nitropack-nightly 2.11.0-20250303-174007.c9fdeb77 → 2.11.0-20250303-180253.398eb4f3
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/core/index.mjs +3 -6
- package/dist/meta/index.d.mts +1 -1
- package/dist/meta/index.d.ts +1 -1
- package/dist/meta/index.mjs +1 -1
- package/dist/presets/cloudflare/preset.mjs +6 -8
- package/dist/presets/cloudflare/utils.mjs +3 -3
- package/dist/presets/deno/runtime/deno-server.mjs +4 -4
- package/dist/presets/netlify/legacy/utils.mjs +2 -2
- package/dist/presets/node/runtime/node-cluster.mjs +1 -3
- package/dist/presets/vercel/utils.mjs +2 -2
- package/dist/rollup/index.mjs +3 -3
- package/dist/runtime/error.mjs +0 -1
- package/dist/runtime/internal/cache.mjs +4 -4
- package/dist/runtime/internal/error/dev.mjs +1 -4
- package/dist/runtime/internal/error/prod.mjs +1 -1
- package/dist/runtime/internal/task.mjs +1 -1
- package/dist/runtime/internal/utils.mjs +1 -1
- package/package.json +2 -2
package/dist/core/index.mjs
CHANGED
|
@@ -1925,8 +1925,8 @@ const JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
|
|
|
1925
1925
|
const linkParents = /* @__PURE__ */ new Map();
|
|
1926
1926
|
async function prerender(nitro) {
|
|
1927
1927
|
if (nitro.options.noPublicDir) {
|
|
1928
|
-
|
|
1929
|
-
"
|
|
1928
|
+
nitro.logger.warn(
|
|
1929
|
+
"Skipping prerender since `noPublicDir` option is enabled."
|
|
1930
1930
|
);
|
|
1931
1931
|
return;
|
|
1932
1932
|
}
|
|
@@ -2332,15 +2332,12 @@ const defaultErrorHandler = defineNitroErrorHandler(
|
|
|
2332
2332
|
if (isSensitive) {
|
|
2333
2333
|
const tags = [error.unhandled && "[unhandled]", error.fatal && "[fatal]"].filter(Boolean).join(" ");
|
|
2334
2334
|
const columns = process.stderr.columns;
|
|
2335
|
-
if (!columns) {
|
|
2336
|
-
process.stdout.columns = 90;
|
|
2337
|
-
}
|
|
2338
2335
|
const ansiError = await (await youch.toANSI(error)).replaceAll(process.cwd(), ".");
|
|
2339
2336
|
if (!columns) {
|
|
2340
2337
|
process.stderr.columns = columns;
|
|
2341
2338
|
}
|
|
2342
2339
|
consola.error(
|
|
2343
|
-
`[
|
|
2340
|
+
`[request error] ${tags} [${event.method}] ${url}
|
|
2344
2341
|
|
|
2345
2342
|
`,
|
|
2346
2343
|
ansiError
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED
package/dist/meta/index.mjs
CHANGED
|
@@ -10,16 +10,14 @@ import {
|
|
|
10
10
|
writeCFPagesRedirects
|
|
11
11
|
} from "./utils.mjs";
|
|
12
12
|
import cfLegacyPresets from "./preset-legacy.mjs";
|
|
13
|
-
const isWindows = process.platform === "win32";
|
|
14
|
-
const commandWithDir = (command) => isWindows ? `cmd /c "cd ./ && ${command}"` : `(cd ./ && ${command})`;
|
|
15
13
|
const cloudflarePages = defineNitroPreset(
|
|
16
14
|
{
|
|
17
15
|
extends: "cloudflare",
|
|
18
16
|
entry: "./runtime/cloudflare-pages",
|
|
19
17
|
exportConditions: ["workerd"],
|
|
20
18
|
commands: {
|
|
21
|
-
preview:
|
|
22
|
-
deploy:
|
|
19
|
+
preview: "npx wrangler --cwd ./ pages dev",
|
|
20
|
+
deploy: "npx wrangler --cwd ./ pages deploy"
|
|
23
21
|
},
|
|
24
22
|
output: {
|
|
25
23
|
dir: "{{ rootDir }}/dist",
|
|
@@ -69,8 +67,8 @@ const cloudflarePagesStatic = defineNitroPreset(
|
|
|
69
67
|
publicDir: "{{ output.dir }}/{{ baseURL }}"
|
|
70
68
|
},
|
|
71
69
|
commands: {
|
|
72
|
-
preview:
|
|
73
|
-
deploy:
|
|
70
|
+
preview: "npx wrangler --cwd ./ pages dev",
|
|
71
|
+
deploy: "npx wrangler --cwd ./ pages deploy"
|
|
74
72
|
},
|
|
75
73
|
hooks: {
|
|
76
74
|
async compiled(nitro) {
|
|
@@ -92,8 +90,8 @@ const cloudflareModule = defineNitroPreset(
|
|
|
92
90
|
entry: "./runtime/cloudflare-module",
|
|
93
91
|
exportConditions: ["workerd"],
|
|
94
92
|
commands: {
|
|
95
|
-
preview:
|
|
96
|
-
deploy:
|
|
93
|
+
preview: "npx wrangler --cwd ./ dev",
|
|
94
|
+
deploy: "npx wrangler --cwd ./ deploy"
|
|
97
95
|
},
|
|
98
96
|
unenv: [unenvCfExternals],
|
|
99
97
|
rollupConfig: {
|
|
@@ -182,7 +182,7 @@ export async function writeWranglerConfig(nitro, cfTarget) {
|
|
|
182
182
|
for (const key in overrides) {
|
|
183
183
|
if (key in userConfig || key in ctxConfig) {
|
|
184
184
|
nitro.logger.warn(
|
|
185
|
-
`[
|
|
185
|
+
`[cloudflare] Wrangler config \`${key}\`${key in ctxConfig ? "set by config or modules" : ""} is overridden and will be ignored.`
|
|
186
186
|
);
|
|
187
187
|
}
|
|
188
188
|
}
|
|
@@ -196,13 +196,13 @@ export async function writeWranglerConfig(nitro, cfTarget) {
|
|
|
196
196
|
if (nitro.options.cloudflare?.nodeCompat) {
|
|
197
197
|
if (compatFlags.has("nodejs_compat_v2") && compatFlags.has("no_nodejs_compat_v2")) {
|
|
198
198
|
nitro.logger.warn(
|
|
199
|
-
"[
|
|
199
|
+
"[cloudflare] Wrangler config `compatibility_flags` contains both `nodejs_compat_v2` and `no_nodejs_compat_v2`. Ignoring `nodejs_compat_v2`."
|
|
200
200
|
);
|
|
201
201
|
compatFlags.delete("nodejs_compat_v2");
|
|
202
202
|
}
|
|
203
203
|
if (compatFlags.has("nodejs_compat_v2")) {
|
|
204
204
|
nitro.logger.warn(
|
|
205
|
-
"[
|
|
205
|
+
"[cloudflare] Please consider replacing `nodejs_compat_v2` with `nodejs_compat` in your `compatibility_flags` or USE IT AT YOUR OWN RISK as it can cause issues with nitro."
|
|
206
206
|
);
|
|
207
207
|
} else {
|
|
208
208
|
compatFlags.add("nodejs_compat");
|
|
@@ -9,20 +9,20 @@ const nitroApp = useNitroApp();
|
|
|
9
9
|
if (Deno.env.get("DEBUG")) {
|
|
10
10
|
addEventListener(
|
|
11
11
|
"unhandledrejection",
|
|
12
|
-
(event) => console.error("[
|
|
12
|
+
(event) => console.error("[unhandledRejection]", event.reason)
|
|
13
13
|
);
|
|
14
14
|
addEventListener(
|
|
15
15
|
"error",
|
|
16
|
-
(event) => console.error("[
|
|
16
|
+
(event) => console.error("[uncaughtException]", event.error)
|
|
17
17
|
);
|
|
18
18
|
} else {
|
|
19
19
|
addEventListener(
|
|
20
20
|
"unhandledrejection",
|
|
21
|
-
(err) => console.error("[
|
|
21
|
+
(err) => console.error("[unhandledRejection] " + err)
|
|
22
22
|
);
|
|
23
23
|
addEventListener(
|
|
24
24
|
"error",
|
|
25
|
-
(event) => console.error("[
|
|
25
|
+
(event) => console.error("[uncaughtException] " + event.error)
|
|
26
26
|
);
|
|
27
27
|
}
|
|
28
28
|
const serveOptions = {
|
|
@@ -123,8 +123,8 @@ export function deprecateSWR(nitro) {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
if (hasLegacyOptions && !isTest) {
|
|
126
|
-
|
|
127
|
-
"
|
|
126
|
+
nitro.logger.warn(
|
|
127
|
+
"Nitro now uses `isr` option to configure ISR behavior on Netlify. Backwards-compatible support for `static` and `swr` support with Builder Functions will be removed in the future versions. Set `future.nativeSWR: true` nitro config disable this warning."
|
|
128
128
|
);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
@@ -24,9 +24,7 @@ function runMaster() {
|
|
|
24
24
|
isShuttingDown = true;
|
|
25
25
|
await new Promise((resolve) => {
|
|
26
26
|
const timeout = setTimeout(() => {
|
|
27
|
-
console.warn(
|
|
28
|
-
"[nitro] [cluster] Timeout reached for graceful shutdown. Forcing exit."
|
|
29
|
-
);
|
|
27
|
+
console.warn("Timeout reached for graceful shutdown. Forcing exit.");
|
|
30
28
|
resolve();
|
|
31
29
|
}, shutdownConfig.timeout);
|
|
32
30
|
cluster.on("exit", () => {
|
|
@@ -192,8 +192,8 @@ export function deprecateSWR(nitro) {
|
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
if (hasLegacyOptions && !isTest) {
|
|
195
|
-
|
|
196
|
-
"
|
|
195
|
+
nitro.logger.warn(
|
|
196
|
+
"Nitro now uses `isr` option to configure ISR behavior on Vercel. Backwards-compatible support for `static` and `swr` options within the Vercel Build Options API will be removed in the future versions. Set `future.nativeSWR: true` nitro config disable this warning."
|
|
197
197
|
);
|
|
198
198
|
}
|
|
199
199
|
}
|
package/dist/rollup/index.mjs
CHANGED
|
@@ -1153,8 +1153,8 @@ function handlersMeta(nitro) {
|
|
|
1153
1153
|
}
|
|
1154
1154
|
}
|
|
1155
1155
|
} catch (error) {
|
|
1156
|
-
|
|
1157
|
-
`[
|
|
1156
|
+
nitro.logger.warn(
|
|
1157
|
+
`[handlers-meta] Cannot extra route meta for: ${id}: ${error}`
|
|
1158
1158
|
);
|
|
1159
1159
|
}
|
|
1160
1160
|
return {
|
|
@@ -1924,7 +1924,7 @@ const getRollupConfig = (nitro) => {
|
|
|
1924
1924
|
rollupConfig.plugins.push(appConfig(nitro));
|
|
1925
1925
|
rollupConfig.plugins.push(handlers(nitro));
|
|
1926
1926
|
if (nitro.options.experimental.openAPI) {
|
|
1927
|
-
rollupConfig.plugins.push(handlersMeta());
|
|
1927
|
+
rollupConfig.plugins.push(handlersMeta(nitro));
|
|
1928
1928
|
}
|
|
1929
1929
|
rollupConfig.plugins.push(errorHandler(nitro));
|
|
1930
1930
|
rollupConfig.plugins.push(
|
package/dist/runtime/error.mjs
CHANGED
|
@@ -28,13 +28,13 @@ export function defineCachedFunction(fn, opts = {}) {
|
|
|
28
28
|
async function get(key, resolver, shouldInvalidateCache, event) {
|
|
29
29
|
const cacheKey = [opts.base, group, name, key + ".json"].filter(Boolean).join(":").replace(/:\/$/, ":index");
|
|
30
30
|
let entry = await useStorage().getItem(cacheKey).catch((error) => {
|
|
31
|
-
console.error(`[
|
|
31
|
+
console.error(`[cache] Cache read error.`, error);
|
|
32
32
|
useNitroApp().captureError(error, { event, tags: ["cache"] });
|
|
33
33
|
}) || {};
|
|
34
34
|
if (typeof entry !== "object") {
|
|
35
35
|
entry = {};
|
|
36
36
|
const error = new Error("Malformed data read from cache.");
|
|
37
|
-
console.error("[
|
|
37
|
+
console.error("[cache]", error);
|
|
38
38
|
useNitroApp().captureError(error, { event, tags: ["cache"] });
|
|
39
39
|
}
|
|
40
40
|
const ttl = (opts.maxAge ?? 0) * 1e3;
|
|
@@ -71,7 +71,7 @@ export function defineCachedFunction(fn, opts = {}) {
|
|
|
71
71
|
setOpts = { ttl: opts.maxAge };
|
|
72
72
|
}
|
|
73
73
|
const promise = useStorage().setItem(cacheKey, entry, setOpts).catch((error) => {
|
|
74
|
-
console.error(`[
|
|
74
|
+
console.error(`[cache] Cache write error.`, error);
|
|
75
75
|
useNitroApp().captureError(error, { event, tags: ["cache"] });
|
|
76
76
|
});
|
|
77
77
|
if (event?.waitUntil) {
|
|
@@ -88,7 +88,7 @@ export function defineCachedFunction(fn, opts = {}) {
|
|
|
88
88
|
}
|
|
89
89
|
if (opts.swr && validate(entry) !== false) {
|
|
90
90
|
_resolvePromise.catch((error) => {
|
|
91
|
-
console.error(`[
|
|
91
|
+
console.error(`[cache] SWR handler error.`, error);
|
|
92
92
|
useNitroApp().captureError(error, { event, tags: ["cache"] });
|
|
93
93
|
});
|
|
94
94
|
return entry;
|
|
@@ -25,15 +25,12 @@ export default defineNitroErrorHandler(
|
|
|
25
25
|
if (isSensitive) {
|
|
26
26
|
const tags = [error.unhandled && "[unhandled]", error.fatal && "[fatal]"].filter(Boolean).join(" ");
|
|
27
27
|
const columns = process.stderr.columns;
|
|
28
|
-
if (!columns) {
|
|
29
|
-
process.stdout.columns = 90;
|
|
30
|
-
}
|
|
31
28
|
const ansiError = await (await youch.toANSI(error)).replaceAll(process.cwd(), ".");
|
|
32
29
|
if (!columns) {
|
|
33
30
|
process.stderr.columns = columns;
|
|
34
31
|
}
|
|
35
32
|
consola.error(
|
|
36
|
-
`[
|
|
33
|
+
`[request error] ${tags} [${event.method}] ${url}
|
|
37
34
|
|
|
38
35
|
`,
|
|
39
36
|
ansiError
|
|
@@ -15,7 +15,7 @@ export default defineNitroErrorHandler(
|
|
|
15
15
|
if (isSensitive) {
|
|
16
16
|
const tags = [error.unhandled && "[unhandled]", error.fatal && "[fatal]"].filter(Boolean).join(" ");
|
|
17
17
|
console.error(
|
|
18
|
-
`[
|
|
18
|
+
`[request error] ${tags} [${event.method}] ${url}
|
|
19
19
|
`,
|
|
20
20
|
error
|
|
21
21
|
);
|
|
@@ -26,7 +26,7 @@ export async function useRequestBody(request) {
|
|
|
26
26
|
return URL.createObjectURL(blob);
|
|
27
27
|
}
|
|
28
28
|
function _captureError(error, type) {
|
|
29
|
-
console.error(`[
|
|
29
|
+
console.error(`[${type}]`, error);
|
|
30
30
|
useNitroApp().captureError(error, { tags: [type] });
|
|
31
31
|
}
|
|
32
32
|
export function trapUnhandledNodeErrors() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitropack-nightly",
|
|
3
|
-
"version": "2.11.0-20250303-
|
|
3
|
+
"version": "2.11.0-20250303-180253.398eb4f3",
|
|
4
4
|
"description": "Build and Deploy Universal JavaScript Servers",
|
|
5
5
|
"repository": "nitrojs/nitro",
|
|
6
6
|
"license": "MIT",
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
"unstorage": "^1.15.0",
|
|
171
171
|
"untyped": "^2.0.0",
|
|
172
172
|
"unwasm": "^0.3.9",
|
|
173
|
-
"youch": "4.1.0-beta.
|
|
173
|
+
"youch": "4.1.0-beta.5",
|
|
174
174
|
"youch-core": "^0.3.1"
|
|
175
175
|
},
|
|
176
176
|
"devDependencies": {
|