From 69b73dc040b2592574fb89f52428398db5f28ca4 Mon Sep 17 00:00:00 2001 From: Jaga Santagostino Date: Sun, 27 Apr 2025 04:33:17 +0200 Subject: [PATCH 1/6] docs: fix example in api-environment-frameworks.md (#19946) --- guide/api-environment-frameworks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/api-environment-frameworks.md b/guide/api-environment-frameworks.md index df8f4a6e..96eeece2 100644 --- a/guide/api-environment-frameworks.md +++ b/guide/api-environment-frameworks.md @@ -160,7 +160,7 @@ const server = createServer() const ssrEnvironment = server.environment.ssr const input = {} -const { createHandler } = await ssrEnvironment.runner.import('./entry.js') +const { createHandler } = await ssrEnvironment.runner.import('./entrypoint.js') const handler = createHandler(input) const response = handler(new Request('/')) From 3b7ac5e4ae9ca77b40bffc2308fb0b0ea4016d46 Mon Sep 17 00:00:00 2001 From: "@beer" <47961062+iiio2@users.noreply.github.com> Date: Mon, 28 Apr 2025 07:15:35 +0600 Subject: [PATCH 2/6] docs: capitalize title (#19947) --- guide/env-and-mode.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/env-and-mode.md b/guide/env-and-mode.md index 63b94194..a963f155 100644 --- a/guide/env-and-mode.md +++ b/guide/env-and-mode.md @@ -2,7 +2,7 @@ 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. -## Built-in constants +## Built-in Constants Some built-in constants are available in all cases: From 1369ef47ef005186f9dd7aa2713f521343884fa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Mon, 28 Apr 2025 11:28:08 +0900 Subject: [PATCH 3/6] docs: update to express 5 (#19771) --- guide/ssr.md | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/guide/ssr.md b/guide/ssr.md index 00c03d51..e2c9c946 100644 --- a/guide/ssr.md +++ b/guide/ssr.md @@ -63,7 +63,7 @@ This is statically replaced during build so it will allow tree-shaking of unused ## Setting Up the Dev Server -When building an SSR app, you likely want to have full control over your main server and decouple Vite from the production environment. It is therefore recommended to use Vite in middleware mode. Here is an example with [express](https://expressjs.com/) (v4): +When building an SSR app, you likely want to have full control over your main server and decouple Vite from the production environment. It is therefore recommended to use Vite in middleware mode. Here is an example with [express](https://expressjs.com/): ```js{15-18} twoslash [server.js] import fs from 'node:fs' @@ -93,7 +93,7 @@ async function createServer() { // middlewares). The following is valid even after restarts. app.use(vite.middlewares) - app.use('*', async (req, res) => { + app.use('*all', async (req, res) => { // serve index.html - we will tackle this next }) @@ -119,7 +119,7 @@ var app var vite // ---cut--- -app.use('*', async (req, res, next) => { +app.use('*all', async (req, res, next) => { const url = req.originalUrl try { diff --git a/package.json b/package.json index 772698ad..86d866ab 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ }, "devDependencies": { "@shikijs/vitepress-twoslash": "^2.5.0", - "@types/express": "^4.17.21", + "@types/express": "^5.0.1", "feed": "^4.2.2", "vitepress": "^1.6.3", "vitepress-plugin-group-icons": "^1.5.2", From 47e88f5402396bf3ae637316f2ab1a0bc81e5549 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 28 Apr 2025 04:22:55 -0500 Subject: [PATCH 4/6] docs: add Deno commands (#19943) --- guide/index.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/guide/index.md b/guide/index.md index 42288452..0ea505ae 100644 --- a/guide/index.md +++ b/guide/index.md @@ -65,6 +65,10 @@ $ pnpm create vite $ bun create vite ``` +```bash [Deno] +$ deno init --npm vite +``` + ::: Then follow the prompts! @@ -90,6 +94,10 @@ $ pnpm create vite my-vue-app --template vue $ bun create vite my-vue-app --template vue ``` +```bash [Deno] +$ deno init --npm vite my-vue-app --template vue +``` + ::: See [create-vite](https://github.com/vitejs/vite/tree/main/packages/create-vite) for more details on each supported template: `vanilla`, `vanilla-ts`, `vue`, `vue-ts`, `react`, `react-ts`, `react-swc`, `react-swc-ts`, `preact`, `preact-ts`, `lit`, `lit-ts`, `svelte`, `svelte-ts`, `solid`, `solid-ts`, `qwik`, `qwik-ts`. @@ -134,6 +142,10 @@ $ pnpm add -D vite $ bun add -D vite ``` +```bash [Deno] +$ deno add -D npm:vite +``` + ::: And create an `index.html` file like this: @@ -162,6 +174,10 @@ $ pnpm vite $ bunx vite ``` +```bash [Deno] +$ deno run -A npm:vite +``` + ::: The `index.html` will be served on `http://localhost:5173`. From 4f0ea491bb5fddc10b60b8a39398b2322cf6b30b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Wed, 30 Apr 2025 14:47:59 +0900 Subject: [PATCH 5/6] fix: check static serve file inside sirv (#19965) --- config/server-options.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/server-options.md b/config/server-options.md index c2f02556..b689118f 100644 --- a/config/server-options.md +++ b/config/server-options.md @@ -377,6 +377,12 @@ export default defineConfig({ Blocklist for sensitive files being restricted to be served by Vite dev server. This will have higher priority than [`server.fs.allow`](#server-fs-allow). [picomatch patterns](https://github.com/micromatch/picomatch#globbing-features) are supported. +::: tip NOTE + +This blocklist does not apply to [the public directory](/guide/assets.md#the-public-directory). All files in the public directory are served without any filtering, since they are copied directly to the output directory during build. + +::: + ## server.origin - **Type:** `string` From 3ca05820d5963b959c79a0a2688d0e2722c6920e Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Wed, 7 May 2025 11:51:07 +0800 Subject: [PATCH 6/6] fix: resolved conflict --- config/server-options.md | 8 ++------ guide/env-and-mode.md | 4 ---- guide/ssr.md | 13 ++----------- package.json | 22 +--------------------- pnpm-lock.yaml | 39 +++++++++------------------------------ 5 files changed, 14 insertions(+), 72 deletions(-) diff --git a/config/server-options.md b/config/server-options.md index 2a534b75..9c5703ce 100644 --- a/config/server-options.md +++ b/config/server-options.md @@ -377,17 +377,13 @@ export default defineConfig({ 用于限制 Vite 开发服务器提供敏感文件的黑名单。这会比 [`server.fs.allow`](#server-fs-allow) 选项的优先级更高。同时还支持 [picomatch 模式](https://github.com/micromatch/picomatch#globbing-features)。 -<<<<<<< HEAD -## server.origin {#server-origin} -======= ::: tip NOTE -This blocklist does not apply to [the public directory](/guide/assets.md#the-public-directory). All files in the public directory are served without any filtering, since they are copied directly to the output directory during build. +此黑名单不适用于[公共目录](/guide/assets.md#the-public-directory)。公共目录中的所有文件均未经任何过滤,因为它们会在构建过程中直接复制到输出目录。 ::: -## server.origin ->>>>>>> 4f0ea491bb5fddc10b60b8a39398b2322cf6b30b +## server.origin {#server-origin} - **类型:** `string` diff --git a/guide/env-and-mode.md b/guide/env-and-mode.md index cf610668..6d895726 100644 --- a/guide/env-and-mode.md +++ b/guide/env-and-mode.md @@ -2,11 +2,7 @@ Vite 在特殊的 `import.meta.env` 对象下暴露了一些常量。这些常量在开发阶段被定义为全局变量,并在构建阶段被静态替换,以使树摇(tree-shaking)更有效。 -<<<<<<< HEAD ## 内置常量 {#built-in-constants} -======= -## Built-in Constants ->>>>>>> 4f0ea491bb5fddc10b60b8a39398b2322cf6b30b 一些内置常量在所有情况下都可用: diff --git a/guide/ssr.md b/guide/ssr.md index 0fdd0f51..f476b5c7 100644 --- a/guide/ssr.md +++ b/guide/ssr.md @@ -63,11 +63,7 @@ if (import.meta.env.SSR) { ## 设置开发服务器 {#setting-up-the-dev-server} -<<<<<<< HEAD -在构建 SSR 应用程序时,你可能希望完全控制主服务器,并将 Vite 与生产环境脱钩。因此,建议以中间件模式使用 Vite。下面是一个关于 [express](https://expressjs.com/) (v4) 的例子: -======= -When building an SSR app, you likely want to have full control over your main server and decouple Vite from the production environment. It is therefore recommended to use Vite in middleware mode. Here is an example with [express](https://expressjs.com/): ->>>>>>> 4f0ea491bb5fddc10b60b8a39398b2322cf6b30b +在构建 SSR 应用程序时,你可能希望完全控制主服务器,并将 Vite 与生产环境脱钩。因此,建议以中间件模式使用 Vite。下面是一个关于 [express](https://expressjs.com/) 的例子: ```js{15-18} twoslash [server.js] import fs from 'node:fs' @@ -97,13 +93,8 @@ async function createServer() { // 即使在重新启动后,以下内容仍然有效。 app.use(vite.middlewares) -<<<<<<< HEAD - app.use('*', async (req, res) => { - // 服务 index.html - 下面我们来处理这个问题 -======= app.use('*all', async (req, res) => { - // serve index.html - we will tackle this next ->>>>>>> 4f0ea491bb5fddc10b60b8a39398b2322cf6b30b + // 服务 index.html - 下面我们来处理这个问题 }) app.listen(5173) diff --git a/package.json b/package.json index 1ecebe61..4626a743 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.", @@ -10,7 +9,7 @@ "license": "CC BY-NC-SA 4.0", "devDependencies": { "@shikijs/vitepress-twoslash": "^2.5.0", - "@types/express": "^4.17.21", + "@types/express": "^5.0.1", "feed": "^4.2.2", "vitepress": "^1.6.3", "vitepress-plugin-group-icons": "^1.5.2", @@ -34,23 +33,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.1", - "feed": "^4.2.2", - "vitepress": "^1.6.3", - "vitepress-plugin-group-icons": "^1.5.2", - "vitepress-plugin-llms": "^1.1.0", - "vue": "^3.5.13" - } ->>>>>>> 4f0ea491bb5fddc10b60b8a39398b2322cf6b30b } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 925a51ce..d43342e3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,8 +15,8 @@ importers: specifier: ^0.1.1 version: 0.1.1 '@types/express': - specifier: ^4.17.21 - version: 4.17.21 + specifier: ^5.0.1 + version: 5.0.1 '@types/node': specifier: ^20.9.2 version: 20.12.12 @@ -553,121 +553,101 @@ packages: resolution: {integrity: sha512-9OwUnK/xKw6DyRlgx8UizeqRFOfi9mf5TYCw1uolDaJSbUmBxP85DE6T4ouCMoN6pXw8ZoTeZCSEfSaYo+/s1w==} cpu: [arm] os: [linux] - libc: [glibc] '@rollup/rollup-linux-arm-gnueabihf@4.37.0': resolution: {integrity: sha512-hhAALKJPidCwZcj+g+iN+38SIOkhK2a9bqtJR+EtyxrKKSt1ynCBeqrQy31z0oWU6thRZzdx53hVgEbRkuI19w==} cpu: [arm] os: [linux] - libc: [glibc] '@rollup/rollup-linux-arm-musleabihf@4.27.4': resolution: {integrity: sha512-Vgdo4fpuphS9V24WOV+KwkCVJ72u7idTgQaBoLRD0UxBAWTF9GWurJO9YD9yh00BzbkhpeXtm6na+MvJU7Z73A==} cpu: [arm] os: [linux] - libc: [musl] '@rollup/rollup-linux-arm-musleabihf@4.37.0': resolution: {integrity: sha512-jUb/kmn/Gd8epbHKEqkRAxq5c2EwRt0DqhSGWjPFxLeFvldFdHQs/n8lQ9x85oAeVb6bHcS8irhTJX2FCOd8Ag==} cpu: [arm] os: [linux] - libc: [musl] '@rollup/rollup-linux-arm64-gnu@4.27.4': resolution: {integrity: sha512-pleyNgyd1kkBkw2kOqlBx+0atfIIkkExOTiifoODo6qKDSpnc6WzUY5RhHdmTdIJXBdSnh6JknnYTtmQyobrVg==} cpu: [arm64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-arm64-gnu@4.37.0': resolution: {integrity: sha512-oNrJxcQT9IcbcmKlkF+Yz2tmOxZgG9D9GRq+1OE6XCQwCVwxixYAa38Z8qqPzQvzt1FCfmrHX03E0pWoXm1DqA==} cpu: [arm64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-arm64-musl@4.27.4': resolution: {integrity: sha512-caluiUXvUuVyCHr5DxL8ohaaFFzPGmgmMvwmqAITMpV/Q+tPoaHZ/PWa3t8B2WyoRcIIuu1hkaW5KkeTDNSnMA==} cpu: [arm64] os: [linux] - libc: [musl] '@rollup/rollup-linux-arm64-musl@4.37.0': resolution: {integrity: sha512-pfxLBMls+28Ey2enpX3JvjEjaJMBX5XlPCZNGxj4kdJyHduPBXtxYeb8alo0a7bqOoWZW2uKynhHxF/MWoHaGQ==} cpu: [arm64] os: [linux] - libc: [musl] '@rollup/rollup-linux-loongarch64-gnu@4.37.0': resolution: {integrity: sha512-yCE0NnutTC/7IGUq/PUHmoeZbIwq3KRh02e9SfFh7Vmc1Z7atuJRYWhRME5fKgT8aS20mwi1RyChA23qSyRGpA==} cpu: [loong64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-powerpc64le-gnu@4.27.4': resolution: {integrity: sha512-FScrpHrO60hARyHh7s1zHE97u0KlT/RECzCKAdmI+LEoC1eDh/RDji9JgFqyO+wPDb86Oa/sXkily1+oi4FzJQ==} cpu: [ppc64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-powerpc64le-gnu@4.37.0': resolution: {integrity: sha512-NxcICptHk06E2Lh3a4Pu+2PEdZ6ahNHuK7o6Np9zcWkrBMuv21j10SQDJW3C9Yf/A/P7cutWoC/DptNLVsZ0VQ==} cpu: [ppc64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-riscv64-gnu@4.27.4': resolution: {integrity: sha512-qyyprhyGb7+RBfMPeww9FlHwKkCXdKHeGgSqmIXw9VSUtvyFZ6WZRtnxgbuz76FK7LyoN8t/eINRbPUcvXB5fw==} cpu: [riscv64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-riscv64-gnu@4.37.0': resolution: {integrity: sha512-PpWwHMPCVpFZLTfLq7EWJWvrmEuLdGn1GMYcm5MV7PaRgwCEYJAwiN94uBuZev0/J/hFIIJCsYw4nLmXA9J7Pw==} cpu: [riscv64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-riscv64-musl@4.37.0': resolution: {integrity: sha512-DTNwl6a3CfhGTAOYZ4KtYbdS8b+275LSLqJVJIrPa5/JuIufWWZ/QFvkxp52gpmguN95eujrM68ZG+zVxa8zHA==} cpu: [riscv64] os: [linux] - libc: [musl] '@rollup/rollup-linux-s390x-gnu@4.27.4': resolution: {integrity: sha512-PFz+y2kb6tbh7m3A7nA9++eInGcDVZUACulf/KzDtovvdTizHpZaJty7Gp0lFwSQcrnebHOqxF1MaKZd7psVRg==} cpu: [s390x] os: [linux] - libc: [glibc] '@rollup/rollup-linux-s390x-gnu@4.37.0': resolution: {integrity: sha512-hZDDU5fgWvDdHFuExN1gBOhCuzo/8TMpidfOR+1cPZJflcEzXdCy1LjnklQdW8/Et9sryOPJAKAQRw8Jq7Tg+A==} cpu: [s390x] os: [linux] - libc: [glibc] '@rollup/rollup-linux-x64-gnu@4.27.4': resolution: {integrity: sha512-Ni8mMtfo+o/G7DVtweXXV/Ol2TFf63KYjTtoZ5f078AUgJTmaIJnj4JFU7TK/9SVWTaSJGxPi5zMDgK4w+Ez7Q==} cpu: [x64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-x64-gnu@4.37.0': resolution: {integrity: sha512-pKivGpgJM5g8dwj0ywBwe/HeVAUSuVVJhUTa/URXjxvoyTT/AxsLTAbkHkDHG7qQxLoW2s3apEIl26uUe08LVQ==} cpu: [x64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-x64-musl@4.27.4': resolution: {integrity: sha512-5AeeAF1PB9TUzD+3cROzFTnAJAcVUGLuR8ng0E0WXGkYhp6RD6L+6szYVX+64Rs0r72019KHZS1ka1q+zU/wUw==} cpu: [x64] os: [linux] - libc: [musl] '@rollup/rollup-linux-x64-musl@4.37.0': resolution: {integrity: sha512-E2lPrLKE8sQbY/2bEkVTGDEk4/49UYRVWgj90MY8yPjpnGBQ+Xi1Qnr7b7UIWw1NOggdFQFOLZ8+5CzCiz143w==} cpu: [x64] os: [linux] - libc: [musl] '@rollup/rollup-win32-arm64-msvc@4.27.4': resolution: {integrity: sha512-yOpVsA4K5qVwu2CaS3hHxluWIK5HQTjNV4tWjQXluMiiiu4pJj4BN98CvxohNCpcjMeTXk/ZMJBRbgRg8HBB6A==} @@ -771,11 +751,11 @@ packages: '@types/estree@1.0.6': resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} - '@types/express-serve-static-core@4.19.0': - resolution: {integrity: sha512-bGyep3JqPCRry1wq+O5n7oiBgGWmeIJXPjXXCo8EK0u8duZGSYar7cGqd3ML2JUsLGeB7fmc06KYo9fLGWqPvQ==} + '@types/express-serve-static-core@5.0.6': + resolution: {integrity: sha512-3xhRnjJPkULekpSzgtoNYYcTWgEZkp4myc+Saevii5JPnHNvHMRlBSHDbs7Bh1iPPoVTERHEZXyhyLbMEsExsA==} - '@types/express@4.17.21': - resolution: {integrity: sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==} + '@types/express@5.0.1': + resolution: {integrity: sha512-UZUw8vjpWFXuDnjFTh7/5c2TWDlQqeXHi6hcN7F2XSVT5P+WmUnnbFS3KA6Jnc6IsEqI2qCVu2bK0R0J4A8ZQQ==} '@types/hast@3.0.4': resolution: {integrity: sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==} @@ -2338,18 +2318,17 @@ snapshots: '@types/estree@1.0.6': {} - '@types/express-serve-static-core@4.19.0': + '@types/express-serve-static-core@5.0.6': dependencies: '@types/node': 20.12.12 '@types/qs': 6.9.15 '@types/range-parser': 1.2.7 '@types/send': 0.17.4 - '@types/express@4.17.21': + '@types/express@5.0.1': dependencies: '@types/body-parser': 1.19.5 - '@types/express-serve-static-core': 4.19.0 - '@types/qs': 6.9.15 + '@types/express-serve-static-core': 5.0.6 '@types/serve-static': 1.15.7 '@types/hast@3.0.4':