From fd57a35e7150a0df9e4745d525f69f65275227e2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 23 Jun 2025 11:37:50 +0900 Subject: [PATCH 1/5] fix(deps): update all non-major dependencies (#20271) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f6d81b97..58383da5 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "gsap": "^3.13.0", "vitepress": "^1.6.3", "vitepress-plugin-group-icons": "^1.6.0", - "vitepress-plugin-llms": "^1.5.0", - "vue": "^3.5.16" + "vitepress-plugin-llms": "^1.5.1", + "vue": "^3.5.17" } } From ca804dd5d32d0125c96dc00c609b1a1896a53e5b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 23 Jun 2025 03:18:03 +0000 Subject: [PATCH 2/5] chore(deps): update dependency prettier to v3.6.0 (#20273) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- guide/api-plugin.md | 3 --- guide/backend-integration.md | 3 --- guide/static-deploy.md | 1 - 3 files changed, 7 deletions(-) diff --git a/guide/api-plugin.md b/guide/api-plugin.md index 867ba2c6..8c928e8b 100644 --- a/guide/api-plugin.md +++ b/guide/api-plugin.md @@ -338,7 +338,6 @@ Vite plugins can also provide hooks that serve Vite-specific purposes. These hoo Dedicated hook for transforming HTML entry point files such as `index.html`. The hook receives the current HTML string and a transform context. The context exposes the [`ViteDevServer`](./api-javascript#vitedevserver) instance during dev, and exposes the Rollup output bundle during build. The hook can be async and can return one of the following: - - Transformed HTML string - An array of tag descriptor objects (`{ tag, attrs, children }`) to inject to the existing HTML. Each tag can also specify where it should be injected to (default is prepending to ``) - An object containing both as `{ html, tags }` @@ -417,13 +416,11 @@ Vite plugins can also provide hooks that serve Vite-specific purposes. These hoo server: ViteDevServer } ``` - - `modules` is an array of modules that are affected by the changed file. It's an array because a single file may map to multiple served modules (e.g. Vue SFCs). - `read` is an async read function that returns the content of the file. This is provided because on some systems, the file change callback may fire too fast before the editor finishes updating the file and direct `fs.readFile` will return empty content. The read function passed in normalizes this behavior. The hook can choose to: - - Filter and narrow down the affected module list so that the HMR is more accurate. - Return an empty array and perform a full reload: diff --git a/guide/backend-integration.md b/guide/backend-integration.md index 34319601..5add4902 100644 --- a/guide/backend-integration.md +++ b/guide/backend-integration.md @@ -45,7 +45,6 @@ If you need a custom integration, you can follow the steps in this guide to conf ``` In order to properly serve assets, you have two options: - - Make sure the server is configured to proxy static assets requests to the Vite server - Set [`server.origin`](/config/server-options.md#server-origin) so that generated asset URLs will be resolved using the back-end server URL instead of a relative path @@ -100,7 +99,6 @@ If you need a custom integration, you can follow the steps in this guide to conf } } ``` - - The manifest has a `Record` structure - For entry or dynamic entry chunks, the key is the relative src path from project root. - For non entry chunks, the key is the base name of the generated file prefixed with `_`. @@ -131,7 +129,6 @@ If you need a custom integration, you can follow the steps in this guide to conf Specifically, a backend generating HTML should include the following tags given a manifest file and an entry point: - - A `` tag for each file in the entry point chunk's `css` list - Recursively follow all chunks in the entry point's `imports` list and include a `` tag for each CSS file of each imported chunk. diff --git a/guide/static-deploy.md b/guide/static-deploy.md index 11cd6f38..17a9c18d 100644 --- a/guide/static-deploy.md +++ b/guide/static-deploy.md @@ -265,7 +265,6 @@ You can deploy your Vite app as a Static Site on [Render](https://render.com/). 3. Connect your GitHub/GitLab account or use a public repository. 4. Specify a project name and branch. - - **Build Command**: `npm install && npm run build` - **Publish Directory**: `dist` From e39c7d60403b5fc204879e7ff9a9c58c610b5493 Mon Sep 17 00:00:00 2001 From: patak <583075+patak-dev@users.noreply.github.com> Date: Mon, 23 Jun 2025 14:03:31 +0200 Subject: [PATCH 3/5] docs: per-environment state in plugins (#20239) --- guide/api-environment-plugins.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/guide/api-environment-plugins.md b/guide/api-environment-plugins.md index e886006e..b456d4c4 100644 --- a/guide/api-environment-plugins.md +++ b/guide/api-environment-plugins.md @@ -126,6 +126,29 @@ The hook can choose to: } ``` +## Per-environment State in Plugins + +Given that the same plugin instance is used for different environments, the plugin state needs to be keyed with `this.environment`. This is the same pattern the ecosystem has already been using to keep state about modules using the `ssr` boolean as key to avoid mixing client and ssr modules state. A `Map` can be used to keep the state for each environment separately. Note that for backward compatibility, `buildStart` and `buildEnd` are only called for the client environment without the `perEnvironmentStartEndDuringDev: true` flag. + +```js +function PerEnvironmentCountTransformedModulesPlugin() { + const state = new Map() + return { + name: 'count-transformed-modules', + perEnvironmentStartEndDuringDev: true, + buildStart() { + state.set(this.environment, { count: 0 }) + }, + transform(id) { + state.get(this.environment).count++ + }, + buildEnd() { + console.log(this.environment.name, state.get(this.environment).count) + } + } +} +``` + ## Per-environment Plugins A plugin can define what are the environments it should apply to with the `applyToEnvironment` function. From 6422755d43c3135e087ebdbf67dc99a0784d5776 Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Tue, 24 Jun 2025 09:38:17 +0800 Subject: [PATCH 4/5] fix(deps): update all non-major dependencies --- package.json | 23 +------ pnpm-lock.yaml | 180 ++++++++++++++++++++++++++++--------------------- 2 files changed, 105 insertions(+), 98 deletions(-) diff --git a/package.json b/package.json index c8f5e604..aa27bcb0 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.", @@ -14,7 +13,7 @@ "feed": "^5.1.0", "vitepress": "^1.6.3", "vitepress-plugin-group-icons": "^1.6.0", - "vue": "^3.5.16", + "vue": "^3.5.17", "@types/node": "^20.9.2", "@type-challenges/utils": "^0.1.1", "chalk": "^4.1.2", @@ -33,24 +32,4 @@ "gitHooks": { "commit-msg": "node scripts/verifyCommit.js" } -======= - "name": "docs", - "private": true, - "type": "module", - "scripts": { - "docs": "vitepress dev", - "docs-build": "vitepress build", - "docs-serve": "vitepress serve" - }, - "devDependencies": { - "@shikijs/vitepress-twoslash": "^2.5.0", - "@types/express": "^5.0.3", - "feed": "^5.1.0", - "gsap": "^3.13.0", - "vitepress": "^1.6.3", - "vitepress-plugin-group-icons": "^1.6.0", - "vitepress-plugin-llms": "^1.5.1", - "vue": "^3.5.17" - } ->>>>>>> e39c7d60403b5fc204879e7ff9a9c58c610b5493 } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 63950d2d..ad4b7024 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -40,13 +40,13 @@ importers: version: 6.3.0-beta.0(@types/node@20.12.12) vitepress: specifier: ^1.6.3 - version: 1.6.3(@algolia/client-search@5.20.0)(@types/node@20.12.12)(postcss@8.5.3)(search-insights@2.13.0)(typescript@5.4.5) + version: 1.6.3(@algolia/client-search@5.20.0)(@types/node@20.12.12)(postcss@8.5.6)(search-insights@2.13.0)(typescript@5.4.5) vitepress-plugin-group-icons: specifier: ^1.6.0 version: 1.6.0(markdown-it@14.1.0)(vite@6.3.0-beta.0(@types/node@20.12.12)) vue: - specifier: ^3.5.16 - version: 3.5.16(typescript@5.4.5) + specifier: ^3.5.17 + version: 3.5.17(typescript@5.4.5) yorkie: specifier: ^2.0.0 version: 2.0.0 @@ -144,10 +144,19 @@ packages: engines: {node: '>=6.0.0'} hasBin: true + '@babel/parser@7.27.5': + resolution: {integrity: sha512-OsQd175SxWkGlzbny8J3K8TnnDD0N3lrIUtB92xwyRpzaenGZhxDvxN/JgU00U3CDZNj9tPuDJ5H0WS4Nt3vKg==} + engines: {node: '>=6.0.0'} + hasBin: true + '@babel/types@7.27.1': resolution: {integrity: sha512-+EzkxvLNfiUeKMgy/3luqfsCWFRXLb7U6wNQTk60tovuckwB15B191tJWvpp4HjiQWdJkCxO3Wbvc6jlk3Xb2Q==} engines: {node: '>=6.9.0'} + '@babel/types@7.27.6': + resolution: {integrity: sha512-ETyHEk2VHHvl9b9jZP5IHPavHYk57EhanlRRuae9XCpb/j5bDCbPPMOBfCWhnl/7EDJz0jEMCi/RhccCE8r1+Q==} + engines: {node: '>=6.9.0'} + '@docsearch/css@3.8.2': resolution: {integrity: sha512-y05ayQFyUmCXze79+56v/4HpycYF3uFqB78pLPrSV5ZKAlDuIAAJNhaRi8tTdRNXh05yxX/TyNnzD6LwSM89vQ==} @@ -823,20 +832,20 @@ packages: '@vue/compiler-core@3.5.15': resolution: {integrity: sha512-nGRc6YJg/kxNqbv/7Tg4juirPnjHvuVdhcmDvQWVZXlLHjouq7VsKmV1hIxM/8yKM0VUfwT/Uzc0lO510ltZqw==} - '@vue/compiler-core@3.5.16': - resolution: {integrity: sha512-AOQS2eaQOaaZQoL1u+2rCJIKDruNXVBZSiUD3chnUrsoX5ZTQMaCvXlWNIfxBJuU15r1o7+mpo5223KVtIhAgQ==} + '@vue/compiler-core@3.5.17': + resolution: {integrity: sha512-Xe+AittLbAyV0pabcN7cP7/BenRBNcteM4aSDCtRvGw0d9OL+HG1u/XHLY/kt1q4fyMeZYXyIYrsHuPSiDPosA==} '@vue/compiler-dom@3.5.15': resolution: {integrity: sha512-ZelQd9n+O/UCBdL00rlwCrsArSak+YLZpBVuNDio1hN3+wrCshYZEDUO3khSLAzPbF1oQS2duEoMDUHScUlYjA==} - '@vue/compiler-dom@3.5.16': - resolution: {integrity: sha512-SSJIhBr/teipXiXjmWOVWLnxjNGo65Oj/8wTEQz0nqwQeP75jWZ0n4sF24Zxoht1cuJoWopwj0J0exYwCJ0dCQ==} + '@vue/compiler-dom@3.5.17': + resolution: {integrity: sha512-+2UgfLKoaNLhgfhV5Ihnk6wB4ljyW1/7wUIog2puUqajiC29Lp5R/IKDdkebh9jTbTogTbsgB+OY9cEWzG95JQ==} - '@vue/compiler-sfc@3.5.16': - resolution: {integrity: sha512-rQR6VSFNpiinDy/DVUE0vHoIDUF++6p910cgcZoaAUm3POxgNOOdS/xgoll3rNdKYTYPnnbARDCZOyZ+QSe6Pw==} + '@vue/compiler-sfc@3.5.17': + resolution: {integrity: sha512-rQQxbRJMgTqwRugtjw0cnyQv9cP4/4BxWfTdRBkqsTfLOHWykLzbOc3C4GGzAmdMDxhzU/1Ija5bTjMVrddqww==} - '@vue/compiler-ssr@3.5.16': - resolution: {integrity: sha512-d2V7kfxbdsjrDSGlJE7my1ZzCXViEcqN6w14DOsDrUCHEA6vbnVCpRFfrc4ryCP/lCKzX2eS1YtnLE/BuC9f/A==} + '@vue/compiler-ssr@3.5.17': + resolution: {integrity: sha512-hkDbA0Q20ZzGgpj5uZjb9rBzQtIHLS78mMilwrlpWk2Ep37DYntUz0PonQ6kr113vfOEdM+zTBuJDaceNIW0tQ==} '@vue/compiler-vue2@2.7.16': resolution: {integrity: sha512-qYC3Psj9S/mfu9uVi5WvNZIzq+xnXMhOwbTFKKDD7b1lhpnn71jXSFdTQ+WsIEk0ONCd7VV2IMm7ONl6tbQ86A==} @@ -858,19 +867,19 @@ packages: typescript: optional: true - '@vue/reactivity@3.5.16': - resolution: {integrity: sha512-FG5Q5ee/kxhIm1p2bykPpPwqiUBV3kFySsHEQha5BJvjXdZTUfmya7wP7zC39dFuZAcf/PD5S4Lni55vGLMhvA==} + '@vue/reactivity@3.5.17': + resolution: {integrity: sha512-l/rmw2STIscWi7SNJp708FK4Kofs97zc/5aEPQh4bOsReD/8ICuBcEmS7KGwDj5ODQLYWVN2lNibKJL1z5b+Lw==} - '@vue/runtime-core@3.5.16': - resolution: {integrity: sha512-bw5Ykq6+JFHYxrQa7Tjr+VSzw7Dj4ldR/udyBZbq73fCdJmyy5MPIFR9IX/M5Qs+TtTjuyUTCnmK3lWWwpAcFQ==} + '@vue/runtime-core@3.5.17': + resolution: {integrity: sha512-QQLXa20dHg1R0ri4bjKeGFKEkJA7MMBxrKo2G+gJikmumRS7PTD4BOU9FKrDQWMKowz7frJJGqBffYMgQYS96Q==} - '@vue/runtime-dom@3.5.16': - resolution: {integrity: sha512-T1qqYJsG2xMGhImRUV9y/RseB9d0eCYZQ4CWca9ztCuiPj/XWNNN+lkNBuzVbia5z4/cgxdL28NoQCvC0Xcfww==} + '@vue/runtime-dom@3.5.17': + resolution: {integrity: sha512-8El0M60TcwZ1QMz4/os2MdlQECgGoVHPuLnQBU3m9h3gdNRW9xRmI8iLS4t/22OQlOE6aJvNNlBiCzPHur4H9g==} - '@vue/server-renderer@3.5.16': - resolution: {integrity: sha512-BrX0qLiv/WugguGsnQUJiYOE0Fe5mZTwi6b7X/ybGB0vfrPH9z0gD/Y6WOR1sGCgX4gc25L1RYS5eYQKDMoNIg==} + '@vue/server-renderer@3.5.17': + resolution: {integrity: sha512-BOHhm8HalujY6lmC3DbqF6uXN/K00uWiEeF22LfEsm9Q93XeJ/plHTepGwf6tqFcF7GA5oGSSAAUock3VvzaCA==} peerDependencies: - vue: 3.5.16 + vue: 3.5.17 '@vue/shared@3.5.13': resolution: {integrity: sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==} @@ -878,8 +887,8 @@ packages: '@vue/shared@3.5.15': resolution: {integrity: sha512-bKvgFJJL1ZX9KxMCTQY6xD9Dhe3nusd1OhyOb1cJYGqvAr0Vg8FIjHPMOEVbJ9GDT9HG+Bjdn4oS8ohKP8EvoA==} - '@vue/shared@3.5.16': - resolution: {integrity: sha512-c/0fWy3Jw6Z8L9FmTyYfkpM5zklnqqa9+a6dz3DvONRKW2NEbh46BP0FHuLFSWi2TnQEtp91Z6zOWNrU6QiyPg==} + '@vue/shared@3.5.17': + resolution: {integrity: sha512-CabR+UN630VnsJO/jHWYBC1YVXyMq94KKp6iF5MQgZJs5I8cmjw6oVMO1oDbtBkENSHSSn/UadWlW/OAgdmKrg==} '@vueuse/core@12.7.0': resolution: {integrity: sha512-jtK5B7YjZXmkGNHjviyGO4s3ZtEhbzSgrbX+s5o+Lr8i2nYqNyHuPVOeTdM1/hZ5Tkxg/KktAuAVDDiHMraMVA==} @@ -1366,6 +1375,10 @@ packages: resolution: {integrity: sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==} engines: {node: ^10 || ^12 || >=14} + postcss@8.5.6: + resolution: {integrity: sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==} + engines: {node: ^10 || ^12 || >=14} + preact@10.22.0: resolution: {integrity: sha512-RRurnSjJPj4rp5K6XoP45Ui33ncb7e4H7WiOHVpjbkvqvA3U+N8Z6Qbo0AE6leGYBV66n8EhEaFixvIu3SkxFw==} @@ -1620,8 +1633,8 @@ packages: peerDependencies: vue: ^3.0.0 - vue@3.5.16: - resolution: {integrity: sha512-rjOV2ecxMd5SiAmof2xzh2WxntRcigkX/He4YFJ6WdRvVUrbt6DxC1Iujh10XLl8xCDRDtGKMeO3D+pRQ1PP9w==} + vue@3.5.17: + resolution: {integrity: sha512-LbHV3xPN9BeljML+Xctq4lbz2lVHCR6DtbpTf5XIO6gugpXUN49j2QQPcMj086r9+AkJ0FfUT8xjulKKBkkr9g==} peerDependencies: typescript: '*' peerDependenciesMeta: @@ -1768,11 +1781,20 @@ snapshots: dependencies: '@babel/types': 7.27.1 + '@babel/parser@7.27.5': + dependencies: + '@babel/types': 7.27.6 + '@babel/types@7.27.1': dependencies: '@babel/helper-string-parser': 7.27.1 '@babel/helper-validator-identifier': 7.27.1 + '@babel/types@7.27.6': + dependencies: + '@babel/helper-string-parser': 7.27.1 + '@babel/helper-validator-identifier': 7.27.1 + '@docsearch/css@3.8.2': {} '@docsearch/js@3.8.2(@algolia/client-search@5.20.0)(search-insights@2.13.0)': @@ -2189,14 +2211,14 @@ snapshots: '@shikijs/vitepress-twoslash@2.5.0(typescript@5.4.5)': dependencies: '@shikijs/twoslash': 3.0.0(typescript@5.4.5) - floating-vue: 5.2.2(vue@3.5.16(typescript@5.4.5)) + floating-vue: 5.2.2(vue@3.5.17(typescript@5.4.5)) mdast-util-from-markdown: 2.0.2 mdast-util-gfm: 3.1.0 mdast-util-to-hast: 13.2.0 shiki: 2.5.0 twoslash: 0.2.12(typescript@5.4.5) twoslash-vue: 0.2.12(typescript@5.4.5) - vue: 3.5.16(typescript@5.4.5) + vue: 3.5.17(typescript@5.4.5) transitivePeerDependencies: - '@nuxt/kit' - supports-color @@ -2291,10 +2313,10 @@ snapshots: '@ungap/structured-clone@1.2.0': {} - '@vitejs/plugin-vue@5.2.1(vite@5.4.14(@types/node@20.12.12))(vue@3.5.16(typescript@5.4.5))': + '@vitejs/plugin-vue@5.2.1(vite@5.4.14(@types/node@20.12.12))(vue@3.5.17(typescript@5.4.5))': dependencies: vite: 5.4.14(@types/node@20.12.12) - vue: 3.5.16(typescript@5.4.5) + vue: 3.5.17(typescript@5.4.5) '@volar/language-core@2.4.1': dependencies: @@ -2310,10 +2332,10 @@ snapshots: estree-walker: 2.0.2 source-map-js: 1.2.1 - '@vue/compiler-core@3.5.16': + '@vue/compiler-core@3.5.17': dependencies: - '@babel/parser': 7.27.2 - '@vue/shared': 3.5.16 + '@babel/parser': 7.27.5 + '@vue/shared': 3.5.17 entities: 4.5.0 estree-walker: 2.0.2 source-map-js: 1.2.1 @@ -2323,27 +2345,27 @@ snapshots: '@vue/compiler-core': 3.5.15 '@vue/shared': 3.5.15 - '@vue/compiler-dom@3.5.16': + '@vue/compiler-dom@3.5.17': dependencies: - '@vue/compiler-core': 3.5.16 - '@vue/shared': 3.5.16 + '@vue/compiler-core': 3.5.17 + '@vue/shared': 3.5.17 - '@vue/compiler-sfc@3.5.16': + '@vue/compiler-sfc@3.5.17': dependencies: - '@babel/parser': 7.27.2 - '@vue/compiler-core': 3.5.16 - '@vue/compiler-dom': 3.5.16 - '@vue/compiler-ssr': 3.5.16 - '@vue/shared': 3.5.16 + '@babel/parser': 7.27.5 + '@vue/compiler-core': 3.5.17 + '@vue/compiler-dom': 3.5.17 + '@vue/compiler-ssr': 3.5.17 + '@vue/shared': 3.5.17 estree-walker: 2.0.2 magic-string: 0.30.17 - postcss: 8.5.3 + postcss: 8.5.6 source-map-js: 1.2.1 - '@vue/compiler-ssr@3.5.16': + '@vue/compiler-ssr@3.5.17': dependencies: - '@vue/compiler-dom': 3.5.16 - '@vue/shared': 3.5.16 + '@vue/compiler-dom': 3.5.17 + '@vue/shared': 3.5.17 '@vue/compiler-vue2@2.7.16': dependencies: @@ -2381,40 +2403,40 @@ snapshots: optionalDependencies: typescript: 5.4.5 - '@vue/reactivity@3.5.16': + '@vue/reactivity@3.5.17': dependencies: - '@vue/shared': 3.5.16 + '@vue/shared': 3.5.17 - '@vue/runtime-core@3.5.16': + '@vue/runtime-core@3.5.17': dependencies: - '@vue/reactivity': 3.5.16 - '@vue/shared': 3.5.16 + '@vue/reactivity': 3.5.17 + '@vue/shared': 3.5.17 - '@vue/runtime-dom@3.5.16': + '@vue/runtime-dom@3.5.17': dependencies: - '@vue/reactivity': 3.5.16 - '@vue/runtime-core': 3.5.16 - '@vue/shared': 3.5.16 + '@vue/reactivity': 3.5.17 + '@vue/runtime-core': 3.5.17 + '@vue/shared': 3.5.17 csstype: 3.1.3 - '@vue/server-renderer@3.5.16(vue@3.5.16(typescript@5.4.5))': + '@vue/server-renderer@3.5.17(vue@3.5.17(typescript@5.4.5))': dependencies: - '@vue/compiler-ssr': 3.5.16 - '@vue/shared': 3.5.16 - vue: 3.5.16(typescript@5.4.5) + '@vue/compiler-ssr': 3.5.17 + '@vue/shared': 3.5.17 + vue: 3.5.17(typescript@5.4.5) '@vue/shared@3.5.13': {} '@vue/shared@3.5.15': {} - '@vue/shared@3.5.16': {} + '@vue/shared@3.5.17': {} '@vueuse/core@12.7.0(typescript@5.4.5)': dependencies: '@types/web-bluetooth': 0.0.20 '@vueuse/metadata': 12.7.0 '@vueuse/shared': 12.7.0(typescript@5.4.5) - vue: 3.5.16(typescript@5.4.5) + vue: 3.5.17(typescript@5.4.5) transitivePeerDependencies: - typescript @@ -2422,7 +2444,7 @@ snapshots: dependencies: '@vueuse/core': 12.7.0(typescript@5.4.5) '@vueuse/shared': 12.7.0(typescript@5.4.5) - vue: 3.5.16(typescript@5.4.5) + vue: 3.5.17(typescript@5.4.5) optionalDependencies: focus-trap: 7.6.4 transitivePeerDependencies: @@ -2432,7 +2454,7 @@ snapshots: '@vueuse/shared@12.7.0(typescript@5.4.5)': dependencies: - vue: 3.5.16(typescript@5.4.5) + vue: 3.5.17(typescript@5.4.5) transitivePeerDependencies: - typescript @@ -2613,11 +2635,11 @@ snapshots: dependencies: xml-js: 1.6.11 - floating-vue@5.2.2(vue@3.5.16(typescript@5.4.5)): + floating-vue@5.2.2(vue@3.5.17(typescript@5.4.5)): dependencies: '@floating-ui/dom': 1.1.1 - vue: 3.5.16(typescript@5.4.5) - vue-resize: 2.0.0-alpha.1(vue@3.5.16(typescript@5.4.5)) + vue: 3.5.17(typescript@5.4.5) + vue-resize: 2.0.0-alpha.1(vue@3.5.17(typescript@5.4.5)) focus-trap@7.6.4: dependencies: @@ -3038,6 +3060,12 @@ snapshots: picocolors: 1.1.1 source-map-js: 1.2.1 + postcss@8.5.6: + dependencies: + nanoid: 3.3.11 + picocolors: 1.1.1 + source-map-js: 1.2.1 + preact@10.22.0: {} property-information@6.5.0: {} @@ -3276,7 +3304,7 @@ snapshots: transitivePeerDependencies: - supports-color - vitepress@1.6.3(@algolia/client-search@5.20.0)(@types/node@20.12.12)(postcss@8.5.3)(search-insights@2.13.0)(typescript@5.4.5): + vitepress@1.6.3(@algolia/client-search@5.20.0)(@types/node@20.12.12)(postcss@8.5.6)(search-insights@2.13.0)(typescript@5.4.5): dependencies: '@docsearch/css': 3.8.2 '@docsearch/js': 3.8.2(@algolia/client-search@5.20.0)(search-insights@2.13.0) @@ -3285,7 +3313,7 @@ snapshots: '@shikijs/transformers': 2.5.0 '@shikijs/types': 2.3.0 '@types/markdown-it': 14.1.2 - '@vitejs/plugin-vue': 5.2.1(vite@5.4.14(@types/node@20.12.12))(vue@3.5.16(typescript@5.4.5)) + '@vitejs/plugin-vue': 5.2.1(vite@5.4.14(@types/node@20.12.12))(vue@3.5.17(typescript@5.4.5)) '@vue/devtools-api': 7.7.1 '@vue/shared': 3.5.13 '@vueuse/core': 12.7.0(typescript@5.4.5) @@ -3295,9 +3323,9 @@ snapshots: minisearch: 7.1.1 shiki: 2.3.0 vite: 5.4.14(@types/node@20.12.12) - vue: 3.5.16(typescript@5.4.5) + vue: 3.5.17(typescript@5.4.5) optionalDependencies: - postcss: 8.5.3 + postcss: 8.5.6 transitivePeerDependencies: - '@algolia/client-search' - '@types/node' @@ -3325,17 +3353,17 @@ snapshots: - typescript - universal-cookie - vue-resize@2.0.0-alpha.1(vue@3.5.16(typescript@5.4.5)): + vue-resize@2.0.0-alpha.1(vue@3.5.17(typescript@5.4.5)): dependencies: - vue: 3.5.16(typescript@5.4.5) + vue: 3.5.17(typescript@5.4.5) - vue@3.5.16(typescript@5.4.5): + vue@3.5.17(typescript@5.4.5): dependencies: - '@vue/compiler-dom': 3.5.16 - '@vue/compiler-sfc': 3.5.16 - '@vue/runtime-dom': 3.5.16 - '@vue/server-renderer': 3.5.16(vue@3.5.16(typescript@5.4.5)) - '@vue/shared': 3.5.16 + '@vue/compiler-dom': 3.5.17 + '@vue/compiler-sfc': 3.5.17 + '@vue/runtime-dom': 3.5.17 + '@vue/server-renderer': 3.5.17(vue@3.5.17(typescript@5.4.5)) + '@vue/shared': 3.5.17 optionalDependencies: typescript: 5.4.5 From 20385d137a26948db1464dde2b44626a269c1802 Mon Sep 17 00:00:00 2001 From: Kylin <1159469891@qq.com> Date: Tue, 24 Jun 2025 11:00:57 +0800 Subject: [PATCH 5/5] docs: update content --- guide/api-environment-plugins.md | 10 +++------- guide/api-plugin.md | 16 ---------------- guide/backend-integration.md | 26 -------------------------- guide/static-deploy.md | 6 ------ 4 files changed, 3 insertions(+), 55 deletions(-) diff --git a/guide/api-environment-plugins.md b/guide/api-environment-plugins.md index 44096dd1..dd67b55e 100644 --- a/guide/api-environment-plugins.md +++ b/guide/api-environment-plugins.md @@ -126,12 +126,9 @@ interface HotUpdateOptions { } ``` -<<<<<<< HEAD -## 基于环境的插件 {#per-environment-plugins} -======= -## Per-environment State in Plugins +## 插件中的基于环境的状态 {#per-environment-state-in-plugins} -Given that the same plugin instance is used for different environments, the plugin state needs to be keyed with `this.environment`. This is the same pattern the ecosystem has already been using to keep state about modules using the `ssr` boolean as key to avoid mixing client and ssr modules state. A `Map` can be used to keep the state for each environment separately. Note that for backward compatibility, `buildStart` and `buildEnd` are only called for the client environment without the `perEnvironmentStartEndDuringDev: true` flag. +鉴于相同的插件实例会被用于不同的环境,插件的状态需要以 `this.environment` 作为键来存储。这与生态系统中已使用的模式相同,即使用 `ssr` 布尔值作为键来避免混合客户端和 SSR 模块状态的方式。可以使用 `Map` 来分别为每个环境保存其对应的状态。注意:为了保持向后兼容性,在未设置 `perEnvironmentStartEndDuringDev: true` 标志时,`buildStart` 和 `buildEnd` 仅会针对客户端环境被调用。 ```js function PerEnvironmentCountTransformedModulesPlugin() { @@ -152,8 +149,7 @@ function PerEnvironmentCountTransformedModulesPlugin() { } ``` -## Per-environment Plugins ->>>>>>> e39c7d60403b5fc204879e7ff9a9c58c610b5493 +## 基于环境的插件 {#per-environment-plugins} 插件可以使用 `applyToEnvironment` 函数来定义它适用的环境。 diff --git a/guide/api-plugin.md b/guide/api-plugin.md index f50c38ae..305d09da 100644 --- a/guide/api-plugin.md +++ b/guide/api-plugin.md @@ -336,18 +336,11 @@ Vite 插件也可以提供钩子来服务于特定的 Vite 目标。这些钩子 转换 `index.html` 的专用钩子。钩子接收当前的 HTML 字符串和转换上下文。上下文在开发期间暴露[`ViteDevServer`](./api-javascript#vitedevserver)实例,在构建期间暴露 Rollup 输出的包。 -<<<<<<< HEAD 这个钩子可以是异步的,并且可以返回以下其中之一: - 经过转换的 HTML 字符串 - 注入到现有 HTML 中的标签描述符对象数组(`{ tag, attrs, children }`)。每个标签也可以指定它应该被注入到哪里(默认是在 `` 之前) - 一个包含 `{ html, tags }` 的对象 -======= - The hook can be async and can return one of the following: - - Transformed HTML string - - An array of tag descriptor objects (`{ tag, attrs, children }`) to inject to the existing HTML. Each tag can also specify where it should be injected to (default is prepending to ``) - - An object containing both as `{ html, tags }` ->>>>>>> e39c7d60403b5fc204879e7ff9a9c58c610b5493 默认情况下 `order` 是 `undefined`,这个钩子会在 HTML 被转换后应用。为了注入一个应该通过 Vite 插件管道的脚本, `order: 'pre'` 指将在处理 HTML 之前应用。 `order: 'post'` 是在所有未定义的 `order` 的钩子函数被应用后才应用。 @@ -423,23 +416,14 @@ Vite 插件也可以提供钩子来服务于特定的 Vite 目标。这些钩子 server: ViteDevServer } ``` -<<<<<<< HEAD - `modules` 是受更改文件影响的模块数组。它是一个数组,因为单个文件可能映射到多个服务模块(例如 Vue 单文件组件)。 -======= - - `modules` is an array of modules that are affected by the changed file. It's an array because a single file may map to multiple served modules (e.g. Vue SFCs). ->>>>>>> e39c7d60403b5fc204879e7ff9a9c58c610b5493 - `read` 这是一个异步读函数,它返回文件的内容。之所以这样做,是因为在某些系统上,文件更改的回调函数可能会在编辑器完成文件更新之前过快地触发,并 `fs.readFile` 直接会返回空内容。传入的 `read` 函数规范了这种行为。 -<<<<<<< HEAD 钩子可以选择: - 过滤和缩小受影响的模块列表,使 HMR 更准确。 -======= - The hook can choose to: - - Filter and narrow down the affected module list so that the HMR is more accurate. ->>>>>>> e39c7d60403b5fc204879e7ff9a9c58c610b5493 - 返回一个空数组并进行全面刷新: diff --git a/guide/backend-integration.md b/guide/backend-integration.md index 48e59dd8..790dff4e 100644 --- a/guide/backend-integration.md +++ b/guide/backend-integration.md @@ -44,16 +44,10 @@ ``` -<<<<<<< HEAD 为了正确地提供资源,你有两种选项: - 确保服务器被配置过,将会拦截代理资源请求给到 Vite 服务器 - 设置 [`server.origin`](/config/server-options.md#server-origin) 以求生成的资源链接将以服务器 URL 形式被解析而非一个相对路径 -======= - In order to properly serve assets, you have two options: - - Make sure the server is configured to proxy static assets requests to the Vite server - - Set [`server.origin`](/config/server-options.md#server-origin) so that generated asset URLs will be resolved using the back-end server URL instead of a relative path ->>>>>>> e39c7d60403b5fc204879e7ff9a9c58c610b5493 这对于图片等资源的正确加载是必需的。 @@ -106,20 +100,12 @@ } } ``` -<<<<<<< HEAD - 清单是一个 `Record` 结构的对象。 - 对于 入口 或动态入口 chunk,键是相对于项目根目录的资源路径。 - 对于非入口 chunk,键是生成文件的名称并加上前缀 `_`。 - 当 [`build.cssCodeSplit`](/config/build-options.md#build-csscodesplit) 为 `false` 时生成的 CSS 文件,键为 `style.css`。 - Chunk 将信息包含在其静态和动态导入上(两者都是映射到清单中相应 chunk 的键),以及任何与之相关的 CSS 和资源文件。 -======= - - The manifest has a `Record` structure - - For entry or dynamic entry chunks, the key is the relative src path from project root. - - For non entry chunks, the key is the base name of the generated file prefixed with `_`. - - For the CSS file generated when [`build.cssCodeSplit`](/config/build-options.md#build-csscodesplit) is `false`, the key is `style.css`. - - Chunks will contain information on its static and dynamic imports (both are keys that map to the corresponding chunk in the manifest), and also its corresponding CSS and asset files (if any). ->>>>>>> e39c7d60403b5fc204879e7ff9a9c58c610b5493 4. 你可以利用这个文件来渲染带有哈希文件名的链接或预加载指令。 @@ -143,7 +129,6 @@ ``` -<<<<<<< HEAD 具体来说,一个生成 HTML 的后端在给定 manifest 文件和一个入口文件的情况下, 应该包含以下标签: @@ -154,17 +139,6 @@ `