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
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// src/component.ts
|
|
2
|
-
import { readFile } from "fs/promises";
|
|
3
|
-
var BaseComponent = class {
|
|
4
|
-
#cachedStyles;
|
|
5
|
-
#cachedScript;
|
|
6
|
-
/**
|
|
7
|
-
* A flag to know if we are in dev mode or not. In dev mode,
|
|
8
|
-
* the styles and scripts are refetched from the disk.
|
|
9
|
-
* Otherwise they are cached.
|
|
10
|
-
*/
|
|
11
|
-
#inDevMode;
|
|
12
|
-
/**
|
|
13
|
-
* Absolute path to the frontend JavaScript that should be
|
|
14
|
-
* injected within the HTML head. The JavaScript does not
|
|
15
|
-
* get transpiled, hence it should work cross browser by
|
|
16
|
-
* default.
|
|
17
|
-
*/
|
|
18
|
-
scriptFile;
|
|
19
|
-
/**
|
|
20
|
-
* Absolute path to the CSS file that should be injected
|
|
21
|
-
* within the HTML head.
|
|
22
|
-
*/
|
|
23
|
-
cssFile;
|
|
24
|
-
constructor(devMode) {
|
|
25
|
-
this.#inDevMode = devMode;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Returns the styles for the component. The null value
|
|
29
|
-
* is not returned if no styles are associated with
|
|
30
|
-
* the component
|
|
31
|
-
*/
|
|
32
|
-
async getStyles() {
|
|
33
|
-
if (!this.cssFile) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
if (this.#inDevMode) {
|
|
37
|
-
return await readFile(this.cssFile, "utf-8");
|
|
38
|
-
}
|
|
39
|
-
this.#cachedStyles = this.#cachedStyles ?? await readFile(this.cssFile, "utf-8");
|
|
40
|
-
return this.#cachedStyles;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Returns the frontend script for the component. The null
|
|
44
|
-
* value is not returned if no styles are associated
|
|
45
|
-
* with the component
|
|
46
|
-
*/
|
|
47
|
-
async getScript() {
|
|
48
|
-
if (!this.scriptFile) {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
if (this.#inDevMode) {
|
|
52
|
-
return await readFile(this.scriptFile, "utf-8");
|
|
53
|
-
}
|
|
54
|
-
this.#cachedScript = this.#cachedScript ?? await readFile(this.scriptFile, "utf-8");
|
|
55
|
-
return this.#cachedScript;
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export {
|
|
60
|
-
BaseComponent
|
|
61
|
-
};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
colors,
|
|
3
|
-
wordWrap
|
|
4
|
-
} from "./chunk-4L7RY2JA.js";
|
|
5
|
-
import {
|
|
6
|
-
publicDirURL
|
|
7
|
-
} from "./chunk-OSUFJZHZ.js";
|
|
8
|
-
import {
|
|
9
|
-
BaseComponent
|
|
10
|
-
} from "./chunk-4YEN7HVQ.js";
|
|
11
|
-
|
|
12
|
-
// src/templates/error_info/main.ts
|
|
13
|
-
var ERROR_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="24" height="24" fill="none"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 7v6m0 4.01.01-.011M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"/></svg>`;
|
|
14
|
-
var HINT_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="24" height="24" fill="none"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m21 2-1 1M3 2l1 1m17 13-1-1M3 16l1-1m5 3h6m-5 3h4M12 3C8 3 5.952 4.95 6 8c.023 1.487.5 2.5 1.5 3.5S9 13 9 15h6c0-2 .5-2.5 1.5-3.5h0c1-1 1.477-2.013 1.5-3.5.048-3.05-2-5-6-5Z"/></svg>`;
|
|
15
|
-
var COPY_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z" /><path d="M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1" /></svg>`;
|
|
16
|
-
function htmlAttributeEscape(value) {
|
|
17
|
-
return value.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">");
|
|
18
|
-
}
|
|
19
|
-
var ErrorInfo = class extends BaseComponent {
|
|
20
|
-
cssFile = new URL("./error_info/style.css", publicDirURL);
|
|
21
|
-
scriptFile = new URL("./error_info/script.js", publicDirURL);
|
|
22
|
-
/**
|
|
23
|
-
* The toHTML method is used to output the HTML for the
|
|
24
|
-
* web view
|
|
25
|
-
*/
|
|
26
|
-
async toHTML(props) {
|
|
27
|
-
return `<section>
|
|
28
|
-
<h4 id="error-name">${props.error.name}</h4>
|
|
29
|
-
<h1 id="error-title">${props.title}</h1>
|
|
30
|
-
</section>
|
|
31
|
-
<section>
|
|
32
|
-
<div class="card">
|
|
33
|
-
<div class="card-body">
|
|
34
|
-
<h2 id="error-message">
|
|
35
|
-
<span>${ERROR_ICON_SVG}</span>
|
|
36
|
-
<span>${props.error.message}</span>
|
|
37
|
-
<button
|
|
38
|
-
id="copy-error-btn"
|
|
39
|
-
data-error-text="${htmlAttributeEscape(`${props.error.name}: ${props.error.message}`)}"
|
|
40
|
-
onclick="copyErrorMessage(this)"
|
|
41
|
-
title="Copy error message"
|
|
42
|
-
aria-label="Copy error message to clipboard"
|
|
43
|
-
>
|
|
44
|
-
${COPY_ICON_SVG}
|
|
45
|
-
</button>
|
|
46
|
-
</h2>
|
|
47
|
-
${props.error.hint ? `<div id="error-hint">
|
|
48
|
-
<span>${HINT_ICON_SVG}</span>
|
|
49
|
-
<span>${props.error.hint}</span>
|
|
50
|
-
</div>` : ""}
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
</section>`;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* The toANSI method is used to output the text for the console
|
|
57
|
-
*/
|
|
58
|
-
async toANSI(props) {
|
|
59
|
-
const errorMessage = colors.red(
|
|
60
|
-
`\u2139 ${wordWrap(`${props.error.name}: ${props.error.message}`, {
|
|
61
|
-
width: process.stdout.columns,
|
|
62
|
-
indent: " ",
|
|
63
|
-
newLine: "\n",
|
|
64
|
-
escape: (value) => value
|
|
65
|
-
})}`
|
|
66
|
-
);
|
|
67
|
-
const hint = props.error.hint ? `
|
|
68
|
-
|
|
69
|
-
${colors.blue("\u25C9")} ${colors.dim().italic(
|
|
70
|
-
wordWrap(props.error.hint.replace(/(<([^>]+)>)/gi, ""), {
|
|
71
|
-
width: process.stdout.columns,
|
|
72
|
-
indent: " ",
|
|
73
|
-
newLine: "\n",
|
|
74
|
-
escape: (value) => value
|
|
75
|
-
})
|
|
76
|
-
)}` : "";
|
|
77
|
-
return `${errorMessage}${hint}`;
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export {
|
|
82
|
-
ErrorInfo
|
|
83
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
publicDirURL
|
|
3
|
-
} from "./chunk-OSUFJZHZ.js";
|
|
4
|
-
import {
|
|
5
|
-
BaseComponent
|
|
6
|
-
} from "./chunk-4YEN7HVQ.js";
|
|
7
|
-
|
|
8
|
-
// src/templates/layout/main.ts
|
|
9
|
-
var Layout = class extends BaseComponent {
|
|
10
|
-
cssFile = new URL("./layout/style.css", publicDirURL);
|
|
11
|
-
scriptFile = new URL("./layout/script.js", publicDirURL);
|
|
12
|
-
/**
|
|
13
|
-
* The toHTML method is used to output the HTML for the
|
|
14
|
-
* web view
|
|
15
|
-
*/
|
|
16
|
-
async toHTML(props) {
|
|
17
|
-
return `<!DOCTYPE html>
|
|
18
|
-
<html lang="en">
|
|
19
|
-
<head>
|
|
20
|
-
<meta charset="UTF-8" />
|
|
21
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
22
|
-
<title>${props.title}</title>
|
|
23
|
-
<!-- STYLES -->
|
|
24
|
-
<!-- GLOBAL SCRIPT -->
|
|
25
|
-
</head>
|
|
26
|
-
<body>
|
|
27
|
-
<div id="layout">
|
|
28
|
-
${await props.children()}
|
|
29
|
-
</div>
|
|
30
|
-
<!-- SCRIPTS -->
|
|
31
|
-
</body>
|
|
32
|
-
</html>`;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* The toANSI method is used to output the text for the console
|
|
36
|
-
*/
|
|
37
|
-
async toANSI(props) {
|
|
38
|
-
return `
|
|
39
|
-
${await props.children()}
|
|
40
|
-
`;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export {
|
|
45
|
-
Layout
|
|
46
|
-
};
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BaseComponent
|
|
3
|
-
} from "./chunk-4YEN7HVQ.js";
|
|
4
|
-
|
|
5
|
-
// src/templates/error_metadata/main.ts
|
|
6
|
-
import { dump, themes } from "@poppinss/dumper/html";
|
|
7
|
-
var ErrorMetadata = class extends BaseComponent {
|
|
8
|
-
#primitives = ["string", "boolean", "number", "undefined"];
|
|
9
|
-
/**
|
|
10
|
-
* Formats the error row value
|
|
11
|
-
*/
|
|
12
|
-
#formatRowValue(value, dumpValue, cspNonce) {
|
|
13
|
-
if (dumpValue === true) {
|
|
14
|
-
return dump(value, { styles: themes.cssVariables, cspNonce });
|
|
15
|
-
}
|
|
16
|
-
if (this.#primitives.includes(typeof value) || value === null) {
|
|
17
|
-
return value;
|
|
18
|
-
}
|
|
19
|
-
return dump(value, { styles: themes.cssVariables, cspNonce });
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Returns HTML fragment with HTML table containing rows
|
|
23
|
-
* metadata section rows
|
|
24
|
-
*/
|
|
25
|
-
#renderRows(rows, cspNonce) {
|
|
26
|
-
return `<table class="card-table">
|
|
27
|
-
<tbody>
|
|
28
|
-
${rows.map((row) => {
|
|
29
|
-
return `<tr>
|
|
30
|
-
<td class="table-key">${row.key}</td>
|
|
31
|
-
<td class="table-value">
|
|
32
|
-
${this.#formatRowValue(row.value, row.dump, cspNonce)}
|
|
33
|
-
</td>
|
|
34
|
-
</tr>`;
|
|
35
|
-
}).join("\n")}
|
|
36
|
-
</tbody>
|
|
37
|
-
</table>`;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Renders each section with its rows inside a table
|
|
41
|
-
*/
|
|
42
|
-
#renderSection(section, rows, cspNonce) {
|
|
43
|
-
return `<div>
|
|
44
|
-
<h4 class="card-subtitle">${section}</h4>
|
|
45
|
-
${Array.isArray(rows) ? this.#renderRows(rows, cspNonce) : `<span>${this.#formatRowValue(rows.value, rows.dump, cspNonce)}</span>`}
|
|
46
|
-
</div>`;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Renders each group as a card
|
|
50
|
-
*/
|
|
51
|
-
#renderGroup(group, sections, cspNonce) {
|
|
52
|
-
return `<section>
|
|
53
|
-
<div class="card">
|
|
54
|
-
<div class="card-heading">
|
|
55
|
-
<h3 class="card-title">${group}</h3>
|
|
56
|
-
</div>
|
|
57
|
-
<div class="card-body">
|
|
58
|
-
${Object.keys(sections).map((section) => this.#renderSection(section, sections[section], cspNonce)).join("\n")}
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
</section>`;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* The toHTML method is used to output the HTML for the
|
|
65
|
-
* web view
|
|
66
|
-
*/
|
|
67
|
-
async toHTML(props) {
|
|
68
|
-
const groups = props.metadata.toJSON();
|
|
69
|
-
const groupsNames = Object.keys(groups);
|
|
70
|
-
if (!groupsNames.length) {
|
|
71
|
-
return "";
|
|
72
|
-
}
|
|
73
|
-
return groupsNames.map((group) => this.#renderGroup(group, groups[group], props.cspNonce)).join("\n");
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* The toANSI method is used to output the text for the console
|
|
77
|
-
*/
|
|
78
|
-
async toANSI() {
|
|
79
|
-
return "";
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export {
|
|
84
|
-
ErrorMetadata
|
|
85
|
-
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
colors
|
|
3
|
-
} from "./chunk-4L7RY2JA.js";
|
|
4
|
-
import {
|
|
5
|
-
publicDirURL
|
|
6
|
-
} from "./chunk-OSUFJZHZ.js";
|
|
7
|
-
import {
|
|
8
|
-
BaseComponent
|
|
9
|
-
} from "./chunk-4YEN7HVQ.js";
|
|
10
|
-
|
|
11
|
-
// src/templates/error_cause/main.ts
|
|
12
|
-
import { dump, themes } from "@poppinss/dumper/html";
|
|
13
|
-
import { dump as dumpCli } from "@poppinss/dumper/console";
|
|
14
|
-
var ErrorCause = class extends BaseComponent {
|
|
15
|
-
cssFile = new URL("./error_cause/style.css", publicDirURL);
|
|
16
|
-
/**
|
|
17
|
-
* The toHTML method is used to output the HTML for the
|
|
18
|
-
* web view
|
|
19
|
-
*/
|
|
20
|
-
async toHTML(props) {
|
|
21
|
-
if (!props.error.cause) {
|
|
22
|
-
return "";
|
|
23
|
-
}
|
|
24
|
-
return `<section>
|
|
25
|
-
<div class="card">
|
|
26
|
-
<div class="card-heading">
|
|
27
|
-
<div>
|
|
28
|
-
<h3 class="card-title">
|
|
29
|
-
Error Cause
|
|
30
|
-
</h3>
|
|
31
|
-
</div>
|
|
32
|
-
</div>
|
|
33
|
-
<div class="card-body">
|
|
34
|
-
<div id="error-cause">
|
|
35
|
-
${dump(props.error.cause, {
|
|
36
|
-
cspNonce: props.cspNonce,
|
|
37
|
-
styles: themes.cssVariables,
|
|
38
|
-
inspectObjectPrototype: false,
|
|
39
|
-
inspectStaticMembers: false,
|
|
40
|
-
inspectArrayPrototype: false
|
|
41
|
-
})}
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
</section>`;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* The toANSI method is used to output the text for the console
|
|
49
|
-
*/
|
|
50
|
-
async toANSI(props) {
|
|
51
|
-
if (!props.error.cause) {
|
|
52
|
-
return "";
|
|
53
|
-
}
|
|
54
|
-
let depth = process.env.YOUCH_CAUSE ? Number(process.env.YOUCH_CAUSE) : 2;
|
|
55
|
-
if (Number.isNaN(depth)) {
|
|
56
|
-
depth = 2;
|
|
57
|
-
}
|
|
58
|
-
return `
|
|
59
|
-
|
|
60
|
-
${colors.red("[CAUSE]")}
|
|
61
|
-
${dumpCli(props.error.cause, {
|
|
62
|
-
depth,
|
|
63
|
-
inspectObjectPrototype: false,
|
|
64
|
-
inspectStaticMembers: false,
|
|
65
|
-
inspectArrayPrototype: false
|
|
66
|
-
})}`;
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export {
|
|
71
|
-
ErrorCause
|
|
72
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
publicDirURL
|
|
3
|
-
} from "./chunk-OSUFJZHZ.js";
|
|
4
|
-
import {
|
|
5
|
-
BaseComponent
|
|
6
|
-
} from "./chunk-4YEN7HVQ.js";
|
|
7
|
-
|
|
8
|
-
// src/templates/header/main.ts
|
|
9
|
-
var DARK_MODE_SVG = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="15" height="15" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path d="M0 0h24v24H0z" stroke="none"/><path d="M12 3h.393a7.5 7.5 0 0 0 7.92 12.446A9 9 0 1 1 12 2.992z"/></svg>`;
|
|
10
|
-
var LIGHT_MODE_SVG = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="15" height="15" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path d="M0 0h24v24H0z" stroke="none"/><circle cx="12" cy="12" r="4"/><path d="M3 12h1m8-9v1m8 8h1m-9 8v1M5.6 5.6l.7.7m12.1-.7-.7.7m0 11.4.7.7m-12.1-.7-.7.7"/></svg>`;
|
|
11
|
-
var Header = class extends BaseComponent {
|
|
12
|
-
cssFile = new URL("./header/style.css", publicDirURL);
|
|
13
|
-
scriptFile = new URL("./header/script.js", publicDirURL);
|
|
14
|
-
/**
|
|
15
|
-
* The toHTML method is used to output the HTML for the
|
|
16
|
-
* web view
|
|
17
|
-
*/
|
|
18
|
-
async toHTML() {
|
|
19
|
-
return `<header id="header">
|
|
20
|
-
<div id="header-actions">
|
|
21
|
-
<div id="toggle-theme-container">
|
|
22
|
-
<input type="checkbox" id="toggle-theme-checkbox" />
|
|
23
|
-
<label id="toggle-theme-label" for="toggle-theme-checkbox">
|
|
24
|
-
<span id="light-theme-indicator" title="Light mode">${LIGHT_MODE_SVG}</span>
|
|
25
|
-
<span id="dark-theme-indicator" title="Dark mode">${DARK_MODE_SVG}</span>
|
|
26
|
-
</label>
|
|
27
|
-
</div>
|
|
28
|
-
</div>
|
|
29
|
-
</header>`;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* The toANSI method is used to output the text for the console
|
|
33
|
-
*/
|
|
34
|
-
async toANSI() {
|
|
35
|
-
return "";
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export {
|
|
40
|
-
Header
|
|
41
|
-
};
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
colors,
|
|
3
|
-
htmlEscape
|
|
4
|
-
} from "./chunk-4L7RY2JA.js";
|
|
5
|
-
import {
|
|
6
|
-
publicDirURL
|
|
7
|
-
} from "./chunk-OSUFJZHZ.js";
|
|
8
|
-
import {
|
|
9
|
-
BaseComponent
|
|
10
|
-
} from "./chunk-4YEN7HVQ.js";
|
|
11
|
-
|
|
12
|
-
// src/templates/error_stack/main.ts
|
|
13
|
-
import { dump, themes } from "@poppinss/dumper/html";
|
|
14
|
-
import { dump as dumpCli } from "@poppinss/dumper/console";
|
|
15
|
-
var CHEVIRON = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" width="24" height="24" stroke-width="2">
|
|
16
|
-
<path d="M6 9l6 6l6 -6"></path>
|
|
17
|
-
</svg>`;
|
|
18
|
-
var EDITORS = {
|
|
19
|
-
textmate: "txmt://open?url=file://%f&line=%l",
|
|
20
|
-
macvim: "mvim://open?url=file://%f&line=%l",
|
|
21
|
-
emacs: "emacs://open?url=file://%f&line=%l",
|
|
22
|
-
sublime: "subl://open?url=file://%f&line=%l",
|
|
23
|
-
phpstorm: "phpstorm://open?file=%f&line=%l",
|
|
24
|
-
atom: "atom://core/open/file?filename=%f&line=%l",
|
|
25
|
-
vscode: "vscode://file/%f:%l"
|
|
26
|
-
};
|
|
27
|
-
var ErrorStack = class extends BaseComponent {
|
|
28
|
-
cssFile = new URL("./error_stack/style.css", publicDirURL);
|
|
29
|
-
scriptFile = new URL("./error_stack/script.js", publicDirURL);
|
|
30
|
-
/**
|
|
31
|
-
* Returns the file's relative name from the CWD
|
|
32
|
-
*/
|
|
33
|
-
#getRelativeFileName(filePath) {
|
|
34
|
-
return filePath.replace(`${process.cwd()}/`, "");
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Returns the index of the frame that should be expanded by
|
|
38
|
-
* default
|
|
39
|
-
*/
|
|
40
|
-
#getFirstExpandedFrameIndex(frames) {
|
|
41
|
-
let expandAtIndex = frames.findIndex((frame) => frame.type === "app");
|
|
42
|
-
if (expandAtIndex === -1) {
|
|
43
|
-
expandAtIndex = frames.findIndex((frame) => frame.type === "module");
|
|
44
|
-
}
|
|
45
|
-
return expandAtIndex;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Returns the link to open the file within known code
|
|
49
|
-
* editors
|
|
50
|
-
*/
|
|
51
|
-
#getEditorLink(ide, frame) {
|
|
52
|
-
const editorURL = EDITORS[ide] || ide;
|
|
53
|
-
if (!editorURL || frame.type === "native") {
|
|
54
|
-
return {
|
|
55
|
-
text: this.#getRelativeFileName(frame.fileName)
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
return {
|
|
59
|
-
href: editorURL.replace("%f", frame.fileName).replace("%l", String(frame.lineNumber)),
|
|
60
|
-
text: this.#getRelativeFileName(frame.fileName)
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Returns the HTML fragment for the frame location
|
|
65
|
-
*/
|
|
66
|
-
#renderFrameLocation(frame, ide) {
|
|
67
|
-
const { text, href } = this.#getEditorLink(ide, frame);
|
|
68
|
-
const fileName = `<a${href ? ` href="${href}"` : ""} class="stack-frame-filepath" title="${text}">
|
|
69
|
-
${htmlEscape(text)}
|
|
70
|
-
</a>`;
|
|
71
|
-
const functionName = frame.functionName ? `<span>in <code title="${frame.functionName}">
|
|
72
|
-
${htmlEscape(frame.functionName)}
|
|
73
|
-
</code></span>` : "";
|
|
74
|
-
const loc = `<span>at line <code>${frame.lineNumber}:${frame.columnNumber}</code></span>`;
|
|
75
|
-
if (frame.type !== "native" && frame.source) {
|
|
76
|
-
return `<button class="stack-frame-location">
|
|
77
|
-
${fileName} ${functionName} ${loc}
|
|
78
|
-
</button>`;
|
|
79
|
-
}
|
|
80
|
-
return `<div class="stack-frame-location">
|
|
81
|
-
${fileName} ${functionName} ${loc}
|
|
82
|
-
</div>`;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Returns HTML fragment for the stack frame
|
|
86
|
-
*/
|
|
87
|
-
async #renderStackFrame(frame, index, expandAtIndex, props) {
|
|
88
|
-
const label = frame.type === "app" ? '<span class="frame-label">In App</span>' : "";
|
|
89
|
-
const expandedClass = expandAtIndex === index ? " expanded" : "";
|
|
90
|
-
const toggleButton = frame.type !== "native" && frame.source ? `<button class="stack-frame-toggle-indicator">${CHEVIRON}</button>` : "";
|
|
91
|
-
return `<li class="stack-frame stack-frame-${frame.type}${expandedClass}">
|
|
92
|
-
<div class="stack-frame-contents">
|
|
93
|
-
${this.#renderFrameLocation(frame, props.ide)}
|
|
94
|
-
<div class="stack-frame-extras">
|
|
95
|
-
${label}
|
|
96
|
-
${toggleButton}
|
|
97
|
-
</div>
|
|
98
|
-
</div>
|
|
99
|
-
<div class="stack-frame-source">
|
|
100
|
-
${await props.sourceCodeRenderer(props.error, frame)}
|
|
101
|
-
</div>
|
|
102
|
-
</li>`;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Returns the ANSI output to print the stack frame on the
|
|
106
|
-
* terminal
|
|
107
|
-
*/
|
|
108
|
-
async #printStackFrame(frame, index, expandAtIndex, props) {
|
|
109
|
-
const fileName = this.#getRelativeFileName(frame.fileName);
|
|
110
|
-
const loc = `${fileName}:${frame.lineNumber}:${frame.columnNumber}`;
|
|
111
|
-
if (index === expandAtIndex) {
|
|
112
|
-
const functionName2 = frame.functionName ? `at ${frame.functionName} ` : "";
|
|
113
|
-
const codeSnippet = await props.sourceCodeRenderer(props.error, frame);
|
|
114
|
-
return ` \u2043 ${functionName2}${colors.yellow(`(${loc})`)}${codeSnippet}`;
|
|
115
|
-
}
|
|
116
|
-
if (frame.type === "native") {
|
|
117
|
-
const functionName2 = frame.functionName ? `at ${colors.italic(frame.functionName)} ` : "";
|
|
118
|
-
return colors.dim(` \u2043 ${functionName2}(${colors.italic(loc)})`);
|
|
119
|
-
}
|
|
120
|
-
const functionName = frame.functionName ? `at ${frame.functionName} ` : "";
|
|
121
|
-
return ` \u2043 ${functionName}${colors.yellow(`(${loc})`)}`;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* The toHTML method is used to output the HTML for the
|
|
125
|
-
* web view
|
|
126
|
-
*/
|
|
127
|
-
async toHTML(props) {
|
|
128
|
-
const frames = await Promise.all(
|
|
129
|
-
props.error.frames.map((frame, index) => {
|
|
130
|
-
return this.#renderStackFrame(
|
|
131
|
-
frame,
|
|
132
|
-
index,
|
|
133
|
-
this.#getFirstExpandedFrameIndex(props.error.frames),
|
|
134
|
-
props
|
|
135
|
-
);
|
|
136
|
-
})
|
|
137
|
-
);
|
|
138
|
-
return `<section>
|
|
139
|
-
<div class="card">
|
|
140
|
-
<div class="card-heading">
|
|
141
|
-
<div>
|
|
142
|
-
<h3 class="card-title">
|
|
143
|
-
Stack Trace
|
|
144
|
-
</h3>
|
|
145
|
-
</div>
|
|
146
|
-
</div>
|
|
147
|
-
<div class="card-body">
|
|
148
|
-
<div id="stack-frames-wrapper">
|
|
149
|
-
<div id="stack-frames-header">
|
|
150
|
-
<div id="all-frames-toggle-wrapper">
|
|
151
|
-
<label id="all-frames-toggle">
|
|
152
|
-
<input type="checkbox" />
|
|
153
|
-
<span> View All Frames </span>
|
|
154
|
-
</label>
|
|
155
|
-
</div>
|
|
156
|
-
|
|
157
|
-
<div>
|
|
158
|
-
<div class="toggle-switch">
|
|
159
|
-
<button id="formatted-frames-toggle" class="active"> Pretty </button>
|
|
160
|
-
<button id="raw-frames-toggle"> Raw </button>
|
|
161
|
-
</div>
|
|
162
|
-
</div>
|
|
163
|
-
</div>
|
|
164
|
-
|
|
165
|
-
<div id="stack-frames-body">
|
|
166
|
-
<div id="stack-frames-formatted" class="visible">
|
|
167
|
-
<ul id="stack-frames">
|
|
168
|
-
${frames.join("\n")}
|
|
169
|
-
</ul>
|
|
170
|
-
</div>
|
|
171
|
-
<div id="stack-frames-raw">
|
|
172
|
-
${dump(props.error.raw, {
|
|
173
|
-
styles: themes.cssVariables,
|
|
174
|
-
expand: true,
|
|
175
|
-
cspNonce: props.cspNonce,
|
|
176
|
-
inspectObjectPrototype: false,
|
|
177
|
-
inspectStaticMembers: false,
|
|
178
|
-
inspectArrayPrototype: false
|
|
179
|
-
})}
|
|
180
|
-
</div>
|
|
181
|
-
</div>
|
|
182
|
-
<div>
|
|
183
|
-
</div>
|
|
184
|
-
</div>
|
|
185
|
-
</section>`;
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* The toANSI method is used to output the text for the console
|
|
189
|
-
*/
|
|
190
|
-
async toANSI(props) {
|
|
191
|
-
const displayRaw = process.env.YOUCH_RAW;
|
|
192
|
-
if (displayRaw) {
|
|
193
|
-
const depth = Number.isNaN(Number(displayRaw)) ? 2 : Number(displayRaw);
|
|
194
|
-
return `
|
|
195
|
-
|
|
196
|
-
${colors.red("[RAW]")}
|
|
197
|
-
${dumpCli(props.error.raw, {
|
|
198
|
-
depth,
|
|
199
|
-
inspectObjectPrototype: false,
|
|
200
|
-
inspectStaticMembers: false,
|
|
201
|
-
inspectArrayPrototype: false
|
|
202
|
-
})}`;
|
|
203
|
-
}
|
|
204
|
-
const frames = await Promise.all(
|
|
205
|
-
props.error.frames.map((frame, index) => {
|
|
206
|
-
return this.#printStackFrame(
|
|
207
|
-
frame,
|
|
208
|
-
index,
|
|
209
|
-
this.#getFirstExpandedFrameIndex(props.error.frames),
|
|
210
|
-
props
|
|
211
|
-
);
|
|
212
|
-
})
|
|
213
|
-
);
|
|
214
|
-
if (frames.length) {
|
|
215
|
-
return `
|
|
216
|
-
|
|
217
|
-
${frames.join("\n")}`;
|
|
218
|
-
}
|
|
219
|
-
return "";
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
export {
|
|
224
|
-
ErrorStack
|
|
225
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { APIGatewayProxyEvent, APIGatewayProxyEventV2 } from "aws-lambda";
|
|
2
|
-
import type { ServerRequest } from "srvx";
|
|
3
|
-
// Incoming (AWS => Web)
|
|
4
|
-
export declare function awsRequest(event: APIGatewayProxyEvent | APIGatewayProxyEventV2, context: unknown): ServerRequest;
|
|
5
|
-
// Outgoing (Web => AWS)
|
|
6
|
-
export declare function awsResponseHeaders(response: Response);
|
|
7
|
-
// AWS Lambda proxy integrations requires base64 encoded buffers
|
|
8
|
-
// binaryMediaTypes should be */*
|
|
9
|
-
// see https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-payload-encodings.html
|
|
10
|
-
export declare function awsResponseBody(response: Response): Promise<{
|
|
11
|
-
body: string;
|
|
12
|
-
isBase64Encoded?: boolean;
|
|
13
|
-
}>;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import "#nitro-internal-pollyfills";
|
|
2
|
-
import type { APIGatewayProxyEvent, APIGatewayProxyEventV2, APIGatewayProxyResult, APIGatewayProxyResultV2, Context } from "aws-lambda";
|
|
3
|
-
export declare function handler(event: APIGatewayProxyEvent | APIGatewayProxyEventV2, context: Context): Promise<APIGatewayProxyResult | APIGatewayProxyResultV2>;
|