@depup/nitro 3.0.260311-beta-depup.0
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 +27 -0
- package/README.md +32 -0
- package/changes.json +14 -0
- package/dist/THIRD-PARTY-LICENSES.md +1646 -0
- package/dist/_build/common.mjs +29361 -0
- package/dist/_build/rolldown.mjs +173 -0
- package/dist/_build/rollup.mjs +194 -0
- package/dist/_build/vite.build.mjs +18 -0
- package/dist/_chunks/nitro.mjs +1159 -0
- package/dist/_chunks/nitro2.mjs +102 -0
- package/dist/_chunks/nitro3.mjs +129 -0
- package/dist/_chunks/utils.mjs +272 -0
- package/dist/_common.mjs +35 -0
- package/dist/_dev.d.mts +12 -0
- package/dist/_dev.mjs +519 -0
- 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 +361 -0
- package/dist/_libs/commondir+is-reference.mjs +1311 -0
- package/dist/_libs/compatx.d.mts +47 -0
- package/dist/_libs/compatx.mjs +45 -0
- package/dist/_libs/esbuild.d.mts +20 -0
- package/dist/_libs/escape-string-regexp.mjs +7 -0
- package/dist/_libs/estree+pluginutils.d.mts +241 -0
- package/dist/_libs/estree-walker.mjs +184 -0
- package/dist/_libs/exsolve.d.mts +1 -0
- package/dist/_libs/hasown+resolve+deepmerge.mjs +1949 -0
- package/dist/_libs/httpxy.d.mts +82 -0
- package/dist/_libs/httpxy.mjs +671 -0
- package/dist/_libs/js-tokens.d.mts +1 -0
- package/dist/_libs/klona.mjs +37 -0
- 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 +64 -0
- package/dist/_libs/plugin-inject.mjs +131 -0
- package/dist/_libs/plugin-json.mjs +34 -0
- package/dist/_libs/pluginutils.mjs +646 -0
- package/dist/_libs/readdirp+chokidar.mjs +1606 -0
- package/dist/_libs/remapping.mjs +115 -0
- package/dist/_libs/resolve-uri+gen-mapping.mjs +442 -0
- package/dist/_libs/rou3.d.mts +44 -0
- package/dist/_libs/rou3.mjs +496 -0
- package/dist/_libs/std-env.d.mts +12 -0
- package/dist/_libs/strip-literal.d.mts +1 -0
- package/dist/_libs/tsconfck.mjs +813 -0
- package/dist/_libs/ultrahtml.mjs +127 -0
- 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 +1759 -0
- package/dist/builder.d.mts +64 -0
- package/dist/builder.mjs +15 -0
- package/dist/cli/_chunks/build.mjs +47 -0
- package/dist/cli/_chunks/common.mjs +14 -0
- package/dist/cli/_chunks/deploy.mjs +40 -0
- package/dist/cli/_chunks/dev.mjs +62 -0
- package/dist/cli/_chunks/docs.mjs +30 -0
- package/dist/cli/_chunks/list.mjs +25 -0
- package/dist/cli/_chunks/prepare.mjs +17 -0
- package/dist/cli/_chunks/preview.mjs +51 -0
- package/dist/cli/_chunks/run.mjs +53 -0
- package/dist/cli/_chunks/task.mjs +14 -0
- package/dist/cli/index.d.mts +1 -0
- package/dist/cli/index.mjs +22 -0
- package/dist/node_modules/@poppinss/colors/build/index.js +139 -0
- package/dist/node_modules/@poppinss/colors/package.json +118 -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 +725 -0
- package/dist/node_modules/@poppinss/dumper/package.json +122 -0
- package/dist/node_modules/@poppinss/exception/build/index.js +44 -0
- package/dist/node_modules/@poppinss/exception/package.json +109 -0
- package/dist/node_modules/@sindresorhus/is/distribution/index.js +1354 -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 +94 -0
- package/dist/node_modules/cookie-es/dist/index.mjs +262 -0
- package/dist/node_modules/cookie-es/package.json +37 -0
- package/dist/node_modules/croner/dist/croner.js +1 -0
- package/dist/node_modules/croner/package.json +73 -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/kleur/index.mjs +110 -0
- package/dist/node_modules/kleur/package.json +51 -0
- package/dist/node_modules/rendu/dist/index.mjs +380 -0
- package/dist/node_modules/rendu/package.json +47 -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/supports-color/index.js +202 -0
- package/dist/node_modules/supports-color/package.json +64 -0
- package/dist/node_modules/ufo/dist/index.mjs +645 -0
- package/dist/node_modules/ufo/package.json +48 -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/helpers-B9BQYaS6.js +23 -0
- package/dist/node_modules/youch/build/index.js +212 -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 +145 -0
- package/dist/node_modules/youch/build/public/error_metadata/style.css +3 -0
- package/dist/node_modules/youch/build/public/error_stack/script.js +72 -0
- package/dist/node_modules/youch/build/public/error_stack/style.css +219 -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 +14 -0
- package/dist/node_modules/youch/build/public/header/style.css +56 -0
- package/dist/node_modules/youch/build/public/layout/script.js +12 -0
- package/dist/node_modules/youch/build/public/layout/style.css +435 -0
- 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 +135 -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 +20 -0
- package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +15 -0
- package/dist/presets/_nitro/runtime/service-worker.mjs +23 -0
- package/dist/presets/aws-amplify/runtime/aws-amplify.mjs +14 -0
- package/dist/presets/aws-lambda/runtime/_utils.mjs +116 -0
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +31 -0
- package/dist/presets/aws-lambda/runtime/aws-lambda.mjs +13 -0
- package/dist/presets/azure/runtime/_utils.mjs +50 -0
- package/dist/presets/azure/runtime/azure-swa.mjs +30 -0
- package/dist/presets/bun/runtime/bun.mjs +40 -0
- package/dist/presets/cloudflare/runtime/_module-handler.mjs +87 -0
- package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +72 -0
- package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +17 -0
- package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +39 -0
- package/dist/presets/cloudflare/runtime/plugin.dev.mjs +96 -0
- package/dist/presets/cloudflare/runtime/shims/workers.dev.mjs +27 -0
- package/dist/presets/deno/runtime/deno-deploy.mjs +19 -0
- package/dist/presets/deno/runtime/deno-server.mjs +39 -0
- package/dist/presets/netlify/runtime/netlify-edge.mjs +20 -0
- package/dist/presets/netlify/runtime/netlify.mjs +20 -0
- package/dist/presets/node/runtime/node-cluster.mjs +54 -0
- package/dist/presets/node/runtime/node-middleware.mjs +14 -0
- package/dist/presets/node/runtime/node-server.mjs +47 -0
- package/dist/presets/standard/runtime/server.mjs +4 -0
- package/dist/presets/stormkit/runtime/stormkit.mjs +27 -0
- 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 +24 -0
- package/dist/presets/vercel/runtime/vercel.web.mjs +23 -0
- package/dist/presets/winterjs/runtime/winterjs.mjs +91 -0
- package/dist/presets/zeabur/runtime/zeabur.mjs +4 -0
- package/dist/presets/zephyr/runtime/server.mjs +3 -0
- package/dist/runtime/app.d.mts +1 -0
- package/dist/runtime/app.mjs +1 -0
- package/dist/runtime/cache.d.mts +1 -0
- package/dist/runtime/cache.mjs +1 -0
- package/dist/runtime/config.d.mts +3 -0
- package/dist/runtime/config.mjs +4 -0
- package/dist/runtime/context.d.mts +1 -0
- package/dist/runtime/context.mjs +1 -0
- package/dist/runtime/database.d.mts +1 -0
- package/dist/runtime/database.mjs +1 -0
- package/dist/runtime/internal/app.d.mts +16 -0
- package/dist/runtime/internal/app.mjs +208 -0
- package/dist/runtime/internal/cache.d.mts +7 -0
- package/dist/runtime/internal/cache.mjs +41 -0
- package/dist/runtime/internal/context.d.mts +14 -0
- package/dist/runtime/internal/context.mjs +24 -0
- package/dist/runtime/internal/database.d.mts +2 -0
- package/dist/runtime/internal/database.mjs +12 -0
- package/dist/runtime/internal/empty.mjs +0 -0
- package/dist/runtime/internal/error/dev.d.mts +10 -0
- package/dist/runtime/internal/error/dev.mjs +121 -0
- package/dist/runtime/internal/error/hooks.d.mts +1 -0
- package/dist/runtime/internal/error/hooks.mjs +9 -0
- package/dist/runtime/internal/error/prod.d.mts +6 -0
- package/dist/runtime/internal/error/prod.mjs +40 -0
- package/dist/runtime/internal/error/utils.d.mts +8 -0
- package/dist/runtime/internal/error/utils.mjs +3 -0
- package/dist/runtime/internal/meta.d.mts +2 -0
- package/dist/runtime/internal/meta.mjs +3 -0
- package/dist/runtime/internal/plugin.d.mts +3 -0
- package/dist/runtime/internal/plugin.mjs +4 -0
- package/dist/runtime/internal/route-rules.d.mts +9 -0
- package/dist/runtime/internal/route-rules.mjs +72 -0
- package/dist/runtime/internal/routes/dev-tasks.d.mts +3 -0
- package/dist/runtime/internal/routes/dev-tasks.mjs +25 -0
- package/dist/runtime/internal/routes/openapi.d.mts +3 -0
- package/dist/runtime/internal/routes/openapi.mjs +94 -0
- 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 +19 -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 +193 -0
- package/dist/runtime/internal/routes/swagger.d.mts +3 -0
- package/dist/runtime/internal/routes/swagger.mjs +42 -0
- package/dist/runtime/internal/runtime-config.d.mts +9 -0
- package/dist/runtime/internal/runtime-config.mjs +54 -0
- package/dist/runtime/internal/static.d.mts +3 -0
- package/dist/runtime/internal/static.mjs +67 -0
- package/dist/runtime/internal/storage.d.mts +2 -0
- package/dist/runtime/internal/storage.mjs +6 -0
- package/dist/runtime/internal/task.d.mts +19 -0
- package/dist/runtime/internal/task.mjs +69 -0
- package/dist/runtime/internal/vite/dev-entry.mjs +18 -0
- package/dist/runtime/internal/vite/dev-worker.mjs +264 -0
- package/dist/runtime/internal/vite/ssr-renderer.mjs +6 -0
- package/dist/runtime/meta.d.mts +5 -0
- package/dist/runtime/meta.mjs +27 -0
- package/dist/runtime/nitro.d.mts +11 -0
- package/dist/runtime/nitro.mjs +34 -0
- package/dist/runtime/runtime-config.d.mts +1 -0
- package/dist/runtime/runtime-config.mjs +1 -0
- package/dist/runtime/storage.d.mts +1 -0
- package/dist/runtime/storage.mjs +1 -0
- package/dist/runtime/task.d.mts +1 -0
- package/dist/runtime/task.mjs +1 -0
- 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/runtime/virtual/polyfills.d.mts +3 -0
- 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.d.mts +8 -0
- package/dist/runtime/vite.mjs +9 -0
- package/dist/types/index.d.mts +3010 -0
- package/dist/types/index.mjs +1 -0
- package/dist/vite.d.mts +52 -0
- package/dist/vite.mjs +740 -0
- package/lib/h3.d.mts +1 -0
- package/lib/h3.mjs +1 -0
- package/lib/tsconfig.json +27 -0
- package/lib/vite.types.d.mts +26 -0
- package/lib/vite.types.mjs +2 -0
- package/package.json +256 -0
- 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
|
@@ -0,0 +1,646 @@
|
|
|
1
|
+
import { S as MagicString, x as stripLiteral } from "../_build/common.mjs";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import "node:assert";
|
|
6
|
+
import { createHash } from "node:crypto";
|
|
7
|
+
import { isCSSRequest, normalizePath } from "vite";
|
|
8
|
+
import assert$1 from "node:assert/strict";
|
|
9
|
+
//#region node_modules/.pnpm/@rolldown+pluginutils@1.0.0-beta.55/node_modules/@rolldown/pluginutils/dist/simple-filters.js
|
|
10
|
+
/**
|
|
11
|
+
* Constructs a RegExp that matches the exact string specified.
|
|
12
|
+
*
|
|
13
|
+
* This is useful for plugin hook filters.
|
|
14
|
+
*
|
|
15
|
+
* @param str the string to match.
|
|
16
|
+
* @param flags flags for the RegExp.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { exactRegex } from '@rolldown/pluginutils';
|
|
21
|
+
* const plugin = {
|
|
22
|
+
* name: 'plugin',
|
|
23
|
+
* resolveId: {
|
|
24
|
+
* filter: { id: exactRegex('foo') },
|
|
25
|
+
* handler(id) {} // will only be called for `foo`
|
|
26
|
+
* }
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
function exactRegex(str, flags) {
|
|
31
|
+
return new RegExp(`^${escapeRegex(str)}$`, flags);
|
|
32
|
+
}
|
|
33
|
+
const escapeRegexRE = /[-/\\^$*+?.()|[\]{}]/g;
|
|
34
|
+
function escapeRegex(str) {
|
|
35
|
+
return str.replace(escapeRegexRE, "\\$&");
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region node_modules/.pnpm/@hiogawa+vite-plugin-fullstack@0.0.11_vite@8.0.0-beta.18_@types+node@25.4.0_esbuild@0.2_62dda1eccee284f7388c2af4cc76ce61/node_modules/@hiogawa/vite-plugin-fullstack/dist/plugin-B4MlD0Bd.js
|
|
39
|
+
function parseIdQuery(id) {
|
|
40
|
+
if (!id.includes("?")) return {
|
|
41
|
+
filename: id,
|
|
42
|
+
query: {}
|
|
43
|
+
};
|
|
44
|
+
const [filename, rawQuery] = id.split(`?`, 2);
|
|
45
|
+
return {
|
|
46
|
+
filename,
|
|
47
|
+
query: Object.fromEntries(new URLSearchParams(rawQuery))
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function toAssetsVirtual(options) {
|
|
51
|
+
return `virtual:fullstack/assets?${new URLSearchParams(options)}&lang.js`;
|
|
52
|
+
}
|
|
53
|
+
function parseAssetsVirtual(id) {
|
|
54
|
+
if (id.startsWith("\0virtual:fullstack/assets?")) return parseIdQuery(id).query;
|
|
55
|
+
}
|
|
56
|
+
function createVirtualPlugin(name, load) {
|
|
57
|
+
name = "virtual:" + name;
|
|
58
|
+
return {
|
|
59
|
+
name: `fullstack:virtual-${name}`,
|
|
60
|
+
resolveId: {
|
|
61
|
+
filter: { id: exactRegex(name) },
|
|
62
|
+
handler(source, _importer, _options) {
|
|
63
|
+
return source === name ? "\0" + name : void 0;
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
load: {
|
|
67
|
+
filter: { id: exactRegex("\0" + name) },
|
|
68
|
+
handler(id, options) {
|
|
69
|
+
return load.apply(this, [id, options]);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function normalizeRelativePath(s) {
|
|
75
|
+
s = normalizePath(s);
|
|
76
|
+
return s[0] === "." ? s : "./" + s;
|
|
77
|
+
}
|
|
78
|
+
function hashString(v) {
|
|
79
|
+
return createHash("sha256").update(v).digest().toString("hex").slice(0, 12);
|
|
80
|
+
}
|
|
81
|
+
const VALID_ID_PREFIX = `/@id/`;
|
|
82
|
+
const NULL_BYTE_PLACEHOLDER = `__x00__`;
|
|
83
|
+
const FS_PREFIX = `/@fs/`;
|
|
84
|
+
function wrapId(id) {
|
|
85
|
+
return id.startsWith(VALID_ID_PREFIX) ? id : VALID_ID_PREFIX + id.replace("\0", NULL_BYTE_PLACEHOLDER);
|
|
86
|
+
}
|
|
87
|
+
function withTrailingSlash(path$1) {
|
|
88
|
+
if (path$1[path$1.length - 1] !== "/") return `${path$1}/`;
|
|
89
|
+
return path$1;
|
|
90
|
+
}
|
|
91
|
+
const postfixRE = /[?#].*$/;
|
|
92
|
+
function cleanUrl(url) {
|
|
93
|
+
return url.replace(postfixRE, "");
|
|
94
|
+
}
|
|
95
|
+
function splitFileAndPostfix(path$1) {
|
|
96
|
+
const file = cleanUrl(path$1);
|
|
97
|
+
return {
|
|
98
|
+
file,
|
|
99
|
+
postfix: path$1.slice(file.length)
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
const windowsSlashRE = /\\/g;
|
|
103
|
+
function slash(p) {
|
|
104
|
+
return p.replace(windowsSlashRE, "/");
|
|
105
|
+
}
|
|
106
|
+
const isWindows = typeof process !== "undefined" && process.platform === "win32";
|
|
107
|
+
function injectQuery(url, queryToInject) {
|
|
108
|
+
const { file, postfix } = splitFileAndPostfix(url);
|
|
109
|
+
return `${isWindows ? slash(file) : file}?${queryToInject}${postfix[0] === "?" ? `&${postfix.slice(1)}` : postfix}`;
|
|
110
|
+
}
|
|
111
|
+
function normalizeResolvedIdToUrl(environment, url, resolved) {
|
|
112
|
+
const root = environment.config.root;
|
|
113
|
+
const depsOptimizer = environment.depsOptimizer;
|
|
114
|
+
if (resolved.id.startsWith(withTrailingSlash(root))) url = resolved.id.slice(root.length);
|
|
115
|
+
else if (depsOptimizer?.isOptimizedDepFile(resolved.id) || resolved.id !== "/@react-refresh" && path.isAbsolute(resolved.id) && fs.existsSync(cleanUrl(resolved.id))) url = path.posix.join(FS_PREFIX, resolved.id);
|
|
116
|
+
else url = resolved.id;
|
|
117
|
+
if (url[0] !== "." && url[0] !== "/") url = wrapId(resolved.id);
|
|
118
|
+
return url;
|
|
119
|
+
}
|
|
120
|
+
function normalizeViteImportAnalysisUrl(environment, id) {
|
|
121
|
+
let url = normalizeResolvedIdToUrl(environment, id, { id });
|
|
122
|
+
if (environment.config.consumer === "client") {
|
|
123
|
+
const mod = environment.moduleGraph.getModuleById(id);
|
|
124
|
+
if (mod && mod.lastHMRTimestamp > 0) url = injectQuery(url, `t=${mod.lastHMRTimestamp}`);
|
|
125
|
+
}
|
|
126
|
+
return url;
|
|
127
|
+
}
|
|
128
|
+
function evalValue(rawValue) {
|
|
129
|
+
return new Function(`
|
|
130
|
+
var console, exports, global, module, process, require
|
|
131
|
+
return (\n${rawValue}\n)
|
|
132
|
+
`)();
|
|
133
|
+
}
|
|
134
|
+
const directRequestRE = /(\?|&)direct=?(?:&|$)/;
|
|
135
|
+
function assetsPlugin(pluginOpts) {
|
|
136
|
+
let server;
|
|
137
|
+
let resolvedConfig;
|
|
138
|
+
const importAssetsMetaMap = {};
|
|
139
|
+
const bundleMap = {};
|
|
140
|
+
async function processAssetsImport(ctx, id, options) {
|
|
141
|
+
if (ctx.environment.mode === "dev") {
|
|
142
|
+
const result = {
|
|
143
|
+
entry: void 0,
|
|
144
|
+
js: [],
|
|
145
|
+
css: []
|
|
146
|
+
};
|
|
147
|
+
const environment = server.environments[options.environment];
|
|
148
|
+
assert$1(environment, `Unknown environment: ${options.environment}`);
|
|
149
|
+
if (options.environment === "client") result.entry = assetsURLDev(normalizeViteImportAnalysisUrl(environment, id).slice(1), resolvedConfig);
|
|
150
|
+
if (environment.name !== "client") {
|
|
151
|
+
const collected = await collectCss(environment, id, { eager: pluginOpts?.experimental?.devEagerTransform ?? true });
|
|
152
|
+
result.css = collected.hrefs.map((href, i) => ({
|
|
153
|
+
href: assetsURLDev(href.slice(1), resolvedConfig),
|
|
154
|
+
"data-vite-dev-id": collected.ids[i]
|
|
155
|
+
}));
|
|
156
|
+
}
|
|
157
|
+
return JSON.stringify(result);
|
|
158
|
+
} else {
|
|
159
|
+
const map = importAssetsMetaMap[options.environment] ??= {};
|
|
160
|
+
const meta = {
|
|
161
|
+
id,
|
|
162
|
+
key: path.relative(resolvedConfig.root, id),
|
|
163
|
+
importerEnvironment: ctx.environment.name,
|
|
164
|
+
isEntry: !!(map[id]?.isEntry || options.isEntry)
|
|
165
|
+
};
|
|
166
|
+
map[id] = meta;
|
|
167
|
+
return `__assets_manifest[${JSON.stringify(options.environment)}][${JSON.stringify(meta.key)}]`;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
let writeAssetsManifestCalled = false;
|
|
171
|
+
async function writeAssetsManifest(builder) {
|
|
172
|
+
if (writeAssetsManifestCalled) return;
|
|
173
|
+
writeAssetsManifestCalled = true;
|
|
174
|
+
const manifest = {};
|
|
175
|
+
for (const [environmentName, metas] of Object.entries(importAssetsMetaMap)) {
|
|
176
|
+
const bundle = bundleMap[environmentName];
|
|
177
|
+
const assetDepsMap = collectAssetDeps(bundle);
|
|
178
|
+
for (const [id, meta] of Object.entries(metas)) {
|
|
179
|
+
const found = assetDepsMap[id];
|
|
180
|
+
if (!found) {
|
|
181
|
+
builder.config.logger.error(`[vite-plugin-fullstack] failed to find built chunk for ${meta.id} imported by ${meta.importerEnvironment} environment`);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const result = {
|
|
185
|
+
js: [],
|
|
186
|
+
css: []
|
|
187
|
+
};
|
|
188
|
+
const { chunk, deps } = found;
|
|
189
|
+
if (environmentName === "client") {
|
|
190
|
+
result.entry = assetsURL(chunk.fileName, builder.config);
|
|
191
|
+
result.js = deps.js.map((fileName) => ({ href: assetsURL(fileName, builder.config) }));
|
|
192
|
+
}
|
|
193
|
+
result.css = deps.css.map((fileName) => ({ href: assetsURL(fileName, builder.config) }));
|
|
194
|
+
if (!builder.environments[environmentName].config.build.cssCodeSplit) {
|
|
195
|
+
const singleCss = Object.values(bundle).find((v) => v.type === "asset" && v.originalFileNames.includes("style.css"));
|
|
196
|
+
if (singleCss) result.css.push({ href: assetsURL(singleCss.fileName, builder.config) });
|
|
197
|
+
}
|
|
198
|
+
(manifest[environmentName] ??= {})[meta.key] = result;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
const importerEnvironments = new Set(Object.values(importAssetsMetaMap).flatMap((metas) => Object.values(metas)).flatMap((meta) => meta.importerEnvironment));
|
|
202
|
+
for (const environmentName of importerEnvironments) {
|
|
203
|
+
const outDir = builder.environments[environmentName].config.build.outDir;
|
|
204
|
+
fs.writeFileSync(path.join(outDir, BUILD_ASSETS_MANIFEST_NAME), `export default ${serializeValueWithRuntime(manifest)};`);
|
|
205
|
+
const clientOutDir = builder.environments["client"].config.build.outDir;
|
|
206
|
+
for (const asset of Object.values(bundleMap[environmentName])) if (asset.type === "asset") {
|
|
207
|
+
const srcFile = path.join(outDir, asset.fileName);
|
|
208
|
+
const destFile = path.join(clientOutDir, asset.fileName);
|
|
209
|
+
fs.mkdirSync(path.dirname(destFile), { recursive: true });
|
|
210
|
+
fs.copyFileSync(srcFile, destFile);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return [
|
|
215
|
+
{
|
|
216
|
+
name: "fullstack:assets",
|
|
217
|
+
sharedDuringBuild: true,
|
|
218
|
+
configureServer(server_) {
|
|
219
|
+
server = server_;
|
|
220
|
+
},
|
|
221
|
+
configResolved(config) {
|
|
222
|
+
resolvedConfig = config;
|
|
223
|
+
},
|
|
224
|
+
configEnvironment(name) {
|
|
225
|
+
if ((pluginOpts?.serverEnvironments ?? ["ssr"]).includes(name)) return { build: { emitAssets: true } };
|
|
226
|
+
},
|
|
227
|
+
transform: {
|
|
228
|
+
filter: { code: /import\.meta\.vite\.assets\(/ },
|
|
229
|
+
async handler(code, id, _options) {
|
|
230
|
+
const output = new MagicString(code);
|
|
231
|
+
const strippedCode = stripLiteral(code);
|
|
232
|
+
const newImports = /* @__PURE__ */ new Set();
|
|
233
|
+
for (const match of code.matchAll(/import\.meta\.vite\.assets\(([\s\S]*?)\)/dg)) {
|
|
234
|
+
const [start, end] = match.indices[0];
|
|
235
|
+
if (!strippedCode.slice(start, end).includes("import.meta.vite.assets")) continue;
|
|
236
|
+
if (this.environment.name === "client") {
|
|
237
|
+
const replacement$1 = `(${JSON.stringify(EMPTY_ASSETS)})`;
|
|
238
|
+
output.update(start, end, replacement$1);
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
const argCode = match[1].trim();
|
|
242
|
+
const options = {
|
|
243
|
+
import: id,
|
|
244
|
+
environment: void 0,
|
|
245
|
+
asEntry: false
|
|
246
|
+
};
|
|
247
|
+
if (argCode) {
|
|
248
|
+
const argValue = evalValue(argCode);
|
|
249
|
+
Object.assign(options, argValue);
|
|
250
|
+
}
|
|
251
|
+
const environments = options.environment ? [options.environment] : ["client", this.environment.name];
|
|
252
|
+
const importedNames = [];
|
|
253
|
+
for (const environment of environments) {
|
|
254
|
+
const importSource = toAssetsVirtual({
|
|
255
|
+
import: options.import,
|
|
256
|
+
importer: id,
|
|
257
|
+
environment,
|
|
258
|
+
entry: options.asEntry ? "1" : ""
|
|
259
|
+
});
|
|
260
|
+
const importedName = `__assets_${hashString(importSource)}`;
|
|
261
|
+
newImports.add(`;import ${importedName} from ${JSON.stringify(importSource)};\n`);
|
|
262
|
+
importedNames.push(importedName);
|
|
263
|
+
}
|
|
264
|
+
let replacement = importedNames[0];
|
|
265
|
+
if (importedNames.length > 1) {
|
|
266
|
+
newImports.add(`;import * as __assets_runtime from "virtual:fullstack/runtime";\n`);
|
|
267
|
+
replacement = `__assets_runtime.mergeAssets(${importedNames.join(", ")})`;
|
|
268
|
+
}
|
|
269
|
+
output.update(start, end, `(${replacement})`);
|
|
270
|
+
}
|
|
271
|
+
if (output.hasChanged()) {
|
|
272
|
+
for (const newImport of newImports) output.append(newImport);
|
|
273
|
+
return {
|
|
274
|
+
code: output.toString(),
|
|
275
|
+
map: output.generateMap({ hires: "boundary" })
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
resolveId: {
|
|
281
|
+
filter: { id: /^virtual:fullstack\// },
|
|
282
|
+
handler(source) {
|
|
283
|
+
if (source === "virtual:fullstack/runtime") return "\0" + source;
|
|
284
|
+
if (source.startsWith("virtual:fullstack/assets?")) return "\0" + source;
|
|
285
|
+
if (source === "virtual:fullstack/assets-manifest") {
|
|
286
|
+
assert$1.notEqual(this.environment.name, "client");
|
|
287
|
+
assert$1.equal(this.environment.mode, "build");
|
|
288
|
+
return {
|
|
289
|
+
id: source,
|
|
290
|
+
external: true
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
load: {
|
|
296
|
+
filter: { id: /^\0virtual:fullstack\// },
|
|
297
|
+
async handler(id) {
|
|
298
|
+
if (id === "\0virtual:fullstack/runtime") return `export const mergeAssets = ${(await import("./_2.mjs")).mergeAssets.toString()};`;
|
|
299
|
+
const parsed = parseAssetsVirtual(id);
|
|
300
|
+
if (!parsed) return;
|
|
301
|
+
assert$1.notEqual(this.environment.name, "client");
|
|
302
|
+
const resolved = await this.resolve(parsed.import, parsed.importer);
|
|
303
|
+
assert$1(resolved, `Failed to resolve: ${parsed.import}`);
|
|
304
|
+
const s = new MagicString("");
|
|
305
|
+
const code = await processAssetsImport(this, resolved.id, {
|
|
306
|
+
environment: parsed.environment,
|
|
307
|
+
isEntry: !!parsed.entry
|
|
308
|
+
});
|
|
309
|
+
s.append(`export default ${code};\n`);
|
|
310
|
+
if (this.environment.mode === "build") s.prepend(`import __assets_manifest from "virtual:fullstack/assets-manifest";\n`);
|
|
311
|
+
return s.toString();
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
renderChunk(code, chunk) {
|
|
315
|
+
if (code.includes("virtual:fullstack/assets-manifest")) {
|
|
316
|
+
const replacement = normalizeRelativePath(path.relative(path.join(chunk.fileName, ".."), BUILD_ASSETS_MANIFEST_NAME));
|
|
317
|
+
code = code.replaceAll("virtual:fullstack/assets-manifest", () => replacement);
|
|
318
|
+
return { code };
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
writeBundle(_options, bundle) {
|
|
322
|
+
bundleMap[this.environment.name] = bundle;
|
|
323
|
+
},
|
|
324
|
+
buildStart() {
|
|
325
|
+
if (this.environment.mode == "build" && this.environment.name === "client") {
|
|
326
|
+
if (importAssetsMetaMap["client"]) {
|
|
327
|
+
for (const meta of Object.values(importAssetsMetaMap["client"])) if (meta.isEntry) this.emitFile({
|
|
328
|
+
type: "chunk",
|
|
329
|
+
id: meta.id,
|
|
330
|
+
preserveSignature: "exports-only"
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
buildApp: {
|
|
336
|
+
order: "pre",
|
|
337
|
+
async handler(builder) {
|
|
338
|
+
builder.writeAssetsManifest = async () => {
|
|
339
|
+
await writeAssetsManifest(builder);
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
name: "fullstack:write-assets-manifest-post",
|
|
346
|
+
buildApp: {
|
|
347
|
+
order: "post",
|
|
348
|
+
async handler(builder) {
|
|
349
|
+
await builder.writeAssetsManifest();
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
name: "fullstack:assets-query",
|
|
355
|
+
sharedDuringBuild: true,
|
|
356
|
+
resolveId: {
|
|
357
|
+
order: "pre",
|
|
358
|
+
filter: { id: /[?&]assets/ },
|
|
359
|
+
handler(source) {
|
|
360
|
+
const { query } = parseIdQuery(source);
|
|
361
|
+
if (typeof query["assets"] !== "undefined") {
|
|
362
|
+
if (this.environment.name === "client") return `\0virtual:fullstack/empty-assets`;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
load: {
|
|
367
|
+
filter: { id: [/^\0virtual:fullstack\/empty-assets$/, /[?&]assets/] },
|
|
368
|
+
async handler(id) {
|
|
369
|
+
if (id === "\0virtual:fullstack/empty-assets") return `export default ${JSON.stringify(EMPTY_ASSETS)}`;
|
|
370
|
+
const { filename, query } = parseIdQuery(id);
|
|
371
|
+
const value = query["assets"];
|
|
372
|
+
if (typeof value !== "undefined") {
|
|
373
|
+
const s = new MagicString("");
|
|
374
|
+
const codes = [];
|
|
375
|
+
if (value) {
|
|
376
|
+
const code = await processAssetsImport(this, filename, {
|
|
377
|
+
environment: value,
|
|
378
|
+
isEntry: value === "client"
|
|
379
|
+
});
|
|
380
|
+
codes.push(code);
|
|
381
|
+
} else {
|
|
382
|
+
const code1 = await processAssetsImport(this, filename, {
|
|
383
|
+
environment: "client",
|
|
384
|
+
isEntry: false
|
|
385
|
+
});
|
|
386
|
+
const code2 = await processAssetsImport(this, filename, {
|
|
387
|
+
environment: this.environment.name,
|
|
388
|
+
isEntry: false
|
|
389
|
+
});
|
|
390
|
+
codes.push(code1, code2);
|
|
391
|
+
}
|
|
392
|
+
s.append(`
|
|
393
|
+
import * as __assets_runtime from "virtual:fullstack/runtime";\n
|
|
394
|
+
export default __assets_runtime.mergeAssets(${codes.join(", ")});
|
|
395
|
+
`);
|
|
396
|
+
if (this.environment.mode === "build") s.prepend(`import __assets_manifest from "virtual:fullstack/assets-manifest";\n`);
|
|
397
|
+
return {
|
|
398
|
+
code: s.toString(),
|
|
399
|
+
moduleSideEffects: false
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
hotUpdate(ctx) {
|
|
405
|
+
if (this.environment.name === "rsc") {
|
|
406
|
+
const mods = collectModuleDependents(ctx.modules);
|
|
407
|
+
for (const mod of mods) if (mod.id) {
|
|
408
|
+
const ids = [
|
|
409
|
+
`${mod.id}?assets`,
|
|
410
|
+
`${mod.id}?assets=client`,
|
|
411
|
+
`${mod.id}?assets=${this.environment.name}`
|
|
412
|
+
];
|
|
413
|
+
for (const id of ids) invalidteModuleById(this.environment, id);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
...createVirtualPlugin("fullstack/client-fallback", () => "export {}"),
|
|
420
|
+
configEnvironment: {
|
|
421
|
+
order: "post",
|
|
422
|
+
handler(name, config, _env) {
|
|
423
|
+
if (name === "client") {
|
|
424
|
+
if ((pluginOpts?.experimental?.clientBuildFallback ?? true) && !config.build?.rollupOptions?.input) return { build: { rollupOptions: { input: { __fallback: "virtual:fullstack/client-fallback" } } } };
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
generateBundle(_optoins, bundle) {
|
|
429
|
+
if (this.environment.name !== "client") return;
|
|
430
|
+
for (const [k, v] of Object.entries(bundle)) if (v.type === "chunk" && v.name === "__fallback") delete bundle[k];
|
|
431
|
+
}
|
|
432
|
+
},
|
|
433
|
+
patchViteClientPlugin(),
|
|
434
|
+
patchVueScopeCssHmr(),
|
|
435
|
+
patchCssLinkSelfAccept()
|
|
436
|
+
];
|
|
437
|
+
}
|
|
438
|
+
const EMPTY_ASSETS = {
|
|
439
|
+
js: [],
|
|
440
|
+
css: []
|
|
441
|
+
};
|
|
442
|
+
const BUILD_ASSETS_MANIFEST_NAME = "__fullstack_assets_manifest.js";
|
|
443
|
+
async function collectCss(environment, entryId, options) {
|
|
444
|
+
const visited = /* @__PURE__ */ new Set();
|
|
445
|
+
const cssIds = /* @__PURE__ */ new Set();
|
|
446
|
+
async function recurse(id) {
|
|
447
|
+
if (visited.has(id) || parseAssetsVirtual(id) || "assets" in parseIdQuery(id).query) return;
|
|
448
|
+
visited.add(id);
|
|
449
|
+
const mod = environment.moduleGraph.getModuleById(id);
|
|
450
|
+
if (!mod) return;
|
|
451
|
+
if (options.eager && !mod?.transformResult) try {
|
|
452
|
+
await environment.transformRequest(id);
|
|
453
|
+
} catch (e) {
|
|
454
|
+
console.error(`[collectCss] Failed to transform '${id}'`, e);
|
|
455
|
+
}
|
|
456
|
+
for (const next of mod?.importedModules ?? []) if (next.id) if (isCSSRequest(next.id)) {
|
|
457
|
+
if (hasSpecialCssQuery(next.id)) continue;
|
|
458
|
+
cssIds.add(next.id);
|
|
459
|
+
} else await recurse(next.id);
|
|
460
|
+
}
|
|
461
|
+
await recurse(entryId);
|
|
462
|
+
const hrefs = [...cssIds].map((id) => normalizeViteImportAnalysisUrl(environment, id));
|
|
463
|
+
return {
|
|
464
|
+
ids: [...cssIds],
|
|
465
|
+
hrefs
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
function invalidteModuleById(environment, id) {
|
|
469
|
+
const mod = environment.moduleGraph.getModuleById(id);
|
|
470
|
+
if (mod) environment.moduleGraph.invalidateModule(mod);
|
|
471
|
+
return mod;
|
|
472
|
+
}
|
|
473
|
+
function collectModuleDependents(mods) {
|
|
474
|
+
const visited = /* @__PURE__ */ new Set();
|
|
475
|
+
function recurse(mod) {
|
|
476
|
+
if (visited.has(mod)) return;
|
|
477
|
+
visited.add(mod);
|
|
478
|
+
for (const importer of mod.importers) recurse(importer);
|
|
479
|
+
}
|
|
480
|
+
for (const mod of mods) recurse(mod);
|
|
481
|
+
return [...visited];
|
|
482
|
+
}
|
|
483
|
+
function hasSpecialCssQuery(id) {
|
|
484
|
+
return /[?&](url|inline|raw)(\b|=|&|$)/.test(id);
|
|
485
|
+
}
|
|
486
|
+
function collectAssetDeps(bundle) {
|
|
487
|
+
const chunkToDeps = /* @__PURE__ */ new Map();
|
|
488
|
+
for (const chunk of Object.values(bundle)) if (chunk.type === "chunk") chunkToDeps.set(chunk, collectAssetDepsInner(chunk.fileName, bundle));
|
|
489
|
+
const idToDeps = {};
|
|
490
|
+
for (const [chunk, deps] of chunkToDeps.entries()) for (const id of chunk.moduleIds) idToDeps[id] = {
|
|
491
|
+
chunk,
|
|
492
|
+
deps
|
|
493
|
+
};
|
|
494
|
+
return idToDeps;
|
|
495
|
+
}
|
|
496
|
+
function collectAssetDepsInner(fileName, bundle) {
|
|
497
|
+
const visited = /* @__PURE__ */ new Set();
|
|
498
|
+
const css = [];
|
|
499
|
+
function recurse(k) {
|
|
500
|
+
if (visited.has(k)) return;
|
|
501
|
+
visited.add(k);
|
|
502
|
+
const v = bundle[k];
|
|
503
|
+
assert$1(v, `Not found '${k}' in the bundle`);
|
|
504
|
+
if (v.type === "chunk") {
|
|
505
|
+
css.push(...v.viteMetadata?.importedCss ?? []);
|
|
506
|
+
for (const k2 of v.imports) if (k2 in bundle) recurse(k2);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
recurse(fileName);
|
|
510
|
+
return {
|
|
511
|
+
js: [...visited],
|
|
512
|
+
css: [...new Set(css)]
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
function patchViteClientPlugin() {
|
|
516
|
+
const viteClientPath = normalizePath(fileURLToPath(import.meta.resolve("vite/dist/client/client.mjs")));
|
|
517
|
+
function endIndexOf(code, searchValue) {
|
|
518
|
+
const i = code.lastIndexOf(searchValue);
|
|
519
|
+
return i === -1 ? i : i + searchValue.length;
|
|
520
|
+
}
|
|
521
|
+
return {
|
|
522
|
+
name: "fullstack:patch-vite-client",
|
|
523
|
+
transform: {
|
|
524
|
+
filter: { id: exactRegex(viteClientPath) },
|
|
525
|
+
handler(code, id) {
|
|
526
|
+
if (id === viteClientPath) {
|
|
527
|
+
if (code.includes("linkSheetsMap")) return;
|
|
528
|
+
const s = new MagicString(code);
|
|
529
|
+
s.prependLeft(code.indexOf("const sheetsMap"), `\
|
|
530
|
+
const linkSheetsMap = new Map();
|
|
531
|
+
document
|
|
532
|
+
.querySelectorAll('link[rel="stylesheet"][data-vite-dev-id]')
|
|
533
|
+
.forEach((el) => {
|
|
534
|
+
linkSheetsMap.set(el.getAttribute('data-vite-dev-id'), el)
|
|
535
|
+
});
|
|
536
|
+
`);
|
|
537
|
+
s.appendLeft(endIndexOf(code, `function updateStyle(id, content) {`), `if (linkSheetsMap.has(id)) { return }`);
|
|
538
|
+
s.appendLeft(endIndexOf(code, `function removeStyle(id) {`), `
|
|
539
|
+
const link = linkSheetsMap.get(id);
|
|
540
|
+
if (link) {
|
|
541
|
+
document
|
|
542
|
+
.querySelectorAll(
|
|
543
|
+
'link[rel="stylesheet"][data-vite-dev-id]',
|
|
544
|
+
)
|
|
545
|
+
.forEach((el) => {
|
|
546
|
+
if (el.getAttribute('data-vite-dev-id') === id) {
|
|
547
|
+
el.remove()
|
|
548
|
+
}
|
|
549
|
+
})
|
|
550
|
+
linkSheetsMap.delete(id)
|
|
551
|
+
}
|
|
552
|
+
`);
|
|
553
|
+
return s.toString();
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
function patchVueScopeCssHmr() {
|
|
560
|
+
return {
|
|
561
|
+
name: "fullstack:patch-vue-scoped-css-hmr",
|
|
562
|
+
configureServer(server) {
|
|
563
|
+
server.middlewares.use((req, _res, next) => {
|
|
564
|
+
if (req.headers.accept?.includes("text/css") && req.url?.includes("&lang.css=")) req.url = req.url.replace("&lang.css=", "?lang.css");
|
|
565
|
+
next();
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
function patchCssLinkSelfAccept() {
|
|
571
|
+
return {
|
|
572
|
+
name: "fullstack:patch-css-link-self-accept",
|
|
573
|
+
apply: "serve",
|
|
574
|
+
transform: {
|
|
575
|
+
order: "post",
|
|
576
|
+
handler(_code, id, _options) {
|
|
577
|
+
if (this.environment.name === "client" && this.environment.mode === "dev" && isCSSRequest(id) && directRequestRE.test(id)) {
|
|
578
|
+
const mod = this.environment.moduleGraph.getModuleById(id);
|
|
579
|
+
if (mod && !mod.isSelfAccepting) mod.isSelfAccepting = true;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
var BuildAssetsURLWithRuntime = class {
|
|
586
|
+
constructor(runtime) {
|
|
587
|
+
this.runtime = runtime;
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
function serializeValueWithRuntime(value) {
|
|
591
|
+
const replacements = [];
|
|
592
|
+
let result = JSON.stringify(value, (_key, value$1) => {
|
|
593
|
+
if (value$1 instanceof BuildAssetsURLWithRuntime) {
|
|
594
|
+
const placeholder = `__runtime_placeholder_${replacements.length}__`;
|
|
595
|
+
replacements.push([placeholder, value$1.runtime]);
|
|
596
|
+
return placeholder;
|
|
597
|
+
}
|
|
598
|
+
return value$1;
|
|
599
|
+
}, 2);
|
|
600
|
+
for (const [placeholder, runtime] of replacements) result = result.replace(`"${placeholder}"`, runtime);
|
|
601
|
+
return result;
|
|
602
|
+
}
|
|
603
|
+
function assetsURL(url, config) {
|
|
604
|
+
if (config.command === "build" && typeof config.experimental?.renderBuiltUrl === "function") {
|
|
605
|
+
const result = config.experimental.renderBuiltUrl(url, {
|
|
606
|
+
type: "asset",
|
|
607
|
+
hostType: "js",
|
|
608
|
+
ssr: true,
|
|
609
|
+
hostId: ""
|
|
610
|
+
});
|
|
611
|
+
if (typeof result === "object") {
|
|
612
|
+
if (result.runtime) return new BuildAssetsURLWithRuntime(result.runtime);
|
|
613
|
+
assert$1(!result.relative, "\"result.relative\" not supported on renderBuiltUrl() for fullstack plugin");
|
|
614
|
+
} else if (result) return result;
|
|
615
|
+
}
|
|
616
|
+
return config.base + url;
|
|
617
|
+
}
|
|
618
|
+
function assetsURLDev(url, config) {
|
|
619
|
+
return config.base + url;
|
|
620
|
+
}
|
|
621
|
+
//#endregion
|
|
622
|
+
//#region node_modules/.pnpm/@hiogawa+vite-plugin-fullstack@0.0.11_vite@8.0.0-beta.18_@types+node@25.4.0_esbuild@0.2_62dda1eccee284f7388c2af4cc76ce61/node_modules/@hiogawa/vite-plugin-fullstack/dist/runtime.js
|
|
623
|
+
function mergeAssets(...args) {
|
|
624
|
+
const js = uniqBy(args.flatMap((h) => h.js), (a) => a.href);
|
|
625
|
+
const css = uniqBy(args.flatMap((h) => h.css), (a) => a.href);
|
|
626
|
+
const raw = {
|
|
627
|
+
entry: args.filter((arg) => arg.entry)?.[0]?.entry,
|
|
628
|
+
js,
|
|
629
|
+
css
|
|
630
|
+
};
|
|
631
|
+
return {
|
|
632
|
+
...raw,
|
|
633
|
+
merge: (...args$1) => mergeAssets(raw, ...args$1)
|
|
634
|
+
};
|
|
635
|
+
function uniqBy(array, key) {
|
|
636
|
+
const seen = /* @__PURE__ */ new Set();
|
|
637
|
+
return array.filter((item) => {
|
|
638
|
+
const k = key(item);
|
|
639
|
+
if (seen.has(k)) return false;
|
|
640
|
+
seen.add(k);
|
|
641
|
+
return true;
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
//#endregion
|
|
646
|
+
export { assetsPlugin as n, mergeAssets as t };
|