@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,430 @@
|
|
|
1
|
+
import { createServer, Server } from 'node:net';
|
|
2
|
+
import { networkInterfaces, tmpdir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { rm } from 'node:fs/promises';
|
|
5
|
+
|
|
6
|
+
const unsafePorts = /* @__PURE__ */ new Set([
|
|
7
|
+
1,
|
|
8
|
+
// tcpmux
|
|
9
|
+
7,
|
|
10
|
+
// echo
|
|
11
|
+
9,
|
|
12
|
+
// discard
|
|
13
|
+
11,
|
|
14
|
+
// systat
|
|
15
|
+
13,
|
|
16
|
+
// daytime
|
|
17
|
+
15,
|
|
18
|
+
// netstat
|
|
19
|
+
17,
|
|
20
|
+
// qotd
|
|
21
|
+
19,
|
|
22
|
+
// chargen
|
|
23
|
+
20,
|
|
24
|
+
// ftp data
|
|
25
|
+
21,
|
|
26
|
+
// ftp access
|
|
27
|
+
22,
|
|
28
|
+
// ssh
|
|
29
|
+
23,
|
|
30
|
+
// telnet
|
|
31
|
+
25,
|
|
32
|
+
// smtp
|
|
33
|
+
37,
|
|
34
|
+
// time
|
|
35
|
+
42,
|
|
36
|
+
// name
|
|
37
|
+
43,
|
|
38
|
+
// nicname
|
|
39
|
+
53,
|
|
40
|
+
// domain
|
|
41
|
+
69,
|
|
42
|
+
// tftp
|
|
43
|
+
77,
|
|
44
|
+
// priv-rjs
|
|
45
|
+
79,
|
|
46
|
+
// finger
|
|
47
|
+
87,
|
|
48
|
+
// ttylink
|
|
49
|
+
95,
|
|
50
|
+
// supdup
|
|
51
|
+
101,
|
|
52
|
+
// hostriame
|
|
53
|
+
102,
|
|
54
|
+
// iso-tsap
|
|
55
|
+
103,
|
|
56
|
+
// gppitnp
|
|
57
|
+
104,
|
|
58
|
+
// acr-nema
|
|
59
|
+
109,
|
|
60
|
+
// pop2
|
|
61
|
+
110,
|
|
62
|
+
// pop3
|
|
63
|
+
111,
|
|
64
|
+
// sunrpc
|
|
65
|
+
113,
|
|
66
|
+
// auth
|
|
67
|
+
115,
|
|
68
|
+
// sftp
|
|
69
|
+
117,
|
|
70
|
+
// uucp-path
|
|
71
|
+
119,
|
|
72
|
+
// nntp
|
|
73
|
+
123,
|
|
74
|
+
// NTP
|
|
75
|
+
135,
|
|
76
|
+
// loc-srv /epmap
|
|
77
|
+
137,
|
|
78
|
+
// netbios
|
|
79
|
+
139,
|
|
80
|
+
// netbios
|
|
81
|
+
143,
|
|
82
|
+
// imap2
|
|
83
|
+
161,
|
|
84
|
+
// snmp
|
|
85
|
+
179,
|
|
86
|
+
// BGP
|
|
87
|
+
389,
|
|
88
|
+
// ldap
|
|
89
|
+
427,
|
|
90
|
+
// SLP (Also used by Apple Filing Protocol)
|
|
91
|
+
465,
|
|
92
|
+
// smtp+ssl
|
|
93
|
+
512,
|
|
94
|
+
// print / exec
|
|
95
|
+
513,
|
|
96
|
+
// login
|
|
97
|
+
514,
|
|
98
|
+
// shell
|
|
99
|
+
515,
|
|
100
|
+
// printer
|
|
101
|
+
526,
|
|
102
|
+
// tempo
|
|
103
|
+
530,
|
|
104
|
+
// courier
|
|
105
|
+
531,
|
|
106
|
+
// chat
|
|
107
|
+
532,
|
|
108
|
+
// netnews
|
|
109
|
+
540,
|
|
110
|
+
// uucp
|
|
111
|
+
548,
|
|
112
|
+
// AFP (Apple Filing Protocol)
|
|
113
|
+
554,
|
|
114
|
+
// rtsp
|
|
115
|
+
556,
|
|
116
|
+
// remotefs
|
|
117
|
+
563,
|
|
118
|
+
// nntp+ssl
|
|
119
|
+
587,
|
|
120
|
+
// smtp (rfc6409)
|
|
121
|
+
601,
|
|
122
|
+
// syslog-conn (rfc3195)
|
|
123
|
+
636,
|
|
124
|
+
// ldap+ssl
|
|
125
|
+
989,
|
|
126
|
+
// ftps-data
|
|
127
|
+
990,
|
|
128
|
+
// ftps
|
|
129
|
+
993,
|
|
130
|
+
// ldap+ssl
|
|
131
|
+
995,
|
|
132
|
+
// pop3+ssl
|
|
133
|
+
1719,
|
|
134
|
+
// h323gatestat
|
|
135
|
+
1720,
|
|
136
|
+
// h323hostcall
|
|
137
|
+
1723,
|
|
138
|
+
// pptp
|
|
139
|
+
2049,
|
|
140
|
+
// nfs
|
|
141
|
+
3659,
|
|
142
|
+
// apple-sasl / PasswordServer
|
|
143
|
+
4045,
|
|
144
|
+
// lockd
|
|
145
|
+
5060,
|
|
146
|
+
// sip
|
|
147
|
+
5061,
|
|
148
|
+
// sips
|
|
149
|
+
6e3,
|
|
150
|
+
// X11
|
|
151
|
+
6566,
|
|
152
|
+
// sane-port
|
|
153
|
+
6665,
|
|
154
|
+
// Alternate IRC [Apple addition]
|
|
155
|
+
6666,
|
|
156
|
+
// Alternate IRC [Apple addition]
|
|
157
|
+
6667,
|
|
158
|
+
// Standard IRC [Apple addition]
|
|
159
|
+
6668,
|
|
160
|
+
// Alternate IRC [Apple addition]
|
|
161
|
+
6669,
|
|
162
|
+
// Alternate IRC [Apple addition]
|
|
163
|
+
6697,
|
|
164
|
+
// IRC + TLS
|
|
165
|
+
10080
|
|
166
|
+
// Amanda
|
|
167
|
+
]);
|
|
168
|
+
function isUnsafePort(port) {
|
|
169
|
+
return unsafePorts.has(port);
|
|
170
|
+
}
|
|
171
|
+
function isSafePort(port) {
|
|
172
|
+
return !isUnsafePort(port);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
class GetPortError extends Error {
|
|
176
|
+
constructor(message, opts) {
|
|
177
|
+
super(message, opts);
|
|
178
|
+
this.message = message;
|
|
179
|
+
}
|
|
180
|
+
name = "GetPortError";
|
|
181
|
+
}
|
|
182
|
+
function _log(verbose, message) {
|
|
183
|
+
if (verbose) {
|
|
184
|
+
console.log(`[get-port] ${message}`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function _generateRange(from, to) {
|
|
188
|
+
if (to < from) {
|
|
189
|
+
return [];
|
|
190
|
+
}
|
|
191
|
+
const r = [];
|
|
192
|
+
for (let index = from; index <= to; index++) {
|
|
193
|
+
r.push(index);
|
|
194
|
+
}
|
|
195
|
+
return r;
|
|
196
|
+
}
|
|
197
|
+
function _tryPort(port, host) {
|
|
198
|
+
return new Promise((resolve) => {
|
|
199
|
+
const server = createServer();
|
|
200
|
+
server.unref();
|
|
201
|
+
server.on("error", () => {
|
|
202
|
+
resolve(false);
|
|
203
|
+
});
|
|
204
|
+
server.listen({ port, host }, () => {
|
|
205
|
+
const { port: port2 } = server.address();
|
|
206
|
+
server.close(() => {
|
|
207
|
+
resolve(isSafePort(port2) && port2);
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
function _getLocalHosts(additional) {
|
|
213
|
+
const hosts = new Set(additional);
|
|
214
|
+
for (const _interface of Object.values(networkInterfaces())) {
|
|
215
|
+
for (const config of _interface || []) {
|
|
216
|
+
if (config.address && !config.internal && !config.address.startsWith("fe80::") && // Link-Local
|
|
217
|
+
!config.address.startsWith("169.254")) {
|
|
218
|
+
hosts.add(config.address);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return [...hosts];
|
|
223
|
+
}
|
|
224
|
+
async function _findPort(ports, host) {
|
|
225
|
+
for (const port of ports) {
|
|
226
|
+
const r = await _tryPort(port, host);
|
|
227
|
+
if (r) {
|
|
228
|
+
return r;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
function _fmtOnHost(hostname) {
|
|
233
|
+
return hostname ? `on host ${JSON.stringify(hostname)}` : "on any host";
|
|
234
|
+
}
|
|
235
|
+
const HOSTNAME_RE = /^(?!-)[\d.:A-Za-z-]{1,63}(?<!-)$/;
|
|
236
|
+
function _validateHostname(hostname, _public, verbose) {
|
|
237
|
+
if (hostname && !HOSTNAME_RE.test(hostname)) {
|
|
238
|
+
const fallbackHost = _public ? "0.0.0.0" : "127.0.0.1";
|
|
239
|
+
_log(
|
|
240
|
+
verbose,
|
|
241
|
+
`Invalid hostname: ${JSON.stringify(hostname)}. Using ${JSON.stringify(
|
|
242
|
+
fallbackHost
|
|
243
|
+
)} as fallback.`
|
|
244
|
+
);
|
|
245
|
+
return fallbackHost;
|
|
246
|
+
}
|
|
247
|
+
return hostname;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
async function getPort(_userOptions = {}) {
|
|
251
|
+
if (typeof _userOptions === "number" || typeof _userOptions === "string") {
|
|
252
|
+
_userOptions = { port: Number.parseInt(_userOptions + "") || 0 };
|
|
253
|
+
}
|
|
254
|
+
const _port = Number(_userOptions.port ?? process.env.PORT);
|
|
255
|
+
const _userSpecifiedAnyPort = Boolean(
|
|
256
|
+
_userOptions.port || _userOptions.ports?.length || _userOptions.portRange?.length
|
|
257
|
+
);
|
|
258
|
+
const options = {
|
|
259
|
+
random: _port === 0,
|
|
260
|
+
ports: [],
|
|
261
|
+
portRange: [],
|
|
262
|
+
alternativePortRange: _userSpecifiedAnyPort ? [] : [3e3, 3100],
|
|
263
|
+
verbose: false,
|
|
264
|
+
..._userOptions,
|
|
265
|
+
port: _port,
|
|
266
|
+
host: _validateHostname(
|
|
267
|
+
_userOptions.host ?? process.env.HOST,
|
|
268
|
+
_userOptions.public,
|
|
269
|
+
_userOptions.verbose
|
|
270
|
+
)
|
|
271
|
+
};
|
|
272
|
+
if (options.random && !_userSpecifiedAnyPort) {
|
|
273
|
+
return getRandomPort(options.host);
|
|
274
|
+
}
|
|
275
|
+
const portsToCheck = [
|
|
276
|
+
options.port,
|
|
277
|
+
...options.ports,
|
|
278
|
+
..._generateRange(...options.portRange)
|
|
279
|
+
].filter((port) => {
|
|
280
|
+
if (!port) {
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
if (!isSafePort(port)) {
|
|
284
|
+
_log(options.verbose, `Ignoring unsafe port: ${port}`);
|
|
285
|
+
return false;
|
|
286
|
+
}
|
|
287
|
+
return true;
|
|
288
|
+
});
|
|
289
|
+
if (portsToCheck.length === 0) {
|
|
290
|
+
portsToCheck.push(3e3);
|
|
291
|
+
}
|
|
292
|
+
let availablePort = await _findPort(portsToCheck, options.host);
|
|
293
|
+
if (!availablePort && options.alternativePortRange.length > 0) {
|
|
294
|
+
availablePort = await _findPort(
|
|
295
|
+
_generateRange(...options.alternativePortRange),
|
|
296
|
+
options.host
|
|
297
|
+
);
|
|
298
|
+
if (portsToCheck.length > 0) {
|
|
299
|
+
let message = `Unable to find an available port (tried ${portsToCheck.join(
|
|
300
|
+
"-"
|
|
301
|
+
)} ${_fmtOnHost(options.host)}).`;
|
|
302
|
+
if (availablePort) {
|
|
303
|
+
message += ` Using alternative port ${availablePort}.`;
|
|
304
|
+
}
|
|
305
|
+
_log(options.verbose, message);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
if (!availablePort && _userOptions.random !== false) {
|
|
309
|
+
availablePort = await getRandomPort(options.host);
|
|
310
|
+
if (availablePort) {
|
|
311
|
+
_log(options.verbose, `Using random port ${availablePort}`);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
if (!availablePort) {
|
|
315
|
+
const triedRanges = [
|
|
316
|
+
options.port,
|
|
317
|
+
options.portRange.join("-"),
|
|
318
|
+
options.alternativePortRange.join("-")
|
|
319
|
+
].filter(Boolean).join(", ");
|
|
320
|
+
throw new GetPortError(
|
|
321
|
+
`Unable to find an available port ${_fmtOnHost(
|
|
322
|
+
options.host
|
|
323
|
+
)} (tried ${triedRanges})`
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
return availablePort;
|
|
327
|
+
}
|
|
328
|
+
async function getRandomPort(host) {
|
|
329
|
+
const port = await checkPort(0, host);
|
|
330
|
+
if (port === false) {
|
|
331
|
+
throw new GetPortError(`Unable to find a random port ${_fmtOnHost(host)}`);
|
|
332
|
+
}
|
|
333
|
+
return port;
|
|
334
|
+
}
|
|
335
|
+
async function waitForPort(port, options = {}) {
|
|
336
|
+
const delay = options.delay || 500;
|
|
337
|
+
const retries = options.retries || 4;
|
|
338
|
+
for (let index = retries; index > 0; index--) {
|
|
339
|
+
if (await _tryPort(port, options.host) === false) {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
343
|
+
}
|
|
344
|
+
throw new GetPortError(
|
|
345
|
+
`Timeout waiting for port ${port} after ${retries} retries with ${delay}ms interval.`
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
async function checkPort(port, host = process.env.HOST, verbose) {
|
|
349
|
+
if (!host) {
|
|
350
|
+
host = _getLocalHosts([void 0, "0.0.0.0"]);
|
|
351
|
+
}
|
|
352
|
+
if (!Array.isArray(host)) {
|
|
353
|
+
return _tryPort(port, host);
|
|
354
|
+
}
|
|
355
|
+
for (const _host of host) {
|
|
356
|
+
const _port = await _tryPort(port, _host);
|
|
357
|
+
if (_port === false) {
|
|
358
|
+
if (port < 1024 && verbose) {
|
|
359
|
+
_log(
|
|
360
|
+
verbose,
|
|
361
|
+
`Unable to listen to the privileged port ${port} ${_fmtOnHost(
|
|
362
|
+
_host
|
|
363
|
+
)}`
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
return false;
|
|
367
|
+
}
|
|
368
|
+
if (port === 0 && _port !== 0) {
|
|
369
|
+
port = _port;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
return port;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
let _nodeMajorVersion;
|
|
376
|
+
let _isSocketSupported;
|
|
377
|
+
function getSocketAddress(opts) {
|
|
378
|
+
const parts = [
|
|
379
|
+
opts.name,
|
|
380
|
+
opts.pid ? process.pid : void 0,
|
|
381
|
+
opts.random ? Math.round(Math.random() * 1e4) : void 0
|
|
382
|
+
].filter(Boolean);
|
|
383
|
+
const socketName = `${parts.join("-")}.sock`;
|
|
384
|
+
if (process.platform === "win32") {
|
|
385
|
+
return join(String.raw`\\.\pipe`, socketName);
|
|
386
|
+
}
|
|
387
|
+
if (process.platform === "linux") {
|
|
388
|
+
if (_nodeMajorVersion === void 0) {
|
|
389
|
+
_nodeMajorVersion = +process.versions.node.split(".")[0];
|
|
390
|
+
}
|
|
391
|
+
if (_nodeMajorVersion >= 20) {
|
|
392
|
+
return `\0${socketName}`;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
return join(tmpdir(), socketName);
|
|
396
|
+
}
|
|
397
|
+
async function isSocketSupported() {
|
|
398
|
+
if (_isSocketSupported !== void 0) {
|
|
399
|
+
return _isSocketSupported;
|
|
400
|
+
}
|
|
401
|
+
if (globalThis.process?.versions?.webcontainer) {
|
|
402
|
+
return false;
|
|
403
|
+
}
|
|
404
|
+
const socketAddress = getSocketAddress({ name: "get-port", random: true });
|
|
405
|
+
const server = new Server();
|
|
406
|
+
try {
|
|
407
|
+
await new Promise((resolve, reject) => {
|
|
408
|
+
server.on("error", reject);
|
|
409
|
+
server.listen(socketAddress, resolve);
|
|
410
|
+
});
|
|
411
|
+
_isSocketSupported = true;
|
|
412
|
+
return true;
|
|
413
|
+
} catch {
|
|
414
|
+
_isSocketSupported = false;
|
|
415
|
+
return false;
|
|
416
|
+
} finally {
|
|
417
|
+
if (server.listening) {
|
|
418
|
+
server.close();
|
|
419
|
+
await cleanSocket(socketAddress);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
async function cleanSocket(path) {
|
|
424
|
+
if (!path || path[0] === "\0" || path.startsWith(String.raw`\\.\pipe`)) {
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
return rm(path, { force: true, recursive: true }).catch(console.error);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
export { checkPort, cleanSocket, getPort, getRandomPort, getSocketAddress, isSafePort, isSocketSupported, isUnsafePort, waitForPort };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "get-port-please",
|
|
3
|
+
"version": "3.2.0",
|
|
4
|
+
"description": "Get an available TCP port to listen",
|
|
5
|
+
"repository": "unjs/get-port-please",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.mjs",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"require": "./dist/index.cjs"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"main": "./dist/index.cjs",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@types/node": "^24.0.13",
|
|
21
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
22
|
+
"changelogen": "^0.6.2",
|
|
23
|
+
"eslint": "^9.30.1",
|
|
24
|
+
"eslint-config-unjs": "^0.5.0",
|
|
25
|
+
"jiti": "^2.4.2",
|
|
26
|
+
"prettier": "^3.6.2",
|
|
27
|
+
"typescript": "^5.8.3",
|
|
28
|
+
"unbuild": "^3.5.0",
|
|
29
|
+
"vitest": "^3.2.4"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "unbuild",
|
|
33
|
+
"dev": "vitest",
|
|
34
|
+
"lint": "eslint . && prettier -c src test",
|
|
35
|
+
"lint:fix": "eslint --fix . && prettier -w src test",
|
|
36
|
+
"release": "pnpm test && pnpm build && changelogen --release --push && pnpm publish",
|
|
37
|
+
"test": "pnpm lint && vitest run"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
let FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, isTTY=true;
|
|
4
|
+
if (typeof process !== 'undefined') {
|
|
5
|
+
({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
|
|
6
|
+
isTTY = process.stdout && process.stdout.isTTY;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const $ = {
|
|
10
|
+
enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== 'dumb' && (
|
|
11
|
+
FORCE_COLOR != null && FORCE_COLOR !== '0' || isTTY
|
|
12
|
+
),
|
|
13
|
+
|
|
14
|
+
// modifiers
|
|
15
|
+
reset: init(0, 0),
|
|
16
|
+
bold: init(1, 22),
|
|
17
|
+
dim: init(2, 22),
|
|
18
|
+
italic: init(3, 23),
|
|
19
|
+
underline: init(4, 24),
|
|
20
|
+
inverse: init(7, 27),
|
|
21
|
+
hidden: init(8, 28),
|
|
22
|
+
strikethrough: init(9, 29),
|
|
23
|
+
|
|
24
|
+
// colors
|
|
25
|
+
black: init(30, 39),
|
|
26
|
+
red: init(31, 39),
|
|
27
|
+
green: init(32, 39),
|
|
28
|
+
yellow: init(33, 39),
|
|
29
|
+
blue: init(34, 39),
|
|
30
|
+
magenta: init(35, 39),
|
|
31
|
+
cyan: init(36, 39),
|
|
32
|
+
white: init(37, 39),
|
|
33
|
+
gray: init(90, 39),
|
|
34
|
+
grey: init(90, 39),
|
|
35
|
+
|
|
36
|
+
// background colors
|
|
37
|
+
bgBlack: init(40, 49),
|
|
38
|
+
bgRed: init(41, 49),
|
|
39
|
+
bgGreen: init(42, 49),
|
|
40
|
+
bgYellow: init(43, 49),
|
|
41
|
+
bgBlue: init(44, 49),
|
|
42
|
+
bgMagenta: init(45, 49),
|
|
43
|
+
bgCyan: init(46, 49),
|
|
44
|
+
bgWhite: init(47, 49)
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
function run(arr, str) {
|
|
48
|
+
let i=0, tmp, beg='', end='';
|
|
49
|
+
for (; i < arr.length; i++) {
|
|
50
|
+
tmp = arr[i];
|
|
51
|
+
beg += tmp.open;
|
|
52
|
+
end += tmp.close;
|
|
53
|
+
if (!!~str.indexOf(tmp.close)) {
|
|
54
|
+
str = str.replace(tmp.rgx, tmp.close + tmp.open);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return beg + str + end;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function chain(has, keys) {
|
|
61
|
+
let ctx = { has, keys };
|
|
62
|
+
|
|
63
|
+
ctx.reset = $.reset.bind(ctx);
|
|
64
|
+
ctx.bold = $.bold.bind(ctx);
|
|
65
|
+
ctx.dim = $.dim.bind(ctx);
|
|
66
|
+
ctx.italic = $.italic.bind(ctx);
|
|
67
|
+
ctx.underline = $.underline.bind(ctx);
|
|
68
|
+
ctx.inverse = $.inverse.bind(ctx);
|
|
69
|
+
ctx.hidden = $.hidden.bind(ctx);
|
|
70
|
+
ctx.strikethrough = $.strikethrough.bind(ctx);
|
|
71
|
+
|
|
72
|
+
ctx.black = $.black.bind(ctx);
|
|
73
|
+
ctx.red = $.red.bind(ctx);
|
|
74
|
+
ctx.green = $.green.bind(ctx);
|
|
75
|
+
ctx.yellow = $.yellow.bind(ctx);
|
|
76
|
+
ctx.blue = $.blue.bind(ctx);
|
|
77
|
+
ctx.magenta = $.magenta.bind(ctx);
|
|
78
|
+
ctx.cyan = $.cyan.bind(ctx);
|
|
79
|
+
ctx.white = $.white.bind(ctx);
|
|
80
|
+
ctx.gray = $.gray.bind(ctx);
|
|
81
|
+
ctx.grey = $.grey.bind(ctx);
|
|
82
|
+
|
|
83
|
+
ctx.bgBlack = $.bgBlack.bind(ctx);
|
|
84
|
+
ctx.bgRed = $.bgRed.bind(ctx);
|
|
85
|
+
ctx.bgGreen = $.bgGreen.bind(ctx);
|
|
86
|
+
ctx.bgYellow = $.bgYellow.bind(ctx);
|
|
87
|
+
ctx.bgBlue = $.bgBlue.bind(ctx);
|
|
88
|
+
ctx.bgMagenta = $.bgMagenta.bind(ctx);
|
|
89
|
+
ctx.bgCyan = $.bgCyan.bind(ctx);
|
|
90
|
+
ctx.bgWhite = $.bgWhite.bind(ctx);
|
|
91
|
+
|
|
92
|
+
return ctx;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function init(open, close) {
|
|
96
|
+
let blk = {
|
|
97
|
+
open: `\x1b[${open}m`,
|
|
98
|
+
close: `\x1b[${close}m`,
|
|
99
|
+
rgx: new RegExp(`\\x1b\\[${close}m`, 'g')
|
|
100
|
+
};
|
|
101
|
+
return function (txt) {
|
|
102
|
+
if (this !== void 0 && this.has !== void 0) {
|
|
103
|
+
!!~this.has.indexOf(open) || (this.has.push(open),this.keys.push(blk));
|
|
104
|
+
return txt === void 0 ? this : $.enabled ? run(this.keys, txt+'') : txt+'';
|
|
105
|
+
}
|
|
106
|
+
return txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt+'') : txt+'';
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export default $;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "kleur",
|
|
3
|
+
"version": "4.1.5",
|
|
4
|
+
"repository": "lukeed/kleur",
|
|
5
|
+
"description": "The fastest Node.js library for formatting terminal text with ANSI colors~!",
|
|
6
|
+
"module": "index.mjs",
|
|
7
|
+
"types": "index.d.ts",
|
|
8
|
+
"main": "index.js",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./index.d.ts",
|
|
13
|
+
"import": "./index.mjs",
|
|
14
|
+
"require": "./index.js"
|
|
15
|
+
},
|
|
16
|
+
"./colors": {
|
|
17
|
+
"types": "./colors.d.ts",
|
|
18
|
+
"import": "./colors.mjs",
|
|
19
|
+
"require": "./colors.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"*.d.ts",
|
|
24
|
+
"colors.*",
|
|
25
|
+
"index.*"
|
|
26
|
+
],
|
|
27
|
+
"author": {
|
|
28
|
+
"name": "Luke Edwards",
|
|
29
|
+
"email": "luke.edwards05@gmail.com",
|
|
30
|
+
"url": "https://lukeed.com"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "node build",
|
|
34
|
+
"test": "uvu -r esm -i utils -i xyz"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=6"
|
|
38
|
+
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"ansi",
|
|
41
|
+
"cli",
|
|
42
|
+
"color",
|
|
43
|
+
"colors",
|
|
44
|
+
"console",
|
|
45
|
+
"terminal"
|
|
46
|
+
],
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"esm": "3.2.25",
|
|
49
|
+
"uvu": "0.3.3"
|
|
50
|
+
}
|
|
51
|
+
}
|