storybook 10.1.0-alpha.10 → 10.1.0-alpha.11
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/_browser-chunks/Color-FTG7SQDA.js +1097 -0
- package/dist/_browser-chunks/WithTooltip-LMROHDUP.js +1651 -0
- package/dist/_browser-chunks/chunk-2FRVAXCZ.js +7 -0
- package/dist/_browser-chunks/chunk-3IAH5M2U.js +171 -0
- package/dist/_browser-chunks/chunk-3OXGAGBE.js +779 -0
- package/dist/_browser-chunks/{chunk-TMDZCWME.js → chunk-3PJE6VLG.js} +1 -3
- package/dist/_browser-chunks/{chunk-VAMFPZY3.js → chunk-45UGUKRX.js} +2 -7
- package/dist/_browser-chunks/chunk-6XWLIJQL.js +11 -0
- package/dist/_browser-chunks/{chunk-FDWKXLBI.js → chunk-74YHFU5B.js} +44 -109
- package/dist/_browser-chunks/{chunk-MM7DTO55.js → chunk-A242L54C.js} +10 -16
- package/dist/_browser-chunks/chunk-AIOS4NGK.js +252 -0
- package/dist/_browser-chunks/chunk-AS2HQEYC.js +14 -0
- package/dist/_browser-chunks/chunk-AXG2BOBL.js +836 -0
- package/dist/_browser-chunks/chunk-BE2DAXKJ.js +2966 -0
- package/dist/_browser-chunks/{chunk-MH6AXFXB.js → chunk-CHUV5WSW.js} +0 -5
- package/dist/_browser-chunks/chunk-EBHB6RPS.js +61 -0
- package/dist/_browser-chunks/chunk-EUVGDK4H.js +93 -0
- package/dist/_browser-chunks/chunk-EZSQOHRI.js +18 -0
- package/dist/_browser-chunks/{chunk-CADGRH3P.js → chunk-FNXWN6IK.js} +3 -8
- package/dist/_browser-chunks/chunk-GFLS4VP3.js +64 -0
- package/dist/_browser-chunks/{chunk-L2D73C6Z.js → chunk-H6XK3RSC.js} +13 -21
- package/dist/_browser-chunks/chunk-IPA5A322.js +71 -0
- package/dist/_browser-chunks/chunk-JP7NCOJX.js +37 -0
- package/dist/_browser-chunks/chunk-KJHJLCBK.js +11 -0
- package/dist/_browser-chunks/{chunk-QMY4G4R2.js → chunk-L4RMQ7D7.js} +17 -64
- package/dist/_browser-chunks/{chunk-AB7OOPUX.js → chunk-QKODTO7K.js} +0 -5
- package/dist/_browser-chunks/chunk-RP5RXKFU.js +2491 -0
- package/dist/_browser-chunks/chunk-SL75JR6Y.js +9 -0
- package/dist/_browser-chunks/chunk-UD6FQLAF.js +1481 -0
- package/dist/_browser-chunks/chunk-VYJQ7RU5.js +2853 -0
- package/dist/_browser-chunks/chunk-WJYERY3R.js +136 -0
- package/dist/_browser-chunks/chunk-WXP2XJ3O.js +950 -0
- package/dist/_browser-chunks/chunk-X3DUQ5RA.js +47 -0
- package/dist/_browser-chunks/chunk-XJNX76GA.js +85 -0
- package/dist/_browser-chunks/{chunk-F4Q6SGTB.js → chunk-YKE5S47A.js} +177 -399
- package/dist/_browser-chunks/{chunk-SN4J4IQ3.js → chunk-ZUWEVLDX.js} +1 -7
- package/dist/_browser-chunks/{formatter-OMEEQ6HG.js → formatter-QJ4M4OGQ.js} +4 -9
- package/dist/_browser-chunks/{syntaxhighlighter-RJZASWHL.js → syntaxhighlighter-WKBQ5RC7.js} +704 -1848
- package/dist/_node-chunks/{builder-manager-HA7CYFCK.js → builder-manager-PMPHOSM2.js} +475 -1013
- package/dist/_node-chunks/camelcase-K3IOOFQW.js +18 -0
- package/dist/_node-chunks/{chunk-X4XU27M6.js → chunk-32NE3UE3.js} +15 -24
- package/dist/_node-chunks/chunk-4GZCFQFG.js +58 -0
- package/dist/_node-chunks/chunk-5QK5MSOI.js +943 -0
- package/dist/_node-chunks/{chunk-VPR5IBMG.js → chunk-6ZOLETQK.js} +8 -10
- package/dist/_node-chunks/chunk-7I22Y76Z.js +1047 -0
- package/dist/_node-chunks/chunk-AKTRSR3O.js +72 -0
- package/dist/_node-chunks/chunk-BBOP3XCK.js +119 -0
- package/dist/_node-chunks/chunk-C2GQVDWI.js +34 -0
- package/dist/_node-chunks/{chunk-ZHSCUGNP.js → chunk-GG2WQZSG.js} +3799 -7849
- package/dist/_node-chunks/chunk-GQJOWVVR.js +3214 -0
- package/dist/_node-chunks/chunk-JCRM2YVK.js +3009 -0
- package/dist/_node-chunks/chunk-KK4AT5F3.js +1029 -0
- package/dist/_node-chunks/chunk-L7MYXJUM.js +1114 -0
- package/dist/_node-chunks/{chunk-F3XOPI6H.js → chunk-LCZO45L7.js} +469 -983
- package/dist/_node-chunks/chunk-LR3QITDI.js +209 -0
- package/dist/_node-chunks/chunk-LXG4DK35.js +3171 -0
- package/dist/_node-chunks/chunk-MJ3WOS6F.js +37 -0
- package/dist/_node-chunks/chunk-PHOZWZZO.js +61 -0
- package/dist/_node-chunks/chunk-QECOQWRJ.js +936 -0
- package/dist/_node-chunks/chunk-QH4V5YDB.js +20 -0
- package/dist/_node-chunks/chunk-R6HWGZWD.js +26 -0
- package/dist/_node-chunks/chunk-SPQXMU2Q.js +759 -0
- package/dist/_node-chunks/chunk-TXZY6V6O.js +1564 -0
- package/dist/_node-chunks/chunk-UGDPX5LE.js +756 -0
- package/dist/_node-chunks/chunk-UY26MQLT.js +603 -0
- package/dist/_node-chunks/chunk-WK3EMYK6.js +61 -0
- package/dist/_node-chunks/{chunk-OVXB5GGT.js → chunk-WLHMN7AP.js} +292 -688
- package/dist/_node-chunks/chunk-XGVLB4UJ.js +54 -0
- package/dist/_node-chunks/{chunk-RMHAL25C.js → chunk-YHRFI6BE.js} +87 -227
- package/dist/_node-chunks/chunk-YK4KVMFW.js +18 -0
- package/dist/_node-chunks/chunk-ZZALGOA6.js +4523 -0
- package/dist/_node-chunks/chunk-ZZPBSYA5.js +301 -0
- package/dist/_node-chunks/chunk-ZZSRFAC6.js +45571 -0
- package/dist/_node-chunks/dist-4DWOCZUD.js +121 -0
- package/dist/_node-chunks/globby-AAARUKEU.js +3452 -0
- package/dist/_node-chunks/lib-HEUKGL62.js +366 -0
- package/dist/_node-chunks/mdx-N42X6CFJ-DCVRPS6N.js +14329 -0
- package/dist/_node-chunks/p-limit-F5ZKJ6WZ.js +116 -0
- package/dist/_node-chunks/plugin-7YY7JXCH.js +123 -0
- package/dist/_node-chunks/{plugin-6ZPCS4LI.js → plugin-SZP3CW6W.js} +36 -56
- package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-TGKNDPO6.js +46623 -0
- package/dist/_node-chunks/webpack-mock-plugin-LNTZZFBE.js +92 -0
- package/dist/actions/decorator.js +21 -42
- package/dist/actions/index.js +3 -3
- package/dist/babel/index.d.ts +671 -335
- package/dist/babel/index.js +11 -11
- package/dist/bin/core.js +592 -1546
- package/dist/bin/dispatcher.js +26 -37
- package/dist/bin/loader.js +23 -34
- package/dist/channels/index.js +98 -234
- package/dist/cli/index.js +1951 -5308
- package/dist/client-logger/index.js +31 -61
- package/dist/common/index.js +20 -20
- package/dist/components/index.js +4211 -8586
- package/dist/core-events/index.js +2 -66
- package/dist/core-server/index.js +3054 -7290
- package/dist/core-server/presets/common-manager.css +2 -2
- package/dist/core-server/presets/common-manager.js +1806 -3427
- package/dist/core-server/presets/common-override-preset.js +31 -60
- package/dist/core-server/presets/common-preset.js +434 -924
- package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +15 -19
- package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +12 -17
- package/dist/csf/index.js +534 -1179
- package/dist/csf-tools/index.js +9 -9
- package/dist/docs-tools/index.js +6 -6
- package/dist/highlight/index.js +2 -2
- package/dist/instrumenter/index.js +199 -415
- package/dist/manager/globals-runtime.js +24150 -47364
- package/dist/manager/globals.js +2 -3
- package/dist/manager/runtime.js +3961 -8373
- package/dist/manager-api/index.js +1231 -2425
- package/dist/manager-errors.d.ts +3 -0
- package/dist/manager-errors.js +3 -3
- package/dist/node-logger/index.js +1253 -2601
- package/dist/preview/globals.js +2 -3
- package/dist/preview/runtime.js +10364 -21990
- package/dist/preview-api/index.d.ts +67 -68
- package/dist/preview-api/index.js +13 -13
- package/dist/preview-errors.d.ts +3 -0
- package/dist/preview-errors.js +4 -4
- package/dist/router/index.js +347 -899
- package/dist/server-errors.d.ts +3 -0
- package/dist/server-errors.js +10 -10
- package/dist/telemetry/index.js +24 -24
- package/dist/test/index.js +5860 -11645
- package/dist/theming/create.js +4 -4
- package/dist/theming/index.d.ts +3363 -2597
- package/dist/theming/index.js +490 -1086
- package/dist/types/index.js +2 -11
- package/dist/viewport/index.js +3 -3
- package/package.json +5 -5
- package/dist/_browser-chunks/Color-FQNEU7YS.js +0 -1695
- package/dist/_browser-chunks/WithTooltip-6NHN2GXF.js +0 -2343
- package/dist/_browser-chunks/chunk-6A7OIVEL.js +0 -66
- package/dist/_browser-chunks/chunk-AW46NMGV.js +0 -1308
- package/dist/_browser-chunks/chunk-B4A3ADP3.js +0 -3816
- package/dist/_browser-chunks/chunk-FSBVR7H5.js +0 -106
- package/dist/_browser-chunks/chunk-FUOHXXZT.js +0 -23
- package/dist/_browser-chunks/chunk-GTKOCWCT.js +0 -17
- package/dist/_browser-chunks/chunk-HHW4FUMO.js +0 -12
- package/dist/_browser-chunks/chunk-JVSKG4YS.js +0 -4052
- package/dist/_browser-chunks/chunk-LASUB7TL.js +0 -76
- package/dist/_browser-chunks/chunk-LYCSRYYR.js +0 -101
- package/dist/_browser-chunks/chunk-NVV6MIOE.js +0 -243
- package/dist/_browser-chunks/chunk-OBXWFEPB.js +0 -852
- package/dist/_browser-chunks/chunk-OPCDBBL3.js +0 -48
- package/dist/_browser-chunks/chunk-PB6FZ3WE.js +0 -130
- package/dist/_browser-chunks/chunk-RW5PKMWM.js +0 -4182
- package/dist/_browser-chunks/chunk-SYS437NN.js +0 -122
- package/dist/_browser-chunks/chunk-U46RQHA4.js +0 -12
- package/dist/_browser-chunks/chunk-UTNZYD2N.js +0 -311
- package/dist/_browser-chunks/chunk-VUAFL5XK.js +0 -20
- package/dist/_browser-chunks/chunk-XDGMHOV7.js +0 -2197
- package/dist/_browser-chunks/chunk-XW6KSYKF.js +0 -16
- package/dist/_browser-chunks/chunk-Y3M7TW6K.js +0 -1041
- package/dist/_browser-chunks/chunk-ZNRFDIVA.js +0 -233
- package/dist/_node-chunks/camelcase-QALD4XFE.js +0 -18
- package/dist/_node-chunks/chunk-2XY53ALL.js +0 -420
- package/dist/_node-chunks/chunk-3CBQMG2A.js +0 -6712
- package/dist/_node-chunks/chunk-3WDAPZYQ.js +0 -28
- package/dist/_node-chunks/chunk-4ZB555EJ.js +0 -697
- package/dist/_node-chunks/chunk-52DXKXY3.js +0 -4272
- package/dist/_node-chunks/chunk-5OVB4A6F.js +0 -69
- package/dist/_node-chunks/chunk-AGHGNXGH.js +0 -18
- package/dist/_node-chunks/chunk-B23X5ZCK.js +0 -1531
- package/dist/_node-chunks/chunk-B2DAHWJK.js +0 -220
- package/dist/_node-chunks/chunk-CC4PW5MJ.js +0 -34
- package/dist/_node-chunks/chunk-D7NIZELR.js +0 -2256
- package/dist/_node-chunks/chunk-DO5Q3H4L.js +0 -1250
- package/dist/_node-chunks/chunk-ECK7WVFX.js +0 -304
- package/dist/_node-chunks/chunk-EUH3NHXA.js +0 -79
- package/dist/_node-chunks/chunk-FOQHPHCV.js +0 -1657
- package/dist/_node-chunks/chunk-G6EL47NS.js +0 -111
- package/dist/_node-chunks/chunk-GFLS4TJB.js +0 -90
- package/dist/_node-chunks/chunk-J3XZKWHE.js +0 -1586
- package/dist/_node-chunks/chunk-LE63EHJ5.js +0 -1518
- package/dist/_node-chunks/chunk-M47XA42S.js +0 -4741
- package/dist/_node-chunks/chunk-OOI74AL3.js +0 -61
- package/dist/_node-chunks/chunk-PRJHT3GJ.js +0 -61
- package/dist/_node-chunks/chunk-Q52PVUSU.js +0 -101
- package/dist/_node-chunks/chunk-SDCF5RNN.js +0 -1198
- package/dist/_node-chunks/chunk-UJ5SJ23M.js +0 -5029
- package/dist/_node-chunks/chunk-UPHK4ETU.js +0 -64658
- package/dist/_node-chunks/chunk-V7VURIPB.js +0 -1544
- package/dist/_node-chunks/dist-6TXHNR5C.js +0 -175
- package/dist/_node-chunks/globby-PBTV6PX6.js +0 -5222
- package/dist/_node-chunks/lib-4RTDZVGX.js +0 -518
- package/dist/_node-chunks/mdx-N42X6CFJ-COWEH7KR.js +0 -22017
- package/dist/_node-chunks/p-limit-PBVZQOFY.js +0 -168
- package/dist/_node-chunks/plugin-EOZKYZAG.js +0 -159
- package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-35HMSMR5.js +0 -69102
- package/dist/_node-chunks/webpack-mock-plugin-GT3MA5E2.js +0 -124
|
@@ -0,0 +1,759 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_843v2rliy1 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_843v2rliy1 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_843v2rliy1 from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_843v2rliy1.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_843v2rliy1.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_843v2rliy1.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
import {
|
|
13
|
+
dirname,
|
|
14
|
+
join
|
|
15
|
+
} from "./chunk-BBOP3XCK.js";
|
|
16
|
+
|
|
17
|
+
// ../node_modules/exsolve/dist/index.mjs
|
|
18
|
+
import fs, { lstatSync, realpathSync, statSync } from "node:fs";
|
|
19
|
+
import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
|
|
20
|
+
import path, { isAbsolute } from "node:path";
|
|
21
|
+
import assert from "node:assert";
|
|
22
|
+
import process$1 from "node:process";
|
|
23
|
+
import v8 from "node:v8";
|
|
24
|
+
import { format, inspect } from "node:util";
|
|
25
|
+
var nodeBuiltins = [
|
|
26
|
+
"_http_agent",
|
|
27
|
+
"_http_client",
|
|
28
|
+
"_http_common",
|
|
29
|
+
"_http_incoming",
|
|
30
|
+
"_http_outgoing",
|
|
31
|
+
"_http_server",
|
|
32
|
+
"_stream_duplex",
|
|
33
|
+
"_stream_passthrough",
|
|
34
|
+
"_stream_readable",
|
|
35
|
+
"_stream_transform",
|
|
36
|
+
"_stream_wrap",
|
|
37
|
+
"_stream_writable",
|
|
38
|
+
"_tls_common",
|
|
39
|
+
"_tls_wrap",
|
|
40
|
+
"assert",
|
|
41
|
+
"assert/strict",
|
|
42
|
+
"async_hooks",
|
|
43
|
+
"buffer",
|
|
44
|
+
"child_process",
|
|
45
|
+
"cluster",
|
|
46
|
+
"console",
|
|
47
|
+
"constants",
|
|
48
|
+
"crypto",
|
|
49
|
+
"dgram",
|
|
50
|
+
"diagnostics_channel",
|
|
51
|
+
"dns",
|
|
52
|
+
"dns/promises",
|
|
53
|
+
"domain",
|
|
54
|
+
"events",
|
|
55
|
+
"fs",
|
|
56
|
+
"fs/promises",
|
|
57
|
+
"http",
|
|
58
|
+
"http2",
|
|
59
|
+
"https",
|
|
60
|
+
"inspector",
|
|
61
|
+
"inspector/promises",
|
|
62
|
+
"module",
|
|
63
|
+
"net",
|
|
64
|
+
"os",
|
|
65
|
+
"path",
|
|
66
|
+
"path/posix",
|
|
67
|
+
"path/win32",
|
|
68
|
+
"perf_hooks",
|
|
69
|
+
"process",
|
|
70
|
+
"punycode",
|
|
71
|
+
"querystring",
|
|
72
|
+
"readline",
|
|
73
|
+
"readline/promises",
|
|
74
|
+
"repl",
|
|
75
|
+
"stream",
|
|
76
|
+
"stream/consumers",
|
|
77
|
+
"stream/promises",
|
|
78
|
+
"stream/web",
|
|
79
|
+
"string_decoder",
|
|
80
|
+
"sys",
|
|
81
|
+
"timers",
|
|
82
|
+
"timers/promises",
|
|
83
|
+
"tls",
|
|
84
|
+
"trace_events",
|
|
85
|
+
"tty",
|
|
86
|
+
"url",
|
|
87
|
+
"util",
|
|
88
|
+
"util/types",
|
|
89
|
+
"v8",
|
|
90
|
+
"vm",
|
|
91
|
+
"wasi",
|
|
92
|
+
"worker_threads",
|
|
93
|
+
"zlib"
|
|
94
|
+
], own$1 = {}.hasOwnProperty, classRegExp = /^([A-Z][a-z\d]*)+$/, kTypes = /* @__PURE__ */ new Set([
|
|
95
|
+
"string",
|
|
96
|
+
"function",
|
|
97
|
+
"number",
|
|
98
|
+
"object",
|
|
99
|
+
"Function",
|
|
100
|
+
"Object",
|
|
101
|
+
"boolean",
|
|
102
|
+
"bigint",
|
|
103
|
+
"symbol"
|
|
104
|
+
]), messages = /* @__PURE__ */ new Map(), nodeInternalPrefix = "__node_internal_", userStackTraceLimit;
|
|
105
|
+
function formatList(array, type = "and") {
|
|
106
|
+
return array.length < 3 ? array.join(` ${type} `) : `${array.slice(0, -1).join(", ")}, ${type} ${array.at(-1)}`;
|
|
107
|
+
}
|
|
108
|
+
function createError(sym, value, constructor) {
|
|
109
|
+
return messages.set(sym, value), makeNodeErrorWithCode(constructor, sym);
|
|
110
|
+
}
|
|
111
|
+
function makeNodeErrorWithCode(Base, key) {
|
|
112
|
+
return function(...parameters) {
|
|
113
|
+
let limit = Error.stackTraceLimit;
|
|
114
|
+
isErrorStackTraceLimitWritable() && (Error.stackTraceLimit = 0);
|
|
115
|
+
let error = new Base();
|
|
116
|
+
isErrorStackTraceLimitWritable() && (Error.stackTraceLimit = limit);
|
|
117
|
+
let message = getMessage(key, parameters, error);
|
|
118
|
+
return Object.defineProperties(error, {
|
|
119
|
+
message: {
|
|
120
|
+
value: message,
|
|
121
|
+
enumerable: !1,
|
|
122
|
+
writable: !0,
|
|
123
|
+
configurable: !0
|
|
124
|
+
},
|
|
125
|
+
toString: {
|
|
126
|
+
value() {
|
|
127
|
+
return `${this.name} [${key}]: ${this.message}`;
|
|
128
|
+
},
|
|
129
|
+
enumerable: !1,
|
|
130
|
+
writable: !0,
|
|
131
|
+
configurable: !0
|
|
132
|
+
}
|
|
133
|
+
}), captureLargerStackTrace(error), error.code = key, error;
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function isErrorStackTraceLimitWritable() {
|
|
137
|
+
try {
|
|
138
|
+
if (v8.startupSnapshot.isBuildingSnapshot()) return !1;
|
|
139
|
+
} catch {
|
|
140
|
+
}
|
|
141
|
+
let desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
|
|
142
|
+
return desc === void 0 ? Object.isExtensible(Error) : own$1.call(desc, "writable") && desc.writable !== void 0 ? desc.writable : desc.set !== void 0;
|
|
143
|
+
}
|
|
144
|
+
function hideStackFrames(wrappedFunction) {
|
|
145
|
+
let hidden = nodeInternalPrefix + wrappedFunction.name;
|
|
146
|
+
return Object.defineProperty(wrappedFunction, "name", { value: hidden }), wrappedFunction;
|
|
147
|
+
}
|
|
148
|
+
var captureLargerStackTrace = hideStackFrames(function(error) {
|
|
149
|
+
let stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
|
|
150
|
+
return stackTraceLimitIsWritable && (userStackTraceLimit = Error.stackTraceLimit, Error.stackTraceLimit = Number.POSITIVE_INFINITY), Error.captureStackTrace(error), stackTraceLimitIsWritable && (Error.stackTraceLimit = userStackTraceLimit), error;
|
|
151
|
+
});
|
|
152
|
+
function getMessage(key, parameters, self) {
|
|
153
|
+
let message = messages.get(key);
|
|
154
|
+
if (assert.ok(message !== void 0, "expected `message` to be found"), typeof message == "function")
|
|
155
|
+
return assert.ok(message.length <= parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`), Reflect.apply(message, self, parameters);
|
|
156
|
+
let regex = /%[dfijoOs]/g, expectedLength = 0;
|
|
157
|
+
for (; regex.exec(message) !== null; ) expectedLength++;
|
|
158
|
+
return assert.ok(expectedLength === parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`), parameters.length === 0 ? message : (parameters.unshift(message), Reflect.apply(format, null, parameters));
|
|
159
|
+
}
|
|
160
|
+
function determineSpecificType(value) {
|
|
161
|
+
if (value == null) return String(value);
|
|
162
|
+
if (typeof value == "function" && value.name) return `function ${value.name}`;
|
|
163
|
+
if (typeof value == "object")
|
|
164
|
+
return value.constructor && value.constructor.name ? `an instance of ${value.constructor.name}` : `${inspect(value, { depth: -1 })}`;
|
|
165
|
+
let inspected = inspect(value, { colors: !1 });
|
|
166
|
+
return inspected.length > 28 && (inspected = `${inspected.slice(0, 25)}...`), `type ${typeof value} (${inspected})`;
|
|
167
|
+
}
|
|
168
|
+
var ERR_INVALID_ARG_TYPE = createError("ERR_INVALID_ARG_TYPE", (name, expected, actual) => {
|
|
169
|
+
assert.ok(typeof name == "string", "'name' must be a string"), Array.isArray(expected) || (expected = [expected]);
|
|
170
|
+
let message = "The ";
|
|
171
|
+
if (name.endsWith(" argument")) message += `${name} `;
|
|
172
|
+
else {
|
|
173
|
+
let type = name.includes(".") ? "property" : "argument";
|
|
174
|
+
message += `"${name}" ${type} `;
|
|
175
|
+
}
|
|
176
|
+
message += "must be ";
|
|
177
|
+
let types = [], instances = [], other = [];
|
|
178
|
+
for (let value of expected)
|
|
179
|
+
assert.ok(typeof value == "string", "All expected entries have to be of type string"), kTypes.has(value) ? types.push(value.toLowerCase()) : classRegExp.exec(value) === null ? (assert.ok(value !== "object", 'The value "object" should be written as "Object"'), other.push(value)) : instances.push(value);
|
|
180
|
+
if (instances.length > 0) {
|
|
181
|
+
let pos = types.indexOf("object");
|
|
182
|
+
pos !== -1 && (types.slice(pos, 1), instances.push("Object"));
|
|
183
|
+
}
|
|
184
|
+
return types.length > 0 && (message += `${types.length > 1 ? "one of type" : "of type"} ${formatList(types, "or")}`, (instances.length > 0 || other.length > 0) && (message += " or ")), instances.length > 0 && (message += `an instance of ${formatList(instances, "or")}`, other.length > 0 && (message += " or ")), other.length > 0 && (other.length > 1 ? message += `one of ${formatList(other, "or")}` : (other[0]?.toLowerCase() !== other[0] && (message += "an "), message += `${other[0]}`)), message += `. Received ${determineSpecificType(actual)}`, message;
|
|
185
|
+
}, TypeError), ERR_INVALID_MODULE_SPECIFIER = createError(
|
|
186
|
+
"ERR_INVALID_MODULE_SPECIFIER",
|
|
187
|
+
/**
|
|
188
|
+
* @param {string} request
|
|
189
|
+
* @param {string} reason
|
|
190
|
+
* @param {string} [base]
|
|
191
|
+
*/
|
|
192
|
+
(request, reason, base) => `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`,
|
|
193
|
+
TypeError
|
|
194
|
+
), ERR_INVALID_PACKAGE_CONFIG = createError("ERR_INVALID_PACKAGE_CONFIG", (path$1, base, message) => `Invalid package config ${path$1}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`, Error), ERR_INVALID_PACKAGE_TARGET = createError("ERR_INVALID_PACKAGE_TARGET", (packagePath, key, target, isImport = !1, base) => {
|
|
195
|
+
let relatedError = typeof target == "string" && !isImport && target.length > 0 && !target.startsWith("./");
|
|
196
|
+
return key === "." ? (assert.ok(isImport === !1), `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`) : `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(target)} defined for '${key}' in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`;
|
|
197
|
+
}, Error), ERR_MODULE_NOT_FOUND = createError("ERR_MODULE_NOT_FOUND", (path$1, base, exactUrl = !1) => `Cannot find ${exactUrl ? "module" : "package"} '${path$1}' imported from ${base}`, Error), ERR_NETWORK_IMPORT_DISALLOWED = createError("ERR_NETWORK_IMPORT_DISALLOWED", "import of '%s' by %s is not supported: %s", Error), ERR_PACKAGE_IMPORT_NOT_DEFINED = createError("ERR_PACKAGE_IMPORT_NOT_DEFINED", (specifier, packagePath, base) => `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath || ""}package.json` : ""} imported from ${base}`, TypeError), ERR_PACKAGE_PATH_NOT_EXPORTED = createError(
|
|
198
|
+
"ERR_PACKAGE_PATH_NOT_EXPORTED",
|
|
199
|
+
/**
|
|
200
|
+
* @param {string} packagePath
|
|
201
|
+
* @param {string} subpath
|
|
202
|
+
* @param {string} [base]
|
|
203
|
+
*/
|
|
204
|
+
(packagePath, subpath, base) => subpath === "." ? `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}` : `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`,
|
|
205
|
+
Error
|
|
206
|
+
), ERR_UNSUPPORTED_DIR_IMPORT = createError("ERR_UNSUPPORTED_DIR_IMPORT", "Directory import '%s' is not supported resolving ES modules imported from %s", Error), ERR_UNSUPPORTED_RESOLVE_REQUEST = createError("ERR_UNSUPPORTED_RESOLVE_REQUEST", 'Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.', TypeError), ERR_UNKNOWN_FILE_EXTENSION = createError("ERR_UNKNOWN_FILE_EXTENSION", (extension, path$1) => `Unknown file extension "${extension}" for ${path$1}`, TypeError), ERR_INVALID_ARG_VALUE = createError("ERR_INVALID_ARG_VALUE", (name, value, reason = "is invalid") => {
|
|
207
|
+
let inspected = inspect(value);
|
|
208
|
+
return inspected.length > 128 && (inspected = `${inspected.slice(0, 128)}...`), `The ${name.includes(".") ? "property" : "argument"} '${name}' ${reason}. Received ${inspected}`;
|
|
209
|
+
}, TypeError), hasOwnProperty$1 = {}.hasOwnProperty, cache = /* @__PURE__ */ new Map();
|
|
210
|
+
function read(jsonPath, { base, specifier }) {
|
|
211
|
+
let existing = cache.get(jsonPath);
|
|
212
|
+
if (existing) return existing;
|
|
213
|
+
let string;
|
|
214
|
+
try {
|
|
215
|
+
string = fs.readFileSync(path.toNamespacedPath(jsonPath), "utf8");
|
|
216
|
+
} catch (error) {
|
|
217
|
+
let exception = error;
|
|
218
|
+
if (exception.code !== "ENOENT") throw exception;
|
|
219
|
+
}
|
|
220
|
+
let result = {
|
|
221
|
+
exists: !1,
|
|
222
|
+
pjsonPath: jsonPath,
|
|
223
|
+
main: void 0,
|
|
224
|
+
name: void 0,
|
|
225
|
+
type: "none",
|
|
226
|
+
exports: void 0,
|
|
227
|
+
imports: void 0
|
|
228
|
+
};
|
|
229
|
+
if (string !== void 0) {
|
|
230
|
+
let parsed;
|
|
231
|
+
try {
|
|
232
|
+
parsed = JSON.parse(string);
|
|
233
|
+
} catch (error_) {
|
|
234
|
+
let error = new ERR_INVALID_PACKAGE_CONFIG(jsonPath, (base ? `"${specifier}" from ` : "") + fileURLToPath(base || specifier), error_.message);
|
|
235
|
+
throw error.cause = error_, error;
|
|
236
|
+
}
|
|
237
|
+
result.exists = !0, hasOwnProperty$1.call(parsed, "name") && typeof parsed.name == "string" && (result.name = parsed.name), hasOwnProperty$1.call(parsed, "main") && typeof parsed.main == "string" && (result.main = parsed.main), hasOwnProperty$1.call(parsed, "exports") && (result.exports = parsed.exports), hasOwnProperty$1.call(parsed, "imports") && (result.imports = parsed.imports), hasOwnProperty$1.call(parsed, "type") && (parsed.type === "commonjs" || parsed.type === "module") && (result.type = parsed.type);
|
|
238
|
+
}
|
|
239
|
+
return cache.set(jsonPath, result), result;
|
|
240
|
+
}
|
|
241
|
+
function getPackageScopeConfig(resolved) {
|
|
242
|
+
let packageJSONUrl = new URL("package.json", resolved);
|
|
243
|
+
for (; !packageJSONUrl.pathname.endsWith("node_modules/package.json"); ) {
|
|
244
|
+
let packageConfig = read(fileURLToPath(packageJSONUrl), { specifier: resolved });
|
|
245
|
+
if (packageConfig.exists) return packageConfig;
|
|
246
|
+
let lastPackageJSONUrl = packageJSONUrl;
|
|
247
|
+
if (packageJSONUrl = new URL("../package.json", packageJSONUrl), packageJSONUrl.pathname === lastPackageJSONUrl.pathname) break;
|
|
248
|
+
}
|
|
249
|
+
return {
|
|
250
|
+
pjsonPath: fileURLToPath(packageJSONUrl),
|
|
251
|
+
exists: !1,
|
|
252
|
+
type: "none"
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
var hasOwnProperty = {}.hasOwnProperty, extensionFormatMap = {
|
|
256
|
+
__proto__: null,
|
|
257
|
+
".json": "json",
|
|
258
|
+
".cjs": "commonjs",
|
|
259
|
+
".cts": "commonjs",
|
|
260
|
+
".js": "module",
|
|
261
|
+
".ts": "module",
|
|
262
|
+
".mts": "module",
|
|
263
|
+
".mjs": "module"
|
|
264
|
+
}, protocolHandlers = {
|
|
265
|
+
__proto__: null,
|
|
266
|
+
"data:": getDataProtocolModuleFormat,
|
|
267
|
+
"file:": getFileProtocolModuleFormat,
|
|
268
|
+
"node:": () => "builtin"
|
|
269
|
+
};
|
|
270
|
+
function mimeToFormat(mime) {
|
|
271
|
+
return mime && /\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i.test(mime) ? "module" : mime === "application/json" ? "json" : null;
|
|
272
|
+
}
|
|
273
|
+
function getDataProtocolModuleFormat(parsed) {
|
|
274
|
+
let { 1: mime } = /^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(parsed.pathname) || [
|
|
275
|
+
null,
|
|
276
|
+
null,
|
|
277
|
+
null
|
|
278
|
+
];
|
|
279
|
+
return mimeToFormat(mime);
|
|
280
|
+
}
|
|
281
|
+
function extname(url) {
|
|
282
|
+
let pathname = url.pathname, index = pathname.length;
|
|
283
|
+
for (; index--; ) {
|
|
284
|
+
let code = pathname.codePointAt(index);
|
|
285
|
+
if (code === 47) return "";
|
|
286
|
+
if (code === 46) return pathname.codePointAt(index - 1) === 47 ? "" : pathname.slice(index);
|
|
287
|
+
}
|
|
288
|
+
return "";
|
|
289
|
+
}
|
|
290
|
+
function getFileProtocolModuleFormat(url, _context, ignoreErrors) {
|
|
291
|
+
let ext = extname(url);
|
|
292
|
+
if (ext === ".js") {
|
|
293
|
+
let { type: packageType } = getPackageScopeConfig(url);
|
|
294
|
+
return packageType !== "none" ? packageType : "commonjs";
|
|
295
|
+
}
|
|
296
|
+
if (ext === "") {
|
|
297
|
+
let { type: packageType } = getPackageScopeConfig(url);
|
|
298
|
+
return packageType === "none" || packageType === "commonjs" ? "commonjs" : "module";
|
|
299
|
+
}
|
|
300
|
+
let format$1 = extensionFormatMap[ext];
|
|
301
|
+
if (format$1) return format$1;
|
|
302
|
+
if (!ignoreErrors)
|
|
303
|
+
throw new ERR_UNKNOWN_FILE_EXTENSION(ext, fileURLToPath(url));
|
|
304
|
+
}
|
|
305
|
+
function defaultGetFormatWithoutErrors(url, context) {
|
|
306
|
+
let protocol = url.protocol;
|
|
307
|
+
return hasOwnProperty.call(protocolHandlers, protocol) && protocolHandlers[protocol](url, context, !0) || null;
|
|
308
|
+
}
|
|
309
|
+
var RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace], own = {}.hasOwnProperty, invalidSegmentRegEx = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i, deprecatedInvalidSegmentRegEx = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\|\/|$)/i, invalidPackageNameRegEx = /^\.|%|\\/, patternRegEx = /\*/g, encodedSeparatorRegEx = /%2f|%5c/i, emittedPackageWarnings = /* @__PURE__ */ new Set(), doubleSlashRegEx = /[/\\]{2}/;
|
|
310
|
+
function emitInvalidSegmentDeprecation(target, request, match, packageJsonUrl, internal, base, isTarget) {
|
|
311
|
+
if (process$1.noDeprecation) return;
|
|
312
|
+
let pjsonPath = fileURLToPath(packageJsonUrl), double = doubleSlashRegEx.exec(isTarget ? target : request) !== null;
|
|
313
|
+
process$1.emitWarning(`Use of deprecated ${double ? "double slash" : "leading or trailing slash matching"} resolving "${target}" for module request "${request}" ${request === match ? "" : `matched to "${match}" `}in the "${internal ? "imports" : "exports"}" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${fileURLToPath(base)}` : ""}.`, "DeprecationWarning", "DEP0166");
|
|
314
|
+
}
|
|
315
|
+
function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
|
|
316
|
+
if (process$1.noDeprecation || defaultGetFormatWithoutErrors(url, { parentURL: base.href }) !== "module") return;
|
|
317
|
+
let urlPath = fileURLToPath(url.href), packagePath = fileURLToPath(new URL$1(".", packageJsonUrl)), basePath = fileURLToPath(base);
|
|
318
|
+
main ? path.resolve(packagePath, main) !== urlPath && process$1.emitWarning(`Package ${packagePath} has a "main" field set to "${main}", excluding the full filename and extension to the resolved file at "${urlPath.slice(packagePath.length)}", imported from ${basePath}.
|
|
319
|
+
Automatic extension resolution of the "main" field is deprecated for ES modules.`, "DeprecationWarning", "DEP0151") : process$1.emitWarning(`No "main" or "exports" field defined in the package.json for ${packagePath} resolving the main entry point "${urlPath.slice(packagePath.length)}", imported from ${basePath}.
|
|
320
|
+
Default "index" lookups for the main are deprecated for ES modules.`, "DeprecationWarning", "DEP0151");
|
|
321
|
+
}
|
|
322
|
+
function tryStatSync(path$1) {
|
|
323
|
+
try {
|
|
324
|
+
return statSync(path$1);
|
|
325
|
+
} catch {
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
function fileExists(url) {
|
|
329
|
+
let stats = statSync(url, { throwIfNoEntry: !1 }), isFile = stats ? stats.isFile() : void 0;
|
|
330
|
+
return isFile ?? !1;
|
|
331
|
+
}
|
|
332
|
+
function legacyMainResolve(packageJsonUrl, packageConfig, base) {
|
|
333
|
+
let guess;
|
|
334
|
+
if (packageConfig.main !== void 0) {
|
|
335
|
+
if (guess = new URL$1(packageConfig.main, packageJsonUrl), fileExists(guess)) return guess;
|
|
336
|
+
let tries$1 = [
|
|
337
|
+
`./${packageConfig.main}.js`,
|
|
338
|
+
`./${packageConfig.main}.json`,
|
|
339
|
+
`./${packageConfig.main}.node`,
|
|
340
|
+
`./${packageConfig.main}/index.js`,
|
|
341
|
+
`./${packageConfig.main}/index.json`,
|
|
342
|
+
`./${packageConfig.main}/index.node`
|
|
343
|
+
], i$1 = -1;
|
|
344
|
+
for (; ++i$1 < tries$1.length && (guess = new URL$1(tries$1[i$1], packageJsonUrl), !fileExists(guess)); )
|
|
345
|
+
guess = void 0;
|
|
346
|
+
if (guess)
|
|
347
|
+
return emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main), guess;
|
|
348
|
+
}
|
|
349
|
+
let tries = [
|
|
350
|
+
"./index.js",
|
|
351
|
+
"./index.json",
|
|
352
|
+
"./index.node"
|
|
353
|
+
], i = -1;
|
|
354
|
+
for (; ++i < tries.length && (guess = new URL$1(tries[i], packageJsonUrl), !fileExists(guess)); )
|
|
355
|
+
guess = void 0;
|
|
356
|
+
if (guess)
|
|
357
|
+
return emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main), guess;
|
|
358
|
+
throw new ERR_MODULE_NOT_FOUND(fileURLToPath(new URL$1(".", packageJsonUrl)), fileURLToPath(base));
|
|
359
|
+
}
|
|
360
|
+
function finalizeResolution(resolved, base, preserveSymlinks) {
|
|
361
|
+
if (encodedSeparatorRegEx.exec(resolved.pathname) !== null) throw new ERR_INVALID_MODULE_SPECIFIER(resolved.pathname, String.raw`must not include encoded "/" or "\" characters`, fileURLToPath(base));
|
|
362
|
+
let filePath;
|
|
363
|
+
try {
|
|
364
|
+
filePath = fileURLToPath(resolved);
|
|
365
|
+
} catch (error) {
|
|
366
|
+
throw Object.defineProperty(error, "input", { value: String(resolved) }), Object.defineProperty(error, "module", { value: String(base) }), error;
|
|
367
|
+
}
|
|
368
|
+
let stats = tryStatSync(filePath.endsWith("/") ? filePath.slice(-1) : filePath);
|
|
369
|
+
if (stats && stats.isDirectory()) {
|
|
370
|
+
let error = new ERR_UNSUPPORTED_DIR_IMPORT(filePath, fileURLToPath(base));
|
|
371
|
+
throw error.url = String(resolved), error;
|
|
372
|
+
}
|
|
373
|
+
if (!stats || !stats.isFile()) {
|
|
374
|
+
let error = new ERR_MODULE_NOT_FOUND(filePath || resolved.pathname, base && fileURLToPath(base), !0);
|
|
375
|
+
throw error.url = String(resolved), error;
|
|
376
|
+
}
|
|
377
|
+
if (!preserveSymlinks) {
|
|
378
|
+
let real = realpathSync(filePath), { search, hash } = resolved;
|
|
379
|
+
resolved = pathToFileURL(real + (filePath.endsWith(path.sep) ? "/" : "")), resolved.search = search, resolved.hash = hash;
|
|
380
|
+
}
|
|
381
|
+
return resolved;
|
|
382
|
+
}
|
|
383
|
+
function importNotDefined(specifier, packageJsonUrl, base) {
|
|
384
|
+
return new ERR_PACKAGE_IMPORT_NOT_DEFINED(specifier, packageJsonUrl && fileURLToPath(new URL$1(".", packageJsonUrl)), fileURLToPath(base));
|
|
385
|
+
}
|
|
386
|
+
function exportsNotFound(subpath, packageJsonUrl, base) {
|
|
387
|
+
return new ERR_PACKAGE_PATH_NOT_EXPORTED(fileURLToPath(new URL$1(".", packageJsonUrl)), subpath, base && fileURLToPath(base));
|
|
388
|
+
}
|
|
389
|
+
function throwInvalidSubpath(request, match, packageJsonUrl, internal, base) {
|
|
390
|
+
throw new ERR_INVALID_MODULE_SPECIFIER(request, `request is not a valid match in pattern "${match}" for the "${internal ? "imports" : "exports"}" resolution of ${fileURLToPath(packageJsonUrl)}`, base && fileURLToPath(base));
|
|
391
|
+
}
|
|
392
|
+
function invalidPackageTarget(subpath, target, packageJsonUrl, internal, base) {
|
|
393
|
+
return target = typeof target == "object" && target !== null ? JSON.stringify(target, null, "") : `${target}`, new ERR_INVALID_PACKAGE_TARGET(fileURLToPath(new URL$1(".", packageJsonUrl)), subpath, target, internal, base && fileURLToPath(base));
|
|
394
|
+
}
|
|
395
|
+
function resolvePackageTargetString(target, subpath, match, packageJsonUrl, base, pattern, internal, isPathMap, conditions) {
|
|
396
|
+
if (subpath !== "" && !pattern && target.at(-1) !== "/") throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
|
|
397
|
+
if (!target.startsWith("./")) {
|
|
398
|
+
if (internal && !target.startsWith("../") && !target.startsWith("/")) {
|
|
399
|
+
let isURL = !1;
|
|
400
|
+
try {
|
|
401
|
+
new URL$1(target), isURL = !0;
|
|
402
|
+
} catch {
|
|
403
|
+
}
|
|
404
|
+
if (!isURL) return packageResolve(pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, () => subpath) : target + subpath, packageJsonUrl, conditions);
|
|
405
|
+
}
|
|
406
|
+
throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
|
|
407
|
+
}
|
|
408
|
+
if (invalidSegmentRegEx.exec(target.slice(2)) !== null) if (deprecatedInvalidSegmentRegEx.exec(target.slice(2)) === null) {
|
|
409
|
+
if (!isPathMap) {
|
|
410
|
+
let request = pattern ? match.replace("*", () => subpath) : match + subpath;
|
|
411
|
+
emitInvalidSegmentDeprecation(pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, () => subpath) : target, request, match, packageJsonUrl, internal, base, !0);
|
|
412
|
+
}
|
|
413
|
+
} else throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
|
|
414
|
+
let resolved = new URL$1(target, packageJsonUrl), resolvedPath = resolved.pathname, packagePath = new URL$1(".", packageJsonUrl).pathname;
|
|
415
|
+
if (!resolvedPath.startsWith(packagePath)) throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
|
|
416
|
+
if (subpath === "") return resolved;
|
|
417
|
+
if (invalidSegmentRegEx.exec(subpath) !== null) {
|
|
418
|
+
let request = pattern ? match.replace("*", () => subpath) : match + subpath;
|
|
419
|
+
deprecatedInvalidSegmentRegEx.exec(subpath) === null ? isPathMap || emitInvalidSegmentDeprecation(pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, () => subpath) : target, request, match, packageJsonUrl, internal, base, !1) : throwInvalidSubpath(request, match, packageJsonUrl, internal, base);
|
|
420
|
+
}
|
|
421
|
+
return pattern ? new URL$1(RegExpPrototypeSymbolReplace.call(patternRegEx, resolved.href, () => subpath)) : new URL$1(subpath, resolved);
|
|
422
|
+
}
|
|
423
|
+
function isArrayIndex(key) {
|
|
424
|
+
let keyNumber = Number(key);
|
|
425
|
+
return `${keyNumber}` !== key ? !1 : keyNumber >= 0 && keyNumber < 4294967295;
|
|
426
|
+
}
|
|
427
|
+
function resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, base, pattern, internal, isPathMap, conditions) {
|
|
428
|
+
if (typeof target == "string") return resolvePackageTargetString(target, subpath, packageSubpath, packageJsonUrl, base, pattern, internal, isPathMap, conditions);
|
|
429
|
+
if (Array.isArray(target)) {
|
|
430
|
+
let targetList = target;
|
|
431
|
+
if (targetList.length === 0) return null;
|
|
432
|
+
let lastException, i = -1;
|
|
433
|
+
for (; ++i < targetList.length; ) {
|
|
434
|
+
let targetItem = targetList[i], resolveResult;
|
|
435
|
+
try {
|
|
436
|
+
resolveResult = resolvePackageTarget(packageJsonUrl, targetItem, subpath, packageSubpath, base, pattern, internal, isPathMap, conditions);
|
|
437
|
+
} catch (error) {
|
|
438
|
+
let exception = error;
|
|
439
|
+
if (lastException = exception, exception.code === "ERR_INVALID_PACKAGE_TARGET") continue;
|
|
440
|
+
throw error;
|
|
441
|
+
}
|
|
442
|
+
if (resolveResult !== void 0) {
|
|
443
|
+
if (resolveResult === null) {
|
|
444
|
+
lastException = null;
|
|
445
|
+
continue;
|
|
446
|
+
}
|
|
447
|
+
return resolveResult;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
if (lastException == null) return null;
|
|
451
|
+
throw lastException;
|
|
452
|
+
}
|
|
453
|
+
if (typeof target == "object" && target !== null) {
|
|
454
|
+
let keys = Object.getOwnPropertyNames(target), i = -1;
|
|
455
|
+
for (; ++i < keys.length; ) {
|
|
456
|
+
let key = keys[i];
|
|
457
|
+
if (isArrayIndex(key)) throw new ERR_INVALID_PACKAGE_CONFIG(fileURLToPath(packageJsonUrl), fileURLToPath(base), '"exports" cannot contain numeric property keys.');
|
|
458
|
+
}
|
|
459
|
+
for (i = -1; ++i < keys.length; ) {
|
|
460
|
+
let key = keys[i];
|
|
461
|
+
if (key === "default" || conditions && conditions.has(key)) {
|
|
462
|
+
let conditionalTarget = target[key], resolveResult = resolvePackageTarget(packageJsonUrl, conditionalTarget, subpath, packageSubpath, base, pattern, internal, isPathMap, conditions);
|
|
463
|
+
if (resolveResult === void 0) continue;
|
|
464
|
+
return resolveResult;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
return null;
|
|
468
|
+
}
|
|
469
|
+
if (target === null) return null;
|
|
470
|
+
throw invalidPackageTarget(packageSubpath, target, packageJsonUrl, internal, base);
|
|
471
|
+
}
|
|
472
|
+
function isConditionalExportsMainSugar(exports, packageJsonUrl, base) {
|
|
473
|
+
if (typeof exports == "string" || Array.isArray(exports)) return !0;
|
|
474
|
+
if (typeof exports != "object" || exports === null) return !1;
|
|
475
|
+
let keys = Object.getOwnPropertyNames(exports), isConditionalSugar = !1, i = 0, keyIndex = -1;
|
|
476
|
+
for (; ++keyIndex < keys.length; ) {
|
|
477
|
+
let key = keys[keyIndex], currentIsConditionalSugar = key === "" || key[0] !== ".";
|
|
478
|
+
if (i++ === 0) isConditionalSugar = currentIsConditionalSugar;
|
|
479
|
+
else if (isConditionalSugar !== currentIsConditionalSugar) throw new ERR_INVALID_PACKAGE_CONFIG(fileURLToPath(packageJsonUrl), fileURLToPath(base), `"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`);
|
|
480
|
+
}
|
|
481
|
+
return isConditionalSugar;
|
|
482
|
+
}
|
|
483
|
+
function emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) {
|
|
484
|
+
if (process$1.noDeprecation) return;
|
|
485
|
+
let pjsonPath = fileURLToPath(pjsonUrl);
|
|
486
|
+
emittedPackageWarnings.has(pjsonPath + "|" + match) || (emittedPackageWarnings.add(pjsonPath + "|" + match), process$1.emitWarning(`Use of deprecated trailing slash pattern mapping "${match}" in the "exports" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${fileURLToPath(base)}` : ""}. Mapping specifiers ending in "/" is no longer supported.`, "DeprecationWarning", "DEP0155"));
|
|
487
|
+
}
|
|
488
|
+
function packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions) {
|
|
489
|
+
let exports = packageConfig.exports;
|
|
490
|
+
if (isConditionalExportsMainSugar(exports, packageJsonUrl, base) && (exports = { ".": exports }), own.call(exports, packageSubpath) && !packageSubpath.includes("*") && !packageSubpath.endsWith("/")) {
|
|
491
|
+
let target = exports[packageSubpath], resolveResult = resolvePackageTarget(packageJsonUrl, target, "", packageSubpath, base, !1, !1, !1, conditions);
|
|
492
|
+
if (resolveResult == null) throw exportsNotFound(packageSubpath, packageJsonUrl, base);
|
|
493
|
+
return resolveResult;
|
|
494
|
+
}
|
|
495
|
+
let bestMatch = "", bestMatchSubpath = "", keys = Object.getOwnPropertyNames(exports), i = -1;
|
|
496
|
+
for (; ++i < keys.length; ) {
|
|
497
|
+
let key = keys[i], patternIndex = key.indexOf("*");
|
|
498
|
+
if (patternIndex !== -1 && packageSubpath.startsWith(key.slice(0, patternIndex))) {
|
|
499
|
+
packageSubpath.endsWith("/") && emitTrailingSlashPatternDeprecation(packageSubpath, packageJsonUrl, base);
|
|
500
|
+
let patternTrailer = key.slice(patternIndex + 1);
|
|
501
|
+
packageSubpath.length >= key.length && packageSubpath.endsWith(patternTrailer) && patternKeyCompare(bestMatch, key) === 1 && key.lastIndexOf("*") === patternIndex && (bestMatch = key, bestMatchSubpath = packageSubpath.slice(patternIndex, packageSubpath.length - patternTrailer.length));
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
if (bestMatch) {
|
|
505
|
+
let target = exports[bestMatch], resolveResult = resolvePackageTarget(packageJsonUrl, target, bestMatchSubpath, bestMatch, base, !0, !1, packageSubpath.endsWith("/"), conditions);
|
|
506
|
+
if (resolveResult == null) throw exportsNotFound(packageSubpath, packageJsonUrl, base);
|
|
507
|
+
return resolveResult;
|
|
508
|
+
}
|
|
509
|
+
throw exportsNotFound(packageSubpath, packageJsonUrl, base);
|
|
510
|
+
}
|
|
511
|
+
function patternKeyCompare(a, b) {
|
|
512
|
+
let aPatternIndex = a.indexOf("*"), bPatternIndex = b.indexOf("*"), baseLengthA = aPatternIndex === -1 ? a.length : aPatternIndex + 1, baseLengthB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;
|
|
513
|
+
return baseLengthA > baseLengthB ? -1 : baseLengthB > baseLengthA || aPatternIndex === -1 ? 1 : bPatternIndex === -1 || a.length > b.length ? -1 : b.length > a.length ? 1 : 0;
|
|
514
|
+
}
|
|
515
|
+
function packageImportsResolve(name, base, conditions) {
|
|
516
|
+
if (name === "#" || name.startsWith("#/") || name.endsWith("/")) throw new ERR_INVALID_MODULE_SPECIFIER(name, "is not a valid internal imports specifier name", fileURLToPath(base));
|
|
517
|
+
let packageJsonUrl, packageConfig = getPackageScopeConfig(base);
|
|
518
|
+
if (packageConfig.exists) {
|
|
519
|
+
packageJsonUrl = pathToFileURL(packageConfig.pjsonPath);
|
|
520
|
+
let imports = packageConfig.imports;
|
|
521
|
+
if (imports) if (own.call(imports, name) && !name.includes("*")) {
|
|
522
|
+
let resolveResult = resolvePackageTarget(packageJsonUrl, imports[name], "", name, base, !1, !0, !1, conditions);
|
|
523
|
+
if (resolveResult != null) return resolveResult;
|
|
524
|
+
} else {
|
|
525
|
+
let bestMatch = "", bestMatchSubpath = "", keys = Object.getOwnPropertyNames(imports), i = -1;
|
|
526
|
+
for (; ++i < keys.length; ) {
|
|
527
|
+
let key = keys[i], patternIndex = key.indexOf("*");
|
|
528
|
+
if (patternIndex !== -1 && name.startsWith(key.slice(0, -1))) {
|
|
529
|
+
let patternTrailer = key.slice(patternIndex + 1);
|
|
530
|
+
name.length >= key.length && name.endsWith(patternTrailer) && patternKeyCompare(bestMatch, key) === 1 && key.lastIndexOf("*") === patternIndex && (bestMatch = key, bestMatchSubpath = name.slice(patternIndex, name.length - patternTrailer.length));
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
if (bestMatch) {
|
|
534
|
+
let target = imports[bestMatch], resolveResult = resolvePackageTarget(packageJsonUrl, target, bestMatchSubpath, bestMatch, base, !0, !0, !1, conditions);
|
|
535
|
+
if (resolveResult != null) return resolveResult;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
throw importNotDefined(name, packageJsonUrl, base);
|
|
540
|
+
}
|
|
541
|
+
function parsePackageName(specifier, base) {
|
|
542
|
+
let separatorIndex = specifier.indexOf("/"), validPackageName = !0, isScoped = !1;
|
|
543
|
+
specifier[0] === "@" && (isScoped = !0, separatorIndex === -1 || specifier.length === 0 ? validPackageName = !1 : separatorIndex = specifier.indexOf("/", separatorIndex + 1));
|
|
544
|
+
let packageName = separatorIndex === -1 ? specifier : specifier.slice(0, separatorIndex);
|
|
545
|
+
if (invalidPackageNameRegEx.exec(packageName) !== null && (validPackageName = !1), !validPackageName) throw new ERR_INVALID_MODULE_SPECIFIER(specifier, "is not a valid package name", fileURLToPath(base));
|
|
546
|
+
return {
|
|
547
|
+
packageName,
|
|
548
|
+
packageSubpath: "." + (separatorIndex === -1 ? "" : specifier.slice(separatorIndex)),
|
|
549
|
+
isScoped
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
function packageResolve(specifier, base, conditions) {
|
|
553
|
+
if (nodeBuiltins.includes(specifier)) return new URL$1("node:" + specifier);
|
|
554
|
+
let { packageName, packageSubpath, isScoped } = parsePackageName(specifier, base), packageConfig = getPackageScopeConfig(base);
|
|
555
|
+
if (packageConfig.exists && packageConfig.name === packageName && packageConfig.exports !== void 0 && packageConfig.exports !== null) return packageExportsResolve(pathToFileURL(packageConfig.pjsonPath), packageSubpath, packageConfig, base, conditions);
|
|
556
|
+
let packageJsonUrl = new URL$1("./node_modules/" + packageName + "/package.json", base), packageJsonPath = fileURLToPath(packageJsonUrl), lastPath;
|
|
557
|
+
do {
|
|
558
|
+
let stat = tryStatSync(packageJsonPath.slice(0, -13));
|
|
559
|
+
if (!stat || !stat.isDirectory()) {
|
|
560
|
+
lastPath = packageJsonPath, packageJsonUrl = new URL$1((isScoped ? "../../../../node_modules/" : "../../../node_modules/") + packageName + "/package.json", packageJsonUrl), packageJsonPath = fileURLToPath(packageJsonUrl);
|
|
561
|
+
continue;
|
|
562
|
+
}
|
|
563
|
+
let packageConfig$1 = read(packageJsonPath, {
|
|
564
|
+
base,
|
|
565
|
+
specifier
|
|
566
|
+
});
|
|
567
|
+
return packageConfig$1.exports !== void 0 && packageConfig$1.exports !== null ? packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig$1, base, conditions) : packageSubpath === "." ? legacyMainResolve(packageJsonUrl, packageConfig$1, base) : new URL$1(packageSubpath, packageJsonUrl);
|
|
568
|
+
} while (packageJsonPath.length !== lastPath.length);
|
|
569
|
+
throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), !1);
|
|
570
|
+
}
|
|
571
|
+
function isRelativeSpecifier(specifier) {
|
|
572
|
+
return specifier[0] === "." && (specifier.length === 1 || specifier[1] === "/" || specifier[1] === "." && (specifier.length === 2 || specifier[2] === "/"));
|
|
573
|
+
}
|
|
574
|
+
function shouldBeTreatedAsRelativeOrAbsolutePath(specifier) {
|
|
575
|
+
return specifier === "" ? !1 : specifier[0] === "/" ? !0 : isRelativeSpecifier(specifier);
|
|
576
|
+
}
|
|
577
|
+
function moduleResolve(specifier, base, conditions, preserveSymlinks) {
|
|
578
|
+
let protocol = base.protocol, isData = protocol === "data:", resolved;
|
|
579
|
+
if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) try {
|
|
580
|
+
resolved = new URL$1(specifier, base);
|
|
581
|
+
} catch (error_) {
|
|
582
|
+
let error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base);
|
|
583
|
+
throw error.cause = error_, error;
|
|
584
|
+
}
|
|
585
|
+
else if (protocol === "file:" && specifier[0] === "#") resolved = packageImportsResolve(specifier, base, conditions);
|
|
586
|
+
else try {
|
|
587
|
+
resolved = new URL$1(specifier);
|
|
588
|
+
} catch (error_) {
|
|
589
|
+
if (isData && !nodeBuiltins.includes(specifier)) {
|
|
590
|
+
let error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base);
|
|
591
|
+
throw error.cause = error_, error;
|
|
592
|
+
}
|
|
593
|
+
resolved = packageResolve(specifier, base, conditions);
|
|
594
|
+
}
|
|
595
|
+
return assert.ok(resolved !== void 0, "expected to be defined"), resolved.protocol !== "file:" ? resolved : finalizeResolution(resolved, base, preserveSymlinks);
|
|
596
|
+
}
|
|
597
|
+
var DEFAULT_CONDITIONS_SET = /* @__PURE__ */ new Set(["node", "import"]), isWindows = process.platform === "win32", globalCache = globalThis.__EXSOLVE_CACHE__ ||= /* @__PURE__ */ new Map();
|
|
598
|
+
function resolveModuleURL(input, options) {
|
|
599
|
+
let parsedInput = _parseInput(input);
|
|
600
|
+
if ("external" in parsedInput) return parsedInput.external;
|
|
601
|
+
let specifier = parsedInput.specifier, url = parsedInput.url, absolutePath = parsedInput.absolutePath, cacheKey, cacheObj;
|
|
602
|
+
if (options?.cache !== !1 && (cacheKey = _cacheKey(absolutePath || specifier, options), cacheObj = options?.cache && typeof options?.cache == "object" ? options.cache : globalCache), cacheObj) {
|
|
603
|
+
let cached = cacheObj.get(cacheKey);
|
|
604
|
+
if (typeof cached == "string") return cached;
|
|
605
|
+
if (cached instanceof Error) {
|
|
606
|
+
if (options?.try) return;
|
|
607
|
+
throw cached;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
if (absolutePath) try {
|
|
611
|
+
let stat = lstatSync(absolutePath);
|
|
612
|
+
if (stat.isSymbolicLink() && (absolutePath = realpathSync(absolutePath), url = pathToFileURL(absolutePath)), stat.isFile())
|
|
613
|
+
return cacheObj && cacheObj.set(cacheKey, url.href), url.href;
|
|
614
|
+
} catch (error) {
|
|
615
|
+
if (error?.code !== "ENOENT")
|
|
616
|
+
throw cacheObj && cacheObj.set(cacheKey, error), error;
|
|
617
|
+
}
|
|
618
|
+
let conditionsSet = options?.conditions ? new Set(options.conditions) : DEFAULT_CONDITIONS_SET, target = specifier || url.href, bases = _normalizeBases(options?.from), suffixes = options?.suffixes || [""], extensions = options?.extensions ? ["", ...options.extensions] : [""], resolved;
|
|
619
|
+
for (let base of bases) {
|
|
620
|
+
for (let suffix of suffixes) {
|
|
621
|
+
let name = _join(target, suffix);
|
|
622
|
+
name === "." && (name += "/.");
|
|
623
|
+
for (let extension of extensions)
|
|
624
|
+
if (resolved = _tryModuleResolve(name + extension, base, conditionsSet), resolved) break;
|
|
625
|
+
if (resolved) break;
|
|
626
|
+
}
|
|
627
|
+
if (resolved) break;
|
|
628
|
+
}
|
|
629
|
+
if (!resolved) {
|
|
630
|
+
let error = new Error(`Cannot resolve module "${input}" (from: ${bases.map((u) => _fmtPath(u)).join(", ")})`);
|
|
631
|
+
if (error.code = "ERR_MODULE_NOT_FOUND", cacheObj && cacheObj.set(cacheKey, error), options?.try) return;
|
|
632
|
+
throw error;
|
|
633
|
+
}
|
|
634
|
+
return cacheObj && cacheObj.set(cacheKey, resolved.href), resolved.href;
|
|
635
|
+
}
|
|
636
|
+
function resolveModulePath(id, options) {
|
|
637
|
+
let resolved = resolveModuleURL(id, options);
|
|
638
|
+
if (!resolved || !resolved.startsWith("file://") && options?.try) return;
|
|
639
|
+
let absolutePath = fileURLToPath(resolved);
|
|
640
|
+
return isWindows ? _normalizeWinPath(absolutePath) : absolutePath;
|
|
641
|
+
}
|
|
642
|
+
function _tryModuleResolve(specifier, base, conditions) {
|
|
643
|
+
try {
|
|
644
|
+
return moduleResolve(specifier, base, conditions);
|
|
645
|
+
} catch {
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
function _normalizeBases(inputs) {
|
|
649
|
+
let urls = (Array.isArray(inputs) ? inputs : [inputs]).flatMap((input) => _normalizeBase(input));
|
|
650
|
+
return urls.length === 0 ? [pathToFileURL("./")] : urls;
|
|
651
|
+
}
|
|
652
|
+
function _normalizeBase(input) {
|
|
653
|
+
if (!input) return [];
|
|
654
|
+
if (_isURL(input)) return [input];
|
|
655
|
+
if (typeof input != "string") return [];
|
|
656
|
+
if (/^(?:node|data|http|https|file):/.test(input)) return new URL(input);
|
|
657
|
+
try {
|
|
658
|
+
return input.endsWith("/") || statSync(input).isDirectory() ? pathToFileURL(input + "/") : pathToFileURL(input);
|
|
659
|
+
} catch {
|
|
660
|
+
return [pathToFileURL(input + "/"), pathToFileURL(input)];
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
function _fmtPath(input) {
|
|
664
|
+
try {
|
|
665
|
+
return fileURLToPath(input);
|
|
666
|
+
} catch {
|
|
667
|
+
return input;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
function _cacheKey(id, opts) {
|
|
671
|
+
return JSON.stringify([
|
|
672
|
+
id,
|
|
673
|
+
(opts?.conditions || ["node", "import"]).sort(),
|
|
674
|
+
opts?.extensions,
|
|
675
|
+
opts?.from,
|
|
676
|
+
opts?.suffixes
|
|
677
|
+
]);
|
|
678
|
+
}
|
|
679
|
+
function _join(a, b) {
|
|
680
|
+
return !a || !b || b === "/" ? a : (a.endsWith("/") ? a : a + "/") + (b.startsWith("/") ? b.slice(1) : b);
|
|
681
|
+
}
|
|
682
|
+
function _normalizeWinPath(path$1) {
|
|
683
|
+
return path$1.replace(/\\/g, "/").replace(/^[a-z]:\//, (r) => r.toUpperCase());
|
|
684
|
+
}
|
|
685
|
+
function _isURL(input) {
|
|
686
|
+
return input instanceof URL || input?.constructor?.name === "URL";
|
|
687
|
+
}
|
|
688
|
+
function _parseInput(input) {
|
|
689
|
+
if (typeof input == "string") {
|
|
690
|
+
if (input.startsWith("file:")) {
|
|
691
|
+
let url = new URL(input);
|
|
692
|
+
return {
|
|
693
|
+
url,
|
|
694
|
+
absolutePath: fileURLToPath(url)
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
return isAbsolute(input) ? {
|
|
698
|
+
url: pathToFileURL(input),
|
|
699
|
+
absolutePath: input
|
|
700
|
+
} : /^(?:node|data|http|https):/.test(input) ? { external: input } : nodeBuiltins.includes(input) && !input.includes(":") ? { external: `node:${input}` } : { specifier: input };
|
|
701
|
+
}
|
|
702
|
+
if (_isURL(input))
|
|
703
|
+
return input.protocol === "file:" ? {
|
|
704
|
+
url: input,
|
|
705
|
+
absolutePath: fileURLToPath(input)
|
|
706
|
+
} : { external: input.href };
|
|
707
|
+
throw new TypeError("id must be a `string` or `URL`");
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
// src/shared/utils/module.ts
|
|
711
|
+
import { statSync as statSync2 } from "node:fs";
|
|
712
|
+
import { createRequire, register } from "node:module";
|
|
713
|
+
import { win32 } from "node:path/win32";
|
|
714
|
+
import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "node:url";
|
|
715
|
+
var importMetaResolve = (...args) => typeof import.meta.resolve != "function" && process.env.VITEST === "true" ? (console.warn(
|
|
716
|
+
"importMetaResolve from within Storybook is being used in a Vitest test, but it shouldn't be. Please report this at https://github.com/storybookjs/storybook/issues/new?template=bug_report.yml"
|
|
717
|
+
), pathToFileURL2(args[0]).href) : import.meta.resolve(...args), resolvePackageDir = (pkg, parent) => dirname(fileURLToPath2(importMetaResolve(join(pkg, "package.json"), parent))), isTypescriptLoaderRegistered = !1;
|
|
718
|
+
async function importModule(path2, { skipCache = !1 } = {}) {
|
|
719
|
+
if (!isTypescriptLoaderRegistered) {
|
|
720
|
+
let typescriptLoaderUrl = importMetaResolve("storybook/internal/bin/loader");
|
|
721
|
+
register(typescriptLoaderUrl, import.meta.url), isTypescriptLoaderRegistered = !0;
|
|
722
|
+
}
|
|
723
|
+
let mod;
|
|
724
|
+
try {
|
|
725
|
+
let resolvedPath = win32.isAbsolute(path2) ? pathToFileURL2(path2).href : path2;
|
|
726
|
+
mod = await import(skipCache ? `${resolvedPath}?${Date.now()}` : resolvedPath);
|
|
727
|
+
} catch (importError) {
|
|
728
|
+
try {
|
|
729
|
+
let require2 = createRequire(import.meta.url);
|
|
730
|
+
skipCache && delete require2.cache[require2.resolve(path2)], mod = require2(path2);
|
|
731
|
+
} catch {
|
|
732
|
+
throw importError;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
return mod.default ?? mod;
|
|
736
|
+
}
|
|
737
|
+
var safeResolveModule = ({
|
|
738
|
+
specifier,
|
|
739
|
+
parent,
|
|
740
|
+
extensions = [".mjs", ".js", ".cjs"]
|
|
741
|
+
}) => {
|
|
742
|
+
try {
|
|
743
|
+
let resolvedPath = resolveModulePath(specifier, {
|
|
744
|
+
from: parent,
|
|
745
|
+
extensions: [""].concat(extensions)
|
|
746
|
+
});
|
|
747
|
+
if (statSync2(resolvedPath).isFile())
|
|
748
|
+
return resolvedPath;
|
|
749
|
+
} catch {
|
|
750
|
+
}
|
|
751
|
+
};
|
|
752
|
+
|
|
753
|
+
export {
|
|
754
|
+
resolveModulePath,
|
|
755
|
+
importMetaResolve,
|
|
756
|
+
resolvePackageDir,
|
|
757
|
+
importModule,
|
|
758
|
+
safeResolveModule
|
|
759
|
+
};
|