nitro-nightly 4.0.0-20251010-091516-7cafddba → 4.0.0-20251030-091344-d4418b98
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/{_chunks/build2.mjs → _build/build.mjs} +108 -58
- package/dist/_build/build2.mjs +556 -0
- package/dist/_build/info.mjs +1002 -0
- package/dist/_build/prepare.mjs +1511 -0
- package/dist/_build/snapshot.mjs +185 -0
- package/dist/{_chunks/plugin.mjs → _build/vite.mjs} +295 -296
- package/dist/_build/vite2.mjs +149 -0
- package/dist/_chunks/_deps/@jridgewell/gen-mapping.mjs +189 -0
- package/dist/_chunks/_deps/@jridgewell/remapping.mjs +137 -0
- package/dist/_chunks/_deps/@jridgewell/resolve-uri.mjs +231 -0
- package/dist/_chunks/_deps/@jridgewell/sourcemap-codec.mjs +173 -0
- package/dist/_chunks/_deps/@jridgewell/trace-mapping.mjs +170 -0
- package/dist/_chunks/_deps/@pi0/vite-plugin-fullstack.mjs +575 -0
- package/dist/_chunks/_deps/@rollup/plugin-alias.mjs +89 -0
- package/dist/_chunks/_deps/@rollup/plugin-commonjs.mjs +2376 -0
- package/dist/_chunks/{index2.mjs → _deps/@rollup/plugin-inject.mjs} +5 -90
- package/dist/_chunks/_deps/@rollup/plugin-json.mjs +37 -0
- package/dist/_chunks/_deps/@rollup/plugin-node-resolve.mjs +1386 -0
- package/dist/_chunks/_deps/@rollup/plugin-replace.mjs +133 -0
- package/dist/_chunks/_deps/@rollup/pluginutils.mjs +346 -0
- package/dist/_chunks/_deps/acorn.mjs +6225 -0
- package/dist/_chunks/_deps/c12.mjs +510 -0
- package/dist/_chunks/_deps/chokidar.mjs +1428 -0
- package/dist/_chunks/_deps/citty.mjs +460 -0
- package/dist/_chunks/_deps/commondir.mjs +77 -0
- package/dist/_chunks/_deps/compatx.mjs +76 -0
- package/dist/_chunks/_deps/confbox.mjs +300 -0
- package/dist/_chunks/_deps/debug.mjs +885 -0
- package/dist/_chunks/_deps/deepmerge.mjs +147 -0
- package/dist/_chunks/_deps/depd.mjs +550 -0
- package/dist/_chunks/_deps/dot-prop.mjs +282 -0
- package/dist/_chunks/_deps/dotenv.mjs +555 -0
- package/dist/_chunks/_deps/duplexer.mjs +1 -0
- package/dist/_chunks/_deps/ee-first.mjs +104 -0
- package/dist/_chunks/_deps/encodeurl.mjs +69 -0
- package/dist/_chunks/_deps/escape-html.mjs +87 -0
- package/dist/_chunks/_deps/escape-string-regexp.mjs +13 -0
- package/dist/_chunks/_deps/estree-walker.mjs +433 -0
- package/dist/_chunks/_deps/etag.mjs +147 -0
- package/dist/_chunks/_deps/exsolve.mjs +1416 -0
- package/dist/_chunks/_deps/fdir.mjs +569 -0
- package/dist/_chunks/_deps/fresh.mjs +145 -0
- package/dist/_chunks/_deps/function-bind.mjs +106 -0
- package/dist/_chunks/{index4.mjs → _deps/giget.mjs} +21 -776
- package/dist/_chunks/_deps/gzip-size.mjs +19 -0
- package/dist/_chunks/_deps/hasown.mjs +19 -0
- package/dist/_chunks/_deps/http-errors.mjs +307 -0
- package/dist/_chunks/_deps/httpxy.mjs +580 -0
- package/dist/_chunks/_deps/inherits.mjs +57 -0
- package/dist/_chunks/_deps/is-core-module.mjs +596 -0
- package/dist/_chunks/_deps/is-module.mjs +25 -0
- package/dist/_chunks/_deps/is-reference.mjs +31 -0
- package/dist/_chunks/_deps/js-tokens.mjs +411 -0
- package/dist/_chunks/_deps/klona.mjs +137 -0
- package/dist/_chunks/_deps/knitwork.mjs +172 -0
- package/dist/_chunks/_deps/local-pkg.mjs +163 -0
- package/dist/_chunks/_deps/magic-string.mjs +1296 -0
- package/dist/_chunks/_deps/mime-db.mjs +11685 -0
- package/dist/_chunks/_deps/mime-types.mjs +287 -0
- package/dist/_chunks/_deps/mime.mjs +1172 -0
- package/dist/_chunks/_deps/mlly.mjs +2413 -0
- package/dist/_chunks/_deps/ms.mjs +172 -0
- package/dist/_chunks/_deps/node-fetch-native.mjs +3 -0
- package/dist/_chunks/_deps/nypm.mjs +219 -0
- package/dist/_chunks/_deps/on-finished.mjs +246 -0
- package/dist/_chunks/_deps/parseurl.mjs +168 -0
- package/dist/_chunks/_deps/path-parse.mjs +85 -0
- package/dist/_chunks/{pathe.M-eThtNZ.mjs → _deps/pathe.mjs} +48 -1
- package/dist/_chunks/_deps/perfect-debounce.mjs +88 -0
- package/dist/_chunks/_deps/picomatch.mjs +2144 -0
- package/dist/_chunks/_deps/pkg-types.mjs +247 -0
- package/dist/_chunks/{snapshot.mjs → _deps/pretty-bytes.mjs} +1 -105
- package/dist/_chunks/_deps/quansync.mjs +99 -0
- package/dist/_chunks/_deps/range-parser.mjs +171 -0
- package/dist/_chunks/_deps/rc9.mjs +219 -0
- package/dist/_chunks/_deps/readdirp.mjs +245 -0
- package/dist/_chunks/_deps/resolve.mjs +1260 -0
- package/dist/_chunks/_deps/rou3.mjs +326 -0
- package/dist/_chunks/_deps/send.mjs +1022 -0
- package/dist/_chunks/_deps/serve-static.mjs +228 -0
- package/dist/_chunks/_deps/setprototypeof.mjs +26 -0
- package/dist/_chunks/_deps/statuses.mjs +457 -0
- package/dist/_chunks/_deps/std-env.mjs +3 -0
- package/dist/_chunks/_deps/strip-literal.mjs +67 -0
- package/dist/_chunks/_deps/supports-color.mjs +44 -0
- package/dist/_chunks/_deps/tinyexec.mjs +552 -0
- package/dist/_chunks/_deps/tinyglobby.mjs +293 -0
- package/dist/_chunks/_deps/toidentifier.mjs +41 -0
- package/dist/_chunks/_deps/ultrahtml.mjs +3 -0
- package/dist/_chunks/_deps/unimport.mjs +2267 -0
- package/dist/_chunks/_deps/unplugin-utils.mjs +65 -0
- package/dist/_chunks/_deps/unplugin.mjs +1294 -0
- package/dist/_chunks/_deps/untyped.mjs +375 -0
- package/dist/_chunks/{info.mjs → _deps/unwasm.mjs} +8 -4206
- package/dist/_chunks/_deps/webpack-virtual-modules.mjs +360 -0
- package/dist/_chunks/_presets/_all.mjs +59 -0
- package/dist/_chunks/_presets/_nitro.mjs +74 -0
- package/dist/_chunks/_presets/_resolve.mjs +64 -0
- package/dist/_chunks/_presets/_static.mjs +69 -0
- package/dist/_chunks/_presets/_types.mjs +3 -0
- package/dist/_chunks/_presets/_utils.mjs +31 -0
- package/dist/_chunks/_presets/alwaysdata.mjs +17 -0
- package/dist/_chunks/_presets/aws-amplify.mjs +111 -0
- package/dist/_chunks/_presets/aws-lambda.mjs +23 -0
- package/dist/_chunks/_presets/azure.mjs +162 -0
- package/dist/_chunks/_presets/bun.mjs +19 -0
- package/dist/_chunks/_presets/cleavr.mjs +15 -0
- package/dist/_chunks/_presets/cloudflare.mjs +608 -0
- package/dist/_chunks/_presets/deno.mjs +196 -0
- package/dist/_chunks/_presets/digitalocean.mjs +14 -0
- package/dist/_chunks/_presets/firebase.mjs +47 -0
- package/dist/_chunks/_presets/flightcontrol.mjs +14 -0
- package/dist/_chunks/_presets/genezio.mjs +13 -0
- package/dist/_chunks/_presets/heroku.mjs +14 -0
- package/dist/_chunks/_presets/iis.mjs +194 -0
- package/dist/_chunks/_presets/index.mjs +62 -0
- package/dist/_chunks/_presets/koyeb.mjs +14 -0
- package/dist/_chunks/_presets/netlify.mjs +241 -0
- package/dist/_chunks/_presets/node.mjs +54 -0
- package/dist/_chunks/_presets/platform.mjs +14 -0
- package/dist/_chunks/_presets/render.mjs +14 -0
- package/dist/_chunks/_presets/standard.mjs +23 -0
- package/dist/_chunks/_presets/stormkit.mjs +18 -0
- package/dist/_chunks/_presets/vercel.mjs +375 -0
- package/dist/_chunks/_presets/winterjs.mjs +22 -0
- package/dist/_chunks/_presets/zeabur.mjs +69 -0
- package/dist/_chunks/_presets/zerops.mjs +27 -0
- package/dist/_chunks/app.mjs +9 -19206
- package/dist/_chunks/{index3.mjs → builder.mjs} +560 -970
- package/dist/_chunks/server.mjs +6 -4
- package/dist/{cli → _cli}/build.mjs +3 -8
- package/dist/{cli → _cli}/dev.mjs +38 -12
- package/dist/{cli/index2.mjs → _cli/index.mjs} +1 -2
- package/dist/{cli → _cli}/list.mjs +3 -4
- package/dist/{cli → _cli}/prepare.mjs +3 -4
- package/dist/{cli → _cli}/run.mjs +3 -4
- package/dist/{index.d.mts → builder.d.mts} +11 -11
- package/dist/builder.mjs +117 -0
- package/dist/cli/index.mjs +7 -464
- package/dist/node_modules/@speed-highlight/core/dist/index.js +1 -1
- package/dist/node_modules/@speed-highlight/core/dist/terminal.js +1 -1
- package/dist/node_modules/@speed-highlight/core/package.json +7 -3
- package/dist/node_modules/cookie-es/dist/index.mjs +262 -0
- package/dist/node_modules/cookie-es/package.json +37 -0
- package/dist/node_modules/hookable/dist/index.mjs +243 -266
- package/dist/node_modules/hookable/package.json +29 -26
- package/dist/node_modules/rendu/dist/index.mjs +380 -0
- package/dist/node_modules/rendu/package.json +47 -0
- package/dist/presets/_nitro/runtime/nitro-dev.mjs +4 -7
- package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +5 -4
- package/dist/presets/azure/runtime/azure-swa.mjs +1 -1
- package/dist/presets/cloudflare/runtime/_module-handler.mjs +7 -6
- package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +4 -5
- package/dist/presets/cloudflare/runtime/plugin.dev.mjs +7 -10
- package/dist/presets/cloudflare/runtime/shims/workers.dev.d.mts +21 -0
- package/dist/presets/cloudflare/runtime/shims/workers.dev.mjs +27 -0
- package/dist/presets/node/runtime/node-server.mjs +1 -1
- package/dist/runtime/index.d.mts +1 -1
- package/dist/runtime/index.mjs +1 -1
- package/dist/runtime/internal/app.d.mts +3 -1
- package/dist/runtime/internal/app.mjs +90 -64
- package/dist/runtime/internal/error/prod.d.mts +3 -2
- package/dist/runtime/internal/error/prod.mjs +9 -13
- package/dist/runtime/internal/renderer.mjs +4 -4
- package/dist/runtime/internal/routes/dev-tasks.d.mts +30 -2
- package/dist/runtime/internal/shutdown.d.mts +1 -2
- package/dist/runtime/internal/shutdown.mjs +3 -2
- package/dist/runtime/internal/task.mjs +1 -2
- package/dist/types/index.d.mts +1603 -10
- package/dist/vite.d.mts +5 -0
- package/dist/vite.mjs +94 -30
- package/lib/index.mjs +1 -0
- package/lib/indexd.mts +1 -0
- package/lib/runtime/meta.mjs +35 -0
- package/package.json +40 -41
- package/dist/_chunks/build.mjs +0 -84
- package/dist/_chunks/build3.mjs +0 -6452
- package/dist/_chunks/detect-acorn.mjs +0 -503
- package/dist/_chunks/index.mjs +0 -22242
- package/dist/_chunks/json5.mjs +0 -68
- package/dist/_chunks/jsonc.mjs +0 -51
- package/dist/_chunks/toml.mjs +0 -259
- package/dist/_chunks/yaml.mjs +0 -86
- package/dist/index.mjs +0 -55
- package/dist/node_modules/klona/dist/index.mjs +0 -81
- package/dist/node_modules/klona/full/index.mjs +0 -53
- package/dist/node_modules/klona/package.json +0 -74
- package/dist/node_modules/std-env/dist/index.mjs +0 -1
- package/dist/node_modules/std-env/package.json +0 -46
- package/dist/presets.mjs +0 -2460
- package/dist/runtime/internal/debug.d.mts +0 -2
- package/dist/runtime/internal/debug.mjs +0 -5
- package/lib/runtime-meta.mjs +0 -38
- /package/dist/{cli → _cli}/common.mjs +0 -0
- /package/lib/{runtime-meta.d.mts → runtime/meta.d.mts} +0 -0
|
@@ -1,38 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { e as copyPublicAssets, s as scanHandlers, h as prettyPath, p as prepare, c as createNitro } from './prepare.mjs';
|
|
2
|
+
import consola from 'consola';
|
|
3
|
+
import { existsSync, watch as watch$1 } from 'node:fs';
|
|
4
4
|
import { defu } from 'defu';
|
|
5
5
|
import 'ufo';
|
|
6
|
-
import {
|
|
6
|
+
import { runtimeDir, runtimeDependencies } from 'nitro/runtime/meta';
|
|
7
|
+
import { r as resolveModulePath } from '../_chunks/_deps/exsolve.mjs';
|
|
7
8
|
import { readFile, rm, mkdir, writeFile, readlink } from 'node:fs/promises';
|
|
8
9
|
import 'node:zlib';
|
|
10
|
+
import '../_chunks/_deps/mime.mjs';
|
|
9
11
|
import 'node:worker_threads';
|
|
10
|
-
import consola from 'consola';
|
|
11
|
-
import 'std-env';
|
|
12
12
|
import 'h3';
|
|
13
13
|
import 'undici';
|
|
14
14
|
import 'nitro/meta';
|
|
15
15
|
import { NodeRequest, sendNodeResponse } from 'srvx/node';
|
|
16
|
-
import {
|
|
17
|
-
import '
|
|
18
|
-
import {
|
|
16
|
+
import { a as NodeDevWorker, N as NitroDevApp } from '../_chunks/app.mjs';
|
|
17
|
+
import 'node:url';
|
|
18
|
+
import { colors } from 'consola/utils';
|
|
19
19
|
import 'ofetch';
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
20
|
+
import { s as sanitizeFilePath } from '../_chunks/_deps/mlly.mjs';
|
|
21
|
+
import { a as alias } from '../_chunks/_deps/@rollup/plugin-alias.mjs';
|
|
22
|
+
import { i as inject } from '../_chunks/_deps/@rollup/plugin-inject.mjs';
|
|
23
|
+
import { b as baseBuildConfig, a as baseBuildPlugins, r as replace, w as writeBuildInfo } from './info.mjs';
|
|
24
|
+
import { r as resolve, d as dirname, n as normalize, b as basename, a as relative, j as join, i as isAbsolute } from '../_chunks/_deps/pathe.mjs';
|
|
25
|
+
import { f as formatCompatibilityDate } from '../_chunks/_deps/compatx.mjs';
|
|
23
26
|
import 'hookable';
|
|
24
27
|
import 'jiti';
|
|
25
|
-
import 'klona';
|
|
26
28
|
import 'unstorage';
|
|
27
29
|
import 'ohash';
|
|
30
|
+
import { a, T } from '../_chunks/_deps/std-env.mjs';
|
|
31
|
+
import '../_chunks/_deps/serve-static.mjs';
|
|
28
32
|
import { resolve as resolve$1, join as join$1 } from 'node:path';
|
|
29
33
|
import 'youch-core';
|
|
30
34
|
import 'youch';
|
|
31
35
|
import 'source-map';
|
|
32
36
|
import 'srvx';
|
|
33
37
|
import { DevEnvironment } from 'vite';
|
|
38
|
+
import { watch } from '../_chunks/_deps/chokidar.mjs';
|
|
39
|
+
import { d as debounce } from '../_chunks/_deps/perfect-debounce.mjs';
|
|
34
40
|
import { getRandomPort } from 'get-port-please';
|
|
35
41
|
import { spawn } from 'node:child_process';
|
|
42
|
+
import { c as createProxyServer } from '../_chunks/_deps/httpxy.mjs';
|
|
43
|
+
import { a as assetsPlugin } from '../_chunks/_deps/@pi0/vite-plugin-fullstack.mjs';
|
|
36
44
|
|
|
37
45
|
const getViteRollupConfig = (ctx) => {
|
|
38
46
|
const nitro = ctx.nitro;
|
|
@@ -42,7 +50,6 @@ const getViteRollupConfig = (ctx) => {
|
|
|
42
50
|
[base.buildServerDir, "app"],
|
|
43
51
|
[runtimeDir, "nitro"],
|
|
44
52
|
[base.presetsDir, "nitro"],
|
|
45
|
-
["\0raw:", "raw"],
|
|
46
53
|
["\0nitro-wasm:", "wasm"],
|
|
47
54
|
["\0", "virtual"]
|
|
48
55
|
];
|
|
@@ -58,7 +65,11 @@ const getViteRollupConfig = (ctx) => {
|
|
|
58
65
|
ctx.pluginConfig.experimental?.virtualBundle && virtualBundlePlugin(ctx._serviceBundles),
|
|
59
66
|
...baseBuildPlugins(nitro, base),
|
|
60
67
|
alias({ entries: base.aliases }),
|
|
61
|
-
replace({
|
|
68
|
+
replace({
|
|
69
|
+
delimiters: base.replaceDelimiters,
|
|
70
|
+
preventAssignment: true,
|
|
71
|
+
values: base.replacements
|
|
72
|
+
}),
|
|
62
73
|
inject(base.env.inject)
|
|
63
74
|
].filter(Boolean),
|
|
64
75
|
treeshake: {
|
|
@@ -193,7 +204,7 @@ async function buildEnvironments(ctx, builder) {
|
|
|
193
204
|
}
|
|
194
205
|
continue;
|
|
195
206
|
}
|
|
196
|
-
console.log();
|
|
207
|
+
if (!a && !T) console.log();
|
|
197
208
|
nitro.logger.start(`Building [${fmtName}]`);
|
|
198
209
|
await builder.build(env);
|
|
199
210
|
}
|
|
@@ -218,7 +229,8 @@ async function buildEnvironments(ctx, builder) {
|
|
|
218
229
|
nitroOptions.renderer.template = tmp;
|
|
219
230
|
}
|
|
220
231
|
}
|
|
221
|
-
|
|
232
|
+
await builder.writeAssetsManifest?.();
|
|
233
|
+
if (!a && !T) console.log();
|
|
222
234
|
const buildInfo = [
|
|
223
235
|
["preset", nitro.options.preset],
|
|
224
236
|
["compatibility", formatCompatibilityDate(nitro.options.compatibilityDate)]
|
|
@@ -227,11 +239,6 @@ async function buildEnvironments(ctx, builder) {
|
|
|
227
239
|
`Building [${BuilderNames.nitro}] ${colors.dim(`(${buildInfo.map(([k, v]) => `${k}: \`${v}\``).join(", ")})`)}`
|
|
228
240
|
);
|
|
229
241
|
await copyPublicAssets(nitro);
|
|
230
|
-
await nitro.hooks.callHook(
|
|
231
|
-
"rollup:before",
|
|
232
|
-
nitro,
|
|
233
|
-
builder.environments.nitro.config.build.rollupOptions
|
|
234
|
-
);
|
|
235
242
|
await builder.build(builder.environments.nitro);
|
|
236
243
|
await nitro.close();
|
|
237
244
|
await nitro.hooks.callHook("compiled", nitro);
|
|
@@ -240,7 +247,7 @@ async function buildEnvironments(ctx, builder) {
|
|
|
240
247
|
const rewriteRelativePaths = (input) => {
|
|
241
248
|
return input.replace(/([\s:])\.\/(\S*)/g, `$1${rOutput}/$2`);
|
|
242
249
|
};
|
|
243
|
-
console.log();
|
|
250
|
+
if (!a && !T) console.log();
|
|
244
251
|
if (nitro.options.commands.preview) {
|
|
245
252
|
nitro.logger.success(
|
|
246
253
|
`You can preview this build using \`${rewriteRelativePaths(
|
|
@@ -446,7 +453,8 @@ async function configureViteDevServer(ctx, server) {
|
|
|
446
453
|
if (fetchDest) {
|
|
447
454
|
res.setHeader("vary", "sec-fetch-dest");
|
|
448
455
|
}
|
|
449
|
-
|
|
456
|
+
const ext = (req.url || "").match(/\.([a-z0-9]+)(?:[?#]|$)/i)?.[1] || "";
|
|
457
|
+
if (!ext && (!fetchDest || /^(document|iframe|frame|empty)$/.test(fetchDest))) {
|
|
450
458
|
nitroDevMiddleware(req, res, next);
|
|
451
459
|
} else {
|
|
452
460
|
next();
|
|
@@ -489,11 +497,7 @@ function createNitroEnvironment(ctx) {
|
|
|
489
497
|
noExternal: ctx.nitro.options.dev ? (
|
|
490
498
|
// Workaround for dev: external dependencies are not resolvable with respect to nodeModulePaths
|
|
491
499
|
new RegExp(runtimeDependencies.join("|"))
|
|
492
|
-
) :
|
|
493
|
-
// Workaround for build: externals tracing is unstable
|
|
494
|
-
ctx.nitro.options.noExternals === false ? void 0 : true
|
|
495
|
-
),
|
|
496
|
-
// prettier-ignore
|
|
500
|
+
) : true,
|
|
497
501
|
conditions: ctx.nitro.options.exportConditions,
|
|
498
502
|
externalConditions: ctx.nitro.options.exportConditions
|
|
499
503
|
},
|
|
@@ -517,7 +521,6 @@ function createServiceEnvironment(ctx, name, serviceConfig) {
|
|
|
517
521
|
emptyOutDir: true
|
|
518
522
|
},
|
|
519
523
|
resolve: {
|
|
520
|
-
noExternal: ctx.nitro.options.dev ? void 0 : true,
|
|
521
524
|
conditions: ctx.nitro.options.exportConditions,
|
|
522
525
|
externalConditions: ctx.nitro.options.exportConditions
|
|
523
526
|
},
|
|
@@ -633,280 +636,218 @@ function nitroPreviewPlugin(ctx) {
|
|
|
633
636
|
}
|
|
634
637
|
|
|
635
638
|
const DEFAULT_EXTENSIONS = [".ts", ".js", ".mts", ".mjs", ".tsx", ".jsx"];
|
|
639
|
+
const debug = process.env.NITRO_DEBUG ? (...args) => console.log("[nitro]", ...args) : () => {
|
|
640
|
+
};
|
|
636
641
|
function nitro(pluginConfig = {}) {
|
|
637
|
-
const ctx =
|
|
638
|
-
pluginConfig,
|
|
639
|
-
_entryPoints: {},
|
|
640
|
-
_manifest: {},
|
|
641
|
-
_serviceBundles: {}
|
|
642
|
-
};
|
|
642
|
+
const ctx = createContext(pluginConfig);
|
|
643
643
|
return [
|
|
644
|
-
|
|
645
|
-
|
|
644
|
+
nitroInit(ctx),
|
|
645
|
+
nitroEnv(ctx),
|
|
646
|
+
nitroMain(ctx),
|
|
647
|
+
nitroPrepare(ctx),
|
|
648
|
+
nitroService(ctx),
|
|
646
649
|
nitroPreviewPlugin(),
|
|
647
|
-
|
|
650
|
+
pluginConfig.experimental?.assetsImport !== false && assetsPlugin({
|
|
651
|
+
experimental: {
|
|
652
|
+
// See https://github.com/hi-ogawa/vite-plugins/pull/1289
|
|
653
|
+
clientBuildFallback: false
|
|
654
|
+
}
|
|
655
|
+
})
|
|
648
656
|
];
|
|
649
657
|
}
|
|
650
|
-
function
|
|
651
|
-
return
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
ssrEntry = resolveModulePath(ssrEntry, {
|
|
687
|
-
from: ctx.nitro.options.scanDirs,
|
|
688
|
-
extensions: DEFAULT_EXTENSIONS,
|
|
689
|
-
suffixes: ["", "/index"],
|
|
690
|
-
try: true
|
|
691
|
-
}) || ssrEntry;
|
|
692
|
-
ctx.pluginConfig.services.ssr = { entry: ssrEntry };
|
|
693
|
-
} else {
|
|
694
|
-
this.error(`Invalid input type for SSR entry point.`);
|
|
695
|
-
}
|
|
658
|
+
function nitroInit(ctx) {
|
|
659
|
+
return {
|
|
660
|
+
name: "nitro:init",
|
|
661
|
+
sharedDuringBuild: true,
|
|
662
|
+
apply: (_config, configEnv) => !configEnv.isPreview,
|
|
663
|
+
async config(config, configEnv) {
|
|
664
|
+
if (!ctx._initialized) {
|
|
665
|
+
debug("[init] Initializing nitro");
|
|
666
|
+
ctx._initialized = true;
|
|
667
|
+
await setupNitroContext(ctx, configEnv, config);
|
|
668
|
+
}
|
|
669
|
+
},
|
|
670
|
+
applyToEnvironment(env) {
|
|
671
|
+
if (env.name === "nitro" && ctx.nitro?.options.dev) {
|
|
672
|
+
debug("[init] Adding rollup plugins for dev");
|
|
673
|
+
return [...ctx.rollupConfig?.config.plugins || []];
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
function nitroEnv(ctx) {
|
|
679
|
+
return {
|
|
680
|
+
name: "nitro:env",
|
|
681
|
+
sharedDuringBuild: true,
|
|
682
|
+
apply: (_config, configEnv) => !configEnv.isPreview,
|
|
683
|
+
async config(userConfig, _configEnv) {
|
|
684
|
+
debug("[env] Extending config (environments)");
|
|
685
|
+
const environments = {
|
|
686
|
+
...createServiceEnvironments(ctx),
|
|
687
|
+
nitro: createNitroEnvironment(ctx)
|
|
688
|
+
};
|
|
689
|
+
environments.client = {
|
|
690
|
+
consumer: userConfig.environments?.client?.consumer ?? "client",
|
|
691
|
+
build: {
|
|
692
|
+
rollupOptions: {
|
|
693
|
+
input: userConfig.environments?.client?.build?.rollupOptions?.input ?? useNitro(ctx).options.renderer?.template
|
|
696
694
|
}
|
|
697
695
|
}
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
}
|
|
718
|
-
await ctx.nitro.hooks.callHook("build:before", ctx.nitro);
|
|
719
|
-
ctx.rollupConfig = await getViteRollupConfig(ctx);
|
|
720
|
-
if (ctx.nitro.options.dev && !ctx.devWorker) {
|
|
721
|
-
ctx.devWorker = createDevWorker(ctx);
|
|
696
|
+
};
|
|
697
|
+
debug("[env] Environments:", Object.keys(environments).join(", "));
|
|
698
|
+
return {
|
|
699
|
+
environments
|
|
700
|
+
};
|
|
701
|
+
},
|
|
702
|
+
configEnvironment(name, config) {
|
|
703
|
+
if (config.consumer === "client") {
|
|
704
|
+
debug(
|
|
705
|
+
"[env] Configuring client environment",
|
|
706
|
+
name === "client" ? "" : ` (${name})`
|
|
707
|
+
);
|
|
708
|
+
config.build.emptyOutDir = false;
|
|
709
|
+
config.build.outDir = useNitro(ctx).options.output.publicDir;
|
|
710
|
+
} else {
|
|
711
|
+
if (ctx.pluginConfig.experimental?.virtualBundle && name in (ctx.pluginConfig.services || {})) {
|
|
712
|
+
debug("[env] Configuring service environment for virtual:", name);
|
|
713
|
+
config.build ??= {};
|
|
714
|
+
config.build.write = config.build.write ?? false;
|
|
722
715
|
}
|
|
723
|
-
|
|
724
|
-
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
function nitroMain(ctx) {
|
|
721
|
+
return {
|
|
722
|
+
name: "nitro:main",
|
|
723
|
+
sharedDuringBuild: true,
|
|
724
|
+
apply: (_config, configEnv) => !configEnv.isPreview,
|
|
725
|
+
async config(userConfig, _configEnv) {
|
|
726
|
+
debug("[main] Extending config (appType, resolve, server)");
|
|
727
|
+
if (!ctx.rollupConfig) {
|
|
728
|
+
throw new Error("Nitro rollup config is not initialized yet.");
|
|
729
|
+
}
|
|
730
|
+
return {
|
|
731
|
+
appType: userConfig.appType || "custom",
|
|
732
|
+
resolve: {
|
|
733
|
+
// TODO: environment specific aliases not working
|
|
734
|
+
// https://github.com/vitejs/vite/pull/17583 (seems not effective)
|
|
735
|
+
alias: ctx.rollupConfig.base.aliases
|
|
736
|
+
},
|
|
737
|
+
builder: {
|
|
738
|
+
sharedConfigBuild: true
|
|
739
|
+
},
|
|
740
|
+
server: {
|
|
741
|
+
port: Number.parseInt(process.env.PORT || "") || userConfig.server?.port || useNitro(ctx).options.devServer?.port || 3e3,
|
|
742
|
+
// #3673, disable Vite's `cors` by default as Nitro handles all requests
|
|
743
|
+
cors: false
|
|
725
744
|
}
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
...createServiceEnvironments(ctx),
|
|
740
|
-
nitro: createNitroEnvironment(ctx)
|
|
741
|
-
},
|
|
742
|
-
resolve: {
|
|
743
|
-
// TODO: environment specific aliases not working
|
|
744
|
-
// https://github.com/vitejs/vite/pull/17583 (seems not effective)
|
|
745
|
-
alias: ctx.rollupConfig.base.aliases
|
|
746
|
-
},
|
|
747
|
-
build: {
|
|
748
|
-
// TODO: Support server environment emitted assets
|
|
749
|
-
assetsInlineLimit: 4096 * 4
|
|
750
|
-
},
|
|
751
|
-
builder: {
|
|
752
|
-
/// Share the config instance among environments to align with the behavior of dev server
|
|
753
|
-
sharedConfigBuild: true
|
|
754
|
-
},
|
|
755
|
-
server: {
|
|
756
|
-
port: Number.parseInt(process.env.PORT || "") || userConfig.server?.port || ctx.nitro.options.devServer?.port || 3e3
|
|
757
|
-
}
|
|
758
|
-
};
|
|
759
|
-
},
|
|
760
|
-
configResolved(config) {
|
|
761
|
-
if (config.command === "build") {
|
|
762
|
-
for (const env of Object.values(config.environments)) {
|
|
763
|
-
if (env.consumer === "client") {
|
|
764
|
-
const { assetsDir } = env.build;
|
|
765
|
-
const rule = ctx.nitro.options.routeRules[`/${assetsDir}/**`] ??= {};
|
|
766
|
-
if (!rule.headers?.["cache-control"]) {
|
|
767
|
-
rule.headers = {
|
|
768
|
-
...rule.headers,
|
|
769
|
-
"cache-control": `public, max-age=31536000, immutable`
|
|
770
|
-
};
|
|
771
|
-
}
|
|
745
|
+
};
|
|
746
|
+
},
|
|
747
|
+
configResolved(config) {
|
|
748
|
+
if (config.command === "build") {
|
|
749
|
+
debug("[main] Inferring caching routes");
|
|
750
|
+
for (const env of Object.values(config.environments)) {
|
|
751
|
+
if (env.consumer === "client") {
|
|
752
|
+
const rule = ctx.nitro.options.routeRules[`/${env.build.assetsDir}/**`] ??= {};
|
|
753
|
+
if (!rule.headers?.["cache-control"]) {
|
|
754
|
+
rule.headers = {
|
|
755
|
+
...rule.headers,
|
|
756
|
+
"cache-control": `public, max-age=31536000, immutable`
|
|
757
|
+
};
|
|
772
758
|
}
|
|
773
759
|
}
|
|
774
760
|
}
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
761
|
+
}
|
|
762
|
+
debug("[main] Syncing nitro routes");
|
|
763
|
+
ctx.nitro.routing.sync();
|
|
764
|
+
},
|
|
765
|
+
buildApp: {
|
|
766
|
+
order: "post",
|
|
767
|
+
handler(builder) {
|
|
768
|
+
debug("[main] Building environments");
|
|
769
|
+
return buildEnvironments(ctx, builder);
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
generateBundle: {
|
|
773
|
+
handler(_options, bundle) {
|
|
774
|
+
const environment = this.environment;
|
|
775
|
+
debug(
|
|
776
|
+
"[main] Generating manifest and entry points for environment:",
|
|
777
|
+
environment.name
|
|
778
|
+
);
|
|
779
|
+
const { root } = environment.config;
|
|
780
|
+
const services = ctx.pluginConfig.services || {};
|
|
781
|
+
const serviceNames = Object.keys(services);
|
|
782
|
+
const isRegisteredService = serviceNames.includes(environment.name);
|
|
783
|
+
let entryFile;
|
|
784
|
+
for (const [_name, file] of Object.entries(bundle)) {
|
|
785
|
+
if (file.type === "chunk") {
|
|
786
|
+
if (isRegisteredService && file.isEntry) {
|
|
787
|
+
if (entryFile === void 0) {
|
|
800
788
|
entryFile = file.fileName;
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
for (const id of filteredModuleIds) {
|
|
806
|
-
const originalFile = relative(root, id);
|
|
807
|
-
ctx._manifest[originalFile] = { file: file.fileName };
|
|
789
|
+
} else {
|
|
790
|
+
this.warn(
|
|
791
|
+
`Multiple entry points found for service "${environment.name}"`
|
|
792
|
+
);
|
|
808
793
|
}
|
|
809
794
|
}
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
795
|
+
const filteredModuleIds = file.moduleIds.filter(
|
|
796
|
+
(id) => id.startsWith(root)
|
|
797
|
+
);
|
|
798
|
+
for (const id of filteredModuleIds) {
|
|
799
|
+
const originalFile = relative(root, id);
|
|
800
|
+
ctx._manifest[originalFile] = { file: file.fileName };
|
|
816
801
|
}
|
|
817
|
-
ctx._entryPoints[this.environment.name] = entryFile;
|
|
818
|
-
ctx._serviceBundles[this.environment.name] = bundle;
|
|
819
802
|
}
|
|
820
803
|
}
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
const serviceNames = Object.keys(services);
|
|
830
|
-
if (serviceNames.includes(name) && ctx.pluginConfig.experimental?.virtualBundle) {
|
|
831
|
-
config.build ??= {};
|
|
832
|
-
config.build.write = config.build.write ?? false;
|
|
804
|
+
if (isRegisteredService) {
|
|
805
|
+
if (entryFile === void 0) {
|
|
806
|
+
this.error(
|
|
807
|
+
`No entry point found for service "${this.environment.name}".`
|
|
808
|
+
);
|
|
809
|
+
}
|
|
810
|
+
ctx._entryPoints[this.environment.name] = entryFile;
|
|
811
|
+
ctx._serviceBundles[this.environment.name] = bundle;
|
|
833
812
|
}
|
|
834
|
-
}
|
|
835
|
-
// Extend Vite dev server with Nitro middleware
|
|
836
|
-
configureServer: (server) => configureViteDevServer(ctx, server)
|
|
813
|
+
}
|
|
837
814
|
},
|
|
838
|
-
{
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
815
|
+
configureServer: (server) => {
|
|
816
|
+
debug("[main] Configuring dev server");
|
|
817
|
+
return configureViteDevServer(ctx, server);
|
|
818
|
+
}
|
|
819
|
+
};
|
|
820
|
+
}
|
|
821
|
+
function nitroPrepare(ctx) {
|
|
822
|
+
return {
|
|
823
|
+
name: "nitro:prepare",
|
|
824
|
+
sharedDuringBuild: true,
|
|
825
|
+
applyToEnvironment: (env) => env.name === "nitro",
|
|
826
|
+
buildApp: {
|
|
827
|
+
// Clean the output directory before any environment is built
|
|
828
|
+
order: "pre",
|
|
829
|
+
async handler() {
|
|
830
|
+
debug("[prepare] Preparing output directory");
|
|
831
|
+
const nitro2 = ctx.nitro;
|
|
832
|
+
await prepare(nitro2);
|
|
847
833
|
}
|
|
848
834
|
}
|
|
849
|
-
|
|
835
|
+
};
|
|
850
836
|
}
|
|
851
|
-
function
|
|
837
|
+
function nitroService(ctx) {
|
|
852
838
|
return {
|
|
853
839
|
name: "nitro:service",
|
|
854
840
|
enforce: "pre",
|
|
855
|
-
|
|
841
|
+
sharedDuringBuild: true,
|
|
856
842
|
applyToEnvironment: (env) => env.name === "nitro",
|
|
857
843
|
resolveId: {
|
|
858
|
-
async handler(id
|
|
844
|
+
async handler(id) {
|
|
859
845
|
if (id === "#nitro-vite-setup") {
|
|
860
846
|
return { id, moduleSideEffects: true };
|
|
861
847
|
}
|
|
862
848
|
if (id === "#nitro-vite-services") {
|
|
863
849
|
return id;
|
|
864
850
|
}
|
|
865
|
-
if (runtimeDependencies.some(
|
|
866
|
-
(dep) => id === dep || id.startsWith(`${dep}/`)
|
|
867
|
-
)) {
|
|
868
|
-
const resolved = await this.resolve(id, importer, {
|
|
869
|
-
...options,
|
|
870
|
-
skipSelf: true
|
|
871
|
-
});
|
|
872
|
-
return resolved || resolveModulePath(id, {
|
|
873
|
-
from: ctx.nitro.options.nodeModulesDirs,
|
|
874
|
-
conditions: ctx.nitro.options.exportConditions,
|
|
875
|
-
try: true
|
|
876
|
-
});
|
|
877
|
-
}
|
|
878
|
-
if (importer?.startsWith("\0virtual:#nitro-internal-virtual")) {
|
|
879
|
-
const internalRes = await this.resolve(id, import.meta.url, {
|
|
880
|
-
...options,
|
|
881
|
-
custom: { ...options.custom, skipNoExternals: true }
|
|
882
|
-
});
|
|
883
|
-
if (internalRes) {
|
|
884
|
-
return internalRes;
|
|
885
|
-
}
|
|
886
|
-
const resolvedFromRoot = await this.resolve(
|
|
887
|
-
id,
|
|
888
|
-
ctx.nitro.options.rootDir,
|
|
889
|
-
{ ...options, custom: { ...options.custom, skipNoExternals: true } }
|
|
890
|
-
);
|
|
891
|
-
if (resolvedFromRoot) {
|
|
892
|
-
return resolvedFromRoot;
|
|
893
|
-
}
|
|
894
|
-
const ids = [id];
|
|
895
|
-
if (!/^[./@#]/.test(id)) {
|
|
896
|
-
ids.push(`./${id}`);
|
|
897
|
-
}
|
|
898
|
-
for (const _id of ids) {
|
|
899
|
-
const resolved = resolveModulePath(_id, {
|
|
900
|
-
from: process.cwd(),
|
|
901
|
-
extensions: DEFAULT_EXTENSIONS,
|
|
902
|
-
suffixes: ["", "/index"],
|
|
903
|
-
try: true
|
|
904
|
-
});
|
|
905
|
-
if (resolved) {
|
|
906
|
-
return resolved;
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
851
|
}
|
|
911
852
|
},
|
|
912
853
|
load: {
|
|
@@ -918,35 +859,93 @@ function nitroServicePlugin(ctx) {
|
|
|
918
859
|
}
|
|
919
860
|
};
|
|
920
861
|
}
|
|
921
|
-
function
|
|
922
|
-
const createHookCaller = (hook, order) => {
|
|
923
|
-
const handler = async function(...args) {
|
|
924
|
-
for (const plugin of ctx.rollupConfig.config.plugins) {
|
|
925
|
-
if (typeof plugin[hook] !== "function") continue;
|
|
926
|
-
const res = await plugin[hook].call(this, ...args);
|
|
927
|
-
if (res) {
|
|
928
|
-
if (hook === "resolveId" && res.id?.startsWith?.("file://")) {
|
|
929
|
-
res.id = fileURLToPath(res.id);
|
|
930
|
-
}
|
|
931
|
-
return res;
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
};
|
|
935
|
-
Object.defineProperty(handler, "name", { value: hook });
|
|
936
|
-
return order ? { order, handler } : handler;
|
|
937
|
-
};
|
|
862
|
+
function createContext(pluginConfig) {
|
|
938
863
|
return {
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
load: createHookCaller("load", "pre"),
|
|
944
|
-
transform: createHookCaller("transform", "post"),
|
|
945
|
-
renderChunk: createHookCaller("renderChunk", "post"),
|
|
946
|
-
generateBundle: createHookCaller("generateBundle", "post"),
|
|
947
|
-
buildEnd: createHookCaller("buildEnd", "post")
|
|
864
|
+
pluginConfig,
|
|
865
|
+
_entryPoints: {},
|
|
866
|
+
_manifest: {},
|
|
867
|
+
_serviceBundles: {}
|
|
948
868
|
};
|
|
949
869
|
}
|
|
870
|
+
function useNitro(ctx) {
|
|
871
|
+
if (!ctx.nitro) {
|
|
872
|
+
throw new Error("Nitro instance is not initialized yet.");
|
|
873
|
+
}
|
|
874
|
+
return ctx.nitro;
|
|
875
|
+
}
|
|
876
|
+
async function setupNitroContext(ctx, configEnv, userConfig) {
|
|
877
|
+
ctx.nitro = ctx.pluginConfig._nitro || await createNitro({
|
|
878
|
+
dev: configEnv.mode === "development",
|
|
879
|
+
rootDir: userConfig.root,
|
|
880
|
+
...defu(ctx.pluginConfig.config, userConfig.nitro)
|
|
881
|
+
});
|
|
882
|
+
if (!ctx.pluginConfig.services?.ssr) {
|
|
883
|
+
ctx.pluginConfig.services ??= {};
|
|
884
|
+
if (userConfig.environments?.ssr === void 0) {
|
|
885
|
+
const ssrEntry = resolveModulePath("./entry-server", {
|
|
886
|
+
from: ["", "app", "src"].flatMap(
|
|
887
|
+
(d) => ctx.nitro.options.scanDirs.map((s) => join(s, d) + "/")
|
|
888
|
+
),
|
|
889
|
+
extensions: DEFAULT_EXTENSIONS,
|
|
890
|
+
try: true
|
|
891
|
+
});
|
|
892
|
+
if (ssrEntry) {
|
|
893
|
+
ctx.pluginConfig.services.ssr = { entry: ssrEntry };
|
|
894
|
+
ctx.nitro.logger.info(
|
|
895
|
+
`Using \`${prettyPath(ssrEntry)}\` as vite ssr entry.`
|
|
896
|
+
);
|
|
897
|
+
}
|
|
898
|
+
} else {
|
|
899
|
+
let ssrEntry = getEntry(
|
|
900
|
+
userConfig.environments.ssr.build?.rollupOptions?.input
|
|
901
|
+
);
|
|
902
|
+
if (typeof ssrEntry === "string") {
|
|
903
|
+
ssrEntry = resolveModulePath(ssrEntry, {
|
|
904
|
+
from: ctx.nitro.options.scanDirs,
|
|
905
|
+
extensions: DEFAULT_EXTENSIONS,
|
|
906
|
+
suffixes: ["", "/index"],
|
|
907
|
+
try: true
|
|
908
|
+
}) || ssrEntry;
|
|
909
|
+
ctx.pluginConfig.services.ssr = { entry: ssrEntry };
|
|
910
|
+
} else {
|
|
911
|
+
throw new TypeError(`Invalid input type for SSR entry point.`);
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
if (!ctx.nitro.options.renderer?.entry && !ctx.nitro.options.renderer?.template && ctx.pluginConfig.services.ssr?.entry) {
|
|
916
|
+
ctx.nitro.options.renderer ??= {};
|
|
917
|
+
ctx.nitro.options.renderer.entry = resolve(
|
|
918
|
+
runtimeDir,
|
|
919
|
+
"internal/vite/ssr-renderer"
|
|
920
|
+
);
|
|
921
|
+
}
|
|
922
|
+
const publicDistDir = ctx._publicDistDir = userConfig.build?.outDir || resolve(ctx.nitro.options.buildDir, "vite/public");
|
|
923
|
+
ctx.nitro.options.publicAssets.push({
|
|
924
|
+
dir: publicDistDir,
|
|
925
|
+
maxAge: 0,
|
|
926
|
+
baseURL: "/",
|
|
927
|
+
fallthrough: true
|
|
928
|
+
});
|
|
929
|
+
if (!ctx.nitro.options.dev) {
|
|
930
|
+
ctx.nitro.options.unenv.push({
|
|
931
|
+
meta: { name: "nitro-vite" },
|
|
932
|
+
polyfill: ["#nitro-vite-setup"]
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
await ctx.nitro.hooks.callHook("build:before", ctx.nitro);
|
|
936
|
+
ctx.rollupConfig = await getViteRollupConfig(ctx);
|
|
937
|
+
await ctx.nitro.hooks.callHook(
|
|
938
|
+
"rollup:before",
|
|
939
|
+
ctx.nitro,
|
|
940
|
+
ctx.rollupConfig.config
|
|
941
|
+
);
|
|
942
|
+
if (ctx.nitro.options.dev && !ctx.devWorker) {
|
|
943
|
+
ctx.devWorker = createDevWorker(ctx);
|
|
944
|
+
}
|
|
945
|
+
if (ctx.nitro.options.dev && !ctx.devApp) {
|
|
946
|
+
ctx.devApp = new NitroDevApp(ctx.nitro);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
950
949
|
function getEntry(input) {
|
|
951
950
|
if (typeof input === "string") {
|
|
952
951
|
return input;
|