refactor(types): bundle client types#9966
Merged
patak-cat merged 9 commits intovitejs:mainfrom Sep 24, 2022
Merged
Conversation
9fbfe17 to
2d925f8
Compare
2d925f8 to
b8f6194
Compare
Member
|
/ecosystem-ci run |
|
📝 Ran ecosystem CI: Open
|
Member
|
Amazing work @sapphi-red! I think to play safe it is better to merge this one on the 3.2 beta, and we could delete the facade in v4. |
Member
Author
|
/ecosystem-ci run |
|
📝 Ran ecosystem CI: Open
|
sapphi-red
commented
Sep 3, 2022
| import type { | ||
| ImportMeta as ViteImportMeta, | ||
| ImportMetaEnv as ViteImportMetaEnv | ||
| // eslint-disable-next-line node/no-missing-import -- use .js for `moduleResolution: "nodenext"` |
Member
Author
There was a problem hiding this comment.
When vite/client or vite/import-meta is used from a file using moduleResolution: "nodenext", this import needs to be vite/client/types or vite/client/types.js... (vitepress uses moduleResolution: "nodenext")
9 tasks
Contributor
|
Tried this PR inside Astro to see if it fixed #9827 and everything worked 👍 Nice work! |
patak-cat
previously approved these changes
Sep 22, 2022
Member
Author
|
/ecosystem-ci run |
|
📝 Ran ecosystem CI: Open
|
patak-cat
approved these changes
Sep 24, 2022
tony19
added a commit
to tony19/vite-docs-template
that referenced
this pull request
Sep 24, 2022
Patch missed by ryu-cho related vitejs/vite#9966
4 tasks
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Moved
d.tsfiles undertypestosrc/dep-typesandsrc/typesand use api-extractor to bundle client types.This solves following issues:
'vite'and'types/*'typesdirectory is not included inexportsfield but was included in packagetypesdirectory included dep types and it was a bit hard to differentiate types of deps or notvite/types/importMetacan be imported byvite/import-metaor importViteImportMetatype fromvite/client/typesThis PR deprecates:
import 'vite/types/*'import 'vite/client/types'orimport 'vite'import { /* import.meta.glob related types */ } from 'vite'(related: vite config files can't be compiled withoutdomtypes #9813)import 'vite/client/types'I added facade files under
typesdirectory so there should be backward compatibility.Additional context
https://vitejs.dev/guide/api-plugin.html#typescript-for-custom-events
This example was not working for
server.ws.send('custom:foo', { msg: 'foo' }). So I updated the docs.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123).