@voidzero-dev/vite-plus-core 0.2.9 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rolldown/cli.mjs +6 -6
- package/dist/rolldown/config.d.mts +1 -1
- package/dist/rolldown/config.mjs +2 -2
- package/dist/rolldown/experimental-index.d.mts +34 -5
- package/dist/rolldown/experimental-index.mjs +36 -9
- package/dist/rolldown/experimental-runtime-types.d.ts +2 -2
- package/dist/rolldown/experimental-runtime.d.ts +2 -2
- package/dist/rolldown/experimental-runtime.mjs +2 -2
- package/dist/rolldown/filter-index.d.mts +1 -1
- package/dist/rolldown/filter-index.mjs +1 -3
- package/dist/rolldown/index.d.mts +3 -3
- package/dist/rolldown/index.mjs +4 -4
- package/dist/rolldown/parallel-plugin-worker.mjs +2 -2
- package/dist/rolldown/parallel-plugin.d.mts +1 -1
- package/dist/rolldown/parse-ast-index.d.mts +1 -1
- package/dist/rolldown/parse-ast-index.mjs +1 -1
- package/dist/rolldown/plugins-index.d.mts +3 -3
- package/dist/rolldown/plugins-index.mjs +2 -2
- package/dist/rolldown/shared/{binding-CVtkJvyl.d.mts → binding-DZuNHVw4.d.mts} +88 -5
- package/dist/rolldown/shared/{binding-CKyeQZen.mjs → binding-DmImI4pj.mjs} +29 -27
- package/dist/rolldown/shared/{bindingify-input-options-44iPAymO.mjs → bindingify-input-options-BYClWKnj.mjs} +11 -9
- package/dist/rolldown/shared/{constructors-XaIbWpwJ.d.mts → constructors-BM20b11r.d.mts} +2 -2
- package/dist/rolldown/shared/{constructors-6Zc-JFd7.mjs → constructors-mRbcbLyX.mjs} +1 -1
- package/dist/rolldown/shared/{create-bundler-option-e1FU0w0P.mjs → create-bundler-option-CHTBktos.mjs} +49 -6
- package/dist/rolldown/shared/{define-config-DVsXPNaU.d.mts → define-config-DNX0WekP.d.mts} +46 -7
- package/dist/rolldown/shared/{error-BzLGqhSQ.mjs → error-BP8lJHle.mjs} +1 -1
- package/dist/rolldown/shared/{load-config-C6QXSnoS.mjs → load-config-Cx5fx_8Q.mjs} +1 -1
- package/dist/rolldown/shared/{normalize-string-or-regex-DYjJ67tj.mjs → normalize-string-or-regex-Dm69lpQ-.mjs} +1 -1
- package/dist/rolldown/shared/{parse-uDDyc1el.mjs → parse-8sr82jSR.mjs} +2 -2
- package/dist/rolldown/shared/{resolve-tsconfig-Bcd82vVT.mjs → resolve-tsconfig-BlNGaH3Y.mjs} +10 -6
- package/dist/rolldown/shared/{rolldown-CCbQNGZt.mjs → rolldown-CaX_Wmqc.mjs} +5 -4
- package/dist/rolldown/shared/{transform-WmU_cI8e.d.mts → transform-CVse9_mH.d.mts} +8 -4
- package/dist/rolldown/shared/{watch-vuOCmvFs.mjs → watch-YKfJgIxz.mjs} +4 -4
- package/dist/rolldown/utils-index.d.mts +3 -3
- package/dist/rolldown/utils-index.mjs +5 -5
- package/dist/tsdown/{build-D_enfyvD-Dg1eKRD4.js → build-JVmLFaZt-kqQJ2U7s.js} +1705 -239
- package/dist/tsdown/debug-CpC4hV25-tvH_Dsg5.js +247 -0
- package/dist/tsdown/{detect-DGhJGEqb-6CTf16BW.js → detect-Bg-d8iUV-KfbO7neP.js} +10 -12
- package/dist/tsdown/{dist-DyXLnzyh.js → dist-Cuw3Ngo4.js} +1226 -893
- package/dist/tsdown/index-types.d.ts +277 -355
- package/dist/tsdown/index.js +4 -4
- package/dist/tsdown/internal-D-JfB5uT.js +29 -0
- package/dist/tsdown/internal-lhH-5yya.js +62 -0
- package/dist/tsdown/{main-DiierkER.js → main-CyNcZUzu.js} +8 -214
- package/dist/tsdown/{resolver-cwLsPb2o-Dk4xdAGE.js → resolver-DE0_sy8o-ZQqHQjRu.js} +4 -4
- package/dist/tsdown/rolldown-runtime-B4iAMlE-.js +35 -0
- package/dist/tsdown/run.js +44 -8
- package/dist/tsdown/{src-drVPfX63.js → src-BWidcM5N.js} +5 -5
- package/dist/tsdown/{tsc-JnMl2z7d.js → tsc-ChjRhsoQ.js} +26 -20
- package/dist/tsdown/tsdown-css.js +17 -11
- package/dist/tsdown/tsdown-exe.js +16 -5
- package/dist/tsdown/version-CQ98ZBpL-Obdnv4J7.js +141 -0
- package/dist/vite/client/bundledDevClient.mjs +69 -19
- package/dist/vite/client/client.mjs +4 -4
- package/dist/vite/node/chunks/build.js +21 -21
- package/dist/vite/node/chunks/lib.js +2 -2
- package/dist/vite/node/chunks/node.js +159 -114
- package/dist/vite/node/chunks/postcss-import.js +13 -16
- package/dist/vite/node/index.d.ts +58 -55
- package/dist/vite/node/module-runner.d.ts +13 -13
- package/dist/vite/node/module-runner.js +3 -4
- package/package.json +30 -30
- package/dist/tsdown/debug-CKcBYQLP-C3NhYhrk.js +0 -157
- package/dist/tsdown/dist-CMKwGGNp.js +0 -1059
- package/dist/tsdown/internal-DKworeK4.js +0 -3
- package/dist/tsdown/target-Bab3CUeB-DQ0pKhCv.js +0 -582
|
@@ -1,29 +1,1139 @@
|
|
|
1
|
-
import {
|
|
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-
|
|
3
|
-
import {
|
|
4
|
-
import { n as
|
|
1
|
+
import { i as __toESM, n as __exportAll$1, t as __commonJSMin } from "./rolldown-runtime-B4iAMlE-.js";
|
|
2
|
+
import { _ as resolveRegex, a as createSuppressWarnings, b as toArray, c as globalLogger, d as debounce, f as importWithError, g as resolveComma, h as pkgExists, i as createLogger, l as prettyFormat, m as noop, n as version, o as generateColor, p as matchPattern, r as LogLevels, s as getNameLabel, u as createConcurrencyExecutor, v as slash, y as styleText$1 } from "./debug-CpC4hV25-tvH_Dsg5.js";
|
|
3
|
+
import { n as x, r as createDebug, t as exec } from "./main-CyNcZUzu.js";
|
|
4
|
+
import { i as RE_JS, n as RE_DTS, o as RE_NODE_MODULES$1, t as RE_CSS } from "./internal-D-JfB5uT.js";
|
|
5
|
+
import { a as GREATER_LESS_THAN, c as LOOSE_PLAIN, d as compareParsed, f as formatComparableVersion, g as tryParse, h as safeRegex, i as FULL_PLAIN, l as XRANGE_PLAIN, m as parse$2, n as normalize$2, o as LONE_CARET, p as isGreaterOrEqual, r as BUILD, s as LONE_TILDE, t as coerce, u as XRANGE_PLAIN_LOOSE } from "./version-CQ98ZBpL-Obdnv4J7.js";
|
|
5
6
|
import module$1, { builtinModules, createRequire, isBuiltin } from "node:module";
|
|
6
7
|
import process$1 from "node:process";
|
|
7
|
-
import readline from "node:readline";
|
|
8
8
|
import { formatWithOptions, inspect, isDeepStrictEqual, parseEnv, promisify } from "node:util";
|
|
9
|
+
import readline from "node:readline";
|
|
9
10
|
import path, { dirname, isAbsolute, join, parse, resolve } from "node:path";
|
|
10
|
-
import
|
|
11
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
12
|
+
import X, { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
11
13
|
import { VERSION, build, watch } from "@voidzero-dev/vite-plus-core/rolldown";
|
|
12
|
-
import { chmod, mkdtemp, readFile, readdir, writeFile } from "node:fs/promises";
|
|
14
|
+
import { access, chmod, cp, mkdir, mkdtemp, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
|
|
13
15
|
import { and, id, importerId, include } from "@voidzero-dev/vite-plus-core/rolldown/filter";
|
|
14
16
|
import * as nativeFs from "fs";
|
|
15
|
-
import { readdir as readdir$1, readdirSync, realpath, realpathSync, stat as stat$1, statSync as statSync$1 } from "fs";
|
|
16
|
-
import
|
|
17
|
+
import Ue, { readdir as readdir$1, readdirSync, realpath, realpathSync, stat as stat$1, statSync as statSync$1 } from "fs";
|
|
18
|
+
import Se from "os";
|
|
19
|
+
import Ie, { 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
20
|
import { Visitor, parse as parse$1 } from "@voidzero-dev/vite-plus-core/rolldown/utils";
|
|
18
21
|
import { tmpdir } from "node:os";
|
|
19
|
-
import { fileURLToPath } from "url";
|
|
22
|
+
import { fileURLToPath as fileURLToPath$1 } from "url";
|
|
20
23
|
import { createRequire as createRequire$1 } from "module";
|
|
21
|
-
import { fileURLToPath as fileURLToPath$1, pathToFileURL } from "node:url";
|
|
22
24
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
23
25
|
import { Buffer } from "node:buffer";
|
|
24
26
|
import { brotliCompress, gzip } from "node:zlib";
|
|
25
27
|
import { importGlobPlugin } from "@voidzero-dev/vite-plus-core/rolldown/experimental";
|
|
26
|
-
//#region ../../node_modules/.pnpm/tsdown@0.
|
|
28
|
+
//#region ../../node_modules/.pnpm/tsdown@0.23.0_@arethetypeswrong+core@0.18.2_@tsdown+css@0.23.0_@tsdown+exe@0.23.0_@type_b65333c86244131b40077d6429604210/node_modules/tsdown/dist/format-DLxyxnif.mjs
|
|
29
|
+
function fsExists(path) {
|
|
30
|
+
return access(path).then(() => true, () => false);
|
|
31
|
+
}
|
|
32
|
+
function fsStat(path) {
|
|
33
|
+
return stat(path).catch(() => null);
|
|
34
|
+
}
|
|
35
|
+
function fsRemove(path) {
|
|
36
|
+
return rm(path, {
|
|
37
|
+
force: true,
|
|
38
|
+
recursive: true
|
|
39
|
+
}).catch(() => {});
|
|
40
|
+
}
|
|
41
|
+
function fsCopy(from, to) {
|
|
42
|
+
return cp(from, to, {
|
|
43
|
+
recursive: true,
|
|
44
|
+
force: true
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function lowestCommonAncestor(...filepaths) {
|
|
48
|
+
if (filepaths.length === 0) return "";
|
|
49
|
+
if (filepaths.length === 1) return path.dirname(filepaths[0]);
|
|
50
|
+
filepaths = filepaths.map(path.normalize);
|
|
51
|
+
const [first, ...rest] = filepaths;
|
|
52
|
+
let ancestor = first.split(path.sep);
|
|
53
|
+
for (const filepath of rest) {
|
|
54
|
+
const directories = filepath.split(path.sep, ancestor.length);
|
|
55
|
+
let index = 0;
|
|
56
|
+
for (const directory of directories) if (directory === ancestor[index]) index += 1;
|
|
57
|
+
else {
|
|
58
|
+
ancestor = ancestor.slice(0, index);
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
ancestor = ancestor.slice(0, index);
|
|
62
|
+
}
|
|
63
|
+
return ancestor.length <= 1 && ancestor[0] === "" ? path.sep + ancestor[0] : ancestor.join(path.sep);
|
|
64
|
+
}
|
|
65
|
+
function stripExtname(filePath) {
|
|
66
|
+
const ext = path.extname(filePath);
|
|
67
|
+
if (!ext.length) return filePath;
|
|
68
|
+
return filePath.slice(0, -ext.length);
|
|
69
|
+
}
|
|
70
|
+
function formatBytes(bytes) {
|
|
71
|
+
if (bytes === Infinity) return void 0;
|
|
72
|
+
if (bytes > 1e6) return `${(bytes / 1e6).toFixed(2)} MB`;
|
|
73
|
+
return `${(bytes / 1e3).toFixed(2)} kB`;
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region ../../node_modules/.pnpm/resolve-pkg-maps@1.0.0/node_modules/resolve-pkg-maps/dist/index.mjs
|
|
77
|
+
const A = (r) => r !== null && typeof r == "object";
|
|
78
|
+
const a = (r, t) => Object.assign(/* @__PURE__ */ new Error(`[${r}]: ${t}`), { code: r });
|
|
79
|
+
const _$1 = "ERR_INVALID_PACKAGE_CONFIG";
|
|
80
|
+
const E$1 = "ERR_INVALID_PACKAGE_TARGET";
|
|
81
|
+
const I$1 = "ERR_PACKAGE_PATH_NOT_EXPORTED";
|
|
82
|
+
const R$1 = /^\d+$/;
|
|
83
|
+
const O = /^(\.{1,2}|node_modules)$/i;
|
|
84
|
+
const w = /\/|\\/;
|
|
85
|
+
var h = ((r) => (r.Export = "exports", r.Import = "imports", r))(h || {});
|
|
86
|
+
const f = (r, t, e, o, c) => {
|
|
87
|
+
if (t == null) return [];
|
|
88
|
+
if (typeof t == "string") {
|
|
89
|
+
const [n, ...i] = t.split(w);
|
|
90
|
+
if (n === ".." || i.some((l) => O.test(l))) throw a(E$1, `Invalid "${r}" target "${t}" defined in the package config`);
|
|
91
|
+
return [c ? t.replace(/\*/g, c) : t];
|
|
92
|
+
}
|
|
93
|
+
if (Array.isArray(t)) return t.flatMap((n) => f(r, n, e, o, c));
|
|
94
|
+
if (A(t)) {
|
|
95
|
+
for (const n of Object.keys(t)) {
|
|
96
|
+
if (R$1.test(n)) throw a(_$1, "Cannot contain numeric property keys");
|
|
97
|
+
if (n === "default" || o.includes(n)) return f(r, t[n], e, o, c);
|
|
98
|
+
}
|
|
99
|
+
return [];
|
|
100
|
+
}
|
|
101
|
+
throw a(E$1, `Invalid "${r}" target "${t}"`);
|
|
102
|
+
};
|
|
103
|
+
const s = "*";
|
|
104
|
+
const m = (r, t) => {
|
|
105
|
+
const e = r.indexOf(s), o = t.indexOf(s);
|
|
106
|
+
return e === o ? t.length > r.length : o > e;
|
|
107
|
+
};
|
|
108
|
+
function d(r, t) {
|
|
109
|
+
if (!t.includes(s) && r.hasOwnProperty(t)) return [t];
|
|
110
|
+
let e, o;
|
|
111
|
+
for (const c of Object.keys(r)) if (c.includes(s)) {
|
|
112
|
+
const [n, i, l] = c.split(s);
|
|
113
|
+
if (l === void 0 && t.startsWith(n) && t.endsWith(i)) {
|
|
114
|
+
const g = t.slice(n.length, -i.length || void 0);
|
|
115
|
+
g && (!e || m(e, c)) && (e = c, o = g);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return [e, o];
|
|
119
|
+
}
|
|
120
|
+
const p = (r) => Object.keys(r).reduce((t, e) => {
|
|
121
|
+
const o = e === "" || e[0] !== ".";
|
|
122
|
+
if (t === void 0 || t === o) return o;
|
|
123
|
+
throw a(_$1, "\"exports\" cannot contain some keys starting with \".\" and some not");
|
|
124
|
+
}, void 0);
|
|
125
|
+
const u = /^\w+:/;
|
|
126
|
+
const v = (r, t, e) => {
|
|
127
|
+
if (!r) throw new Error("\"exports\" is required");
|
|
128
|
+
t = t === "" ? "." : `./${t}`, (typeof r == "string" || Array.isArray(r) || A(r) && p(r)) && (r = { ".": r });
|
|
129
|
+
const [o, c] = d(r, t), n = f(h.Export, r[o], t, e, c);
|
|
130
|
+
if (n.length === 0) throw a(I$1, t === "." ? "No \"exports\" main defined" : `Package subpath '${t}' is not defined by "exports"`);
|
|
131
|
+
for (const i of n) if (!i.startsWith("./") && !u.test(i)) throw a(E$1, `Invalid "exports" target "${i}" defined in the package config`);
|
|
132
|
+
return n;
|
|
133
|
+
};
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region ../../node_modules/.pnpm/get-tsconfig@5.0.0-beta.6/node_modules/get-tsconfig/dist/index.mjs
|
|
136
|
+
var Le = Object.defineProperty;
|
|
137
|
+
var i = (e, n) => Le(e, "name", {
|
|
138
|
+
value: n,
|
|
139
|
+
configurable: !0
|
|
140
|
+
});
|
|
141
|
+
function E(e) {
|
|
142
|
+
return e.startsWith("\\\\?\\") ? e : e.replace(/\\/g, "/");
|
|
143
|
+
}
|
|
144
|
+
i(E, "slash");
|
|
145
|
+
const _e = i((e, n) => {
|
|
146
|
+
const s = `readFileSync:${n}`;
|
|
147
|
+
let t = e?.get(s);
|
|
148
|
+
return t === void 0 && (t = X.readFileSync(n, "utf8"), e?.set(s, t)), t;
|
|
149
|
+
}, "readFile");
|
|
150
|
+
const Ne = i((e, n) => {
|
|
151
|
+
const s = `realpathSync:${n}`;
|
|
152
|
+
let t = e?.get(s);
|
|
153
|
+
return t === void 0 && (t = X.realpathSync(n), e?.set(s, t)), t;
|
|
154
|
+
}, "realpath");
|
|
155
|
+
const $ = i((e, n) => {
|
|
156
|
+
const s = `tryStat:${n}`;
|
|
157
|
+
let t = e?.get(s);
|
|
158
|
+
if (t === void 0) {
|
|
159
|
+
try {
|
|
160
|
+
t = X.statSync(n);
|
|
161
|
+
} catch {
|
|
162
|
+
t = null;
|
|
163
|
+
}
|
|
164
|
+
e?.set(s, t);
|
|
165
|
+
}
|
|
166
|
+
return t ?? void 0;
|
|
167
|
+
}, "tryStat");
|
|
168
|
+
const R = i((e, n, s) => {
|
|
169
|
+
for (;;) {
|
|
170
|
+
const t = path.posix.join(e, n);
|
|
171
|
+
if ($(s, t)) return t;
|
|
172
|
+
const o = path.dirname(e);
|
|
173
|
+
if (o === e) return;
|
|
174
|
+
e = o;
|
|
175
|
+
}
|
|
176
|
+
}, "findUp");
|
|
177
|
+
function Re(e, n = !1) {
|
|
178
|
+
const s = e.length;
|
|
179
|
+
let t = 0, o = "", r = 0, c = 16, g = 0, m = 0, k = 0, v = 0, f = 0;
|
|
180
|
+
function O(l, T) {
|
|
181
|
+
let A = 0, b = 0;
|
|
182
|
+
for (; A < l;) {
|
|
183
|
+
let d = e.charCodeAt(t);
|
|
184
|
+
if (d >= 48 && d <= 57) b = b * 16 + d - 48;
|
|
185
|
+
else if (d >= 65 && d <= 70) b = b * 16 + d - 65 + 10;
|
|
186
|
+
else if (d >= 97 && d <= 102) b = b * 16 + d - 97 + 10;
|
|
187
|
+
else break;
|
|
188
|
+
t++, A++;
|
|
189
|
+
}
|
|
190
|
+
return A < l && (b = -1), b;
|
|
191
|
+
}
|
|
192
|
+
i(O, "scanHexDigits");
|
|
193
|
+
function j(l) {
|
|
194
|
+
t = l, o = "", r = 0, c = 16, f = 0;
|
|
195
|
+
}
|
|
196
|
+
i(j, "setPosition");
|
|
197
|
+
function y() {
|
|
198
|
+
let l = t;
|
|
199
|
+
if (e.charCodeAt(t) === 48) t++;
|
|
200
|
+
else for (t++; t < e.length && I(e.charCodeAt(t));) t++;
|
|
201
|
+
if (t < e.length && e.charCodeAt(t) === 46) if (t++, t < e.length && I(e.charCodeAt(t))) for (t++; t < e.length && I(e.charCodeAt(t));) t++;
|
|
202
|
+
else return f = 3, e.substring(l, t);
|
|
203
|
+
let T = t;
|
|
204
|
+
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 && I(e.charCodeAt(t))) {
|
|
205
|
+
for (t++; t < e.length && I(e.charCodeAt(t));) t++;
|
|
206
|
+
T = t;
|
|
207
|
+
} else f = 3;
|
|
208
|
+
return e.substring(l, T);
|
|
209
|
+
}
|
|
210
|
+
i(y, "scanNumber");
|
|
211
|
+
function x() {
|
|
212
|
+
let l = "", T = t;
|
|
213
|
+
for (;;) {
|
|
214
|
+
if (t >= s) {
|
|
215
|
+
l += e.substring(T, t), f = 2;
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
const A = e.charCodeAt(t);
|
|
219
|
+
if (A === 34) {
|
|
220
|
+
l += e.substring(T, t), t++;
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
if (A === 92) {
|
|
224
|
+
if (l += e.substring(T, t), t++, t >= s) {
|
|
225
|
+
f = 2;
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
switch (e.charCodeAt(t++)) {
|
|
229
|
+
case 34:
|
|
230
|
+
l += "\"";
|
|
231
|
+
break;
|
|
232
|
+
case 92:
|
|
233
|
+
l += "\\";
|
|
234
|
+
break;
|
|
235
|
+
case 47:
|
|
236
|
+
l += "/";
|
|
237
|
+
break;
|
|
238
|
+
case 98:
|
|
239
|
+
l += "\b";
|
|
240
|
+
break;
|
|
241
|
+
case 102:
|
|
242
|
+
l += "\f";
|
|
243
|
+
break;
|
|
244
|
+
case 110:
|
|
245
|
+
l += `
|
|
246
|
+
`;
|
|
247
|
+
break;
|
|
248
|
+
case 114:
|
|
249
|
+
l += "\r";
|
|
250
|
+
break;
|
|
251
|
+
case 116:
|
|
252
|
+
l += " ";
|
|
253
|
+
break;
|
|
254
|
+
case 117:
|
|
255
|
+
const d = O(4);
|
|
256
|
+
d >= 0 ? l += String.fromCharCode(d) : f = 4;
|
|
257
|
+
break;
|
|
258
|
+
default: f = 5;
|
|
259
|
+
}
|
|
260
|
+
T = t;
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
if (A >= 0 && A <= 31) if (P(A)) {
|
|
264
|
+
l += e.substring(T, t), f = 2;
|
|
265
|
+
break;
|
|
266
|
+
} else f = 6;
|
|
267
|
+
t++;
|
|
268
|
+
}
|
|
269
|
+
return l;
|
|
270
|
+
}
|
|
271
|
+
i(x, "scanString");
|
|
272
|
+
function p() {
|
|
273
|
+
if (o = "", f = 0, r = t, m = g, v = k, t >= s) return r = s, c = 17;
|
|
274
|
+
let l = e.charCodeAt(t);
|
|
275
|
+
if (Y(l)) {
|
|
276
|
+
do
|
|
277
|
+
t++, o += String.fromCharCode(l), l = e.charCodeAt(t);
|
|
278
|
+
while (Y(l));
|
|
279
|
+
return c = 15;
|
|
280
|
+
}
|
|
281
|
+
if (P(l)) return t++, o += String.fromCharCode(l), l === 13 && e.charCodeAt(t) === 10 && (t++, o += `
|
|
282
|
+
`), g++, k = t, c = 14;
|
|
283
|
+
switch (l) {
|
|
284
|
+
case 123: return t++, c = 1;
|
|
285
|
+
case 125: return t++, c = 2;
|
|
286
|
+
case 91: return t++, c = 3;
|
|
287
|
+
case 93: return t++, c = 4;
|
|
288
|
+
case 58: return t++, c = 6;
|
|
289
|
+
case 44: return t++, c = 5;
|
|
290
|
+
case 34: return t++, o = x(), c = 10;
|
|
291
|
+
case 47:
|
|
292
|
+
const T = t - 1;
|
|
293
|
+
if (e.charCodeAt(t + 1) === 47) {
|
|
294
|
+
for (t += 2; t < s && !P(e.charCodeAt(t));) t++;
|
|
295
|
+
return o = e.substring(T, t), c = 12;
|
|
296
|
+
}
|
|
297
|
+
if (e.charCodeAt(t + 1) === 42) {
|
|
298
|
+
t += 2;
|
|
299
|
+
const A = s - 1;
|
|
300
|
+
let b = !1;
|
|
301
|
+
for (; t < A;) {
|
|
302
|
+
const d = e.charCodeAt(t);
|
|
303
|
+
if (d === 42 && e.charCodeAt(t + 1) === 47) {
|
|
304
|
+
t += 2, b = !0;
|
|
305
|
+
break;
|
|
306
|
+
}
|
|
307
|
+
t++, P(d) && (d === 13 && e.charCodeAt(t) === 10 && t++, g++, k = t);
|
|
308
|
+
}
|
|
309
|
+
return b || (t++, f = 1), o = e.substring(T, t), c = 13;
|
|
310
|
+
}
|
|
311
|
+
return o += String.fromCharCode(l), t++, c = 16;
|
|
312
|
+
case 45: if (o += String.fromCharCode(l), t++, t === s || !I(e.charCodeAt(t))) return c = 16;
|
|
313
|
+
case 48:
|
|
314
|
+
case 49:
|
|
315
|
+
case 50:
|
|
316
|
+
case 51:
|
|
317
|
+
case 52:
|
|
318
|
+
case 53:
|
|
319
|
+
case 54:
|
|
320
|
+
case 55:
|
|
321
|
+
case 56:
|
|
322
|
+
case 57: return o += y(), c = 11;
|
|
323
|
+
default:
|
|
324
|
+
for (; t < s && u(l);) t++, l = e.charCodeAt(t);
|
|
325
|
+
if (r !== t) {
|
|
326
|
+
switch (o = e.substring(r, t), o) {
|
|
327
|
+
case "true": return c = 8;
|
|
328
|
+
case "false": return c = 9;
|
|
329
|
+
case "null": return c = 7;
|
|
330
|
+
}
|
|
331
|
+
return c = 16;
|
|
332
|
+
}
|
|
333
|
+
return o += String.fromCharCode(l), t++, c = 16;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
i(p, "scanNext");
|
|
337
|
+
function u(l) {
|
|
338
|
+
if (Y(l) || P(l)) return !1;
|
|
339
|
+
switch (l) {
|
|
340
|
+
case 125:
|
|
341
|
+
case 93:
|
|
342
|
+
case 123:
|
|
343
|
+
case 91:
|
|
344
|
+
case 34:
|
|
345
|
+
case 58:
|
|
346
|
+
case 44:
|
|
347
|
+
case 47: return !1;
|
|
348
|
+
}
|
|
349
|
+
return !0;
|
|
350
|
+
}
|
|
351
|
+
i(u, "isUnknownContentCharacter");
|
|
352
|
+
function w() {
|
|
353
|
+
let l;
|
|
354
|
+
do
|
|
355
|
+
l = p();
|
|
356
|
+
while (l >= 12 && l <= 15);
|
|
357
|
+
return l;
|
|
358
|
+
}
|
|
359
|
+
return i(w, "scanNextNonTrivia"), {
|
|
360
|
+
setPosition: j,
|
|
361
|
+
getPosition: i(() => t, "getPosition"),
|
|
362
|
+
scan: n ? w : p,
|
|
363
|
+
getToken: i(() => c, "getToken"),
|
|
364
|
+
getTokenValue: i(() => o, "getTokenValue"),
|
|
365
|
+
getTokenOffset: i(() => r, "getTokenOffset"),
|
|
366
|
+
getTokenLength: i(() => t - r, "getTokenLength"),
|
|
367
|
+
getTokenStartLine: i(() => m, "getTokenStartLine"),
|
|
368
|
+
getTokenStartCharacter: i(() => r - v, "getTokenStartCharacter"),
|
|
369
|
+
getTokenError: i(() => f, "getTokenError")
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
i(Re, "createScanner");
|
|
373
|
+
function Y(e) {
|
|
374
|
+
return e === 32 || e === 9;
|
|
375
|
+
}
|
|
376
|
+
i(Y, "isWhiteSpace");
|
|
377
|
+
function P(e) {
|
|
378
|
+
return e === 10 || e === 13;
|
|
379
|
+
}
|
|
380
|
+
i(P, "isLineBreak");
|
|
381
|
+
function I(e) {
|
|
382
|
+
return e >= 48 && e <= 57;
|
|
383
|
+
}
|
|
384
|
+
i(I, "isDigit");
|
|
385
|
+
var ce;
|
|
386
|
+
(function(e) {
|
|
387
|
+
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";
|
|
388
|
+
})(ce || (ce = {})), new Array(20).fill(0).map((e, n) => " ".repeat(n));
|
|
389
|
+
const _ = 200;
|
|
390
|
+
new Array(_).fill(0).map((e, n) => `
|
|
391
|
+
` + " ".repeat(n)), new Array(_).fill(0).map((e, n) => "\r" + " ".repeat(n)), new Array(_).fill(0).map((e, n) => `\r
|
|
392
|
+
` + " ".repeat(n)), new Array(_).fill(0).map((e, n) => `
|
|
393
|
+
` + " ".repeat(n)), new Array(_).fill(0).map((e, n) => "\r" + " ".repeat(n)), new Array(_).fill(0).map((e, n) => `\r
|
|
394
|
+
` + " ".repeat(n));
|
|
395
|
+
var W;
|
|
396
|
+
(function(e) {
|
|
397
|
+
e.DEFAULT = { allowTrailingComma: !1 };
|
|
398
|
+
})(W || (W = {}));
|
|
399
|
+
function Pe(e, n = [], s = W.DEFAULT) {
|
|
400
|
+
let t = null, o = [];
|
|
401
|
+
const r = [];
|
|
402
|
+
function c(m) {
|
|
403
|
+
Array.isArray(o) ? o.push(m) : t !== null && (o[t] = m);
|
|
404
|
+
}
|
|
405
|
+
return i(c, "onValue"), Ve(e, {
|
|
406
|
+
onObjectBegin: i(() => {
|
|
407
|
+
const m = {};
|
|
408
|
+
c(m), r.push(o), o = m, t = null;
|
|
409
|
+
}, "onObjectBegin"),
|
|
410
|
+
onObjectProperty: i((m) => {
|
|
411
|
+
t = m;
|
|
412
|
+
}, "onObjectProperty"),
|
|
413
|
+
onObjectEnd: i(() => {
|
|
414
|
+
o = r.pop();
|
|
415
|
+
}, "onObjectEnd"),
|
|
416
|
+
onArrayBegin: i(() => {
|
|
417
|
+
const m = [];
|
|
418
|
+
c(m), r.push(o), o = m, t = null;
|
|
419
|
+
}, "onArrayBegin"),
|
|
420
|
+
onArrayEnd: i(() => {
|
|
421
|
+
o = r.pop();
|
|
422
|
+
}, "onArrayEnd"),
|
|
423
|
+
onLiteralValue: c,
|
|
424
|
+
onError: i((m, k, v) => {
|
|
425
|
+
n.push({
|
|
426
|
+
error: m,
|
|
427
|
+
offset: k,
|
|
428
|
+
length: v
|
|
429
|
+
});
|
|
430
|
+
}, "onError")
|
|
431
|
+
}, s), o[0];
|
|
432
|
+
}
|
|
433
|
+
i(Pe, "parse$1");
|
|
434
|
+
function Ve(e, n, s = W.DEFAULT) {
|
|
435
|
+
const t = Re(e, !1), o = [];
|
|
436
|
+
let r = 0;
|
|
437
|
+
function c(h) {
|
|
438
|
+
return h ? () => r === 0 && h(t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter()) : () => !0;
|
|
439
|
+
}
|
|
440
|
+
i(c, "toNoArgVisit");
|
|
441
|
+
function g(h) {
|
|
442
|
+
return h ? (D) => r === 0 && h(D, t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter()) : () => !0;
|
|
443
|
+
}
|
|
444
|
+
i(g, "toOneArgVisit");
|
|
445
|
+
function m(h) {
|
|
446
|
+
return h ? (D) => r === 0 && h(D, t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter(), () => o.slice()) : () => !0;
|
|
447
|
+
}
|
|
448
|
+
i(m, "toOneArgVisitWithPath");
|
|
449
|
+
function k(h) {
|
|
450
|
+
return h ? () => {
|
|
451
|
+
r > 0 ? r++ : h(t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter(), () => o.slice()) === !1 && (r = 1);
|
|
452
|
+
} : () => !0;
|
|
453
|
+
}
|
|
454
|
+
i(k, "toBeginVisit");
|
|
455
|
+
function v(h) {
|
|
456
|
+
return h ? () => {
|
|
457
|
+
r > 0 && r--, r === 0 && h(t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter());
|
|
458
|
+
} : () => !0;
|
|
459
|
+
}
|
|
460
|
+
i(v, "toEndVisit");
|
|
461
|
+
const f = k(n.onObjectBegin), O = m(n.onObjectProperty), j = v(n.onObjectEnd), y = k(n.onArrayBegin), x = v(n.onArrayEnd), p = m(n.onLiteralValue), u = g(n.onSeparator), w = c(n.onComment), l = g(n.onError), T = s && s.disallowComments, A = s && s.allowTrailingComma;
|
|
462
|
+
function b() {
|
|
463
|
+
for (;;) {
|
|
464
|
+
const h = t.scan();
|
|
465
|
+
switch (t.getTokenError()) {
|
|
466
|
+
case 4:
|
|
467
|
+
d(14);
|
|
468
|
+
break;
|
|
469
|
+
case 5:
|
|
470
|
+
d(15);
|
|
471
|
+
break;
|
|
472
|
+
case 3:
|
|
473
|
+
d(13);
|
|
474
|
+
break;
|
|
475
|
+
case 1:
|
|
476
|
+
T || d(11);
|
|
477
|
+
break;
|
|
478
|
+
case 2:
|
|
479
|
+
d(12);
|
|
480
|
+
break;
|
|
481
|
+
case 6: d(16);
|
|
482
|
+
}
|
|
483
|
+
switch (h) {
|
|
484
|
+
case 12:
|
|
485
|
+
case 13:
|
|
486
|
+
T ? d(10) : w();
|
|
487
|
+
break;
|
|
488
|
+
case 16:
|
|
489
|
+
d(1);
|
|
490
|
+
break;
|
|
491
|
+
case 15:
|
|
492
|
+
case 14: break;
|
|
493
|
+
default: return h;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
i(b, "scanNext");
|
|
498
|
+
function d(h, D = [], re = []) {
|
|
499
|
+
if (l(h), D.length + re.length > 0) {
|
|
500
|
+
let V = t.getToken();
|
|
501
|
+
for (; V !== 17;) {
|
|
502
|
+
if (D.indexOf(V) !== -1) {
|
|
503
|
+
b();
|
|
504
|
+
break;
|
|
505
|
+
} else if (re.indexOf(V) !== -1) break;
|
|
506
|
+
V = b();
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
i(d, "handleError");
|
|
511
|
+
function L(h) {
|
|
512
|
+
const D = t.getTokenValue();
|
|
513
|
+
return h ? p(D) : (O(D), o.push(D)), b(), !0;
|
|
514
|
+
}
|
|
515
|
+
i(L, "parseString");
|
|
516
|
+
function B() {
|
|
517
|
+
switch (t.getToken()) {
|
|
518
|
+
case 11:
|
|
519
|
+
const h = t.getTokenValue();
|
|
520
|
+
let D = Number(h);
|
|
521
|
+
isNaN(D) && (d(2), D = 0), p(D);
|
|
522
|
+
break;
|
|
523
|
+
case 7:
|
|
524
|
+
p(null);
|
|
525
|
+
break;
|
|
526
|
+
case 8:
|
|
527
|
+
p(!0);
|
|
528
|
+
break;
|
|
529
|
+
case 9:
|
|
530
|
+
p(!1);
|
|
531
|
+
break;
|
|
532
|
+
default: return !1;
|
|
533
|
+
}
|
|
534
|
+
return b(), !0;
|
|
535
|
+
}
|
|
536
|
+
i(B, "parseLiteral");
|
|
537
|
+
function F() {
|
|
538
|
+
return t.getToken() !== 10 ? (d(3, [], [2, 5]), !1) : (L(!1), t.getToken() === 6 ? (u(":"), b(), H() || d(4, [], [2, 5])) : d(5, [], [2, 5]), o.pop(), !0);
|
|
539
|
+
}
|
|
540
|
+
i(F, "parseProperty");
|
|
541
|
+
function N() {
|
|
542
|
+
f(), b();
|
|
543
|
+
let h = !1;
|
|
544
|
+
for (; t.getToken() !== 2 && t.getToken() !== 17;) {
|
|
545
|
+
if (t.getToken() === 5) {
|
|
546
|
+
if (h || d(4, [], []), u(","), b(), t.getToken() === 2 && A) break;
|
|
547
|
+
} else h && d(6, [], []);
|
|
548
|
+
F() || d(4, [], [2, 5]), h = !0;
|
|
549
|
+
}
|
|
550
|
+
return j(), t.getToken() !== 2 ? d(7, [2], []) : b(), !0;
|
|
551
|
+
}
|
|
552
|
+
i(N, "parseObject");
|
|
553
|
+
function Fe() {
|
|
554
|
+
y(), b();
|
|
555
|
+
let h = !0, D = !1;
|
|
556
|
+
for (; t.getToken() !== 4 && t.getToken() !== 17;) {
|
|
557
|
+
if (t.getToken() === 5) {
|
|
558
|
+
if (D || d(4, [], []), u(","), b(), t.getToken() === 4 && A) break;
|
|
559
|
+
} else D && d(6, [], []);
|
|
560
|
+
h ? (o.push(0), h = !1) : o[o.length - 1]++, H() || d(4, [], [4, 5]), D = !0;
|
|
561
|
+
}
|
|
562
|
+
return x(), h || o.pop(), t.getToken() !== 4 ? d(8, [4], []) : b(), !0;
|
|
563
|
+
}
|
|
564
|
+
i(Fe, "parseArray");
|
|
565
|
+
function H() {
|
|
566
|
+
switch (t.getToken()) {
|
|
567
|
+
case 3: return Fe();
|
|
568
|
+
case 1: return N();
|
|
569
|
+
case 10: return L(!0);
|
|
570
|
+
default: return B();
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
return i(H, "parseValue"), b(), t.getToken() === 17 ? s.allowEmptyContent ? !0 : (d(4, [], []), !1) : H() ? (t.getToken() !== 17 && d(9, [], []), !0) : (d(4, [], []), !1);
|
|
574
|
+
}
|
|
575
|
+
i(Ve, "visit");
|
|
576
|
+
var fe;
|
|
577
|
+
(function(e) {
|
|
578
|
+
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";
|
|
579
|
+
})(fe || (fe = {}));
|
|
580
|
+
var ue;
|
|
581
|
+
(function(e) {
|
|
582
|
+
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";
|
|
583
|
+
})(ue || (ue = {}));
|
|
584
|
+
const We = Pe;
|
|
585
|
+
var ae;
|
|
586
|
+
(function(e) {
|
|
587
|
+
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";
|
|
588
|
+
})(ae || (ae = {}));
|
|
589
|
+
const Z = i((e, n) => We(_e(n, e)), "readJsonc");
|
|
590
|
+
const pe = i(() => {
|
|
591
|
+
const { findPnpApi: e } = module$1;
|
|
592
|
+
return e && e(process.cwd());
|
|
593
|
+
}, "getPnpApi");
|
|
594
|
+
const Me = "detectTypeScriptVersion:";
|
|
595
|
+
const Je = i((e, n) => {
|
|
596
|
+
const s = `${Me}${e}`, t = n?.get(s);
|
|
597
|
+
if (t !== void 0) return t ?? void 0;
|
|
598
|
+
let o;
|
|
599
|
+
const r = pe();
|
|
600
|
+
if (r) try {
|
|
601
|
+
o = r.resolveRequest("typescript/package.json", e) ?? void 0;
|
|
602
|
+
} catch {}
|
|
603
|
+
o ??= R(path.resolve(e), path.join("node_modules", "typescript", "package.json"), n);
|
|
604
|
+
let c;
|
|
605
|
+
if (o) try {
|
|
606
|
+
const g = Z(o, n);
|
|
607
|
+
typeof g?.version == "string" && (c = g.version);
|
|
608
|
+
} catch {}
|
|
609
|
+
return n?.set(s, c ?? null), c;
|
|
610
|
+
}, "detectTypeScriptVersion");
|
|
611
|
+
const S = "package.json";
|
|
612
|
+
const M = "tsconfig.json";
|
|
613
|
+
const ze = i((e, n, s) => {
|
|
614
|
+
const t = module$1.createRequire(path.join(s, "tsconfig.json"));
|
|
615
|
+
if (e !== n) try {
|
|
616
|
+
return t.resolve(e);
|
|
617
|
+
} catch {}
|
|
618
|
+
try {
|
|
619
|
+
return t.resolve(n);
|
|
620
|
+
} catch {}
|
|
621
|
+
try {
|
|
622
|
+
return t.resolve(`${n}/${S}`);
|
|
623
|
+
} catch {}
|
|
624
|
+
}, "resolvePackageEntryWithNode");
|
|
625
|
+
const q = i((e, n, s, t) => {
|
|
626
|
+
const o = `resolveFromPackageJsonPath:${e}:${n}:${s}`;
|
|
627
|
+
if (t?.has(o)) return t.get(o) || !1;
|
|
628
|
+
const r = Z(e, t);
|
|
629
|
+
if (!r) return;
|
|
630
|
+
let c = n || M;
|
|
631
|
+
if (!s && r.exports) try {
|
|
632
|
+
const [g] = v(r.exports, n, ["require", "types"]);
|
|
633
|
+
c = g;
|
|
634
|
+
} catch {
|
|
635
|
+
return t?.set(o, ""), !1;
|
|
636
|
+
}
|
|
637
|
+
else !n && r.tsconfig && (c = r.tsconfig);
|
|
638
|
+
return c = path.join(e, "..", c), t?.set(o, c), c;
|
|
639
|
+
}, "resolveFromPackageJsonPath");
|
|
640
|
+
const Ge = i((e, n, s) => {
|
|
641
|
+
const t = `resolveExtendsPath:${e}:${n}`;
|
|
642
|
+
if (s?.has(t)) return s.get(t) || void 0;
|
|
643
|
+
const o = Qe(e, n, s);
|
|
644
|
+
return s?.set(t, o || ""), o;
|
|
645
|
+
}, "resolveExtendsPath");
|
|
646
|
+
const Qe = i((e, n, s) => {
|
|
647
|
+
let t = e;
|
|
648
|
+
if (e === ".." && (t = path.join(t, M)), e[0] === "." && (t = path.resolve(n, t)), path.isAbsolute(t)) {
|
|
649
|
+
const u = $(s, t);
|
|
650
|
+
if (u) {
|
|
651
|
+
if (u.isFile()) return t;
|
|
652
|
+
} else if (!t.endsWith(".json")) {
|
|
653
|
+
const w = `${t}.json`;
|
|
654
|
+
if ($(s, w)) return w;
|
|
655
|
+
}
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
const [o, ...r] = e.split("/"), c = o[0] === "@" ? `${o}/${r.shift()}` : o, g = r.join("/"), m = pe();
|
|
659
|
+
if (m) {
|
|
660
|
+
const { resolveRequest: u } = m;
|
|
661
|
+
try {
|
|
662
|
+
if (c === e) {
|
|
663
|
+
const w = u(path.join(c, S), n);
|
|
664
|
+
if (w) {
|
|
665
|
+
const l = q(w, g, !1, s);
|
|
666
|
+
if (l && $(s, l)) return l;
|
|
667
|
+
}
|
|
668
|
+
} else {
|
|
669
|
+
let w;
|
|
670
|
+
try {
|
|
671
|
+
w = u(e, n, { extensions: [".json"] });
|
|
672
|
+
} catch {
|
|
673
|
+
w = u(path.join(e, M), n);
|
|
674
|
+
}
|
|
675
|
+
if (w) return w;
|
|
676
|
+
}
|
|
677
|
+
} catch {}
|
|
678
|
+
}
|
|
679
|
+
const k = ze(e, c, n);
|
|
680
|
+
let v;
|
|
681
|
+
if (k) {
|
|
682
|
+
if (path.basename(k) !== S && k.endsWith(".json")) return k;
|
|
683
|
+
v = path.basename(k) === S ? k : R(path.dirname(k), S, s);
|
|
684
|
+
}
|
|
685
|
+
const f = v && path.dirname(v) || R(path.resolve(n), path.join("node_modules", c), s);
|
|
686
|
+
if (!f || !$(s, f)?.isDirectory()) return;
|
|
687
|
+
const O = Ne(s, f), j = path.join(O, S);
|
|
688
|
+
if ($(s, j)) {
|
|
689
|
+
const u = q(j, g, !1, s);
|
|
690
|
+
if (u === !1) return;
|
|
691
|
+
if (u && $(s, u)?.isFile()) return u;
|
|
692
|
+
}
|
|
693
|
+
const y = path.join(O, g), x = y.endsWith(".json");
|
|
694
|
+
if (!x) {
|
|
695
|
+
const u = `${y}.json`;
|
|
696
|
+
if ($(s, u)) return u;
|
|
697
|
+
}
|
|
698
|
+
const p = $(s, y);
|
|
699
|
+
if (p) {
|
|
700
|
+
if (p.isDirectory()) {
|
|
701
|
+
const u = path.join(y, S);
|
|
702
|
+
if ($(s, u)) {
|
|
703
|
+
const l = q(u, "", !0, s);
|
|
704
|
+
if (l && $(s, l)) return l;
|
|
705
|
+
}
|
|
706
|
+
const w = path.join(y, M);
|
|
707
|
+
if ($(s, w)) return w;
|
|
708
|
+
} else if (x) return y;
|
|
709
|
+
}
|
|
710
|
+
}, "resolveExtendsPathUncached");
|
|
711
|
+
const K = Symbol("implicitBaseUrl");
|
|
712
|
+
const U = "${configDir}";
|
|
713
|
+
const C = /^\.{1,2}(\/.*)?$/;
|
|
714
|
+
const J = i((e) => {
|
|
715
|
+
const n = E(e);
|
|
716
|
+
return C.test(n) ? n : `./${n}`;
|
|
717
|
+
}, "normalizeRelativePath");
|
|
718
|
+
const He = i((e) => {
|
|
719
|
+
const n = { ...e };
|
|
720
|
+
if (n.strict) for (const t of [
|
|
721
|
+
"noImplicitAny",
|
|
722
|
+
"noImplicitThis",
|
|
723
|
+
"strictNullChecks",
|
|
724
|
+
"strictFunctionTypes",
|
|
725
|
+
"strictBindCallApply",
|
|
726
|
+
"strictPropertyInitialization",
|
|
727
|
+
"strictBuiltinIteratorReturn",
|
|
728
|
+
"alwaysStrict",
|
|
729
|
+
"useUnknownInCatchVariables"
|
|
730
|
+
]) n[t] === void 0 && (n[t] = !0);
|
|
731
|
+
if (n.composite && (n.declaration ??= !0, n.incremental ??= !0), n.target) {
|
|
732
|
+
let s = n.target.toLowerCase();
|
|
733
|
+
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);
|
|
734
|
+
}
|
|
735
|
+
if (n.module) {
|
|
736
|
+
let s = n.module.toLowerCase();
|
|
737
|
+
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") {
|
|
738
|
+
const t = n.target;
|
|
739
|
+
(t === "es3" || t === "es2022" || t === "es2023" || t === "es2024" || t === "esnext") && (n.useDefineForClassFields ??= !0);
|
|
740
|
+
}
|
|
741
|
+
s === "preserve" && (n.moduleResolution ??= "bundler");
|
|
742
|
+
}
|
|
743
|
+
if (n.moduleResolution) {
|
|
744
|
+
let s = n.moduleResolution.toLowerCase();
|
|
745
|
+
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);
|
|
746
|
+
}
|
|
747
|
+
for (const s of [
|
|
748
|
+
"jsx",
|
|
749
|
+
"moduleDetection",
|
|
750
|
+
"importsNotUsedAsValues",
|
|
751
|
+
"newLine"
|
|
752
|
+
]) n[s] && (n[s] = n[s].toLowerCase());
|
|
753
|
+
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;
|
|
754
|
+
}, "normalizeCompilerOptions");
|
|
755
|
+
const Xe = i((e, n) => {
|
|
756
|
+
!n.has("target") && !Ye(e.module) && (e.target = "es3");
|
|
757
|
+
}, "applyV4Defaults");
|
|
758
|
+
const Ye = i((e) => e === "node16" || e === "node18" || e === "node20" || e === "nodenext", "moduleDictatesTarget$1");
|
|
759
|
+
const Ze = i((e, n) => {
|
|
760
|
+
!n.has("target") && !qe(e.module) && (e.target = "es5");
|
|
761
|
+
}, "applyV5Defaults");
|
|
762
|
+
const qe = i((e) => e === "node16" || e === "node18" || e === "node20" || e === "nodenext", "moduleDictatesTarget");
|
|
763
|
+
const Ke = i((e, n) => {
|
|
764
|
+
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);
|
|
765
|
+
}, "applyV6Defaults");
|
|
766
|
+
const Ce = [
|
|
767
|
+
[4, Xe],
|
|
768
|
+
[5, Ze],
|
|
769
|
+
[6, Ke]
|
|
770
|
+
];
|
|
771
|
+
const et = i((e) => {
|
|
772
|
+
const n = /^v?(\d+)/.exec(e);
|
|
773
|
+
return n ? Number(n[1]) : void 0;
|
|
774
|
+
}, "parseMajor");
|
|
775
|
+
const tt = i((e, n) => {
|
|
776
|
+
const s = et(n);
|
|
777
|
+
if (s === void 0) return;
|
|
778
|
+
const t = new Set(Object.keys(e));
|
|
779
|
+
for (const [o, r] of Ce) o <= s && r(e, t);
|
|
780
|
+
}, "applyVersionDefaults");
|
|
781
|
+
const ee = i((e, n) => J(path.relative(e, n)), "pathRelative");
|
|
782
|
+
const me = [
|
|
783
|
+
"files",
|
|
784
|
+
"include",
|
|
785
|
+
"exclude"
|
|
786
|
+
];
|
|
787
|
+
const ge = i((e, n, s) => {
|
|
788
|
+
const t = path.join(n, s);
|
|
789
|
+
return E(path.relative(e, t)) || "./";
|
|
790
|
+
}, "resolveAndRelativize");
|
|
791
|
+
const nt = i((e, n, s) => {
|
|
792
|
+
const t = path.relative(e, n);
|
|
793
|
+
if (!t) return s;
|
|
794
|
+
return E(`${t}/${s.startsWith("./") ? s.slice(2) : s}`);
|
|
795
|
+
}, "prefixPattern");
|
|
796
|
+
const de = ["outDir", "declarationDir"];
|
|
797
|
+
const z = i((e, n) => {
|
|
798
|
+
if (e.startsWith(U)) return E(path.join(n, e.slice(12)));
|
|
799
|
+
}, "interpolateConfigDir");
|
|
800
|
+
const st = [
|
|
801
|
+
"outDir",
|
|
802
|
+
"declarationDir",
|
|
803
|
+
"outFile",
|
|
804
|
+
"rootDir",
|
|
805
|
+
"baseUrl",
|
|
806
|
+
"tsBuildInfoFile"
|
|
807
|
+
];
|
|
808
|
+
const ke = i((e, n = {}) => {
|
|
809
|
+
if (e.length === 0) throw new Error("Chain must not be empty");
|
|
810
|
+
const { typescriptVersion: s } = n, t = new Map(e.map((f) => [f.path, f])), o = /* @__PURE__ */ new Map(), r = i((f) => {
|
|
811
|
+
const O = o.get(f);
|
|
812
|
+
if (O) return O;
|
|
813
|
+
const j = t.get(f);
|
|
814
|
+
if (!j) throw new Error(`Config not found in chain: ${f}`);
|
|
815
|
+
const y = j.config, x = path.dirname(f);
|
|
816
|
+
let p = {
|
|
817
|
+
...y,
|
|
818
|
+
...y.compilerOptions && { compilerOptions: { ...y.compilerOptions } },
|
|
819
|
+
...y.watchOptions && { watchOptions: { ...y.watchOptions } }
|
|
820
|
+
};
|
|
821
|
+
if (delete p.extends, p.compilerOptions?.paths && !p.compilerOptions.baseUrl && (p.compilerOptions[K] = x), y.extends) {
|
|
822
|
+
const u = Array.isArray(y.extends) ? y.extends : [y.extends];
|
|
823
|
+
for (const w of u.toReversed()) {
|
|
824
|
+
const l = r(w), T = path.dirname(w), { references: A, ...b } = l;
|
|
825
|
+
if (b.compilerOptions) {
|
|
826
|
+
const L = { ...b.compilerOptions };
|
|
827
|
+
for (const B of [
|
|
828
|
+
"baseUrl",
|
|
829
|
+
"outDir",
|
|
830
|
+
"declarationDir",
|
|
831
|
+
"rootDir"
|
|
832
|
+
]) {
|
|
833
|
+
const F = L[B];
|
|
834
|
+
F && !F.startsWith(U) && (L[B] = ge(x, T, F));
|
|
835
|
+
}
|
|
836
|
+
for (const B of ["rootDirs", "typeRoots"]) {
|
|
837
|
+
const F = L[B];
|
|
838
|
+
F && (L[B] = F.map((N) => N.startsWith(U) ? N : ge(x, T, N)));
|
|
839
|
+
}
|
|
840
|
+
b.compilerOptions = L;
|
|
841
|
+
}
|
|
842
|
+
for (const L of me) {
|
|
843
|
+
const B = b[L];
|
|
844
|
+
B && (b[L] = B.map((F) => F.startsWith(U) ? F : nt(x, T, F)));
|
|
845
|
+
}
|
|
846
|
+
const d = {
|
|
847
|
+
...b,
|
|
848
|
+
...p,
|
|
849
|
+
compilerOptions: {
|
|
850
|
+
...b.compilerOptions,
|
|
851
|
+
...p.compilerOptions
|
|
852
|
+
}
|
|
853
|
+
};
|
|
854
|
+
b.watchOptions && (d.watchOptions = {
|
|
855
|
+
...b.watchOptions,
|
|
856
|
+
...p.watchOptions
|
|
857
|
+
}), p = d;
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
if (p.compilerOptions) {
|
|
861
|
+
const { compilerOptions: u } = p;
|
|
862
|
+
for (const l of ["baseUrl", "rootDir"]) {
|
|
863
|
+
const T = u[l];
|
|
864
|
+
if (T && !T.startsWith(U)) {
|
|
865
|
+
const A = path.resolve(x, T);
|
|
866
|
+
u[l] = ee(x, A);
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
for (const l of de) {
|
|
870
|
+
let T = u[l];
|
|
871
|
+
T && (Array.isArray(p.exclude) || (p.exclude = de.map((A) => u[A]).filter(Boolean)), T.startsWith(U) || (T = J(T)), u[l] = T);
|
|
872
|
+
}
|
|
873
|
+
} else p.compilerOptions = {};
|
|
874
|
+
if (p.include && (p.include = p.include.map(E)), p.files && (p.files = p.files.map((u) => u.startsWith(U) ? u : J(u))), p.watchOptions) {
|
|
875
|
+
const { watchOptions: u } = p;
|
|
876
|
+
for (const w of ["excludeDirectories", "excludeFiles"]) u[w] && (u[w] = u[w].map((l) => E(path.resolve(x, l))));
|
|
877
|
+
for (const w of [
|
|
878
|
+
"watchFile",
|
|
879
|
+
"watchDirectory",
|
|
880
|
+
"fallbackPolling"
|
|
881
|
+
]) if (u[w]) {
|
|
882
|
+
const l = u;
|
|
883
|
+
l[w] = u[w].toLowerCase();
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
return o.set(f, p), p;
|
|
887
|
+
}, "resolveEntry"), c = e[0], g = r(c.path), m = path.dirname(c.path), k = {
|
|
888
|
+
...g,
|
|
889
|
+
compilerOptions: g.compilerOptions ? { ...g.compilerOptions } : {}
|
|
890
|
+
}, { compilerOptions: v } = k;
|
|
891
|
+
if (v) {
|
|
892
|
+
for (const f of st) {
|
|
893
|
+
const O = v[f];
|
|
894
|
+
if (O) {
|
|
895
|
+
const j = z(O, m);
|
|
896
|
+
v[f] = j ? ee(m, j) : O;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
for (const f of ["rootDirs", "typeRoots"]) {
|
|
900
|
+
const O = v[f];
|
|
901
|
+
O && (v[f] = O.map((j) => {
|
|
902
|
+
const y = z(j, m);
|
|
903
|
+
return y ? ee(m, y) : J(j);
|
|
904
|
+
}));
|
|
905
|
+
}
|
|
906
|
+
if (v.paths) {
|
|
907
|
+
const f = {};
|
|
908
|
+
for (const [O, j] of Object.entries(v.paths)) f[O] = j.map((y) => z(y, m) ?? y);
|
|
909
|
+
v.paths = f;
|
|
910
|
+
}
|
|
911
|
+
s && tt(v, s), k.compilerOptions = He(v);
|
|
912
|
+
}
|
|
913
|
+
for (const f of me) {
|
|
914
|
+
const O = k[f];
|
|
915
|
+
O && (k[f] = O.map((j) => z(j, m) ?? j));
|
|
916
|
+
}
|
|
917
|
+
return {
|
|
918
|
+
path: c.path,
|
|
919
|
+
config: k,
|
|
920
|
+
sources: e.map((f) => f.path)
|
|
921
|
+
};
|
|
922
|
+
}, "resolveExtendsChain");
|
|
923
|
+
const ve = i((e, n = {}) => {
|
|
924
|
+
const { cache: s = /* @__PURE__ */ new Map() } = n, t = path.resolve(e), o = [], r = /* @__PURE__ */ new Set(), c = i((g, m) => {
|
|
925
|
+
const k = E(g);
|
|
926
|
+
if (r.has(k)) return;
|
|
927
|
+
r.add(k);
|
|
928
|
+
let v;
|
|
929
|
+
try {
|
|
930
|
+
v = Z(g, s) || {};
|
|
931
|
+
} catch {
|
|
932
|
+
throw new Error(`Cannot resolve tsconfig at path: ${g}`);
|
|
933
|
+
}
|
|
934
|
+
if (typeof v != "object") throw new SyntaxError(`Failed to parse tsconfig at: ${g}`);
|
|
935
|
+
const f = path.dirname(g);
|
|
936
|
+
if (v.extends) {
|
|
937
|
+
const O = Array.isArray(v.extends), y = (O ? v.extends : [v.extends]).map((p) => {
|
|
938
|
+
const u = Ge(p, f, s);
|
|
939
|
+
if (!u) throw new Error(`File '${p}' not found.`);
|
|
940
|
+
const w = E(u);
|
|
941
|
+
if (m.has(w) || w === k) throw new Error(`Circularity detected while resolving configuration: ${w}`);
|
|
942
|
+
return w;
|
|
943
|
+
});
|
|
944
|
+
v.extends = O ? y : y[0], o.push({
|
|
945
|
+
path: k,
|
|
946
|
+
config: v
|
|
947
|
+
});
|
|
948
|
+
const x = new Set(m);
|
|
949
|
+
x.add(k);
|
|
950
|
+
for (const p of [...y].reverse()) c(p, x);
|
|
951
|
+
} else o.push({
|
|
952
|
+
path: k,
|
|
953
|
+
config: v
|
|
954
|
+
});
|
|
955
|
+
}, "collect");
|
|
956
|
+
return c(t, /* @__PURE__ */ new Set()), o;
|
|
957
|
+
}, "getExtendsChain");
|
|
958
|
+
const te = i((e, n = {}) => {
|
|
959
|
+
const { cache: s = /* @__PURE__ */ new Map(), typescriptVersion: t = "auto" } = n, o = ve(e, { cache: s });
|
|
960
|
+
let r;
|
|
961
|
+
return t === "auto" ? r = Je(path.dirname(o[0].path), s) : t !== !1 && (r = t), ke(o, { typescriptVersion: r });
|
|
962
|
+
}, "readTsconfig");
|
|
963
|
+
var ot = Object.defineProperty;
|
|
964
|
+
var G = i((e, n) => ot(e, "name", {
|
|
965
|
+
value: n,
|
|
966
|
+
configurable: !0
|
|
967
|
+
}), "s");
|
|
968
|
+
const we = G((e) => {
|
|
969
|
+
let n = "";
|
|
970
|
+
for (let s = 0; s < e.length; s += 1) {
|
|
971
|
+
const t = e[s], o = t.toUpperCase();
|
|
972
|
+
n += t === o ? t.toLowerCase() : o;
|
|
973
|
+
}
|
|
974
|
+
return n;
|
|
975
|
+
}, "invertCase"), ne = /* @__PURE__ */ new Map(), be = G((e, n) => {
|
|
976
|
+
const s = Ie.join(e, `.is-fs-case-sensitive-test-${process.pid}`);
|
|
977
|
+
try {
|
|
978
|
+
return n.writeFileSync(s, ""), !n.existsSync(we(s));
|
|
979
|
+
} finally {
|
|
980
|
+
try {
|
|
981
|
+
n.unlinkSync(s);
|
|
982
|
+
} catch {}
|
|
983
|
+
}
|
|
984
|
+
}, "checkDirectoryCaseWithWrite"), it = G((e, n, s) => {
|
|
985
|
+
try {
|
|
986
|
+
return be(e, s);
|
|
987
|
+
} catch (t) {
|
|
988
|
+
if (n === void 0) return be(Se.tmpdir(), s);
|
|
989
|
+
throw t;
|
|
990
|
+
}
|
|
991
|
+
}, "checkDirectoryCaseWithFallback"), rt = G((e, n = Ue, s = !0) => {
|
|
992
|
+
const t = e ?? process.cwd();
|
|
993
|
+
if (s && ne.has(t)) return ne.get(t);
|
|
994
|
+
let o;
|
|
995
|
+
const r = we(t);
|
|
996
|
+
return r !== t && n.existsSync(t) ? o = !n.existsSync(r) : o = it(t, e, n), s && ne.set(t, o), o;
|
|
997
|
+
}, "isFsCaseSensitive"), { join: lt } = path.posix, ye = i((e, n) => {
|
|
998
|
+
const s = lt(e, n);
|
|
999
|
+
return e.startsWith("//") && !s.startsWith("//") ? `/${s}` : s;
|
|
1000
|
+
}, "pathJoin"), se = {
|
|
1001
|
+
ts: [
|
|
1002
|
+
".ts",
|
|
1003
|
+
".tsx",
|
|
1004
|
+
".d.ts"
|
|
1005
|
+
],
|
|
1006
|
+
cts: [".cts", ".d.cts"],
|
|
1007
|
+
mts: [".mts", ".d.mts"]
|
|
1008
|
+
}, ct = i((e) => {
|
|
1009
|
+
const n = [...se.ts], s = [...se.cts], t = [...se.mts];
|
|
1010
|
+
return e?.allowJs && (n.push(".js", ".jsx"), s.push(".cjs"), t.push(".mjs")), [
|
|
1011
|
+
...n,
|
|
1012
|
+
...s,
|
|
1013
|
+
...t
|
|
1014
|
+
];
|
|
1015
|
+
}, "getSupportedExtensions"), ft = i((e) => {
|
|
1016
|
+
const n = [];
|
|
1017
|
+
if (!e) return n;
|
|
1018
|
+
const { outDir: s, declarationDir: t } = e;
|
|
1019
|
+
return s && n.push(s), t && n.push(t), n;
|
|
1020
|
+
}, "getDefaultExcludeSpec"), Te = i((e) => e.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`), "escapeForRegexp"), oe = `(?!(${[
|
|
1021
|
+
"node_modules",
|
|
1022
|
+
"bower_components",
|
|
1023
|
+
"jspm_packages"
|
|
1024
|
+
].join("|")})(/|$))`, at = /(?:^|\/)[^.*?]+$/, he = "**/*", Q = "[^/]", ie = "[^./]", Oe = process.platform === "win32", pt = i(({ config: e, path: n }, s) => {
|
|
1025
|
+
if ("extends" in e) throw new Error("tsconfig#extends must be resolved. Use getTsconfig or readTsconfig to resolve it.");
|
|
1026
|
+
if (!path.isAbsolute(n)) throw new Error("The tsconfig path must be absolute");
|
|
1027
|
+
Oe && (n = E(n));
|
|
1028
|
+
const t = path.dirname(n), { files: o, include: r, exclude: c, compilerOptions: g } = e, m = i((p) => path.isAbsolute(p) ? p : ye(t, p), "resolvePattern"), k = o ? new Set(o.map(m)) : void 0, v = ct(g), f = s ? "" : "i", j = (c || ft(g)).map((p) => {
|
|
1029
|
+
const u = m(p), w = Te(u).replaceAll(String.raw`\*\*/`, "(.+/)?").replaceAll(String.raw`\*`, `${Q}*`).replaceAll(String.raw`\?`, Q);
|
|
1030
|
+
return new RegExp(`^${w}($|/)`, f);
|
|
1031
|
+
}), y = o || r ? r : [he];
|
|
1032
|
+
return {
|
|
1033
|
+
filesSet: k,
|
|
1034
|
+
extensions: v,
|
|
1035
|
+
excludePatterns: j,
|
|
1036
|
+
includePatterns: y ? y.map((p) => {
|
|
1037
|
+
let u = m(p);
|
|
1038
|
+
at.test(u) && (u = ye(u, he));
|
|
1039
|
+
const w = Te(u).replaceAll(String.raw`/\*\*`, `(/${oe}${ie}${Q}*)*?`).replaceAll(/(\/)?\\\*/g, (l, T) => {
|
|
1040
|
+
const A = String.raw`(${ie}|(\.(?!min\.js$))?)*`;
|
|
1041
|
+
return T ? `/${oe}${ie}${A}` : A;
|
|
1042
|
+
}).replaceAll(/(\/)?\\\?/g, (l, T) => {
|
|
1043
|
+
const A = Q;
|
|
1044
|
+
return T ? `/${oe}${A}` : A;
|
|
1045
|
+
});
|
|
1046
|
+
return new RegExp(`^${w}$`, f);
|
|
1047
|
+
}) : void 0
|
|
1048
|
+
};
|
|
1049
|
+
}, "compilePatterns"), Ae = /* @__PURE__ */ new WeakMap(), je = i((e, n) => {
|
|
1050
|
+
if (!path.isAbsolute(n)) return !1;
|
|
1051
|
+
Oe && (n = E(n));
|
|
1052
|
+
let s = Ae.get(e);
|
|
1053
|
+
s || (s = pt(e, rt()), Ae.set(e, s));
|
|
1054
|
+
const { filesSet: t, extensions: o, excludePatterns: r, includePatterns: c } = s;
|
|
1055
|
+
return t?.has(n) ? !0 : !o.some((g) => n.endsWith(g)) || r.some((g) => g.test(n)) ? !1 : !!(c && c.some((g) => g.test(n)));
|
|
1056
|
+
}, "isFileIncluded"), xe = i((e, n, s, t) => {
|
|
1057
|
+
const o = path.resolve(e);
|
|
1058
|
+
let r = E(e);
|
|
1059
|
+
for (;;) {
|
|
1060
|
+
const c = R(r, n, s);
|
|
1061
|
+
if (!c) return;
|
|
1062
|
+
const g = path.resolve(c), m = te(g, {
|
|
1063
|
+
cache: s,
|
|
1064
|
+
typescriptVersion: t
|
|
1065
|
+
});
|
|
1066
|
+
if (je(m, o)) return m;
|
|
1067
|
+
const k = path.dirname(c), v = path.dirname(k);
|
|
1068
|
+
if (v === k) return;
|
|
1069
|
+
r = v;
|
|
1070
|
+
}
|
|
1071
|
+
}, "findConfigApplicable"), De = i((e = process.cwd(), n = {}) => {
|
|
1072
|
+
const { configName: s = "tsconfig.json", cache: t = /* @__PURE__ */ new Map(), includes: o = !1 } = n;
|
|
1073
|
+
if (!o) {
|
|
1074
|
+
const r = path.resolve(e);
|
|
1075
|
+
return path.basename(r) === s && $(t, r)?.isFile() ? E(r) : R(E(e), s, t);
|
|
1076
|
+
}
|
|
1077
|
+
return xe(e, s, t, !1)?.path;
|
|
1078
|
+
}, "findTsconfig"), mt = i((e = process.cwd(), n = {}) => {
|
|
1079
|
+
const { configName: s = "tsconfig.json", cache: t = /* @__PURE__ */ new Map(), includes: o = !1, typescriptVersion: r = "auto" } = n;
|
|
1080
|
+
if (!o) {
|
|
1081
|
+
const c = De(e, {
|
|
1082
|
+
configName: s,
|
|
1083
|
+
cache: t
|
|
1084
|
+
});
|
|
1085
|
+
return c ? te(c, {
|
|
1086
|
+
cache: t,
|
|
1087
|
+
typescriptVersion: r
|
|
1088
|
+
}) : void 0;
|
|
1089
|
+
}
|
|
1090
|
+
return xe(e, s, t, r);
|
|
1091
|
+
}, "getTsconfig"), gt = /\*/g, Ee = i((e, n) => {
|
|
1092
|
+
const s = e.match(gt);
|
|
1093
|
+
if (s && s.length > 1) throw new Error(n);
|
|
1094
|
+
}, "assertStarCount"), dt = i((e) => {
|
|
1095
|
+
if (e.includes("*")) {
|
|
1096
|
+
const [n, s] = e.split("*");
|
|
1097
|
+
return {
|
|
1098
|
+
prefix: n,
|
|
1099
|
+
suffix: s
|
|
1100
|
+
};
|
|
1101
|
+
}
|
|
1102
|
+
return e;
|
|
1103
|
+
}, "parsePattern"), kt = i(({ prefix: e, suffix: n }, s) => s.startsWith(e) && s.endsWith(n), "isPatternMatch"), vt = i((e, n, s) => Object.entries(e).map(([t, o]) => (Ee(t, `Pattern '${t}' can have at most one '*' character.`), {
|
|
1104
|
+
pattern: dt(t),
|
|
1105
|
+
substitutions: o.map((r) => {
|
|
1106
|
+
if (Ee(r, `Substitution '${r}' in pattern '${t}' can have at most one '*' character.`), !n && !C.test(r) && !path.isAbsolute(r)) throw new Error("Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?");
|
|
1107
|
+
return path.resolve(s, r);
|
|
1108
|
+
})
|
|
1109
|
+
})), "parsePaths"), wt = i((e) => {
|
|
1110
|
+
const { compilerOptions: n } = e.config;
|
|
1111
|
+
if (!n) return null;
|
|
1112
|
+
const { baseUrl: s, paths: t } = n;
|
|
1113
|
+
if (!s && !t) return null;
|
|
1114
|
+
const o = K in n && n[K], r = path.resolve(path.dirname(e.path), s || o || "."), c = t ? vt(t, s, r) : [], g = /* @__PURE__ */ new Map(), m = [];
|
|
1115
|
+
for (const k of c) typeof k.pattern == "string" ? g.set(k.pattern, k.substitutions) : m.push(k);
|
|
1116
|
+
return {
|
|
1117
|
+
exactEntries: g,
|
|
1118
|
+
patternEntries: m,
|
|
1119
|
+
resolvedBaseUrl: r,
|
|
1120
|
+
baseUrl: s
|
|
1121
|
+
};
|
|
1122
|
+
}, "compilePaths"), $e = /* @__PURE__ */ new WeakMap();
|
|
1123
|
+
i((e, n) => {
|
|
1124
|
+
let s = $e.get(e);
|
|
1125
|
+
if (s === void 0 && (s = wt(e), $e.set(e, s)), !s) return [];
|
|
1126
|
+
if (C.test(n)) return [];
|
|
1127
|
+
const { exactEntries: t, patternEntries: o, resolvedBaseUrl: r, baseUrl: c } = s, g = t.get(n);
|
|
1128
|
+
if (g) return g.map(E);
|
|
1129
|
+
let m, k = -1;
|
|
1130
|
+
for (const f of o) kt(f.pattern, n) && f.pattern.prefix.length > k && (k = f.pattern.prefix.length, m = f);
|
|
1131
|
+
if (!m) return c ? [E(path.join(r, n))] : [];
|
|
1132
|
+
const v = n.slice(m.pattern.prefix.length, n.length - m.pattern.suffix.length);
|
|
1133
|
+
return m.substitutions.map((f) => E(f.replace("*", v)));
|
|
1134
|
+
}, "resolvePathAlias");
|
|
1135
|
+
//#endregion
|
|
1136
|
+
//#region ../../node_modules/.pnpm/tsdown@0.23.0_@arethetypeswrong+core@0.18.2_@tsdown+css@0.23.0_@tsdown+exe@0.23.0_@type_b65333c86244131b40077d6429604210/node_modules/tsdown/dist/deps-DCK8g4G9.mjs
|
|
27
1137
|
const shimFile = path.resolve(import.meta.dirname, "..", "esm-shims.js");
|
|
28
1138
|
const shimsInject = {
|
|
29
1139
|
__dirname: [shimFile, "__dirname"],
|
|
@@ -51,14 +1161,14 @@ function getShims(config) {
|
|
|
51
1161
|
};
|
|
52
1162
|
return { inject: shimsInject };
|
|
53
1163
|
}
|
|
54
|
-
const debug$
|
|
1164
|
+
const debug$9 = createDebug("tsdown:deps");
|
|
55
1165
|
/**
|
|
56
1166
|
* Matches specifiers that follow npm package naming conventions,
|
|
57
1167
|
* e.g. `pkg`, `pkg/subpath`, `@scope/pkg/subpath`.
|
|
58
1168
|
*/
|
|
59
1169
|
const RE_PACKAGE_SPECIFIER = /^(?:@[a-z0-9-][a-z0-9-._]*\/)?[a-z0-9-][a-z0-9-._]*(?:\/|$)/;
|
|
60
1170
|
function resolveDepsConfig(config, logger) {
|
|
61
|
-
let { neverBundle, alwaysBundle, onlyBundle, onlyImport,
|
|
1171
|
+
let { neverBundle, alwaysBundle, onlyBundle, onlyImport, resolveDepSubpath } = config.deps || {};
|
|
62
1172
|
if (config.external != null) {
|
|
63
1173
|
if (neverBundle != null) throw new TypeError("`external` is deprecated. Cannot be used with `deps.neverBundle`.");
|
|
64
1174
|
logger?.warn("`external` is deprecated. Use `deps.neverBundle` instead.");
|
|
@@ -69,32 +1179,12 @@ function resolveDepsConfig(config, logger) {
|
|
|
69
1179
|
logger?.warn("`noExternal` is deprecated. Use `deps.alwaysBundle` instead.");
|
|
70
1180
|
alwaysBundle = config.noExternal;
|
|
71
1181
|
}
|
|
72
|
-
if (config.inlineOnly != null) {
|
|
73
|
-
if (onlyBundle != null) throw new TypeError("`inlineOnly` is deprecated. Cannot be used with `deps.onlyBundle`.");
|
|
74
|
-
logger?.warn("`inlineOnly` is deprecated. Use `deps.onlyBundle` instead.");
|
|
75
|
-
onlyBundle = config.inlineOnly;
|
|
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
|
-
}
|
|
82
|
-
if (config.skipNodeModulesBundle != null) {
|
|
83
|
-
if (config.deps?.skipNodeModulesBundle != null) throw new TypeError("`skipNodeModulesBundle` is deprecated. Cannot be used with `deps.skipNodeModulesBundle`.");
|
|
84
|
-
logger?.warn("`skipNodeModulesBundle` is deprecated. Use `deps.neverBundle: true` instead.");
|
|
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.");
|
|
90
|
-
}
|
|
91
1182
|
if (onlyBundle != null && onlyBundle !== false) onlyBundle = toArray(onlyBundle);
|
|
92
1183
|
if (onlyImport != null) onlyImport = toArray(onlyImport);
|
|
93
1184
|
return {
|
|
94
1185
|
...normalizeDepsOptions(alwaysBundle, neverBundle),
|
|
95
1186
|
onlyBundle,
|
|
96
1187
|
onlyImport,
|
|
97
|
-
skipNodeModulesBundle,
|
|
98
1188
|
resolveDepSubpath,
|
|
99
1189
|
dts: normalizeDepsOptions(config.deps?.dts?.alwaysBundle, config.deps?.dts?.neverBundle)
|
|
100
1190
|
};
|
|
@@ -109,7 +1199,7 @@ function normalizeDepsOptions(alwaysBundle, neverBundle) {
|
|
|
109
1199
|
neverBundle: resolveRegex(neverBundle)
|
|
110
1200
|
};
|
|
111
1201
|
}
|
|
112
|
-
function DepsPlugin({ pkg, deps: { neverBundle, alwaysBundle: jsAlwaysBundle, onlyBundle, onlyImport,
|
|
1202
|
+
function DepsPlugin({ pkg, deps: { neverBundle, alwaysBundle: jsAlwaysBundle, onlyBundle, onlyImport, resolveDepSubpath: shouldResolveDepSubpath, dts }, logger, nameLabel, platform }, tsdownBundle) {
|
|
113
1203
|
const deps = pkg && Array.from(getProductionDeps(pkg));
|
|
114
1204
|
return {
|
|
115
1205
|
name: "tsdown:deps",
|
|
@@ -124,12 +1214,12 @@ function DepsPlugin({ pkg, deps: { neverBundle, alwaysBundle: jsAlwaysBundle, on
|
|
|
124
1214
|
});
|
|
125
1215
|
let shouldExternal = await externalStrategy(id, importer, resolve);
|
|
126
1216
|
if (Array.isArray(shouldExternal)) {
|
|
127
|
-
debug$
|
|
1217
|
+
debug$9("custom resolved id for %o -> %o", id, shouldExternal[1]);
|
|
128
1218
|
id = shouldExternal[1];
|
|
129
1219
|
shouldExternal = shouldExternal[0];
|
|
130
1220
|
}
|
|
131
1221
|
const moduleSideEffects = isBuiltin(id) ? false : void 0;
|
|
132
|
-
debug$
|
|
1222
|
+
debug$9("shouldExternal: %o = %o", id, shouldExternal);
|
|
133
1223
|
if (shouldExternal === true || shouldExternal === "absolute") return {
|
|
134
1224
|
id,
|
|
135
1225
|
external: shouldExternal,
|
|
@@ -157,7 +1247,7 @@ function DepsPlugin({ pkg, deps: { neverBundle, alwaysBundle: jsAlwaysBundle, on
|
|
|
157
1247
|
if (source[0] === ".") continue;
|
|
158
1248
|
if (platform === "node" && isBuiltin(source)) continue;
|
|
159
1249
|
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.`);
|
|
1250
|
+
errors.push(`${styleText$1.yellow(source)} is imported in ${styleText$1.blue(chunk.fileName)} but is not included in ${styleText$1.blue(`deps.onlyImport`)} option.\nTo fix this, either add it to ${styleText$1.blue(`deps.onlyImport`)} or bundle it manually by adding it to ${styleText$1.blue(`deps.alwaysBundle`)} option.`);
|
|
161
1251
|
}
|
|
162
1252
|
}
|
|
163
1253
|
for (const id of chunk.moduleIds) {
|
|
@@ -171,13 +1261,13 @@ function DepsPlugin({ pkg, deps: { neverBundle, alwaysBundle: jsAlwaysBundle, on
|
|
|
171
1261
|
if (module) importers.set(parsed.name, /* @__PURE__ */ new Set([...module.importers, ...importers.get(parsed.name) || []]));
|
|
172
1262
|
}
|
|
173
1263
|
}
|
|
174
|
-
debug$
|
|
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")}`));
|
|
1264
|
+
debug$9("found deps in bundle: %o", deps);
|
|
1265
|
+
if (onlyBundle) errors.push(...Array.from(deps).filter((dep) => !matchPattern(dep, onlyBundle)).map((dep) => `${styleText$1.yellow(dep)} is located in ${styleText$1.blue(`node_modules`)} but is not included in ${styleText$1.blue(`deps.onlyBundle`)} option.\nTo fix this, either add it to ${styleText$1.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) => `- ${styleText$1.underline(s)}`).join("\n")}`));
|
|
176
1266
|
if (errors.length) this.error(errors.join("\n\n"));
|
|
177
1267
|
if (onlyBundle) {
|
|
178
1268
|
const unusedPatterns = onlyBundle.filter((pattern) => Array.from(deps).every((dep) => !matchPattern(dep, [pattern])));
|
|
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.`);
|
|
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")}`);
|
|
1269
|
+
if (unusedPatterns.length) logger.info(nameLabel, `The following entries in ${styleText$1.blue(`deps.onlyBundle`)} are not used in the bundle:\n${unusedPatterns.map((pattern) => `- ${styleText$1.yellow(String(pattern))}`).join("\n")}\nConsider removing them to keep your configuration clean.`);
|
|
1270
|
+
} else if (onlyBundle == null && deps.size) logger.info(nameLabel, `Hint: consider adding ${styleText$1.blue(`deps.onlyBundle`)} option to avoid unintended bundling of dependencies, or set ${styleText$1.blue(`deps.onlyBundle: false`)} to disable this hint.\nSee more at ${styleText$1.underline(`https://tsdown.dev/options/dependencies#deps-onlybundle`)}\nDetected dependencies in bundle:\n${Array.from(deps, (dep) => `- ${styleText$1.blue(dep)}`).join("\n")}`);
|
|
181
1271
|
}
|
|
182
1272
|
}
|
|
183
1273
|
};
|
|
@@ -186,7 +1276,7 @@ function DepsPlugin({ pkg, deps: { neverBundle, alwaysBundle: jsAlwaysBundle, on
|
|
|
186
1276
|
* - `[true, resolvedId]`: external with custom resolved ID
|
|
187
1277
|
* - `false`: skip, let other plugins handle it
|
|
188
1278
|
* - `'absolute'`: external as absolute path
|
|
189
|
-
* - `'no-external'`: skip, but mark as non-external for
|
|
1279
|
+
* - `'no-external'`: skip, but mark as non-external for onlyBundle check
|
|
190
1280
|
*/
|
|
191
1281
|
async function externalStrategy(id, importer, resolve) {
|
|
192
1282
|
if (id === shimFile) return false;
|
|
@@ -194,16 +1284,13 @@ function DepsPlugin({ pkg, deps: { neverBundle, alwaysBundle: jsAlwaysBundle, on
|
|
|
194
1284
|
if ((isDts && dts?.alwaysBundle || jsAlwaysBundle)?.(id, importer)) return "no-external";
|
|
195
1285
|
if ((isDts && dts?.neverBundle != null ? dts.neverBundle : neverBundle) === true) {
|
|
196
1286
|
if (id[0] === "\0" || id.startsWith("data:") || path.isAbsolute(id)) return false;
|
|
197
|
-
if (isBuiltin(id)
|
|
198
|
-
|
|
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))) {
|
|
1287
|
+
if (isBuiltin(id)) return true;
|
|
1288
|
+
if (RE_PACKAGE_SPECIFIER.test(id)) {
|
|
204
1289
|
const resolvedDep = shouldResolveDepSubpath && await resolveDepSubpath(id, resolve);
|
|
205
1290
|
return resolvedDep ? [true, resolvedDep] : true;
|
|
206
1291
|
}
|
|
1292
|
+
const resolved = await resolve();
|
|
1293
|
+
return !!resolved && (!!resolved.external || RE_NODE_MODULES$1.test(resolved.id));
|
|
207
1294
|
}
|
|
208
1295
|
if (deps) {
|
|
209
1296
|
if (deps.includes(id) || deps.some((dep) => id.startsWith(`${dep}/`))) {
|
|
@@ -307,6 +1394,370 @@ function getProductionDeps(pkg) {
|
|
|
307
1394
|
]);
|
|
308
1395
|
}
|
|
309
1396
|
//#endregion
|
|
1397
|
+
//#region ../../node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/set-CC5YeoYX.js
|
|
1398
|
+
const STRICT_COMPARATOR = safeRegex(String.raw`^${GREATER_LESS_THAN}\s*(${FULL_PLAIN})$|^$`);
|
|
1399
|
+
const LOOSE_COMPARATOR$1 = safeRegex(String.raw`^${GREATER_LESS_THAN}\s*(${LOOSE_PLAIN})$|^$`);
|
|
1400
|
+
function parseComparator(comparator, options = {}) {
|
|
1401
|
+
if (typeof comparator !== "string") return comparator;
|
|
1402
|
+
const normalized = comparator.trim().replaceAll(/\s+/g, " ");
|
|
1403
|
+
const match = normalized.match(options.loose ? LOOSE_COMPARATOR$1 : STRICT_COMPARATOR);
|
|
1404
|
+
if (!match) throw new TypeError(`Invalid comparator: ${normalized}`);
|
|
1405
|
+
const operator = match[1] === "=" ? "" : match[1] || "";
|
|
1406
|
+
const version = match[2] ? parse$2(match[2], options) : null;
|
|
1407
|
+
return {
|
|
1408
|
+
operator,
|
|
1409
|
+
options,
|
|
1410
|
+
value: version ? `${operator}${formatComparableVersion(version)}` : "",
|
|
1411
|
+
version
|
|
1412
|
+
};
|
|
1413
|
+
}
|
|
1414
|
+
function testParsedComparator(comparator, version) {
|
|
1415
|
+
if (!comparator.version) return true;
|
|
1416
|
+
const comparison = compareParsed(version, comparator.version);
|
|
1417
|
+
switch (comparator.operator) {
|
|
1418
|
+
case "": return comparison === 0;
|
|
1419
|
+
case ">": return comparison > 0;
|
|
1420
|
+
case ">=": return comparison >= 0;
|
|
1421
|
+
case "<": return comparison < 0;
|
|
1422
|
+
case "<=": return comparison <= 0;
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
function comparatorAllowsPrerelease(comparator, version) {
|
|
1426
|
+
const allowed = comparator.version;
|
|
1427
|
+
return allowed !== null && !!allowed.prerelease?.length && allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch;
|
|
1428
|
+
}
|
|
1429
|
+
function testComparatorSet(set, version, options) {
|
|
1430
|
+
if (set.some((comparator) => !testParsedComparator(comparator, version))) return false;
|
|
1431
|
+
return !version.prerelease?.length || !!options.includePrerelease || set.some((comparator) => comparatorAllowsPrerelease(comparator, version));
|
|
1432
|
+
}
|
|
1433
|
+
//#endregion
|
|
1434
|
+
//#region ../../node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/range-DvX-Y6iv.js
|
|
1435
|
+
const BUILD_STRIP = new RegExp(BUILD, "g");
|
|
1436
|
+
const BUILD_SAFE = safeRegex(BUILD);
|
|
1437
|
+
const STRICT_HYPHEN = safeRegex(String.raw`^\s*(${XRANGE_PLAIN})\s+-\s+(${XRANGE_PLAIN})\s*$`);
|
|
1438
|
+
const LOOSE_HYPHEN = safeRegex(String.raw`^\s*(${XRANGE_PLAIN_LOOSE})\s+-\s+(${XRANGE_PLAIN_LOOSE})\s*$`);
|
|
1439
|
+
const COMPARATOR_TRIM = safeRegex(String.raw`(\s*)${GREATER_LESS_THAN}\s*(${LOOSE_PLAIN}|${XRANGE_PLAIN})`, "g");
|
|
1440
|
+
const TILDE_TRIM = safeRegex(String.raw`(\s*)${LONE_TILDE}\s+`, "g");
|
|
1441
|
+
const CARET_TRIM = safeRegex(String.raw`(\s*)${LONE_CARET}\s+`, "g");
|
|
1442
|
+
const STRICT_TILDE = safeRegex(`^${LONE_TILDE}${XRANGE_PLAIN}$`);
|
|
1443
|
+
const LOOSE_TILDE = safeRegex(`^${LONE_TILDE}${XRANGE_PLAIN_LOOSE}$`);
|
|
1444
|
+
const STRICT_CARET = safeRegex(`^${LONE_CARET}${XRANGE_PLAIN}$`);
|
|
1445
|
+
const LOOSE_CARET = safeRegex(`^${LONE_CARET}${XRANGE_PLAIN_LOOSE}$`);
|
|
1446
|
+
const STRICT_XRANGE = safeRegex(String.raw`^${GREATER_LESS_THAN}\s*${XRANGE_PLAIN}$`);
|
|
1447
|
+
const LOOSE_XRANGE = safeRegex(String.raw`^${GREATER_LESS_THAN}\s*${XRANGE_PLAIN_LOOSE}$`);
|
|
1448
|
+
const STAR = safeRegex(String.raw`(<|>)?=?\s*\*`);
|
|
1449
|
+
const GTE_ZERO = /^\s*>=\s*0\.0\.0\s*$/;
|
|
1450
|
+
const GTE_ZERO_PRERELEASE = /^\s*>=\s*0\.0\.0-0\s*$/;
|
|
1451
|
+
const LOOSE_COMPARATOR = safeRegex(String.raw`^${GREATER_LESS_THAN}\s*(${LOOSE_PLAIN})$|^$`);
|
|
1452
|
+
function isWildcard(value) {
|
|
1453
|
+
return !value || String(value).toLowerCase() === "x" || String(value) === "*";
|
|
1454
|
+
}
|
|
1455
|
+
function hasInvalidWildcardOrder(major, minor, patch) {
|
|
1456
|
+
return isWildcard(major) && !isWildcard(minor) || isWildcard(minor) && Boolean(patch) && !isWildcard(patch);
|
|
1457
|
+
}
|
|
1458
|
+
function replaceTilde(comparator, options) {
|
|
1459
|
+
const expression = options.loose ? LOOSE_TILDE : STRICT_TILDE;
|
|
1460
|
+
const lowerPrerelease = options.includePrerelease ? "-0" : "";
|
|
1461
|
+
return comparator.replace(expression, (_match, major, minor, patch, prerelease) => {
|
|
1462
|
+
if (isWildcard(major)) return "";
|
|
1463
|
+
if (isWildcard(minor)) return `>=${major}.0.0${lowerPrerelease} <${Number(major) + 1}.0.0-0`;
|
|
1464
|
+
if (isWildcard(patch)) return `>=${major}.${minor}.0${lowerPrerelease} <${major}.${Number(minor) + 1}.0-0`;
|
|
1465
|
+
return prerelease ? `>=${major}.${minor}.${patch}-${prerelease} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.${patch} <${major}.${Number(minor) + 1}.0-0`;
|
|
1466
|
+
});
|
|
1467
|
+
}
|
|
1468
|
+
function replaceTildes(comparator, options) {
|
|
1469
|
+
return comparator.trim().split(/\s+/).map((part) => replaceTilde(part, options)).join(" ");
|
|
1470
|
+
}
|
|
1471
|
+
function replaceCaret(comparator, options) {
|
|
1472
|
+
const expression = options.loose ? LOOSE_CARET : STRICT_CARET;
|
|
1473
|
+
const lowerPrerelease = options.includePrerelease ? "-0" : "";
|
|
1474
|
+
return comparator.replace(expression, (_match, major, minor, patch, prerelease) => {
|
|
1475
|
+
if (isWildcard(major)) return "";
|
|
1476
|
+
if (isWildcard(minor)) return `>=${major}.0.0${lowerPrerelease} <${Number(major) + 1}.0.0-0`;
|
|
1477
|
+
if (isWildcard(patch)) return major === "0" ? `>=${major}.${minor}.0${lowerPrerelease} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.0${lowerPrerelease} <${Number(major) + 1}.0.0-0`;
|
|
1478
|
+
if (prerelease) return major === "0" ? minor === "0" ? `>=${major}.${minor}.${patch}-${prerelease} <${major}.${minor}.${Number(patch) + 1}-0` : `>=${major}.${minor}.${patch}-${prerelease} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.${patch}-${prerelease} <${Number(major) + 1}.0.0-0`;
|
|
1479
|
+
return major === "0" ? minor === "0" ? `>=${major}.${minor}.${patch} <${major}.${minor}.${Number(patch) + 1}-0` : `>=${major}.${minor}.${patch} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.${patch} <${Number(major) + 1}.0.0-0`;
|
|
1480
|
+
});
|
|
1481
|
+
}
|
|
1482
|
+
function replaceCarets(comparator, options) {
|
|
1483
|
+
return comparator.trim().split(/\s+/).map((part) => replaceCaret(part, options)).join(" ");
|
|
1484
|
+
}
|
|
1485
|
+
function replaceXRange(comparator, options) {
|
|
1486
|
+
const expression = options.loose ? LOOSE_XRANGE : STRICT_XRANGE;
|
|
1487
|
+
return comparator.trim().replace(expression, (match, rawOperator, rawMajor, rawMinor, rawPatch) => {
|
|
1488
|
+
let operator = rawOperator;
|
|
1489
|
+
let major = rawMajor;
|
|
1490
|
+
let minor = rawMinor;
|
|
1491
|
+
let patch = rawPatch;
|
|
1492
|
+
if (hasInvalidWildcardOrder(String(major), minor === void 0 ? void 0 : String(minor), patch === void 0 ? void 0 : String(patch))) return comparator;
|
|
1493
|
+
const wildcardMajor = isWildcard(major);
|
|
1494
|
+
const wildcardMinor = wildcardMajor || isWildcard(minor);
|
|
1495
|
+
const wildcardPatch = wildcardMinor || isWildcard(patch);
|
|
1496
|
+
if (operator === "=" && wildcardPatch) operator = "";
|
|
1497
|
+
if (wildcardMajor) return operator === ">" || operator === "<" ? "<0.0.0-0" : "*";
|
|
1498
|
+
let prerelease = options.includePrerelease ? "-0" : "";
|
|
1499
|
+
if (operator && wildcardPatch) {
|
|
1500
|
+
if (wildcardMinor) minor = 0;
|
|
1501
|
+
patch = 0;
|
|
1502
|
+
if (operator === ">") {
|
|
1503
|
+
operator = ">=";
|
|
1504
|
+
if (wildcardMinor) {
|
|
1505
|
+
major = Number(major) + 1;
|
|
1506
|
+
minor = 0;
|
|
1507
|
+
} else minor = Number(minor) + 1;
|
|
1508
|
+
} else if (operator === "<=") {
|
|
1509
|
+
operator = "<";
|
|
1510
|
+
if (wildcardMinor) major = Number(major) + 1;
|
|
1511
|
+
else minor = Number(minor) + 1;
|
|
1512
|
+
}
|
|
1513
|
+
if (operator === "<") prerelease = "-0";
|
|
1514
|
+
return `${operator}${major}.${minor}.${patch}${prerelease}`;
|
|
1515
|
+
}
|
|
1516
|
+
if (wildcardMinor) return `>=${major}.0.0${prerelease} <${Number(major) + 1}.0.0-0`;
|
|
1517
|
+
if (wildcardPatch) return `>=${major}.${minor}.0${prerelease} <${major}.${Number(minor) + 1}.0-0`;
|
|
1518
|
+
return match;
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1521
|
+
function replaceXRanges(comparator, options) {
|
|
1522
|
+
return comparator.split(/\s+/).map((part) => replaceXRange(part, options)).join(" ");
|
|
1523
|
+
}
|
|
1524
|
+
function replaceHyphenRange(range, options) {
|
|
1525
|
+
const expression = options.loose ? LOOSE_HYPHEN : STRICT_HYPHEN;
|
|
1526
|
+
return range.replace(expression, (_match, rawFrom, fromMajor, fromMinor, fromPatch, fromPrerelease, _fromBuild, rawTo, toMajor, toMinor, toPatch, toPrerelease) => {
|
|
1527
|
+
let from = rawFrom;
|
|
1528
|
+
let to = rawTo;
|
|
1529
|
+
if (isWildcard(fromMajor)) from = "";
|
|
1530
|
+
else if (isWildcard(fromMinor)) from = `>=${fromMajor}.0.0${options.includePrerelease ? "-0" : ""}`;
|
|
1531
|
+
else if (isWildcard(fromPatch)) from = `>=${fromMajor}.${fromMinor}.0${options.includePrerelease ? "-0" : ""}`;
|
|
1532
|
+
else if (fromPrerelease) from = `>=${from}`;
|
|
1533
|
+
else from = `>=${from}${options.includePrerelease ? "-0" : ""}`;
|
|
1534
|
+
if (isWildcard(toMajor)) to = "";
|
|
1535
|
+
else if (isWildcard(toMinor)) to = `<${Number(toMajor) + 1}.0.0-0`;
|
|
1536
|
+
else if (isWildcard(toPatch)) to = `<${toMajor}.${Number(toMinor) + 1}.0-0`;
|
|
1537
|
+
else if (toPrerelease) to = `<=${toMajor}.${toMinor}.${toPatch}-${toPrerelease}`;
|
|
1538
|
+
else if (options.includePrerelease) to = `<${toMajor}.${toMinor}.${Number(toPatch) + 1}-0`;
|
|
1539
|
+
else to = `<=${to}`;
|
|
1540
|
+
return `${from} ${to}`.trim();
|
|
1541
|
+
});
|
|
1542
|
+
}
|
|
1543
|
+
function expandComparator(comparator, options) {
|
|
1544
|
+
return replaceXRanges(replaceTildes(replaceCarets(comparator.replace(BUILD_SAFE, ""), options), options), options).trim().replace(STAR, "");
|
|
1545
|
+
}
|
|
1546
|
+
function parseSimpleRange(input, options) {
|
|
1547
|
+
let parts = replaceHyphenRange(input.replace(BUILD_STRIP, ""), options).replace(COMPARATOR_TRIM, "$1$2$3").replace(TILDE_TRIM, "$1~").replace(CARET_TRIM, "$1^").split(" ").map((part) => expandComparator(part, options)).join(" ").split(/\s+/).map((part) => part.trim().replace(options.includePrerelease ? GTE_ZERO_PRERELEASE : GTE_ZERO, ""));
|
|
1548
|
+
if (options.loose) parts = parts.filter((part) => LOOSE_COMPARATOR.test(part));
|
|
1549
|
+
const unique = /* @__PURE__ */ new Map();
|
|
1550
|
+
for (const comparator of parts.map((part) => parseComparator(part, options))) {
|
|
1551
|
+
if (comparator.value === "<0.0.0-0") return [comparator];
|
|
1552
|
+
unique.set(comparator.value, comparator);
|
|
1553
|
+
}
|
|
1554
|
+
if (unique.size > 1) unique.delete("");
|
|
1555
|
+
return [...unique.values()];
|
|
1556
|
+
}
|
|
1557
|
+
function parseRange(range, options = {}) {
|
|
1558
|
+
if (typeof range !== "string") return range;
|
|
1559
|
+
const parsedOptions = { ...options };
|
|
1560
|
+
const normalizedRange = range.trim().replaceAll(/\s+/g, " ");
|
|
1561
|
+
let sets = normalizedRange.split("||").map((part) => parseSimpleRange(part.trim(), parsedOptions)).filter((set) => set.length);
|
|
1562
|
+
if (!sets.length) throw new TypeError(`Range contains no valid comparator sets: ${normalizedRange}`);
|
|
1563
|
+
if (sets.length > 1) {
|
|
1564
|
+
const first = sets[0];
|
|
1565
|
+
sets = sets.filter((set) => set[0]?.value !== "<0.0.0-0");
|
|
1566
|
+
if (!sets.length) sets = [first];
|
|
1567
|
+
else if (sets.length > 1) {
|
|
1568
|
+
const any = sets.find((set) => set.length === 1 && set[0]?.value === "");
|
|
1569
|
+
if (any) sets = [any];
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
return {
|
|
1573
|
+
options: parsedOptions,
|
|
1574
|
+
sets
|
|
1575
|
+
};
|
|
1576
|
+
}
|
|
1577
|
+
function tryParseRange(range, options = {}) {
|
|
1578
|
+
try {
|
|
1579
|
+
return parseRange(range, options);
|
|
1580
|
+
} catch {
|
|
1581
|
+
return null;
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
function testParsedRange(range, version) {
|
|
1585
|
+
return range.sets.some((set) => testComparatorSet(set, version, range.options));
|
|
1586
|
+
}
|
|
1587
|
+
function testRangeVersion(range, version) {
|
|
1588
|
+
const parsed = tryParse(version, range.options);
|
|
1589
|
+
return parsed ? testParsedRange(range, parsed) : false;
|
|
1590
|
+
}
|
|
1591
|
+
function satisfies(version, range, options = {}) {
|
|
1592
|
+
const parsed = tryParseRange(range, options);
|
|
1593
|
+
return parsed ? testRangeVersion(parsed, version) : false;
|
|
1594
|
+
}
|
|
1595
|
+
function nextVersionAfter(version) {
|
|
1596
|
+
const { prerelease } = version;
|
|
1597
|
+
return prerelease?.length ? {
|
|
1598
|
+
major: version.major,
|
|
1599
|
+
minor: version.minor,
|
|
1600
|
+
patch: version.patch,
|
|
1601
|
+
prerelease: [...prerelease, 0]
|
|
1602
|
+
} : {
|
|
1603
|
+
major: version.major,
|
|
1604
|
+
minor: version.minor,
|
|
1605
|
+
patch: version.patch + 1
|
|
1606
|
+
};
|
|
1607
|
+
}
|
|
1608
|
+
function findMinimumForRange(range, options = {}) {
|
|
1609
|
+
const parsedRange = parseRange(range, options);
|
|
1610
|
+
const zero = {
|
|
1611
|
+
major: 0,
|
|
1612
|
+
minor: 0,
|
|
1613
|
+
patch: 0
|
|
1614
|
+
};
|
|
1615
|
+
if (testParsedRange(parsedRange, zero)) return zero;
|
|
1616
|
+
const zeroPrerelease = {
|
|
1617
|
+
...zero,
|
|
1618
|
+
prerelease: [0]
|
|
1619
|
+
};
|
|
1620
|
+
if (testParsedRange(parsedRange, zeroPrerelease)) return zeroPrerelease;
|
|
1621
|
+
let minimum = null;
|
|
1622
|
+
for (const set of parsedRange.sets) {
|
|
1623
|
+
let setMinimum = null;
|
|
1624
|
+
for (const comparator of set) {
|
|
1625
|
+
if (!comparator.version) continue;
|
|
1626
|
+
const candidate = comparator.operator === ">" ? nextVersionAfter(comparator.version) : comparator.operator === "" || comparator.operator === ">=" ? structuredClone(comparator.version) : null;
|
|
1627
|
+
if (candidate && (!setMinimum || compareParsed(candidate, setMinimum) > 0)) setMinimum = candidate;
|
|
1628
|
+
}
|
|
1629
|
+
if (setMinimum && (!minimum || compareParsed(minimum, setMinimum) > 0)) minimum = setMinimum;
|
|
1630
|
+
}
|
|
1631
|
+
return minimum && testParsedRange(parsedRange, minimum) ? minimum : null;
|
|
1632
|
+
}
|
|
1633
|
+
//#endregion
|
|
1634
|
+
//#region ../../node_modules/.pnpm/tsdown@0.23.0_@arethetypeswrong+core@0.18.2_@tsdown+css@0.23.0_@tsdown+exe@0.23.0_@type_b65333c86244131b40077d6429604210/node_modules/tsdown/dist/target-DgdLrXba.mjs
|
|
1635
|
+
const NODE_SEA_MIN_VERSION = "25.7.0";
|
|
1636
|
+
const NODE_SEA_MIN_VERSION_PARSED = {
|
|
1637
|
+
major: 25,
|
|
1638
|
+
minor: 7,
|
|
1639
|
+
patch: 0
|
|
1640
|
+
};
|
|
1641
|
+
const debug$7 = createDebug("tsdown:exe");
|
|
1642
|
+
function validateSea({ dts, entry, logger, nameLabel }) {
|
|
1643
|
+
if (process$1.versions.bun || process$1.versions.deno) throw new Error("The `exe` option is not supported in Bun and Deno environments.");
|
|
1644
|
+
if (!isGreaterOrEqual(process$1.version, NODE_SEA_MIN_VERSION_PARSED)) throw new Error(`Node.js version ${process$1.version} does not support \`exe\` option. Please upgrade to Node.js ${NODE_SEA_MIN_VERSION} or later.`);
|
|
1645
|
+
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)}`);
|
|
1646
|
+
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.`);
|
|
1647
|
+
logger.info(nameLabel, "`exe` option is experimental and may change in future releases.");
|
|
1648
|
+
}
|
|
1649
|
+
async function buildExe(config, chunks) {
|
|
1650
|
+
if (!config.exe) return;
|
|
1651
|
+
const filteredChunks = chunks.filter((chunk) => !RE_DTS.test(chunk.fileName));
|
|
1652
|
+
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")}`);
|
|
1653
|
+
const chunk = filteredChunks[0];
|
|
1654
|
+
debug$7("Building executable with SEA for chunk:", chunk.fileName);
|
|
1655
|
+
const bundledFile = path.join(config.outDir, chunk.fileName);
|
|
1656
|
+
const { targets } = config.exe;
|
|
1657
|
+
if (targets?.length) {
|
|
1658
|
+
if (config.exe.seaConfig?.executable) config.logger.warn(config.nameLabel, "`seaConfig.executable` is ignored when `targets` is specified.");
|
|
1659
|
+
const { resolveNodeBinary, getTargetSuffix } = await import("./tsdown-exe.js");
|
|
1660
|
+
for (const target of targets) {
|
|
1661
|
+
const nodeBinaryPath = await resolveNodeBinary(target, config.exe, config.logger);
|
|
1662
|
+
const suffix = getTargetSuffix(target);
|
|
1663
|
+
await buildSingleExe(config, bundledFile, resolveOutputFileName(config.exe, chunk, bundledFile, target, suffix), nodeBinaryPath, target);
|
|
1664
|
+
}
|
|
1665
|
+
} else await buildSingleExe(config, bundledFile, resolveOutputFileName(config.exe, chunk, bundledFile));
|
|
1666
|
+
}
|
|
1667
|
+
function resolveOutputFileName(exe, chunk, bundledFile, target, suffix) {
|
|
1668
|
+
let baseName;
|
|
1669
|
+
if (exe.fileName) baseName = typeof exe.fileName === "function" ? exe.fileName(chunk) : exe.fileName;
|
|
1670
|
+
else baseName = path.basename(bundledFile, path.extname(bundledFile));
|
|
1671
|
+
if (suffix) baseName += suffix;
|
|
1672
|
+
if (target?.platform ? target.platform === "win" : process$1.platform === "win32") baseName += ".exe";
|
|
1673
|
+
return baseName;
|
|
1674
|
+
}
|
|
1675
|
+
async function buildSingleExe(config, bundledFile, outputFile, executable, target) {
|
|
1676
|
+
const exe = config.exe;
|
|
1677
|
+
const exeOutDir = path.resolve(config.cwd, exe.outDir || "build");
|
|
1678
|
+
await mkdir(exeOutDir, { recursive: true });
|
|
1679
|
+
const outputPath = path.join(exeOutDir, outputFile);
|
|
1680
|
+
debug$7("Building SEA executable: %s -> %s", bundledFile, outputPath);
|
|
1681
|
+
const t = performance.now();
|
|
1682
|
+
const tempDir = await mkdtemp(path.join(tmpdir(), "tsdown-sea-"));
|
|
1683
|
+
try {
|
|
1684
|
+
const seaConfig = {
|
|
1685
|
+
disableExperimentalSEAWarning: true,
|
|
1686
|
+
...exe.seaConfig,
|
|
1687
|
+
main: bundledFile,
|
|
1688
|
+
output: outputPath,
|
|
1689
|
+
mainFormat: config.format === "es" ? "module" : "commonjs"
|
|
1690
|
+
};
|
|
1691
|
+
if (executable) seaConfig.executable = executable;
|
|
1692
|
+
const seaConfigPath = path.join(tempDir, "sea-config.json");
|
|
1693
|
+
await writeFile(seaConfigPath, JSON.stringify(seaConfig));
|
|
1694
|
+
debug$7("Wrote sea-config.json: %O -> %s", seaConfig, seaConfigPath);
|
|
1695
|
+
debug$7("Running: %s --build-sea %s", process$1.execPath, seaConfigPath);
|
|
1696
|
+
await x(process$1.execPath, ["--build-sea", seaConfigPath], {
|
|
1697
|
+
nodeOptions: { stdio: [
|
|
1698
|
+
"ignore",
|
|
1699
|
+
"ignore",
|
|
1700
|
+
"inherit"
|
|
1701
|
+
] },
|
|
1702
|
+
throwOnError: true,
|
|
1703
|
+
nodePath: false
|
|
1704
|
+
});
|
|
1705
|
+
} finally {
|
|
1706
|
+
if (debug$7.enabled) debug$7("Preserving temp directory for debugging: %s", tempDir);
|
|
1707
|
+
else await fsRemove(tempDir);
|
|
1708
|
+
}
|
|
1709
|
+
if ((target?.platform || process$1.platform) === "darwin") try {
|
|
1710
|
+
await x("codesign", [
|
|
1711
|
+
"--sign",
|
|
1712
|
+
"-",
|
|
1713
|
+
outputPath
|
|
1714
|
+
], {
|
|
1715
|
+
nodeOptions: { stdio: "inherit" },
|
|
1716
|
+
throwOnError: true,
|
|
1717
|
+
nodePath: false
|
|
1718
|
+
});
|
|
1719
|
+
} catch {
|
|
1720
|
+
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}.`}`);
|
|
1721
|
+
}
|
|
1722
|
+
const stat = await fsStat(outputPath);
|
|
1723
|
+
if (stat) {
|
|
1724
|
+
const sizeText = formatBytes(stat.size);
|
|
1725
|
+
config.logger.info(config.nameLabel, styleText$1.bold(path.relative(config.cwd, outputPath)), ` ${styleText$1.dim(sizeText)}`);
|
|
1726
|
+
}
|
|
1727
|
+
config.logger.success(config.nameLabel, `Built executable: ${styleText$1.red(path.relative(config.cwd, outputPath))}`, styleText$1.dim(`(${Math.round(performance.now() - t)}ms)`));
|
|
1728
|
+
}
|
|
1729
|
+
const BASELINE_WIDELY_AVAILABLE_TARGET = [
|
|
1730
|
+
"chrome111",
|
|
1731
|
+
"edge111",
|
|
1732
|
+
"firefox114",
|
|
1733
|
+
"safari16.4",
|
|
1734
|
+
"ios16.4"
|
|
1735
|
+
];
|
|
1736
|
+
function expandBaselineTarget(targets) {
|
|
1737
|
+
return targets.flatMap((t) => t === "baseline-widely-available" ? BASELINE_WIDELY_AVAILABLE_TARGET : t);
|
|
1738
|
+
}
|
|
1739
|
+
function resolveTarget(logger, target, color, pkg, nameLabel) {
|
|
1740
|
+
if (target === false) return;
|
|
1741
|
+
if (target == null) {
|
|
1742
|
+
const pkgTarget = resolvePackageTarget(pkg);
|
|
1743
|
+
if (pkgTarget) target = pkgTarget;
|
|
1744
|
+
else return;
|
|
1745
|
+
}
|
|
1746
|
+
if (typeof target === "number") throw new TypeError(`Invalid target: ${target}`);
|
|
1747
|
+
const targets = expandBaselineTarget(resolveComma(toArray(target)));
|
|
1748
|
+
if (targets.length) logger.info(nameLabel, `target${targets.length > 1 ? "s" : ""}: ${color(targets.join(", "))}`);
|
|
1749
|
+
return targets;
|
|
1750
|
+
}
|
|
1751
|
+
function resolvePackageTarget(pkg) {
|
|
1752
|
+
const nodeVersion = pkg?.engines?.node;
|
|
1753
|
+
if (!nodeVersion) return;
|
|
1754
|
+
const nodeMinVersion = findMinimumForRange(nodeVersion);
|
|
1755
|
+
if (!nodeMinVersion) return;
|
|
1756
|
+
const normalized = normalize$2(nodeMinVersion);
|
|
1757
|
+
if (normalized === "0.0.0") return;
|
|
1758
|
+
return `node${normalized}`;
|
|
1759
|
+
}
|
|
1760
|
+
//#endregion
|
|
310
1761
|
//#region ../../node_modules/.pnpm/defu@6.1.7/node_modules/defu/dist/defu.mjs
|
|
311
1762
|
function isPlainObject(value) {
|
|
312
1763
|
if (value === null || typeof value !== "object") return false;
|
|
@@ -334,7 +1785,7 @@ function createDefu(merger) {
|
|
|
334
1785
|
return (...arguments_) => arguments_.reduce((p, c) => _defu(p, c, "", merger), {});
|
|
335
1786
|
}
|
|
336
1787
|
//#endregion
|
|
337
|
-
//#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.
|
|
1788
|
+
//#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.7/node_modules/fdir/dist/index.mjs
|
|
338
1789
|
var __require$1 = /* @__PURE__ */ createRequire$1(import.meta.url);
|
|
339
1790
|
function cleanPath(path) {
|
|
340
1791
|
let normalized = normalize$1(path);
|
|
@@ -842,7 +2293,7 @@ var Builder = class {
|
|
|
842
2293
|
}
|
|
843
2294
|
};
|
|
844
2295
|
//#endregion
|
|
845
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
2296
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/constants.js
|
|
846
2297
|
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
847
2298
|
const WIN_SLASH = "\\\\/";
|
|
848
2299
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
@@ -1011,7 +2462,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1011
2462
|
};
|
|
1012
2463
|
}));
|
|
1013
2464
|
//#endregion
|
|
1014
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
2465
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/utils.js
|
|
1015
2466
|
var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1016
2467
|
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
|
|
1017
2468
|
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
@@ -1059,7 +2510,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1059
2510
|
};
|
|
1060
2511
|
}));
|
|
1061
2512
|
//#endregion
|
|
1062
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
2513
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/scan.js
|
|
1063
2514
|
var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1064
2515
|
const utils = require_utils();
|
|
1065
2516
|
const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
|
|
@@ -1088,7 +2539,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1088
2539
|
const scan = (input, options) => {
|
|
1089
2540
|
const opts = options || {};
|
|
1090
2541
|
const length = input.length - 1;
|
|
1091
|
-
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
2542
|
+
const scanToEnd = opts.parts === true || opts.tokens === true || opts.scanToEnd === true;
|
|
1092
2543
|
const slashes = [];
|
|
1093
2544
|
const tokens = [];
|
|
1094
2545
|
const parts = [];
|
|
@@ -1191,14 +2642,18 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1191
2642
|
finished = true;
|
|
1192
2643
|
if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
|
|
1193
2644
|
if (scanToEnd === true) {
|
|
2645
|
+
let parens = 0;
|
|
1194
2646
|
while (eos() !== true && (code = advance())) {
|
|
1195
2647
|
if (code === CHAR_BACKWARD_SLASH) {
|
|
1196
2648
|
backslashes = token.backslashes = true;
|
|
1197
|
-
|
|
2649
|
+
advance();
|
|
2650
|
+
continue;
|
|
2651
|
+
}
|
|
2652
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
2653
|
+
parens++;
|
|
1198
2654
|
continue;
|
|
1199
2655
|
}
|
|
1200
|
-
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
1201
|
-
isGlob = token.isGlob = true;
|
|
2656
|
+
if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
|
|
1202
2657
|
finished = true;
|
|
1203
2658
|
break;
|
|
1204
2659
|
}
|
|
@@ -1246,13 +2701,18 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1246
2701
|
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
1247
2702
|
isGlob = token.isGlob = true;
|
|
1248
2703
|
if (scanToEnd === true) {
|
|
2704
|
+
let parens = 1;
|
|
1249
2705
|
while (eos() !== true && (code = advance())) {
|
|
1250
|
-
if (code ===
|
|
2706
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
1251
2707
|
backslashes = token.backslashes = true;
|
|
1252
|
-
|
|
2708
|
+
advance();
|
|
1253
2709
|
continue;
|
|
1254
2710
|
}
|
|
1255
|
-
if (code ===
|
|
2711
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
2712
|
+
parens++;
|
|
2713
|
+
continue;
|
|
2714
|
+
}
|
|
2715
|
+
if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
|
|
1256
2716
|
finished = true;
|
|
1257
2717
|
break;
|
|
1258
2718
|
}
|
|
@@ -1315,7 +2775,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1315
2775
|
if (opts.parts === true || opts.tokens === true) {
|
|
1316
2776
|
let prevIndex;
|
|
1317
2777
|
for (let idx = 0; idx < slashes.length; idx++) {
|
|
1318
|
-
const n = prevIndex ? prevIndex + 1 : start;
|
|
2778
|
+
const n = prevIndex !== void 0 ? prevIndex + 1 : start;
|
|
1319
2779
|
const i = slashes[idx];
|
|
1320
2780
|
const value = input.slice(n, i);
|
|
1321
2781
|
if (opts.tokens) {
|
|
@@ -1326,18 +2786,19 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1326
2786
|
depth(tokens[idx]);
|
|
1327
2787
|
state.maxDepth += tokens[idx].depth;
|
|
1328
2788
|
}
|
|
1329
|
-
if (
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
if (prevIndex && prevIndex + 1 < input.length) {
|
|
1333
|
-
const value = input.slice(prevIndex + 1);
|
|
1334
|
-
parts.push(value);
|
|
1335
|
-
if (opts.tokens) {
|
|
1336
|
-
tokens[tokens.length - 1].value = value;
|
|
1337
|
-
depth(tokens[tokens.length - 1]);
|
|
1338
|
-
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
2789
|
+
if (i >= start) {
|
|
2790
|
+
parts.push(value);
|
|
2791
|
+
prevIndex = i;
|
|
1339
2792
|
}
|
|
1340
2793
|
}
|
|
2794
|
+
const n = prevIndex !== void 0 ? prevIndex + 1 : start;
|
|
2795
|
+
const value = input.slice(n);
|
|
2796
|
+
parts.push(value);
|
|
2797
|
+
if (opts.tokens && prevIndex && prevIndex + 1 < input.length) {
|
|
2798
|
+
tokens[tokens.length - 1].value = value;
|
|
2799
|
+
depth(tokens[tokens.length - 1]);
|
|
2800
|
+
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
2801
|
+
}
|
|
1341
2802
|
state.slashes = slashes;
|
|
1342
2803
|
state.parts = parts;
|
|
1343
2804
|
}
|
|
@@ -1346,7 +2807,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1346
2807
|
module.exports = scan;
|
|
1347
2808
|
}));
|
|
1348
2809
|
//#endregion
|
|
1349
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
2810
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/parse.js
|
|
1350
2811
|
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1351
2812
|
const constants = require_constants();
|
|
1352
2813
|
const utils = require_utils();
|
|
@@ -2248,6 +3709,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2248
3709
|
rest = rest.slice(3);
|
|
2249
3710
|
consume("/**", 3);
|
|
2250
3711
|
}
|
|
3712
|
+
const isEnd = eos() || state.parens > 0 && rest === ")".repeat(state.parens) && !extglobs.some((extglob) => extglob.type === "negate");
|
|
2251
3713
|
if (prior.type === "bos" && eos()) {
|
|
2252
3714
|
prev.type = "globstar";
|
|
2253
3715
|
prev.value += value;
|
|
@@ -2257,7 +3719,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2257
3719
|
consume(value);
|
|
2258
3720
|
continue;
|
|
2259
3721
|
}
|
|
2260
|
-
if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar &&
|
|
3722
|
+
if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && isEnd) {
|
|
2261
3723
|
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
2262
3724
|
prior.output = `(?:${prior.output}`;
|
|
2263
3725
|
prev.type = "globstar";
|
|
@@ -2422,7 +3884,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2422
3884
|
module.exports = parse;
|
|
2423
3885
|
}));
|
|
2424
3886
|
//#endregion
|
|
2425
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
3887
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/picomatch.js
|
|
2426
3888
|
var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2427
3889
|
const scan = require_scan();
|
|
2428
3890
|
const parse = require_parse();
|
|
@@ -3000,7 +4462,7 @@ const defaultOptions$1 = {
|
|
|
3000
4462
|
function getOptions(options) {
|
|
3001
4463
|
const opts = Object.assign({}, options);
|
|
3002
4464
|
for (const key in defaultOptions$1) if (opts[key] === void 0) Object.assign(opts, { [key]: defaultOptions$1[key] });
|
|
3003
|
-
opts.cwd = (opts.cwd instanceof URL ? fileURLToPath(opts.cwd) : resolve$1(opts.cwd || process.cwd())).replace(BACKSLASHES, "/");
|
|
4465
|
+
opts.cwd = (opts.cwd instanceof URL ? fileURLToPath$1(opts.cwd) : resolve$1(opts.cwd || process.cwd())).replace(BACKSLASHES, "/");
|
|
3004
4466
|
opts.ignore = ensureStringArray(opts.ignore);
|
|
3005
4467
|
opts.fs && (opts.fs = {
|
|
3006
4468
|
readdir: opts.fs.readdir || readdir$1,
|
|
@@ -3108,7 +4570,7 @@ function init({ skipNodeModules } = {}) {
|
|
|
3108
4570
|
const parentUUID = getParentUUID(context.parentURL);
|
|
3109
4571
|
if (!noCache && !parentUUID) return resolved;
|
|
3110
4572
|
const deps = depsStore.getStore();
|
|
3111
|
-
if (deps) deps.add(fileURLToPath
|
|
4573
|
+
if (deps) deps.add(fileURLToPath(resolved.url));
|
|
3112
4574
|
resolved.url = appendUUID(resolved.url, parentUUID || crypto.randomUUID());
|
|
3113
4575
|
return resolved;
|
|
3114
4576
|
},
|
|
@@ -3238,87 +4700,87 @@ quansync$1({
|
|
|
3238
4700
|
*/
|
|
3239
4701
|
const quansync = quansync$1;
|
|
3240
4702
|
quansync$1({
|
|
3241
|
-
sync:
|
|
3242
|
-
async:
|
|
4703
|
+
sync: X.readFileSync,
|
|
4704
|
+
async: X.promises.readFile
|
|
3243
4705
|
});
|
|
3244
4706
|
quansync$1({
|
|
3245
|
-
sync:
|
|
3246
|
-
async:
|
|
4707
|
+
sync: X.writeFileSync,
|
|
4708
|
+
async: X.promises.writeFile
|
|
3247
4709
|
});
|
|
3248
4710
|
quansync$1({
|
|
3249
|
-
sync:
|
|
3250
|
-
async:
|
|
4711
|
+
sync: X.unlinkSync,
|
|
4712
|
+
async: X.promises.unlink
|
|
3251
4713
|
});
|
|
3252
4714
|
quansync$1({
|
|
3253
|
-
sync:
|
|
3254
|
-
async:
|
|
4715
|
+
sync: X.accessSync,
|
|
4716
|
+
async: X.promises.access
|
|
3255
4717
|
});
|
|
3256
4718
|
/**
|
|
3257
4719
|
* @link https://nodejs.org/api/fs.html#fspromisesstatpath-options
|
|
3258
4720
|
*/
|
|
3259
4721
|
const stat$2 = quansync$1({
|
|
3260
|
-
sync:
|
|
3261
|
-
async:
|
|
4722
|
+
sync: X.statSync,
|
|
4723
|
+
async: X.promises.stat
|
|
3262
4724
|
});
|
|
3263
4725
|
const lstat = quansync$1({
|
|
3264
|
-
sync:
|
|
3265
|
-
async:
|
|
4726
|
+
sync: X.lstatSync,
|
|
4727
|
+
async: X.promises.lstat
|
|
3266
4728
|
});
|
|
3267
4729
|
quansync$1({
|
|
3268
|
-
sync:
|
|
3269
|
-
async:
|
|
4730
|
+
sync: X.copyFileSync,
|
|
4731
|
+
async: X.promises.copyFile
|
|
3270
4732
|
});
|
|
3271
4733
|
quansync$1({
|
|
3272
|
-
sync:
|
|
3273
|
-
async:
|
|
4734
|
+
sync: X.rmSync,
|
|
4735
|
+
async: X.promises.rm
|
|
3274
4736
|
});
|
|
3275
4737
|
quansync$1({
|
|
3276
|
-
sync:
|
|
3277
|
-
async:
|
|
4738
|
+
sync: X.mkdirSync,
|
|
4739
|
+
async: X.promises.mkdir
|
|
3278
4740
|
});
|
|
3279
4741
|
quansync$1({
|
|
3280
|
-
sync:
|
|
3281
|
-
async:
|
|
4742
|
+
sync: X.renameSync,
|
|
4743
|
+
async: X.promises.rename
|
|
3282
4744
|
});
|
|
3283
4745
|
quansync$1({
|
|
3284
|
-
sync:
|
|
3285
|
-
async:
|
|
4746
|
+
sync: X.readdirSync,
|
|
4747
|
+
async: X.promises.readdir
|
|
3286
4748
|
});
|
|
3287
4749
|
quansync$1({
|
|
3288
|
-
sync:
|
|
3289
|
-
async:
|
|
4750
|
+
sync: X.realpathSync,
|
|
4751
|
+
async: X.promises.realpath
|
|
3290
4752
|
});
|
|
3291
4753
|
quansync$1({
|
|
3292
|
-
sync:
|
|
3293
|
-
async:
|
|
4754
|
+
sync: X.readlinkSync,
|
|
4755
|
+
async: X.promises.readlink
|
|
3294
4756
|
});
|
|
3295
4757
|
quansync$1({
|
|
3296
|
-
sync:
|
|
3297
|
-
async:
|
|
4758
|
+
sync: X.symlinkSync,
|
|
4759
|
+
async: X.promises.symlink
|
|
3298
4760
|
});
|
|
3299
4761
|
quansync$1({
|
|
3300
|
-
sync:
|
|
3301
|
-
async:
|
|
4762
|
+
sync: X.chownSync,
|
|
4763
|
+
async: X.promises.chown
|
|
3302
4764
|
});
|
|
3303
4765
|
quansync$1({
|
|
3304
|
-
sync:
|
|
3305
|
-
async:
|
|
4766
|
+
sync: X.lchownSync,
|
|
4767
|
+
async: X.promises.lchown
|
|
3306
4768
|
});
|
|
3307
4769
|
quansync$1({
|
|
3308
|
-
sync:
|
|
3309
|
-
async:
|
|
4770
|
+
sync: X.chmodSync,
|
|
4771
|
+
async: X.promises.chmod
|
|
3310
4772
|
});
|
|
3311
4773
|
quansync$1({
|
|
3312
|
-
sync:
|
|
3313
|
-
async:
|
|
4774
|
+
sync: X.utimesSync,
|
|
4775
|
+
async: X.promises.utimes
|
|
3314
4776
|
});
|
|
3315
4777
|
quansync$1({
|
|
3316
|
-
sync:
|
|
3317
|
-
async:
|
|
4778
|
+
sync: X.lutimesSync,
|
|
4779
|
+
async: X.promises.lutimes
|
|
3318
4780
|
});
|
|
3319
4781
|
quansync$1({
|
|
3320
|
-
sync:
|
|
3321
|
-
async:
|
|
4782
|
+
sync: X.mkdtempSync,
|
|
4783
|
+
async: X.promises.mkdtemp
|
|
3322
4784
|
});
|
|
3323
4785
|
//#endregion
|
|
3324
4786
|
//#region ../../node_modules/.pnpm/unconfig-core@7.5.0/node_modules/unconfig-core/dist/index.mjs
|
|
@@ -3501,7 +4963,8 @@ async function resolveArrayEntry(entries, cwd, root) {
|
|
|
3501
4963
|
const computedRoot = root || lowestCommonAncestor(...resolvedEntries);
|
|
3502
4964
|
const base = root && !isGlob ? path.relative(cwd, root) || "." : computedRoot;
|
|
3503
4965
|
const arrayEntryMap = Object.fromEntries(resolvedEntries.map((file) => {
|
|
3504
|
-
|
|
4966
|
+
const relative = path.relative(base, file);
|
|
4967
|
+
return [slash(stripExtname(relative)), file];
|
|
3505
4968
|
}));
|
|
3506
4969
|
const resolvedObjectEntries = await Promise.all(objectEntries.map(async (entry) => {
|
|
3507
4970
|
const [entryMap] = await resolveObjectEntry(entry, cwd);
|
|
@@ -3586,10 +5049,13 @@ async function generateExports(pkg, chunks, options, inlinedDeps) {
|
|
|
3586
5049
|
const distFile = join$1(pkgRoot, chunk.outDir, normalizedName);
|
|
3587
5050
|
if (isIndex) {
|
|
3588
5051
|
name = ".";
|
|
3589
|
-
if (format === "cjs")
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
else
|
|
5052
|
+
if (format === "cjs") {
|
|
5053
|
+
if (isDts) cjsTypes = distFile;
|
|
5054
|
+
else main = distFile;
|
|
5055
|
+
} else if (format === "es") {
|
|
5056
|
+
if (isDts) esmTypes = distFile;
|
|
5057
|
+
else module = distFile;
|
|
5058
|
+
}
|
|
3593
5059
|
} else if (name.endsWith("/index")) name = `./${name.slice(0, -6)}`;
|
|
3594
5060
|
else name = `./${name}`;
|
|
3595
5061
|
if (extensions && name !== ".") name = `${name}.js`;
|
|
@@ -3770,17 +5236,17 @@ async function resolveTsconfig(logger, tsconfig, cwd, color, nameLabel) {
|
|
|
3770
5236
|
if (tsconfig !== false) {
|
|
3771
5237
|
if (tsconfig === true || tsconfig == null) {
|
|
3772
5238
|
tsconfig = findTsconfig(cwd);
|
|
3773
|
-
if (original && !tsconfig) logger.warn(`No tsconfig found in ${blue(cwd)}`);
|
|
5239
|
+
if (original && !tsconfig) logger.warn(`No tsconfig found in ${styleText$1.blue(cwd)}`);
|
|
3774
5240
|
} else {
|
|
3775
5241
|
const tsconfigPath = path.resolve(cwd, tsconfig);
|
|
3776
5242
|
const stat = await fsStat(tsconfigPath);
|
|
3777
5243
|
if (stat?.isFile()) tsconfig = tsconfigPath;
|
|
3778
5244
|
else if (stat?.isDirectory()) {
|
|
3779
5245
|
tsconfig = findTsconfig(tsconfigPath);
|
|
3780
|
-
if (!tsconfig) logger.warn(`No tsconfig found in ${blue(tsconfigPath)}`);
|
|
5246
|
+
if (!tsconfig) logger.warn(`No tsconfig found in ${styleText$1.blue(tsconfigPath)}`);
|
|
3781
5247
|
} else {
|
|
3782
5248
|
tsconfig = findTsconfig(cwd, tsconfig);
|
|
3783
|
-
if (!tsconfig) logger.warn(`tsconfig ${blue(original)} doesn't exist`);
|
|
5249
|
+
if (!tsconfig) logger.warn(`tsconfig ${styleText$1.blue(original)} doesn't exist`);
|
|
3784
5250
|
}
|
|
3785
5251
|
}
|
|
3786
5252
|
if (tsconfig) logger.info(nameLabel, `tsconfig: ${color(path.relative(cwd, tsconfig))}`);
|
|
@@ -3839,7 +5305,7 @@ async function loadViteConfig(prefix, cwd, configLoader) {
|
|
|
3839
5305
|
}).load(true);
|
|
3840
5306
|
if (!result) return;
|
|
3841
5307
|
let { config: [exported, deps], source } = result;
|
|
3842
|
-
globalLogger.info(`Using Vite config: ${underline(source)}`);
|
|
5308
|
+
globalLogger.info(`Using Vite config: ${styleText$1.underline(source)}`);
|
|
3843
5309
|
exported = await exported;
|
|
3844
5310
|
if (typeof exported === "function") exported = await exported({
|
|
3845
5311
|
command: "build",
|
|
@@ -3851,7 +5317,7 @@ async function loadViteConfig(prefix, cwd, configLoader) {
|
|
|
3851
5317
|
};
|
|
3852
5318
|
}
|
|
3853
5319
|
const configPrefix = "tsdown.config";
|
|
3854
|
-
async function loadConfigFile(inlineConfig,
|
|
5320
|
+
async function loadConfigFile(inlineConfig, context, workspace) {
|
|
3855
5321
|
let cwd = inlineConfig.cwd || process$1.cwd();
|
|
3856
5322
|
let { config: filePath } = inlineConfig;
|
|
3857
5323
|
if (filePath === false) return { configs: [{}] };
|
|
@@ -3899,12 +5365,9 @@ async function loadConfigFile(inlineConfig, workspace, rootConfig) {
|
|
|
3899
5365
|
let deps;
|
|
3900
5366
|
if (result) {
|
|
3901
5367
|
({config: [exported, deps], source: file} = result);
|
|
3902
|
-
globalLogger.info(`config file: ${underline(file)}`, loader === "native" ? "" : `(${loader})`);
|
|
5368
|
+
globalLogger.info(`config file: ${styleText$1.underline(file)}`, loader === "native" ? "" : `(${loader})`);
|
|
3903
5369
|
exported = await exported;
|
|
3904
|
-
if (typeof exported === "function") exported = await exported(inlineConfig,
|
|
3905
|
-
ci: isInCI(),
|
|
3906
|
-
rootConfig
|
|
3907
|
-
});
|
|
5370
|
+
if (typeof exported === "function") exported = await exported(inlineConfig, context);
|
|
3908
5371
|
}
|
|
3909
5372
|
exported = toArray(exported);
|
|
3910
5373
|
if (exported.length === 0) exported.push({});
|
|
@@ -3981,7 +5444,7 @@ async function resolveUserConfig(userConfig, inlineConfig, configDeps, runBuild
|
|
|
3981
5444
|
if (result) userConfig = mergeConfig(userConfig, result);
|
|
3982
5445
|
}
|
|
3983
5446
|
}
|
|
3984
|
-
let { entry, format, plugins = [], clean = true, logLevel = "info", failOnWarn = false, suppressWarnings, customLogger, treeshake = true, platform = "node", outDir = "dist", sourcemap = false, dts, unused = false, watch = false, ignoreWatch, shims = false, publint = false, attw = false, fromVite, alias, tsconfig, report = true, target, env = {}, envFile, envPrefix = "TSDOWN_", copy,
|
|
5447
|
+
let { entry, format, plugins = [], clean = true, logLevel = "info", failOnWarn = false, suppressWarnings, customLogger, treeshake = true, platform = "node", outDir = "dist", sourcemap = false, dts, unused = false, watch = false, ignoreWatch, shims = false, publint = false, attw = false, fromVite, alias, tsconfig, report = true, target, env = {}, envFile, envPrefix = "TSDOWN_", copy, hash = true, cwd = process$1.cwd(), name, workspace, exports = false, unbundle = false, root, nodeProtocol = false, cjsDefault = true, globImport = true, css, outExtensions, fixedExtension = platform === "node", devtools = false, write = true, exe = false } = userConfig;
|
|
3985
5448
|
const pkg = await readPackageJson(cwd);
|
|
3986
5449
|
if (workspace) name ||= pkg?.name;
|
|
3987
5450
|
const color = generateColor(name);
|
|
@@ -3995,12 +5458,6 @@ async function resolveUserConfig(userConfig, inlineConfig, configDeps, runBuild
|
|
|
3995
5458
|
failOnWarn: resolveFeatureOption(failOnWarn, true),
|
|
3996
5459
|
suppressWarnings
|
|
3997
5460
|
});
|
|
3998
|
-
if (typeof bundle === "boolean") logger.warn("`bundle` option is deprecated. Use `unbundle` instead.");
|
|
3999
|
-
if (removeNodeProtocol) {
|
|
4000
|
-
if (nodeProtocol) throw new TypeError("`removeNodeProtocol` is deprecated. Please only use `nodeProtocol` instead.");
|
|
4001
|
-
logger.warn("`removeNodeProtocol` is deprecated. Use `nodeProtocol: \"strip\"` instead.");
|
|
4002
|
-
}
|
|
4003
|
-
nodeProtocol = nodeProtocol ?? (removeNodeProtocol ? "strip" : false);
|
|
4004
5461
|
outDir = path.resolve(cwd, outDir);
|
|
4005
5462
|
clean = resolveClean(clean, outDir, cwd);
|
|
4006
5463
|
const rawEntry = entry;
|
|
@@ -4013,32 +5470,20 @@ async function resolveUserConfig(userConfig, inlineConfig, configDeps, runBuild
|
|
|
4013
5470
|
unused = resolveFeatureOption(unused, {});
|
|
4014
5471
|
report = resolveFeatureOption(report, {});
|
|
4015
5472
|
exe = resolveFeatureOption(exe, {});
|
|
4016
|
-
if (dts == null)
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
5473
|
+
if (dts == null) {
|
|
5474
|
+
if (exe) dts = false;
|
|
5475
|
+
else if (pkg?.types || pkg?.typings || hasExportsTypes(pkg?.exports)) dts = true;
|
|
5476
|
+
else if (tsconfig) {
|
|
5477
|
+
const { config } = te(tsconfig);
|
|
5478
|
+
dts = !!config.compilerOptions?.declaration;
|
|
5479
|
+
} else dts = false;
|
|
5480
|
+
}
|
|
4022
5481
|
dts = resolveFeatureOption(dts, {});
|
|
4023
5482
|
if (!pkg) {
|
|
4024
5483
|
if (exports) throw new Error("`package.json` not found, cannot write exports");
|
|
4025
5484
|
if (publint) logger.warn(nameLabel, "publint is enabled but package.json is not found");
|
|
4026
5485
|
if (attw) logger.warn(nameLabel, "attw is enabled but package.json is not found");
|
|
4027
5486
|
}
|
|
4028
|
-
if (injectStyle != null) if (css?.inject == null) {
|
|
4029
|
-
logger.warn(`${blue`injectStyle`} is deprecated. Use ${blue`css.inject`} instead.`);
|
|
4030
|
-
css = {
|
|
4031
|
-
...css,
|
|
4032
|
-
inject: injectStyle
|
|
4033
|
-
};
|
|
4034
|
-
} else throw new TypeError("`injectStyle` is deprecated. Cannot be used with `css.inject`");
|
|
4035
|
-
if (publicDir) if (copy) throw new TypeError("`publicDir` is deprecated. Cannot be used with `copy`");
|
|
4036
|
-
else logger.warn(`${blue`publicDir`} is deprecated. Use ${blue`copy`} instead.`);
|
|
4037
|
-
if (outExtension) {
|
|
4038
|
-
if (outExtensions) throw new TypeError("`outExtension` is deprecated. Cannot be used with `outExtensions`");
|
|
4039
|
-
logger.warn(`${blue`outExtension`} is deprecated. Use ${blue`outExtensions`} instead.`);
|
|
4040
|
-
outExtensions = outExtension;
|
|
4041
|
-
}
|
|
4042
5487
|
envPrefix = toArray(envPrefix);
|
|
4043
5488
|
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.");
|
|
4044
5489
|
const envFromProcess = filterEnv(process$1.env, envPrefix);
|
|
@@ -4077,10 +5522,12 @@ async function resolveUserConfig(userConfig, inlineConfig, configDeps, runBuild
|
|
|
4077
5522
|
});
|
|
4078
5523
|
const depsConfig = resolveDepsConfig(userConfig, logger);
|
|
4079
5524
|
devtools = resolveFeatureOption(devtools, {});
|
|
4080
|
-
if (devtools)
|
|
4081
|
-
if (
|
|
4082
|
-
|
|
4083
|
-
|
|
5525
|
+
if (devtools) {
|
|
5526
|
+
if (watch) {
|
|
5527
|
+
if (devtools.ui) logger.warn("Devtools UI is not supported in watch mode, disabling it.");
|
|
5528
|
+
devtools.ui = false;
|
|
5529
|
+
} else devtools.ui ??= !!pkgExists("@vitejs/devtools/cli");
|
|
5530
|
+
}
|
|
4084
5531
|
const config = {
|
|
4085
5532
|
...userConfig,
|
|
4086
5533
|
alias,
|
|
@@ -4088,7 +5535,7 @@ async function resolveUserConfig(userConfig, inlineConfig, configDeps, runBuild
|
|
|
4088
5535
|
cjsDefault,
|
|
4089
5536
|
clean,
|
|
4090
5537
|
configDeps,
|
|
4091
|
-
copy
|
|
5538
|
+
copy,
|
|
4092
5539
|
css,
|
|
4093
5540
|
cwd,
|
|
4094
5541
|
deps: depsConfig,
|
|
@@ -4187,7 +5634,7 @@ function filterConfig(filter, configCwd, name) {
|
|
|
4187
5634
|
return toArray(filter).some((value) => name && name === value || cwd === value);
|
|
4188
5635
|
}
|
|
4189
5636
|
//#endregion
|
|
4190
|
-
//#region ../../node_modules/.pnpm/tsdown@0.
|
|
5637
|
+
//#region ../../node_modules/.pnpm/tsdown@0.23.0_@arethetypeswrong+core@0.18.2_@tsdown+css@0.23.0_@tsdown+exe@0.23.0_@type_b65333c86244131b40077d6429604210/node_modules/tsdown/dist/watch-UrMX4y5g.mjs
|
|
4191
5638
|
async function copy(options) {
|
|
4192
5639
|
if (!options.copy) return;
|
|
4193
5640
|
const resolved = await resolveCopyEntries(options);
|
|
@@ -4268,7 +5715,8 @@ const gzipAsync = promisify(gzip);
|
|
|
4268
5715
|
const defaultOptions = {
|
|
4269
5716
|
gzip: true,
|
|
4270
5717
|
brotli: false,
|
|
4271
|
-
maxCompressSize: 1e6
|
|
5718
|
+
maxCompressSize: 1e6,
|
|
5719
|
+
summary: false
|
|
4272
5720
|
};
|
|
4273
5721
|
function ReportPlugin(config, cjsDts, isDualFormat) {
|
|
4274
5722
|
return {
|
|
@@ -4307,10 +5755,10 @@ async function outputReport(config, chunks, outDir, cjsDts, isDualFormat) {
|
|
|
4307
5755
|
return b.raw - a.raw;
|
|
4308
5756
|
});
|
|
4309
5757
|
const formatLabel = isDualFormat && prettyFormat(cjsDts ? "cjs" : config.format);
|
|
4310
|
-
for (const size of sizes) {
|
|
4311
|
-
const filenameColor = size.dts ? green : noop;
|
|
5758
|
+
if (!options.summary) for (const size of sizes) {
|
|
5759
|
+
const filenameColor = size.dts ? styleText$1.green : noop;
|
|
4312
5760
|
const filename = path.normalize(size.filename);
|
|
4313
|
-
config.logger.info(config.nameLabel, formatLabel, dim(outDir + path.sep) + filenameColor(
|
|
5761
|
+
config.logger.info(config.nameLabel, formatLabel, styleText$1.dim(outDir + path.sep) + filenameColor(size.isEntry ? styleText$1.bold(filename) : filename), ` `.repeat(filenameLength - size.filename.length), styleText$1.dim(size.rawText), options.gzip && size.gzipText && styleText$1.dim(`│ gzip: ${size.gzipText}`), options.brotli && size.brotliText && styleText$1.dim(`│ brotli: ${size.brotliText}`));
|
|
4314
5762
|
}
|
|
4315
5763
|
const totalSizeText = formatBytes(totalRaw);
|
|
4316
5764
|
config.logger.info(config.nameLabel, formatLabel, `${sizes.length} files, total: ${totalSizeText}`);
|
|
@@ -4355,7 +5803,7 @@ function ShebangPlugin(logger, cwd, nameLabel, isDualFormat) {
|
|
|
4355
5803
|
if (!RE_SHEBANG.test(chunk.code)) continue;
|
|
4356
5804
|
const filepath = path.resolve(cwd, options.file || path.join(options.dir, chunk.fileName));
|
|
4357
5805
|
if (await fsExists(filepath)) {
|
|
4358
|
-
logger.info(nameLabel, isDualFormat && prettyFormat(options.format), `Granting execute permission to ${underline(path.relative(cwd, filepath))}`);
|
|
5806
|
+
logger.info(nameLabel, isDualFormat && prettyFormat(options.format), `Granting execute permission to ${styleText$1.underline(path.relative(cwd, filepath))}`);
|
|
4359
5807
|
await chmod(filepath, 493);
|
|
4360
5808
|
}
|
|
4361
5809
|
}
|
|
@@ -4567,8 +6015,8 @@ var Hookable = class {
|
|
|
4567
6015
|
}
|
|
4568
6016
|
};
|
|
4569
6017
|
//#endregion
|
|
4570
|
-
//#region ../../node_modules/.pnpm/tsdown@0.
|
|
4571
|
-
var
|
|
6018
|
+
//#region ../../node_modules/.pnpm/tsdown@0.23.0_@arethetypeswrong+core@0.18.2_@tsdown+css@0.23.0_@tsdown+exe@0.23.0_@type_b65333c86244131b40077d6429604210/node_modules/tsdown/dist/build-JVmLFaZt.mjs
|
|
6019
|
+
var build_JVmLFaZt_exports = /* @__PURE__ */ __exportAll$1({
|
|
4572
6020
|
n: () => buildWithConfigs,
|
|
4573
6021
|
r: () => build_exports,
|
|
4574
6022
|
t: () => build$1
|
|
@@ -4591,7 +6039,7 @@ const DEFAULT_EXCLUDE_WORKSPACE = [
|
|
|
4591
6039
|
"**/test?(s)/**",
|
|
4592
6040
|
"**/t?(e)mp/**"
|
|
4593
6041
|
];
|
|
4594
|
-
async function resolveWorkspace(config, inlineConfig, rootDeps) {
|
|
6042
|
+
async function resolveWorkspace(config, inlineConfig, context, rootDeps) {
|
|
4595
6043
|
const normalized = mergeConfig(config, inlineConfig);
|
|
4596
6044
|
const rootCwd = normalized.cwd || process$1.cwd();
|
|
4597
6045
|
const deps = new Set(rootDeps);
|
|
@@ -4616,6 +6064,10 @@ async function resolveWorkspace(config, inlineConfig, rootDeps) {
|
|
|
4616
6064
|
expandDirectories: false
|
|
4617
6065
|
})).map((file) => slash(path.resolve(file)));
|
|
4618
6066
|
if (packages.length === 0) throw new Error("No workspace packages found, please check your config");
|
|
6067
|
+
context = {
|
|
6068
|
+
...context,
|
|
6069
|
+
rootConfig: normalized
|
|
6070
|
+
};
|
|
4619
6071
|
return {
|
|
4620
6072
|
configs: (await Promise.all(packages.map(async (cwd) => {
|
|
4621
6073
|
debug$5("loading workspace config %s", cwd);
|
|
@@ -4623,7 +6075,7 @@ async function resolveWorkspace(config, inlineConfig, rootDeps) {
|
|
|
4623
6075
|
...inlineConfig,
|
|
4624
6076
|
config: workspaceConfig,
|
|
4625
6077
|
cwd
|
|
4626
|
-
},
|
|
6078
|
+
}, context, cwd);
|
|
4627
6079
|
workspaceDeps?.forEach((dep) => deps.add(dep));
|
|
4628
6080
|
return configs.map((config) => mergeConfig(normalized, config));
|
|
4629
6081
|
}))).flat(),
|
|
@@ -4631,14 +6083,18 @@ async function resolveWorkspace(config, inlineConfig, rootDeps) {
|
|
|
4631
6083
|
};
|
|
4632
6084
|
}
|
|
4633
6085
|
const debug$4 = createDebug("tsdown:config");
|
|
4634
|
-
async function resolveConfig(inlineConfig) {
|
|
6086
|
+
async function resolveConfig(inlineConfig, watch) {
|
|
4635
6087
|
debug$4("inline config %O", inlineConfig);
|
|
4636
6088
|
if (inlineConfig.cwd) inlineConfig.cwd = path.resolve(inlineConfig.cwd);
|
|
4637
|
-
const
|
|
6089
|
+
const context = {
|
|
6090
|
+
ci: isInCI(),
|
|
6091
|
+
watch
|
|
6092
|
+
};
|
|
6093
|
+
const { configs: rootConfigs, deps: rootDeps } = await loadConfigFile(inlineConfig, context);
|
|
4638
6094
|
const globalDeps = new Set(rootDeps);
|
|
4639
6095
|
const runBuild = createConcurrencyExecutor(inlineConfig.concurrency);
|
|
4640
6096
|
const configs = (await Promise.all(rootConfigs.map(async (rootConfig) => {
|
|
4641
|
-
const { configs: workspaceConfigs, deps: workspaceDeps } = await resolveWorkspace(rootConfig, inlineConfig, rootDeps);
|
|
6097
|
+
const { configs: workspaceConfigs, deps: workspaceDeps } = await resolveWorkspace(rootConfig, inlineConfig, context, rootDeps);
|
|
4642
6098
|
debug$4("workspace configs %O", workspaceConfigs);
|
|
4643
6099
|
const configs = (await Promise.all(workspaceConfigs.filter((config) => !config.workspace || config.entry).map((config) => resolveUserConfig(config, inlineConfig, workspaceDeps, runBuild)))).flat().filter((config) => !!config);
|
|
4644
6100
|
workspaceDeps.forEach((dep) => globalDeps.add(dep));
|
|
@@ -4660,23 +6116,6 @@ function warnLegacyCJS(config) {
|
|
|
4660
6116
|
return version && satisfies(version, RANGE_REQUIRING_ESM);
|
|
4661
6117
|
})) 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");
|
|
4662
6118
|
}
|
|
4663
|
-
function CjsDtsReexportPlugin() {
|
|
4664
|
-
return {
|
|
4665
|
-
name: "tsdown:cjs-dts-reexport",
|
|
4666
|
-
generateBundle(_options, bundle) {
|
|
4667
|
-
for (const chunk of Object.values(bundle)) {
|
|
4668
|
-
if (chunk.type !== "chunk" || !chunk.isEntry) continue;
|
|
4669
|
-
if (!chunk.fileName.endsWith(".cjs") && !chunk.fileName.endsWith(".js")) continue;
|
|
4670
|
-
const content = `export type * from './${path.basename(chunk.fileName.replace(RE_JS, ".d.mts"))}'\n`;
|
|
4671
|
-
this.emitFile({
|
|
4672
|
-
type: "prebuilt-chunk",
|
|
4673
|
-
fileName: filename_js_to_dts(chunk.fileName),
|
|
4674
|
-
code: content
|
|
4675
|
-
});
|
|
4676
|
-
}
|
|
4677
|
-
}
|
|
4678
|
-
};
|
|
4679
|
-
}
|
|
4680
6119
|
async function startDevtoolsUI(config) {
|
|
4681
6120
|
const { start } = await importWithError("@vitejs/devtools/cli-commands");
|
|
4682
6121
|
await start({
|
|
@@ -4716,7 +6155,7 @@ function executeOnSuccess(config) {
|
|
|
4716
6155
|
return ab;
|
|
4717
6156
|
}
|
|
4718
6157
|
const debug$3 = createDebug("tsdown:attw");
|
|
4719
|
-
const label$1 = dim`[attw]
|
|
6158
|
+
const label$1 = styleText$1.dim(`[attw]`);
|
|
4720
6159
|
const problemFlags = {
|
|
4721
6160
|
NoResolution: "no-resolution",
|
|
4722
6161
|
UntypedResolution: "untyped-resolution",
|
|
@@ -4748,7 +6187,7 @@ async function attw(options, tarball) {
|
|
|
4748
6187
|
options.logger.warn("attw is enabled but package.json is not found");
|
|
4749
6188
|
return;
|
|
4750
6189
|
}
|
|
4751
|
-
const { profile = "
|
|
6190
|
+
const { profile = "esm-only", level = "warn", ignoreRules = [], ...attwOptions } = options.attw;
|
|
4752
6191
|
const invalidRules = ignoreRules.filter((rule) => !Object.values(problemFlags).includes(rule));
|
|
4753
6192
|
if (invalidRules.length) options.logger.warn(`attw config option 'ignoreRules' contains invalid value '${invalidRules.join(", ")}'.`);
|
|
4754
6193
|
const t = performance.now();
|
|
@@ -4766,7 +6205,7 @@ async function attw(options, tarball) {
|
|
|
4766
6205
|
if (problems.length) errorMessage = `problems found:\n${problems.map((problem) => formatProblem(checkResult.packageName, problem)).join("\n")}`;
|
|
4767
6206
|
} else errorMessage = `Package has no types`;
|
|
4768
6207
|
if (errorMessage) options.logger[level](options.nameLabel, label$1, errorMessage);
|
|
4769
|
-
else options.logger.success(options.nameLabel, label$1, "No problems found", dim`(${Math.round(performance.now() - t)}ms)`);
|
|
6208
|
+
else options.logger.success(options.nameLabel, label$1, "No problems found", styleText$1.dim(`(${Math.round(performance.now() - t)}ms)`));
|
|
4770
6209
|
}
|
|
4771
6210
|
/**
|
|
4772
6211
|
* Format an ATTW problem for display
|
|
@@ -4794,7 +6233,7 @@ function formatProblem(packageName, problem) {
|
|
|
4794
6233
|
}
|
|
4795
6234
|
}
|
|
4796
6235
|
const debug$2 = createDebug("tsdown:publint");
|
|
4797
|
-
const label = dim`[publint]
|
|
6236
|
+
const label = styleText$1.dim(`[publint]`);
|
|
4798
6237
|
async function publint(options, tarball) {
|
|
4799
6238
|
if (!options.publint) return;
|
|
4800
6239
|
if (!options.pkg) {
|
|
@@ -4811,7 +6250,7 @@ async function publint(options, tarball) {
|
|
|
4811
6250
|
});
|
|
4812
6251
|
debug$2("Found %d issues", messages.length);
|
|
4813
6252
|
if (!messages.length) {
|
|
4814
|
-
options.logger.success(options.nameLabel, label, "No issues found", dim`(${Math.round(performance.now() - t)}ms)`);
|
|
6253
|
+
options.logger.success(options.nameLabel, label, "No issues found", styleText$1.dim(`(${Math.round(performance.now() - t)}ms)`));
|
|
4815
6254
|
return;
|
|
4816
6255
|
}
|
|
4817
6256
|
for (const message of messages) {
|
|
@@ -4856,9 +6295,9 @@ async function bundleDone(bundleByPkg, bundle) {
|
|
|
4856
6295
|
if (exportsConfigs.length) {
|
|
4857
6296
|
if (exportsConfigs.length > 1) throw new Error(`Conflicting exports options for package at ${pkg.packageJsonPath}. Please merge them:\n${exportsConfigs.map((config) => `- ${formatWithOptions({ colors: true }, config.exports)}`).join("\n")}`);
|
|
4858
6297
|
const chunks = {};
|
|
4859
|
-
const
|
|
4860
|
-
|
|
4861
|
-
|
|
6298
|
+
const exportsBundles = ctx.bundles.filter((bundle) => bundle.config.exports);
|
|
6299
|
+
const inlinedDeps = mergeInlinedDeps(exportsBundles);
|
|
6300
|
+
for (const bundle of exportsBundles) {
|
|
4862
6301
|
chunks[bundle.config.format] ||= [];
|
|
4863
6302
|
chunks[bundle.config.format].push(...bundle.chunks);
|
|
4864
6303
|
}
|
|
@@ -4882,7 +6321,7 @@ async function bundleDone(bundleByPkg, bundle) {
|
|
|
4882
6321
|
async function packTarball(packageJsonPath) {
|
|
4883
6322
|
const pkgDir = path.dirname(packageJsonPath);
|
|
4884
6323
|
const destination = await mkdtemp(path.join(tmpdir(), "tsdown-pack-"));
|
|
4885
|
-
const { detect } = await import("./detect-
|
|
6324
|
+
const { detect } = await import("./detect-Bg-d8iUV-KfbO7neP.js");
|
|
4886
6325
|
try {
|
|
4887
6326
|
const detected = await detect({ cwd: pkgDir });
|
|
4888
6327
|
debug$1("Detected package manager: %o", detected);
|
|
@@ -4940,18 +6379,14 @@ async function pack(dir, pm, destination, ignoreScripts) {
|
|
|
4940
6379
|
case "bun":
|
|
4941
6380
|
args.push("--destination", destination);
|
|
4942
6381
|
break;
|
|
4943
|
-
default:
|
|
4944
|
-
args.push("--pack-destination", destination);
|
|
4945
|
-
break;
|
|
6382
|
+
default: args.push("--pack-destination", destination);
|
|
4946
6383
|
}
|
|
4947
6384
|
if (ignoreScripts) switch (pm.agent) {
|
|
4948
6385
|
case "pnpm":
|
|
4949
6386
|
args.push("--config.ignore-scripts=true");
|
|
4950
6387
|
break;
|
|
4951
6388
|
case "yarn@berry": break;
|
|
4952
|
-
default:
|
|
4953
|
-
args.push("--ignore-scripts");
|
|
4954
|
-
break;
|
|
6389
|
+
default: args.push("--ignore-scripts");
|
|
4955
6390
|
}
|
|
4956
6391
|
const output = await x(command, args, {
|
|
4957
6392
|
nodePath: false,
|
|
@@ -5025,14 +6460,13 @@ async function resolveInputOptions(config, format, configDeps, bundle, cjsDts, i
|
|
|
5025
6460
|
const isSuppressed = createSuppressWarnings(logger.options?.suppressWarnings);
|
|
5026
6461
|
const plugins = [];
|
|
5027
6462
|
if (nodeProtocol) plugins.push(NodeProtocolPlugin(nodeProtocol));
|
|
5028
|
-
if (config.pkg || config.deps.
|
|
6463
|
+
if (config.pkg || config.deps.neverBundle === true || config.deps.dts.neverBundle === true) plugins.push(DepsPlugin(config, bundle));
|
|
5029
6464
|
if (dts) {
|
|
5030
|
-
const { dts: dtsPlugin } = await import("./dist-
|
|
5031
|
-
const { cjsReexport: _, ...dtsPluginOptions } = dts;
|
|
6465
|
+
const { dts: dtsPlugin } = await import("./dist-Cuw3Ngo4.js");
|
|
5032
6466
|
const options = {
|
|
5033
6467
|
tsconfig,
|
|
5034
6468
|
logger,
|
|
5035
|
-
...
|
|
6469
|
+
...dts
|
|
5036
6470
|
};
|
|
5037
6471
|
if (format === "es") plugins.push(dtsPlugin(options));
|
|
5038
6472
|
else if (cjsDts) plugins.push(dtsPlugin({
|
|
@@ -5040,7 +6474,6 @@ async function resolveInputOptions(config, format, configDeps, bundle, cjsDts, i
|
|
|
5040
6474
|
emitDtsOnly: true,
|
|
5041
6475
|
cjsDefault
|
|
5042
6476
|
}));
|
|
5043
|
-
else if (dts.cjsReexport && isDualFormat) plugins.push(CjsDtsReexportPlugin());
|
|
5044
6477
|
}
|
|
5045
6478
|
let cssPostPlugins;
|
|
5046
6479
|
if (!cjsDts) {
|
|
@@ -5156,14 +6589,15 @@ async function debugBuildOptions(dir, name, format, buildOptions) {
|
|
|
5156
6589
|
maxArrayLength: null,
|
|
5157
6590
|
maxStringLength: null
|
|
5158
6591
|
}, buildOptions);
|
|
5159
|
-
|
|
6592
|
+
const code = `/*
|
|
5160
6593
|
Auto-generated rolldown config for tsdown debug purposes
|
|
5161
6594
|
tsdown v${version}, rolldown v${VERSION}
|
|
5162
6595
|
Generated on ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
5163
6596
|
Package name: ${name || "not specified"}
|
|
5164
6597
|
*/
|
|
5165
6598
|
|
|
5166
|
-
export default ${serialized}\n
|
|
6599
|
+
export default ${serialized}\n`;
|
|
6600
|
+
await writeFile(outFile, code);
|
|
5167
6601
|
debug("Wrote debug rolldown config for \"%s\" (%s) -> %s", name || "default name", format, outFile);
|
|
5168
6602
|
}
|
|
5169
6603
|
function handlePluginInspect(plugins) {
|
|
@@ -5204,9 +6638,7 @@ function shortcuts(restart) {
|
|
|
5204
6638
|
{
|
|
5205
6639
|
key: "r",
|
|
5206
6640
|
description: "reload config and rebuild",
|
|
5207
|
-
action
|
|
5208
|
-
restart();
|
|
5209
|
-
}
|
|
6641
|
+
action: restart
|
|
5210
6642
|
},
|
|
5211
6643
|
{
|
|
5212
6644
|
key: "c",
|
|
@@ -5230,7 +6662,7 @@ function shortcuts(restart) {
|
|
|
5230
6662
|
if (loggedKeys.has(shortcut.key)) continue;
|
|
5231
6663
|
loggedKeys.add(shortcut.key);
|
|
5232
6664
|
if (shortcut.action == null) continue;
|
|
5233
|
-
globalLogger.info(dim` press ` + bold`${shortcut.key} + enter` + dim` to ${shortcut.description}`);
|
|
6665
|
+
globalLogger.info(styleText$1.dim(` press `) + styleText$1.bold(`${shortcut.key} + enter`) + styleText$1.dim(` to ${shortcut.description}`));
|
|
5234
6666
|
}
|
|
5235
6667
|
return;
|
|
5236
6668
|
}
|
|
@@ -5248,14 +6680,27 @@ var build_exports = /* @__PURE__ */ __exportAll({
|
|
|
5248
6680
|
build: () => build$1,
|
|
5249
6681
|
buildWithConfigs: () => buildWithConfigs
|
|
5250
6682
|
});
|
|
5251
|
-
const asyncDispose = Symbol.asyncDispose || Symbol.for("Symbol.asyncDispose");
|
|
5252
6683
|
/**
|
|
5253
6684
|
* Build with tsdown.
|
|
5254
6685
|
*/
|
|
5255
6686
|
async function build$1(inlineConfig = {}) {
|
|
5256
6687
|
globalLogger.level = inlineConfig.logLevel || "info";
|
|
5257
|
-
|
|
5258
|
-
|
|
6688
|
+
let isConfigResolved = false;
|
|
6689
|
+
const { configs, deps } = await resolveConfig(inlineConfig, {
|
|
6690
|
+
restart,
|
|
6691
|
+
close
|
|
6692
|
+
});
|
|
6693
|
+
const handlePromise = buildWithConfigs(configs, deps, () => build$1(inlineConfig));
|
|
6694
|
+
isConfigResolved = true;
|
|
6695
|
+
return await handlePromise;
|
|
6696
|
+
async function restart() {
|
|
6697
|
+
if (!isConfigResolved) throw new Error("`watch.restart` cannot be called before config resolution is complete.");
|
|
6698
|
+
return (await handlePromise).watch.restart();
|
|
6699
|
+
}
|
|
6700
|
+
async function close() {
|
|
6701
|
+
if (!isConfigResolved) throw new Error("`watch.close` cannot be called before config resolution is complete.");
|
|
6702
|
+
return (await handlePromise).watch.close();
|
|
6703
|
+
}
|
|
5259
6704
|
}
|
|
5260
6705
|
/**
|
|
5261
6706
|
* Build with `ResolvedConfigs`.
|
|
@@ -5263,20 +6708,29 @@ async function build$1(inlineConfig = {}) {
|
|
|
5263
6708
|
* **Internal API, not for public use**
|
|
5264
6709
|
* @private
|
|
5265
6710
|
*/
|
|
5266
|
-
async function buildWithConfigs(configs, configDeps,
|
|
6711
|
+
async function buildWithConfigs(configs, configDeps, rebuild) {
|
|
6712
|
+
const hasWatchConfig = configs.some((config) => config.watch);
|
|
5267
6713
|
let cleanPromise;
|
|
5268
6714
|
const clean = () => {
|
|
5269
6715
|
if (cleanPromise) return cleanPromise;
|
|
5270
6716
|
return cleanPromise = cleanOutDir(configs);
|
|
5271
6717
|
};
|
|
5272
6718
|
const disposeCbs = [];
|
|
5273
|
-
let
|
|
5274
|
-
|
|
5275
|
-
if (
|
|
5276
|
-
|
|
6719
|
+
let restarted = false;
|
|
6720
|
+
function assertWatchMode() {
|
|
6721
|
+
if (!hasWatchConfig) throw new Error("`watch` is only available in watch mode.");
|
|
6722
|
+
}
|
|
6723
|
+
async function close() {
|
|
6724
|
+
assertWatchMode();
|
|
5277
6725
|
await Promise.all(disposeCbs.map((cb) => cb()));
|
|
6726
|
+
}
|
|
6727
|
+
async function restart() {
|
|
6728
|
+
assertWatchMode();
|
|
6729
|
+
if (restarted) throw new Error("`watch.restart` can only be called once per handle.");
|
|
6730
|
+
restarted = true;
|
|
6731
|
+
await close();
|
|
5278
6732
|
clearRequireCache();
|
|
5279
|
-
|
|
6733
|
+
return rebuild();
|
|
5280
6734
|
}
|
|
5281
6735
|
const configChunksByPkg = initBundleByPkg(configs);
|
|
5282
6736
|
function done(bundle) {
|
|
@@ -5284,14 +6738,23 @@ async function buildWithConfigs(configs, configDeps, _restart) {
|
|
|
5284
6738
|
}
|
|
5285
6739
|
globalLogger.info("Build start");
|
|
5286
6740
|
const bundles = await Promise.all(configs.map((options) => {
|
|
5287
|
-
return buildSingle(options, configDeps, options.pkg ? configChunksByPkg[options.pkg.packageJsonPath].formats.size > 1 : true, clean,
|
|
6741
|
+
return buildSingle(options, configDeps, options.pkg ? configChunksByPkg[options.pkg.packageJsonPath].formats.size > 1 : true, clean, () => {
|
|
6742
|
+
if (restarted) return;
|
|
6743
|
+
restart().catch((error) => globalLogger.error(error));
|
|
6744
|
+
}, done);
|
|
5288
6745
|
}));
|
|
5289
6746
|
const firstDevtoolsConfig = configs.find((config) => config.devtools && config.devtools.ui);
|
|
5290
|
-
if (
|
|
6747
|
+
if (hasWatchConfig) {
|
|
5291
6748
|
disposeCbs.push(shortcuts(restart));
|
|
5292
|
-
for (const bundle of bundles) disposeCbs.push(bundle[asyncDispose]);
|
|
6749
|
+
for (const bundle of bundles) disposeCbs.push(bundle[Symbol.asyncDispose]);
|
|
5293
6750
|
} else if (firstDevtoolsConfig) startDevtoolsUI(firstDevtoolsConfig.devtools);
|
|
5294
|
-
return
|
|
6751
|
+
return {
|
|
6752
|
+
bundles,
|
|
6753
|
+
watch: {
|
|
6754
|
+
restart,
|
|
6755
|
+
close
|
|
6756
|
+
}
|
|
6757
|
+
};
|
|
5295
6758
|
}
|
|
5296
6759
|
/**
|
|
5297
6760
|
* Build a single configuration, without watch and shortcuts features.
|
|
@@ -5316,7 +6779,7 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
|
|
|
5316
6779
|
chunks,
|
|
5317
6780
|
config,
|
|
5318
6781
|
inlinedDeps: /* @__PURE__ */ new Map(),
|
|
5319
|
-
async [asyncDispose]() {
|
|
6782
|
+
async [Symbol.asyncDispose]() {
|
|
5320
6783
|
debouncedPostBuild.cancel();
|
|
5321
6784
|
ab?.abort();
|
|
5322
6785
|
await watcher?.close();
|
|
@@ -5325,17 +6788,18 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
|
|
|
5325
6788
|
const configs = await initBuildOptions();
|
|
5326
6789
|
if (watch$1) {
|
|
5327
6790
|
watcher = watch(configs);
|
|
5328
|
-
handleWatcher(watcher);
|
|
6791
|
+
await handleWatcher(watcher);
|
|
5329
6792
|
} else {
|
|
5330
6793
|
const outputs = await config.runBuild(() => build(configs));
|
|
5331
6794
|
for (const { output } of outputs) chunks.push(...addOutDirToChunks(output, outDir));
|
|
5332
6795
|
}
|
|
5333
6796
|
if (!watch$1) {
|
|
5334
|
-
logger.success(config.nameLabel, `Build complete in ${green(`${Math.round(performance.now() - startTime)}ms`)}`);
|
|
6797
|
+
logger.success(config.nameLabel, `Build complete in ${styleText$1.green(`${Math.round(performance.now() - startTime)}ms`)}`);
|
|
5335
6798
|
await postBuild();
|
|
5336
6799
|
}
|
|
5337
6800
|
return bundle;
|
|
5338
6801
|
function handleWatcher(watcher) {
|
|
6802
|
+
const ready = Promise.withResolvers();
|
|
5339
6803
|
const changedFile = [];
|
|
5340
6804
|
let hasError = false;
|
|
5341
6805
|
watcher.on("change", async (id, event) => {
|
|
@@ -5363,6 +6827,7 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
|
|
|
5363
6827
|
if (config.clean.length) await cleanChunks(config.outDir, chunks);
|
|
5364
6828
|
chunks.length = 0;
|
|
5365
6829
|
hasError = false;
|
|
6830
|
+
ready.resolve();
|
|
5366
6831
|
break;
|
|
5367
6832
|
case "END":
|
|
5368
6833
|
if (!hasError) debouncedPostBuild();
|
|
@@ -5370,7 +6835,7 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
|
|
|
5370
6835
|
case "BUNDLE_START":
|
|
5371
6836
|
if (changedFile.length) {
|
|
5372
6837
|
logger.clearScreen("info");
|
|
5373
|
-
logger.info(`Found ${bold(changedFile.join(", "))} changed, rebuilding...`);
|
|
6838
|
+
logger.info(`Found ${styleText$1.bold(changedFile.join(", "))} changed, rebuilding...`);
|
|
5374
6839
|
}
|
|
5375
6840
|
changedFile.length = 0;
|
|
5376
6841
|
break;
|
|
@@ -5384,6 +6849,7 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
|
|
|
5384
6849
|
hasError = true;
|
|
5385
6850
|
}
|
|
5386
6851
|
});
|
|
6852
|
+
return ready.promise;
|
|
5387
6853
|
}
|
|
5388
6854
|
async function initBuildOptions() {
|
|
5389
6855
|
const buildOptions = await getBuildOptions(config, format, configDeps, bundle, false, isDualFormat);
|
|
@@ -5393,7 +6859,7 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
|
|
|
5393
6859
|
});
|
|
5394
6860
|
if (debugRolldownConfigDir) await debugBuildOptions(debugRolldownConfigDir, config.name, format, buildOptions);
|
|
5395
6861
|
const configs = [buildOptions];
|
|
5396
|
-
if (format === "cjs" && dts
|
|
6862
|
+
if (format === "cjs" && dts) configs.push(await getBuildOptions(config, format, configDeps, bundle, true, isDualFormat));
|
|
5397
6863
|
return configs;
|
|
5398
6864
|
}
|
|
5399
6865
|
async function postBuild() {
|
|
@@ -5410,4 +6876,4 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
|
|
|
5410
6876
|
}
|
|
5411
6877
|
}
|
|
5412
6878
|
//#endregion
|
|
5413
|
-
export { resolveUserConfig as a, mergeConfig as i, buildWithConfigs as n,
|
|
6879
|
+
export { resolveUserConfig as a, mergeConfig as i, buildWithConfigs as n, mt as o, build_JVmLFaZt_exports as r, te as s, build$1 as t };
|