@voidzero-dev/vite-plus-core 0.2.5 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +31 -7
- package/dist/rolldown/cli.d.mts +1 -1
- package/dist/rolldown/cli.mjs +6 -6
- package/dist/rolldown/config.d.mts +16 -17
- package/dist/rolldown/config.mjs +2 -2
- package/dist/rolldown/experimental-index.d.mts +164 -155
- package/dist/rolldown/experimental-index.mjs +23 -14
- package/dist/rolldown/experimental-runtime-types.d.ts +111 -41
- package/dist/rolldown/filter-index.d.mts +6 -5
- package/dist/rolldown/get-log-filter.d.mts +2 -2
- package/dist/rolldown/index.d.mts +3 -3
- package/dist/rolldown/index.mjs +4 -4
- package/dist/rolldown/parallel-plugin-worker.d.mts +1 -1
- package/dist/rolldown/parallel-plugin-worker.mjs +2 -2
- package/dist/rolldown/parallel-plugin.d.mts +3 -4
- package/dist/rolldown/parse-ast-index.d.mts +19 -20
- package/dist/rolldown/parse-ast-index.mjs +1 -1
- package/dist/rolldown/plugins-index.d.mts +27 -28
- package/dist/rolldown/plugins-index.mjs +2 -2
- package/dist/rolldown/shared/{binding-D26QphWG.d.mts → binding-Dbbi0RbO.d.mts} +37 -25
- package/dist/rolldown/shared/{binding-TuFFIE_J.mjs → binding-Dby9rwGk.mjs} +26 -26
- package/dist/rolldown/shared/{bindingify-input-options-CwbcQL6W.mjs → bindingify-input-options-DVQ4K-zY.mjs} +5 -5
- package/dist/rolldown/shared/{constructors-BbWPse2X.d.mts → constructors-CSWbNgBZ.d.mts} +9 -10
- package/dist/rolldown/shared/{constructors-D_3i7dpX.mjs → constructors-CuGa75s-.mjs} +1 -1
- package/dist/rolldown/shared/define-config-B-IDOhDz.d.mts +4003 -0
- package/dist/rolldown/shared/{error-BHRSI0R7.mjs → error-DFGNOCle.mjs} +1 -1
- package/dist/rolldown/shared/get-log-filter-AjBknEEO.d.mts +34 -0
- package/dist/rolldown/shared/{load-config-Bd7MgqCK.mjs → load-config-R0z2olkB.mjs} +1 -1
- package/dist/rolldown/shared/{logging-BSNejiLS.d.mts → logging-xuHO4mAy.d.mts} +6 -6
- package/dist/rolldown/shared/{normalize-string-or-regex-dnh67V_w.mjs → normalize-string-or-regex-SiXbePVH.mjs} +1 -1
- package/dist/rolldown/shared/{parse-B6_waszz.mjs → parse-D5dkElpf.mjs} +2 -2
- package/dist/rolldown/shared/{resolve-tsconfig-DxqIJB3x.mjs → resolve-tsconfig-2TXRF_zr.mjs} +2 -2
- package/dist/rolldown/shared/{rolldown-CACDGVWV.mjs → rolldown-BnV7isAX.mjs} +1 -1
- package/dist/rolldown/shared/{rolldown-build-BV22mk7t.mjs → rolldown-build-BGXNOfvH.mjs} +4 -4
- package/dist/rolldown/shared/transform-Cs2bUDRH.d.mts +148 -0
- package/dist/rolldown/shared/{watch-CS_JygCu.mjs → watch-DVucf-VG.mjs} +4 -4
- package/dist/rolldown/utils-index.d.mts +29 -30
- package/dist/rolldown/utils-index.mjs +6 -8
- package/dist/tsdown/{build-BlM3pDGJ-C8Uovnt4.js → build-D_enfyvD-DX5mX46j.js} +149 -1255
- package/dist/tsdown/debug-CKcBYQLP-GQrJ--dM.js +159 -0
- package/dist/tsdown/{detect-BNXt7gkp-DKAC9Z7n.js → detect-DGhJGEqb-Cz6qOZuP.js} +7 -1
- package/dist/tsdown/{dist-Pjag7IPt.js → dist-CWolxbYK.js} +1939 -2529
- package/dist/tsdown/dist-DCMiHFrJ.js +1061 -0
- package/dist/tsdown/index-types.d.ts +740 -554
- package/dist/tsdown/index.js +4 -4
- package/dist/tsdown/internal-DAh_SWnB.js +3 -0
- package/dist/tsdown/load-tsc-BKULZsrs-Bha6Vsu1.js +18 -0
- package/dist/tsdown/{main-BlTcyuFi.js → main-DI8qthUB.js} +222 -9
- package/dist/tsdown/{resolver-DtsKFXi2-B8Z3WwZh.js → resolver-cwLsPb2o-DvUqSYux.js} +4 -3
- package/dist/tsdown/run.js +5 -5
- package/dist/tsdown/{src-CK50m8R_.js → src-CPDzmpAq.js} +5 -5
- package/dist/tsdown/target-Bab3CUeB-Di6tCARH.js +582 -0
- package/dist/tsdown/{tsc-CilQvmj4.js → tsc-BQoNcjeB.js} +49 -116
- package/dist/tsdown/tsc-context-BhMGQ9Qr.js +23 -0
- package/dist/tsdown/tsdown-css.js +11 -12
- package/dist/tsdown/tsdown-exe.js +129 -877
- package/dist/vite/client/client.mjs +5 -5
- package/dist/vite/node/chunks/build.js +19 -19
- package/dist/vite/node/chunks/moduleRunnerTransport.d.ts +25 -26
- package/dist/vite/node/chunks/node.js +73 -38
- package/dist/vite/node/chunks/postcss-import.js +10 -10
- package/dist/vite/node/index.d.ts +1282 -1283
- package/dist/vite/node/module-runner.d.ts +76 -77
- package/dist/vite/node/module-runner.js +6 -7
- package/package.json +16 -16
- package/dist/rolldown/shared/define-config-BhJ90aEv.d.mts +0 -3978
- package/dist/rolldown/shared/get-log-filter-BpNVNJ5-.d.mts +0 -35
- package/dist/rolldown/shared/transform-BPrUvqEZ.d.mts +0 -149
- package/dist/tsdown/debug-B1wUEHkd-DhRzGJTf.js +0 -265
- package/dist/tsdown/fs-qxJxxoCE-B_amenYz.js +0 -46
- package/dist/tsdown/general-Cp4NiJNK-xAqmPhMP.js +0 -97
- package/dist/tsdown/internal-Bn6NGoha.js +0 -3
- package/dist/tsdown/npm_cjs_chunk_range.cjs +0 -475
- package/dist/tsdown/npm_cjs_chunk_semver.cjs +0 -357
- package/dist/tsdown/npm_entry_semver_functions_coerce.cjs +0 -52
- package/dist/tsdown/npm_entry_semver_functions_satisfies.cjs +0 -19
- package/dist/tsdown/npm_entry_semver_ranges_min-version.cjs +0 -46
- package/dist/tsdown/target-CqeSqtms-CIvlAiuG.js +0 -35
- package/dist/tsdown/tsc-context-BusiAGCd.js +0 -27
|
@@ -1,1110 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { n as resolveTarget } from "./target-CqeSqtms-CIvlAiuG.js";
|
|
1
|
+
import { A as __toESM, C as resolveComma, D as __commonJSMin, E as toArray, O as __exportAll$1, S as pkgExists, T as slash, _ as createConcurrencyExecutor, b as matchPattern, c as blue, d as green, g as yellow, h as underline, l as bold, n as z, r as createDebug, t as R, u as dim, v as debounce, w as resolveRegex, x as noop, y as importWithError } from "./main-DI8qthUB.js";
|
|
2
|
+
import { a as createSuppressWarnings, c as globalLogger, i as createLogger, l as prettyFormat, n as version, o as generateColor, r as LogLevels, s as getNameLabel } from "./debug-CKcBYQLP-GQrJ--dM.js";
|
|
3
|
+
import { A as fsStat, D as fsCopy, E as formatBytes, M as stripExtname, O as fsExists, S as filename_js_to_dts, a as resolveTarget, d as satisfies, g as RE_JS, j as lowestCommonAncestor, k as fsRemove, m as RE_DTS, o as validateSea, p as RE_CSS, r as buildExe, s as coerce, u as parseRange, v as RE_NODE_MODULES$1 } from "./target-Bab3CUeB-Di6tCARH.js";
|
|
4
|
+
import { n as ee } from "./dist-DCMiHFrJ.js";
|
|
6
5
|
import module$1, { builtinModules, createRequire, isBuiltin } from "node:module";
|
|
7
6
|
import process$1 from "node:process";
|
|
8
7
|
import readline from "node:readline";
|
|
9
|
-
import { formatWithOptions, inspect, isDeepStrictEqual, promisify } from "node:util";
|
|
8
|
+
import { formatWithOptions, inspect, isDeepStrictEqual, parseEnv, promisify } from "node:util";
|
|
10
9
|
import path, { dirname, isAbsolute, join, parse, resolve } from "node:path";
|
|
11
10
|
import re, { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
12
|
-
import {
|
|
13
|
-
import { chmod,
|
|
14
|
-
import { and,
|
|
11
|
+
import { VERSION, build, watch } from "@voidzero-dev/vite-plus-core/rolldown";
|
|
12
|
+
import { chmod, mkdtemp, readFile, readdir, writeFile } from "node:fs/promises";
|
|
13
|
+
import { and, id, importerId, include } from "@voidzero-dev/vite-plus-core/rolldown/filter";
|
|
15
14
|
import * as nativeFs from "fs";
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
15
|
+
import { readdir as readdir$1, readdirSync, realpath, realpathSync, stat as stat$1, statSync as statSync$1 } from "fs";
|
|
16
|
+
import { basename as basename$1, dirname as dirname$1, isAbsolute as isAbsolute$1, normalize as normalize$1, posix, relative, resolve as resolve$1, sep } from "path";
|
|
17
|
+
import { Visitor, parse as parse$1 } from "@voidzero-dev/vite-plus-core/rolldown/utils";
|
|
18
|
+
import { tmpdir } from "node:os";
|
|
19
19
|
import { fileURLToPath } from "url";
|
|
20
20
|
import { createRequire as createRequire$1 } from "module";
|
|
21
|
-
import { tmpdir } from "node:os";
|
|
22
21
|
import { fileURLToPath as fileURLToPath$1, pathToFileURL } from "node:url";
|
|
23
22
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
24
23
|
import { Buffer } from "node:buffer";
|
|
25
24
|
import { brotliCompress, gzip } from "node:zlib";
|
|
26
25
|
import { importGlobPlugin } from "@voidzero-dev/vite-plus-core/rolldown/experimental";
|
|
27
|
-
//#region ../../node_modules/.pnpm/
|
|
28
|
-
const RE_JS = /\.([cm]?)jsx?$/;
|
|
29
|
-
const RE_TS = /\.([cm]?)tsx?$/;
|
|
30
|
-
const RE_DTS = /\.d\.([cm]?)ts$/;
|
|
31
|
-
const RE_DTS_MAP = /\.d\.([cm]?)ts\.map$/;
|
|
32
|
-
const RE_NODE_MODULES$1 = /[\\/]node_modules[\\/]/;
|
|
33
|
-
const RE_CSS = /\.(?:css|scss|sass|less|styl|stylus)$/;
|
|
34
|
-
const RE_VUE = /\.vue$/;
|
|
35
|
-
const RE_JSON = /\.json$/;
|
|
36
|
-
const RE_ROLLDOWN_RUNTIME = exactRegex(RUNTIME_MODULE_ID);
|
|
37
|
-
function filename_js_to_dts(id) {
|
|
38
|
-
return id.replace(RE_JS, ".d.$1ts");
|
|
39
|
-
}
|
|
40
|
-
function filename_to_dts(id) {
|
|
41
|
-
return id.replace(RE_VUE, ".vue.ts").replace(RE_TS, ".d.$1ts").replace(RE_JS, ".d.$1ts").replace(RE_JSON, ".json.d.ts");
|
|
42
|
-
}
|
|
43
|
-
function filename_dts_to(id, ext) {
|
|
44
|
-
return id.replace(RE_DTS, `.$1${ext}`);
|
|
45
|
-
}
|
|
46
|
-
function resolveTemplateFn(fn, chunk) {
|
|
47
|
-
return typeof fn === "function" ? fn(chunk) : fn;
|
|
48
|
-
}
|
|
49
|
-
function replaceTemplateName(template, name) {
|
|
50
|
-
return template.replaceAll("[name]", name);
|
|
51
|
-
}
|
|
52
|
-
//#endregion
|
|
53
|
-
//#region ../../node_modules/.pnpm/resolve-pkg-maps@1.0.0/node_modules/resolve-pkg-maps/dist/index.mjs
|
|
54
|
-
const A = (r) => r !== null && typeof r == "object";
|
|
55
|
-
const a = (r, t) => Object.assign(/* @__PURE__ */ new Error(`[${r}]: ${t}`), { code: r });
|
|
56
|
-
const _$1 = "ERR_INVALID_PACKAGE_CONFIG";
|
|
57
|
-
const E = "ERR_INVALID_PACKAGE_TARGET";
|
|
58
|
-
const I$1 = "ERR_PACKAGE_PATH_NOT_EXPORTED";
|
|
59
|
-
const R$1 = /^\d+$/;
|
|
60
|
-
const O = /^(\.{1,2}|node_modules)$/i;
|
|
61
|
-
const w = /\/|\\/;
|
|
62
|
-
var h = ((r) => (r.Export = "exports", r.Import = "imports", r))(h || {});
|
|
63
|
-
const f = (r, t, e, o, c) => {
|
|
64
|
-
if (t == null) return [];
|
|
65
|
-
if (typeof t == "string") {
|
|
66
|
-
const [n, ...i] = t.split(w);
|
|
67
|
-
if (n === ".." || i.some((l) => O.test(l))) throw a(E, `Invalid "${r}" target "${t}" defined in the package config`);
|
|
68
|
-
return [c ? t.replace(/\*/g, c) : t];
|
|
69
|
-
}
|
|
70
|
-
if (Array.isArray(t)) return t.flatMap((n) => f(r, n, e, o, c));
|
|
71
|
-
if (A(t)) {
|
|
72
|
-
for (const n of Object.keys(t)) {
|
|
73
|
-
if (R$1.test(n)) throw a(_$1, "Cannot contain numeric property keys");
|
|
74
|
-
if (n === "default" || o.includes(n)) return f(r, t[n], e, o, c);
|
|
75
|
-
}
|
|
76
|
-
return [];
|
|
77
|
-
}
|
|
78
|
-
throw a(E, `Invalid "${r}" target "${t}"`);
|
|
79
|
-
};
|
|
80
|
-
const s = "*";
|
|
81
|
-
const m = (r, t) => {
|
|
82
|
-
const e = r.indexOf(s), o = t.indexOf(s);
|
|
83
|
-
return e === o ? t.length > r.length : o > e;
|
|
84
|
-
};
|
|
85
|
-
function d(r, t) {
|
|
86
|
-
if (!t.includes(s) && r.hasOwnProperty(t)) return [t];
|
|
87
|
-
let e, o;
|
|
88
|
-
for (const c of Object.keys(r)) if (c.includes(s)) {
|
|
89
|
-
const [n, i, l] = c.split(s);
|
|
90
|
-
if (l === void 0 && t.startsWith(n) && t.endsWith(i)) {
|
|
91
|
-
const g = t.slice(n.length, -i.length || void 0);
|
|
92
|
-
g && (!e || m(e, c)) && (e = c, o = g);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return [e, o];
|
|
96
|
-
}
|
|
97
|
-
const p = (r) => Object.keys(r).reduce((t, e) => {
|
|
98
|
-
const o = e === "" || e[0] !== ".";
|
|
99
|
-
if (t === void 0 || t === o) return o;
|
|
100
|
-
throw a(_$1, "\"exports\" cannot contain some keys starting with \".\" and some not");
|
|
101
|
-
}, void 0);
|
|
102
|
-
const u = /^\w+:/;
|
|
103
|
-
const v = (r, t, e) => {
|
|
104
|
-
if (!r) throw new Error("\"exports\" is required");
|
|
105
|
-
t = t === "" ? "." : `./${t}`, (typeof r == "string" || Array.isArray(r) || A(r) && p(r)) && (r = { ".": r });
|
|
106
|
-
const [o, c] = d(r, t), n = f(h.Export, r[o], t, e, c);
|
|
107
|
-
if (n.length === 0) throw a(I$1, t === "." ? "No \"exports\" main defined" : `Package subpath '${t}' is not defined by "exports"`);
|
|
108
|
-
for (const i of n) if (!i.startsWith("./") && !u.test(i)) throw a(E, `Invalid "exports" target "${i}" defined in the package config`);
|
|
109
|
-
return n;
|
|
110
|
-
};
|
|
111
|
-
//#endregion
|
|
112
|
-
//#region ../../node_modules/.pnpm/get-tsconfig@5.0.0-beta.5/node_modules/get-tsconfig/dist/index.mjs
|
|
113
|
-
var Le = Object.defineProperty;
|
|
114
|
-
var i = (e, n) => Le(e, "name", {
|
|
115
|
-
value: n,
|
|
116
|
-
configurable: !0
|
|
117
|
-
});
|
|
118
|
-
function x(e) {
|
|
119
|
-
return e.startsWith("\\\\?\\") ? e : e.replace(/\\/g, "/");
|
|
120
|
-
}
|
|
121
|
-
i(x, "slash");
|
|
122
|
-
const _e = i((e, n) => {
|
|
123
|
-
const s = `readFileSync:${n}`;
|
|
124
|
-
let t = e?.get(s);
|
|
125
|
-
return t === void 0 && (t = re.readFileSync(n, "utf8"), e?.set(s, t)), t;
|
|
126
|
-
}, "readFile");
|
|
127
|
-
const F = i((e, n) => {
|
|
128
|
-
const s = `tryStat:${n}`;
|
|
129
|
-
let t = e?.get(s);
|
|
130
|
-
if (t === void 0) {
|
|
131
|
-
try {
|
|
132
|
-
t = re.statSync(n);
|
|
133
|
-
} catch {
|
|
134
|
-
t = null;
|
|
135
|
-
}
|
|
136
|
-
e?.set(s, t);
|
|
137
|
-
}
|
|
138
|
-
return t ?? void 0;
|
|
139
|
-
}, "tryStat");
|
|
140
|
-
const R = i((e, n, s) => {
|
|
141
|
-
for (;;) {
|
|
142
|
-
const t = path.posix.join(e, n);
|
|
143
|
-
if (F(s, t)) return t;
|
|
144
|
-
const o = path.dirname(e);
|
|
145
|
-
if (o === e) return;
|
|
146
|
-
e = o;
|
|
147
|
-
}
|
|
148
|
-
}, "findUp");
|
|
149
|
-
function Ne(e, n = !1) {
|
|
150
|
-
const s = e.length;
|
|
151
|
-
let t = 0, o = "", r = 0, l = 16, g = 0, m = 0, k = 0, w = 0, u = 0;
|
|
152
|
-
function A(f, y) {
|
|
153
|
-
let j = 0, v = 0;
|
|
154
|
-
for (; j < f;) {
|
|
155
|
-
let d = e.charCodeAt(t);
|
|
156
|
-
if (d >= 48 && d <= 57) v = v * 16 + d - 48;
|
|
157
|
-
else if (d >= 65 && d <= 70) v = v * 16 + d - 65 + 10;
|
|
158
|
-
else if (d >= 97 && d <= 102) v = v * 16 + d - 97 + 10;
|
|
159
|
-
else break;
|
|
160
|
-
t++, j++;
|
|
161
|
-
}
|
|
162
|
-
return j < f && (v = -1), v;
|
|
163
|
-
}
|
|
164
|
-
i(A, "scanHexDigits");
|
|
165
|
-
function O(f) {
|
|
166
|
-
t = f, o = "", r = 0, l = 16, u = 0;
|
|
167
|
-
}
|
|
168
|
-
i(O, "setPosition");
|
|
169
|
-
function h() {
|
|
170
|
-
let f = t;
|
|
171
|
-
if (e.charCodeAt(t) === 48) t++;
|
|
172
|
-
else for (t++; t < e.length && S(e.charCodeAt(t));) t++;
|
|
173
|
-
if (t < e.length && e.charCodeAt(t) === 46) if (t++, t < e.length && S(e.charCodeAt(t))) for (t++; t < e.length && S(e.charCodeAt(t));) t++;
|
|
174
|
-
else return u = 3, e.substring(f, t);
|
|
175
|
-
let y = t;
|
|
176
|
-
if (t < e.length && (e.charCodeAt(t) === 69 || e.charCodeAt(t) === 101)) if (t++, (t < e.length && e.charCodeAt(t) === 43 || e.charCodeAt(t) === 45) && t++, t < e.length && S(e.charCodeAt(t))) {
|
|
177
|
-
for (t++; t < e.length && S(e.charCodeAt(t));) t++;
|
|
178
|
-
y = t;
|
|
179
|
-
} else u = 3;
|
|
180
|
-
return e.substring(f, y);
|
|
181
|
-
}
|
|
182
|
-
i(h, "scanNumber");
|
|
183
|
-
function D() {
|
|
184
|
-
let f = "", y = t;
|
|
185
|
-
for (;;) {
|
|
186
|
-
if (t >= s) {
|
|
187
|
-
f += e.substring(y, t), u = 2;
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
const j = e.charCodeAt(t);
|
|
191
|
-
if (j === 34) {
|
|
192
|
-
f += e.substring(y, t), t++;
|
|
193
|
-
break;
|
|
194
|
-
}
|
|
195
|
-
if (j === 92) {
|
|
196
|
-
if (f += e.substring(y, t), t++, t >= s) {
|
|
197
|
-
u = 2;
|
|
198
|
-
break;
|
|
199
|
-
}
|
|
200
|
-
switch (e.charCodeAt(t++)) {
|
|
201
|
-
case 34:
|
|
202
|
-
f += "\"";
|
|
203
|
-
break;
|
|
204
|
-
case 92:
|
|
205
|
-
f += "\\";
|
|
206
|
-
break;
|
|
207
|
-
case 47:
|
|
208
|
-
f += "/";
|
|
209
|
-
break;
|
|
210
|
-
case 98:
|
|
211
|
-
f += "\b";
|
|
212
|
-
break;
|
|
213
|
-
case 102:
|
|
214
|
-
f += "\f";
|
|
215
|
-
break;
|
|
216
|
-
case 110:
|
|
217
|
-
f += `
|
|
218
|
-
`;
|
|
219
|
-
break;
|
|
220
|
-
case 114:
|
|
221
|
-
f += "\r";
|
|
222
|
-
break;
|
|
223
|
-
case 116:
|
|
224
|
-
f += " ";
|
|
225
|
-
break;
|
|
226
|
-
case 117:
|
|
227
|
-
const d = A(4);
|
|
228
|
-
d >= 0 ? f += String.fromCharCode(d) : u = 4;
|
|
229
|
-
break;
|
|
230
|
-
default: u = 5;
|
|
231
|
-
}
|
|
232
|
-
y = t;
|
|
233
|
-
continue;
|
|
234
|
-
}
|
|
235
|
-
if (j >= 0 && j <= 31) if (P(j)) {
|
|
236
|
-
f += e.substring(y, t), u = 2;
|
|
237
|
-
break;
|
|
238
|
-
} else u = 6;
|
|
239
|
-
t++;
|
|
240
|
-
}
|
|
241
|
-
return f;
|
|
242
|
-
}
|
|
243
|
-
i(D, "scanString");
|
|
244
|
-
function c() {
|
|
245
|
-
if (o = "", u = 0, r = t, m = g, w = k, t >= s) return r = s, l = 17;
|
|
246
|
-
let f = e.charCodeAt(t);
|
|
247
|
-
if (X(f)) {
|
|
248
|
-
do
|
|
249
|
-
t++, o += String.fromCharCode(f), f = e.charCodeAt(t);
|
|
250
|
-
while (X(f));
|
|
251
|
-
return l = 15;
|
|
252
|
-
}
|
|
253
|
-
if (P(f)) return t++, o += String.fromCharCode(f), f === 13 && e.charCodeAt(t) === 10 && (t++, o += `
|
|
254
|
-
`), g++, k = t, l = 14;
|
|
255
|
-
switch (f) {
|
|
256
|
-
case 123: return t++, l = 1;
|
|
257
|
-
case 125: return t++, l = 2;
|
|
258
|
-
case 91: return t++, l = 3;
|
|
259
|
-
case 93: return t++, l = 4;
|
|
260
|
-
case 58: return t++, l = 6;
|
|
261
|
-
case 44: return t++, l = 5;
|
|
262
|
-
case 34: return t++, o = D(), l = 10;
|
|
263
|
-
case 47:
|
|
264
|
-
const y = t - 1;
|
|
265
|
-
if (e.charCodeAt(t + 1) === 47) {
|
|
266
|
-
for (t += 2; t < s && !P(e.charCodeAt(t));) t++;
|
|
267
|
-
return o = e.substring(y, t), l = 12;
|
|
268
|
-
}
|
|
269
|
-
if (e.charCodeAt(t + 1) === 42) {
|
|
270
|
-
t += 2;
|
|
271
|
-
const j = s - 1;
|
|
272
|
-
let v = !1;
|
|
273
|
-
for (; t < j;) {
|
|
274
|
-
const d = e.charCodeAt(t);
|
|
275
|
-
if (d === 42 && e.charCodeAt(t + 1) === 47) {
|
|
276
|
-
t += 2, v = !0;
|
|
277
|
-
break;
|
|
278
|
-
}
|
|
279
|
-
t++, P(d) && (d === 13 && e.charCodeAt(t) === 10 && t++, g++, k = t);
|
|
280
|
-
}
|
|
281
|
-
return v || (t++, u = 1), o = e.substring(y, t), l = 13;
|
|
282
|
-
}
|
|
283
|
-
return o += String.fromCharCode(f), t++, l = 16;
|
|
284
|
-
case 45: if (o += String.fromCharCode(f), t++, t === s || !S(e.charCodeAt(t))) return l = 16;
|
|
285
|
-
case 48:
|
|
286
|
-
case 49:
|
|
287
|
-
case 50:
|
|
288
|
-
case 51:
|
|
289
|
-
case 52:
|
|
290
|
-
case 53:
|
|
291
|
-
case 54:
|
|
292
|
-
case 55:
|
|
293
|
-
case 56:
|
|
294
|
-
case 57: return o += h(), l = 11;
|
|
295
|
-
default:
|
|
296
|
-
for (; t < s && p(f);) t++, f = e.charCodeAt(t);
|
|
297
|
-
if (r !== t) {
|
|
298
|
-
switch (o = e.substring(r, t), o) {
|
|
299
|
-
case "true": return l = 8;
|
|
300
|
-
case "false": return l = 9;
|
|
301
|
-
case "null": return l = 7;
|
|
302
|
-
}
|
|
303
|
-
return l = 16;
|
|
304
|
-
}
|
|
305
|
-
return o += String.fromCharCode(f), t++, l = 16;
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
i(c, "scanNext");
|
|
309
|
-
function p(f) {
|
|
310
|
-
if (X(f) || P(f)) return !1;
|
|
311
|
-
switch (f) {
|
|
312
|
-
case 125:
|
|
313
|
-
case 93:
|
|
314
|
-
case 123:
|
|
315
|
-
case 91:
|
|
316
|
-
case 34:
|
|
317
|
-
case 58:
|
|
318
|
-
case 44:
|
|
319
|
-
case 47: return !1;
|
|
320
|
-
}
|
|
321
|
-
return !0;
|
|
322
|
-
}
|
|
323
|
-
i(p, "isUnknownContentCharacter");
|
|
324
|
-
function b() {
|
|
325
|
-
let f;
|
|
326
|
-
do
|
|
327
|
-
f = c();
|
|
328
|
-
while (f >= 12 && f <= 15);
|
|
329
|
-
return f;
|
|
330
|
-
}
|
|
331
|
-
return i(b, "scanNextNonTrivia"), {
|
|
332
|
-
setPosition: O,
|
|
333
|
-
getPosition: i(() => t, "getPosition"),
|
|
334
|
-
scan: n ? b : c,
|
|
335
|
-
getToken: i(() => l, "getToken"),
|
|
336
|
-
getTokenValue: i(() => o, "getTokenValue"),
|
|
337
|
-
getTokenOffset: i(() => r, "getTokenOffset"),
|
|
338
|
-
getTokenLength: i(() => t - r, "getTokenLength"),
|
|
339
|
-
getTokenStartLine: i(() => m, "getTokenStartLine"),
|
|
340
|
-
getTokenStartCharacter: i(() => r - w, "getTokenStartCharacter"),
|
|
341
|
-
getTokenError: i(() => u, "getTokenError")
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
|
-
i(Ne, "createScanner");
|
|
345
|
-
function X(e) {
|
|
346
|
-
return e === 32 || e === 9;
|
|
347
|
-
}
|
|
348
|
-
i(X, "isWhiteSpace");
|
|
349
|
-
function P(e) {
|
|
350
|
-
return e === 10 || e === 13;
|
|
351
|
-
}
|
|
352
|
-
i(P, "isLineBreak");
|
|
353
|
-
function S(e) {
|
|
354
|
-
return e >= 48 && e <= 57;
|
|
355
|
-
}
|
|
356
|
-
i(S, "isDigit");
|
|
357
|
-
var ce;
|
|
358
|
-
(function(e) {
|
|
359
|
-
e[e.lineFeed = 10] = "lineFeed", e[e.carriageReturn = 13] = "carriageReturn", e[e.space = 32] = "space", e[e._0 = 48] = "_0", e[e._1 = 49] = "_1", e[e._2 = 50] = "_2", e[e._3 = 51] = "_3", e[e._4 = 52] = "_4", e[e._5 = 53] = "_5", e[e._6 = 54] = "_6", e[e._7 = 55] = "_7", e[e._8 = 56] = "_8", e[e._9 = 57] = "_9", e[e.a = 97] = "a", e[e.b = 98] = "b", e[e.c = 99] = "c", e[e.d = 100] = "d", e[e.e = 101] = "e", e[e.f = 102] = "f", e[e.g = 103] = "g", e[e.h = 104] = "h", e[e.i = 105] = "i", e[e.j = 106] = "j", e[e.k = 107] = "k", e[e.l = 108] = "l", e[e.m = 109] = "m", e[e.n = 110] = "n", e[e.o = 111] = "o", e[e.p = 112] = "p", e[e.q = 113] = "q", e[e.r = 114] = "r", e[e.s = 115] = "s", e[e.t = 116] = "t", e[e.u = 117] = "u", e[e.v = 118] = "v", e[e.w = 119] = "w", e[e.x = 120] = "x", e[e.y = 121] = "y", e[e.z = 122] = "z", e[e.A = 65] = "A", e[e.B = 66] = "B", e[e.C = 67] = "C", e[e.D = 68] = "D", e[e.E = 69] = "E", e[e.F = 70] = "F", e[e.G = 71] = "G", e[e.H = 72] = "H", e[e.I = 73] = "I", e[e.J = 74] = "J", e[e.K = 75] = "K", e[e.L = 76] = "L", e[e.M = 77] = "M", e[e.N = 78] = "N", e[e.O = 79] = "O", e[e.P = 80] = "P", e[e.Q = 81] = "Q", e[e.R = 82] = "R", e[e.S = 83] = "S", e[e.T = 84] = "T", e[e.U = 85] = "U", e[e.V = 86] = "V", e[e.W = 87] = "W", e[e.X = 88] = "X", e[e.Y = 89] = "Y", e[e.Z = 90] = "Z", e[e.asterisk = 42] = "asterisk", e[e.backslash = 92] = "backslash", e[e.closeBrace = 125] = "closeBrace", e[e.closeBracket = 93] = "closeBracket", e[e.colon = 58] = "colon", e[e.comma = 44] = "comma", e[e.dot = 46] = "dot", e[e.doubleQuote = 34] = "doubleQuote", e[e.minus = 45] = "minus", e[e.openBrace = 123] = "openBrace", e[e.openBracket = 91] = "openBracket", e[e.plus = 43] = "plus", e[e.slash = 47] = "slash", e[e.formFeed = 12] = "formFeed", e[e.tab = 9] = "tab";
|
|
360
|
-
})(ce || (ce = {})), new Array(20).fill(0).map((e, n) => " ".repeat(n));
|
|
361
|
-
const _ = 200;
|
|
362
|
-
new Array(_).fill(0).map((e, n) => `
|
|
363
|
-
` + " ".repeat(n)), new Array(_).fill(0).map((e, n) => "\r" + " ".repeat(n)), new Array(_).fill(0).map((e, n) => `\r
|
|
364
|
-
` + " ".repeat(n)), new Array(_).fill(0).map((e, n) => `
|
|
365
|
-
` + " ".repeat(n)), new Array(_).fill(0).map((e, n) => "\r" + " ".repeat(n)), new Array(_).fill(0).map((e, n) => `\r
|
|
366
|
-
` + " ".repeat(n));
|
|
367
|
-
var W;
|
|
368
|
-
(function(e) {
|
|
369
|
-
e.DEFAULT = { allowTrailingComma: !1 };
|
|
370
|
-
})(W || (W = {}));
|
|
371
|
-
function Re(e, n = [], s = W.DEFAULT) {
|
|
372
|
-
let t = null, o = [];
|
|
373
|
-
const r = [];
|
|
374
|
-
function l(m) {
|
|
375
|
-
Array.isArray(o) ? o.push(m) : t !== null && (o[t] = m);
|
|
376
|
-
}
|
|
377
|
-
return i(l, "onValue"), Pe(e, {
|
|
378
|
-
onObjectBegin: i(() => {
|
|
379
|
-
const m = {};
|
|
380
|
-
l(m), r.push(o), o = m, t = null;
|
|
381
|
-
}, "onObjectBegin"),
|
|
382
|
-
onObjectProperty: i((m) => {
|
|
383
|
-
t = m;
|
|
384
|
-
}, "onObjectProperty"),
|
|
385
|
-
onObjectEnd: i(() => {
|
|
386
|
-
o = r.pop();
|
|
387
|
-
}, "onObjectEnd"),
|
|
388
|
-
onArrayBegin: i(() => {
|
|
389
|
-
const m = [];
|
|
390
|
-
l(m), r.push(o), o = m, t = null;
|
|
391
|
-
}, "onArrayBegin"),
|
|
392
|
-
onArrayEnd: i(() => {
|
|
393
|
-
o = r.pop();
|
|
394
|
-
}, "onArrayEnd"),
|
|
395
|
-
onLiteralValue: l,
|
|
396
|
-
onError: i((m, k, w) => {
|
|
397
|
-
n.push({
|
|
398
|
-
error: m,
|
|
399
|
-
offset: k,
|
|
400
|
-
length: w
|
|
401
|
-
});
|
|
402
|
-
}, "onError")
|
|
403
|
-
}, s), o[0];
|
|
404
|
-
}
|
|
405
|
-
i(Re, "parse$1");
|
|
406
|
-
function Pe(e, n, s = W.DEFAULT) {
|
|
407
|
-
const t = Ne(e, !1), o = [];
|
|
408
|
-
let r = 0;
|
|
409
|
-
function l(T) {
|
|
410
|
-
return T ? () => r === 0 && T(t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter()) : () => !0;
|
|
411
|
-
}
|
|
412
|
-
i(l, "toNoArgVisit");
|
|
413
|
-
function g(T) {
|
|
414
|
-
return T ? (E) => r === 0 && T(E, t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter()) : () => !0;
|
|
415
|
-
}
|
|
416
|
-
i(g, "toOneArgVisit");
|
|
417
|
-
function m(T) {
|
|
418
|
-
return T ? (E) => r === 0 && T(E, t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter(), () => o.slice()) : () => !0;
|
|
419
|
-
}
|
|
420
|
-
i(m, "toOneArgVisitWithPath");
|
|
421
|
-
function k(T) {
|
|
422
|
-
return T ? () => {
|
|
423
|
-
r > 0 ? r++ : T(t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter(), () => o.slice()) === !1 && (r = 1);
|
|
424
|
-
} : () => !0;
|
|
425
|
-
}
|
|
426
|
-
i(k, "toBeginVisit");
|
|
427
|
-
function w(T) {
|
|
428
|
-
return T ? () => {
|
|
429
|
-
r > 0 && r--, r === 0 && T(t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter());
|
|
430
|
-
} : () => !0;
|
|
431
|
-
}
|
|
432
|
-
i(w, "toEndVisit");
|
|
433
|
-
const u = k(n.onObjectBegin), A = m(n.onObjectProperty), O = w(n.onObjectEnd), h = k(n.onArrayBegin), D = w(n.onArrayEnd), c = m(n.onLiteralValue), p = g(n.onSeparator), b = l(n.onComment), f = g(n.onError), y = s && s.disallowComments, j = s && s.allowTrailingComma;
|
|
434
|
-
function v() {
|
|
435
|
-
for (;;) {
|
|
436
|
-
const T = t.scan();
|
|
437
|
-
switch (t.getTokenError()) {
|
|
438
|
-
case 4:
|
|
439
|
-
d(14);
|
|
440
|
-
break;
|
|
441
|
-
case 5:
|
|
442
|
-
d(15);
|
|
443
|
-
break;
|
|
444
|
-
case 3:
|
|
445
|
-
d(13);
|
|
446
|
-
break;
|
|
447
|
-
case 1:
|
|
448
|
-
y || d(11);
|
|
449
|
-
break;
|
|
450
|
-
case 2:
|
|
451
|
-
d(12);
|
|
452
|
-
break;
|
|
453
|
-
case 6:
|
|
454
|
-
d(16);
|
|
455
|
-
break;
|
|
456
|
-
}
|
|
457
|
-
switch (T) {
|
|
458
|
-
case 12:
|
|
459
|
-
case 13:
|
|
460
|
-
y ? d(10) : b();
|
|
461
|
-
break;
|
|
462
|
-
case 16:
|
|
463
|
-
d(1);
|
|
464
|
-
break;
|
|
465
|
-
case 15:
|
|
466
|
-
case 14: break;
|
|
467
|
-
default: return T;
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
i(v, "scanNext");
|
|
472
|
-
function d(T, E = [], ie = []) {
|
|
473
|
-
if (f(T), E.length + ie.length > 0) {
|
|
474
|
-
let V = t.getToken();
|
|
475
|
-
for (; V !== 17;) {
|
|
476
|
-
if (E.indexOf(V) !== -1) {
|
|
477
|
-
v();
|
|
478
|
-
break;
|
|
479
|
-
} else if (ie.indexOf(V) !== -1) break;
|
|
480
|
-
V = v();
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
i(d, "handleError");
|
|
485
|
-
function L(T) {
|
|
486
|
-
const E = t.getTokenValue();
|
|
487
|
-
return T ? c(E) : (A(E), o.push(E)), v(), !0;
|
|
488
|
-
}
|
|
489
|
-
i(L, "parseString");
|
|
490
|
-
function B() {
|
|
491
|
-
switch (t.getToken()) {
|
|
492
|
-
case 11:
|
|
493
|
-
const T = t.getTokenValue();
|
|
494
|
-
let E = Number(T);
|
|
495
|
-
isNaN(E) && (d(2), E = 0), c(E);
|
|
496
|
-
break;
|
|
497
|
-
case 7:
|
|
498
|
-
c(null);
|
|
499
|
-
break;
|
|
500
|
-
case 8:
|
|
501
|
-
c(!0);
|
|
502
|
-
break;
|
|
503
|
-
case 9:
|
|
504
|
-
c(!1);
|
|
505
|
-
break;
|
|
506
|
-
default: return !1;
|
|
507
|
-
}
|
|
508
|
-
return v(), !0;
|
|
509
|
-
}
|
|
510
|
-
i(B, "parseLiteral");
|
|
511
|
-
function $() {
|
|
512
|
-
return t.getToken() !== 10 ? (d(3, [], [2, 5]), !1) : (L(!1), t.getToken() === 6 ? (p(":"), v(), H() || d(4, [], [2, 5])) : d(5, [], [2, 5]), o.pop(), !0);
|
|
513
|
-
}
|
|
514
|
-
i($, "parseProperty");
|
|
515
|
-
function N() {
|
|
516
|
-
u(), v();
|
|
517
|
-
let T = !1;
|
|
518
|
-
for (; t.getToken() !== 2 && t.getToken() !== 17;) {
|
|
519
|
-
if (t.getToken() === 5) {
|
|
520
|
-
if (T || d(4, [], []), p(","), v(), t.getToken() === 2 && j) break;
|
|
521
|
-
} else T && d(6, [], []);
|
|
522
|
-
$() || d(4, [], [2, 5]), T = !0;
|
|
523
|
-
}
|
|
524
|
-
return O(), t.getToken() !== 2 ? d(7, [2], []) : v(), !0;
|
|
525
|
-
}
|
|
526
|
-
i(N, "parseObject");
|
|
527
|
-
function $e() {
|
|
528
|
-
h(), v();
|
|
529
|
-
let T = !0, E = !1;
|
|
530
|
-
for (; t.getToken() !== 4 && t.getToken() !== 17;) {
|
|
531
|
-
if (t.getToken() === 5) {
|
|
532
|
-
if (E || d(4, [], []), p(","), v(), t.getToken() === 4 && j) break;
|
|
533
|
-
} else E && d(6, [], []);
|
|
534
|
-
T ? (o.push(0), T = !1) : o[o.length - 1]++, H() || d(4, [], [4, 5]), E = !0;
|
|
535
|
-
}
|
|
536
|
-
return D(), T || o.pop(), t.getToken() !== 4 ? d(8, [4], []) : v(), !0;
|
|
537
|
-
}
|
|
538
|
-
i($e, "parseArray");
|
|
539
|
-
function H() {
|
|
540
|
-
switch (t.getToken()) {
|
|
541
|
-
case 3: return $e();
|
|
542
|
-
case 1: return N();
|
|
543
|
-
case 10: return L(!0);
|
|
544
|
-
default: return B();
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
return i(H, "parseValue"), v(), t.getToken() === 17 ? s.allowEmptyContent ? !0 : (d(4, [], []), !1) : H() ? (t.getToken() !== 17 && d(9, [], []), !0) : (d(4, [], []), !1);
|
|
548
|
-
}
|
|
549
|
-
i(Pe, "visit");
|
|
550
|
-
var fe;
|
|
551
|
-
(function(e) {
|
|
552
|
-
e[e.None = 0] = "None", e[e.UnexpectedEndOfComment = 1] = "UnexpectedEndOfComment", e[e.UnexpectedEndOfString = 2] = "UnexpectedEndOfString", e[e.UnexpectedEndOfNumber = 3] = "UnexpectedEndOfNumber", e[e.InvalidUnicode = 4] = "InvalidUnicode", e[e.InvalidEscapeCharacter = 5] = "InvalidEscapeCharacter", e[e.InvalidCharacter = 6] = "InvalidCharacter";
|
|
553
|
-
})(fe || (fe = {}));
|
|
554
|
-
var ue;
|
|
555
|
-
(function(e) {
|
|
556
|
-
e[e.OpenBraceToken = 1] = "OpenBraceToken", e[e.CloseBraceToken = 2] = "CloseBraceToken", e[e.OpenBracketToken = 3] = "OpenBracketToken", e[e.CloseBracketToken = 4] = "CloseBracketToken", e[e.CommaToken = 5] = "CommaToken", e[e.ColonToken = 6] = "ColonToken", e[e.NullKeyword = 7] = "NullKeyword", e[e.TrueKeyword = 8] = "TrueKeyword", e[e.FalseKeyword = 9] = "FalseKeyword", e[e.StringLiteral = 10] = "StringLiteral", e[e.NumericLiteral = 11] = "NumericLiteral", e[e.LineCommentTrivia = 12] = "LineCommentTrivia", e[e.BlockCommentTrivia = 13] = "BlockCommentTrivia", e[e.LineBreakTrivia = 14] = "LineBreakTrivia", e[e.Trivia = 15] = "Trivia", e[e.Unknown = 16] = "Unknown", e[e.EOF = 17] = "EOF";
|
|
557
|
-
})(ue || (ue = {}));
|
|
558
|
-
const Ve = Re;
|
|
559
|
-
var ae;
|
|
560
|
-
(function(e) {
|
|
561
|
-
e[e.InvalidSymbol = 1] = "InvalidSymbol", e[e.InvalidNumberFormat = 2] = "InvalidNumberFormat", e[e.PropertyNameExpected = 3] = "PropertyNameExpected", e[e.ValueExpected = 4] = "ValueExpected", e[e.ColonExpected = 5] = "ColonExpected", e[e.CommaExpected = 6] = "CommaExpected", e[e.CloseBraceExpected = 7] = "CloseBraceExpected", e[e.CloseBracketExpected = 8] = "CloseBracketExpected", e[e.EndOfFileExpected = 9] = "EndOfFileExpected", e[e.InvalidCommentToken = 10] = "InvalidCommentToken", e[e.UnexpectedEndOfComment = 11] = "UnexpectedEndOfComment", e[e.UnexpectedEndOfString = 12] = "UnexpectedEndOfString", e[e.UnexpectedEndOfNumber = 13] = "UnexpectedEndOfNumber", e[e.InvalidUnicode = 14] = "InvalidUnicode", e[e.InvalidEscapeCharacter = 15] = "InvalidEscapeCharacter", e[e.InvalidCharacter = 16] = "InvalidCharacter";
|
|
562
|
-
})(ae || (ae = {}));
|
|
563
|
-
const Y = i((e, n) => Ve(_e(n, e)), "readJsonc");
|
|
564
|
-
const pe = i(() => {
|
|
565
|
-
const { findPnpApi: e } = module$1;
|
|
566
|
-
return e && e(process.cwd());
|
|
567
|
-
}, "getPnpApi");
|
|
568
|
-
const We = "detectTypeScriptVersion:";
|
|
569
|
-
const Me = i((e, n) => {
|
|
570
|
-
const s = `${We}${e}`, t = n?.get(s);
|
|
571
|
-
if (t !== void 0) return t ?? void 0;
|
|
572
|
-
let o;
|
|
573
|
-
const r = pe();
|
|
574
|
-
if (r) try {
|
|
575
|
-
o = r.resolveRequest("typescript/package.json", e) ?? void 0;
|
|
576
|
-
} catch {}
|
|
577
|
-
o ??= R(path.resolve(e), path.join("node_modules", "typescript", "package.json"), n);
|
|
578
|
-
let l;
|
|
579
|
-
if (o) try {
|
|
580
|
-
const g = Y(o, n);
|
|
581
|
-
typeof g?.version == "string" && (l = g.version);
|
|
582
|
-
} catch {}
|
|
583
|
-
return n?.set(s, l ?? null), l;
|
|
584
|
-
}, "detectTypeScriptVersion");
|
|
585
|
-
const I = "package.json";
|
|
586
|
-
const M = "tsconfig.json";
|
|
587
|
-
const Je = i((e, n, s) => {
|
|
588
|
-
const t = module$1.createRequire(path.join(s, "tsconfig.json"));
|
|
589
|
-
if (e !== n) try {
|
|
590
|
-
return t.resolve(e);
|
|
591
|
-
} catch {}
|
|
592
|
-
try {
|
|
593
|
-
return t.resolve(n);
|
|
594
|
-
} catch {}
|
|
595
|
-
try {
|
|
596
|
-
return t.resolve(`${n}/${I}`);
|
|
597
|
-
} catch {}
|
|
598
|
-
}, "resolvePackageEntryWithNode");
|
|
599
|
-
const Z = i((e, n, s, t) => {
|
|
600
|
-
const o = `resolveFromPackageJsonPath:${e}:${n}:${s}`;
|
|
601
|
-
if (t?.has(o)) return t.get(o) || !1;
|
|
602
|
-
const r = Y(e, t);
|
|
603
|
-
if (!r) return;
|
|
604
|
-
let l = n || M;
|
|
605
|
-
if (!s && r.exports) try {
|
|
606
|
-
const [g] = v(r.exports, n, ["require", "types"]);
|
|
607
|
-
l = g;
|
|
608
|
-
} catch {
|
|
609
|
-
return t?.set(o, ""), !1;
|
|
610
|
-
}
|
|
611
|
-
else !n && r.tsconfig && (l = r.tsconfig);
|
|
612
|
-
return l = path.join(e, "..", l), t?.set(o, l), l;
|
|
613
|
-
}, "resolveFromPackageJsonPath");
|
|
614
|
-
const ze = i((e, n, s) => {
|
|
615
|
-
const t = `resolveExtendsPath:${e}:${n}`;
|
|
616
|
-
if (s?.has(t)) return s.get(t) || void 0;
|
|
617
|
-
const o = Ge(e, n, s);
|
|
618
|
-
return s?.set(t, o || ""), o;
|
|
619
|
-
}, "resolveExtendsPath");
|
|
620
|
-
const Ge = i((e, n, s) => {
|
|
621
|
-
let t = e;
|
|
622
|
-
if (e === ".." && (t = path.join(t, M)), e[0] === "." && (t = path.resolve(n, t)), path.isAbsolute(t)) {
|
|
623
|
-
const c = F(s, t);
|
|
624
|
-
if (c) {
|
|
625
|
-
if (c.isFile()) return t;
|
|
626
|
-
} else if (!t.endsWith(".json")) {
|
|
627
|
-
const p = `${t}.json`;
|
|
628
|
-
if (F(s, p)) return p;
|
|
629
|
-
}
|
|
630
|
-
return;
|
|
631
|
-
}
|
|
632
|
-
const [o, ...r] = e.split("/"), l = o[0] === "@" ? `${o}/${r.shift()}` : o, g = r.join("/"), m = pe();
|
|
633
|
-
if (m) {
|
|
634
|
-
const { resolveRequest: c } = m;
|
|
635
|
-
try {
|
|
636
|
-
if (l === e) {
|
|
637
|
-
const p = c(path.join(l, I), n);
|
|
638
|
-
if (p) {
|
|
639
|
-
const b = Z(p, g, !1, s);
|
|
640
|
-
if (b && F(s, b)) return b;
|
|
641
|
-
}
|
|
642
|
-
} else {
|
|
643
|
-
let p;
|
|
644
|
-
try {
|
|
645
|
-
p = c(e, n, { extensions: [".json"] });
|
|
646
|
-
} catch {
|
|
647
|
-
p = c(path.join(e, M), n);
|
|
648
|
-
}
|
|
649
|
-
if (p) return p;
|
|
650
|
-
}
|
|
651
|
-
} catch {}
|
|
652
|
-
}
|
|
653
|
-
const k = Je(e, l, n);
|
|
654
|
-
let w;
|
|
655
|
-
if (k) {
|
|
656
|
-
if (path.basename(k) !== I && k.endsWith(".json")) return k;
|
|
657
|
-
w = path.basename(k) === I ? k : R(path.dirname(k), I, s);
|
|
658
|
-
}
|
|
659
|
-
const u = w && path.dirname(w) || R(path.resolve(n), path.join("node_modules", l), s);
|
|
660
|
-
if (!u || !F(s, u)?.isDirectory()) return;
|
|
661
|
-
const A = path.join(u, I);
|
|
662
|
-
if (F(s, A)) {
|
|
663
|
-
const c = Z(A, g, !1, s);
|
|
664
|
-
if (c === !1) return;
|
|
665
|
-
if (c && F(s, c)?.isFile()) return c;
|
|
666
|
-
}
|
|
667
|
-
const O = path.join(u, g), h = O.endsWith(".json");
|
|
668
|
-
if (!h) {
|
|
669
|
-
const c = `${O}.json`;
|
|
670
|
-
if (F(s, c)) return c;
|
|
671
|
-
}
|
|
672
|
-
const D = F(s, O);
|
|
673
|
-
if (D) {
|
|
674
|
-
if (D.isDirectory()) {
|
|
675
|
-
const c = path.join(O, I);
|
|
676
|
-
if (F(s, c)) {
|
|
677
|
-
const b = Z(c, "", !0, s);
|
|
678
|
-
if (b && F(s, b)) return b;
|
|
679
|
-
}
|
|
680
|
-
const p = path.join(O, M);
|
|
681
|
-
if (F(s, p)) return p;
|
|
682
|
-
} else if (h) return O;
|
|
683
|
-
}
|
|
684
|
-
}, "resolveExtendsPathUncached");
|
|
685
|
-
const q = Symbol("implicitBaseUrl");
|
|
686
|
-
const U = "${configDir}";
|
|
687
|
-
const K = /^\.{1,2}(\/.*)?$/;
|
|
688
|
-
const J = i((e) => {
|
|
689
|
-
const n = x(e);
|
|
690
|
-
return K.test(n) ? n : `./${n}`;
|
|
691
|
-
}, "normalizeRelativePath");
|
|
692
|
-
const Qe = i((e) => {
|
|
693
|
-
const n = { ...e };
|
|
694
|
-
if (n.strict) for (const t of [
|
|
695
|
-
"noImplicitAny",
|
|
696
|
-
"noImplicitThis",
|
|
697
|
-
"strictNullChecks",
|
|
698
|
-
"strictFunctionTypes",
|
|
699
|
-
"strictBindCallApply",
|
|
700
|
-
"strictPropertyInitialization",
|
|
701
|
-
"strictBuiltinIteratorReturn",
|
|
702
|
-
"alwaysStrict",
|
|
703
|
-
"useUnknownInCatchVariables"
|
|
704
|
-
]) n[t] === void 0 && (n[t] = !0);
|
|
705
|
-
if (n.composite && (n.declaration ??= !0, n.incremental ??= !0), n.target) {
|
|
706
|
-
let s = n.target.toLowerCase();
|
|
707
|
-
s === "es2015" && (s = "es6"), n.target = s, s === "esnext" && (n.module ??= "es6", n.useDefineForClassFields ??= !0), (s === "es6" || s === "es2016" || s === "es2017" || s === "es2018" || s === "es2019" || s === "es2020" || s === "es2021" || s === "es2022" || s === "es2023" || s === "es2024" || s === "es2025") && (n.module ??= "es6"), (s === "es2022" || s === "es2023" || s === "es2024" || s === "es2025") && (n.useDefineForClassFields ??= !0);
|
|
708
|
-
}
|
|
709
|
-
if (n.module) {
|
|
710
|
-
let s = n.module.toLowerCase();
|
|
711
|
-
if (s === "es2015" && (s = "es6"), n.module = s, (s === "es6" || s === "es2020" || s === "es2022" || s === "esnext" || s === "none" || s === "system" || s === "umd" || s === "amd") && (n.moduleResolution ??= "classic"), s === "system" && (n.allowSyntheticDefaultImports ??= !0), (s === "node16" || s === "node18" || s === "node20" || s === "nodenext" || s === "preserve") && (n.esModuleInterop ??= !0, n.allowSyntheticDefaultImports ??= !0), (s === "node16" || s === "node18" || s === "node20" || s === "nodenext") && (n.moduleDetection ??= "force"), (s === "node16" || s === "node18") && (n.target ??= "es2022", n.moduleResolution ??= "node16"), s === "node20" && (n.target ??= "es2023", n.moduleResolution ??= "node16", n.resolveJsonModule ??= !0), s === "nodenext" && (n.target ??= "esnext", n.moduleResolution ??= "nodenext", n.resolveJsonModule ??= !0), s === "node16" || s === "node18" || s === "node20" || s === "nodenext") {
|
|
712
|
-
const t = n.target;
|
|
713
|
-
(t === "es3" || t === "es2022" || t === "es2023" || t === "es2024" || t === "esnext") && (n.useDefineForClassFields ??= !0);
|
|
714
|
-
}
|
|
715
|
-
s === "preserve" && (n.moduleResolution ??= "bundler");
|
|
716
|
-
}
|
|
717
|
-
if (n.moduleResolution) {
|
|
718
|
-
let s = n.moduleResolution.toLowerCase();
|
|
719
|
-
s === "node" && (s = "node10"), n.moduleResolution = s, (s === "node16" || s === "nodenext" || s === "bundler") && (n.resolvePackageJsonExports ??= !0, n.resolvePackageJsonImports ??= !0), s === "bundler" && (n.allowSyntheticDefaultImports ??= !0, n.resolveJsonModule ??= !0);
|
|
720
|
-
}
|
|
721
|
-
for (const s of [
|
|
722
|
-
"jsx",
|
|
723
|
-
"moduleDetection",
|
|
724
|
-
"importsNotUsedAsValues",
|
|
725
|
-
"newLine"
|
|
726
|
-
]) n[s] && (n[s] = n[s].toLowerCase());
|
|
727
|
-
return n.esModuleInterop && (n.allowSyntheticDefaultImports ??= !0), n.verbatimModuleSyntax && (n.isolatedModules ??= !0, n.preserveConstEnums ??= !0), n.isolatedModules && (n.preserveConstEnums ??= !0), n.rewriteRelativeImportExtensions && (n.allowImportingTsExtensions ??= !0), n.lib && (n.lib = n.lib.map((s) => s.toLowerCase())), n.checkJs && (n.allowJs ??= !0), n;
|
|
728
|
-
}, "normalizeCompilerOptions");
|
|
729
|
-
const He = i((e, n) => {
|
|
730
|
-
!n.has("target") && !Xe(e.module) && (e.target = "es3");
|
|
731
|
-
}, "applyV4Defaults");
|
|
732
|
-
const Xe = i((e) => e === "node16" || e === "node18" || e === "node20" || e === "nodenext", "moduleDictatesTarget$1");
|
|
733
|
-
const Ye = i((e, n) => {
|
|
734
|
-
!n.has("target") && !Ze(e.module) && (e.target = "es5");
|
|
735
|
-
}, "applyV5Defaults");
|
|
736
|
-
const Ze = i((e) => e === "node16" || e === "node18" || e === "node20" || e === "nodenext", "moduleDictatesTarget");
|
|
737
|
-
const qe = i((e, n) => {
|
|
738
|
-
n.has("strict") || (e.strict = !0), n.has("target") || (e.target = "es2025"), n.has("module") || (e.module = "es2022"), n.has("moduleResolution") || (e.moduleResolution = "bundler"), n.has("rootDir") || (e.rootDir = "."), n.has("types") || (e.types = []), n.has("noUncheckedSideEffectImports") || (e.noUncheckedSideEffectImports = !0), n.has("libReplacement") || (e.libReplacement = !1);
|
|
739
|
-
}, "applyV6Defaults");
|
|
740
|
-
const Ke = [
|
|
741
|
-
[4, He],
|
|
742
|
-
[5, Ye],
|
|
743
|
-
[6, qe]
|
|
744
|
-
];
|
|
745
|
-
const Ce = i((e) => {
|
|
746
|
-
const n = /^v?(\d+)/.exec(e);
|
|
747
|
-
return n ? Number(n[1]) : void 0;
|
|
748
|
-
}, "parseMajor");
|
|
749
|
-
const et = i((e, n) => {
|
|
750
|
-
const s = Ce(n);
|
|
751
|
-
if (s === void 0) return;
|
|
752
|
-
const t = new Set(Object.keys(e));
|
|
753
|
-
for (const [o, r] of Ke) o <= s && r(e, t);
|
|
754
|
-
}, "applyVersionDefaults");
|
|
755
|
-
const C = i((e, n) => J(path.relative(e, n)), "pathRelative");
|
|
756
|
-
const me = [
|
|
757
|
-
"files",
|
|
758
|
-
"include",
|
|
759
|
-
"exclude"
|
|
760
|
-
];
|
|
761
|
-
const ge = i((e, n, s) => {
|
|
762
|
-
const t = path.join(n, s);
|
|
763
|
-
return x(path.relative(e, t)) || "./";
|
|
764
|
-
}, "resolveAndRelativize");
|
|
765
|
-
const tt = i((e, n, s) => {
|
|
766
|
-
const t = path.relative(e, n);
|
|
767
|
-
if (!t) return s;
|
|
768
|
-
return x(`${t}/${s.startsWith("./") ? s.slice(2) : s}`);
|
|
769
|
-
}, "prefixPattern");
|
|
770
|
-
const de = ["outDir", "declarationDir"];
|
|
771
|
-
const z = i((e, n) => {
|
|
772
|
-
if (e.startsWith(U)) return x(path.join(n, e.slice(12)));
|
|
773
|
-
}, "interpolateConfigDir");
|
|
774
|
-
const nt = [
|
|
775
|
-
"outDir",
|
|
776
|
-
"declarationDir",
|
|
777
|
-
"outFile",
|
|
778
|
-
"rootDir",
|
|
779
|
-
"baseUrl",
|
|
780
|
-
"tsBuildInfoFile"
|
|
781
|
-
];
|
|
782
|
-
const ke = i((e, n = {}) => {
|
|
783
|
-
if (e.length === 0) throw new Error("Chain must not be empty");
|
|
784
|
-
const { typescriptVersion: s } = n, t = new Map(e.map((u) => [u.path, u])), o = /* @__PURE__ */ new Map(), r = i((u) => {
|
|
785
|
-
const A = o.get(u);
|
|
786
|
-
if (A) return A;
|
|
787
|
-
const O = t.get(u);
|
|
788
|
-
if (!O) throw new Error(`Config not found in chain: ${u}`);
|
|
789
|
-
const h = O.config, D = path.dirname(u);
|
|
790
|
-
let c = {
|
|
791
|
-
...h,
|
|
792
|
-
...h.compilerOptions && { compilerOptions: { ...h.compilerOptions } },
|
|
793
|
-
...h.watchOptions && { watchOptions: { ...h.watchOptions } }
|
|
794
|
-
};
|
|
795
|
-
if (delete c.extends, c.compilerOptions?.paths && !c.compilerOptions.baseUrl && (c.compilerOptions[q] = D), h.extends) {
|
|
796
|
-
const p = Array.isArray(h.extends) ? h.extends : [h.extends];
|
|
797
|
-
for (const b of p.toReversed()) {
|
|
798
|
-
const f = r(b), y = path.dirname(b), { references: j, ...v } = f;
|
|
799
|
-
if (v.compilerOptions) {
|
|
800
|
-
const L = { ...v.compilerOptions };
|
|
801
|
-
for (const B of [
|
|
802
|
-
"baseUrl",
|
|
803
|
-
"outDir",
|
|
804
|
-
"declarationDir",
|
|
805
|
-
"rootDir"
|
|
806
|
-
]) {
|
|
807
|
-
const $ = L[B];
|
|
808
|
-
$ && !$.startsWith(U) && (L[B] = ge(D, y, $));
|
|
809
|
-
}
|
|
810
|
-
for (const B of ["rootDirs", "typeRoots"]) {
|
|
811
|
-
const $ = L[B];
|
|
812
|
-
$ && (L[B] = $.map((N) => N.startsWith(U) ? N : ge(D, y, N)));
|
|
813
|
-
}
|
|
814
|
-
v.compilerOptions = L;
|
|
815
|
-
}
|
|
816
|
-
for (const L of me) {
|
|
817
|
-
const B = v[L];
|
|
818
|
-
B && (v[L] = B.map(($) => $.startsWith(U) ? $ : tt(D, y, $)));
|
|
819
|
-
}
|
|
820
|
-
const d = {
|
|
821
|
-
...v,
|
|
822
|
-
...c,
|
|
823
|
-
compilerOptions: {
|
|
824
|
-
...v.compilerOptions,
|
|
825
|
-
...c.compilerOptions
|
|
826
|
-
}
|
|
827
|
-
};
|
|
828
|
-
v.watchOptions && (d.watchOptions = {
|
|
829
|
-
...v.watchOptions,
|
|
830
|
-
...c.watchOptions
|
|
831
|
-
}), c = d;
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
if (c.compilerOptions) {
|
|
835
|
-
const { compilerOptions: p } = c;
|
|
836
|
-
for (const f of ["baseUrl", "rootDir"]) {
|
|
837
|
-
const y = p[f];
|
|
838
|
-
if (y && !y.startsWith(U)) {
|
|
839
|
-
const j = path.resolve(D, y);
|
|
840
|
-
p[f] = C(D, j);
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
for (const f of de) {
|
|
844
|
-
let y = p[f];
|
|
845
|
-
y && (Array.isArray(c.exclude) || (c.exclude = de.map((j) => p[j]).filter(Boolean)), y.startsWith(U) || (y = J(y)), p[f] = y);
|
|
846
|
-
}
|
|
847
|
-
} else c.compilerOptions = {};
|
|
848
|
-
if (c.include && (c.include = c.include.map(x)), c.files && (c.files = c.files.map((p) => p.startsWith(U) ? p : J(p))), c.watchOptions) {
|
|
849
|
-
const { watchOptions: p } = c;
|
|
850
|
-
for (const b of ["excludeDirectories", "excludeFiles"]) p[b] && (p[b] = p[b].map((f) => x(path.resolve(D, f))));
|
|
851
|
-
for (const b of [
|
|
852
|
-
"watchFile",
|
|
853
|
-
"watchDirectory",
|
|
854
|
-
"fallbackPolling"
|
|
855
|
-
]) if (p[b]) {
|
|
856
|
-
const f = p;
|
|
857
|
-
f[b] = p[b].toLowerCase();
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
return o.set(u, c), c;
|
|
861
|
-
}, "resolveEntry"), l = e[0], g = r(l.path), m = path.dirname(l.path), k = {
|
|
862
|
-
...g,
|
|
863
|
-
compilerOptions: g.compilerOptions ? { ...g.compilerOptions } : {}
|
|
864
|
-
}, { compilerOptions: w } = k;
|
|
865
|
-
if (w) {
|
|
866
|
-
for (const u of nt) {
|
|
867
|
-
const A = w[u];
|
|
868
|
-
if (A) {
|
|
869
|
-
const O = z(A, m);
|
|
870
|
-
w[u] = O ? C(m, O) : A;
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
for (const u of ["rootDirs", "typeRoots"]) {
|
|
874
|
-
const A = w[u];
|
|
875
|
-
A && (w[u] = A.map((O) => {
|
|
876
|
-
const h = z(O, m);
|
|
877
|
-
return h ? C(m, h) : J(O);
|
|
878
|
-
}));
|
|
879
|
-
}
|
|
880
|
-
if (w.paths) {
|
|
881
|
-
const u = {};
|
|
882
|
-
for (const [A, O] of Object.entries(w.paths)) u[A] = O.map((h) => z(h, m) ?? h);
|
|
883
|
-
w.paths = u;
|
|
884
|
-
}
|
|
885
|
-
s && et(w, s), k.compilerOptions = Qe(w);
|
|
886
|
-
}
|
|
887
|
-
for (const u of me) {
|
|
888
|
-
const A = k[u];
|
|
889
|
-
A && (k[u] = A.map((O) => z(O, m) ?? O));
|
|
890
|
-
}
|
|
891
|
-
return {
|
|
892
|
-
path: l.path,
|
|
893
|
-
config: k,
|
|
894
|
-
sources: e.map((u) => u.path)
|
|
895
|
-
};
|
|
896
|
-
}, "resolveExtendsChain");
|
|
897
|
-
const we = i((e, n = {}) => {
|
|
898
|
-
const { cache: s = /* @__PURE__ */ new Map() } = n, t = path.resolve(e), o = [], r = /* @__PURE__ */ new Set(), l = i((g, m) => {
|
|
899
|
-
const k = x(g);
|
|
900
|
-
if (r.has(k)) return;
|
|
901
|
-
r.add(k);
|
|
902
|
-
let w;
|
|
903
|
-
try {
|
|
904
|
-
w = Y(g, s) || {};
|
|
905
|
-
} catch {
|
|
906
|
-
throw new Error(`Cannot resolve tsconfig at path: ${g}`);
|
|
907
|
-
}
|
|
908
|
-
if (typeof w != "object") throw new SyntaxError(`Failed to parse tsconfig at: ${g}`);
|
|
909
|
-
const u = path.dirname(g);
|
|
910
|
-
if (w.extends) {
|
|
911
|
-
const A = Array.isArray(w.extends), h = (A ? w.extends : [w.extends]).map((c) => {
|
|
912
|
-
const p = ze(c, u, s);
|
|
913
|
-
if (!p) throw new Error(`File '${c}' not found.`);
|
|
914
|
-
const b = x(p);
|
|
915
|
-
if (m.has(b) || b === k) throw new Error(`Circularity detected while resolving configuration: ${b}`);
|
|
916
|
-
return b;
|
|
917
|
-
});
|
|
918
|
-
w.extends = A ? h : h[0], o.push({
|
|
919
|
-
path: k,
|
|
920
|
-
config: w
|
|
921
|
-
});
|
|
922
|
-
const D = new Set(m);
|
|
923
|
-
D.add(k);
|
|
924
|
-
for (const c of [...h].reverse()) l(c, D);
|
|
925
|
-
} else o.push({
|
|
926
|
-
path: k,
|
|
927
|
-
config: w
|
|
928
|
-
});
|
|
929
|
-
}, "collect");
|
|
930
|
-
return l(t, /* @__PURE__ */ new Set()), o;
|
|
931
|
-
}, "getExtendsChain");
|
|
932
|
-
const ee = i((e, n = {}) => {
|
|
933
|
-
const { cache: s = /* @__PURE__ */ new Map(), typescriptVersion: t = "auto" } = n, o = we(e, { cache: s });
|
|
934
|
-
let r;
|
|
935
|
-
return t === "auto" ? r = Me(path.dirname(o[0].path), s) : t !== !1 && (r = t), ke(o, { typescriptVersion: r });
|
|
936
|
-
}, "readTsconfig");
|
|
937
|
-
var st = Object.defineProperty;
|
|
938
|
-
var G = i((e, n) => st(e, "name", {
|
|
939
|
-
value: n,
|
|
940
|
-
configurable: !0
|
|
941
|
-
}), "s");
|
|
942
|
-
const ve = G((e) => {
|
|
943
|
-
let n = "";
|
|
944
|
-
for (let s = 0; s < e.length; s += 1) {
|
|
945
|
-
const t = e[s], o = t.toUpperCase();
|
|
946
|
-
n += t === o ? t.toLowerCase() : o;
|
|
947
|
-
}
|
|
948
|
-
return n;
|
|
949
|
-
}, "invertCase"), te = /* @__PURE__ */ new Map(), be = G((e, n) => {
|
|
950
|
-
const s = Se.join(e, `.is-fs-case-sensitive-test-${process.pid}`);
|
|
951
|
-
try {
|
|
952
|
-
return n.writeFileSync(s, ""), !n.existsSync(ve(s));
|
|
953
|
-
} finally {
|
|
954
|
-
try {
|
|
955
|
-
n.unlinkSync(s);
|
|
956
|
-
} catch {}
|
|
957
|
-
}
|
|
958
|
-
}, "checkDirectoryCaseWithWrite"), ot = G((e, n, s) => {
|
|
959
|
-
try {
|
|
960
|
-
return be(e, s);
|
|
961
|
-
} catch (t) {
|
|
962
|
-
if (n === void 0) return be(Ie.tmpdir(), s);
|
|
963
|
-
throw t;
|
|
964
|
-
}
|
|
965
|
-
}, "checkDirectoryCaseWithFallback"), it = G((e, n = Ue, s = !0) => {
|
|
966
|
-
const t = e ?? process.cwd();
|
|
967
|
-
if (s && te.has(t)) return te.get(t);
|
|
968
|
-
let o;
|
|
969
|
-
const r = ve(t);
|
|
970
|
-
return r !== t && n.existsSync(t) ? o = !n.existsSync(r) : o = ot(t, e, n), s && te.set(t, o), o;
|
|
971
|
-
}, "isFsCaseSensitive"), { join: ye } = path.posix, ne = {
|
|
972
|
-
ts: [
|
|
973
|
-
".ts",
|
|
974
|
-
".tsx",
|
|
975
|
-
".d.ts"
|
|
976
|
-
],
|
|
977
|
-
cts: [".cts", ".d.cts"],
|
|
978
|
-
mts: [".mts", ".d.mts"]
|
|
979
|
-
}, rt = i((e) => {
|
|
980
|
-
const n = [...ne.ts], s = [...ne.cts], t = [...ne.mts];
|
|
981
|
-
return e?.allowJs && (n.push(".js", ".jsx"), s.push(".cjs"), t.push(".mjs")), [
|
|
982
|
-
...n,
|
|
983
|
-
...s,
|
|
984
|
-
...t
|
|
985
|
-
];
|
|
986
|
-
}, "getSupportedExtensions"), lt = i((e) => {
|
|
987
|
-
const n = [];
|
|
988
|
-
if (!e) return n;
|
|
989
|
-
const { outDir: s, declarationDir: t } = e;
|
|
990
|
-
return s && n.push(s), t && n.push(t), n;
|
|
991
|
-
}, "getDefaultExcludeSpec"), Te = i((e) => e.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`), "escapeForRegexp"), se = `(?!(${[
|
|
992
|
-
"node_modules",
|
|
993
|
-
"bower_components",
|
|
994
|
-
"jspm_packages"
|
|
995
|
-
].join("|")})(/|$))`, ft = /(?:^|\/)[^.*?]+$/, he = "**/*", Q = "[^/]", oe = "[^./]", Oe = process.platform === "win32", ut = i(({ config: e, path: n }, s) => {
|
|
996
|
-
if ("extends" in e) throw new Error("tsconfig#extends must be resolved. Use getTsconfig or readTsconfig to resolve it.");
|
|
997
|
-
if (!path.isAbsolute(n)) throw new Error("The tsconfig path must be absolute");
|
|
998
|
-
Oe && (n = x(n));
|
|
999
|
-
const t = path.dirname(n), { files: o, include: r, exclude: l, compilerOptions: g } = e, m = i((c) => path.isAbsolute(c) ? c : ye(t, c), "resolvePattern"), k = o ? new Set(o.map(m)) : void 0, w = rt(g), u = s ? "" : "i", O = (l || lt(g)).map((c) => {
|
|
1000
|
-
const p = m(c), b = Te(p).replaceAll(String.raw`\*\*/`, "(.+/)?").replaceAll(String.raw`\*`, `${Q}*`).replaceAll(String.raw`\?`, Q);
|
|
1001
|
-
return new RegExp(`^${b}($|/)`, u);
|
|
1002
|
-
}), h = o || r ? r : [he];
|
|
1003
|
-
return {
|
|
1004
|
-
filesSet: k,
|
|
1005
|
-
extensions: w,
|
|
1006
|
-
excludePatterns: O,
|
|
1007
|
-
includePatterns: h ? h.map((c) => {
|
|
1008
|
-
let p = m(c);
|
|
1009
|
-
ft.test(p) && (p = ye(p, he));
|
|
1010
|
-
const b = Te(p).replaceAll(String.raw`/\*\*`, `(/${se}${oe}${Q}*)*?`).replaceAll(/(\/)?\\\*/g, (f, y) => {
|
|
1011
|
-
const j = String.raw`(${oe}|(\.(?!min\.js$))?)*`;
|
|
1012
|
-
return y ? `/${se}${oe}${j}` : j;
|
|
1013
|
-
}).replaceAll(/(\/)?\\\?/g, (f, y) => {
|
|
1014
|
-
const j = Q;
|
|
1015
|
-
return y ? `/${se}${j}` : j;
|
|
1016
|
-
});
|
|
1017
|
-
return new RegExp(`^${b}$`, u);
|
|
1018
|
-
}) : void 0
|
|
1019
|
-
};
|
|
1020
|
-
}, "compilePatterns"), Ae = /* @__PURE__ */ new WeakMap(), je = i((e, n) => {
|
|
1021
|
-
if (!path.isAbsolute(n)) return !1;
|
|
1022
|
-
Oe && (n = x(n));
|
|
1023
|
-
let s = Ae.get(e);
|
|
1024
|
-
s || (s = ut(e, it()), Ae.set(e, s));
|
|
1025
|
-
const { filesSet: t, extensions: o, excludePatterns: r, includePatterns: l } = s;
|
|
1026
|
-
return t?.has(n) ? !0 : !o.some((g) => n.endsWith(g)) || r.some((g) => g.test(n)) ? !1 : !!(l && l.some((g) => g.test(n)));
|
|
1027
|
-
}, "isFileIncluded"), De = i((e, n, s, t) => {
|
|
1028
|
-
const o = path.resolve(e);
|
|
1029
|
-
let r = x(e);
|
|
1030
|
-
for (;;) {
|
|
1031
|
-
const l = R(r, n, s);
|
|
1032
|
-
if (!l) return;
|
|
1033
|
-
const g = path.resolve(l), m = ee(g, {
|
|
1034
|
-
cache: s,
|
|
1035
|
-
typescriptVersion: t
|
|
1036
|
-
});
|
|
1037
|
-
if (je(m, o)) return m;
|
|
1038
|
-
const k = path.dirname(l), w = path.dirname(k);
|
|
1039
|
-
if (w === k) return;
|
|
1040
|
-
r = w;
|
|
1041
|
-
}
|
|
1042
|
-
}, "findConfigApplicable"), Ee = i((e = process.cwd(), n = {}) => {
|
|
1043
|
-
const { configName: s = "tsconfig.json", cache: t = /* @__PURE__ */ new Map(), includes: o = !1 } = n;
|
|
1044
|
-
if (!o) {
|
|
1045
|
-
const r = path.resolve(e);
|
|
1046
|
-
return path.basename(r) === s && F(t, r)?.isFile() ? x(r) : R(x(e), s, t);
|
|
1047
|
-
}
|
|
1048
|
-
return De(e, s, t, !1)?.path;
|
|
1049
|
-
}, "findTsconfig"), at = i((e = process.cwd(), n = {}) => {
|
|
1050
|
-
const { configName: s = "tsconfig.json", cache: t = /* @__PURE__ */ new Map(), includes: o = !1, typescriptVersion: r = "auto" } = n;
|
|
1051
|
-
if (!o) {
|
|
1052
|
-
const l = Ee(e, {
|
|
1053
|
-
configName: s,
|
|
1054
|
-
cache: t
|
|
1055
|
-
});
|
|
1056
|
-
return l ? ee(l, {
|
|
1057
|
-
cache: t,
|
|
1058
|
-
typescriptVersion: r
|
|
1059
|
-
}) : void 0;
|
|
1060
|
-
}
|
|
1061
|
-
return De(e, s, t, r);
|
|
1062
|
-
}, "getTsconfig"), pt = /\*/g, xe = i((e, n) => {
|
|
1063
|
-
const s = e.match(pt);
|
|
1064
|
-
if (s && s.length > 1) throw new Error(n);
|
|
1065
|
-
}, "assertStarCount"), mt = i((e) => {
|
|
1066
|
-
if (e.includes("*")) {
|
|
1067
|
-
const [n, s] = e.split("*");
|
|
1068
|
-
return {
|
|
1069
|
-
prefix: n,
|
|
1070
|
-
suffix: s
|
|
1071
|
-
};
|
|
1072
|
-
}
|
|
1073
|
-
return e;
|
|
1074
|
-
}, "parsePattern"), gt = i(({ prefix: e, suffix: n }, s) => s.startsWith(e) && s.endsWith(n), "isPatternMatch"), dt = i((e, n, s) => Object.entries(e).map(([t, o]) => (xe(t, `Pattern '${t}' can have at most one '*' character.`), {
|
|
1075
|
-
pattern: mt(t),
|
|
1076
|
-
substitutions: o.map((r) => {
|
|
1077
|
-
if (xe(r, `Substitution '${r}' in pattern '${t}' can have at most one '*' character.`), !n && !K.test(r) && !path.isAbsolute(r)) throw new Error("Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?");
|
|
1078
|
-
return path.resolve(s, r);
|
|
1079
|
-
})
|
|
1080
|
-
})), "parsePaths"), kt = i((e) => {
|
|
1081
|
-
const { compilerOptions: n } = e.config;
|
|
1082
|
-
if (!n) return null;
|
|
1083
|
-
const { baseUrl: s, paths: t } = n;
|
|
1084
|
-
if (!s && !t) return null;
|
|
1085
|
-
const o = q in n && n[q], r = path.resolve(path.dirname(e.path), s || o || "."), l = t ? dt(t, s, r) : [], g = /* @__PURE__ */ new Map(), m = [];
|
|
1086
|
-
for (const k of l) typeof k.pattern == "string" ? g.set(k.pattern, k.substitutions) : m.push(k);
|
|
1087
|
-
return {
|
|
1088
|
-
exactEntries: g,
|
|
1089
|
-
patternEntries: m,
|
|
1090
|
-
resolvedBaseUrl: r,
|
|
1091
|
-
baseUrl: s
|
|
1092
|
-
};
|
|
1093
|
-
}, "compilePaths"), Fe = /* @__PURE__ */ new WeakMap();
|
|
1094
|
-
i((e, n) => {
|
|
1095
|
-
let s = Fe.get(e);
|
|
1096
|
-
if (s === void 0 && (s = kt(e), Fe.set(e, s)), !s) return [];
|
|
1097
|
-
if (K.test(n)) return [];
|
|
1098
|
-
const { exactEntries: t, patternEntries: o, resolvedBaseUrl: r, baseUrl: l } = s, g = t.get(n);
|
|
1099
|
-
if (g) return g.map(x);
|
|
1100
|
-
let m, k = -1;
|
|
1101
|
-
for (const u of o) gt(u.pattern, n) && u.pattern.prefix.length > k && (k = u.pattern.prefix.length, m = u);
|
|
1102
|
-
if (!m) return l ? [x(path.join(r, n))] : [];
|
|
1103
|
-
const w = n.slice(m.pattern.prefix.length, n.length - m.pattern.suffix.length);
|
|
1104
|
-
return m.substitutions.map((u) => x(u.replace("*", w)));
|
|
1105
|
-
}, "resolvePathAlias");
|
|
1106
|
-
//#endregion
|
|
1107
|
-
//#region ../../node_modules/.pnpm/tsdown@0.22.7_@arethetypeswrong+core@0.18.2_@tsdown+css@0.22.7_@tsdown+exe@0.22.7_@type_53c241a653f2227a5df8ba2949047afe/node_modules/tsdown/dist/format-V8jMDi-4.mjs
|
|
26
|
+
//#region ../../node_modules/.pnpm/tsdown@0.22.14_@arethetypeswrong+core@0.18.2_@tsdown+css@0.22.14_@tsdown+exe@0.22.14_@t_ce23af2d06b6e55ae551016827d08ee4/node_modules/tsdown/dist/deps-B_uZzM4C.mjs
|
|
1108
27
|
const shimFile = path.resolve(import.meta.dirname, "..", "esm-shims.js");
|
|
1109
28
|
const shimsInject = {
|
|
1110
29
|
__dirname: [shimFile, "__dirname"],
|
|
@@ -1133,8 +52,13 @@ function getShims(config) {
|
|
|
1133
52
|
return { inject: shimsInject };
|
|
1134
53
|
}
|
|
1135
54
|
const debug$7 = createDebug("tsdown:deps");
|
|
55
|
+
/**
|
|
56
|
+
* Matches specifiers that follow npm package naming conventions,
|
|
57
|
+
* e.g. `pkg`, `pkg/subpath`, `@scope/pkg/subpath`.
|
|
58
|
+
*/
|
|
59
|
+
const RE_PACKAGE_SPECIFIER = /^(?:@[a-z0-9-][a-z0-9-._]*\/)?[a-z0-9-][a-z0-9-._]*(?:\/|$)/;
|
|
1136
60
|
function resolveDepsConfig(config, logger) {
|
|
1137
|
-
let { neverBundle, alwaysBundle, onlyBundle, skipNodeModulesBundle =
|
|
61
|
+
let { neverBundle, alwaysBundle, onlyBundle, onlyImport, skipNodeModulesBundle, resolveDepSubpath = true } = config.deps || {};
|
|
1138
62
|
if (config.external != null) {
|
|
1139
63
|
if (neverBundle != null) throw new TypeError("`external` is deprecated. Cannot be used with `deps.neverBundle`.");
|
|
1140
64
|
logger?.warn("`external` is deprecated. Use `deps.neverBundle` instead.");
|
|
@@ -1145,27 +69,33 @@ function resolveDepsConfig(config, logger) {
|
|
|
1145
69
|
logger?.warn("`noExternal` is deprecated. Use `deps.alwaysBundle` instead.");
|
|
1146
70
|
alwaysBundle = config.noExternal;
|
|
1147
71
|
}
|
|
1148
|
-
if (config.deps?.onlyAllowBundle != null) {
|
|
1149
|
-
if (onlyBundle != null) throw new TypeError("`deps.onlyAllowBundle` is deprecated. Cannot be used with `deps.onlyBundle`.");
|
|
1150
|
-
logger?.warn("`deps.onlyAllowBundle` is deprecated. Use `deps.onlyBundle` instead.");
|
|
1151
|
-
onlyBundle = config.deps.onlyAllowBundle;
|
|
1152
|
-
}
|
|
1153
72
|
if (config.inlineOnly != null) {
|
|
1154
73
|
if (onlyBundle != null) throw new TypeError("`inlineOnly` is deprecated. Cannot be used with `deps.onlyBundle`.");
|
|
1155
74
|
logger?.warn("`inlineOnly` is deprecated. Use `deps.onlyBundle` instead.");
|
|
1156
75
|
onlyBundle = config.inlineOnly;
|
|
1157
76
|
}
|
|
77
|
+
if (config.deps?.onlyAllowBundle != null) {
|
|
78
|
+
if (onlyBundle != null) throw new TypeError("`deps.onlyAllowBundle` is deprecated. Cannot be used with `deps.onlyBundle`.");
|
|
79
|
+
logger?.warn("`deps.onlyAllowBundle` is deprecated. Use `deps.onlyBundle` instead.");
|
|
80
|
+
onlyBundle = config.deps.onlyAllowBundle;
|
|
81
|
+
}
|
|
1158
82
|
if (config.skipNodeModulesBundle != null) {
|
|
1159
83
|
if (config.deps?.skipNodeModulesBundle != null) throw new TypeError("`skipNodeModulesBundle` is deprecated. Cannot be used with `deps.skipNodeModulesBundle`.");
|
|
1160
|
-
logger?.warn("`skipNodeModulesBundle` is deprecated. Use `deps.
|
|
84
|
+
logger?.warn("`skipNodeModulesBundle` is deprecated. Use `deps.neverBundle: true` instead.");
|
|
1161
85
|
skipNodeModulesBundle = config.skipNodeModulesBundle;
|
|
86
|
+
} else if (skipNodeModulesBundle != null) logger?.warn("`deps.skipNodeModulesBundle` is deprecated. Use `deps.neverBundle: true` instead.");
|
|
87
|
+
if (skipNodeModulesBundle) {
|
|
88
|
+
if (neverBundle === true) throw new TypeError("`deps.skipNodeModulesBundle` is deprecated. Cannot be used with `deps.neverBundle: true`.");
|
|
89
|
+
if (alwaysBundle != null) throw new TypeError("`deps.skipNodeModulesBundle` and `deps.alwaysBundle` are mutually exclusive options and cannot be used together.");
|
|
1162
90
|
}
|
|
1163
|
-
if (skipNodeModulesBundle && alwaysBundle != null) throw new TypeError("`deps.skipNodeModulesBundle` and `deps.alwaysBundle` are mutually exclusive options and cannot be used together.");
|
|
1164
91
|
if (onlyBundle != null && onlyBundle !== false) onlyBundle = toArray(onlyBundle);
|
|
92
|
+
if (onlyImport != null) onlyImport = toArray(onlyImport);
|
|
1165
93
|
return {
|
|
1166
94
|
...normalizeDepsOptions(alwaysBundle, neverBundle),
|
|
1167
95
|
onlyBundle,
|
|
96
|
+
onlyImport,
|
|
1168
97
|
skipNodeModulesBundle,
|
|
98
|
+
resolveDepSubpath,
|
|
1169
99
|
dts: normalizeDepsOptions(config.deps?.dts?.alwaysBundle, config.deps?.dts?.neverBundle)
|
|
1170
100
|
};
|
|
1171
101
|
}
|
|
@@ -1179,7 +109,7 @@ function normalizeDepsOptions(alwaysBundle, neverBundle) {
|
|
|
1179
109
|
neverBundle: resolveRegex(neverBundle)
|
|
1180
110
|
};
|
|
1181
111
|
}
|
|
1182
|
-
function DepsPlugin({ pkg, deps: { alwaysBundle: jsAlwaysBundle, onlyBundle, skipNodeModulesBundle, dts }, logger, nameLabel }, tsdownBundle) {
|
|
112
|
+
function DepsPlugin({ pkg, deps: { neverBundle, alwaysBundle: jsAlwaysBundle, onlyBundle, onlyImport, skipNodeModulesBundle, resolveDepSubpath: shouldResolveDepSubpath, dts }, logger, nameLabel, platform }, tsdownBundle) {
|
|
1183
113
|
const deps = pkg && Array.from(getProductionDeps(pkg));
|
|
1184
114
|
return {
|
|
1185
115
|
name: "tsdown:deps",
|
|
@@ -1187,11 +117,12 @@ function DepsPlugin({ pkg, deps: { alwaysBundle: jsAlwaysBundle, onlyBundle, ski
|
|
|
1187
117
|
filter: [include(and(id(/^[^.]/), importerId(/./)))],
|
|
1188
118
|
async handler(id, importer, extraOptions) {
|
|
1189
119
|
if (extraOptions.isEntry) return;
|
|
1190
|
-
|
|
120
|
+
let resolveResult;
|
|
121
|
+
const resolve = () => resolveResult ??= this.resolve(id, importer, {
|
|
1191
122
|
...extraOptions,
|
|
1192
123
|
skipSelf: true
|
|
1193
124
|
});
|
|
1194
|
-
let shouldExternal = await externalStrategy(id, importer,
|
|
125
|
+
let shouldExternal = await externalStrategy(id, importer, resolve);
|
|
1195
126
|
if (Array.isArray(shouldExternal)) {
|
|
1196
127
|
debug$7("custom resolved id for %o -> %o", id, shouldExternal[1]);
|
|
1197
128
|
id = shouldExternal[1];
|
|
@@ -1204,6 +135,7 @@ function DepsPlugin({ pkg, deps: { alwaysBundle: jsAlwaysBundle, onlyBundle, ski
|
|
|
1204
135
|
external: shouldExternal,
|
|
1205
136
|
moduleSideEffects
|
|
1206
137
|
};
|
|
138
|
+
const resolved = await resolve();
|
|
1207
139
|
if (resolved) return {
|
|
1208
140
|
...resolved,
|
|
1209
141
|
moduleSideEffects
|
|
@@ -1215,8 +147,19 @@ function DepsPlugin({ pkg, deps: { alwaysBundle: jsAlwaysBundle, onlyBundle, ski
|
|
|
1215
147
|
async handler(options, bundle) {
|
|
1216
148
|
const deps = /* @__PURE__ */ new Set();
|
|
1217
149
|
const importers = /* @__PURE__ */ new Map();
|
|
150
|
+
const errors = [];
|
|
151
|
+
const moduleIds = [...this.getModuleIds()].filter((id) => platform !== "node" || !isBuiltin(id));
|
|
1218
152
|
for (const chunk of Object.values(bundle)) {
|
|
1219
153
|
if (chunk.type === "asset") continue;
|
|
154
|
+
if (onlyImport && chunk.code && moduleIds.some((id) => chunk.code.includes(id))) {
|
|
155
|
+
const { program } = await parse$1(chunk.fileName, chunk.code);
|
|
156
|
+
for (const source of collectImportSources(program)) {
|
|
157
|
+
if (source[0] === ".") continue;
|
|
158
|
+
if (platform === "node" && isBuiltin(source)) continue;
|
|
159
|
+
if (matchPattern(parsePackageSpecifier(source)[0], onlyImport)) continue;
|
|
160
|
+
errors.push(`${yellow(source)} is imported in ${blue(chunk.fileName)} but is not included in ${blue`deps.onlyImport`} option.\nTo fix this, either add it to ${blue`deps.onlyImport`} or bundle it manually by adding it to ${blue`deps.alwaysBundle`} option.`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
1220
163
|
for (const id of chunk.moduleIds) {
|
|
1221
164
|
if (id === shimFile) continue;
|
|
1222
165
|
const parsed = await readBundledDepInfo(id);
|
|
@@ -1229,12 +172,12 @@ function DepsPlugin({ pkg, deps: { alwaysBundle: jsAlwaysBundle, onlyBundle, ski
|
|
|
1229
172
|
}
|
|
1230
173
|
}
|
|
1231
174
|
debug$7("found deps in bundle: %o", deps);
|
|
175
|
+
if (onlyBundle) errors.push(...Array.from(deps).filter((dep) => !matchPattern(dep, onlyBundle)).map((dep) => `${yellow(dep)} is located in ${blue`node_modules`} but is not included in ${blue`deps.onlyBundle`} option.\nTo fix this, either add it to ${blue`deps.onlyBundle`}, declare it as a production or peer dependency in your package.json, or externalize it manually.\nImported by\n${[...importers.get(dep) || []].map((s) => `- ${underline(s)}`).join("\n")}`));
|
|
176
|
+
if (errors.length) this.error(errors.join("\n\n"));
|
|
1232
177
|
if (onlyBundle) {
|
|
1233
|
-
const
|
|
1234
|
-
if (errors.length) this.error(errors.join("\n\n"));
|
|
1235
|
-
const unusedPatterns = onlyBundle.filter((pattern) => !Array.from(deps).some((dep) => matchPattern(dep, [pattern])));
|
|
178
|
+
const unusedPatterns = onlyBundle.filter((pattern) => Array.from(deps).every((dep) => !matchPattern(dep, [pattern])));
|
|
1236
179
|
if (unusedPatterns.length) logger.info(nameLabel, `The following entries in ${blue`deps.onlyBundle`} are not used in the bundle:\n${unusedPatterns.map((pattern) => `- ${yellow(pattern)}`).join("\n")}\nConsider removing them to keep your configuration clean.`);
|
|
1237
|
-
} else if (onlyBundle == null && deps.size) logger.info(nameLabel, `Hint: consider adding ${blue`deps.onlyBundle`} option to avoid unintended bundling of dependencies, or set ${blue`deps.onlyBundle: false`} to disable this hint.\nSee more at ${underline`https://tsdown.dev/options/dependencies#deps-onlybundle`}\nDetected dependencies in bundle:\n${Array.from(deps
|
|
180
|
+
} else if (onlyBundle == null && deps.size) logger.info(nameLabel, `Hint: consider adding ${blue`deps.onlyBundle`} option to avoid unintended bundling of dependencies, or set ${blue`deps.onlyBundle: false`} to disable this hint.\nSee more at ${underline`https://tsdown.dev/options/dependencies#deps-onlybundle`}\nDetected dependencies in bundle:\n${Array.from(deps, (dep) => `- ${blue(dep)}`).join("\n")}`);
|
|
1238
181
|
}
|
|
1239
182
|
}
|
|
1240
183
|
};
|
|
@@ -1245,19 +188,29 @@ function DepsPlugin({ pkg, deps: { alwaysBundle: jsAlwaysBundle, onlyBundle, ski
|
|
|
1245
188
|
* - `'absolute'`: external as absolute path
|
|
1246
189
|
* - `'no-external'`: skip, but mark as non-external for inlineOnly check
|
|
1247
190
|
*/
|
|
1248
|
-
async function externalStrategy(id, importer,
|
|
191
|
+
async function externalStrategy(id, importer, resolve) {
|
|
1249
192
|
if (id === shimFile) return false;
|
|
1250
|
-
|
|
1251
|
-
if (
|
|
1252
|
-
|
|
1253
|
-
|
|
193
|
+
const isDts = RE_DTS.test(importer);
|
|
194
|
+
if ((isDts && dts?.alwaysBundle || jsAlwaysBundle)?.(id, importer)) return "no-external";
|
|
195
|
+
if ((isDts && dts?.neverBundle != null ? dts.neverBundle : neverBundle) === true) {
|
|
196
|
+
if (id[0] === "\0" || id.startsWith("data:") || path.isAbsolute(id)) return false;
|
|
197
|
+
if (isBuiltin(id) || RE_PACKAGE_SPECIFIER.test(id)) return true;
|
|
198
|
+
const resolved = await resolve();
|
|
199
|
+
return !!resolved && (!!resolved.external || RE_NODE_MODULES$1.test(resolved.id));
|
|
200
|
+
}
|
|
201
|
+
if (skipNodeModulesBundle) {
|
|
202
|
+
const resolved = await resolve();
|
|
203
|
+
if (resolved && (resolved.external || RE_NODE_MODULES$1.test(resolved.id))) {
|
|
204
|
+
const resolvedDep = shouldResolveDepSubpath && await resolveDepSubpath(id, resolve);
|
|
205
|
+
return resolvedDep ? [true, resolvedDep] : true;
|
|
206
|
+
}
|
|
1254
207
|
}
|
|
1255
208
|
if (deps) {
|
|
1256
209
|
if (deps.includes(id) || deps.some((dep) => id.startsWith(`${dep}/`))) {
|
|
1257
|
-
const resolvedDep = await resolveDepSubpath(id,
|
|
210
|
+
const resolvedDep = shouldResolveDepSubpath && await resolveDepSubpath(id, resolve);
|
|
1258
211
|
return resolvedDep ? [true, resolvedDep] : true;
|
|
1259
212
|
}
|
|
1260
|
-
if (
|
|
213
|
+
if (isDts && !id.startsWith("@types/")) {
|
|
1261
214
|
const typesName = getTypesPackageName(id);
|
|
1262
215
|
if (typesName && deps.includes(typesName)) return true;
|
|
1263
216
|
}
|
|
@@ -1265,6 +218,32 @@ function DepsPlugin({ pkg, deps: { alwaysBundle: jsAlwaysBundle, onlyBundle, ski
|
|
|
1265
218
|
return false;
|
|
1266
219
|
}
|
|
1267
220
|
}
|
|
221
|
+
function collectImportSources(program) {
|
|
222
|
+
const sources = [];
|
|
223
|
+
new Visitor({
|
|
224
|
+
ImportDeclaration(node) {
|
|
225
|
+
sources.push(node.source.value);
|
|
226
|
+
},
|
|
227
|
+
ExportAllDeclaration(node) {
|
|
228
|
+
sources.push(node.source.value);
|
|
229
|
+
},
|
|
230
|
+
ExportNamedDeclaration(node) {
|
|
231
|
+
if (node.source) sources.push(node.source.value);
|
|
232
|
+
},
|
|
233
|
+
ImportExpression(node) {
|
|
234
|
+
const source = getStaticString(node.source);
|
|
235
|
+
if (source) sources.push(source);
|
|
236
|
+
}
|
|
237
|
+
}).visit(program);
|
|
238
|
+
return sources;
|
|
239
|
+
}
|
|
240
|
+
function getStaticString(value) {
|
|
241
|
+
if (value.type === "Literal" && typeof value.value === "string") return value.value;
|
|
242
|
+
if (value.type !== "TemplateLiteral") return;
|
|
243
|
+
if (value.expressions.length || value.quasis.length !== 1) return;
|
|
244
|
+
const { cooked, raw } = value.quasis[0].value;
|
|
245
|
+
return cooked ?? raw;
|
|
246
|
+
}
|
|
1268
247
|
function parsePackageSpecifier(id) {
|
|
1269
248
|
const [first, second] = id.split("/", 3);
|
|
1270
249
|
const name = first[0] === "@" && second ? `${first}/${second}` : first;
|
|
@@ -1300,11 +279,12 @@ function getTypesPackageName(id) {
|
|
|
1300
279
|
if (!name) return;
|
|
1301
280
|
return `@types/${name.replace(/^@/, "").replace("/", "__")}`;
|
|
1302
281
|
}
|
|
1303
|
-
async function resolveDepSubpath(id,
|
|
1304
|
-
if (!resolved?.packageJsonPath) return;
|
|
282
|
+
async function resolveDepSubpath(id, resolve) {
|
|
1305
283
|
const parts = id.split("/");
|
|
1306
284
|
if (parts[0][0] === "@") parts.shift();
|
|
1307
285
|
if (parts.length === 1 || parts.at(-1).includes(".")) return;
|
|
286
|
+
const resolved = await resolve();
|
|
287
|
+
if (!resolved?.packageJsonPath) return;
|
|
1308
288
|
let pkgJson;
|
|
1309
289
|
try {
|
|
1310
290
|
pkgJson = JSON.parse(await readFile(resolved.packageJsonPath, "utf8"));
|
|
@@ -1322,14 +302,10 @@ function getProductionDeps(pkg) {
|
|
|
1322
302
|
return /* @__PURE__ */ new Set([
|
|
1323
303
|
...Object.keys(pkg.dependencies || {}),
|
|
1324
304
|
...Object.keys(pkg.peerDependencies || {}),
|
|
305
|
+
...Object.keys(pkg.peerDependenciesMeta || {}),
|
|
1325
306
|
...Object.keys(pkg.optionalDependencies || {})
|
|
1326
307
|
]);
|
|
1327
308
|
}
|
|
1328
|
-
function formatBytes(bytes) {
|
|
1329
|
-
if (bytes === Infinity) return void 0;
|
|
1330
|
-
if (bytes > 1e6) return `${(bytes / 1e6).toFixed(2)} MB`;
|
|
1331
|
-
return `${(bytes / 1e3).toFixed(2)} kB`;
|
|
1332
|
-
}
|
|
1333
309
|
//#endregion
|
|
1334
310
|
//#region ../../node_modules/.pnpm/defu@6.1.7/node_modules/defu/dist/defu.mjs
|
|
1335
311
|
function isPlainObject(value) {
|
|
@@ -4416,12 +3392,8 @@ function createConfigCoreLoader(options) {
|
|
|
4416
3392
|
findConfigs
|
|
4417
3393
|
};
|
|
4418
3394
|
}
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
const __cjs_require$1 = createRequire(import.meta.url);
|
|
4422
|
-
const picomatch = __cjs_require$1("./npm_entry_picomatch.cjs");
|
|
4423
|
-
const satisfies$1 = __cjs_require$1("./npm_entry_semver_functions_satisfies.cjs");
|
|
4424
|
-
const debug$4$2 = createDebug("tsdown:clean");
|
|
3395
|
+
const picomatch = createRequire(import.meta.url)("./npm_entry_picomatch.cjs");
|
|
3396
|
+
const debug$3$2 = createDebug("tsdown:clean");
|
|
4425
3397
|
const RE_LAST_SLASH = /[/\\]$/;
|
|
4426
3398
|
async function cleanOutDir(configs) {
|
|
4427
3399
|
const removes = /* @__PURE__ */ new Set();
|
|
@@ -4444,10 +3416,10 @@ async function cleanOutDir(configs) {
|
|
|
4444
3416
|
if (!removes.size) return;
|
|
4445
3417
|
globalLogger.info(`Cleaning ${removes.size} files`);
|
|
4446
3418
|
await Promise.all([...removes].map(async (file) => {
|
|
4447
|
-
debug$
|
|
3419
|
+
debug$3$2("Removing", file);
|
|
4448
3420
|
await fsRemove(file);
|
|
4449
3421
|
}));
|
|
4450
|
-
debug$
|
|
3422
|
+
debug$3$2("Removed %d files", removes.size);
|
|
4451
3423
|
}
|
|
4452
3424
|
function resolveClean(clean, outDir, cwd) {
|
|
4453
3425
|
if (clean === true) clean = [slash(outDir)];
|
|
@@ -4458,7 +3430,7 @@ function resolveClean(clean, outDir, cwd) {
|
|
|
4458
3430
|
async function cleanChunks(outDir, chunks) {
|
|
4459
3431
|
await Promise.all(chunks.map(async (chunk) => {
|
|
4460
3432
|
const filePath = path.resolve(outDir, chunk.fileName);
|
|
4461
|
-
debug$
|
|
3433
|
+
debug$3$2("Removing chunk file", filePath);
|
|
4462
3434
|
await fsRemove(filePath);
|
|
4463
3435
|
}));
|
|
4464
3436
|
}
|
|
@@ -4533,95 +3505,9 @@ async function resolveArrayEntry(entries, cwd, root) {
|
|
|
4533
3505
|
}));
|
|
4534
3506
|
return [Object.assign({}, arrayEntryMap, ...resolvedObjectEntries), computedRoot];
|
|
4535
3507
|
}
|
|
4536
|
-
const debug$3$2 = createDebug("tsdown:exe");
|
|
4537
|
-
function validateSea({ dts, entry, logger, nameLabel }) {
|
|
4538
|
-
if (process$1.versions.bun || process$1.versions.deno) throw new Error("The `exe` option is not supported in Bun and Deno environments.");
|
|
4539
|
-
if (!satisfies$1(process$1.version, ">=25.7.0")) throw new Error(`Node.js version ${process$1.version} does not support \`exe\` option. Please upgrade to Node.js 25.7.0 or later.`);
|
|
4540
|
-
if (Object.keys(entry).length > 1) throw new Error(`The \`exe\` feature currently only supports single entry points. Found entries:\n${JSON.stringify(entry, void 0, 2)}`);
|
|
4541
|
-
if (dts) logger.warn(nameLabel, `Generating .d.ts files with \`exe\` option is not recommended since they won't be included in the executable. Consider separating your library and executable targets if you need type declarations.`);
|
|
4542
|
-
logger.info(nameLabel, "`exe` option is experimental and may change in future releases.");
|
|
4543
|
-
}
|
|
4544
|
-
async function buildExe(config, chunks) {
|
|
4545
|
-
if (!config.exe) return;
|
|
4546
|
-
const filteredChunks = chunks.filter((chunk) => !RE_DTS.test(chunk.fileName));
|
|
4547
|
-
if (filteredChunks.length > 1) throw new Error(`The 'exe' feature currently only supports single-chunk outputs. Found ${filteredChunks.length} chunks.\nChunks:\n${filteredChunks.map((c) => `- ${c.fileName}`).join("\n")}`);
|
|
4548
|
-
const chunk = filteredChunks[0];
|
|
4549
|
-
debug$3$2("Building executable with SEA for chunk:", chunk.fileName);
|
|
4550
|
-
const bundledFile = path.join(config.outDir, chunk.fileName);
|
|
4551
|
-
const { targets } = config.exe;
|
|
4552
|
-
if (targets?.length) {
|
|
4553
|
-
if (config.exe.seaConfig?.executable) config.logger.warn(config.nameLabel, "`seaConfig.executable` is ignored when `targets` is specified.");
|
|
4554
|
-
const { resolveNodeBinary, getTargetSuffix } = await import("./tsdown-exe.js");
|
|
4555
|
-
for (const target of targets) {
|
|
4556
|
-
const nodeBinaryPath = await resolveNodeBinary(target, config.logger);
|
|
4557
|
-
const suffix = getTargetSuffix(target);
|
|
4558
|
-
await buildSingleExe(config, bundledFile, resolveOutputFileName(config.exe, chunk, bundledFile, target, suffix), nodeBinaryPath, target);
|
|
4559
|
-
}
|
|
4560
|
-
} else await buildSingleExe(config, bundledFile, resolveOutputFileName(config.exe, chunk, bundledFile));
|
|
4561
|
-
}
|
|
4562
|
-
function resolveOutputFileName(exe, chunk, bundledFile, target, suffix) {
|
|
4563
|
-
let baseName;
|
|
4564
|
-
if (exe.fileName) baseName = typeof exe.fileName === "function" ? exe.fileName(chunk) : exe.fileName;
|
|
4565
|
-
else baseName = path.basename(bundledFile, path.extname(bundledFile));
|
|
4566
|
-
if (suffix) baseName += suffix;
|
|
4567
|
-
if (target?.platform ? target.platform === "win" : process$1.platform === "win32") baseName += ".exe";
|
|
4568
|
-
return baseName;
|
|
4569
|
-
}
|
|
4570
|
-
async function buildSingleExe(config, bundledFile, outputFile, executable, target) {
|
|
4571
|
-
const exe = config.exe;
|
|
4572
|
-
const exeOutDir = path.resolve(config.cwd, exe.outDir || "build");
|
|
4573
|
-
await mkdir(exeOutDir, { recursive: true });
|
|
4574
|
-
const outputPath = path.join(exeOutDir, outputFile);
|
|
4575
|
-
debug$3$2("Building SEA executable: %s -> %s", bundledFile, outputPath);
|
|
4576
|
-
const t = performance.now();
|
|
4577
|
-
const tempDir = await mkdtemp(path.join(tmpdir(), "tsdown-sea-"));
|
|
4578
|
-
try {
|
|
4579
|
-
const seaConfig = {
|
|
4580
|
-
disableExperimentalSEAWarning: true,
|
|
4581
|
-
...exe.seaConfig,
|
|
4582
|
-
main: bundledFile,
|
|
4583
|
-
output: outputPath,
|
|
4584
|
-
mainFormat: config.format === "es" ? "module" : "commonjs"
|
|
4585
|
-
};
|
|
4586
|
-
if (executable) seaConfig.executable = executable;
|
|
4587
|
-
const seaConfigPath = path.join(tempDir, "sea-config.json");
|
|
4588
|
-
await writeFile(seaConfigPath, JSON.stringify(seaConfig));
|
|
4589
|
-
debug$3$2("Wrote sea-config.json: %O -> %s", seaConfig, seaConfigPath);
|
|
4590
|
-
debug$3$2("Running: %s --build-sea %s", process$1.execPath, seaConfigPath);
|
|
4591
|
-
await R$2(process$1.execPath, ["--build-sea", seaConfigPath], {
|
|
4592
|
-
nodeOptions: { stdio: [
|
|
4593
|
-
"ignore",
|
|
4594
|
-
"ignore",
|
|
4595
|
-
"inherit"
|
|
4596
|
-
] },
|
|
4597
|
-
throwOnError: true
|
|
4598
|
-
});
|
|
4599
|
-
} finally {
|
|
4600
|
-
if (debug$3$2.enabled) debug$3$2("Preserving temp directory for debugging: %s", tempDir);
|
|
4601
|
-
else await fsRemove(tempDir);
|
|
4602
|
-
}
|
|
4603
|
-
if ((target?.platform || process$1.platform) === "darwin") try {
|
|
4604
|
-
await R$2("codesign", [
|
|
4605
|
-
"--sign",
|
|
4606
|
-
"-",
|
|
4607
|
-
outputPath
|
|
4608
|
-
], {
|
|
4609
|
-
nodeOptions: { stdio: "inherit" },
|
|
4610
|
-
throwOnError: true
|
|
4611
|
-
});
|
|
4612
|
-
} catch {
|
|
4613
|
-
config.logger.warn(config.nameLabel, `Failed to code-sign the executable. ${process$1.platform === "darwin" ? `You can sign it manually using:\n codesign --sign - "${outputPath}"` : `Automatic code signing is not supported on ${process$1.platform}.`}`);
|
|
4614
|
-
}
|
|
4615
|
-
const stat = await fsStat(outputPath);
|
|
4616
|
-
if (stat) {
|
|
4617
|
-
const sizeText = formatBytes(stat.size);
|
|
4618
|
-
config.logger.info(config.nameLabel, bold(path.relative(config.cwd, outputPath)), ` ${dim(sizeText)}`);
|
|
4619
|
-
}
|
|
4620
|
-
config.logger.success(config.nameLabel, `Built executable: ${red(path.relative(config.cwd, outputPath))}`, dim`(${Math.round(performance.now() - t)}ms)`);
|
|
4621
|
-
}
|
|
4622
3508
|
function writeJsonFile(filePath, content) {
|
|
4623
3509
|
let originalText;
|
|
4624
|
-
let originalJson
|
|
3510
|
+
let originalJson;
|
|
4625
3511
|
let originalIndent = 2;
|
|
4626
3512
|
let originalEOL = "\n";
|
|
4627
3513
|
let originalHasTrailingNewline = false;
|
|
@@ -4714,7 +3600,7 @@ async function generateExports(pkg, chunks, options, inlinedDeps) {
|
|
|
4714
3600
|
}
|
|
4715
3601
|
}
|
|
4716
3602
|
}
|
|
4717
|
-
const sortedExportsMap =
|
|
3603
|
+
const sortedExportsMap = [...exportsMap].toSorted(([a], [b]) => {
|
|
4718
3604
|
if (a === "index") return -1;
|
|
4719
3605
|
return a.localeCompare(b);
|
|
4720
3606
|
});
|
|
@@ -4913,10 +3799,9 @@ async function readPackageJson(dir) {
|
|
|
4913
3799
|
};
|
|
4914
3800
|
}
|
|
4915
3801
|
function getPackageType(pkg) {
|
|
4916
|
-
if (pkg?.type)
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
}
|
|
3802
|
+
if (!pkg?.type) return;
|
|
3803
|
+
if (!["module", "commonjs"].includes(pkg.type)) throw new Error(`Invalid package.json type: ${pkg.type}`);
|
|
3804
|
+
return pkg.type;
|
|
4920
3805
|
}
|
|
4921
3806
|
function normalizeFormat(format) {
|
|
4922
3807
|
switch (format) {
|
|
@@ -4964,9 +3849,9 @@ async function loadViteConfig(prefix, cwd, configLoader) {
|
|
|
4964
3849
|
const configPrefix = "tsdown.config";
|
|
4965
3850
|
async function loadConfigFile(inlineConfig, workspace, rootConfig) {
|
|
4966
3851
|
let cwd = inlineConfig.cwd || process$1.cwd();
|
|
4967
|
-
let overrideConfig = false;
|
|
4968
3852
|
let { config: filePath } = inlineConfig;
|
|
4969
3853
|
if (filePath === false) return { configs: [{}] };
|
|
3854
|
+
let overrideConfig = false;
|
|
4970
3855
|
if (typeof filePath === "string") {
|
|
4971
3856
|
const stats = await fsStat(filePath);
|
|
4972
3857
|
if (stats) {
|
|
@@ -5078,14 +3963,13 @@ async function unrunImport(id) {
|
|
|
5078
3963
|
return [module, new Set(dependencies)];
|
|
5079
3964
|
}
|
|
5080
3965
|
const debug$8 = createDebug("tsdown:config:options");
|
|
5081
|
-
const parseEnv = process$1.getBuiltinModule("node:util").parseEnv;
|
|
5082
3966
|
/**
|
|
5083
3967
|
* Resolve user config into resolved configs
|
|
5084
3968
|
*
|
|
5085
3969
|
* **Internal API, not for public use**
|
|
5086
3970
|
* @private
|
|
5087
3971
|
*/
|
|
5088
|
-
async function resolveUserConfig(userConfig, inlineConfig, configDeps) {
|
|
3972
|
+
async function resolveUserConfig(userConfig, inlineConfig, configDeps, runBuild = createConcurrencyExecutor()) {
|
|
5089
3973
|
{
|
|
5090
3974
|
const flat = await flattenPlugins(userConfig.plugins);
|
|
5091
3975
|
for (const plugin of flat) {
|
|
@@ -5155,7 +4039,6 @@ async function resolveUserConfig(userConfig, inlineConfig, configDeps) {
|
|
|
5155
4039
|
if (envPrefix.includes("")) logger.warn("`envPrefix` includes an empty string; filtering is disabled. All environment variables from the env file and process.env will be injected into the build. Ensure this is intended to avoid accidental leakage of sensitive information.");
|
|
5156
4040
|
const envFromProcess = filterEnv(process$1.env, envPrefix);
|
|
5157
4041
|
if (envFile) {
|
|
5158
|
-
if (!parseEnv) throw new Error(`Your runtime does not support 'util.parseEnv()'. Please upgrade to Node.js v20.12.0 or later.`);
|
|
5159
4042
|
const resolvedPath = path.resolve(cwd, envFile);
|
|
5160
4043
|
logger.info(nameLabel, `env file: ${color(resolvedPath)}`);
|
|
5161
4044
|
env = {
|
|
@@ -5228,6 +4111,7 @@ async function resolveUserConfig(userConfig, inlineConfig, configDeps) {
|
|
|
5228
4111
|
rawEntry,
|
|
5229
4112
|
report,
|
|
5230
4113
|
root: resolvedRoot,
|
|
4114
|
+
runBuild,
|
|
5231
4115
|
shims,
|
|
5232
4116
|
sourcemap,
|
|
5233
4117
|
target,
|
|
@@ -5248,7 +4132,8 @@ async function resolveUserConfig(userConfig, inlineConfig, configDeps) {
|
|
|
5248
4132
|
copy: once ? config.copy : void 0,
|
|
5249
4133
|
onSuccess: once ? config.onSuccess : void 0,
|
|
5250
4134
|
format: normalizeFormat(fmt),
|
|
5251
|
-
...overrides
|
|
4135
|
+
...overrides,
|
|
4136
|
+
runBuild
|
|
5252
4137
|
};
|
|
5253
4138
|
});
|
|
5254
4139
|
for (const resolved of resolvedConfigs) {
|
|
@@ -5263,7 +4148,11 @@ function filterEnv(envDict, envPrefixes) {
|
|
|
5263
4148
|
for (const [key, value] of Object.entries(envDict)) if (value != null && envPrefixes.some((prefix) => key.startsWith(prefix))) env[key] = value;
|
|
5264
4149
|
return env;
|
|
5265
4150
|
}
|
|
5266
|
-
const defu = createDefu((obj, key, value) => {
|
|
4151
|
+
const defu = createDefu((obj, key, value, namespace) => {
|
|
4152
|
+
if (key === "plugins" && (namespace === "" || namespace === "inputOptions" || namespace === "outputOptions")) {
|
|
4153
|
+
obj[key] = [].concat(obj[key], value);
|
|
4154
|
+
return true;
|
|
4155
|
+
}
|
|
5267
4156
|
if (Array.isArray(obj[key]) && Array.isArray(value)) {
|
|
5268
4157
|
obj[key] = value;
|
|
5269
4158
|
return true;
|
|
@@ -5273,9 +4162,9 @@ function mergeConfig(defaults, ...overrides) {
|
|
|
5273
4162
|
return defu(...overrides.toReversed(), defaults);
|
|
5274
4163
|
}
|
|
5275
4164
|
async function mergeUserOptions(defaults, user, args) {
|
|
5276
|
-
|
|
5277
|
-
if (
|
|
5278
|
-
return defu(
|
|
4165
|
+
if (!user) return defaults;
|
|
4166
|
+
if (typeof user === "function") return await user(defaults, ...args) ?? defaults;
|
|
4167
|
+
return defu(user, defaults);
|
|
5279
4168
|
}
|
|
5280
4169
|
function resolveFeatureOption(value, defaults) {
|
|
5281
4170
|
if (typeof value === "object" && value !== null) return resolveCIOption(value.enabled ?? true) ? value : false;
|
|
@@ -5294,7 +4183,7 @@ function filterConfig(filter, configCwd, name) {
|
|
|
5294
4183
|
return toArray(filter).some((value) => name && name === value || cwd === value);
|
|
5295
4184
|
}
|
|
5296
4185
|
//#endregion
|
|
5297
|
-
//#region ../../node_modules/.pnpm/tsdown@0.22.
|
|
4186
|
+
//#region ../../node_modules/.pnpm/tsdown@0.22.14_@arethetypeswrong+core@0.18.2_@tsdown+css@0.22.14_@tsdown+exe@0.22.14_@t_ce23af2d06b6e55ae551016827d08ee4/node_modules/tsdown/dist/watch-DOMHXvCH.mjs
|
|
5298
4187
|
async function copy(options) {
|
|
5299
4188
|
if (!options.copy) return;
|
|
5300
4189
|
const resolved = await resolveCopyEntries(options);
|
|
@@ -5674,16 +4563,13 @@ var Hookable = class {
|
|
|
5674
4563
|
}
|
|
5675
4564
|
};
|
|
5676
4565
|
//#endregion
|
|
5677
|
-
//#region ../../node_modules/.pnpm/tsdown@0.22.
|
|
5678
|
-
var
|
|
4566
|
+
//#region ../../node_modules/.pnpm/tsdown@0.22.14_@arethetypeswrong+core@0.18.2_@tsdown+css@0.22.14_@tsdown+exe@0.22.14_@t_ce23af2d06b6e55ae551016827d08ee4/node_modules/tsdown/dist/build-D_enfyvD.mjs
|
|
4567
|
+
var build_D_enfyvD_exports = /* @__PURE__ */ __exportAll$1({
|
|
5679
4568
|
n: () => buildWithConfigs,
|
|
5680
4569
|
r: () => build_exports,
|
|
5681
4570
|
t: () => build$1
|
|
5682
4571
|
});
|
|
5683
|
-
const
|
|
5684
|
-
const satisfies = __cjs_require("./npm_entry_semver_functions_satisfies.cjs");
|
|
5685
|
-
const coerce = __cjs_require("./npm_entry_semver_functions_coerce.cjs");
|
|
5686
|
-
const treeKill = __cjs_require("./npm_entry_tree-kill.cjs");
|
|
4572
|
+
const treeKill = createRequire(import.meta.url)("./npm_entry_tree-kill.cjs");
|
|
5687
4573
|
var __defProp = Object.defineProperty;
|
|
5688
4574
|
var __exportAll = (all, no_symbols) => {
|
|
5689
4575
|
let target = {};
|
|
@@ -5746,25 +4632,28 @@ async function resolveConfig(inlineConfig) {
|
|
|
5746
4632
|
if (inlineConfig.cwd) inlineConfig.cwd = path.resolve(inlineConfig.cwd);
|
|
5747
4633
|
const { configs: rootConfigs, deps: rootDeps } = await loadConfigFile(inlineConfig);
|
|
5748
4634
|
const globalDeps = new Set(rootDeps);
|
|
4635
|
+
const runBuild = createConcurrencyExecutor(inlineConfig.concurrency);
|
|
5749
4636
|
const configs = (await Promise.all(rootConfigs.map(async (rootConfig) => {
|
|
5750
4637
|
const { configs: workspaceConfigs, deps: workspaceDeps } = await resolveWorkspace(rootConfig, inlineConfig, rootDeps);
|
|
5751
4638
|
debug$4("workspace configs %O", workspaceConfigs);
|
|
5752
|
-
const configs = (await Promise.all(workspaceConfigs.filter((config) => !config.workspace || config.entry).map((config) => resolveUserConfig(config, inlineConfig, workspaceDeps)))).flat().filter((config) => !!config);
|
|
4639
|
+
const configs = (await Promise.all(workspaceConfigs.filter((config) => !config.workspace || config.entry).map((config) => resolveUserConfig(config, inlineConfig, workspaceDeps, runBuild)))).flat().filter((config) => !!config);
|
|
5753
4640
|
workspaceDeps.forEach((dep) => globalDeps.add(dep));
|
|
5754
4641
|
return configs;
|
|
5755
4642
|
}))).flat();
|
|
5756
4643
|
debug$4("resolved configs %O", configs);
|
|
5757
4644
|
if (configs.length === 0) throw new Error("No valid configuration found.");
|
|
4645
|
+
if (inlineConfig.concurrency != null && configs.some((config) => config.watch)) globalLogger.warn("`--concurrency` is not supported in watch mode and will be ignored.");
|
|
5758
4646
|
return {
|
|
5759
4647
|
configs,
|
|
5760
4648
|
deps: globalDeps
|
|
5761
4649
|
};
|
|
5762
4650
|
}
|
|
4651
|
+
const RANGE_REQUIRING_ESM = parseRange("^20.19.0 || >=22.12.0");
|
|
5763
4652
|
function warnLegacyCJS(config) {
|
|
5764
4653
|
if (config.exe || !config.target || !(config.checks?.legacyCjs ?? true) || !config.format.includes("cjs")) return;
|
|
5765
4654
|
if (config.target.some((t) => {
|
|
5766
4655
|
const version = coerce(t.split("node", 2)[1]);
|
|
5767
|
-
return version && satisfies(version,
|
|
4656
|
+
return version && satisfies(version, RANGE_REQUIRING_ESM);
|
|
5768
4657
|
})) config.logger.warnOnce("We recommend using the ESM format instead of CommonJS.\nThe ESM format is compatible with modern platforms and runtimes, and most new libraries are now distributed only in ESM format.\nLearn more at https://nodejs.org/en/learn/modules/publishing-a-package#how-did-we-get-here");
|
|
5769
4658
|
}
|
|
5770
4659
|
function CjsDtsReexportPlugin() {
|
|
@@ -5808,7 +4697,7 @@ function executeOnSuccess(config) {
|
|
|
5808
4697
|
if (!config.onSuccess) return;
|
|
5809
4698
|
const ab = new AbortController();
|
|
5810
4699
|
if (typeof config.onSuccess === "string") {
|
|
5811
|
-
const p = z
|
|
4700
|
+
const p = z(config.onSuccess, [], { nodeOptions: {
|
|
5812
4701
|
shell: true,
|
|
5813
4702
|
stdio: "inherit",
|
|
5814
4703
|
cwd: config.cwd
|
|
@@ -5938,7 +4827,7 @@ function initBundleByPkg(configs) {
|
|
|
5938
4827
|
const pkgJson = config.pkg?.packageJsonPath;
|
|
5939
4828
|
if (!pkgJson) continue;
|
|
5940
4829
|
if (!map[pkgJson]) {
|
|
5941
|
-
const { promise, resolve } =
|
|
4830
|
+
const { promise, resolve } = Promise.withResolvers();
|
|
5942
4831
|
map[pkgJson] = {
|
|
5943
4832
|
promise,
|
|
5944
4833
|
resolve,
|
|
@@ -5989,7 +4878,7 @@ async function bundleDone(bundleByPkg, bundle) {
|
|
|
5989
4878
|
async function packTarball(packageJsonPath) {
|
|
5990
4879
|
const pkgDir = path.dirname(packageJsonPath);
|
|
5991
4880
|
const destination = await mkdtemp(path.join(tmpdir(), "tsdown-pack-"));
|
|
5992
|
-
const { detect } = await import("./detect-
|
|
4881
|
+
const { detect } = await import("./detect-DGhJGEqb-Cz6qOZuP.js");
|
|
5993
4882
|
try {
|
|
5994
4883
|
const detected = await detect({ cwd: pkgDir });
|
|
5995
4884
|
debug$1("Detected package manager: %o", detected);
|
|
@@ -6022,7 +4911,7 @@ function mergeInlinedDeps(bundles) {
|
|
|
6022
4911
|
for (const v of versions) merged.get(pkgName).add(v);
|
|
6023
4912
|
}
|
|
6024
4913
|
if (!merged.size) return;
|
|
6025
|
-
const sorted = [...merged
|
|
4914
|
+
const sorted = [...merged].toSorted(([a], [b]) => a.localeCompare(b));
|
|
6026
4915
|
const result = {};
|
|
6027
4916
|
for (const [pkgName, versions] of sorted) result[pkgName] = versions.size === 1 ? [...versions][0] : [...versions].toSorted();
|
|
6028
4917
|
return result;
|
|
@@ -6060,7 +4949,10 @@ async function pack(dir, pm, destination, ignoreScripts) {
|
|
|
6060
4949
|
args.push("--ignore-scripts");
|
|
6061
4950
|
break;
|
|
6062
4951
|
}
|
|
6063
|
-
const output = await R
|
|
4952
|
+
const output = await R(command, args, {
|
|
4953
|
+
nodePath: false,
|
|
4954
|
+
nodeOptions: { cwd: dir }
|
|
4955
|
+
});
|
|
6064
4956
|
const tarballFile = await readdir(destination).then((files) => files.find((file) => file.endsWith(".tgz")));
|
|
6065
4957
|
if (!tarballFile) throw new Error(`Failed to find packed tarball file in ${destination}. Command output:\n${JSON.stringify(output, null, 2)}`);
|
|
6066
4958
|
return path.join(destination, tarballFile);
|
|
@@ -6129,9 +5021,9 @@ async function resolveInputOptions(config, format, configDeps, bundle, cjsDts, i
|
|
|
6129
5021
|
const isSuppressed = createSuppressWarnings(logger.options?.suppressWarnings);
|
|
6130
5022
|
const plugins = [];
|
|
6131
5023
|
if (nodeProtocol) plugins.push(NodeProtocolPlugin(nodeProtocol));
|
|
6132
|
-
if (config.pkg || config.deps.skipNodeModulesBundle) plugins.push(DepsPlugin(config, bundle));
|
|
5024
|
+
if (config.pkg || config.deps.skipNodeModulesBundle || config.deps.neverBundle === true || config.deps.dts.neverBundle === true) plugins.push(DepsPlugin(config, bundle));
|
|
6133
5025
|
if (dts) {
|
|
6134
|
-
const { dts: dtsPlugin } = await import("./dist-
|
|
5026
|
+
const { dts: dtsPlugin } = await import("./dist-CWolxbYK.js");
|
|
6135
5027
|
const { cjsReexport: _, ...dtsPluginOptions } = dts;
|
|
6136
5028
|
const options = {
|
|
6137
5029
|
tsconfig,
|
|
@@ -6187,17 +5079,19 @@ async function resolveInputOptions(config, format, configDeps, bundle, cjsDts, i
|
|
|
6187
5079
|
};
|
|
6188
5080
|
if (shims.plugin) plugins.push(shims.plugin);
|
|
6189
5081
|
}
|
|
6190
|
-
const
|
|
5082
|
+
const jsNeverBundle = deps.neverBundle === true ? void 0 : deps.neverBundle;
|
|
5083
|
+
const dtsNeverBundle = deps.dts.neverBundle === true ? void 0 : deps.dts.neverBundle;
|
|
5084
|
+
const dtsExternal = dtsNeverBundle ? functionifyExternal(dtsNeverBundle) : void 0;
|
|
6191
5085
|
let external;
|
|
6192
|
-
if (
|
|
6193
|
-
const jsExternal = functionifyExternal(
|
|
5086
|
+
if (jsNeverBundle && dtsExternal) {
|
|
5087
|
+
const jsExternal = functionifyExternal(jsNeverBundle);
|
|
6194
5088
|
external = (id, importer, ...args) => {
|
|
6195
5089
|
return ((importer ? RE_DTS.test(importer) : false) ? dtsExternal : jsExternal)(id, importer, ...args);
|
|
6196
5090
|
};
|
|
6197
5091
|
} else if (dtsExternal) external = (id, importer, ...args) => {
|
|
6198
5092
|
return (importer ? RE_DTS.test(importer) : false) ? dtsExternal(id, importer, ...args) : void 0;
|
|
6199
5093
|
};
|
|
6200
|
-
else external =
|
|
5094
|
+
else external = jsNeverBundle;
|
|
6201
5095
|
const logLevel = logger.options?.failOnWarn && loggerLevelIndex < 2 ? "warn" : logger.level === "error" ? "silent" : logger.level;
|
|
6202
5096
|
return await mergeUserOptions({
|
|
6203
5097
|
input: entry,
|
|
@@ -6429,7 +5323,7 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
|
|
|
6429
5323
|
watcher = watch(configs);
|
|
6430
5324
|
handleWatcher(watcher);
|
|
6431
5325
|
} else {
|
|
6432
|
-
const outputs = await build(configs);
|
|
5326
|
+
const outputs = await config.runBuild(() => build(configs));
|
|
6433
5327
|
for (const { output } of outputs) chunks.push(...addOutDirToChunks(output, outDir));
|
|
6434
5328
|
}
|
|
6435
5329
|
if (!watch$1) {
|
|
@@ -6513,4 +5407,4 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
|
|
|
6513
5407
|
}
|
|
6514
5408
|
}
|
|
6515
5409
|
//#endregion
|
|
6516
|
-
export {
|
|
5410
|
+
export { resolveUserConfig as a, mergeConfig as i, buildWithConfigs as n, build_D_enfyvD_exports as r, build$1 as t };
|