From 8850321fa87528b8a01b399b51b4f038108cdba2 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Mon, 8 Sep 2025 14:09:13 +0900 Subject: [PATCH 1/2] fix: upgrade sirv to 3.0.2 --- packages/vite/package.json | 2 +- .../{sirv@3.0.1.patch => sirv@3.0.2.patch} | 12 +++++----- playground/lib/package.json | 2 +- playground/ssr-conditions/package.json | 2 +- pnpm-lock.yaml | 24 +++++++++---------- pnpm-workspace.yaml | 2 +- 6 files changed, 22 insertions(+), 22 deletions(-) rename patches/{sirv@3.0.1.patch => sirv@3.0.2.patch} (87%) diff --git a/packages/vite/package.json b/packages/vite/package.json index 00d2b5a034f14f..d8d43153b56d3a 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -143,7 +143,7 @@ "rollup-plugin-license": "^3.6.0", "sass": "^1.92.1", "sass-embedded": "^1.92.1", - "sirv": "^3.0.1", + "sirv": "^3.0.2", "strip-literal": "^3.0.0", "terser": "^5.44.0", "tsconfck": "^3.1.6", diff --git a/patches/sirv@3.0.1.patch b/patches/sirv@3.0.2.patch similarity index 87% rename from patches/sirv@3.0.1.patch rename to patches/sirv@3.0.2.patch index 49de9e6b2a62b7..a0a7a4d2bc85d2 100644 --- a/patches/sirv@3.0.1.patch +++ b/patches/sirv@3.0.2.patch @@ -1,5 +1,5 @@ diff --git a/build.js b/build.js -index 0c6ed8e2c0949c93978dd1a244baa9bf2448e9b8..08a9347cfdca06e6a97077ea4582c5b0922ecb2d 100644 +index 3734120d67745ff83b2df07fa5d0a40dcb92a69b..7bfb6faa81ccfcb9016fd2b071a2f93b24e75479 100644 --- a/build.js +++ b/build.js @@ -35,7 +35,7 @@ function viaCache(cache, uri, extns) { @@ -11,7 +11,7 @@ index 0c6ed8e2c0949c93978dd1a244baa9bf2448e9b8..08a9347cfdca06e6a97077ea4582c5b0 let i=0, arr=toAssume(uri, extns); let abs, stats, name, headers; for (; i < arr.length; i++) { -@@ -43,6 +43,7 @@ function viaLocal(dir, isEtag, uri, extns) { +@@ -46,6 +46,7 @@ function viaLocal(dir, isEtag, uri, extns) { if (abs.startsWith(dir) && fs.existsSync(abs)) { stats = fs.statSync(abs); if (stats.isDirectory()) continue; @@ -19,7 +19,7 @@ index 0c6ed8e2c0949c93978dd1a244baa9bf2448e9b8..08a9347cfdca06e6a97077ea4582c5b0 headers = toHeaders(name, stats, isEtag); headers['Cache-Control'] = isEtag ? 'no-cache' : 'no-store'; return { abs, stats, headers }; -@@ -176,7 +177,7 @@ module.exports = function (dir, opts={}) { +@@ -179,7 +180,7 @@ module.exports = function (dir, opts={}) { catch (err) { /* malform uri */ } } @@ -29,7 +29,7 @@ index 0c6ed8e2c0949c93978dd1a244baa9bf2448e9b8..08a9347cfdca06e6a97077ea4582c5b0 if (isEtag && req.headers['if-none-match'] === data.headers['ETag']) { diff --git a/build.mjs b/build.mjs -index 3ad14d45630a8627b93842a04a96465120d3f223..8451277c015b56a7d2cb99aaee3a318d9c0893dd 100644 +index 2f866d5216c951ec125f2044af070fa6b530e375..a4dfae6d0738568b4f9b86fdfbec47c94562957c 100644 --- a/build.mjs +++ b/build.mjs @@ -35,7 +35,7 @@ function viaCache(cache, uri, extns) { @@ -41,7 +41,7 @@ index 3ad14d45630a8627b93842a04a96465120d3f223..8451277c015b56a7d2cb99aaee3a318d let i=0, arr=toAssume(uri, extns); let abs, stats, name, headers; for (; i < arr.length; i++) { -@@ -43,6 +43,7 @@ function viaLocal(dir, isEtag, uri, extns) { +@@ -46,6 +46,7 @@ function viaLocal(dir, isEtag, uri, extns) { if (abs.startsWith(dir) && fs.existsSync(abs)) { stats = fs.statSync(abs); if (stats.isDirectory()) continue; @@ -49,7 +49,7 @@ index 3ad14d45630a8627b93842a04a96465120d3f223..8451277c015b56a7d2cb99aaee3a318d headers = toHeaders(name, stats, isEtag); headers['Cache-Control'] = isEtag ? 'no-cache' : 'no-store'; return { abs, stats, headers }; -@@ -176,7 +177,7 @@ export default function (dir, opts={}) { +@@ -179,7 +180,7 @@ export default function (dir, opts={}) { catch (err) { /* malform uri */ } } diff --git a/playground/lib/package.json b/playground/lib/package.json index 0db97d117e49be..9bf781949774a6 100644 --- a/playground/lib/package.json +++ b/playground/lib/package.json @@ -10,6 +10,6 @@ "preview": "vite preview" }, "devDependencies": { - "sirv": "^3.0.1" + "sirv": "^3.0.2" } } diff --git a/playground/ssr-conditions/package.json b/playground/ssr-conditions/package.json index 96c9ef988f226b..96bb52d7f3b9a9 100644 --- a/playground/ssr-conditions/package.json +++ b/playground/ssr-conditions/package.json @@ -17,6 +17,6 @@ }, "devDependencies": { "express": "^5.1.0", - "sirv": "^3.0.1" + "sirv": "^3.0.2" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 49fb526831fa0a..3340baa64f8c21 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,9 +16,9 @@ patchedDependencies: dotenv-expand@12.0.3: hash: 49330a663821151418e003e822a82a6a61d2f0f8a6e3cab00c1c94815a112889 path: patches/dotenv-expand@12.0.3.patch - sirv@3.0.1: - hash: 95b663b930c5cc6e609c7fa15b69a86ff3b30df68978611d1d3d724c65135cb1 - path: patches/sirv@3.0.1.patch + sirv@3.0.2: + hash: 072611f3564d76f0b627bdd633376cb22c7a00dda91f75361662c101fe103f16 + path: patches/sirv@3.0.2.patch importers: @@ -405,8 +405,8 @@ importers: specifier: ^1.92.1 version: 1.92.1(source-map-js@1.2.1) sirv: - specifier: ^3.0.1 - version: 3.0.1(patch_hash=95b663b930c5cc6e609c7fa15b69a86ff3b30df68978611d1d3d724c65135cb1) + specifier: ^3.0.2 + version: 3.0.2(patch_hash=072611f3564d76f0b627bdd633376cb22c7a00dda91f75361662c101fe103f16) strip-literal: specifier: ^3.0.0 version: 3.0.0 @@ -878,8 +878,8 @@ importers: playground/lib: devDependencies: sirv: - specifier: ^3.0.1 - version: 3.0.1(patch_hash=95b663b930c5cc6e609c7fa15b69a86ff3b30df68978611d1d3d724c65135cb1) + specifier: ^3.0.2 + version: 3.0.2(patch_hash=072611f3564d76f0b627bdd633376cb22c7a00dda91f75361662c101fe103f16) playground/minify: dependencies: @@ -1428,8 +1428,8 @@ importers: specifier: ^5.1.0 version: 5.1.0 sirv: - specifier: ^3.0.1 - version: 3.0.1(patch_hash=95b663b930c5cc6e609c7fa15b69a86ff3b30df68978611d1d3d724c65135cb1) + specifier: ^3.0.2 + version: 3.0.2(patch_hash=072611f3564d76f0b627bdd633376cb22c7a00dda91f75361662c101fe103f16) playground/ssr-conditions/external: {} @@ -6780,8 +6780,8 @@ packages: simple-swizzle@0.2.2: resolution: {integrity: sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==} - sirv@3.0.1: - resolution: {integrity: sha512-FoqMu0NCGBLCcAkS1qA+XJIQTR6/JHfQXl+uGteNCQ76T91DMUjPa9xfmeqMY3z80nLSg9yQmNjK0Px6RWsH/A==} + sirv@3.0.2: + resolution: {integrity: sha512-2wcC/oGxHis/BoHkkPwldgiPSYcpZK3JU28WoMVv55yHJgcZ8rlXvuG9iZggz+sU1d4bRgIGASwyWqjxu3FM0g==} engines: {node: '>=18'} sisteransi@1.0.5: @@ -12792,7 +12792,7 @@ snapshots: dependencies: is-arrayish: 0.3.2 - sirv@3.0.1(patch_hash=95b663b930c5cc6e609c7fa15b69a86ff3b30df68978611d1d3d724c65135cb1): + sirv@3.0.2(patch_hash=072611f3564d76f0b627bdd633376cb22c7a00dda91f75361662c101fe103f16): dependencies: '@polka/url': 1.0.0-next.28 mrmime: 2.0.1 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index b98aded812fa48..cd7d979737644a 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -14,7 +14,7 @@ dedupeInjectedDeps: false overrides: vite: 'workspace:*' patchedDependencies: - "sirv@3.0.1": "patches/sirv@3.0.1.patch" + "sirv@3.0.2": "patches/sirv@3.0.2.patch" "chokidar@3.6.0": "patches/chokidar@3.6.0.patch" "dotenv-expand@12.0.3": "patches/dotenv-expand@12.0.3.patch" peerDependencyRules: From 363be79baa48bd200f1288bec25864ef933a4ec2 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Mon, 8 Sep 2025 14:30:18 +0900 Subject: [PATCH 2/2] fix: avoid double sep --- patches/sirv@3.0.2.patch | 22 ++++++++++++++++++++-- pnpm-lock.yaml | 10 +++++----- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/patches/sirv@3.0.2.patch b/patches/sirv@3.0.2.patch index a0a7a4d2bc85d2..88002c855e0353 100644 --- a/patches/sirv@3.0.2.patch +++ b/patches/sirv@3.0.2.patch @@ -1,5 +1,5 @@ diff --git a/build.js b/build.js -index 3734120d67745ff83b2df07fa5d0a40dcb92a69b..7bfb6faa81ccfcb9016fd2b071a2f93b24e75479 100644 +index 3734120d67745ff83b2df07fa5d0a40dcb92a69b..bd57f693ac2bd4555a12e7a5436fb9524789ef66 100644 --- a/build.js +++ b/build.js @@ -35,7 +35,7 @@ function viaCache(cache, uri, extns) { @@ -19,6 +19,15 @@ index 3734120d67745ff83b2df07fa5d0a40dcb92a69b..7bfb6faa81ccfcb9016fd2b071a2f93b headers = toHeaders(name, stats, isEtag); headers['Cache-Control'] = isEtag ? 'no-cache' : 'no-store'; return { abs, stats, headers }; +@@ -164,7 +165,7 @@ module.exports = function (dir, opts={}) { + }); + } + +- let lookup = opts.dev ? viaLocal.bind(0, dir + sep, isEtag) : viaCache.bind(0, FILES); ++ let lookup = opts.dev ? viaLocal.bind(0, dir.endsWith(sep) ? dir : dir + sep, isEtag) : viaCache.bind(0, FILES); + + return function (req, res, next) { + let extns = ['']; @@ -179,7 +180,7 @@ module.exports = function (dir, opts={}) { catch (err) { /* malform uri */ } } @@ -29,7 +38,7 @@ index 3734120d67745ff83b2df07fa5d0a40dcb92a69b..7bfb6faa81ccfcb9016fd2b071a2f93b if (isEtag && req.headers['if-none-match'] === data.headers['ETag']) { diff --git a/build.mjs b/build.mjs -index 2f866d5216c951ec125f2044af070fa6b530e375..a4dfae6d0738568b4f9b86fdfbec47c94562957c 100644 +index 2f866d5216c951ec125f2044af070fa6b530e375..d5335bfbb16e23b57385c1a83226611e29c39093 100644 --- a/build.mjs +++ b/build.mjs @@ -35,7 +35,7 @@ function viaCache(cache, uri, extns) { @@ -49,6 +58,15 @@ index 2f866d5216c951ec125f2044af070fa6b530e375..a4dfae6d0738568b4f9b86fdfbec47c9 headers = toHeaders(name, stats, isEtag); headers['Cache-Control'] = isEtag ? 'no-cache' : 'no-store'; return { abs, stats, headers }; +@@ -164,7 +165,7 @@ export default function (dir, opts={}) { + }); + } + +- let lookup = opts.dev ? viaLocal.bind(0, dir + sep, isEtag) : viaCache.bind(0, FILES); ++ let lookup = opts.dev ? viaLocal.bind(0, dir.endsWith(sep) ? dir : dir + sep, isEtag) : viaCache.bind(0, FILES); + + return function (req, res, next) { + let extns = ['']; @@ -179,7 +180,7 @@ export default function (dir, opts={}) { catch (err) { /* malform uri */ } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3340baa64f8c21..2efe74dc92e83c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,7 +17,7 @@ patchedDependencies: hash: 49330a663821151418e003e822a82a6a61d2f0f8a6e3cab00c1c94815a112889 path: patches/dotenv-expand@12.0.3.patch sirv@3.0.2: - hash: 072611f3564d76f0b627bdd633376cb22c7a00dda91f75361662c101fe103f16 + hash: c07c56eb72faea34341d465cde2314e89db472106ed378181e3447893af6bf95 path: patches/sirv@3.0.2.patch importers: @@ -406,7 +406,7 @@ importers: version: 1.92.1(source-map-js@1.2.1) sirv: specifier: ^3.0.2 - version: 3.0.2(patch_hash=072611f3564d76f0b627bdd633376cb22c7a00dda91f75361662c101fe103f16) + version: 3.0.2(patch_hash=c07c56eb72faea34341d465cde2314e89db472106ed378181e3447893af6bf95) strip-literal: specifier: ^3.0.0 version: 3.0.0 @@ -879,7 +879,7 @@ importers: devDependencies: sirv: specifier: ^3.0.2 - version: 3.0.2(patch_hash=072611f3564d76f0b627bdd633376cb22c7a00dda91f75361662c101fe103f16) + version: 3.0.2(patch_hash=c07c56eb72faea34341d465cde2314e89db472106ed378181e3447893af6bf95) playground/minify: dependencies: @@ -1429,7 +1429,7 @@ importers: version: 5.1.0 sirv: specifier: ^3.0.2 - version: 3.0.2(patch_hash=072611f3564d76f0b627bdd633376cb22c7a00dda91f75361662c101fe103f16) + version: 3.0.2(patch_hash=c07c56eb72faea34341d465cde2314e89db472106ed378181e3447893af6bf95) playground/ssr-conditions/external: {} @@ -12792,7 +12792,7 @@ snapshots: dependencies: is-arrayish: 0.3.2 - sirv@3.0.2(patch_hash=072611f3564d76f0b627bdd633376cb22c7a00dda91f75361662c101fe103f16): + sirv@3.0.2(patch_hash=c07c56eb72faea34341d465cde2314e89db472106ed378181e3447893af6bf95): dependencies: '@polka/url': 1.0.0-next.28 mrmime: 2.0.1