nitropack-nightly 2.12.7-20251003-132655.f739097c → 2.13.0-20251210-110053-de8d24c4
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/cli/build.mjs +1 -1
- package/dist/cli/dev.mjs +1 -1
- package/dist/core/index.mjs +9 -5
- package/dist/meta/index.mjs +1 -1
- package/dist/presets/_nitro/runtime/nitro-dev.mjs +1 -1
- package/dist/presets/cloudflare/dev.mjs +1 -1
- package/dist/presets/cloudflare/preset.mjs +14 -1
- package/dist/presets/cloudflare/runtime/plugin.dev.mjs +6 -9
- package/dist/presets/cloudflare/runtime/shims/workers.dev.d.mts +21 -0
- package/dist/presets/cloudflare/runtime/shims/workers.dev.mjs +27 -0
- package/dist/presets/firebase/runtime/firebase-gen-1.mjs +1 -1
- package/dist/presets/firebase/runtime/firebase-gen-2.d.ts +1 -1
- package/dist/presets/firebase/types.d.ts +1 -1
- package/dist/presets/vercel/preset.mjs +6 -0
- package/dist/presets/vercel/runtime/consts.d.ts +1 -0
- package/dist/presets/vercel/runtime/consts.mjs +1 -0
- package/dist/presets/vercel/runtime/vercel.mjs +25 -6
- package/dist/presets/vercel/types.d.ts +11 -0
- package/dist/presets/vercel/utils.d.ts +4 -0
- package/dist/presets/vercel/utils.mjs +47 -11
- package/dist/rollup/index.mjs +9 -8
- package/package.json +55 -56
package/dist/cli/build.mjs
CHANGED
package/dist/cli/dev.mjs
CHANGED
package/dist/core/index.mjs
CHANGED
|
@@ -1196,12 +1196,13 @@ async function writeTypes(nitro) {
|
|
|
1196
1196
|
);
|
|
1197
1197
|
const resolvedImportPathMap = /* @__PURE__ */ new Map();
|
|
1198
1198
|
for (const i of allImports) {
|
|
1199
|
-
|
|
1199
|
+
const from = i.typeFrom || i.from;
|
|
1200
|
+
if (resolvedImportPathMap.has(from)) {
|
|
1200
1201
|
continue;
|
|
1201
1202
|
}
|
|
1202
|
-
let path = resolveAlias(
|
|
1203
|
+
let path = resolveAlias(from, nitro.options.alias);
|
|
1203
1204
|
if (!isAbsolute(path)) {
|
|
1204
|
-
const resolvedPath = resolveModulePath(
|
|
1205
|
+
const resolvedPath = resolveModulePath(from, {
|
|
1205
1206
|
try: true,
|
|
1206
1207
|
from: nitro.options.nodeModulesDirs,
|
|
1207
1208
|
conditions: ["type", "node", "import"],
|
|
@@ -1224,12 +1225,15 @@ async function writeTypes(nitro) {
|
|
|
1224
1225
|
if (isAbsolute(path)) {
|
|
1225
1226
|
path = relative(typesDir, path);
|
|
1226
1227
|
}
|
|
1227
|
-
resolvedImportPathMap.set(
|
|
1228
|
+
resolvedImportPathMap.set(from, path);
|
|
1228
1229
|
}
|
|
1229
1230
|
autoImportedTypes = [
|
|
1230
1231
|
nitro.options.imports && nitro.options.imports.autoImport !== false ? (await nitro.unimport.generateTypeDeclarations({
|
|
1231
1232
|
exportHelper: false,
|
|
1232
|
-
resolvePath: (i) =>
|
|
1233
|
+
resolvePath: (i) => {
|
|
1234
|
+
const from = i.typeFrom || i.from;
|
|
1235
|
+
return resolvedImportPathMap.get(from) ?? from;
|
|
1236
|
+
}
|
|
1233
1237
|
})).trim() : ""
|
|
1234
1238
|
];
|
|
1235
1239
|
}
|
package/dist/meta/index.mjs
CHANGED
|
@@ -58,7 +58,7 @@ export async function cloudflareDev(nitro) {
|
|
|
58
58
|
fileURLToPath(new URL("runtime/", import.meta.url))
|
|
59
59
|
);
|
|
60
60
|
nitro.options.plugins = nitro.options.plugins || [];
|
|
61
|
-
nitro.options.plugins.
|
|
61
|
+
nitro.options.plugins.unshift(
|
|
62
62
|
fileURLToPath(new URL("runtime/plugin.dev", import.meta.url))
|
|
63
63
|
);
|
|
64
64
|
}
|
|
@@ -99,7 +99,20 @@ export const cloudflareDev = defineNitroPreset(
|
|
|
99
99
|
extends: "nitro-dev",
|
|
100
100
|
modules: [
|
|
101
101
|
async (nitro) => await import("./dev.mjs").then((m) => m.cloudflareDev(nitro))
|
|
102
|
-
]
|
|
102
|
+
],
|
|
103
|
+
esbuild: {
|
|
104
|
+
options: {
|
|
105
|
+
target: "es2022"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
unenv: {
|
|
109
|
+
meta: {
|
|
110
|
+
name: "cloudflare-dev"
|
|
111
|
+
},
|
|
112
|
+
alias: {
|
|
113
|
+
"cloudflare:workers": "nitropack/presets/cloudflare/runtime/shims/workers.dev"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
103
116
|
},
|
|
104
117
|
{
|
|
105
118
|
name: "cloudflare-dev",
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { useRuntimeConfig, getRequestURL } from "#imports";
|
|
2
|
-
const
|
|
2
|
+
const proxy = await _getPlatformProxy().catch((error) => {
|
|
3
3
|
console.error("Failed to initialize wrangler bindings proxy", error);
|
|
4
4
|
return _createStubProxy();
|
|
5
|
-
}).then((proxy) => {
|
|
6
|
-
globalThis.__env__ = proxy.env;
|
|
7
|
-
return proxy;
|
|
8
5
|
});
|
|
9
|
-
globalThis.__env__ =
|
|
6
|
+
globalThis.__env__ = proxy.env;
|
|
7
|
+
globalThis.__wait_until__ = proxy.ctx.waitUntil.bind(proxy.ctx);
|
|
10
8
|
export default (function(nitroApp) {
|
|
11
9
|
nitroApp.hooks.hook("request", async (event) => {
|
|
12
|
-
const proxy = await _proxy;
|
|
13
10
|
event.context.cf = proxy.cf;
|
|
14
11
|
event.context.waitUntil = proxy.ctx.waitUntil.bind(proxy.ctx);
|
|
15
12
|
const request = new Request(getRequestURL(event));
|
|
@@ -27,7 +24,7 @@ export default (function(nitroApp) {
|
|
|
27
24
|
});
|
|
28
25
|
nitroApp.hooks._hooks.request.unshift(nitroApp.hooks._hooks.request.pop());
|
|
29
26
|
nitroApp.hooks.hook("close", () => {
|
|
30
|
-
return
|
|
27
|
+
return proxy?.dispose();
|
|
31
28
|
});
|
|
32
29
|
});
|
|
33
30
|
async function _getPlatformProxy() {
|
|
@@ -45,8 +42,8 @@ async function _getPlatformProxy() {
|
|
|
45
42
|
if (runtimeConfig.wrangler.environment) {
|
|
46
43
|
proxyOptions.environment = runtimeConfig.wrangler.environment;
|
|
47
44
|
}
|
|
48
|
-
const
|
|
49
|
-
return
|
|
45
|
+
const proxy2 = await getPlatformProxy(proxyOptions);
|
|
46
|
+
return proxy2;
|
|
50
47
|
}
|
|
51
48
|
function _createStubProxy() {
|
|
52
49
|
return {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function waitUntil(promise: any): Promise<void>;
|
|
2
|
+
export function withEnv(newEnv: any, fn: any): void;
|
|
3
|
+
export class DurableObject extends NotImplemented {
|
|
4
|
+
}
|
|
5
|
+
export class RpcPromise extends NotImplemented {
|
|
6
|
+
}
|
|
7
|
+
export class RpcProperty extends NotImplemented {
|
|
8
|
+
}
|
|
9
|
+
export class RpcStub extends NotImplemented {
|
|
10
|
+
}
|
|
11
|
+
export class RpcTarget extends NotImplemented {
|
|
12
|
+
}
|
|
13
|
+
export class ServiceStub extends NotImplemented {
|
|
14
|
+
}
|
|
15
|
+
export class WorkerEntrypoint extends NotImplemented {
|
|
16
|
+
}
|
|
17
|
+
export class WorkflowEntrypoint extends NotImplemented {
|
|
18
|
+
}
|
|
19
|
+
declare class NotImplemented {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Shim for "cloudflare:workers" import in dev environment
|
|
2
|
+
|
|
3
|
+
// unenv shim respects __env__
|
|
4
|
+
export { env } from "unenv/node/internal/process/env";
|
|
5
|
+
|
|
6
|
+
export async function waitUntil(promise) {
|
|
7
|
+
await globalThis.__wait_until__?.(promise);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function withEnv(newEnv, fn) {
|
|
11
|
+
throw new Error("cf.withEnv is not implemented in dev env currently.");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
class NotImplemented {
|
|
15
|
+
constructor() {
|
|
16
|
+
throw new Error("Not implemented in dev env currently.");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class DurableObject extends NotImplemented {}
|
|
21
|
+
export class RpcPromise extends NotImplemented {}
|
|
22
|
+
export class RpcProperty extends NotImplemented {}
|
|
23
|
+
export class RpcStub extends NotImplemented {}
|
|
24
|
+
export class RpcTarget extends NotImplemented {}
|
|
25
|
+
export class ServiceStub extends NotImplemented {}
|
|
26
|
+
export class WorkerEntrypoint extends NotImplemented {}
|
|
27
|
+
export class WorkflowEntrypoint extends NotImplemented {}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "#nitro-internal-pollyfills";
|
|
2
2
|
import { useNitroApp } from "nitropack/runtime";
|
|
3
3
|
import { useAppConfig } from "nitropack/runtime";
|
|
4
|
-
import functions from "firebase-functions";
|
|
4
|
+
import functions from "firebase-functions/v1";
|
|
5
5
|
import { toNodeListener } from "h3";
|
|
6
6
|
const nitroApp = useNitroApp();
|
|
7
7
|
const firebaseConfig = useAppConfig().nitro.firebase;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import "#nitro-internal-pollyfills";
|
|
2
|
-
export declare const __firebaseServerFunctionName__: import("firebase-functions/
|
|
2
|
+
export declare const __firebaseServerFunctionName__: import("firebase-functions/https").HttpsFunction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RuntimeOptions, region } from "firebase-functions";
|
|
1
|
+
import type { RuntimeOptions, region } from "firebase-functions/v1";
|
|
2
2
|
import type { HttpsOptions } from "firebase-functions/v2/https";
|
|
3
3
|
export type FirebaseOptions = FirebaseFunctionsOptions | AppHostingOptions;
|
|
4
4
|
export type FirebaseFunctionsOptions = FirebaseOptionsGen1 | FirebaseOptionsGen2;
|
|
@@ -10,6 +10,9 @@ const vercel = defineNitroPreset(
|
|
|
10
10
|
{
|
|
11
11
|
extends: "node",
|
|
12
12
|
entry: "./runtime/vercel",
|
|
13
|
+
vercel: {
|
|
14
|
+
skewProtection: !!process.env.VERCEL_SKEW_PROTECTION_ENABLED
|
|
15
|
+
},
|
|
13
16
|
output: {
|
|
14
17
|
dir: "{{ rootDir }}/.vercel/output",
|
|
15
18
|
serverDir: "{{ output.dir }}/functions/__fallback.func",
|
|
@@ -85,6 +88,9 @@ const vercelEdge = defineNitroPreset(
|
|
|
85
88
|
const vercelStatic = defineNitroPreset(
|
|
86
89
|
{
|
|
87
90
|
extends: "static",
|
|
91
|
+
vercel: {
|
|
92
|
+
skewProtection: !!process.env.VERCEL_SKEW_PROTECTION_ENABLED
|
|
93
|
+
},
|
|
88
94
|
output: {
|
|
89
95
|
dir: "{{ rootDir }}/.vercel/output",
|
|
90
96
|
publicDir: "{{ output.dir }}/static/{{ baseURL }}"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ISR_URL_PARAM = "__isr_route";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const ISR_URL_PARAM = "__isr_route";
|
|
@@ -1,15 +1,34 @@
|
|
|
1
1
|
import "#nitro-internal-pollyfills";
|
|
2
2
|
import { useNitroApp } from "nitropack/runtime";
|
|
3
|
+
import { getRouteRulesForPath } from "nitropack/runtime/internal/index";
|
|
3
4
|
import { toNodeListener } from "h3";
|
|
4
|
-
import { parseQuery } from "ufo";
|
|
5
|
+
import { parseQuery, withQuery } from "ufo";
|
|
6
|
+
import { ISR_URL_PARAM } from "./consts.mjs";
|
|
5
7
|
const nitroApp = useNitroApp();
|
|
6
8
|
const handler = toNodeListener(nitroApp.h3App);
|
|
7
9
|
const listener = function(req, res) {
|
|
8
|
-
const
|
|
9
|
-
if (
|
|
10
|
-
const { url } = parseQuery(
|
|
11
|
-
if (url) {
|
|
12
|
-
|
|
10
|
+
const isrRoute = req.headers["x-now-route-matches"];
|
|
11
|
+
if (isrRoute) {
|
|
12
|
+
const { [ISR_URL_PARAM]: url } = parseQuery(isrRoute);
|
|
13
|
+
if (url && typeof url === "string") {
|
|
14
|
+
const routeRules = getRouteRulesForPath(url);
|
|
15
|
+
if (routeRules.isr) {
|
|
16
|
+
req.url = url;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
} else {
|
|
20
|
+
const queryIndex = req.url.indexOf("?");
|
|
21
|
+
const urlQueryIndex = queryIndex === -1 ? -1 : req.url.indexOf(`${ISR_URL_PARAM}=`, queryIndex);
|
|
22
|
+
if (urlQueryIndex !== -1) {
|
|
23
|
+
const { [ISR_URL_PARAM]: url, ...params } = parseQuery(
|
|
24
|
+
req.url.slice(queryIndex)
|
|
25
|
+
);
|
|
26
|
+
if (url && typeof url === "string") {
|
|
27
|
+
const routeRules = getRouteRulesForPath(url);
|
|
28
|
+
if (routeRules.isr) {
|
|
29
|
+
req.url = withQuery(url, params);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
13
32
|
}
|
|
14
33
|
}
|
|
15
34
|
return handler(req, res);
|
|
@@ -85,10 +85,21 @@ export interface VercelServerlessFunctionConfig {
|
|
|
85
85
|
* Enables source map generation.
|
|
86
86
|
*/
|
|
87
87
|
shouldAddSourcemapSupport?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* The runtime to use. Defaults to the auto-detected Node.js version.
|
|
90
|
+
*/
|
|
91
|
+
runtime?: "nodejs20.x" | "nodejs22.x" | "bun1.x" | (string & {});
|
|
88
92
|
[key: string]: unknown;
|
|
89
93
|
}
|
|
90
94
|
export interface VercelOptions {
|
|
91
95
|
config: VercelBuildConfigV3;
|
|
96
|
+
/**
|
|
97
|
+
* If you have enabled skew protection in the Vercel dashboard, it will
|
|
98
|
+
* be enabled by default.
|
|
99
|
+
*
|
|
100
|
+
* You can disable the Nitro integration by setting this option to `false`.
|
|
101
|
+
*/
|
|
102
|
+
skewProtection?: boolean;
|
|
92
103
|
/**
|
|
93
104
|
* If you are using `vercel-edge`, you can specify the region(s) for your edge function.
|
|
94
105
|
* @see https://vercel.com/docs/concepts/functions/edge-functions#edge-function-regions
|
|
@@ -3,3 +3,7 @@ export declare function generateFunctionFiles(nitro: Nitro): Promise<void>;
|
|
|
3
3
|
export declare function generateEdgeFunctionFiles(nitro: Nitro): Promise<void>;
|
|
4
4
|
export declare function generateStaticFiles(nitro: Nitro): Promise<void>;
|
|
5
5
|
export declare function deprecateSWR(nitro: Nitro): void;
|
|
6
|
+
export interface VercelConfig {
|
|
7
|
+
bunVersion?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function readVercelConfig(rootDir: string): Promise<VercelConfig>;
|
|
@@ -5,6 +5,7 @@ import { dirname, relative, resolve } from "pathe";
|
|
|
5
5
|
import { joinURL, withLeadingSlash, withoutLeadingSlash } from "ufo";
|
|
6
6
|
import { isTest } from "std-env";
|
|
7
7
|
import { createRouter as createRadixRouter, toRouteMatcher } from "radix3";
|
|
8
|
+
import { ISR_URL_PARAM } from "./runtime/consts.mjs";
|
|
8
9
|
const SUPPORTED_NODE_VERSIONS = [18, 20, 22];
|
|
9
10
|
const FALLBACK_ROUTE = "/__fallback";
|
|
10
11
|
const ISR_SUFFIX = "-isr";
|
|
@@ -20,20 +21,30 @@ export async function generateFunctionFiles(nitro) {
|
|
|
20
21
|
const buildConfigPath = resolve(nitro.options.output.dir, "config.json");
|
|
21
22
|
const buildConfig = generateBuildConfig(nitro, o11Routes);
|
|
22
23
|
await writeFile(buildConfigPath, JSON.stringify(buildConfig, null, 2));
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
let runtime = nitro.options.vercel?.functions?.runtime;
|
|
25
|
+
if (!runtime) {
|
|
26
|
+
const vercelConfig = await readVercelConfig(nitro.options.rootDir);
|
|
27
|
+
if (vercelConfig.bunVersion || "Bun" in globalThis) {
|
|
28
|
+
runtime = `bun${vercelConfig.bunVersion || "1.x"}`;
|
|
29
|
+
} else {
|
|
30
|
+
const systemNodeVersion = getSystemNodeVersion();
|
|
31
|
+
const usedNodeVersion = SUPPORTED_NODE_VERSIONS.find(
|
|
32
|
+
(version) => version >= systemNodeVersion
|
|
33
|
+
) ?? SUPPORTED_NODE_VERSIONS.at(-1);
|
|
34
|
+
runtime = `nodejs${usedNodeVersion}.x`;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
26
37
|
const functionConfigPath = resolve(
|
|
27
38
|
nitro.options.output.serverDir,
|
|
28
39
|
".vc-config.json"
|
|
29
40
|
);
|
|
30
41
|
const functionConfig = {
|
|
31
|
-
runtime
|
|
42
|
+
runtime,
|
|
43
|
+
...nitro.options.vercel?.functions,
|
|
32
44
|
handler: "index.mjs",
|
|
33
45
|
launcherType: "Nodejs",
|
|
34
46
|
shouldAddHelpers: false,
|
|
35
|
-
supportsResponseStreaming: true
|
|
36
|
-
...nitro.options.vercel?.functions
|
|
47
|
+
supportsResponseStreaming: true
|
|
37
48
|
};
|
|
38
49
|
await writeFile(functionConfigPath, JSON.stringify(functionConfig, null, 2));
|
|
39
50
|
for (const [key, value] of Object.entries(nitro.options.routeRules)) {
|
|
@@ -136,6 +147,23 @@ function generateBuildConfig(nitro, o11Routes) {
|
|
|
136
147
|
}
|
|
137
148
|
return route;
|
|
138
149
|
}),
|
|
150
|
+
// Skew protection
|
|
151
|
+
...nitro.options.vercel?.skewProtection && process.env.VERCEL_DEPLOYMENT_ID ? [
|
|
152
|
+
{
|
|
153
|
+
src: "/.*",
|
|
154
|
+
has: [
|
|
155
|
+
{
|
|
156
|
+
type: "header",
|
|
157
|
+
key: "Sec-Fetch-Dest",
|
|
158
|
+
value: "document"
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
headers: {
|
|
162
|
+
"Set-Cookie": `__vdpl=${process.env.VERCEL_DEPLOYMENT_ID}; Path=${nitro.options.baseURL}; SameSite=Strict; Secure; HttpOnly`
|
|
163
|
+
},
|
|
164
|
+
continue: true
|
|
165
|
+
}
|
|
166
|
+
] : [],
|
|
139
167
|
// Public asset rules
|
|
140
168
|
...nitro.options.publicAssets.filter((asset) => !asset.fallthrough).map((asset) => joinURL(nitro.options.baseURL, asset.baseURL || "/")).map((baseURL) => ({
|
|
141
169
|
src: baseURL + "(.*)",
|
|
@@ -153,12 +181,12 @@ function generateBuildConfig(nitro, o11Routes) {
|
|
|
153
181
|
config.routes.push(
|
|
154
182
|
...nitro.options.routeRules["/"]?.isr ? [
|
|
155
183
|
{
|
|
156
|
-
src:
|
|
157
|
-
dest: `/index${ISR_SUFFIX}
|
|
184
|
+
src: `(?<${ISR_URL_PARAM}>/)`,
|
|
185
|
+
dest: `/index${ISR_SUFFIX}?${ISR_URL_PARAM}=$${ISR_URL_PARAM}`
|
|
158
186
|
}
|
|
159
187
|
] : [],
|
|
160
188
|
...rules.filter(([key, value]) => value.isr !== void 0 && key !== "/").map(([key, value]) => {
|
|
161
|
-
const src = `(
|
|
189
|
+
const src = `(?<${ISR_URL_PARAM}>${normalizeRouteSrc(key)})`;
|
|
162
190
|
if (value.isr === false) {
|
|
163
191
|
return {
|
|
164
192
|
src,
|
|
@@ -167,8 +195,8 @@ function generateBuildConfig(nitro, o11Routes) {
|
|
|
167
195
|
}
|
|
168
196
|
return {
|
|
169
197
|
src,
|
|
170
|
-
dest: nitro.options.preset === "vercel-edge" ? FALLBACK_ROUTE +
|
|
171
|
-
normalizeRouteDest(key) + ISR_SUFFIX +
|
|
198
|
+
dest: nitro.options.preset === "vercel-edge" ? FALLBACK_ROUTE + `?${ISR_URL_PARAM}=$${ISR_URL_PARAM}` : withLeadingSlash(
|
|
199
|
+
normalizeRouteDest(key) + ISR_SUFFIX + `?${ISR_URL_PARAM}=$${ISR_URL_PARAM}`
|
|
172
200
|
)
|
|
173
201
|
};
|
|
174
202
|
}),
|
|
@@ -212,6 +240,11 @@ export function deprecateSWR(nitro) {
|
|
|
212
240
|
);
|
|
213
241
|
}
|
|
214
242
|
}
|
|
243
|
+
export async function readVercelConfig(rootDir) {
|
|
244
|
+
const vercelConfigPath = resolve(rootDir, "vercel.json");
|
|
245
|
+
const vercelConfig = await fsp.readFile(vercelConfigPath).then((config) => JSON.parse(config.toString())).catch(() => ({}));
|
|
246
|
+
return vercelConfig;
|
|
247
|
+
}
|
|
215
248
|
function _hasProp(obj, prop) {
|
|
216
249
|
return obj && typeof obj === "object" && prop in obj;
|
|
217
250
|
}
|
|
@@ -306,5 +339,8 @@ async function writePrerenderConfig(filename, isrConfig, bypassToken) {
|
|
|
306
339
|
bypassToken,
|
|
307
340
|
...isrConfig
|
|
308
341
|
};
|
|
342
|
+
if (prerenderConfig.allowQuery && !prerenderConfig.allowQuery.includes(ISR_URL_PARAM)) {
|
|
343
|
+
prerenderConfig.allowQuery.push(ISR_URL_PARAM);
|
|
344
|
+
}
|
|
309
345
|
await writeFile(filename, JSON.stringify(prerenderConfig, null, 2));
|
|
310
346
|
}
|
package/dist/rollup/index.mjs
CHANGED
|
@@ -670,19 +670,19 @@ function compareVersions(v1 = "0.0.0", v2 = "0.0.0") {
|
|
|
670
670
|
return v1.localeCompare(v2);
|
|
671
671
|
}
|
|
672
672
|
}
|
|
673
|
-
function applyProductionCondition(exports) {
|
|
674
|
-
if (!exports || typeof exports === "string" || Array.isArray(exports)) {
|
|
673
|
+
function applyProductionCondition(exports$1) {
|
|
674
|
+
if (!exports$1 || typeof exports$1 === "string" || Array.isArray(exports$1)) {
|
|
675
675
|
return;
|
|
676
676
|
}
|
|
677
|
-
if ("production" in exports) {
|
|
678
|
-
if (typeof exports.production === "string") {
|
|
679
|
-
exports.default = exports.production;
|
|
677
|
+
if ("production" in exports$1) {
|
|
678
|
+
if (typeof exports$1.production === "string") {
|
|
679
|
+
exports$1.default = exports$1.production;
|
|
680
680
|
} else {
|
|
681
|
-
Object.assign(exports, exports.production);
|
|
681
|
+
Object.assign(exports$1, exports$1.production);
|
|
682
682
|
}
|
|
683
683
|
}
|
|
684
|
-
for (const key in exports) {
|
|
685
|
-
applyProductionCondition(exports[key]);
|
|
684
|
+
for (const key in exports$1) {
|
|
685
|
+
applyProductionCondition(exports$1[key]);
|
|
686
686
|
}
|
|
687
687
|
}
|
|
688
688
|
async function isFile$1(file) {
|
|
@@ -1866,6 +1866,7 @@ const getRollupConfig = (nitro) => {
|
|
|
1866
1866
|
rollupConfig.plugins.push(
|
|
1867
1867
|
replace({
|
|
1868
1868
|
preventAssignment: true,
|
|
1869
|
+
delimiters: [String.raw`\b`, String.raw`\b(?![\.$])`],
|
|
1869
1870
|
values: {
|
|
1870
1871
|
"typeof window": '"undefined"',
|
|
1871
1872
|
_import_meta_url_: "import.meta.url",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitropack-nightly",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0-20251210-110053-de8d24c4",
|
|
4
4
|
"description": "Build and Deploy Universal JavaScript Servers",
|
|
5
5
|
"repository": "nitrojs/nitro",
|
|
6
6
|
"license": "MIT",
|
|
@@ -80,7 +80,6 @@
|
|
|
80
80
|
"dev": "pnpm -C playground dev",
|
|
81
81
|
"dev:build": "pnpm -C playground build",
|
|
82
82
|
"dev:start": "node playground/.output/server/index.mjs",
|
|
83
|
-
"gen-mirror": "pnpm jiti scripts/gen-mirror.ts",
|
|
84
83
|
"gen-node-compat": "pnpm node-ts scripts/gen-node-compat.ts",
|
|
85
84
|
"gen-presets": "pnpm jiti scripts/gen-presets.ts",
|
|
86
85
|
"lint": "eslint --cache . && prettier -c .",
|
|
@@ -88,7 +87,7 @@
|
|
|
88
87
|
"nitro": "jiti ./src/cli/index.ts",
|
|
89
88
|
"node-ts": "node --disable-warning=ExperimentalWarning --experimental-strip-types",
|
|
90
89
|
"prepack": "pnpm build",
|
|
91
|
-
"release": "pnpm test && pnpm build && changelogen --release
|
|
90
|
+
"release": "pnpm test && pnpm build && changelogen --release --publish && git push --follow-tags",
|
|
92
91
|
"stub": "unbuild --stub",
|
|
93
92
|
"test": "pnpm lint && pnpm vitest run",
|
|
94
93
|
"test:fixture:types": "pnpm stub && jiti ./test/scripts/gen-fixture-types.ts && cd test/fixture && tsc --noEmit",
|
|
@@ -98,17 +97,17 @@
|
|
|
98
97
|
"nitropack": "link:."
|
|
99
98
|
},
|
|
100
99
|
"dependencies": {
|
|
101
|
-
"@cloudflare/kv-asset-handler": "^0.4.
|
|
102
|
-
"@rollup/plugin-alias": "^
|
|
103
|
-
"@rollup/plugin-commonjs": "^
|
|
100
|
+
"@cloudflare/kv-asset-handler": "^0.4.1",
|
|
101
|
+
"@rollup/plugin-alias": "^6.0.0",
|
|
102
|
+
"@rollup/plugin-commonjs": "^29.0.0",
|
|
104
103
|
"@rollup/plugin-inject": "^5.0.5",
|
|
105
104
|
"@rollup/plugin-json": "^6.1.0",
|
|
106
|
-
"@rollup/plugin-node-resolve": "^16.0.
|
|
107
|
-
"@rollup/plugin-replace": "^6.0.
|
|
105
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
106
|
+
"@rollup/plugin-replace": "^6.0.3",
|
|
108
107
|
"@rollup/plugin-terser": "^0.4.4",
|
|
109
|
-
"@vercel/nft": "^
|
|
108
|
+
"@vercel/nft": "^1.1.1",
|
|
110
109
|
"archiver": "^7.0.1",
|
|
111
|
-
"c12": "^3.2
|
|
110
|
+
"c12": "^3.3.2",
|
|
112
111
|
"chokidar": "^4.0.3",
|
|
113
112
|
"citty": "^0.1.6",
|
|
114
113
|
"compatx": "^0.2.0",
|
|
@@ -117,94 +116,94 @@
|
|
|
117
116
|
"cookie-es": "^2.0.0",
|
|
118
117
|
"croner": "^9.1.0",
|
|
119
118
|
"crossws": "^0.3.5",
|
|
120
|
-
"db0": "^0.3.
|
|
119
|
+
"db0": "^0.3.4",
|
|
121
120
|
"defu": "^6.1.4",
|
|
122
121
|
"destr": "^2.0.5",
|
|
123
|
-
"dot-prop": "^
|
|
124
|
-
"esbuild": "^0.
|
|
122
|
+
"dot-prop": "^10.1.0",
|
|
123
|
+
"esbuild": "^0.27.1",
|
|
125
124
|
"escape-string-regexp": "^5.0.0",
|
|
126
125
|
"etag": "^1.8.1",
|
|
127
|
-
"exsolve": "^1.0.
|
|
128
|
-
"globby": "^
|
|
126
|
+
"exsolve": "^1.0.8",
|
|
127
|
+
"globby": "^16.0.0",
|
|
129
128
|
"gzip-size": "^7.0.0",
|
|
130
|
-
"h3": "
|
|
129
|
+
"h3": "^1.15.4",
|
|
131
130
|
"hookable": "^5.5.3",
|
|
132
131
|
"httpxy": "^0.1.7",
|
|
133
|
-
"ioredis": "^5.
|
|
134
|
-
"jiti": "^2.
|
|
132
|
+
"ioredis": "^5.8.2",
|
|
133
|
+
"jiti": "^2.6.1",
|
|
135
134
|
"klona": "^2.0.6",
|
|
136
|
-
"knitwork": "^1.
|
|
135
|
+
"knitwork": "^1.3.0",
|
|
137
136
|
"listhen": "^1.9.0",
|
|
138
|
-
"magic-string": "^0.30.
|
|
139
|
-
"magicast": "^0.
|
|
140
|
-
"mime": "^4.0
|
|
137
|
+
"magic-string": "^0.30.21",
|
|
138
|
+
"magicast": "^0.5.1",
|
|
139
|
+
"mime": "^4.1.0",
|
|
141
140
|
"mlly": "^1.8.0",
|
|
142
141
|
"node-fetch-native": "^1.6.7",
|
|
143
|
-
"node-mock-http": "^1.0.
|
|
144
|
-
"ofetch": "^1.
|
|
142
|
+
"node-mock-http": "^1.0.4",
|
|
143
|
+
"ofetch": "^1.5.1",
|
|
145
144
|
"ohash": "^2.0.11",
|
|
146
145
|
"pathe": "^2.0.3",
|
|
147
146
|
"perfect-debounce": "^2.0.0",
|
|
148
147
|
"pkg-types": "^2.3.0",
|
|
149
|
-
"pretty-bytes": "^7.0
|
|
148
|
+
"pretty-bytes": "^7.1.0",
|
|
150
149
|
"radix3": "^1.1.2",
|
|
151
|
-
"rollup": "^4.
|
|
152
|
-
"rollup-plugin-visualizer": "^6.0.
|
|
150
|
+
"rollup": "^4.53.3",
|
|
151
|
+
"rollup-plugin-visualizer": "^6.0.5",
|
|
153
152
|
"scule": "^1.3.0",
|
|
154
|
-
"semver": "^7.7.
|
|
153
|
+
"semver": "^7.7.3",
|
|
155
154
|
"serve-placeholder": "^2.0.2",
|
|
156
155
|
"serve-static": "^2.2.0",
|
|
157
156
|
"source-map": "^0.7.6",
|
|
158
|
-
"std-env": "^3.
|
|
157
|
+
"std-env": "^3.10.0",
|
|
159
158
|
"ufo": "^1.6.1",
|
|
160
159
|
"ultrahtml": "^1.6.0",
|
|
161
160
|
"uncrypto": "^0.1.3",
|
|
162
161
|
"unctx": "^2.4.1",
|
|
163
|
-
"unenv": "^2.0.0-rc.
|
|
164
|
-
"unimport": "^5.
|
|
165
|
-
"unplugin-utils": "^0.3.
|
|
166
|
-
"unstorage": "^1.17.
|
|
162
|
+
"unenv": "^2.0.0-rc.24",
|
|
163
|
+
"unimport": "^5.5.0",
|
|
164
|
+
"unplugin-utils": "^0.3.1",
|
|
165
|
+
"unstorage": "^1.17.3",
|
|
167
166
|
"untyped": "^2.0.0",
|
|
168
|
-
"unwasm": "^0.
|
|
169
|
-
"youch": "^4.1.0-beta.
|
|
167
|
+
"unwasm": "^0.5.0",
|
|
168
|
+
"youch": "^4.1.0-beta.13",
|
|
170
169
|
"youch-core": "^0.3.3"
|
|
171
170
|
},
|
|
172
171
|
"devDependencies": {
|
|
173
172
|
"@azure/functions": "^3.5.1",
|
|
174
|
-
"@azure/static-web-apps-cli": "^2.0.
|
|
175
|
-
"@cloudflare/workers-types": "^4.
|
|
173
|
+
"@azure/static-web-apps-cli": "^2.0.7",
|
|
174
|
+
"@cloudflare/workers-types": "^4.20251209.0",
|
|
176
175
|
"@deno/types": "^0.0.1",
|
|
177
|
-
"@netlify/edge-functions": "^
|
|
178
|
-
"@netlify/functions": "^
|
|
179
|
-
"@scalar/api-reference": "^1.
|
|
180
|
-
"@types/archiver": "^
|
|
181
|
-
"@types/aws-lambda": "^8.10.
|
|
176
|
+
"@netlify/edge-functions": "^3.0.3",
|
|
177
|
+
"@netlify/functions": "^5.1.1",
|
|
178
|
+
"@scalar/api-reference": "^1.40.2",
|
|
179
|
+
"@types/archiver": "^7.0.0",
|
|
180
|
+
"@types/aws-lambda": "^8.10.159",
|
|
182
181
|
"@types/estree": "^1.0.8",
|
|
183
182
|
"@types/etag": "^1.8.4",
|
|
184
183
|
"@types/fs-extra": "^11.0.4",
|
|
185
184
|
"@types/node-fetch": "^2.6.13",
|
|
186
185
|
"@types/semver": "^7.7.1",
|
|
187
|
-
"@types/serve-static": "^
|
|
186
|
+
"@types/serve-static": "^2.2.0",
|
|
188
187
|
"@types/xml2js": "^0.4.14",
|
|
189
|
-
"@vitest/coverage-v8": "^
|
|
190
|
-
"automd": "^0.4.
|
|
188
|
+
"@vitest/coverage-v8": "^4.0.15",
|
|
189
|
+
"automd": "^0.4.2",
|
|
191
190
|
"changelogen": "^0.6.2",
|
|
192
191
|
"edge-runtime": "^4.0.1",
|
|
193
|
-
"eslint": "^9.
|
|
192
|
+
"eslint": "^9.39.1",
|
|
194
193
|
"eslint-config-unjs": "^0.5.0",
|
|
195
|
-
"execa": "^9.6.
|
|
196
|
-
"expect-type": "^1.
|
|
197
|
-
"firebase-admin": "^
|
|
198
|
-
"firebase-functions": "^
|
|
194
|
+
"execa": "^9.6.1",
|
|
195
|
+
"expect-type": "^1.3.0",
|
|
196
|
+
"firebase-admin": "^13.6.0",
|
|
197
|
+
"firebase-functions": "^7.0.1",
|
|
199
198
|
"get-port-please": "^3.2.0",
|
|
200
|
-
"miniflare": "^4.
|
|
199
|
+
"miniflare": "^4.20251202.1",
|
|
201
200
|
"ohash-v1": "npm:ohash@^1.1.6",
|
|
202
|
-
"prettier": "^3.
|
|
203
|
-
"typescript": "^5.9.
|
|
201
|
+
"prettier": "^3.7.4",
|
|
202
|
+
"typescript": "^5.9.3",
|
|
204
203
|
"unbuild": "^3.6.1",
|
|
205
204
|
"undici": "^7.16.0",
|
|
206
|
-
"vitest": "^
|
|
207
|
-
"wrangler": "^4.
|
|
205
|
+
"vitest": "^4.0.15",
|
|
206
|
+
"wrangler": "^4.53.0",
|
|
208
207
|
"xml2js": "^0.6.2"
|
|
209
208
|
},
|
|
210
209
|
"peerDependencies": {
|
|
@@ -215,7 +214,7 @@
|
|
|
215
214
|
"optional": true
|
|
216
215
|
}
|
|
217
216
|
},
|
|
218
|
-
"packageManager": "pnpm@10.
|
|
217
|
+
"packageManager": "pnpm@10.25.0",
|
|
219
218
|
"engines": {
|
|
220
219
|
"node": "^20.19.0 || >=22.12.0"
|
|
221
220
|
},
|