@voidzero-dev/vite-plus-core 0.3.0 → 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.
Files changed (62) hide show
  1. package/dist/rolldown/cli.mjs +6 -6
  2. package/dist/rolldown/config.d.mts +1 -1
  3. package/dist/rolldown/config.mjs +2 -2
  4. package/dist/rolldown/experimental-index.d.mts +33 -4
  5. package/dist/rolldown/experimental-index.mjs +33 -8
  6. package/dist/rolldown/experimental-runtime-types.d.ts +2 -2
  7. package/dist/rolldown/experimental-runtime.d.ts +2 -2
  8. package/dist/rolldown/experimental-runtime.mjs +2 -2
  9. package/dist/rolldown/filter-index.d.mts +1 -1
  10. package/dist/rolldown/filter-index.mjs +1 -3
  11. package/dist/rolldown/index.d.mts +3 -3
  12. package/dist/rolldown/index.mjs +4 -4
  13. package/dist/rolldown/parallel-plugin-worker.mjs +2 -2
  14. package/dist/rolldown/parallel-plugin.d.mts +1 -1
  15. package/dist/rolldown/parse-ast-index.d.mts +1 -1
  16. package/dist/rolldown/parse-ast-index.mjs +1 -1
  17. package/dist/rolldown/plugins-index.d.mts +3 -3
  18. package/dist/rolldown/plugins-index.mjs +2 -2
  19. package/dist/rolldown/shared/{binding-Bvw14S3g.d.mts → binding-DZuNHVw4.d.mts} +19 -5
  20. package/dist/rolldown/shared/{binding-C__LJDBG.mjs → binding-DmImI4pj.mjs} +27 -27
  21. package/dist/rolldown/shared/{bindingify-input-options-V9YvAjrr.mjs → bindingify-input-options-BYClWKnj.mjs} +11 -9
  22. package/dist/rolldown/shared/{constructors-CRumnw21.d.mts → constructors-BM20b11r.d.mts} +2 -2
  23. package/dist/rolldown/shared/{constructors-DklcHr18.mjs → constructors-mRbcbLyX.mjs} +1 -1
  24. package/dist/rolldown/shared/{create-bundler-option-DbV2ud0B.mjs → create-bundler-option-CHTBktos.mjs} +47 -5
  25. package/dist/rolldown/shared/{define-config-DwTNhgWB.d.mts → define-config-DNX0WekP.d.mts} +36 -3
  26. package/dist/rolldown/shared/{error-NcRuXAVN.mjs → error-BP8lJHle.mjs} +1 -1
  27. package/dist/rolldown/shared/{load-config-Dd7jKGUy.mjs → load-config-Cx5fx_8Q.mjs} +1 -1
  28. package/dist/rolldown/shared/{normalize-string-or-regex-CFtim40S.mjs → normalize-string-or-regex-Dm69lpQ-.mjs} +1 -1
  29. package/dist/rolldown/shared/{parse-rvxTD36n.mjs → parse-8sr82jSR.mjs} +2 -2
  30. package/dist/rolldown/shared/{resolve-tsconfig-D2vSIIkR.mjs → resolve-tsconfig-BlNGaH3Y.mjs} +10 -6
  31. package/dist/rolldown/shared/{rolldown-Bblizyw1.mjs → rolldown-CaX_Wmqc.mjs} +5 -4
  32. package/dist/rolldown/shared/{transform--WSMLt1x.d.mts → transform-CVse9_mH.d.mts} +8 -4
  33. package/dist/rolldown/shared/{watch-DPvOlccK.mjs → watch-YKfJgIxz.mjs} +4 -4
  34. package/dist/rolldown/utils-index.d.mts +3 -3
  35. package/dist/rolldown/utils-index.mjs +5 -5
  36. package/dist/tsdown/{build-D_enfyvD-tOzhITac.js → build-JVmLFaZt-kqQJ2U7s.js} +1101 -687
  37. package/dist/tsdown/debug-CpC4hV25-tvH_Dsg5.js +247 -0
  38. package/dist/tsdown/{detect-DGhJGEqb-LL52mV6u.js → detect-Bg-d8iUV-KfbO7neP.js} +10 -12
  39. package/dist/tsdown/{dist-BsS7BOcb.js → dist-Cuw3Ngo4.js} +1226 -893
  40. package/dist/tsdown/index-types.d.ts +277 -355
  41. package/dist/tsdown/index.js +4 -4
  42. package/dist/tsdown/internal-D-JfB5uT.js +29 -0
  43. package/dist/tsdown/internal-lhH-5yya.js +62 -0
  44. package/dist/tsdown/{main-Bcv7jU2b.js → main-CyNcZUzu.js} +8 -214
  45. package/dist/tsdown/{resolver-cwLsPb2o-Bb9SDBm6.js → resolver-DE0_sy8o-ZQqHQjRu.js} +4 -4
  46. package/dist/tsdown/rolldown-runtime-B4iAMlE-.js +35 -0
  47. package/dist/tsdown/run.js +44 -8
  48. package/dist/tsdown/{src-JVSpR8xt.js → src-BWidcM5N.js} +1 -1
  49. package/dist/tsdown/{tsc-B8FD48Oc.js → tsc-ChjRhsoQ.js} +26 -20
  50. package/dist/tsdown/tsdown-css.js +17 -11
  51. package/dist/tsdown/tsdown-exe.js +16 -5
  52. package/dist/tsdown/version-CQ98ZBpL-Obdnv4J7.js +141 -0
  53. package/dist/vite/client/bundledDevClient.mjs +6 -6
  54. package/dist/vite/client/client.mjs +4 -4
  55. package/dist/vite/node/chunks/build.js +2 -2
  56. package/dist/vite/node/chunks/lib.js +2 -2
  57. package/dist/vite/node/chunks/node.js +42 -31
  58. package/dist/vite/node/module-runner.js +3 -3
  59. package/package.json +25 -25
  60. package/dist/tsdown/debug-CKcBYQLP-By_AQqN8.js +0 -157
  61. package/dist/tsdown/internal-DSmmwu4u.js +0 -3
  62. package/dist/tsdown/target-Bab3CUeB-8PBzMh3p.js +0 -582
@@ -1,33 +1,83 @@
1
- import { A as __toESM, C as resolveComma, D as __commonJSMin, E as toArray, O as __exportAll$1, S as pkgExists, T as slash, _ as createConcurrencyExecutor, b as matchPattern, c as blue, d as green, g as yellow, h as underline, l as bold, n as x$1, r as createDebug, t as exec, u as dim, v as debounce, w as resolveRegex, x as noop, y as importWithError } from "./main-Bcv7jU2b.js";
2
- import { a as createSuppressWarnings, c as globalLogger, i as createLogger, l as prettyFormat, n as version, o as generateColor, r as LogLevels, s as getNameLabel } from "./debug-CKcBYQLP-By_AQqN8.js";
3
- import { A as fsStat, D as fsCopy, E as formatBytes, M as stripExtname, O as fsExists, S as filename_js_to_dts, a as resolveTarget, d as satisfies, g as RE_JS, j as lowestCommonAncestor, k as fsRemove, m as RE_DTS, o as validateSea, p as RE_CSS, r as buildExe, s as coerce, u as parseRange, v as RE_NODE_MODULES$1 } from "./target-Bab3CUeB-8PBzMh3p.js";
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";
4
6
  import module$1, { builtinModules, createRequire, isBuiltin } from "node:module";
5
7
  import process$1 from "node:process";
6
- import readline from "node:readline";
7
8
  import { formatWithOptions, inspect, isDeepStrictEqual, parseEnv, promisify } from "node:util";
9
+ import readline from "node:readline";
8
10
  import path, { dirname, isAbsolute, join, parse, resolve } from "node:path";
9
- import re, { existsSync, readFileSync, writeFileSync } from "node:fs";
11
+ import { fileURLToPath, pathToFileURL } from "node:url";
12
+ import X, { existsSync, readFileSync, writeFileSync } from "node:fs";
10
13
  import { VERSION, build, watch } from "@voidzero-dev/vite-plus-core/rolldown";
11
- 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";
12
15
  import { and, id, importerId, include } from "@voidzero-dev/vite-plus-core/rolldown/filter";
13
16
  import * as nativeFs from "fs";
14
17
  import Ue, { readdir as readdir$1, readdirSync, realpath, realpathSync, stat as stat$1, statSync as statSync$1 } from "fs";
15
- import Ie from "os";
16
- import Se, { 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";
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";
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
26
76
  //#region ../../node_modules/.pnpm/resolve-pkg-maps@1.0.0/node_modules/resolve-pkg-maps/dist/index.mjs
27
77
  const A = (r) => r !== null && typeof r == "object";
28
78
  const a = (r, t) => Object.assign(/* @__PURE__ */ new Error(`[${r}]: ${t}`), { code: r });
29
79
  const _$1 = "ERR_INVALID_PACKAGE_CONFIG";
30
- const E = "ERR_INVALID_PACKAGE_TARGET";
80
+ const E$1 = "ERR_INVALID_PACKAGE_TARGET";
31
81
  const I$1 = "ERR_PACKAGE_PATH_NOT_EXPORTED";
32
82
  const R$1 = /^\d+$/;
33
83
  const O = /^(\.{1,2}|node_modules)$/i;
@@ -37,7 +87,7 @@ const f = (r, t, e, o, c) => {
37
87
  if (t == null) return [];
38
88
  if (typeof t == "string") {
39
89
  const [n, ...i] = t.split(w);
40
- if (n === ".." || i.some((l) => O.test(l))) throw a(E, `Invalid "${r}" target "${t}" defined in the package config`);
90
+ if (n === ".." || i.some((l) => O.test(l))) throw a(E$1, `Invalid "${r}" target "${t}" defined in the package config`);
41
91
  return [c ? t.replace(/\*/g, c) : t];
42
92
  }
43
93
  if (Array.isArray(t)) return t.flatMap((n) => f(r, n, e, o, c));
@@ -48,7 +98,7 @@ const f = (r, t, e, o, c) => {
48
98
  }
49
99
  return [];
50
100
  }
51
- throw a(E, `Invalid "${r}" target "${t}"`);
101
+ throw a(E$1, `Invalid "${r}" target "${t}"`);
52
102
  };
53
103
  const s = "*";
54
104
  const m = (r, t) => {
@@ -78,31 +128,36 @@ const v = (r, t, e) => {
78
128
  t = t === "" ? "." : `./${t}`, (typeof r == "string" || Array.isArray(r) || A(r) && p(r)) && (r = { ".": r });
79
129
  const [o, c] = d(r, t), n = f(h.Export, r[o], t, e, c);
80
130
  if (n.length === 0) throw a(I$1, t === "." ? "No \"exports\" main defined" : `Package subpath '${t}' is not defined by "exports"`);
81
- for (const i of n) if (!i.startsWith("./") && !u.test(i)) throw a(E, `Invalid "exports" target "${i}" defined in the package config`);
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`);
82
132
  return n;
83
133
  };
84
134
  //#endregion
85
- //#region ../../node_modules/.pnpm/get-tsconfig@5.0.0-beta.5/node_modules/get-tsconfig/dist/index.mjs
135
+ //#region ../../node_modules/.pnpm/get-tsconfig@5.0.0-beta.6/node_modules/get-tsconfig/dist/index.mjs
86
136
  var Le = Object.defineProperty;
87
137
  var i = (e, n) => Le(e, "name", {
88
138
  value: n,
89
139
  configurable: !0
90
140
  });
91
- function x(e) {
141
+ function E(e) {
92
142
  return e.startsWith("\\\\?\\") ? e : e.replace(/\\/g, "/");
93
143
  }
94
- i(x, "slash");
144
+ i(E, "slash");
95
145
  const _e = i((e, n) => {
96
146
  const s = `readFileSync:${n}`;
97
147
  let t = e?.get(s);
98
- return t === void 0 && (t = re.readFileSync(n, "utf8"), e?.set(s, t)), t;
148
+ return t === void 0 && (t = X.readFileSync(n, "utf8"), e?.set(s, t)), t;
99
149
  }, "readFile");
100
- const F = i((e, n) => {
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) => {
101
156
  const s = `tryStat:${n}`;
102
157
  let t = e?.get(s);
103
158
  if (t === void 0) {
104
159
  try {
105
- t = re.statSync(n);
160
+ t = X.statSync(n);
106
161
  } catch {
107
162
  t = null;
108
163
  }
@@ -113,148 +168,148 @@ const F = i((e, n) => {
113
168
  const R = i((e, n, s) => {
114
169
  for (;;) {
115
170
  const t = path.posix.join(e, n);
116
- if (F(s, t)) return t;
171
+ if ($(s, t)) return t;
117
172
  const o = path.dirname(e);
118
173
  if (o === e) return;
119
174
  e = o;
120
175
  }
121
176
  }, "findUp");
122
- function Ne(e, n = !1) {
177
+ function Re(e, n = !1) {
123
178
  const s = e.length;
124
- let t = 0, o = "", r = 0, l = 16, g = 0, m = 0, k = 0, w = 0, u = 0;
125
- function A(f, y) {
126
- let j = 0, v = 0;
127
- for (; j < f;) {
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;) {
128
183
  let d = e.charCodeAt(t);
129
- if (d >= 48 && d <= 57) v = v * 16 + d - 48;
130
- else if (d >= 65 && d <= 70) v = v * 16 + d - 65 + 10;
131
- else if (d >= 97 && d <= 102) v = v * 16 + d - 97 + 10;
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;
132
187
  else break;
133
- t++, j++;
188
+ t++, A++;
134
189
  }
135
- return j < f && (v = -1), v;
190
+ return A < l && (b = -1), b;
136
191
  }
137
- i(A, "scanHexDigits");
138
- function O(f) {
139
- t = f, o = "", r = 0, l = 16, u = 0;
192
+ i(O, "scanHexDigits");
193
+ function j(l) {
194
+ t = l, o = "", r = 0, c = 16, f = 0;
140
195
  }
141
- i(O, "setPosition");
142
- function h() {
143
- let f = t;
196
+ i(j, "setPosition");
197
+ function y() {
198
+ let l = t;
144
199
  if (e.charCodeAt(t) === 48) t++;
145
- else for (t++; t < e.length && S(e.charCodeAt(t));) t++;
146
- if (t < e.length && e.charCodeAt(t) === 46) if (t++, t < e.length && S(e.charCodeAt(t))) for (t++; t < e.length && S(e.charCodeAt(t));) t++;
147
- else return u = 3, e.substring(f, t);
148
- let y = t;
149
- if (t < e.length && (e.charCodeAt(t) === 69 || e.charCodeAt(t) === 101)) if (t++, (t < e.length && e.charCodeAt(t) === 43 || e.charCodeAt(t) === 45) && t++, t < e.length && S(e.charCodeAt(t))) {
150
- for (t++; t < e.length && S(e.charCodeAt(t));) t++;
151
- y = t;
152
- } else u = 3;
153
- return e.substring(f, y);
154
- }
155
- i(h, "scanNumber");
156
- function D() {
157
- let f = "", y = 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;
158
213
  for (;;) {
159
214
  if (t >= s) {
160
- f += e.substring(y, t), u = 2;
215
+ l += e.substring(T, t), f = 2;
161
216
  break;
162
217
  }
163
- const j = e.charCodeAt(t);
164
- if (j === 34) {
165
- f += e.substring(y, t), t++;
218
+ const A = e.charCodeAt(t);
219
+ if (A === 34) {
220
+ l += e.substring(T, t), t++;
166
221
  break;
167
222
  }
168
- if (j === 92) {
169
- if (f += e.substring(y, t), t++, t >= s) {
170
- u = 2;
223
+ if (A === 92) {
224
+ if (l += e.substring(T, t), t++, t >= s) {
225
+ f = 2;
171
226
  break;
172
227
  }
173
228
  switch (e.charCodeAt(t++)) {
174
229
  case 34:
175
- f += "\"";
230
+ l += "\"";
176
231
  break;
177
232
  case 92:
178
- f += "\\";
233
+ l += "\\";
179
234
  break;
180
235
  case 47:
181
- f += "/";
236
+ l += "/";
182
237
  break;
183
238
  case 98:
184
- f += "\b";
239
+ l += "\b";
185
240
  break;
186
241
  case 102:
187
- f += "\f";
242
+ l += "\f";
188
243
  break;
189
244
  case 110:
190
- f += `
245
+ l += `
191
246
  `;
192
247
  break;
193
248
  case 114:
194
- f += "\r";
249
+ l += "\r";
195
250
  break;
196
251
  case 116:
197
- f += " ";
252
+ l += " ";
198
253
  break;
199
254
  case 117:
200
- const d = A(4);
201
- d >= 0 ? f += String.fromCharCode(d) : u = 4;
255
+ const d = O(4);
256
+ d >= 0 ? l += String.fromCharCode(d) : f = 4;
202
257
  break;
203
- default: u = 5;
258
+ default: f = 5;
204
259
  }
205
- y = t;
260
+ T = t;
206
261
  continue;
207
262
  }
208
- if (j >= 0 && j <= 31) if (P(j)) {
209
- f += e.substring(y, t), u = 2;
263
+ if (A >= 0 && A <= 31) if (P(A)) {
264
+ l += e.substring(T, t), f = 2;
210
265
  break;
211
- } else u = 6;
266
+ } else f = 6;
212
267
  t++;
213
268
  }
214
- return f;
269
+ return l;
215
270
  }
216
- i(D, "scanString");
217
- function c() {
218
- if (o = "", u = 0, r = t, m = g, w = k, t >= s) return r = s, l = 17;
219
- let f = e.charCodeAt(t);
220
- if (X(f)) {
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)) {
221
276
  do
222
- t++, o += String.fromCharCode(f), f = e.charCodeAt(t);
223
- while (X(f));
224
- return l = 15;
277
+ t++, o += String.fromCharCode(l), l = e.charCodeAt(t);
278
+ while (Y(l));
279
+ return c = 15;
225
280
  }
226
- if (P(f)) return t++, o += String.fromCharCode(f), f === 13 && e.charCodeAt(t) === 10 && (t++, o += `
227
- `), g++, k = t, l = 14;
228
- switch (f) {
229
- case 123: return t++, l = 1;
230
- case 125: return t++, l = 2;
231
- case 91: return t++, l = 3;
232
- case 93: return t++, l = 4;
233
- case 58: return t++, l = 6;
234
- case 44: return t++, l = 5;
235
- case 34: return t++, o = D(), l = 10;
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;
236
291
  case 47:
237
- const y = t - 1;
292
+ const T = t - 1;
238
293
  if (e.charCodeAt(t + 1) === 47) {
239
294
  for (t += 2; t < s && !P(e.charCodeAt(t));) t++;
240
- return o = e.substring(y, t), l = 12;
295
+ return o = e.substring(T, t), c = 12;
241
296
  }
242
297
  if (e.charCodeAt(t + 1) === 42) {
243
298
  t += 2;
244
- const j = s - 1;
245
- let v = !1;
246
- for (; t < j;) {
299
+ const A = s - 1;
300
+ let b = !1;
301
+ for (; t < A;) {
247
302
  const d = e.charCodeAt(t);
248
303
  if (d === 42 && e.charCodeAt(t + 1) === 47) {
249
- t += 2, v = !0;
304
+ t += 2, b = !0;
250
305
  break;
251
306
  }
252
307
  t++, P(d) && (d === 13 && e.charCodeAt(t) === 10 && t++, g++, k = t);
253
308
  }
254
- return v || (t++, u = 1), o = e.substring(y, t), l = 13;
309
+ return b || (t++, f = 1), o = e.substring(T, t), c = 13;
255
310
  }
256
- return o += String.fromCharCode(f), t++, l = 16;
257
- case 45: if (o += String.fromCharCode(f), t++, t === s || !S(e.charCodeAt(t))) return l = 16;
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;
258
313
  case 48:
259
314
  case 49:
260
315
  case 50:
@@ -264,24 +319,24 @@ function Ne(e, n = !1) {
264
319
  case 54:
265
320
  case 55:
266
321
  case 56:
267
- case 57: return o += h(), l = 11;
322
+ case 57: return o += y(), c = 11;
268
323
  default:
269
- for (; t < s && p(f);) t++, f = e.charCodeAt(t);
324
+ for (; t < s && u(l);) t++, l = e.charCodeAt(t);
270
325
  if (r !== t) {
271
326
  switch (o = e.substring(r, t), o) {
272
- case "true": return l = 8;
273
- case "false": return l = 9;
274
- case "null": return l = 7;
327
+ case "true": return c = 8;
328
+ case "false": return c = 9;
329
+ case "null": return c = 7;
275
330
  }
276
- return l = 16;
331
+ return c = 16;
277
332
  }
278
- return o += String.fromCharCode(f), t++, l = 16;
333
+ return o += String.fromCharCode(l), t++, c = 16;
279
334
  }
280
335
  }
281
- i(c, "scanNext");
282
- function p(f) {
283
- if (X(f) || P(f)) return !1;
284
- switch (f) {
336
+ i(p, "scanNext");
337
+ function u(l) {
338
+ if (Y(l) || P(l)) return !1;
339
+ switch (l) {
285
340
  case 125:
286
341
  case 93:
287
342
  case 123:
@@ -293,40 +348,40 @@ function Ne(e, n = !1) {
293
348
  }
294
349
  return !0;
295
350
  }
296
- i(p, "isUnknownContentCharacter");
297
- function b() {
298
- let f;
351
+ i(u, "isUnknownContentCharacter");
352
+ function w() {
353
+ let l;
299
354
  do
300
- f = c();
301
- while (f >= 12 && f <= 15);
302
- return f;
355
+ l = p();
356
+ while (l >= 12 && l <= 15);
357
+ return l;
303
358
  }
304
- return i(b, "scanNextNonTrivia"), {
305
- setPosition: O,
359
+ return i(w, "scanNextNonTrivia"), {
360
+ setPosition: j,
306
361
  getPosition: i(() => t, "getPosition"),
307
- scan: n ? b : c,
308
- getToken: i(() => l, "getToken"),
362
+ scan: n ? w : p,
363
+ getToken: i(() => c, "getToken"),
309
364
  getTokenValue: i(() => o, "getTokenValue"),
310
365
  getTokenOffset: i(() => r, "getTokenOffset"),
311
366
  getTokenLength: i(() => t - r, "getTokenLength"),
312
367
  getTokenStartLine: i(() => m, "getTokenStartLine"),
313
- getTokenStartCharacter: i(() => r - w, "getTokenStartCharacter"),
314
- getTokenError: i(() => u, "getTokenError")
368
+ getTokenStartCharacter: i(() => r - v, "getTokenStartCharacter"),
369
+ getTokenError: i(() => f, "getTokenError")
315
370
  };
316
371
  }
317
- i(Ne, "createScanner");
318
- function X(e) {
372
+ i(Re, "createScanner");
373
+ function Y(e) {
319
374
  return e === 32 || e === 9;
320
375
  }
321
- i(X, "isWhiteSpace");
376
+ i(Y, "isWhiteSpace");
322
377
  function P(e) {
323
378
  return e === 10 || e === 13;
324
379
  }
325
380
  i(P, "isLineBreak");
326
- function S(e) {
381
+ function I(e) {
327
382
  return e >= 48 && e <= 57;
328
383
  }
329
- i(S, "isDigit");
384
+ i(I, "isDigit");
330
385
  var ce;
331
386
  (function(e) {
332
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";
@@ -341,16 +396,16 @@ var W;
341
396
  (function(e) {
342
397
  e.DEFAULT = { allowTrailingComma: !1 };
343
398
  })(W || (W = {}));
344
- function Re(e, n = [], s = W.DEFAULT) {
399
+ function Pe(e, n = [], s = W.DEFAULT) {
345
400
  let t = null, o = [];
346
401
  const r = [];
347
- function l(m) {
402
+ function c(m) {
348
403
  Array.isArray(o) ? o.push(m) : t !== null && (o[t] = m);
349
404
  }
350
- return i(l, "onValue"), Pe(e, {
405
+ return i(c, "onValue"), Ve(e, {
351
406
  onObjectBegin: i(() => {
352
407
  const m = {};
353
- l(m), r.push(o), o = m, t = null;
408
+ c(m), r.push(o), o = m, t = null;
354
409
  }, "onObjectBegin"),
355
410
  onObjectProperty: i((m) => {
356
411
  t = m;
@@ -360,53 +415,53 @@ function Re(e, n = [], s = W.DEFAULT) {
360
415
  }, "onObjectEnd"),
361
416
  onArrayBegin: i(() => {
362
417
  const m = [];
363
- l(m), r.push(o), o = m, t = null;
418
+ c(m), r.push(o), o = m, t = null;
364
419
  }, "onArrayBegin"),
365
420
  onArrayEnd: i(() => {
366
421
  o = r.pop();
367
422
  }, "onArrayEnd"),
368
- onLiteralValue: l,
369
- onError: i((m, k, w) => {
423
+ onLiteralValue: c,
424
+ onError: i((m, k, v) => {
370
425
  n.push({
371
426
  error: m,
372
427
  offset: k,
373
- length: w
428
+ length: v
374
429
  });
375
430
  }, "onError")
376
431
  }, s), o[0];
377
432
  }
378
- i(Re, "parse$1");
379
- function Pe(e, n, s = W.DEFAULT) {
380
- const t = Ne(e, !1), o = [];
433
+ i(Pe, "parse$1");
434
+ function Ve(e, n, s = W.DEFAULT) {
435
+ const t = Re(e, !1), o = [];
381
436
  let r = 0;
382
- function l(T) {
383
- return T ? () => r === 0 && T(t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter()) : () => !0;
437
+ function c(h) {
438
+ return h ? () => r === 0 && h(t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter()) : () => !0;
384
439
  }
385
- i(l, "toNoArgVisit");
386
- function g(T) {
387
- return T ? (E) => r === 0 && T(E, t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter()) : () => !0;
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;
388
443
  }
389
444
  i(g, "toOneArgVisit");
390
- function m(T) {
391
- return T ? (E) => r === 0 && T(E, t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter(), () => o.slice()) : () => !0;
445
+ function m(h) {
446
+ return h ? (D) => r === 0 && h(D, t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter(), () => o.slice()) : () => !0;
392
447
  }
393
448
  i(m, "toOneArgVisitWithPath");
394
- function k(T) {
395
- return T ? () => {
396
- r > 0 ? r++ : T(t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter(), () => o.slice()) === !1 && (r = 1);
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);
397
452
  } : () => !0;
398
453
  }
399
454
  i(k, "toBeginVisit");
400
- function w(T) {
401
- return T ? () => {
402
- r > 0 && r--, r === 0 && T(t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter());
455
+ function v(h) {
456
+ return h ? () => {
457
+ r > 0 && r--, r === 0 && h(t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter());
403
458
  } : () => !0;
404
459
  }
405
- i(w, "toEndVisit");
406
- const u = k(n.onObjectBegin), A = m(n.onObjectProperty), O = w(n.onObjectEnd), h = k(n.onArrayBegin), D = w(n.onArrayEnd), c = m(n.onLiteralValue), p = g(n.onSeparator), b = l(n.onComment), f = g(n.onError), y = s && s.disallowComments, j = s && s.allowTrailingComma;
407
- function v() {
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() {
408
463
  for (;;) {
409
- const T = t.scan();
464
+ const h = t.scan();
410
465
  switch (t.getTokenError()) {
411
466
  case 4:
412
467
  d(14);
@@ -418,106 +473,106 @@ function Pe(e, n, s = W.DEFAULT) {
418
473
  d(13);
419
474
  break;
420
475
  case 1:
421
- y || d(11);
476
+ T || d(11);
422
477
  break;
423
478
  case 2:
424
479
  d(12);
425
480
  break;
426
481
  case 6: d(16);
427
482
  }
428
- switch (T) {
483
+ switch (h) {
429
484
  case 12:
430
485
  case 13:
431
- y ? d(10) : b();
486
+ T ? d(10) : w();
432
487
  break;
433
488
  case 16:
434
489
  d(1);
435
490
  break;
436
491
  case 15:
437
492
  case 14: break;
438
- default: return T;
493
+ default: return h;
439
494
  }
440
495
  }
441
496
  }
442
- i(v, "scanNext");
443
- function d(T, E = [], ie = []) {
444
- if (f(T), E.length + ie.length > 0) {
497
+ i(b, "scanNext");
498
+ function d(h, D = [], re = []) {
499
+ if (l(h), D.length + re.length > 0) {
445
500
  let V = t.getToken();
446
501
  for (; V !== 17;) {
447
- if (E.indexOf(V) !== -1) {
448
- v();
502
+ if (D.indexOf(V) !== -1) {
503
+ b();
449
504
  break;
450
- } else if (ie.indexOf(V) !== -1) break;
451
- V = v();
505
+ } else if (re.indexOf(V) !== -1) break;
506
+ V = b();
452
507
  }
453
508
  }
454
509
  }
455
510
  i(d, "handleError");
456
- function L(T) {
457
- const E = t.getTokenValue();
458
- return T ? c(E) : (A(E), o.push(E)), v(), !0;
511
+ function L(h) {
512
+ const D = t.getTokenValue();
513
+ return h ? p(D) : (O(D), o.push(D)), b(), !0;
459
514
  }
460
515
  i(L, "parseString");
461
516
  function B() {
462
517
  switch (t.getToken()) {
463
518
  case 11:
464
- const T = t.getTokenValue();
465
- let E = Number(T);
466
- isNaN(E) && (d(2), E = 0), c(E);
519
+ const h = t.getTokenValue();
520
+ let D = Number(h);
521
+ isNaN(D) && (d(2), D = 0), p(D);
467
522
  break;
468
523
  case 7:
469
- c(null);
524
+ p(null);
470
525
  break;
471
526
  case 8:
472
- c(!0);
527
+ p(!0);
473
528
  break;
474
529
  case 9:
475
- c(!1);
530
+ p(!1);
476
531
  break;
477
532
  default: return !1;
478
533
  }
479
- return v(), !0;
534
+ return b(), !0;
480
535
  }
481
536
  i(B, "parseLiteral");
482
- function $() {
483
- return t.getToken() !== 10 ? (d(3, [], [2, 5]), !1) : (L(!1), t.getToken() === 6 ? (p(":"), v(), H() || d(4, [], [2, 5])) : d(5, [], [2, 5]), o.pop(), !0);
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);
484
539
  }
485
- i($, "parseProperty");
540
+ i(F, "parseProperty");
486
541
  function N() {
487
- u(), v();
488
- let T = !1;
542
+ f(), b();
543
+ let h = !1;
489
544
  for (; t.getToken() !== 2 && t.getToken() !== 17;) {
490
545
  if (t.getToken() === 5) {
491
- if (T || d(4, [], []), p(","), v(), t.getToken() === 2 && j) break;
492
- } else T && d(6, [], []);
493
- $() || d(4, [], [2, 5]), T = !0;
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;
494
549
  }
495
- return O(), t.getToken() !== 2 ? d(7, [2], []) : v(), !0;
550
+ return j(), t.getToken() !== 2 ? d(7, [2], []) : b(), !0;
496
551
  }
497
552
  i(N, "parseObject");
498
- function $e() {
499
- h(), v();
500
- let T = !0, E = !1;
553
+ function Fe() {
554
+ y(), b();
555
+ let h = !0, D = !1;
501
556
  for (; t.getToken() !== 4 && t.getToken() !== 17;) {
502
557
  if (t.getToken() === 5) {
503
- if (E || d(4, [], []), p(","), v(), t.getToken() === 4 && j) break;
504
- } else E && d(6, [], []);
505
- T ? (o.push(0), T = !1) : o[o.length - 1]++, H() || d(4, [], [4, 5]), E = !0;
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;
506
561
  }
507
- return D(), T || o.pop(), t.getToken() !== 4 ? d(8, [4], []) : v(), !0;
562
+ return x(), h || o.pop(), t.getToken() !== 4 ? d(8, [4], []) : b(), !0;
508
563
  }
509
- i($e, "parseArray");
564
+ i(Fe, "parseArray");
510
565
  function H() {
511
566
  switch (t.getToken()) {
512
- case 3: return $e();
567
+ case 3: return Fe();
513
568
  case 1: return N();
514
569
  case 10: return L(!0);
515
570
  default: return B();
516
571
  }
517
572
  }
518
- return i(H, "parseValue"), v(), t.getToken() === 17 ? s.allowEmptyContent ? !0 : (d(4, [], []), !1) : H() ? (t.getToken() !== 17 && d(9, [], []), !0) : (d(4, [], []), !1);
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);
519
574
  }
520
- i(Pe, "visit");
575
+ i(Ve, "visit");
521
576
  var fe;
522
577
  (function(e) {
523
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";
@@ -526,19 +581,19 @@ var ue;
526
581
  (function(e) {
527
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";
528
583
  })(ue || (ue = {}));
529
- const Ve = Re;
584
+ const We = Pe;
530
585
  var ae;
531
586
  (function(e) {
532
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";
533
588
  })(ae || (ae = {}));
534
- const Y = i((e, n) => Ve(_e(n, e)), "readJsonc");
589
+ const Z = i((e, n) => We(_e(n, e)), "readJsonc");
535
590
  const pe = i(() => {
536
591
  const { findPnpApi: e } = module$1;
537
592
  return e && e(process.cwd());
538
593
  }, "getPnpApi");
539
- const We = "detectTypeScriptVersion:";
540
- const Me = i((e, n) => {
541
- const s = `${We}${e}`, t = n?.get(s);
594
+ const Me = "detectTypeScriptVersion:";
595
+ const Je = i((e, n) => {
596
+ const s = `${Me}${e}`, t = n?.get(s);
542
597
  if (t !== void 0) return t ?? void 0;
543
598
  let o;
544
599
  const r = pe();
@@ -546,16 +601,16 @@ const Me = i((e, n) => {
546
601
  o = r.resolveRequest("typescript/package.json", e) ?? void 0;
547
602
  } catch {}
548
603
  o ??= R(path.resolve(e), path.join("node_modules", "typescript", "package.json"), n);
549
- let l;
604
+ let c;
550
605
  if (o) try {
551
- const g = Y(o, n);
552
- typeof g?.version == "string" && (l = g.version);
606
+ const g = Z(o, n);
607
+ typeof g?.version == "string" && (c = g.version);
553
608
  } catch {}
554
- return n?.set(s, l ?? null), l;
609
+ return n?.set(s, c ?? null), c;
555
610
  }, "detectTypeScriptVersion");
556
- const I = "package.json";
611
+ const S = "package.json";
557
612
  const M = "tsconfig.json";
558
- const Je = i((e, n, s) => {
613
+ const ze = i((e, n, s) => {
559
614
  const t = module$1.createRequire(path.join(s, "tsconfig.json"));
560
615
  if (e !== n) try {
561
616
  return t.resolve(e);
@@ -564,103 +619,103 @@ const Je = i((e, n, s) => {
564
619
  return t.resolve(n);
565
620
  } catch {}
566
621
  try {
567
- return t.resolve(`${n}/${I}`);
622
+ return t.resolve(`${n}/${S}`);
568
623
  } catch {}
569
624
  }, "resolvePackageEntryWithNode");
570
- const Z = i((e, n, s, t) => {
625
+ const q = i((e, n, s, t) => {
571
626
  const o = `resolveFromPackageJsonPath:${e}:${n}:${s}`;
572
627
  if (t?.has(o)) return t.get(o) || !1;
573
- const r = Y(e, t);
628
+ const r = Z(e, t);
574
629
  if (!r) return;
575
- let l = n || M;
630
+ let c = n || M;
576
631
  if (!s && r.exports) try {
577
632
  const [g] = v(r.exports, n, ["require", "types"]);
578
- l = g;
633
+ c = g;
579
634
  } catch {
580
635
  return t?.set(o, ""), !1;
581
636
  }
582
- else !n && r.tsconfig && (l = r.tsconfig);
583
- return l = path.join(e, "..", l), t?.set(o, l), l;
637
+ else !n && r.tsconfig && (c = r.tsconfig);
638
+ return c = path.join(e, "..", c), t?.set(o, c), c;
584
639
  }, "resolveFromPackageJsonPath");
585
- const ze = i((e, n, s) => {
640
+ const Ge = i((e, n, s) => {
586
641
  const t = `resolveExtendsPath:${e}:${n}`;
587
642
  if (s?.has(t)) return s.get(t) || void 0;
588
- const o = Ge(e, n, s);
643
+ const o = Qe(e, n, s);
589
644
  return s?.set(t, o || ""), o;
590
645
  }, "resolveExtendsPath");
591
- const Ge = i((e, n, s) => {
646
+ const Qe = i((e, n, s) => {
592
647
  let t = e;
593
648
  if (e === ".." && (t = path.join(t, M)), e[0] === "." && (t = path.resolve(n, t)), path.isAbsolute(t)) {
594
- const c = F(s, t);
595
- if (c) {
596
- if (c.isFile()) return t;
649
+ const u = $(s, t);
650
+ if (u) {
651
+ if (u.isFile()) return t;
597
652
  } else if (!t.endsWith(".json")) {
598
- const p = `${t}.json`;
599
- if (F(s, p)) return p;
653
+ const w = `${t}.json`;
654
+ if ($(s, w)) return w;
600
655
  }
601
656
  return;
602
657
  }
603
- const [o, ...r] = e.split("/"), l = o[0] === "@" ? `${o}/${r.shift()}` : o, g = r.join("/"), m = pe();
658
+ const [o, ...r] = e.split("/"), c = o[0] === "@" ? `${o}/${r.shift()}` : o, g = r.join("/"), m = pe();
604
659
  if (m) {
605
- const { resolveRequest: c } = m;
660
+ const { resolveRequest: u } = m;
606
661
  try {
607
- if (l === e) {
608
- const p = c(path.join(l, I), n);
609
- if (p) {
610
- const b = Z(p, g, !1, s);
611
- if (b && F(s, b)) return b;
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;
612
667
  }
613
668
  } else {
614
- let p;
669
+ let w;
615
670
  try {
616
- p = c(e, n, { extensions: [".json"] });
671
+ w = u(e, n, { extensions: [".json"] });
617
672
  } catch {
618
- p = c(path.join(e, M), n);
673
+ w = u(path.join(e, M), n);
619
674
  }
620
- if (p) return p;
675
+ if (w) return w;
621
676
  }
622
677
  } catch {}
623
678
  }
624
- const k = Je(e, l, n);
625
- let w;
679
+ const k = ze(e, c, n);
680
+ let v;
626
681
  if (k) {
627
- if (path.basename(k) !== I && k.endsWith(".json")) return k;
628
- w = path.basename(k) === I ? k : R(path.dirname(k), I, s);
629
- }
630
- const u = w && path.dirname(w) || R(path.resolve(n), path.join("node_modules", l), s);
631
- if (!u || !F(s, u)?.isDirectory()) return;
632
- const A = path.join(u, I);
633
- if (F(s, A)) {
634
- const c = Z(A, g, !1, s);
635
- if (c === !1) return;
636
- if (c && F(s, c)?.isFile()) return c;
637
- }
638
- const O = path.join(u, g), h = O.endsWith(".json");
639
- if (!h) {
640
- const c = `${O}.json`;
641
- if (F(s, c)) return c;
642
- }
643
- const D = F(s, O);
644
- if (D) {
645
- if (D.isDirectory()) {
646
- const c = path.join(O, I);
647
- if (F(s, c)) {
648
- const b = Z(c, "", !0, s);
649
- if (b && F(s, b)) return b;
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;
650
705
  }
651
- const p = path.join(O, M);
652
- if (F(s, p)) return p;
653
- } else if (h) return O;
706
+ const w = path.join(y, M);
707
+ if ($(s, w)) return w;
708
+ } else if (x) return y;
654
709
  }
655
710
  }, "resolveExtendsPathUncached");
656
- const q = Symbol("implicitBaseUrl");
711
+ const K = Symbol("implicitBaseUrl");
657
712
  const U = "${configDir}";
658
- const K = /^\.{1,2}(\/.*)?$/;
713
+ const C = /^\.{1,2}(\/.*)?$/;
659
714
  const J = i((e) => {
660
- const n = x(e);
661
- return K.test(n) ? n : `./${n}`;
715
+ const n = E(e);
716
+ return C.test(n) ? n : `./${n}`;
662
717
  }, "normalizeRelativePath");
663
- const Qe = i((e) => {
718
+ const He = i((e) => {
664
719
  const n = { ...e };
665
720
  if (n.strict) for (const t of [
666
721
  "noImplicitAny",
@@ -697,33 +752,33 @@ const Qe = i((e) => {
697
752
  ]) n[s] && (n[s] = n[s].toLowerCase());
698
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;
699
754
  }, "normalizeCompilerOptions");
700
- const He = i((e, n) => {
701
- !n.has("target") && !Xe(e.module) && (e.target = "es3");
755
+ const Xe = i((e, n) => {
756
+ !n.has("target") && !Ye(e.module) && (e.target = "es3");
702
757
  }, "applyV4Defaults");
703
- const Xe = i((e) => e === "node16" || e === "node18" || e === "node20" || e === "nodenext", "moduleDictatesTarget$1");
704
- const Ye = i((e, n) => {
705
- !n.has("target") && !Ze(e.module) && (e.target = "es5");
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");
706
761
  }, "applyV5Defaults");
707
- const Ze = i((e) => e === "node16" || e === "node18" || e === "node20" || e === "nodenext", "moduleDictatesTarget");
708
- const qe = i((e, n) => {
762
+ const qe = i((e) => e === "node16" || e === "node18" || e === "node20" || e === "nodenext", "moduleDictatesTarget");
763
+ const Ke = i((e, n) => {
709
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);
710
765
  }, "applyV6Defaults");
711
- const Ke = [
712
- [4, He],
713
- [5, Ye],
714
- [6, qe]
766
+ const Ce = [
767
+ [4, Xe],
768
+ [5, Ze],
769
+ [6, Ke]
715
770
  ];
716
- const Ce = i((e) => {
771
+ const et = i((e) => {
717
772
  const n = /^v?(\d+)/.exec(e);
718
773
  return n ? Number(n[1]) : void 0;
719
774
  }, "parseMajor");
720
- const et = i((e, n) => {
721
- const s = Ce(n);
775
+ const tt = i((e, n) => {
776
+ const s = et(n);
722
777
  if (s === void 0) return;
723
778
  const t = new Set(Object.keys(e));
724
- for (const [o, r] of Ke) o <= s && r(e, t);
779
+ for (const [o, r] of Ce) o <= s && r(e, t);
725
780
  }, "applyVersionDefaults");
726
- const C = i((e, n) => J(path.relative(e, n)), "pathRelative");
781
+ const ee = i((e, n) => J(path.relative(e, n)), "pathRelative");
727
782
  const me = [
728
783
  "files",
729
784
  "include",
@@ -731,18 +786,18 @@ const me = [
731
786
  ];
732
787
  const ge = i((e, n, s) => {
733
788
  const t = path.join(n, s);
734
- return x(path.relative(e, t)) || "./";
789
+ return E(path.relative(e, t)) || "./";
735
790
  }, "resolveAndRelativize");
736
- const tt = i((e, n, s) => {
791
+ const nt = i((e, n, s) => {
737
792
  const t = path.relative(e, n);
738
793
  if (!t) return s;
739
- return x(`${t}/${s.startsWith("./") ? s.slice(2) : s}`);
794
+ return E(`${t}/${s.startsWith("./") ? s.slice(2) : s}`);
740
795
  }, "prefixPattern");
741
796
  const de = ["outDir", "declarationDir"];
742
797
  const z = i((e, n) => {
743
- if (e.startsWith(U)) return x(path.join(n, e.slice(12)));
798
+ if (e.startsWith(U)) return E(path.join(n, e.slice(12)));
744
799
  }, "interpolateConfigDir");
745
- const nt = [
800
+ const st = [
746
801
  "outDir",
747
802
  "declarationDir",
748
803
  "outFile",
@@ -752,194 +807,197 @@ const nt = [
752
807
  ];
753
808
  const ke = i((e, n = {}) => {
754
809
  if (e.length === 0) throw new Error("Chain must not be empty");
755
- const { typescriptVersion: s } = n, t = new Map(e.map((u) => [u.path, u])), o = /* @__PURE__ */ new Map(), r = i((u) => {
756
- const A = o.get(u);
757
- if (A) return A;
758
- const O = t.get(u);
759
- if (!O) throw new Error(`Config not found in chain: ${u}`);
760
- const h = O.config, D = path.dirname(u);
761
- let c = {
762
- ...h,
763
- ...h.compilerOptions && { compilerOptions: { ...h.compilerOptions } },
764
- ...h.watchOptions && { watchOptions: { ...h.watchOptions } }
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 } }
765
820
  };
766
- if (delete c.extends, c.compilerOptions?.paths && !c.compilerOptions.baseUrl && (c.compilerOptions[q] = D), h.extends) {
767
- const p = Array.isArray(h.extends) ? h.extends : [h.extends];
768
- for (const b of p.toReversed()) {
769
- const f = r(b), y = path.dirname(b), { references: j, ...v } = f;
770
- if (v.compilerOptions) {
771
- const L = { ...v.compilerOptions };
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 };
772
827
  for (const B of [
773
828
  "baseUrl",
774
829
  "outDir",
775
830
  "declarationDir",
776
831
  "rootDir"
777
832
  ]) {
778
- const $ = L[B];
779
- $ && !$.startsWith(U) && (L[B] = ge(D, y, $));
833
+ const F = L[B];
834
+ F && !F.startsWith(U) && (L[B] = ge(x, T, F));
780
835
  }
781
836
  for (const B of ["rootDirs", "typeRoots"]) {
782
- const $ = L[B];
783
- $ && (L[B] = $.map((N) => N.startsWith(U) ? N : ge(D, y, N)));
837
+ const F = L[B];
838
+ F && (L[B] = F.map((N) => N.startsWith(U) ? N : ge(x, T, N)));
784
839
  }
785
- v.compilerOptions = L;
840
+ b.compilerOptions = L;
786
841
  }
787
842
  for (const L of me) {
788
- const B = v[L];
789
- B && (v[L] = B.map(($) => $.startsWith(U) ? $ : tt(D, y, $)));
843
+ const B = b[L];
844
+ B && (b[L] = B.map((F) => F.startsWith(U) ? F : nt(x, T, F)));
790
845
  }
791
846
  const d = {
792
- ...v,
793
- ...c,
847
+ ...b,
848
+ ...p,
794
849
  compilerOptions: {
795
- ...v.compilerOptions,
796
- ...c.compilerOptions
850
+ ...b.compilerOptions,
851
+ ...p.compilerOptions
797
852
  }
798
853
  };
799
- v.watchOptions && (d.watchOptions = {
800
- ...v.watchOptions,
801
- ...c.watchOptions
802
- }), c = d;
854
+ b.watchOptions && (d.watchOptions = {
855
+ ...b.watchOptions,
856
+ ...p.watchOptions
857
+ }), p = d;
803
858
  }
804
859
  }
805
- if (c.compilerOptions) {
806
- const { compilerOptions: p } = c;
807
- for (const f of ["baseUrl", "rootDir"]) {
808
- const y = p[f];
809
- if (y && !y.startsWith(U)) {
810
- const j = path.resolve(D, y);
811
- p[f] = C(D, j);
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);
812
867
  }
813
868
  }
814
- for (const f of de) {
815
- let y = p[f];
816
- y && (Array.isArray(c.exclude) || (c.exclude = de.map((j) => p[j]).filter(Boolean)), y.startsWith(U) || (y = J(y)), p[f] = y);
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);
817
872
  }
818
- } else c.compilerOptions = {};
819
- if (c.include && (c.include = c.include.map(x)), c.files && (c.files = c.files.map((p) => p.startsWith(U) ? p : J(p))), c.watchOptions) {
820
- const { watchOptions: p } = c;
821
- for (const b of ["excludeDirectories", "excludeFiles"]) p[b] && (p[b] = p[b].map((f) => x(path.resolve(D, f))));
822
- for (const b of [
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 [
823
878
  "watchFile",
824
879
  "watchDirectory",
825
880
  "fallbackPolling"
826
- ]) if (p[b]) {
827
- const f = p;
828
- f[b] = p[b].toLowerCase();
881
+ ]) if (u[w]) {
882
+ const l = u;
883
+ l[w] = u[w].toLowerCase();
829
884
  }
830
885
  }
831
- return o.set(u, c), c;
832
- }, "resolveEntry"), l = e[0], g = r(l.path), m = path.dirname(l.path), k = {
886
+ return o.set(f, p), p;
887
+ }, "resolveEntry"), c = e[0], g = r(c.path), m = path.dirname(c.path), k = {
833
888
  ...g,
834
889
  compilerOptions: g.compilerOptions ? { ...g.compilerOptions } : {}
835
- }, { compilerOptions: w } = k;
836
- if (w) {
837
- for (const u of nt) {
838
- const A = w[u];
839
- if (A) {
840
- const O = z(A, m);
841
- w[u] = O ? C(m, O) : A;
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;
842
897
  }
843
898
  }
844
- for (const u of ["rootDirs", "typeRoots"]) {
845
- const A = w[u];
846
- A && (w[u] = A.map((O) => {
847
- const h = z(O, m);
848
- return h ? C(m, h) : J(O);
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);
849
904
  }));
850
905
  }
851
- if (w.paths) {
852
- const u = {};
853
- for (const [A, O] of Object.entries(w.paths)) u[A] = O.map((h) => z(h, m) ?? h);
854
- w.paths = u;
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;
855
910
  }
856
- s && et(w, s), k.compilerOptions = Qe(w);
911
+ s && tt(v, s), k.compilerOptions = He(v);
857
912
  }
858
- for (const u of me) {
859
- const A = k[u];
860
- A && (k[u] = A.map((O) => z(O, m) ?? O));
913
+ for (const f of me) {
914
+ const O = k[f];
915
+ O && (k[f] = O.map((j) => z(j, m) ?? j));
861
916
  }
862
917
  return {
863
- path: l.path,
918
+ path: c.path,
864
919
  config: k,
865
- sources: e.map((u) => u.path)
920
+ sources: e.map((f) => f.path)
866
921
  };
867
922
  }, "resolveExtendsChain");
868
- const we = i((e, n = {}) => {
869
- const { cache: s = /* @__PURE__ */ new Map() } = n, t = path.resolve(e), o = [], r = /* @__PURE__ */ new Set(), l = i((g, m) => {
870
- const k = x(g);
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);
871
926
  if (r.has(k)) return;
872
927
  r.add(k);
873
- let w;
928
+ let v;
874
929
  try {
875
- w = Y(g, s) || {};
930
+ v = Z(g, s) || {};
876
931
  } catch {
877
932
  throw new Error(`Cannot resolve tsconfig at path: ${g}`);
878
933
  }
879
- if (typeof w != "object") throw new SyntaxError(`Failed to parse tsconfig at: ${g}`);
880
- const u = path.dirname(g);
881
- if (w.extends) {
882
- const A = Array.isArray(w.extends), h = (A ? w.extends : [w.extends]).map((c) => {
883
- const p = ze(c, u, s);
884
- if (!p) throw new Error(`File '${c}' not found.`);
885
- const b = x(p);
886
- if (m.has(b) || b === k) throw new Error(`Circularity detected while resolving configuration: ${b}`);
887
- return b;
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;
888
943
  });
889
- w.extends = A ? h : h[0], o.push({
944
+ v.extends = O ? y : y[0], o.push({
890
945
  path: k,
891
- config: w
946
+ config: v
892
947
  });
893
- const D = new Set(m);
894
- D.add(k);
895
- for (const c of [...h].reverse()) l(c, D);
948
+ const x = new Set(m);
949
+ x.add(k);
950
+ for (const p of [...y].reverse()) c(p, x);
896
951
  } else o.push({
897
952
  path: k,
898
- config: w
953
+ config: v
899
954
  });
900
955
  }, "collect");
901
- return l(t, /* @__PURE__ */ new Set()), o;
956
+ return c(t, /* @__PURE__ */ new Set()), o;
902
957
  }, "getExtendsChain");
903
- const ee = i((e, n = {}) => {
904
- const { cache: s = /* @__PURE__ */ new Map(), typescriptVersion: t = "auto" } = n, o = we(e, { cache: s });
958
+ const te = i((e, n = {}) => {
959
+ const { cache: s = /* @__PURE__ */ new Map(), typescriptVersion: t = "auto" } = n, o = ve(e, { cache: s });
905
960
  let r;
906
- return t === "auto" ? r = Me(path.dirname(o[0].path), s) : t !== !1 && (r = t), ke(o, { typescriptVersion: r });
961
+ return t === "auto" ? r = Je(path.dirname(o[0].path), s) : t !== !1 && (r = t), ke(o, { typescriptVersion: r });
907
962
  }, "readTsconfig");
908
- var st = Object.defineProperty;
909
- var G = i((e, n) => st(e, "name", {
963
+ var ot = Object.defineProperty;
964
+ var G = i((e, n) => ot(e, "name", {
910
965
  value: n,
911
966
  configurable: !0
912
967
  }), "s");
913
- const ve = G((e) => {
968
+ const we = G((e) => {
914
969
  let n = "";
915
970
  for (let s = 0; s < e.length; s += 1) {
916
971
  const t = e[s], o = t.toUpperCase();
917
972
  n += t === o ? t.toLowerCase() : o;
918
973
  }
919
974
  return n;
920
- }, "invertCase"), te = /* @__PURE__ */ new Map(), be = G((e, n) => {
921
- const s = Se.join(e, `.is-fs-case-sensitive-test-${process.pid}`);
975
+ }, "invertCase"), ne = /* @__PURE__ */ new Map(), be = G((e, n) => {
976
+ const s = Ie.join(e, `.is-fs-case-sensitive-test-${process.pid}`);
922
977
  try {
923
- return n.writeFileSync(s, ""), !n.existsSync(ve(s));
978
+ return n.writeFileSync(s, ""), !n.existsSync(we(s));
924
979
  } finally {
925
980
  try {
926
981
  n.unlinkSync(s);
927
982
  } catch {}
928
983
  }
929
- }, "checkDirectoryCaseWithWrite"), ot = G((e, n, s) => {
984
+ }, "checkDirectoryCaseWithWrite"), it = G((e, n, s) => {
930
985
  try {
931
986
  return be(e, s);
932
987
  } catch (t) {
933
- if (n === void 0) return be(Ie.tmpdir(), s);
988
+ if (n === void 0) return be(Se.tmpdir(), s);
934
989
  throw t;
935
990
  }
936
- }, "checkDirectoryCaseWithFallback"), it = G((e, n = Ue, s = !0) => {
991
+ }, "checkDirectoryCaseWithFallback"), rt = G((e, n = Ue, s = !0) => {
937
992
  const t = e ?? process.cwd();
938
- if (s && te.has(t)) return te.get(t);
993
+ if (s && ne.has(t)) return ne.get(t);
939
994
  let o;
940
- const r = ve(t);
941
- return r !== t && n.existsSync(t) ? o = !n.existsSync(r) : o = ot(t, e, n), s && te.set(t, o), o;
942
- }, "isFsCaseSensitive"), { join: ye } = path.posix, ne = {
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 = {
943
1001
  ts: [
944
1002
  ".ts",
945
1003
  ".tsx",
@@ -947,93 +1005,93 @@ const ve = G((e) => {
947
1005
  ],
948
1006
  cts: [".cts", ".d.cts"],
949
1007
  mts: [".mts", ".d.mts"]
950
- }, rt = i((e) => {
951
- const n = [...ne.ts], s = [...ne.cts], t = [...ne.mts];
1008
+ }, ct = i((e) => {
1009
+ const n = [...se.ts], s = [...se.cts], t = [...se.mts];
952
1010
  return e?.allowJs && (n.push(".js", ".jsx"), s.push(".cjs"), t.push(".mjs")), [
953
1011
  ...n,
954
1012
  ...s,
955
1013
  ...t
956
1014
  ];
957
- }, "getSupportedExtensions"), lt = i((e) => {
1015
+ }, "getSupportedExtensions"), ft = i((e) => {
958
1016
  const n = [];
959
1017
  if (!e) return n;
960
1018
  const { outDir: s, declarationDir: t } = e;
961
1019
  return s && n.push(s), t && n.push(t), n;
962
- }, "getDefaultExcludeSpec"), Te = i((e) => e.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`), "escapeForRegexp"), se = `(?!(${[
1020
+ }, "getDefaultExcludeSpec"), Te = i((e) => e.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`), "escapeForRegexp"), oe = `(?!(${[
963
1021
  "node_modules",
964
1022
  "bower_components",
965
1023
  "jspm_packages"
966
- ].join("|")})(/|$))`, ft = /(?:^|\/)[^.*?]+$/, he = "**/*", Q = "[^/]", oe = "[^./]", Oe = process.platform === "win32", ut = i(({ config: e, path: n }, s) => {
1024
+ ].join("|")})(/|$))`, at = /(?:^|\/)[^.*?]+$/, he = "**/*", Q = "[^/]", ie = "[^./]", Oe = process.platform === "win32", pt = i(({ config: e, path: n }, s) => {
967
1025
  if ("extends" in e) throw new Error("tsconfig#extends must be resolved. Use getTsconfig or readTsconfig to resolve it.");
968
1026
  if (!path.isAbsolute(n)) throw new Error("The tsconfig path must be absolute");
969
- Oe && (n = x(n));
970
- const t = path.dirname(n), { files: o, include: r, exclude: l, compilerOptions: g } = e, m = i((c) => path.isAbsolute(c) ? c : ye(t, c), "resolvePattern"), k = o ? new Set(o.map(m)) : void 0, w = rt(g), u = s ? "" : "i", O = (l || lt(g)).map((c) => {
971
- const p = m(c), b = Te(p).replaceAll(String.raw`\*\*/`, "(.+/)?").replaceAll(String.raw`\*`, `${Q}*`).replaceAll(String.raw`\?`, Q);
972
- return new RegExp(`^${b}($|/)`, u);
973
- }), h = o || r ? r : [he];
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];
974
1032
  return {
975
1033
  filesSet: k,
976
- extensions: w,
977
- excludePatterns: O,
978
- includePatterns: h ? h.map((c) => {
979
- let p = m(c);
980
- ft.test(p) && (p = ye(p, he));
981
- const b = Te(p).replaceAll(String.raw`/\*\*`, `(/${se}${oe}${Q}*)*?`).replaceAll(/(\/)?\\\*/g, (f, y) => {
982
- const j = String.raw`(${oe}|(\.(?!min\.js$))?)*`;
983
- return y ? `/${se}${oe}${j}` : j;
984
- }).replaceAll(/(\/)?\\\?/g, (f, y) => {
985
- const j = Q;
986
- return y ? `/${se}${j}` : j;
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;
987
1045
  });
988
- return new RegExp(`^${b}$`, u);
1046
+ return new RegExp(`^${w}$`, f);
989
1047
  }) : void 0
990
1048
  };
991
1049
  }, "compilePatterns"), Ae = /* @__PURE__ */ new WeakMap(), je = i((e, n) => {
992
1050
  if (!path.isAbsolute(n)) return !1;
993
- Oe && (n = x(n));
1051
+ Oe && (n = E(n));
994
1052
  let s = Ae.get(e);
995
- s || (s = ut(e, it()), Ae.set(e, s));
996
- const { filesSet: t, extensions: o, excludePatterns: r, includePatterns: l } = s;
997
- return t?.has(n) ? !0 : !o.some((g) => n.endsWith(g)) || r.some((g) => g.test(n)) ? !1 : !!(l && l.some((g) => g.test(n)));
998
- }, "isFileIncluded"), De = i((e, n, s, t) => {
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) => {
999
1057
  const o = path.resolve(e);
1000
- let r = x(e);
1058
+ let r = E(e);
1001
1059
  for (;;) {
1002
- const l = R(r, n, s);
1003
- if (!l) return;
1004
- const g = path.resolve(l), m = ee(g, {
1060
+ const c = R(r, n, s);
1061
+ if (!c) return;
1062
+ const g = path.resolve(c), m = te(g, {
1005
1063
  cache: s,
1006
1064
  typescriptVersion: t
1007
1065
  });
1008
1066
  if (je(m, o)) return m;
1009
- const k = path.dirname(l), w = path.dirname(k);
1010
- if (w === k) return;
1011
- r = w;
1067
+ const k = path.dirname(c), v = path.dirname(k);
1068
+ if (v === k) return;
1069
+ r = v;
1012
1070
  }
1013
- }, "findConfigApplicable"), Ee = i((e = process.cwd(), n = {}) => {
1071
+ }, "findConfigApplicable"), De = i((e = process.cwd(), n = {}) => {
1014
1072
  const { configName: s = "tsconfig.json", cache: t = /* @__PURE__ */ new Map(), includes: o = !1 } = n;
1015
1073
  if (!o) {
1016
1074
  const r = path.resolve(e);
1017
- return path.basename(r) === s && F(t, r)?.isFile() ? x(r) : R(x(e), s, t);
1075
+ return path.basename(r) === s && $(t, r)?.isFile() ? E(r) : R(E(e), s, t);
1018
1076
  }
1019
- return De(e, s, t, !1)?.path;
1020
- }, "findTsconfig"), at = i((e = process.cwd(), n = {}) => {
1077
+ return xe(e, s, t, !1)?.path;
1078
+ }, "findTsconfig"), mt = i((e = process.cwd(), n = {}) => {
1021
1079
  const { configName: s = "tsconfig.json", cache: t = /* @__PURE__ */ new Map(), includes: o = !1, typescriptVersion: r = "auto" } = n;
1022
1080
  if (!o) {
1023
- const l = Ee(e, {
1081
+ const c = De(e, {
1024
1082
  configName: s,
1025
1083
  cache: t
1026
1084
  });
1027
- return l ? ee(l, {
1085
+ return c ? te(c, {
1028
1086
  cache: t,
1029
1087
  typescriptVersion: r
1030
1088
  }) : void 0;
1031
1089
  }
1032
- return De(e, s, t, r);
1033
- }, "getTsconfig"), pt = /\*/g, xe = i((e, n) => {
1034
- const s = e.match(pt);
1090
+ return xe(e, s, t, r);
1091
+ }, "getTsconfig"), gt = /\*/g, Ee = i((e, n) => {
1092
+ const s = e.match(gt);
1035
1093
  if (s && s.length > 1) throw new Error(n);
1036
- }, "assertStarCount"), mt = i((e) => {
1094
+ }, "assertStarCount"), dt = i((e) => {
1037
1095
  if (e.includes("*")) {
1038
1096
  const [n, s] = e.split("*");
1039
1097
  return {
@@ -1042,40 +1100,40 @@ const ve = G((e) => {
1042
1100
  };
1043
1101
  }
1044
1102
  return e;
1045
- }, "parsePattern"), gt = i(({ prefix: e, suffix: n }, s) => s.startsWith(e) && s.endsWith(n), "isPatternMatch"), dt = i((e, n, s) => Object.entries(e).map(([t, o]) => (xe(t, `Pattern '${t}' can have at most one '*' character.`), {
1046
- pattern: mt(t),
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),
1047
1105
  substitutions: o.map((r) => {
1048
- if (xe(r, `Substitution '${r}' in pattern '${t}' can have at most one '*' character.`), !n && !K.test(r) && !path.isAbsolute(r)) throw new Error("Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?");
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 './'?");
1049
1107
  return path.resolve(s, r);
1050
1108
  })
1051
- })), "parsePaths"), kt = i((e) => {
1109
+ })), "parsePaths"), wt = i((e) => {
1052
1110
  const { compilerOptions: n } = e.config;
1053
1111
  if (!n) return null;
1054
1112
  const { baseUrl: s, paths: t } = n;
1055
1113
  if (!s && !t) return null;
1056
- const o = q in n && n[q], r = path.resolve(path.dirname(e.path), s || o || "."), l = t ? dt(t, s, r) : [], g = /* @__PURE__ */ new Map(), m = [];
1057
- for (const k of l) typeof k.pattern == "string" ? g.set(k.pattern, k.substitutions) : m.push(k);
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);
1058
1116
  return {
1059
1117
  exactEntries: g,
1060
1118
  patternEntries: m,
1061
1119
  resolvedBaseUrl: r,
1062
1120
  baseUrl: s
1063
1121
  };
1064
- }, "compilePaths"), Fe = /* @__PURE__ */ new WeakMap();
1122
+ }, "compilePaths"), $e = /* @__PURE__ */ new WeakMap();
1065
1123
  i((e, n) => {
1066
- let s = Fe.get(e);
1067
- if (s === void 0 && (s = kt(e), Fe.set(e, s)), !s) return [];
1068
- if (K.test(n)) return [];
1069
- const { exactEntries: t, patternEntries: o, resolvedBaseUrl: r, baseUrl: l } = s, g = t.get(n);
1070
- if (g) return g.map(x);
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);
1071
1129
  let m, k = -1;
1072
- for (const u of o) gt(u.pattern, n) && u.pattern.prefix.length > k && (k = u.pattern.prefix.length, m = u);
1073
- if (!m) return l ? [x(path.join(r, n))] : [];
1074
- const w = n.slice(m.pattern.prefix.length, n.length - m.pattern.suffix.length);
1075
- return m.substitutions.map((u) => x(u.replace("*", w)));
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)));
1076
1134
  }, "resolvePathAlias");
1077
1135
  //#endregion
1078
- //#region ../../node_modules/.pnpm/tsdown@0.22.14_@arethetypeswrong+core@0.18.2_@tsdown+css@0.22.14_@tsdown+exe@0.22.14_@t_4084c24f9f44f250d2b604ebc16f10f3/node_modules/tsdown/dist/deps-B_uZzM4C.mjs
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
1079
1137
  const shimFile = path.resolve(import.meta.dirname, "..", "esm-shims.js");
1080
1138
  const shimsInject = {
1081
1139
  __dirname: [shimFile, "__dirname"],
@@ -1103,14 +1161,14 @@ function getShims(config) {
1103
1161
  };
1104
1162
  return { inject: shimsInject };
1105
1163
  }
1106
- const debug$7 = createDebug("tsdown:deps");
1164
+ const debug$9 = createDebug("tsdown:deps");
1107
1165
  /**
1108
1166
  * Matches specifiers that follow npm package naming conventions,
1109
1167
  * e.g. `pkg`, `pkg/subpath`, `@scope/pkg/subpath`.
1110
1168
  */
1111
1169
  const RE_PACKAGE_SPECIFIER = /^(?:@[a-z0-9-][a-z0-9-._]*\/)?[a-z0-9-][a-z0-9-._]*(?:\/|$)/;
1112
1170
  function resolveDepsConfig(config, logger) {
1113
- let { neverBundle, alwaysBundle, onlyBundle, onlyImport, skipNodeModulesBundle, resolveDepSubpath = true } = config.deps || {};
1171
+ let { neverBundle, alwaysBundle, onlyBundle, onlyImport, resolveDepSubpath } = config.deps || {};
1114
1172
  if (config.external != null) {
1115
1173
  if (neverBundle != null) throw new TypeError("`external` is deprecated. Cannot be used with `deps.neverBundle`.");
1116
1174
  logger?.warn("`external` is deprecated. Use `deps.neverBundle` instead.");
@@ -1121,32 +1179,12 @@ function resolveDepsConfig(config, logger) {
1121
1179
  logger?.warn("`noExternal` is deprecated. Use `deps.alwaysBundle` instead.");
1122
1180
  alwaysBundle = config.noExternal;
1123
1181
  }
1124
- if (config.inlineOnly != null) {
1125
- if (onlyBundle != null) throw new TypeError("`inlineOnly` is deprecated. Cannot be used with `deps.onlyBundle`.");
1126
- logger?.warn("`inlineOnly` is deprecated. Use `deps.onlyBundle` instead.");
1127
- onlyBundle = config.inlineOnly;
1128
- }
1129
- if (config.deps?.onlyAllowBundle != null) {
1130
- if (onlyBundle != null) throw new TypeError("`deps.onlyAllowBundle` is deprecated. Cannot be used with `deps.onlyBundle`.");
1131
- logger?.warn("`deps.onlyAllowBundle` is deprecated. Use `deps.onlyBundle` instead.");
1132
- onlyBundle = config.deps.onlyAllowBundle;
1133
- }
1134
- if (config.skipNodeModulesBundle != null) {
1135
- if (config.deps?.skipNodeModulesBundle != null) throw new TypeError("`skipNodeModulesBundle` is deprecated. Cannot be used with `deps.skipNodeModulesBundle`.");
1136
- logger?.warn("`skipNodeModulesBundle` is deprecated. Use `deps.neverBundle: true` instead.");
1137
- skipNodeModulesBundle = config.skipNodeModulesBundle;
1138
- } else if (skipNodeModulesBundle != null) logger?.warn("`deps.skipNodeModulesBundle` is deprecated. Use `deps.neverBundle: true` instead.");
1139
- if (skipNodeModulesBundle) {
1140
- if (neverBundle === true) throw new TypeError("`deps.skipNodeModulesBundle` is deprecated. Cannot be used with `deps.neverBundle: true`.");
1141
- if (alwaysBundle != null) throw new TypeError("`deps.skipNodeModulesBundle` and `deps.alwaysBundle` are mutually exclusive options and cannot be used together.");
1142
- }
1143
1182
  if (onlyBundle != null && onlyBundle !== false) onlyBundle = toArray(onlyBundle);
1144
1183
  if (onlyImport != null) onlyImport = toArray(onlyImport);
1145
1184
  return {
1146
1185
  ...normalizeDepsOptions(alwaysBundle, neverBundle),
1147
1186
  onlyBundle,
1148
1187
  onlyImport,
1149
- skipNodeModulesBundle,
1150
1188
  resolveDepSubpath,
1151
1189
  dts: normalizeDepsOptions(config.deps?.dts?.alwaysBundle, config.deps?.dts?.neverBundle)
1152
1190
  };
@@ -1161,7 +1199,7 @@ function normalizeDepsOptions(alwaysBundle, neverBundle) {
1161
1199
  neverBundle: resolveRegex(neverBundle)
1162
1200
  };
1163
1201
  }
1164
- function DepsPlugin({ pkg, deps: { neverBundle, alwaysBundle: jsAlwaysBundle, onlyBundle, onlyImport, skipNodeModulesBundle, resolveDepSubpath: shouldResolveDepSubpath, dts }, logger, nameLabel, platform }, tsdownBundle) {
1202
+ function DepsPlugin({ pkg, deps: { neverBundle, alwaysBundle: jsAlwaysBundle, onlyBundle, onlyImport, resolveDepSubpath: shouldResolveDepSubpath, dts }, logger, nameLabel, platform }, tsdownBundle) {
1165
1203
  const deps = pkg && Array.from(getProductionDeps(pkg));
1166
1204
  return {
1167
1205
  name: "tsdown:deps",
@@ -1176,12 +1214,12 @@ function DepsPlugin({ pkg, deps: { neverBundle, alwaysBundle: jsAlwaysBundle, on
1176
1214
  });
1177
1215
  let shouldExternal = await externalStrategy(id, importer, resolve);
1178
1216
  if (Array.isArray(shouldExternal)) {
1179
- debug$7("custom resolved id for %o -> %o", id, shouldExternal[1]);
1217
+ debug$9("custom resolved id for %o -> %o", id, shouldExternal[1]);
1180
1218
  id = shouldExternal[1];
1181
1219
  shouldExternal = shouldExternal[0];
1182
1220
  }
1183
1221
  const moduleSideEffects = isBuiltin(id) ? false : void 0;
1184
- debug$7("shouldExternal: %o = %o", id, shouldExternal);
1222
+ debug$9("shouldExternal: %o = %o", id, shouldExternal);
1185
1223
  if (shouldExternal === true || shouldExternal === "absolute") return {
1186
1224
  id,
1187
1225
  external: shouldExternal,
@@ -1209,7 +1247,7 @@ function DepsPlugin({ pkg, deps: { neverBundle, alwaysBundle: jsAlwaysBundle, on
1209
1247
  if (source[0] === ".") continue;
1210
1248
  if (platform === "node" && isBuiltin(source)) continue;
1211
1249
  if (matchPattern(parsePackageSpecifier(source)[0], onlyImport)) continue;
1212
- 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.`);
1213
1251
  }
1214
1252
  }
1215
1253
  for (const id of chunk.moduleIds) {
@@ -1223,13 +1261,13 @@ function DepsPlugin({ pkg, deps: { neverBundle, alwaysBundle: jsAlwaysBundle, on
1223
1261
  if (module) importers.set(parsed.name, /* @__PURE__ */ new Set([...module.importers, ...importers.get(parsed.name) || []]));
1224
1262
  }
1225
1263
  }
1226
- debug$7("found deps in bundle: %o", deps);
1227
- 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")}`));
1228
1266
  if (errors.length) this.error(errors.join("\n\n"));
1229
1267
  if (onlyBundle) {
1230
1268
  const unusedPatterns = onlyBundle.filter((pattern) => Array.from(deps).every((dep) => !matchPattern(dep, [pattern])));
1231
- 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.`);
1232
- } 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")}`);
1233
1271
  }
1234
1272
  }
1235
1273
  };
@@ -1238,7 +1276,7 @@ function DepsPlugin({ pkg, deps: { neverBundle, alwaysBundle: jsAlwaysBundle, on
1238
1276
  * - `[true, resolvedId]`: external with custom resolved ID
1239
1277
  * - `false`: skip, let other plugins handle it
1240
1278
  * - `'absolute'`: external as absolute path
1241
- * - `'no-external'`: skip, but mark as non-external for inlineOnly check
1279
+ * - `'no-external'`: skip, but mark as non-external for onlyBundle check
1242
1280
  */
1243
1281
  async function externalStrategy(id, importer, resolve) {
1244
1282
  if (id === shimFile) return false;
@@ -1246,16 +1284,13 @@ function DepsPlugin({ pkg, deps: { neverBundle, alwaysBundle: jsAlwaysBundle, on
1246
1284
  if ((isDts && dts?.alwaysBundle || jsAlwaysBundle)?.(id, importer)) return "no-external";
1247
1285
  if ((isDts && dts?.neverBundle != null ? dts.neverBundle : neverBundle) === true) {
1248
1286
  if (id[0] === "\0" || id.startsWith("data:") || path.isAbsolute(id)) return false;
1249
- if (isBuiltin(id) || RE_PACKAGE_SPECIFIER.test(id)) return true;
1250
- const resolved = await resolve();
1251
- return !!resolved && (!!resolved.external || RE_NODE_MODULES$1.test(resolved.id));
1252
- }
1253
- if (skipNodeModulesBundle) {
1254
- const resolved = await resolve();
1255
- if (resolved && (resolved.external || RE_NODE_MODULES$1.test(resolved.id))) {
1287
+ if (isBuiltin(id)) return true;
1288
+ if (RE_PACKAGE_SPECIFIER.test(id)) {
1256
1289
  const resolvedDep = shouldResolveDepSubpath && await resolveDepSubpath(id, resolve);
1257
1290
  return resolvedDep ? [true, resolvedDep] : true;
1258
1291
  }
1292
+ const resolved = await resolve();
1293
+ return !!resolved && (!!resolved.external || RE_NODE_MODULES$1.test(resolved.id));
1259
1294
  }
1260
1295
  if (deps) {
1261
1296
  if (deps.includes(id) || deps.some((dep) => id.startsWith(`${dep}/`))) {
@@ -1359,6 +1394,370 @@ function getProductionDeps(pkg) {
1359
1394
  ]);
1360
1395
  }
1361
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
1362
1761
  //#region ../../node_modules/.pnpm/defu@6.1.7/node_modules/defu/dist/defu.mjs
1363
1762
  function isPlainObject(value) {
1364
1763
  if (value === null || typeof value !== "object") return false;
@@ -1386,7 +1785,7 @@ function createDefu(merger) {
1386
1785
  return (...arguments_) => arguments_.reduce((p, c) => _defu(p, c, "", merger), {});
1387
1786
  }
1388
1787
  //#endregion
1389
- //#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.5/node_modules/fdir/dist/index.mjs
1788
+ //#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.7/node_modules/fdir/dist/index.mjs
1390
1789
  var __require$1 = /* @__PURE__ */ createRequire$1(import.meta.url);
1391
1790
  function cleanPath(path) {
1392
1791
  let normalized = normalize$1(path);
@@ -1894,7 +2293,7 @@ var Builder = class {
1894
2293
  }
1895
2294
  };
1896
2295
  //#endregion
1897
- //#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/constants.js
2296
+ //#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/constants.js
1898
2297
  var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1899
2298
  const WIN_SLASH = "\\\\/";
1900
2299
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
@@ -2063,7 +2462,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2063
2462
  };
2064
2463
  }));
2065
2464
  //#endregion
2066
- //#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/utils.js
2465
+ //#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/utils.js
2067
2466
  var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
2068
2467
  const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
2069
2468
  exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
@@ -2111,7 +2510,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
2111
2510
  };
2112
2511
  }));
2113
2512
  //#endregion
2114
- //#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/scan.js
2513
+ //#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/scan.js
2115
2514
  var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2116
2515
  const utils = require_utils();
2117
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();
@@ -2140,7 +2539,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2140
2539
  const scan = (input, options) => {
2141
2540
  const opts = options || {};
2142
2541
  const length = input.length - 1;
2143
- const scanToEnd = opts.parts === true || opts.scanToEnd === true;
2542
+ const scanToEnd = opts.parts === true || opts.tokens === true || opts.scanToEnd === true;
2144
2543
  const slashes = [];
2145
2544
  const tokens = [];
2146
2545
  const parts = [];
@@ -2243,14 +2642,18 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2243
2642
  finished = true;
2244
2643
  if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
2245
2644
  if (scanToEnd === true) {
2645
+ let parens = 0;
2246
2646
  while (eos() !== true && (code = advance())) {
2247
2647
  if (code === CHAR_BACKWARD_SLASH) {
2248
2648
  backslashes = token.backslashes = true;
2249
- code = advance();
2649
+ advance();
2650
+ continue;
2651
+ }
2652
+ if (code === CHAR_LEFT_PARENTHESES) {
2653
+ parens++;
2250
2654
  continue;
2251
2655
  }
2252
- if (code === CHAR_RIGHT_PARENTHESES) {
2253
- isGlob = token.isGlob = true;
2656
+ if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
2254
2657
  finished = true;
2255
2658
  break;
2256
2659
  }
@@ -2298,13 +2701,18 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2298
2701
  if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
2299
2702
  isGlob = token.isGlob = true;
2300
2703
  if (scanToEnd === true) {
2704
+ let parens = 1;
2301
2705
  while (eos() !== true && (code = advance())) {
2302
- if (code === CHAR_LEFT_PARENTHESES) {
2706
+ if (code === CHAR_BACKWARD_SLASH) {
2303
2707
  backslashes = token.backslashes = true;
2304
- code = advance();
2708
+ advance();
2305
2709
  continue;
2306
2710
  }
2307
- if (code === CHAR_RIGHT_PARENTHESES) {
2711
+ if (code === CHAR_LEFT_PARENTHESES) {
2712
+ parens++;
2713
+ continue;
2714
+ }
2715
+ if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
2308
2716
  finished = true;
2309
2717
  break;
2310
2718
  }
@@ -2367,7 +2775,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2367
2775
  if (opts.parts === true || opts.tokens === true) {
2368
2776
  let prevIndex;
2369
2777
  for (let idx = 0; idx < slashes.length; idx++) {
2370
- const n = prevIndex ? prevIndex + 1 : start;
2778
+ const n = prevIndex !== void 0 ? prevIndex + 1 : start;
2371
2779
  const i = slashes[idx];
2372
2780
  const value = input.slice(n, i);
2373
2781
  if (opts.tokens) {
@@ -2378,18 +2786,19 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2378
2786
  depth(tokens[idx]);
2379
2787
  state.maxDepth += tokens[idx].depth;
2380
2788
  }
2381
- if (idx !== 0 || value !== "") parts.push(value);
2382
- prevIndex = i;
2383
- }
2384
- if (prevIndex && prevIndex + 1 < input.length) {
2385
- const value = input.slice(prevIndex + 1);
2386
- parts.push(value);
2387
- if (opts.tokens) {
2388
- tokens[tokens.length - 1].value = value;
2389
- depth(tokens[tokens.length - 1]);
2390
- state.maxDepth += tokens[tokens.length - 1].depth;
2789
+ if (i >= start) {
2790
+ parts.push(value);
2791
+ prevIndex = i;
2391
2792
  }
2392
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
+ }
2393
2802
  state.slashes = slashes;
2394
2803
  state.parts = parts;
2395
2804
  }
@@ -2398,7 +2807,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2398
2807
  module.exports = scan;
2399
2808
  }));
2400
2809
  //#endregion
2401
- //#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/parse.js
2810
+ //#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/parse.js
2402
2811
  var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2403
2812
  const constants = require_constants();
2404
2813
  const utils = require_utils();
@@ -3300,6 +3709,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3300
3709
  rest = rest.slice(3);
3301
3710
  consume("/**", 3);
3302
3711
  }
3712
+ const isEnd = eos() || state.parens > 0 && rest === ")".repeat(state.parens) && !extglobs.some((extglob) => extglob.type === "negate");
3303
3713
  if (prior.type === "bos" && eos()) {
3304
3714
  prev.type = "globstar";
3305
3715
  prev.value += value;
@@ -3309,7 +3719,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3309
3719
  consume(value);
3310
3720
  continue;
3311
3721
  }
3312
- if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
3722
+ if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && isEnd) {
3313
3723
  state.output = state.output.slice(0, -(prior.output + prev.output).length);
3314
3724
  prior.output = `(?:${prior.output}`;
3315
3725
  prev.type = "globstar";
@@ -3474,7 +3884,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3474
3884
  module.exports = parse;
3475
3885
  }));
3476
3886
  //#endregion
3477
- //#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/picomatch.js
3887
+ //#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/picomatch.js
3478
3888
  var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3479
3889
  const scan = require_scan();
3480
3890
  const parse = require_parse();
@@ -4052,7 +4462,7 @@ const defaultOptions$1 = {
4052
4462
  function getOptions(options) {
4053
4463
  const opts = Object.assign({}, options);
4054
4464
  for (const key in defaultOptions$1) if (opts[key] === void 0) Object.assign(opts, { [key]: defaultOptions$1[key] });
4055
- 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, "/");
4056
4466
  opts.ignore = ensureStringArray(opts.ignore);
4057
4467
  opts.fs && (opts.fs = {
4058
4468
  readdir: opts.fs.readdir || readdir$1,
@@ -4160,7 +4570,7 @@ function init({ skipNodeModules } = {}) {
4160
4570
  const parentUUID = getParentUUID(context.parentURL);
4161
4571
  if (!noCache && !parentUUID) return resolved;
4162
4572
  const deps = depsStore.getStore();
4163
- if (deps) deps.add(fileURLToPath$1(resolved.url));
4573
+ if (deps) deps.add(fileURLToPath(resolved.url));
4164
4574
  resolved.url = appendUUID(resolved.url, parentUUID || crypto.randomUUID());
4165
4575
  return resolved;
4166
4576
  },
@@ -4290,87 +4700,87 @@ quansync$1({
4290
4700
  */
4291
4701
  const quansync = quansync$1;
4292
4702
  quansync$1({
4293
- sync: re.readFileSync,
4294
- async: re.promises.readFile
4703
+ sync: X.readFileSync,
4704
+ async: X.promises.readFile
4295
4705
  });
4296
4706
  quansync$1({
4297
- sync: re.writeFileSync,
4298
- async: re.promises.writeFile
4707
+ sync: X.writeFileSync,
4708
+ async: X.promises.writeFile
4299
4709
  });
4300
4710
  quansync$1({
4301
- sync: re.unlinkSync,
4302
- async: re.promises.unlink
4711
+ sync: X.unlinkSync,
4712
+ async: X.promises.unlink
4303
4713
  });
4304
4714
  quansync$1({
4305
- sync: re.accessSync,
4306
- async: re.promises.access
4715
+ sync: X.accessSync,
4716
+ async: X.promises.access
4307
4717
  });
4308
4718
  /**
4309
4719
  * @link https://nodejs.org/api/fs.html#fspromisesstatpath-options
4310
4720
  */
4311
4721
  const stat$2 = quansync$1({
4312
- sync: re.statSync,
4313
- async: re.promises.stat
4722
+ sync: X.statSync,
4723
+ async: X.promises.stat
4314
4724
  });
4315
4725
  const lstat = quansync$1({
4316
- sync: re.lstatSync,
4317
- async: re.promises.lstat
4726
+ sync: X.lstatSync,
4727
+ async: X.promises.lstat
4318
4728
  });
4319
4729
  quansync$1({
4320
- sync: re.copyFileSync,
4321
- async: re.promises.copyFile
4730
+ sync: X.copyFileSync,
4731
+ async: X.promises.copyFile
4322
4732
  });
4323
4733
  quansync$1({
4324
- sync: re.rmSync,
4325
- async: re.promises.rm
4734
+ sync: X.rmSync,
4735
+ async: X.promises.rm
4326
4736
  });
4327
4737
  quansync$1({
4328
- sync: re.mkdirSync,
4329
- async: re.promises.mkdir
4738
+ sync: X.mkdirSync,
4739
+ async: X.promises.mkdir
4330
4740
  });
4331
4741
  quansync$1({
4332
- sync: re.renameSync,
4333
- async: re.promises.rename
4742
+ sync: X.renameSync,
4743
+ async: X.promises.rename
4334
4744
  });
4335
4745
  quansync$1({
4336
- sync: re.readdirSync,
4337
- async: re.promises.readdir
4746
+ sync: X.readdirSync,
4747
+ async: X.promises.readdir
4338
4748
  });
4339
4749
  quansync$1({
4340
- sync: re.realpathSync,
4341
- async: re.promises.realpath
4750
+ sync: X.realpathSync,
4751
+ async: X.promises.realpath
4342
4752
  });
4343
4753
  quansync$1({
4344
- sync: re.readlinkSync,
4345
- async: re.promises.readlink
4754
+ sync: X.readlinkSync,
4755
+ async: X.promises.readlink
4346
4756
  });
4347
4757
  quansync$1({
4348
- sync: re.symlinkSync,
4349
- async: re.promises.symlink
4758
+ sync: X.symlinkSync,
4759
+ async: X.promises.symlink
4350
4760
  });
4351
4761
  quansync$1({
4352
- sync: re.chownSync,
4353
- async: re.promises.chown
4762
+ sync: X.chownSync,
4763
+ async: X.promises.chown
4354
4764
  });
4355
4765
  quansync$1({
4356
- sync: re.lchownSync,
4357
- async: re.promises.lchown
4766
+ sync: X.lchownSync,
4767
+ async: X.promises.lchown
4358
4768
  });
4359
4769
  quansync$1({
4360
- sync: re.chmodSync,
4361
- async: re.promises.chmod
4770
+ sync: X.chmodSync,
4771
+ async: X.promises.chmod
4362
4772
  });
4363
4773
  quansync$1({
4364
- sync: re.utimesSync,
4365
- async: re.promises.utimes
4774
+ sync: X.utimesSync,
4775
+ async: X.promises.utimes
4366
4776
  });
4367
4777
  quansync$1({
4368
- sync: re.lutimesSync,
4369
- async: re.promises.lutimes
4778
+ sync: X.lutimesSync,
4779
+ async: X.promises.lutimes
4370
4780
  });
4371
4781
  quansync$1({
4372
- sync: re.mkdtempSync,
4373
- async: re.promises.mkdtemp
4782
+ sync: X.mkdtempSync,
4783
+ async: X.promises.mkdtemp
4374
4784
  });
4375
4785
  //#endregion
4376
4786
  //#region ../../node_modules/.pnpm/unconfig-core@7.5.0/node_modules/unconfig-core/dist/index.mjs
@@ -4553,7 +4963,8 @@ async function resolveArrayEntry(entries, cwd, root) {
4553
4963
  const computedRoot = root || lowestCommonAncestor(...resolvedEntries);
4554
4964
  const base = root && !isGlob ? path.relative(cwd, root) || "." : computedRoot;
4555
4965
  const arrayEntryMap = Object.fromEntries(resolvedEntries.map((file) => {
4556
- return [slash(stripExtname(path.relative(base, file))), file];
4966
+ const relative = path.relative(base, file);
4967
+ return [slash(stripExtname(relative)), file];
4557
4968
  }));
4558
4969
  const resolvedObjectEntries = await Promise.all(objectEntries.map(async (entry) => {
4559
4970
  const [entryMap] = await resolveObjectEntry(entry, cwd);
@@ -4638,10 +5049,13 @@ async function generateExports(pkg, chunks, options, inlinedDeps) {
4638
5049
  const distFile = join$1(pkgRoot, chunk.outDir, normalizedName);
4639
5050
  if (isIndex) {
4640
5051
  name = ".";
4641
- if (format === "cjs") if (isDts) cjsTypes = distFile;
4642
- else main = distFile;
4643
- else if (format === "es") if (isDts) esmTypes = distFile;
4644
- else module = distFile;
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
+ }
4645
5059
  } else if (name.endsWith("/index")) name = `./${name.slice(0, -6)}`;
4646
5060
  else name = `./${name}`;
4647
5061
  if (extensions && name !== ".") name = `${name}.js`;
@@ -4822,17 +5236,17 @@ async function resolveTsconfig(logger, tsconfig, cwd, color, nameLabel) {
4822
5236
  if (tsconfig !== false) {
4823
5237
  if (tsconfig === true || tsconfig == null) {
4824
5238
  tsconfig = findTsconfig(cwd);
4825
- 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)}`);
4826
5240
  } else {
4827
5241
  const tsconfigPath = path.resolve(cwd, tsconfig);
4828
5242
  const stat = await fsStat(tsconfigPath);
4829
5243
  if (stat?.isFile()) tsconfig = tsconfigPath;
4830
5244
  else if (stat?.isDirectory()) {
4831
5245
  tsconfig = findTsconfig(tsconfigPath);
4832
- if (!tsconfig) logger.warn(`No tsconfig found in ${blue(tsconfigPath)}`);
5246
+ if (!tsconfig) logger.warn(`No tsconfig found in ${styleText$1.blue(tsconfigPath)}`);
4833
5247
  } else {
4834
5248
  tsconfig = findTsconfig(cwd, tsconfig);
4835
- if (!tsconfig) logger.warn(`tsconfig ${blue(original)} doesn't exist`);
5249
+ if (!tsconfig) logger.warn(`tsconfig ${styleText$1.blue(original)} doesn't exist`);
4836
5250
  }
4837
5251
  }
4838
5252
  if (tsconfig) logger.info(nameLabel, `tsconfig: ${color(path.relative(cwd, tsconfig))}`);
@@ -4891,7 +5305,7 @@ async function loadViteConfig(prefix, cwd, configLoader) {
4891
5305
  }).load(true);
4892
5306
  if (!result) return;
4893
5307
  let { config: [exported, deps], source } = result;
4894
- globalLogger.info(`Using Vite config: ${underline(source)}`);
5308
+ globalLogger.info(`Using Vite config: ${styleText$1.underline(source)}`);
4895
5309
  exported = await exported;
4896
5310
  if (typeof exported === "function") exported = await exported({
4897
5311
  command: "build",
@@ -4903,7 +5317,7 @@ async function loadViteConfig(prefix, cwd, configLoader) {
4903
5317
  };
4904
5318
  }
4905
5319
  const configPrefix = "tsdown.config";
4906
- async function loadConfigFile(inlineConfig, workspace, rootConfig) {
5320
+ async function loadConfigFile(inlineConfig, context, workspace) {
4907
5321
  let cwd = inlineConfig.cwd || process$1.cwd();
4908
5322
  let { config: filePath } = inlineConfig;
4909
5323
  if (filePath === false) return { configs: [{}] };
@@ -4951,12 +5365,9 @@ async function loadConfigFile(inlineConfig, workspace, rootConfig) {
4951
5365
  let deps;
4952
5366
  if (result) {
4953
5367
  ({config: [exported, deps], source: file} = result);
4954
- globalLogger.info(`config file: ${underline(file)}`, loader === "native" ? "" : `(${loader})`);
5368
+ globalLogger.info(`config file: ${styleText$1.underline(file)}`, loader === "native" ? "" : `(${loader})`);
4955
5369
  exported = await exported;
4956
- if (typeof exported === "function") exported = await exported(inlineConfig, {
4957
- ci: isInCI(),
4958
- rootConfig
4959
- });
5370
+ if (typeof exported === "function") exported = await exported(inlineConfig, context);
4960
5371
  }
4961
5372
  exported = toArray(exported);
4962
5373
  if (exported.length === 0) exported.push({});
@@ -5033,7 +5444,7 @@ async function resolveUserConfig(userConfig, inlineConfig, configDeps, runBuild
5033
5444
  if (result) userConfig = mergeConfig(userConfig, result);
5034
5445
  }
5035
5446
  }
5036
- 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, publicDir, hash = true, cwd = process$1.cwd(), name, workspace, exports = false, bundle, unbundle = typeof bundle === "boolean" ? !bundle : false, root, removeNodeProtocol, nodeProtocol, cjsDefault = true, globImport = true, css, injectStyle, outExtension, outExtensions, fixedExtension = platform === "node", devtools = false, write = true, exe = false } = userConfig;
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;
5037
5448
  const pkg = await readPackageJson(cwd);
5038
5449
  if (workspace) name ||= pkg?.name;
5039
5450
  const color = generateColor(name);
@@ -5047,12 +5458,6 @@ async function resolveUserConfig(userConfig, inlineConfig, configDeps, runBuild
5047
5458
  failOnWarn: resolveFeatureOption(failOnWarn, true),
5048
5459
  suppressWarnings
5049
5460
  });
5050
- if (typeof bundle === "boolean") logger.warn("`bundle` option is deprecated. Use `unbundle` instead.");
5051
- if (removeNodeProtocol) {
5052
- if (nodeProtocol) throw new TypeError("`removeNodeProtocol` is deprecated. Please only use `nodeProtocol` instead.");
5053
- logger.warn("`removeNodeProtocol` is deprecated. Use `nodeProtocol: \"strip\"` instead.");
5054
- }
5055
- nodeProtocol = nodeProtocol ?? (removeNodeProtocol ? "strip" : false);
5056
5461
  outDir = path.resolve(cwd, outDir);
5057
5462
  clean = resolveClean(clean, outDir, cwd);
5058
5463
  const rawEntry = entry;
@@ -5065,32 +5470,20 @@ async function resolveUserConfig(userConfig, inlineConfig, configDeps, runBuild
5065
5470
  unused = resolveFeatureOption(unused, {});
5066
5471
  report = resolveFeatureOption(report, {});
5067
5472
  exe = resolveFeatureOption(exe, {});
5068
- if (dts == null) if (exe) dts = false;
5069
- else if (pkg?.types || pkg?.typings || hasExportsTypes(pkg?.exports)) dts = true;
5070
- else if (tsconfig) {
5071
- const { config } = ee(tsconfig);
5072
- dts = !!config.compilerOptions?.declaration;
5073
- } else dts = false;
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
+ }
5074
5481
  dts = resolveFeatureOption(dts, {});
5075
5482
  if (!pkg) {
5076
5483
  if (exports) throw new Error("`package.json` not found, cannot write exports");
5077
5484
  if (publint) logger.warn(nameLabel, "publint is enabled but package.json is not found");
5078
5485
  if (attw) logger.warn(nameLabel, "attw is enabled but package.json is not found");
5079
5486
  }
5080
- if (injectStyle != null) if (css?.inject == null) {
5081
- logger.warn(`${blue`injectStyle`} is deprecated. Use ${blue`css.inject`} instead.`);
5082
- css = {
5083
- ...css,
5084
- inject: injectStyle
5085
- };
5086
- } else throw new TypeError("`injectStyle` is deprecated. Cannot be used with `css.inject`");
5087
- if (publicDir) if (copy) throw new TypeError("`publicDir` is deprecated. Cannot be used with `copy`");
5088
- else logger.warn(`${blue`publicDir`} is deprecated. Use ${blue`copy`} instead.`);
5089
- if (outExtension) {
5090
- if (outExtensions) throw new TypeError("`outExtension` is deprecated. Cannot be used with `outExtensions`");
5091
- logger.warn(`${blue`outExtension`} is deprecated. Use ${blue`outExtensions`} instead.`);
5092
- outExtensions = outExtension;
5093
- }
5094
5487
  envPrefix = toArray(envPrefix);
5095
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.");
5096
5489
  const envFromProcess = filterEnv(process$1.env, envPrefix);
@@ -5129,10 +5522,12 @@ async function resolveUserConfig(userConfig, inlineConfig, configDeps, runBuild
5129
5522
  });
5130
5523
  const depsConfig = resolveDepsConfig(userConfig, logger);
5131
5524
  devtools = resolveFeatureOption(devtools, {});
5132
- if (devtools) if (watch) {
5133
- if (devtools.ui) logger.warn("Devtools UI is not supported in watch mode, disabling it.");
5134
- devtools.ui = false;
5135
- } else devtools.ui ??= !!pkgExists("@vitejs/devtools/cli");
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
+ }
5136
5531
  const config = {
5137
5532
  ...userConfig,
5138
5533
  alias,
@@ -5140,7 +5535,7 @@ async function resolveUserConfig(userConfig, inlineConfig, configDeps, runBuild
5140
5535
  cjsDefault,
5141
5536
  clean,
5142
5537
  configDeps,
5143
- copy: publicDir || copy,
5538
+ copy,
5144
5539
  css,
5145
5540
  cwd,
5146
5541
  deps: depsConfig,
@@ -5239,7 +5634,7 @@ function filterConfig(filter, configCwd, name) {
5239
5634
  return toArray(filter).some((value) => name && name === value || cwd === value);
5240
5635
  }
5241
5636
  //#endregion
5242
- //#region ../../node_modules/.pnpm/tsdown@0.22.14_@arethetypeswrong+core@0.18.2_@tsdown+css@0.22.14_@tsdown+exe@0.22.14_@t_4084c24f9f44f250d2b604ebc16f10f3/node_modules/tsdown/dist/watch-DOMHXvCH.mjs
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
5243
5638
  async function copy(options) {
5244
5639
  if (!options.copy) return;
5245
5640
  const resolved = await resolveCopyEntries(options);
@@ -5320,7 +5715,8 @@ const gzipAsync = promisify(gzip);
5320
5715
  const defaultOptions = {
5321
5716
  gzip: true,
5322
5717
  brotli: false,
5323
- maxCompressSize: 1e6
5718
+ maxCompressSize: 1e6,
5719
+ summary: false
5324
5720
  };
5325
5721
  function ReportPlugin(config, cjsDts, isDualFormat) {
5326
5722
  return {
@@ -5359,10 +5755,10 @@ async function outputReport(config, chunks, outDir, cjsDts, isDualFormat) {
5359
5755
  return b.raw - a.raw;
5360
5756
  });
5361
5757
  const formatLabel = isDualFormat && prettyFormat(cjsDts ? "cjs" : config.format);
5362
- for (const size of sizes) {
5363
- const filenameColor = size.dts ? green : noop;
5758
+ if (!options.summary) for (const size of sizes) {
5759
+ const filenameColor = size.dts ? styleText$1.green : noop;
5364
5760
  const filename = path.normalize(size.filename);
5365
- config.logger.info(config.nameLabel, formatLabel, dim(outDir + path.sep) + filenameColor((size.isEntry ? bold : noop)(filename)), ` `.repeat(filenameLength - size.filename.length), dim(size.rawText), options.gzip && size.gzipText && dim`│ gzip: ${size.gzipText}`, options.brotli && size.brotliText && dim`│ brotli: ${size.brotliText}`);
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}`));
5366
5762
  }
5367
5763
  const totalSizeText = formatBytes(totalRaw);
5368
5764
  config.logger.info(config.nameLabel, formatLabel, `${sizes.length} files, total: ${totalSizeText}`);
@@ -5407,7 +5803,7 @@ function ShebangPlugin(logger, cwd, nameLabel, isDualFormat) {
5407
5803
  if (!RE_SHEBANG.test(chunk.code)) continue;
5408
5804
  const filepath = path.resolve(cwd, options.file || path.join(options.dir, chunk.fileName));
5409
5805
  if (await fsExists(filepath)) {
5410
- 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))}`);
5411
5807
  await chmod(filepath, 493);
5412
5808
  }
5413
5809
  }
@@ -5619,8 +6015,8 @@ var Hookable = class {
5619
6015
  }
5620
6016
  };
5621
6017
  //#endregion
5622
- //#region ../../node_modules/.pnpm/tsdown@0.22.14_@arethetypeswrong+core@0.18.2_@tsdown+css@0.22.14_@tsdown+exe@0.22.14_@t_4084c24f9f44f250d2b604ebc16f10f3/node_modules/tsdown/dist/build-D_enfyvD.mjs
5623
- var build_D_enfyvD_exports = /* @__PURE__ */ __exportAll$1({
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({
5624
6020
  n: () => buildWithConfigs,
5625
6021
  r: () => build_exports,
5626
6022
  t: () => build$1
@@ -5643,7 +6039,7 @@ const DEFAULT_EXCLUDE_WORKSPACE = [
5643
6039
  "**/test?(s)/**",
5644
6040
  "**/t?(e)mp/**"
5645
6041
  ];
5646
- async function resolveWorkspace(config, inlineConfig, rootDeps) {
6042
+ async function resolveWorkspace(config, inlineConfig, context, rootDeps) {
5647
6043
  const normalized = mergeConfig(config, inlineConfig);
5648
6044
  const rootCwd = normalized.cwd || process$1.cwd();
5649
6045
  const deps = new Set(rootDeps);
@@ -5668,6 +6064,10 @@ async function resolveWorkspace(config, inlineConfig, rootDeps) {
5668
6064
  expandDirectories: false
5669
6065
  })).map((file) => slash(path.resolve(file)));
5670
6066
  if (packages.length === 0) throw new Error("No workspace packages found, please check your config");
6067
+ context = {
6068
+ ...context,
6069
+ rootConfig: normalized
6070
+ };
5671
6071
  return {
5672
6072
  configs: (await Promise.all(packages.map(async (cwd) => {
5673
6073
  debug$5("loading workspace config %s", cwd);
@@ -5675,7 +6075,7 @@ async function resolveWorkspace(config, inlineConfig, rootDeps) {
5675
6075
  ...inlineConfig,
5676
6076
  config: workspaceConfig,
5677
6077
  cwd
5678
- }, cwd, normalized);
6078
+ }, context, cwd);
5679
6079
  workspaceDeps?.forEach((dep) => deps.add(dep));
5680
6080
  return configs.map((config) => mergeConfig(normalized, config));
5681
6081
  }))).flat(),
@@ -5683,14 +6083,18 @@ async function resolveWorkspace(config, inlineConfig, rootDeps) {
5683
6083
  };
5684
6084
  }
5685
6085
  const debug$4 = createDebug("tsdown:config");
5686
- async function resolveConfig(inlineConfig) {
6086
+ async function resolveConfig(inlineConfig, watch) {
5687
6087
  debug$4("inline config %O", inlineConfig);
5688
6088
  if (inlineConfig.cwd) inlineConfig.cwd = path.resolve(inlineConfig.cwd);
5689
- const { configs: rootConfigs, deps: rootDeps } = await loadConfigFile(inlineConfig);
6089
+ const context = {
6090
+ ci: isInCI(),
6091
+ watch
6092
+ };
6093
+ const { configs: rootConfigs, deps: rootDeps } = await loadConfigFile(inlineConfig, context);
5690
6094
  const globalDeps = new Set(rootDeps);
5691
6095
  const runBuild = createConcurrencyExecutor(inlineConfig.concurrency);
5692
6096
  const configs = (await Promise.all(rootConfigs.map(async (rootConfig) => {
5693
- const { configs: workspaceConfigs, deps: workspaceDeps } = await resolveWorkspace(rootConfig, inlineConfig, rootDeps);
6097
+ const { configs: workspaceConfigs, deps: workspaceDeps } = await resolveWorkspace(rootConfig, inlineConfig, context, rootDeps);
5694
6098
  debug$4("workspace configs %O", workspaceConfigs);
5695
6099
  const configs = (await Promise.all(workspaceConfigs.filter((config) => !config.workspace || config.entry).map((config) => resolveUserConfig(config, inlineConfig, workspaceDeps, runBuild)))).flat().filter((config) => !!config);
5696
6100
  workspaceDeps.forEach((dep) => globalDeps.add(dep));
@@ -5712,23 +6116,6 @@ function warnLegacyCJS(config) {
5712
6116
  return version && satisfies(version, RANGE_REQUIRING_ESM);
5713
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");
5714
6118
  }
5715
- function CjsDtsReexportPlugin() {
5716
- return {
5717
- name: "tsdown:cjs-dts-reexport",
5718
- generateBundle(_options, bundle) {
5719
- for (const chunk of Object.values(bundle)) {
5720
- if (chunk.type !== "chunk" || !chunk.isEntry) continue;
5721
- if (!chunk.fileName.endsWith(".cjs") && !chunk.fileName.endsWith(".js")) continue;
5722
- const content = `export type * from './${path.basename(chunk.fileName.replace(RE_JS, ".d.mts"))}'\n`;
5723
- this.emitFile({
5724
- type: "prebuilt-chunk",
5725
- fileName: filename_js_to_dts(chunk.fileName),
5726
- code: content
5727
- });
5728
- }
5729
- }
5730
- };
5731
- }
5732
6119
  async function startDevtoolsUI(config) {
5733
6120
  const { start } = await importWithError("@vitejs/devtools/cli-commands");
5734
6121
  await start({
@@ -5768,7 +6155,7 @@ function executeOnSuccess(config) {
5768
6155
  return ab;
5769
6156
  }
5770
6157
  const debug$3 = createDebug("tsdown:attw");
5771
- const label$1 = dim`[attw]`;
6158
+ const label$1 = styleText$1.dim(`[attw]`);
5772
6159
  const problemFlags = {
5773
6160
  NoResolution: "no-resolution",
5774
6161
  UntypedResolution: "untyped-resolution",
@@ -5800,7 +6187,7 @@ async function attw(options, tarball) {
5800
6187
  options.logger.warn("attw is enabled but package.json is not found");
5801
6188
  return;
5802
6189
  }
5803
- const { profile = "strict", level = "warn", ignoreRules = [], ...attwOptions } = options.attw;
6190
+ const { profile = "esm-only", level = "warn", ignoreRules = [], ...attwOptions } = options.attw;
5804
6191
  const invalidRules = ignoreRules.filter((rule) => !Object.values(problemFlags).includes(rule));
5805
6192
  if (invalidRules.length) options.logger.warn(`attw config option 'ignoreRules' contains invalid value '${invalidRules.join(", ")}'.`);
5806
6193
  const t = performance.now();
@@ -5818,7 +6205,7 @@ async function attw(options, tarball) {
5818
6205
  if (problems.length) errorMessage = `problems found:\n${problems.map((problem) => formatProblem(checkResult.packageName, problem)).join("\n")}`;
5819
6206
  } else errorMessage = `Package has no types`;
5820
6207
  if (errorMessage) options.logger[level](options.nameLabel, label$1, errorMessage);
5821
- 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)`));
5822
6209
  }
5823
6210
  /**
5824
6211
  * Format an ATTW problem for display
@@ -5846,7 +6233,7 @@ function formatProblem(packageName, problem) {
5846
6233
  }
5847
6234
  }
5848
6235
  const debug$2 = createDebug("tsdown:publint");
5849
- const label = dim`[publint]`;
6236
+ const label = styleText$1.dim(`[publint]`);
5850
6237
  async function publint(options, tarball) {
5851
6238
  if (!options.publint) return;
5852
6239
  if (!options.pkg) {
@@ -5863,7 +6250,7 @@ async function publint(options, tarball) {
5863
6250
  });
5864
6251
  debug$2("Found %d issues", messages.length);
5865
6252
  if (!messages.length) {
5866
- 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)`));
5867
6254
  return;
5868
6255
  }
5869
6256
  for (const message of messages) {
@@ -5908,9 +6295,9 @@ async function bundleDone(bundleByPkg, bundle) {
5908
6295
  if (exportsConfigs.length) {
5909
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")}`);
5910
6297
  const chunks = {};
5911
- const inlinedDeps = mergeInlinedDeps(ctx.bundles);
5912
- for (const bundle of ctx.bundles) {
5913
- if (!bundle.config.exports) continue;
6298
+ const exportsBundles = ctx.bundles.filter((bundle) => bundle.config.exports);
6299
+ const inlinedDeps = mergeInlinedDeps(exportsBundles);
6300
+ for (const bundle of exportsBundles) {
5914
6301
  chunks[bundle.config.format] ||= [];
5915
6302
  chunks[bundle.config.format].push(...bundle.chunks);
5916
6303
  }
@@ -5934,7 +6321,7 @@ async function bundleDone(bundleByPkg, bundle) {
5934
6321
  async function packTarball(packageJsonPath) {
5935
6322
  const pkgDir = path.dirname(packageJsonPath);
5936
6323
  const destination = await mkdtemp(path.join(tmpdir(), "tsdown-pack-"));
5937
- const { detect } = await import("./detect-DGhJGEqb-LL52mV6u.js");
6324
+ const { detect } = await import("./detect-Bg-d8iUV-KfbO7neP.js");
5938
6325
  try {
5939
6326
  const detected = await detect({ cwd: pkgDir });
5940
6327
  debug$1("Detected package manager: %o", detected);
@@ -5992,20 +6379,16 @@ async function pack(dir, pm, destination, ignoreScripts) {
5992
6379
  case "bun":
5993
6380
  args.push("--destination", destination);
5994
6381
  break;
5995
- default:
5996
- args.push("--pack-destination", destination);
5997
- break;
6382
+ default: args.push("--pack-destination", destination);
5998
6383
  }
5999
6384
  if (ignoreScripts) switch (pm.agent) {
6000
6385
  case "pnpm":
6001
6386
  args.push("--config.ignore-scripts=true");
6002
6387
  break;
6003
6388
  case "yarn@berry": break;
6004
- default:
6005
- args.push("--ignore-scripts");
6006
- break;
6389
+ default: args.push("--ignore-scripts");
6007
6390
  }
6008
- const output = await x$1(command, args, {
6391
+ const output = await x(command, args, {
6009
6392
  nodePath: false,
6010
6393
  nodeOptions: { cwd: dir }
6011
6394
  });
@@ -6077,14 +6460,13 @@ async function resolveInputOptions(config, format, configDeps, bundle, cjsDts, i
6077
6460
  const isSuppressed = createSuppressWarnings(logger.options?.suppressWarnings);
6078
6461
  const plugins = [];
6079
6462
  if (nodeProtocol) plugins.push(NodeProtocolPlugin(nodeProtocol));
6080
- if (config.pkg || config.deps.skipNodeModulesBundle || config.deps.neverBundle === true || config.deps.dts.neverBundle === true) plugins.push(DepsPlugin(config, bundle));
6463
+ if (config.pkg || config.deps.neverBundle === true || config.deps.dts.neverBundle === true) plugins.push(DepsPlugin(config, bundle));
6081
6464
  if (dts) {
6082
- const { dts: dtsPlugin } = await import("./dist-BsS7BOcb.js");
6083
- const { cjsReexport: _, ...dtsPluginOptions } = dts;
6465
+ const { dts: dtsPlugin } = await import("./dist-Cuw3Ngo4.js");
6084
6466
  const options = {
6085
6467
  tsconfig,
6086
6468
  logger,
6087
- ...dtsPluginOptions
6469
+ ...dts
6088
6470
  };
6089
6471
  if (format === "es") plugins.push(dtsPlugin(options));
6090
6472
  else if (cjsDts) plugins.push(dtsPlugin({
@@ -6092,7 +6474,6 @@ async function resolveInputOptions(config, format, configDeps, bundle, cjsDts, i
6092
6474
  emitDtsOnly: true,
6093
6475
  cjsDefault
6094
6476
  }));
6095
- else if (dts.cjsReexport && isDualFormat) plugins.push(CjsDtsReexportPlugin());
6096
6477
  }
6097
6478
  let cssPostPlugins;
6098
6479
  if (!cjsDts) {
@@ -6208,14 +6589,15 @@ async function debugBuildOptions(dir, name, format, buildOptions) {
6208
6589
  maxArrayLength: null,
6209
6590
  maxStringLength: null
6210
6591
  }, buildOptions);
6211
- await writeFile(outFile, `/*
6592
+ const code = `/*
6212
6593
  Auto-generated rolldown config for tsdown debug purposes
6213
6594
  tsdown v${version}, rolldown v${VERSION}
6214
6595
  Generated on ${(/* @__PURE__ */ new Date()).toISOString()}
6215
6596
  Package name: ${name || "not specified"}
6216
6597
  */
6217
6598
 
6218
- export default ${serialized}\n`);
6599
+ export default ${serialized}\n`;
6600
+ await writeFile(outFile, code);
6219
6601
  debug("Wrote debug rolldown config for \"%s\" (%s) -> %s", name || "default name", format, outFile);
6220
6602
  }
6221
6603
  function handlePluginInspect(plugins) {
@@ -6256,9 +6638,7 @@ function shortcuts(restart) {
6256
6638
  {
6257
6639
  key: "r",
6258
6640
  description: "reload config and rebuild",
6259
- action() {
6260
- restart();
6261
- }
6641
+ action: restart
6262
6642
  },
6263
6643
  {
6264
6644
  key: "c",
@@ -6282,7 +6662,7 @@ function shortcuts(restart) {
6282
6662
  if (loggedKeys.has(shortcut.key)) continue;
6283
6663
  loggedKeys.add(shortcut.key);
6284
6664
  if (shortcut.action == null) continue;
6285
- 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}`));
6286
6666
  }
6287
6667
  return;
6288
6668
  }
@@ -6300,14 +6680,27 @@ var build_exports = /* @__PURE__ */ __exportAll({
6300
6680
  build: () => build$1,
6301
6681
  buildWithConfigs: () => buildWithConfigs
6302
6682
  });
6303
- const asyncDispose = Symbol.asyncDispose || Symbol.for("Symbol.asyncDispose");
6304
6683
  /**
6305
6684
  * Build with tsdown.
6306
6685
  */
6307
6686
  async function build$1(inlineConfig = {}) {
6308
6687
  globalLogger.level = inlineConfig.logLevel || "info";
6309
- const { configs, deps: configDeps } = await resolveConfig(inlineConfig);
6310
- return buildWithConfigs(configs, configDeps, () => build$1(inlineConfig));
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
+ }
6311
6704
  }
6312
6705
  /**
6313
6706
  * Build with `ResolvedConfigs`.
@@ -6315,20 +6708,29 @@ async function build$1(inlineConfig = {}) {
6315
6708
  * **Internal API, not for public use**
6316
6709
  * @private
6317
6710
  */
6318
- async function buildWithConfigs(configs, configDeps, _restart) {
6711
+ async function buildWithConfigs(configs, configDeps, rebuild) {
6712
+ const hasWatchConfig = configs.some((config) => config.watch);
6319
6713
  let cleanPromise;
6320
6714
  const clean = () => {
6321
6715
  if (cleanPromise) return cleanPromise;
6322
6716
  return cleanPromise = cleanOutDir(configs);
6323
6717
  };
6324
6718
  const disposeCbs = [];
6325
- let restarting = false;
6326
- async function restart() {
6327
- if (restarting) return;
6328
- restarting = true;
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();
6329
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();
6330
6732
  clearRequireCache();
6331
- _restart();
6733
+ return rebuild();
6332
6734
  }
6333
6735
  const configChunksByPkg = initBundleByPkg(configs);
6334
6736
  function done(bundle) {
@@ -6336,14 +6738,23 @@ async function buildWithConfigs(configs, configDeps, _restart) {
6336
6738
  }
6337
6739
  globalLogger.info("Build start");
6338
6740
  const bundles = await Promise.all(configs.map((options) => {
6339
- return buildSingle(options, configDeps, options.pkg ? configChunksByPkg[options.pkg.packageJsonPath].formats.size > 1 : true, clean, restart, done);
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);
6340
6745
  }));
6341
6746
  const firstDevtoolsConfig = configs.find((config) => config.devtools && config.devtools.ui);
6342
- if (configs.some((config) => config.watch)) {
6747
+ if (hasWatchConfig) {
6343
6748
  disposeCbs.push(shortcuts(restart));
6344
- for (const bundle of bundles) disposeCbs.push(bundle[asyncDispose]);
6749
+ for (const bundle of bundles) disposeCbs.push(bundle[Symbol.asyncDispose]);
6345
6750
  } else if (firstDevtoolsConfig) startDevtoolsUI(firstDevtoolsConfig.devtools);
6346
- return bundles;
6751
+ return {
6752
+ bundles,
6753
+ watch: {
6754
+ restart,
6755
+ close
6756
+ }
6757
+ };
6347
6758
  }
6348
6759
  /**
6349
6760
  * Build a single configuration, without watch and shortcuts features.
@@ -6368,7 +6779,7 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
6368
6779
  chunks,
6369
6780
  config,
6370
6781
  inlinedDeps: /* @__PURE__ */ new Map(),
6371
- async [asyncDispose]() {
6782
+ async [Symbol.asyncDispose]() {
6372
6783
  debouncedPostBuild.cancel();
6373
6784
  ab?.abort();
6374
6785
  await watcher?.close();
@@ -6377,17 +6788,18 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
6377
6788
  const configs = await initBuildOptions();
6378
6789
  if (watch$1) {
6379
6790
  watcher = watch(configs);
6380
- handleWatcher(watcher);
6791
+ await handleWatcher(watcher);
6381
6792
  } else {
6382
6793
  const outputs = await config.runBuild(() => build(configs));
6383
6794
  for (const { output } of outputs) chunks.push(...addOutDirToChunks(output, outDir));
6384
6795
  }
6385
6796
  if (!watch$1) {
6386
- 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`)}`);
6387
6798
  await postBuild();
6388
6799
  }
6389
6800
  return bundle;
6390
6801
  function handleWatcher(watcher) {
6802
+ const ready = Promise.withResolvers();
6391
6803
  const changedFile = [];
6392
6804
  let hasError = false;
6393
6805
  watcher.on("change", async (id, event) => {
@@ -6415,6 +6827,7 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
6415
6827
  if (config.clean.length) await cleanChunks(config.outDir, chunks);
6416
6828
  chunks.length = 0;
6417
6829
  hasError = false;
6830
+ ready.resolve();
6418
6831
  break;
6419
6832
  case "END":
6420
6833
  if (!hasError) debouncedPostBuild();
@@ -6422,7 +6835,7 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
6422
6835
  case "BUNDLE_START":
6423
6836
  if (changedFile.length) {
6424
6837
  logger.clearScreen("info");
6425
- logger.info(`Found ${bold(changedFile.join(", "))} changed, rebuilding...`);
6838
+ logger.info(`Found ${styleText$1.bold(changedFile.join(", "))} changed, rebuilding...`);
6426
6839
  }
6427
6840
  changedFile.length = 0;
6428
6841
  break;
@@ -6436,6 +6849,7 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
6436
6849
  hasError = true;
6437
6850
  }
6438
6851
  });
6852
+ return ready.promise;
6439
6853
  }
6440
6854
  async function initBuildOptions() {
6441
6855
  const buildOptions = await getBuildOptions(config, format, configDeps, bundle, false, isDualFormat);
@@ -6445,7 +6859,7 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
6445
6859
  });
6446
6860
  if (debugRolldownConfigDir) await debugBuildOptions(debugRolldownConfigDir, config.name, format, buildOptions);
6447
6861
  const configs = [buildOptions];
6448
- if (format === "cjs" && dts && (!isDualFormat || !dts.cjsReexport)) configs.push(await getBuildOptions(config, format, configDeps, bundle, true, isDualFormat));
6862
+ if (format === "cjs" && dts) configs.push(await getBuildOptions(config, format, configDeps, bundle, true, isDualFormat));
6449
6863
  return configs;
6450
6864
  }
6451
6865
  async function postBuild() {
@@ -6462,4 +6876,4 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
6462
6876
  }
6463
6877
  }
6464
6878
  //#endregion
6465
- export { resolveUserConfig as a, mergeConfig as i, buildWithConfigs as n, at as o, build_D_enfyvD_exports as r, ee as s, build$1 as t };
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 };