From 20422fb6a60076c4f268284404bb36d5448b2d27 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 22 Sep 2025 03:06:08 +0000 Subject: [PATCH 1/8] fix(deps): update all non-major dependencies (#20811) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b2c99c63..c6b096fb 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "docs-serve": "vitepress serve" }, "devDependencies": { - "@shikijs/vitepress-twoslash": "^3.12.2", + "@shikijs/vitepress-twoslash": "^3.13.0", "@types/express": "^5.0.3", "feed": "^5.1.0", "gsap": "^3.13.0", From a71f9f6b6373620f40c82b17b5be03af1590bf9b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 22 Sep 2025 03:33:18 +0000 Subject: [PATCH 2/8] chore(deps): update actions/setup-node action to v5 (#20812) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- guide/static-deploy-github-pages.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/static-deploy-github-pages.yaml b/guide/static-deploy-github-pages.yaml index dfd3da33..d7276280 100644 --- a/guide/static-deploy-github-pages.yaml +++ b/guide/static-deploy-github-pages.yaml @@ -35,7 +35,7 @@ jobs: - name: Checkout uses: actions/checkout@v5 - name: Set up Node - uses: actions/setup-node@v4 + uses: actions/setup-node@v5 with: node-version: lts/* cache: 'npm' From 07ca567cd9bdb27e7d095bdff78a2a802df43345 Mon Sep 17 00:00:00 2001 From: Adithyaa Saravanam <148425378+adithyaa-s@users.noreply.github.com> Date: Mon, 22 Sep 2025 10:16:12 +0530 Subject: [PATCH 3/8] docs: add `import.meta.env.DEV` example (#20352) Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com> --- guide/env-and-mode.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/guide/env-and-mode.md b/guide/env-and-mode.md index a963f155..205cf2f9 100644 --- a/guide/env-and-mode.md +++ b/guide/env-and-mode.md @@ -2,6 +2,17 @@ Vite exposes certain constants under the special `import.meta.env` object. These constants are defined as global variables during dev and statically replaced at build time to make tree-shaking effective. +:::details Example + +```js +if (import.meta.env.DEV) { + // code inside here will be tree-shaken in production builds + console.log('Dev mode') +} +``` + +::: + ## Built-in Constants Some built-in constants are available in all cases: From 771f74c95078789a9cbad3a7abbfe0b51a3ab117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Barr=C3=A9?= Date: Mon, 22 Sep 2025 14:09:43 +0200 Subject: [PATCH 4/8] feat(create-vite): set types compiler option in tsconfigs (#20132) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 翠 --- guide/api-hmr.md | 10 +++++++--- guide/env-and-mode.md | 2 -- guide/features.md | 28 +++++++++++++++++----------- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/guide/api-hmr.md b/guide/api-hmr.md index f53db42a..ac6b7864 100644 --- a/guide/api-hmr.md +++ b/guide/api-hmr.md @@ -62,10 +62,14 @@ if (import.meta.hot) { ## IntelliSense for TypeScript -Vite provides type definitions for `import.meta.hot` in [`vite/client.d.ts`](https://github.com/vitejs/vite/blob/main/packages/vite/client.d.ts). You can create an `vite-env.d.ts` in the `src` directory so TypeScript picks up the type definitions: +Vite provides type definitions for `import.meta.hot` in [`vite/client.d.ts`](https://github.com/vitejs/vite/blob/main/packages/vite/client.d.ts). You can add "vite/client" in the `tsconfig.json` so TypeScript picks up the type definitions: -```ts [vite-env.d.ts] -/// +```json [tsconfig.json] +{ + "compilerOptions": { + "types": ["vite/client"] + } +} ``` ## `hot.accept(cb)` diff --git a/guide/env-and-mode.md b/guide/env-and-mode.md index 205cf2f9..9953a204 100644 --- a/guide/env-and-mode.md +++ b/guide/env-and-mode.md @@ -117,8 +117,6 @@ By default, Vite provides type definitions for `import.meta.env` in [`vite/clien To achieve this, you can create an `vite-env.d.ts` in `src` directory, then augment `ImportMetaEnv` like this: ```typescript [vite-env.d.ts] -/// - interface ViteTypeOptions { // By adding this line, you can make the type of ImportMetaEnv strict // to disallow unknown keys. diff --git a/guide/features.md b/guide/features.md index 8b87e422..39b9d638 100644 --- a/guide/features.md +++ b/guide/features.md @@ -113,15 +113,7 @@ Vite starter templates have `"skipLibCheck": "true"` by default to avoid typeche ### Client Types -Vite's default types are for its Node.js API. To shim the environment of client-side code in a Vite application, add a `d.ts` declaration file: - -```typescript -/// -``` - -::: details Using `compilerOptions.types` - -Alternatively, you can add `vite/client` to `compilerOptions.types` inside `tsconfig.json`: +Vite's default types are for its Node.js API. To shim the environment of client-side code in a Vite application, you can add `vite/client` to `compilerOptions.types` inside `tsconfig.json`: ```json [tsconfig.json] { @@ -131,7 +123,15 @@ Alternatively, you can add `vite/client` to `compilerOptions.types` inside `tsco } ``` -Note that if [`compilerOptions.types`](https://www.typescriptlang.org/tsconfig#types) is specified, only these packages will be included in the global scope (instead of all visible ”@types” packages). +Note that if [`compilerOptions.types`](https://www.typescriptlang.org/tsconfig#types) is specified, only these packages will be included in the global scope (instead of all visible ”@types” packages). This is recommended since TS 5.9. + +::: details Using triple-slash directive + +Alternatively, you can add a `d.ts` declaration file: + +```typescript [vite-env.d.ts] +/// +``` ::: @@ -153,7 +153,13 @@ For example, to make the default import of `*.svg` a React component: export default content } ``` -- The file containing the reference to `vite/client` (normally `vite-env.d.ts`): +- If you are using `compilerOptions.types`, ensure the file is included in `tsconfig.json`: + ```json [tsconfig.json] + { + "include": ["src", "./vite-env-override.d.ts"] + } + ``` +- If you are using triple-slash directives, update the file containing the reference to `vite/client` (normally `vite-env.d.ts`): ```ts /// /// From 8885216737ac0478e1ca5271dd1a259d9fdadde3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0?= Date: Mon, 22 Sep 2025 21:11:18 +0900 Subject: [PATCH 5/8] feat(create-vite): scaffold with rolldown-vite (#20739) --- guide/rolldown.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/guide/rolldown.md b/guide/rolldown.md index 428bcb6b..2da863e2 100644 --- a/guide/rolldown.md +++ b/guide/rolldown.md @@ -85,6 +85,8 @@ If you use a Vitepress or a meta framework that has Vite as peer dependency, you After adding these overrides, reinstall your dependencies and start your development server or build your project as usual. No further configuration changes are required. +If you are starting a new project, you can use `create-vite` as normal for rolldown-vite, too. The latest version will ask you whether to use `rolldown-vite` or not. + ## Known Limitations While Rolldown aims to be a drop-in replacement for Rollup, there are features that are still being implemented and minor intentional behavior differences. For a comprehensive list, please refer to [this GitHub PR](https://github.com/vitejs/rolldown-vite/pull/84#issue-2903144667) which is regularly updated. From ebc496f35803490509749b771e6439c91143bdec Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Tue, 23 Sep 2025 20:11:22 +0800 Subject: [PATCH 6/8] fix: resolved deps --- package.json | 26 +-------- pnpm-lock.yaml | 156 +++++++++++++++++-------------------------------- 2 files changed, 54 insertions(+), 128 deletions(-) diff --git a/package.json b/package.json index c815d299..f53068a8 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,4 @@ { -<<<<<<< HEAD "name": "vite-docs-cn", "version": "1.0.0", "description": "Vite.js documentation Chinese translation.", @@ -9,7 +8,7 @@ "private": true, "license": "CC BY-NC-SA 4.0", "devDependencies": { - "@shikijs/vitepress-twoslash": "^3.12.2", + "@shikijs/vitepress-twoslash": "^3.13.0", "@type-challenges/utils": "^0.1.1", "@types/express": "^5.0.3", "@types/node": "^20.9.2", @@ -40,27 +39,4 @@ "gitHooks": { "commit-msg": "node scripts/verifyCommit.js" } -======= - "name": "@vitejs/monorepo-docs", - "private": true, - "type": "module", - "scripts": { - "typecheck": "vue-tsc", - "docs": "vitepress dev", - "docs-build": "vitepress build", - "docs-serve": "vitepress serve" - }, - "devDependencies": { - "@shikijs/vitepress-twoslash": "^3.13.0", - "@types/express": "^5.0.3", - "feed": "^5.1.0", - "gsap": "^3.13.0", - "markdown-it-image-size": "^14.8.0", - "vitepress": "^2.0.0-alpha.12", - "vitepress-plugin-group-icons": "^1.6.3", - "vitepress-plugin-llms": "^1.7.5", - "vue": "^3.5.21", - "vue-tsc": "^3.0.7" - } ->>>>>>> 8885216737ac0478e1ca5271dd1a259d9fdadde3 } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a5424109..92630145 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: devDependencies: '@shikijs/vitepress-twoslash': - specifier: ^3.12.2 - version: 3.12.2(typescript@5.4.5) + specifier: ^3.13.0 + version: 3.13.0(typescript@5.4.5) '@type-challenges/utils': specifier: ^0.1.1 version: 0.1.1 @@ -479,32 +479,32 @@ packages: cpu: [x64] os: [win32] - '@shikijs/core@3.12.2': - resolution: {integrity: sha512-L1Safnhra3tX/oJK5kYHaWmLEBJi1irASwewzY3taX5ibyXyMkkSDZlq01qigjryOBwrXSdFgTiZ3ryzSNeu7Q==} + '@shikijs/core@3.13.0': + resolution: {integrity: sha512-3P8rGsg2Eh2qIHekwuQjzWhKI4jV97PhvYjYUzGqjvJfqdQPz+nMlfWahU24GZAyW1FxFI1sYjyhfh5CoLmIUA==} '@shikijs/core@3.7.0': resolution: {integrity: sha512-yilc0S9HvTPyahHpcum8eonYrQtmGTU0lbtwxhA6jHv4Bm1cAdlPFRCJX4AHebkCm75aKTjjRAW+DezqD1b/cg==} - '@shikijs/engine-javascript@3.12.2': - resolution: {integrity: sha512-Nm3/azSsaVS7hk6EwtHEnTythjQfwvrO5tKqMlaH9TwG1P+PNaR8M0EAKZ+GaH2DFwvcr4iSfTveyxMIvXEHMw==} + '@shikijs/engine-javascript@3.13.0': + resolution: {integrity: sha512-Ty7xv32XCp8u0eQt8rItpMs6rU9Ki6LJ1dQOW3V/56PKDcpvfHPnYFbsx5FFUP2Yim34m/UkazidamMNVR4vKg==} '@shikijs/engine-javascript@3.7.0': resolution: {integrity: sha512-0t17s03Cbv+ZcUvv+y33GtX75WBLQELgNdVghnsdhTgU3hVcWcMsoP6Lb0nDTl95ZJfbP1mVMO0p3byVh3uuzA==} - '@shikijs/engine-oniguruma@3.12.2': - resolution: {integrity: sha512-hozwnFHsLvujK4/CPVHNo3Bcg2EsnG8krI/ZQ2FlBlCRpPZW4XAEQmEwqegJsypsTAN9ehu2tEYe30lYKSZW/w==} + '@shikijs/engine-oniguruma@3.13.0': + resolution: {integrity: sha512-O42rBGr4UDSlhT2ZFMxqM7QzIU+IcpoTMzb3W7AlziI1ZF7R8eS2M0yt5Ry35nnnTX/LTLXFPUjRFCIW+Operg==} '@shikijs/engine-oniguruma@3.7.0': resolution: {integrity: sha512-5BxcD6LjVWsGu4xyaBC5bu8LdNgPCVBnAkWTtOCs/CZxcB22L8rcoWfv7Hh/3WooVjBZmFtyxhgvkQFedPGnFw==} - '@shikijs/langs@3.12.2': - resolution: {integrity: sha512-bVx5PfuZHDSHoBal+KzJZGheFuyH4qwwcwG/n+MsWno5cTlKmaNtTsGzJpHYQ8YPbB5BdEdKU1rga5/6JGY8ww==} + '@shikijs/langs@3.13.0': + resolution: {integrity: sha512-672c3WAETDYHwrRP0yLy3W1QYB89Hbpj+pO4KhxK6FzIrDI2FoEXNiNCut6BQmEApYLfuYfpgOZaqbY+E9b8wQ==} '@shikijs/langs@3.7.0': resolution: {integrity: sha512-1zYtdfXLr9xDKLTGy5kb7O0zDQsxXiIsw1iIBcNOO8Yi5/Y1qDbJ+0VsFoqTlzdmneO8Ij35g7QKF8kcLyznCQ==} - '@shikijs/themes@3.12.2': - resolution: {integrity: sha512-fTR3QAgnwYpfGczpIbzPjlRnxyONJOerguQv1iwpyQZ9QXX4qy/XFQqXlf17XTsorxnHoJGbH/LXBvwtqDsF5A==} + '@shikijs/themes@3.13.0': + resolution: {integrity: sha512-Vxw1Nm1/Od8jyA7QuAenaV78BG2nSr3/gCGdBkLpfLscddCkzkL36Q5b67SrLLfvAJTOUzW39x4FHVCFriPVgg==} '@shikijs/themes@3.7.0': resolution: {integrity: sha512-VJx8497iZPy5zLiiCTSIaOChIcKQwR0FebwE9S3rcN0+J/GTWwQ1v/bqhTbpbY3zybPKeO8wdammqkpXc4NVjQ==} @@ -512,19 +512,19 @@ packages: '@shikijs/transformers@3.7.0': resolution: {integrity: sha512-VplaqIMRNsNOorCXJHkbF5S0pT6xm8Z/s7w7OPZLohf8tR93XH0krvUafpNy/ozEylrWuShJF0+ftEB+wFRwGA==} - '@shikijs/twoslash@3.12.2': - resolution: {integrity: sha512-JthKvEvyE/gbu3u693mhNhEO6GYP1vetrwgEfqTAsT/G9AJ6nf7g7JVqdTSs+axdfilGWzZKeYdjfyanu/v5AA==} + '@shikijs/twoslash@3.13.0': + resolution: {integrity: sha512-OmNKNoZ8Hevt4VKQHfJL+hrsrqLSnW/Nz7RMutuBqXBCIYZWk80HnF9pcXEwRmy9MN0MGRmZCW2rDDP8K7Bxkw==} peerDependencies: typescript: '>=5.5.0' - '@shikijs/types@3.12.2': - resolution: {integrity: sha512-K5UIBzxCyv0YoxN3LMrKB9zuhp1bV+LgewxuVwHdl4Gz5oePoUFrr9EfgJlGlDeXCU1b/yhdnXeuRvAnz8HN8Q==} + '@shikijs/types@3.13.0': + resolution: {integrity: sha512-oM9P+NCFri/mmQ8LoFGVfVyemm5Hi27330zuOBp0annwJdKH1kOLndw3zCtAVDehPLg9fKqoEx3Ht/wNZxolfw==} '@shikijs/types@3.7.0': resolution: {integrity: sha512-MGaLeaRlSWpnP0XSAum3kP3a8vtcTsITqoEPYdt3lQG3YCdQH4DnEhodkYcNMcU0uW0RffhoD1O3e0vG5eSBBg==} - '@shikijs/vitepress-twoslash@3.12.2': - resolution: {integrity: sha512-aOuy+69iuTI8MMAy2htMdB6MSwmC5/gfeWDs0TbEkEc2yBaA6dfM5XZi0LpsJeJFSgvIROaxH5pvgdrENTWfpg==} + '@shikijs/vitepress-twoslash@3.13.0': + resolution: {integrity: sha512-YwL/Wsyl1Vfg9wcWFJbpqKn7vySaCKNsSxYL3v5J/z+7Qm+fu15JXrtqEJbT8h/STWeaO7pnR6npgoPQEj8Ewg==} '@shikijs/vscode-textmate@10.0.2': resolution: {integrity: sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==} @@ -601,30 +601,18 @@ packages: vite: ^5.0.0 || ^6.0.0 || ^7.0.0 vue: ^3.2.25 - '@volar/language-core@2.4.22': - resolution: {integrity: sha512-gp4M7Di5KgNyIyO903wTClYBavRt6UyFNpc5LWfyZr1lBsTUY+QrVZfmbNF2aCyfklBOVk9YC4p+zkwoyT7ECg==} - '@volar/language-core@2.4.23': resolution: {integrity: sha512-hEEd5ET/oSmBC6pi1j6NaNYRWoAiDhINbT8rmwtINugR39loROSlufGdYMF9TaKGfz+ViGs1Idi3mAhnuPcoGQ==} - '@volar/source-map@2.4.22': - resolution: {integrity: sha512-L2nVr/1vei0xKRgO2tYVXtJYd09HTRjaZi418e85Q+QdbbqA8h7bBjfNyPPSsjnrOO4l4kaAo78c8SQUAdHvgA==} - '@volar/source-map@2.4.23': resolution: {integrity: sha512-Z1Uc8IB57Lm6k7q6KIDu/p+JWtf3xsXJqAX/5r18hYOTpJyBn0KXUR8oTJ4WFYOcDzWC9n3IflGgHowx6U6z9Q==} '@volar/typescript@2.4.23': resolution: {integrity: sha512-lAB5zJghWxVPqfcStmAP1ZqQacMpe90UrP5RJ3arDyrhy4aCUQqmxPPLB2PWDKugvylmO41ljK7vZ+t6INMTag==} - '@vue/compiler-core@3.5.20': - resolution: {integrity: sha512-8TWXUyiqFd3GmP4JTX9hbiTFRwYHgVL/vr3cqhr4YQ258+9FADwvj7golk2sWNGHR67QgmCZ8gz80nQcMokhwg==} - '@vue/compiler-core@3.5.21': resolution: {integrity: sha512-8i+LZ0vf6ZgII5Z9XmUvrCyEzocvWT+TeR2VBUVlzIH6Tyv57E20mPZ1bCS+tbejgUgmjrEh7q/0F0bibskAmw==} - '@vue/compiler-dom@3.5.20': - resolution: {integrity: sha512-whB44M59XKjqUEYOMPYU0ijUV0G+4fdrHVKDe32abNdX/kJe1NUEMqsi4cwzXa9kyM9w5S8WqFsrfo1ogtBZGQ==} - '@vue/compiler-dom@3.5.21': resolution: {integrity: sha512-jNtbu/u97wiyEBJlJ9kmdw7tAr5Vy0Aj5CgQmo+6pxWNQhXZDPsRr1UWPN4v3Zf82s2H3kF51IbzZ4jMWAgPlQ==} @@ -646,14 +634,6 @@ packages: '@vue/devtools-shared@7.7.7': resolution: {integrity: sha512-+udSj47aRl5aKb0memBvcUG9koarqnxNM5yjuREvqwK6T3ap4mn3Zqqc17QrBFTqSMjr3HK1cvStEZpMDpfdyw==} - '@vue/language-core@3.0.5': - resolution: {integrity: sha512-gCEjn9Ik7I/seHVNIEipOm8W+f3/kg60e8s1IgIkMYma2wu9ZGUTMv3mSL2bX+Md2L8fslceJ4SU8j1fgSRoiw==} - peerDependencies: - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - '@vue/language-core@3.0.7': resolution: {integrity: sha512-0sqqyqJ0Gn33JH3TdIsZLCZZ8Gr4kwlg8iYOnOrDDkJKSjFurlQY/bEFQx5zs7SX2C/bjMkmPYq/NiyY1fTOkw==} peerDependencies: @@ -679,9 +659,6 @@ packages: '@vue/shared@3.5.17': resolution: {integrity: sha512-CabR+UN630VnsJO/jHWYBC1YVXyMq94KKp6iF5MQgZJs5I8cmjw6oVMO1oDbtBkENSHSSn/UadWlW/OAgdmKrg==} - '@vue/shared@3.5.20': - resolution: {integrity: sha512-SoRGP596KU/ig6TfgkCMbXkr4YJ91n/QSdMuqeP5r3hVIYA3CPHUBCc7Skak0EAKV+5lL4KyIh61VA/pK1CIAA==} - '@vue/shared@3.5.21': resolution: {integrity: sha512-+2k1EQpnYuVuu3N7atWyG3/xoFWIVJZq4Mz8XNOdScFI0etES75fbny/oU4lKWk/577P1zmg0ioYvpGEDZ3DLw==} @@ -1033,6 +1010,9 @@ packages: magic-string@0.30.18: resolution: {integrity: sha512-yi8swmWbO17qHhwIBNeeZxTceJMeBvWJaId6dyvTSOwTipqeHhMhOrz6513r1sOKnpvQ7zkhlG8tPrpilwTxHQ==} + magic-string@0.30.19: + resolution: {integrity: sha512-2N21sPY9Ws53PZvsEpVtNuSW+ScYbQdp4b9qUaL+9QkHUrGFKo56Lg9Emg5s9V/qrtNBmiR01sYhUOwu3H+VOw==} + mark.js@8.11.1: resolution: {integrity: sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ==} @@ -1321,8 +1301,8 @@ packages: resolution: {integrity: sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==} engines: {node: '>=0.10.0'} - shiki@3.12.2: - resolution: {integrity: sha512-uIrKI+f9IPz1zDT+GMz+0RjzKJiijVr6WDWm9Pe3NNY6QigKCfifCEv9v9R2mDASKKjzjQ2QpFLcxaR3iHSnMA==} + shiki@3.13.0: + resolution: {integrity: sha512-aZW4l8Og16CokuCLf8CF8kq+KK2yOygapU5m3+hoGw0Mdosc6fPitjM+ujYarppj5ZIKGyPDPP1vqmQhr+5/0g==} shiki@3.7.0: resolution: {integrity: sha512-ZcI4UT9n6N2pDuM2n3Jbk0sR4Swzq43nLPgS/4h0E3B/NrFn2HKElrDtceSf8Zx/OWYOo7G1SAtBLypCp+YXqg==} @@ -1914,9 +1894,9 @@ snapshots: '@rollup/rollup-win32-x64-msvc@4.44.0': optional: true - '@shikijs/core@3.12.2': + '@shikijs/core@3.13.0': dependencies: - '@shikijs/types': 3.12.2 + '@shikijs/types': 3.13.0 '@shikijs/vscode-textmate': 10.0.2 '@types/hast': 3.0.4 hast-util-to-html: 9.0.5 @@ -1928,9 +1908,9 @@ snapshots: '@types/hast': 3.0.4 hast-util-to-html: 9.0.5 - '@shikijs/engine-javascript@3.12.2': + '@shikijs/engine-javascript@3.13.0': dependencies: - '@shikijs/types': 3.12.2 + '@shikijs/types': 3.13.0 '@shikijs/vscode-textmate': 10.0.2 oniguruma-to-es: 4.3.3 @@ -1940,9 +1920,9 @@ snapshots: '@shikijs/vscode-textmate': 10.0.2 oniguruma-to-es: 4.3.3 - '@shikijs/engine-oniguruma@3.12.2': + '@shikijs/engine-oniguruma@3.13.0': dependencies: - '@shikijs/types': 3.12.2 + '@shikijs/types': 3.13.0 '@shikijs/vscode-textmate': 10.0.2 '@shikijs/engine-oniguruma@3.7.0': @@ -1950,17 +1930,17 @@ snapshots: '@shikijs/types': 3.7.0 '@shikijs/vscode-textmate': 10.0.2 - '@shikijs/langs@3.12.2': + '@shikijs/langs@3.13.0': dependencies: - '@shikijs/types': 3.12.2 + '@shikijs/types': 3.13.0 '@shikijs/langs@3.7.0': dependencies: '@shikijs/types': 3.7.0 - '@shikijs/themes@3.12.2': + '@shikijs/themes@3.13.0': dependencies: - '@shikijs/types': 3.12.2 + '@shikijs/types': 3.13.0 '@shikijs/themes@3.7.0': dependencies: @@ -1971,16 +1951,16 @@ snapshots: '@shikijs/core': 3.7.0 '@shikijs/types': 3.7.0 - '@shikijs/twoslash@3.12.2(typescript@5.4.5)': + '@shikijs/twoslash@3.13.0(typescript@5.4.5)': dependencies: - '@shikijs/core': 3.12.2 - '@shikijs/types': 3.12.2 + '@shikijs/core': 3.13.0 + '@shikijs/types': 3.13.0 twoslash: 0.3.4(typescript@5.4.5) typescript: 5.4.5 transitivePeerDependencies: - supports-color - '@shikijs/types@3.12.2': + '@shikijs/types@3.13.0': dependencies: '@shikijs/vscode-textmate': 10.0.2 '@types/hast': 3.0.4 @@ -1990,18 +1970,18 @@ snapshots: '@shikijs/vscode-textmate': 10.0.2 '@types/hast': 3.0.4 - '@shikijs/vitepress-twoslash@3.12.2(typescript@5.4.5)': + '@shikijs/vitepress-twoslash@3.13.0(typescript@5.4.5)': dependencies: - '@shikijs/twoslash': 3.12.2(typescript@5.4.5) + '@shikijs/twoslash': 3.13.0(typescript@5.4.5) floating-vue: 5.2.2(vue@3.5.21(typescript@5.4.5)) lz-string: 1.5.0 - magic-string: 0.30.18 + magic-string: 0.30.19 markdown-it: 14.1.0 mdast-util-from-markdown: 2.0.2 mdast-util-gfm: 3.1.0 mdast-util-to-hast: 13.2.0 ohash: 2.0.11 - shiki: 3.12.2 + shiki: 3.13.0 twoslash: 0.3.4(typescript@5.4.5) twoslash-vue: 0.3.4(typescript@5.4.5) vue: 3.5.21(typescript@5.4.5) @@ -2094,16 +2074,10 @@ snapshots: vite: 7.0.4(@types/node@20.12.12) vue: 3.5.21(typescript@5.4.5) - '@volar/language-core@2.4.22': - dependencies: - '@volar/source-map': 2.4.22 - '@volar/language-core@2.4.23': dependencies: '@volar/source-map': 2.4.23 - '@volar/source-map@2.4.22': {} - '@volar/source-map@2.4.23': {} '@volar/typescript@2.4.23': @@ -2112,14 +2086,6 @@ snapshots: path-browserify: 1.0.1 vscode-uri: 3.1.0 - '@vue/compiler-core@3.5.20': - dependencies: - '@babel/parser': 7.28.3 - '@vue/shared': 3.5.20 - entities: 4.5.0 - estree-walker: 2.0.2 - source-map-js: 1.2.1 - '@vue/compiler-core@3.5.21': dependencies: '@babel/parser': 7.28.3 @@ -2128,11 +2094,6 @@ snapshots: estree-walker: 2.0.2 source-map-js: 1.2.1 - '@vue/compiler-dom@3.5.20': - dependencies: - '@vue/compiler-core': 3.5.20 - '@vue/shared': 3.5.20 - '@vue/compiler-dom@3.5.21': dependencies: '@vue/compiler-core': 3.5.21 @@ -2178,19 +2139,6 @@ snapshots: dependencies: rfdc: 1.4.1 - '@vue/language-core@3.0.5(typescript@5.4.5)': - dependencies: - '@volar/language-core': 2.4.22 - '@vue/compiler-dom': 3.5.20 - '@vue/compiler-vue2': 2.7.16 - '@vue/shared': 3.5.20 - alien-signals: 2.0.6 - muggle-string: 0.4.1 - path-browserify: 1.0.1 - picomatch: 4.0.2 - optionalDependencies: - typescript: 5.4.5 - '@vue/language-core@3.0.7(typescript@5.4.5)': dependencies: '@volar/language-core': 2.4.23 @@ -2228,8 +2176,6 @@ snapshots: '@vue/shared@3.5.17': {} - '@vue/shared@3.5.20': {} - '@vue/shared@3.5.21': {} '@vueuse/core@13.4.0(vue@3.5.21(typescript@5.4.5))': @@ -2536,6 +2482,10 @@ snapshots: dependencies: '@jridgewell/sourcemap-codec': 1.5.5 + magic-string@0.30.19: + dependencies: + '@jridgewell/sourcemap-codec': 1.5.5 + mark.js@8.11.1: {} markdown-it-image-size@14.7.0(markdown-it@14.1.0): @@ -2999,14 +2949,14 @@ snapshots: shebang-regex@1.0.0: {} - shiki@3.12.2: + shiki@3.13.0: dependencies: - '@shikijs/core': 3.12.2 - '@shikijs/engine-javascript': 3.12.2 - '@shikijs/engine-oniguruma': 3.12.2 - '@shikijs/langs': 3.12.2 - '@shikijs/themes': 3.12.2 - '@shikijs/types': 3.12.2 + '@shikijs/core': 3.13.0 + '@shikijs/engine-javascript': 3.13.0 + '@shikijs/engine-oniguruma': 3.13.0 + '@shikijs/langs': 3.13.0 + '@shikijs/themes': 3.13.0 + '@shikijs/types': 3.13.0 '@shikijs/vscode-textmate': 10.0.2 '@types/hast': 3.0.4 @@ -3087,7 +3037,7 @@ snapshots: twoslash-vue@0.3.4(typescript@5.4.5): dependencies: - '@vue/language-core': 3.0.5(typescript@5.4.5) + '@vue/language-core': 3.0.7(typescript@5.4.5) twoslash: 0.3.4(typescript@5.4.5) twoslash-protocol: 0.3.4 typescript: 5.4.5 From 8cef664b0ba406caaf7d513f748588ce1959a608 Mon Sep 17 00:00:00 2001 From: Kylin <1159469891@qq.com> Date: Tue, 23 Sep 2025 20:25:36 +0800 Subject: [PATCH 7/8] docs: update content --- guide/api-hmr.md | 8 +------- guide/env-and-mode.md | 8 ++------ guide/features.md | 22 +++------------------- guide/rolldown.md | 8 ++------ 4 files changed, 8 insertions(+), 38 deletions(-) diff --git a/guide/api-hmr.md b/guide/api-hmr.md index c4af7111..a4b8b7bd 100644 --- a/guide/api-hmr.md +++ b/guide/api-hmr.md @@ -60,14 +60,8 @@ if (import.meta.hot) { } ``` -<<<<<<< HEAD ## TypeScript 的智能提示 {#intellisense-for-typescript} -Vite 在 [`vite/client.d.ts`](https://github.com/vitejs/vite/blob/main/packages/vite/client.d.ts) 中为 `import.meta.hot` 提供了类型定义。你可以在 `src` 目录中创建一个 `vite-env.d.ts`,以便 TypeScript 获取类型定义: -======= -## IntelliSense for TypeScript - -Vite provides type definitions for `import.meta.hot` in [`vite/client.d.ts`](https://github.com/vitejs/vite/blob/main/packages/vite/client.d.ts). You can add "vite/client" in the `tsconfig.json` so TypeScript picks up the type definitions: ->>>>>>> 8885216737ac0478e1ca5271dd1a259d9fdadde3 +Vite 在 [`vite/client.d.ts`](https://github.com/vitejs/vite/blob/main/packages/vite/client.d.ts) 中为 `import.meta.hot` 提供了类型定义。你可以在 `tsconfig.json` 中添加 "vite/client",以便 TypeScript 获取这些类型定义: ```json [tsconfig.json] { diff --git a/guide/env-and-mode.md b/guide/env-and-mode.md index 0fd02b95..c3d635a7 100644 --- a/guide/env-and-mode.md +++ b/guide/env-and-mode.md @@ -2,22 +2,18 @@ Vite 在特殊的 `import.meta.env` 对象下暴露了一些常量。这些常量在开发阶段被定义为全局变量,并在构建阶段被静态替换,以使树摇(tree-shaking)更有效。 -<<<<<<< HEAD -## 内置常量 {#built-in-constants} -======= :::details Example ```js if (import.meta.env.DEV) { - // code inside here will be tree-shaken in production builds + // 这里的代码在生产构建中会被 tree-shaking 优化掉 console.log('Dev mode') } ``` ::: -## Built-in Constants ->>>>>>> 8885216737ac0478e1ca5271dd1a259d9fdadde3 +## 内置常量 {#built-in-constants} 一些内置常量在所有情况下都可用: diff --git a/guide/features.md b/guide/features.md index 520f55cd..f795e806 100644 --- a/guide/features.md +++ b/guide/features.md @@ -113,19 +113,7 @@ Vite 启动模板默认情况下会设置 `"skipLibCheck": "true"`,以避免 ### 客户端类型 {#client-types} -<<<<<<< HEAD -Vite 默认的类型定义是写给它的 Node.js API 的。要将其补充到一个 Vite 应用的客户端代码环境中,请添加一个 `d.ts` 声明文件: - -```typescript -/// -``` - -::: details 使用 `compilerOptions.types` - -或者,你也可以将 `vite/client` 添加到 `tsconfig.json` 中的 `compilerOptions.types` 下: -======= -Vite's default types are for its Node.js API. To shim the environment of client-side code in a Vite application, you can add `vite/client` to `compilerOptions.types` inside `tsconfig.json`: ->>>>>>> 8885216737ac0478e1ca5271dd1a259d9fdadde3 +Vite 默认的类型定义是写给它的 Node.js API 的。要将其补充到一个 Vite 应用的客户端代码环境中,你可以在 `tsconfig.json` 中的 `compilerOptions.types` 添加 `vite/client`: ```json [tsconfig.json] { @@ -135,19 +123,15 @@ Vite's default types are for its Node.js API. To shim the environment of client- } ``` -<<<<<<< HEAD -需要注意的是,如果指定了 [`compilerOptions.types`](https://www.typescriptlang.org/tsconfig#types),则只有这些包会被包含在全局作用域内(而不是所有的“@types”包)。 -======= -Note that if [`compilerOptions.types`](https://www.typescriptlang.org/tsconfig#types) is specified, only these packages will be included in the global scope (instead of all visible ”@types” packages). This is recommended since TS 5.9. +需要注意的是,如果指定了 [`compilerOptions.types`](https://www.typescriptlang.org/tsconfig#types),则只有这些包会被包含在全局作用域内(而不是所有的“@types”包)。这是自 TypeScript 5.9 以来推荐的做法。 ::: details Using triple-slash directive -Alternatively, you can add a `d.ts` declaration file: +或者,你可以添加一个 `d.ts` 声明文件: ```typescript [vite-env.d.ts] /// ``` ->>>>>>> 8885216737ac0478e1ca5271dd1a259d9fdadde3 ::: diff --git a/guide/rolldown.md b/guide/rolldown.md index 203a70ec..8cde023b 100644 --- a/guide/rolldown.md +++ b/guide/rolldown.md @@ -85,13 +85,9 @@ Rolldown 专注于三个主要原则: 在添加 overrides 之后,重新安装你的依赖并像往常一样启动你的开发服务器或构建你的项目即可,无需进一步的配置更改。 -<<<<<<< HEAD -## 已知限制 {#known-limitations} -======= -If you are starting a new project, you can use `create-vite` as normal for rolldown-vite, too. The latest version will ask you whether to use `rolldown-vite` or not. +如果你正在启动一个新项目,你也可以像平常一样使用 `create-vite` 来创建 rolldown-vite 项目。最新版本会询问你是否要使用 `rolldown-vite`。 -## Known Limitations ->>>>>>> 8885216737ac0478e1ca5271dd1a259d9fdadde3 +## 已知限制 {#known-limitations} 虽然 Rolldown 的目标是成为 Rollup 的替代品,但还有一些特性正在实现中,以及一些小的有意的行为差异。需要查看完整的列表,请参考 [这个 GitHub PR](https://github.com/vitejs/rolldown-vite/pull/84#issue-2903144667),它会定期更新。 From ef925b53d6412fc7838a6487e414d95b21e116fe Mon Sep 17 00:00:00 2001 From: Kylin <1159469891@qq.com> Date: Tue, 23 Sep 2025 21:32:25 +0800 Subject: [PATCH 8/8] docs: update content --- guide/features.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guide/features.md b/guide/features.md index f795e806..722f2a08 100644 --- a/guide/features.md +++ b/guide/features.md @@ -153,13 +153,13 @@ Vite 默认的类型定义是写给它的 Node.js API 的。要将其补充到 export default content } ``` -- If you are using `compilerOptions.types`, ensure the file is included in `tsconfig.json`: +- 如果你正在使用 `compilerOptions.types`,请确保该文件已包含在 `tsconfig.json` 中: ```json [tsconfig.json] { "include": ["src", "./vite-env-override.d.ts"] } ``` -- If you are using triple-slash directives, update the file containing the reference to `vite/client` (normally `vite-env.d.ts`): +- 如果你正在使用三斜线指令,请更新包含对 `vite/client` 引用的文件(通常是 `vite-env.d.ts`): ```ts /// ///