nitro-nightly 3.0.1-alpha.2 → 3.0.260415-beta
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/LICENSE +6 -0
- package/README.md +2 -2
- package/dist/THIRD-PARTY-LICENSES.md +1646 -0
- package/dist/_build/common.mjs +7259 -3815
- package/dist/_build/rolldown.mjs +32 -42
- package/dist/_build/rollup.mjs +28 -48
- package/dist/_build/vite.build.mjs +10 -10
- package/dist/_chunks/nitro.mjs +102 -327
- package/dist/_chunks/nitro2.mjs +8 -9
- package/dist/_chunks/nitro3.mjs +136 -0
- package/dist/_chunks/nitro4.mjs +127 -0
- package/dist/_chunks/utils.mjs +40 -29
- package/dist/_common.mjs +13 -25
- package/dist/_dev.d.mts +0 -3
- package/dist/{_chunks/dev.mjs → _dev.mjs} +132 -330
- package/dist/_libs/_.mjs +2 -0
- package/dist/_libs/_2.mjs +2 -0
- package/dist/_libs/_3.mjs +2 -0
- package/dist/_libs/_4.mjs +2 -0
- package/dist/_libs/_5.mjs +2 -0
- package/dist/_libs/_6.mjs +2 -0
- package/dist/_libs/_7.mjs +2 -0
- package/dist/_libs/c12+rc9.mjs +814 -0
- package/dist/_libs/{c12+giget+readdirp+chokidar.d.mts → c12+readdirp+chokidar.d.mts} +49 -40
- package/dist/_libs/citty.mjs +142 -41
- package/dist/_libs/commondir+is-reference.mjs +60 -56
- package/dist/_libs/compatx.d.mts +0 -2
- package/dist/_libs/compatx.mjs +1 -4
- package/dist/_libs/esbuild.d.mts +0 -1
- package/dist/_libs/escape-string-regexp.mjs +1 -4
- package/dist/_libs/{pluginutils+plugin-commonjs.d.mts → estree+pluginutils.d.mts} +0 -5
- package/dist/_libs/estree-walker.mjs +4 -92
- package/dist/_libs/exsolve.d.mts +1 -0
- package/dist/_libs/hasown+resolve+deepmerge.mjs +160 -246
- package/dist/_libs/httpxy.d.mts +20 -13
- package/dist/_libs/httpxy.mjs +519 -95
- package/dist/_libs/js-tokens.d.mts +1 -0
- package/dist/_libs/klona.mjs +1 -4
- package/dist/_libs/magic-string.d.mts +0 -2
- package/dist/_libs/mlly.d.mts +0 -2
- package/dist/_libs/nypm+tinyexec.mjs +822 -0
- package/dist/_libs/perfect-debounce.mjs +68 -0
- package/dist/_libs/pkg-types.d.mts +0 -3
- package/dist/_libs/plugin-alias.mjs +1 -5
- package/dist/_libs/plugin-inject.mjs +1 -7
- package/dist/_libs/plugin-json.mjs +1 -5
- package/dist/_libs/pluginutils.mjs +3 -35
- package/dist/_libs/readdirp+chokidar.mjs +187 -365
- package/dist/_libs/remapping.mjs +1 -5
- package/dist/_libs/resolve-uri+gen-mapping.mjs +15 -53
- package/dist/_libs/rou3.d.mts +1 -4
- package/dist/_libs/rou3.mjs +223 -78
- package/dist/_libs/std-env.d.mts +8 -2
- package/dist/_libs/strip-literal.d.mts +1 -0
- package/dist/_libs/tsconfck.mjs +21 -334
- package/dist/_libs/ultrahtml.mjs +3 -16
- package/dist/_libs/unimport+unplugin.mjs +244 -388
- package/dist/_libs/unplugin+unimport.d.mts +5 -15
- package/dist/_libs/unwasm.d.mts +0 -3
- package/dist/_presets.mjs +575 -488
- package/dist/builder.d.mts +5 -25
- package/dist/builder.mjs +3 -8
- package/dist/cli/_chunks/build.mjs +22 -25
- package/dist/cli/_chunks/common.mjs +1 -4
- package/dist/cli/_chunks/deploy.mjs +37 -0
- package/dist/cli/_chunks/dev.mjs +6 -11
- package/dist/cli/_chunks/docs.mjs +28 -0
- package/dist/cli/_chunks/list.mjs +4 -8
- package/dist/cli/_chunks/prepare.mjs +2 -6
- package/dist/cli/_chunks/preview.mjs +48 -0
- package/dist/cli/_chunks/run.mjs +7 -11
- package/dist/cli/_chunks/task.mjs +1 -5
- package/dist/cli/index.mjs +5 -6
- package/dist/docs/0.docs/0.index/index.md +56 -0
- package/dist/docs/0.docs/1.quick-start.md +110 -0
- package/dist/docs/0.docs/10.lifecycle.md +204 -0
- package/dist/docs/0.docs/11.openapi.md +291 -0
- package/dist/docs/0.docs/12.plugins.md +164 -0
- package/dist/docs/0.docs/13.tasks.md +277 -0
- package/dist/docs/0.docs/14.websocket.md +386 -0
- package/dist/docs/0.docs/15.migration.md +213 -0
- package/dist/docs/0.docs/16.nightly.md +31 -0
- package/dist/docs/0.docs/2.renderer.md +322 -0
- package/dist/docs/0.docs/3.routing.md +711 -0
- package/dist/docs/0.docs/4.server-entry.md +239 -0
- package/dist/docs/0.docs/5.cache.md +408 -0
- package/dist/docs/0.docs/6.storage.md +261 -0
- package/dist/docs/0.docs/7.assets.md +166 -0
- package/dist/docs/0.docs/8.configuration.md +256 -0
- package/dist/docs/0.docs/9.database.md +185 -0
- package/dist/docs/1.deploy/0.index/index.md +64 -0
- package/dist/docs/1.deploy/1.runtimes/0.node.md +63 -0
- package/dist/docs/1.deploy/1.runtimes/1.bun.md +15 -0
- package/dist/docs/1.deploy/1.runtimes/2.deno.md +19 -0
- package/dist/docs/1.deploy/2.providers/0.alwaysdata.md +50 -0
- package/dist/docs/1.deploy/2.providers/1.aws.md +47 -0
- package/dist/docs/1.deploy/2.providers/10.flightcontrol.md +67 -0
- package/dist/docs/1.deploy/2.providers/11.genezio.md +67 -0
- package/dist/docs/1.deploy/2.providers/12.github-pages.md +68 -0
- package/dist/docs/1.deploy/2.providers/13.gitlab-pages.md +37 -0
- package/dist/docs/1.deploy/2.providers/14.heroku.md +84 -0
- package/dist/docs/1.deploy/2.providers/15.iis.md +38 -0
- package/dist/docs/1.deploy/2.providers/16.koyeb.md +109 -0
- package/dist/docs/1.deploy/2.providers/17.netlify.md +47 -0
- package/dist/docs/1.deploy/2.providers/18.platform-sh.md +37 -0
- package/dist/docs/1.deploy/2.providers/19.render.md +37 -0
- package/dist/docs/1.deploy/2.providers/2.aws-amplify.md +81 -0
- package/dist/docs/1.deploy/2.providers/20.stormkit.md +24 -0
- package/dist/docs/1.deploy/2.providers/21.vercel.md +270 -0
- package/dist/docs/1.deploy/2.providers/22.zeabur.md +19 -0
- package/dist/docs/1.deploy/2.providers/23.zephyr.md +99 -0
- package/dist/docs/1.deploy/2.providers/24.zerops.md +102 -0
- package/dist/docs/1.deploy/2.providers/3.azure.md +72 -0
- package/dist/docs/1.deploy/2.providers/4.cleavr.md +33 -0
- package/dist/docs/1.deploy/2.providers/5.cloudflare.md +369 -0
- package/dist/docs/1.deploy/2.providers/6.deno-deploy.md +66 -0
- package/dist/docs/1.deploy/2.providers/7.digitalocean.md +46 -0
- package/dist/docs/1.deploy/2.providers/8.edgeone.md +20 -0
- package/dist/docs/1.deploy/2.providers/9.firebase.md +32 -0
- package/dist/docs/2.config/0.index/index.md +1221 -0
- package/dist/docs/3.examples/0.index/index.md +3 -0
- package/dist/docs/3.examples/1.api-routes.md +145 -0
- package/dist/docs/3.examples/10.hono.md +74 -0
- package/dist/docs/3.examples/11.import-alias.md +97 -0
- package/dist/docs/3.examples/12.middleware.md +91 -0
- package/dist/docs/3.examples/13.mono-jsx.md +68 -0
- package/dist/docs/3.examples/14.nano-jsx.md +70 -0
- package/dist/docs/3.examples/15.plugins.md +91 -0
- package/dist/docs/3.examples/16.renderer.md +113 -0
- package/dist/docs/3.examples/17.runtime-config.md +97 -0
- package/dist/docs/3.examples/18.server-fetch.md +87 -0
- package/dist/docs/3.examples/19.shiki.md +198 -0
- package/dist/docs/3.examples/2.auto-imports.md +92 -0
- package/dist/docs/3.examples/20.virtual-routes.md +74 -0
- package/dist/docs/3.examples/21.vite-nitro-plugin.md +79 -0
- package/dist/docs/3.examples/22.vite-rsc.md +1041 -0
- package/dist/docs/3.examples/23.vite-ssr-html.md +217 -0
- package/dist/docs/3.examples/24.vite-ssr-preact.md +247 -0
- package/dist/docs/3.examples/25.vite-ssr-react.md +226 -0
- package/dist/docs/3.examples/26.vite-ssr-solid.md +256 -0
- package/dist/docs/3.examples/27.vite-ssr-tsr-react.md +442 -0
- package/dist/docs/3.examples/28.vite-ssr-tss-react.md +444 -0
- package/dist/docs/3.examples/29.vite-ssr-vue-router.md +617 -0
- package/dist/docs/3.examples/3.cached-handler.md +81 -0
- package/dist/docs/3.examples/30.vite-trpc.md +335 -0
- package/dist/docs/3.examples/31.websocket.md +282 -0
- package/dist/docs/3.examples/4.custom-error-handler.md +98 -0
- package/dist/docs/3.examples/5.database.md +157 -0
- package/dist/docs/3.examples/6.elysia.md +70 -0
- package/dist/docs/3.examples/7.express.md +78 -0
- package/dist/docs/3.examples/8.fastify.md +79 -0
- package/dist/docs/3.examples/9.hello-world.md +68 -0
- package/dist/docs/README.md +86 -0
- package/dist/docs/index.md +121 -0
- package/dist/node_modules/@poppinss/dumper/build/formatters/html/main.js +8 -0
- package/dist/node_modules/@poppinss/dumper/package.json +1 -1
- package/dist/node_modules/@speed-highlight/core/dist/index.js +4 -4
- package/dist/node_modules/@speed-highlight/core/dist/terminal.js +2 -2
- package/dist/node_modules/@speed-highlight/core/package.json +1 -1
- package/dist/node_modules/cookie-es/dist/index.mjs +299 -250
- package/dist/node_modules/cookie-es/package.json +26 -23
- package/dist/node_modules/croner/dist/croner.js +1 -1
- package/dist/node_modules/croner/package.json +11 -1
- package/dist/node_modules/defu/dist/defu.mjs +2 -2
- package/dist/node_modules/defu/package.json +33 -28
- package/dist/node_modules/rendu/dist/_chunks/libs/cookie-es.mjs +151 -0
- package/dist/node_modules/rendu/dist/index.mjs +5 -112
- package/dist/node_modules/rendu/package.json +25 -24
- package/dist/node_modules/youch/build/helpers-B9BQYaS6.js +23 -0
- package/dist/node_modules/youch/build/index.js +204 -351
- package/dist/node_modules/youch/build/public/error_info/script.js +1 -1
- package/dist/node_modules/youch/build/public_dir-C5bujZKB.js +25 -0
- package/dist/node_modules/youch/build/src/templates/error_cause/main.js +44 -0
- package/dist/node_modules/youch/build/src/templates/error_info/main.js +72 -0
- package/dist/node_modules/youch/build/src/templates/error_metadata/main.js +65 -0
- package/dist/node_modules/youch/build/src/templates/error_stack/main.js +152 -0
- package/dist/node_modules/youch/build/src/templates/error_stack_source/main.js +46 -0
- package/dist/node_modules/youch/build/src/templates/header/main.js +24 -0
- package/dist/node_modules/youch/build/src/templates/layout/main.js +27 -0
- package/dist/node_modules/youch/package.json +35 -32
- package/dist/presets/_nitro/runtime/nitro-dev.mjs +12 -57
- package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +1 -0
- package/dist/presets/_nitro/runtime/service-worker.mjs +1 -2
- package/dist/presets/aws-lambda/runtime/_utils.mjs +6 -6
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +3 -1
- package/dist/presets/azure/runtime/_utils.mjs +5 -5
- package/dist/presets/azure/runtime/azure-swa.mjs +5 -5
- package/dist/presets/bun/runtime/bun.mjs +9 -6
- package/dist/presets/cloudflare/runtime/_module-handler.mjs +1 -1
- package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +4 -4
- package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +3 -3
- package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +2 -2
- package/dist/presets/cloudflare/runtime/plugin.dev.mjs +10 -21
- package/dist/presets/deno/runtime/deno-deploy.mjs +4 -4
- package/dist/presets/deno/runtime/deno-server.mjs +9 -6
- package/dist/presets/edgeone/runtime/edgeone.mjs +10 -0
- package/dist/presets/netlify/runtime/netlify-edge.mjs +2 -3
- package/dist/presets/netlify/runtime/netlify.mjs +1 -1
- package/dist/presets/node/runtime/node-cluster.mjs +5 -4
- package/dist/presets/node/runtime/node-middleware.mjs +1 -1
- package/dist/presets/node/runtime/node-server.mjs +8 -5
- package/dist/presets/stormkit/runtime/stormkit.mjs +1 -2
- package/dist/presets/vercel/runtime/cron-handler.mjs +25 -0
- package/dist/presets/vercel/runtime/queue-handler.mjs +21 -0
- package/dist/presets/vercel/runtime/vercel.node.mjs +3 -3
- package/dist/presets/vercel/runtime/vercel.web.mjs +3 -5
- package/dist/presets/winterjs/runtime/winterjs.mjs +10 -10
- package/dist/presets/zephyr/runtime/server.mjs +3 -0
- package/dist/runtime/internal/app.mjs +12 -11
- package/dist/runtime/internal/cache.d.mts +0 -4
- package/dist/runtime/internal/cache.mjs +32 -256
- package/dist/runtime/internal/context.d.mts +3 -1
- package/dist/runtime/internal/context.mjs +1 -9
- package/dist/runtime/internal/error/dev.d.mts +5 -4
- package/dist/runtime/internal/error/dev.mjs +47 -49
- package/dist/runtime/internal/error/hooks.d.mts +1 -1
- package/dist/runtime/internal/error/prod.d.mts +2 -5
- package/dist/runtime/internal/error/prod.mjs +19 -33
- package/dist/runtime/internal/error/utils.d.mts +4 -4
- package/dist/runtime/internal/meta.d.mts +1 -1
- package/dist/runtime/internal/plugin.d.mts +2 -2
- package/dist/runtime/internal/route-rules.d.mts +11 -4
- package/dist/runtime/internal/route-rules.mjs +15 -5
- package/dist/runtime/internal/routes/dev-tasks.d.mts +3 -2
- package/dist/runtime/internal/routes/dev-tasks.mjs +15 -10
- package/dist/runtime/internal/routes/openapi.mjs +2 -2
- package/dist/runtime/internal/routes/renderer-template.d.mts +1 -1
- package/dist/runtime/internal/routes/renderer-template.dev.d.mts +2 -1
- package/dist/runtime/internal/routes/scalar.mjs +3 -3
- package/dist/runtime/internal/routes/swagger.mjs +7 -4
- package/dist/runtime/internal/runtime-config.d.mts +1 -1
- package/dist/runtime/internal/runtime-config.mjs +2 -2
- package/dist/runtime/internal/static.mjs +5 -4
- package/dist/runtime/internal/task.d.mts +3 -1
- package/dist/runtime/internal/task.mjs +7 -7
- package/dist/runtime/internal/vite/dev-entry.mjs +6 -3
- package/dist/runtime/internal/vite/dev-worker.mjs +264 -0
- package/dist/runtime/meta.d.mts +1 -0
- package/dist/runtime/meta.mjs +2 -0
- package/dist/runtime/nitro.d.mts +2 -0
- package/dist/runtime/nitro.mjs +4 -2
- package/dist/runtime/virtual/error-handler.mjs +1 -1
- package/dist/runtime/virtual/renderer-template.mjs +1 -1
- package/dist/runtime/virtual/server-assets.d.mts +2 -1
- package/dist/runtime/virtual/tracing.d.mts +5 -0
- package/dist/runtime/virtual/tracing.mjs +1 -0
- package/dist/runtime/vite.d.mts +1 -1
- package/dist/types/index.d.mts +215 -195
- package/dist/types/index.mjs +1 -11
- package/dist/vite.d.mts +3 -8
- package/dist/vite.mjs +285 -253
- package/lib/tsconfig.json +3 -5
- package/package.json +97 -80
- package/dist/_libs/confbox.mjs +0 -2509
- package/dist/_libs/nypm+giget+tinyexec.mjs +0 -3603
- package/dist/_libs/rc9+c12+dotenv.mjs +0 -972
- package/dist/node_modules/hookable/dist/index.mjs +0 -266
- package/dist/node_modules/hookable/package.json +0 -52
- package/dist/node_modules/youch/build/chunk-4L7RY2JA.js +0 -42
- package/dist/node_modules/youch/build/chunk-7QV3D5YX.js +0 -83
- package/dist/node_modules/youch/build/chunk-AUGPHE32.js +0 -39
- package/dist/node_modules/youch/build/chunk-CM7DWJNZ.js +0 -44
- package/dist/node_modules/youch/build/chunk-EJH674NB.js +0 -223
- package/dist/node_modules/youch/build/chunk-OIJ3WD7L.js +0 -81
- package/dist/node_modules/youch/build/chunk-P36L72PL.js +0 -87
- package/dist/node_modules/youch/build/chunk-PE3GG3TN.js +0 -65
- package/dist/node_modules/youch/build/chunk-X53OIOJH.js +0 -70
- package/dist/presets/_nitro/runtime/nitro-dev.d.mts +0 -2
- package/dist/presets/_nitro/runtime/nitro-prerenderer.d.mts +0 -3
- package/dist/presets/_nitro/runtime/service-worker.d.mts +0 -2
- package/dist/presets/aws-amplify/runtime/aws-amplify.d.mts +0 -2
- package/dist/presets/aws-lambda/runtime/_utils.d.mts +0 -8
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.d.mts +0 -2
- package/dist/presets/aws-lambda/runtime/aws-lambda.d.mts +0 -3
- package/dist/presets/azure/runtime/_utils.d.mts +0 -2
- package/dist/presets/azure/runtime/azure-swa.d.mts +0 -5
- package/dist/presets/bun/runtime/bun.d.mts +0 -3
- package/dist/presets/cloudflare/runtime/_module-handler.d.mts +0 -16
- package/dist/presets/cloudflare/runtime/cloudflare-durable.d.mts +0 -11
- package/dist/presets/cloudflare/runtime/cloudflare-module.d.mts +0 -3
- package/dist/presets/cloudflare/runtime/cloudflare-pages.d.mts +0 -20
- package/dist/presets/cloudflare/runtime/plugin.dev.d.mts +0 -3
- package/dist/presets/deno/runtime/deno-deploy.d.mts +0 -5
- package/dist/presets/deno/runtime/deno-server.d.mts +0 -3
- package/dist/presets/netlify/runtime/netlify-edge.d.mts +0 -3
- package/dist/presets/netlify/runtime/netlify.d.mts +0 -4
- package/dist/presets/node/runtime/node-cluster.d.mts +0 -3
- package/dist/presets/node/runtime/node-middleware.d.mts +0 -3
- package/dist/presets/node/runtime/node-server.d.mts +0 -3
- package/dist/presets/standard/runtime/server.d.mts +0 -3
- package/dist/presets/stormkit/runtime/stormkit.d.mts +0 -21
- package/dist/presets/vercel/runtime/isr.d.mts +0 -2
- package/dist/presets/vercel/runtime/vercel.node.d.mts +0 -3
- package/dist/presets/vercel/runtime/vercel.web.d.mts +0 -8
- package/dist/presets/winterjs/runtime/winterjs.d.mts +0 -2
- package/dist/presets/zeabur/runtime/zeabur.d.mts +0 -3
- package/dist/runtime/internal/vite/node-runner.mjs +0 -359
package/dist/_build/rolldown.mjs
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import { _ as writeTypes, at as join, d as libChunkName, f as baseBuildConfig, h as writeBuildInfo, l as NODE_MODULES_RE, n as baseBuildPlugins, st as relative, u as getChunkName } from "./common.mjs";
|
|
3
|
-
import { i as debounce } from "../_libs/rc9+c12+dotenv.mjs";
|
|
1
|
+
import { _ as writeTypes, ct as join, d as libChunkName, f as baseBuildConfig, h as writeBuildInfo, it as basename, l as NODE_MODULES_RE, n as baseBuildPlugins, u as getChunkName, ut as relative } from "./common.mjs";
|
|
4
2
|
import { t as formatCompatibilityDate } from "../_libs/compatx.mjs";
|
|
5
3
|
import { n as scanHandlers } from "../_chunks/nitro2.mjs";
|
|
6
|
-
import { n as watch
|
|
7
|
-
import { t as
|
|
4
|
+
import { n as watch } from "../_libs/readdirp+chokidar.mjs";
|
|
5
|
+
import { t as debounce } from "../_libs/perfect-debounce.mjs";
|
|
6
|
+
import { n as generateFSTree } from "../_chunks/utils.mjs";
|
|
8
7
|
import { builtinModules } from "node:module";
|
|
9
|
-
import { watch } from "node:fs";
|
|
10
8
|
import { defu } from "defu";
|
|
11
|
-
|
|
12
|
-
//#region src/build/rolldown/config.ts
|
|
13
9
|
const getRolldownConfig = async (nitro) => {
|
|
14
10
|
const base = baseBuildConfig(nitro);
|
|
15
11
|
const tsc = nitro.options.typescript.tsConfig?.compilerOptions;
|
|
@@ -44,9 +40,6 @@ const getRolldownConfig = async (nitro) => {
|
|
|
44
40
|
warn(warning);
|
|
45
41
|
}
|
|
46
42
|
},
|
|
47
|
-
treeshake: { moduleSideEffects(id) {
|
|
48
|
-
return nitro.options.moduleSideEffects.some((p) => id.startsWith(p));
|
|
49
|
-
} },
|
|
50
43
|
optimization: { inlineConst: true },
|
|
51
44
|
output: {
|
|
52
45
|
format: "esm",
|
|
@@ -67,12 +60,12 @@ const getRolldownConfig = async (nitro) => {
|
|
|
67
60
|
};
|
|
68
61
|
config = defu(nitro.options.rolldownConfig, nitro.options.rollupConfig, config);
|
|
69
62
|
const outputConfig = config.output;
|
|
70
|
-
if (outputConfig.inlineDynamicImports || outputConfig.format === "iife")
|
|
63
|
+
if (outputConfig.inlineDynamicImports || outputConfig.format === "iife") {
|
|
64
|
+
delete outputConfig.inlineDynamicImports;
|
|
65
|
+
outputConfig.codeSplitting = false;
|
|
66
|
+
}
|
|
71
67
|
return config;
|
|
72
68
|
};
|
|
73
|
-
|
|
74
|
-
//#endregion
|
|
75
|
-
//#region src/build/rolldown/dev.ts
|
|
76
69
|
async function watchDev(nitro, config) {
|
|
77
70
|
const rolldown = await import("rolldown");
|
|
78
71
|
let watcher;
|
|
@@ -97,11 +90,15 @@ async function watchDev(nitro, config) {
|
|
|
97
90
|
"unlink",
|
|
98
91
|
"unlinkDir"
|
|
99
92
|
]);
|
|
100
|
-
const scanDirsWatcher = watch
|
|
93
|
+
const scanDirsWatcher = watch(scanDirs, { ignoreInitial: true }).on("all", (event) => {
|
|
101
94
|
if (watchReloadEvents.has(event)) reload();
|
|
102
95
|
});
|
|
103
|
-
const
|
|
104
|
-
|
|
96
|
+
const serverEntryRe = /^server\.[mc]?[jt]sx?$/;
|
|
97
|
+
const rootDirWatcher = watch(nitro.options.rootDir, {
|
|
98
|
+
ignoreInitial: true,
|
|
99
|
+
depth: 0
|
|
100
|
+
}).on("all", (event, path) => {
|
|
101
|
+
if (watchReloadEvents.has(event) && serverEntryRe.test(basename(path))) reload();
|
|
105
102
|
});
|
|
106
103
|
nitro.hooks.hook("close", () => {
|
|
107
104
|
watcher.close();
|
|
@@ -109,43 +106,41 @@ async function watchDev(nitro, config) {
|
|
|
109
106
|
rootDirWatcher.close();
|
|
110
107
|
});
|
|
111
108
|
nitro.hooks.hook("rollup:reload", () => reload());
|
|
109
|
+
nitro.logger.info(`Starting dev watcher (builder: \`rolldown\`, preset: \`${nitro.options.preset}\`, compatibility date: \`${formatCompatibilityDate(nitro.options.compatibilityDate)}\`)`);
|
|
112
110
|
await load();
|
|
113
|
-
function startWatcher(nitro
|
|
114
|
-
const watcher
|
|
111
|
+
function startWatcher(nitro, config) {
|
|
112
|
+
const watcher = rolldown.watch(config);
|
|
115
113
|
let start;
|
|
116
|
-
watcher
|
|
114
|
+
watcher.on("event", (event) => {
|
|
117
115
|
switch (event.code) {
|
|
118
116
|
case "START":
|
|
119
117
|
start = Date.now();
|
|
120
|
-
nitro
|
|
121
|
-
nitro$1.hooks.callHook("dev:start");
|
|
118
|
+
nitro.hooks.callHook("dev:start");
|
|
122
119
|
break;
|
|
123
120
|
case "BUNDLE_END":
|
|
124
|
-
nitro
|
|
125
|
-
if (nitro
|
|
126
|
-
nitro
|
|
121
|
+
nitro.hooks.callHook("compiled", nitro);
|
|
122
|
+
if (nitro.options.logging.buildSuccess) nitro.logger.success(`Server built`, start ? `in ${Date.now() - start}ms` : "");
|
|
123
|
+
nitro.hooks.callHook("dev:reload");
|
|
127
124
|
break;
|
|
128
125
|
case "ERROR":
|
|
129
|
-
nitro
|
|
130
|
-
nitro
|
|
126
|
+
nitro.logger.error(event.error);
|
|
127
|
+
nitro.hooks.callHook("dev:error", event.error);
|
|
131
128
|
}
|
|
132
129
|
});
|
|
133
|
-
return watcher
|
|
130
|
+
return watcher;
|
|
134
131
|
}
|
|
135
132
|
}
|
|
136
|
-
|
|
137
|
-
//#endregion
|
|
138
|
-
//#region src/build/rolldown/prod.ts
|
|
139
133
|
async function buildProduction(nitro, config) {
|
|
140
134
|
const rolldown = await import("rolldown");
|
|
141
135
|
const buildStartTime = Date.now();
|
|
142
136
|
await scanHandlers(nitro);
|
|
143
137
|
await writeTypes(nitro);
|
|
138
|
+
let output;
|
|
144
139
|
if (!nitro.options.static) {
|
|
145
140
|
nitro.logger.info(`Building server (builder: \`rolldown\`, preset: \`${nitro.options.preset}\`, compatibility date: \`${formatCompatibilityDate(nitro.options.compatibilityDate)}\`)`);
|
|
146
|
-
await (await rolldown.rolldown(config)).write(config.output);
|
|
141
|
+
output = await (await rolldown.rolldown(config)).write(config.output);
|
|
147
142
|
}
|
|
148
|
-
const buildInfo = await writeBuildInfo(nitro);
|
|
143
|
+
const buildInfo = await writeBuildInfo(nitro, output);
|
|
149
144
|
if (!nitro.options.static) {
|
|
150
145
|
if (nitro.options.logging.buildSuccess) nitro.logger.success(`Server built in ${Date.now() - buildStartTime}ms`);
|
|
151
146
|
if (nitro.options.logLevel > 1) process.stdout.write(await generateFSTree(nitro.options.output.serverDir, { compressedSizes: nitro.options.logging.compressedSizes }) || "");
|
|
@@ -155,18 +150,13 @@ async function buildProduction(nitro, config) {
|
|
|
155
150
|
const rewriteRelativePaths = (input) => {
|
|
156
151
|
return input.replace(/([\s:])\.\/(\S*)/g, `$1${rOutput}/$2`);
|
|
157
152
|
};
|
|
158
|
-
|
|
159
|
-
if (buildInfo.commands.deploy) nitro.logger.success(
|
|
153
|
+
nitro.logger.success("You can preview this build using `npx nitro preview`");
|
|
154
|
+
if (buildInfo.commands.deploy) nitro.logger.success(rewriteRelativePaths("You can deploy this build using `npx nitro deploy --prebuilt`"));
|
|
160
155
|
}
|
|
161
|
-
|
|
162
|
-
//#endregion
|
|
163
|
-
//#region src/build/rolldown/build.ts
|
|
164
156
|
async function rolldownBuild(nitro) {
|
|
165
157
|
await nitro.hooks.callHook("build:before", nitro);
|
|
166
158
|
const config = await getRolldownConfig(nitro);
|
|
167
159
|
await nitro.hooks.callHook("rollup:before", nitro, config);
|
|
168
160
|
return nitro.options.dev ? watchDev(nitro, config) : buildProduction(nitro, config);
|
|
169
161
|
}
|
|
170
|
-
|
|
171
|
-
//#endregion
|
|
172
|
-
export { rolldownBuild };
|
|
162
|
+
export { rolldownBuild };
|
package/dist/_build/rollup.mjs
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import { _ as writeTypes, at as join, d as libChunkName, f as baseBuildConfig, h as writeBuildInfo, it as isAbsolute, l as NODE_MODULES_RE, n as baseBuildPlugins, st as relative, t as oxc, u as getChunkName } from "./common.mjs";
|
|
3
|
-
import { i as debounce } from "../_libs/rc9+c12+dotenv.mjs";
|
|
1
|
+
import { _ as writeTypes, ct as join, d as libChunkName, f as baseBuildConfig, h as writeBuildInfo, it as basename, l as NODE_MODULES_RE, n as baseBuildPlugins, st as isAbsolute, t as oxc, u as getChunkName, ut as relative } from "./common.mjs";
|
|
4
2
|
import { t as formatCompatibilityDate } from "../_libs/compatx.mjs";
|
|
5
3
|
import { n as scanHandlers } from "../_chunks/nitro2.mjs";
|
|
6
|
-
import { n as watch
|
|
4
|
+
import { n as watch } from "../_libs/readdirp+chokidar.mjs";
|
|
5
|
+
import { t as debounce } from "../_libs/perfect-debounce.mjs";
|
|
7
6
|
import { t as alias } from "../_libs/plugin-alias.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { t as inject } from "../_libs/plugin-inject.mjs";
|
|
8
|
+
import { n as generateFSTree } from "../_chunks/utils.mjs";
|
|
10
9
|
import { t as commonjs } from "../_libs/commondir+is-reference.mjs";
|
|
11
10
|
import { t as json } from "../_libs/plugin-json.mjs";
|
|
12
11
|
import { t as nodeResolve } from "../_libs/hasown+resolve+deepmerge.mjs";
|
|
13
|
-
import { watch } from "node:fs";
|
|
14
12
|
import { defu } from "defu";
|
|
15
|
-
|
|
16
|
-
//#region src/build/rollup/config.ts
|
|
17
13
|
const getRollupConfig = async (nitro) => {
|
|
18
14
|
const base = baseBuildConfig(nitro);
|
|
19
15
|
const tsc = nitro.options.typescript.tsConfig?.compilerOptions;
|
|
@@ -22,7 +18,7 @@ const getRollupConfig = async (nitro) => {
|
|
|
22
18
|
external: [...base.env.external],
|
|
23
19
|
plugins: [
|
|
24
20
|
...await baseBuildPlugins(nitro, base),
|
|
25
|
-
oxc({
|
|
21
|
+
await oxc({
|
|
26
22
|
sourcemap: !!nitro.options.sourcemap,
|
|
27
23
|
minify: nitro.options.minify ? { ...nitro.options.oxc?.minify } : false,
|
|
28
24
|
transform: {
|
|
@@ -53,9 +49,6 @@ const getRollupConfig = async (nitro) => {
|
|
|
53
49
|
onwarn(warning, rollupWarn) {
|
|
54
50
|
if (!base.ignoreWarningCodes.has(warning.code || "")) rollupWarn(warning);
|
|
55
51
|
},
|
|
56
|
-
treeshake: { moduleSideEffects(id) {
|
|
57
|
-
return nitro.options.moduleSideEffects.some((p) => id.startsWith(p));
|
|
58
|
-
} },
|
|
59
52
|
output: {
|
|
60
53
|
format: "esm",
|
|
61
54
|
entryFileNames: "index.mjs",
|
|
@@ -76,9 +69,6 @@ const getRollupConfig = async (nitro) => {
|
|
|
76
69
|
if (outputConfig.inlineDynamicImports || outputConfig.format === "iife") delete outputConfig.manualChunks;
|
|
77
70
|
return config;
|
|
78
71
|
};
|
|
79
|
-
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region src/build/rollup/error.ts
|
|
82
72
|
function formatRollupError(_error) {
|
|
83
73
|
try {
|
|
84
74
|
const logs = [_error.toString()];
|
|
@@ -96,9 +86,6 @@ function formatRollupError(_error) {
|
|
|
96
86
|
return _error?.toString();
|
|
97
87
|
}
|
|
98
88
|
}
|
|
99
|
-
|
|
100
|
-
//#endregion
|
|
101
|
-
//#region src/build/rollup/dev.ts
|
|
102
89
|
async function watchDev(nitro, rollupConfig) {
|
|
103
90
|
const rollup = await import("rollup");
|
|
104
91
|
let rollupWatcher;
|
|
@@ -123,11 +110,15 @@ async function watchDev(nitro, rollupConfig) {
|
|
|
123
110
|
"unlink",
|
|
124
111
|
"unlinkDir"
|
|
125
112
|
]);
|
|
126
|
-
const scanDirsWatcher = watch
|
|
113
|
+
const scanDirsWatcher = watch(scanDirs, { ignoreInitial: true }).on("all", (event, path, stat) => {
|
|
127
114
|
if (watchReloadEvents.has(event)) reload();
|
|
128
115
|
});
|
|
129
|
-
const
|
|
130
|
-
|
|
116
|
+
const serverEntryRe = /^server\.[mc]?[jt]sx?$/;
|
|
117
|
+
const rootDirWatcher = watch(nitro.options.rootDir, {
|
|
118
|
+
ignoreInitial: true,
|
|
119
|
+
depth: 0
|
|
120
|
+
}).on("all", (event, path) => {
|
|
121
|
+
if (watchReloadEvents.has(event) && serverEntryRe.test(basename(path))) reload();
|
|
131
122
|
});
|
|
132
123
|
nitro.hooks.hook("close", () => {
|
|
133
124
|
rollupWatcher.close();
|
|
@@ -135,67 +126,56 @@ async function watchDev(nitro, rollupConfig) {
|
|
|
135
126
|
rootDirWatcher.close();
|
|
136
127
|
});
|
|
137
128
|
nitro.hooks.hook("rollup:reload", () => reload());
|
|
129
|
+
nitro.logger.info(`Starting dev watcher (builder: \`rollup\`, preset: \`${nitro.options.preset}\`, compatibility date: \`${formatCompatibilityDate(nitro.options.compatibilityDate)}\`)`);
|
|
138
130
|
await load();
|
|
139
|
-
function startRollupWatcher(nitro
|
|
140
|
-
const watcher = rollup.watch(defu(rollupConfig
|
|
131
|
+
function startRollupWatcher(nitro, rollupConfig) {
|
|
132
|
+
const watcher = rollup.watch(defu(rollupConfig, { watch: { chokidar: nitro.options.watchOptions } }));
|
|
141
133
|
let start;
|
|
142
134
|
watcher.on("event", (event) => {
|
|
143
135
|
switch (event.code) {
|
|
144
136
|
case "START":
|
|
145
137
|
start = Date.now();
|
|
146
|
-
nitro
|
|
147
|
-
nitro$1.hooks.callHook("dev:start");
|
|
138
|
+
nitro.hooks.callHook("dev:start");
|
|
148
139
|
break;
|
|
149
140
|
case "BUNDLE_END":
|
|
150
|
-
nitro
|
|
151
|
-
if (nitro
|
|
152
|
-
nitro
|
|
141
|
+
nitro.hooks.callHook("compiled", nitro);
|
|
142
|
+
if (nitro.options.logging.buildSuccess) nitro.logger.success(`Server built`, start ? `in ${Date.now() - start}ms` : "");
|
|
143
|
+
nitro.hooks.callHook("dev:reload");
|
|
153
144
|
break;
|
|
154
145
|
case "ERROR":
|
|
155
|
-
nitro
|
|
156
|
-
nitro
|
|
146
|
+
nitro.logger.error(formatRollupError(event.error));
|
|
147
|
+
nitro.hooks.callHook("dev:error", event.error);
|
|
157
148
|
}
|
|
158
149
|
});
|
|
159
150
|
return watcher;
|
|
160
151
|
}
|
|
161
152
|
}
|
|
162
|
-
|
|
163
|
-
//#endregion
|
|
164
|
-
//#region src/build/rollup/prod.ts
|
|
165
153
|
async function buildProduction(nitro, rollupConfig) {
|
|
166
154
|
const rollup = await import("rollup");
|
|
167
155
|
const buildStartTime = Date.now();
|
|
168
156
|
await scanHandlers(nitro);
|
|
169
157
|
await writeTypes(nitro);
|
|
158
|
+
let output;
|
|
170
159
|
if (!nitro.options.static) {
|
|
171
160
|
nitro.logger.info(`Building server (builder: \`rollup\`, preset: \`${nitro.options.preset}\`, compatibility date: \`${formatCompatibilityDate(nitro.options.compatibilityDate)}\`)`);
|
|
172
|
-
await (await rollup.rollup(rollupConfig).catch((error) => {
|
|
161
|
+
output = await (await rollup.rollup(rollupConfig).catch((error) => {
|
|
173
162
|
nitro.logger.error(formatRollupError(error));
|
|
174
163
|
throw error;
|
|
175
164
|
})).write(rollupConfig.output);
|
|
176
165
|
}
|
|
177
|
-
const buildInfo = await writeBuildInfo(nitro);
|
|
166
|
+
const buildInfo = await writeBuildInfo(nitro, output);
|
|
178
167
|
if (!nitro.options.static) {
|
|
179
168
|
if (nitro.options.logging.buildSuccess) nitro.logger.success(`Server built in ${Date.now() - buildStartTime}ms`);
|
|
180
169
|
if (nitro.options.logLevel > 1) process.stdout.write(await generateFSTree(nitro.options.output.serverDir, { compressedSizes: nitro.options.logging.compressedSizes }) || "");
|
|
181
170
|
}
|
|
182
171
|
await nitro.hooks.callHook("compiled", nitro);
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
return input.replace(/([\s:])\.\/(\S*)/g, `$1${rOutput}/$2`);
|
|
186
|
-
};
|
|
187
|
-
if (buildInfo.commands.preview) nitro.logger.success(`You can preview this build using \`${rewriteRelativePaths(buildInfo.commands.preview)}\``);
|
|
188
|
-
if (buildInfo.commands.deploy) nitro.logger.success(`You can deploy this build using \`${rewriteRelativePaths(buildInfo.commands.deploy)}\``);
|
|
172
|
+
nitro.logger.success("You can preview this build using `npx nitro preview`");
|
|
173
|
+
if (buildInfo.commands.deploy) nitro.logger.success("You can deploy this build using `npx nitro deploy --prebuilt`");
|
|
189
174
|
}
|
|
190
|
-
|
|
191
|
-
//#endregion
|
|
192
|
-
//#region src/build/rollup/build.ts
|
|
193
175
|
async function rollupBuild(nitro) {
|
|
194
176
|
await nitro.hooks.callHook("build:before", nitro);
|
|
195
177
|
const config = await getRollupConfig(nitro);
|
|
196
178
|
await nitro.hooks.callHook("rollup:before", nitro, config);
|
|
197
179
|
return nitro.options.dev ? watchDev(nitro, config) : buildProduction(nitro, config);
|
|
198
180
|
}
|
|
199
|
-
|
|
200
|
-
//#endregion
|
|
201
|
-
export { rollupBuild };
|
|
181
|
+
export { rollupBuild };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { H as v } from "./common.mjs";
|
|
2
2
|
import { nitro } from "nitro/vite";
|
|
3
|
-
|
|
4
|
-
//#region src/build/vite/build.ts
|
|
5
3
|
async function viteBuild(nitro$1) {
|
|
6
4
|
if (nitro$1.options.dev) throw new Error("Nitro dev CLI does not supports vite. Please use `vite dev` instead.");
|
|
7
5
|
const { createBuilder } = await import(nitro$1.options.__vitePkg__ || "vite");
|
|
8
|
-
|
|
6
|
+
const pluginInstance = nitro({ _nitro: nitro$1 });
|
|
7
|
+
globalThis.__nitro_build__ = true;
|
|
8
|
+
const builder = await createBuilder({
|
|
9
9
|
base: nitro$1.options.rootDir,
|
|
10
|
-
plugins: [
|
|
11
|
-
logLevel:
|
|
12
|
-
})
|
|
10
|
+
plugins: [pluginInstance],
|
|
11
|
+
logLevel: v ? "warn" : void 0
|
|
12
|
+
});
|
|
13
|
+
delete globalThis.__nitro_build__;
|
|
14
|
+
await builder.buildApp();
|
|
13
15
|
}
|
|
14
|
-
|
|
15
|
-
//#endregion
|
|
16
|
-
export { viteBuild };
|
|
16
|
+
export { viteBuild };
|