nitro-nightly 3.0.0-beta-28969273.f7aa9de6 → 4.0.0-20251010-091516-7cafddba
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/README.md +8 -39
- package/dist/_chunks/app.mjs +19797 -0
- package/dist/_chunks/build.mjs +84 -0
- package/dist/_chunks/build2.mjs +318 -0
- package/dist/_chunks/build3.mjs +6452 -0
- package/dist/_chunks/detect-acorn.mjs +503 -0
- package/dist/_chunks/index.mjs +22242 -0
- package/dist/_chunks/index2.mjs +297 -0
- package/dist/_chunks/index3.mjs +1058 -0
- package/dist/_chunks/index4.mjs +1206 -0
- package/dist/_chunks/info.mjs +11157 -0
- package/dist/_chunks/json5.mjs +68 -0
- package/dist/_chunks/jsonc.mjs +51 -0
- package/dist/_chunks/pathe.M-eThtNZ.mjs +204 -0
- package/dist/_chunks/plugin.mjs +960 -0
- package/dist/_chunks/server.mjs +254 -0
- package/dist/_chunks/snapshot.mjs +284 -0
- package/dist/_chunks/toml.mjs +259 -0
- package/dist/_chunks/yaml.mjs +86 -0
- package/dist/cli/build.mjs +10 -3
- package/dist/cli/dev.mjs +41 -9
- package/dist/cli/index.mjs +460 -1
- package/dist/cli/index2.mjs +4 -1
- package/dist/cli/list.mjs +10 -4
- package/dist/cli/prepare.mjs +6 -3
- package/dist/cli/run.mjs +7 -4
- package/dist/index.d.mts +52 -0
- package/dist/index.mjs +55 -0
- package/dist/node_modules/@poppinss/colors/build/index.js +169 -0
- package/dist/node_modules/@poppinss/colors/package.json +116 -0
- package/dist/node_modules/@poppinss/dumper/build/chunk-26HALFTP.js +602 -0
- package/dist/node_modules/@poppinss/dumper/build/formatters/console/main.js +441 -0
- package/dist/node_modules/@poppinss/dumper/build/formatters/html/main.js +717 -0
- package/dist/node_modules/@poppinss/dumper/package.json +122 -0
- package/dist/node_modules/@poppinss/exception/build/index.js +63 -0
- package/dist/node_modules/@poppinss/exception/package.json +106 -0
- package/dist/node_modules/@sindresorhus/is/distribution/index.js +1313 -0
- package/dist/node_modules/@sindresorhus/is/distribution/utilities.js +3 -0
- package/dist/node_modules/@sindresorhus/is/package.json +81 -0
- package/dist/node_modules/@speed-highlight/core/dist/index.js +4 -0
- package/dist/node_modules/@speed-highlight/core/dist/terminal.js +2 -0
- package/dist/node_modules/@speed-highlight/core/package.json +90 -0
- package/dist/node_modules/cookie/dist/index.js +239 -0
- package/dist/node_modules/cookie/package.json +42 -0
- package/dist/node_modules/croner/dist/croner.js +1 -0
- package/dist/node_modules/croner/package.json +63 -0
- package/dist/node_modules/defu/dist/defu.mjs +69 -0
- package/dist/node_modules/defu/package.json +43 -0
- package/dist/node_modules/destr/dist/index.mjs +72 -0
- package/dist/node_modules/destr/package.json +47 -0
- package/dist/node_modules/error-stack-parser-es/dist/index.mjs +38 -0
- package/dist/node_modules/error-stack-parser-es/dist/lite.mjs +167 -0
- package/dist/node_modules/error-stack-parser-es/package.json +83 -0
- package/dist/node_modules/get-port-please/dist/index.mjs +430 -0
- package/dist/node_modules/get-port-please/package.json +39 -0
- package/dist/node_modules/hookable/dist/index.mjs +290 -0
- package/dist/node_modules/hookable/package.json +49 -0
- package/dist/node_modules/kleur/index.js +110 -0
- package/dist/node_modules/kleur/index.mjs +110 -0
- package/dist/node_modules/kleur/package.json +51 -0
- package/dist/node_modules/klona/dist/index.mjs +81 -0
- package/dist/node_modules/klona/full/index.mjs +53 -0
- package/dist/node_modules/klona/package.json +74 -0
- package/dist/node_modules/scule/dist/index.mjs +80 -0
- package/dist/node_modules/scule/package.json +43 -0
- package/dist/node_modules/source-map/lib/array-set.js +100 -0
- package/dist/node_modules/source-map/lib/base64-vlq.js +94 -0
- package/dist/node_modules/source-map/lib/base64.js +19 -0
- package/dist/node_modules/source-map/lib/binary-search.js +113 -0
- package/dist/node_modules/source-map/lib/mapping-list.js +83 -0
- package/dist/node_modules/source-map/lib/mappings.wasm +0 -0
- package/dist/node_modules/source-map/lib/read-wasm.js +27 -0
- package/dist/node_modules/source-map/lib/source-map-consumer.js +1081 -0
- package/dist/node_modules/source-map/lib/source-map-generator.js +439 -0
- package/dist/node_modules/source-map/lib/source-node.js +430 -0
- package/dist/node_modules/source-map/lib/url.js +13 -0
- package/dist/node_modules/source-map/lib/util.js +444 -0
- package/dist/node_modules/source-map/lib/wasm.js +138 -0
- package/dist/node_modules/source-map/package.json +79 -0
- package/dist/node_modules/source-map/source-map.js +10 -0
- package/dist/node_modules/std-env/dist/index.mjs +1 -0
- package/dist/node_modules/std-env/package.json +46 -0
- package/dist/node_modules/supports-color/index.js +202 -0
- package/dist/node_modules/supports-color/package.json +64 -0
- package/dist/node_modules/ufo/dist/index.mjs +638 -0
- package/dist/node_modules/ufo/package.json +47 -0
- package/dist/node_modules/unctx/dist/index.mjs +131 -0
- package/dist/node_modules/unctx/package.json +67 -0
- package/dist/node_modules/youch/build/chunk-4L7RY2JA.js +42 -0
- package/dist/node_modules/youch/build/chunk-4XB2BYKC.js +85 -0
- package/dist/node_modules/youch/build/chunk-4YEN7HVQ.js +61 -0
- package/dist/node_modules/youch/build/chunk-EUJBVOYB.js +83 -0
- package/dist/node_modules/youch/build/chunk-HFSXRSKS.js +85 -0
- package/dist/node_modules/youch/build/chunk-JAN2TFI2.js +222 -0
- package/dist/node_modules/youch/build/chunk-OSUFJZHZ.js +6 -0
- package/dist/node_modules/youch/build/chunk-PINJDICN.js +72 -0
- package/dist/node_modules/youch/build/chunk-PUHGL6HA.js +41 -0
- package/dist/node_modules/youch/build/chunk-VE4LENUR.js +45 -0
- package/dist/node_modules/youch/build/index.js +352 -0
- package/dist/node_modules/youch/build/public/error_cause/style.css +5 -0
- package/dist/node_modules/youch/build/public/error_info/script.js +13 -0
- package/dist/node_modules/youch/build/public/error_info/style.css +144 -0
- package/dist/node_modules/youch/build/public/error_stack/script.js +74 -0
- package/dist/node_modules/youch/build/public/error_stack/style.css +220 -0
- package/dist/node_modules/youch/build/public/error_stack_source/style.css +123 -0
- package/dist/node_modules/youch/build/public/header/script.js +16 -0
- package/dist/node_modules/youch/build/public/header/style.css +56 -0
- package/dist/node_modules/youch/build/public/layout/script.js +20 -0
- package/dist/node_modules/youch/build/public/layout/style.css +431 -0
- package/dist/node_modules/youch/package.json +133 -0
- package/dist/node_modules/youch-core/build/index.js +316 -0
- package/dist/node_modules/youch-core/package.json +124 -0
- package/dist/presets/_nitro/runtime/nitro-dev.mjs +48 -73
- package/dist/presets/_nitro/runtime/{nitro-prerenderer.d.ts → nitro-prerenderer.d.mts} +1 -1
- package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +12 -1
- package/dist/presets/_nitro/runtime/service-worker.mjs +5 -15
- package/dist/presets/aws-amplify/runtime/aws-amplify.mjs +2 -2
- package/dist/presets/aws-lambda/runtime/_utils.d.mts +18 -0
- package/dist/presets/aws-lambda/runtime/_utils.mjs +102 -0
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.d.mts +3 -0
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +12 -32
- package/dist/presets/aws-lambda/runtime/aws-lambda.d.mts +3 -0
- package/dist/presets/aws-lambda/runtime/aws-lambda.mjs +6 -38
- package/dist/{runtime/internal/utils.azure.d.ts → presets/azure/runtime/_utils.d.mts} +1 -1
- package/dist/{runtime/internal/utils.azure.mjs → presets/azure/runtime/_utils.mjs} +3 -4
- package/dist/presets/azure/runtime/azure-swa.mjs +11 -13
- package/dist/presets/bun/runtime/bun.mjs +13 -18
- package/dist/presets/cloudflare/runtime/_module-handler.d.mts +13 -0
- package/dist/presets/cloudflare/runtime/_module-handler.mjs +93 -0
- package/dist/presets/cloudflare/runtime/cloudflare-durable.d.mts +19 -0
- package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +74 -0
- package/dist/presets/cloudflare/runtime/cloudflare-module.d.mts +9 -0
- package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +13 -97
- package/dist/presets/cloudflare/runtime/{cloudflare-pages.d.ts → cloudflare-pages.d.mts} +1 -1
- package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +19 -27
- package/dist/{runtime/internal/timing.d.ts → presets/cloudflare/runtime/plugin.dev.d.mts} +1 -0
- package/dist/presets/cloudflare/runtime/plugin.dev.mjs +89 -0
- package/dist/presets/deno/runtime/deno-deploy.mjs +11 -25
- package/dist/presets/deno/runtime/deno-server.d.mts +6 -0
- package/dist/presets/deno/runtime/deno-server.mjs +15 -21
- package/dist/presets/netlify/runtime/netlify-edge.d.mts +3 -0
- package/dist/presets/netlify/runtime/netlify-edge.mjs +8 -16
- package/dist/presets/netlify/runtime/netlify.mjs +16 -45
- package/dist/presets/node/runtime/{cluster.mjs → node-cluster.mjs} +1 -3
- package/dist/presets/node/runtime/node-middleware.d.mts +4 -0
- package/dist/presets/node/runtime/{node-listener.mjs → node-middleware.mjs} +3 -4
- package/dist/presets/node/runtime/node-server.mjs +3 -4
- package/dist/presets/standard/runtime/server.d.mts +5 -0
- package/dist/presets/standard/runtime/server.mjs +6 -0
- package/dist/presets/stormkit/runtime/stormkit.mjs +8 -12
- package/dist/presets/vercel/runtime/vercel.d.mts +8 -0
- package/dist/presets/vercel/runtime/vercel.mjs +11 -11
- package/dist/presets/winterjs/runtime/winterjs.mjs +22 -4
- package/dist/presets/{node/runtime/node-server.d.ts → zeabur/runtime/zeabur.d.mts} +1 -1
- package/dist/presets/zeabur/runtime/zeabur.mjs +2 -6
- package/dist/presets.mjs +2460 -0
- package/dist/runtime/index.d.mts +11 -0
- package/dist/runtime/index.mjs +8 -8
- package/dist/runtime/internal/app.d.mts +2 -0
- package/dist/runtime/internal/app.mjs +129 -128
- package/dist/runtime/internal/cache.d.mts +7 -0
- package/dist/runtime/internal/cache.mjs +82 -175
- package/dist/runtime/internal/{context.d.ts → context.d.mts} +3 -3
- package/dist/runtime/internal/context.mjs +6 -6
- package/dist/runtime/internal/error/dev.d.mts +9 -0
- package/dist/runtime/internal/error/dev.mjs +122 -0
- package/dist/runtime/internal/error/prod.d.mts +8 -0
- package/dist/runtime/internal/error/prod.mjs +62 -0
- package/dist/runtime/internal/error/utils.d.mts +8 -0
- package/dist/runtime/internal/error/utils.mjs +3 -0
- package/dist/runtime/internal/index.d.mts +3 -0
- package/dist/runtime/internal/index.mjs +1 -14
- package/dist/runtime/internal/renderer.d.mts +3 -0
- package/dist/runtime/internal/renderer.mjs +29 -33
- package/dist/runtime/internal/route-rules.d.mts +8 -0
- package/dist/runtime/internal/route-rules.mjs +58 -63
- package/dist/runtime/internal/routes/dev-tasks.d.mts +3 -0
- package/dist/runtime/internal/routes/dev-tasks.mjs +23 -0
- package/dist/runtime/internal/routes/openapi.d.mts +3 -0
- package/dist/runtime/internal/routes/openapi.mjs +24 -9
- package/dist/runtime/internal/routes/renderer-template.d.mts +2 -0
- package/dist/runtime/internal/routes/renderer-template.dev.d.mts +3 -0
- package/dist/runtime/internal/routes/renderer-template.dev.mjs +21 -0
- package/dist/runtime/internal/routes/renderer-template.mjs +4 -0
- package/dist/runtime/internal/routes/scalar.d.mts +3 -0
- package/dist/runtime/internal/routes/scalar.mjs +7 -4
- package/dist/runtime/internal/routes/swagger.d.mts +3 -0
- package/dist/runtime/internal/routes/swagger.mjs +5 -4
- package/dist/runtime/internal/{utils.env.d.ts → runtime-config.d.mts} +4 -2
- package/dist/runtime/internal/{utils.env.mjs → runtime-config.mjs} +16 -6
- package/dist/runtime/internal/static.d.mts +3 -0
- package/dist/runtime/internal/static.mjs +24 -36
- package/dist/runtime/internal/storage.mjs +2 -1
- package/dist/runtime/internal/task.mjs +6 -6
- package/dist/runtime/internal/utils.d.mts +1 -0
- package/dist/runtime/internal/utils.mjs +1 -116
- package/dist/runtime/internal/vite/dev-entry.d.mts +1 -0
- package/dist/runtime/internal/vite/dev-entry.mjs +6 -0
- package/dist/runtime/internal/vite/dev-worker.mjs +362 -0
- package/dist/runtime/internal/vite/prod-setup.d.mts +4 -0
- package/dist/runtime/internal/vite/prod-setup.mjs +55 -0
- package/dist/runtime/internal/vite/ssr-renderer.d.mts +4 -0
- package/dist/runtime/internal/vite/ssr-renderer.mjs +4 -0
- package/dist/types/index.d.mts +2688 -138
- package/dist/vite.d.mts +59 -0
- package/dist/vite.mjs +68 -0
- package/lib/config.d.mts +9 -0
- package/lib/deps/h3.d.mts +1 -0
- package/lib/deps/h3.mjs +1 -0
- package/lib/deps/ofetch.mjs +1 -0
- package/lib/deps/ofetch.mts +1 -0
- package/lib/meta.d.mts +5 -0
- package/lib/meta.mjs +21 -0
- package/{runtime-meta.d.ts → lib/runtime-meta.d.mts} +1 -0
- package/{runtime-meta.mjs → lib/runtime-meta.mjs} +12 -4
- package/package.json +142 -160
- package/cli.d.ts +0 -1
- package/config.d.ts +0 -1
- package/core.d.ts +0 -1
- package/dist/cli/index.d.ts +0 -1
- package/dist/config/index.d.mts +0 -6
- package/dist/config/index.d.ts +0 -6
- package/dist/core/index.d.mts +0 -30
- package/dist/core/index.d.ts +0 -30
- package/dist/core/index.mjs +0 -2456
- package/dist/kit/index.d.mts +0 -44
- package/dist/kit/index.d.ts +0 -44
- package/dist/kit/index.mjs +0 -71
- package/dist/meta/index.d.mts +0 -3
- package/dist/meta/index.d.ts +0 -3
- package/dist/meta/index.mjs +0 -3
- package/dist/presets/_all.gen.d.ts +0 -2
- package/dist/presets/_all.gen.mjs +0 -52
- package/dist/presets/_nitro/base-worker.d.ts +0 -2
- package/dist/presets/_nitro/base-worker.mjs +0 -25
- package/dist/presets/_nitro/nitro-dev.d.ts +0 -2
- package/dist/presets/_nitro/nitro-dev.mjs +0 -19
- package/dist/presets/_nitro/nitro-prerender.d.ts +0 -2
- package/dist/presets/_nitro/nitro-prerender.mjs +0 -17
- package/dist/presets/_nitro/preset.d.ts +0 -2
- package/dist/presets/_nitro/preset.mjs +0 -5
- package/dist/presets/_nitro/service-worker.d.ts +0 -2
- package/dist/presets/_nitro/service-worker.mjs +0 -110
- package/dist/presets/_resolve.d.ts +0 -8
- package/dist/presets/_resolve.mjs +0 -44
- package/dist/presets/_static/preset.d.ts +0 -2
- package/dist/presets/_static/preset.mjs +0 -69
- package/dist/presets/_types.gen.d.ts +0 -16
- package/dist/presets/alwaysdata/preset.d.ts +0 -2
- package/dist/presets/alwaysdata/preset.mjs +0 -14
- package/dist/presets/aws-amplify/preset.d.ts +0 -3
- package/dist/presets/aws-amplify/preset.mjs +0 -27
- package/dist/presets/aws-amplify/types.d.ts +0 -141
- package/dist/presets/aws-amplify/utils.d.ts +0 -2
- package/dist/presets/aws-amplify/utils.mjs +0 -82
- package/dist/presets/aws-lambda/preset.d.ts +0 -2
- package/dist/presets/aws-lambda/preset.mjs +0 -21
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.d.ts +0 -14
- package/dist/presets/aws-lambda/runtime/aws-lambda.d.ts +0 -4
- package/dist/presets/azure/preset.d.ts +0 -3
- package/dist/presets/azure/preset.mjs +0 -44
- package/dist/presets/azure/runtime/azure-functions.mjs +0 -24
- package/dist/presets/azure/runtime/azure-swa.d.ts +0 -5
- package/dist/presets/azure/types.d.ts +0 -13
- package/dist/presets/azure/types.mjs +0 -0
- package/dist/presets/azure/utils.d.ts +0 -3
- package/dist/presets/azure/utils.mjs +0 -183
- package/dist/presets/bun/preset.d.ts +0 -2
- package/dist/presets/bun/preset.mjs +0 -17
- package/dist/presets/cleavr/preset.d.ts +0 -2
- package/dist/presets/cleavr/preset.mjs +0 -12
- package/dist/presets/cloudflare/preset.d.ts +0 -3
- package/dist/presets/cloudflare/preset.mjs +0 -145
- package/dist/presets/cloudflare/runtime/cloudflare-module.d.ts +0 -13
- package/dist/presets/cloudflare/runtime/cloudflare-worker.mjs +0 -64
- package/dist/presets/cloudflare/types.d.ts +0 -89
- package/dist/presets/cloudflare/types.mjs +0 -0
- package/dist/presets/cloudflare/types.wrangler.d.ts +0 -974
- package/dist/presets/cloudflare/types.wrangler.mjs +0 -0
- package/dist/presets/cloudflare/utils.d.ts +0 -3
- package/dist/presets/cloudflare/utils.mjs +0 -163
- package/dist/presets/deno/preset.d.ts +0 -2
- package/dist/presets/deno/preset.mjs +0 -148
- package/dist/presets/deno/runtime/_deno-env-polyfill.d.ts +0 -0
- package/dist/presets/deno/runtime/_deno-env-polyfill.mjs +0 -1
- package/dist/presets/digitalocean/preset.d.ts +0 -2
- package/dist/presets/digitalocean/preset.mjs +0 -11
- package/dist/presets/edgio/preset.d.ts +0 -2
- package/dist/presets/edgio/preset.mjs +0 -95
- package/dist/presets/firebase/preset.d.ts +0 -3
- package/dist/presets/firebase/preset.mjs +0 -50
- package/dist/presets/firebase/runtime/firebase-gen-1.d.ts +0 -2
- package/dist/presets/firebase/runtime/firebase-gen-1.mjs +0 -7
- package/dist/presets/firebase/runtime/firebase-gen-2.d.ts +0 -2
- package/dist/presets/firebase/runtime/firebase-gen-2.mjs +0 -14
- package/dist/presets/firebase/runtime/firebase-gen-default.d.ts +0 -1
- package/dist/presets/firebase/runtime/firebase-gen-default.mjs +0 -1
- package/dist/presets/firebase/types.d.ts +0 -38
- package/dist/presets/firebase/types.mjs +0 -0
- package/dist/presets/firebase/utils.d.ts +0 -3
- package/dist/presets/firebase/utils.mjs +0 -50
- package/dist/presets/flightcontrol/preset.d.ts +0 -2
- package/dist/presets/flightcontrol/preset.mjs +0 -11
- package/dist/presets/heroku/preset.d.ts +0 -2
- package/dist/presets/heroku/preset.mjs +0 -11
- package/dist/presets/iis/preset.d.ts +0 -2
- package/dist/presets/iis/preset.mjs +0 -32
- package/dist/presets/iis/utils.d.ts +0 -3
- package/dist/presets/iis/utils.mjs +0 -161
- package/dist/presets/index.d.mts +0 -1
- package/dist/presets/index.d.ts +0 -2
- package/dist/presets/index.mjs +0 -1
- package/dist/presets/koyeb/preset.d.ts +0 -2
- package/dist/presets/koyeb/preset.mjs +0 -11
- package/dist/presets/netlify/legacy/preset.d.ts +0 -2
- package/dist/presets/netlify/legacy/preset.mjs +0 -143
- package/dist/presets/netlify/legacy/runtime/_deno-env-polyfill.d.ts +0 -0
- package/dist/presets/netlify/legacy/runtime/_deno-env-polyfill.mjs +0 -1
- package/dist/presets/netlify/legacy/runtime/netlify-builder.d.ts +0 -3
- package/dist/presets/netlify/legacy/runtime/netlify-builder.mjs +0 -5
- package/dist/presets/netlify/legacy/runtime/netlify-edge.d.ts +0 -2
- package/dist/presets/netlify/legacy/runtime/netlify-edge.mjs +0 -25
- package/dist/presets/netlify/legacy/runtime/netlify-lambda.d.ts +0 -3
- package/dist/presets/netlify/legacy/runtime/netlify-lambda.mjs +0 -38
- package/dist/presets/netlify/legacy/runtime/netlify.d.ts +0 -4
- package/dist/presets/netlify/legacy/runtime/netlify.mjs +0 -22
- package/dist/presets/netlify/legacy/utils.d.ts +0 -4
- package/dist/presets/netlify/legacy/utils.mjs +0 -113
- package/dist/presets/netlify/preset.d.ts +0 -3
- package/dist/presets/netlify/preset.mjs +0 -128
- package/dist/presets/netlify/runtime/_deno-env-polyfill.d.ts +0 -0
- package/dist/presets/netlify/runtime/_deno-env-polyfill.mjs +0 -1
- package/dist/presets/netlify/runtime/netlify-edge.d.ts +0 -2
- package/dist/presets/netlify/types.d.ts +0 -12
- package/dist/presets/netlify/types.mjs +0 -0
- package/dist/presets/netlify/utils.d.ts +0 -5
- package/dist/presets/netlify/utils.mjs +0 -94
- package/dist/presets/node/preset.d.ts +0 -2
- package/dist/presets/node/preset.mjs +0 -49
- package/dist/presets/node/runtime/cli.d.ts +0 -1
- package/dist/presets/node/runtime/cli.mjs +0 -22
- package/dist/presets/node/runtime/node-listener.d.ts +0 -6
- package/dist/presets/platform.sh/preset.d.ts +0 -2
- package/dist/presets/platform.sh/preset.mjs +0 -11
- package/dist/presets/render.com/preset.d.ts +0 -2
- package/dist/presets/render.com/preset.mjs +0 -11
- package/dist/presets/stormkit/preset.d.ts +0 -2
- package/dist/presets/stormkit/preset.mjs +0 -15
- package/dist/presets/vercel/preset.d.ts +0 -3
- package/dist/presets/vercel/preset.mjs +0 -104
- package/dist/presets/vercel/runtime/vercel-edge.d.ts +0 -2
- package/dist/presets/vercel/runtime/vercel-edge.mjs +0 -22
- package/dist/presets/vercel/runtime/vercel.d.ts +0 -4
- package/dist/presets/vercel/types.d.ts +0 -78
- package/dist/presets/vercel/types.mjs +0 -0
- package/dist/presets/vercel/utils.d.ts +0 -5
- package/dist/presets/vercel/utils.mjs +0 -186
- package/dist/presets/winterjs/preset.d.ts +0 -2
- package/dist/presets/winterjs/preset.mjs +0 -20
- package/dist/presets/winterjs/runtime/winterjs.d.ts +0 -1
- package/dist/presets/zeabur/preset.d.ts +0 -2
- package/dist/presets/zeabur/preset.mjs +0 -70
- package/dist/presets/zeabur/runtime/zeabur.d.ts +0 -4
- package/dist/rollup/index.d.mts +0 -5
- package/dist/rollup/index.d.ts +0 -5
- package/dist/rollup/index.mjs +0 -1673
- package/dist/runtime/index.d.ts +0 -12
- package/dist/runtime/internal/app.d.ts +0 -3
- package/dist/runtime/internal/cache.d.ts +0 -8
- package/dist/runtime/internal/client.mjs +0 -4
- package/dist/runtime/internal/config.d.ts +0 -5
- package/dist/runtime/internal/config.mjs +0 -45
- package/dist/runtime/internal/error.d.ts +0 -4
- package/dist/runtime/internal/error.mjs +0 -73
- package/dist/runtime/internal/index.d.ts +0 -6
- package/dist/runtime/internal/renderer.d.ts +0 -2
- package/dist/runtime/internal/route-rules.d.ts +0 -14
- package/dist/runtime/internal/routes/openapi.d.ts +0 -3
- package/dist/runtime/internal/routes/scalar.d.ts +0 -2
- package/dist/runtime/internal/routes/swagger.d.ts +0 -2
- package/dist/runtime/internal/static.d.ts +0 -2
- package/dist/runtime/internal/timing.mjs +0 -29
- package/dist/runtime/internal/utils.d.ts +0 -21
- package/dist/runtime/internal/utils.lambda.d.ts +0 -10
- package/dist/runtime/internal/utils.lambda.mjs +0 -30
- package/dist/shared/nitro.bra5i6ER.d.mts +0 -620
- package/dist/shared/nitro.bra5i6ER.d.ts +0 -620
- package/dist/types/index.d.ts +0 -260
- package/kit.d.ts +0 -1
- package/meta.d.ts +0 -1
- package/presets.d.ts +0 -1
- package/rollup.d.ts +0 -1
- package/runtime.d.ts +0 -1
- package/types.d.ts +0 -1
- /package/dist/presets/_nitro/runtime/{nitro-dev.d.ts → nitro-dev.d.mts} +0 -0
- /package/dist/presets/_nitro/runtime/{service-worker.d.ts → service-worker.d.mts} +0 -0
- /package/dist/presets/aws-amplify/runtime/{aws-amplify.d.ts → aws-amplify.d.mts} +0 -0
- /package/dist/presets/azure/runtime/{azure-functions.d.ts → azure-swa.d.mts} +0 -0
- /package/dist/presets/bun/runtime/{bun.d.ts → bun.d.mts} +0 -0
- /package/dist/presets/{cloudflare/runtime/cloudflare-worker.d.ts → deno/runtime/deno-deploy.d.mts} +0 -0
- /package/dist/presets/netlify/runtime/{netlify.d.ts → netlify.d.mts} +0 -0
- /package/dist/presets/node/runtime/{cluster.d.ts → node-cluster.d.mts} +0 -0
- /package/dist/presets/{deno/runtime/deno-server.d.ts → node/runtime/node-server.d.mts} +0 -0
- /package/dist/presets/stormkit/runtime/{stormkit.d.ts → stormkit.d.mts} +0 -0
- /package/dist/presets/{deno/runtime/deno-deploy.d.ts → winterjs/runtime/winterjs.d.mts} +0 -0
- /package/dist/runtime/internal/{database.d.ts → database.d.mts} +0 -0
- /package/dist/runtime/internal/{debug.d.ts → debug.d.mts} +0 -0
- /package/dist/{presets/_types.gen.mjs → runtime/internal/empty.d.mts} +0 -0
- /package/dist/{presets/aws-amplify/types.mjs → runtime/internal/empty.mjs} +0 -0
- /package/dist/runtime/internal/lib/{http-graceful-shutdown.d.ts → http-graceful-shutdown.d.mts} +0 -0
- /package/dist/runtime/internal/{meta.d.ts → meta.d.mts} +0 -0
- /package/dist/runtime/internal/{plugin.d.ts → plugin.d.mts} +0 -0
- /package/dist/runtime/internal/{shutdown.d.ts → shutdown.d.mts} +0 -0
- /package/dist/runtime/internal/{storage.d.ts → storage.d.mts} +0 -0
- /package/dist/runtime/internal/{task.d.ts → task.d.mts} +0 -0
- /package/dist/runtime/internal/{client.d.ts → vite/dev-worker.d.mts} +0 -0
- /package/{dist/config/index.mjs → lib/config.mjs} +0 -0
|
@@ -1,40 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
eventHandler,
|
|
3
|
-
getResponseStatus,
|
|
4
|
-
send,
|
|
5
|
-
setResponseHeader,
|
|
6
|
-
setResponseHeaders,
|
|
7
|
-
setResponseStatus
|
|
8
|
-
} from "h3";
|
|
1
|
+
import { defineHandler } from "h3";
|
|
9
2
|
import { useNitroApp } from "./app.mjs";
|
|
10
|
-
import { useRuntimeConfig } from "./config.mjs";
|
|
11
|
-
export function defineRenderHandler(
|
|
3
|
+
import { useRuntimeConfig } from "./runtime-config.mjs";
|
|
4
|
+
export function defineRenderHandler(render) {
|
|
12
5
|
const runtimeConfig = useRuntimeConfig();
|
|
13
|
-
return
|
|
14
|
-
if (event.path === `${runtimeConfig.app.baseURL}favicon.ico`) {
|
|
15
|
-
setResponseHeader(event, "Content-Type", "image/x-icon");
|
|
16
|
-
return send(
|
|
17
|
-
event,
|
|
18
|
-
"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
const response = await handler(event);
|
|
22
|
-
if (!response) {
|
|
23
|
-
const _currentStatus = getResponseStatus(event);
|
|
24
|
-
setResponseStatus(event, _currentStatus === 200 ? 500 : _currentStatus);
|
|
25
|
-
return send(
|
|
26
|
-
event,
|
|
27
|
-
"No response returned from render handler: " + event.path
|
|
28
|
-
);
|
|
29
|
-
}
|
|
6
|
+
return defineHandler(async (event) => {
|
|
30
7
|
const nitroApp = useNitroApp();
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
8
|
+
const ctx = { event, render, response: void 0 };
|
|
9
|
+
await nitroApp.hooks.callHook("render:before", ctx);
|
|
10
|
+
if (!ctx.response) {
|
|
11
|
+
if (event.url.pathname === `${runtimeConfig.app.baseURL}favicon.ico`) {
|
|
12
|
+
event.res.headers.set("Content-Type", "image/x-icon");
|
|
13
|
+
return "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
14
|
+
}
|
|
15
|
+
ctx.response = await ctx.render(event);
|
|
16
|
+
if (!ctx.response) {
|
|
17
|
+
const _currentStatus = event.res.status;
|
|
18
|
+
event.res.statusText = String(
|
|
19
|
+
_currentStatus === 200 ? 500 : _currentStatus
|
|
20
|
+
);
|
|
21
|
+
return "No response returned from render handler: " + event.url.pathname;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
await nitroApp.hooks.callHook("render:response", ctx.response, ctx);
|
|
25
|
+
if (ctx.response.headers) {
|
|
26
|
+
for (const [key, value] of Object.entries(ctx.response.headers)) {
|
|
27
|
+
event.res.headers.set(key, value);
|
|
28
|
+
}
|
|
34
29
|
}
|
|
35
|
-
if (response.
|
|
36
|
-
|
|
30
|
+
if (ctx.response.status || ctx.response.statusText) {
|
|
31
|
+
event.res.status = ctx.response.status;
|
|
32
|
+
event.res.statusText = ctx.response.statusText;
|
|
37
33
|
}
|
|
38
|
-
return response.body;
|
|
34
|
+
return ctx.response.body;
|
|
39
35
|
});
|
|
40
36
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Middleware } from "h3";
|
|
2
|
+
import type { MatchedRouteRule, NitroRouteRules } from "nitro/types";
|
|
3
|
+
type RouteRuleCtor<T extends keyof NitroRouteRules> = (m: MatchedRouteRule<T>) => Middleware;
|
|
4
|
+
export declare const headers: RouteRuleCtor<"headers">;
|
|
5
|
+
export declare const redirect: RouteRuleCtor<"redirect">;
|
|
6
|
+
export declare const proxy: RouteRuleCtor<"proxy">;
|
|
7
|
+
export declare const cache: RouteRuleCtor<"cache">;
|
|
8
|
+
export {};
|
|
@@ -1,67 +1,62 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
setHeaders(event, routeRules.headers);
|
|
20
|
-
}
|
|
21
|
-
if (routeRules.redirect) {
|
|
22
|
-
let target = routeRules.redirect.to;
|
|
23
|
-
if (target.endsWith("/**")) {
|
|
24
|
-
let targetPath = event.path;
|
|
25
|
-
const strpBase = routeRules.redirect._redirectStripBase;
|
|
26
|
-
if (strpBase) {
|
|
27
|
-
targetPath = withoutBase(targetPath, strpBase);
|
|
28
|
-
}
|
|
29
|
-
target = joinURL(target.slice(0, -3), targetPath);
|
|
30
|
-
} else if (event.path.includes("?")) {
|
|
31
|
-
const query = getQuery(event.path);
|
|
32
|
-
target = withQuery(target, query);
|
|
33
|
-
}
|
|
34
|
-
return sendRedirect(event, target, routeRules.redirect.statusCode);
|
|
1
|
+
import { proxyRequest, redirect as sendRedirect } from "h3";
|
|
2
|
+
import { joinURL, withQuery, withoutBase } from "ufo";
|
|
3
|
+
import { defineCachedEventHandler } from "./cache.mjs";
|
|
4
|
+
export const headers = ((m) => function headersRouteRule(event) {
|
|
5
|
+
for (const [key, value] of Object.entries(m.options || {})) {
|
|
6
|
+
event.res.headers.set(key, value);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export const redirect = ((m) => function redirectRouteRule(event) {
|
|
10
|
+
let target = m.options?.to;
|
|
11
|
+
if (!target) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if (target.endsWith("/**")) {
|
|
15
|
+
let targetPath = event.url.pathname + event.url.search;
|
|
16
|
+
const strpBase = m.options._redirectStripBase;
|
|
17
|
+
if (strpBase) {
|
|
18
|
+
targetPath = withoutBase(targetPath, strpBase);
|
|
35
19
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
});
|
|
20
|
+
target = joinURL(target.slice(0, -3), targetPath);
|
|
21
|
+
} else if (event.url.search) {
|
|
22
|
+
target = withQuery(target, Object.fromEntries(event.url.searchParams));
|
|
23
|
+
}
|
|
24
|
+
return sendRedirect(target, m.options?.status);
|
|
25
|
+
});
|
|
26
|
+
export const proxy = ((m) => function proxyRouteRule(event) {
|
|
27
|
+
let target = m.options?.to;
|
|
28
|
+
if (!target) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (target.endsWith("/**")) {
|
|
32
|
+
let targetPath = event.url.pathname + event.url.search;
|
|
33
|
+
const strpBase = m.options._proxyStripBase;
|
|
34
|
+
if (strpBase) {
|
|
35
|
+
targetPath = withoutBase(targetPath, strpBase);
|
|
53
36
|
}
|
|
37
|
+
target = joinURL(target.slice(0, -3), targetPath);
|
|
38
|
+
} else if (event.url.search) {
|
|
39
|
+
target = withQuery(target, Object.fromEntries(event.url.searchParams));
|
|
40
|
+
}
|
|
41
|
+
return proxyRequest(event, target, {
|
|
42
|
+
...m.options
|
|
54
43
|
});
|
|
55
|
-
}
|
|
56
|
-
export function
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
44
|
+
});
|
|
45
|
+
export const cache = ((m) => function cacheRouteRule(event, next) {
|
|
46
|
+
if (!event.context.matchedRoute) {
|
|
47
|
+
return next();
|
|
48
|
+
}
|
|
49
|
+
const cachedHandlers = globalThis.__nitroCachedHandlers ??= /* @__PURE__ */ new Map();
|
|
50
|
+
const { handler, route } = event.context.matchedRoute;
|
|
51
|
+
const key = `${m.route}:${route}`;
|
|
52
|
+
let cachedHandler = cachedHandlers.get(key);
|
|
53
|
+
if (!cachedHandler) {
|
|
54
|
+
cachedHandler = defineCachedEventHandler(handler, {
|
|
55
|
+
group: "nitro/route-rules",
|
|
56
|
+
name: key,
|
|
57
|
+
...m.options
|
|
58
|
+
});
|
|
59
|
+
cachedHandlers.set(key, cachedHandler);
|
|
62
60
|
}
|
|
63
|
-
return event
|
|
64
|
-
}
|
|
65
|
-
export function getRouteRulesForPath(path) {
|
|
66
|
-
return defu({}, ..._routeRulesMatcher.matchAll(path).reverse());
|
|
67
|
-
}
|
|
61
|
+
return cachedHandler(event);
|
|
62
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { H3 } from "h3";
|
|
2
|
+
import { runTask } from "nitro/runtime";
|
|
3
|
+
import { scheduledTasks, tasks } from "#nitro-internal-virtual/tasks";
|
|
4
|
+
export default new H3().get("/_nitro/tasks", async () => {
|
|
5
|
+
const _tasks = await Promise.all(
|
|
6
|
+
Object.entries(tasks).map(async ([name, task]) => {
|
|
7
|
+
const _task = await task.resolve?.();
|
|
8
|
+
return [name, { description: _task?.meta?.description }];
|
|
9
|
+
})
|
|
10
|
+
);
|
|
11
|
+
return {
|
|
12
|
+
tasks: Object.fromEntries(_tasks),
|
|
13
|
+
scheduledTasks
|
|
14
|
+
};
|
|
15
|
+
}).get("/_nitro/tasks/:name", async (event) => {
|
|
16
|
+
const name = event.context.params?.name;
|
|
17
|
+
const body = await event.req.json().catch(() => ({}));
|
|
18
|
+
const payload = {
|
|
19
|
+
...Object.fromEntries(event.url.searchParams.entries()),
|
|
20
|
+
...body
|
|
21
|
+
};
|
|
22
|
+
return await runTask(name, { payload });
|
|
23
|
+
});
|
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineHandler, getRequestURL } from "h3";
|
|
2
2
|
import { joinURL } from "ufo";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { defu } from "defu";
|
|
4
|
+
import { handlersMeta } from "#nitro-internal-virtual/routing-meta";
|
|
5
|
+
import { useRuntimeConfig } from "../runtime-config.mjs";
|
|
6
|
+
export default defineHandler((event) => {
|
|
7
|
+
const runtimeConfig = useRuntimeConfig();
|
|
7
8
|
const base = runtimeConfig.app?.baseURL;
|
|
8
9
|
const url = joinURL(getRequestURL(event).origin, base);
|
|
9
10
|
const meta = {
|
|
10
11
|
title: "Nitro Server Routes",
|
|
11
12
|
...runtimeConfig.nitro?.openAPI?.meta
|
|
12
13
|
};
|
|
14
|
+
const {
|
|
15
|
+
paths,
|
|
16
|
+
globals: { components, ...globalsRest }
|
|
17
|
+
} = getHandlersMeta();
|
|
18
|
+
const extensible = Object.fromEntries(
|
|
19
|
+
Object.entries(globalsRest).filter(([key]) => key.startsWith("x-"))
|
|
20
|
+
);
|
|
13
21
|
return {
|
|
14
22
|
openapi: "3.1.0",
|
|
15
23
|
info: {
|
|
@@ -24,15 +32,19 @@ export default eventHandler((event) => {
|
|
|
24
32
|
variables: {}
|
|
25
33
|
}
|
|
26
34
|
],
|
|
27
|
-
paths
|
|
35
|
+
paths,
|
|
36
|
+
components,
|
|
37
|
+
...extensible
|
|
28
38
|
};
|
|
29
39
|
});
|
|
30
|
-
function
|
|
40
|
+
function getHandlersMeta() {
|
|
31
41
|
const paths = {};
|
|
42
|
+
let globals = {};
|
|
32
43
|
for (const h of handlersMeta) {
|
|
33
44
|
const { route, parameters } = normalizeRoute(h.route || "");
|
|
34
45
|
const tags = defaultTags(h.route || "");
|
|
35
46
|
const method = (h.method || "get").toLowerCase();
|
|
47
|
+
const { $global, ...openAPI } = h.meta?.openAPI || {};
|
|
36
48
|
const item = {
|
|
37
49
|
[method]: {
|
|
38
50
|
tags,
|
|
@@ -40,16 +52,19 @@ function getPaths() {
|
|
|
40
52
|
responses: {
|
|
41
53
|
200: { description: "OK" }
|
|
42
54
|
},
|
|
43
|
-
...
|
|
55
|
+
...openAPI
|
|
44
56
|
}
|
|
45
57
|
};
|
|
58
|
+
if ($global) {
|
|
59
|
+
globals = defu($global, globals);
|
|
60
|
+
}
|
|
46
61
|
if (paths[route] === void 0) {
|
|
47
62
|
paths[route] = item;
|
|
48
63
|
} else {
|
|
49
64
|
Object.assign(paths[route], item);
|
|
50
65
|
}
|
|
51
66
|
}
|
|
52
|
-
return paths;
|
|
67
|
+
return { paths, globals };
|
|
53
68
|
}
|
|
54
69
|
function normalizeRoute(_route) {
|
|
55
70
|
const parameters = [];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
rendererTemplate,
|
|
3
|
+
rendererTemplateFile
|
|
4
|
+
} from "#nitro-internal-virtual/renderer-template";
|
|
5
|
+
import { HTTPResponse } from "h3";
|
|
6
|
+
import { hasTemplateSyntax, renderToResponse, compileTemplate } from "rendu";
|
|
7
|
+
export default async function renderIndexHTML(event) {
|
|
8
|
+
let html = await rendererTemplate(event.req);
|
|
9
|
+
if (globalThis.__transform_html__) {
|
|
10
|
+
html = await globalThis.__transform_html__(html);
|
|
11
|
+
}
|
|
12
|
+
if (!hasTemplateSyntax(html)) {
|
|
13
|
+
return new HTTPResponse(html, {
|
|
14
|
+
headers: { "content-type": "text/html; charset=utf-8" }
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
const template = compileTemplate(html, { filename: rendererTemplateFile });
|
|
18
|
+
return renderToResponse(template, {
|
|
19
|
+
request: event.req
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useRuntimeConfig } from "../config.mjs";
|
|
3
|
-
export default
|
|
4
|
-
const runtimeConfig = useRuntimeConfig(
|
|
1
|
+
import { defineHandler } from "h3";
|
|
2
|
+
import { useRuntimeConfig } from "../runtime-config.mjs";
|
|
3
|
+
export default defineHandler((event) => {
|
|
4
|
+
const runtimeConfig = useRuntimeConfig();
|
|
5
5
|
const title = runtimeConfig.nitro.openAPI?.meta?.title || "API Reference";
|
|
6
6
|
const description = runtimeConfig.nitro.openAPI?.meta?.description || "";
|
|
7
7
|
const openAPIEndpoint = runtimeConfig.nitro.openAPI?.route || "./_openapi.json";
|
|
8
8
|
const _config = runtimeConfig.nitro.openAPI?.ui?.scalar;
|
|
9
9
|
const scalarConfig = {
|
|
10
10
|
..._config,
|
|
11
|
+
url: openAPIEndpoint,
|
|
12
|
+
// @ts-expect-error (missing types?)
|
|
11
13
|
spec: { url: openAPIEndpoint, ..._config?.spec }
|
|
12
14
|
};
|
|
15
|
+
event.res.headers.set("Content-Type", "text/html");
|
|
13
16
|
return (
|
|
14
17
|
/* html */
|
|
15
18
|
`<!doctype html>
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useRuntimeConfig } from "../config.mjs";
|
|
3
|
-
export default
|
|
4
|
-
const runtimeConfig = useRuntimeConfig(
|
|
1
|
+
import { defineHandler } from "h3";
|
|
2
|
+
import { useRuntimeConfig } from "../runtime-config.mjs";
|
|
3
|
+
export default defineHandler((event) => {
|
|
4
|
+
const runtimeConfig = useRuntimeConfig();
|
|
5
5
|
const title = runtimeConfig.nitro.openAPI?.meta?.title || "API Reference";
|
|
6
6
|
const description = runtimeConfig.nitro.openAPI?.meta?.description || "";
|
|
7
7
|
const openAPIEndpoint = runtimeConfig.nitro.openAPI?.route || "./_openapi.json";
|
|
8
8
|
const CDN_BASE = "https://cdn.jsdelivr.net/npm/swagger-ui-dist@^5";
|
|
9
|
+
event.res.headers.set("Content-Type", "text/html");
|
|
9
10
|
return (
|
|
10
11
|
/* html */
|
|
11
12
|
`<!doctype html>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import type { NitroRuntimeConfig } from "nitro/types";
|
|
2
|
+
export declare function useRuntimeConfig(): NitroRuntimeConfig;
|
|
3
|
+
type EnvOptions = {
|
|
2
4
|
prefix?: string;
|
|
3
5
|
altPrefix?: string;
|
|
4
6
|
envExpansion?: boolean;
|
|
5
7
|
};
|
|
6
|
-
export declare function getEnv(key: string, opts: EnvOptions): unknown;
|
|
7
8
|
export declare function applyEnv(obj: Record<string, any>, opts: EnvOptions, parentKey?: string): Record<string, any>;
|
|
9
|
+
export {};
|
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import destr from "destr";
|
|
2
1
|
import { snakeCase } from "scule";
|
|
3
|
-
export function
|
|
2
|
+
export function useRuntimeConfig() {
|
|
3
|
+
return useRuntimeConfig._cached ||= getRuntimeConfig();
|
|
4
|
+
}
|
|
5
|
+
function getRuntimeConfig() {
|
|
6
|
+
const runtimeConfig = globalThis.__NITRO_RUNTIME_CONFIG__ || process.env.RUNTIME_CONFIG || {};
|
|
7
|
+
const env = globalThis.process?.env || {};
|
|
8
|
+
applyEnv(runtimeConfig, {
|
|
9
|
+
prefix: "NITRO_",
|
|
10
|
+
altPrefix: runtimeConfig.nitro?.envPrefix ?? env?.NITRO_ENV_PREFIX ?? "_",
|
|
11
|
+
envExpansion: runtimeConfig.nitro?.envExpansion ?? env?.NITRO_ENV_EXPANSION ?? false
|
|
12
|
+
});
|
|
13
|
+
return runtimeConfig;
|
|
14
|
+
}
|
|
15
|
+
function getEnv(key, opts) {
|
|
4
16
|
const envKey = snakeCase(key).toUpperCase();
|
|
5
|
-
return
|
|
6
|
-
process.env[opts.prefix + envKey] ?? process.env[opts.altPrefix + envKey]
|
|
7
|
-
);
|
|
17
|
+
return process.env[opts.prefix + envKey] ?? process.env[opts.altPrefix + envKey];
|
|
8
18
|
}
|
|
9
19
|
function _isObject(input) {
|
|
10
20
|
return typeof input === "object" && !Array.isArray(input);
|
|
@@ -31,7 +41,7 @@ export function applyEnv(obj, opts, parentKey = "") {
|
|
|
31
41
|
}
|
|
32
42
|
return obj;
|
|
33
43
|
}
|
|
34
|
-
const envExpandRx =
|
|
44
|
+
const envExpandRx = /\{\{([^{}]*)\}\}/g;
|
|
35
45
|
function _expandFromEnv(value) {
|
|
36
46
|
return value.replace(envExpandRx, (match, key) => {
|
|
37
47
|
return process.env[key] || match;
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createError,
|
|
3
|
-
eventHandler,
|
|
4
|
-
getRequestHeader,
|
|
5
|
-
getResponseHeader,
|
|
6
|
-
removeResponseHeader,
|
|
7
|
-
setResponseHeader,
|
|
8
|
-
setResponseStatus
|
|
9
|
-
} from "h3";
|
|
1
|
+
import { HTTPError, defineHandler } from "h3";
|
|
10
2
|
import {
|
|
11
3
|
decodePath,
|
|
12
4
|
joinURL,
|
|
13
|
-
parseURL,
|
|
14
5
|
withLeadingSlash,
|
|
15
6
|
withoutTrailingSlash
|
|
16
7
|
} from "ufo";
|
|
@@ -21,23 +12,21 @@ import {
|
|
|
21
12
|
} from "#nitro-internal-virtual/public-assets";
|
|
22
13
|
const METHODS = /* @__PURE__ */ new Set(["HEAD", "GET"]);
|
|
23
14
|
const EncodingMap = { gzip: ".gz", br: ".br" };
|
|
24
|
-
export default
|
|
25
|
-
if (event.method && !METHODS.has(event.method)) {
|
|
15
|
+
export default defineHandler((event) => {
|
|
16
|
+
if (event.req.method && !METHODS.has(event.req.method)) {
|
|
26
17
|
return;
|
|
27
18
|
}
|
|
28
19
|
let id = decodePath(
|
|
29
|
-
withLeadingSlash(withoutTrailingSlash(
|
|
20
|
+
withLeadingSlash(withoutTrailingSlash(event.url.pathname))
|
|
30
21
|
);
|
|
31
22
|
let asset;
|
|
32
|
-
const encodingHeader =
|
|
33
|
-
getRequestHeader(event, "accept-encoding") || ""
|
|
34
|
-
);
|
|
23
|
+
const encodingHeader = event.req.headers.get("accept-encoding") || "";
|
|
35
24
|
const encodings = [
|
|
36
25
|
...encodingHeader.split(",").map((e) => EncodingMap[e.trim()]).filter(Boolean).sort(),
|
|
37
26
|
""
|
|
38
27
|
];
|
|
39
28
|
if (encodings.length > 1) {
|
|
40
|
-
|
|
29
|
+
event.res.headers.append("Vary", "Accept-Encoding");
|
|
41
30
|
}
|
|
42
31
|
for (const encoding of encodings) {
|
|
43
32
|
for (const _id of [id + encoding, joinURL(id, "index.html" + encoding)]) {
|
|
@@ -51,39 +40,38 @@ export default eventHandler((event) => {
|
|
|
51
40
|
}
|
|
52
41
|
if (!asset) {
|
|
53
42
|
if (isPublicAssetURL(id)) {
|
|
54
|
-
|
|
55
|
-
throw
|
|
56
|
-
statusMessage: "Cannot find static asset " + id,
|
|
57
|
-
statusCode: 404
|
|
58
|
-
});
|
|
43
|
+
event.res.headers.delete("Cache-Control");
|
|
44
|
+
throw new HTTPError({ status: 404 });
|
|
59
45
|
}
|
|
60
46
|
return;
|
|
61
47
|
}
|
|
62
|
-
const ifNotMatch =
|
|
48
|
+
const ifNotMatch = event.req.headers.get("if-none-match") === asset.etag;
|
|
63
49
|
if (ifNotMatch) {
|
|
64
|
-
|
|
50
|
+
event.res.status = 304;
|
|
51
|
+
event.res.statusText = "Not Modified";
|
|
65
52
|
return "";
|
|
66
53
|
}
|
|
67
|
-
const ifModifiedSinceH =
|
|
54
|
+
const ifModifiedSinceH = event.req.headers.get("if-modified-since");
|
|
68
55
|
const mtimeDate = new Date(asset.mtime);
|
|
69
56
|
if (ifModifiedSinceH && asset.mtime && new Date(ifModifiedSinceH) >= mtimeDate) {
|
|
70
|
-
|
|
57
|
+
event.res.status = 304;
|
|
58
|
+
event.res.statusText = "Not Modified";
|
|
71
59
|
return "";
|
|
72
60
|
}
|
|
73
|
-
if (asset.type
|
|
74
|
-
|
|
61
|
+
if (asset.type) {
|
|
62
|
+
event.res.headers.set("Content-Type", asset.type);
|
|
75
63
|
}
|
|
76
|
-
if (asset.etag && !
|
|
77
|
-
|
|
64
|
+
if (asset.etag && !event.res.headers.has("ETag")) {
|
|
65
|
+
event.res.headers.set("ETag", asset.etag);
|
|
78
66
|
}
|
|
79
|
-
if (asset.mtime && !
|
|
80
|
-
|
|
67
|
+
if (asset.mtime && !event.res.headers.has("Last-Modified")) {
|
|
68
|
+
event.res.headers.set("Last-Modified", mtimeDate.toUTCString());
|
|
81
69
|
}
|
|
82
|
-
if (asset.encoding && !
|
|
83
|
-
|
|
70
|
+
if (asset.encoding && !event.res.headers.has("Content-Encoding")) {
|
|
71
|
+
event.res.headers.set("Content-Encoding", asset.encoding);
|
|
84
72
|
}
|
|
85
|
-
if (asset.size > 0 && !
|
|
86
|
-
|
|
73
|
+
if (asset.size > 0 && !event.res.headers.has("Content-Length")) {
|
|
74
|
+
event.res.headers.set("Content-Length", asset.size.toString());
|
|
87
75
|
}
|
|
88
76
|
return readAsset(id);
|
|
89
77
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { prefixStorage } from "unstorage";
|
|
2
|
-
import {
|
|
2
|
+
import { initStorage } from "#nitro-internal-virtual/storage";
|
|
3
3
|
export function useStorage(base = "") {
|
|
4
|
+
const storage = useStorage._storage ??= initStorage();
|
|
4
5
|
return base ? prefixStorage(storage, base) : storage;
|
|
5
6
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Cron } from "croner";
|
|
2
|
-
import {
|
|
2
|
+
import { HTTPError } from "h3";
|
|
3
3
|
import { isTest } from "std-env";
|
|
4
4
|
import { scheduledTasks, tasks } from "#nitro-internal-virtual/tasks";
|
|
5
5
|
export function defineTask(def) {
|
|
@@ -19,15 +19,15 @@ export async function runTask(name, {
|
|
|
19
19
|
return __runningTasks__[name];
|
|
20
20
|
}
|
|
21
21
|
if (!(name in tasks)) {
|
|
22
|
-
throw
|
|
22
|
+
throw new HTTPError({
|
|
23
23
|
message: `Task \`${name}\` is not available!`,
|
|
24
|
-
|
|
24
|
+
status: 404
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
if (!tasks[name].resolve) {
|
|
28
|
-
throw
|
|
28
|
+
throw new HTTPError({
|
|
29
29
|
message: `Task \`${name}\` is not implemented!`,
|
|
30
|
-
|
|
30
|
+
status: 501
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
const handler = await tasks[name].resolve();
|
|
@@ -56,7 +56,7 @@ export function startScheduleRunner() {
|
|
|
56
56
|
context: {}
|
|
57
57
|
}).catch((error) => {
|
|
58
58
|
console.error(
|
|
59
|
-
`
|
|
59
|
+
`Error while running scheduled task "${name}"`,
|
|
60
60
|
error
|
|
61
61
|
);
|
|
62
62
|
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function trapUnhandledNodeErrors(): void;
|