nitro-nightly 3.0.1-20260125-215009-8882bc9e → 3.0.1-20260128-210932-ae83c97e
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 +2084 -3212
- package/dist/_build/rolldown.mjs +12 -25
- package/dist/_build/rollup.mjs +11 -27
- package/dist/_build/vite.build.mjs +7 -11
- package/dist/_chunks/dev.mjs +20 -42
- package/dist/_chunks/nitro.mjs +13 -92
- package/dist/_chunks/nitro2.mjs +1 -5
- package/dist/_chunks/utils.mjs +10 -24
- package/dist/_common.mjs +12 -24
- package/dist/_libs/citty.mjs +1 -13
- package/dist/_libs/commondir+is-reference.mjs +12 -22
- package/dist/_libs/compatx.mjs +1 -4
- package/dist/_libs/confbox.mjs +363 -376
- package/dist/_libs/escape-string-regexp.mjs +1 -4
- package/dist/_libs/estree-walker.mjs +4 -92
- package/dist/_libs/hasown+resolve+deepmerge.mjs +144 -230
- package/dist/_libs/httpxy.mjs +5 -21
- package/dist/_libs/klona.mjs +1 -4
- package/dist/_libs/nypm+giget+tinyexec.mjs +874 -926
- package/dist/_libs/plugin-alias.mjs +1 -5
- package/dist/_libs/plugin-inject.mjs +1 -5
- package/dist/_libs/plugin-json.mjs +1 -5
- package/dist/_libs/pluginutils+plugin-commonjs.d.mts +2 -2
- package/dist/_libs/pluginutils.mjs +1 -31
- package/dist/_libs/rc9+c12+dotenv.mjs +43 -83
- package/dist/_libs/readdirp+chokidar.mjs +184 -360
- package/dist/_libs/remapping.mjs +1 -5
- package/dist/_libs/resolve-uri+gen-mapping.mjs +12 -48
- package/dist/_libs/rou3.mjs +1 -32
- package/dist/_libs/tsconfck.mjs +21 -334
- package/dist/_libs/ultrahtml.mjs +3 -16
- package/dist/_libs/unimport+unplugin.mjs +15 -75
- package/dist/_presets.mjs +260 -445
- package/dist/builder.mjs +1 -2
- package/dist/cli/_chunks/build.mjs +1 -5
- package/dist/cli/_chunks/common.mjs +1 -4
- package/dist/cli/_chunks/dev.mjs +1 -5
- package/dist/cli/_chunks/list.mjs +1 -5
- package/dist/cli/_chunks/prepare.mjs +1 -5
- package/dist/cli/_chunks/run.mjs +1 -5
- package/dist/cli/_chunks/task.mjs +1 -5
- package/dist/cli/index.mjs +1 -5
- package/dist/types/index.d.mts +5 -5
- package/dist/types/index.mjs +1 -2
- package/dist/vite.mjs +44 -63
- package/package.json +22 -22
package/dist/_chunks/nitro.mjs
CHANGED
|
@@ -20,8 +20,6 @@ import { colors } from "consola/utils";
|
|
|
20
20
|
import { hash } from "ohash";
|
|
21
21
|
import http from "node:http";
|
|
22
22
|
import { toRequest } from "h3";
|
|
23
|
-
|
|
24
|
-
//#region src/config/defaults.ts
|
|
25
23
|
const NitroDefaults = {
|
|
26
24
|
compatibilityDate: "latest",
|
|
27
25
|
debug: d,
|
|
@@ -98,9 +96,6 @@ const NitroDefaults = {
|
|
|
98
96
|
version: ""
|
|
99
97
|
}
|
|
100
98
|
};
|
|
101
|
-
|
|
102
|
-
//#endregion
|
|
103
|
-
//#region src/config/resolvers/assets.ts
|
|
104
99
|
async function resolveAssetsOptions(options) {
|
|
105
100
|
for (const publicAsset of options.publicAssets) {
|
|
106
101
|
publicAsset.dir = resolve(options.rootDir, publicAsset.dir);
|
|
@@ -126,15 +121,9 @@ async function resolveAssetsOptions(options) {
|
|
|
126
121
|
if (asset.maxAge && !asset.fallthrough) options.routeRules[asset.baseURL + "/**"] = defu(routeRule, { headers: { "cache-control": `public, max-age=${asset.maxAge}, immutable` } });
|
|
127
122
|
}
|
|
128
123
|
}
|
|
129
|
-
|
|
130
|
-
//#endregion
|
|
131
|
-
//#region src/config/resolvers/compatibility.ts
|
|
132
124
|
async function resolveCompatibilityOptions(options) {
|
|
133
125
|
options.compatibilityDate = resolveCompatibilityDatesFromEnv(options.compatibilityDate);
|
|
134
126
|
}
|
|
135
|
-
|
|
136
|
-
//#endregion
|
|
137
|
-
//#region src/config/resolvers/database.ts
|
|
138
127
|
async function resolveDatabaseOptions(options) {
|
|
139
128
|
if (options.experimental.database && options.imports) {
|
|
140
129
|
options.imports.presets ??= [];
|
|
@@ -152,9 +141,6 @@ async function resolveDatabaseOptions(options) {
|
|
|
152
141
|
} };
|
|
153
142
|
}
|
|
154
143
|
}
|
|
155
|
-
|
|
156
|
-
//#endregion
|
|
157
|
-
//#region src/config/resolvers/export-conditions.ts
|
|
158
144
|
async function resolveExportConditionsOptions(options) {
|
|
159
145
|
options.exportConditions = _resolveExportConditions(options.exportConditions || [], {
|
|
160
146
|
dev: options.dev,
|
|
@@ -174,9 +160,6 @@ function _resolveExportConditions(conditions, opts) {
|
|
|
174
160
|
else if ("Deno" in globalThis) resolvedConditions.push("deno");
|
|
175
161
|
return resolvedConditions.filter((c, i) => resolvedConditions.indexOf(c) === i);
|
|
176
162
|
}
|
|
177
|
-
|
|
178
|
-
//#endregion
|
|
179
|
-
//#region src/config/resolvers/imports.ts
|
|
180
163
|
async function resolveImportsOptions(options) {
|
|
181
164
|
if (options.imports === false) return;
|
|
182
165
|
options.imports.presets ??= [];
|
|
@@ -186,12 +169,9 @@ async function resolveImportsOptions(options) {
|
|
|
186
169
|
options.imports.exclude.push(/[/\\]\.git[/\\]/);
|
|
187
170
|
options.imports.exclude.push(options.buildDir);
|
|
188
171
|
const scanDirsInNodeModules = options.scanDirs.map((dir) => dir.match(/(?<=\/)node_modules\/(.+)$/)?.[1]).filter(Boolean);
|
|
189
|
-
options.imports.exclude.push(scanDirsInNodeModules.length > 0 ?
|
|
172
|
+
options.imports.exclude.push(scanDirsInNodeModules.length > 0 ? new RegExp(`node_modules\\/(?!${scanDirsInNodeModules.map((dir) => escapeStringRegexp(dir)).join("|")})`) : /[/\\]node_modules[/\\]/);
|
|
190
173
|
}
|
|
191
174
|
}
|
|
192
|
-
|
|
193
|
-
//#endregion
|
|
194
|
-
//#region src/config/resolvers/open-api.ts
|
|
195
175
|
async function resolveOpenAPIOptions(options) {
|
|
196
176
|
if (!options.experimental.openAPI) return;
|
|
197
177
|
if (!options.dev && !options.openAPI?.production) return;
|
|
@@ -229,9 +209,6 @@ async function resolveOpenAPIOptions(options) {
|
|
|
229
209
|
options.prerender.routes.push(...prerenderRoutes);
|
|
230
210
|
}
|
|
231
211
|
}
|
|
232
|
-
|
|
233
|
-
//#endregion
|
|
234
|
-
//#region src/config/resolvers/tsconfig.ts
|
|
235
212
|
async function resolveTsconfig(options) {
|
|
236
213
|
const root = resolve(options.rootDir || ".") + "/";
|
|
237
214
|
if (!options.typescript.tsConfig) options.typescript.tsConfig = await loadTsconfig(root);
|
|
@@ -246,8 +223,7 @@ async function loadTsconfig(root) {
|
|
|
246
223
|
cache: loadTsconfig["__cache"] ??= new TSConfckCache(),
|
|
247
224
|
ignoreNodeModules: true
|
|
248
225
|
};
|
|
249
|
-
const
|
|
250
|
-
const parsed = await parse(tsConfigPath, opts).catch(() => void 0);
|
|
226
|
+
const parsed = await parse(join(root, "tsconfig.json"), opts).catch(() => void 0);
|
|
251
227
|
if (!parsed) return {};
|
|
252
228
|
const { tsconfig, tsconfigFile } = parsed;
|
|
253
229
|
tsconfig.compilerOptions ??= {};
|
|
@@ -276,9 +252,6 @@ function tsConfigToAliasObj(tsconfig, root) {
|
|
|
276
252
|
}
|
|
277
253
|
return alias;
|
|
278
254
|
}
|
|
279
|
-
|
|
280
|
-
//#endregion
|
|
281
|
-
//#region src/config/resolvers/paths.ts
|
|
282
255
|
const RESOLVE_EXTENSIONS = [
|
|
283
256
|
".ts",
|
|
284
257
|
".js",
|
|
@@ -368,9 +341,6 @@ async function resolvePathOptions(options) {
|
|
|
368
341
|
}
|
|
369
342
|
}
|
|
370
343
|
}
|
|
371
|
-
|
|
372
|
-
//#endregion
|
|
373
|
-
//#region src/config/resolvers/route-rules.ts
|
|
374
344
|
async function resolveRouteRulesOptions(options) {
|
|
375
345
|
options.routeRules = normalizeRouteRules(options);
|
|
376
346
|
}
|
|
@@ -413,9 +383,6 @@ function normalizeRouteRules(config) {
|
|
|
413
383
|
}
|
|
414
384
|
return normalizedRules;
|
|
415
385
|
}
|
|
416
|
-
|
|
417
|
-
//#endregion
|
|
418
|
-
//#region src/config/resolvers/runtime-config.ts
|
|
419
386
|
async function resolveRuntimeConfigOptions(options) {
|
|
420
387
|
options.runtimeConfig = normalizeRuntimeConfig(options);
|
|
421
388
|
}
|
|
@@ -450,28 +417,16 @@ function checkSerializableRuntimeConfig(obj, path = []) {
|
|
|
450
417
|
function isPrimitiveValue(value) {
|
|
451
418
|
return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
452
419
|
}
|
|
453
|
-
|
|
454
|
-
//#endregion
|
|
455
|
-
//#region src/config/resolvers/storage.ts
|
|
456
420
|
async function resolveStorageOptions(options) {}
|
|
457
|
-
|
|
458
|
-
//#endregion
|
|
459
|
-
//#region src/config/resolvers/url.ts
|
|
460
421
|
async function resolveURLOptions(options) {
|
|
461
422
|
options.baseURL = withLeadingSlash(withTrailingSlash(options.baseURL));
|
|
462
423
|
}
|
|
463
|
-
|
|
464
|
-
//#endregion
|
|
465
|
-
//#region src/config/resolvers/error.ts
|
|
466
424
|
async function resolveErrorOptions(options) {
|
|
467
425
|
if (!options.errorHandler) options.errorHandler = [];
|
|
468
426
|
else if (!Array.isArray(options.errorHandler)) options.errorHandler = [options.errorHandler];
|
|
469
427
|
options.errorHandler = options.errorHandler.map((h) => resolveNitroPath(h, options));
|
|
470
428
|
options.errorHandler.push(join(runtimeDir, `internal/error/${options.dev ? "dev" : "prod"}`));
|
|
471
429
|
}
|
|
472
|
-
|
|
473
|
-
//#endregion
|
|
474
|
-
//#region src/config/resolvers/unenv.ts
|
|
475
430
|
const common = {
|
|
476
431
|
meta: {
|
|
477
432
|
name: "nitro-common",
|
|
@@ -514,9 +469,6 @@ async function resolveUnenv(options) {
|
|
|
514
469
|
if (!options.node) options.unenv.unshift(nodeless);
|
|
515
470
|
options.unenv.unshift(common);
|
|
516
471
|
}
|
|
517
|
-
|
|
518
|
-
//#endregion
|
|
519
|
-
//#region src/config/resolvers/builder.ts
|
|
520
472
|
const VALID_BUILDERS = [
|
|
521
473
|
"rolldown",
|
|
522
474
|
"rollup",
|
|
@@ -570,9 +522,6 @@ async function installPkg(pkg, root) {
|
|
|
570
522
|
const { addDevDependency } = await import("../_libs/nypm+giget+tinyexec.mjs").then((n) => n.n);
|
|
571
523
|
return addDevDependency(pkg, { cwd: root });
|
|
572
524
|
}
|
|
573
|
-
|
|
574
|
-
//#endregion
|
|
575
|
-
//#region src/config/loader.ts
|
|
576
525
|
const configResolvers = [
|
|
577
526
|
resolveCompatibilityOptions,
|
|
578
527
|
resolveTsconfig,
|
|
@@ -639,12 +588,12 @@ async function _loadUserConfig(configOverrides = {}, opts = {}) {
|
|
|
639
588
|
};
|
|
640
589
|
},
|
|
641
590
|
async resolve(id) {
|
|
642
|
-
const preset
|
|
591
|
+
const preset = await resolvePreset(id, {
|
|
643
592
|
static: configOverrides.static,
|
|
644
593
|
compatibilityDate: compatibilityDate || "latest",
|
|
645
594
|
dev: configOverrides.dev
|
|
646
595
|
});
|
|
647
|
-
if (preset
|
|
596
|
+
if (preset) return { config: klona(preset) };
|
|
648
597
|
},
|
|
649
598
|
...opts.c12
|
|
650
599
|
});
|
|
@@ -656,18 +605,12 @@ async function _loadUserConfig(configOverrides = {}, opts = {}) {
|
|
|
656
605
|
if (options.dev && options.preset !== "nitro-dev") consola$1.info(`Using \`${options.preset}\` emulation in development mode.`);
|
|
657
606
|
return options;
|
|
658
607
|
}
|
|
659
|
-
|
|
660
|
-
//#endregion
|
|
661
|
-
//#region src/config/update.ts
|
|
662
608
|
async function updateNitroConfig(nitro, config) {
|
|
663
609
|
nitro.options.routeRules = normalizeRouteRules(config.routeRules ? config : nitro.options);
|
|
664
610
|
nitro.options.runtimeConfig = normalizeRuntimeConfig(config.runtimeConfig ? config : nitro.options);
|
|
665
611
|
await nitro.hooks.callHook("rollup:reload");
|
|
666
612
|
consola$1.success("Nitro config hot reloaded!");
|
|
667
613
|
}
|
|
668
|
-
|
|
669
|
-
//#endregion
|
|
670
|
-
//#region src/module.ts
|
|
671
614
|
async function installModules(nitro) {
|
|
672
615
|
const _modules = [...nitro.options.modules || []];
|
|
673
616
|
const modules = await Promise.all(_modules.map((mod) => _resolveNitroModule(mod, nitro.options)));
|
|
@@ -704,9 +647,6 @@ async function _resolveNitroModule(mod, nitroOptions) {
|
|
|
704
647
|
...mod
|
|
705
648
|
};
|
|
706
649
|
}
|
|
707
|
-
|
|
708
|
-
//#endregion
|
|
709
|
-
//#region src/routing.ts
|
|
710
650
|
const isGlobalMiddleware = (h) => !h.method && (!h.route || h.route === "/**");
|
|
711
651
|
function initNitroRouting(nitro) {
|
|
712
652
|
const envConditions = new Set([
|
|
@@ -838,9 +778,6 @@ function mergeCatchAll(router) {
|
|
|
838
778
|
data: handlers.map((h) => h.data)
|
|
839
779
|
});
|
|
840
780
|
}
|
|
841
|
-
|
|
842
|
-
//#endregion
|
|
843
|
-
//#region src/global.ts
|
|
844
781
|
const nitroInstances = globalThis.__nitro_instances__ ||= [];
|
|
845
782
|
const globalKey = "__nitro_builder__";
|
|
846
783
|
function registerNitroInstance(nitro) {
|
|
@@ -855,15 +792,12 @@ function registerNitroInstance(nitro) {
|
|
|
855
792
|
function globalInit() {
|
|
856
793
|
if (globalThis[globalKey]) return;
|
|
857
794
|
globalThis[globalKey] = { async fetch(req) {
|
|
858
|
-
for (let r = 0; r < 10 && nitroInstances.length === 0; r++) await new Promise((resolve
|
|
795
|
+
for (let r = 0; r < 10 && nitroInstances.length === 0; r++) await new Promise((resolve) => setTimeout(resolve, 300));
|
|
859
796
|
const nitro = nitroInstances[0];
|
|
860
797
|
if (!nitro) throw new Error("No Nitro instance is running.");
|
|
861
798
|
return nitro.fetch(req);
|
|
862
799
|
} };
|
|
863
800
|
}
|
|
864
|
-
|
|
865
|
-
//#endregion
|
|
866
|
-
//#region src/nitro.ts
|
|
867
801
|
async function createNitro(config = {}, opts = {}) {
|
|
868
802
|
const nitro = {
|
|
869
803
|
options: await loadOptions(config, opts),
|
|
@@ -876,8 +810,8 @@ async function createNitro(config = {}, opts = {}) {
|
|
|
876
810
|
throw new Error("no dev server attached!");
|
|
877
811
|
},
|
|
878
812
|
close: () => Promise.resolve(nitro.hooks.callHook("close")),
|
|
879
|
-
async updateConfig(config
|
|
880
|
-
updateNitroConfig(nitro, config
|
|
813
|
+
async updateConfig(config) {
|
|
814
|
+
updateNitroConfig(nitro, config);
|
|
881
815
|
}
|
|
882
816
|
};
|
|
883
817
|
registerNitroInstance(nitro);
|
|
@@ -898,9 +832,6 @@ async function createNitro(config = {}, opts = {}) {
|
|
|
898
832
|
nitro.routing.sync();
|
|
899
833
|
return nitro;
|
|
900
834
|
}
|
|
901
|
-
|
|
902
|
-
//#endregion
|
|
903
|
-
//#region src/prerender/utils.ts
|
|
904
835
|
const allowedExtensions = new Set(["", ".json"]);
|
|
905
836
|
const linkParents = /* @__PURE__ */ new Map();
|
|
906
837
|
const HTML_ENTITIES = {
|
|
@@ -961,9 +892,6 @@ function matchesIgnorePattern(path, pattern) {
|
|
|
961
892
|
if (pattern instanceof RegExp) return pattern.test(path);
|
|
962
893
|
return false;
|
|
963
894
|
}
|
|
964
|
-
|
|
965
|
-
//#endregion
|
|
966
|
-
//#region src/prerender/prerender.ts
|
|
967
895
|
const JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
|
|
968
896
|
async function prerender(nitro) {
|
|
969
897
|
if (nitro.options.noPublicDir) {
|
|
@@ -975,7 +903,7 @@ async function prerender(nitro) {
|
|
|
975
903
|
return;
|
|
976
904
|
}
|
|
977
905
|
const routes = new Set(nitro.options.prerender.routes);
|
|
978
|
-
const prerenderRulePaths = Object.entries(nitro.options.routeRules).filter(([path
|
|
906
|
+
const prerenderRulePaths = Object.entries(nitro.options.routeRules).filter(([path, options]) => options.prerender && !path.includes("*")).map((e) => e[0]);
|
|
979
907
|
for (const route of prerenderRulePaths) routes.add(route);
|
|
980
908
|
await nitro.hooks.callHook("prerender:routes", routes);
|
|
981
909
|
if (routes.size === 0) if (nitro.options.prerender.crawlLinks) routes.add("/");
|
|
@@ -1003,12 +931,12 @@ async function prerender(nitro) {
|
|
|
1003
931
|
const prerenderer = await import(pathToFileURL(resolve(nitroRenderer.options.output.serverDir, serverFilename)).href).then((m) => m.default);
|
|
1004
932
|
const routeRules = createRouter();
|
|
1005
933
|
for (const [route, rules] of Object.entries(nitro.options.routeRules)) addRoute(routeRules, void 0, route, rules);
|
|
1006
|
-
const _getRouteRules = (path
|
|
934
|
+
const _getRouteRules = (path) => defu({}, ...findAllRoutes(routeRules, void 0, path).map((r) => r.data).reverse());
|
|
1007
935
|
const generatedRoutes = /* @__PURE__ */ new Set();
|
|
1008
936
|
const failedRoutes = /* @__PURE__ */ new Set();
|
|
1009
937
|
const skippedRoutes = /* @__PURE__ */ new Set();
|
|
1010
938
|
const displayedLengthWarns = /* @__PURE__ */ new Set();
|
|
1011
|
-
const publicAssetBases = nitro.options.publicAssets.filter((a
|
|
939
|
+
const publicAssetBases = nitro.options.publicAssets.filter((a) => !!a.baseURL && a.baseURL !== "/" && !a.fallthrough).map((a) => withTrailingSlash(a.baseURL));
|
|
1012
940
|
const scannedPublicAssets = nitro.options.prerender.ignoreUnprefixedPublicAssets ? new Set(await scanUnprefixedPublicAssets(nitro)) : /* @__PURE__ */ new Set();
|
|
1013
941
|
const canPrerender = (route = "/") => {
|
|
1014
942
|
if (generatedRoutes.has(route) || skippedRoutes.has(route)) return false;
|
|
@@ -1129,17 +1057,12 @@ async function prerender(nitro) {
|
|
|
1129
1057
|
nitro.logger.info(`Prerendered ${nitro._prerenderedRoutes.length} routes in ${prerenderTimeInMs / 1e3} seconds`);
|
|
1130
1058
|
if (nitro.options.compressPublicAssets) await compressPublicAssets(nitro);
|
|
1131
1059
|
}
|
|
1132
|
-
|
|
1133
|
-
//#endregion
|
|
1134
|
-
//#region src/task.ts
|
|
1135
|
-
/** @experimental */
|
|
1136
1060
|
async function runTask(taskEvent, opts) {
|
|
1137
1061
|
return await (await _getTasksContext(opts)).devFetch(`/_nitro/tasks/${taskEvent.name}`, {
|
|
1138
1062
|
method: "POST",
|
|
1139
1063
|
body: taskEvent
|
|
1140
1064
|
});
|
|
1141
1065
|
}
|
|
1142
|
-
/** @experimental */
|
|
1143
1066
|
async function listTasks(opts) {
|
|
1144
1067
|
return (await (await _getTasksContext(opts)).devFetch("/_nitro/tasks")).tasks;
|
|
1145
1068
|
}
|
|
@@ -1153,7 +1076,7 @@ async function _getTasksContext(opts) {
|
|
|
1153
1076
|
const baseURL = `http://${buildInfo.dev.workerAddress.host || "localhost"}:${buildInfo.dev.workerAddress.port || "3000"}`;
|
|
1154
1077
|
const socketPath = buildInfo.dev.workerAddress.socketPath;
|
|
1155
1078
|
const devFetch = (path, options) => {
|
|
1156
|
-
return new Promise((resolve
|
|
1079
|
+
return new Promise((resolve, reject) => {
|
|
1157
1080
|
let url = withBase(path, baseURL);
|
|
1158
1081
|
if (options?.query) url = withQuery(url, options.query);
|
|
1159
1082
|
const request = http.request(url, {
|
|
@@ -1169,7 +1092,7 @@ async function _getTasksContext(opts) {
|
|
|
1169
1092
|
return;
|
|
1170
1093
|
}
|
|
1171
1094
|
let data = "";
|
|
1172
|
-
response.on("data", (chunk) => data += chunk).on("end", () => resolve
|
|
1095
|
+
response.on("data", (chunk) => data += chunk).on("end", () => resolve(JSON.parse(data))).on("error", (e) => reject(e));
|
|
1173
1096
|
});
|
|
1174
1097
|
request.on("error", (e) => reject(e));
|
|
1175
1098
|
if (options?.body) request.write(JSON.stringify(options.body));
|
|
@@ -1189,6 +1112,4 @@ function _pidIsRunning(pid) {
|
|
|
1189
1112
|
return false;
|
|
1190
1113
|
}
|
|
1191
1114
|
}
|
|
1192
|
-
|
|
1193
|
-
//#endregion
|
|
1194
|
-
export { loadOptions as a, createNitro as i, runTask as n, prerender as r, listTasks as t };
|
|
1115
|
+
export { loadOptions as a, createNitro as i, runTask as n, prerender as r, listTasks as t };
|
package/dist/_chunks/nitro2.mjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { N as glob, at as join, st as relative } from "../_build/common.mjs";
|
|
2
2
|
import { withBase, withLeadingSlash, withoutTrailingSlash } from "ufo";
|
|
3
|
-
|
|
4
|
-
//#region src/scan.ts
|
|
5
3
|
const GLOB_SCAN_PATTERN = "**/*.{js,mjs,cjs,ts,mts,cts,tsx,jsx}";
|
|
6
4
|
const suffixRegex = /(\.(?<method>connect|delete|get|head|options|patch|post|put|trace))?(\.(?<env>dev|prod|prerender))?$/;
|
|
7
5
|
async function scanAndSyncOptions(nitro) {
|
|
@@ -96,6 +94,4 @@ async function scanDir(nitro, dir, name) {
|
|
|
96
94
|
};
|
|
97
95
|
}).sort((a, b) => a.path.localeCompare(b.path));
|
|
98
96
|
}
|
|
99
|
-
|
|
100
|
-
//#endregion
|
|
101
|
-
export { scanHandlers as n, scanAndSyncOptions as t };
|
|
97
|
+
export { scanHandlers as n, scanAndSyncOptions as t };
|
package/dist/_chunks/utils.mjs
CHANGED
|
@@ -5,9 +5,7 @@ import { promisify } from "node:util";
|
|
|
5
5
|
import { colors } from "consola/utils";
|
|
6
6
|
import zlib from "node:zlib";
|
|
7
7
|
import "node:stream";
|
|
8
|
-
|
|
9
|
-
//#region node_modules/.pnpm/duplexer@0.1.2/node_modules/duplexer/index.js
|
|
10
|
-
var require_duplexer = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
8
|
+
(/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
11
9
|
var Stream = __require("stream");
|
|
12
10
|
var writeMethods = [
|
|
13
11
|
"write",
|
|
@@ -53,8 +51,8 @@ var require_duplexer = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
53
51
|
}
|
|
54
52
|
}
|
|
55
53
|
function proxyStream(methodName) {
|
|
56
|
-
reader.on(methodName, reemit
|
|
57
|
-
function reemit
|
|
54
|
+
reader.on(methodName, reemit);
|
|
55
|
+
function reemit() {
|
|
58
56
|
var args = slice.call(arguments);
|
|
59
57
|
args.unshift(methodName);
|
|
60
58
|
stream.emit.apply(stream, args);
|
|
@@ -71,11 +69,7 @@ var require_duplexer = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
71
69
|
stream.emit("error", err);
|
|
72
70
|
}
|
|
73
71
|
}
|
|
74
|
-
}));
|
|
75
|
-
|
|
76
|
-
//#endregion
|
|
77
|
-
//#region node_modules/.pnpm/gzip-size@7.0.0/node_modules/gzip-size/index.js
|
|
78
|
-
var import_duplexer = /* @__PURE__ */ __toESM(require_duplexer(), 1);
|
|
72
|
+
})))();
|
|
79
73
|
const getOptions = (options) => ({
|
|
80
74
|
level: 9,
|
|
81
75
|
...options
|
|
@@ -85,9 +79,6 @@ async function gzipSize(input, options) {
|
|
|
85
79
|
if (!input) return 0;
|
|
86
80
|
return (await gzip(input, getOptions(options))).length;
|
|
87
81
|
}
|
|
88
|
-
|
|
89
|
-
//#endregion
|
|
90
|
-
//#region node_modules/.pnpm/pretty-bytes@7.1.0/node_modules/pretty-bytes/index.js
|
|
91
82
|
const BYTE_UNITS = [
|
|
92
83
|
"B",
|
|
93
84
|
"kB",
|
|
@@ -200,9 +191,6 @@ function prettyBytes(number, options) {
|
|
|
200
191
|
}
|
|
201
192
|
return applyFixedWidth(result, options.fixedWidth);
|
|
202
193
|
}
|
|
203
|
-
|
|
204
|
-
//#endregion
|
|
205
|
-
//#region src/utils/fs-tree.ts
|
|
206
194
|
async function generateFSTree(dir, options = {}) {
|
|
207
195
|
if (a) return;
|
|
208
196
|
const files = await glob("**/*.*", {
|
|
@@ -214,23 +202,23 @@ async function generateFSTree(dir, options = {}) {
|
|
|
214
202
|
const path = resolve(dir, file);
|
|
215
203
|
const src = await promises.readFile(path);
|
|
216
204
|
const size = src.byteLength;
|
|
217
|
-
const gzip
|
|
205
|
+
const gzip = options.compressedSizes ? await gzipSize(src) : 0;
|
|
218
206
|
items.push({
|
|
219
207
|
file,
|
|
220
208
|
path,
|
|
221
209
|
size,
|
|
222
|
-
gzip
|
|
210
|
+
gzip
|
|
223
211
|
});
|
|
224
212
|
}, { concurrency: 10 });
|
|
225
|
-
items.sort((a
|
|
213
|
+
items.sort((a, b) => a.path.localeCompare(b.path));
|
|
226
214
|
let totalSize = 0;
|
|
227
215
|
let totalGzip = 0;
|
|
228
216
|
let totalNodeModulesSize = 0;
|
|
229
217
|
let totalNodeModulesGzip = 0;
|
|
230
218
|
let treeText = "";
|
|
231
219
|
for (const [index, item] of items.entries()) {
|
|
232
|
-
let dir
|
|
233
|
-
if (dir
|
|
220
|
+
let dir = dirname(item.file);
|
|
221
|
+
if (dir === ".") dir = "";
|
|
234
222
|
const rpath = relative(process.cwd(), item.path);
|
|
235
223
|
const treeChar = index === items.length - 1 ? "└─" : "├─";
|
|
236
224
|
if (item.file.includes("node_modules")) {
|
|
@@ -249,6 +237,4 @@ async function generateFSTree(dir, options = {}) {
|
|
|
249
237
|
treeText += "\n";
|
|
250
238
|
return treeText;
|
|
251
239
|
}
|
|
252
|
-
|
|
253
|
-
//#endregion
|
|
254
|
-
export { generateFSTree as t };
|
|
240
|
+
export { generateFSTree as t };
|
package/dist/_common.mjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
|
|
3
|
-
//#region rolldown:runtime
|
|
4
2
|
var __create = Object.create;
|
|
5
3
|
var __defProp = Object.defineProperty;
|
|
6
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -10,28 +8,20 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
10
8
|
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
11
9
|
var __exportAll = (all, symbols) => {
|
|
12
10
|
let target = {};
|
|
13
|
-
for (var name in all) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
if (symbols) {
|
|
20
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
21
|
-
}
|
|
11
|
+
for (var name in all) __defProp(target, name, {
|
|
12
|
+
get: all[name],
|
|
13
|
+
enumerable: true
|
|
14
|
+
});
|
|
15
|
+
if (symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
22
16
|
return target;
|
|
23
17
|
};
|
|
24
18
|
var __copyProps = (to, from, except, desc) => {
|
|
25
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
20
|
+
key = keys[i];
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
22
|
+
get: ((k) => from[k]).bind(null, key),
|
|
23
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
24
|
+
});
|
|
35
25
|
}
|
|
36
26
|
return to;
|
|
37
27
|
};
|
|
@@ -40,6 +30,4 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
40
30
|
enumerable: true
|
|
41
31
|
}) : target, mod));
|
|
42
32
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
43
|
-
|
|
44
|
-
//#endregion
|
|
45
|
-
export { __toESM as i, __exportAll as n, __require as r, __commonJSMin as t };
|
|
33
|
+
export { __toESM as i, __exportAll as n, __require as r, __commonJSMin as t };
|
package/dist/_libs/citty.mjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { parseArgs } from "node:util";
|
|
2
|
-
|
|
3
|
-
//#region node_modules/.pnpm/citty@0.2.0/node_modules/citty/dist/_chunks/libs/scule.mjs
|
|
4
2
|
const NUMBER_CHAR_RE = /\d/;
|
|
5
3
|
const STR_SPLITTERS = [
|
|
6
4
|
"-",
|
|
@@ -65,9 +63,6 @@ function camelCase(str, opts) {
|
|
|
65
63
|
function kebabCase(str, joiner) {
|
|
66
64
|
return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join(joiner ?? "-") : "";
|
|
67
65
|
}
|
|
68
|
-
|
|
69
|
-
//#endregion
|
|
70
|
-
//#region node_modules/.pnpm/citty@0.2.0/node_modules/citty/dist/index.mjs
|
|
71
66
|
function toArray(val) {
|
|
72
67
|
if (Array.isArray(val)) return val;
|
|
73
68
|
return val === void 0 ? [] : [val];
|
|
@@ -294,11 +289,6 @@ async function renderUsage(cmd, parent) {
|
|
|
294
289
|
const isRequired = arg.required === true && arg.default === void 0;
|
|
295
290
|
const argStr = [...(arg.alias || []).map((a) => `-${a}`), `--${arg.name}`].join(", ") + (arg.type === "string" && (arg.valueHint || arg.default) ? `=${arg.valueHint ? `<${arg.valueHint}>` : `"${arg.default || ""}"`}` : "") + (arg.type === "enum" && arg.options ? `=<${arg.options.join("|")}>` : "");
|
|
296
291
|
argLines.push([cyan(argStr + (isRequired ? " (required)" : "")), arg.description || ""]);
|
|
297
|
-
/**
|
|
298
|
-
* print negative boolean arg variant usage when
|
|
299
|
-
* - enabled by default or has `negativeDescription`
|
|
300
|
-
* - not prefixed with `no-` or `no[A-Z]`
|
|
301
|
-
*/
|
|
302
292
|
if (arg.type === "boolean" && (arg.default === true || arg.negativeDescription) && !negativePrefixRe.test(arg.name)) {
|
|
303
293
|
const negativeArgStr = [...(arg.alias || []).map((a) => `--no-${a}`), `--no-${arg.name}`].join(", ");
|
|
304
294
|
argLines.push([cyan(negativeArgStr + (isRequired ? " (required)" : "")), arg.negativeDescription || ""]);
|
|
@@ -358,6 +348,4 @@ async function runMain(cmd, opts = {}) {
|
|
|
358
348
|
process.exit(1);
|
|
359
349
|
}
|
|
360
350
|
}
|
|
361
|
-
|
|
362
|
-
//#endregion
|
|
363
|
-
export { runMain as n, defineCommand as t };
|
|
351
|
+
export { runMain as n, defineCommand as t };
|
|
@@ -2,8 +2,6 @@ import { i as __toESM, r as __require, t as __commonJSMin } from "../_common.mjs
|
|
|
2
2
|
import { F as Builder, S as MagicString, c as walk, i as createFilter, o as extractAssignedNames, r as attachScopes, s as makeLegalIdentifier } from "../_build/common.mjs";
|
|
3
3
|
import { existsSync, readFileSync, statSync } from "fs";
|
|
4
4
|
import { basename, dirname, extname, join, relative, resolve, sep } from "path";
|
|
5
|
-
|
|
6
|
-
//#region node_modules/.pnpm/commondir@1.0.1/node_modules/commondir/index.js
|
|
7
5
|
var require_commondir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
8
6
|
var path$1 = __require("path");
|
|
9
7
|
module.exports = function(basedir, relfiles) {
|
|
@@ -20,16 +18,13 @@ var require_commondir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
20
18
|
return res.length > 1 ? res.join("/") : "/";
|
|
21
19
|
};
|
|
22
20
|
}));
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
//#region node_modules/.pnpm/is-reference@1.2.1/node_modules/is-reference/dist/is-reference.js
|
|
26
21
|
var require_is_reference = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
27
22
|
(function(global, factory) {
|
|
28
23
|
typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = global || self, global.isReference = factory());
|
|
29
24
|
})(exports, (function() {
|
|
30
25
|
"use strict";
|
|
31
|
-
function isReference
|
|
32
|
-
if (node.type === "MemberExpression") return !node.computed && isReference
|
|
26
|
+
function isReference(node, parent) {
|
|
27
|
+
if (node.type === "MemberExpression") return !node.computed && isReference(node.object, node);
|
|
33
28
|
if (node.type === "Identifier") {
|
|
34
29
|
if (!parent) return true;
|
|
35
30
|
switch (parent.type) {
|
|
@@ -47,12 +42,9 @@ var require_is_reference = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
47
42
|
}
|
|
48
43
|
return false;
|
|
49
44
|
}
|
|
50
|
-
return isReference
|
|
45
|
+
return isReference;
|
|
51
46
|
}));
|
|
52
47
|
}));
|
|
53
|
-
|
|
54
|
-
//#endregion
|
|
55
|
-
//#region node_modules/.pnpm/@rollup+plugin-commonjs@29.0.0_rollup@4.55.3/node_modules/@rollup/plugin-commonjs/dist/es/index.js
|
|
56
48
|
var import_commondir = /* @__PURE__ */ __toESM(require_commondir(), 1);
|
|
57
49
|
var import_is_reference = /* @__PURE__ */ __toESM(require_is_reference(), 1);
|
|
58
50
|
var version = "29.0.0";
|
|
@@ -118,10 +110,10 @@ function getName(id) {
|
|
|
118
110
|
if (name !== "index") return name;
|
|
119
111
|
return makeLegalIdentifier(basename(dirname(id)));
|
|
120
112
|
}
|
|
121
|
-
function normalizePathSlashes(path
|
|
122
|
-
return path
|
|
113
|
+
function normalizePathSlashes(path) {
|
|
114
|
+
return path.replace(/\\/g, "/");
|
|
123
115
|
}
|
|
124
|
-
const getVirtualPathForDynamicRequirePath = (path
|
|
116
|
+
const getVirtualPathForDynamicRequirePath = (path, commonDir) => `/${normalizePathSlashes(relative(commonDir, path))}`;
|
|
125
117
|
function capitalize(name) {
|
|
126
118
|
return name[0].toUpperCase() + name.slice(1);
|
|
127
119
|
}
|
|
@@ -157,9 +149,9 @@ function getPackageEntryPoint(dirPath) {
|
|
|
157
149
|
} catch (ignored) {}
|
|
158
150
|
return entryPoint;
|
|
159
151
|
}
|
|
160
|
-
function isDirectory(path
|
|
152
|
+
function isDirectory(path) {
|
|
161
153
|
try {
|
|
162
|
-
if (statSync(path
|
|
154
|
+
if (statSync(path).isDirectory()) return true;
|
|
163
155
|
} catch (ignored) {}
|
|
164
156
|
return false;
|
|
165
157
|
}
|
|
@@ -169,12 +161,12 @@ function getDynamicRequireModules(patterns, dynamicRequireRoot) {
|
|
|
169
161
|
for (const pattern of !patterns || Array.isArray(patterns) ? patterns || [] : [patterns]) {
|
|
170
162
|
const isNegated = pattern.startsWith("!");
|
|
171
163
|
const modifyMap = (targetPath, resolvedPath) => isNegated ? dynamicRequireModules.delete(targetPath) : dynamicRequireModules.set(targetPath, resolvedPath);
|
|
172
|
-
for (const path
|
|
173
|
-
const resolvedPath = resolve(path
|
|
164
|
+
for (const path of new Builder().withBasePath().withDirs().glob(isNegated ? pattern.substr(1) : pattern).crawl(relative(".", dynamicRequireRoot)).sync().sort((a, b) => a.localeCompare(b, "en"))) {
|
|
165
|
+
const resolvedPath = resolve(path);
|
|
174
166
|
const requirePath = normalizePathSlashes(resolvedPath);
|
|
175
167
|
if (isDirectory(resolvedPath)) {
|
|
176
168
|
dirNames.add(resolvedPath);
|
|
177
|
-
const modulePath = resolve(join(resolvedPath, getPackageEntryPoint(path
|
|
169
|
+
const modulePath = resolve(join(resolvedPath, getPackageEntryPoint(path)));
|
|
178
170
|
modifyMap(requirePath, modulePath);
|
|
179
171
|
modifyMap(normalizePathSlashes(modulePath), modulePath);
|
|
180
172
|
} else {
|
|
@@ -1295,6 +1287,4 @@ function commonjs(options = {}) {
|
|
|
1295
1287
|
}
|
|
1296
1288
|
};
|
|
1297
1289
|
}
|
|
1298
|
-
|
|
1299
|
-
//#endregion
|
|
1300
|
-
export { commonjs as t };
|
|
1290
|
+
export { commonjs as t };
|
package/dist/_libs/compatx.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region node_modules/.pnpm/compatx@0.2.0/node_modules/compatx/dist/index.mjs
|
|
2
1
|
const platforms = [
|
|
3
2
|
"aws",
|
|
4
3
|
"azure",
|
|
@@ -41,6 +40,4 @@ function normalizeDate(date) {
|
|
|
41
40
|
if (date === "latest") return /* @__PURE__ */ new Date();
|
|
42
41
|
return new Date(date);
|
|
43
42
|
}
|
|
44
|
-
|
|
45
|
-
//#endregion
|
|
46
|
-
export { resolveCompatibilityDates as n, resolveCompatibilityDatesFromEnv as r, formatCompatibilityDate as t };
|
|
43
|
+
export { resolveCompatibilityDates as n, resolveCompatibilityDatesFromEnv as r, formatCompatibilityDate as t };
|