Skip to content

Commit 09f2b52

Browse files
authored
fix: upgrade sirv to 3.0.2 (#20735)
1 parent 14015d7 commit 09f2b52

File tree

6 files changed

+40
-22
lines changed

6 files changed

+40
-22
lines changed

packages/vite/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
"rollup-plugin-license": "^3.6.0",
144144
"sass": "^1.92.1",
145145
"sass-embedded": "^1.92.1",
146-
"sirv": "^3.0.1",
146+
"sirv": "^3.0.2",
147147
"strip-literal": "^3.0.0",
148148
"terser": "^5.44.0",
149149
"tsconfck": "^3.1.6",
Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/build.js b/build.js
2-
index 0c6ed8e2c0949c93978dd1a244baa9bf2448e9b8..08a9347cfdca06e6a97077ea4582c5b0922ecb2d 100644
2+
index 3734120d67745ff83b2df07fa5d0a40dcb92a69b..bd57f693ac2bd4555a12e7a5436fb9524789ef66 100644
33
--- a/build.js
44
+++ b/build.js
55
@@ -35,7 +35,7 @@ function viaCache(cache, uri, extns) {
@@ -11,15 +11,24 @@ index 0c6ed8e2c0949c93978dd1a244baa9bf2448e9b8..08a9347cfdca06e6a97077ea4582c5b0
1111
let i=0, arr=toAssume(uri, extns);
1212
let abs, stats, name, headers;
1313
for (; i < arr.length; i++) {
14-
@@ -43,6 +43,7 @@ function viaLocal(dir, isEtag, uri, extns) {
14+
@@ -46,6 +46,7 @@ function viaLocal(dir, isEtag, uri, extns) {
1515
if (abs.startsWith(dir) && fs.existsSync(abs)) {
1616
stats = fs.statSync(abs);
1717
if (stats.isDirectory()) continue;
1818
+ if (shouldServe && !shouldServe(abs)) continue;
1919
headers = toHeaders(name, stats, isEtag);
2020
headers['Cache-Control'] = isEtag ? 'no-cache' : 'no-store';
2121
return { abs, stats, headers };
22-
@@ -176,7 +177,7 @@ module.exports = function (dir, opts={}) {
22+
@@ -164,7 +165,7 @@ module.exports = function (dir, opts={}) {
23+
});
24+
}
25+
26+
- let lookup = opts.dev ? viaLocal.bind(0, dir + sep, isEtag) : viaCache.bind(0, FILES);
27+
+ let lookup = opts.dev ? viaLocal.bind(0, dir.endsWith(sep) ? dir : dir + sep, isEtag) : viaCache.bind(0, FILES);
28+
29+
return function (req, res, next) {
30+
let extns = [''];
31+
@@ -179,7 +180,7 @@ module.exports = function (dir, opts={}) {
2332
catch (err) { /* malform uri */ }
2433
}
2534

@@ -29,7 +38,7 @@ index 0c6ed8e2c0949c93978dd1a244baa9bf2448e9b8..08a9347cfdca06e6a97077ea4582c5b0
2938

3039
if (isEtag && req.headers['if-none-match'] === data.headers['ETag']) {
3140
diff --git a/build.mjs b/build.mjs
32-
index 3ad14d45630a8627b93842a04a96465120d3f223..8451277c015b56a7d2cb99aaee3a318d9c0893dd 100644
41+
index 2f866d5216c951ec125f2044af070fa6b530e375..d5335bfbb16e23b57385c1a83226611e29c39093 100644
3342
--- a/build.mjs
3443
+++ b/build.mjs
3544
@@ -35,7 +35,7 @@ function viaCache(cache, uri, extns) {
@@ -41,15 +50,24 @@ index 3ad14d45630a8627b93842a04a96465120d3f223..8451277c015b56a7d2cb99aaee3a318d
4150
let i=0, arr=toAssume(uri, extns);
4251
let abs, stats, name, headers;
4352
for (; i < arr.length; i++) {
44-
@@ -43,6 +43,7 @@ function viaLocal(dir, isEtag, uri, extns) {
53+
@@ -46,6 +46,7 @@ function viaLocal(dir, isEtag, uri, extns) {
4554
if (abs.startsWith(dir) && fs.existsSync(abs)) {
4655
stats = fs.statSync(abs);
4756
if (stats.isDirectory()) continue;
4857
+ if (shouldServe && !shouldServe(abs)) continue;
4958
headers = toHeaders(name, stats, isEtag);
5059
headers['Cache-Control'] = isEtag ? 'no-cache' : 'no-store';
5160
return { abs, stats, headers };
52-
@@ -176,7 +177,7 @@ export default function (dir, opts={}) {
61+
@@ -164,7 +165,7 @@ export default function (dir, opts={}) {
62+
});
63+
}
64+
65+
- let lookup = opts.dev ? viaLocal.bind(0, dir + sep, isEtag) : viaCache.bind(0, FILES);
66+
+ let lookup = opts.dev ? viaLocal.bind(0, dir.endsWith(sep) ? dir : dir + sep, isEtag) : viaCache.bind(0, FILES);
67+
68+
return function (req, res, next) {
69+
let extns = [''];
70+
@@ -179,7 +180,7 @@ export default function (dir, opts={}) {
5371
catch (err) { /* malform uri */ }
5472
}
5573

playground/lib/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
"preview": "vite preview"
1111
},
1212
"devDependencies": {
13-
"sirv": "^3.0.1"
13+
"sirv": "^3.0.2"
1414
}
1515
}

playground/ssr-conditions/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
},
1818
"devDependencies": {
1919
"express": "^5.1.0",
20-
"sirv": "^3.0.1"
20+
"sirv": "^3.0.2"
2121
}
2222
}

pnpm-lock.yaml

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dedupeInjectedDeps: false
1414
overrides:
1515
vite: 'workspace:*'
1616
patchedDependencies:
17-
"[email protected].1": "patches/[email protected].1.patch"
17+
"[email protected].2": "patches/[email protected].2.patch"
1818
1919
2020
peerDependencyRules:

0 commit comments

Comments
 (0)