nitro-nightly 3.0.1-20251127-003817-dd47a8df → 3.0.1-20251127-112821-2989d6be
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/_build/rolldown.mjs +1 -1
- package/dist/_build/rollup.mjs +1 -1
- package/dist/_build/vite.build.mjs +2 -2
- package/dist/_build/vite.plugin.mjs +2 -2
- package/dist/_chunks/{BT4o98A6.mjs → CGEOOxsU.mjs} +623 -499
- package/dist/_chunks/{QnObqKaP.mjs → _yl3G_3Y.mjs} +41 -70
- package/dist/_dev.mjs +4 -9
- package/dist/builder.mjs +1 -1
- package/dist/presets/_nitro/runtime/nitro-dev.d.mts +1 -1
- package/dist/presets/_nitro/runtime/nitro-dev.mjs +1 -1
- package/dist/presets/_nitro/runtime/nitro-prerenderer.d.mts +1 -1
- package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +1 -1
- package/dist/presets/_nitro/runtime/service-worker.d.mts +1 -1
- package/dist/presets/_nitro/runtime/service-worker.mjs +1 -1
- package/dist/presets/aws-amplify/runtime/aws-amplify.d.mts +1 -1
- package/dist/presets/aws-amplify/runtime/aws-amplify.mjs +1 -1
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.d.mts +1 -1
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +1 -1
- package/dist/presets/aws-lambda/runtime/aws-lambda.d.mts +1 -1
- package/dist/presets/aws-lambda/runtime/aws-lambda.mjs +1 -1
- package/dist/presets/azure/runtime/azure-swa.d.mts +1 -1
- package/dist/presets/azure/runtime/azure-swa.mjs +1 -1
- package/dist/presets/bun/runtime/bun.d.mts +1 -1
- package/dist/presets/bun/runtime/bun.mjs +1 -1
- package/dist/presets/cloudflare/runtime/_module-handler.d.mts +1 -1
- package/dist/presets/cloudflare/runtime/_module-handler.mjs +1 -1
- package/dist/presets/cloudflare/runtime/cloudflare-durable.d.mts +1 -1
- package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +1 -1
- package/dist/presets/cloudflare/runtime/cloudflare-module.d.mts +1 -1
- package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +1 -1
- package/dist/presets/cloudflare/runtime/cloudflare-pages.d.mts +1 -1
- package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +1 -1
- package/dist/presets/deno/runtime/deno-deploy.d.mts +1 -1
- package/dist/presets/deno/runtime/deno-deploy.mjs +1 -1
- package/dist/presets/deno/runtime/deno-server.d.mts +1 -1
- package/dist/presets/deno/runtime/deno-server.mjs +1 -1
- package/dist/presets/netlify/runtime/netlify-edge.d.mts +1 -1
- package/dist/presets/netlify/runtime/netlify-edge.mjs +1 -1
- package/dist/presets/netlify/runtime/netlify.d.mts +1 -1
- package/dist/presets/netlify/runtime/netlify.mjs +1 -1
- package/dist/presets/node/runtime/node-cluster.d.mts +1 -1
- package/dist/presets/node/runtime/node-cluster.mjs +1 -1
- package/dist/presets/node/runtime/node-middleware.d.mts +1 -1
- package/dist/presets/node/runtime/node-middleware.mjs +1 -1
- package/dist/presets/node/runtime/node-server.d.mts +1 -1
- package/dist/presets/node/runtime/node-server.mjs +1 -1
- package/dist/presets/standard/runtime/server.d.mts +1 -1
- package/dist/presets/standard/runtime/server.mjs +1 -1
- package/dist/presets/stormkit/runtime/stormkit.d.mts +1 -1
- package/dist/presets/stormkit/runtime/stormkit.mjs +1 -1
- package/dist/presets/vercel/runtime/vercel.node.d.mts +1 -1
- package/dist/presets/vercel/runtime/vercel.node.mjs +1 -1
- package/dist/presets/vercel/runtime/vercel.web.d.mts +1 -1
- package/dist/presets/vercel/runtime/vercel.web.mjs +1 -1
- package/dist/presets/winterjs/runtime/winterjs.d.mts +1 -1
- package/dist/presets/winterjs/runtime/winterjs.mjs +1 -1
- package/dist/presets/zeabur/runtime/zeabur.d.mts +1 -1
- package/dist/presets/zeabur/runtime/zeabur.mjs +1 -1
- package/dist/runtime/internal/vite/dev-entry.mjs +1 -1
- package/dist/types/index.d.mts +6 -4
- package/dist/vite.mjs +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as relative,
|
|
1
|
+
import { O as relative, a as watchConfig, g as resolveModuleURL, h as resolveModulePath, k as resolve, l as findWorkspaceDir, n as loadConfig, w as join } from "../_libs/c12.mjs";
|
|
2
2
|
import { a as createUnimport } from "../_libs/unimport.mjs";
|
|
3
3
|
import { t as glob } from "../_libs/tinyglobby.mjs";
|
|
4
4
|
import { n as resolveCompatibilityDates, r as resolveCompatibilityDatesFromEnv } from "../_libs/compatx.mjs";
|
|
@@ -21,10 +21,10 @@ import fsp, { readFile } from "node:fs/promises";
|
|
|
21
21
|
import { defu } from "defu";
|
|
22
22
|
import { pkgDir, runtimeDir } from "nitro/meta";
|
|
23
23
|
import { colors } from "consola/utils";
|
|
24
|
-
import { ofetch } from "ofetch";
|
|
25
24
|
import { hash } from "ohash";
|
|
26
25
|
import zlib from "node:zlib";
|
|
27
26
|
import { toRequest } from "h3";
|
|
27
|
+
import { ofetch } from "ofetch";
|
|
28
28
|
|
|
29
29
|
//#region src/config/defaults.ts
|
|
30
30
|
const NitroDefaults = {
|
|
@@ -708,71 +708,6 @@ async function _resolveNitroModule(mod, nitroOptions) {
|
|
|
708
708
|
};
|
|
709
709
|
}
|
|
710
710
|
|
|
711
|
-
//#endregion
|
|
712
|
-
//#region src/task.ts
|
|
713
|
-
/** @experimental */
|
|
714
|
-
async function runTask(taskEvent, opts) {
|
|
715
|
-
return await (await _getTasksContext(opts)).devFetch(`/_nitro/tasks/${taskEvent.name}`, {
|
|
716
|
-
method: "POST",
|
|
717
|
-
body: taskEvent
|
|
718
|
-
});
|
|
719
|
-
}
|
|
720
|
-
/** @experimental */
|
|
721
|
-
async function listTasks(opts) {
|
|
722
|
-
return (await (await _getTasksContext(opts)).devFetch("/_nitro/tasks")).tasks;
|
|
723
|
-
}
|
|
724
|
-
function addNitroTasksVirtualFile(nitro) {
|
|
725
|
-
nitro.options.virtual["#nitro-internal-virtual/tasks"] = () => {
|
|
726
|
-
const _scheduledTasks = Object.entries(nitro.options.scheduledTasks || {}).map(([cron, _tasks]) => {
|
|
727
|
-
return {
|
|
728
|
-
cron,
|
|
729
|
-
tasks: (Array.isArray(_tasks) ? _tasks : [_tasks]).filter((name) => {
|
|
730
|
-
if (!nitro.options.tasks[name]) {
|
|
731
|
-
nitro.logger.warn(`Scheduled task \`${name}\` is not defined!`);
|
|
732
|
-
return false;
|
|
733
|
-
}
|
|
734
|
-
return true;
|
|
735
|
-
})
|
|
736
|
-
};
|
|
737
|
-
}).filter((e) => e.tasks.length > 0);
|
|
738
|
-
const scheduledTasks = _scheduledTasks.length > 0 ? _scheduledTasks : false;
|
|
739
|
-
return `
|
|
740
|
-
export const scheduledTasks = ${JSON.stringify(scheduledTasks)};
|
|
741
|
-
|
|
742
|
-
export const tasks = {
|
|
743
|
-
${Object.entries(nitro.options.tasks).map(([name, task]) => `"${name}": {
|
|
744
|
-
meta: {
|
|
745
|
-
description: ${JSON.stringify(task.description)},
|
|
746
|
-
},
|
|
747
|
-
resolve: ${task.handler ? `() => import("${normalize(task.handler)}").then(r => r.default || r)` : "undefined"},
|
|
748
|
-
}`).join(",\n")}
|
|
749
|
-
};`;
|
|
750
|
-
};
|
|
751
|
-
}
|
|
752
|
-
const _devHint = `(is dev server running?)`;
|
|
753
|
-
async function _getTasksContext(opts) {
|
|
754
|
-
const buildInfoPath = resolve(resolve(resolve(process.cwd(), opts?.cwd || "."), opts?.buildDir || "node_modules/.nitro"), "nitro.dev.json");
|
|
755
|
-
if (!existsSync(buildInfoPath)) throw new Error(`Missing info file: \`${buildInfoPath}\` ${_devHint}`);
|
|
756
|
-
const buildInfo = JSON.parse(await readFile(buildInfoPath, "utf8"));
|
|
757
|
-
if (!buildInfo.dev?.pid || !buildInfo.dev?.workerAddress) throw new Error(`Missing dev server info in: \`${buildInfoPath}\` ${_devHint}`);
|
|
758
|
-
if (!_pidIsRunning(buildInfo.dev.pid)) throw new Error(`Dev server is not running (pid: ${buildInfo.dev.pid})`);
|
|
759
|
-
return {
|
|
760
|
-
buildInfo,
|
|
761
|
-
devFetch: ofetch.create({
|
|
762
|
-
baseURL: `http://${buildInfo.dev.workerAddress.host || "localhost"}:${buildInfo.dev.workerAddress.port || "3000"}`,
|
|
763
|
-
socketPath: buildInfo.dev.workerAddress.socketPath
|
|
764
|
-
})
|
|
765
|
-
};
|
|
766
|
-
}
|
|
767
|
-
function _pidIsRunning(pid) {
|
|
768
|
-
try {
|
|
769
|
-
process.kill(pid, 0);
|
|
770
|
-
return true;
|
|
771
|
-
} catch {
|
|
772
|
-
return false;
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
|
|
776
711
|
//#endregion
|
|
777
712
|
//#region src/routing.ts
|
|
778
713
|
const isGlobalMiddleware = (h) => !h.method && (!h.route || h.route === "/**");
|
|
@@ -929,7 +864,7 @@ async function createNitro(config = {}, opts = {}) {
|
|
|
929
864
|
const nitro = {
|
|
930
865
|
options: await loadOptions(config, opts),
|
|
931
866
|
hooks: new Hookable(),
|
|
932
|
-
vfs:
|
|
867
|
+
vfs: /* @__PURE__ */ new Map(),
|
|
933
868
|
routing: {},
|
|
934
869
|
logger: consola.withTag("nitro"),
|
|
935
870
|
scannedHandlers: [],
|
|
@@ -947,7 +882,6 @@ async function createNitro(config = {}, opts = {}) {
|
|
|
947
882
|
if (nitro.options.debug) createDebugger(nitro.hooks, { tag: "nitro" });
|
|
948
883
|
if (nitro.options.logLevel !== void 0) nitro.logger.level = nitro.options.logLevel;
|
|
949
884
|
nitro.hooks.addHooks(nitro.options.hooks);
|
|
950
|
-
addNitroTasksVirtualFile(nitro);
|
|
951
885
|
await installModules(nitro);
|
|
952
886
|
if (nitro.options.imports) {
|
|
953
887
|
nitro.unimport = createUnimport(nitro.options.imports);
|
|
@@ -1364,4 +1298,41 @@ async function prerender(nitro) {
|
|
|
1364
1298
|
}
|
|
1365
1299
|
|
|
1366
1300
|
//#endregion
|
|
1367
|
-
|
|
1301
|
+
//#region src/task.ts
|
|
1302
|
+
/** @experimental */
|
|
1303
|
+
async function runTask(taskEvent, opts) {
|
|
1304
|
+
return await (await _getTasksContext(opts)).devFetch(`/_nitro/tasks/${taskEvent.name}`, {
|
|
1305
|
+
method: "POST",
|
|
1306
|
+
body: taskEvent
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1309
|
+
/** @experimental */
|
|
1310
|
+
async function listTasks(opts) {
|
|
1311
|
+
return (await (await _getTasksContext(opts)).devFetch("/_nitro/tasks")).tasks;
|
|
1312
|
+
}
|
|
1313
|
+
const _devHint = `(is dev server running?)`;
|
|
1314
|
+
async function _getTasksContext(opts) {
|
|
1315
|
+
const buildInfoPath = resolve(resolve(resolve(process.cwd(), opts?.cwd || "."), opts?.buildDir || "node_modules/.nitro"), "nitro.dev.json");
|
|
1316
|
+
if (!existsSync(buildInfoPath)) throw new Error(`Missing info file: \`${buildInfoPath}\` ${_devHint}`);
|
|
1317
|
+
const buildInfo = JSON.parse(await readFile(buildInfoPath, "utf8"));
|
|
1318
|
+
if (!buildInfo.dev?.pid || !buildInfo.dev?.workerAddress) throw new Error(`Missing dev server info in: \`${buildInfoPath}\` ${_devHint}`);
|
|
1319
|
+
if (!_pidIsRunning(buildInfo.dev.pid)) throw new Error(`Dev server is not running (pid: ${buildInfo.dev.pid})`);
|
|
1320
|
+
return {
|
|
1321
|
+
buildInfo,
|
|
1322
|
+
devFetch: ofetch.create({
|
|
1323
|
+
baseURL: `http://${buildInfo.dev.workerAddress.host || "localhost"}:${buildInfo.dev.workerAddress.port || "3000"}`,
|
|
1324
|
+
socketPath: buildInfo.dev.workerAddress.socketPath
|
|
1325
|
+
})
|
|
1326
|
+
};
|
|
1327
|
+
}
|
|
1328
|
+
function _pidIsRunning(pid) {
|
|
1329
|
+
try {
|
|
1330
|
+
process.kill(pid, 0);
|
|
1331
|
+
return true;
|
|
1332
|
+
} catch {
|
|
1333
|
+
return false;
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
//#endregion
|
|
1338
|
+
export { copyPublicAssets as a, loadOptions as c, prepare as i, runTask as n, build as o, prerender as r, createNitro as s, listTasks as t };
|
package/dist/_dev.mjs
CHANGED
|
@@ -224,22 +224,17 @@ function createVFSHandler(nitro) {
|
|
|
224
224
|
statusText: `Forbidden IP: "${ip || "?"}"`,
|
|
225
225
|
status: 403
|
|
226
226
|
});
|
|
227
|
-
const vfsEntries = {
|
|
228
|
-
...nitro.vfs,
|
|
229
|
-
...nitro.options.virtual
|
|
230
|
-
};
|
|
231
227
|
const url = event.context.params?._ || "";
|
|
232
228
|
const isJson = url.endsWith(".json") || event.req.headers.get("accept")?.includes("application/json");
|
|
233
229
|
const id = decodeURIComponent(url.replace(/^(\.json)?\/?/, "") || "");
|
|
234
|
-
if (id && !(id
|
|
230
|
+
if (id && !nitro.vfs.has(id)) throw new HTTPError({
|
|
235
231
|
message: "File not found",
|
|
236
232
|
status: 404
|
|
237
233
|
});
|
|
238
|
-
|
|
239
|
-
if (typeof content === "function") content = await content();
|
|
234
|
+
const content = id ? await nitro.vfs.get(id)?.render() : void 0;
|
|
240
235
|
if (isJson) return {
|
|
241
236
|
rootDir: nitro.options.rootDir,
|
|
242
|
-
entries:
|
|
237
|
+
entries: [...nitro.vfs.keys()].map((id$1) => ({
|
|
243
238
|
id: id$1,
|
|
244
239
|
path: "/_vfs.json/" + encodeURIComponent(id$1)
|
|
245
240
|
})),
|
|
@@ -249,7 +244,7 @@ function createVFSHandler(nitro) {
|
|
|
249
244
|
} : null
|
|
250
245
|
};
|
|
251
246
|
const directories = { [nitro.options.rootDir]: {} };
|
|
252
|
-
const fpaths =
|
|
247
|
+
const fpaths = [...nitro.vfs.keys()];
|
|
253
248
|
for (const item of fpaths) {
|
|
254
249
|
const segments = item.replace(nitro.options.rootDir, "").split("/").filter(Boolean);
|
|
255
250
|
let currentDir = item.startsWith(nitro.options.rootDir) ? directories[nitro.options.rootDir] : directories;
|
package/dist/builder.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import "./_libs/tinyglobby.mjs";
|
|
|
13
13
|
import "./_libs/compatx.mjs";
|
|
14
14
|
import "./_libs/klona.mjs";
|
|
15
15
|
import "./_libs/std-env.mjs";
|
|
16
|
-
import { a as
|
|
16
|
+
import { a as copyPublicAssets, c as loadOptions, i as prepare, n as runTask, o as build, r as prerender, s as createNitro, t as listTasks } from "./_chunks/_yl3G_3Y.mjs";
|
|
17
17
|
import "./_libs/escape-string-regexp.mjs";
|
|
18
18
|
import "./_libs/tsconfck.mjs";
|
|
19
19
|
import "./_libs/dot-prop.mjs";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import "#nitro-internal-
|
|
1
|
+
import "#nitro-internal-polyfills";
|
|
2
2
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import "#nitro-internal-
|
|
1
|
+
import "#nitro-internal-polyfills";
|
|
2
2
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import "#nitro-internal-
|
|
1
|
+
import "#nitro-internal-polyfills";
|
|
2
2
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import "#nitro-internal-
|
|
1
|
+
import "#nitro-internal-polyfills";
|
|
2
2
|
export declare const handler: unknown;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "#nitro-internal-
|
|
1
|
+
import "#nitro-internal-polyfills";
|
|
2
2
|
import type { APIGatewayProxyEvent, APIGatewayProxyEventV2, APIGatewayProxyResult, APIGatewayProxyResultV2, Context } from "aws-lambda";
|
|
3
3
|
export declare function handler(event: APIGatewayProxyEvent | APIGatewayProxyEventV2, context: Context): Promise<APIGatewayProxyResult | APIGatewayProxyResultV2>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "#nitro-internal-
|
|
1
|
+
import "#nitro-internal-polyfills";
|
|
2
2
|
import type { Request as CFRequest, EventContext, ExecutionContext } from "@cloudflare/workers-types";
|
|
3
3
|
/**
|
|
4
4
|
* Reference: https://developers.cloudflare.com/workers/runtime-apis/fetch-event/#parameters
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
2
2
|
import { Hookable, HookableCore, NestedHooks } from "hookable";
|
|
3
3
|
import { version } from "nitro/meta";
|
|
4
|
-
import { FetchOptions, FetchRequest, FetchResponse } from "ofetch";
|
|
5
4
|
import { IncomingMessage, OutgoingMessage } from "node:http";
|
|
6
5
|
import { H3Core, HTTPError, HTTPEvent, HTTPHandler, HTTPMethod, Middleware, ProxyOptions } from "h3";
|
|
7
6
|
import { Duplex } from "node:stream";
|
|
8
7
|
import { ServerRequest, ServerRequest as ServerRequest$1 } from "srvx";
|
|
8
|
+
import { FetchOptions, FetchRequest, FetchResponse } from "ofetch";
|
|
9
9
|
import { Preset } from "unenv";
|
|
10
|
-
import { ConnectorName } from "db0";
|
|
11
10
|
import { JsxOptions, TransformOptions } from "oxc-transform";
|
|
12
|
-
import { BuiltinDriverName } from "unstorage";
|
|
13
11
|
import { ExternalsPluginOptions as NodeExternalsOptions } from "nf3";
|
|
12
|
+
import { ConnectorName } from "db0";
|
|
13
|
+
import { BuiltinDriverName } from "unstorage";
|
|
14
14
|
import { MinifyOptions } from "oxc-minify";
|
|
15
15
|
import { InputOptions, OutputOptions } from "rollup";
|
|
16
16
|
import { DevMessageListener as DevMessageListener$1, Nitro as Nitro$1 } from "nitro/types";
|
|
@@ -2669,7 +2669,9 @@ type MaybeArray<T> = T | T[];
|
|
|
2669
2669
|
interface Nitro {
|
|
2670
2670
|
options: NitroOptions;
|
|
2671
2671
|
scannedHandlers: NitroEventHandler[];
|
|
2672
|
-
vfs:
|
|
2672
|
+
vfs: Map<string, {
|
|
2673
|
+
render: () => string | Promise<string>;
|
|
2674
|
+
}>;
|
|
2673
2675
|
hooks: Hookable<NitroHooks>;
|
|
2674
2676
|
unimport?: Unimport;
|
|
2675
2677
|
logger: ConsolaInstance;
|
package/dist/vite.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import "./_libs/tinyglobby.mjs";
|
|
|
13
13
|
import "./_libs/compatx.mjs";
|
|
14
14
|
import "./_libs/klona.mjs";
|
|
15
15
|
import "./_libs/std-env.mjs";
|
|
16
|
-
import "./_chunks/
|
|
16
|
+
import "./_chunks/_yl3G_3Y.mjs";
|
|
17
17
|
import "./_libs/escape-string-regexp.mjs";
|
|
18
18
|
import "./_libs/tsconfck.mjs";
|
|
19
19
|
import "./_libs/dot-prop.mjs";
|
|
@@ -33,7 +33,7 @@ import "./_libs/plugin-alias.mjs";
|
|
|
33
33
|
import "./_libs/estree-walker.mjs";
|
|
34
34
|
import "./_libs/plugin-commonjs.mjs";
|
|
35
35
|
import "./_libs/plugin-inject.mjs";
|
|
36
|
-
import "./_chunks/
|
|
36
|
+
import "./_chunks/CGEOOxsU.mjs";
|
|
37
37
|
import "./_libs/remapping.mjs";
|
|
38
38
|
import "./_libs/unwasm.mjs";
|
|
39
39
|
import "./_libs/plugin-replace.mjs";
|
package/package.json
CHANGED