nitro-nightly 3.0.1-20251106-171053-91c2bee6 → 3.0.1-20251106-212413-8b396123
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/common.mjs +2 -21
- package/dist/_build/rolldown.mjs +3 -5
- package/dist/_build/rollup.mjs +2 -4
- package/dist/_build/vite.build.mjs +2 -2
- package/dist/_build/vite.plugin.mjs +2 -2
- package/dist/_chunks/{Dm6E92Pi.mjs → B45B0YMI.mjs} +8 -42
- package/dist/_chunks/{BY8z09D4.mjs → H3oOYREn.mjs} +3 -22
- package/dist/_chunks/{DD4msOU9.mjs → thLbatgM.mjs} +1 -26
- package/dist/_libs/klona.mjs +6 -58
- package/dist/_presets.mjs +1 -1
- package/dist/builder.mjs +2 -2
- package/dist/runtime/internal/task.mjs +1 -1
- package/dist/types/index.d.mts +1 -3
- package/dist/vite.mjs +2 -2
- package/lib/tsconfig.json +27 -0
- package/package.json +4 -3
package/dist/_build/common.mjs
CHANGED
|
@@ -13,11 +13,11 @@ import { joinURL, withTrailingSlash } from "ufo";
|
|
|
13
13
|
import { readFile } from "node:fs/promises";
|
|
14
14
|
import { defu } from "defu";
|
|
15
15
|
import { runtimeDependencies, runtimeDir } from "nitro/runtime/meta";
|
|
16
|
-
import { builtinDrivers, normalizeKey } from "unstorage";
|
|
17
16
|
import { hash } from "ohash";
|
|
18
17
|
import { defineEnv } from "unenv";
|
|
19
18
|
import { connectors } from "db0";
|
|
20
19
|
import { transform } from "esbuild";
|
|
20
|
+
import { builtinDrivers, normalizeKey } from "unstorage";
|
|
21
21
|
import { rollupNodeFileTrace } from "nf3";
|
|
22
22
|
import { RENDER_CONTEXT_KEYS, compileTemplateToString, hasTemplateSyntax } from "rendu";
|
|
23
23
|
|
|
@@ -532,8 +532,7 @@ export const assets = {
|
|
|
532
532
|
//#region src/build/plugins/storage.ts
|
|
533
533
|
function storage(nitro) {
|
|
534
534
|
const mounts = [];
|
|
535
|
-
const
|
|
536
|
-
const storageMounts = isDevOrPrerender ? {
|
|
535
|
+
const storageMounts = nitro.options.dev || nitro.options.preset === "nitro-prerender" ? {
|
|
537
536
|
...nitro.options.storage,
|
|
538
537
|
...nitro.options.devStorage
|
|
539
538
|
} : nitro.options.storage;
|
|
@@ -546,22 +545,6 @@ function storage(nitro) {
|
|
|
546
545
|
});
|
|
547
546
|
}
|
|
548
547
|
const driverImports = [...new Set(mounts.map((m) => m.driver))];
|
|
549
|
-
const bundledStorageCode = `
|
|
550
|
-
import { prefixStorage } from 'unstorage'
|
|
551
|
-
import overlay from 'unstorage/drivers/overlay'
|
|
552
|
-
import memory from 'unstorage/drivers/memory'
|
|
553
|
-
|
|
554
|
-
const bundledStorage = ${JSON.stringify(nitro.options.bundledStorage)}
|
|
555
|
-
for (const base of bundledStorage) {
|
|
556
|
-
storage.mount(base, overlay({
|
|
557
|
-
layers: [
|
|
558
|
-
memory(),
|
|
559
|
-
// TODO
|
|
560
|
-
// prefixStorage(storage, base),
|
|
561
|
-
prefixStorage(storage, 'assets:nitro:bundled:' + base)
|
|
562
|
-
]
|
|
563
|
-
}))
|
|
564
|
-
}`;
|
|
565
548
|
return virtual({ "#nitro-internal-virtual/storage": `
|
|
566
549
|
import { createStorage } from 'unstorage'
|
|
567
550
|
import { assets } from '#nitro-internal-virtual/server-assets'
|
|
@@ -572,8 +555,6 @@ export function initStorage() {
|
|
|
572
555
|
const storage = createStorage({})
|
|
573
556
|
storage.mount('/assets', assets)
|
|
574
557
|
${mounts.map((m) => `storage.mount('${m.path}', ${genSafeVariableName(m.driver)}(${JSON.stringify(m.opts)}))`).join("\n")}
|
|
575
|
-
|
|
576
|
-
${!isDevOrPrerender && nitro.options.bundledStorage.length > 0 ? bundledStorageCode : ""}
|
|
577
558
|
return storage
|
|
578
559
|
}
|
|
579
560
|
` }, nitro.vfs);
|
package/dist/_build/rolldown.mjs
CHANGED
|
@@ -11,11 +11,10 @@ import "../_libs/picomatch.mjs";
|
|
|
11
11
|
import "../_libs/fdir.mjs";
|
|
12
12
|
import "../_libs/tinyglobby.mjs";
|
|
13
13
|
import { t as formatCompatibilityDate } from "../_libs/compatx.mjs";
|
|
14
|
-
import "../_libs/klona.mjs";
|
|
15
14
|
import "../_libs/std-env.mjs";
|
|
16
15
|
import "../_libs/dot-prop.mjs";
|
|
17
16
|
import { n as writeBuildInfo } from "../_chunks/zV3n76Yk.mjs";
|
|
18
|
-
import {
|
|
17
|
+
import { i as scanHandlers, n as writeTypes } from "../_chunks/thLbatgM.mjs";
|
|
19
18
|
import "../_libs/mime.mjs";
|
|
20
19
|
import "../_libs/pathe.mjs";
|
|
21
20
|
import "../_libs/untyped.mjs";
|
|
@@ -28,7 +27,7 @@ import { n as baseBuildConfig, r as replace, t as baseBuildPlugins } from "./com
|
|
|
28
27
|
import "../_libs/remapping.mjs";
|
|
29
28
|
import "../_libs/unwasm.mjs";
|
|
30
29
|
import "../_libs/etag.mjs";
|
|
31
|
-
import { n as
|
|
30
|
+
import { n as raw, t as generateFSTree } from "../_chunks/H3oOYREn.mjs";
|
|
32
31
|
import "../_libs/duplexer.mjs";
|
|
33
32
|
import "../_libs/gzip-size.mjs";
|
|
34
33
|
import "../_libs/pretty-bytes.mjs";
|
|
@@ -72,7 +71,7 @@ const getRolldownConfig = (nitro) => {
|
|
|
72
71
|
transform: {
|
|
73
72
|
inject: base.env.inject,
|
|
74
73
|
jsx: {
|
|
75
|
-
runtime: "classic",
|
|
74
|
+
runtime: nitro.options.esbuild?.options?.jsx === "automatic" ? "automatic" : "classic",
|
|
76
75
|
pragma: nitro.options.esbuild?.options?.jsxFactory,
|
|
77
76
|
pragmaFrag: nitro.options.esbuild?.options?.jsxFragment,
|
|
78
77
|
development: nitro.options.dev
|
|
@@ -184,7 +183,6 @@ async function buildProduction(nitro, config) {
|
|
|
184
183
|
const buildStartTime = Date.now();
|
|
185
184
|
await scanHandlers(nitro);
|
|
186
185
|
await writeTypes(nitro);
|
|
187
|
-
await snapshot(nitro);
|
|
188
186
|
if (!nitro.options.static) {
|
|
189
187
|
nitro.logger.info(`Building server (builder: \`rolldown\`, preset: \`${nitro.options.preset}\`, compatibility date: \`${formatCompatibilityDate(nitro.options.compatibilityDate)}\`)`);
|
|
190
188
|
await (await rolldown.rolldown(config)).write(config.output);
|
package/dist/_build/rollup.mjs
CHANGED
|
@@ -11,11 +11,10 @@ import "../_libs/picomatch.mjs";
|
|
|
11
11
|
import "../_libs/fdir.mjs";
|
|
12
12
|
import "../_libs/tinyglobby.mjs";
|
|
13
13
|
import { t as formatCompatibilityDate } from "../_libs/compatx.mjs";
|
|
14
|
-
import "../_libs/klona.mjs";
|
|
15
14
|
import "../_libs/std-env.mjs";
|
|
16
15
|
import "../_libs/dot-prop.mjs";
|
|
17
16
|
import { n as writeBuildInfo } from "../_chunks/zV3n76Yk.mjs";
|
|
18
|
-
import {
|
|
17
|
+
import { i as scanHandlers, n as writeTypes } from "../_chunks/thLbatgM.mjs";
|
|
19
18
|
import "../_libs/mime.mjs";
|
|
20
19
|
import "../_libs/pathe.mjs";
|
|
21
20
|
import "../_libs/untyped.mjs";
|
|
@@ -30,7 +29,7 @@ import { n as baseBuildConfig, r as replace, t as baseBuildPlugins } from "./com
|
|
|
30
29
|
import "../_libs/remapping.mjs";
|
|
31
30
|
import "../_libs/unwasm.mjs";
|
|
32
31
|
import "../_libs/etag.mjs";
|
|
33
|
-
import { n as
|
|
32
|
+
import { n as raw, t as generateFSTree } from "../_chunks/H3oOYREn.mjs";
|
|
34
33
|
import "../_libs/duplexer.mjs";
|
|
35
34
|
import "../_libs/gzip-size.mjs";
|
|
36
35
|
import "../_libs/pretty-bytes.mjs";
|
|
@@ -313,7 +312,6 @@ async function buildProduction(nitro, rollupConfig) {
|
|
|
313
312
|
const buildStartTime = Date.now();
|
|
314
313
|
await scanHandlers(nitro);
|
|
315
314
|
await writeTypes(nitro);
|
|
316
|
-
await snapshot(nitro);
|
|
317
315
|
if (!nitro.options.static) {
|
|
318
316
|
nitro.logger.info(`Building server (builder: \`rollup\`, preset: \`${nitro.options.preset}\`, compatibility date: \`${formatCompatibilityDate(nitro.options.compatibilityDate)}\`)`);
|
|
319
317
|
await (await rollup.rollup(rollupConfig).catch((error) => {
|
|
@@ -13,11 +13,11 @@ import "../_libs/tinyglobby.mjs";
|
|
|
13
13
|
import "../_libs/compatx.mjs";
|
|
14
14
|
import "../_libs/klona.mjs";
|
|
15
15
|
import { r as a } from "../_libs/std-env.mjs";
|
|
16
|
-
import "../_chunks/
|
|
16
|
+
import "../_chunks/B45B0YMI.mjs";
|
|
17
17
|
import "../_libs/escape-string-regexp.mjs";
|
|
18
18
|
import "../_libs/dot-prop.mjs";
|
|
19
19
|
import "../_chunks/zV3n76Yk.mjs";
|
|
20
|
-
import "../_chunks/
|
|
20
|
+
import "../_chunks/thLbatgM.mjs";
|
|
21
21
|
import "../_libs/rou3.mjs";
|
|
22
22
|
import "../_libs/mime.mjs";
|
|
23
23
|
import "../_libs/pathe.mjs";
|
|
@@ -2,9 +2,9 @@ import { C as join$1, D as relative$1, O as resolve$1, S as isAbsolute$1, b as d
|
|
|
2
2
|
import { f as sanitizeFilePath } from "../_libs/local-pkg.mjs";
|
|
3
3
|
import { t as formatCompatibilityDate } from "../_libs/compatx.mjs";
|
|
4
4
|
import { n as T, r as a } from "../_libs/std-env.mjs";
|
|
5
|
-
import { a as createNitro, n as prepare, r as copyPublicAssets } from "../_chunks/
|
|
5
|
+
import { a as createNitro, n as prepare, r as copyPublicAssets } from "../_chunks/B45B0YMI.mjs";
|
|
6
6
|
import { a as prettyPath, n as writeBuildInfo, t as getBuildInfo } from "../_chunks/zV3n76Yk.mjs";
|
|
7
|
-
import {
|
|
7
|
+
import { i as scanHandlers } from "../_chunks/thLbatgM.mjs";
|
|
8
8
|
import { i as NodeDevWorker, r as NitroDevApp } from "../_dev.mjs";
|
|
9
9
|
import { i as watch$1 } from "../_libs/chokidar.mjs";
|
|
10
10
|
import { t as alias } from "../_libs/plugin-alias.mjs";
|
|
@@ -4,11 +4,11 @@ import { d as resolveModuleExportNames } from "../_libs/local-pkg.mjs";
|
|
|
4
4
|
import { o as createUnimport } from "../_libs/unimport.mjs";
|
|
5
5
|
import { t as glob } from "../_libs/tinyglobby.mjs";
|
|
6
6
|
import { n as resolveCompatibilityDates, r as resolveCompatibilityDatesFromEnv } from "../_libs/compatx.mjs";
|
|
7
|
-
import {
|
|
7
|
+
import { t as klona } from "../_libs/klona.mjs";
|
|
8
8
|
import { i as d, r as a } from "../_libs/std-env.mjs";
|
|
9
9
|
import { t as escapeStringRegexp } from "../_libs/escape-string-regexp.mjs";
|
|
10
10
|
import { a as prettyPath, i as isDirectory, o as resolveNitroPath, s as writeFile$1 } from "./zV3n76Yk.mjs";
|
|
11
|
-
import {
|
|
11
|
+
import { i as scanHandlers, r as scanAndSyncOptions, t as runParallel } from "./thLbatgM.mjs";
|
|
12
12
|
import { a as findRoute, i as findAllRoutes, n as addRoute, r as createRouter, t as compileRouterToString } from "../_libs/rou3.mjs";
|
|
13
13
|
import { t as src_default } from "../_libs/mime.mjs";
|
|
14
14
|
import { n as z, t as P } from "../_libs/ultrahtml.mjs";
|
|
@@ -47,7 +47,6 @@ const NitroDefaults = {
|
|
|
47
47
|
future: {},
|
|
48
48
|
storage: {},
|
|
49
49
|
devStorage: {},
|
|
50
|
-
bundledStorage: [],
|
|
51
50
|
publicAssets: [],
|
|
52
51
|
serverAssets: [],
|
|
53
52
|
plugins: [],
|
|
@@ -467,30 +466,7 @@ function isPrimitiveValue(value) {
|
|
|
467
466
|
|
|
468
467
|
//#endregion
|
|
469
468
|
//#region src/config/resolvers/storage.ts
|
|
470
|
-
async function resolveStorageOptions(options) {
|
|
471
|
-
const fsMounts = {
|
|
472
|
-
root: resolve(options.rootDir),
|
|
473
|
-
src: options.serverDir ? resolve(options.serverDir) : void 0,
|
|
474
|
-
build: resolve(options.buildDir),
|
|
475
|
-
cache: resolve(options.buildDir, "cache")
|
|
476
|
-
};
|
|
477
|
-
for (const p in fsMounts) {
|
|
478
|
-
if (!fsMounts[p]) continue;
|
|
479
|
-
options.devStorage[p] = options.devStorage[p] || {
|
|
480
|
-
driver: "fs",
|
|
481
|
-
readOnly: p === "root" || p === "src",
|
|
482
|
-
base: fsMounts[p]
|
|
483
|
-
};
|
|
484
|
-
}
|
|
485
|
-
if (options.dev && options.storage.data === void 0 && options.devStorage.data === void 0) options.devStorage.data = {
|
|
486
|
-
driver: "fs",
|
|
487
|
-
base: resolve(options.rootDir, ".data/kv")
|
|
488
|
-
};
|
|
489
|
-
else if (options.node && options.storage.data === void 0) options.storage.data = {
|
|
490
|
-
driver: "fsLite",
|
|
491
|
-
base: "./.data/kv"
|
|
492
|
-
};
|
|
493
|
-
}
|
|
469
|
+
async function resolveStorageOptions(options) {}
|
|
494
470
|
|
|
495
471
|
//#endregion
|
|
496
472
|
//#region src/config/resolvers/url.ts
|
|
@@ -929,7 +905,6 @@ async function createNitro(config = {}, opts = {}) {
|
|
|
929
905
|
throw new Error("no dev server attached!");
|
|
930
906
|
},
|
|
931
907
|
close: () => Promise.resolve(nitro.hooks.callHook("close")),
|
|
932
|
-
storage: void 0,
|
|
933
908
|
async updateConfig(config$1) {
|
|
934
909
|
updateNitroConfig(nitro, config$1);
|
|
935
910
|
}
|
|
@@ -937,10 +912,6 @@ async function createNitro(config = {}, opts = {}) {
|
|
|
937
912
|
registerNitroInstance(nitro);
|
|
938
913
|
initNitroRouting(nitro);
|
|
939
914
|
await scanAndSyncOptions(nitro);
|
|
940
|
-
nitro.storage = await createStorage(nitro);
|
|
941
|
-
nitro.hooks.hook("close", async () => {
|
|
942
|
-
await nitro.storage.dispose();
|
|
943
|
-
});
|
|
944
915
|
if (nitro.options.debug) createDebugger(nitro.hooks, { tag: "nitro" });
|
|
945
916
|
if (nitro.options.logLevel !== void 0) nitro.logger.level = nitro.options.logLevel;
|
|
946
917
|
nitro.hooks.addHooks(nitro.options.hooks);
|
|
@@ -1134,7 +1105,7 @@ async function prepareDir(dir) {
|
|
|
1134
1105
|
//#endregion
|
|
1135
1106
|
//#region src/prerender/utils.ts
|
|
1136
1107
|
const allowedExtensions = new Set(["", ".json"]);
|
|
1137
|
-
const linkParents
|
|
1108
|
+
const linkParents = /* @__PURE__ */ new Map();
|
|
1138
1109
|
const HTML_ENTITIES = {
|
|
1139
1110
|
"<": "<",
|
|
1140
1111
|
">": ">",
|
|
@@ -1165,9 +1136,9 @@ async function extractLinks(html, from, res, crawlLinks) {
|
|
|
1165
1136
|
links.push(_link.pathname + _link.search);
|
|
1166
1137
|
}
|
|
1167
1138
|
for (const link of links) {
|
|
1168
|
-
const _parents = linkParents
|
|
1139
|
+
const _parents = linkParents.get(link);
|
|
1169
1140
|
if (_parents) _parents.add(from);
|
|
1170
|
-
else linkParents
|
|
1141
|
+
else linkParents.set(link, new Set([from]));
|
|
1171
1142
|
}
|
|
1172
1143
|
return links;
|
|
1173
1144
|
}
|
|
@@ -1178,7 +1149,7 @@ function getExtension(link) {
|
|
|
1178
1149
|
function formatPrerenderRoute(route) {
|
|
1179
1150
|
let str = ` ├─ ${route.route} (${route.generateTimeMS}ms)`;
|
|
1180
1151
|
if (route.error) {
|
|
1181
|
-
const parents = linkParents
|
|
1152
|
+
const parents = linkParents.get(route.route);
|
|
1182
1153
|
const errorColor = colors[route.error.status === 404 ? "yellow" : "red"];
|
|
1183
1154
|
const errorLead = parents?.size ? "├──" : "└──";
|
|
1184
1155
|
str += `\n │ ${errorLead} ${errorColor(route.error.message)}`;
|
|
@@ -1197,7 +1168,6 @@ function matchesIgnorePattern(path, pattern) {
|
|
|
1197
1168
|
//#endregion
|
|
1198
1169
|
//#region src/prerender/prerender.ts
|
|
1199
1170
|
const JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
|
|
1200
|
-
const linkParents = /* @__PURE__ */ new Map();
|
|
1201
1171
|
async function prerender(nitro) {
|
|
1202
1172
|
if (nitro.options.noPublicDir) {
|
|
1203
1173
|
nitro.logger.warn("Skipping prerender since `noPublicDir` option is enabled.");
|
|
@@ -1352,11 +1322,7 @@ async function prerender(nitro) {
|
|
|
1352
1322
|
});
|
|
1353
1323
|
if (nitro.options.prerender.failOnError && failedRoutes.size > 0) {
|
|
1354
1324
|
nitro.logger.log("\nErrors prerendering:");
|
|
1355
|
-
for (const route of failedRoutes)
|
|
1356
|
-
const parents = linkParents.get(route.route);
|
|
1357
|
-
parents?.size && `${[...parents.values()].map((link) => colors.gray(` │ └── Linked from ${link}`)).join("\n")}`;
|
|
1358
|
-
nitro.logger.log(formatPrerenderRoute(route));
|
|
1359
|
-
}
|
|
1325
|
+
for (const route of failedRoutes) nitro.logger.log(formatPrerenderRoute(route));
|
|
1360
1326
|
nitro.logger.log("");
|
|
1361
1327
|
throw new Error("Exiting due to prerender errors.");
|
|
1362
1328
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as relative, O as resolve, b as dirname, x as extname } from "../_libs/c12.mjs";
|
|
2
2
|
import { t as glob } from "../_libs/tinyglobby.mjs";
|
|
3
3
|
import { r as a } from "../_libs/std-env.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { t as runParallel } from "./thLbatgM.mjs";
|
|
5
5
|
import { t as src_default } from "../_libs/mime.mjs";
|
|
6
6
|
import { t as gzipSize } from "../_libs/gzip-size.mjs";
|
|
7
7
|
import { t as prettyBytes } from "../_libs/pretty-bytes.mjs";
|
|
8
8
|
import { promises } from "node:fs";
|
|
9
|
-
import { mkdir, writeFile } from "node:fs/promises";
|
|
10
9
|
import { colors } from "consola/utils";
|
|
11
10
|
|
|
12
11
|
//#region src/build/plugins/raw.ts
|
|
@@ -123,22 +122,4 @@ async function generateFSTree(dir, options = {}) {
|
|
|
123
122
|
}
|
|
124
123
|
|
|
125
124
|
//#endregion
|
|
126
|
-
|
|
127
|
-
async function snapshot(nitro) {
|
|
128
|
-
if (nitro.options.bundledStorage.length === 0 || nitro.options.preset === "nitro-prerender") return;
|
|
129
|
-
const storageDir = resolve(nitro.options.buildDir, "snapshot");
|
|
130
|
-
nitro.options.serverAssets.push({
|
|
131
|
-
baseName: "nitro:bundled",
|
|
132
|
-
dir: storageDir
|
|
133
|
-
});
|
|
134
|
-
const data = await snapshotStorage(nitro);
|
|
135
|
-
await Promise.all(Object.entries(data).map(async ([path, contents]) => {
|
|
136
|
-
if (typeof contents !== "string") contents = JSON.stringify(contents);
|
|
137
|
-
const fsPath = join(storageDir, path.replace(/:/g, "/"));
|
|
138
|
-
await mkdir(dirname(fsPath), { recursive: true });
|
|
139
|
-
await writeFile(fsPath, contents, "utf8");
|
|
140
|
-
}));
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
//#endregion
|
|
144
|
-
export { generateFSTree as n, raw as r, snapshot as t };
|
|
125
|
+
export { raw as n, generateFSTree as t };
|
|
@@ -3,7 +3,6 @@ import { C as join, D as relative, O as resolve, S as isAbsolute, b as dirname,
|
|
|
3
3
|
import { c as parseNodeModulePath, s as lookupNodeModuleSubpath } from "../_libs/local-pkg.mjs";
|
|
4
4
|
import { s as toExports } from "../_libs/unimport.mjs";
|
|
5
5
|
import { t as glob } from "../_libs/tinyglobby.mjs";
|
|
6
|
-
import { t as klona } from "../_libs/klona.mjs";
|
|
7
6
|
import { i as isDirectory, o as resolveNitroPath, s as writeFile } from "./zV3n76Yk.mjs";
|
|
8
7
|
import { t as resolveAlias } from "../_libs/pathe.mjs";
|
|
9
8
|
import { n as resolveSchema, t as generateTypes } from "../_libs/untyped.mjs";
|
|
@@ -11,7 +10,6 @@ import { existsSync, promises } from "node:fs";
|
|
|
11
10
|
import { withBase, withLeadingSlash, withoutTrailingSlash } from "ufo";
|
|
12
11
|
import { defu } from "defu";
|
|
13
12
|
import { runtimeDir } from "nitro/runtime/meta";
|
|
14
|
-
import { builtinDrivers, createStorage } from "unstorage";
|
|
15
13
|
|
|
16
14
|
//#region src/scan.ts
|
|
17
15
|
const GLOB_SCAN_PATTERN = "**/*.{js,mjs,cjs,ts,mts,cts,tsx,jsx}";
|
|
@@ -109,29 +107,6 @@ async function scanDir(nitro, dir, name) {
|
|
|
109
107
|
}).sort((a, b) => a.path.localeCompare(b.path));
|
|
110
108
|
}
|
|
111
109
|
|
|
112
|
-
//#endregion
|
|
113
|
-
//#region src/utils/storage.ts
|
|
114
|
-
async function createStorage$1(nitro) {
|
|
115
|
-
const storage = createStorage();
|
|
116
|
-
const mounts = klona({
|
|
117
|
-
...nitro.options.storage,
|
|
118
|
-
...nitro.options.devStorage
|
|
119
|
-
});
|
|
120
|
-
for (const [path, opts] of Object.entries(mounts)) if (opts.driver) {
|
|
121
|
-
const driver = await import(builtinDrivers[opts.driver] || opts.driver).then((r) => r.default || r);
|
|
122
|
-
storage.mount(path, driver(opts));
|
|
123
|
-
} else nitro.logger.warn(`No \`driver\` set for storage mount point "${path}".`);
|
|
124
|
-
return storage;
|
|
125
|
-
}
|
|
126
|
-
async function snapshotStorage(nitro) {
|
|
127
|
-
const data = {};
|
|
128
|
-
const allKeys = [...new Set(await Promise.all(nitro.options.bundledStorage.map((base) => nitro.storage.getKeys(base))).then((r) => r.flat()))];
|
|
129
|
-
await Promise.all(allKeys.map(async (key) => {
|
|
130
|
-
data[key] = await nitro.storage.getItem(key);
|
|
131
|
-
}));
|
|
132
|
-
return data;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
110
|
//#endregion
|
|
136
111
|
//#region src/build/types.ts
|
|
137
112
|
async function writeTypes(nitro) {
|
|
@@ -334,4 +309,4 @@ async function runParallel(inputs, cb, opts) {
|
|
|
334
309
|
}
|
|
335
310
|
|
|
336
311
|
//#endregion
|
|
337
|
-
export {
|
|
312
|
+
export { scanHandlers as i, writeTypes as n, scanAndSyncOptions as r, runParallel as t };
|
package/dist/_libs/klona.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
//#region node_modules/.pnpm/klona@2.0.6/node_modules/klona/full/index.mjs
|
|
2
2
|
function set(obj, key, val) {
|
|
3
|
-
if (typeof val.value === "object") val.value = klona
|
|
3
|
+
if (typeof val.value === "object") val.value = klona(val.value);
|
|
4
4
|
if (!val.enumerable || val.get || val.set || !val.configurable || !val.writable || key === "__proto__") Object.defineProperty(obj, key, val);
|
|
5
5
|
else obj[key] = val.value;
|
|
6
6
|
}
|
|
7
|
-
function klona
|
|
7
|
+
function klona(x) {
|
|
8
8
|
if (typeof x !== "object") return x;
|
|
9
9
|
var i = 0, k, list, tmp, str = Object.prototype.toString.call(x);
|
|
10
10
|
if (str === "[object Object]") tmp = Object.create(x.__proto__ || null);
|
|
@@ -12,16 +12,16 @@ function klona$1(x) {
|
|
|
12
12
|
else if (str === "[object Set]") {
|
|
13
13
|
tmp = /* @__PURE__ */ new Set();
|
|
14
14
|
x.forEach(function(val) {
|
|
15
|
-
tmp.add(klona
|
|
15
|
+
tmp.add(klona(val));
|
|
16
16
|
});
|
|
17
17
|
} else if (str === "[object Map]") {
|
|
18
18
|
tmp = /* @__PURE__ */ new Map();
|
|
19
19
|
x.forEach(function(val, key) {
|
|
20
|
-
tmp.set(klona
|
|
20
|
+
tmp.set(klona(key), klona(val));
|
|
21
21
|
});
|
|
22
22
|
} else if (str === "[object Date]") tmp = /* @__PURE__ */ new Date(+x);
|
|
23
23
|
else if (str === "[object RegExp]") tmp = new RegExp(x.source, x.flags);
|
|
24
|
-
else if (str === "[object DataView]") tmp = new x.constructor(klona
|
|
24
|
+
else if (str === "[object DataView]") tmp = new x.constructor(klona(x.buffer));
|
|
25
25
|
else if (str === "[object ArrayBuffer]") tmp = x.slice(0);
|
|
26
26
|
else if (str.slice(-6) === "Array]") tmp = new x.constructor(x);
|
|
27
27
|
if (tmp) {
|
|
@@ -35,56 +35,4 @@ function klona$1(x) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
//#endregion
|
|
38
|
-
|
|
39
|
-
function klona(x) {
|
|
40
|
-
if (typeof x !== "object") return x;
|
|
41
|
-
var k, tmp, str = Object.prototype.toString.call(x);
|
|
42
|
-
if (str === "[object Object]") {
|
|
43
|
-
if (x.constructor !== Object && typeof x.constructor === "function") {
|
|
44
|
-
tmp = new x.constructor();
|
|
45
|
-
for (k in x) if (x.hasOwnProperty(k) && tmp[k] !== x[k]) tmp[k] = klona(x[k]);
|
|
46
|
-
} else {
|
|
47
|
-
tmp = {};
|
|
48
|
-
for (k in x) if (k === "__proto__") Object.defineProperty(tmp, k, {
|
|
49
|
-
value: klona(x[k]),
|
|
50
|
-
configurable: true,
|
|
51
|
-
enumerable: true,
|
|
52
|
-
writable: true
|
|
53
|
-
});
|
|
54
|
-
else tmp[k] = klona(x[k]);
|
|
55
|
-
}
|
|
56
|
-
return tmp;
|
|
57
|
-
}
|
|
58
|
-
if (str === "[object Array]") {
|
|
59
|
-
k = x.length;
|
|
60
|
-
for (tmp = Array(k); k--;) tmp[k] = klona(x[k]);
|
|
61
|
-
return tmp;
|
|
62
|
-
}
|
|
63
|
-
if (str === "[object Set]") {
|
|
64
|
-
tmp = /* @__PURE__ */ new Set();
|
|
65
|
-
x.forEach(function(val) {
|
|
66
|
-
tmp.add(klona(val));
|
|
67
|
-
});
|
|
68
|
-
return tmp;
|
|
69
|
-
}
|
|
70
|
-
if (str === "[object Map]") {
|
|
71
|
-
tmp = /* @__PURE__ */ new Map();
|
|
72
|
-
x.forEach(function(val, key) {
|
|
73
|
-
tmp.set(klona(key), klona(val));
|
|
74
|
-
});
|
|
75
|
-
return tmp;
|
|
76
|
-
}
|
|
77
|
-
if (str === "[object Date]") return /* @__PURE__ */ new Date(+x);
|
|
78
|
-
if (str === "[object RegExp]") {
|
|
79
|
-
tmp = new RegExp(x.source, x.flags);
|
|
80
|
-
tmp.lastIndex = x.lastIndex;
|
|
81
|
-
return tmp;
|
|
82
|
-
}
|
|
83
|
-
if (str === "[object DataView]") return new x.constructor(klona(x.buffer));
|
|
84
|
-
if (str === "[object ArrayBuffer]") return x.slice(0);
|
|
85
|
-
if (str.slice(-6) === "Array]") return new x.constructor(x);
|
|
86
|
-
return x;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
//#endregion
|
|
90
|
-
export { klona$1 as n, klona as t };
|
|
38
|
+
export { klona as t };
|
package/dist/_presets.mjs
CHANGED
|
@@ -1443,7 +1443,7 @@ function generateBuildConfig(nitro, o11Routes) {
|
|
|
1443
1443
|
function deprecateSWR(nitro) {
|
|
1444
1444
|
if (nitro.options.future.nativeSWR) return;
|
|
1445
1445
|
let hasLegacyOptions = false;
|
|
1446
|
-
for (const [
|
|
1446
|
+
for (const [_key, value] of Object.entries(nitro.options.routeRules)) {
|
|
1447
1447
|
if (_hasProp(value, "isr")) continue;
|
|
1448
1448
|
if (value.cache === false) value.isr = false;
|
|
1449
1449
|
if (_hasProp(value, "static")) {
|
package/dist/builder.mjs
CHANGED
|
@@ -13,11 +13,11 @@ 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 createNitro, c as loadOptions, i as build, n as prepare, o as listTasks, r as copyPublicAssets, s as runTask, t as prerender } from "./_chunks/
|
|
16
|
+
import { a as createNitro, c as loadOptions, i as build, n as prepare, o as listTasks, r as copyPublicAssets, s as runTask, t as prerender } from "./_chunks/B45B0YMI.mjs";
|
|
17
17
|
import "./_libs/escape-string-regexp.mjs";
|
|
18
18
|
import "./_libs/dot-prop.mjs";
|
|
19
19
|
import { t as getBuildInfo } from "./_chunks/zV3n76Yk.mjs";
|
|
20
|
-
import { n as writeTypes } from "./_chunks/
|
|
20
|
+
import { n as writeTypes } from "./_chunks/thLbatgM.mjs";
|
|
21
21
|
import "./_libs/rou3.mjs";
|
|
22
22
|
import "./_libs/mime.mjs";
|
|
23
23
|
import "./_libs/pathe.mjs";
|
|
@@ -49,7 +49,7 @@ export function startScheduleRunner() {
|
|
|
49
49
|
}
|
|
50
50
|
const payload = { scheduledTime: Date.now() };
|
|
51
51
|
for (const schedule of scheduledTasks) {
|
|
52
|
-
|
|
52
|
+
new Cron(schedule.cron, async () => {
|
|
53
53
|
await Promise.all(schedule.tasks.map((name) => runTask(name, {
|
|
54
54
|
payload,
|
|
55
55
|
context: {}
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
2
2
|
import { Hookable, HookableCore, NestedHooks } from "hookable";
|
|
3
3
|
import { FetchOptions, FetchRequest, FetchResponse } from "ofetch";
|
|
4
|
-
import { BuiltinDriverName, Storage } from "unstorage";
|
|
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";
|
|
@@ -9,6 +8,7 @@ import { ServerRequest } from "srvx";
|
|
|
9
8
|
import { Preset } from "unenv";
|
|
10
9
|
import { ConnectorName } from "db0";
|
|
11
10
|
import { Loader, TransformOptions } from "esbuild";
|
|
11
|
+
import { BuiltinDriverName } from "unstorage";
|
|
12
12
|
import { ExternalsPluginOptions as NodeExternalsOptions } from "nf3";
|
|
13
13
|
import { InputOptions, OutputOptions } from "rollup";
|
|
14
14
|
import { DevMessageListener as DevMessageListener$1, Nitro as Nitro$1 } from "nitro/types";
|
|
@@ -2626,7 +2626,6 @@ interface Nitro {
|
|
|
2626
2626
|
hooks: Hookable<NitroHooks>;
|
|
2627
2627
|
unimport?: Unimport;
|
|
2628
2628
|
logger: ConsolaInstance;
|
|
2629
|
-
storage: Storage;
|
|
2630
2629
|
fetch: (input: Request) => Response | Promise<Response>;
|
|
2631
2630
|
close: () => Promise<void>;
|
|
2632
2631
|
updateConfig: (config: NitroDynamicConfig) => void | Promise<void>;
|
|
@@ -2849,7 +2848,6 @@ interface NitroOptions extends PresetOptions {
|
|
|
2849
2848
|
devStorage: StorageMounts;
|
|
2850
2849
|
database: DatabaseConnectionConfigs;
|
|
2851
2850
|
devDatabase: DatabaseConnectionConfigs;
|
|
2852
|
-
bundledStorage: string[];
|
|
2853
2851
|
renderer?: {
|
|
2854
2852
|
handler?: string;
|
|
2855
2853
|
template?: string;
|
package/dist/vite.mjs
CHANGED
|
@@ -13,11 +13,11 @@ 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/B45B0YMI.mjs";
|
|
17
17
|
import "./_libs/escape-string-regexp.mjs";
|
|
18
18
|
import "./_libs/dot-prop.mjs";
|
|
19
19
|
import "./_chunks/zV3n76Yk.mjs";
|
|
20
|
-
import "./_chunks/
|
|
20
|
+
import "./_chunks/thLbatgM.mjs";
|
|
21
21
|
import "./_libs/rou3.mjs";
|
|
22
22
|
import "./_libs/mime.mjs";
|
|
23
23
|
import "./_libs/pathe.mjs";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"moduleDetection": "force",
|
|
7
|
+
"isolatedModules": true,
|
|
8
|
+
"verbatimModuleSyntax": true,
|
|
9
|
+
|
|
10
|
+
"allowJs": true,
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
"strict": true,
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
"skipLibCheck": true,
|
|
15
|
+
"resolveJsonModule": true,
|
|
16
|
+
"esModuleInterop": true,
|
|
17
|
+
"allowSyntheticDefaultImports": true,
|
|
18
|
+
"noUncheckedIndexedAccess": true,
|
|
19
|
+
"noImplicitOverride": true,
|
|
20
|
+
|
|
21
|
+
"forceConsistentCasingInFileNames": true,
|
|
22
|
+
"noImplicitReturns": true,
|
|
23
|
+
"noFallthroughCasesInSwitch": true,
|
|
24
|
+
"useUnknownInCatchVariables": true,
|
|
25
|
+
"noUnusedLocals": true
|
|
26
|
+
}
|
|
27
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitro-nightly",
|
|
3
|
-
"version": "3.0.1-20251106-
|
|
3
|
+
"version": "3.0.1-20251106-212413-8b396123",
|
|
4
4
|
"description": "Build and Deploy Universal JavaScript Servers",
|
|
5
5
|
"homepage": "https://nitro.build",
|
|
6
6
|
"repository": "nitrojs/nitro",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"./vite": "./dist/vite.mjs",
|
|
21
21
|
"./h3": "./lib/deps/h3.mjs",
|
|
22
22
|
"./deps/h3": "./lib/deps/h3.mjs",
|
|
23
|
-
"./deps/ofetch": "./lib/deps/ofetch.mjs"
|
|
23
|
+
"./deps/ofetch": "./lib/deps/ofetch.mjs",
|
|
24
|
+
"./tsconfig": "./lib/tsconfig.json"
|
|
24
25
|
},
|
|
25
26
|
"types": "./lib/index.d.mts",
|
|
26
27
|
"bin": {
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
"test:fixture:types": "pnpm stub && node ./test/scripts/gen-fixture-types.ts && cd test/fixture && tsc --noEmit",
|
|
47
48
|
"test:rolldown": "NITRO_BUILDER=rolldown pnpm vitest",
|
|
48
49
|
"test:rollup": "NITRO_BUILDER=rollup pnpm vitest",
|
|
49
|
-
"test:types": "tsc --noEmit
|
|
50
|
+
"test:types": "tsc --noEmit"
|
|
50
51
|
},
|
|
51
52
|
"resolutions": {
|
|
52
53
|
"nitro": "link:.",
|