@nuxt/nitro-server-nightly 4.5.2-29765478.8fb72c09 → 4.5.2-29765770.c8af8ed3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +52 -11
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -22,7 +22,7 @@ import { ImpoundPlugin } from "impound";
|
|
|
22
22
|
import { resolveModulePath } from "exsolve";
|
|
23
23
|
import { runtimeDependencies } from "nitropack/runtime/meta";
|
|
24
24
|
//#region package.json
|
|
25
|
-
var version = "4.5.2-
|
|
25
|
+
var version = "4.5.2-29765770.c8af8ed3";
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/utils.ts
|
|
28
28
|
function toArray(value) {
|
|
@@ -178,6 +178,40 @@ const contextFlags = {
|
|
|
178
178
|
"shared": "the #shared directory"
|
|
179
179
|
};
|
|
180
180
|
//#endregion
|
|
181
|
+
//#region ../nuxt/src/core/utils/index.ts
|
|
182
|
+
/**
|
|
183
|
+
* Decode a route path for route-rule matching, returning it unchanged if it is not
|
|
184
|
+
* percent-encoded or cannot be decoded. Reserved characters (`%2F`, `%3F`, …) are
|
|
185
|
+
* left encoded, so decoding cannot introduce additional path segments. Only the path
|
|
186
|
+
* portion is decoded; a query string, if present, is left untouched to avoid
|
|
187
|
+
* double-decoding it.
|
|
188
|
+
*/
|
|
189
|
+
function decodeRoutePath(path) {
|
|
190
|
+
if (!path.includes("%")) return path;
|
|
191
|
+
const queryIndex = path.indexOf("?");
|
|
192
|
+
const pathname = queryIndex === -1 ? path : path.slice(0, queryIndex);
|
|
193
|
+
try {
|
|
194
|
+
return queryIndex === -1 ? decodeURI(pathname) : decodeURI(pathname) + path.slice(queryIndex);
|
|
195
|
+
} catch {
|
|
196
|
+
return path;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region ../nuxt/src/core/utils/route-rules.ts
|
|
201
|
+
/**
|
|
202
|
+
* Normalise a route-rule key or lookup path: decode percent-encoding, then case-fold when
|
|
203
|
+
* `fold` is set. Keys are matched in decoded form so that a rule may be authored either
|
|
204
|
+
* decoded (`/测试`, the usual case) or encoded (`/%E6%B5%8B%E8%AF%95`, the form the page route
|
|
205
|
+
* and the request path take). Decoding must precede case folding, or a percent-encoded
|
|
206
|
+
* non-ASCII character would never fold.
|
|
207
|
+
*
|
|
208
|
+
* @internal
|
|
209
|
+
*/
|
|
210
|
+
function normalizeRouteRulePath(path, fold) {
|
|
211
|
+
const decoded = decodeRoutePath(path);
|
|
212
|
+
return fold ? decoded.toLowerCase() : decoded;
|
|
213
|
+
}
|
|
214
|
+
//#endregion
|
|
181
215
|
//#region src/templates.ts
|
|
182
216
|
const nitroSchemaTemplate = {
|
|
183
217
|
filename: "types/nitro-nuxt.d.ts",
|
|
@@ -528,20 +562,21 @@ async function bundle(nuxt) {
|
|
|
528
562
|
"ssr"
|
|
529
563
|
];
|
|
530
564
|
const caseSensitiveRouteRules = !!nuxt.options.router.options.sensitive;
|
|
531
|
-
const
|
|
565
|
+
const warnedKeyCollisions = /* @__PURE__ */ new Set();
|
|
532
566
|
function getRouteRulesRouter(fold) {
|
|
533
567
|
const routeRulesRouter = createRouter();
|
|
534
568
|
if (nuxt._nitro) {
|
|
535
|
-
const
|
|
569
|
+
const normalizedKeys = /* @__PURE__ */ new Map();
|
|
536
570
|
for (const [route, rules] of Object.entries(nuxt._nitro.options.routeRules)) {
|
|
537
571
|
if (route === "/__nuxt_error") continue;
|
|
538
572
|
if (validManifestKeys.every((key) => !(key in rules))) continue;
|
|
539
|
-
const key =
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
573
|
+
const key = normalizeRouteRulePath(route, fold);
|
|
574
|
+
const existing = normalizedKeys.get(key);
|
|
575
|
+
if (existing !== void 0 && existing !== route && fold !== caseSensitiveRouteRules && !warnedKeyCollisions.has(key)) {
|
|
576
|
+
warnedKeyCollisions.add(key);
|
|
577
|
+
logger.warn(`Route rules for \`${existing}\` and \`${route}\` resolve to the same path; \`${route}\` takes precedence. Disambiguate the keys${fold ? " or set `router.options.sensitive: true`" : ""}.`);
|
|
544
578
|
}
|
|
579
|
+
normalizedKeys.set(key, route);
|
|
545
580
|
addRoute(routeRulesRouter, void 0, key, rules);
|
|
546
581
|
}
|
|
547
582
|
}
|
|
@@ -585,9 +620,15 @@ async function bundle(nuxt) {
|
|
|
585
620
|
`import routerOptions from '#build/router.options.mjs'`,
|
|
586
621
|
`const sensitiveMatcher = ${sensitiveMatcher}`,
|
|
587
622
|
foldedMatcher === sensitiveMatcher ? `const foldedMatcher = sensitiveMatcher` : `const foldedMatcher = ${foldedMatcher}`,
|
|
623
|
+
`const decodeRoutePath = ${decodeRoutePath.toString()}`,
|
|
624
|
+
`const normalizePath = (path, fold) => {`,
|
|
625
|
+
` if (typeof path !== 'string') { return path }`,
|
|
626
|
+
` const decoded = decodeRoutePath(path)`,
|
|
627
|
+
` return fold ? decoded.toLowerCase() : decoded`,
|
|
628
|
+
`}`,
|
|
588
629
|
`export default (path) => routerOptions.sensitive`,
|
|
589
|
-
` ? defu({}, ...sensitiveMatcher('', path).map(r => r.data).reverse())`,
|
|
590
|
-
` : defu({}, ...foldedMatcher('',
|
|
630
|
+
` ? defu({}, ...sensitiveMatcher('', normalizePath(path, false)).map(r => r.data).reverse())`,
|
|
631
|
+
` : defu({}, ...foldedMatcher('', normalizePath(path, true)).map(r => r.data).reverse())`
|
|
591
632
|
].join("\n");
|
|
592
633
|
}
|
|
593
634
|
});
|
|
@@ -653,7 +694,7 @@ async function bundle(nuxt) {
|
|
|
653
694
|
const payloadSuffix = nuxt.options.experimental.renderJsonPayloads ? "/_payload.json" : "/_payload.js";
|
|
654
695
|
for (const route of nitro._prerenderedRoutes) if (!route.error && route.route.endsWith(payloadSuffix)) {
|
|
655
696
|
const url = route.route.slice(0, -payloadSuffix.length) || "/";
|
|
656
|
-
if (!defu({}, ...findAllRoutes(routeRulesMatcher, void 0,
|
|
697
|
+
if (!defu({}, ...findAllRoutes(routeRulesMatcher, void 0, normalizeRouteRulePath(url, !caseSensitiveRouteRules)).reverse()).prerender) prerenderedRoutes.add(url);
|
|
657
698
|
}
|
|
658
699
|
}
|
|
659
700
|
const manifest = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/nitro-server-nightly",
|
|
3
|
-
"version": "4.5.2-
|
|
3
|
+
"version": "4.5.2-29765770.c8af8ed3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@nuxt/devalue": "^2.0.2",
|
|
35
|
-
"@nuxt/kit": "npm:@nuxt/kit-nightly@4.5.2-
|
|
35
|
+
"@nuxt/kit": "npm:@nuxt/kit-nightly@4.5.2-29765770.c8af8ed3",
|
|
36
36
|
"@unhead/vue": "^3.3.1",
|
|
37
37
|
"@vue/shared": "^3.5.40",
|
|
38
38
|
"consola": "^3.4.2",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@babel/plugin-proposal-decorators": "^7.25.0 || ^8.0.0",
|
|
65
65
|
"@babel/plugin-syntax-typescript": "^7.25.0 || ^8.0.0",
|
|
66
66
|
"@rollup/plugin-babel": "^6.0.0 || ^7.0.0",
|
|
67
|
-
"nuxt": "npm:nuxt-nightly@4.5.2-
|
|
67
|
+
"nuxt": "npm:nuxt-nightly@4.5.2-29765770.c8af8ed3"
|
|
68
68
|
},
|
|
69
69
|
"peerDependenciesMeta": {
|
|
70
70
|
"@babel/plugin-proposal-decorators": {
|
|
@@ -80,9 +80,9 @@
|
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@babel/plugin-proposal-decorators": "8.0.2",
|
|
82
82
|
"@babel/plugin-syntax-typescript": "8.0.3",
|
|
83
|
-
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.5.2-
|
|
83
|
+
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.5.2-29765770.c8af8ed3",
|
|
84
84
|
"@rollup/plugin-babel": "7.1.0",
|
|
85
|
-
"nuxt": "npm:nuxt-nightly@4.5.2-
|
|
85
|
+
"nuxt": "npm:nuxt-nightly@4.5.2-29765770.c8af8ed3",
|
|
86
86
|
"tsdown": "0.22.14",
|
|
87
87
|
"vitest": "4.1.10"
|
|
88
88
|
},
|