nitro-nightly 4.0.0-20251010-091516-7cafddba → 4.0.0-20251030-121649-98b56dfe
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/dist/_build/common.mjs +763 -0
- package/dist/_build/rolldown.mjs +216 -0
- package/dist/_build/rollup.mjs +359 -0
- package/dist/_build/vite.build.mjs +67 -0
- package/dist/_build/vite.plugin.mjs +747 -0
- package/dist/_chunks/B-7HiF0V.mjs +1303 -0
- package/dist/_chunks/B3asVbT4.mjs +151 -0
- package/dist/_chunks/B5ooyfLk.mjs +372 -0
- package/dist/_chunks/DXMHy5ca.mjs +43 -0
- package/dist/_dev.d.mts +12 -0
- package/dist/_dev.mjs +675 -0
- package/dist/_libs/acorn.mjs +5034 -0
- package/dist/_libs/c12.mjs +2798 -0
- package/dist/_libs/chokidar.mjs +1560 -0
- package/dist/_libs/citty.mjs +333 -0
- package/dist/_libs/commondir.mjs +22 -0
- package/dist/_libs/compatx.mjs +46 -0
- package/dist/_libs/confbox.mjs +2920 -0
- package/dist/_libs/debug.mjs +848 -0
- package/dist/_libs/deepmerge.mjs +86 -0
- package/dist/_libs/depd.mjs +314 -0
- package/dist/_libs/dot-prop.mjs +138 -0
- package/dist/_libs/duplexer.mjs +71 -0
- package/dist/_libs/ee-first.mjs +68 -0
- package/dist/_libs/encodeurl.mjs +49 -0
- package/dist/_libs/escape-html.mjs +58 -0
- package/dist/_libs/escape-string-regexp.mjs +8 -0
- package/dist/_libs/estree-walker.mjs +330 -0
- package/dist/_libs/etag.mjs +75 -0
- package/dist/_libs/fdir.mjs +514 -0
- package/dist/_libs/fresh.mjs +85 -0
- package/dist/_libs/function-bind.mjs +63 -0
- package/dist/_libs/gen-mapping.mjs +612 -0
- package/dist/_libs/giget.mjs +19076 -0
- package/dist/_libs/gzip-size.mjs +21 -0
- package/dist/_libs/hasown.mjs +14 -0
- package/dist/_libs/http-errors.mjs +436 -0
- package/dist/_libs/httpxy.mjs +410 -0
- package/dist/_libs/is-core-module.mjs +220 -0
- package/dist/_libs/is-module.mjs +13 -0
- package/dist/_libs/is-reference.mjs +32 -0
- package/dist/_libs/js-tokens.mjs +382 -0
- package/dist/_libs/klona.mjs +90 -0
- package/dist/_libs/knitwork.mjs +124 -0
- package/dist/_libs/local-pkg.mjs +1686 -0
- package/dist/_libs/magic-string.mjs +939 -0
- package/dist/_libs/mime-db.mjs +7642 -0
- package/dist/_libs/mime-types.mjs +162 -0
- package/dist/_libs/mime.mjs +1391 -0
- package/dist/_libs/node-fetch-native.mjs +173 -0
- package/dist/_libs/on-finished.mjs +170 -0
- package/dist/_libs/parseurl.mjs +103 -0
- package/dist/_libs/path-parse.mjs +47 -0
- package/dist/_libs/pathe.mjs +41 -0
- package/dist/_libs/picomatch.mjs +1673 -0
- package/dist/_libs/plugin-alias.mjs +64 -0
- package/dist/_libs/plugin-commonjs.mjs +1489 -0
- package/dist/_libs/plugin-inject.mjs +135 -0
- package/dist/_libs/plugin-json.mjs +36 -0
- package/dist/_libs/plugin-node-resolve.mjs +1553 -0
- package/dist/_libs/plugin-replace.mjs +104 -0
- package/dist/_libs/pretty-bytes.mjs +116 -0
- package/dist/_libs/range-parser.mjs +102 -0
- package/dist/_libs/remapping.mjs +117 -0
- package/dist/_libs/rou3.mjs +311 -0
- package/dist/_libs/send.mjs +857 -0
- package/dist/_libs/serve-static.mjs +124 -0
- package/dist/_libs/std-env.mjs +158 -0
- package/dist/_libs/strip-literal.mjs +51 -0
- package/dist/_libs/tinyglobby.mjs +292 -0
- package/dist/_libs/ultrahtml.mjs +138 -0
- package/dist/_libs/unimport.mjs +3520 -0
- package/dist/_libs/untyped.mjs +271 -0
- package/dist/_libs/unwasm.mjs +5825 -0
- package/dist/_libs/vite-plugin-fullstack.mjs +561 -0
- package/dist/_presets.mjs +1723 -0
- package/dist/builder.d.mts +54 -0
- package/dist/builder.mjs +45 -0
- package/dist/cli/_chunks/build.mjs +43 -0
- package/dist/cli/_chunks/common.mjs +15 -0
- package/dist/cli/_chunks/detect-acorn.mjs +12 -0
- package/dist/cli/_chunks/dev.mjs +79 -0
- package/dist/cli/_chunks/dist.mjs +3 -0
- package/dist/cli/_chunks/dist2.mjs +4 -0
- package/dist/cli/_chunks/esm.mjs +3 -0
- package/dist/cli/_chunks/json5.mjs +4 -0
- package/dist/cli/_chunks/jsonc.mjs +4 -0
- package/dist/cli/_chunks/list.mjs +27 -0
- package/dist/cli/_chunks/multipart-parser.mjs +6 -0
- package/dist/cli/_chunks/prepare.mjs +19 -0
- package/dist/cli/_chunks/run.mjs +55 -0
- package/dist/cli/_chunks/task.mjs +16 -0
- package/dist/cli/_chunks/toml.mjs +4 -0
- package/dist/cli/_chunks/yaml.mjs +4 -0
- package/dist/cli/index.d.mts +1 -1
- package/dist/cli/index.mjs +20 -476
- package/dist/node_modules/@speed-highlight/core/dist/index.js +1 -1
- package/dist/node_modules/@speed-highlight/core/dist/terminal.js +1 -1
- package/dist/node_modules/@speed-highlight/core/package.json +7 -3
- package/dist/node_modules/cookie-es/dist/index.mjs +262 -0
- package/dist/node_modules/cookie-es/package.json +37 -0
- package/dist/node_modules/hookable/dist/index.mjs +243 -266
- package/dist/node_modules/hookable/package.json +29 -26
- package/dist/node_modules/rendu/dist/index.mjs +380 -0
- package/dist/node_modules/rendu/package.json +47 -0
- package/dist/presets/_nitro/runtime/nitro-dev.d.mts +1 -0
- package/dist/presets/_nitro/runtime/nitro-dev.mjs +44 -38
- package/dist/presets/_nitro/runtime/nitro-prerenderer.d.mts +2 -2
- package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +9 -12
- package/dist/presets/_nitro/runtime/service-worker.d.mts +1 -0
- package/dist/presets/_nitro/runtime/service-worker.mjs +14 -11
- package/dist/presets/aws-amplify/runtime/aws-amplify.d.mts +1 -0
- package/dist/presets/aws-amplify/runtime/aws-amplify.mjs +6 -5
- package/dist/presets/aws-lambda/runtime/_utils.d.mts +8 -13
- package/dist/presets/aws-lambda/runtime/_utils.mjs +95 -81
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.d.mts +1 -2
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +25 -27
- package/dist/presets/aws-lambda/runtime/aws-lambda.mjs +7 -7
- package/dist/presets/azure/runtime/_utils.mjs +43 -43
- package/dist/presets/azure/runtime/azure-swa.d.mts +2 -2
- package/dist/presets/azure/runtime/azure-swa.mjs +22 -21
- package/dist/presets/bun/runtime/bun.d.mts +1 -0
- package/dist/presets/bun/runtime/bun.mjs +18 -17
- package/dist/presets/cloudflare/runtime/_module-handler.d.mts +10 -7
- package/dist/presets/cloudflare/runtime/_module-handler.mjs +79 -87
- package/dist/presets/cloudflare/runtime/cloudflare-durable.d.mts +6 -14
- package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +55 -61
- package/dist/presets/cloudflare/runtime/cloudflare-module.d.mts +1 -7
- package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +12 -14
- package/dist/presets/cloudflare/runtime/cloudflare-pages.d.mts +12 -12
- package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +35 -39
- package/dist/presets/cloudflare/runtime/plugin.dev.d.mts +2 -2
- package/dist/presets/cloudflare/runtime/plugin.dev.mjs +89 -82
- package/dist/presets/cloudflare/runtime/shims/workers.dev.mjs +27 -0
- package/dist/presets/deno/runtime/deno-deploy.d.mts +1 -0
- package/dist/presets/deno/runtime/deno-deploy.mjs +12 -11
- package/dist/presets/deno/runtime/deno-server.d.mts +2 -1
- package/dist/presets/deno/runtime/deno-server.mjs +31 -39
- package/dist/presets/netlify/runtime/netlify-edge.d.mts +2 -1
- package/dist/presets/netlify/runtime/netlify-edge.mjs +14 -11
- package/dist/presets/netlify/runtime/netlify.mjs +11 -17
- package/dist/presets/node/runtime/node-cluster.mjs +49 -48
- package/dist/presets/node/runtime/node-middleware.d.mts +3 -2
- package/dist/presets/node/runtime/node-middleware.mjs +7 -6
- package/dist/presets/node/runtime/node-server.mjs +34 -24
- package/dist/presets/standard/runtime/server.d.mts +1 -3
- package/dist/presets/standard/runtime/server.mjs +1 -3
- package/dist/presets/stormkit/runtime/stormkit.d.mts +13 -13
- package/dist/presets/stormkit/runtime/stormkit.mjs +20 -20
- package/dist/presets/vercel/runtime/vercel.d.mts +3 -3
- package/dist/presets/vercel/runtime/vercel.mjs +15 -14
- package/dist/presets/winterjs/runtime/winterjs.d.mts +2 -0
- package/dist/presets/winterjs/runtime/winterjs.mjs +72 -68
- package/dist/presets/zeabur/runtime/zeabur.d.mts +1 -1
- package/dist/runtime/index.d.mts +13 -2
- package/dist/runtime/index.mjs +13 -8
- package/dist/runtime/internal/app.d.mts +3 -1
- package/dist/runtime/internal/app.mjs +179 -140
- package/dist/runtime/internal/cache.d.mts +10 -4
- package/dist/runtime/internal/cache.mjs +247 -216
- package/dist/runtime/internal/context.d.mts +9 -9
- package/dist/runtime/internal/context.mjs +17 -10
- package/dist/runtime/internal/database.mjs +8 -10
- package/dist/runtime/internal/error/dev.d.mts +5 -4
- package/dist/runtime/internal/error/dev.mjs +106 -105
- package/dist/runtime/internal/error/prod.d.mts +5 -4
- package/dist/runtime/internal/error/prod.mjs +51 -59
- package/dist/runtime/internal/error/utils.d.mts +4 -4
- package/dist/runtime/internal/error/utils.mjs +1 -1
- package/dist/runtime/internal/index.d.mts +2 -0
- package/dist/runtime/internal/index.mjs +2 -0
- package/dist/runtime/internal/lib/http-graceful-shutdown.d.mts +14 -14
- package/dist/runtime/internal/lib/http-graceful-shutdown.mjs +248 -209
- package/dist/runtime/internal/meta.d.mts +1 -1
- package/dist/runtime/internal/meta.mjs +1 -1
- package/dist/runtime/internal/plugin.d.mts +2 -2
- package/dist/runtime/internal/plugin.mjs +1 -1
- package/dist/runtime/internal/renderer.mjs +40 -32
- package/dist/runtime/internal/route-rules.d.mts +8 -8
- package/dist/runtime/internal/route-rules.mjs +53 -51
- package/dist/runtime/internal/routes/dev-tasks.d.mts +1 -2
- package/dist/runtime/internal/routes/dev-tasks.mjs +15 -17
- package/dist/runtime/internal/routes/openapi.d.mts +1 -0
- package/dist/runtime/internal/routes/openapi.mjs +81 -87
- package/dist/runtime/internal/routes/renderer-template.d.mts +1 -1
- package/dist/runtime/internal/routes/renderer-template.dev.d.mts +1 -2
- package/dist/runtime/internal/routes/renderer-template.dev.mjs +10 -17
- package/dist/runtime/internal/routes/renderer-template.mjs +1 -1
- package/dist/runtime/internal/routes/scalar.d.mts +1 -0
- package/dist/runtime/internal/routes/scalar.mjs +22 -23
- package/dist/runtime/internal/routes/swagger.d.mts +1 -0
- package/dist/runtime/internal/routes/swagger.mjs +9 -11
- package/dist/runtime/internal/runtime-config.d.mts +4 -4
- package/dist/runtime/internal/runtime-config.mjs +40 -35
- package/dist/runtime/internal/shutdown.d.mts +2 -8
- package/dist/runtime/internal/shutdown.mjs +32 -30
- package/dist/runtime/internal/static.mjs +63 -74
- package/dist/runtime/internal/storage.mjs +2 -2
- package/dist/runtime/internal/task.d.mts +6 -6
- package/dist/runtime/internal/task.mjs +56 -60
- package/dist/runtime/internal/utils.d.mts +1 -1
- package/dist/runtime/internal/utils.mjs +4 -10
- package/dist/types/index.d.mts +2594 -2286
- package/dist/types/index.mjs +1 -1
- package/dist/vite.d.mts +56 -47
- package/dist/vite.mjs +55 -68
- package/lib/index.d.mts +1 -0
- package/lib/index.mjs +1 -0
- package/lib/runtime/meta.mjs +35 -0
- package/package.json +49 -50
- package/dist/_chunks/app.mjs +0 -19797
- package/dist/_chunks/build.mjs +0 -84
- package/dist/_chunks/build2.mjs +0 -318
- package/dist/_chunks/build3.mjs +0 -6452
- package/dist/_chunks/detect-acorn.mjs +0 -503
- package/dist/_chunks/index.mjs +0 -22242
- package/dist/_chunks/index2.mjs +0 -297
- package/dist/_chunks/index3.mjs +0 -1058
- package/dist/_chunks/index4.mjs +0 -1206
- package/dist/_chunks/info.mjs +0 -11157
- package/dist/_chunks/json5.mjs +0 -68
- package/dist/_chunks/jsonc.mjs +0 -51
- package/dist/_chunks/pathe.M-eThtNZ.mjs +0 -204
- package/dist/_chunks/plugin.mjs +0 -960
- package/dist/_chunks/server.mjs +0 -254
- package/dist/_chunks/snapshot.mjs +0 -284
- package/dist/_chunks/toml.mjs +0 -259
- package/dist/_chunks/yaml.mjs +0 -86
- package/dist/cli/build.mjs +0 -54
- package/dist/cli/common.mjs +0 -13
- package/dist/cli/dev.mjs +0 -95
- package/dist/cli/index2.mjs +0 -17
- package/dist/cli/list.mjs +0 -34
- package/dist/cli/prepare.mjs +0 -24
- package/dist/cli/run.mjs +0 -60
- package/dist/index.d.mts +0 -52
- package/dist/index.mjs +0 -55
- package/dist/node_modules/klona/dist/index.mjs +0 -81
- package/dist/node_modules/klona/full/index.mjs +0 -53
- package/dist/node_modules/klona/package.json +0 -74
- package/dist/node_modules/std-env/dist/index.mjs +0 -1
- package/dist/node_modules/std-env/package.json +0 -46
- package/dist/presets.mjs +0 -2460
- package/dist/runtime/internal/debug.d.mts +0 -2
- package/dist/runtime/internal/debug.mjs +0 -5
- package/dist/runtime/internal/empty.d.mts +0 -0
- package/dist/runtime/internal/vite/dev-entry.d.mts +0 -1
- package/dist/runtime/internal/vite/dev-worker.d.mts +0 -1
- package/dist/runtime/internal/vite/prod-setup.d.mts +0 -4
- package/dist/runtime/internal/vite/ssr-renderer.d.mts +0 -4
- package/lib/runtime-meta.mjs +0 -38
- /package/lib/{runtime-meta.d.mts → runtime/meta.d.mts} +0 -0
|
@@ -0,0 +1,1553 @@
|
|
|
1
|
+
import { i as __require, s as __toESM, t as __commonJS } from "../_chunks/DXMHy5ca.mjs";
|
|
2
|
+
import { r as createFilter } from "./plugin-commonjs.mjs";
|
|
3
|
+
import { t as require_cjs } from "./deepmerge.mjs";
|
|
4
|
+
import { t as require_is_module } from "./is-module.mjs";
|
|
5
|
+
import { t as require_path_parse } from "./path-parse.mjs";
|
|
6
|
+
import { t as require_is_core_module } from "./is-core-module.mjs";
|
|
7
|
+
import nativeFs, { realpathSync } from "fs";
|
|
8
|
+
import path, { dirname, extname, normalize, resolve, sep } from "path";
|
|
9
|
+
import { fileURLToPath, pathToFileURL } from "url";
|
|
10
|
+
import { builtinModules } from "module";
|
|
11
|
+
import { promisify } from "util";
|
|
12
|
+
|
|
13
|
+
//#region node_modules/.pnpm/resolve@1.22.11/node_modules/resolve/lib/homedir.js
|
|
14
|
+
var require_homedir = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/resolve@1.22.11/node_modules/resolve/lib/homedir.js": ((exports, module) => {
|
|
15
|
+
var os = __require("os");
|
|
16
|
+
module.exports = os.homedir || function homedir$2() {
|
|
17
|
+
var home = process.env.HOME;
|
|
18
|
+
var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
|
|
19
|
+
if (process.platform === "win32") return process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH || home || null;
|
|
20
|
+
if (process.platform === "darwin") return home || (user ? "/Users/" + user : null);
|
|
21
|
+
if (process.platform === "linux") return home || (process.getuid() === 0 ? "/root" : user ? "/home/" + user : null);
|
|
22
|
+
return home || null;
|
|
23
|
+
};
|
|
24
|
+
}) });
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region node_modules/.pnpm/resolve@1.22.11/node_modules/resolve/lib/caller.js
|
|
28
|
+
var require_caller = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/resolve@1.22.11/node_modules/resolve/lib/caller.js": ((exports, module) => {
|
|
29
|
+
module.exports = function() {
|
|
30
|
+
var origPrepareStackTrace = Error.prepareStackTrace;
|
|
31
|
+
Error.prepareStackTrace = function(_, stack$1) {
|
|
32
|
+
return stack$1;
|
|
33
|
+
};
|
|
34
|
+
var stack = (/* @__PURE__ */ new Error()).stack;
|
|
35
|
+
Error.prepareStackTrace = origPrepareStackTrace;
|
|
36
|
+
return stack[2].getFileName();
|
|
37
|
+
};
|
|
38
|
+
}) });
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region node_modules/.pnpm/resolve@1.22.11/node_modules/resolve/lib/node-modules-paths.js
|
|
42
|
+
var require_node_modules_paths = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/resolve@1.22.11/node_modules/resolve/lib/node-modules-paths.js": ((exports, module) => {
|
|
43
|
+
var path$3 = __require("path");
|
|
44
|
+
var parse = path$3.parse || require_path_parse();
|
|
45
|
+
var driveLetterRegex = /^([A-Za-z]:)/;
|
|
46
|
+
var uncPathRegex = /^\\\\/;
|
|
47
|
+
var getNodeModulesDirs = function getNodeModulesDirs$1(absoluteStart, modules) {
|
|
48
|
+
var prefix = "/";
|
|
49
|
+
if (driveLetterRegex.test(absoluteStart)) prefix = "";
|
|
50
|
+
else if (uncPathRegex.test(absoluteStart)) prefix = "\\\\";
|
|
51
|
+
var paths = [absoluteStart];
|
|
52
|
+
var parsed = parse(absoluteStart);
|
|
53
|
+
while (parsed.dir !== paths[paths.length - 1]) {
|
|
54
|
+
paths.push(parsed.dir);
|
|
55
|
+
parsed = parse(parsed.dir);
|
|
56
|
+
}
|
|
57
|
+
return paths.reduce(function(dirs, aPath) {
|
|
58
|
+
return dirs.concat(modules.map(function(moduleDir) {
|
|
59
|
+
return path$3.resolve(prefix, aPath, moduleDir);
|
|
60
|
+
}));
|
|
61
|
+
}, []);
|
|
62
|
+
};
|
|
63
|
+
module.exports = function nodeModulesPaths$2(start, opts, request) {
|
|
64
|
+
var modules = opts && opts.moduleDirectory ? [].concat(opts.moduleDirectory) : ["node_modules"];
|
|
65
|
+
if (opts && typeof opts.paths === "function") return opts.paths(request, start, function() {
|
|
66
|
+
return getNodeModulesDirs(start, modules);
|
|
67
|
+
}, opts);
|
|
68
|
+
var dirs = getNodeModulesDirs(start, modules);
|
|
69
|
+
return opts && opts.paths ? dirs.concat(opts.paths) : dirs;
|
|
70
|
+
};
|
|
71
|
+
}) });
|
|
72
|
+
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region node_modules/.pnpm/resolve@1.22.11/node_modules/resolve/lib/normalize-options.js
|
|
75
|
+
var require_normalize_options = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/resolve@1.22.11/node_modules/resolve/lib/normalize-options.js": ((exports, module) => {
|
|
76
|
+
module.exports = function(x, opts) {
|
|
77
|
+
/**
|
|
78
|
+
* This file is purposefully a passthrough. It's expected that third-party
|
|
79
|
+
* environments will override it at runtime in order to inject special logic
|
|
80
|
+
* into `resolve` (by manipulating the options). One such example is the PnP
|
|
81
|
+
* code path in Yarn.
|
|
82
|
+
*/
|
|
83
|
+
return opts || {};
|
|
84
|
+
};
|
|
85
|
+
}) });
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region node_modules/.pnpm/resolve@1.22.11/node_modules/resolve/lib/async.js
|
|
89
|
+
var require_async = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/resolve@1.22.11/node_modules/resolve/lib/async.js": ((exports, module) => {
|
|
90
|
+
var fs$1 = __require("fs");
|
|
91
|
+
var getHomedir$1 = require_homedir();
|
|
92
|
+
var path$2 = __require("path");
|
|
93
|
+
var caller$1 = require_caller();
|
|
94
|
+
var nodeModulesPaths$1 = require_node_modules_paths();
|
|
95
|
+
var normalizeOptions$1 = require_normalize_options();
|
|
96
|
+
var isCore$1 = require_is_core_module();
|
|
97
|
+
var realpathFS$1 = process.platform !== "win32" && fs$1.realpath && typeof fs$1.realpath.native === "function" ? fs$1.realpath.native : fs$1.realpath;
|
|
98
|
+
var relativePathRegex$1 = /^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/;
|
|
99
|
+
var windowsDriveRegex$1 = /^\w:[/\\]*$/;
|
|
100
|
+
var nodeModulesRegex$1 = /[/\\]node_modules[/\\]*$/;
|
|
101
|
+
var homedir$1 = getHomedir$1();
|
|
102
|
+
var defaultPaths$1 = function() {
|
|
103
|
+
return [path$2.join(homedir$1, ".node_modules"), path$2.join(homedir$1, ".node_libraries")];
|
|
104
|
+
};
|
|
105
|
+
var defaultIsFile$1 = function isFile(file, cb) {
|
|
106
|
+
fs$1.stat(file, function(err, stat$2) {
|
|
107
|
+
if (!err) return cb(null, stat$2.isFile() || stat$2.isFIFO());
|
|
108
|
+
if (err.code === "ENOENT" || err.code === "ENOTDIR") return cb(null, false);
|
|
109
|
+
return cb(err);
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
var defaultIsDir$1 = function isDirectory(dir, cb) {
|
|
113
|
+
fs$1.stat(dir, function(err, stat$2) {
|
|
114
|
+
if (!err) return cb(null, stat$2.isDirectory());
|
|
115
|
+
if (err.code === "ENOENT" || err.code === "ENOTDIR") return cb(null, false);
|
|
116
|
+
return cb(err);
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
var defaultRealpath = function realpath$1(x, cb) {
|
|
120
|
+
realpathFS$1(x, function(realpathErr, realPath) {
|
|
121
|
+
if (realpathErr && realpathErr.code !== "ENOENT") cb(realpathErr);
|
|
122
|
+
else cb(null, realpathErr ? x : realPath);
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
var maybeRealpath = function maybeRealpath$1(realpath$1, x, opts, cb) {
|
|
126
|
+
if (opts && opts.preserveSymlinks === false) realpath$1(x, cb);
|
|
127
|
+
else cb(null, x);
|
|
128
|
+
};
|
|
129
|
+
var defaultReadPackage = function defaultReadPackage$1(readFile$2, pkgfile, cb) {
|
|
130
|
+
readFile$2(pkgfile, function(readFileErr, body) {
|
|
131
|
+
if (readFileErr) cb(readFileErr);
|
|
132
|
+
else try {
|
|
133
|
+
cb(null, JSON.parse(body));
|
|
134
|
+
} catch (jsonErr) {
|
|
135
|
+
cb(null);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
var getPackageCandidates$1 = function getPackageCandidates$2(x, start, opts) {
|
|
140
|
+
var dirs = nodeModulesPaths$1(start, opts, x);
|
|
141
|
+
for (var i = 0; i < dirs.length; i++) dirs[i] = path$2.join(dirs[i], x);
|
|
142
|
+
return dirs;
|
|
143
|
+
};
|
|
144
|
+
module.exports = function resolve$2(x, options, callback) {
|
|
145
|
+
var cb = callback;
|
|
146
|
+
var opts = options;
|
|
147
|
+
if (typeof options === "function") {
|
|
148
|
+
cb = opts;
|
|
149
|
+
opts = {};
|
|
150
|
+
}
|
|
151
|
+
if (typeof x !== "string") {
|
|
152
|
+
var err = /* @__PURE__ */ new TypeError("Path must be a string.");
|
|
153
|
+
return process.nextTick(function() {
|
|
154
|
+
cb(err);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
opts = normalizeOptions$1(x, opts);
|
|
158
|
+
var isFile = opts.isFile || defaultIsFile$1;
|
|
159
|
+
var isDirectory = opts.isDirectory || defaultIsDir$1;
|
|
160
|
+
var readFile$2 = opts.readFile || fs$1.readFile;
|
|
161
|
+
var realpath$1 = opts.realpath || defaultRealpath;
|
|
162
|
+
var readPackage = opts.readPackage || defaultReadPackage;
|
|
163
|
+
if (opts.readFile && opts.readPackage) {
|
|
164
|
+
var conflictErr = /* @__PURE__ */ new TypeError("`readFile` and `readPackage` are mutually exclusive.");
|
|
165
|
+
return process.nextTick(function() {
|
|
166
|
+
cb(conflictErr);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
var packageIterator = opts.packageIterator;
|
|
170
|
+
var extensions = opts.extensions || [".js"];
|
|
171
|
+
var includeCoreModules = opts.includeCoreModules !== false;
|
|
172
|
+
var basedir = opts.basedir || path$2.dirname(caller$1());
|
|
173
|
+
var parent = opts.filename || basedir;
|
|
174
|
+
opts.paths = opts.paths || defaultPaths$1();
|
|
175
|
+
maybeRealpath(realpath$1, path$2.resolve(basedir), opts, function(err$1, realStart) {
|
|
176
|
+
if (err$1) cb(err$1);
|
|
177
|
+
else init(realStart);
|
|
178
|
+
});
|
|
179
|
+
var res;
|
|
180
|
+
function init(basedir$1) {
|
|
181
|
+
if (relativePathRegex$1.test(x)) {
|
|
182
|
+
res = path$2.resolve(basedir$1, x);
|
|
183
|
+
if (x === "." || x === ".." || x.slice(-1) === "/") res += "/";
|
|
184
|
+
if (x.slice(-1) === "/" && res === basedir$1) loadAsDirectory(res, opts.package, onfile);
|
|
185
|
+
else loadAsFile(res, opts.package, onfile);
|
|
186
|
+
} else if (includeCoreModules && isCore$1(x)) return cb(null, x);
|
|
187
|
+
else loadNodeModules(x, basedir$1, function(err$1, n, pkg) {
|
|
188
|
+
if (err$1) cb(err$1);
|
|
189
|
+
else if (n) return maybeRealpath(realpath$1, n, opts, function(err$2, realN) {
|
|
190
|
+
if (err$2) cb(err$2);
|
|
191
|
+
else cb(null, realN, pkg);
|
|
192
|
+
});
|
|
193
|
+
else {
|
|
194
|
+
var moduleError = /* @__PURE__ */ new Error("Cannot find module '" + x + "' from '" + parent + "'");
|
|
195
|
+
moduleError.code = "MODULE_NOT_FOUND";
|
|
196
|
+
cb(moduleError);
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
function onfile(err$1, m, pkg) {
|
|
201
|
+
if (err$1) cb(err$1);
|
|
202
|
+
else if (m) cb(null, m, pkg);
|
|
203
|
+
else loadAsDirectory(res, function(err$2, d, pkg$1) {
|
|
204
|
+
if (err$2) cb(err$2);
|
|
205
|
+
else if (d) maybeRealpath(realpath$1, d, opts, function(err$3, realD) {
|
|
206
|
+
if (err$3) cb(err$3);
|
|
207
|
+
else cb(null, realD, pkg$1);
|
|
208
|
+
});
|
|
209
|
+
else {
|
|
210
|
+
var moduleError = /* @__PURE__ */ new Error("Cannot find module '" + x + "' from '" + parent + "'");
|
|
211
|
+
moduleError.code = "MODULE_NOT_FOUND";
|
|
212
|
+
cb(moduleError);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
function loadAsFile(x$1, thePackage, callback$1) {
|
|
217
|
+
var loadAsFilePackage = thePackage;
|
|
218
|
+
var cb$1 = callback$1;
|
|
219
|
+
if (typeof loadAsFilePackage === "function") {
|
|
220
|
+
cb$1 = loadAsFilePackage;
|
|
221
|
+
loadAsFilePackage = void 0;
|
|
222
|
+
}
|
|
223
|
+
load([""].concat(extensions), x$1, loadAsFilePackage);
|
|
224
|
+
function load(exts, x$2, loadPackage) {
|
|
225
|
+
if (exts.length === 0) return cb$1(null, void 0, loadPackage);
|
|
226
|
+
var file = x$2 + exts[0];
|
|
227
|
+
var pkg = loadPackage;
|
|
228
|
+
if (pkg) onpkg(null, pkg);
|
|
229
|
+
else loadpkg(path$2.dirname(file), onpkg);
|
|
230
|
+
function onpkg(err$1, pkg_, dir) {
|
|
231
|
+
pkg = pkg_;
|
|
232
|
+
if (err$1) return cb$1(err$1);
|
|
233
|
+
if (dir && pkg && opts.pathFilter) {
|
|
234
|
+
var rfile = path$2.relative(dir, file);
|
|
235
|
+
var rel = rfile.slice(0, rfile.length - exts[0].length);
|
|
236
|
+
var r = opts.pathFilter(pkg, x$2, rel);
|
|
237
|
+
if (r) return load([""].concat(extensions.slice()), path$2.resolve(dir, r), pkg);
|
|
238
|
+
}
|
|
239
|
+
isFile(file, onex);
|
|
240
|
+
}
|
|
241
|
+
function onex(err$1, ex) {
|
|
242
|
+
if (err$1) return cb$1(err$1);
|
|
243
|
+
if (ex) return cb$1(null, file, pkg);
|
|
244
|
+
load(exts.slice(1), x$2, pkg);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
function loadpkg(dir, cb$1) {
|
|
249
|
+
if (dir === "" || dir === "/") return cb$1(null);
|
|
250
|
+
if (process.platform === "win32" && windowsDriveRegex$1.test(dir)) return cb$1(null);
|
|
251
|
+
if (nodeModulesRegex$1.test(dir)) return cb$1(null);
|
|
252
|
+
maybeRealpath(realpath$1, dir, opts, function(unwrapErr, pkgdir) {
|
|
253
|
+
if (unwrapErr) return loadpkg(path$2.dirname(dir), cb$1);
|
|
254
|
+
var pkgfile = path$2.join(pkgdir, "package.json");
|
|
255
|
+
isFile(pkgfile, function(err$1, ex) {
|
|
256
|
+
if (!ex) return loadpkg(path$2.dirname(dir), cb$1);
|
|
257
|
+
readPackage(readFile$2, pkgfile, function(err$2, pkgParam) {
|
|
258
|
+
if (err$2) cb$1(err$2);
|
|
259
|
+
var pkg = pkgParam;
|
|
260
|
+
if (pkg && opts.packageFilter) pkg = opts.packageFilter(pkg, pkgfile);
|
|
261
|
+
cb$1(null, pkg, dir);
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
function loadAsDirectory(x$1, loadAsDirectoryPackage, callback$1) {
|
|
267
|
+
var cb$1 = callback$1;
|
|
268
|
+
var fpkg = loadAsDirectoryPackage;
|
|
269
|
+
if (typeof fpkg === "function") {
|
|
270
|
+
cb$1 = fpkg;
|
|
271
|
+
fpkg = opts.package;
|
|
272
|
+
}
|
|
273
|
+
maybeRealpath(realpath$1, x$1, opts, function(unwrapErr, pkgdir) {
|
|
274
|
+
if (unwrapErr) return cb$1(unwrapErr);
|
|
275
|
+
var pkgfile = path$2.join(pkgdir, "package.json");
|
|
276
|
+
isFile(pkgfile, function(err$1, ex) {
|
|
277
|
+
if (err$1) return cb$1(err$1);
|
|
278
|
+
if (!ex) return loadAsFile(path$2.join(x$1, "index"), fpkg, cb$1);
|
|
279
|
+
readPackage(readFile$2, pkgfile, function(err$2, pkgParam) {
|
|
280
|
+
if (err$2) return cb$1(err$2);
|
|
281
|
+
var pkg = pkgParam;
|
|
282
|
+
if (pkg && opts.packageFilter) pkg = opts.packageFilter(pkg, pkgfile);
|
|
283
|
+
if (pkg && pkg.main) {
|
|
284
|
+
if (typeof pkg.main !== "string") {
|
|
285
|
+
var mainError = /* @__PURE__ */ new TypeError("package “" + pkg.name + "” `main` must be a string");
|
|
286
|
+
mainError.code = "INVALID_PACKAGE_MAIN";
|
|
287
|
+
return cb$1(mainError);
|
|
288
|
+
}
|
|
289
|
+
if (pkg.main === "." || pkg.main === "./") pkg.main = "index";
|
|
290
|
+
loadAsFile(path$2.resolve(x$1, pkg.main), pkg, function(err$3, m, pkg$1) {
|
|
291
|
+
if (err$3) return cb$1(err$3);
|
|
292
|
+
if (m) return cb$1(null, m, pkg$1);
|
|
293
|
+
if (!pkg$1) return loadAsFile(path$2.join(x$1, "index"), pkg$1, cb$1);
|
|
294
|
+
loadAsDirectory(path$2.resolve(x$1, pkg$1.main), pkg$1, function(err$4, n, pkg$2) {
|
|
295
|
+
if (err$4) return cb$1(err$4);
|
|
296
|
+
if (n) return cb$1(null, n, pkg$2);
|
|
297
|
+
loadAsFile(path$2.join(x$1, "index"), pkg$2, cb$1);
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
loadAsFile(path$2.join(x$1, "/index"), pkg, cb$1);
|
|
303
|
+
});
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
function processDirs(cb$1, dirs) {
|
|
308
|
+
if (dirs.length === 0) return cb$1(null, void 0);
|
|
309
|
+
var dir = dirs[0];
|
|
310
|
+
isDirectory(path$2.dirname(dir), isdir);
|
|
311
|
+
function isdir(err$1, isdir$1) {
|
|
312
|
+
if (err$1) return cb$1(err$1);
|
|
313
|
+
if (!isdir$1) return processDirs(cb$1, dirs.slice(1));
|
|
314
|
+
loadAsFile(dir, opts.package, onfile$1);
|
|
315
|
+
}
|
|
316
|
+
function onfile$1(err$1, m, pkg) {
|
|
317
|
+
if (err$1) return cb$1(err$1);
|
|
318
|
+
if (m) return cb$1(null, m, pkg);
|
|
319
|
+
loadAsDirectory(dir, opts.package, ondir);
|
|
320
|
+
}
|
|
321
|
+
function ondir(err$1, n, pkg) {
|
|
322
|
+
if (err$1) return cb$1(err$1);
|
|
323
|
+
if (n) return cb$1(null, n, pkg);
|
|
324
|
+
processDirs(cb$1, dirs.slice(1));
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
function loadNodeModules(x$1, start, cb$1) {
|
|
328
|
+
var thunk = function() {
|
|
329
|
+
return getPackageCandidates$1(x$1, start, opts);
|
|
330
|
+
};
|
|
331
|
+
processDirs(cb$1, packageIterator ? packageIterator(x$1, start, thunk, opts) : thunk());
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
}) });
|
|
335
|
+
|
|
336
|
+
//#endregion
|
|
337
|
+
//#region node_modules/.pnpm/resolve@1.22.11/node_modules/resolve/lib/core.json
|
|
338
|
+
var require_core$1 = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/resolve@1.22.11/node_modules/resolve/lib/core.json": ((exports, module) => {
|
|
339
|
+
module.exports = {
|
|
340
|
+
"assert": true,
|
|
341
|
+
"node:assert": [">= 14.18 && < 15", ">= 16"],
|
|
342
|
+
"assert/strict": ">= 15",
|
|
343
|
+
"node:assert/strict": ">= 16",
|
|
344
|
+
"async_hooks": ">= 8",
|
|
345
|
+
"node:async_hooks": [">= 14.18 && < 15", ">= 16"],
|
|
346
|
+
"buffer_ieee754": ">= 0.5 && < 0.9.7",
|
|
347
|
+
"buffer": true,
|
|
348
|
+
"node:buffer": [">= 14.18 && < 15", ">= 16"],
|
|
349
|
+
"child_process": true,
|
|
350
|
+
"node:child_process": [">= 14.18 && < 15", ">= 16"],
|
|
351
|
+
"cluster": ">= 0.5",
|
|
352
|
+
"node:cluster": [">= 14.18 && < 15", ">= 16"],
|
|
353
|
+
"console": true,
|
|
354
|
+
"node:console": [">= 14.18 && < 15", ">= 16"],
|
|
355
|
+
"constants": true,
|
|
356
|
+
"node:constants": [">= 14.18 && < 15", ">= 16"],
|
|
357
|
+
"crypto": true,
|
|
358
|
+
"node:crypto": [">= 14.18 && < 15", ">= 16"],
|
|
359
|
+
"_debug_agent": ">= 1 && < 8",
|
|
360
|
+
"_debugger": "< 8",
|
|
361
|
+
"dgram": true,
|
|
362
|
+
"node:dgram": [">= 14.18 && < 15", ">= 16"],
|
|
363
|
+
"diagnostics_channel": [">= 14.17 && < 15", ">= 15.1"],
|
|
364
|
+
"node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"],
|
|
365
|
+
"dns": true,
|
|
366
|
+
"node:dns": [">= 14.18 && < 15", ">= 16"],
|
|
367
|
+
"dns/promises": ">= 15",
|
|
368
|
+
"node:dns/promises": ">= 16",
|
|
369
|
+
"domain": ">= 0.7.12",
|
|
370
|
+
"node:domain": [">= 14.18 && < 15", ">= 16"],
|
|
371
|
+
"events": true,
|
|
372
|
+
"node:events": [">= 14.18 && < 15", ">= 16"],
|
|
373
|
+
"freelist": "< 6",
|
|
374
|
+
"fs": true,
|
|
375
|
+
"node:fs": [">= 14.18 && < 15", ">= 16"],
|
|
376
|
+
"fs/promises": [">= 10 && < 10.1", ">= 14"],
|
|
377
|
+
"node:fs/promises": [">= 14.18 && < 15", ">= 16"],
|
|
378
|
+
"_http_agent": ">= 0.11.1",
|
|
379
|
+
"node:_http_agent": [">= 14.18 && < 15", ">= 16"],
|
|
380
|
+
"_http_client": ">= 0.11.1",
|
|
381
|
+
"node:_http_client": [">= 14.18 && < 15", ">= 16"],
|
|
382
|
+
"_http_common": ">= 0.11.1",
|
|
383
|
+
"node:_http_common": [">= 14.18 && < 15", ">= 16"],
|
|
384
|
+
"_http_incoming": ">= 0.11.1",
|
|
385
|
+
"node:_http_incoming": [">= 14.18 && < 15", ">= 16"],
|
|
386
|
+
"_http_outgoing": ">= 0.11.1",
|
|
387
|
+
"node:_http_outgoing": [">= 14.18 && < 15", ">= 16"],
|
|
388
|
+
"_http_server": ">= 0.11.1",
|
|
389
|
+
"node:_http_server": [">= 14.18 && < 15", ">= 16"],
|
|
390
|
+
"http": true,
|
|
391
|
+
"node:http": [">= 14.18 && < 15", ">= 16"],
|
|
392
|
+
"http2": ">= 8.8",
|
|
393
|
+
"node:http2": [">= 14.18 && < 15", ">= 16"],
|
|
394
|
+
"https": true,
|
|
395
|
+
"node:https": [">= 14.18 && < 15", ">= 16"],
|
|
396
|
+
"inspector": ">= 8",
|
|
397
|
+
"node:inspector": [">= 14.18 && < 15", ">= 16"],
|
|
398
|
+
"inspector/promises": [">= 19"],
|
|
399
|
+
"node:inspector/promises": [">= 19"],
|
|
400
|
+
"_linklist": "< 8",
|
|
401
|
+
"module": true,
|
|
402
|
+
"node:module": [">= 14.18 && < 15", ">= 16"],
|
|
403
|
+
"net": true,
|
|
404
|
+
"node:net": [">= 14.18 && < 15", ">= 16"],
|
|
405
|
+
"node-inspect/lib/_inspect": ">= 7.6 && < 12",
|
|
406
|
+
"node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12",
|
|
407
|
+
"node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12",
|
|
408
|
+
"os": true,
|
|
409
|
+
"node:os": [">= 14.18 && < 15", ">= 16"],
|
|
410
|
+
"path": true,
|
|
411
|
+
"node:path": [">= 14.18 && < 15", ">= 16"],
|
|
412
|
+
"path/posix": ">= 15.3",
|
|
413
|
+
"node:path/posix": ">= 16",
|
|
414
|
+
"path/win32": ">= 15.3",
|
|
415
|
+
"node:path/win32": ">= 16",
|
|
416
|
+
"perf_hooks": ">= 8.5",
|
|
417
|
+
"node:perf_hooks": [">= 14.18 && < 15", ">= 16"],
|
|
418
|
+
"process": ">= 1",
|
|
419
|
+
"node:process": [">= 14.18 && < 15", ">= 16"],
|
|
420
|
+
"punycode": ">= 0.5",
|
|
421
|
+
"node:punycode": [">= 14.18 && < 15", ">= 16"],
|
|
422
|
+
"querystring": true,
|
|
423
|
+
"node:querystring": [">= 14.18 && < 15", ">= 16"],
|
|
424
|
+
"readline": true,
|
|
425
|
+
"node:readline": [">= 14.18 && < 15", ">= 16"],
|
|
426
|
+
"readline/promises": ">= 17",
|
|
427
|
+
"node:readline/promises": ">= 17",
|
|
428
|
+
"repl": true,
|
|
429
|
+
"node:repl": [">= 14.18 && < 15", ">= 16"],
|
|
430
|
+
"node:sea": [">= 20.12 && < 21", ">= 21.7"],
|
|
431
|
+
"smalloc": ">= 0.11.5 && < 3",
|
|
432
|
+
"node:sqlite": [">= 22.13 && < 23", ">= 23.4"],
|
|
433
|
+
"_stream_duplex": ">= 0.9.4",
|
|
434
|
+
"node:_stream_duplex": [">= 14.18 && < 15", ">= 16"],
|
|
435
|
+
"_stream_transform": ">= 0.9.4",
|
|
436
|
+
"node:_stream_transform": [">= 14.18 && < 15", ">= 16"],
|
|
437
|
+
"_stream_wrap": ">= 1.4.1",
|
|
438
|
+
"node:_stream_wrap": [">= 14.18 && < 15", ">= 16"],
|
|
439
|
+
"_stream_passthrough": ">= 0.9.4",
|
|
440
|
+
"node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"],
|
|
441
|
+
"_stream_readable": ">= 0.9.4",
|
|
442
|
+
"node:_stream_readable": [">= 14.18 && < 15", ">= 16"],
|
|
443
|
+
"_stream_writable": ">= 0.9.4",
|
|
444
|
+
"node:_stream_writable": [">= 14.18 && < 15", ">= 16"],
|
|
445
|
+
"stream": true,
|
|
446
|
+
"node:stream": [">= 14.18 && < 15", ">= 16"],
|
|
447
|
+
"stream/consumers": ">= 16.7",
|
|
448
|
+
"node:stream/consumers": ">= 16.7",
|
|
449
|
+
"stream/promises": ">= 15",
|
|
450
|
+
"node:stream/promises": ">= 16",
|
|
451
|
+
"stream/web": ">= 16.5",
|
|
452
|
+
"node:stream/web": ">= 16.5",
|
|
453
|
+
"string_decoder": true,
|
|
454
|
+
"node:string_decoder": [">= 14.18 && < 15", ">= 16"],
|
|
455
|
+
"sys": [">= 0.4 && < 0.7", ">= 0.8"],
|
|
456
|
+
"node:sys": [">= 14.18 && < 15", ">= 16"],
|
|
457
|
+
"test/reporters": ">= 19.9 && < 20.2",
|
|
458
|
+
"node:test/reporters": [
|
|
459
|
+
">= 18.17 && < 19",
|
|
460
|
+
">= 19.9",
|
|
461
|
+
">= 20"
|
|
462
|
+
],
|
|
463
|
+
"test/mock_loader": ">= 22.3 && < 22.7",
|
|
464
|
+
"node:test/mock_loader": ">= 22.3 && < 22.7",
|
|
465
|
+
"node:test": [">= 16.17 && < 17", ">= 18"],
|
|
466
|
+
"timers": true,
|
|
467
|
+
"node:timers": [">= 14.18 && < 15", ">= 16"],
|
|
468
|
+
"timers/promises": ">= 15",
|
|
469
|
+
"node:timers/promises": ">= 16",
|
|
470
|
+
"_tls_common": ">= 0.11.13",
|
|
471
|
+
"node:_tls_common": [">= 14.18 && < 15", ">= 16"],
|
|
472
|
+
"_tls_legacy": ">= 0.11.3 && < 10",
|
|
473
|
+
"_tls_wrap": ">= 0.11.3",
|
|
474
|
+
"node:_tls_wrap": [">= 14.18 && < 15", ">= 16"],
|
|
475
|
+
"tls": true,
|
|
476
|
+
"node:tls": [">= 14.18 && < 15", ">= 16"],
|
|
477
|
+
"trace_events": ">= 10",
|
|
478
|
+
"node:trace_events": [">= 14.18 && < 15", ">= 16"],
|
|
479
|
+
"tty": true,
|
|
480
|
+
"node:tty": [">= 14.18 && < 15", ">= 16"],
|
|
481
|
+
"url": true,
|
|
482
|
+
"node:url": [">= 14.18 && < 15", ">= 16"],
|
|
483
|
+
"util": true,
|
|
484
|
+
"node:util": [">= 14.18 && < 15", ">= 16"],
|
|
485
|
+
"util/types": ">= 15.3",
|
|
486
|
+
"node:util/types": ">= 16",
|
|
487
|
+
"v8/tools/arguments": ">= 10 && < 12",
|
|
488
|
+
"v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
|
489
|
+
"v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
|
490
|
+
"v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
|
491
|
+
"v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
|
492
|
+
"v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
|
493
|
+
"v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
|
494
|
+
"v8": ">= 1",
|
|
495
|
+
"node:v8": [">= 14.18 && < 15", ">= 16"],
|
|
496
|
+
"vm": true,
|
|
497
|
+
"node:vm": [">= 14.18 && < 15", ">= 16"],
|
|
498
|
+
"wasi": [
|
|
499
|
+
">= 13.4 && < 13.5",
|
|
500
|
+
">= 18.17 && < 19",
|
|
501
|
+
">= 20"
|
|
502
|
+
],
|
|
503
|
+
"node:wasi": [">= 18.17 && < 19", ">= 20"],
|
|
504
|
+
"worker_threads": ">= 11.7",
|
|
505
|
+
"node:worker_threads": [">= 14.18 && < 15", ">= 16"],
|
|
506
|
+
"zlib": ">= 0.5",
|
|
507
|
+
"node:zlib": [">= 14.18 && < 15", ">= 16"]
|
|
508
|
+
};
|
|
509
|
+
}) });
|
|
510
|
+
|
|
511
|
+
//#endregion
|
|
512
|
+
//#region node_modules/.pnpm/resolve@1.22.11/node_modules/resolve/lib/core.js
|
|
513
|
+
var require_core = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/resolve@1.22.11/node_modules/resolve/lib/core.js": ((exports, module) => {
|
|
514
|
+
var isCoreModule$1 = require_is_core_module();
|
|
515
|
+
var data = require_core$1();
|
|
516
|
+
var core = {};
|
|
517
|
+
for (var mod in data) if (Object.prototype.hasOwnProperty.call(data, mod)) core[mod] = isCoreModule$1(mod);
|
|
518
|
+
module.exports = core;
|
|
519
|
+
}) });
|
|
520
|
+
|
|
521
|
+
//#endregion
|
|
522
|
+
//#region node_modules/.pnpm/resolve@1.22.11/node_modules/resolve/lib/is-core.js
|
|
523
|
+
var require_is_core = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/resolve@1.22.11/node_modules/resolve/lib/is-core.js": ((exports, module) => {
|
|
524
|
+
var isCoreModule = require_is_core_module();
|
|
525
|
+
module.exports = function isCore$2(x) {
|
|
526
|
+
return isCoreModule(x);
|
|
527
|
+
};
|
|
528
|
+
}) });
|
|
529
|
+
|
|
530
|
+
//#endregion
|
|
531
|
+
//#region node_modules/.pnpm/resolve@1.22.11/node_modules/resolve/lib/sync.js
|
|
532
|
+
var require_sync = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/resolve@1.22.11/node_modules/resolve/lib/sync.js": ((exports, module) => {
|
|
533
|
+
var isCore = require_is_core_module();
|
|
534
|
+
var fs = __require("fs");
|
|
535
|
+
var path$1 = __require("path");
|
|
536
|
+
var getHomedir = require_homedir();
|
|
537
|
+
var caller = require_caller();
|
|
538
|
+
var nodeModulesPaths = require_node_modules_paths();
|
|
539
|
+
var normalizeOptions = require_normalize_options();
|
|
540
|
+
var realpathFS = process.platform !== "win32" && fs.realpathSync && typeof fs.realpathSync.native === "function" ? fs.realpathSync.native : fs.realpathSync;
|
|
541
|
+
var relativePathRegex = /^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/;
|
|
542
|
+
var windowsDriveRegex = /^\w:[/\\]*$/;
|
|
543
|
+
var nodeModulesRegex = /[/\\]node_modules[/\\]*$/;
|
|
544
|
+
var homedir = getHomedir();
|
|
545
|
+
var defaultPaths = function() {
|
|
546
|
+
return [path$1.join(homedir, ".node_modules"), path$1.join(homedir, ".node_libraries")];
|
|
547
|
+
};
|
|
548
|
+
var defaultIsFile = function isFile(file) {
|
|
549
|
+
try {
|
|
550
|
+
var stat$2 = fs.statSync(file, { throwIfNoEntry: false });
|
|
551
|
+
} catch (e) {
|
|
552
|
+
if (e && (e.code === "ENOENT" || e.code === "ENOTDIR")) return false;
|
|
553
|
+
throw e;
|
|
554
|
+
}
|
|
555
|
+
return !!stat$2 && (stat$2.isFile() || stat$2.isFIFO());
|
|
556
|
+
};
|
|
557
|
+
var defaultIsDir = function isDirectory(dir) {
|
|
558
|
+
try {
|
|
559
|
+
var stat$2 = fs.statSync(dir, { throwIfNoEntry: false });
|
|
560
|
+
} catch (e) {
|
|
561
|
+
if (e && (e.code === "ENOENT" || e.code === "ENOTDIR")) return false;
|
|
562
|
+
throw e;
|
|
563
|
+
}
|
|
564
|
+
return !!stat$2 && stat$2.isDirectory();
|
|
565
|
+
};
|
|
566
|
+
var defaultRealpathSync = function realpathSync$1(x) {
|
|
567
|
+
try {
|
|
568
|
+
return realpathFS(x);
|
|
569
|
+
} catch (realpathErr) {
|
|
570
|
+
if (realpathErr.code !== "ENOENT") throw realpathErr;
|
|
571
|
+
}
|
|
572
|
+
return x;
|
|
573
|
+
};
|
|
574
|
+
var maybeRealpathSync = function maybeRealpathSync$1(realpathSync$1, x, opts) {
|
|
575
|
+
if (opts && opts.preserveSymlinks === false) return realpathSync$1(x);
|
|
576
|
+
return x;
|
|
577
|
+
};
|
|
578
|
+
var defaultReadPackageSync = function defaultReadPackageSync$1(readFileSync$1, pkgfile) {
|
|
579
|
+
var body = readFileSync$1(pkgfile);
|
|
580
|
+
try {
|
|
581
|
+
return JSON.parse(body);
|
|
582
|
+
} catch (jsonErr) {}
|
|
583
|
+
};
|
|
584
|
+
var getPackageCandidates = function getPackageCandidates$2(x, start, opts) {
|
|
585
|
+
var dirs = nodeModulesPaths(start, opts, x);
|
|
586
|
+
for (var i = 0; i < dirs.length; i++) dirs[i] = path$1.join(dirs[i], x);
|
|
587
|
+
return dirs;
|
|
588
|
+
};
|
|
589
|
+
module.exports = function resolveSync(x, options) {
|
|
590
|
+
if (typeof x !== "string") throw new TypeError("Path must be a string.");
|
|
591
|
+
var opts = normalizeOptions(x, options);
|
|
592
|
+
var isFile = opts.isFile || defaultIsFile;
|
|
593
|
+
var readFileSync$1 = opts.readFileSync || fs.readFileSync;
|
|
594
|
+
var isDirectory = opts.isDirectory || defaultIsDir;
|
|
595
|
+
var realpathSync$1 = opts.realpathSync || defaultRealpathSync;
|
|
596
|
+
var readPackageSync = opts.readPackageSync || defaultReadPackageSync;
|
|
597
|
+
if (opts.readFileSync && opts.readPackageSync) throw new TypeError("`readFileSync` and `readPackageSync` are mutually exclusive.");
|
|
598
|
+
var packageIterator = opts.packageIterator;
|
|
599
|
+
var extensions = opts.extensions || [".js"];
|
|
600
|
+
var includeCoreModules = opts.includeCoreModules !== false;
|
|
601
|
+
var basedir = opts.basedir || path$1.dirname(caller());
|
|
602
|
+
var parent = opts.filename || basedir;
|
|
603
|
+
opts.paths = opts.paths || defaultPaths();
|
|
604
|
+
var absoluteStart = maybeRealpathSync(realpathSync$1, path$1.resolve(basedir), opts);
|
|
605
|
+
if (relativePathRegex.test(x)) {
|
|
606
|
+
var res = path$1.resolve(absoluteStart, x);
|
|
607
|
+
if (x === "." || x === ".." || x.slice(-1) === "/") res += "/";
|
|
608
|
+
var m = loadAsFileSync(res) || loadAsDirectorySync(res);
|
|
609
|
+
if (m) return maybeRealpathSync(realpathSync$1, m, opts);
|
|
610
|
+
} else if (includeCoreModules && isCore(x)) return x;
|
|
611
|
+
else {
|
|
612
|
+
var n = loadNodeModulesSync(x, absoluteStart);
|
|
613
|
+
if (n) return maybeRealpathSync(realpathSync$1, n, opts);
|
|
614
|
+
}
|
|
615
|
+
var err = /* @__PURE__ */ new Error("Cannot find module '" + x + "' from '" + parent + "'");
|
|
616
|
+
err.code = "MODULE_NOT_FOUND";
|
|
617
|
+
throw err;
|
|
618
|
+
function loadAsFileSync(x$1) {
|
|
619
|
+
var pkg = loadpkg(path$1.dirname(x$1));
|
|
620
|
+
if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) {
|
|
621
|
+
var rfile = path$1.relative(pkg.dir, x$1);
|
|
622
|
+
var r = opts.pathFilter(pkg.pkg, x$1, rfile);
|
|
623
|
+
if (r) x$1 = path$1.resolve(pkg.dir, r);
|
|
624
|
+
}
|
|
625
|
+
if (isFile(x$1)) return x$1;
|
|
626
|
+
for (var i = 0; i < extensions.length; i++) {
|
|
627
|
+
var file = x$1 + extensions[i];
|
|
628
|
+
if (isFile(file)) return file;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
function loadpkg(dir) {
|
|
632
|
+
if (dir === "" || dir === "/") return;
|
|
633
|
+
if (process.platform === "win32" && windowsDriveRegex.test(dir)) return;
|
|
634
|
+
if (nodeModulesRegex.test(dir)) return;
|
|
635
|
+
var pkgfile = path$1.join(maybeRealpathSync(realpathSync$1, dir, opts), "package.json");
|
|
636
|
+
if (!isFile(pkgfile)) return loadpkg(path$1.dirname(dir));
|
|
637
|
+
var pkg = readPackageSync(readFileSync$1, pkgfile);
|
|
638
|
+
if (pkg && opts.packageFilter) pkg = opts.packageFilter(pkg, dir);
|
|
639
|
+
return {
|
|
640
|
+
pkg,
|
|
641
|
+
dir
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
function loadAsDirectorySync(x$1) {
|
|
645
|
+
var pkgfile = path$1.join(maybeRealpathSync(realpathSync$1, x$1, opts), "/package.json");
|
|
646
|
+
if (isFile(pkgfile)) {
|
|
647
|
+
try {
|
|
648
|
+
var pkg = readPackageSync(readFileSync$1, pkgfile);
|
|
649
|
+
} catch (e) {}
|
|
650
|
+
if (pkg && opts.packageFilter) pkg = opts.packageFilter(pkg, x$1);
|
|
651
|
+
if (pkg && pkg.main) {
|
|
652
|
+
if (typeof pkg.main !== "string") {
|
|
653
|
+
var mainError = /* @__PURE__ */ new TypeError("package “" + pkg.name + "” `main` must be a string");
|
|
654
|
+
mainError.code = "INVALID_PACKAGE_MAIN";
|
|
655
|
+
throw mainError;
|
|
656
|
+
}
|
|
657
|
+
if (pkg.main === "." || pkg.main === "./") pkg.main = "index";
|
|
658
|
+
try {
|
|
659
|
+
var m$1 = loadAsFileSync(path$1.resolve(x$1, pkg.main));
|
|
660
|
+
if (m$1) return m$1;
|
|
661
|
+
var n$1 = loadAsDirectorySync(path$1.resolve(x$1, pkg.main));
|
|
662
|
+
if (n$1) return n$1;
|
|
663
|
+
} catch (e) {}
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
return loadAsFileSync(path$1.join(x$1, "/index"));
|
|
667
|
+
}
|
|
668
|
+
function loadNodeModulesSync(x$1, start) {
|
|
669
|
+
var thunk = function() {
|
|
670
|
+
return getPackageCandidates(x$1, start, opts);
|
|
671
|
+
};
|
|
672
|
+
var dirs = packageIterator ? packageIterator(x$1, start, thunk, opts) : thunk();
|
|
673
|
+
for (var i = 0; i < dirs.length; i++) {
|
|
674
|
+
var dir = dirs[i];
|
|
675
|
+
if (isDirectory(path$1.dirname(dir))) {
|
|
676
|
+
var m$1 = loadAsFileSync(dir);
|
|
677
|
+
if (m$1) return m$1;
|
|
678
|
+
var n$1 = loadAsDirectorySync(dir);
|
|
679
|
+
if (n$1) return n$1;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
};
|
|
684
|
+
}) });
|
|
685
|
+
|
|
686
|
+
//#endregion
|
|
687
|
+
//#region node_modules/.pnpm/resolve@1.22.11/node_modules/resolve/index.js
|
|
688
|
+
var require_resolve = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/resolve@1.22.11/node_modules/resolve/index.js": ((exports, module) => {
|
|
689
|
+
var async = require_async();
|
|
690
|
+
async.core = require_core();
|
|
691
|
+
async.isCore = require_is_core();
|
|
692
|
+
async.sync = require_sync();
|
|
693
|
+
module.exports = async;
|
|
694
|
+
}) });
|
|
695
|
+
|
|
696
|
+
//#endregion
|
|
697
|
+
//#region node_modules/.pnpm/@rollup+plugin-node-resolve@16.0.3_rollup@4.52.5/node_modules/@rollup/plugin-node-resolve/dist/es/index.js
|
|
698
|
+
var import_cjs = /* @__PURE__ */ __toESM(require_cjs(), 1);
|
|
699
|
+
var import_is_module = /* @__PURE__ */ __toESM(require_is_module(), 1);
|
|
700
|
+
var import_resolve = /* @__PURE__ */ __toESM(require_resolve(), 1);
|
|
701
|
+
var version = "16.0.3";
|
|
702
|
+
var peerDependencies = { rollup: "^2.78.0||^3.0.0||^4.0.0" };
|
|
703
|
+
promisify(nativeFs.access);
|
|
704
|
+
const readFile$1 = promisify(nativeFs.readFile);
|
|
705
|
+
const realpath = promisify(nativeFs.realpath);
|
|
706
|
+
const stat$1 = promisify(nativeFs.stat);
|
|
707
|
+
async function fileExists(filePath) {
|
|
708
|
+
try {
|
|
709
|
+
return (await stat$1(filePath)).isFile();
|
|
710
|
+
} catch {
|
|
711
|
+
return false;
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
async function resolveSymlink(path$4) {
|
|
715
|
+
return await fileExists(path$4) ? realpath(path$4) : path$4;
|
|
716
|
+
}
|
|
717
|
+
const onError = (error) => {
|
|
718
|
+
if (error.code === "ENOENT") return false;
|
|
719
|
+
throw error;
|
|
720
|
+
};
|
|
721
|
+
const makeCache = (fn) => {
|
|
722
|
+
const cache = /* @__PURE__ */ new Map();
|
|
723
|
+
const wrapped = async (param, done) => {
|
|
724
|
+
if (cache.has(param) === false) cache.set(param, fn(param).catch((err) => {
|
|
725
|
+
cache.delete(param);
|
|
726
|
+
throw err;
|
|
727
|
+
}));
|
|
728
|
+
try {
|
|
729
|
+
return done(null, await cache.get(param));
|
|
730
|
+
} catch (error) {
|
|
731
|
+
return done(error);
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
wrapped.clear = () => cache.clear();
|
|
735
|
+
return wrapped;
|
|
736
|
+
};
|
|
737
|
+
const isDirCached = makeCache(async (file) => {
|
|
738
|
+
try {
|
|
739
|
+
return (await stat$1(file)).isDirectory();
|
|
740
|
+
} catch (error) {
|
|
741
|
+
return onError(error);
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
const isFileCached = makeCache(async (file) => {
|
|
745
|
+
try {
|
|
746
|
+
return (await stat$1(file)).isFile();
|
|
747
|
+
} catch (error) {
|
|
748
|
+
return onError(error);
|
|
749
|
+
}
|
|
750
|
+
});
|
|
751
|
+
const readCachedFile = makeCache(readFile$1);
|
|
752
|
+
function handleDeprecatedOptions(opts) {
|
|
753
|
+
const warnings = [];
|
|
754
|
+
if (opts.customResolveOptions) {
|
|
755
|
+
const { customResolveOptions } = opts;
|
|
756
|
+
if (customResolveOptions.moduleDirectory) {
|
|
757
|
+
opts.moduleDirectories = Array.isArray(customResolveOptions.moduleDirectory) ? customResolveOptions.moduleDirectory : [customResolveOptions.moduleDirectory];
|
|
758
|
+
warnings.push("node-resolve: The `customResolveOptions.moduleDirectory` option has been deprecated. Use `moduleDirectories`, which must be an array.");
|
|
759
|
+
}
|
|
760
|
+
if (customResolveOptions.preserveSymlinks) throw new Error("node-resolve: `customResolveOptions.preserveSymlinks` is no longer an option. We now always use the rollup `preserveSymlinks` option.");
|
|
761
|
+
[
|
|
762
|
+
"basedir",
|
|
763
|
+
"package",
|
|
764
|
+
"extensions",
|
|
765
|
+
"includeCoreModules",
|
|
766
|
+
"readFile",
|
|
767
|
+
"isFile",
|
|
768
|
+
"isDirectory",
|
|
769
|
+
"realpath",
|
|
770
|
+
"packageFilter",
|
|
771
|
+
"pathFilter",
|
|
772
|
+
"paths",
|
|
773
|
+
"packageIterator"
|
|
774
|
+
].forEach((resolveOption) => {
|
|
775
|
+
if (customResolveOptions[resolveOption]) throw new Error(`node-resolve: \`customResolveOptions.${resolveOption}\` is no longer an option. If you need this, please open an issue.`);
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
return { warnings };
|
|
779
|
+
}
|
|
780
|
+
function getPackageName(id) {
|
|
781
|
+
if (id.startsWith(".") || id.startsWith("/")) return null;
|
|
782
|
+
const split = id.split("/");
|
|
783
|
+
if (split[0][0] === "@") return `${split[0]}/${split[1]}`;
|
|
784
|
+
return split[0];
|
|
785
|
+
}
|
|
786
|
+
function getMainFields(options) {
|
|
787
|
+
let mainFields;
|
|
788
|
+
if (options.mainFields) ({mainFields} = options);
|
|
789
|
+
else mainFields = ["module", "main"];
|
|
790
|
+
if (options.browser && mainFields.indexOf("browser") === -1) return ["browser"].concat(mainFields);
|
|
791
|
+
if (!mainFields.length) throw new Error("Please ensure at least one `mainFields` value is specified");
|
|
792
|
+
return mainFields;
|
|
793
|
+
}
|
|
794
|
+
function getPackageInfo(options) {
|
|
795
|
+
const { cache, extensions, pkg, mainFields, preserveSymlinks, useBrowserOverrides, rootDir, ignoreSideEffectsForRoot } = options;
|
|
796
|
+
let { pkgPath } = options;
|
|
797
|
+
if (cache.has(pkgPath)) return cache.get(pkgPath);
|
|
798
|
+
if (!preserveSymlinks) pkgPath = realpathSync(pkgPath);
|
|
799
|
+
const pkgRoot = dirname(pkgPath);
|
|
800
|
+
const packageInfo = {
|
|
801
|
+
packageJson: { ...pkg },
|
|
802
|
+
packageJsonPath: pkgPath,
|
|
803
|
+
root: pkgRoot,
|
|
804
|
+
resolvedMainField: "main",
|
|
805
|
+
browserMappedMain: false,
|
|
806
|
+
resolvedEntryPoint: ""
|
|
807
|
+
};
|
|
808
|
+
let overriddenMain = false;
|
|
809
|
+
for (let i = 0; i < mainFields.length; i++) {
|
|
810
|
+
const field = mainFields[i];
|
|
811
|
+
if (typeof pkg[field] === "string") {
|
|
812
|
+
pkg.main = pkg[field];
|
|
813
|
+
packageInfo.resolvedMainField = field;
|
|
814
|
+
overriddenMain = true;
|
|
815
|
+
break;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
const internalPackageInfo = {
|
|
819
|
+
cachedPkg: pkg,
|
|
820
|
+
hasModuleSideEffects: () => null,
|
|
821
|
+
hasPackageEntry: overriddenMain !== false || mainFields.indexOf("main") !== -1,
|
|
822
|
+
packageBrowserField: useBrowserOverrides && typeof pkg.browser === "object" && Object.keys(pkg.browser).reduce((browser, key) => {
|
|
823
|
+
let resolved = pkg.browser[key];
|
|
824
|
+
if (resolved && resolved[0] === ".") resolved = resolve(pkgRoot, resolved);
|
|
825
|
+
browser[key] = resolved;
|
|
826
|
+
if (key[0] === ".") {
|
|
827
|
+
const absoluteKey = resolve(pkgRoot, key);
|
|
828
|
+
browser[absoluteKey] = resolved;
|
|
829
|
+
if (!extname(key)) extensions.reduce((subBrowser, ext) => {
|
|
830
|
+
subBrowser[absoluteKey + ext] = subBrowser[key];
|
|
831
|
+
return subBrowser;
|
|
832
|
+
}, browser);
|
|
833
|
+
}
|
|
834
|
+
return browser;
|
|
835
|
+
}, {}),
|
|
836
|
+
packageInfo
|
|
837
|
+
};
|
|
838
|
+
const browserMap = internalPackageInfo.packageBrowserField;
|
|
839
|
+
if (useBrowserOverrides && typeof pkg.browser === "object" && browserMap.hasOwnProperty(pkg.main)) {
|
|
840
|
+
packageInfo.resolvedEntryPoint = browserMap[pkg.main];
|
|
841
|
+
packageInfo.browserMappedMain = true;
|
|
842
|
+
} else {
|
|
843
|
+
packageInfo.resolvedEntryPoint = resolve(pkgRoot, pkg.main || "index.js");
|
|
844
|
+
packageInfo.browserMappedMain = false;
|
|
845
|
+
}
|
|
846
|
+
if (!ignoreSideEffectsForRoot || rootDir !== pkgRoot) {
|
|
847
|
+
const packageSideEffects = pkg.sideEffects;
|
|
848
|
+
if (typeof packageSideEffects === "boolean") internalPackageInfo.hasModuleSideEffects = () => packageSideEffects;
|
|
849
|
+
else if (Array.isArray(packageSideEffects)) internalPackageInfo.hasModuleSideEffects = createFilter(packageSideEffects.map((sideEffect) => {
|
|
850
|
+
if (sideEffect.includes("/")) return sideEffect;
|
|
851
|
+
return `**/${sideEffect}`;
|
|
852
|
+
}), null, { resolve: pkgRoot });
|
|
853
|
+
}
|
|
854
|
+
cache.set(pkgPath, internalPackageInfo);
|
|
855
|
+
return internalPackageInfo;
|
|
856
|
+
}
|
|
857
|
+
function normalizeInput(input) {
|
|
858
|
+
if (Array.isArray(input)) return input;
|
|
859
|
+
else if (typeof input === "object") return Object.values(input);
|
|
860
|
+
return [input];
|
|
861
|
+
}
|
|
862
|
+
function isModuleDir(current, moduleDirs) {
|
|
863
|
+
return moduleDirs.some((dir) => current.endsWith(dir));
|
|
864
|
+
}
|
|
865
|
+
async function findPackageJson(base, moduleDirs) {
|
|
866
|
+
const { root } = path.parse(base);
|
|
867
|
+
let current = base;
|
|
868
|
+
while (current !== root && !isModuleDir(current, moduleDirs)) {
|
|
869
|
+
const pkgJsonPath = path.join(current, "package.json");
|
|
870
|
+
if (await fileExists(pkgJsonPath)) {
|
|
871
|
+
const pkgJsonString = nativeFs.readFileSync(pkgJsonPath, "utf-8");
|
|
872
|
+
return {
|
|
873
|
+
pkgJson: JSON.parse(pkgJsonString),
|
|
874
|
+
pkgPath: current,
|
|
875
|
+
pkgJsonPath
|
|
876
|
+
};
|
|
877
|
+
}
|
|
878
|
+
current = path.resolve(current, "..");
|
|
879
|
+
}
|
|
880
|
+
return null;
|
|
881
|
+
}
|
|
882
|
+
function isUrl(str) {
|
|
883
|
+
try {
|
|
884
|
+
return !!new URL(str);
|
|
885
|
+
} catch (_) {
|
|
886
|
+
return false;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Conditions is an export object where all keys are conditions like 'node' (aka do not with '.')
|
|
891
|
+
*/
|
|
892
|
+
function isConditions(exports) {
|
|
893
|
+
return typeof exports === "object" && Object.keys(exports).every((k) => !k.startsWith("."));
|
|
894
|
+
}
|
|
895
|
+
/**
|
|
896
|
+
* Mappings is an export object where all keys start with '.
|
|
897
|
+
*/
|
|
898
|
+
function isMappings(exports) {
|
|
899
|
+
return typeof exports === "object" && !isConditions(exports);
|
|
900
|
+
}
|
|
901
|
+
/**
|
|
902
|
+
* Check for mixed exports, which are exports where some keys start with '.' and some do not
|
|
903
|
+
*/
|
|
904
|
+
function isMixedExports(exports) {
|
|
905
|
+
const keys = Object.keys(exports);
|
|
906
|
+
return keys.some((k) => k.startsWith(".")) && keys.some((k) => !k.startsWith("."));
|
|
907
|
+
}
|
|
908
|
+
function createBaseErrorMsg(importSpecifier, importer) {
|
|
909
|
+
return `Could not resolve import "${importSpecifier}" in ${importer}`;
|
|
910
|
+
}
|
|
911
|
+
function createErrorMsg(context, reason, isImports) {
|
|
912
|
+
const { importSpecifier, importer, pkgJsonPath } = context;
|
|
913
|
+
return `${createBaseErrorMsg(importSpecifier, importer)} using ${isImports ? "imports" : "exports"} defined in ${pkgJsonPath}.${reason ? ` ${reason}` : ""}`;
|
|
914
|
+
}
|
|
915
|
+
var ResolveError = class extends Error {};
|
|
916
|
+
var InvalidConfigurationError = class extends ResolveError {
|
|
917
|
+
constructor(context, reason) {
|
|
918
|
+
super(createErrorMsg(context, `Invalid "exports" field. ${reason}`));
|
|
919
|
+
}
|
|
920
|
+
};
|
|
921
|
+
var InvalidModuleSpecifierError = class extends ResolveError {
|
|
922
|
+
constructor(context, isImports, reason) {
|
|
923
|
+
super(createErrorMsg(context, reason, isImports));
|
|
924
|
+
}
|
|
925
|
+
};
|
|
926
|
+
var InvalidPackageTargetError = class extends ResolveError {
|
|
927
|
+
constructor(context, reason) {
|
|
928
|
+
super(createErrorMsg(context, reason));
|
|
929
|
+
}
|
|
930
|
+
};
|
|
931
|
+
/**
|
|
932
|
+
* Check for invalid path segments
|
|
933
|
+
*/
|
|
934
|
+
function includesInvalidSegments(pathSegments, moduleDirs) {
|
|
935
|
+
const invalidSegments = [
|
|
936
|
+
"",
|
|
937
|
+
".",
|
|
938
|
+
"..",
|
|
939
|
+
...moduleDirs
|
|
940
|
+
];
|
|
941
|
+
return pathSegments.some((v) => invalidSegments.includes(v) || invalidSegments.includes(decodeURI(v)));
|
|
942
|
+
}
|
|
943
|
+
async function resolvePackageTarget(context, { target, patternMatch, isImports }) {
|
|
944
|
+
if (typeof target === "string") {
|
|
945
|
+
if (!target.startsWith("./")) {
|
|
946
|
+
if (!isImports || ["/", "../"].some((p) => target.startsWith(p)) || isUrl(target)) throw new InvalidPackageTargetError(context, `Invalid mapping: "${target}".`);
|
|
947
|
+
if (typeof patternMatch === "string") {
|
|
948
|
+
const result$1 = await context.resolveId(target.replace(/\*/g, patternMatch), context.pkgURL.href);
|
|
949
|
+
return result$1 ? pathToFileURL(result$1.location).href : null;
|
|
950
|
+
}
|
|
951
|
+
const result = await context.resolveId(target, context.pkgURL.href);
|
|
952
|
+
return result ? pathToFileURL(result.location).href : null;
|
|
953
|
+
}
|
|
954
|
+
if (context.allowExportsFolderMapping) target = target.replace(/\/$/, "/*");
|
|
955
|
+
{
|
|
956
|
+
const pathSegments = target.split(/\/|\\/);
|
|
957
|
+
const firstDot = pathSegments.indexOf(".");
|
|
958
|
+
firstDot !== -1 && pathSegments.slice(firstDot);
|
|
959
|
+
if (firstDot !== -1 && firstDot < pathSegments.length - 1 && includesInvalidSegments(pathSegments.slice(firstDot + 1), context.moduleDirs)) throw new InvalidPackageTargetError(context, `Invalid mapping: "${target}".`);
|
|
960
|
+
}
|
|
961
|
+
const resolvedTarget = new URL(target, context.pkgURL);
|
|
962
|
+
if (!resolvedTarget.href.startsWith(context.pkgURL.href)) throw new InvalidPackageTargetError(context, `Resolved to ${resolvedTarget.href} which is outside package ${context.pkgURL.href}`);
|
|
963
|
+
if (!patternMatch) return resolvedTarget;
|
|
964
|
+
if (includesInvalidSegments(patternMatch.split(/\/|\\/), context.moduleDirs)) throw new InvalidModuleSpecifierError(context);
|
|
965
|
+
return resolvedTarget.href.replace(/\*/g, patternMatch);
|
|
966
|
+
}
|
|
967
|
+
if (Array.isArray(target)) {
|
|
968
|
+
if (target.length === 0) return null;
|
|
969
|
+
let lastError = null;
|
|
970
|
+
for (const item of target) try {
|
|
971
|
+
const resolved = await resolvePackageTarget(context, {
|
|
972
|
+
target: item,
|
|
973
|
+
patternMatch,
|
|
974
|
+
isImports
|
|
975
|
+
});
|
|
976
|
+
if (resolved !== void 0) return resolved;
|
|
977
|
+
} catch (error) {
|
|
978
|
+
if (!(error instanceof InvalidPackageTargetError)) throw error;
|
|
979
|
+
else lastError = error;
|
|
980
|
+
}
|
|
981
|
+
if (lastError) throw lastError;
|
|
982
|
+
return null;
|
|
983
|
+
}
|
|
984
|
+
if (target && typeof target === "object") {
|
|
985
|
+
for (const [key, value] of Object.entries(target)) if (key === "default" || context.conditions.includes(key)) {
|
|
986
|
+
const resolved = await resolvePackageTarget(context, {
|
|
987
|
+
target: value,
|
|
988
|
+
patternMatch,
|
|
989
|
+
isImports
|
|
990
|
+
});
|
|
991
|
+
if (resolved !== void 0) return resolved;
|
|
992
|
+
}
|
|
993
|
+
return;
|
|
994
|
+
}
|
|
995
|
+
if (target === null) return null;
|
|
996
|
+
throw new InvalidPackageTargetError(context, `Invalid exports field.`);
|
|
997
|
+
}
|
|
998
|
+
/**
|
|
999
|
+
* Implementation of Node's `PATTERN_KEY_COMPARE` function
|
|
1000
|
+
*/
|
|
1001
|
+
function nodePatternKeyCompare(keyA, keyB) {
|
|
1002
|
+
const baseLengthA = keyA.includes("*") ? keyA.indexOf("*") + 1 : keyA.length;
|
|
1003
|
+
const rval = (keyB.includes("*") ? keyB.indexOf("*") + 1 : keyB.length) - baseLengthA;
|
|
1004
|
+
if (rval !== 0) return rval;
|
|
1005
|
+
if (!keyA.includes("*")) return 1;
|
|
1006
|
+
if (!keyB.includes("*")) return -1;
|
|
1007
|
+
return keyB.length - keyA.length;
|
|
1008
|
+
}
|
|
1009
|
+
async function resolvePackageImportsExports(context, { matchKey, matchObj, isImports }) {
|
|
1010
|
+
if (!matchKey.includes("*") && matchKey in matchObj) {
|
|
1011
|
+
const target = matchObj[matchKey];
|
|
1012
|
+
return await resolvePackageTarget(context, {
|
|
1013
|
+
target,
|
|
1014
|
+
patternMatch: "",
|
|
1015
|
+
isImports
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
const expansionKeys = Object.keys(matchObj).filter((k) => k.endsWith("/") || k.includes("*")).sort(nodePatternKeyCompare);
|
|
1019
|
+
for (const expansionKey of expansionKeys) {
|
|
1020
|
+
const indexOfAsterisk = expansionKey.indexOf("*");
|
|
1021
|
+
const patternBase = indexOfAsterisk === -1 ? expansionKey : expansionKey.substring(0, indexOfAsterisk);
|
|
1022
|
+
if (matchKey.startsWith(patternBase) && matchKey !== patternBase) {
|
|
1023
|
+
const patternTrailer = indexOfAsterisk !== -1 ? expansionKey.substring(indexOfAsterisk + 1) : "";
|
|
1024
|
+
if (patternTrailer.length === 0 || matchKey.endsWith(patternTrailer) && matchKey.length >= expansionKey.length) {
|
|
1025
|
+
const target = matchObj[expansionKey];
|
|
1026
|
+
return await resolvePackageTarget(context, {
|
|
1027
|
+
target,
|
|
1028
|
+
patternMatch: matchKey.substring(patternBase.length, matchKey.length - patternTrailer.length),
|
|
1029
|
+
isImports
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
throw new InvalidModuleSpecifierError(context, isImports);
|
|
1035
|
+
}
|
|
1036
|
+
/**
|
|
1037
|
+
* Implementation of PACKAGE_EXPORTS_RESOLVE
|
|
1038
|
+
*/
|
|
1039
|
+
async function resolvePackageExports(context, subpath, exports) {
|
|
1040
|
+
if (isMixedExports(exports)) throw new InvalidConfigurationError(context, "All keys must either start with ./, or without one.");
|
|
1041
|
+
if (subpath === ".") {
|
|
1042
|
+
let mainExport;
|
|
1043
|
+
if (typeof exports === "string" || Array.isArray(exports) || isConditions(exports)) mainExport = exports;
|
|
1044
|
+
else if (isMappings(exports)) mainExport = exports["."];
|
|
1045
|
+
if (mainExport) {
|
|
1046
|
+
const resolved = await resolvePackageTarget(context, {
|
|
1047
|
+
target: mainExport,
|
|
1048
|
+
patternMatch: "",
|
|
1049
|
+
isImports: false
|
|
1050
|
+
});
|
|
1051
|
+
if (resolved) return resolved;
|
|
1052
|
+
}
|
|
1053
|
+
} else if (isMappings(exports)) {
|
|
1054
|
+
const resolvedMatch = await resolvePackageImportsExports(context, {
|
|
1055
|
+
matchKey: subpath,
|
|
1056
|
+
matchObj: exports,
|
|
1057
|
+
isImports: false
|
|
1058
|
+
});
|
|
1059
|
+
if (resolvedMatch) return resolvedMatch;
|
|
1060
|
+
}
|
|
1061
|
+
throw new InvalidModuleSpecifierError(context);
|
|
1062
|
+
}
|
|
1063
|
+
async function resolvePackageImports({ importSpecifier, importer, moduleDirs, conditions, resolveId }) {
|
|
1064
|
+
const result = await findPackageJson(importer, moduleDirs);
|
|
1065
|
+
if (!result) throw new Error(`${createBaseErrorMsg(importSpecifier, importer)}. Could not find a parent package.json.`);
|
|
1066
|
+
const { pkgPath, pkgJsonPath, pkgJson } = result;
|
|
1067
|
+
const context = {
|
|
1068
|
+
importer,
|
|
1069
|
+
importSpecifier,
|
|
1070
|
+
moduleDirs,
|
|
1071
|
+
pkgURL: pathToFileURL(`${pkgPath}/`),
|
|
1072
|
+
pkgJsonPath,
|
|
1073
|
+
conditions,
|
|
1074
|
+
resolveId
|
|
1075
|
+
};
|
|
1076
|
+
if (!importSpecifier.startsWith("#")) throw new InvalidModuleSpecifierError(context, true, "Invalid import specifier.");
|
|
1077
|
+
if (importSpecifier === "#" || importSpecifier.startsWith("#/")) throw new InvalidModuleSpecifierError(context, true, "Invalid import specifier.");
|
|
1078
|
+
const { imports } = pkgJson;
|
|
1079
|
+
if (!imports) throw new InvalidModuleSpecifierError(context, true);
|
|
1080
|
+
return resolvePackageImportsExports(context, {
|
|
1081
|
+
matchKey: importSpecifier,
|
|
1082
|
+
matchObj: imports,
|
|
1083
|
+
isImports: true
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
const resolveImportPath = promisify(import_resolve.default);
|
|
1087
|
+
const readFile = promisify(nativeFs.readFile);
|
|
1088
|
+
async function getPackageJson(importer, pkgName, resolveOptions, moduleDirectories) {
|
|
1089
|
+
if (importer) {
|
|
1090
|
+
const selfPackageJsonResult = await findPackageJson(importer, moduleDirectories);
|
|
1091
|
+
if (selfPackageJsonResult && selfPackageJsonResult.pkgJson.name === pkgName) return selfPackageJsonResult;
|
|
1092
|
+
}
|
|
1093
|
+
try {
|
|
1094
|
+
const pkgJsonPath = await resolveImportPath(`${pkgName}/package.json`, resolveOptions);
|
|
1095
|
+
return {
|
|
1096
|
+
pkgJsonPath,
|
|
1097
|
+
pkgJson: JSON.parse(await readFile(pkgJsonPath, "utf-8")),
|
|
1098
|
+
pkgPath: dirname(pkgJsonPath)
|
|
1099
|
+
};
|
|
1100
|
+
} catch (_) {
|
|
1101
|
+
return null;
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
async function resolveIdClassic({ importSpecifier, packageInfoCache, extensions, mainFields, preserveSymlinks, useBrowserOverrides, baseDir, moduleDirectories, modulePaths, rootDir, ignoreSideEffectsForRoot }) {
|
|
1105
|
+
let hasModuleSideEffects = () => null;
|
|
1106
|
+
let hasPackageEntry = true;
|
|
1107
|
+
let packageBrowserField = false;
|
|
1108
|
+
let packageInfo;
|
|
1109
|
+
const filter = (pkg, pkgPath) => {
|
|
1110
|
+
const info = getPackageInfo({
|
|
1111
|
+
cache: packageInfoCache,
|
|
1112
|
+
extensions,
|
|
1113
|
+
pkg,
|
|
1114
|
+
pkgPath,
|
|
1115
|
+
mainFields,
|
|
1116
|
+
preserveSymlinks,
|
|
1117
|
+
useBrowserOverrides,
|
|
1118
|
+
rootDir,
|
|
1119
|
+
ignoreSideEffectsForRoot
|
|
1120
|
+
});
|
|
1121
|
+
({packageInfo, hasModuleSideEffects, hasPackageEntry, packageBrowserField} = info);
|
|
1122
|
+
return info.cachedPkg;
|
|
1123
|
+
};
|
|
1124
|
+
const resolveOptions = {
|
|
1125
|
+
basedir: baseDir,
|
|
1126
|
+
readFile: readCachedFile,
|
|
1127
|
+
isFile: isFileCached,
|
|
1128
|
+
isDirectory: isDirCached,
|
|
1129
|
+
extensions,
|
|
1130
|
+
includeCoreModules: false,
|
|
1131
|
+
moduleDirectory: moduleDirectories,
|
|
1132
|
+
paths: modulePaths,
|
|
1133
|
+
preserveSymlinks,
|
|
1134
|
+
packageFilter: filter
|
|
1135
|
+
};
|
|
1136
|
+
let location;
|
|
1137
|
+
try {
|
|
1138
|
+
location = await resolveImportPath(importSpecifier, resolveOptions);
|
|
1139
|
+
} catch (error) {
|
|
1140
|
+
if (error.code !== "MODULE_NOT_FOUND") throw error;
|
|
1141
|
+
return null;
|
|
1142
|
+
}
|
|
1143
|
+
return {
|
|
1144
|
+
location: preserveSymlinks ? location : await resolveSymlink(location),
|
|
1145
|
+
hasModuleSideEffects,
|
|
1146
|
+
hasPackageEntry,
|
|
1147
|
+
packageBrowserField,
|
|
1148
|
+
packageInfo
|
|
1149
|
+
};
|
|
1150
|
+
}
|
|
1151
|
+
async function resolveWithExportMap({ importer, importSpecifier, exportConditions, packageInfoCache, extensions, mainFields, preserveSymlinks, useBrowserOverrides, baseDir, moduleDirectories, modulePaths, rootDir, ignoreSideEffectsForRoot, allowExportsFolderMapping }) {
|
|
1152
|
+
if (importSpecifier.startsWith("#")) {
|
|
1153
|
+
const resolveResult = await resolvePackageImports({
|
|
1154
|
+
importSpecifier,
|
|
1155
|
+
importer,
|
|
1156
|
+
moduleDirs: moduleDirectories,
|
|
1157
|
+
conditions: exportConditions,
|
|
1158
|
+
resolveId(id) {
|
|
1159
|
+
return resolveImportSpecifiers({
|
|
1160
|
+
importer,
|
|
1161
|
+
importSpecifierList: [id],
|
|
1162
|
+
exportConditions,
|
|
1163
|
+
packageInfoCache,
|
|
1164
|
+
extensions,
|
|
1165
|
+
mainFields,
|
|
1166
|
+
preserveSymlinks,
|
|
1167
|
+
useBrowserOverrides,
|
|
1168
|
+
baseDir,
|
|
1169
|
+
moduleDirectories,
|
|
1170
|
+
modulePaths,
|
|
1171
|
+
rootDir,
|
|
1172
|
+
ignoreSideEffectsForRoot,
|
|
1173
|
+
allowExportsFolderMapping
|
|
1174
|
+
});
|
|
1175
|
+
}
|
|
1176
|
+
});
|
|
1177
|
+
if (resolveResult == null) throw new ResolveError(`Could not resolve import "${importSpecifier}" in ${importer} using imports.`);
|
|
1178
|
+
const location = fileURLToPath(resolveResult);
|
|
1179
|
+
return {
|
|
1180
|
+
location: preserveSymlinks ? location : await resolveSymlink(location),
|
|
1181
|
+
hasModuleSideEffects: () => null,
|
|
1182
|
+
hasPackageEntry: true,
|
|
1183
|
+
packageBrowserField: false,
|
|
1184
|
+
packageInfo: void 0
|
|
1185
|
+
};
|
|
1186
|
+
}
|
|
1187
|
+
const pkgName = getPackageName(importSpecifier);
|
|
1188
|
+
if (pkgName) {
|
|
1189
|
+
let hasModuleSideEffects = () => null;
|
|
1190
|
+
let hasPackageEntry = true;
|
|
1191
|
+
let packageBrowserField = false;
|
|
1192
|
+
let packageInfo;
|
|
1193
|
+
const filter = (pkg, pkgPath) => {
|
|
1194
|
+
const info = getPackageInfo({
|
|
1195
|
+
cache: packageInfoCache,
|
|
1196
|
+
extensions,
|
|
1197
|
+
pkg,
|
|
1198
|
+
pkgPath,
|
|
1199
|
+
mainFields,
|
|
1200
|
+
preserveSymlinks,
|
|
1201
|
+
useBrowserOverrides,
|
|
1202
|
+
rootDir,
|
|
1203
|
+
ignoreSideEffectsForRoot
|
|
1204
|
+
});
|
|
1205
|
+
({packageInfo, hasModuleSideEffects, hasPackageEntry, packageBrowserField} = info);
|
|
1206
|
+
return info.cachedPkg;
|
|
1207
|
+
};
|
|
1208
|
+
const result = await getPackageJson(importer, pkgName, {
|
|
1209
|
+
basedir: baseDir,
|
|
1210
|
+
readFile: readCachedFile,
|
|
1211
|
+
isFile: isFileCached,
|
|
1212
|
+
isDirectory: isDirCached,
|
|
1213
|
+
extensions,
|
|
1214
|
+
includeCoreModules: false,
|
|
1215
|
+
moduleDirectory: moduleDirectories,
|
|
1216
|
+
paths: modulePaths,
|
|
1217
|
+
preserveSymlinks,
|
|
1218
|
+
packageFilter: filter
|
|
1219
|
+
}, moduleDirectories);
|
|
1220
|
+
if (result && result.pkgJson.exports) {
|
|
1221
|
+
const { pkgJson, pkgJsonPath } = result;
|
|
1222
|
+
const subpath = pkgName === importSpecifier ? "." : `.${importSpecifier.substring(pkgName.length)}`;
|
|
1223
|
+
const location = fileURLToPath(await resolvePackageExports({
|
|
1224
|
+
importer,
|
|
1225
|
+
importSpecifier,
|
|
1226
|
+
moduleDirs: moduleDirectories,
|
|
1227
|
+
pkgURL: pathToFileURL(pkgJsonPath.replace("package.json", "")),
|
|
1228
|
+
pkgJsonPath,
|
|
1229
|
+
allowExportsFolderMapping,
|
|
1230
|
+
conditions: exportConditions
|
|
1231
|
+
}, subpath, pkgJson.exports));
|
|
1232
|
+
if (location) return {
|
|
1233
|
+
location: preserveSymlinks ? location : await resolveSymlink(location),
|
|
1234
|
+
hasModuleSideEffects,
|
|
1235
|
+
hasPackageEntry,
|
|
1236
|
+
packageBrowserField,
|
|
1237
|
+
packageInfo
|
|
1238
|
+
};
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
return null;
|
|
1242
|
+
}
|
|
1243
|
+
async function resolveWithClassic({ importer, importSpecifierList, exportConditions, warn, packageInfoCache, extensions, mainFields, preserveSymlinks, useBrowserOverrides, baseDir, moduleDirectories, modulePaths, rootDir, ignoreSideEffectsForRoot }) {
|
|
1244
|
+
for (let i = 0; i < importSpecifierList.length; i++) {
|
|
1245
|
+
const result = await resolveIdClassic({
|
|
1246
|
+
importer,
|
|
1247
|
+
importSpecifier: importSpecifierList[i],
|
|
1248
|
+
exportConditions,
|
|
1249
|
+
warn,
|
|
1250
|
+
packageInfoCache,
|
|
1251
|
+
extensions,
|
|
1252
|
+
mainFields,
|
|
1253
|
+
preserveSymlinks,
|
|
1254
|
+
useBrowserOverrides,
|
|
1255
|
+
baseDir,
|
|
1256
|
+
moduleDirectories,
|
|
1257
|
+
modulePaths,
|
|
1258
|
+
rootDir,
|
|
1259
|
+
ignoreSideEffectsForRoot
|
|
1260
|
+
});
|
|
1261
|
+
if (result) return result;
|
|
1262
|
+
}
|
|
1263
|
+
return null;
|
|
1264
|
+
}
|
|
1265
|
+
async function resolveImportSpecifiers({ importer, importSpecifierList, exportConditions, warn, packageInfoCache, extensions, mainFields, preserveSymlinks, useBrowserOverrides, baseDir, moduleDirectories, modulePaths, rootDir, ignoreSideEffectsForRoot, allowExportsFolderMapping }) {
|
|
1266
|
+
try {
|
|
1267
|
+
const exportMapRes = await resolveWithExportMap({
|
|
1268
|
+
importer,
|
|
1269
|
+
importSpecifier: importSpecifierList[0],
|
|
1270
|
+
exportConditions,
|
|
1271
|
+
packageInfoCache,
|
|
1272
|
+
extensions,
|
|
1273
|
+
mainFields,
|
|
1274
|
+
preserveSymlinks,
|
|
1275
|
+
useBrowserOverrides,
|
|
1276
|
+
baseDir,
|
|
1277
|
+
moduleDirectories,
|
|
1278
|
+
modulePaths,
|
|
1279
|
+
rootDir,
|
|
1280
|
+
ignoreSideEffectsForRoot,
|
|
1281
|
+
allowExportsFolderMapping
|
|
1282
|
+
});
|
|
1283
|
+
if (exportMapRes) return exportMapRes;
|
|
1284
|
+
} catch (error) {
|
|
1285
|
+
if (error instanceof ResolveError) {
|
|
1286
|
+
warn(error);
|
|
1287
|
+
return null;
|
|
1288
|
+
}
|
|
1289
|
+
throw error;
|
|
1290
|
+
}
|
|
1291
|
+
return resolveWithClassic({
|
|
1292
|
+
importer,
|
|
1293
|
+
importSpecifierList,
|
|
1294
|
+
exportConditions,
|
|
1295
|
+
warn,
|
|
1296
|
+
packageInfoCache,
|
|
1297
|
+
extensions,
|
|
1298
|
+
mainFields,
|
|
1299
|
+
preserveSymlinks,
|
|
1300
|
+
useBrowserOverrides,
|
|
1301
|
+
baseDir,
|
|
1302
|
+
moduleDirectories,
|
|
1303
|
+
modulePaths,
|
|
1304
|
+
rootDir,
|
|
1305
|
+
ignoreSideEffectsForRoot
|
|
1306
|
+
});
|
|
1307
|
+
}
|
|
1308
|
+
const versionRegexp = /\^(\d+\.\d+\.\d+)/g;
|
|
1309
|
+
function validateVersion(actualVersion, peerDependencyVersion) {
|
|
1310
|
+
let minMajor = Infinity;
|
|
1311
|
+
let minMinor = Infinity;
|
|
1312
|
+
let minPatch = Infinity;
|
|
1313
|
+
let foundVersion;
|
|
1314
|
+
while (foundVersion = versionRegexp.exec(peerDependencyVersion)) {
|
|
1315
|
+
const [foundMajor, foundMinor, foundPatch] = foundVersion[1].split(".").map(Number);
|
|
1316
|
+
if (foundMajor < minMajor) {
|
|
1317
|
+
minMajor = foundMajor;
|
|
1318
|
+
minMinor = foundMinor;
|
|
1319
|
+
minPatch = foundPatch;
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
if (!actualVersion) throw new Error(`Insufficient Rollup version: "@rollup/plugin-node-resolve" requires at least rollup@${minMajor}.${minMinor}.${minPatch}.`);
|
|
1323
|
+
const [major, minor, patch] = actualVersion.split(".").map(Number);
|
|
1324
|
+
if (major < minMajor || major === minMajor && (minor < minMinor || minor === minMinor && patch < minPatch)) throw new Error(`Insufficient rollup version: "@rollup/plugin-node-resolve" requires at least rollup@${minMajor}.${minMinor}.${minPatch} but found rollup@${actualVersion}.`);
|
|
1325
|
+
}
|
|
1326
|
+
const ES6_BROWSER_EMPTY = "\0node-resolve:empty.js";
|
|
1327
|
+
const deepFreeze = (object) => {
|
|
1328
|
+
Object.freeze(object);
|
|
1329
|
+
for (const value of Object.values(object)) if (typeof value === "object" && !Object.isFrozen(value)) deepFreeze(value);
|
|
1330
|
+
return object;
|
|
1331
|
+
};
|
|
1332
|
+
const baseConditions = ["default", "module"];
|
|
1333
|
+
const baseConditionsEsm = [...baseConditions, "import"];
|
|
1334
|
+
const baseConditionsCjs = [...baseConditions, "require"];
|
|
1335
|
+
const defaults = {
|
|
1336
|
+
dedupe: [],
|
|
1337
|
+
extensions: [
|
|
1338
|
+
".mjs",
|
|
1339
|
+
".js",
|
|
1340
|
+
".json",
|
|
1341
|
+
".node"
|
|
1342
|
+
],
|
|
1343
|
+
resolveOnly: [],
|
|
1344
|
+
moduleDirectories: ["node_modules"],
|
|
1345
|
+
modulePaths: [],
|
|
1346
|
+
ignoreSideEffectsForRoot: false,
|
|
1347
|
+
allowExportsFolderMapping: true
|
|
1348
|
+
};
|
|
1349
|
+
const nodeImportPrefix = /^node:/;
|
|
1350
|
+
const DEFAULTS = deepFreeze((0, import_cjs.default)({}, defaults));
|
|
1351
|
+
function nodeResolve(opts = {}) {
|
|
1352
|
+
const { warnings } = handleDeprecatedOptions(opts);
|
|
1353
|
+
const options = {
|
|
1354
|
+
...defaults,
|
|
1355
|
+
...opts
|
|
1356
|
+
};
|
|
1357
|
+
const { extensions, jail, moduleDirectories, modulePaths, ignoreSideEffectsForRoot } = options;
|
|
1358
|
+
const exportConditions = options.exportConditions || [];
|
|
1359
|
+
const devProdCondition = exportConditions.includes("development") || exportConditions.includes("production") ? [] : [process.env.NODE_ENV && process.env.NODE_ENV !== "production" ? "development" : "production"];
|
|
1360
|
+
const conditionsEsm = [
|
|
1361
|
+
...baseConditionsEsm,
|
|
1362
|
+
...exportConditions,
|
|
1363
|
+
...devProdCondition
|
|
1364
|
+
];
|
|
1365
|
+
const conditionsCjs = [
|
|
1366
|
+
...baseConditionsCjs,
|
|
1367
|
+
...exportConditions,
|
|
1368
|
+
...devProdCondition
|
|
1369
|
+
];
|
|
1370
|
+
const packageInfoCache = /* @__PURE__ */ new Map();
|
|
1371
|
+
const idToPackageInfo = /* @__PURE__ */ new Map();
|
|
1372
|
+
const mainFields = getMainFields(options);
|
|
1373
|
+
const useBrowserOverrides = mainFields.indexOf("browser") !== -1;
|
|
1374
|
+
const isPreferBuiltinsSet = Object.prototype.hasOwnProperty.call(options, "preferBuiltins");
|
|
1375
|
+
const preferBuiltins = isPreferBuiltinsSet ? options.preferBuiltins : true;
|
|
1376
|
+
const rootDir = resolve(options.rootDir || process.cwd());
|
|
1377
|
+
let { dedupe } = options;
|
|
1378
|
+
let rollupOptions;
|
|
1379
|
+
if (moduleDirectories.some((name) => name.includes("/"))) throw new Error("`moduleDirectories` option must only contain directory names. If you want to load modules from somewhere not supported by the default module resolution algorithm, see `modulePaths`.");
|
|
1380
|
+
if (typeof dedupe !== "function") dedupe = (importee) => options.dedupe.includes(importee) || options.dedupe.includes(getPackageName(importee));
|
|
1381
|
+
const allowPatterns = (patterns) => {
|
|
1382
|
+
const regexPatterns = patterns.map((pattern) => {
|
|
1383
|
+
if (pattern instanceof RegExp) return pattern;
|
|
1384
|
+
const normalized = pattern.replace(/[\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
1385
|
+
return /* @__PURE__ */ new RegExp(`^${normalized}$`);
|
|
1386
|
+
});
|
|
1387
|
+
return (id) => !regexPatterns.length || regexPatterns.some((pattern) => pattern.test(id));
|
|
1388
|
+
};
|
|
1389
|
+
const resolveOnly = typeof options.resolveOnly === "function" ? options.resolveOnly : allowPatterns(options.resolveOnly);
|
|
1390
|
+
const browserMapCache = /* @__PURE__ */ new Map();
|
|
1391
|
+
let preserveSymlinks;
|
|
1392
|
+
const resolveLikeNode = async (context, importee, importer, custom) => {
|
|
1393
|
+
const [importPath, params] = importee.split("?");
|
|
1394
|
+
const importSuffix = `${params ? `?${params}` : ""}`;
|
|
1395
|
+
importee = importPath;
|
|
1396
|
+
const baseDir = !importer || dedupe(importee) ? rootDir : dirname(importer);
|
|
1397
|
+
const browser = browserMapCache.get(importer);
|
|
1398
|
+
if (useBrowserOverrides && browser) {
|
|
1399
|
+
const resolvedImportee = resolve(baseDir, importee);
|
|
1400
|
+
if (browser[importee] === false || browser[resolvedImportee] === false) return { id: ES6_BROWSER_EMPTY };
|
|
1401
|
+
const browserImportee = importee[0] !== "." && browser[importee] || browser[resolvedImportee] || browser[`${resolvedImportee}.js`] || browser[`${resolvedImportee}.json`];
|
|
1402
|
+
if (browserImportee) importee = browserImportee;
|
|
1403
|
+
}
|
|
1404
|
+
const parts = importee.split(/[/\\]/);
|
|
1405
|
+
let id = parts.shift();
|
|
1406
|
+
let isRelativeImport = false;
|
|
1407
|
+
if (id[0] === "@" && parts.length > 0) id += `/${parts.shift()}`;
|
|
1408
|
+
else if (id[0] === ".") {
|
|
1409
|
+
id = resolve(baseDir, importee);
|
|
1410
|
+
isRelativeImport = true;
|
|
1411
|
+
}
|
|
1412
|
+
if (!isRelativeImport && !resolveOnly(id)) {
|
|
1413
|
+
if (normalizeInput(rollupOptions.input).includes(importee)) return null;
|
|
1414
|
+
return false;
|
|
1415
|
+
}
|
|
1416
|
+
const importSpecifierList = [importee];
|
|
1417
|
+
if (importer === void 0 && importee[0] && !importee[0].match(/^\.?\.?\//)) importSpecifierList.push(`./${importee}`);
|
|
1418
|
+
if (importer && /\.(ts|mts|cts|tsx)$/.test(importer)) {
|
|
1419
|
+
for (const [importeeExt, resolvedExt] of [
|
|
1420
|
+
[".js", ".ts"],
|
|
1421
|
+
[".js", ".tsx"],
|
|
1422
|
+
[".jsx", ".tsx"],
|
|
1423
|
+
[".mjs", ".mts"],
|
|
1424
|
+
[".cjs", ".cts"]
|
|
1425
|
+
]) if (importee.endsWith(importeeExt) && extensions.includes(resolvedExt)) importSpecifierList.push(importee.slice(0, -importeeExt.length) + resolvedExt);
|
|
1426
|
+
}
|
|
1427
|
+
const warn = (...args) => context.warn(...args);
|
|
1428
|
+
const exportConditions$1 = custom && custom["node-resolve"] && custom["node-resolve"].isRequire ? conditionsCjs : conditionsEsm;
|
|
1429
|
+
if (useBrowserOverrides && !exportConditions$1.includes("browser")) exportConditions$1.push("browser");
|
|
1430
|
+
const resolvedWithoutBuiltins = await resolveImportSpecifiers({
|
|
1431
|
+
importer,
|
|
1432
|
+
importSpecifierList,
|
|
1433
|
+
exportConditions: exportConditions$1,
|
|
1434
|
+
warn,
|
|
1435
|
+
packageInfoCache,
|
|
1436
|
+
extensions,
|
|
1437
|
+
mainFields,
|
|
1438
|
+
preserveSymlinks,
|
|
1439
|
+
useBrowserOverrides,
|
|
1440
|
+
baseDir,
|
|
1441
|
+
moduleDirectories,
|
|
1442
|
+
modulePaths,
|
|
1443
|
+
rootDir,
|
|
1444
|
+
ignoreSideEffectsForRoot,
|
|
1445
|
+
allowExportsFolderMapping: options.allowExportsFolderMapping
|
|
1446
|
+
});
|
|
1447
|
+
const importeeIsBuiltin = builtinModules.includes(importee.replace(nodeImportPrefix, ""));
|
|
1448
|
+
const preferImporteeIsBuiltin = typeof preferBuiltins === "function" ? preferBuiltins(importee) : preferBuiltins;
|
|
1449
|
+
const resolved = importeeIsBuiltin && preferImporteeIsBuiltin ? {
|
|
1450
|
+
packageInfo: void 0,
|
|
1451
|
+
hasModuleSideEffects: () => null,
|
|
1452
|
+
hasPackageEntry: true,
|
|
1453
|
+
packageBrowserField: false
|
|
1454
|
+
} : resolvedWithoutBuiltins;
|
|
1455
|
+
if (!resolved) return null;
|
|
1456
|
+
const { packageInfo, hasModuleSideEffects, hasPackageEntry, packageBrowserField } = resolved;
|
|
1457
|
+
let { location } = resolved;
|
|
1458
|
+
if (packageBrowserField) {
|
|
1459
|
+
if (Object.prototype.hasOwnProperty.call(packageBrowserField, location)) {
|
|
1460
|
+
if (!packageBrowserField[location]) {
|
|
1461
|
+
browserMapCache.set(location, packageBrowserField);
|
|
1462
|
+
return { id: ES6_BROWSER_EMPTY };
|
|
1463
|
+
}
|
|
1464
|
+
location = packageBrowserField[location];
|
|
1465
|
+
}
|
|
1466
|
+
browserMapCache.set(location, packageBrowserField);
|
|
1467
|
+
}
|
|
1468
|
+
if (hasPackageEntry && !preserveSymlinks) {
|
|
1469
|
+
if (await fileExists(location)) location = await realpath(location);
|
|
1470
|
+
}
|
|
1471
|
+
idToPackageInfo.set(location, packageInfo);
|
|
1472
|
+
if (hasPackageEntry) {
|
|
1473
|
+
if (importeeIsBuiltin && preferImporteeIsBuiltin) {
|
|
1474
|
+
if (!isPreferBuiltinsSet && resolvedWithoutBuiltins && resolved !== importee) context.warn({
|
|
1475
|
+
message: `preferring built-in module '${importee}' over local alternative at '${resolvedWithoutBuiltins.location}', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning.or passing a function to 'preferBuiltins' to provide more fine-grained control over which built-in modules to prefer.`,
|
|
1476
|
+
pluginCode: "PREFER_BUILTINS"
|
|
1477
|
+
});
|
|
1478
|
+
return false;
|
|
1479
|
+
} else if (jail && location.indexOf(normalize(jail.trim(sep))) !== 0) return null;
|
|
1480
|
+
}
|
|
1481
|
+
if (options.modulesOnly && await fileExists(location)) {
|
|
1482
|
+
if ((0, import_is_module.default)(await readFile$1(location, "utf-8"))) return {
|
|
1483
|
+
id: `${location}${importSuffix}`,
|
|
1484
|
+
moduleSideEffects: hasModuleSideEffects(location)
|
|
1485
|
+
};
|
|
1486
|
+
return null;
|
|
1487
|
+
}
|
|
1488
|
+
return {
|
|
1489
|
+
id: `${location}${importSuffix}`,
|
|
1490
|
+
moduleSideEffects: hasModuleSideEffects(location)
|
|
1491
|
+
};
|
|
1492
|
+
};
|
|
1493
|
+
return {
|
|
1494
|
+
name: "node-resolve",
|
|
1495
|
+
version,
|
|
1496
|
+
buildStart(buildOptions) {
|
|
1497
|
+
validateVersion(this.meta.rollupVersion, peerDependencies.rollup);
|
|
1498
|
+
rollupOptions = buildOptions;
|
|
1499
|
+
for (const warning of warnings) this.warn(warning);
|
|
1500
|
+
({preserveSymlinks} = buildOptions);
|
|
1501
|
+
},
|
|
1502
|
+
generateBundle() {
|
|
1503
|
+
readCachedFile.clear();
|
|
1504
|
+
isFileCached.clear();
|
|
1505
|
+
isDirCached.clear();
|
|
1506
|
+
},
|
|
1507
|
+
resolveId: {
|
|
1508
|
+
order: "post",
|
|
1509
|
+
async handler(importee, importer, resolveOptions) {
|
|
1510
|
+
if (importee === ES6_BROWSER_EMPTY) return importee;
|
|
1511
|
+
if (importee && importee.includes("\0")) return null;
|
|
1512
|
+
const { custom = {} } = resolveOptions;
|
|
1513
|
+
const { "node-resolve": { resolved: alreadyResolved } = {} } = custom;
|
|
1514
|
+
if (alreadyResolved) return alreadyResolved;
|
|
1515
|
+
if (importer && importer.includes("\0")) importer = void 0;
|
|
1516
|
+
const resolved = await resolveLikeNode(this, importee, importer, custom);
|
|
1517
|
+
if (resolved) {
|
|
1518
|
+
const resolvedResolved = await this.resolve(resolved.id, importer, {
|
|
1519
|
+
...resolveOptions,
|
|
1520
|
+
skipSelf: false,
|
|
1521
|
+
custom: {
|
|
1522
|
+
...custom,
|
|
1523
|
+
"node-resolve": {
|
|
1524
|
+
...custom["node-resolve"],
|
|
1525
|
+
resolved,
|
|
1526
|
+
importee
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
});
|
|
1530
|
+
if (resolvedResolved) {
|
|
1531
|
+
if (resolvedResolved.external) return false;
|
|
1532
|
+
if (resolvedResolved.id !== resolved.id) return resolvedResolved;
|
|
1533
|
+
return {
|
|
1534
|
+
...resolved,
|
|
1535
|
+
meta: resolvedResolved.meta
|
|
1536
|
+
};
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
return resolved;
|
|
1540
|
+
}
|
|
1541
|
+
},
|
|
1542
|
+
load(importee) {
|
|
1543
|
+
if (importee === ES6_BROWSER_EMPTY) return "export default {};";
|
|
1544
|
+
return null;
|
|
1545
|
+
},
|
|
1546
|
+
getPackageInfoForId(id) {
|
|
1547
|
+
return idToPackageInfo.get(id);
|
|
1548
|
+
}
|
|
1549
|
+
};
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
//#endregion
|
|
1553
|
+
export { nodeResolve as t };
|