nitro 3.0.1-alpha.2 → 3.0.260311-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +6 -0
- package/README.md +2 -2
- package/dist/THIRD-PARTY-LICENSES.md +1646 -0
- package/dist/_build/common.mjs +6977 -2556
- package/dist/_build/rolldown.mjs +32 -31
- package/dist/_build/rollup.mjs +28 -35
- package/dist/_build/vite.build.mjs +10 -8
- package/dist/_chunks/nitro.mjs +80 -112
- package/dist/_chunks/nitro2.mjs +8 -7
- package/dist/_chunks/nitro3.mjs +129 -0
- package/dist/_chunks/utils.mjs +42 -24
- package/dist/_common.mjs +14 -24
- package/dist/{_chunks/dev.mjs → _dev.mjs} +132 -320
- 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+giget+readdirp+chokidar.d.mts → c12+readdirp+chokidar.d.mts} +52 -36
- package/dist/_libs/citty.mjs +10 -12
- package/dist/_libs/commondir+is-reference.mjs +60 -49
- package/dist/_libs/compatx.mjs +1 -2
- package/dist/_libs/esbuild.d.mts +1 -1
- package/dist/_libs/escape-string-regexp.mjs +1 -2
- package/dist/_libs/{pluginutils+plugin-commonjs.d.mts → estree+pluginutils.d.mts} +2 -2
- package/dist/_libs/estree-walker.mjs +1 -4
- package/dist/_libs/exsolve.d.mts +1 -0
- package/dist/_libs/hasown+resolve+deepmerge.mjs +146 -169
- package/dist/_libs/httpxy.d.mts +12 -9
- package/dist/_libs/httpxy.mjs +299 -43
- package/dist/_libs/js-tokens.d.mts +1 -0
- package/dist/_libs/klona.mjs +1 -2
- package/dist/_libs/mlly.d.mts +1 -1
- package/dist/_libs/nypm+tinyexec.mjs +845 -0
- package/dist/_libs/perfect-debounce.mjs +88 -0
- package/dist/_libs/plugin-alias.mjs +2 -4
- package/dist/_libs/plugin-inject.mjs +2 -6
- package/dist/_libs/plugin-json.mjs +2 -4
- package/dist/_libs/pluginutils.mjs +5 -11
- package/dist/_libs/readdirp+chokidar.mjs +187 -192
- package/dist/_libs/remapping.mjs +1 -3
- package/dist/_libs/resolve-uri+gen-mapping.mjs +15 -21
- package/dist/_libs/rou3.d.mts +3 -2
- package/dist/_libs/rou3.mjs +225 -51
- package/dist/_libs/std-env.d.mts +10 -2
- package/dist/_libs/strip-literal.d.mts +1 -0
- package/dist/_libs/tsconfck.mjs +21 -40
- package/dist/_libs/ultrahtml.mjs +3 -14
- package/dist/_libs/unimport+unplugin.mjs +250 -351
- package/dist/_libs/unplugin+unimport.d.mts +7 -10
- package/dist/_presets.mjs +389 -432
- package/dist/builder.d.mts +5 -4
- package/dist/builder.mjs +12 -6
- package/dist/cli/_chunks/build.mjs +22 -23
- package/dist/cli/_chunks/common.mjs +1 -2
- package/dist/cli/_chunks/deploy.mjs +40 -0
- package/dist/cli/_chunks/dev.mjs +9 -9
- package/dist/cli/_chunks/docs.mjs +30 -0
- package/dist/cli/_chunks/list.mjs +4 -6
- package/dist/cli/_chunks/prepare.mjs +2 -4
- package/dist/cli/_chunks/preview.mjs +51 -0
- package/dist/cli/_chunks/run.mjs +7 -9
- package/dist/cli/_chunks/task.mjs +1 -3
- package/dist/cli/index.mjs +5 -4
- package/dist/node_modules/@poppinss/dumper/build/formatters/html/main.js +8 -0
- package/dist/node_modules/@poppinss/dumper/package.json +1 -1
- package/dist/node_modules/croner/dist/croner.js +1 -1
- package/dist/node_modules/croner/package.json +11 -1
- 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 +34 -31
- package/dist/presets/_nitro/runtime/nitro-dev.mjs +9 -56
- package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +1 -0
- package/dist/presets/_nitro/runtime/service-worker.mjs +0 -1
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +3 -1
- package/dist/presets/bun/runtime/bun.mjs +4 -3
- package/dist/presets/deno/runtime/deno-server.mjs +4 -3
- package/dist/presets/netlify/runtime/netlify-edge.mjs +0 -1
- package/dist/presets/netlify/runtime/netlify.mjs +1 -1
- package/dist/presets/node/runtime/node-cluster.mjs +3 -2
- package/dist/presets/node/runtime/node-server.mjs +3 -2
- package/dist/presets/stormkit/runtime/stormkit.mjs +0 -1
- package/dist/presets/vercel/runtime/cron-handler.mjs +25 -0
- package/dist/presets/vercel/runtime/vercel.web.mjs +2 -4
- package/dist/presets/zephyr/runtime/server.mjs +3 -0
- 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/error/dev.d.mts +5 -4
- package/dist/runtime/internal/error/dev.mjs +38 -40
- package/dist/runtime/internal/error/hooks.d.mts +1 -1
- package/dist/runtime/internal/error/prod.d.mts +2 -5
- package/dist/runtime/internal/error/prod.mjs +19 -33
- package/dist/runtime/internal/error/utils.d.mts +4 -4
- package/dist/runtime/internal/meta.d.mts +1 -1
- package/dist/runtime/internal/plugin.d.mts +2 -2
- package/dist/runtime/internal/route-rules.d.mts +9 -4
- package/dist/runtime/internal/route-rules.mjs +9 -1
- package/dist/runtime/internal/routes/dev-tasks.d.mts +3 -2
- package/dist/runtime/internal/routes/dev-tasks.mjs +6 -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/runtime-config.d.mts +1 -1
- package/dist/runtime/internal/static.mjs +5 -4
- package/dist/runtime/internal/task.d.mts +3 -1
- package/dist/runtime/internal/task.mjs +2 -2
- package/dist/runtime/internal/vite/dev-entry.mjs +6 -3
- package/dist/runtime/internal/vite/dev-worker.mjs +264 -0
- package/dist/runtime/meta.mjs +1 -0
- package/dist/runtime/nitro.d.mts +2 -0
- package/dist/runtime/nitro.mjs +2 -0
- package/dist/runtime/virtual/error-handler.mjs +1 -1
- package/dist/runtime/virtual/server-assets.d.mts +2 -1
- package/dist/runtime/vite.d.mts +1 -1
- package/dist/types/index.d.mts +68 -117
- package/dist/types/index.mjs +1 -11
- package/dist/vite.d.mts +3 -3
- package/dist/vite.mjs +236 -233
- package/package.json +83 -68
- package/skills/nitro/SKILL.md +10 -0
- package/skills/nitro/docs/TOC.md +83 -0
- package/skills/nitro/docs/_navigation.json +679 -0
- package/skills/nitro/docs/config/index.md +1147 -0
- package/skills/nitro/docs/deploy/index.md +64 -0
- package/skills/nitro/docs/deploy/providers/alwaysdata.md +50 -0
- package/skills/nitro/docs/deploy/providers/aws-amplify.md +81 -0
- package/skills/nitro/docs/deploy/providers/aws.md +47 -0
- package/skills/nitro/docs/deploy/providers/azure.md +72 -0
- package/skills/nitro/docs/deploy/providers/cleavr.md +33 -0
- package/skills/nitro/docs/deploy/providers/cloudflare.md +375 -0
- package/skills/nitro/docs/deploy/providers/deno-deploy.md +66 -0
- package/skills/nitro/docs/deploy/providers/digitalocean.md +46 -0
- package/skills/nitro/docs/deploy/providers/firebase.md +32 -0
- package/skills/nitro/docs/deploy/providers/flightcontrol.md +67 -0
- package/skills/nitro/docs/deploy/providers/genezio.md +67 -0
- package/skills/nitro/docs/deploy/providers/github-pages.md +68 -0
- package/skills/nitro/docs/deploy/providers/gitlab-pages.md +37 -0
- package/skills/nitro/docs/deploy/providers/heroku.md +84 -0
- package/skills/nitro/docs/deploy/providers/iis.md +38 -0
- package/skills/nitro/docs/deploy/providers/koyeb.md +109 -0
- package/skills/nitro/docs/deploy/providers/netlify.md +47 -0
- package/skills/nitro/docs/deploy/providers/platform-sh.md +37 -0
- package/skills/nitro/docs/deploy/providers/render.md +37 -0
- package/skills/nitro/docs/deploy/providers/stormkit.md +24 -0
- package/skills/nitro/docs/deploy/providers/vercel.md +179 -0
- package/skills/nitro/docs/deploy/providers/zeabur.md +19 -0
- package/skills/nitro/docs/deploy/providers/zephyr.md +99 -0
- package/skills/nitro/docs/deploy/providers/zerops.md +102 -0
- package/skills/nitro/docs/deploy/runtimes/bun.md +15 -0
- package/skills/nitro/docs/deploy/runtimes/deno.md +19 -0
- package/skills/nitro/docs/deploy/runtimes/node.md +63 -0
- package/skills/nitro/docs/docs/assets.md +166 -0
- package/skills/nitro/docs/docs/cache.md +408 -0
- package/skills/nitro/docs/docs/configuration.md +256 -0
- package/skills/nitro/docs/docs/database.md +185 -0
- package/skills/nitro/docs/docs/index.md +56 -0
- package/skills/nitro/docs/docs/lifecycle.md +204 -0
- package/skills/nitro/docs/docs/migration.md +215 -0
- package/skills/nitro/docs/docs/nightly.md +31 -0
- package/skills/nitro/docs/docs/plugins.md +164 -0
- package/skills/nitro/docs/docs/quick-start.md +110 -0
- package/skills/nitro/docs/docs/renderer.md +322 -0
- package/skills/nitro/docs/docs/routing.md +711 -0
- package/skills/nitro/docs/docs/server-entry.md +239 -0
- package/skills/nitro/docs/docs/storage.md +261 -0
- package/skills/nitro/docs/docs/tasks.md +277 -0
- package/skills/nitro/docs/examples/api-routes.md +145 -0
- package/skills/nitro/docs/examples/auto-imports.md +93 -0
- package/skills/nitro/docs/examples/cached-handler.md +81 -0
- package/skills/nitro/docs/examples/custom-error-handler.md +98 -0
- package/skills/nitro/docs/examples/database.md +157 -0
- package/skills/nitro/docs/examples/elysia.md +70 -0
- package/skills/nitro/docs/examples/express.md +78 -0
- package/skills/nitro/docs/examples/fastify.md +79 -0
- package/skills/nitro/docs/examples/hello-world.md +68 -0
- package/skills/nitro/docs/examples/hono.md +74 -0
- package/skills/nitro/docs/examples/import-alias.md +100 -0
- package/skills/nitro/docs/examples/index.md +3 -0
- package/skills/nitro/docs/examples/middleware.md +91 -0
- package/skills/nitro/docs/examples/mono-jsx.md +68 -0
- package/skills/nitro/docs/examples/nano-jsx.md +70 -0
- package/skills/nitro/docs/examples/plugins.md +91 -0
- package/skills/nitro/docs/examples/renderer.md +113 -0
- package/skills/nitro/docs/examples/runtime-config.md +97 -0
- package/skills/nitro/docs/examples/server-fetch.md +87 -0
- package/skills/nitro/docs/examples/shiki.md +198 -0
- package/skills/nitro/docs/examples/virtual-routes.md +74 -0
- package/skills/nitro/docs/examples/vite-nitro-plugin.md +79 -0
- package/skills/nitro/docs/examples/vite-rsc.md +1041 -0
- package/skills/nitro/docs/examples/vite-ssr-html.md +217 -0
- package/skills/nitro/docs/examples/vite-ssr-preact.md +247 -0
- package/skills/nitro/docs/examples/vite-ssr-react.md +226 -0
- package/skills/nitro/docs/examples/vite-ssr-solid.md +256 -0
- package/skills/nitro/docs/examples/vite-ssr-tsr-react.md +442 -0
- package/skills/nitro/docs/examples/vite-ssr-tss-react.md +444 -0
- package/skills/nitro/docs/examples/vite-ssr-vue-router.md +616 -0
- package/skills/nitro/docs/examples/vite-trpc.md +335 -0
- package/skills/nitro/docs/examples/websocket.md +282 -0
- package/skills/nitro/docs/index.md +121 -0
- package/dist/_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,14 @@
|
|
|
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
|
-
});
|
|
11
|
+
//#region node_modules/.pnpm/unimport@6.0.1/node_modules/unimport/dist/chunks/detect-acorn.mjs
|
|
22
12
|
async function detectImportsAcorn(code, ctx, options) {
|
|
23
13
|
const s = getMagicString(code);
|
|
24
14
|
const map = await ctx.getImportMap();
|
|
@@ -201,9 +191,8 @@ function createVirtualImportsAcronWalker(importMap, virtualImports = []) {
|
|
|
201
191
|
} }
|
|
202
192
|
};
|
|
203
193
|
}
|
|
204
|
-
|
|
205
194
|
//#endregion
|
|
206
|
-
//#region node_modules/.pnpm/unplugin@
|
|
195
|
+
//#region node_modules/.pnpm/unplugin@3.0.0/node_modules/unplugin/dist/parse-DN2jPtpt.mjs
|
|
207
196
|
var import_picomatch = /* @__PURE__ */ __toESM(require_picomatch(), 1);
|
|
208
197
|
function toArray$2(array) {
|
|
209
198
|
array = array || [];
|
|
@@ -211,16 +200,16 @@ function toArray$2(array) {
|
|
|
211
200
|
return [array];
|
|
212
201
|
}
|
|
213
202
|
const BACKSLASH_REGEX = /\\/g;
|
|
214
|
-
function normalize$1(path
|
|
215
|
-
return path
|
|
203
|
+
function normalize$1(path) {
|
|
204
|
+
return path.replace(BACKSLASH_REGEX, "/");
|
|
216
205
|
}
|
|
217
206
|
const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Z]:)?[/\\|])/i;
|
|
218
|
-
function isAbsolute$1(path
|
|
219
|
-
return ABSOLUTE_PATH_REGEX.test(path
|
|
207
|
+
function isAbsolute$1(path) {
|
|
208
|
+
return ABSOLUTE_PATH_REGEX.test(path);
|
|
220
209
|
}
|
|
221
|
-
function getMatcherString$1(glob, cwd
|
|
210
|
+
function getMatcherString$1(glob, cwd) {
|
|
222
211
|
if (glob.startsWith("**") || isAbsolute$1(glob)) return normalize$1(glob);
|
|
223
|
-
return normalize$1(resolve(cwd
|
|
212
|
+
return normalize$1(resolve(cwd, glob));
|
|
224
213
|
}
|
|
225
214
|
function patternToIdFilter(pattern) {
|
|
226
215
|
if (pattern instanceof RegExp) return (id) => {
|
|
@@ -304,16 +293,10 @@ function normalizeObjectHook(name, hook) {
|
|
|
304
293
|
};
|
|
305
294
|
}
|
|
306
295
|
function parse(code, opts = {}) {
|
|
307
|
-
|
|
308
|
-
sourceType: "module",
|
|
309
|
-
ecmaVersion: "latest",
|
|
310
|
-
locations: true,
|
|
311
|
-
...opts
|
|
312
|
-
});
|
|
296
|
+
throw new Error("Parse implementation is not set. Please call setParseImpl first.");
|
|
313
297
|
}
|
|
314
|
-
|
|
315
298
|
//#endregion
|
|
316
|
-
//#region node_modules/.pnpm/unplugin@
|
|
299
|
+
//#region node_modules/.pnpm/unplugin@3.0.0/node_modules/unplugin/dist/webpack-like-Djrmy9eu.mjs
|
|
317
300
|
function transformUse(data, plugin, transformLoader) {
|
|
318
301
|
if (data.resource == null) return [];
|
|
319
302
|
const id = normalizeAbsolutePath(data.resource + (data.resourceQuery || ""));
|
|
@@ -336,14 +319,13 @@ function transformUse(data, plugin, transformLoader) {
|
|
|
336
319
|
* @param path - Path to normalize.
|
|
337
320
|
* @returns a new normalized path.
|
|
338
321
|
*/
|
|
339
|
-
function normalizeAbsolutePath(path
|
|
340
|
-
if (isAbsolute(path
|
|
341
|
-
else return path
|
|
322
|
+
function normalizeAbsolutePath(path) {
|
|
323
|
+
if (isAbsolute(path)) return normalize(path);
|
|
324
|
+
else return path;
|
|
342
325
|
}
|
|
343
|
-
|
|
344
326
|
//#endregion
|
|
345
|
-
//#region node_modules/.pnpm/unplugin@
|
|
346
|
-
function createBuildContext$
|
|
327
|
+
//#region node_modules/.pnpm/unplugin@3.0.0/node_modules/unplugin/dist/context-CKhLGGrj.mjs
|
|
328
|
+
function createBuildContext$3(compiler, compilation, loaderContext, inputSourceMap) {
|
|
347
329
|
return {
|
|
348
330
|
getNativeBuildContext() {
|
|
349
331
|
return {
|
|
@@ -355,8 +337,9 @@ function createBuildContext$1(compiler, compilation, loaderContext, inputSourceM
|
|
|
355
337
|
};
|
|
356
338
|
},
|
|
357
339
|
addWatchFile(file) {
|
|
358
|
-
const
|
|
359
|
-
compilation.fileDependencies.add(
|
|
340
|
+
const resolvedPath = resolve(process.cwd(), file);
|
|
341
|
+
compilation.fileDependencies.add(resolvedPath);
|
|
342
|
+
loaderContext?.addDependency(resolvedPath);
|
|
360
343
|
},
|
|
361
344
|
getWatchFiles() {
|
|
362
345
|
return Array.from(compilation.fileDependencies);
|
|
@@ -371,7 +354,7 @@ function createBuildContext$1(compiler, compilation, loaderContext, inputSourceM
|
|
|
371
354
|
}
|
|
372
355
|
};
|
|
373
356
|
}
|
|
374
|
-
function normalizeMessage$
|
|
357
|
+
function normalizeMessage$2(error) {
|
|
375
358
|
const err = new Error(typeof error === "string" ? error : error.message);
|
|
376
359
|
if (typeof error === "object") {
|
|
377
360
|
err.stack = error.stack;
|
|
@@ -379,9 +362,8 @@ function normalizeMessage$1(error) {
|
|
|
379
362
|
}
|
|
380
363
|
return err;
|
|
381
364
|
}
|
|
382
|
-
|
|
383
365
|
//#endregion
|
|
384
|
-
//#region node_modules/.pnpm/unplugin@
|
|
366
|
+
//#region node_modules/.pnpm/unplugin@3.0.0/node_modules/unplugin/dist/utils-BMHLEWml.mjs
|
|
385
367
|
function encodeVirtualModuleId(id, plugin) {
|
|
386
368
|
return resolve(plugin.__virtualModulePrefix, encodeURIComponent(id));
|
|
387
369
|
}
|
|
@@ -415,23 +397,22 @@ var FakeVirtualModulesPlugin = class FakeVirtualModulesPlugin {
|
|
|
415
397
|
const counter = FakeVirtualModulesPlugin.counters.get(dir) ?? 0;
|
|
416
398
|
FakeVirtualModulesPlugin.counters.set(dir, counter + 1);
|
|
417
399
|
compiler.hooks.shutdown.tap(this.name, () => {
|
|
418
|
-
const counter
|
|
419
|
-
if (counter
|
|
400
|
+
const counter = (FakeVirtualModulesPlugin.counters.get(dir) ?? 1) - 1;
|
|
401
|
+
if (counter === 0) {
|
|
420
402
|
FakeVirtualModulesPlugin.counters.delete(dir);
|
|
421
403
|
fs.rmSync(dir, {
|
|
422
404
|
recursive: true,
|
|
423
405
|
force: true
|
|
424
406
|
});
|
|
425
|
-
} else FakeVirtualModulesPlugin.counters.set(dir, counter
|
|
407
|
+
} else FakeVirtualModulesPlugin.counters.set(dir, counter);
|
|
426
408
|
});
|
|
427
409
|
}
|
|
428
410
|
async writeModule(file) {
|
|
429
411
|
return fs.promises.writeFile(file, "");
|
|
430
412
|
}
|
|
431
413
|
};
|
|
432
|
-
|
|
433
414
|
//#endregion
|
|
434
|
-
//#region node_modules/.pnpm/unplugin@
|
|
415
|
+
//#region node_modules/.pnpm/unplugin@3.0.0/node_modules/unplugin/dist/context-MD-xQmYI.mjs
|
|
435
416
|
function contextOptionsFromCompilation(compilation) {
|
|
436
417
|
return {
|
|
437
418
|
addWatchFile(file) {
|
|
@@ -442,11 +423,11 @@ function contextOptionsFromCompilation(compilation) {
|
|
|
442
423
|
}
|
|
443
424
|
};
|
|
444
425
|
}
|
|
445
|
-
const require
|
|
426
|
+
const require = createRequire(import.meta.url);
|
|
446
427
|
function getSource(fileSource) {
|
|
447
|
-
return new (require
|
|
428
|
+
return new (require("webpack")).sources.RawSource(typeof fileSource === "string" ? fileSource : Buffer.from(fileSource.buffer));
|
|
448
429
|
}
|
|
449
|
-
function createBuildContext(options, compiler, compilation, loaderContext, inputSourceMap) {
|
|
430
|
+
function createBuildContext$2(options, compiler, compilation, loaderContext, inputSourceMap) {
|
|
450
431
|
return {
|
|
451
432
|
parse,
|
|
452
433
|
addWatchFile(id) {
|
|
@@ -473,7 +454,7 @@ function createBuildContext(options, compiler, compilation, loaderContext, input
|
|
|
473
454
|
}
|
|
474
455
|
};
|
|
475
456
|
}
|
|
476
|
-
function normalizeMessage(error) {
|
|
457
|
+
function normalizeMessage$1(error) {
|
|
477
458
|
const err = new Error(typeof error === "string" ? error : error.message);
|
|
478
459
|
if (typeof error === "object") {
|
|
479
460
|
err.stack = error.stack;
|
|
@@ -481,279 +462,205 @@ function normalizeMessage(error) {
|
|
|
481
462
|
}
|
|
482
463
|
return err;
|
|
483
464
|
}
|
|
484
|
-
|
|
485
465
|
//#endregion
|
|
486
|
-
//#region node_modules/.pnpm/
|
|
487
|
-
var
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
466
|
+
//#region node_modules/.pnpm/unplugin@3.0.0/node_modules/unplugin/dist/index.mjs
|
|
467
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
468
|
+
const ExtToLoader$1 = {
|
|
469
|
+
".js": "js",
|
|
470
|
+
".mjs": "js",
|
|
471
|
+
".cjs": "js",
|
|
472
|
+
".jsx": "jsx",
|
|
473
|
+
".ts": "ts",
|
|
474
|
+
".cts": "ts",
|
|
475
|
+
".mts": "ts",
|
|
476
|
+
".tsx": "tsx",
|
|
477
|
+
".css": "css",
|
|
478
|
+
".less": "css",
|
|
479
|
+
".stylus": "css",
|
|
480
|
+
".scss": "css",
|
|
481
|
+
".sass": "css",
|
|
482
|
+
".json": "json",
|
|
483
|
+
".txt": "text"
|
|
484
|
+
};
|
|
485
|
+
function guessLoader$1(id) {
|
|
486
|
+
return ExtToLoader$1[path.extname(id).toLowerCase()] || "js";
|
|
487
|
+
}
|
|
488
|
+
function createBuildContext$1(build) {
|
|
489
|
+
const watchFiles = [];
|
|
490
|
+
return {
|
|
491
|
+
addWatchFile(file) {
|
|
492
|
+
watchFiles.push(file);
|
|
493
|
+
},
|
|
494
|
+
getWatchFiles() {
|
|
495
|
+
return watchFiles;
|
|
496
|
+
},
|
|
497
|
+
emitFile(emittedFile) {
|
|
498
|
+
const outFileName = emittedFile.fileName || emittedFile.name;
|
|
499
|
+
const outdir = build?.config?.outdir;
|
|
500
|
+
if (outdir && emittedFile.source && outFileName) {
|
|
501
|
+
const outPath = path.resolve(outdir, outFileName);
|
|
502
|
+
const outDir = path.dirname(outPath);
|
|
503
|
+
if (!fs.existsSync(outDir)) fs.mkdirSync(outDir, { recursive: true });
|
|
504
|
+
fs.writeFileSync(outPath, emittedFile.source);
|
|
499
505
|
}
|
|
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);
|
|
506
|
+
},
|
|
507
|
+
parse,
|
|
508
|
+
getNativeBuildContext() {
|
|
509
|
+
return {
|
|
510
|
+
framework: "bun",
|
|
511
|
+
build
|
|
512
|
+
};
|
|
524
513
|
}
|
|
525
514
|
};
|
|
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
|
-
};
|
|
515
|
+
}
|
|
516
|
+
function createPluginContext$1(buildContext) {
|
|
517
|
+
const errors = [];
|
|
518
|
+
const warnings = [];
|
|
519
|
+
return {
|
|
520
|
+
errors,
|
|
521
|
+
warnings,
|
|
522
|
+
mixedContext: {
|
|
523
|
+
...buildContext,
|
|
524
|
+
error(error) {
|
|
525
|
+
errors.push(error);
|
|
526
|
+
},
|
|
527
|
+
warn(warning) {
|
|
528
|
+
warnings.push(warning);
|
|
554
529
|
}
|
|
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
530
|
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
function getBunPlugin(factory) {
|
|
534
|
+
return (userOptions) => {
|
|
535
|
+
if (typeof Bun === "undefined") throw new ReferenceError("Bun is not supported in this environment");
|
|
536
|
+
if (!Bun.semver.satisfies(Bun.version, ">=1.2.22")) throw new Error("Bun 1.2.22 or higher is required, please upgrade Bun");
|
|
537
|
+
const meta = { framework: "bun" };
|
|
538
|
+
const plugins = toArray$2(factory(userOptions, meta));
|
|
539
|
+
return {
|
|
540
|
+
name: (plugins.length === 1 ? plugins[0].name : meta.bunHostName) ?? `unplugin-host:${plugins.map((p) => p.name).join(":")}`,
|
|
541
|
+
async setup(build) {
|
|
542
|
+
const context = createBuildContext$1(build);
|
|
543
|
+
if (plugins.some((plugin) => plugin.buildStart)) build.onStart(async () => {
|
|
544
|
+
for (const plugin of plugins) if (plugin.buildStart) await plugin.buildStart.call(context);
|
|
607
545
|
});
|
|
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
|
-
|
|
546
|
+
const resolveIdHooks = plugins.filter((plugin) => plugin.resolveId).map((plugin) => ({
|
|
547
|
+
plugin,
|
|
548
|
+
...normalizeObjectHook("resolveId", plugin.resolveId)
|
|
549
|
+
}));
|
|
550
|
+
const loadHooks = plugins.filter((plugin) => plugin.load).map((plugin) => ({
|
|
551
|
+
plugin,
|
|
552
|
+
...normalizeObjectHook("load", plugin.load)
|
|
553
|
+
}));
|
|
554
|
+
const transformHooks = plugins.filter((plugin) => plugin.transform || plugin.transformInclude).map((plugin) => ({
|
|
555
|
+
plugin,
|
|
556
|
+
...normalizeObjectHook("transform", plugin.transform)
|
|
557
|
+
}));
|
|
558
|
+
const virtualModulePlugins = /* @__PURE__ */ new Set();
|
|
559
|
+
for (const plugin of plugins) if (plugin.resolveId && plugin.load) virtualModulePlugins.add(plugin.name);
|
|
560
|
+
if (resolveIdHooks.length) build.onResolve({ filter: /.*/ }, async (args) => {
|
|
561
|
+
if (build.config?.external?.includes(args.path)) return;
|
|
562
|
+
for (const { plugin, handler, filter } of resolveIdHooks) {
|
|
563
|
+
if (!filter(args.path)) continue;
|
|
564
|
+
const { mixedContext, errors, warnings } = createPluginContext$1(context);
|
|
565
|
+
const isEntry = args.kind === "entry-point-run" || args.kind === "entry-point-build";
|
|
566
|
+
const result = await handler.call(mixedContext, args.path, isEntry ? void 0 : args.importer, { isEntry });
|
|
567
|
+
for (const warning of warnings) console.warn("[unplugin]", typeof warning === "string" ? warning : warning.message);
|
|
568
|
+
if (errors.length > 0) {
|
|
569
|
+
const errorMessage = errors.map((e) => typeof e === "string" ? e : e.message).join("\n");
|
|
570
|
+
throw new Error(`[unplugin] ${plugin.name}: ${errorMessage}`);
|
|
571
|
+
}
|
|
572
|
+
if (typeof result === "string") {
|
|
573
|
+
if (!isAbsolute(result)) return {
|
|
574
|
+
path: result,
|
|
575
|
+
namespace: plugin.name
|
|
576
|
+
};
|
|
577
|
+
return { path: result };
|
|
578
|
+
} else if (typeof result === "object" && result !== null) {
|
|
579
|
+
if (!isAbsolute(result.id)) return {
|
|
580
|
+
path: result.id,
|
|
581
|
+
external: result.external,
|
|
582
|
+
namespace: plugin.name
|
|
583
|
+
};
|
|
584
|
+
return {
|
|
585
|
+
path: result.id,
|
|
586
|
+
external: result.external
|
|
587
|
+
};
|
|
588
|
+
}
|
|
649
589
|
}
|
|
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));
|
|
590
|
+
});
|
|
591
|
+
async function processLoadTransform(id, namespace, loader) {
|
|
592
|
+
let code;
|
|
593
|
+
let hasResult = false;
|
|
594
|
+
const namespaceLoadHooks = namespace === "file" ? loadHooks : loadHooks.filter((h) => h.plugin.name === namespace);
|
|
595
|
+
for (const { plugin, handler, filter } of namespaceLoadHooks) {
|
|
596
|
+
if (plugin.loadInclude && !plugin.loadInclude(id)) continue;
|
|
597
|
+
if (!filter(id)) continue;
|
|
598
|
+
const { mixedContext, errors, warnings } = createPluginContext$1(context);
|
|
599
|
+
const result = await handler.call(mixedContext, 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
|
+
break;
|
|
609
|
+
} else if (typeof result === "object" && result !== null) {
|
|
610
|
+
code = result.code;
|
|
611
|
+
hasResult = true;
|
|
612
|
+
break;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
if (!hasResult && namespace === "file" && transformHooks.length > 0) code = await Bun.file(id).text();
|
|
616
|
+
if (code !== void 0) {
|
|
617
|
+
const namespaceTransformHooks = namespace === "file" ? transformHooks : transformHooks.filter((h) => h.plugin.name === namespace);
|
|
618
|
+
for (const { plugin, handler, filter } of namespaceTransformHooks) {
|
|
619
|
+
if (plugin.transformInclude && !plugin.transformInclude(id)) continue;
|
|
620
|
+
if (!filter(id, code)) continue;
|
|
621
|
+
const { mixedContext, errors, warnings } = createPluginContext$1(context);
|
|
622
|
+
const result = await handler.call(mixedContext, code, id);
|
|
623
|
+
for (const warning of warnings) console.warn("[unplugin]", typeof warning === "string" ? warning : warning.message);
|
|
624
|
+
if (errors.length > 0) {
|
|
625
|
+
const errorMessage = errors.map((e) => typeof e === "string" ? e : e.message).join("\n");
|
|
626
|
+
throw new Error(`[unplugin] ${plugin.name}: ${errorMessage}`);
|
|
627
|
+
}
|
|
628
|
+
if (typeof result === "string") {
|
|
629
|
+
code = result;
|
|
630
|
+
hasResult = true;
|
|
631
|
+
} else if (typeof result === "object" && result !== null) {
|
|
632
|
+
code = result.code;
|
|
633
|
+
hasResult = true;
|
|
707
634
|
}
|
|
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
635
|
}
|
|
636
|
+
}
|
|
637
|
+
if (hasResult && code !== void 0) return {
|
|
638
|
+
contents: code,
|
|
639
|
+
loader: loader ?? guessLoader$1(id)
|
|
717
640
|
};
|
|
718
641
|
}
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
if (
|
|
732
|
-
const
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
});
|
|
642
|
+
if (loadHooks.length || transformHooks.length) build.onLoad({
|
|
643
|
+
filter: /.*/,
|
|
644
|
+
namespace: "file"
|
|
645
|
+
}, async (args) => {
|
|
646
|
+
return processLoadTransform(args.path, "file", args.loader);
|
|
647
|
+
});
|
|
648
|
+
for (const pluginName of virtualModulePlugins) build.onLoad({
|
|
649
|
+
filter: /.*/,
|
|
650
|
+
namespace: pluginName
|
|
651
|
+
}, async (args) => {
|
|
652
|
+
return processLoadTransform(args.path, pluginName, args.loader);
|
|
653
|
+
});
|
|
654
|
+
if (plugins.some((plugin) => plugin.buildEnd || plugin.writeBundle)) build.onEnd(async () => {
|
|
655
|
+
for (const plugin of plugins) {
|
|
656
|
+
if (plugin.buildEnd) await plugin.buildEnd.call(context);
|
|
657
|
+
if (plugin.writeBundle) await plugin.writeBundle();
|
|
658
|
+
}
|
|
737
659
|
});
|
|
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
660
|
}
|
|
749
|
-
}
|
|
661
|
+
};
|
|
750
662
|
};
|
|
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);
|
|
663
|
+
}
|
|
757
664
|
const ExtToLoader = {
|
|
758
665
|
".js": "js",
|
|
759
666
|
".mjs": "js",
|
|
@@ -812,7 +719,7 @@ function combineSourcemaps(filename, sourcemapList) {
|
|
|
812
719
|
if (!map.file) delete map.file;
|
|
813
720
|
return map;
|
|
814
721
|
}
|
|
815
|
-
function createBuildContext
|
|
722
|
+
function createBuildContext(build) {
|
|
816
723
|
const watchFiles = [];
|
|
817
724
|
const { initialOptions } = build;
|
|
818
725
|
return {
|
|
@@ -845,10 +752,10 @@ function createPluginContext(context) {
|
|
|
845
752
|
const warnings = [];
|
|
846
753
|
const pluginContext = {
|
|
847
754
|
error(message) {
|
|
848
|
-
errors.push(normalizeMessage
|
|
755
|
+
errors.push(normalizeMessage(message));
|
|
849
756
|
},
|
|
850
757
|
warn(message) {
|
|
851
|
-
warnings.push(normalizeMessage
|
|
758
|
+
warnings.push(normalizeMessage(message));
|
|
852
759
|
}
|
|
853
760
|
};
|
|
854
761
|
return {
|
|
@@ -863,7 +770,7 @@ function createPluginContext(context) {
|
|
|
863
770
|
}
|
|
864
771
|
};
|
|
865
772
|
}
|
|
866
|
-
function normalizeMessage
|
|
773
|
+
function normalizeMessage(message) {
|
|
867
774
|
if (typeof message === "string") message = { message };
|
|
868
775
|
return {
|
|
869
776
|
id: message.id,
|
|
@@ -946,7 +853,7 @@ function getEsbuildPlugin(factory) {
|
|
|
946
853
|
function buildSetup() {
|
|
947
854
|
return (plugin) => {
|
|
948
855
|
return (build, rawBuild) => {
|
|
949
|
-
const context = createBuildContext
|
|
856
|
+
const context = createBuildContext(rawBuild);
|
|
950
857
|
const { onStart, onEnd, onResolve, onLoad, onTransform, initialOptions } = build;
|
|
951
858
|
const onResolveFilter = plugin.esbuild?.onResolveFilter ?? /.*/;
|
|
952
859
|
const onLoadFilter = plugin.esbuild?.onLoadFilter ?? /.*/;
|
|
@@ -1125,7 +1032,7 @@ function decodeStr(str) {
|
|
|
1125
1032
|
if (firstIndex === -1) return str;
|
|
1126
1033
|
const result = Array.from({ length: len - countBackslashZeros(str, firstIndex) });
|
|
1127
1034
|
let pos = 0;
|
|
1128
|
-
for (let i
|
|
1035
|
+
for (let i = 0; i < firstIndex; i++) result[pos++] = str[i];
|
|
1129
1036
|
let i = firstIndex;
|
|
1130
1037
|
while (i < len) if (str[i] === "\\" && str[i + 1] === "0") {
|
|
1131
1038
|
result[pos++] = "\0";
|
|
@@ -1370,7 +1277,6 @@ function toRollupPlugin(plugin, key) {
|
|
|
1370
1277
|
}
|
|
1371
1278
|
}
|
|
1372
1279
|
function supportNativeFilter(context, framework) {
|
|
1373
|
-
if (framework === "unloader") return false;
|
|
1374
1280
|
if (framework === "vite") return !!context?.meta?.viteVersion;
|
|
1375
1281
|
if (framework === "rolldown") return true;
|
|
1376
1282
|
const rollupVersion = context?.meta?.rollupVersion;
|
|
@@ -1386,11 +1292,8 @@ function getRolldownPlugin(factory) {
|
|
|
1386
1292
|
return plugins.length === 1 ? plugins[0] : plugins;
|
|
1387
1293
|
});
|
|
1388
1294
|
}
|
|
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");
|
|
1295
|
+
const TRANSFORM_LOADER$1 = resolve(import.meta.dirname, "rspack/loaders/transform.mjs");
|
|
1296
|
+
const LOAD_LOADER$1 = resolve(import.meta.dirname, "rspack/loaders/load.mjs");
|
|
1394
1297
|
function getRspackPlugin(factory) {
|
|
1395
1298
|
return (userOptions) => {
|
|
1396
1299
|
return { apply(compiler) {
|
|
@@ -1407,9 +1310,9 @@ function getRspackPlugin(factory) {
|
|
|
1407
1310
|
});
|
|
1408
1311
|
const externalModules = /* @__PURE__ */ new Set();
|
|
1409
1312
|
if (plugin.resolveId) {
|
|
1410
|
-
const createPlugin = (plugin
|
|
1313
|
+
const createPlugin = (plugin) => {
|
|
1411
1314
|
if (compiler.rspack.experiments.VirtualModulesPlugin) return new compiler.rspack.experiments.VirtualModulesPlugin();
|
|
1412
|
-
return new FakeVirtualModulesPlugin(plugin
|
|
1315
|
+
return new FakeVirtualModulesPlugin(plugin);
|
|
1413
1316
|
};
|
|
1414
1317
|
const vfs = createPlugin(plugin);
|
|
1415
1318
|
vfs.apply(compiler);
|
|
@@ -1423,11 +1326,11 @@ function getRspackPlugin(factory) {
|
|
|
1423
1326
|
let importer = requestContext.issuer !== "" ? requestContext.issuer : void 0;
|
|
1424
1327
|
const isEntry = requestContext.issuer === "";
|
|
1425
1328
|
if (importer?.startsWith(plugin.__virtualModulePrefix)) importer = decodeURIComponent(importer.slice(plugin.__virtualModulePrefix.length));
|
|
1426
|
-
const context = createBuildContext$
|
|
1329
|
+
const context = createBuildContext$3(compiler, compilation);
|
|
1427
1330
|
let error;
|
|
1428
1331
|
const pluginContext = {
|
|
1429
1332
|
error(msg) {
|
|
1430
|
-
if (error == null) error = normalizeMessage$
|
|
1333
|
+
if (error == null) error = normalizeMessage$2(msg);
|
|
1431
1334
|
else console.error(`unplugin/rspack: multiple errors returned from resolveId hook: ${msg}`);
|
|
1432
1335
|
},
|
|
1433
1336
|
warn(msg) {
|
|
@@ -1487,17 +1390,17 @@ function getRspackPlugin(factory) {
|
|
|
1487
1390
|
});
|
|
1488
1391
|
if (plugin.rspack) plugin.rspack(compiler);
|
|
1489
1392
|
if (plugin.watchChange || plugin.buildStart) compiler.hooks.make.tapPromise(plugin.name, async (compilation) => {
|
|
1490
|
-
const context = createBuildContext$
|
|
1393
|
+
const context = createBuildContext$3(compiler, compilation);
|
|
1491
1394
|
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
|
|
1395
|
+
const promises = [];
|
|
1396
|
+
if (compiler.modifiedFiles) compiler.modifiedFiles.forEach((file) => promises.push(Promise.resolve(plugin.watchChange.call(context, file, { event: "update" }))));
|
|
1397
|
+
if (compiler.removedFiles) compiler.removedFiles.forEach((file) => promises.push(Promise.resolve(plugin.watchChange.call(context, file, { event: "delete" }))));
|
|
1398
|
+
await Promise.all(promises);
|
|
1496
1399
|
}
|
|
1497
1400
|
if (plugin.buildStart) return await plugin.buildStart.call(context);
|
|
1498
1401
|
});
|
|
1499
1402
|
if (plugin.buildEnd) compiler.hooks.emit.tapPromise(plugin.name, async (compilation) => {
|
|
1500
|
-
await plugin.buildEnd.call(createBuildContext$
|
|
1403
|
+
await plugin.buildEnd.call(createBuildContext$3(compiler, compilation));
|
|
1501
1404
|
});
|
|
1502
1405
|
if (plugin.writeBundle) compiler.hooks.afterEmit.tapPromise(plugin.name, async () => {
|
|
1503
1406
|
await plugin.writeBundle();
|
|
@@ -1522,10 +1425,11 @@ function getVitePlugin(factory) {
|
|
|
1522
1425
|
return plugins.length === 1 ? plugins[0] : plugins;
|
|
1523
1426
|
});
|
|
1524
1427
|
}
|
|
1525
|
-
const TRANSFORM_LOADER = resolve(
|
|
1526
|
-
const LOAD_LOADER = resolve(
|
|
1428
|
+
const TRANSFORM_LOADER = resolve(import.meta.dirname, "webpack/loaders/transform.mjs");
|
|
1429
|
+
const LOAD_LOADER = resolve(import.meta.dirname, "webpack/loaders/load.mjs");
|
|
1527
1430
|
function getWebpackPlugin(factory) {
|
|
1528
1431
|
return (userOptions) => {
|
|
1432
|
+
const VirtualModulesPlugin = __require("webpack-virtual-modules");
|
|
1529
1433
|
return { apply(compiler) {
|
|
1530
1434
|
const VIRTUAL_MODULE_PREFIX = resolve(compiler.options.context ?? process$1.cwd(), "_virtual_");
|
|
1531
1435
|
const meta = {
|
|
@@ -1540,9 +1444,9 @@ function getWebpackPlugin(factory) {
|
|
|
1540
1444
|
});
|
|
1541
1445
|
const externalModules = /* @__PURE__ */ new Set();
|
|
1542
1446
|
if (plugin.resolveId) {
|
|
1543
|
-
let vfs = compiler.options.plugins.find((i) => i instanceof
|
|
1447
|
+
let vfs = compiler.options.plugins.find((i) => i instanceof VirtualModulesPlugin);
|
|
1544
1448
|
if (!vfs) {
|
|
1545
|
-
vfs = new
|
|
1449
|
+
vfs = new VirtualModulesPlugin();
|
|
1546
1450
|
compiler.options.plugins.push(vfs);
|
|
1547
1451
|
}
|
|
1548
1452
|
const vfsModules = /* @__PURE__ */ new Set();
|
|
@@ -1559,7 +1463,7 @@ function getWebpackPlugin(factory) {
|
|
|
1559
1463
|
const isEntry = requestContext.issuer === "";
|
|
1560
1464
|
if (importer?.startsWith(plugin.__virtualModulePrefix)) importer = decodeURIComponent(importer.slice(plugin.__virtualModulePrefix.length));
|
|
1561
1465
|
const fileDependencies = /* @__PURE__ */ new Set();
|
|
1562
|
-
const context = createBuildContext({
|
|
1466
|
+
const context = createBuildContext$2({
|
|
1563
1467
|
addWatchFile(file) {
|
|
1564
1468
|
fileDependencies.add(file);
|
|
1565
1469
|
resolveContext.fileDependencies?.add(file);
|
|
@@ -1571,7 +1475,7 @@ function getWebpackPlugin(factory) {
|
|
|
1571
1475
|
let error;
|
|
1572
1476
|
const pluginContext = {
|
|
1573
1477
|
error(msg) {
|
|
1574
|
-
if (error == null) error = normalizeMessage(msg);
|
|
1478
|
+
if (error == null) error = normalizeMessage$1(msg);
|
|
1575
1479
|
else console.error(`unplugin/webpack: multiple errors returned from resolveId hook: ${msg}`);
|
|
1576
1480
|
},
|
|
1577
1481
|
warn(msg) {
|
|
@@ -1624,17 +1528,17 @@ function getWebpackPlugin(factory) {
|
|
|
1624
1528
|
});
|
|
1625
1529
|
if (plugin.webpack) plugin.webpack(compiler);
|
|
1626
1530
|
if (plugin.watchChange || plugin.buildStart) compiler.hooks.make.tapPromise(plugin.name, async (compilation) => {
|
|
1627
|
-
const context = createBuildContext(contextOptionsFromCompilation(compilation), compiler, compilation);
|
|
1531
|
+
const context = createBuildContext$2(contextOptionsFromCompilation(compilation), compiler, compilation);
|
|
1628
1532
|
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
|
|
1533
|
+
const promises = [];
|
|
1534
|
+
if (compiler.modifiedFiles) compiler.modifiedFiles.forEach((file) => promises.push(Promise.resolve(plugin.watchChange.call(context, file, { event: "update" }))));
|
|
1535
|
+
if (compiler.removedFiles) compiler.removedFiles.forEach((file) => promises.push(Promise.resolve(plugin.watchChange.call(context, file, { event: "delete" }))));
|
|
1536
|
+
await Promise.all(promises);
|
|
1633
1537
|
}
|
|
1634
1538
|
if (plugin.buildStart) return await plugin.buildStart.call(context);
|
|
1635
1539
|
});
|
|
1636
1540
|
if (plugin.buildEnd) compiler.hooks.emit.tapPromise(plugin.name, async (compilation) => {
|
|
1637
|
-
await plugin.buildEnd.call(createBuildContext(contextOptionsFromCompilation(compilation), compiler, compilation));
|
|
1541
|
+
await plugin.buildEnd.call(createBuildContext$2(contextOptionsFromCompilation(compilation), compiler, compilation));
|
|
1638
1542
|
});
|
|
1639
1543
|
if (plugin.writeBundle) compiler.hooks.afterEmit.tapPromise(plugin.name, async () => {
|
|
1640
1544
|
await plugin.writeBundle();
|
|
@@ -1676,12 +1580,14 @@ function createUnplugin(factory) {
|
|
|
1676
1580
|
get unloader() {
|
|
1677
1581
|
return getUnloaderPlugin(factory);
|
|
1678
1582
|
},
|
|
1583
|
+
get bun() {
|
|
1584
|
+
return getBunPlugin(factory);
|
|
1585
|
+
},
|
|
1679
1586
|
get raw() {
|
|
1680
1587
|
return factory;
|
|
1681
1588
|
}
|
|
1682
1589
|
};
|
|
1683
1590
|
}
|
|
1684
|
-
|
|
1685
1591
|
//#endregion
|
|
1686
1592
|
//#region node_modules/.pnpm/unplugin-utils@0.3.1/node_modules/unplugin-utils/dist/index.js
|
|
1687
1593
|
/**
|
|
@@ -1736,14 +1642,8 @@ function createFilter(include, exclude, options) {
|
|
|
1736
1642
|
return !includeMatchers.length;
|
|
1737
1643
|
};
|
|
1738
1644
|
}
|
|
1739
|
-
|
|
1740
1645
|
//#endregion
|
|
1741
|
-
//#region node_modules/.pnpm/unimport@
|
|
1742
|
-
var unplugin_exports = /* @__PURE__ */ __exportAll({
|
|
1743
|
-
default: () => unplugin,
|
|
1744
|
-
defaultExcludes: () => defaultExcludes,
|
|
1745
|
-
defaultIncludes: () => defaultIncludes
|
|
1746
|
-
});
|
|
1646
|
+
//#region node_modules/.pnpm/unimport@6.0.1/node_modules/unimport/dist/unplugin.mjs
|
|
1747
1647
|
const defaultIncludes = [
|
|
1748
1648
|
/\.[jt]sx?$/,
|
|
1749
1649
|
/\.vue$/,
|
|
@@ -1780,6 +1680,5 @@ const unplugin = createUnplugin((options = {}) => {
|
|
|
1780
1680
|
}
|
|
1781
1681
|
};
|
|
1782
1682
|
});
|
|
1783
|
-
|
|
1784
1683
|
//#endregion
|
|
1785
|
-
export {
|
|
1684
|
+
export { detectImportsAcorn as a, createVirtualImportsAcronWalker as i, defaultIncludes as n, traveseScopes as o, unplugin as r, defaultExcludes as t };
|