nitro 3.0.1-alpha.2 → 3.0.260415-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 +2 -2
- package/dist/THIRD-PARTY-LICENSES.md +1646 -0
- package/dist/_build/common.mjs +7261 -3812
- package/dist/_build/rolldown.mjs +32 -42
- package/dist/_build/rollup.mjs +28 -48
- package/dist/_build/vite.build.mjs +10 -10
- package/dist/_chunks/nitro.mjs +102 -327
- package/dist/_chunks/nitro2.mjs +8 -9
- package/dist/_chunks/nitro3.mjs +136 -0
- package/dist/_chunks/nitro4.mjs +127 -0
- package/dist/_chunks/utils.mjs +40 -29
- package/dist/_common.mjs +13 -25
- package/dist/_dev.d.mts +0 -3
- package/dist/{_chunks/dev.mjs → _dev.mjs} +132 -330
- package/dist/_libs/_.mjs +2 -0
- package/dist/_libs/_2.mjs +2 -0
- package/dist/_libs/_3.mjs +2 -0
- package/dist/_libs/_4.mjs +2 -0
- package/dist/_libs/_5.mjs +2 -0
- package/dist/_libs/_6.mjs +2 -0
- package/dist/_libs/_7.mjs +2 -0
- package/dist/_libs/c12+rc9.mjs +814 -0
- package/dist/_libs/{c12+giget+readdirp+chokidar.d.mts → c12+readdirp+chokidar.d.mts} +49 -40
- package/dist/_libs/citty.mjs +142 -41
- package/dist/_libs/commondir+is-reference.mjs +60 -56
- package/dist/_libs/compatx.d.mts +0 -2
- package/dist/_libs/compatx.mjs +1 -4
- package/dist/_libs/esbuild.d.mts +0 -1
- package/dist/_libs/escape-string-regexp.mjs +1 -4
- package/dist/_libs/{pluginutils+plugin-commonjs.d.mts → estree+pluginutils.d.mts} +0 -5
- package/dist/_libs/estree-walker.mjs +4 -92
- package/dist/_libs/exsolve.d.mts +1 -0
- package/dist/_libs/hasown+resolve+deepmerge.mjs +160 -246
- package/dist/_libs/httpxy.d.mts +20 -13
- package/dist/_libs/httpxy.mjs +519 -95
- package/dist/_libs/js-tokens.d.mts +1 -0
- package/dist/_libs/klona.mjs +1 -4
- package/dist/_libs/magic-string.d.mts +0 -2
- package/dist/_libs/mlly.d.mts +0 -2
- package/dist/_libs/nypm+tinyexec.mjs +822 -0
- package/dist/_libs/perfect-debounce.mjs +68 -0
- package/dist/_libs/pkg-types.d.mts +0 -3
- package/dist/_libs/plugin-alias.mjs +1 -5
- package/dist/_libs/plugin-inject.mjs +1 -7
- package/dist/_libs/plugin-json.mjs +1 -5
- package/dist/_libs/pluginutils.mjs +3 -35
- package/dist/_libs/readdirp+chokidar.mjs +187 -365
- package/dist/_libs/remapping.mjs +1 -5
- package/dist/_libs/resolve-uri+gen-mapping.mjs +15 -53
- package/dist/_libs/rou3.d.mts +1 -4
- package/dist/_libs/rou3.mjs +223 -78
- package/dist/_libs/std-env.d.mts +8 -2
- package/dist/_libs/strip-literal.d.mts +1 -0
- package/dist/_libs/tsconfck.mjs +21 -334
- package/dist/_libs/ultrahtml.mjs +3 -16
- package/dist/_libs/unimport+unplugin.mjs +244 -388
- package/dist/_libs/unplugin+unimport.d.mts +5 -15
- package/dist/_libs/unwasm.d.mts +0 -3
- package/dist/_presets.mjs +576 -488
- package/dist/builder.d.mts +5 -25
- package/dist/builder.mjs +3 -8
- package/dist/cli/_chunks/build.mjs +22 -25
- package/dist/cli/_chunks/common.mjs +1 -4
- package/dist/cli/_chunks/deploy.mjs +37 -0
- package/dist/cli/_chunks/dev.mjs +6 -11
- package/dist/cli/_chunks/docs.mjs +28 -0
- package/dist/cli/_chunks/list.mjs +4 -8
- package/dist/cli/_chunks/prepare.mjs +2 -6
- package/dist/cli/_chunks/preview.mjs +48 -0
- package/dist/cli/_chunks/run.mjs +7 -11
- package/dist/cli/_chunks/task.mjs +1 -5
- package/dist/cli/index.mjs +5 -6
- package/dist/docs/0.docs/0.index/index.md +56 -0
- package/dist/docs/0.docs/1.quick-start.md +110 -0
- package/dist/docs/0.docs/10.lifecycle.md +204 -0
- package/dist/docs/0.docs/11.openapi.md +291 -0
- package/dist/docs/0.docs/12.plugins.md +164 -0
- package/dist/docs/0.docs/13.tasks.md +277 -0
- package/dist/docs/0.docs/14.websocket.md +386 -0
- package/dist/docs/0.docs/15.migration.md +213 -0
- package/dist/docs/0.docs/16.nightly.md +31 -0
- package/dist/docs/0.docs/2.renderer.md +322 -0
- package/dist/docs/0.docs/3.routing.md +711 -0
- package/dist/docs/0.docs/4.server-entry.md +239 -0
- package/dist/docs/0.docs/5.cache.md +408 -0
- package/dist/docs/0.docs/6.storage.md +261 -0
- package/dist/docs/0.docs/7.assets.md +166 -0
- package/dist/docs/0.docs/8.configuration.md +256 -0
- package/dist/docs/0.docs/9.database.md +185 -0
- package/dist/docs/1.deploy/0.index/index.md +64 -0
- package/dist/docs/1.deploy/1.runtimes/0.node.md +63 -0
- package/dist/docs/1.deploy/1.runtimes/1.bun.md +15 -0
- package/dist/docs/1.deploy/1.runtimes/2.deno.md +19 -0
- package/dist/docs/1.deploy/2.providers/0.alwaysdata.md +50 -0
- package/dist/docs/1.deploy/2.providers/1.aws.md +47 -0
- package/dist/docs/1.deploy/2.providers/10.flightcontrol.md +67 -0
- package/dist/docs/1.deploy/2.providers/11.genezio.md +67 -0
- package/dist/docs/1.deploy/2.providers/12.github-pages.md +68 -0
- package/dist/docs/1.deploy/2.providers/13.gitlab-pages.md +37 -0
- package/dist/docs/1.deploy/2.providers/14.heroku.md +84 -0
- package/dist/docs/1.deploy/2.providers/15.iis.md +38 -0
- package/dist/docs/1.deploy/2.providers/16.koyeb.md +109 -0
- package/dist/docs/1.deploy/2.providers/17.netlify.md +47 -0
- package/dist/docs/1.deploy/2.providers/18.platform-sh.md +37 -0
- package/dist/docs/1.deploy/2.providers/19.render.md +37 -0
- package/dist/docs/1.deploy/2.providers/2.aws-amplify.md +81 -0
- package/dist/docs/1.deploy/2.providers/20.stormkit.md +24 -0
- package/dist/docs/1.deploy/2.providers/21.vercel.md +270 -0
- package/dist/docs/1.deploy/2.providers/22.zeabur.md +19 -0
- package/dist/docs/1.deploy/2.providers/23.zephyr.md +99 -0
- package/dist/docs/1.deploy/2.providers/24.zerops.md +102 -0
- package/dist/docs/1.deploy/2.providers/3.azure.md +72 -0
- package/dist/docs/1.deploy/2.providers/4.cleavr.md +33 -0
- package/dist/docs/1.deploy/2.providers/5.cloudflare.md +369 -0
- package/dist/docs/1.deploy/2.providers/6.deno-deploy.md +66 -0
- package/dist/docs/1.deploy/2.providers/7.digitalocean.md +46 -0
- package/dist/docs/1.deploy/2.providers/8.edgeone.md +20 -0
- package/dist/docs/1.deploy/2.providers/9.firebase.md +32 -0
- package/dist/docs/2.config/0.index/index.md +1221 -0
- package/dist/docs/3.examples/0.index/index.md +3 -0
- package/dist/docs/3.examples/1.api-routes.md +145 -0
- package/dist/docs/3.examples/10.hono.md +74 -0
- package/dist/docs/3.examples/11.import-alias.md +97 -0
- package/dist/docs/3.examples/12.middleware.md +91 -0
- package/dist/docs/3.examples/13.mono-jsx.md +68 -0
- package/dist/docs/3.examples/14.nano-jsx.md +70 -0
- package/dist/docs/3.examples/15.plugins.md +91 -0
- package/dist/docs/3.examples/16.renderer.md +113 -0
- package/dist/docs/3.examples/17.runtime-config.md +97 -0
- package/dist/docs/3.examples/18.server-fetch.md +87 -0
- package/dist/docs/3.examples/19.shiki.md +198 -0
- package/dist/docs/3.examples/2.auto-imports.md +92 -0
- package/dist/docs/3.examples/20.virtual-routes.md +74 -0
- package/dist/docs/3.examples/21.vite-nitro-plugin.md +79 -0
- package/dist/docs/3.examples/22.vite-rsc.md +1041 -0
- package/dist/docs/3.examples/23.vite-ssr-html.md +217 -0
- package/dist/docs/3.examples/24.vite-ssr-preact.md +247 -0
- package/dist/docs/3.examples/25.vite-ssr-react.md +226 -0
- package/dist/docs/3.examples/26.vite-ssr-solid.md +256 -0
- package/dist/docs/3.examples/27.vite-ssr-tsr-react.md +442 -0
- package/dist/docs/3.examples/28.vite-ssr-tss-react.md +444 -0
- package/dist/docs/3.examples/29.vite-ssr-vue-router.md +617 -0
- package/dist/docs/3.examples/3.cached-handler.md +81 -0
- package/dist/docs/3.examples/30.vite-trpc.md +335 -0
- package/dist/docs/3.examples/31.websocket.md +282 -0
- package/dist/docs/3.examples/4.custom-error-handler.md +98 -0
- package/dist/docs/3.examples/5.database.md +157 -0
- package/dist/docs/3.examples/6.elysia.md +70 -0
- package/dist/docs/3.examples/7.express.md +78 -0
- package/dist/docs/3.examples/8.fastify.md +79 -0
- package/dist/docs/3.examples/9.hello-world.md +68 -0
- package/dist/docs/README.md +86 -0
- package/dist/docs/index.md +121 -0
- 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/@speed-highlight/core/dist/index.js +4 -4
- package/dist/node_modules/@speed-highlight/core/dist/terminal.js +2 -2
- package/dist/node_modules/@speed-highlight/core/package.json +1 -1
- package/dist/node_modules/cookie-es/dist/index.mjs +299 -250
- package/dist/node_modules/cookie-es/package.json +26 -23
- package/dist/node_modules/croner/dist/croner.js +1 -1
- package/dist/node_modules/croner/package.json +11 -1
- package/dist/node_modules/defu/dist/defu.mjs +2 -2
- package/dist/node_modules/defu/package.json +33 -28
- package/dist/node_modules/rendu/dist/_chunks/libs/cookie-es.mjs +151 -0
- package/dist/node_modules/rendu/dist/index.mjs +5 -112
- package/dist/node_modules/rendu/package.json +25 -24
- package/dist/node_modules/youch/build/helpers-B9BQYaS6.js +23 -0
- package/dist/node_modules/youch/build/index.js +204 -351
- package/dist/node_modules/youch/build/public/error_info/script.js +1 -1
- 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 +35 -32
- package/dist/presets/_nitro/runtime/nitro-dev.mjs +12 -57
- package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +1 -0
- package/dist/presets/_nitro/runtime/service-worker.mjs +1 -2
- package/dist/presets/aws-lambda/runtime/_utils.mjs +6 -6
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +3 -1
- package/dist/presets/azure/runtime/_utils.mjs +5 -5
- package/dist/presets/azure/runtime/azure-swa.mjs +5 -5
- package/dist/presets/bun/runtime/bun.mjs +9 -6
- package/dist/presets/cloudflare/runtime/_module-handler.mjs +1 -1
- package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +4 -4
- package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +3 -3
- package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +2 -2
- package/dist/presets/cloudflare/runtime/plugin.dev.mjs +10 -21
- package/dist/presets/deno/runtime/deno-deploy.mjs +4 -4
- package/dist/presets/deno/runtime/deno-server.mjs +9 -6
- package/dist/presets/edgeone/runtime/edgeone.mjs +10 -0
- package/dist/presets/netlify/runtime/netlify-edge.mjs +2 -3
- package/dist/presets/netlify/runtime/netlify.mjs +1 -1
- package/dist/presets/node/runtime/node-cluster.mjs +5 -4
- package/dist/presets/node/runtime/node-middleware.mjs +1 -1
- package/dist/presets/node/runtime/node-server.mjs +8 -5
- package/dist/presets/stormkit/runtime/stormkit.mjs +1 -2
- package/dist/presets/vercel/runtime/cron-handler.mjs +25 -0
- package/dist/presets/vercel/runtime/queue-handler.mjs +21 -0
- package/dist/presets/vercel/runtime/vercel.node.mjs +3 -3
- package/dist/presets/vercel/runtime/vercel.web.mjs +3 -5
- package/dist/presets/winterjs/runtime/winterjs.mjs +10 -10
- package/dist/presets/zephyr/runtime/server.mjs +3 -0
- package/dist/runtime/internal/app.mjs +12 -11
- 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/context.mjs +1 -9
- package/dist/runtime/internal/error/dev.d.mts +5 -4
- package/dist/runtime/internal/error/dev.mjs +47 -49
- 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 +11 -4
- package/dist/runtime/internal/route-rules.mjs +15 -5
- package/dist/runtime/internal/routes/dev-tasks.d.mts +3 -2
- package/dist/runtime/internal/routes/dev-tasks.mjs +15 -10
- package/dist/runtime/internal/routes/openapi.mjs +2 -2
- 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/scalar.mjs +3 -3
- package/dist/runtime/internal/routes/swagger.mjs +7 -4
- package/dist/runtime/internal/runtime-config.d.mts +1 -1
- package/dist/runtime/internal/runtime-config.mjs +2 -2
- package/dist/runtime/internal/static.mjs +5 -4
- package/dist/runtime/internal/task.d.mts +3 -1
- package/dist/runtime/internal/task.mjs +7 -7
- package/dist/runtime/internal/vite/dev-entry.mjs +6 -3
- package/dist/runtime/internal/vite/dev-worker.mjs +264 -0
- package/dist/runtime/meta.d.mts +1 -0
- package/dist/runtime/meta.mjs +2 -0
- package/dist/runtime/nitro.d.mts +2 -0
- package/dist/runtime/nitro.mjs +4 -2
- package/dist/runtime/virtual/error-handler.mjs +1 -1
- package/dist/runtime/virtual/renderer-template.mjs +1 -1
- package/dist/runtime/virtual/server-assets.d.mts +2 -1
- package/dist/runtime/virtual/tracing.d.mts +5 -0
- package/dist/runtime/virtual/tracing.mjs +1 -0
- package/dist/runtime/vite.d.mts +1 -1
- package/dist/types/index.d.mts +215 -195
- package/dist/types/index.mjs +1 -11
- package/dist/vite.d.mts +3 -8
- package/dist/vite.mjs +285 -253
- package/lib/tsconfig.json +3 -5
- package/package.json +97 -80
- package/dist/_libs/confbox.mjs +0 -2509
- package/dist/_libs/nypm+giget+tinyexec.mjs +0 -3603
- package/dist/_libs/rc9+c12+dotenv.mjs +0 -972
- package/dist/node_modules/hookable/dist/index.mjs +0 -266
- package/dist/node_modules/hookable/package.json +0 -52
- package/dist/node_modules/youch/build/chunk-4L7RY2JA.js +0 -42
- package/dist/node_modules/youch/build/chunk-7QV3D5YX.js +0 -83
- package/dist/node_modules/youch/build/chunk-AUGPHE32.js +0 -39
- package/dist/node_modules/youch/build/chunk-CM7DWJNZ.js +0 -44
- package/dist/node_modules/youch/build/chunk-EJH674NB.js +0 -223
- package/dist/node_modules/youch/build/chunk-OIJ3WD7L.js +0 -81
- package/dist/node_modules/youch/build/chunk-P36L72PL.js +0 -87
- package/dist/node_modules/youch/build/chunk-PE3GG3TN.js +0 -65
- package/dist/node_modules/youch/build/chunk-X53OIOJH.js +0 -70
- package/dist/presets/_nitro/runtime/nitro-dev.d.mts +0 -2
- package/dist/presets/_nitro/runtime/nitro-prerenderer.d.mts +0 -3
- 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 -8
- 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 -3
- package/dist/presets/netlify/runtime/netlify.d.mts +0 -4
- 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/isr.d.mts +0 -2
- 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 -2
- package/dist/presets/zeabur/runtime/zeabur.d.mts +0 -3
- package/dist/runtime/internal/vite/node-runner.mjs +0 -359
|
@@ -1,24 +1,13 @@
|
|
|
1
|
-
import { i as __toESM
|
|
2
|
-
import {
|
|
1
|
+
import { i as __toESM } from "../_common.mjs";
|
|
2
|
+
import { N as require_picomatch, S as MagicString, T as parse$1, b as getMagicString, ct as join$1, dt as resolve$1, st as isAbsolute$2, y as createUnimport } from "../_build/common.mjs";
|
|
3
3
|
import { t as walk } from "./estree-walker.mjs";
|
|
4
4
|
import { t as remapping } from "./remapping.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import fs, { promises } from "node:fs";
|
|
7
|
-
import "node:fs/promises";
|
|
8
|
-
import { fileURLToPath } from "node:url";
|
|
9
|
-
import "node:os";
|
|
10
7
|
import path, { basename, dirname, extname, isAbsolute, normalize, resolve } from "node:path";
|
|
11
8
|
import process$1 from "node:process";
|
|
12
|
-
import "scule";
|
|
13
9
|
import { Buffer } from "node:buffer";
|
|
14
10
|
import * as querystring from "node:querystring";
|
|
15
|
-
|
|
16
|
-
//#region node_modules/.pnpm/unimport@5.6.0/node_modules/unimport/dist/chunks/detect-acorn.mjs
|
|
17
|
-
var detect_acorn_exports = /* @__PURE__ */ __exportAll({
|
|
18
|
-
createVirtualImportsAcronWalker: () => createVirtualImportsAcronWalker,
|
|
19
|
-
detectImportsAcorn: () => detectImportsAcorn,
|
|
20
|
-
traveseScopes: () => traveseScopes
|
|
21
|
-
});
|
|
22
11
|
async function detectImportsAcorn(code, ctx, options) {
|
|
23
12
|
const s = getMagicString(code);
|
|
24
13
|
const map = await ctx.getImportMap();
|
|
@@ -71,7 +60,7 @@ function traveseScopes(ast, additionalWalk) {
|
|
|
71
60
|
}
|
|
72
61
|
function popScope(node) {
|
|
73
62
|
if (scopesStack.pop()?.node !== node) throw new Error("Scope mismatch");
|
|
74
|
-
scopeCurrent = scopesStack
|
|
63
|
+
scopeCurrent = scopesStack.at(-1);
|
|
75
64
|
}
|
|
76
65
|
pushScope(void 0);
|
|
77
66
|
walk(ast, {
|
|
@@ -201,9 +190,6 @@ function createVirtualImportsAcronWalker(importMap, virtualImports = []) {
|
|
|
201
190
|
} }
|
|
202
191
|
};
|
|
203
192
|
}
|
|
204
|
-
|
|
205
|
-
//#endregion
|
|
206
|
-
//#region node_modules/.pnpm/unplugin@2.3.11/node_modules/unplugin/dist/context-Csj9j3eN.js
|
|
207
193
|
var import_picomatch = /* @__PURE__ */ __toESM(require_picomatch(), 1);
|
|
208
194
|
function toArray$2(array) {
|
|
209
195
|
array = array || [];
|
|
@@ -211,16 +197,16 @@ function toArray$2(array) {
|
|
|
211
197
|
return [array];
|
|
212
198
|
}
|
|
213
199
|
const BACKSLASH_REGEX = /\\/g;
|
|
214
|
-
function normalize$1(path
|
|
215
|
-
return path
|
|
200
|
+
function normalize$1(path) {
|
|
201
|
+
return path.replace(BACKSLASH_REGEX, "/");
|
|
216
202
|
}
|
|
217
203
|
const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Z]:)?[/\\|])/i;
|
|
218
|
-
function isAbsolute$1(path
|
|
219
|
-
return ABSOLUTE_PATH_REGEX.test(path
|
|
204
|
+
function isAbsolute$1(path) {
|
|
205
|
+
return ABSOLUTE_PATH_REGEX.test(path);
|
|
220
206
|
}
|
|
221
|
-
function getMatcherString$1(glob, cwd
|
|
207
|
+
function getMatcherString$1(glob, cwd) {
|
|
222
208
|
if (glob.startsWith("**") || isAbsolute$1(glob)) return normalize$1(glob);
|
|
223
|
-
return normalize$1(resolve(cwd
|
|
209
|
+
return normalize$1(resolve(cwd, glob));
|
|
224
210
|
}
|
|
225
211
|
function patternToIdFilter(pattern) {
|
|
226
212
|
if (pattern instanceof RegExp) return (id) => {
|
|
@@ -304,16 +290,8 @@ function normalizeObjectHook(name, hook) {
|
|
|
304
290
|
};
|
|
305
291
|
}
|
|
306
292
|
function parse(code, opts = {}) {
|
|
307
|
-
|
|
308
|
-
sourceType: "module",
|
|
309
|
-
ecmaVersion: "latest",
|
|
310
|
-
locations: true,
|
|
311
|
-
...opts
|
|
312
|
-
});
|
|
293
|
+
throw new Error("Parse implementation is not set. Please call setParseImpl first.");
|
|
313
294
|
}
|
|
314
|
-
|
|
315
|
-
//#endregion
|
|
316
|
-
//#region node_modules/.pnpm/unplugin@2.3.11/node_modules/unplugin/dist/webpack-like-DFGTNSuV.js
|
|
317
295
|
function transformUse(data, plugin, transformLoader) {
|
|
318
296
|
if (data.resource == null) return [];
|
|
319
297
|
const id = normalizeAbsolutePath(data.resource + (data.resourceQuery || ""));
|
|
@@ -326,24 +304,11 @@ function transformUse(data, plugin, transformLoader) {
|
|
|
326
304
|
ident: plugin.name
|
|
327
305
|
}];
|
|
328
306
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
* untouched.
|
|
335
|
-
*
|
|
336
|
-
* @param path - Path to normalize.
|
|
337
|
-
* @returns a new normalized path.
|
|
338
|
-
*/
|
|
339
|
-
function normalizeAbsolutePath(path$1) {
|
|
340
|
-
if (isAbsolute(path$1)) return normalize(path$1);
|
|
341
|
-
else return path$1;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
//#endregion
|
|
345
|
-
//#region node_modules/.pnpm/unplugin@2.3.11/node_modules/unplugin/dist/context-DkYlx1xL.js
|
|
346
|
-
function createBuildContext$1(compiler, compilation, loaderContext, inputSourceMap) {
|
|
307
|
+
function normalizeAbsolutePath(path) {
|
|
308
|
+
if (isAbsolute(path)) return normalize(path);
|
|
309
|
+
else return path;
|
|
310
|
+
}
|
|
311
|
+
function createBuildContext$3(compiler, compilation, loaderContext, inputSourceMap) {
|
|
347
312
|
return {
|
|
348
313
|
getNativeBuildContext() {
|
|
349
314
|
return {
|
|
@@ -355,8 +320,9 @@ function createBuildContext$1(compiler, compilation, loaderContext, inputSourceM
|
|
|
355
320
|
};
|
|
356
321
|
},
|
|
357
322
|
addWatchFile(file) {
|
|
358
|
-
const
|
|
359
|
-
compilation.fileDependencies.add(
|
|
323
|
+
const resolvedPath = resolve(process.cwd(), file);
|
|
324
|
+
compilation.fileDependencies.add(resolvedPath);
|
|
325
|
+
loaderContext?.addDependency(resolvedPath);
|
|
360
326
|
},
|
|
361
327
|
getWatchFiles() {
|
|
362
328
|
return Array.from(compilation.fileDependencies);
|
|
@@ -371,7 +337,7 @@ function createBuildContext$1(compiler, compilation, loaderContext, inputSourceM
|
|
|
371
337
|
}
|
|
372
338
|
};
|
|
373
339
|
}
|
|
374
|
-
function normalizeMessage$
|
|
340
|
+
function normalizeMessage$2(error) {
|
|
375
341
|
const err = new Error(typeof error === "string" ? error : error.message);
|
|
376
342
|
if (typeof error === "object") {
|
|
377
343
|
err.stack = error.stack;
|
|
@@ -379,9 +345,6 @@ function normalizeMessage$1(error) {
|
|
|
379
345
|
}
|
|
380
346
|
return err;
|
|
381
347
|
}
|
|
382
|
-
|
|
383
|
-
//#endregion
|
|
384
|
-
//#region node_modules/.pnpm/unplugin@2.3.11/node_modules/unplugin/dist/utils-BosfZ0pB.js
|
|
385
348
|
function encodeVirtualModuleId(id, plugin) {
|
|
386
349
|
return resolve(plugin.__virtualModulePrefix, encodeURIComponent(id));
|
|
387
350
|
}
|
|
@@ -415,23 +378,20 @@ var FakeVirtualModulesPlugin = class FakeVirtualModulesPlugin {
|
|
|
415
378
|
const counter = FakeVirtualModulesPlugin.counters.get(dir) ?? 0;
|
|
416
379
|
FakeVirtualModulesPlugin.counters.set(dir, counter + 1);
|
|
417
380
|
compiler.hooks.shutdown.tap(this.name, () => {
|
|
418
|
-
const counter
|
|
419
|
-
if (counter
|
|
381
|
+
const counter = (FakeVirtualModulesPlugin.counters.get(dir) ?? 1) - 1;
|
|
382
|
+
if (counter === 0) {
|
|
420
383
|
FakeVirtualModulesPlugin.counters.delete(dir);
|
|
421
384
|
fs.rmSync(dir, {
|
|
422
385
|
recursive: true,
|
|
423
386
|
force: true
|
|
424
387
|
});
|
|
425
|
-
} else FakeVirtualModulesPlugin.counters.set(dir, counter
|
|
388
|
+
} else FakeVirtualModulesPlugin.counters.set(dir, counter);
|
|
426
389
|
});
|
|
427
390
|
}
|
|
428
391
|
async writeModule(file) {
|
|
429
392
|
return fs.promises.writeFile(file, "");
|
|
430
393
|
}
|
|
431
394
|
};
|
|
432
|
-
|
|
433
|
-
//#endregion
|
|
434
|
-
//#region node_modules/.pnpm/unplugin@2.3.11/node_modules/unplugin/dist/context-OCFO8EW1.js
|
|
435
395
|
function contextOptionsFromCompilation(compilation) {
|
|
436
396
|
return {
|
|
437
397
|
addWatchFile(file) {
|
|
@@ -442,11 +402,11 @@ function contextOptionsFromCompilation(compilation) {
|
|
|
442
402
|
}
|
|
443
403
|
};
|
|
444
404
|
}
|
|
445
|
-
const require
|
|
405
|
+
const require = createRequire(import.meta.url);
|
|
446
406
|
function getSource(fileSource) {
|
|
447
|
-
return new (require
|
|
407
|
+
return new (require("webpack")).sources.RawSource(typeof fileSource === "string" ? fileSource : Buffer.from(fileSource.buffer));
|
|
448
408
|
}
|
|
449
|
-
function createBuildContext(options, compiler, compilation, loaderContext, inputSourceMap) {
|
|
409
|
+
function createBuildContext$2(options, compiler, compilation, loaderContext, inputSourceMap) {
|
|
450
410
|
return {
|
|
451
411
|
parse,
|
|
452
412
|
addWatchFile(id) {
|
|
@@ -473,7 +433,7 @@ function createBuildContext(options, compiler, compilation, loaderContext, input
|
|
|
473
433
|
}
|
|
474
434
|
};
|
|
475
435
|
}
|
|
476
|
-
function normalizeMessage(error) {
|
|
436
|
+
function normalizeMessage$1(error) {
|
|
477
437
|
const err = new Error(typeof error === "string" ? error : error.message);
|
|
478
438
|
if (typeof error === "object") {
|
|
479
439
|
err.stack = error.stack;
|
|
@@ -481,279 +441,203 @@ function normalizeMessage(error) {
|
|
|
481
441
|
}
|
|
482
442
|
return err;
|
|
483
443
|
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
444
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
445
|
+
const ExtToLoader$1 = {
|
|
446
|
+
".js": "js",
|
|
447
|
+
".mjs": "js",
|
|
448
|
+
".cjs": "js",
|
|
449
|
+
".jsx": "jsx",
|
|
450
|
+
".ts": "ts",
|
|
451
|
+
".cts": "ts",
|
|
452
|
+
".mts": "ts",
|
|
453
|
+
".tsx": "tsx",
|
|
454
|
+
".css": "css",
|
|
455
|
+
".less": "css",
|
|
456
|
+
".stylus": "css",
|
|
457
|
+
".scss": "css",
|
|
458
|
+
".sass": "css",
|
|
459
|
+
".json": "json",
|
|
460
|
+
".txt": "text"
|
|
461
|
+
};
|
|
462
|
+
function guessLoader$1(id) {
|
|
463
|
+
return ExtToLoader$1[path.extname(id).toLowerCase()] || "js";
|
|
464
|
+
}
|
|
465
|
+
function createBuildContext$1(build) {
|
|
466
|
+
const watchFiles = [];
|
|
467
|
+
return {
|
|
468
|
+
addWatchFile(file) {
|
|
469
|
+
watchFiles.push(file);
|
|
470
|
+
},
|
|
471
|
+
getWatchFiles() {
|
|
472
|
+
return watchFiles;
|
|
473
|
+
},
|
|
474
|
+
emitFile(emittedFile) {
|
|
475
|
+
const outFileName = emittedFile.fileName || emittedFile.name;
|
|
476
|
+
const outdir = build?.config?.outdir;
|
|
477
|
+
if (outdir && emittedFile.source && outFileName) {
|
|
478
|
+
const outPath = path.resolve(outdir, outFileName);
|
|
479
|
+
const outDir = path.dirname(outPath);
|
|
480
|
+
if (!fs.existsSync(outDir)) fs.mkdirSync(outDir, { recursive: true });
|
|
481
|
+
fs.writeFileSync(outPath, emittedFile.source);
|
|
499
482
|
}
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
isFile() {
|
|
508
|
-
return this._checkModeProperty(constants_1.default.S_IFREG);
|
|
509
|
-
}
|
|
510
|
-
isBlockDevice() {
|
|
511
|
-
return this._checkModeProperty(constants_1.default.S_IFBLK);
|
|
512
|
-
}
|
|
513
|
-
isCharacterDevice() {
|
|
514
|
-
return this._checkModeProperty(constants_1.default.S_IFCHR);
|
|
515
|
-
}
|
|
516
|
-
isSymbolicLink() {
|
|
517
|
-
return this._checkModeProperty(constants_1.default.S_IFLNK);
|
|
518
|
-
}
|
|
519
|
-
isFIFO() {
|
|
520
|
-
return this._checkModeProperty(constants_1.default.S_IFIFO);
|
|
521
|
-
}
|
|
522
|
-
isSocket() {
|
|
523
|
-
return this._checkModeProperty(constants_1.default.S_IFSOCK);
|
|
483
|
+
},
|
|
484
|
+
parse,
|
|
485
|
+
getNativeBuildContext() {
|
|
486
|
+
return {
|
|
487
|
+
framework: "bun",
|
|
488
|
+
build
|
|
489
|
+
};
|
|
524
490
|
}
|
|
525
491
|
};
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
function checkActivation(instance) {
|
|
541
|
-
if (!instance._compiler) throw new Error("You must use this plugin only after creating webpack instance!");
|
|
542
|
-
}
|
|
543
|
-
function getModulePath(filePath, compiler) {
|
|
544
|
-
return path_1.default.isAbsolute(filePath) ? filePath : path_1.default.join(compiler.context, filePath);
|
|
545
|
-
}
|
|
546
|
-
function createWebpackData(result) {
|
|
547
|
-
return (backendOrStorage) => {
|
|
548
|
-
if (backendOrStorage._data) {
|
|
549
|
-
const curLevelIdx = backendOrStorage._currentLevel;
|
|
550
|
-
return {
|
|
551
|
-
result,
|
|
552
|
-
level: backendOrStorage._levels[curLevelIdx]
|
|
553
|
-
};
|
|
492
|
+
}
|
|
493
|
+
function createPluginContext$1(buildContext) {
|
|
494
|
+
const errors = [];
|
|
495
|
+
const warnings = [];
|
|
496
|
+
return {
|
|
497
|
+
errors,
|
|
498
|
+
warnings,
|
|
499
|
+
mixedContext: {
|
|
500
|
+
...buildContext,
|
|
501
|
+
error(error) {
|
|
502
|
+
errors.push(error);
|
|
503
|
+
},
|
|
504
|
+
warn(warning) {
|
|
505
|
+
warnings.push(warning);
|
|
554
506
|
}
|
|
555
|
-
return [null, result];
|
|
556
|
-
};
|
|
557
|
-
}
|
|
558
|
-
function getData(storage, key) {
|
|
559
|
-
if (storage._data instanceof Map) return storage._data.get(key);
|
|
560
|
-
else if (storage._data) return storage.data[key];
|
|
561
|
-
else if (storage.data instanceof Map) return storage.data.get(key);
|
|
562
|
-
else return storage.data[key];
|
|
563
|
-
}
|
|
564
|
-
function setData(backendOrStorage, key, valueFactory) {
|
|
565
|
-
const value = valueFactory(backendOrStorage);
|
|
566
|
-
if (backendOrStorage._data instanceof Map) backendOrStorage._data.set(key, value);
|
|
567
|
-
else if (backendOrStorage._data) backendOrStorage.data[key] = value;
|
|
568
|
-
else if (backendOrStorage.data instanceof Map) backendOrStorage.data.set(key, value);
|
|
569
|
-
else backendOrStorage.data[key] = value;
|
|
570
|
-
}
|
|
571
|
-
function getStatStorage(fileSystem) {
|
|
572
|
-
if (fileSystem._statStorage) return fileSystem._statStorage;
|
|
573
|
-
else if (fileSystem._statBackend) return fileSystem._statBackend;
|
|
574
|
-
else throw new Error("Couldn't find a stat storage");
|
|
575
|
-
}
|
|
576
|
-
function getFileStorage(fileSystem) {
|
|
577
|
-
if (fileSystem._readFileStorage) return fileSystem._readFileStorage;
|
|
578
|
-
else if (fileSystem._readFileBackend) return fileSystem._readFileBackend;
|
|
579
|
-
else throw new Error("Couldn't find a readFileStorage");
|
|
580
|
-
}
|
|
581
|
-
function getReadDirBackend(fileSystem) {
|
|
582
|
-
if (fileSystem._readdirBackend) return fileSystem._readdirBackend;
|
|
583
|
-
else if (fileSystem._readdirStorage) return fileSystem._readdirStorage;
|
|
584
|
-
else throw new Error("Couldn't find a readDirStorage from Webpack Internals");
|
|
585
|
-
}
|
|
586
|
-
function getRealpathBackend(fileSystem) {
|
|
587
|
-
if (fileSystem._realpathBackend) return fileSystem._realpathBackend;
|
|
588
|
-
}
|
|
589
|
-
var VirtualModulesPlugin = class {
|
|
590
|
-
constructor(modules) {
|
|
591
|
-
this._compiler = null;
|
|
592
|
-
this._watcher = null;
|
|
593
|
-
this._staticModules = modules || null;
|
|
594
507
|
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
function getBunPlugin(factory) {
|
|
511
|
+
return (userOptions) => {
|
|
512
|
+
if (typeof Bun === "undefined") throw new ReferenceError("Bun is not supported in this environment");
|
|
513
|
+
if (!Bun.semver.satisfies(Bun.version, ">=1.2.22")) throw new Error("Bun 1.2.22 or higher is required, please upgrade Bun");
|
|
514
|
+
const meta = { framework: "bun" };
|
|
515
|
+
const plugins = toArray$2(factory(userOptions, meta));
|
|
516
|
+
return {
|
|
517
|
+
name: (plugins.length === 1 ? plugins[0].name : meta.bunHostName) ?? `unplugin-host:${plugins.map((p) => p.name).join(":")}`,
|
|
518
|
+
async setup(build) {
|
|
519
|
+
const context = createBuildContext$1(build);
|
|
520
|
+
if (plugins.some((plugin) => plugin.buildStart)) build.onStart(async () => {
|
|
521
|
+
for (const plugin of plugins) if (plugin.buildStart) await plugin.buildStart.call(context);
|
|
607
522
|
});
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
523
|
+
const resolveIdHooks = plugins.filter((plugin) => plugin.resolveId).map((plugin) => ({
|
|
524
|
+
plugin,
|
|
525
|
+
...normalizeObjectHook("resolveId", plugin.resolveId)
|
|
526
|
+
}));
|
|
527
|
+
const loadHooks = plugins.filter((plugin) => plugin.load).map((plugin) => ({
|
|
528
|
+
plugin,
|
|
529
|
+
...normalizeObjectHook("load", plugin.load)
|
|
530
|
+
}));
|
|
531
|
+
const transformHooks = plugins.filter((plugin) => plugin.transform || plugin.transformInclude).map((plugin) => ({
|
|
532
|
+
plugin,
|
|
533
|
+
...normalizeObjectHook("transform", plugin.transform)
|
|
534
|
+
}));
|
|
535
|
+
const virtualModulePlugins = /* @__PURE__ */ new Set();
|
|
536
|
+
for (const plugin of plugins) if (plugin.resolveId && plugin.load) virtualModulePlugins.add(plugin.name);
|
|
537
|
+
if (resolveIdHooks.length) build.onResolve({ filter: /.*/ }, async (args) => {
|
|
538
|
+
if (build.config?.external?.includes(args.path)) return;
|
|
539
|
+
for (const { plugin, handler, filter } of resolveIdHooks) {
|
|
540
|
+
if (!filter(args.path)) continue;
|
|
541
|
+
const { mixedContext, errors, warnings } = createPluginContext$1(context);
|
|
542
|
+
const isEntry = args.kind === "entry-point-run" || args.kind === "entry-point-build";
|
|
543
|
+
const result = await handler.call(mixedContext, args.path, isEntry ? void 0 : args.importer, { isEntry });
|
|
544
|
+
for (const warning of warnings) console.warn("[unplugin]", typeof warning === "string" ? warning : warning.message);
|
|
545
|
+
if (errors.length > 0) {
|
|
546
|
+
const errorMessage = errors.map((e) => typeof e === "string" ? e : e.message).join("\n");
|
|
547
|
+
throw new Error(`[unplugin] ${plugin.name}: ${errorMessage}`);
|
|
548
|
+
}
|
|
549
|
+
if (typeof result === "string") {
|
|
550
|
+
if (!isAbsolute(result)) return {
|
|
551
|
+
path: result,
|
|
552
|
+
namespace: plugin.name
|
|
553
|
+
};
|
|
554
|
+
return { path: result };
|
|
555
|
+
} else if (typeof result === "object" && result !== null) {
|
|
556
|
+
if (!isAbsolute(result.id)) return {
|
|
557
|
+
path: result.id,
|
|
558
|
+
external: result.external,
|
|
559
|
+
namespace: plugin.name
|
|
560
|
+
};
|
|
561
|
+
return {
|
|
562
|
+
path: result.id,
|
|
563
|
+
external: result.external
|
|
564
|
+
};
|
|
565
|
+
}
|
|
649
566
|
}
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
const
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
blksize: 4096,
|
|
695
|
-
ino: inode++,
|
|
696
|
-
mode: 16877,
|
|
697
|
-
size: stats.size,
|
|
698
|
-
blocks: Math.floor(stats.size / 4096),
|
|
699
|
-
atime: time,
|
|
700
|
-
mtime: time,
|
|
701
|
-
ctime: time,
|
|
702
|
-
birthtime: time
|
|
703
|
-
});
|
|
704
|
-
setData(readDirStorage, dir, createWebpackData([]));
|
|
705
|
-
if (realPathStorage) setData(realPathStorage, dir, createWebpackData(dir));
|
|
706
|
-
setData(statStorage, dir, createWebpackData(dirStats));
|
|
567
|
+
});
|
|
568
|
+
async function processLoadTransform(id, namespace, loader) {
|
|
569
|
+
let code;
|
|
570
|
+
let hasResult = false;
|
|
571
|
+
const namespaceLoadHooks = namespace === "file" ? loadHooks : loadHooks.filter((h) => h.plugin.name === namespace);
|
|
572
|
+
for (const { plugin, handler, filter } of namespaceLoadHooks) {
|
|
573
|
+
if (plugin.loadInclude && !plugin.loadInclude(id)) continue;
|
|
574
|
+
if (!filter(id)) continue;
|
|
575
|
+
const { mixedContext, errors, warnings } = createPluginContext$1(context);
|
|
576
|
+
const result = await handler.call(mixedContext, id);
|
|
577
|
+
for (const warning of warnings) console.warn("[unplugin]", typeof warning === "string" ? warning : warning.message);
|
|
578
|
+
if (errors.length > 0) {
|
|
579
|
+
const errorMessage = errors.map((e) => typeof e === "string" ? e : e.message).join("\n");
|
|
580
|
+
throw new Error(`[unplugin] ${plugin.name}: ${errorMessage}`);
|
|
581
|
+
}
|
|
582
|
+
if (typeof result === "string") {
|
|
583
|
+
code = result;
|
|
584
|
+
hasResult = true;
|
|
585
|
+
break;
|
|
586
|
+
} else if (typeof result === "object" && result !== null) {
|
|
587
|
+
code = result.code;
|
|
588
|
+
hasResult = true;
|
|
589
|
+
break;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
if (!hasResult && namespace === "file" && transformHooks.length > 0) code = await Bun.file(id).text();
|
|
593
|
+
if (code !== void 0) {
|
|
594
|
+
const namespaceTransformHooks = namespace === "file" ? transformHooks : transformHooks.filter((h) => h.plugin.name === namespace);
|
|
595
|
+
for (const { plugin, handler, filter } of namespaceTransformHooks) {
|
|
596
|
+
if (plugin.transformInclude && !plugin.transformInclude(id)) continue;
|
|
597
|
+
if (!filter(id, code)) continue;
|
|
598
|
+
const { mixedContext, errors, warnings } = createPluginContext$1(context);
|
|
599
|
+
const result = await handler.call(mixedContext, code, id);
|
|
600
|
+
for (const warning of warnings) console.warn("[unplugin]", typeof warning === "string" ? warning : warning.message);
|
|
601
|
+
if (errors.length > 0) {
|
|
602
|
+
const errorMessage = errors.map((e) => typeof e === "string" ? e : e.message).join("\n");
|
|
603
|
+
throw new Error(`[unplugin] ${plugin.name}: ${errorMessage}`);
|
|
604
|
+
}
|
|
605
|
+
if (typeof result === "string") {
|
|
606
|
+
code = result;
|
|
607
|
+
hasResult = true;
|
|
608
|
+
} else if (typeof result === "object" && result !== null) {
|
|
609
|
+
code = result.code;
|
|
610
|
+
hasResult = true;
|
|
707
611
|
}
|
|
708
|
-
let dirData = getData(getReadDirBackend(finalInputFileSystem), dir);
|
|
709
|
-
dirData = dirData[1] || dirData.result;
|
|
710
|
-
const filename = segments[count];
|
|
711
|
-
if (dirData.indexOf(filename) < 0) {
|
|
712
|
-
const files = dirData.concat([filename]).sort();
|
|
713
|
-
setData(getReadDirBackend(finalInputFileSystem), dir, createWebpackData(files));
|
|
714
|
-
} else break;
|
|
715
|
-
count--;
|
|
716
612
|
}
|
|
613
|
+
}
|
|
614
|
+
if (hasResult && code !== void 0) return {
|
|
615
|
+
contents: code,
|
|
616
|
+
loader: loader ?? guessLoader$1(id)
|
|
717
617
|
};
|
|
718
618
|
}
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
if (
|
|
732
|
-
const
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
});
|
|
619
|
+
if (loadHooks.length || transformHooks.length) build.onLoad({
|
|
620
|
+
filter: /.*/,
|
|
621
|
+
namespace: "file"
|
|
622
|
+
}, async (args) => {
|
|
623
|
+
return processLoadTransform(args.path, "file", args.loader);
|
|
624
|
+
});
|
|
625
|
+
for (const pluginName of virtualModulePlugins) build.onLoad({
|
|
626
|
+
filter: /.*/,
|
|
627
|
+
namespace: pluginName
|
|
628
|
+
}, async (args) => {
|
|
629
|
+
return processLoadTransform(args.path, pluginName, args.loader);
|
|
630
|
+
});
|
|
631
|
+
if (plugins.some((plugin) => plugin.buildEnd || plugin.writeBundle)) build.onEnd(async () => {
|
|
632
|
+
for (const plugin of plugins) {
|
|
633
|
+
if (plugin.buildEnd) await plugin.buildEnd.call(context);
|
|
634
|
+
if (plugin.writeBundle) await plugin.writeBundle();
|
|
635
|
+
}
|
|
737
636
|
});
|
|
738
|
-
callback();
|
|
739
|
-
};
|
|
740
|
-
if (compiler.hooks) {
|
|
741
|
-
compiler.hooks.afterEnvironment.tap("VirtualModulesPlugin", afterEnvironmentHook);
|
|
742
|
-
compiler.hooks.afterResolvers.tap("VirtualModulesPlugin", afterResolversHook);
|
|
743
|
-
compiler.hooks.watchRun.tapAsync("VirtualModulesPlugin", watchRunHook);
|
|
744
|
-
} else {
|
|
745
|
-
compiler.plugin("after-environment", afterEnvironmentHook);
|
|
746
|
-
compiler.plugin("after-resolvers", afterResolversHook);
|
|
747
|
-
compiler.plugin("watch-run", watchRunHook);
|
|
748
637
|
}
|
|
749
|
-
}
|
|
638
|
+
};
|
|
750
639
|
};
|
|
751
|
-
|
|
752
|
-
}));
|
|
753
|
-
|
|
754
|
-
//#endregion
|
|
755
|
-
//#region node_modules/.pnpm/unplugin@2.3.11/node_modules/unplugin/dist/index.js
|
|
756
|
-
var import_lib = /* @__PURE__ */ __toESM(require_lib(), 1);
|
|
640
|
+
}
|
|
757
641
|
const ExtToLoader = {
|
|
758
642
|
".js": "js",
|
|
759
643
|
".mjs": "js",
|
|
@@ -812,7 +696,7 @@ function combineSourcemaps(filename, sourcemapList) {
|
|
|
812
696
|
if (!map.file) delete map.file;
|
|
813
697
|
return map;
|
|
814
698
|
}
|
|
815
|
-
function createBuildContext
|
|
699
|
+
function createBuildContext(build) {
|
|
816
700
|
const watchFiles = [];
|
|
817
701
|
const { initialOptions } = build;
|
|
818
702
|
return {
|
|
@@ -845,10 +729,10 @@ function createPluginContext(context) {
|
|
|
845
729
|
const warnings = [];
|
|
846
730
|
const pluginContext = {
|
|
847
731
|
error(message) {
|
|
848
|
-
errors.push(normalizeMessage
|
|
732
|
+
errors.push(normalizeMessage(message));
|
|
849
733
|
},
|
|
850
734
|
warn(message) {
|
|
851
|
-
warnings.push(normalizeMessage
|
|
735
|
+
warnings.push(normalizeMessage(message));
|
|
852
736
|
}
|
|
853
737
|
};
|
|
854
738
|
return {
|
|
@@ -863,7 +747,7 @@ function createPluginContext(context) {
|
|
|
863
747
|
}
|
|
864
748
|
};
|
|
865
749
|
}
|
|
866
|
-
function normalizeMessage
|
|
750
|
+
function normalizeMessage(message) {
|
|
867
751
|
if (typeof message === "string") message = { message };
|
|
868
752
|
return {
|
|
869
753
|
id: message.id,
|
|
@@ -946,7 +830,7 @@ function getEsbuildPlugin(factory) {
|
|
|
946
830
|
function buildSetup() {
|
|
947
831
|
return (plugin) => {
|
|
948
832
|
return (build, rawBuild) => {
|
|
949
|
-
const context = createBuildContext
|
|
833
|
+
const context = createBuildContext(rawBuild);
|
|
950
834
|
const { onStart, onEnd, onResolve, onLoad, onTransform, initialOptions } = build;
|
|
951
835
|
const onResolveFilter = plugin.esbuild?.onResolveFilter ?? /.*/;
|
|
952
836
|
const onLoadFilter = plugin.esbuild?.onLoadFilter ?? /.*/;
|
|
@@ -1125,7 +1009,7 @@ function decodeStr(str) {
|
|
|
1125
1009
|
if (firstIndex === -1) return str;
|
|
1126
1010
|
const result = Array.from({ length: len - countBackslashZeros(str, firstIndex) });
|
|
1127
1011
|
let pos = 0;
|
|
1128
|
-
for (let i
|
|
1012
|
+
for (let i = 0; i < firstIndex; i++) result[pos++] = str[i];
|
|
1129
1013
|
let i = firstIndex;
|
|
1130
1014
|
while (i < len) if (str[i] === "\\" && str[i + 1] === "0") {
|
|
1131
1015
|
result[pos++] = "\0";
|
|
@@ -1370,7 +1254,6 @@ function toRollupPlugin(plugin, key) {
|
|
|
1370
1254
|
}
|
|
1371
1255
|
}
|
|
1372
1256
|
function supportNativeFilter(context, framework) {
|
|
1373
|
-
if (framework === "unloader") return false;
|
|
1374
1257
|
if (framework === "vite") return !!context?.meta?.viteVersion;
|
|
1375
1258
|
if (framework === "rolldown") return true;
|
|
1376
1259
|
const rollupVersion = context?.meta?.rollupVersion;
|
|
@@ -1386,11 +1269,8 @@ function getRolldownPlugin(factory) {
|
|
|
1386
1269
|
return plugins.length === 1 ? plugins[0] : plugins;
|
|
1387
1270
|
});
|
|
1388
1271
|
}
|
|
1389
|
-
const
|
|
1390
|
-
const
|
|
1391
|
-
const __dirname = /* @__PURE__ */ getDirname();
|
|
1392
|
-
const TRANSFORM_LOADER$1 = resolve(__dirname, "rspack/loaders/transform");
|
|
1393
|
-
const LOAD_LOADER$1 = resolve(__dirname, "rspack/loaders/load");
|
|
1272
|
+
const TRANSFORM_LOADER$1 = resolve(import.meta.dirname, "rspack/loaders/transform.mjs");
|
|
1273
|
+
const LOAD_LOADER$1 = resolve(import.meta.dirname, "rspack/loaders/load.mjs");
|
|
1394
1274
|
function getRspackPlugin(factory) {
|
|
1395
1275
|
return (userOptions) => {
|
|
1396
1276
|
return { apply(compiler) {
|
|
@@ -1407,9 +1287,9 @@ function getRspackPlugin(factory) {
|
|
|
1407
1287
|
});
|
|
1408
1288
|
const externalModules = /* @__PURE__ */ new Set();
|
|
1409
1289
|
if (plugin.resolveId) {
|
|
1410
|
-
const createPlugin = (plugin
|
|
1290
|
+
const createPlugin = (plugin) => {
|
|
1411
1291
|
if (compiler.rspack.experiments.VirtualModulesPlugin) return new compiler.rspack.experiments.VirtualModulesPlugin();
|
|
1412
|
-
return new FakeVirtualModulesPlugin(plugin
|
|
1292
|
+
return new FakeVirtualModulesPlugin(plugin);
|
|
1413
1293
|
};
|
|
1414
1294
|
const vfs = createPlugin(plugin);
|
|
1415
1295
|
vfs.apply(compiler);
|
|
@@ -1423,11 +1303,11 @@ function getRspackPlugin(factory) {
|
|
|
1423
1303
|
let importer = requestContext.issuer !== "" ? requestContext.issuer : void 0;
|
|
1424
1304
|
const isEntry = requestContext.issuer === "";
|
|
1425
1305
|
if (importer?.startsWith(plugin.__virtualModulePrefix)) importer = decodeURIComponent(importer.slice(plugin.__virtualModulePrefix.length));
|
|
1426
|
-
const context = createBuildContext$
|
|
1306
|
+
const context = createBuildContext$3(compiler, compilation);
|
|
1427
1307
|
let error;
|
|
1428
1308
|
const pluginContext = {
|
|
1429
1309
|
error(msg) {
|
|
1430
|
-
if (error == null) error = normalizeMessage$
|
|
1310
|
+
if (error == null) error = normalizeMessage$2(msg);
|
|
1431
1311
|
else console.error(`unplugin/rspack: multiple errors returned from resolveId hook: ${msg}`);
|
|
1432
1312
|
},
|
|
1433
1313
|
warn(msg) {
|
|
@@ -1487,17 +1367,17 @@ function getRspackPlugin(factory) {
|
|
|
1487
1367
|
});
|
|
1488
1368
|
if (plugin.rspack) plugin.rspack(compiler);
|
|
1489
1369
|
if (plugin.watchChange || plugin.buildStart) compiler.hooks.make.tapPromise(plugin.name, async (compilation) => {
|
|
1490
|
-
const context = createBuildContext$
|
|
1370
|
+
const context = createBuildContext$3(compiler, compilation);
|
|
1491
1371
|
if (plugin.watchChange && (compiler.modifiedFiles || compiler.removedFiles)) {
|
|
1492
|
-
const promises
|
|
1493
|
-
if (compiler.modifiedFiles) compiler.modifiedFiles.forEach((file) => promises
|
|
1494
|
-
if (compiler.removedFiles) compiler.removedFiles.forEach((file) => promises
|
|
1495
|
-
await Promise.all(promises
|
|
1372
|
+
const promises = [];
|
|
1373
|
+
if (compiler.modifiedFiles) compiler.modifiedFiles.forEach((file) => promises.push(Promise.resolve(plugin.watchChange.call(context, file, { event: "update" }))));
|
|
1374
|
+
if (compiler.removedFiles) compiler.removedFiles.forEach((file) => promises.push(Promise.resolve(plugin.watchChange.call(context, file, { event: "delete" }))));
|
|
1375
|
+
await Promise.all(promises);
|
|
1496
1376
|
}
|
|
1497
1377
|
if (plugin.buildStart) return await plugin.buildStart.call(context);
|
|
1498
1378
|
});
|
|
1499
1379
|
if (plugin.buildEnd) compiler.hooks.emit.tapPromise(plugin.name, async (compilation) => {
|
|
1500
|
-
await plugin.buildEnd.call(createBuildContext$
|
|
1380
|
+
await plugin.buildEnd.call(createBuildContext$3(compiler, compilation));
|
|
1501
1381
|
});
|
|
1502
1382
|
if (plugin.writeBundle) compiler.hooks.afterEmit.tapPromise(plugin.name, async () => {
|
|
1503
1383
|
await plugin.writeBundle();
|
|
@@ -1522,10 +1402,11 @@ function getVitePlugin(factory) {
|
|
|
1522
1402
|
return plugins.length === 1 ? plugins[0] : plugins;
|
|
1523
1403
|
});
|
|
1524
1404
|
}
|
|
1525
|
-
const TRANSFORM_LOADER = resolve(
|
|
1526
|
-
const LOAD_LOADER = resolve(
|
|
1405
|
+
const TRANSFORM_LOADER = resolve(import.meta.dirname, "webpack/loaders/transform.mjs");
|
|
1406
|
+
const LOAD_LOADER = resolve(import.meta.dirname, "webpack/loaders/load.mjs");
|
|
1527
1407
|
function getWebpackPlugin(factory) {
|
|
1528
1408
|
return (userOptions) => {
|
|
1409
|
+
const VirtualModulesPlugin = __require("webpack-virtual-modules");
|
|
1529
1410
|
return { apply(compiler) {
|
|
1530
1411
|
const VIRTUAL_MODULE_PREFIX = resolve(compiler.options.context ?? process$1.cwd(), "_virtual_");
|
|
1531
1412
|
const meta = {
|
|
@@ -1540,9 +1421,9 @@ function getWebpackPlugin(factory) {
|
|
|
1540
1421
|
});
|
|
1541
1422
|
const externalModules = /* @__PURE__ */ new Set();
|
|
1542
1423
|
if (plugin.resolveId) {
|
|
1543
|
-
let vfs = compiler.options.plugins.find((i) => i instanceof
|
|
1424
|
+
let vfs = compiler.options.plugins.find((i) => i instanceof VirtualModulesPlugin);
|
|
1544
1425
|
if (!vfs) {
|
|
1545
|
-
vfs = new
|
|
1426
|
+
vfs = new VirtualModulesPlugin();
|
|
1546
1427
|
compiler.options.plugins.push(vfs);
|
|
1547
1428
|
}
|
|
1548
1429
|
const vfsModules = /* @__PURE__ */ new Set();
|
|
@@ -1559,7 +1440,7 @@ function getWebpackPlugin(factory) {
|
|
|
1559
1440
|
const isEntry = requestContext.issuer === "";
|
|
1560
1441
|
if (importer?.startsWith(plugin.__virtualModulePrefix)) importer = decodeURIComponent(importer.slice(plugin.__virtualModulePrefix.length));
|
|
1561
1442
|
const fileDependencies = /* @__PURE__ */ new Set();
|
|
1562
|
-
const context = createBuildContext({
|
|
1443
|
+
const context = createBuildContext$2({
|
|
1563
1444
|
addWatchFile(file) {
|
|
1564
1445
|
fileDependencies.add(file);
|
|
1565
1446
|
resolveContext.fileDependencies?.add(file);
|
|
@@ -1571,7 +1452,7 @@ function getWebpackPlugin(factory) {
|
|
|
1571
1452
|
let error;
|
|
1572
1453
|
const pluginContext = {
|
|
1573
1454
|
error(msg) {
|
|
1574
|
-
if (error == null) error = normalizeMessage(msg);
|
|
1455
|
+
if (error == null) error = normalizeMessage$1(msg);
|
|
1575
1456
|
else console.error(`unplugin/webpack: multiple errors returned from resolveId hook: ${msg}`);
|
|
1576
1457
|
},
|
|
1577
1458
|
warn(msg) {
|
|
@@ -1624,17 +1505,17 @@ function getWebpackPlugin(factory) {
|
|
|
1624
1505
|
});
|
|
1625
1506
|
if (plugin.webpack) plugin.webpack(compiler);
|
|
1626
1507
|
if (plugin.watchChange || plugin.buildStart) compiler.hooks.make.tapPromise(plugin.name, async (compilation) => {
|
|
1627
|
-
const context = createBuildContext(contextOptionsFromCompilation(compilation), compiler, compilation);
|
|
1508
|
+
const context = createBuildContext$2(contextOptionsFromCompilation(compilation), compiler, compilation);
|
|
1628
1509
|
if (plugin.watchChange && (compiler.modifiedFiles || compiler.removedFiles)) {
|
|
1629
|
-
const promises
|
|
1630
|
-
if (compiler.modifiedFiles) compiler.modifiedFiles.forEach((file) => promises
|
|
1631
|
-
if (compiler.removedFiles) compiler.removedFiles.forEach((file) => promises
|
|
1632
|
-
await Promise.all(promises
|
|
1510
|
+
const promises = [];
|
|
1511
|
+
if (compiler.modifiedFiles) compiler.modifiedFiles.forEach((file) => promises.push(Promise.resolve(plugin.watchChange.call(context, file, { event: "update" }))));
|
|
1512
|
+
if (compiler.removedFiles) compiler.removedFiles.forEach((file) => promises.push(Promise.resolve(plugin.watchChange.call(context, file, { event: "delete" }))));
|
|
1513
|
+
await Promise.all(promises);
|
|
1633
1514
|
}
|
|
1634
1515
|
if (plugin.buildStart) return await plugin.buildStart.call(context);
|
|
1635
1516
|
});
|
|
1636
1517
|
if (plugin.buildEnd) compiler.hooks.emit.tapPromise(plugin.name, async (compilation) => {
|
|
1637
|
-
await plugin.buildEnd.call(createBuildContext(contextOptionsFromCompilation(compilation), compiler, compilation));
|
|
1518
|
+
await plugin.buildEnd.call(createBuildContext$2(contextOptionsFromCompilation(compilation), compiler, compilation));
|
|
1638
1519
|
});
|
|
1639
1520
|
if (plugin.writeBundle) compiler.hooks.afterEmit.tapPromise(plugin.name, async () => {
|
|
1640
1521
|
await plugin.writeBundle();
|
|
@@ -1676,17 +1557,14 @@ function createUnplugin(factory) {
|
|
|
1676
1557
|
get unloader() {
|
|
1677
1558
|
return getUnloaderPlugin(factory);
|
|
1678
1559
|
},
|
|
1560
|
+
get bun() {
|
|
1561
|
+
return getBunPlugin(factory);
|
|
1562
|
+
},
|
|
1679
1563
|
get raw() {
|
|
1680
1564
|
return factory;
|
|
1681
1565
|
}
|
|
1682
1566
|
};
|
|
1683
1567
|
}
|
|
1684
|
-
|
|
1685
|
-
//#endregion
|
|
1686
|
-
//#region node_modules/.pnpm/unplugin-utils@0.3.1/node_modules/unplugin-utils/dist/index.js
|
|
1687
|
-
/**
|
|
1688
|
-
* Converts path separators to forward slash.
|
|
1689
|
-
*/
|
|
1690
1568
|
function normalizePath(filename) {
|
|
1691
1569
|
return filename.replaceAll("\\", "/");
|
|
1692
1570
|
}
|
|
@@ -1701,18 +1579,6 @@ function getMatcherString(id, resolutionBase) {
|
|
|
1701
1579
|
if (resolutionBase === false || isAbsolute$2(id) || id.startsWith("**")) return normalizePath(id);
|
|
1702
1580
|
return join$1(normalizePath(resolve$1(resolutionBase || "")).replaceAll(/[-^$*+?.()|[\]{}]/g, `${escapeMark}$&`), normalizePath(id)).replaceAll(escapeMark, "\\");
|
|
1703
1581
|
}
|
|
1704
|
-
/**
|
|
1705
|
-
* Constructs a filter function which can be used to determine whether or not
|
|
1706
|
-
* certain modules should be operated upon.
|
|
1707
|
-
* @param include If `include` is omitted or has zero length, filter will return `true` by default.
|
|
1708
|
-
* @param exclude ID must not match any of the `exclude` patterns.
|
|
1709
|
-
* @param options Additional options.
|
|
1710
|
-
* @param options.resolve Optionally resolves the patterns against a directory other than `process.cwd()`.
|
|
1711
|
-
* If a `string` is specified, then the value will be used as the base directory.
|
|
1712
|
-
* Relative paths will be resolved against `process.cwd()` first.
|
|
1713
|
-
* If `false`, then the patterns will not be resolved against any directory.
|
|
1714
|
-
* This can be useful if you want to create a filter for virtual module names.
|
|
1715
|
-
*/
|
|
1716
1582
|
function createFilter(include, exclude, options) {
|
|
1717
1583
|
const resolutionBase = options && options.resolve;
|
|
1718
1584
|
const getMatcher = (id) => id instanceof RegExp ? id : { test: (what) => {
|
|
@@ -1736,14 +1602,6 @@ function createFilter(include, exclude, options) {
|
|
|
1736
1602
|
return !includeMatchers.length;
|
|
1737
1603
|
};
|
|
1738
1604
|
}
|
|
1739
|
-
|
|
1740
|
-
//#endregion
|
|
1741
|
-
//#region node_modules/.pnpm/unimport@5.6.0/node_modules/unimport/dist/unplugin.mjs
|
|
1742
|
-
var unplugin_exports = /* @__PURE__ */ __exportAll({
|
|
1743
|
-
default: () => unplugin,
|
|
1744
|
-
defaultExcludes: () => defaultExcludes,
|
|
1745
|
-
defaultIncludes: () => defaultIncludes
|
|
1746
|
-
});
|
|
1747
1605
|
const defaultIncludes = [
|
|
1748
1606
|
/\.[jt]sx?$/,
|
|
1749
1607
|
/\.vue$/,
|
|
@@ -1780,6 +1638,4 @@ const unplugin = createUnplugin((options = {}) => {
|
|
|
1780
1638
|
}
|
|
1781
1639
|
};
|
|
1782
1640
|
});
|
|
1783
|
-
|
|
1784
|
-
//#endregion
|
|
1785
|
-
export { detect_acorn_exports as n, unplugin_exports as t };
|
|
1641
|
+
export { detectImportsAcorn as a, createVirtualImportsAcronWalker as i, defaultIncludes as n, traveseScopes as o, unplugin as r, defaultExcludes as t };
|