nitro 3.0.1-alpha.1 → 3.0.260311-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 +4 -2
- package/dist/THIRD-PARTY-LICENSES.md +1646 -0
- package/dist/_build/common.mjs +29347 -54
- package/dist/_build/rolldown.mjs +53 -86
- package/dist/_build/rollup.mjs +42 -137
- package/dist/_build/vite.build.mjs +12 -50
- package/dist/_chunks/{B-D1JOIz.mjs → nitro.mjs} +211 -407
- package/dist/_chunks/nitro2.mjs +102 -0
- package/dist/_chunks/nitro3.mjs +129 -0
- package/dist/_chunks/utils.mjs +272 -0
- package/dist/{_chunks/Bqks5huO.mjs → _common.mjs} +11 -7
- package/dist/_dev.mjs +140 -326
- package/dist/_libs/_.mjs +3 -0
- package/dist/_libs/_2.mjs +2 -0
- package/dist/_libs/_3.mjs +3 -0
- package/dist/_libs/_4.mjs +2 -0
- package/dist/_libs/_5.mjs +3 -0
- package/dist/_libs/_6.mjs +4 -0
- package/dist/_libs/_7.mjs +5 -0
- package/dist/_libs/c12+rc9.mjs +812 -0
- package/dist/_libs/c12+readdirp+chokidar.d.mts +230 -0
- package/dist/_libs/citty.mjs +141 -113
- package/dist/_libs/{plugin-commonjs.mjs → commondir+is-reference.mjs} +79 -259
- package/dist/_libs/compatx.d.mts +47 -0
- package/dist/_libs/compatx.mjs +1 -2
- package/dist/_libs/esbuild.d.mts +20 -0
- package/dist/_libs/escape-string-regexp.mjs +1 -2
- package/dist/_libs/estree+pluginutils.d.mts +241 -0
- package/dist/_libs/estree-walker.mjs +1 -147
- package/dist/_libs/exsolve.d.mts +1 -0
- package/dist/_libs/{plugin-node-resolve.mjs → hasown+resolve+deepmerge.mjs} +612 -216
- package/dist/_libs/httpxy.d.mts +82 -0
- package/dist/_libs/httpxy.mjs +299 -38
- package/dist/_libs/js-tokens.d.mts +1 -0
- package/dist/_libs/klona.mjs +1 -2
- package/dist/_libs/magic-string.d.mts +220 -0
- package/dist/_libs/mlly.d.mts +57 -0
- package/dist/_libs/nypm+tinyexec.mjs +845 -0
- package/dist/_libs/perfect-debounce.mjs +88 -0
- package/dist/_libs/pkg-types.d.mts +23 -0
- package/dist/_libs/plugin-alias.mjs +4 -4
- package/dist/_libs/plugin-inject.mjs +3 -7
- package/dist/_libs/plugin-json.mjs +3 -5
- package/dist/_libs/{vite-plugin-fullstack.mjs → pluginutils.mjs} +241 -156
- package/dist/_libs/{chokidar.mjs → readdirp+chokidar.mjs} +268 -223
- package/dist/_libs/remapping.mjs +2 -4
- package/dist/_libs/{gen-mapping.mjs → resolve-uri+gen-mapping.mjs} +16 -186
- package/dist/_libs/rou3.d.mts +44 -0
- package/dist/_libs/rou3.mjs +231 -54
- package/dist/_libs/std-env.d.mts +12 -0
- package/dist/_libs/strip-literal.d.mts +1 -0
- package/dist/_libs/tsconfck.mjs +20 -39
- package/dist/_libs/ultrahtml.mjs +3 -14
- package/dist/_libs/unimport+unplugin.mjs +1684 -0
- package/dist/_libs/unplugin+unimport.d.mts +423 -0
- package/dist/_libs/unwasm.d.mts +29 -0
- package/dist/_presets.mjs +475 -468
- package/dist/builder.d.mts +8 -7
- package/dist/builder.mjs +7 -25
- package/dist/cli/_chunks/build.mjs +22 -23
- package/dist/cli/_chunks/common.mjs +1 -2
- package/dist/cli/_chunks/deploy.mjs +40 -0
- package/dist/cli/_chunks/dev.mjs +9 -15
- package/dist/cli/_chunks/docs.mjs +30 -0
- package/dist/cli/_chunks/list.mjs +4 -6
- package/dist/cli/_chunks/prepare.mjs +2 -4
- package/dist/cli/_chunks/preview.mjs +51 -0
- package/dist/cli/_chunks/run.mjs +7 -9
- package/dist/cli/_chunks/task.mjs +1 -3
- package/dist/cli/index.mjs +5 -4
- package/dist/node_modules/@poppinss/colors/build/index.js +130 -160
- package/dist/node_modules/@poppinss/colors/package.json +20 -18
- 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/@poppinss/exception/build/index.js +36 -55
- package/dist/node_modules/@poppinss/exception/package.json +19 -16
- package/dist/node_modules/@sindresorhus/is/distribution/index.js +46 -5
- package/dist/node_modules/@sindresorhus/is/package.json +1 -1
- 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 +2 -2
- package/dist/node_modules/croner/dist/croner.js +1 -1
- package/dist/node_modules/croner/package.json +11 -1
- package/dist/node_modules/ufo/dist/index.mjs +16 -9
- package/dist/node_modules/ufo/package.json +15 -14
- package/dist/node_modules/unctx/package.json +16 -16
- package/dist/node_modules/youch/build/helpers-B9BQYaS6.js +23 -0
- package/dist/node_modules/youch/build/index.js +204 -352
- package/dist/node_modules/youch/build/public/error_info/script.js +1 -1
- package/dist/node_modules/youch/build/public/error_info/style.css +1 -0
- package/dist/node_modules/youch/build/public/error_metadata/style.css +3 -0
- package/dist/node_modules/youch/build/public/error_stack/style.css +2 -3
- 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 +34 -31
- package/dist/presets/_nitro/runtime/nitro-dev.mjs +13 -61
- package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +2 -1
- package/dist/presets/_nitro/runtime/service-worker.mjs +2 -3
- package/dist/presets/aws-amplify/runtime/aws-amplify.mjs +1 -1
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +11 -11
- package/dist/presets/aws-lambda/runtime/aws-lambda.mjs +1 -1
- package/dist/presets/azure/runtime/azure-swa.mjs +1 -1
- package/dist/presets/bun/runtime/bun.mjs +11 -11
- package/dist/presets/cloudflare/runtime/_module-handler.mjs +19 -17
- package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +17 -16
- package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +8 -9
- package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +12 -18
- package/dist/presets/deno/runtime/deno-deploy.mjs +4 -5
- package/dist/presets/deno/runtime/deno-server.mjs +9 -9
- package/dist/presets/netlify/runtime/netlify-edge.mjs +3 -3
- package/dist/presets/netlify/runtime/netlify.mjs +3 -1
- package/dist/presets/node/runtime/node-cluster.mjs +8 -8
- package/dist/presets/node/runtime/node-middleware.mjs +4 -5
- package/dist/presets/node/runtime/node-server.mjs +8 -8
- package/dist/presets/standard/runtime/server.mjs +1 -1
- package/dist/presets/stormkit/runtime/stormkit.mjs +1 -2
- package/dist/presets/vercel/runtime/cron-handler.mjs +25 -0
- package/dist/presets/vercel/runtime/isr.mjs +19 -0
- package/dist/presets/vercel/runtime/vercel.node.mjs +16 -7
- package/dist/presets/vercel/runtime/vercel.web.mjs +14 -11
- package/dist/presets/winterjs/runtime/winterjs.mjs +1 -1
- package/dist/presets/zeabur/runtime/zeabur.mjs +1 -1
- package/dist/presets/zephyr/runtime/server.mjs +3 -0
- package/dist/runtime/app.d.mts +1 -1
- package/dist/runtime/app.mjs +1 -1
- package/dist/runtime/internal/app.d.mts +7 -3
- package/dist/runtime/internal/app.mjs +29 -22
- 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/database.mjs +1 -1
- package/dist/runtime/internal/error/dev.d.mts +5 -5
- package/dist/runtime/internal/error/dev.mjs +39 -41
- 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 +9 -8
- package/dist/runtime/internal/route-rules.mjs +9 -1
- package/dist/runtime/internal/routes/dev-tasks.d.mts +3 -2
- package/dist/runtime/internal/routes/dev-tasks.mjs +7 -3
- package/dist/runtime/internal/routes/openapi.d.mts +0 -1
- package/dist/runtime/internal/routes/openapi.mjs +3 -3
- 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/renderer-template.dev.mjs +1 -1
- package/dist/runtime/internal/routes/renderer-template.mjs +1 -1
- package/dist/runtime/internal/routes/scalar.d.mts +0 -1
- package/dist/runtime/internal/routes/scalar.mjs +4 -4
- package/dist/runtime/internal/routes/swagger.d.mts +0 -1
- package/dist/runtime/internal/routes/swagger.mjs +3 -3
- package/dist/runtime/internal/runtime-config.d.mts +1 -1
- package/dist/runtime/internal/runtime-config.mjs +8 -8
- package/dist/runtime/internal/static.mjs +6 -5
- package/dist/runtime/internal/storage.mjs +1 -1
- package/dist/runtime/internal/task.d.mts +3 -1
- package/dist/runtime/internal/task.mjs +3 -3
- package/dist/runtime/internal/vite/dev-entry.mjs +8 -6
- package/dist/runtime/internal/vite/dev-worker.mjs +166 -216
- package/dist/runtime/meta.d.mts +1 -1
- package/dist/runtime/meta.mjs +2 -1
- package/dist/runtime/nitro.d.mts +2 -3
- package/dist/runtime/nitro.mjs +3 -1
- package/dist/runtime/virtual/_runtime_warn.d.mts +1 -0
- package/dist/runtime/virtual/_runtime_warn.mjs +5 -0
- package/dist/runtime/virtual/database.d.mts +8 -0
- package/dist/runtime/virtual/database.mjs +2 -0
- package/dist/runtime/virtual/error-handler.d.mts +6 -0
- package/dist/runtime/virtual/error-handler.mjs +9 -0
- package/dist/runtime/virtual/feature-flags.d.mts +7 -0
- package/dist/runtime/virtual/feature-flags.mjs +7 -0
- package/dist/runtime/virtual/plugins.d.mts +3 -0
- package/dist/runtime/virtual/plugins.mjs +2 -0
- package/dist/{presets/_nitro/runtime/nitro-prerenderer.d.mts → runtime/virtual/polyfills.d.mts} +1 -1
- package/dist/runtime/virtual/polyfills.mjs +2 -0
- package/dist/runtime/virtual/public-assets.d.mts +9 -0
- package/dist/runtime/virtual/public-assets.mjs +8 -0
- package/dist/runtime/virtual/renderer-template.d.mts +4 -0
- package/dist/runtime/virtual/renderer-template.mjs +7 -0
- package/dist/runtime/virtual/routing-meta.d.mts +7 -0
- package/dist/runtime/virtual/routing-meta.mjs +2 -0
- package/dist/runtime/virtual/routing.d.mts +8 -0
- package/dist/runtime/virtual/routing.mjs +11 -0
- package/dist/runtime/virtual/runtime-config.d.mts +3 -0
- package/dist/runtime/virtual/runtime-config.mjs +5 -0
- package/dist/runtime/virtual/server-assets.d.mts +7 -0
- package/dist/runtime/virtual/server-assets.mjs +12 -0
- package/dist/runtime/virtual/storage.d.mts +3 -0
- package/dist/runtime/virtual/storage.mjs +5 -0
- package/dist/runtime/virtual/tasks.d.mts +10 -0
- package/dist/runtime/virtual/tasks.mjs +3 -0
- package/dist/runtime/{vite-runtime.d.mts → vite.d.mts} +1 -1
- package/dist/types/index.d.mts +315 -443
- package/dist/types/index.mjs +1 -1
- package/dist/vite.d.mts +10 -15
- package/dist/vite.mjs +733 -37
- package/lib/vite.types.d.mts +26 -0
- package/lib/vite.types.mjs +2 -0
- package/package.json +129 -85
- package/skills/nitro/SKILL.md +10 -0
- package/skills/nitro/docs/TOC.md +83 -0
- package/skills/nitro/docs/_navigation.json +679 -0
- package/skills/nitro/docs/config/index.md +1147 -0
- package/skills/nitro/docs/deploy/index.md +64 -0
- package/skills/nitro/docs/deploy/providers/alwaysdata.md +50 -0
- package/skills/nitro/docs/deploy/providers/aws-amplify.md +81 -0
- package/skills/nitro/docs/deploy/providers/aws.md +47 -0
- package/skills/nitro/docs/deploy/providers/azure.md +72 -0
- package/skills/nitro/docs/deploy/providers/cleavr.md +33 -0
- package/skills/nitro/docs/deploy/providers/cloudflare.md +375 -0
- package/skills/nitro/docs/deploy/providers/deno-deploy.md +66 -0
- package/skills/nitro/docs/deploy/providers/digitalocean.md +46 -0
- package/skills/nitro/docs/deploy/providers/firebase.md +32 -0
- package/skills/nitro/docs/deploy/providers/flightcontrol.md +67 -0
- package/skills/nitro/docs/deploy/providers/genezio.md +67 -0
- package/skills/nitro/docs/deploy/providers/github-pages.md +68 -0
- package/skills/nitro/docs/deploy/providers/gitlab-pages.md +37 -0
- package/skills/nitro/docs/deploy/providers/heroku.md +84 -0
- package/skills/nitro/docs/deploy/providers/iis.md +38 -0
- package/skills/nitro/docs/deploy/providers/koyeb.md +109 -0
- package/skills/nitro/docs/deploy/providers/netlify.md +47 -0
- package/skills/nitro/docs/deploy/providers/platform-sh.md +37 -0
- package/skills/nitro/docs/deploy/providers/render.md +37 -0
- package/skills/nitro/docs/deploy/providers/stormkit.md +24 -0
- package/skills/nitro/docs/deploy/providers/vercel.md +179 -0
- package/skills/nitro/docs/deploy/providers/zeabur.md +19 -0
- package/skills/nitro/docs/deploy/providers/zephyr.md +99 -0
- package/skills/nitro/docs/deploy/providers/zerops.md +102 -0
- package/skills/nitro/docs/deploy/runtimes/bun.md +15 -0
- package/skills/nitro/docs/deploy/runtimes/deno.md +19 -0
- package/skills/nitro/docs/deploy/runtimes/node.md +63 -0
- package/skills/nitro/docs/docs/assets.md +166 -0
- package/skills/nitro/docs/docs/cache.md +408 -0
- package/skills/nitro/docs/docs/configuration.md +256 -0
- package/skills/nitro/docs/docs/database.md +185 -0
- package/skills/nitro/docs/docs/index.md +56 -0
- package/skills/nitro/docs/docs/lifecycle.md +204 -0
- package/skills/nitro/docs/docs/migration.md +215 -0
- package/skills/nitro/docs/docs/nightly.md +31 -0
- package/skills/nitro/docs/docs/plugins.md +164 -0
- package/skills/nitro/docs/docs/quick-start.md +110 -0
- package/skills/nitro/docs/docs/renderer.md +322 -0
- package/skills/nitro/docs/docs/routing.md +711 -0
- package/skills/nitro/docs/docs/server-entry.md +239 -0
- package/skills/nitro/docs/docs/storage.md +261 -0
- package/skills/nitro/docs/docs/tasks.md +277 -0
- package/skills/nitro/docs/examples/api-routes.md +145 -0
- package/skills/nitro/docs/examples/auto-imports.md +93 -0
- package/skills/nitro/docs/examples/cached-handler.md +81 -0
- package/skills/nitro/docs/examples/custom-error-handler.md +98 -0
- package/skills/nitro/docs/examples/database.md +157 -0
- package/skills/nitro/docs/examples/elysia.md +70 -0
- package/skills/nitro/docs/examples/express.md +78 -0
- package/skills/nitro/docs/examples/fastify.md +79 -0
- package/skills/nitro/docs/examples/hello-world.md +68 -0
- package/skills/nitro/docs/examples/hono.md +74 -0
- package/skills/nitro/docs/examples/import-alias.md +100 -0
- package/skills/nitro/docs/examples/index.md +3 -0
- package/skills/nitro/docs/examples/middleware.md +91 -0
- package/skills/nitro/docs/examples/mono-jsx.md +68 -0
- package/skills/nitro/docs/examples/nano-jsx.md +70 -0
- package/skills/nitro/docs/examples/plugins.md +91 -0
- package/skills/nitro/docs/examples/renderer.md +113 -0
- package/skills/nitro/docs/examples/runtime-config.md +97 -0
- package/skills/nitro/docs/examples/server-fetch.md +87 -0
- package/skills/nitro/docs/examples/shiki.md +198 -0
- package/skills/nitro/docs/examples/virtual-routes.md +74 -0
- package/skills/nitro/docs/examples/vite-nitro-plugin.md +79 -0
- package/skills/nitro/docs/examples/vite-rsc.md +1041 -0
- package/skills/nitro/docs/examples/vite-ssr-html.md +217 -0
- package/skills/nitro/docs/examples/vite-ssr-preact.md +247 -0
- package/skills/nitro/docs/examples/vite-ssr-react.md +226 -0
- package/skills/nitro/docs/examples/vite-ssr-solid.md +256 -0
- package/skills/nitro/docs/examples/vite-ssr-tsr-react.md +442 -0
- package/skills/nitro/docs/examples/vite-ssr-tss-react.md +444 -0
- package/skills/nitro/docs/examples/vite-ssr-vue-router.md +616 -0
- package/skills/nitro/docs/examples/vite-trpc.md +335 -0
- package/skills/nitro/docs/examples/websocket.md +282 -0
- package/skills/nitro/docs/index.md +121 -0
- package/dist/_build/common2.mjs +0 -772
- package/dist/_build/vite.plugin.mjs +0 -768
- package/dist/_chunks/ANM1K1bE.mjs +0 -304
- package/dist/_chunks/BX9-zVkM.mjs +0 -59
- package/dist/_chunks/C7CbzoI1.mjs +0 -39
- package/dist/_libs/acorn.mjs +0 -5034
- package/dist/_libs/c12.mjs +0 -2858
- package/dist/_libs/commondir.mjs +0 -22
- package/dist/_libs/confbox.mjs +0 -2920
- package/dist/_libs/deepmerge.mjs +0 -86
- package/dist/_libs/dot-prop.mjs +0 -138
- package/dist/_libs/duplexer.mjs +0 -71
- package/dist/_libs/etag.mjs +0 -80
- package/dist/_libs/fdir.mjs +0 -514
- package/dist/_libs/function-bind.mjs +0 -63
- package/dist/_libs/giget.mjs +0 -19289
- package/dist/_libs/gzip-size.mjs +0 -21
- package/dist/_libs/hasown.mjs +0 -14
- package/dist/_libs/is-core-module.mjs +0 -220
- package/dist/_libs/is-module.mjs +0 -13
- package/dist/_libs/is-reference.mjs +0 -32
- package/dist/_libs/js-tokens.mjs +0 -382
- package/dist/_libs/knitwork.mjs +0 -124
- package/dist/_libs/local-pkg.mjs +0 -1686
- package/dist/_libs/magic-string.mjs +0 -939
- package/dist/_libs/mime.mjs +0 -1391
- package/dist/_libs/node-fetch-native.mjs +0 -173
- package/dist/_libs/path-parse.mjs +0 -47
- package/dist/_libs/pathe.mjs +0 -41
- package/dist/_libs/picomatch.mjs +0 -1673
- package/dist/_libs/plugin-replace.mjs +0 -104
- package/dist/_libs/pretty-bytes.mjs +0 -116
- package/dist/_libs/std-env.mjs +0 -158
- package/dist/_libs/strip-literal.mjs +0 -51
- package/dist/_libs/tinyglobby.mjs +0 -292
- package/dist/_libs/unimport.mjs +0 -3520
- package/dist/_libs/untyped.mjs +0 -271
- package/dist/_libs/unwasm.mjs +0 -5836
- package/dist/cli/_chunks/detect-acorn.mjs +0 -12
- package/dist/cli/_chunks/dist.mjs +0 -3
- package/dist/cli/_chunks/dist2.mjs +0 -3
- package/dist/cli/_chunks/dist3.mjs +0 -3
- package/dist/cli/_chunks/dist4.mjs +0 -4
- package/dist/cli/_chunks/dist5.mjs +0 -4
- package/dist/cli/_chunks/esm.mjs +0 -3
- package/dist/cli/_chunks/json5.mjs +0 -4
- package/dist/cli/_chunks/jsonc.mjs +0 -4
- package/dist/cli/_chunks/multipart-parser.mjs +0 -6
- package/dist/cli/_chunks/toml.mjs +0 -4
- package/dist/cli/_chunks/yaml.mjs +0 -4
- package/dist/node_modules/hookable/dist/index.mjs +0 -267
- package/dist/node_modules/hookable/package.json +0 -52
- package/dist/node_modules/kleur/index.js +0 -110
- package/dist/node_modules/youch/build/chunk-4L7RY2JA.js +0 -42
- package/dist/node_modules/youch/build/chunk-4XB2BYKC.js +0 -85
- package/dist/node_modules/youch/build/chunk-4YEN7HVQ.js +0 -61
- package/dist/node_modules/youch/build/chunk-EUJBVOYB.js +0 -83
- package/dist/node_modules/youch/build/chunk-F4I6KX4R.js +0 -46
- package/dist/node_modules/youch/build/chunk-HFSXRSKS.js +0 -85
- package/dist/node_modules/youch/build/chunk-OSUFJZHZ.js +0 -6
- package/dist/node_modules/youch/build/chunk-PINJDICN.js +0 -72
- package/dist/node_modules/youch/build/chunk-PUHGL6HA.js +0 -41
- package/dist/node_modules/youch/build/chunk-YYEJ3AGB.js +0 -225
- package/dist/presets/_nitro/runtime/nitro-dev.d.mts +0 -2
- 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 -13
- 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 -4
- package/dist/presets/netlify/runtime/netlify.d.mts +0 -3
- 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/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 -3
- package/dist/presets/zeabur/runtime/zeabur.d.mts +0 -3
- package/lib/deps/ofetch.mjs +0 -1
- package/lib/deps/ofetch.mts +0 -1
- /package/dist/runtime/{vite-runtime.mjs → vite.mjs} +0 -0
- /package/lib/{deps/h3.d.mts → h3.d.mts} +0 -0
- /package/lib/{deps/h3.mjs → h3.mjs} +0 -0
package/dist/_build/rolldown.mjs
CHANGED
|
@@ -1,54 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../_libs/gen-mapping.mjs";
|
|
3
|
-
import "../_libs/magic-string.mjs";
|
|
4
|
-
import "../_libs/acorn.mjs";
|
|
5
|
-
import "../_libs/confbox.mjs";
|
|
6
|
-
import { f as sanitizeFilePath } from "../_libs/local-pkg.mjs";
|
|
7
|
-
import "../_libs/js-tokens.mjs";
|
|
8
|
-
import "../_libs/strip-literal.mjs";
|
|
9
|
-
import "../_libs/unimport.mjs";
|
|
10
|
-
import "../_libs/picomatch.mjs";
|
|
11
|
-
import "../_libs/fdir.mjs";
|
|
12
|
-
import "../_libs/tinyglobby.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";
|
|
13
2
|
import { t as formatCompatibilityDate } from "../_libs/compatx.mjs";
|
|
14
|
-
import "../
|
|
15
|
-
import "../_libs/
|
|
16
|
-
import "../
|
|
17
|
-
import {
|
|
18
|
-
import "../_libs/mime.mjs";
|
|
19
|
-
import "../_libs/pathe.mjs";
|
|
20
|
-
import "../_libs/untyped.mjs";
|
|
21
|
-
import "../_libs/knitwork.mjs";
|
|
22
|
-
import { n as writeBuildInfo } from "./common.mjs";
|
|
23
|
-
import { i as watch$1 } from "../_libs/chokidar.mjs";
|
|
24
|
-
import "../_libs/estree-walker.mjs";
|
|
25
|
-
import "../_libs/plugin-commonjs.mjs";
|
|
26
|
-
import { n as baseBuildConfig, t as baseBuildPlugins } from "./common2.mjs";
|
|
27
|
-
import "../_libs/remapping.mjs";
|
|
28
|
-
import "../_libs/unwasm.mjs";
|
|
29
|
-
import "../_libs/plugin-replace.mjs";
|
|
30
|
-
import "../_libs/etag.mjs";
|
|
31
|
-
import "../_libs/duplexer.mjs";
|
|
32
|
-
import "../_libs/gzip-size.mjs";
|
|
33
|
-
import "../_libs/pretty-bytes.mjs";
|
|
34
|
-
import { t as generateFSTree } from "../_chunks/BX9-zVkM.mjs";
|
|
3
|
+
import { n as scanHandlers } from "../_chunks/nitro2.mjs";
|
|
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";
|
|
35
7
|
import { builtinModules } from "node:module";
|
|
36
|
-
import { watch } from "node:fs";
|
|
37
8
|
import { defu } from "defu";
|
|
38
|
-
import { runtimeDir } from "nitro/meta";
|
|
39
|
-
|
|
40
9
|
//#region src/build/rolldown/config.ts
|
|
41
|
-
const getRolldownConfig = (nitro) => {
|
|
10
|
+
const getRolldownConfig = async (nitro) => {
|
|
42
11
|
const base = baseBuildConfig(nitro);
|
|
43
|
-
const chunkNamePrefixes = [
|
|
44
|
-
[runtimeDir, "nitro"],
|
|
45
|
-
[base.presetsDir, "nitro"],
|
|
46
|
-
["\0raw:", "raw"],
|
|
47
|
-
["\0nitro-wasm:", "wasm"],
|
|
48
|
-
["\0", "virtual"]
|
|
49
|
-
];
|
|
50
12
|
const tsc = nitro.options.typescript.tsConfig?.compilerOptions;
|
|
51
13
|
let config = {
|
|
14
|
+
platform: nitro.options.node ? "node" : "neutral",
|
|
52
15
|
cwd: nitro.options.rootDir,
|
|
53
16
|
input: nitro.options.entry,
|
|
54
17
|
external: [
|
|
@@ -56,11 +19,10 @@ const getRolldownConfig = (nitro) => {
|
|
|
56
19
|
...builtinModules,
|
|
57
20
|
...builtinModules.map((m) => `node:${m}`)
|
|
58
21
|
],
|
|
59
|
-
plugins: [...baseBuildPlugins(nitro, base)],
|
|
22
|
+
plugins: [...await baseBuildPlugins(nitro, base)],
|
|
60
23
|
resolve: {
|
|
61
24
|
alias: base.aliases,
|
|
62
25
|
extensions: base.extensions,
|
|
63
|
-
mainFields: ["main"],
|
|
64
26
|
conditionNames: nitro.options.exportConditions
|
|
65
27
|
},
|
|
66
28
|
transform: {
|
|
@@ -74,39 +36,40 @@ const getRolldownConfig = (nitro) => {
|
|
|
74
36
|
}
|
|
75
37
|
},
|
|
76
38
|
onwarn(warning, warn) {
|
|
77
|
-
if (!
|
|
39
|
+
if (!base.ignoreWarningCodes.has(warning.code || "")) {
|
|
40
|
+
console.log(warning.code);
|
|
41
|
+
warn(warning);
|
|
42
|
+
}
|
|
78
43
|
},
|
|
79
44
|
treeshake: { moduleSideEffects(id) {
|
|
80
45
|
return nitro.options.moduleSideEffects.some((p) => id.startsWith(p));
|
|
81
46
|
} },
|
|
47
|
+
optimization: { inlineConst: true },
|
|
82
48
|
output: {
|
|
83
|
-
|
|
49
|
+
format: "esm",
|
|
84
50
|
entryFileNames: "index.mjs",
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (Object.entries(nitro.options.tasks).find(([_, task]) => task.handler === id)) return `chunks/tasks/[name].mjs`;
|
|
92
|
-
return `chunks/_/[name].mjs`;
|
|
93
|
-
},
|
|
51
|
+
chunkFileNames: (chunk) => getChunkName(chunk, nitro),
|
|
52
|
+
codeSplitting: { groups: [{
|
|
53
|
+
test: NODE_MODULES_RE,
|
|
54
|
+
name: (id) => libChunkName(id)
|
|
55
|
+
}] },
|
|
56
|
+
dir: nitro.options.output.serverDir,
|
|
94
57
|
inlineDynamicImports: nitro.options.inlineDynamicImports,
|
|
95
|
-
|
|
96
|
-
exports: "auto",
|
|
97
|
-
intro: "",
|
|
98
|
-
outro: "",
|
|
99
|
-
sanitizeFileName: sanitizeFilePath,
|
|
58
|
+
minify: nitro.options.minify ? true : "dce-only",
|
|
100
59
|
sourcemap: nitro.options.sourcemap,
|
|
101
60
|
sourcemapIgnoreList(relativePath) {
|
|
102
61
|
return relativePath.includes("node_modules");
|
|
103
62
|
}
|
|
104
63
|
}
|
|
105
64
|
};
|
|
106
|
-
config = defu(nitro.options.rollupConfig, config);
|
|
65
|
+
config = defu(nitro.options.rolldownConfig, nitro.options.rollupConfig, config);
|
|
66
|
+
const outputConfig = config.output;
|
|
67
|
+
if (outputConfig.inlineDynamicImports || outputConfig.format === "iife") {
|
|
68
|
+
delete outputConfig.inlineDynamicImports;
|
|
69
|
+
outputConfig.codeSplitting = false;
|
|
70
|
+
}
|
|
107
71
|
return config;
|
|
108
72
|
};
|
|
109
|
-
|
|
110
73
|
//#endregion
|
|
111
74
|
//#region src/build/rolldown/dev.ts
|
|
112
75
|
async function watchDev(nitro, config) {
|
|
@@ -133,11 +96,15 @@ async function watchDev(nitro, config) {
|
|
|
133
96
|
"unlink",
|
|
134
97
|
"unlinkDir"
|
|
135
98
|
]);
|
|
136
|
-
const scanDirsWatcher = watch
|
|
99
|
+
const scanDirsWatcher = watch(scanDirs, { ignoreInitial: true }).on("all", (event) => {
|
|
137
100
|
if (watchReloadEvents.has(event)) reload();
|
|
138
101
|
});
|
|
139
|
-
const
|
|
140
|
-
|
|
102
|
+
const serverEntryRe = /^server\.[mc]?[jt]sx?$/;
|
|
103
|
+
const rootDirWatcher = watch(nitro.options.rootDir, {
|
|
104
|
+
ignoreInitial: true,
|
|
105
|
+
depth: 0
|
|
106
|
+
}).on("all", (event, path) => {
|
|
107
|
+
if (watchReloadEvents.has(event) && serverEntryRe.test(basename(path))) reload();
|
|
141
108
|
});
|
|
142
109
|
nitro.hooks.hook("close", () => {
|
|
143
110
|
watcher.close();
|
|
@@ -145,29 +112,30 @@ async function watchDev(nitro, config) {
|
|
|
145
112
|
rootDirWatcher.close();
|
|
146
113
|
});
|
|
147
114
|
nitro.hooks.hook("rollup:reload", () => reload());
|
|
115
|
+
nitro.logger.info(`Starting dev watcher (builder: \`rolldown\`, preset: \`${nitro.options.preset}\`, compatibility date: \`${formatCompatibilityDate(nitro.options.compatibilityDate)}\`)`);
|
|
148
116
|
await load();
|
|
149
|
-
function startWatcher(nitro
|
|
150
|
-
const watcher
|
|
117
|
+
function startWatcher(nitro, config) {
|
|
118
|
+
const watcher = rolldown.watch(config);
|
|
151
119
|
let start;
|
|
152
|
-
watcher
|
|
120
|
+
watcher.on("event", (event) => {
|
|
153
121
|
switch (event.code) {
|
|
154
122
|
case "START":
|
|
155
123
|
start = Date.now();
|
|
156
|
-
nitro
|
|
157
|
-
nitro$1.hooks.callHook("dev:start");
|
|
124
|
+
nitro.hooks.callHook("dev:start");
|
|
158
125
|
break;
|
|
159
126
|
case "BUNDLE_END":
|
|
160
|
-
nitro
|
|
161
|
-
if (nitro
|
|
162
|
-
nitro
|
|
127
|
+
nitro.hooks.callHook("compiled", nitro);
|
|
128
|
+
if (nitro.options.logging.buildSuccess) nitro.logger.success(`Server built`, start ? `in ${Date.now() - start}ms` : "");
|
|
129
|
+
nitro.hooks.callHook("dev:reload");
|
|
163
130
|
break;
|
|
164
|
-
case "ERROR":
|
|
131
|
+
case "ERROR":
|
|
132
|
+
nitro.logger.error(event.error);
|
|
133
|
+
nitro.hooks.callHook("dev:error", event.error);
|
|
165
134
|
}
|
|
166
135
|
});
|
|
167
|
-
return watcher
|
|
136
|
+
return watcher;
|
|
168
137
|
}
|
|
169
138
|
}
|
|
170
|
-
|
|
171
139
|
//#endregion
|
|
172
140
|
//#region src/build/rolldown/prod.ts
|
|
173
141
|
async function buildProduction(nitro, config) {
|
|
@@ -175,11 +143,12 @@ async function buildProduction(nitro, config) {
|
|
|
175
143
|
const buildStartTime = Date.now();
|
|
176
144
|
await scanHandlers(nitro);
|
|
177
145
|
await writeTypes(nitro);
|
|
146
|
+
let output;
|
|
178
147
|
if (!nitro.options.static) {
|
|
179
148
|
nitro.logger.info(`Building server (builder: \`rolldown\`, preset: \`${nitro.options.preset}\`, compatibility date: \`${formatCompatibilityDate(nitro.options.compatibilityDate)}\`)`);
|
|
180
|
-
await (await rolldown.rolldown(config)).write(config.output);
|
|
149
|
+
output = await (await rolldown.rolldown(config)).write(config.output);
|
|
181
150
|
}
|
|
182
|
-
const buildInfo = await writeBuildInfo(nitro);
|
|
151
|
+
const buildInfo = await writeBuildInfo(nitro, output);
|
|
183
152
|
if (!nitro.options.static) {
|
|
184
153
|
if (nitro.options.logging.buildSuccess) nitro.logger.success(`Server built in ${Date.now() - buildStartTime}ms`);
|
|
185
154
|
if (nitro.options.logLevel > 1) process.stdout.write(await generateFSTree(nitro.options.output.serverDir, { compressedSizes: nitro.options.logging.compressedSizes }) || "");
|
|
@@ -189,18 +158,16 @@ async function buildProduction(nitro, config) {
|
|
|
189
158
|
const rewriteRelativePaths = (input) => {
|
|
190
159
|
return input.replace(/([\s:])\.\/(\S*)/g, `$1${rOutput}/$2`);
|
|
191
160
|
};
|
|
192
|
-
|
|
193
|
-
if (buildInfo.commands.deploy) nitro.logger.success(
|
|
161
|
+
nitro.logger.success("You can preview this build using `npx nitro preview`");
|
|
162
|
+
if (buildInfo.commands.deploy) nitro.logger.success(rewriteRelativePaths("You can deploy this build using `npx nitro deploy --prebuilt`"));
|
|
194
163
|
}
|
|
195
|
-
|
|
196
164
|
//#endregion
|
|
197
165
|
//#region src/build/rolldown/build.ts
|
|
198
166
|
async function rolldownBuild(nitro) {
|
|
199
167
|
await nitro.hooks.callHook("build:before", nitro);
|
|
200
|
-
const config = getRolldownConfig(nitro);
|
|
168
|
+
const config = await getRolldownConfig(nitro);
|
|
201
169
|
await nitro.hooks.callHook("rollup:before", nitro, config);
|
|
202
170
|
return nitro.options.dev ? watchDev(nitro, config) : buildProduction(nitro, config);
|
|
203
171
|
}
|
|
204
|
-
|
|
205
172
|
//#endregion
|
|
206
|
-
export { rolldownBuild };
|
|
173
|
+
export { rolldownBuild };
|
package/dist/_build/rollup.mjs
CHANGED
|
@@ -1,98 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../_libs/gen-mapping.mjs";
|
|
3
|
-
import "../_libs/magic-string.mjs";
|
|
4
|
-
import "../_libs/acorn.mjs";
|
|
5
|
-
import "../_libs/confbox.mjs";
|
|
6
|
-
import { f as sanitizeFilePath } from "../_libs/local-pkg.mjs";
|
|
7
|
-
import "../_libs/js-tokens.mjs";
|
|
8
|
-
import "../_libs/strip-literal.mjs";
|
|
9
|
-
import "../_libs/unimport.mjs";
|
|
10
|
-
import "../_libs/picomatch.mjs";
|
|
11
|
-
import "../_libs/fdir.mjs";
|
|
12
|
-
import "../_libs/tinyglobby.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";
|
|
13
2
|
import { t as formatCompatibilityDate } from "../_libs/compatx.mjs";
|
|
14
|
-
import "../
|
|
15
|
-
import "../_libs/
|
|
16
|
-
import "../
|
|
17
|
-
import { i as scanHandlers, n as writeTypes } from "../_chunks/ANM1K1bE.mjs";
|
|
18
|
-
import "../_libs/mime.mjs";
|
|
19
|
-
import "../_libs/pathe.mjs";
|
|
20
|
-
import "../_libs/untyped.mjs";
|
|
21
|
-
import "../_libs/knitwork.mjs";
|
|
22
|
-
import { n as writeBuildInfo } from "./common.mjs";
|
|
23
|
-
import { i as watch$1 } from "../_libs/chokidar.mjs";
|
|
3
|
+
import { n as scanHandlers } from "../_chunks/nitro2.mjs";
|
|
4
|
+
import { n as watch } from "../_libs/readdirp+chokidar.mjs";
|
|
5
|
+
import { t as debounce } from "../_libs/perfect-debounce.mjs";
|
|
24
6
|
import { t as alias } from "../_libs/plugin-alias.mjs";
|
|
25
|
-
import "../_libs/estree-walker.mjs";
|
|
26
|
-
import { t as commonjs } from "../_libs/plugin-commonjs.mjs";
|
|
27
7
|
import { t as inject } from "../_libs/plugin-inject.mjs";
|
|
28
|
-
import { n as
|
|
29
|
-
import "../_libs/
|
|
30
|
-
import "../_libs/unwasm.mjs";
|
|
31
|
-
import "../_libs/plugin-replace.mjs";
|
|
32
|
-
import "../_libs/etag.mjs";
|
|
33
|
-
import "../_libs/duplexer.mjs";
|
|
34
|
-
import "../_libs/gzip-size.mjs";
|
|
35
|
-
import "../_libs/pretty-bytes.mjs";
|
|
36
|
-
import { t as generateFSTree } from "../_chunks/BX9-zVkM.mjs";
|
|
37
|
-
import "../_libs/commondir.mjs";
|
|
38
|
-
import "../_libs/is-reference.mjs";
|
|
8
|
+
import { n as generateFSTree } from "../_chunks/utils.mjs";
|
|
9
|
+
import { t as commonjs } from "../_libs/commondir+is-reference.mjs";
|
|
39
10
|
import { t as json } from "../_libs/plugin-json.mjs";
|
|
40
|
-
import "../_libs/deepmerge.mjs";
|
|
41
|
-
import "../_libs/is-module.mjs";
|
|
42
|
-
import { t as nodeResolve } from "../_libs/plugin-node-resolve.mjs";
|
|
43
|
-
import "../_libs/path-parse.mjs";
|
|
44
|
-
import "../_libs/function-bind.mjs";
|
|
45
|
-
import "../_libs/hasown.mjs";
|
|
46
|
-
import "../_libs/is-core-module.mjs";
|
|
47
|
-
import { watch } from "node:fs";
|
|
11
|
+
import { t as nodeResolve } from "../_libs/hasown+resolve+deepmerge.mjs";
|
|
48
12
|
import { defu } from "defu";
|
|
49
|
-
import { runtimeDir } from "nitro/meta";
|
|
50
|
-
import { transform } from "oxc-transform";
|
|
51
|
-
import { minify } from "oxc-minify";
|
|
52
|
-
|
|
53
|
-
//#region src/build/plugins/oxc.ts
|
|
54
|
-
function oxc(options) {
|
|
55
|
-
const filter = (id) => !/node_modules/.test(id) && /\.[mj]?[jt]sx?$/.test(id);
|
|
56
|
-
return {
|
|
57
|
-
name: "nitro:oxc",
|
|
58
|
-
async transform(code, id) {
|
|
59
|
-
if (!filter(id)) return null;
|
|
60
|
-
return transform(id, code, {
|
|
61
|
-
sourcemap: options.sourcemap,
|
|
62
|
-
...options.transform
|
|
63
|
-
});
|
|
64
|
-
},
|
|
65
|
-
async renderChunk(code, chunk) {
|
|
66
|
-
if (options.minify) return minify(chunk.fileName, code, {
|
|
67
|
-
sourcemap: options.sourcemap,
|
|
68
|
-
...typeof options.minify === "object" ? options.minify : {}
|
|
69
|
-
});
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
//#endregion
|
|
76
13
|
//#region src/build/rollup/config.ts
|
|
77
|
-
const getRollupConfig = (nitro) => {
|
|
14
|
+
const getRollupConfig = async (nitro) => {
|
|
78
15
|
const base = baseBuildConfig(nitro);
|
|
79
|
-
const chunkNamePrefixes = [
|
|
80
|
-
[runtimeDir, "nitro"],
|
|
81
|
-
[base.presetsDir, "nitro"],
|
|
82
|
-
["\0raw:", "raw"],
|
|
83
|
-
["\0nitro-wasm:", "wasm"],
|
|
84
|
-
["\0", "virtual"]
|
|
85
|
-
];
|
|
86
|
-
function getChunkGroup(id) {
|
|
87
|
-
if (id.startsWith(runtimeDir) || id.startsWith(base.presetsDir)) return "nitro";
|
|
88
|
-
}
|
|
89
16
|
const tsc = nitro.options.typescript.tsConfig?.compilerOptions;
|
|
90
17
|
let config = {
|
|
91
18
|
input: nitro.options.entry,
|
|
92
19
|
external: [...base.env.external],
|
|
93
20
|
plugins: [
|
|
94
|
-
...baseBuildPlugins(nitro, base),
|
|
95
|
-
oxc({
|
|
21
|
+
...await baseBuildPlugins(nitro, base),
|
|
22
|
+
await oxc({
|
|
96
23
|
sourcemap: !!nitro.options.sourcemap,
|
|
97
24
|
minify: nitro.options.minify ? { ...nitro.options.oxc?.minify } : false,
|
|
98
25
|
transform: {
|
|
@@ -114,8 +41,6 @@ const getRollupConfig = (nitro) => {
|
|
|
114
41
|
extensions: base.extensions,
|
|
115
42
|
preferBuiltins: !!nitro.options.node,
|
|
116
43
|
rootDir: nitro.options.rootDir,
|
|
117
|
-
modulePaths: nitro.options.nodeModulesDirs,
|
|
118
|
-
mainFields: ["main"],
|
|
119
44
|
exportConditions: nitro.options.exportConditions
|
|
120
45
|
}),
|
|
121
46
|
commonjs({ ...nitro.options.commonJS }),
|
|
@@ -123,48 +48,31 @@ const getRollupConfig = (nitro) => {
|
|
|
123
48
|
inject(base.env.inject)
|
|
124
49
|
],
|
|
125
50
|
onwarn(warning, rollupWarn) {
|
|
126
|
-
if (!
|
|
127
|
-
"EVAL",
|
|
128
|
-
"CIRCULAR_DEPENDENCY",
|
|
129
|
-
"THIS_IS_UNDEFINED"
|
|
130
|
-
].includes(warning.code || "") && !warning.message.includes("Unsupported source map comment")) rollupWarn(warning);
|
|
51
|
+
if (!base.ignoreWarningCodes.has(warning.code || "")) rollupWarn(warning);
|
|
131
52
|
},
|
|
132
53
|
treeshake: { moduleSideEffects(id) {
|
|
133
54
|
return nitro.options.moduleSideEffects.some((p) => id.startsWith(p));
|
|
134
55
|
} },
|
|
135
56
|
output: {
|
|
136
|
-
|
|
57
|
+
format: "esm",
|
|
137
58
|
entryFileNames: "index.mjs",
|
|
138
|
-
chunkFileNames(chunk)
|
|
139
|
-
|
|
140
|
-
for (const [dir, name] of chunkNamePrefixes) if (id.startsWith(dir)) return `chunks/${name}/[name].mjs`;
|
|
141
|
-
const routeHandler = nitro.options.handlers.find((h) => id.startsWith(h.handler)) || nitro.scannedHandlers.find((h) => id.startsWith(h.handler));
|
|
142
|
-
if (routeHandler?.route) return `chunks/routes${routeHandler.route.replace(/:([^/]+)/g, "_$1").replace(/\/[^/]+$/g, "") || "/"}/[name].mjs`;
|
|
143
|
-
if (Object.entries(nitro.options.tasks).find(([_, task]) => task.handler === id)) return `chunks/tasks/[name].mjs`;
|
|
144
|
-
return `chunks/_/[name].mjs`;
|
|
145
|
-
},
|
|
146
|
-
manualChunks(id) {
|
|
147
|
-
return getChunkGroup(id);
|
|
148
|
-
},
|
|
59
|
+
chunkFileNames: (chunk) => getChunkName(chunk, nitro),
|
|
60
|
+
dir: nitro.options.output.serverDir,
|
|
149
61
|
inlineDynamicImports: nitro.options.inlineDynamicImports,
|
|
150
|
-
format: "esm",
|
|
151
|
-
exports: "auto",
|
|
152
|
-
intro: "",
|
|
153
|
-
outro: "",
|
|
154
62
|
generatedCode: { constBindings: true },
|
|
155
|
-
sanitizeFileName: sanitizeFilePath,
|
|
156
63
|
sourcemap: nitro.options.sourcemap,
|
|
157
64
|
sourcemapExcludeSources: true,
|
|
158
|
-
sourcemapIgnoreList(
|
|
159
|
-
|
|
65
|
+
sourcemapIgnoreList: (id) => id.includes("node_modules"),
|
|
66
|
+
manualChunks(id) {
|
|
67
|
+
if (NODE_MODULES_RE.test(id)) return libChunkName(id);
|
|
160
68
|
}
|
|
161
69
|
}
|
|
162
70
|
};
|
|
163
71
|
config = defu(nitro.options.rollupConfig, config);
|
|
164
|
-
|
|
72
|
+
const outputConfig = config.output;
|
|
73
|
+
if (outputConfig.inlineDynamicImports || outputConfig.format === "iife") delete outputConfig.manualChunks;
|
|
165
74
|
return config;
|
|
166
75
|
};
|
|
167
|
-
|
|
168
76
|
//#endregion
|
|
169
77
|
//#region src/build/rollup/error.ts
|
|
170
78
|
function formatRollupError(_error) {
|
|
@@ -184,7 +92,6 @@ function formatRollupError(_error) {
|
|
|
184
92
|
return _error?.toString();
|
|
185
93
|
}
|
|
186
94
|
}
|
|
187
|
-
|
|
188
95
|
//#endregion
|
|
189
96
|
//#region src/build/rollup/dev.ts
|
|
190
97
|
async function watchDev(nitro, rollupConfig) {
|
|
@@ -211,11 +118,15 @@ async function watchDev(nitro, rollupConfig) {
|
|
|
211
118
|
"unlink",
|
|
212
119
|
"unlinkDir"
|
|
213
120
|
]);
|
|
214
|
-
const scanDirsWatcher = watch
|
|
121
|
+
const scanDirsWatcher = watch(scanDirs, { ignoreInitial: true }).on("all", (event, path, stat) => {
|
|
215
122
|
if (watchReloadEvents.has(event)) reload();
|
|
216
123
|
});
|
|
217
|
-
const
|
|
218
|
-
|
|
124
|
+
const serverEntryRe = /^server\.[mc]?[jt]sx?$/;
|
|
125
|
+
const rootDirWatcher = watch(nitro.options.rootDir, {
|
|
126
|
+
ignoreInitial: true,
|
|
127
|
+
depth: 0
|
|
128
|
+
}).on("all", (event, path) => {
|
|
129
|
+
if (watchReloadEvents.has(event) && serverEntryRe.test(basename(path))) reload();
|
|
219
130
|
});
|
|
220
131
|
nitro.hooks.hook("close", () => {
|
|
221
132
|
rollupWatcher.close();
|
|
@@ -223,31 +134,30 @@ async function watchDev(nitro, rollupConfig) {
|
|
|
223
134
|
rootDirWatcher.close();
|
|
224
135
|
});
|
|
225
136
|
nitro.hooks.hook("rollup:reload", () => reload());
|
|
137
|
+
nitro.logger.info(`Starting dev watcher (builder: \`rollup\`, preset: \`${nitro.options.preset}\`, compatibility date: \`${formatCompatibilityDate(nitro.options.compatibilityDate)}\`)`);
|
|
226
138
|
await load();
|
|
227
|
-
function startRollupWatcher(nitro
|
|
228
|
-
const watcher = rollup.watch(defu(rollupConfig
|
|
139
|
+
function startRollupWatcher(nitro, rollupConfig) {
|
|
140
|
+
const watcher = rollup.watch(defu(rollupConfig, { watch: { chokidar: nitro.options.watchOptions } }));
|
|
229
141
|
let start;
|
|
230
142
|
watcher.on("event", (event) => {
|
|
231
143
|
switch (event.code) {
|
|
232
144
|
case "START":
|
|
233
145
|
start = Date.now();
|
|
234
|
-
nitro
|
|
235
|
-
nitro$1.hooks.callHook("dev:start");
|
|
146
|
+
nitro.hooks.callHook("dev:start");
|
|
236
147
|
break;
|
|
237
148
|
case "BUNDLE_END":
|
|
238
|
-
nitro
|
|
239
|
-
if (nitro
|
|
240
|
-
nitro
|
|
149
|
+
nitro.hooks.callHook("compiled", nitro);
|
|
150
|
+
if (nitro.options.logging.buildSuccess) nitro.logger.success(`Server built`, start ? `in ${Date.now() - start}ms` : "");
|
|
151
|
+
nitro.hooks.callHook("dev:reload");
|
|
241
152
|
break;
|
|
242
153
|
case "ERROR":
|
|
243
|
-
nitro
|
|
244
|
-
nitro
|
|
154
|
+
nitro.logger.error(formatRollupError(event.error));
|
|
155
|
+
nitro.hooks.callHook("dev:error", event.error);
|
|
245
156
|
}
|
|
246
157
|
});
|
|
247
158
|
return watcher;
|
|
248
159
|
}
|
|
249
160
|
}
|
|
250
|
-
|
|
251
161
|
//#endregion
|
|
252
162
|
//#region src/build/rollup/prod.ts
|
|
253
163
|
async function buildProduction(nitro, rollupConfig) {
|
|
@@ -255,35 +165,30 @@ async function buildProduction(nitro, rollupConfig) {
|
|
|
255
165
|
const buildStartTime = Date.now();
|
|
256
166
|
await scanHandlers(nitro);
|
|
257
167
|
await writeTypes(nitro);
|
|
168
|
+
let output;
|
|
258
169
|
if (!nitro.options.static) {
|
|
259
170
|
nitro.logger.info(`Building server (builder: \`rollup\`, preset: \`${nitro.options.preset}\`, compatibility date: \`${formatCompatibilityDate(nitro.options.compatibilityDate)}\`)`);
|
|
260
|
-
await (await rollup.rollup(rollupConfig).catch((error) => {
|
|
171
|
+
output = await (await rollup.rollup(rollupConfig).catch((error) => {
|
|
261
172
|
nitro.logger.error(formatRollupError(error));
|
|
262
173
|
throw error;
|
|
263
174
|
})).write(rollupConfig.output);
|
|
264
175
|
}
|
|
265
|
-
const buildInfo = await writeBuildInfo(nitro);
|
|
176
|
+
const buildInfo = await writeBuildInfo(nitro, output);
|
|
266
177
|
if (!nitro.options.static) {
|
|
267
178
|
if (nitro.options.logging.buildSuccess) nitro.logger.success(`Server built in ${Date.now() - buildStartTime}ms`);
|
|
268
179
|
if (nitro.options.logLevel > 1) process.stdout.write(await generateFSTree(nitro.options.output.serverDir, { compressedSizes: nitro.options.logging.compressedSizes }) || "");
|
|
269
180
|
}
|
|
270
181
|
await nitro.hooks.callHook("compiled", nitro);
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
return input.replace(/([\s:])\.\/(\S*)/g, `$1${rOutput}/$2`);
|
|
274
|
-
};
|
|
275
|
-
if (buildInfo.commands.preview) nitro.logger.success(`You can preview this build using \`${rewriteRelativePaths(buildInfo.commands.preview)}\``);
|
|
276
|
-
if (buildInfo.commands.deploy) nitro.logger.success(`You can deploy this build using \`${rewriteRelativePaths(buildInfo.commands.deploy)}\``);
|
|
182
|
+
nitro.logger.success("You can preview this build using `npx nitro preview`");
|
|
183
|
+
if (buildInfo.commands.deploy) nitro.logger.success("You can deploy this build using `npx nitro deploy --prebuilt`");
|
|
277
184
|
}
|
|
278
|
-
|
|
279
185
|
//#endregion
|
|
280
186
|
//#region src/build/rollup/build.ts
|
|
281
187
|
async function rollupBuild(nitro) {
|
|
282
188
|
await nitro.hooks.callHook("build:before", nitro);
|
|
283
|
-
const config = getRollupConfig(nitro);
|
|
189
|
+
const config = await getRollupConfig(nitro);
|
|
284
190
|
await nitro.hooks.callHook("rollup:before", nitro, config);
|
|
285
191
|
return nitro.options.dev ? watchDev(nitro, config) : buildProduction(nitro, config);
|
|
286
192
|
}
|
|
287
|
-
|
|
288
193
|
//#endregion
|
|
289
|
-
export { rollupBuild };
|
|
194
|
+
export { rollupBuild };
|
|
@@ -1,56 +1,18 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import "
|
|
3
|
-
import "../_libs/magic-string.mjs";
|
|
4
|
-
import "../_libs/acorn.mjs";
|
|
5
|
-
import "../_libs/confbox.mjs";
|
|
6
|
-
import "../_libs/local-pkg.mjs";
|
|
7
|
-
import "../_libs/js-tokens.mjs";
|
|
8
|
-
import "../_libs/strip-literal.mjs";
|
|
9
|
-
import "../_libs/unimport.mjs";
|
|
10
|
-
import "../_libs/picomatch.mjs";
|
|
11
|
-
import "../_libs/fdir.mjs";
|
|
12
|
-
import "../_libs/tinyglobby.mjs";
|
|
13
|
-
import "../_libs/compatx.mjs";
|
|
14
|
-
import "../_libs/klona.mjs";
|
|
15
|
-
import { r as a } from "../_libs/std-env.mjs";
|
|
16
|
-
import "../_chunks/B-D1JOIz.mjs";
|
|
17
|
-
import "../_libs/escape-string-regexp.mjs";
|
|
18
|
-
import "../_libs/tsconfck.mjs";
|
|
19
|
-
import "../_libs/dot-prop.mjs";
|
|
20
|
-
import "../_chunks/C7CbzoI1.mjs";
|
|
21
|
-
import "../_chunks/ANM1K1bE.mjs";
|
|
22
|
-
import "../_libs/rou3.mjs";
|
|
23
|
-
import "../_libs/mime.mjs";
|
|
24
|
-
import "../_libs/pathe.mjs";
|
|
25
|
-
import "../_libs/untyped.mjs";
|
|
26
|
-
import "../_libs/knitwork.mjs";
|
|
27
|
-
import "./common.mjs";
|
|
28
|
-
import "../_libs/httpxy.mjs";
|
|
29
|
-
import "../_dev.mjs";
|
|
30
|
-
import "../_libs/chokidar.mjs";
|
|
31
|
-
import "../_libs/ultrahtml.mjs";
|
|
32
|
-
import "../_libs/plugin-alias.mjs";
|
|
33
|
-
import "../_libs/estree-walker.mjs";
|
|
34
|
-
import "../_libs/plugin-commonjs.mjs";
|
|
35
|
-
import "../_libs/plugin-inject.mjs";
|
|
36
|
-
import "./common2.mjs";
|
|
37
|
-
import "../_libs/remapping.mjs";
|
|
38
|
-
import "../_libs/unwasm.mjs";
|
|
39
|
-
import "../_libs/plugin-replace.mjs";
|
|
40
|
-
import "../_libs/etag.mjs";
|
|
41
|
-
import { t as nitro } from "./vite.plugin.mjs";
|
|
42
|
-
import "../_libs/vite-plugin-fullstack.mjs";
|
|
43
|
-
|
|
1
|
+
import { H as v } from "./common.mjs";
|
|
2
|
+
import { nitro } from "nitro/vite";
|
|
44
3
|
//#region src/build/vite/build.ts
|
|
45
4
|
async function viteBuild(nitro$1) {
|
|
46
5
|
if (nitro$1.options.dev) throw new Error("Nitro dev CLI does not supports vite. Please use `vite dev` instead.");
|
|
47
|
-
const { createBuilder } = nitro$1.options.
|
|
48
|
-
|
|
6
|
+
const { createBuilder } = await import(nitro$1.options.__vitePkg__ || "vite");
|
|
7
|
+
const pluginInstance = nitro({ _nitro: nitro$1 });
|
|
8
|
+
globalThis.__nitro_build__ = true;
|
|
9
|
+
const builder = await createBuilder({
|
|
49
10
|
base: nitro$1.options.rootDir,
|
|
50
|
-
plugins: [
|
|
51
|
-
logLevel:
|
|
52
|
-
})
|
|
11
|
+
plugins: [pluginInstance],
|
|
12
|
+
logLevel: v ? "warn" : void 0
|
|
13
|
+
});
|
|
14
|
+
delete globalThis.__nitro_build__;
|
|
15
|
+
await builder.buildApp();
|
|
53
16
|
}
|
|
54
|
-
|
|
55
17
|
//#endregion
|
|
56
|
-
export { viteBuild };
|
|
18
|
+
export { viteBuild };
|