vite
vite copied to clipboard
refactor(types): bundle client types
Description
Moved d.ts
files under types
to src/dep-types
and src/types
and use api-extractor to bundle client types.
This solves following issues:
- prevent inconsistency between
'vite'
and'types/*'
- #9962
- #6433, #6456, #6531
-
types
directory is not included inexports
field but was included in package- it was not clear whether this is intended to be exported
-
types
directory included dep types and it was a bit hard to differentiate types of deps or not - fixes #9827
- Now
vite/types/importMeta
can be imported byvite/import-meta
or importViteImportMeta
type fromvite/client/types
- Now
This PR deprecates:
-
import 'vite/types/*'
- Use
import 'vite/client/types'
orimport 'vite'
- Use
-
import { /* import.meta.glob related types */ } from 'vite'
(related: #9813)- Use
import 'vite/client/types'
- Use
I added facade files under types
directory 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?
- [ ] Bug fix
- [ ] New Feature
- [ ] Documentation update
- [x] Other
Before submitting the PR, please make sure you do the following
- [x] Read the Contributing Guidelines.
- [x] Read the Pull Request Guidelines and follow the Commit Convention.
- [x] Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
- [x] Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g.
fixes #123
). - [ ] Ideally, include relevant tests that fail without this PR but pass with it.
/ecosystem-ci run
📝 Ran ecosystem CI: Open
suite | result |
---|---|
astro | :white_check_mark: success |
iles | :white_check_mark: success |
ladle | :white_check_mark: success |
laravel | :white_check_mark: success |
marko | :white_check_mark: success |
nuxt-framework | :white_check_mark: success |
rakkas | :white_check_mark: success |
storybook | :x: failure |
svelte | :white_check_mark: success |
vite-plugin-ssr | :white_check_mark: success |
vite-setup-catalogue | :white_check_mark: success |
vitepress | :x: failure |
vitest | :white_check_mark: success |
windicss | :white_check_mark: success |
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.
/ecosystem-ci run
📝 Ran ecosystem CI: Open
suite | result |
---|---|
astro | :white_check_mark: success |
iles | :white_check_mark: success |
ladle | :white_check_mark: success |
laravel | :white_check_mark: success |
marko | :white_check_mark: success |
nuxt-framework | :white_check_mark: success |
rakkas | :white_check_mark: success |
storybook | :x: failure |
svelte | :white_check_mark: success |
vite-plugin-ssr | :white_check_mark: success |
vite-setup-catalogue | :white_check_mark: success |
vitepress | :white_check_mark: success |
vitest | :white_check_mark: success |
windicss | :white_check_mark: success |
Tried this PR inside Astro to see if it fixed #9827 and everything worked 👍 Nice work!
/ecosystem-ci run
📝 Ran ecosystem CI: Open
suite | result |
---|---|
astro | :white_check_mark: success |
iles | :white_check_mark: success |
ladle | :x: failure |
laravel | :x: failure |
marko | :white_check_mark: success |
nuxt-framework | :white_check_mark: success |
rakkas | :white_check_mark: success |
storybook | :white_check_mark: success |
svelte | :white_check_mark: success |
vite-plugin-ssr | :white_check_mark: success |
vite-setup-catalogue | :white_check_mark: success |
vitepress | :white_check_mark: success |
vitest | :white_check_mark: success |
windicss | :white_check_mark: success |