Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(types): bundle client types #9966

Merged
merged 9 commits into from
Sep 24, 2022
Merged

Conversation

sapphi-red
Copy link
Member

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:

This PR deprecates:

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
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • 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.

@sapphi-red sapphi-red added the p2-nice-to-have Not breaking anything but nice to have (priority) label Sep 2, 2022
@sapphi-red sapphi-red force-pushed the refactor/types branch 2 times, most recently from 9fbfe17 to 2d925f8 Compare September 2, 2022 11:54
@patak-dev
Copy link
Member

/ecosystem-ci run

@vite-ecosystem-ci
Copy link

vite-ecosystem-ci bot commented Sep 2, 2022

📝 Ran ecosystem CI: Open

suite result
astro ✅ success
iles ✅ success
ladle ✅ success
laravel ✅ success
marko ✅ success
nuxt-framework ✅ success
rakkas ✅ success
storybook ❌ failure
svelte ✅ success
vite-plugin-ssr ✅ success
vite-setup-catalogue ✅ success
vitepress ❌ failure
vitest ✅ success
windicss ✅ success

@patak-dev patak-dev added this to the 3.2 milestone Sep 2, 2022
@patak-dev
Copy link
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.

@sapphi-red
Copy link
Member Author

/ecosystem-ci run

@vite-ecosystem-ci
Copy link

vite-ecosystem-ci bot commented Sep 3, 2022

📝 Ran ecosystem CI: Open

suite result
astro ✅ success
iles ✅ success
ladle ✅ success
laravel ✅ success
marko ✅ success
nuxt-framework ✅ success
rakkas ✅ success
storybook ❌ failure
svelte ✅ success
vite-plugin-ssr ✅ success
vite-setup-catalogue ✅ success
vitepress ✅ success
vitest ✅ success
windicss ✅ success

import type {
ImportMeta as ViteImportMeta,
ImportMetaEnv as ViteImportMetaEnv
// eslint-disable-next-line node/no-missing-import -- use .js for `moduleResolution: "nodenext"`
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")

@Princesseuh
Copy link
Contributor

Tried this PR inside Astro to see if it fixed #9827 and everything worked 👍 Nice work!

patak-dev
patak-dev previously approved these changes Sep 22, 2022
@sapphi-red
Copy link
Member Author

/ecosystem-ci run

@vite-ecosystem-ci
Copy link

vite-ecosystem-ci bot commented Sep 24, 2022

📝 Ran ecosystem CI: Open

suite result
astro ✅ success
iles ✅ success
ladle ❌ failure
laravel ❌ failure
marko ✅ success
nuxt-framework ✅ success
rakkas ✅ success
storybook ✅ success
svelte ✅ success
vite-plugin-ssr ✅ success
vite-setup-catalogue ✅ success
vitepress ✅ success
vitest ✅ success
windicss ✅ success

@patak-dev patak-dev merged commit da632bf into vitejs:main Sep 24, 2022
@sapphi-red sapphi-red deleted the refactor/types branch September 24, 2022 12:23
tony19 added a commit to tony19/vite-docs-template that referenced this pull request Sep 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants