nitropack-nightly 2.12.6-20250908-085153.e195f910 → 2.12.6-20250908-120209.81c2f9cd
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/meta/index.mjs +1 -1
- package/dist/presets/vercel/utils.mjs +12 -14
- package/package.json +1 -1
package/dist/meta/index.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { isTest } from "std-env";
|
|
|
7
7
|
import { createRouter as createRadixRouter, toRouteMatcher } from "radix3";
|
|
8
8
|
const SUPPORTED_NODE_VERSIONS = [18, 20, 22];
|
|
9
9
|
const FALLBACK_ROUTE = "/__fallback";
|
|
10
|
+
const ISR_SUFFIX = "-isr";
|
|
10
11
|
const SAFE_FS_CHAR_RE = /[^a-zA-Z0-9_.[\]/]/g;
|
|
11
12
|
function getSystemNodeVersion() {
|
|
12
13
|
const systemNodeVersion = Number.parseInt(
|
|
@@ -42,7 +43,7 @@ export async function generateFunctionFiles(nitro) {
|
|
|
42
43
|
const funcPrefix = resolve(
|
|
43
44
|
nitro.options.output.serverDir,
|
|
44
45
|
"..",
|
|
45
|
-
normalizeRouteDest(key) +
|
|
46
|
+
normalizeRouteDest(key) + ISR_SUFFIX
|
|
46
47
|
);
|
|
47
48
|
await fsp.mkdir(dirname(funcPrefix), { recursive: true });
|
|
48
49
|
await fsp.symlink(
|
|
@@ -150,12 +151,13 @@ function generateBuildConfig(nitro, o11Routes) {
|
|
|
150
151
|
return config;
|
|
151
152
|
}
|
|
152
153
|
config.routes.push(
|
|
153
|
-
...
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
154
|
+
...nitro.options.routeRules["/"]?.isr ? [
|
|
155
|
+
{
|
|
156
|
+
src: "(?<url>/)",
|
|
157
|
+
dest: `/index${ISR_SUFFIX}?url=$url`
|
|
158
|
+
}
|
|
159
|
+
] : [],
|
|
160
|
+
...rules.filter(([key, value]) => value.isr !== void 0 && key !== "/").map(([key, value]) => {
|
|
159
161
|
const src = key.replace(/^(.*)\/\*\*/, "(?<url>$1/.*)");
|
|
160
162
|
if (value.isr === false) {
|
|
161
163
|
return {
|
|
@@ -165,15 +167,11 @@ function generateBuildConfig(nitro, o11Routes) {
|
|
|
165
167
|
}
|
|
166
168
|
return {
|
|
167
169
|
src,
|
|
168
|
-
dest: nitro.options.preset === "vercel-edge" ? FALLBACK_ROUTE + "?url=$url" : withLeadingSlash(
|
|
170
|
+
dest: nitro.options.preset === "vercel-edge" ? FALLBACK_ROUTE + "?url=$url" : withLeadingSlash(
|
|
171
|
+
normalizeRouteDest(key) + ISR_SUFFIX + "?url=$url"
|
|
172
|
+
)
|
|
169
173
|
};
|
|
170
174
|
}),
|
|
171
|
-
...nitro.options.routeRules["/"]?.isr ? [
|
|
172
|
-
{
|
|
173
|
-
src: "(?<url>/)",
|
|
174
|
-
dest: "/index.isr?url=$url"
|
|
175
|
-
}
|
|
176
|
-
] : [],
|
|
177
175
|
...(o11Routes || []).map((route) => ({
|
|
178
176
|
src: joinURL(nitro.options.baseURL, route.src),
|
|
179
177
|
dest: withLeadingSlash(route.dest)
|
package/package.json
CHANGED