nitro-nightly 3.0.1-20251217-221413-0e6f159e → 3.0.1-20251217-223946-1ee0b5b8

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/_nitro3.mjs DELETED
@@ -1,1158 +0,0 @@
1
- import { i as __toESM } from "./_rolldown.mjs";
2
- import { C as isAbsolute, O as relative, T as normalize, h as resolveModulePath, k as resolve$1, w as join } from "./_libs/c12.mjs";
3
- import { i as unplugin } from "./_libs/unimport.mjs";
4
- import { t as glob } from "./_libs/tinyglobby.mjs";
5
- import { i as a, r as T, t as A } from "./_libs/std-env.mjs";
6
- import { t as src_default } from "./_libs/mime.mjs";
7
- import { i as genSafeVariableName, t as genImport } from "./_libs/knitwork.mjs";
8
- import { t as require_etag } from "./_libs/etag.mjs";
9
- import { t as replace } from "./_libs/@rollup/plugin-replace.mjs";
10
- import { t as unwasm } from "./_libs/unwasm.mjs";
11
- import { builtinModules, createRequire } from "node:module";
12
- import { consola } from "consola";
13
- import { camelCase } from "scule";
14
- import { promises } from "node:fs";
15
- import { joinURL, withTrailingSlash } from "ufo";
16
- import { fileURLToPath, pathToFileURL } from "node:url";
17
- import { readFile } from "node:fs/promises";
18
- import { pkgDir, presetsDir, runtimeDir } from "nitro/meta";
19
- import { hash } from "ohash";
20
- import { defineEnv } from "unenv";
21
- import { connectors } from "db0";
22
- import { RENDER_CONTEXT_KEYS, compileTemplateToString, hasTemplateSyntax } from "rendu";
23
- import { builtinDrivers, normalizeKey } from "unstorage";
24
- import { transformSync } from "oxc-transform";
25
-
26
- //#region src/utils/regex.ts
27
- function escapeRegExp(string) {
28
- return string.replace(/[-\\^$*+?.()|[\]{}]/g, String.raw`\$&`);
29
- }
30
- function pathRegExp(string) {
31
- if (A) string = string.replace(/\\/g, "/");
32
- let escaped = escapeRegExp(string);
33
- if (A) escaped = escaped.replace(/\//g, String.raw`[/\\]`);
34
- return escaped;
35
- }
36
- function toPathRegExp(input) {
37
- if (input instanceof RegExp) return input;
38
- if (typeof input === "string") return new RegExp(pathRegExp(input));
39
- throw new TypeError("Expected a string or RegExp", { cause: input });
40
- }
41
-
42
- //#endregion
43
- //#region src/build/config.ts
44
- function baseBuildConfig(nitro) {
45
- const extensions = [
46
- ".ts",
47
- ".mjs",
48
- ".js",
49
- ".json",
50
- ".node",
51
- ".tsx",
52
- ".jsx"
53
- ];
54
- const isNodeless = nitro.options.node === false;
55
- const importMetaInjections = {
56
- dev: nitro.options.dev,
57
- preset: nitro.options.preset,
58
- prerender: nitro.options.preset === "nitro-prerender",
59
- nitro: true,
60
- server: true,
61
- client: false,
62
- baseURL: nitro.options.baseURL,
63
- _asyncContext: nitro.options.experimental.asyncContext,
64
- _tasks: nitro.options.experimental.tasks
65
- };
66
- const replacements = {
67
- ...Object.fromEntries(Object.entries(importMetaInjections).map(([key, val]) => [`import.meta.${key}`, JSON.stringify(val)])),
68
- ...nitro.options.replace
69
- };
70
- const { env } = defineEnv({
71
- nodeCompat: isNodeless,
72
- resolve: true,
73
- presets: nitro.options.unenv,
74
- overrides: { alias: nitro.options.alias }
75
- });
76
- return {
77
- extensions,
78
- isNodeless,
79
- replacements,
80
- env,
81
- aliases: resolveAliases({ ...env.alias }),
82
- noExternal: getNoExternals(nitro),
83
- ignoreWarningCodes: new Set([
84
- "EVAL",
85
- "CIRCULAR_DEPENDENCY",
86
- "THIS_IS_UNDEFINED",
87
- "EMPTY_BUNDLE"
88
- ])
89
- };
90
- }
91
- function getNoExternals(nitro) {
92
- const noExternal = [
93
- /\.[mc]?tsx?$/,
94
- /^(?:[\0#~.]|virtual:)/,
95
- /* @__PURE__ */ new RegExp("^" + pathRegExp(pkgDir) + "(?!.*node_modules)"),
96
- ...[nitro.options.rootDir, ...nitro.options.scanDirs.filter((dir) => dir.includes("node_modules") || !dir.startsWith(nitro.options.rootDir))].map((dir) => /* @__PURE__ */ new RegExp("^" + pathRegExp(dir) + "(?!.*node_modules)"))
97
- ];
98
- if (nitro.options.wasm !== false) noExternal.push(/\.wasm$/);
99
- if (Array.isArray(nitro.options.noExternals)) noExternal.push(...nitro.options.noExternals.filter(Boolean).map((item) => toPathRegExp(item)));
100
- return noExternal.sort((a$1, b) => a$1.source.length - b.source.length);
101
- }
102
- function resolveAliases(_aliases) {
103
- const aliases = Object.fromEntries(Object.entries(_aliases).sort(([a$1], [b]) => b.split("/").length - a$1.split("/").length || b.length - a$1.length));
104
- for (const key in aliases) for (const alias in aliases) {
105
- if (![
106
- "~",
107
- "@",
108
- "#"
109
- ].includes(alias[0])) continue;
110
- if (alias === "@" && !aliases[key].startsWith("@/")) continue;
111
- if (aliases[key].startsWith(alias)) aliases[key] = aliases[alias] + aliases[key].slice(alias.length);
112
- }
113
- return aliases;
114
- }
115
-
116
- //#endregion
117
- //#region src/build/chunks.ts
118
- const virtualRe = /^\0|^virtual:/;
119
- const NODE_MODULES_RE$1 = /node_modules[/\\][^.]/;
120
- function libChunkName(id) {
121
- return `_libs/${id.match(/.*(?:[/\\])node_modules(?:[/\\])(?<package>@[^/\\]+[/\\][^/\\]+|[^/\\.][^/\\]*)/)?.groups?.package || "common"}`;
122
- }
123
- function getChunkName(chunk, nitro) {
124
- if (chunk.name.startsWith("_libs/")) return `${chunk.name}.mjs`;
125
- if (chunk.name === "rolldown-runtime") return "_runtime/rolldown.mjs";
126
- if (chunk.moduleIds.length === 0) return `_chunks/${chunk.name}.mjs`;
127
- const ids = chunk.moduleIds.filter((id) => !virtualRe.test(id));
128
- if (ids.length === 0) {
129
- if (chunk.moduleIds.every((id) => id.includes("virtual:raw"))) return `_raw/[name].mjs`;
130
- return `_virtual/[name].mjs`;
131
- }
132
- if (ids.every((id) => id.endsWith(".wasm"))) return `_wasm/[name].mjs`;
133
- if (ids.every((id) => id.includes("vite/services"))) return `_ssr/[name].mjs`;
134
- if (ids.every((id) => id.startsWith(nitro.options.buildDir))) return `_build/[name].mjs`;
135
- if (ids.every((id) => id.startsWith(runtimeDir) || id.startsWith(presetsDir))) return `_runtime/[name].mjs`;
136
- const mainId = ids.at(-1);
137
- if (mainId) {
138
- const routeHandler = nitro.routing.routes.routes.flatMap((h) => h.data).find((h) => h.handler === mainId);
139
- if (routeHandler?.route) return `_routes/${routeToFsPath(routeHandler.route)}.mjs`;
140
- if (Object.entries(nitro.options.tasks).find(([_, task]) => task.handler === mainId)) return `_tasks/[name].mjs`;
141
- }
142
- return `_chunks/[name].mjs`;
143
- }
144
- function routeToFsPath(route) {
145
- return route.split("/").slice(1).map((s) => `${s.replace(/[:*]+/g, "$").replace(/[^$a-zA-Z0-9_.[\]/]/g, "_")}`).join("/") || "index";
146
- }
147
-
148
- //#endregion
149
- //#region src/build/virtual/database.ts
150
- function database(nitro) {
151
- return {
152
- id: "#nitro/virtual/database",
153
- template: () => {
154
- if (!nitro.options.experimental.database) return `export const connectionConfigs = {};`;
155
- const dbConfigs = nitro.options.dev && nitro.options.devDatabase || nitro.options.database;
156
- const connectorsNames = [...new Set(Object.values(dbConfigs || {}).map((config) => config?.connector))].filter(Boolean);
157
- for (const name of connectorsNames) if (!connectors[name]) throw new Error(`Database connector "${name}" is invalid.`);
158
- return `
159
- ${connectorsNames.map((name) => `import ${camelCase(name)}Connector from "${connectors[name]}";`).join("\n")}
160
-
161
- export const connectionConfigs = {
162
- ${Object.entries(dbConfigs || {}).filter(([, config]) => !!config?.connector).map(([name, { connector, options }]) => `${name}: {
163
- connector: ${camelCase(connector)}Connector,
164
- options: ${JSON.stringify(options)}
165
- }`).join(",\n")}
166
- };
167
- `;
168
- }
169
- };
170
- }
171
-
172
- //#endregion
173
- //#region src/build/virtual/error-handler.ts
174
- function errorHandler(nitro) {
175
- return {
176
- id: "#nitro/virtual/error-handler",
177
- template: () => {
178
- const errorHandlers = Array.isArray(nitro.options.errorHandler) ? nitro.options.errorHandler : [nitro.options.errorHandler];
179
- const builtinHandler = join(runtimeDir, `internal/error/${nitro.options.dev ? "dev" : "prod"}`);
180
- return `
181
- ${errorHandlers.map((h, i) => `import errorHandler$${i} from "${h}";`).join("\n")}
182
-
183
- const errorHandlers = [${errorHandlers.map((_, i) => `errorHandler$${i}`).join(", ")}];
184
-
185
- import { defaultHandler } from "${builtinHandler}";
186
-
187
- export default async function(error, event) {
188
- for (const handler of errorHandlers) {
189
- try {
190
- const response = await handler(error, event, { defaultHandler });
191
- if (response) {
192
- return response;
193
- }
194
- } catch(error) {
195
- // Handler itself thrown, log and continue
196
- console.error(error);
197
- }
198
- }
199
- // H3 will handle fallback
200
- }
201
- `;
202
- }
203
- };
204
- }
205
-
206
- //#endregion
207
- //#region src/build/virtual/feature-flags.ts
208
- function featureFlags(nitro) {
209
- return {
210
- id: "#nitro/virtual/feature-flags",
211
- template: () => {
212
- const featureFlags$1 = {
213
- hasRoutes: nitro.routing.routes.hasRoutes(),
214
- hasRouteRules: nitro.routing.routeRules.hasRoutes(),
215
- hasRoutedMiddleware: nitro.routing.routedMiddleware.hasRoutes(),
216
- hasGlobalMiddleware: nitro.routing.globalMiddleware.length > 0,
217
- hasPlugins: nitro.options.plugins.length > 0,
218
- hasHooks: nitro.options.features?.runtimeHooks ?? nitro.options.plugins.length > 0,
219
- hasWebSocket: nitro.options.features?.websocket ?? nitro.options.experimental.websocket ?? false
220
- };
221
- return Object.entries(featureFlags$1).map(([key, value]) => `export const ${key} = ${Boolean(value)};`).join("\n");
222
- }
223
- };
224
- }
225
-
226
- //#endregion
227
- //#region src/build/virtual/plugins.ts
228
- function plugins(nitro) {
229
- return {
230
- id: "#nitro/virtual/plugins",
231
- template: () => {
232
- const nitroPlugins = [...new Set(nitro.options.plugins)];
233
- return `
234
- ${nitroPlugins.map((plugin) => `import _${hash(plugin).replace(/-/g, "")} from "${plugin}";`).join("\n")}
235
-
236
- export const plugins = [
237
- ${nitroPlugins.map((plugin) => `_${hash(plugin).replace(/-/g, "")}`).join(",\n")}
238
- ]
239
- `;
240
- }
241
- };
242
- }
243
-
244
- //#endregion
245
- //#region src/build/virtual/polyfills.ts
246
- function polyfills(_nitro, polyfills$1) {
247
- return {
248
- id: "#nitro/virtual/polyfills",
249
- moduleSideEffects: true,
250
- template: () => {
251
- return polyfills$1.map((p) => `import '${p}';`).join("\n") || `/* No polyfills */`;
252
- }
253
- };
254
- }
255
-
256
- //#endregion
257
- //#region src/build/virtual/public-assets.ts
258
- var import_etag$1 = /* @__PURE__ */ __toESM(require_etag(), 1);
259
- const readAssetHandler = {
260
- true: "node",
261
- node: "node",
262
- false: "null",
263
- deno: "deno",
264
- inline: "inline"
265
- };
266
- function publicAssets(nitro) {
267
- return [
268
- {
269
- id: "#nitro/virtual/public-assets-data",
270
- template: async () => {
271
- const assets = {};
272
- const files = await glob("**", {
273
- cwd: nitro.options.output.publicDir,
274
- absolute: false,
275
- dot: true
276
- });
277
- for (const id of files) {
278
- let mimeType = src_default.getType(id.replace(/\.(gz|br)$/, "")) || "text/plain";
279
- if (mimeType.startsWith("text")) mimeType += "; charset=utf-8";
280
- const fullPath = resolve$1(nitro.options.output.publicDir, id);
281
- const assetData = await promises.readFile(fullPath);
282
- const etag = (0, import_etag$1.default)(assetData);
283
- const stat$2 = await promises.stat(fullPath);
284
- const assetId = joinURL(nitro.options.baseURL, decodeURIComponent(id));
285
- let encoding;
286
- if (id.endsWith(".gz")) encoding = "gzip";
287
- else if (id.endsWith(".br")) encoding = "br";
288
- assets[assetId] = {
289
- type: nitro._prerenderMeta?.[assetId]?.contentType || mimeType,
290
- encoding,
291
- etag,
292
- mtime: stat$2.mtime.toJSON(),
293
- size: stat$2.size,
294
- path: relative(nitro.options.output.serverDir, fullPath),
295
- data: nitro.options.serveStatic === "inline" ? assetData.toString("base64") : void 0
296
- };
297
- }
298
- return `export default ${JSON.stringify(assets, null, 2)};`;
299
- }
300
- },
301
- {
302
- id: "#nitro/virtual/public-assets",
303
- template: () => {
304
- const publicAssetBases = Object.fromEntries(nitro.options.publicAssets.filter((dir) => !dir.fallthrough && dir.baseURL !== "/").map((dir) => [withTrailingSlash(joinURL(nitro.options.baseURL, dir.baseURL || "/")), { maxAge: dir.maxAge }]));
305
- return `
306
- import assets from '#nitro/virtual/public-assets-data'
307
- export { readAsset } from "${`#nitro/virtual/public-assets-${readAssetHandler[nitro.options.serveStatic] || "null"}`}"
308
- export const publicAssetBases = ${JSON.stringify(publicAssetBases)}
309
-
310
- export function isPublicAssetURL(id = '') {
311
- if (assets[id]) {
312
- return true
313
- }
314
- for (const base in publicAssetBases) {
315
- if (id.startsWith(base)) { return true }
316
- }
317
- return false
318
- }
319
-
320
- export function getPublicAssetMeta(id = '') {
321
- for (const base in publicAssetBases) {
322
- if (id.startsWith(base)) { return publicAssetBases[base] }
323
- }
324
- return {}
325
- }
326
-
327
- export function getAsset (id) {
328
- return assets[id]
329
- }
330
- `;
331
- }
332
- },
333
- {
334
- id: "#nitro/virtual/public-assets-node",
335
- template: () => {
336
- return `
337
- import { promises as fsp } from 'node:fs'
338
- import { fileURLToPath } from 'node:url'
339
- import { resolve, dirname } from 'node:path'
340
- import assets from '#nitro/virtual/public-assets-data'
341
- export function readAsset (id) {
342
- const serverDir = dirname(fileURLToPath(globalThis.__nitro_main__))
343
- return fsp.readFile(resolve(serverDir, assets[id].path))
344
- }`;
345
- }
346
- },
347
- {
348
- id: "#nitro/virtual/public-assets-deno",
349
- template: () => {
350
- return `
351
- import assets from '#nitro/virtual/public-assets-data'
352
- export function readAsset (id) {
353
- // https://deno.com/deploy/docs/serve-static-assets
354
- const path = '.' + decodeURIComponent(new URL(\`../public\${id}\`, 'file://').pathname)
355
- return Deno.readFile(path);
356
- }`;
357
- }
358
- },
359
- {
360
- id: "#nitro/virtual/public-assets-null",
361
- template: () => {
362
- return `
363
- export function readAsset (id) {
364
- return Promise.resolve(null);
365
- }`;
366
- }
367
- },
368
- {
369
- id: "#nitro/virtual/public-assets-inline",
370
- template: () => {
371
- return `
372
- import assets from '#nitro/virtual/public-assets-data'
373
- export function readAsset (id) {
374
- if (!assets[id]) { return undefined }
375
- if (assets[id]._data) { return assets[id]._data }
376
- if (!assets[id].data) { return assets[id].data }
377
- assets[id]._data = Uint8Array.from(atob(assets[id].data), (c) => c.charCodeAt(0))
378
- return assets[id]._data
379
- }`;
380
- }
381
- }
382
- ];
383
- }
384
-
385
- //#endregion
386
- //#region src/build/virtual/renderer-template.ts
387
- function rendererTemplate(nitro) {
388
- return {
389
- id: "#nitro/virtual/renderer-template",
390
- template: async () => {
391
- const template = nitro.options.renderer?.template;
392
- if (typeof template !== "string") return `
393
- export const rendererTemplate = () => '<!-- renderer.template is not set -->';
394
- export const rendererTemplateFile = undefined;
395
- export const isStaticTemplate = true;`;
396
- if (nitro.options.dev) return `
397
- import { readFile } from 'node:fs/promises';
398
- export const rendererTemplate = () => readFile(${JSON.stringify(template)}, "utf8");
399
- export const rendererTemplateFile = ${JSON.stringify(template)};
400
- export const isStaticTemplate = ${JSON.stringify(nitro.options.renderer?.static)};
401
- `;
402
- else {
403
- const html = await readFile(template, "utf8");
404
- if (nitro.options.renderer?.static ?? !hasTemplateSyntax(html)) return `
405
- import { HTTPResponse } from "h3";
406
- export const rendererTemplate = () => new HTTPResponse(${JSON.stringify(html)}, { headers: { "content-type": "text/html; charset=utf-8" } });
407
- `;
408
- else return `
409
- import { renderToResponse } from 'rendu'
410
- import { serverFetch } from 'nitro/app'
411
- const template = ${compileTemplateToString(html, { contextKeys: [...RENDER_CONTEXT_KEYS] })};
412
- export const rendererTemplate = (request) => renderToResponse(template, { request, context: { serverFetch } })
413
- `;
414
- }
415
- }
416
- };
417
- }
418
-
419
- //#endregion
420
- //#region src/build/virtual/routing-meta.ts
421
- function routingMeta(nitro) {
422
- return {
423
- id: "#nitro/virtual/routing-meta",
424
- template: () => {
425
- const routeHandlers = uniqueBy$1(Object.values(nitro.routing.routes.routes).flatMap((h) => h.data), "_importHash");
426
- return `
427
- ${routeHandlers.map((h) => `import ${h._importHash}Meta from "${h.handler}?meta";`).join("\n")}
428
- export const handlersMeta = [
429
- ${routeHandlers.map((h) => `{ route: ${JSON.stringify(h.route)}, method: ${JSON.stringify(h.method?.toLowerCase())}, meta: ${h._importHash}Meta }`).join(",\n")}
430
- ];
431
- `.trim();
432
- }
433
- };
434
- }
435
- function uniqueBy$1(arr, key) {
436
- return [...new Map(arr.map((item) => [item[key], item])).values()];
437
- }
438
-
439
- //#endregion
440
- //#region src/build/virtual/routing.ts
441
- const RuntimeRouteRules = [
442
- "headers",
443
- "redirect",
444
- "proxy",
445
- "cache"
446
- ];
447
- function routing(nitro) {
448
- return {
449
- id: "#nitro/virtual/routing",
450
- template: () => {
451
- const allHandlers = uniqueBy([
452
- ...Object.values(nitro.routing.routes.routes).flatMap((h) => h.data),
453
- ...Object.values(nitro.routing.routedMiddleware.routes).map((h) => h.data),
454
- ...nitro.routing.globalMiddleware
455
- ], "_importHash");
456
- return `
457
- import * as __routeRules__ from "#nitro/runtime/route-rules";
458
- import * as srvxNode from "srvx/node"
459
- import * as h3 from "h3";
460
-
461
- export const findRouteRules = ${nitro.routing.routeRules.compileToString({
462
- serialize: serializeRouteRule,
463
- matchAll: true
464
- })}
465
-
466
- const multiHandler = (...handlers) => {
467
- const final = handlers.pop()
468
- const middleware = handlers.filter(Boolean).map(h => h3.toMiddleware(h));
469
- return (ev) => h3.callMiddleware(ev, middleware, final);
470
- }
471
-
472
- ${allHandlers.filter((h) => !h.lazy).map((h) => `import ${h._importHash} from "${h.handler}";`).join("\n")}
473
-
474
- ${allHandlers.filter((h) => h.lazy).map((h) => `const ${h._importHash} = h3.defineLazyEventHandler(() => import("${h.handler}")${h.format === "node" ? ".then(m => srvxNode.toFetchHandler(m.default))" : ""});`).join("\n")}
475
-
476
- export const findRoute = ${nitro.routing.routes.compileToString({ serialize: serializeHandler })}
477
-
478
- export const findRoutedMiddleware = ${nitro.routing.routedMiddleware.compileToString({
479
- serialize: serializeHandler,
480
- matchAll: true
481
- })};
482
-
483
- export const globalMiddleware = [
484
- ${nitro.routing.globalMiddleware.map((h) => h.lazy ? h._importHash : `h3.toEventHandler(${h._importHash})`).join(",")}
485
- ].filter(Boolean);
486
- `;
487
- }
488
- };
489
- }
490
- function uniqueBy(arr, key) {
491
- return [...new Map(arr.map((item) => [item[key], item])).values()];
492
- }
493
- function serializeHandler(h) {
494
- const meta = Array.isArray(h) ? h[0] : h;
495
- return `{${[
496
- `route:${JSON.stringify(meta.route)}`,
497
- meta.method && `method:${JSON.stringify(meta.method)}`,
498
- meta.meta && `meta:${JSON.stringify(meta.meta)}`,
499
- `handler:${Array.isArray(h) ? `multiHandler(${h.map((handler) => serializeHandlerFn(handler)).join(",")})` : serializeHandlerFn(h)}`
500
- ].filter(Boolean).join(",")}}`;
501
- }
502
- function serializeHandlerFn(h) {
503
- let code = h._importHash;
504
- if (!h.lazy) {
505
- if (h.format === "node") code = `srvxNode.toFetchHandler(${code})`;
506
- code = `h3.toEventHandler(${code})`;
507
- }
508
- return code;
509
- }
510
- function serializeRouteRule(h) {
511
- return `[${Object.entries(h).filter(([name, options]) => options !== void 0 && name[0] !== "_").map(([name, options]) => {
512
- return `{${[
513
- `name:${JSON.stringify(name)}`,
514
- `route:${JSON.stringify(h._route)}`,
515
- h._method && `method:${JSON.stringify(h._method)}`,
516
- RuntimeRouteRules.includes(name) && `handler:__routeRules__.${name}`,
517
- `options:${JSON.stringify(options)}`
518
- ].filter(Boolean).join(",")}}`;
519
- }).join(",")}]`;
520
- }
521
-
522
- //#endregion
523
- //#region src/build/virtual/runtime-config.ts
524
- function runtimeConfig(nitro) {
525
- return {
526
- id: "#nitro/virtual/runtime-config",
527
- template: () => {
528
- return `export const runtimeConfig = ${JSON.stringify(nitro.options.runtimeConfig || {})};`;
529
- }
530
- };
531
- }
532
-
533
- //#endregion
534
- //#region src/build/virtual/server-assets.ts
535
- var import_etag = /* @__PURE__ */ __toESM(require_etag(), 1);
536
- function serverAssets(nitro) {
537
- return {
538
- id: "#nitro/virtual/server-assets",
539
- template: async () => {
540
- if (nitro.options.dev || nitro.options.preset === "nitro-prerender") return `
541
- import { createStorage } from 'unstorage'
542
- import fsDriver from 'unstorage/drivers/fs'
543
- const serverAssets = ${JSON.stringify(nitro.options.serverAssets)}
544
- export const assets = createStorage()
545
- for (const asset of serverAssets) {
546
- assets.mount(asset.baseName, fsDriver({ base: asset.dir, ignore: (asset?.ignore || []) }))
547
- }`;
548
- const assets = {};
549
- for (const asset of nitro.options.serverAssets) {
550
- const files = await glob(asset.pattern || "**/*", {
551
- cwd: asset.dir,
552
- absolute: false,
553
- ignore: asset.ignore
554
- });
555
- for (const _id of files) {
556
- const fsPath = resolve$1(asset.dir, _id);
557
- const id = asset.baseName + "/" + _id;
558
- assets[id] = {
559
- fsPath,
560
- meta: {}
561
- };
562
- let type = src_default.getType(id) || "text/plain";
563
- if (type.startsWith("text")) type += "; charset=utf-8";
564
- const etag = (0, import_etag.default)(await promises.readFile(fsPath));
565
- const mtime = await promises.stat(fsPath).then((s) => s.mtime.toJSON());
566
- assets[id].meta = {
567
- type,
568
- etag,
569
- mtime
570
- };
571
- }
572
- }
573
- return `
574
- const _assets = {\n${Object.entries(assets).map(([id, asset]) => ` [${JSON.stringify(normalizeKey(id))}]: {\n import: () => import(${JSON.stringify("raw:" + asset.fsPath)}).then(r => r.default || r),\n meta: ${JSON.stringify(asset.meta)}\n }`).join(",\n")}\n}
575
-
576
- const normalizeKey = ${normalizeKey.toString()}
577
-
578
- export const assets = {
579
- getKeys() {
580
- return Promise.resolve(Object.keys(_assets))
581
- },
582
- hasItem (id) {
583
- id = normalizeKey(id)
584
- return Promise.resolve(id in _assets)
585
- },
586
- getItem (id) {
587
- id = normalizeKey(id)
588
- return Promise.resolve(_assets[id] ? _assets[id].import() : null)
589
- },
590
- getMeta (id) {
591
- id = normalizeKey(id)
592
- return Promise.resolve(_assets[id] ? _assets[id].meta : {})
593
- }
594
- }
595
- `;
596
- }
597
- };
598
- }
599
-
600
- //#endregion
601
- //#region src/build/virtual/storage.ts
602
- function storage(nitro) {
603
- return {
604
- id: "#nitro/virtual/storage",
605
- template: () => {
606
- const mounts = [];
607
- const storageMounts = nitro.options.dev || nitro.options.preset === "nitro-prerender" ? {
608
- ...nitro.options.storage,
609
- ...nitro.options.devStorage
610
- } : nitro.options.storage;
611
- for (const path in storageMounts) {
612
- const { driver: driverName, ...driverOpts } = storageMounts[path];
613
- mounts.push({
614
- path,
615
- driver: builtinDrivers[driverName] || driverName,
616
- opts: driverOpts
617
- });
618
- }
619
- return `
620
- import { createStorage } from 'unstorage'
621
- import { assets } from '#nitro/virtual/server-assets'
622
-
623
- ${[...new Set(mounts.map((m) => m.driver))].map((i) => genImport(i, genSafeVariableName(i))).join("\n")}
624
-
625
- export function initStorage() {
626
- const storage = createStorage({})
627
- storage.mount('/assets', assets)
628
- ${mounts.map((m) => `storage.mount('${m.path}', ${genSafeVariableName(m.driver)}(${JSON.stringify(m.opts)}))`).join("\n")}
629
- return storage
630
- }
631
- `;
632
- }
633
- };
634
- }
635
-
636
- //#endregion
637
- //#region src/build/virtual/tasks.ts
638
- function tasks(nitro) {
639
- return {
640
- id: "#nitro/virtual/tasks",
641
- template: () => {
642
- const _scheduledTasks = Object.entries(nitro.options.scheduledTasks || {}).map(([cron, _tasks]) => {
643
- return {
644
- cron,
645
- tasks: (Array.isArray(_tasks) ? _tasks : [_tasks]).filter((name) => {
646
- if (!nitro.options.tasks[name]) {
647
- nitro.logger.warn(`Scheduled task \`${name}\` is not defined!`);
648
- return false;
649
- }
650
- return true;
651
- })
652
- };
653
- }).filter((e) => e.tasks.length > 0);
654
- const scheduledTasks = _scheduledTasks.length > 0 ? _scheduledTasks : false;
655
- return `
656
- export const scheduledTasks = ${JSON.stringify(scheduledTasks)};
657
-
658
- export const tasks = {
659
- ${Object.entries(nitro.options.tasks).map(([name, task]) => `"${name}": {
660
- meta: {
661
- description: ${JSON.stringify(task.description)},
662
- },
663
- resolve: ${task.handler ? `() => import("${normalize(task.handler)}").then(r => r.default || r)` : "undefined"},
664
- }`).join(",\n")}
665
- };`;
666
- }
667
- };
668
- }
669
-
670
- //#endregion
671
- //#region src/build/virtual/_all.ts
672
- function virtualTemplates(nitro, _polyfills) {
673
- const nitroTemplates = [
674
- database,
675
- errorHandler,
676
- featureFlags,
677
- plugins,
678
- polyfills,
679
- publicAssets,
680
- rendererTemplate,
681
- routingMeta,
682
- routing,
683
- runtimeConfig,
684
- serverAssets,
685
- storage,
686
- tasks
687
- ].flatMap((t) => t(nitro, _polyfills));
688
- const customTemplates = Object.entries(nitro.options.virtual).map(([id, template]) => ({
689
- id,
690
- template
691
- }));
692
- return [...nitroTemplates, ...customTemplates];
693
- }
694
-
695
- //#endregion
696
- //#region src/build/plugins/route-meta.ts
697
- const PREFIX$1 = "\0nitro:route-meta:";
698
- function routeMeta(nitro) {
699
- return {
700
- name: "nitro:route-meta",
701
- resolveId: {
702
- filter: { id: /^(?!\u0000)(.+)\?meta$/ },
703
- async handler(id, importer, resolveOpts) {
704
- if (id.endsWith("?meta")) {
705
- const resolved = await this.resolve(id.replace("?meta", ""), importer, resolveOpts);
706
- if (!resolved) return;
707
- return PREFIX$1 + resolved.id;
708
- }
709
- }
710
- },
711
- load: {
712
- filter: { id: /* @__PURE__ */ new RegExp(`^${escapeRegExp(PREFIX$1)}`) },
713
- handler(id) {
714
- if (id.startsWith(PREFIX$1)) {
715
- const fullPath = id.slice(18);
716
- if (isAbsolute(fullPath)) return readFile(fullPath, { encoding: "utf8" });
717
- else return "export default undefined;";
718
- }
719
- }
720
- },
721
- transform: {
722
- filter: { id: /* @__PURE__ */ new RegExp(`^${escapeRegExp(PREFIX$1)}`) },
723
- async handler(code, id) {
724
- let meta = null;
725
- try {
726
- const transformRes = transformSync(id, code);
727
- if (transformRes.errors?.length > 0) {
728
- for (const error of transformRes.errors) this.warn(error);
729
- return {
730
- code: `export default {};`,
731
- map: null
732
- };
733
- }
734
- const ast = this.parse(transformRes.code);
735
- for (const node of ast.body) if (node.type === "ExpressionStatement" && node.expression.type === "CallExpression" && node.expression.callee.type === "Identifier" && node.expression.callee.name === "defineRouteMeta" && node.expression.arguments.length === 1) {
736
- meta = astToObject(node.expression.arguments[0]);
737
- break;
738
- }
739
- } catch (error) {
740
- nitro.logger.warn(`[handlers-meta] Cannot extra route meta for: ${id}: ${error}`);
741
- }
742
- return {
743
- code: `export default ${JSON.stringify(meta)};`,
744
- map: null
745
- };
746
- }
747
- }
748
- };
749
- }
750
- function astToObject(node) {
751
- switch (node.type) {
752
- case "ObjectExpression": {
753
- const obj = {};
754
- for (const prop of node.properties) if (prop.type === "Property") {
755
- const key = prop.key.name ?? prop.key.value;
756
- obj[key] = astToObject(prop.value);
757
- }
758
- return obj;
759
- }
760
- case "ArrayExpression": return node.elements.map((el) => astToObject(el)).filter(Boolean);
761
- case "Literal": return node.value;
762
- }
763
- }
764
-
765
- //#endregion
766
- //#region src/build/plugins/server-main.ts
767
- function serverMain(nitro) {
768
- return {
769
- name: "nitro:server-main",
770
- renderChunk(code, chunk) {
771
- if (chunk.isEntry) return {
772
- code: `globalThis.__nitro_main__ = import.meta.url; ${code}`,
773
- map: null
774
- };
775
- }
776
- };
777
- }
778
-
779
- //#endregion
780
- //#region package.json
781
- var version$2 = "3.0.1-alpha.1";
782
-
783
- //#endregion
784
- //#region src/runtime/meta.ts
785
- const version$1 = version$2;
786
- const resolve = (path) => fileURLToPath(new URL(path, import.meta.url));
787
- const runtimeDir$1 = /* @__PURE__ */ resolve("./");
788
- const runtimeDependencies$1 = [
789
- "crossws",
790
- "croner",
791
- "db0",
792
- "defu",
793
- "destr",
794
- "h3",
795
- "rou3",
796
- "hookable",
797
- "ofetch",
798
- "ohash",
799
- "rendu",
800
- "scule",
801
- "srvx",
802
- "ufo",
803
- "unctx",
804
- "unenv",
805
- "unstorage"
806
- ];
807
-
808
- //#endregion
809
- //#region src/build/plugins/virtual.ts
810
- function virtual(input) {
811
- const modules = /* @__PURE__ */ new Map();
812
- for (const mod of input) {
813
- const render = () => typeof mod.template === "function" ? mod.template() : mod.template;
814
- modules.set(mod.id, {
815
- module: mod,
816
- render
817
- });
818
- }
819
- const include = [/^#nitro\/virtual/];
820
- const extraIds = [...modules.keys()].filter((key) => !key.startsWith("#nitro/virtual"));
821
- if (extraIds.length > 0) include.push(/* @__PURE__ */ new RegExp(`^(${extraIds.map((id) => pathRegExp(id)).join("|")})$`));
822
- return {
823
- name: "nitro:virtual",
824
- api: { modules },
825
- resolveId: {
826
- order: "pre",
827
- filter: { id: include },
828
- handler: (id) => {
829
- const mod = modules.get(id);
830
- if (mod) return {
831
- id,
832
- moduleSideEffects: mod.module.moduleSideEffects ?? false
833
- };
834
- }
835
- },
836
- load: {
837
- order: "pre",
838
- filter: { id: include },
839
- handler: async (id) => {
840
- const mod = modules.get(id);
841
- if (!mod) throw new Error(`Virtual module ${id} not found.`);
842
- return {
843
- code: await mod.render(),
844
- map: null
845
- };
846
- }
847
- }
848
- };
849
- }
850
- function virtualDeps() {
851
- const cache = /* @__PURE__ */ new Map();
852
- return {
853
- name: "nitro:virtual-deps",
854
- resolveId: {
855
- order: "pre",
856
- filter: { id: /* @__PURE__ */ new RegExp(`^(#nitro|${runtimeDependencies$1.map((dep) => pathRegExp(dep)).join("|")})`) },
857
- handler(id, importer) {
858
- if (!importer || !importer.startsWith("#nitro/virtual")) return;
859
- let resolved = cache.get(id);
860
- if (!resolved) resolved = this.resolve(id, runtimeDir$1).then((_resolved) => {
861
- cache.set(id, _resolved);
862
- return _resolved;
863
- }).catch((error) => {
864
- cache.delete(id);
865
- throw error;
866
- });
867
- return resolved;
868
- }
869
- }
870
- };
871
- }
872
-
873
- //#endregion
874
- //#region src/build/plugins/sourcemap-min.ts
875
- function sourcemapMinify() {
876
- return {
877
- name: "nitro:sourcemap-minify",
878
- generateBundle(_options, bundle) {
879
- for (const [key, asset] of Object.entries(bundle)) {
880
- if (!key.endsWith(".map") || !("source" in asset) || typeof asset.source !== "string") continue;
881
- const sourcemap = JSON.parse(asset.source);
882
- delete sourcemap.sourcesContent;
883
- delete sourcemap.x_google_ignoreList;
884
- if ((sourcemap.sources || []).some((s) => s.includes("node_modules"))) sourcemap.mappings = "";
885
- asset.source = JSON.stringify(sourcemap);
886
- }
887
- }
888
- };
889
- }
890
-
891
- //#endregion
892
- //#region src/build/plugins/raw.ts
893
- const HELPER_ID = "\0nitro-raw-helpers";
894
- const RESOLVED_PREFIX = "\0nitro:raw:";
895
- const PREFIX = "raw:";
896
- function raw() {
897
- return {
898
- name: "nitro:raw",
899
- resolveId: {
900
- order: "pre",
901
- filter: { id: [/* @__PURE__ */ new RegExp(`^${HELPER_ID}$`), /* @__PURE__ */ new RegExp(`^${PREFIX}`)] },
902
- async handler(id, importer, resolveOpts) {
903
- if (id === HELPER_ID) return id;
904
- if (id.startsWith(PREFIX)) {
905
- const resolvedId = (await this.resolve(id.slice(4), importer, resolveOpts))?.id;
906
- if (!resolvedId) return null;
907
- return { id: RESOLVED_PREFIX + resolvedId };
908
- }
909
- }
910
- },
911
- load: {
912
- order: "pre",
913
- filter: { id: [/* @__PURE__ */ new RegExp(`^${HELPER_ID}$`), /* @__PURE__ */ new RegExp(`^${RESOLVED_PREFIX}`)] },
914
- handler(id) {
915
- if (id === HELPER_ID) return getHelpers();
916
- if (id.startsWith(RESOLVED_PREFIX)) return promises.readFile(id.slice(11), isBinary(id) ? "binary" : "utf8");
917
- }
918
- },
919
- transform: {
920
- order: "pre",
921
- filter: { id: /* @__PURE__ */ new RegExp(`^${RESOLVED_PREFIX}`) },
922
- handler(code, id) {
923
- const path = id.slice(11);
924
- if (isBinary(id)) return {
925
- code: `import {base64ToUint8Array } from "${HELPER_ID}" \n export default base64ToUint8Array("${Buffer.from(code, "binary").toString("base64")}")`,
926
- map: rawAssetMap(path)
927
- };
928
- return {
929
- code: `export default ${JSON.stringify(code)}`,
930
- map: rawAssetMap(path),
931
- moduleType: "js"
932
- };
933
- }
934
- }
935
- };
936
- }
937
- function isBinary(id) {
938
- const idMime = src_default.getType(id) || "";
939
- if (idMime.startsWith("text/")) return false;
940
- if (/application\/(json|sql|xml|yaml)/.test(idMime)) return false;
941
- return true;
942
- }
943
- function getHelpers() {
944
- return `
945
- export function base64ToUint8Array(str) {
946
- const data = atob(str);
947
- const size = data.length;
948
- const bytes = new Uint8Array(size);
949
- for (let i = 0; i < size; i++) {
950
- bytes[i] = data.charCodeAt(i);
951
- }
952
- return bytes;
953
- }
954
- `;
955
- }
956
- function rawAssetMap(id) {
957
- return {
958
- version: 3,
959
- file: id,
960
- sources: [id],
961
- sourcesContent: [],
962
- names: [],
963
- mappings: ""
964
- };
965
- }
966
-
967
- //#endregion
968
- //#region src/utils/dep.ts
969
- async function importDep(opts, _retry) {
970
- const resolved = resolveModulePath(opts.id, {
971
- from: [opts.dir, import.meta.url],
972
- cache: _retry ? false : true,
973
- try: true
974
- });
975
- if (resolved) return await import(resolved);
976
- let shouldInstall;
977
- if (_retry || a) shouldInstall = false;
978
- else if (T) {
979
- consola.info(`\`${opts.id}\` is required for ${opts.reason}. Installing automatically in CI environment...`);
980
- shouldInstall = true;
981
- } else shouldInstall = await consola.prompt(`\`${opts.id}\` is required for ${opts.reason}, but it is not installed. Would you like to install it?`, {
982
- type: "confirm",
983
- default: true,
984
- cancel: "undefined"
985
- });
986
- if (!shouldInstall) throw new Error(`\`${opts.id}\` is not installed. Please add it to your dependencies for ${opts.reason}.`);
987
- const start = Date.now();
988
- consola.start(`Installing \`${opts.id}\` in \`${opts.dir}\`...`);
989
- const { addDevDependency } = await import("./cli/_chunks/dist4.mjs");
990
- await addDevDependency(opts.id, { cwd: opts.dir });
991
- consola.success(`Installed \`${opts.id}\` in ${opts.dir} (${Date.now() - start}ms).`);
992
- return importDep(opts, true);
993
- }
994
-
995
- //#endregion
996
- //#region src/build/plugins/externals.ts
997
- const PLUGIN_NAME = "nitro:externals";
998
- function externals(opts) {
999
- const include = opts?.include ? opts.include.map((p) => toPathRegExp(p)) : void 0;
1000
- const exclude = [/^(?:[\0#~.]|[a-z0-9]{2,}:)|\?/, ...(opts?.exclude || []).map((p) => toPathRegExp(p))];
1001
- const filter = (id) => {
1002
- if (include && !include.some((r) => r.test(id))) return false;
1003
- if (exclude.some((r) => r.test(id))) return false;
1004
- return true;
1005
- };
1006
- const tryResolve = (id, from) => resolveModulePath(id, {
1007
- try: true,
1008
- from: from && isAbsolute(from) ? from : opts.rootDir,
1009
- conditions: opts.conditions
1010
- });
1011
- const tracedPaths = /* @__PURE__ */ new Set();
1012
- if (include && include.length === 0) return { name: PLUGIN_NAME };
1013
- return {
1014
- name: PLUGIN_NAME,
1015
- resolveId: {
1016
- order: "pre",
1017
- filter: { id: {
1018
- exclude,
1019
- include
1020
- } },
1021
- async handler(id, importer, rOpts) {
1022
- if (builtinModules.includes(id)) return {
1023
- resolvedBy: PLUGIN_NAME,
1024
- external: true,
1025
- id: id.includes(":") ? id : `node:${id}`
1026
- };
1027
- if (rOpts.custom?.["node-resolve"]) return null;
1028
- let resolved = await this.resolve(id, importer, rOpts);
1029
- const cjsResolved = resolved?.meta?.commonjs?.resolved;
1030
- if (cjsResolved) {
1031
- if (!filter(cjsResolved.id)) return resolved;
1032
- resolved = cjsResolved;
1033
- }
1034
- if (!resolved?.id || !filter(resolved.id)) return resolved;
1035
- let resolvedPath = resolved.id;
1036
- if (!isAbsolute(resolvedPath)) resolvedPath = tryResolve(resolvedPath, importer) || resolvedPath;
1037
- if (opts.trace) {
1038
- let importId = toImport(id) || toImport(resolvedPath);
1039
- if (!importId) return resolved;
1040
- if (!tryResolve(importId, importer)) {
1041
- const guessed = await guessSubpath(resolvedPath, opts.conditions);
1042
- if (!guessed) return resolved;
1043
- importId = guessed;
1044
- }
1045
- tracedPaths.add(resolvedPath);
1046
- return {
1047
- ...resolved,
1048
- resolvedBy: PLUGIN_NAME,
1049
- external: true,
1050
- id: importId
1051
- };
1052
- }
1053
- return {
1054
- ...resolved,
1055
- resolvedBy: PLUGIN_NAME,
1056
- external: true,
1057
- id: isAbsolute(resolvedPath) ? pathToFileURL(resolvedPath).href : resolvedPath
1058
- };
1059
- }
1060
- },
1061
- buildEnd: {
1062
- order: "post",
1063
- async handler() {
1064
- if (!opts.trace || tracedPaths.size === 0) return;
1065
- const { traceNodeModules } = await importDep({
1066
- id: "nf3",
1067
- dir: opts.rootDir,
1068
- reason: "tracing external dependencies"
1069
- });
1070
- await traceNodeModules([...tracedPaths], {
1071
- ...opts.trace,
1072
- conditions: opts.conditions,
1073
- rootDir: opts.rootDir,
1074
- writePackageJson: true
1075
- });
1076
- }
1077
- }
1078
- };
1079
- }
1080
- const NODE_MODULES_RE = /^(?<dir>.+[\\/]node_modules[\\/])(?<name>[^@\\/]+|@[^\\/]+[\\/][^\\/]+)(?:[\\/](?<subpath>.+))?$/;
1081
- const IMPORT_RE = /^(?!\.)(?<name>[^@/\\]+|@[^/\\]+[/\\][^/\\]+)(?:[/\\](?<subpath>.+))?$/;
1082
- function toImport(id) {
1083
- if (isAbsolute(id)) {
1084
- const { name, subpath } = NODE_MODULES_RE.exec(id)?.groups || {};
1085
- if (name && subpath) return join(name, subpath);
1086
- } else if (IMPORT_RE.test(id)) return id;
1087
- }
1088
- function guessSubpath(path, conditions) {
1089
- const { dir, name, subpath } = NODE_MODULES_RE.exec(path)?.groups || {};
1090
- if (!dir || !name || !subpath) return;
1091
- const exports = getPkgJSON(join(dir, name) + "/")?.exports;
1092
- if (!exports || typeof exports !== "object") return;
1093
- for (const e of flattenExports(exports)) {
1094
- if (!conditions.includes(e.condition || "default")) continue;
1095
- if (e.fsPath === subpath) return join(name, e.subpath);
1096
- if (e.fsPath.includes("*")) {
1097
- const fsPathRe = /* @__PURE__ */ new RegExp("^" + escapeRegExp(e.fsPath).replace(String.raw`\*`, "(.+?)") + "$");
1098
- if (fsPathRe.test(subpath)) {
1099
- const matched = fsPathRe.exec(subpath)?.[1];
1100
- if (matched) return join(name, e.subpath.replace("*", matched));
1101
- }
1102
- }
1103
- }
1104
- }
1105
- function getPkgJSON(dir) {
1106
- const cache = getPkgJSON._cache ||= /* @__PURE__ */ new Map();
1107
- if (cache.has(dir)) return cache.get(dir);
1108
- try {
1109
- const pkg = createRequire(dir)("./package.json");
1110
- cache.set(dir, pkg);
1111
- return pkg;
1112
- } catch {}
1113
- }
1114
- function flattenExports(exports = {}, parentSubpath = "./") {
1115
- return Object.entries(exports).flatMap(([key, value]) => {
1116
- const [subpath, condition] = key.startsWith(".") ? [key.slice(1)] : [void 0, key];
1117
- const _subPath = join(parentSubpath, subpath || "");
1118
- if (typeof value === "string") return [{
1119
- subpath: _subPath,
1120
- fsPath: value.replace(/^\.\//, ""),
1121
- condition
1122
- }];
1123
- return typeof value === "object" ? flattenExports(value, _subPath) : [];
1124
- });
1125
- }
1126
-
1127
- //#endregion
1128
- //#region src/build/plugins.ts
1129
- function baseBuildPlugins(nitro, base) {
1130
- const plugins$1 = [];
1131
- const virtualPlugin = virtual(virtualTemplates(nitro, [...base.env.polyfill]));
1132
- nitro.vfs = virtualPlugin.api.modules;
1133
- plugins$1.push(virtualPlugin, virtualDeps());
1134
- if (nitro.options.imports) plugins$1.push(unplugin.rollup(nitro.options.imports));
1135
- if (nitro.options.wasm !== false) plugins$1.push(unwasm(nitro.options.wasm || {}));
1136
- plugins$1.push(serverMain(nitro));
1137
- plugins$1.push(raw());
1138
- if (nitro.options.experimental.openAPI) plugins$1.push(routeMeta(nitro));
1139
- plugins$1.push(replace({
1140
- preventAssignment: true,
1141
- values: base.replacements
1142
- }));
1143
- if (nitro.options.node && nitro.options.noExternals !== true) {
1144
- const isDevOrPrerender = nitro.options.dev || nitro.options.preset === "nitro-prerender";
1145
- plugins$1.push(externals({
1146
- rootDir: nitro.options.rootDir,
1147
- conditions: nitro.options.exportConditions || ["default"],
1148
- exclude: [...base.noExternal],
1149
- include: isDevOrPrerender ? void 0 : nitro.options.traceDeps,
1150
- trace: isDevOrPrerender ? false : { outDir: nitro.options.output.serverDir }
1151
- }));
1152
- }
1153
- if (nitro.options.sourcemap && !nitro.options.dev && nitro.options.experimental.sourcemapMinify !== false) plugins$1.push(sourcemapMinify());
1154
- return plugins$1;
1155
- }
1156
-
1157
- //#endregion
1158
- export { baseBuildConfig as a, libChunkName as i, NODE_MODULES_RE$1 as n, getChunkName as r, baseBuildPlugins as t };