@voidzero-dev/vite-plus-core 0.3.0 → 0.3.2

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 (69) hide show
  1. package/LICENSE +0 -29
  2. package/dist/rolldown/cli.mjs +6 -6
  3. package/dist/rolldown/config.d.mts +1 -1
  4. package/dist/rolldown/config.mjs +2 -2
  5. package/dist/rolldown/experimental-index.d.mts +38 -4
  6. package/dist/rolldown/experimental-index.mjs +35 -9
  7. package/dist/rolldown/experimental-runtime-types.d.ts +2 -2
  8. package/dist/rolldown/experimental-runtime.d.ts +2 -2
  9. package/dist/rolldown/experimental-runtime.mjs +2 -2
  10. package/dist/rolldown/filter-index.d.mts +1 -1
  11. package/dist/rolldown/filter-index.mjs +1 -3
  12. package/dist/rolldown/index.d.mts +3 -3
  13. package/dist/rolldown/index.mjs +4 -4
  14. package/dist/rolldown/parallel-plugin-worker.mjs +2 -2
  15. package/dist/rolldown/parallel-plugin.d.mts +1 -1
  16. package/dist/rolldown/parse-ast-index.d.mts +1 -1
  17. package/dist/rolldown/parse-ast-index.mjs +1 -1
  18. package/dist/rolldown/plugins-index.d.mts +3 -3
  19. package/dist/rolldown/plugins-index.mjs +2 -2
  20. package/dist/rolldown/shared/{binding-C__LJDBG.mjs → binding-DH95uVkp.mjs} +27 -27
  21. package/dist/rolldown/shared/{binding-Bvw14S3g.d.mts → binding-DZuNHVw4.d.mts} +19 -5
  22. package/dist/rolldown/shared/{bindingify-input-options-V9YvAjrr.mjs → bindingify-input-options-BL4xrXys.mjs} +11 -9
  23. package/dist/rolldown/shared/{constructors-CRumnw21.d.mts → constructors-BnIg8feC.d.mts} +2 -2
  24. package/dist/rolldown/shared/{constructors-DklcHr18.mjs → constructors-CrhQ-yy_.mjs} +1 -1
  25. package/dist/rolldown/shared/{create-bundler-option-DbV2ud0B.mjs → create-bundler-option-Dk9AZBn_.mjs} +72 -6
  26. package/dist/rolldown/shared/{define-config-DwTNhgWB.d.mts → define-config-DjHYbH6S.d.mts} +40 -3
  27. package/dist/rolldown/shared/{error-NcRuXAVN.mjs → error-CRNyaqoL.mjs} +1 -1
  28. package/dist/rolldown/shared/{load-config-Dd7jKGUy.mjs → load-config-CKqTUKwB.mjs} +1 -1
  29. package/dist/rolldown/shared/{normalize-string-or-regex-CFtim40S.mjs → normalize-string-or-regex-BgP6W4eD.mjs} +1 -1
  30. package/dist/rolldown/shared/{parse-rvxTD36n.mjs → parse-DYyNe0IU.mjs} +2 -2
  31. package/dist/rolldown/shared/{resolve-tsconfig-D2vSIIkR.mjs → resolve-tsconfig-jh43hFM_.mjs} +10 -6
  32. package/dist/rolldown/shared/{rolldown-Bblizyw1.mjs → rolldown-BpXK1q5_.mjs} +5 -4
  33. package/dist/rolldown/shared/{transform--WSMLt1x.d.mts → transform-CVse9_mH.d.mts} +8 -4
  34. package/dist/rolldown/shared/{watch-DPvOlccK.mjs → watch-Due6uYkS.mjs} +4 -4
  35. package/dist/rolldown/utils-index.d.mts +3 -3
  36. package/dist/rolldown/utils-index.mjs +5 -5
  37. package/dist/tsdown/{build-D_enfyvD-tOzhITac.js → build-JVmLFaZt-BN9yuB6k.js} +683 -682
  38. package/dist/tsdown/{debug-CKcBYQLP-By_AQqN8.js → debug-CpC4hV25-BeCITV83.js} +18 -14
  39. package/dist/tsdown/{detect-DGhJGEqb-LL52mV6u.js → detect-Bg-d8iUV-Cr_BRLVW.js} +10 -12
  40. package/dist/tsdown/{dist-BsS7BOcb.js → dist-ByW_jJfv.js} +1226 -893
  41. package/dist/tsdown/index-types.d.ts +239 -317
  42. package/dist/tsdown/index.js +4 -4
  43. package/dist/tsdown/internal-DTYQdXId.js +3 -0
  44. package/dist/tsdown/{main-Bcv7jU2b.js → main-bgV9NlwM.js} +24 -145
  45. package/dist/tsdown/{resolver-cwLsPb2o-Bb9SDBm6.js → resolver-DE0_sy8o-UMsN-SXx.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-D5xv98Iu.js} +5 -5
  49. package/dist/tsdown/{target-Bab3CUeB-8PBzMh3p.js → target-DgdLrXba-DaJJ11xX.js} +78 -74
  50. package/dist/tsdown/{tsc-B8FD48Oc.js → tsc-BFDF_Im9.js} +26 -20
  51. package/dist/tsdown/tsdown-css.js +19 -11
  52. package/dist/tsdown/tsdown-exe.js +4 -4
  53. package/dist/vite/client/bundledDevClient.mjs +77 -42
  54. package/dist/vite/client/client.mjs +288 -260
  55. package/dist/vite/node/chunks/build.js +21 -21
  56. package/dist/vite/node/chunks/lib.js +2 -2
  57. package/dist/vite/node/chunks/node.js +32781 -32305
  58. package/dist/vite/node/chunks/postcss-import.js +10 -10
  59. package/dist/vite/node/cli.js +12 -8
  60. package/dist/vite/node/index.d.ts +1568 -1577
  61. package/dist/vite/node/index.js +1 -1
  62. package/dist/vite/node/module-runner.d.ts +1 -1
  63. package/dist/vite/node/module-runner.js +201 -202
  64. package/dist/vite/types/customEvent.d.ts +2 -0
  65. package/dist/vite/types/hmrPayload.d.ts +2 -0
  66. package/dist/vite/types/internal/cssPreprocessorOptions.d.ts +2 -2
  67. package/dist/vite/types/internal/devtoolsOptions.d.ts +9 -0
  68. package/package.json +28 -31
  69. package/dist/tsdown/internal-DSmmwu4u.js +0 -3
@@ -1,24 +1,25 @@
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 { c as importWithError, d as pkgExists, f as resolveComma, g as toArray, h as styleText$1, l as matchPattern, m as slash, n as x, o as createConcurrencyExecutor, p as resolveRegex, r as createDebug, s as debounce, t as exec, u as noop } from "./main-bgV9NlwM.js";
3
+ 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-CpC4hV25-BeCITV83.js";
4
+ import { A as fsStat, D as fsCopy, E as formatBytes, M as stripExtname, O as fsExists, a as resolveTarget, g as RE_JS, j as lowestCommonAncestor, k as fsRemove, l as parseRange, m as RE_DTS, o as validateSea, p as RE_CSS, r as buildExe, s as coerce, u as satisfies, v as RE_NODE_MODULES$1 } from "./target-DgdLrXba-DaJJ11xX.js";
4
5
  import module$1, { builtinModules, createRequire, isBuiltin } from "node:module";
5
6
  import process$1 from "node:process";
6
- import readline from "node:readline";
7
7
  import { formatWithOptions, inspect, isDeepStrictEqual, parseEnv, promisify } from "node:util";
8
+ import readline from "node:readline";
8
9
  import path, { dirname, isAbsolute, join, parse, resolve } from "node:path";
9
- import re, { existsSync, readFileSync, writeFileSync } from "node:fs";
10
+ import { fileURLToPath, pathToFileURL } from "node:url";
11
+ import X, { existsSync, readFileSync, writeFileSync } from "node:fs";
10
12
  import { VERSION, build, watch } from "@voidzero-dev/vite-plus-core/rolldown";
11
13
  import { chmod, mkdtemp, readFile, readdir, writeFile } from "node:fs/promises";
12
14
  import { and, id, importerId, include } from "@voidzero-dev/vite-plus-core/rolldown/filter";
13
15
  import * as nativeFs from "fs";
14
16
  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";
17
+ import Se from "os";
18
+ 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
19
  import { Visitor, parse as parse$1 } from "@voidzero-dev/vite-plus-core/rolldown/utils";
18
20
  import { tmpdir } from "node:os";
19
- import { fileURLToPath } from "url";
21
+ import { fileURLToPath as fileURLToPath$1 } from "url";
20
22
  import { createRequire as createRequire$1 } from "module";
21
- import { fileURLToPath as fileURLToPath$1, pathToFileURL } from "node:url";
22
23
  import { AsyncLocalStorage } from "node:async_hooks";
23
24
  import { Buffer } from "node:buffer";
24
25
  import { brotliCompress, gzip } from "node:zlib";
@@ -27,7 +28,7 @@ import { importGlobPlugin } from "@voidzero-dev/vite-plus-core/rolldown/experime
27
28
  const A = (r) => r !== null && typeof r == "object";
28
29
  const a = (r, t) => Object.assign(/* @__PURE__ */ new Error(`[${r}]: ${t}`), { code: r });
29
30
  const _$1 = "ERR_INVALID_PACKAGE_CONFIG";
30
- const E = "ERR_INVALID_PACKAGE_TARGET";
31
+ const E$1 = "ERR_INVALID_PACKAGE_TARGET";
31
32
  const I$1 = "ERR_PACKAGE_PATH_NOT_EXPORTED";
32
33
  const R$1 = /^\d+$/;
33
34
  const O = /^(\.{1,2}|node_modules)$/i;
@@ -37,7 +38,7 @@ const f = (r, t, e, o, c) => {
37
38
  if (t == null) return [];
38
39
  if (typeof t == "string") {
39
40
  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`);
41
+ if (n === ".." || i.some((l) => O.test(l))) throw a(E$1, `Invalid "${r}" target "${t}" defined in the package config`);
41
42
  return [c ? t.replace(/\*/g, c) : t];
42
43
  }
43
44
  if (Array.isArray(t)) return t.flatMap((n) => f(r, n, e, o, c));
@@ -48,7 +49,7 @@ const f = (r, t, e, o, c) => {
48
49
  }
49
50
  return [];
50
51
  }
51
- throw a(E, `Invalid "${r}" target "${t}"`);
52
+ throw a(E$1, `Invalid "${r}" target "${t}"`);
52
53
  };
53
54
  const s = "*";
54
55
  const m = (r, t) => {
@@ -78,31 +79,36 @@ const v = (r, t, e) => {
78
79
  t = t === "" ? "." : `./${t}`, (typeof r == "string" || Array.isArray(r) || A(r) && p(r)) && (r = { ".": r });
79
80
  const [o, c] = d(r, t), n = f(h.Export, r[o], t, e, c);
80
81
  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`);
82
+ 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
83
  return n;
83
84
  };
84
85
  //#endregion
85
- //#region ../../node_modules/.pnpm/get-tsconfig@5.0.0-beta.5/node_modules/get-tsconfig/dist/index.mjs
86
+ //#region ../../node_modules/.pnpm/get-tsconfig@5.0.0-beta.6/node_modules/get-tsconfig/dist/index.mjs
86
87
  var Le = Object.defineProperty;
87
88
  var i = (e, n) => Le(e, "name", {
88
89
  value: n,
89
90
  configurable: !0
90
91
  });
91
- function x(e) {
92
+ function E(e) {
92
93
  return e.startsWith("\\\\?\\") ? e : e.replace(/\\/g, "/");
93
94
  }
94
- i(x, "slash");
95
+ i(E, "slash");
95
96
  const _e = i((e, n) => {
96
97
  const s = `readFileSync:${n}`;
97
98
  let t = e?.get(s);
98
- return t === void 0 && (t = re.readFileSync(n, "utf8"), e?.set(s, t)), t;
99
+ return t === void 0 && (t = X.readFileSync(n, "utf8"), e?.set(s, t)), t;
99
100
  }, "readFile");
100
- const F = i((e, n) => {
101
+ const Ne = i((e, n) => {
102
+ const s = `realpathSync:${n}`;
103
+ let t = e?.get(s);
104
+ return t === void 0 && (t = X.realpathSync(n), e?.set(s, t)), t;
105
+ }, "realpath");
106
+ const $ = i((e, n) => {
101
107
  const s = `tryStat:${n}`;
102
108
  let t = e?.get(s);
103
109
  if (t === void 0) {
104
110
  try {
105
- t = re.statSync(n);
111
+ t = X.statSync(n);
106
112
  } catch {
107
113
  t = null;
108
114
  }
@@ -113,148 +119,148 @@ const F = i((e, n) => {
113
119
  const R = i((e, n, s) => {
114
120
  for (;;) {
115
121
  const t = path.posix.join(e, n);
116
- if (F(s, t)) return t;
122
+ if ($(s, t)) return t;
117
123
  const o = path.dirname(e);
118
124
  if (o === e) return;
119
125
  e = o;
120
126
  }
121
127
  }, "findUp");
122
- function Ne(e, n = !1) {
128
+ function Re(e, n = !1) {
123
129
  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;) {
130
+ let t = 0, o = "", r = 0, c = 16, g = 0, m = 0, k = 0, v = 0, f = 0;
131
+ function O(l, T) {
132
+ let A = 0, b = 0;
133
+ for (; A < l;) {
128
134
  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;
135
+ if (d >= 48 && d <= 57) b = b * 16 + d - 48;
136
+ else if (d >= 65 && d <= 70) b = b * 16 + d - 65 + 10;
137
+ else if (d >= 97 && d <= 102) b = b * 16 + d - 97 + 10;
132
138
  else break;
133
- t++, j++;
139
+ t++, A++;
134
140
  }
135
- return j < f && (v = -1), v;
141
+ return A < l && (b = -1), b;
136
142
  }
137
- i(A, "scanHexDigits");
138
- function O(f) {
139
- t = f, o = "", r = 0, l = 16, u = 0;
143
+ i(O, "scanHexDigits");
144
+ function j(l) {
145
+ t = l, o = "", r = 0, c = 16, f = 0;
140
146
  }
141
- i(O, "setPosition");
142
- function h() {
143
- let f = t;
147
+ i(j, "setPosition");
148
+ function y() {
149
+ let l = t;
144
150
  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;
151
+ else for (t++; t < e.length && I(e.charCodeAt(t));) t++;
152
+ 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++;
153
+ else return f = 3, e.substring(l, t);
154
+ let T = t;
155
+ 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))) {
156
+ for (t++; t < e.length && I(e.charCodeAt(t));) t++;
157
+ T = t;
158
+ } else f = 3;
159
+ return e.substring(l, T);
160
+ }
161
+ i(y, "scanNumber");
162
+ function x() {
163
+ let l = "", T = t;
158
164
  for (;;) {
159
165
  if (t >= s) {
160
- f += e.substring(y, t), u = 2;
166
+ l += e.substring(T, t), f = 2;
161
167
  break;
162
168
  }
163
- const j = e.charCodeAt(t);
164
- if (j === 34) {
165
- f += e.substring(y, t), t++;
169
+ const A = e.charCodeAt(t);
170
+ if (A === 34) {
171
+ l += e.substring(T, t), t++;
166
172
  break;
167
173
  }
168
- if (j === 92) {
169
- if (f += e.substring(y, t), t++, t >= s) {
170
- u = 2;
174
+ if (A === 92) {
175
+ if (l += e.substring(T, t), t++, t >= s) {
176
+ f = 2;
171
177
  break;
172
178
  }
173
179
  switch (e.charCodeAt(t++)) {
174
180
  case 34:
175
- f += "\"";
181
+ l += "\"";
176
182
  break;
177
183
  case 92:
178
- f += "\\";
184
+ l += "\\";
179
185
  break;
180
186
  case 47:
181
- f += "/";
187
+ l += "/";
182
188
  break;
183
189
  case 98:
184
- f += "\b";
190
+ l += "\b";
185
191
  break;
186
192
  case 102:
187
- f += "\f";
193
+ l += "\f";
188
194
  break;
189
195
  case 110:
190
- f += `
196
+ l += `
191
197
  `;
192
198
  break;
193
199
  case 114:
194
- f += "\r";
200
+ l += "\r";
195
201
  break;
196
202
  case 116:
197
- f += " ";
203
+ l += " ";
198
204
  break;
199
205
  case 117:
200
- const d = A(4);
201
- d >= 0 ? f += String.fromCharCode(d) : u = 4;
206
+ const d = O(4);
207
+ d >= 0 ? l += String.fromCharCode(d) : f = 4;
202
208
  break;
203
- default: u = 5;
209
+ default: f = 5;
204
210
  }
205
- y = t;
211
+ T = t;
206
212
  continue;
207
213
  }
208
- if (j >= 0 && j <= 31) if (P(j)) {
209
- f += e.substring(y, t), u = 2;
214
+ if (A >= 0 && A <= 31) if (P(A)) {
215
+ l += e.substring(T, t), f = 2;
210
216
  break;
211
- } else u = 6;
217
+ } else f = 6;
212
218
  t++;
213
219
  }
214
- return f;
220
+ return l;
215
221
  }
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)) {
222
+ i(x, "scanString");
223
+ function p() {
224
+ if (o = "", f = 0, r = t, m = g, v = k, t >= s) return r = s, c = 17;
225
+ let l = e.charCodeAt(t);
226
+ if (Y(l)) {
221
227
  do
222
- t++, o += String.fromCharCode(f), f = e.charCodeAt(t);
223
- while (X(f));
224
- return l = 15;
228
+ t++, o += String.fromCharCode(l), l = e.charCodeAt(t);
229
+ while (Y(l));
230
+ return c = 15;
225
231
  }
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;
232
+ if (P(l)) return t++, o += String.fromCharCode(l), l === 13 && e.charCodeAt(t) === 10 && (t++, o += `
233
+ `), g++, k = t, c = 14;
234
+ switch (l) {
235
+ case 123: return t++, c = 1;
236
+ case 125: return t++, c = 2;
237
+ case 91: return t++, c = 3;
238
+ case 93: return t++, c = 4;
239
+ case 58: return t++, c = 6;
240
+ case 44: return t++, c = 5;
241
+ case 34: return t++, o = x(), c = 10;
236
242
  case 47:
237
- const y = t - 1;
243
+ const T = t - 1;
238
244
  if (e.charCodeAt(t + 1) === 47) {
239
245
  for (t += 2; t < s && !P(e.charCodeAt(t));) t++;
240
- return o = e.substring(y, t), l = 12;
246
+ return o = e.substring(T, t), c = 12;
241
247
  }
242
248
  if (e.charCodeAt(t + 1) === 42) {
243
249
  t += 2;
244
- const j = s - 1;
245
- let v = !1;
246
- for (; t < j;) {
250
+ const A = s - 1;
251
+ let b = !1;
252
+ for (; t < A;) {
247
253
  const d = e.charCodeAt(t);
248
254
  if (d === 42 && e.charCodeAt(t + 1) === 47) {
249
- t += 2, v = !0;
255
+ t += 2, b = !0;
250
256
  break;
251
257
  }
252
258
  t++, P(d) && (d === 13 && e.charCodeAt(t) === 10 && t++, g++, k = t);
253
259
  }
254
- return v || (t++, u = 1), o = e.substring(y, t), l = 13;
260
+ return b || (t++, f = 1), o = e.substring(T, t), c = 13;
255
261
  }
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;
262
+ return o += String.fromCharCode(l), t++, c = 16;
263
+ case 45: if (o += String.fromCharCode(l), t++, t === s || !I(e.charCodeAt(t))) return c = 16;
258
264
  case 48:
259
265
  case 49:
260
266
  case 50:
@@ -264,24 +270,24 @@ function Ne(e, n = !1) {
264
270
  case 54:
265
271
  case 55:
266
272
  case 56:
267
- case 57: return o += h(), l = 11;
273
+ case 57: return o += y(), c = 11;
268
274
  default:
269
- for (; t < s && p(f);) t++, f = e.charCodeAt(t);
275
+ for (; t < s && u(l);) t++, l = e.charCodeAt(t);
270
276
  if (r !== t) {
271
277
  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;
278
+ case "true": return c = 8;
279
+ case "false": return c = 9;
280
+ case "null": return c = 7;
275
281
  }
276
- return l = 16;
282
+ return c = 16;
277
283
  }
278
- return o += String.fromCharCode(f), t++, l = 16;
284
+ return o += String.fromCharCode(l), t++, c = 16;
279
285
  }
280
286
  }
281
- i(c, "scanNext");
282
- function p(f) {
283
- if (X(f) || P(f)) return !1;
284
- switch (f) {
287
+ i(p, "scanNext");
288
+ function u(l) {
289
+ if (Y(l) || P(l)) return !1;
290
+ switch (l) {
285
291
  case 125:
286
292
  case 93:
287
293
  case 123:
@@ -293,40 +299,40 @@ function Ne(e, n = !1) {
293
299
  }
294
300
  return !0;
295
301
  }
296
- i(p, "isUnknownContentCharacter");
297
- function b() {
298
- let f;
302
+ i(u, "isUnknownContentCharacter");
303
+ function w() {
304
+ let l;
299
305
  do
300
- f = c();
301
- while (f >= 12 && f <= 15);
302
- return f;
306
+ l = p();
307
+ while (l >= 12 && l <= 15);
308
+ return l;
303
309
  }
304
- return i(b, "scanNextNonTrivia"), {
305
- setPosition: O,
310
+ return i(w, "scanNextNonTrivia"), {
311
+ setPosition: j,
306
312
  getPosition: i(() => t, "getPosition"),
307
- scan: n ? b : c,
308
- getToken: i(() => l, "getToken"),
313
+ scan: n ? w : p,
314
+ getToken: i(() => c, "getToken"),
309
315
  getTokenValue: i(() => o, "getTokenValue"),
310
316
  getTokenOffset: i(() => r, "getTokenOffset"),
311
317
  getTokenLength: i(() => t - r, "getTokenLength"),
312
318
  getTokenStartLine: i(() => m, "getTokenStartLine"),
313
- getTokenStartCharacter: i(() => r - w, "getTokenStartCharacter"),
314
- getTokenError: i(() => u, "getTokenError")
319
+ getTokenStartCharacter: i(() => r - v, "getTokenStartCharacter"),
320
+ getTokenError: i(() => f, "getTokenError")
315
321
  };
316
322
  }
317
- i(Ne, "createScanner");
318
- function X(e) {
323
+ i(Re, "createScanner");
324
+ function Y(e) {
319
325
  return e === 32 || e === 9;
320
326
  }
321
- i(X, "isWhiteSpace");
327
+ i(Y, "isWhiteSpace");
322
328
  function P(e) {
323
329
  return e === 10 || e === 13;
324
330
  }
325
331
  i(P, "isLineBreak");
326
- function S(e) {
332
+ function I(e) {
327
333
  return e >= 48 && e <= 57;
328
334
  }
329
- i(S, "isDigit");
335
+ i(I, "isDigit");
330
336
  var ce;
331
337
  (function(e) {
332
338
  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 +347,16 @@ var W;
341
347
  (function(e) {
342
348
  e.DEFAULT = { allowTrailingComma: !1 };
343
349
  })(W || (W = {}));
344
- function Re(e, n = [], s = W.DEFAULT) {
350
+ function Pe(e, n = [], s = W.DEFAULT) {
345
351
  let t = null, o = [];
346
352
  const r = [];
347
- function l(m) {
353
+ function c(m) {
348
354
  Array.isArray(o) ? o.push(m) : t !== null && (o[t] = m);
349
355
  }
350
- return i(l, "onValue"), Pe(e, {
356
+ return i(c, "onValue"), Ve(e, {
351
357
  onObjectBegin: i(() => {
352
358
  const m = {};
353
- l(m), r.push(o), o = m, t = null;
359
+ c(m), r.push(o), o = m, t = null;
354
360
  }, "onObjectBegin"),
355
361
  onObjectProperty: i((m) => {
356
362
  t = m;
@@ -360,53 +366,53 @@ function Re(e, n = [], s = W.DEFAULT) {
360
366
  }, "onObjectEnd"),
361
367
  onArrayBegin: i(() => {
362
368
  const m = [];
363
- l(m), r.push(o), o = m, t = null;
369
+ c(m), r.push(o), o = m, t = null;
364
370
  }, "onArrayBegin"),
365
371
  onArrayEnd: i(() => {
366
372
  o = r.pop();
367
373
  }, "onArrayEnd"),
368
- onLiteralValue: l,
369
- onError: i((m, k, w) => {
374
+ onLiteralValue: c,
375
+ onError: i((m, k, v) => {
370
376
  n.push({
371
377
  error: m,
372
378
  offset: k,
373
- length: w
379
+ length: v
374
380
  });
375
381
  }, "onError")
376
382
  }, s), o[0];
377
383
  }
378
- i(Re, "parse$1");
379
- function Pe(e, n, s = W.DEFAULT) {
380
- const t = Ne(e, !1), o = [];
384
+ i(Pe, "parse$1");
385
+ function Ve(e, n, s = W.DEFAULT) {
386
+ const t = Re(e, !1), o = [];
381
387
  let r = 0;
382
- function l(T) {
383
- return T ? () => r === 0 && T(t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter()) : () => !0;
388
+ function c(h) {
389
+ return h ? () => r === 0 && h(t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter()) : () => !0;
384
390
  }
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;
391
+ i(c, "toNoArgVisit");
392
+ function g(h) {
393
+ return h ? (D) => r === 0 && h(D, t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter()) : () => !0;
388
394
  }
389
395
  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;
396
+ function m(h) {
397
+ return h ? (D) => r === 0 && h(D, t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter(), () => o.slice()) : () => !0;
392
398
  }
393
399
  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);
400
+ function k(h) {
401
+ return h ? () => {
402
+ r > 0 ? r++ : h(t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter(), () => o.slice()) === !1 && (r = 1);
397
403
  } : () => !0;
398
404
  }
399
405
  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());
406
+ function v(h) {
407
+ return h ? () => {
408
+ r > 0 && r--, r === 0 && h(t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter());
403
409
  } : () => !0;
404
410
  }
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() {
411
+ i(v, "toEndVisit");
412
+ 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;
413
+ function b() {
408
414
  for (;;) {
409
- const T = t.scan();
415
+ const h = t.scan();
410
416
  switch (t.getTokenError()) {
411
417
  case 4:
412
418
  d(14);
@@ -418,106 +424,106 @@ function Pe(e, n, s = W.DEFAULT) {
418
424
  d(13);
419
425
  break;
420
426
  case 1:
421
- y || d(11);
427
+ T || d(11);
422
428
  break;
423
429
  case 2:
424
430
  d(12);
425
431
  break;
426
432
  case 6: d(16);
427
433
  }
428
- switch (T) {
434
+ switch (h) {
429
435
  case 12:
430
436
  case 13:
431
- y ? d(10) : b();
437
+ T ? d(10) : w();
432
438
  break;
433
439
  case 16:
434
440
  d(1);
435
441
  break;
436
442
  case 15:
437
443
  case 14: break;
438
- default: return T;
444
+ default: return h;
439
445
  }
440
446
  }
441
447
  }
442
- i(v, "scanNext");
443
- function d(T, E = [], ie = []) {
444
- if (f(T), E.length + ie.length > 0) {
448
+ i(b, "scanNext");
449
+ function d(h, D = [], re = []) {
450
+ if (l(h), D.length + re.length > 0) {
445
451
  let V = t.getToken();
446
452
  for (; V !== 17;) {
447
- if (E.indexOf(V) !== -1) {
448
- v();
453
+ if (D.indexOf(V) !== -1) {
454
+ b();
449
455
  break;
450
- } else if (ie.indexOf(V) !== -1) break;
451
- V = v();
456
+ } else if (re.indexOf(V) !== -1) break;
457
+ V = b();
452
458
  }
453
459
  }
454
460
  }
455
461
  i(d, "handleError");
456
- function L(T) {
457
- const E = t.getTokenValue();
458
- return T ? c(E) : (A(E), o.push(E)), v(), !0;
462
+ function L(h) {
463
+ const D = t.getTokenValue();
464
+ return h ? p(D) : (O(D), o.push(D)), b(), !0;
459
465
  }
460
466
  i(L, "parseString");
461
467
  function B() {
462
468
  switch (t.getToken()) {
463
469
  case 11:
464
- const T = t.getTokenValue();
465
- let E = Number(T);
466
- isNaN(E) && (d(2), E = 0), c(E);
470
+ const h = t.getTokenValue();
471
+ let D = Number(h);
472
+ isNaN(D) && (d(2), D = 0), p(D);
467
473
  break;
468
474
  case 7:
469
- c(null);
475
+ p(null);
470
476
  break;
471
477
  case 8:
472
- c(!0);
478
+ p(!0);
473
479
  break;
474
480
  case 9:
475
- c(!1);
481
+ p(!1);
476
482
  break;
477
483
  default: return !1;
478
484
  }
479
- return v(), !0;
485
+ return b(), !0;
480
486
  }
481
487
  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);
488
+ function F() {
489
+ 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
490
  }
485
- i($, "parseProperty");
491
+ i(F, "parseProperty");
486
492
  function N() {
487
- u(), v();
488
- let T = !1;
493
+ f(), b();
494
+ let h = !1;
489
495
  for (; t.getToken() !== 2 && t.getToken() !== 17;) {
490
496
  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;
497
+ if (h || d(4, [], []), u(","), b(), t.getToken() === 2 && A) break;
498
+ } else h && d(6, [], []);
499
+ F() || d(4, [], [2, 5]), h = !0;
494
500
  }
495
- return O(), t.getToken() !== 2 ? d(7, [2], []) : v(), !0;
501
+ return j(), t.getToken() !== 2 ? d(7, [2], []) : b(), !0;
496
502
  }
497
503
  i(N, "parseObject");
498
- function $e() {
499
- h(), v();
500
- let T = !0, E = !1;
504
+ function Fe() {
505
+ y(), b();
506
+ let h = !0, D = !1;
501
507
  for (; t.getToken() !== 4 && t.getToken() !== 17;) {
502
508
  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;
509
+ if (D || d(4, [], []), u(","), b(), t.getToken() === 4 && A) break;
510
+ } else D && d(6, [], []);
511
+ h ? (o.push(0), h = !1) : o[o.length - 1]++, H() || d(4, [], [4, 5]), D = !0;
506
512
  }
507
- return D(), T || o.pop(), t.getToken() !== 4 ? d(8, [4], []) : v(), !0;
513
+ return x(), h || o.pop(), t.getToken() !== 4 ? d(8, [4], []) : b(), !0;
508
514
  }
509
- i($e, "parseArray");
515
+ i(Fe, "parseArray");
510
516
  function H() {
511
517
  switch (t.getToken()) {
512
- case 3: return $e();
518
+ case 3: return Fe();
513
519
  case 1: return N();
514
520
  case 10: return L(!0);
515
521
  default: return B();
516
522
  }
517
523
  }
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);
524
+ 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
525
  }
520
- i(Pe, "visit");
526
+ i(Ve, "visit");
521
527
  var fe;
522
528
  (function(e) {
523
529
  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 +532,19 @@ var ue;
526
532
  (function(e) {
527
533
  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
534
  })(ue || (ue = {}));
529
- const Ve = Re;
535
+ const We = Pe;
530
536
  var ae;
531
537
  (function(e) {
532
538
  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
539
  })(ae || (ae = {}));
534
- const Y = i((e, n) => Ve(_e(n, e)), "readJsonc");
540
+ const Z = i((e, n) => We(_e(n, e)), "readJsonc");
535
541
  const pe = i(() => {
536
542
  const { findPnpApi: e } = module$1;
537
543
  return e && e(process.cwd());
538
544
  }, "getPnpApi");
539
- const We = "detectTypeScriptVersion:";
540
- const Me = i((e, n) => {
541
- const s = `${We}${e}`, t = n?.get(s);
545
+ const Me = "detectTypeScriptVersion:";
546
+ const Je = i((e, n) => {
547
+ const s = `${Me}${e}`, t = n?.get(s);
542
548
  if (t !== void 0) return t ?? void 0;
543
549
  let o;
544
550
  const r = pe();
@@ -546,16 +552,16 @@ const Me = i((e, n) => {
546
552
  o = r.resolveRequest("typescript/package.json", e) ?? void 0;
547
553
  } catch {}
548
554
  o ??= R(path.resolve(e), path.join("node_modules", "typescript", "package.json"), n);
549
- let l;
555
+ let c;
550
556
  if (o) try {
551
- const g = Y(o, n);
552
- typeof g?.version == "string" && (l = g.version);
557
+ const g = Z(o, n);
558
+ typeof g?.version == "string" && (c = g.version);
553
559
  } catch {}
554
- return n?.set(s, l ?? null), l;
560
+ return n?.set(s, c ?? null), c;
555
561
  }, "detectTypeScriptVersion");
556
- const I = "package.json";
562
+ const S = "package.json";
557
563
  const M = "tsconfig.json";
558
- const Je = i((e, n, s) => {
564
+ const ze = i((e, n, s) => {
559
565
  const t = module$1.createRequire(path.join(s, "tsconfig.json"));
560
566
  if (e !== n) try {
561
567
  return t.resolve(e);
@@ -564,103 +570,103 @@ const Je = i((e, n, s) => {
564
570
  return t.resolve(n);
565
571
  } catch {}
566
572
  try {
567
- return t.resolve(`${n}/${I}`);
573
+ return t.resolve(`${n}/${S}`);
568
574
  } catch {}
569
575
  }, "resolvePackageEntryWithNode");
570
- const Z = i((e, n, s, t) => {
576
+ const q = i((e, n, s, t) => {
571
577
  const o = `resolveFromPackageJsonPath:${e}:${n}:${s}`;
572
578
  if (t?.has(o)) return t.get(o) || !1;
573
- const r = Y(e, t);
579
+ const r = Z(e, t);
574
580
  if (!r) return;
575
- let l = n || M;
581
+ let c = n || M;
576
582
  if (!s && r.exports) try {
577
583
  const [g] = v(r.exports, n, ["require", "types"]);
578
- l = g;
584
+ c = g;
579
585
  } catch {
580
586
  return t?.set(o, ""), !1;
581
587
  }
582
- else !n && r.tsconfig && (l = r.tsconfig);
583
- return l = path.join(e, "..", l), t?.set(o, l), l;
588
+ else !n && r.tsconfig && (c = r.tsconfig);
589
+ return c = path.join(e, "..", c), t?.set(o, c), c;
584
590
  }, "resolveFromPackageJsonPath");
585
- const ze = i((e, n, s) => {
591
+ const Ge = i((e, n, s) => {
586
592
  const t = `resolveExtendsPath:${e}:${n}`;
587
593
  if (s?.has(t)) return s.get(t) || void 0;
588
- const o = Ge(e, n, s);
594
+ const o = Qe(e, n, s);
589
595
  return s?.set(t, o || ""), o;
590
596
  }, "resolveExtendsPath");
591
- const Ge = i((e, n, s) => {
597
+ const Qe = i((e, n, s) => {
592
598
  let t = e;
593
599
  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;
600
+ const u = $(s, t);
601
+ if (u) {
602
+ if (u.isFile()) return t;
597
603
  } else if (!t.endsWith(".json")) {
598
- const p = `${t}.json`;
599
- if (F(s, p)) return p;
604
+ const w = `${t}.json`;
605
+ if ($(s, w)) return w;
600
606
  }
601
607
  return;
602
608
  }
603
- const [o, ...r] = e.split("/"), l = o[0] === "@" ? `${o}/${r.shift()}` : o, g = r.join("/"), m = pe();
609
+ const [o, ...r] = e.split("/"), c = o[0] === "@" ? `${o}/${r.shift()}` : o, g = r.join("/"), m = pe();
604
610
  if (m) {
605
- const { resolveRequest: c } = m;
611
+ const { resolveRequest: u } = m;
606
612
  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;
613
+ if (c === e) {
614
+ const w = u(path.join(c, S), n);
615
+ if (w) {
616
+ const l = q(w, g, !1, s);
617
+ if (l && $(s, l)) return l;
612
618
  }
613
619
  } else {
614
- let p;
620
+ let w;
615
621
  try {
616
- p = c(e, n, { extensions: [".json"] });
622
+ w = u(e, n, { extensions: [".json"] });
617
623
  } catch {
618
- p = c(path.join(e, M), n);
624
+ w = u(path.join(e, M), n);
619
625
  }
620
- if (p) return p;
626
+ if (w) return w;
621
627
  }
622
628
  } catch {}
623
629
  }
624
- const k = Je(e, l, n);
625
- let w;
630
+ const k = ze(e, c, n);
631
+ let v;
626
632
  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;
633
+ if (path.basename(k) !== S && k.endsWith(".json")) return k;
634
+ v = path.basename(k) === S ? k : R(path.dirname(k), S, s);
635
+ }
636
+ const f = v && path.dirname(v) || R(path.resolve(n), path.join("node_modules", c), s);
637
+ if (!f || !$(s, f)?.isDirectory()) return;
638
+ const O = Ne(s, f), j = path.join(O, S);
639
+ if ($(s, j)) {
640
+ const u = q(j, g, !1, s);
641
+ if (u === !1) return;
642
+ if (u && $(s, u)?.isFile()) return u;
643
+ }
644
+ const y = path.join(O, g), x = y.endsWith(".json");
645
+ if (!x) {
646
+ const u = `${y}.json`;
647
+ if ($(s, u)) return u;
648
+ }
649
+ const p = $(s, y);
650
+ if (p) {
651
+ if (p.isDirectory()) {
652
+ const u = path.join(y, S);
653
+ if ($(s, u)) {
654
+ const l = q(u, "", !0, s);
655
+ if (l && $(s, l)) return l;
650
656
  }
651
- const p = path.join(O, M);
652
- if (F(s, p)) return p;
653
- } else if (h) return O;
657
+ const w = path.join(y, M);
658
+ if ($(s, w)) return w;
659
+ } else if (x) return y;
654
660
  }
655
661
  }, "resolveExtendsPathUncached");
656
- const q = Symbol("implicitBaseUrl");
662
+ const K = Symbol("implicitBaseUrl");
657
663
  const U = "${configDir}";
658
- const K = /^\.{1,2}(\/.*)?$/;
664
+ const C = /^\.{1,2}(\/.*)?$/;
659
665
  const J = i((e) => {
660
- const n = x(e);
661
- return K.test(n) ? n : `./${n}`;
666
+ const n = E(e);
667
+ return C.test(n) ? n : `./${n}`;
662
668
  }, "normalizeRelativePath");
663
- const Qe = i((e) => {
669
+ const He = i((e) => {
664
670
  const n = { ...e };
665
671
  if (n.strict) for (const t of [
666
672
  "noImplicitAny",
@@ -697,33 +703,33 @@ const Qe = i((e) => {
697
703
  ]) n[s] && (n[s] = n[s].toLowerCase());
698
704
  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
705
  }, "normalizeCompilerOptions");
700
- const He = i((e, n) => {
701
- !n.has("target") && !Xe(e.module) && (e.target = "es3");
706
+ const Xe = i((e, n) => {
707
+ !n.has("target") && !Ye(e.module) && (e.target = "es3");
702
708
  }, "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");
709
+ const Ye = i((e) => e === "node16" || e === "node18" || e === "node20" || e === "nodenext", "moduleDictatesTarget$1");
710
+ const Ze = i((e, n) => {
711
+ !n.has("target") && !qe(e.module) && (e.target = "es5");
706
712
  }, "applyV5Defaults");
707
- const Ze = i((e) => e === "node16" || e === "node18" || e === "node20" || e === "nodenext", "moduleDictatesTarget");
708
- const qe = i((e, n) => {
713
+ const qe = i((e) => e === "node16" || e === "node18" || e === "node20" || e === "nodenext", "moduleDictatesTarget");
714
+ const Ke = i((e, n) => {
709
715
  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
716
  }, "applyV6Defaults");
711
- const Ke = [
712
- [4, He],
713
- [5, Ye],
714
- [6, qe]
717
+ const Ce = [
718
+ [4, Xe],
719
+ [5, Ze],
720
+ [6, Ke]
715
721
  ];
716
- const Ce = i((e) => {
722
+ const et = i((e) => {
717
723
  const n = /^v?(\d+)/.exec(e);
718
724
  return n ? Number(n[1]) : void 0;
719
725
  }, "parseMajor");
720
- const et = i((e, n) => {
721
- const s = Ce(n);
726
+ const tt = i((e, n) => {
727
+ const s = et(n);
722
728
  if (s === void 0) return;
723
729
  const t = new Set(Object.keys(e));
724
- for (const [o, r] of Ke) o <= s && r(e, t);
730
+ for (const [o, r] of Ce) o <= s && r(e, t);
725
731
  }, "applyVersionDefaults");
726
- const C = i((e, n) => J(path.relative(e, n)), "pathRelative");
732
+ const ee = i((e, n) => J(path.relative(e, n)), "pathRelative");
727
733
  const me = [
728
734
  "files",
729
735
  "include",
@@ -731,18 +737,18 @@ const me = [
731
737
  ];
732
738
  const ge = i((e, n, s) => {
733
739
  const t = path.join(n, s);
734
- return x(path.relative(e, t)) || "./";
740
+ return E(path.relative(e, t)) || "./";
735
741
  }, "resolveAndRelativize");
736
- const tt = i((e, n, s) => {
742
+ const nt = i((e, n, s) => {
737
743
  const t = path.relative(e, n);
738
744
  if (!t) return s;
739
- return x(`${t}/${s.startsWith("./") ? s.slice(2) : s}`);
745
+ return E(`${t}/${s.startsWith("./") ? s.slice(2) : s}`);
740
746
  }, "prefixPattern");
741
747
  const de = ["outDir", "declarationDir"];
742
748
  const z = i((e, n) => {
743
- if (e.startsWith(U)) return x(path.join(n, e.slice(12)));
749
+ if (e.startsWith(U)) return E(path.join(n, e.slice(12)));
744
750
  }, "interpolateConfigDir");
745
- const nt = [
751
+ const st = [
746
752
  "outDir",
747
753
  "declarationDir",
748
754
  "outFile",
@@ -752,194 +758,197 @@ const nt = [
752
758
  ];
753
759
  const ke = i((e, n = {}) => {
754
760
  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 } }
761
+ const { typescriptVersion: s } = n, t = new Map(e.map((f) => [f.path, f])), o = /* @__PURE__ */ new Map(), r = i((f) => {
762
+ const O = o.get(f);
763
+ if (O) return O;
764
+ const j = t.get(f);
765
+ if (!j) throw new Error(`Config not found in chain: ${f}`);
766
+ const y = j.config, x = path.dirname(f);
767
+ let p = {
768
+ ...y,
769
+ ...y.compilerOptions && { compilerOptions: { ...y.compilerOptions } },
770
+ ...y.watchOptions && { watchOptions: { ...y.watchOptions } }
765
771
  };
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 };
772
+ if (delete p.extends, p.compilerOptions?.paths && !p.compilerOptions.baseUrl && (p.compilerOptions[K] = x), y.extends) {
773
+ const u = Array.isArray(y.extends) ? y.extends : [y.extends];
774
+ for (const w of u.toReversed()) {
775
+ const l = r(w), T = path.dirname(w), { references: A, ...b } = l;
776
+ if (b.compilerOptions) {
777
+ const L = { ...b.compilerOptions };
772
778
  for (const B of [
773
779
  "baseUrl",
774
780
  "outDir",
775
781
  "declarationDir",
776
782
  "rootDir"
777
783
  ]) {
778
- const $ = L[B];
779
- $ && !$.startsWith(U) && (L[B] = ge(D, y, $));
784
+ const F = L[B];
785
+ F && !F.startsWith(U) && (L[B] = ge(x, T, F));
780
786
  }
781
787
  for (const B of ["rootDirs", "typeRoots"]) {
782
- const $ = L[B];
783
- $ && (L[B] = $.map((N) => N.startsWith(U) ? N : ge(D, y, N)));
788
+ const F = L[B];
789
+ F && (L[B] = F.map((N) => N.startsWith(U) ? N : ge(x, T, N)));
784
790
  }
785
- v.compilerOptions = L;
791
+ b.compilerOptions = L;
786
792
  }
787
793
  for (const L of me) {
788
- const B = v[L];
789
- B && (v[L] = B.map(($) => $.startsWith(U) ? $ : tt(D, y, $)));
794
+ const B = b[L];
795
+ B && (b[L] = B.map((F) => F.startsWith(U) ? F : nt(x, T, F)));
790
796
  }
791
797
  const d = {
792
- ...v,
793
- ...c,
798
+ ...b,
799
+ ...p,
794
800
  compilerOptions: {
795
- ...v.compilerOptions,
796
- ...c.compilerOptions
801
+ ...b.compilerOptions,
802
+ ...p.compilerOptions
797
803
  }
798
804
  };
799
- v.watchOptions && (d.watchOptions = {
800
- ...v.watchOptions,
801
- ...c.watchOptions
802
- }), c = d;
805
+ b.watchOptions && (d.watchOptions = {
806
+ ...b.watchOptions,
807
+ ...p.watchOptions
808
+ }), p = d;
803
809
  }
804
810
  }
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);
811
+ if (p.compilerOptions) {
812
+ const { compilerOptions: u } = p;
813
+ for (const l of ["baseUrl", "rootDir"]) {
814
+ const T = u[l];
815
+ if (T && !T.startsWith(U)) {
816
+ const A = path.resolve(x, T);
817
+ u[l] = ee(x, A);
812
818
  }
813
819
  }
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);
820
+ for (const l of de) {
821
+ let T = u[l];
822
+ T && (Array.isArray(p.exclude) || (p.exclude = de.map((A) => u[A]).filter(Boolean)), T.startsWith(U) || (T = J(T)), u[l] = T);
817
823
  }
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 [
824
+ } else p.compilerOptions = {};
825
+ 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) {
826
+ const { watchOptions: u } = p;
827
+ for (const w of ["excludeDirectories", "excludeFiles"]) u[w] && (u[w] = u[w].map((l) => E(path.resolve(x, l))));
828
+ for (const w of [
823
829
  "watchFile",
824
830
  "watchDirectory",
825
831
  "fallbackPolling"
826
- ]) if (p[b]) {
827
- const f = p;
828
- f[b] = p[b].toLowerCase();
832
+ ]) if (u[w]) {
833
+ const l = u;
834
+ l[w] = u[w].toLowerCase();
829
835
  }
830
836
  }
831
- return o.set(u, c), c;
832
- }, "resolveEntry"), l = e[0], g = r(l.path), m = path.dirname(l.path), k = {
837
+ return o.set(f, p), p;
838
+ }, "resolveEntry"), c = e[0], g = r(c.path), m = path.dirname(c.path), k = {
833
839
  ...g,
834
840
  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;
841
+ }, { compilerOptions: v } = k;
842
+ if (v) {
843
+ for (const f of st) {
844
+ const O = v[f];
845
+ if (O) {
846
+ const j = z(O, m);
847
+ v[f] = j ? ee(m, j) : O;
842
848
  }
843
849
  }
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);
850
+ for (const f of ["rootDirs", "typeRoots"]) {
851
+ const O = v[f];
852
+ O && (v[f] = O.map((j) => {
853
+ const y = z(j, m);
854
+ return y ? ee(m, y) : J(j);
849
855
  }));
850
856
  }
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;
857
+ if (v.paths) {
858
+ const f = {};
859
+ for (const [O, j] of Object.entries(v.paths)) f[O] = j.map((y) => z(y, m) ?? y);
860
+ v.paths = f;
855
861
  }
856
- s && et(w, s), k.compilerOptions = Qe(w);
862
+ s && tt(v, s), k.compilerOptions = He(v);
857
863
  }
858
- for (const u of me) {
859
- const A = k[u];
860
- A && (k[u] = A.map((O) => z(O, m) ?? O));
864
+ for (const f of me) {
865
+ const O = k[f];
866
+ O && (k[f] = O.map((j) => z(j, m) ?? j));
861
867
  }
862
868
  return {
863
- path: l.path,
869
+ path: c.path,
864
870
  config: k,
865
- sources: e.map((u) => u.path)
871
+ sources: e.map((f) => f.path)
866
872
  };
867
873
  }, "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);
874
+ const ve = i((e, n = {}) => {
875
+ const { cache: s = /* @__PURE__ */ new Map() } = n, t = path.resolve(e), o = [], r = /* @__PURE__ */ new Set(), c = i((g, m) => {
876
+ const k = E(g);
871
877
  if (r.has(k)) return;
872
878
  r.add(k);
873
- let w;
879
+ let v;
874
880
  try {
875
- w = Y(g, s) || {};
881
+ v = Z(g, s) || {};
876
882
  } catch {
877
883
  throw new Error(`Cannot resolve tsconfig at path: ${g}`);
878
884
  }
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;
885
+ if (typeof v != "object") throw new SyntaxError(`Failed to parse tsconfig at: ${g}`);
886
+ const f = path.dirname(g);
887
+ if (v.extends) {
888
+ const O = Array.isArray(v.extends), y = (O ? v.extends : [v.extends]).map((p) => {
889
+ const u = Ge(p, f, s);
890
+ if (!u) throw new Error(`File '${p}' not found.`);
891
+ const w = E(u);
892
+ if (m.has(w) || w === k) throw new Error(`Circularity detected while resolving configuration: ${w}`);
893
+ return w;
888
894
  });
889
- w.extends = A ? h : h[0], o.push({
895
+ v.extends = O ? y : y[0], o.push({
890
896
  path: k,
891
- config: w
897
+ config: v
892
898
  });
893
- const D = new Set(m);
894
- D.add(k);
895
- for (const c of [...h].reverse()) l(c, D);
899
+ const x = new Set(m);
900
+ x.add(k);
901
+ for (const p of [...y].reverse()) c(p, x);
896
902
  } else o.push({
897
903
  path: k,
898
- config: w
904
+ config: v
899
905
  });
900
906
  }, "collect");
901
- return l(t, /* @__PURE__ */ new Set()), o;
907
+ return c(t, /* @__PURE__ */ new Set()), o;
902
908
  }, "getExtendsChain");
903
- const ee = i((e, n = {}) => {
904
- const { cache: s = /* @__PURE__ */ new Map(), typescriptVersion: t = "auto" } = n, o = we(e, { cache: s });
909
+ const te = i((e, n = {}) => {
910
+ const { cache: s = /* @__PURE__ */ new Map(), typescriptVersion: t = "auto" } = n, o = ve(e, { cache: s });
905
911
  let r;
906
- return t === "auto" ? r = Me(path.dirname(o[0].path), s) : t !== !1 && (r = t), ke(o, { typescriptVersion: r });
912
+ return t === "auto" ? r = Je(path.dirname(o[0].path), s) : t !== !1 && (r = t), ke(o, { typescriptVersion: r });
907
913
  }, "readTsconfig");
908
- var st = Object.defineProperty;
909
- var G = i((e, n) => st(e, "name", {
914
+ var ot = Object.defineProperty;
915
+ var G = i((e, n) => ot(e, "name", {
910
916
  value: n,
911
917
  configurable: !0
912
918
  }), "s");
913
- const ve = G((e) => {
919
+ const we = G((e) => {
914
920
  let n = "";
915
921
  for (let s = 0; s < e.length; s += 1) {
916
922
  const t = e[s], o = t.toUpperCase();
917
923
  n += t === o ? t.toLowerCase() : o;
918
924
  }
919
925
  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}`);
926
+ }, "invertCase"), ne = /* @__PURE__ */ new Map(), be = G((e, n) => {
927
+ const s = Ie.join(e, `.is-fs-case-sensitive-test-${process.pid}`);
922
928
  try {
923
- return n.writeFileSync(s, ""), !n.existsSync(ve(s));
929
+ return n.writeFileSync(s, ""), !n.existsSync(we(s));
924
930
  } finally {
925
931
  try {
926
932
  n.unlinkSync(s);
927
933
  } catch {}
928
934
  }
929
- }, "checkDirectoryCaseWithWrite"), ot = G((e, n, s) => {
935
+ }, "checkDirectoryCaseWithWrite"), it = G((e, n, s) => {
930
936
  try {
931
937
  return be(e, s);
932
938
  } catch (t) {
933
- if (n === void 0) return be(Ie.tmpdir(), s);
939
+ if (n === void 0) return be(Se.tmpdir(), s);
934
940
  throw t;
935
941
  }
936
- }, "checkDirectoryCaseWithFallback"), it = G((e, n = Ue, s = !0) => {
942
+ }, "checkDirectoryCaseWithFallback"), rt = G((e, n = Ue, s = !0) => {
937
943
  const t = e ?? process.cwd();
938
- if (s && te.has(t)) return te.get(t);
944
+ if (s && ne.has(t)) return ne.get(t);
939
945
  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 = {
946
+ const r = we(t);
947
+ return r !== t && n.existsSync(t) ? o = !n.existsSync(r) : o = it(t, e, n), s && ne.set(t, o), o;
948
+ }, "isFsCaseSensitive"), { join: lt } = path.posix, ye = i((e, n) => {
949
+ const s = lt(e, n);
950
+ return e.startsWith("//") && !s.startsWith("//") ? `/${s}` : s;
951
+ }, "pathJoin"), se = {
943
952
  ts: [
944
953
  ".ts",
945
954
  ".tsx",
@@ -947,93 +956,93 @@ const ve = G((e) => {
947
956
  ],
948
957
  cts: [".cts", ".d.cts"],
949
958
  mts: [".mts", ".d.mts"]
950
- }, rt = i((e) => {
951
- const n = [...ne.ts], s = [...ne.cts], t = [...ne.mts];
959
+ }, ct = i((e) => {
960
+ const n = [...se.ts], s = [...se.cts], t = [...se.mts];
952
961
  return e?.allowJs && (n.push(".js", ".jsx"), s.push(".cjs"), t.push(".mjs")), [
953
962
  ...n,
954
963
  ...s,
955
964
  ...t
956
965
  ];
957
- }, "getSupportedExtensions"), lt = i((e) => {
966
+ }, "getSupportedExtensions"), ft = i((e) => {
958
967
  const n = [];
959
968
  if (!e) return n;
960
969
  const { outDir: s, declarationDir: t } = e;
961
970
  return s && n.push(s), t && n.push(t), n;
962
- }, "getDefaultExcludeSpec"), Te = i((e) => e.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`), "escapeForRegexp"), se = `(?!(${[
971
+ }, "getDefaultExcludeSpec"), Te = i((e) => e.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`), "escapeForRegexp"), oe = `(?!(${[
963
972
  "node_modules",
964
973
  "bower_components",
965
974
  "jspm_packages"
966
- ].join("|")})(/|$))`, ft = /(?:^|\/)[^.*?]+$/, he = "**/*", Q = "[^/]", oe = "[^./]", Oe = process.platform === "win32", ut = i(({ config: e, path: n }, s) => {
975
+ ].join("|")})(/|$))`, at = /(?:^|\/)[^.*?]+$/, he = "**/*", Q = "[^/]", ie = "[^./]", Oe = process.platform === "win32", pt = i(({ config: e, path: n }, s) => {
967
976
  if ("extends" in e) throw new Error("tsconfig#extends must be resolved. Use getTsconfig or readTsconfig to resolve it.");
968
977
  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];
978
+ Oe && (n = E(n));
979
+ 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) => {
980
+ const u = m(p), w = Te(u).replaceAll(String.raw`\*\*/`, "(.+/)?").replaceAll(String.raw`\*`, `${Q}*`).replaceAll(String.raw`\?`, Q);
981
+ return new RegExp(`^${w}($|/)`, f);
982
+ }), y = o || r ? r : [he];
974
983
  return {
975
984
  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;
985
+ extensions: v,
986
+ excludePatterns: j,
987
+ includePatterns: y ? y.map((p) => {
988
+ let u = m(p);
989
+ at.test(u) && (u = ye(u, he));
990
+ const w = Te(u).replaceAll(String.raw`/\*\*`, `(/${oe}${ie}${Q}*)*?`).replaceAll(/(\/)?\\\*/g, (l, T) => {
991
+ const A = String.raw`(${ie}|(\.(?!min\.js$))?)*`;
992
+ return T ? `/${oe}${ie}${A}` : A;
993
+ }).replaceAll(/(\/)?\\\?/g, (l, T) => {
994
+ const A = Q;
995
+ return T ? `/${oe}${A}` : A;
987
996
  });
988
- return new RegExp(`^${b}$`, u);
997
+ return new RegExp(`^${w}$`, f);
989
998
  }) : void 0
990
999
  };
991
1000
  }, "compilePatterns"), Ae = /* @__PURE__ */ new WeakMap(), je = i((e, n) => {
992
1001
  if (!path.isAbsolute(n)) return !1;
993
- Oe && (n = x(n));
1002
+ Oe && (n = E(n));
994
1003
  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) => {
1004
+ s || (s = pt(e, rt()), Ae.set(e, s));
1005
+ const { filesSet: t, extensions: o, excludePatterns: r, includePatterns: c } = s;
1006
+ 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)));
1007
+ }, "isFileIncluded"), xe = i((e, n, s, t) => {
999
1008
  const o = path.resolve(e);
1000
- let r = x(e);
1009
+ let r = E(e);
1001
1010
  for (;;) {
1002
- const l = R(r, n, s);
1003
- if (!l) return;
1004
- const g = path.resolve(l), m = ee(g, {
1011
+ const c = R(r, n, s);
1012
+ if (!c) return;
1013
+ const g = path.resolve(c), m = te(g, {
1005
1014
  cache: s,
1006
1015
  typescriptVersion: t
1007
1016
  });
1008
1017
  if (je(m, o)) return m;
1009
- const k = path.dirname(l), w = path.dirname(k);
1010
- if (w === k) return;
1011
- r = w;
1018
+ const k = path.dirname(c), v = path.dirname(k);
1019
+ if (v === k) return;
1020
+ r = v;
1012
1021
  }
1013
- }, "findConfigApplicable"), Ee = i((e = process.cwd(), n = {}) => {
1022
+ }, "findConfigApplicable"), De = i((e = process.cwd(), n = {}) => {
1014
1023
  const { configName: s = "tsconfig.json", cache: t = /* @__PURE__ */ new Map(), includes: o = !1 } = n;
1015
1024
  if (!o) {
1016
1025
  const r = path.resolve(e);
1017
- return path.basename(r) === s && F(t, r)?.isFile() ? x(r) : R(x(e), s, t);
1026
+ return path.basename(r) === s && $(t, r)?.isFile() ? E(r) : R(E(e), s, t);
1018
1027
  }
1019
- return De(e, s, t, !1)?.path;
1020
- }, "findTsconfig"), at = i((e = process.cwd(), n = {}) => {
1028
+ return xe(e, s, t, !1)?.path;
1029
+ }, "findTsconfig"), mt = i((e = process.cwd(), n = {}) => {
1021
1030
  const { configName: s = "tsconfig.json", cache: t = /* @__PURE__ */ new Map(), includes: o = !1, typescriptVersion: r = "auto" } = n;
1022
1031
  if (!o) {
1023
- const l = Ee(e, {
1032
+ const c = De(e, {
1024
1033
  configName: s,
1025
1034
  cache: t
1026
1035
  });
1027
- return l ? ee(l, {
1036
+ return c ? te(c, {
1028
1037
  cache: t,
1029
1038
  typescriptVersion: r
1030
1039
  }) : void 0;
1031
1040
  }
1032
- return De(e, s, t, r);
1033
- }, "getTsconfig"), pt = /\*/g, xe = i((e, n) => {
1034
- const s = e.match(pt);
1041
+ return xe(e, s, t, r);
1042
+ }, "getTsconfig"), gt = /\*/g, Ee = i((e, n) => {
1043
+ const s = e.match(gt);
1035
1044
  if (s && s.length > 1) throw new Error(n);
1036
- }, "assertStarCount"), mt = i((e) => {
1045
+ }, "assertStarCount"), dt = i((e) => {
1037
1046
  if (e.includes("*")) {
1038
1047
  const [n, s] = e.split("*");
1039
1048
  return {
@@ -1042,40 +1051,40 @@ const ve = G((e) => {
1042
1051
  };
1043
1052
  }
1044
1053
  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),
1054
+ }, "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.`), {
1055
+ pattern: dt(t),
1047
1056
  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 './'?");
1057
+ 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
1058
  return path.resolve(s, r);
1050
1059
  })
1051
- })), "parsePaths"), kt = i((e) => {
1060
+ })), "parsePaths"), wt = i((e) => {
1052
1061
  const { compilerOptions: n } = e.config;
1053
1062
  if (!n) return null;
1054
1063
  const { baseUrl: s, paths: t } = n;
1055
1064
  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);
1065
+ 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 = [];
1066
+ for (const k of c) typeof k.pattern == "string" ? g.set(k.pattern, k.substitutions) : m.push(k);
1058
1067
  return {
1059
1068
  exactEntries: g,
1060
1069
  patternEntries: m,
1061
1070
  resolvedBaseUrl: r,
1062
1071
  baseUrl: s
1063
1072
  };
1064
- }, "compilePaths"), Fe = /* @__PURE__ */ new WeakMap();
1073
+ }, "compilePaths"), $e = /* @__PURE__ */ new WeakMap();
1065
1074
  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);
1075
+ let s = $e.get(e);
1076
+ if (s === void 0 && (s = wt(e), $e.set(e, s)), !s) return [];
1077
+ if (C.test(n)) return [];
1078
+ const { exactEntries: t, patternEntries: o, resolvedBaseUrl: r, baseUrl: c } = s, g = t.get(n);
1079
+ if (g) return g.map(E);
1071
1080
  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)));
1081
+ for (const f of o) kt(f.pattern, n) && f.pattern.prefix.length > k && (k = f.pattern.prefix.length, m = f);
1082
+ if (!m) return c ? [E(path.join(r, n))] : [];
1083
+ const v = n.slice(m.pattern.prefix.length, n.length - m.pattern.suffix.length);
1084
+ return m.substitutions.map((f) => E(f.replace("*", v)));
1076
1085
  }, "resolvePathAlias");
1077
1086
  //#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
1087
+ //#region ../../node_modules/.pnpm/tsdown@0.23.0_@arethetypeswrong+core@0.18.2_@tsdown+css@0.23.0_@tsdown+exe@0.23.0_@type_298964156353ef75a02894ab80b3a2e6/node_modules/tsdown/dist/deps-DCK8g4G9.mjs
1079
1088
  const shimFile = path.resolve(import.meta.dirname, "..", "esm-shims.js");
1080
1089
  const shimsInject = {
1081
1090
  __dirname: [shimFile, "__dirname"],
@@ -1110,7 +1119,7 @@ const debug$7 = createDebug("tsdown:deps");
1110
1119
  */
1111
1120
  const RE_PACKAGE_SPECIFIER = /^(?:@[a-z0-9-][a-z0-9-._]*\/)?[a-z0-9-][a-z0-9-._]*(?:\/|$)/;
1112
1121
  function resolveDepsConfig(config, logger) {
1113
- let { neverBundle, alwaysBundle, onlyBundle, onlyImport, skipNodeModulesBundle, resolveDepSubpath = true } = config.deps || {};
1122
+ let { neverBundle, alwaysBundle, onlyBundle, onlyImport, resolveDepSubpath } = config.deps || {};
1114
1123
  if (config.external != null) {
1115
1124
  if (neverBundle != null) throw new TypeError("`external` is deprecated. Cannot be used with `deps.neverBundle`.");
1116
1125
  logger?.warn("`external` is deprecated. Use `deps.neverBundle` instead.");
@@ -1121,32 +1130,12 @@ function resolveDepsConfig(config, logger) {
1121
1130
  logger?.warn("`noExternal` is deprecated. Use `deps.alwaysBundle` instead.");
1122
1131
  alwaysBundle = config.noExternal;
1123
1132
  }
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
1133
  if (onlyBundle != null && onlyBundle !== false) onlyBundle = toArray(onlyBundle);
1144
1134
  if (onlyImport != null) onlyImport = toArray(onlyImport);
1145
1135
  return {
1146
1136
  ...normalizeDepsOptions(alwaysBundle, neverBundle),
1147
1137
  onlyBundle,
1148
1138
  onlyImport,
1149
- skipNodeModulesBundle,
1150
1139
  resolveDepSubpath,
1151
1140
  dts: normalizeDepsOptions(config.deps?.dts?.alwaysBundle, config.deps?.dts?.neverBundle)
1152
1141
  };
@@ -1161,7 +1150,7 @@ function normalizeDepsOptions(alwaysBundle, neverBundle) {
1161
1150
  neverBundle: resolveRegex(neverBundle)
1162
1151
  };
1163
1152
  }
1164
- function DepsPlugin({ pkg, deps: { neverBundle, alwaysBundle: jsAlwaysBundle, onlyBundle, onlyImport, skipNodeModulesBundle, resolveDepSubpath: shouldResolveDepSubpath, dts }, logger, nameLabel, platform }, tsdownBundle) {
1153
+ function DepsPlugin({ pkg, deps: { neverBundle, alwaysBundle: jsAlwaysBundle, onlyBundle, onlyImport, resolveDepSubpath: shouldResolveDepSubpath, dts }, logger, nameLabel, platform }, tsdownBundle) {
1165
1154
  const deps = pkg && Array.from(getProductionDeps(pkg));
1166
1155
  return {
1167
1156
  name: "tsdown:deps",
@@ -1209,7 +1198,7 @@ function DepsPlugin({ pkg, deps: { neverBundle, alwaysBundle: jsAlwaysBundle, on
1209
1198
  if (source[0] === ".") continue;
1210
1199
  if (platform === "node" && isBuiltin(source)) continue;
1211
1200
  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.`);
1201
+ 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
1202
  }
1214
1203
  }
1215
1204
  for (const id of chunk.moduleIds) {
@@ -1224,12 +1213,12 @@ function DepsPlugin({ pkg, deps: { neverBundle, alwaysBundle: jsAlwaysBundle, on
1224
1213
  }
1225
1214
  }
1226
1215
  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")}`));
1216
+ 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
1217
  if (errors.length) this.error(errors.join("\n\n"));
1229
1218
  if (onlyBundle) {
1230
1219
  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")}`);
1220
+ 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.`);
1221
+ } 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
1222
  }
1234
1223
  }
1235
1224
  };
@@ -1238,7 +1227,7 @@ function DepsPlugin({ pkg, deps: { neverBundle, alwaysBundle: jsAlwaysBundle, on
1238
1227
  * - `[true, resolvedId]`: external with custom resolved ID
1239
1228
  * - `false`: skip, let other plugins handle it
1240
1229
  * - `'absolute'`: external as absolute path
1241
- * - `'no-external'`: skip, but mark as non-external for inlineOnly check
1230
+ * - `'no-external'`: skip, but mark as non-external for onlyBundle check
1242
1231
  */
1243
1232
  async function externalStrategy(id, importer, resolve) {
1244
1233
  if (id === shimFile) return false;
@@ -1246,16 +1235,13 @@ function DepsPlugin({ pkg, deps: { neverBundle, alwaysBundle: jsAlwaysBundle, on
1246
1235
  if ((isDts && dts?.alwaysBundle || jsAlwaysBundle)?.(id, importer)) return "no-external";
1247
1236
  if ((isDts && dts?.neverBundle != null ? dts.neverBundle : neverBundle) === true) {
1248
1237
  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))) {
1238
+ if (isBuiltin(id)) return true;
1239
+ if (RE_PACKAGE_SPECIFIER.test(id)) {
1256
1240
  const resolvedDep = shouldResolveDepSubpath && await resolveDepSubpath(id, resolve);
1257
1241
  return resolvedDep ? [true, resolvedDep] : true;
1258
1242
  }
1243
+ const resolved = await resolve();
1244
+ return !!resolved && (!!resolved.external || RE_NODE_MODULES$1.test(resolved.id));
1259
1245
  }
1260
1246
  if (deps) {
1261
1247
  if (deps.includes(id) || deps.some((dep) => id.startsWith(`${dep}/`))) {
@@ -1386,7 +1372,7 @@ function createDefu(merger) {
1386
1372
  return (...arguments_) => arguments_.reduce((p, c) => _defu(p, c, "", merger), {});
1387
1373
  }
1388
1374
  //#endregion
1389
- //#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.5/node_modules/fdir/dist/index.mjs
1375
+ //#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.7/node_modules/fdir/dist/index.mjs
1390
1376
  var __require$1 = /* @__PURE__ */ createRequire$1(import.meta.url);
1391
1377
  function cleanPath(path) {
1392
1378
  let normalized = normalize$1(path);
@@ -1894,7 +1880,7 @@ var Builder = class {
1894
1880
  }
1895
1881
  };
1896
1882
  //#endregion
1897
- //#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/constants.js
1883
+ //#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/constants.js
1898
1884
  var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1899
1885
  const WIN_SLASH = "\\\\/";
1900
1886
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
@@ -2063,7 +2049,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2063
2049
  };
2064
2050
  }));
2065
2051
  //#endregion
2066
- //#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/utils.js
2052
+ //#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/utils.js
2067
2053
  var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
2068
2054
  const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
2069
2055
  exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
@@ -2111,7 +2097,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
2111
2097
  };
2112
2098
  }));
2113
2099
  //#endregion
2114
- //#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/scan.js
2100
+ //#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/scan.js
2115
2101
  var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2116
2102
  const utils = require_utils();
2117
2103
  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 +2126,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2140
2126
  const scan = (input, options) => {
2141
2127
  const opts = options || {};
2142
2128
  const length = input.length - 1;
2143
- const scanToEnd = opts.parts === true || opts.scanToEnd === true;
2129
+ const scanToEnd = opts.parts === true || opts.tokens === true || opts.scanToEnd === true;
2144
2130
  const slashes = [];
2145
2131
  const tokens = [];
2146
2132
  const parts = [];
@@ -2243,14 +2229,18 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2243
2229
  finished = true;
2244
2230
  if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
2245
2231
  if (scanToEnd === true) {
2232
+ let parens = 0;
2246
2233
  while (eos() !== true && (code = advance())) {
2247
2234
  if (code === CHAR_BACKWARD_SLASH) {
2248
2235
  backslashes = token.backslashes = true;
2249
- code = advance();
2236
+ advance();
2237
+ continue;
2238
+ }
2239
+ if (code === CHAR_LEFT_PARENTHESES) {
2240
+ parens++;
2250
2241
  continue;
2251
2242
  }
2252
- if (code === CHAR_RIGHT_PARENTHESES) {
2253
- isGlob = token.isGlob = true;
2243
+ if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
2254
2244
  finished = true;
2255
2245
  break;
2256
2246
  }
@@ -2298,13 +2288,18 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2298
2288
  if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
2299
2289
  isGlob = token.isGlob = true;
2300
2290
  if (scanToEnd === true) {
2291
+ let parens = 1;
2301
2292
  while (eos() !== true && (code = advance())) {
2302
- if (code === CHAR_LEFT_PARENTHESES) {
2293
+ if (code === CHAR_BACKWARD_SLASH) {
2303
2294
  backslashes = token.backslashes = true;
2304
- code = advance();
2295
+ advance();
2296
+ continue;
2297
+ }
2298
+ if (code === CHAR_LEFT_PARENTHESES) {
2299
+ parens++;
2305
2300
  continue;
2306
2301
  }
2307
- if (code === CHAR_RIGHT_PARENTHESES) {
2302
+ if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
2308
2303
  finished = true;
2309
2304
  break;
2310
2305
  }
@@ -2367,7 +2362,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2367
2362
  if (opts.parts === true || opts.tokens === true) {
2368
2363
  let prevIndex;
2369
2364
  for (let idx = 0; idx < slashes.length; idx++) {
2370
- const n = prevIndex ? prevIndex + 1 : start;
2365
+ const n = prevIndex !== void 0 ? prevIndex + 1 : start;
2371
2366
  const i = slashes[idx];
2372
2367
  const value = input.slice(n, i);
2373
2368
  if (opts.tokens) {
@@ -2378,18 +2373,19 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2378
2373
  depth(tokens[idx]);
2379
2374
  state.maxDepth += tokens[idx].depth;
2380
2375
  }
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;
2376
+ if (i >= start) {
2377
+ parts.push(value);
2378
+ prevIndex = i;
2391
2379
  }
2392
2380
  }
2381
+ const n = prevIndex !== void 0 ? prevIndex + 1 : start;
2382
+ const value = input.slice(n);
2383
+ parts.push(value);
2384
+ if (opts.tokens && prevIndex && prevIndex + 1 < input.length) {
2385
+ tokens[tokens.length - 1].value = value;
2386
+ depth(tokens[tokens.length - 1]);
2387
+ state.maxDepth += tokens[tokens.length - 1].depth;
2388
+ }
2393
2389
  state.slashes = slashes;
2394
2390
  state.parts = parts;
2395
2391
  }
@@ -2398,7 +2394,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2398
2394
  module.exports = scan;
2399
2395
  }));
2400
2396
  //#endregion
2401
- //#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/parse.js
2397
+ //#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/parse.js
2402
2398
  var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2403
2399
  const constants = require_constants();
2404
2400
  const utils = require_utils();
@@ -3300,6 +3296,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3300
3296
  rest = rest.slice(3);
3301
3297
  consume("/**", 3);
3302
3298
  }
3299
+ const isEnd = eos() || state.parens > 0 && rest === ")".repeat(state.parens) && !extglobs.some((extglob) => extglob.type === "negate");
3303
3300
  if (prior.type === "bos" && eos()) {
3304
3301
  prev.type = "globstar";
3305
3302
  prev.value += value;
@@ -3309,7 +3306,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3309
3306
  consume(value);
3310
3307
  continue;
3311
3308
  }
3312
- if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
3309
+ if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && isEnd) {
3313
3310
  state.output = state.output.slice(0, -(prior.output + prev.output).length);
3314
3311
  prior.output = `(?:${prior.output}`;
3315
3312
  prev.type = "globstar";
@@ -3474,7 +3471,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3474
3471
  module.exports = parse;
3475
3472
  }));
3476
3473
  //#endregion
3477
- //#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/picomatch.js
3474
+ //#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/picomatch.js
3478
3475
  var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3479
3476
  const scan = require_scan();
3480
3477
  const parse = require_parse();
@@ -4052,7 +4049,7 @@ const defaultOptions$1 = {
4052
4049
  function getOptions(options) {
4053
4050
  const opts = Object.assign({}, options);
4054
4051
  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, "/");
4052
+ opts.cwd = (opts.cwd instanceof URL ? fileURLToPath$1(opts.cwd) : resolve$1(opts.cwd || process.cwd())).replace(BACKSLASHES, "/");
4056
4053
  opts.ignore = ensureStringArray(opts.ignore);
4057
4054
  opts.fs && (opts.fs = {
4058
4055
  readdir: opts.fs.readdir || readdir$1,
@@ -4160,7 +4157,7 @@ function init({ skipNodeModules } = {}) {
4160
4157
  const parentUUID = getParentUUID(context.parentURL);
4161
4158
  if (!noCache && !parentUUID) return resolved;
4162
4159
  const deps = depsStore.getStore();
4163
- if (deps) deps.add(fileURLToPath$1(resolved.url));
4160
+ if (deps) deps.add(fileURLToPath(resolved.url));
4164
4161
  resolved.url = appendUUID(resolved.url, parentUUID || crypto.randomUUID());
4165
4162
  return resolved;
4166
4163
  },
@@ -4290,87 +4287,87 @@ quansync$1({
4290
4287
  */
4291
4288
  const quansync = quansync$1;
4292
4289
  quansync$1({
4293
- sync: re.readFileSync,
4294
- async: re.promises.readFile
4290
+ sync: X.readFileSync,
4291
+ async: X.promises.readFile
4295
4292
  });
4296
4293
  quansync$1({
4297
- sync: re.writeFileSync,
4298
- async: re.promises.writeFile
4294
+ sync: X.writeFileSync,
4295
+ async: X.promises.writeFile
4299
4296
  });
4300
4297
  quansync$1({
4301
- sync: re.unlinkSync,
4302
- async: re.promises.unlink
4298
+ sync: X.unlinkSync,
4299
+ async: X.promises.unlink
4303
4300
  });
4304
4301
  quansync$1({
4305
- sync: re.accessSync,
4306
- async: re.promises.access
4302
+ sync: X.accessSync,
4303
+ async: X.promises.access
4307
4304
  });
4308
4305
  /**
4309
4306
  * @link https://nodejs.org/api/fs.html#fspromisesstatpath-options
4310
4307
  */
4311
4308
  const stat$2 = quansync$1({
4312
- sync: re.statSync,
4313
- async: re.promises.stat
4309
+ sync: X.statSync,
4310
+ async: X.promises.stat
4314
4311
  });
4315
4312
  const lstat = quansync$1({
4316
- sync: re.lstatSync,
4317
- async: re.promises.lstat
4313
+ sync: X.lstatSync,
4314
+ async: X.promises.lstat
4318
4315
  });
4319
4316
  quansync$1({
4320
- sync: re.copyFileSync,
4321
- async: re.promises.copyFile
4317
+ sync: X.copyFileSync,
4318
+ async: X.promises.copyFile
4322
4319
  });
4323
4320
  quansync$1({
4324
- sync: re.rmSync,
4325
- async: re.promises.rm
4321
+ sync: X.rmSync,
4322
+ async: X.promises.rm
4326
4323
  });
4327
4324
  quansync$1({
4328
- sync: re.mkdirSync,
4329
- async: re.promises.mkdir
4325
+ sync: X.mkdirSync,
4326
+ async: X.promises.mkdir
4330
4327
  });
4331
4328
  quansync$1({
4332
- sync: re.renameSync,
4333
- async: re.promises.rename
4329
+ sync: X.renameSync,
4330
+ async: X.promises.rename
4334
4331
  });
4335
4332
  quansync$1({
4336
- sync: re.readdirSync,
4337
- async: re.promises.readdir
4333
+ sync: X.readdirSync,
4334
+ async: X.promises.readdir
4338
4335
  });
4339
4336
  quansync$1({
4340
- sync: re.realpathSync,
4341
- async: re.promises.realpath
4337
+ sync: X.realpathSync,
4338
+ async: X.promises.realpath
4342
4339
  });
4343
4340
  quansync$1({
4344
- sync: re.readlinkSync,
4345
- async: re.promises.readlink
4341
+ sync: X.readlinkSync,
4342
+ async: X.promises.readlink
4346
4343
  });
4347
4344
  quansync$1({
4348
- sync: re.symlinkSync,
4349
- async: re.promises.symlink
4345
+ sync: X.symlinkSync,
4346
+ async: X.promises.symlink
4350
4347
  });
4351
4348
  quansync$1({
4352
- sync: re.chownSync,
4353
- async: re.promises.chown
4349
+ sync: X.chownSync,
4350
+ async: X.promises.chown
4354
4351
  });
4355
4352
  quansync$1({
4356
- sync: re.lchownSync,
4357
- async: re.promises.lchown
4353
+ sync: X.lchownSync,
4354
+ async: X.promises.lchown
4358
4355
  });
4359
4356
  quansync$1({
4360
- sync: re.chmodSync,
4361
- async: re.promises.chmod
4357
+ sync: X.chmodSync,
4358
+ async: X.promises.chmod
4362
4359
  });
4363
4360
  quansync$1({
4364
- sync: re.utimesSync,
4365
- async: re.promises.utimes
4361
+ sync: X.utimesSync,
4362
+ async: X.promises.utimes
4366
4363
  });
4367
4364
  quansync$1({
4368
- sync: re.lutimesSync,
4369
- async: re.promises.lutimes
4365
+ sync: X.lutimesSync,
4366
+ async: X.promises.lutimes
4370
4367
  });
4371
4368
  quansync$1({
4372
- sync: re.mkdtempSync,
4373
- async: re.promises.mkdtemp
4369
+ sync: X.mkdtempSync,
4370
+ async: X.promises.mkdtemp
4374
4371
  });
4375
4372
  //#endregion
4376
4373
  //#region ../../node_modules/.pnpm/unconfig-core@7.5.0/node_modules/unconfig-core/dist/index.mjs
@@ -4553,7 +4550,8 @@ async function resolveArrayEntry(entries, cwd, root) {
4553
4550
  const computedRoot = root || lowestCommonAncestor(...resolvedEntries);
4554
4551
  const base = root && !isGlob ? path.relative(cwd, root) || "." : computedRoot;
4555
4552
  const arrayEntryMap = Object.fromEntries(resolvedEntries.map((file) => {
4556
- return [slash(stripExtname(path.relative(base, file))), file];
4553
+ const relative = path.relative(base, file);
4554
+ return [slash(stripExtname(relative)), file];
4557
4555
  }));
4558
4556
  const resolvedObjectEntries = await Promise.all(objectEntries.map(async (entry) => {
4559
4557
  const [entryMap] = await resolveObjectEntry(entry, cwd);
@@ -4638,10 +4636,13 @@ async function generateExports(pkg, chunks, options, inlinedDeps) {
4638
4636
  const distFile = join$1(pkgRoot, chunk.outDir, normalizedName);
4639
4637
  if (isIndex) {
4640
4638
  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;
4639
+ if (format === "cjs") {
4640
+ if (isDts) cjsTypes = distFile;
4641
+ else main = distFile;
4642
+ } else if (format === "es") {
4643
+ if (isDts) esmTypes = distFile;
4644
+ else module = distFile;
4645
+ }
4645
4646
  } else if (name.endsWith("/index")) name = `./${name.slice(0, -6)}`;
4646
4647
  else name = `./${name}`;
4647
4648
  if (extensions && name !== ".") name = `${name}.js`;
@@ -4822,17 +4823,17 @@ async function resolveTsconfig(logger, tsconfig, cwd, color, nameLabel) {
4822
4823
  if (tsconfig !== false) {
4823
4824
  if (tsconfig === true || tsconfig == null) {
4824
4825
  tsconfig = findTsconfig(cwd);
4825
- if (original && !tsconfig) logger.warn(`No tsconfig found in ${blue(cwd)}`);
4826
+ if (original && !tsconfig) logger.warn(`No tsconfig found in ${styleText$1.blue(cwd)}`);
4826
4827
  } else {
4827
4828
  const tsconfigPath = path.resolve(cwd, tsconfig);
4828
4829
  const stat = await fsStat(tsconfigPath);
4829
4830
  if (stat?.isFile()) tsconfig = tsconfigPath;
4830
4831
  else if (stat?.isDirectory()) {
4831
4832
  tsconfig = findTsconfig(tsconfigPath);
4832
- if (!tsconfig) logger.warn(`No tsconfig found in ${blue(tsconfigPath)}`);
4833
+ if (!tsconfig) logger.warn(`No tsconfig found in ${styleText$1.blue(tsconfigPath)}`);
4833
4834
  } else {
4834
4835
  tsconfig = findTsconfig(cwd, tsconfig);
4835
- if (!tsconfig) logger.warn(`tsconfig ${blue(original)} doesn't exist`);
4836
+ if (!tsconfig) logger.warn(`tsconfig ${styleText$1.blue(original)} doesn't exist`);
4836
4837
  }
4837
4838
  }
4838
4839
  if (tsconfig) logger.info(nameLabel, `tsconfig: ${color(path.relative(cwd, tsconfig))}`);
@@ -4891,7 +4892,7 @@ async function loadViteConfig(prefix, cwd, configLoader) {
4891
4892
  }).load(true);
4892
4893
  if (!result) return;
4893
4894
  let { config: [exported, deps], source } = result;
4894
- globalLogger.info(`Using Vite config: ${underline(source)}`);
4895
+ globalLogger.info(`Using Vite config: ${styleText$1.underline(source)}`);
4895
4896
  exported = await exported;
4896
4897
  if (typeof exported === "function") exported = await exported({
4897
4898
  command: "build",
@@ -4903,7 +4904,7 @@ async function loadViteConfig(prefix, cwd, configLoader) {
4903
4904
  };
4904
4905
  }
4905
4906
  const configPrefix = "tsdown.config";
4906
- async function loadConfigFile(inlineConfig, workspace, rootConfig) {
4907
+ async function loadConfigFile(inlineConfig, context, workspace) {
4907
4908
  let cwd = inlineConfig.cwd || process$1.cwd();
4908
4909
  let { config: filePath } = inlineConfig;
4909
4910
  if (filePath === false) return { configs: [{}] };
@@ -4951,12 +4952,9 @@ async function loadConfigFile(inlineConfig, workspace, rootConfig) {
4951
4952
  let deps;
4952
4953
  if (result) {
4953
4954
  ({config: [exported, deps], source: file} = result);
4954
- globalLogger.info(`config file: ${underline(file)}`, loader === "native" ? "" : `(${loader})`);
4955
+ globalLogger.info(`config file: ${styleText$1.underline(file)}`, loader === "native" ? "" : `(${loader})`);
4955
4956
  exported = await exported;
4956
- if (typeof exported === "function") exported = await exported(inlineConfig, {
4957
- ci: isInCI(),
4958
- rootConfig
4959
- });
4957
+ if (typeof exported === "function") exported = await exported(inlineConfig, context);
4960
4958
  }
4961
4959
  exported = toArray(exported);
4962
4960
  if (exported.length === 0) exported.push({});
@@ -5033,7 +5031,7 @@ async function resolveUserConfig(userConfig, inlineConfig, configDeps, runBuild
5033
5031
  if (result) userConfig = mergeConfig(userConfig, result);
5034
5032
  }
5035
5033
  }
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;
5034
+ 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
5035
  const pkg = await readPackageJson(cwd);
5038
5036
  if (workspace) name ||= pkg?.name;
5039
5037
  const color = generateColor(name);
@@ -5047,12 +5045,6 @@ async function resolveUserConfig(userConfig, inlineConfig, configDeps, runBuild
5047
5045
  failOnWarn: resolveFeatureOption(failOnWarn, true),
5048
5046
  suppressWarnings
5049
5047
  });
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
5048
  outDir = path.resolve(cwd, outDir);
5057
5049
  clean = resolveClean(clean, outDir, cwd);
5058
5050
  const rawEntry = entry;
@@ -5065,32 +5057,20 @@ async function resolveUserConfig(userConfig, inlineConfig, configDeps, runBuild
5065
5057
  unused = resolveFeatureOption(unused, {});
5066
5058
  report = resolveFeatureOption(report, {});
5067
5059
  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;
5060
+ if (dts == null) {
5061
+ if (exe) dts = false;
5062
+ else if (pkg?.types || pkg?.typings || hasExportsTypes(pkg?.exports)) dts = true;
5063
+ else if (tsconfig) {
5064
+ const { config } = te(tsconfig);
5065
+ dts = !!config.compilerOptions?.declaration;
5066
+ } else dts = false;
5067
+ }
5074
5068
  dts = resolveFeatureOption(dts, {});
5075
5069
  if (!pkg) {
5076
5070
  if (exports) throw new Error("`package.json` not found, cannot write exports");
5077
5071
  if (publint) logger.warn(nameLabel, "publint is enabled but package.json is not found");
5078
5072
  if (attw) logger.warn(nameLabel, "attw is enabled but package.json is not found");
5079
5073
  }
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
5074
  envPrefix = toArray(envPrefix);
5095
5075
  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
5076
  const envFromProcess = filterEnv(process$1.env, envPrefix);
@@ -5129,10 +5109,12 @@ async function resolveUserConfig(userConfig, inlineConfig, configDeps, runBuild
5129
5109
  });
5130
5110
  const depsConfig = resolveDepsConfig(userConfig, logger);
5131
5111
  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");
5112
+ if (devtools) {
5113
+ if (watch) {
5114
+ if (devtools.ui) logger.warn("Devtools UI is not supported in watch mode, disabling it.");
5115
+ devtools.ui = false;
5116
+ } else devtools.ui ??= !!pkgExists("@vitejs/devtools/cli");
5117
+ }
5136
5118
  const config = {
5137
5119
  ...userConfig,
5138
5120
  alias,
@@ -5140,7 +5122,7 @@ async function resolveUserConfig(userConfig, inlineConfig, configDeps, runBuild
5140
5122
  cjsDefault,
5141
5123
  clean,
5142
5124
  configDeps,
5143
- copy: publicDir || copy,
5125
+ copy,
5144
5126
  css,
5145
5127
  cwd,
5146
5128
  deps: depsConfig,
@@ -5239,7 +5221,7 @@ function filterConfig(filter, configCwd, name) {
5239
5221
  return toArray(filter).some((value) => name && name === value || cwd === value);
5240
5222
  }
5241
5223
  //#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
5224
+ //#region ../../node_modules/.pnpm/tsdown@0.23.0_@arethetypeswrong+core@0.18.2_@tsdown+css@0.23.0_@tsdown+exe@0.23.0_@type_298964156353ef75a02894ab80b3a2e6/node_modules/tsdown/dist/watch-UrMX4y5g.mjs
5243
5225
  async function copy(options) {
5244
5226
  if (!options.copy) return;
5245
5227
  const resolved = await resolveCopyEntries(options);
@@ -5320,7 +5302,8 @@ const gzipAsync = promisify(gzip);
5320
5302
  const defaultOptions = {
5321
5303
  gzip: true,
5322
5304
  brotli: false,
5323
- maxCompressSize: 1e6
5305
+ maxCompressSize: 1e6,
5306
+ summary: false
5324
5307
  };
5325
5308
  function ReportPlugin(config, cjsDts, isDualFormat) {
5326
5309
  return {
@@ -5359,10 +5342,10 @@ async function outputReport(config, chunks, outDir, cjsDts, isDualFormat) {
5359
5342
  return b.raw - a.raw;
5360
5343
  });
5361
5344
  const formatLabel = isDualFormat && prettyFormat(cjsDts ? "cjs" : config.format);
5362
- for (const size of sizes) {
5363
- const filenameColor = size.dts ? green : noop;
5345
+ if (!options.summary) for (const size of sizes) {
5346
+ const filenameColor = size.dts ? styleText$1.green : noop;
5364
5347
  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}`);
5348
+ 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
5349
  }
5367
5350
  const totalSizeText = formatBytes(totalRaw);
5368
5351
  config.logger.info(config.nameLabel, formatLabel, `${sizes.length} files, total: ${totalSizeText}`);
@@ -5407,7 +5390,7 @@ function ShebangPlugin(logger, cwd, nameLabel, isDualFormat) {
5407
5390
  if (!RE_SHEBANG.test(chunk.code)) continue;
5408
5391
  const filepath = path.resolve(cwd, options.file || path.join(options.dir, chunk.fileName));
5409
5392
  if (await fsExists(filepath)) {
5410
- logger.info(nameLabel, isDualFormat && prettyFormat(options.format), `Granting execute permission to ${underline(path.relative(cwd, filepath))}`);
5393
+ logger.info(nameLabel, isDualFormat && prettyFormat(options.format), `Granting execute permission to ${styleText$1.underline(path.relative(cwd, filepath))}`);
5411
5394
  await chmod(filepath, 493);
5412
5395
  }
5413
5396
  }
@@ -5619,8 +5602,8 @@ var Hookable = class {
5619
5602
  }
5620
5603
  };
5621
5604
  //#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({
5605
+ //#region ../../node_modules/.pnpm/tsdown@0.23.0_@arethetypeswrong+core@0.18.2_@tsdown+css@0.23.0_@tsdown+exe@0.23.0_@type_298964156353ef75a02894ab80b3a2e6/node_modules/tsdown/dist/build-JVmLFaZt.mjs
5606
+ var build_JVmLFaZt_exports = /* @__PURE__ */ __exportAll$1({
5624
5607
  n: () => buildWithConfigs,
5625
5608
  r: () => build_exports,
5626
5609
  t: () => build$1
@@ -5643,7 +5626,7 @@ const DEFAULT_EXCLUDE_WORKSPACE = [
5643
5626
  "**/test?(s)/**",
5644
5627
  "**/t?(e)mp/**"
5645
5628
  ];
5646
- async function resolveWorkspace(config, inlineConfig, rootDeps) {
5629
+ async function resolveWorkspace(config, inlineConfig, context, rootDeps) {
5647
5630
  const normalized = mergeConfig(config, inlineConfig);
5648
5631
  const rootCwd = normalized.cwd || process$1.cwd();
5649
5632
  const deps = new Set(rootDeps);
@@ -5668,6 +5651,10 @@ async function resolveWorkspace(config, inlineConfig, rootDeps) {
5668
5651
  expandDirectories: false
5669
5652
  })).map((file) => slash(path.resolve(file)));
5670
5653
  if (packages.length === 0) throw new Error("No workspace packages found, please check your config");
5654
+ context = {
5655
+ ...context,
5656
+ rootConfig: normalized
5657
+ };
5671
5658
  return {
5672
5659
  configs: (await Promise.all(packages.map(async (cwd) => {
5673
5660
  debug$5("loading workspace config %s", cwd);
@@ -5675,7 +5662,7 @@ async function resolveWorkspace(config, inlineConfig, rootDeps) {
5675
5662
  ...inlineConfig,
5676
5663
  config: workspaceConfig,
5677
5664
  cwd
5678
- }, cwd, normalized);
5665
+ }, context, cwd);
5679
5666
  workspaceDeps?.forEach((dep) => deps.add(dep));
5680
5667
  return configs.map((config) => mergeConfig(normalized, config));
5681
5668
  }))).flat(),
@@ -5683,14 +5670,18 @@ async function resolveWorkspace(config, inlineConfig, rootDeps) {
5683
5670
  };
5684
5671
  }
5685
5672
  const debug$4 = createDebug("tsdown:config");
5686
- async function resolveConfig(inlineConfig) {
5673
+ async function resolveConfig(inlineConfig, watch) {
5687
5674
  debug$4("inline config %O", inlineConfig);
5688
5675
  if (inlineConfig.cwd) inlineConfig.cwd = path.resolve(inlineConfig.cwd);
5689
- const { configs: rootConfigs, deps: rootDeps } = await loadConfigFile(inlineConfig);
5676
+ const context = {
5677
+ ci: isInCI(),
5678
+ watch
5679
+ };
5680
+ const { configs: rootConfigs, deps: rootDeps } = await loadConfigFile(inlineConfig, context);
5690
5681
  const globalDeps = new Set(rootDeps);
5691
5682
  const runBuild = createConcurrencyExecutor(inlineConfig.concurrency);
5692
5683
  const configs = (await Promise.all(rootConfigs.map(async (rootConfig) => {
5693
- const { configs: workspaceConfigs, deps: workspaceDeps } = await resolveWorkspace(rootConfig, inlineConfig, rootDeps);
5684
+ const { configs: workspaceConfigs, deps: workspaceDeps } = await resolveWorkspace(rootConfig, inlineConfig, context, rootDeps);
5694
5685
  debug$4("workspace configs %O", workspaceConfigs);
5695
5686
  const configs = (await Promise.all(workspaceConfigs.filter((config) => !config.workspace || config.entry).map((config) => resolveUserConfig(config, inlineConfig, workspaceDeps, runBuild)))).flat().filter((config) => !!config);
5696
5687
  workspaceDeps.forEach((dep) => globalDeps.add(dep));
@@ -5712,23 +5703,6 @@ function warnLegacyCJS(config) {
5712
5703
  return version && satisfies(version, RANGE_REQUIRING_ESM);
5713
5704
  })) 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
5705
  }
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
5706
  async function startDevtoolsUI(config) {
5733
5707
  const { start } = await importWithError("@vitejs/devtools/cli-commands");
5734
5708
  await start({
@@ -5768,7 +5742,7 @@ function executeOnSuccess(config) {
5768
5742
  return ab;
5769
5743
  }
5770
5744
  const debug$3 = createDebug("tsdown:attw");
5771
- const label$1 = dim`[attw]`;
5745
+ const label$1 = styleText$1.dim(`[attw]`);
5772
5746
  const problemFlags = {
5773
5747
  NoResolution: "no-resolution",
5774
5748
  UntypedResolution: "untyped-resolution",
@@ -5800,7 +5774,7 @@ async function attw(options, tarball) {
5800
5774
  options.logger.warn("attw is enabled but package.json is not found");
5801
5775
  return;
5802
5776
  }
5803
- const { profile = "strict", level = "warn", ignoreRules = [], ...attwOptions } = options.attw;
5777
+ const { profile = "esm-only", level = "warn", ignoreRules = [], ...attwOptions } = options.attw;
5804
5778
  const invalidRules = ignoreRules.filter((rule) => !Object.values(problemFlags).includes(rule));
5805
5779
  if (invalidRules.length) options.logger.warn(`attw config option 'ignoreRules' contains invalid value '${invalidRules.join(", ")}'.`);
5806
5780
  const t = performance.now();
@@ -5818,7 +5792,7 @@ async function attw(options, tarball) {
5818
5792
  if (problems.length) errorMessage = `problems found:\n${problems.map((problem) => formatProblem(checkResult.packageName, problem)).join("\n")}`;
5819
5793
  } else errorMessage = `Package has no types`;
5820
5794
  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)`);
5795
+ else options.logger.success(options.nameLabel, label$1, "No problems found", styleText$1.dim(`(${Math.round(performance.now() - t)}ms)`));
5822
5796
  }
5823
5797
  /**
5824
5798
  * Format an ATTW problem for display
@@ -5846,7 +5820,7 @@ function formatProblem(packageName, problem) {
5846
5820
  }
5847
5821
  }
5848
5822
  const debug$2 = createDebug("tsdown:publint");
5849
- const label = dim`[publint]`;
5823
+ const label = styleText$1.dim(`[publint]`);
5850
5824
  async function publint(options, tarball) {
5851
5825
  if (!options.publint) return;
5852
5826
  if (!options.pkg) {
@@ -5863,7 +5837,7 @@ async function publint(options, tarball) {
5863
5837
  });
5864
5838
  debug$2("Found %d issues", messages.length);
5865
5839
  if (!messages.length) {
5866
- options.logger.success(options.nameLabel, label, "No issues found", dim`(${Math.round(performance.now() - t)}ms)`);
5840
+ options.logger.success(options.nameLabel, label, "No issues found", styleText$1.dim(`(${Math.round(performance.now() - t)}ms)`));
5867
5841
  return;
5868
5842
  }
5869
5843
  for (const message of messages) {
@@ -5908,9 +5882,9 @@ async function bundleDone(bundleByPkg, bundle) {
5908
5882
  if (exportsConfigs.length) {
5909
5883
  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
5884
  const chunks = {};
5911
- const inlinedDeps = mergeInlinedDeps(ctx.bundles);
5912
- for (const bundle of ctx.bundles) {
5913
- if (!bundle.config.exports) continue;
5885
+ const exportsBundles = ctx.bundles.filter((bundle) => bundle.config.exports);
5886
+ const inlinedDeps = mergeInlinedDeps(exportsBundles);
5887
+ for (const bundle of exportsBundles) {
5914
5888
  chunks[bundle.config.format] ||= [];
5915
5889
  chunks[bundle.config.format].push(...bundle.chunks);
5916
5890
  }
@@ -5934,7 +5908,7 @@ async function bundleDone(bundleByPkg, bundle) {
5934
5908
  async function packTarball(packageJsonPath) {
5935
5909
  const pkgDir = path.dirname(packageJsonPath);
5936
5910
  const destination = await mkdtemp(path.join(tmpdir(), "tsdown-pack-"));
5937
- const { detect } = await import("./detect-DGhJGEqb-LL52mV6u.js");
5911
+ const { detect } = await import("./detect-Bg-d8iUV-Cr_BRLVW.js");
5938
5912
  try {
5939
5913
  const detected = await detect({ cwd: pkgDir });
5940
5914
  debug$1("Detected package manager: %o", detected);
@@ -5992,20 +5966,16 @@ async function pack(dir, pm, destination, ignoreScripts) {
5992
5966
  case "bun":
5993
5967
  args.push("--destination", destination);
5994
5968
  break;
5995
- default:
5996
- args.push("--pack-destination", destination);
5997
- break;
5969
+ default: args.push("--pack-destination", destination);
5998
5970
  }
5999
5971
  if (ignoreScripts) switch (pm.agent) {
6000
5972
  case "pnpm":
6001
5973
  args.push("--config.ignore-scripts=true");
6002
5974
  break;
6003
5975
  case "yarn@berry": break;
6004
- default:
6005
- args.push("--ignore-scripts");
6006
- break;
5976
+ default: args.push("--ignore-scripts");
6007
5977
  }
6008
- const output = await x$1(command, args, {
5978
+ const output = await x(command, args, {
6009
5979
  nodePath: false,
6010
5980
  nodeOptions: { cwd: dir }
6011
5981
  });
@@ -6077,14 +6047,13 @@ async function resolveInputOptions(config, format, configDeps, bundle, cjsDts, i
6077
6047
  const isSuppressed = createSuppressWarnings(logger.options?.suppressWarnings);
6078
6048
  const plugins = [];
6079
6049
  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));
6050
+ if (config.pkg || config.deps.neverBundle === true || config.deps.dts.neverBundle === true) plugins.push(DepsPlugin(config, bundle));
6081
6051
  if (dts) {
6082
- const { dts: dtsPlugin } = await import("./dist-BsS7BOcb.js");
6083
- const { cjsReexport: _, ...dtsPluginOptions } = dts;
6052
+ const { dts: dtsPlugin } = await import("./dist-ByW_jJfv.js");
6084
6053
  const options = {
6085
6054
  tsconfig,
6086
6055
  logger,
6087
- ...dtsPluginOptions
6056
+ ...dts
6088
6057
  };
6089
6058
  if (format === "es") plugins.push(dtsPlugin(options));
6090
6059
  else if (cjsDts) plugins.push(dtsPlugin({
@@ -6092,7 +6061,6 @@ async function resolveInputOptions(config, format, configDeps, bundle, cjsDts, i
6092
6061
  emitDtsOnly: true,
6093
6062
  cjsDefault
6094
6063
  }));
6095
- else if (dts.cjsReexport && isDualFormat) plugins.push(CjsDtsReexportPlugin());
6096
6064
  }
6097
6065
  let cssPostPlugins;
6098
6066
  if (!cjsDts) {
@@ -6208,14 +6176,15 @@ async function debugBuildOptions(dir, name, format, buildOptions) {
6208
6176
  maxArrayLength: null,
6209
6177
  maxStringLength: null
6210
6178
  }, buildOptions);
6211
- await writeFile(outFile, `/*
6179
+ const code = `/*
6212
6180
  Auto-generated rolldown config for tsdown debug purposes
6213
6181
  tsdown v${version}, rolldown v${VERSION}
6214
6182
  Generated on ${(/* @__PURE__ */ new Date()).toISOString()}
6215
6183
  Package name: ${name || "not specified"}
6216
6184
  */
6217
6185
 
6218
- export default ${serialized}\n`);
6186
+ export default ${serialized}\n`;
6187
+ await writeFile(outFile, code);
6219
6188
  debug("Wrote debug rolldown config for \"%s\" (%s) -> %s", name || "default name", format, outFile);
6220
6189
  }
6221
6190
  function handlePluginInspect(plugins) {
@@ -6256,9 +6225,7 @@ function shortcuts(restart) {
6256
6225
  {
6257
6226
  key: "r",
6258
6227
  description: "reload config and rebuild",
6259
- action() {
6260
- restart();
6261
- }
6228
+ action: restart
6262
6229
  },
6263
6230
  {
6264
6231
  key: "c",
@@ -6282,7 +6249,7 @@ function shortcuts(restart) {
6282
6249
  if (loggedKeys.has(shortcut.key)) continue;
6283
6250
  loggedKeys.add(shortcut.key);
6284
6251
  if (shortcut.action == null) continue;
6285
- globalLogger.info(dim` press ` + bold`${shortcut.key} + enter` + dim` to ${shortcut.description}`);
6252
+ globalLogger.info(styleText$1.dim(` press `) + styleText$1.bold(`${shortcut.key} + enter`) + styleText$1.dim(` to ${shortcut.description}`));
6286
6253
  }
6287
6254
  return;
6288
6255
  }
@@ -6300,14 +6267,27 @@ var build_exports = /* @__PURE__ */ __exportAll({
6300
6267
  build: () => build$1,
6301
6268
  buildWithConfigs: () => buildWithConfigs
6302
6269
  });
6303
- const asyncDispose = Symbol.asyncDispose || Symbol.for("Symbol.asyncDispose");
6304
6270
  /**
6305
6271
  * Build with tsdown.
6306
6272
  */
6307
6273
  async function build$1(inlineConfig = {}) {
6308
6274
  globalLogger.level = inlineConfig.logLevel || "info";
6309
- const { configs, deps: configDeps } = await resolveConfig(inlineConfig);
6310
- return buildWithConfigs(configs, configDeps, () => build$1(inlineConfig));
6275
+ let isConfigResolved = false;
6276
+ const { configs, deps } = await resolveConfig(inlineConfig, {
6277
+ restart,
6278
+ close
6279
+ });
6280
+ const handlePromise = buildWithConfigs(configs, deps, () => build$1(inlineConfig));
6281
+ isConfigResolved = true;
6282
+ return await handlePromise;
6283
+ async function restart() {
6284
+ if (!isConfigResolved) throw new Error("`watch.restart` cannot be called before config resolution is complete.");
6285
+ return (await handlePromise).watch.restart();
6286
+ }
6287
+ async function close() {
6288
+ if (!isConfigResolved) throw new Error("`watch.close` cannot be called before config resolution is complete.");
6289
+ return (await handlePromise).watch.close();
6290
+ }
6311
6291
  }
6312
6292
  /**
6313
6293
  * Build with `ResolvedConfigs`.
@@ -6315,20 +6295,29 @@ async function build$1(inlineConfig = {}) {
6315
6295
  * **Internal API, not for public use**
6316
6296
  * @private
6317
6297
  */
6318
- async function buildWithConfigs(configs, configDeps, _restart) {
6298
+ async function buildWithConfigs(configs, configDeps, rebuild) {
6299
+ const hasWatchConfig = configs.some((config) => config.watch);
6319
6300
  let cleanPromise;
6320
6301
  const clean = () => {
6321
6302
  if (cleanPromise) return cleanPromise;
6322
6303
  return cleanPromise = cleanOutDir(configs);
6323
6304
  };
6324
6305
  const disposeCbs = [];
6325
- let restarting = false;
6326
- async function restart() {
6327
- if (restarting) return;
6328
- restarting = true;
6306
+ let restarted = false;
6307
+ function assertWatchMode() {
6308
+ if (!hasWatchConfig) throw new Error("`watch` is only available in watch mode.");
6309
+ }
6310
+ async function close() {
6311
+ assertWatchMode();
6329
6312
  await Promise.all(disposeCbs.map((cb) => cb()));
6313
+ }
6314
+ async function restart() {
6315
+ assertWatchMode();
6316
+ if (restarted) throw new Error("`watch.restart` can only be called once per handle.");
6317
+ restarted = true;
6318
+ await close();
6330
6319
  clearRequireCache();
6331
- _restart();
6320
+ return rebuild();
6332
6321
  }
6333
6322
  const configChunksByPkg = initBundleByPkg(configs);
6334
6323
  function done(bundle) {
@@ -6336,14 +6325,23 @@ async function buildWithConfigs(configs, configDeps, _restart) {
6336
6325
  }
6337
6326
  globalLogger.info("Build start");
6338
6327
  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);
6328
+ return buildSingle(options, configDeps, options.pkg ? configChunksByPkg[options.pkg.packageJsonPath].formats.size > 1 : true, clean, () => {
6329
+ if (restarted) return;
6330
+ restart().catch((error) => globalLogger.error(error));
6331
+ }, done);
6340
6332
  }));
6341
6333
  const firstDevtoolsConfig = configs.find((config) => config.devtools && config.devtools.ui);
6342
- if (configs.some((config) => config.watch)) {
6334
+ if (hasWatchConfig) {
6343
6335
  disposeCbs.push(shortcuts(restart));
6344
- for (const bundle of bundles) disposeCbs.push(bundle[asyncDispose]);
6336
+ for (const bundle of bundles) disposeCbs.push(bundle[Symbol.asyncDispose]);
6345
6337
  } else if (firstDevtoolsConfig) startDevtoolsUI(firstDevtoolsConfig.devtools);
6346
- return bundles;
6338
+ return {
6339
+ bundles,
6340
+ watch: {
6341
+ restart,
6342
+ close
6343
+ }
6344
+ };
6347
6345
  }
6348
6346
  /**
6349
6347
  * Build a single configuration, without watch and shortcuts features.
@@ -6368,7 +6366,7 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
6368
6366
  chunks,
6369
6367
  config,
6370
6368
  inlinedDeps: /* @__PURE__ */ new Map(),
6371
- async [asyncDispose]() {
6369
+ async [Symbol.asyncDispose]() {
6372
6370
  debouncedPostBuild.cancel();
6373
6371
  ab?.abort();
6374
6372
  await watcher?.close();
@@ -6377,17 +6375,18 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
6377
6375
  const configs = await initBuildOptions();
6378
6376
  if (watch$1) {
6379
6377
  watcher = watch(configs);
6380
- handleWatcher(watcher);
6378
+ await handleWatcher(watcher);
6381
6379
  } else {
6382
6380
  const outputs = await config.runBuild(() => build(configs));
6383
6381
  for (const { output } of outputs) chunks.push(...addOutDirToChunks(output, outDir));
6384
6382
  }
6385
6383
  if (!watch$1) {
6386
- logger.success(config.nameLabel, `Build complete in ${green(`${Math.round(performance.now() - startTime)}ms`)}`);
6384
+ logger.success(config.nameLabel, `Build complete in ${styleText$1.green(`${Math.round(performance.now() - startTime)}ms`)}`);
6387
6385
  await postBuild();
6388
6386
  }
6389
6387
  return bundle;
6390
6388
  function handleWatcher(watcher) {
6389
+ const ready = Promise.withResolvers();
6391
6390
  const changedFile = [];
6392
6391
  let hasError = false;
6393
6392
  watcher.on("change", async (id, event) => {
@@ -6415,6 +6414,7 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
6415
6414
  if (config.clean.length) await cleanChunks(config.outDir, chunks);
6416
6415
  chunks.length = 0;
6417
6416
  hasError = false;
6417
+ ready.resolve();
6418
6418
  break;
6419
6419
  case "END":
6420
6420
  if (!hasError) debouncedPostBuild();
@@ -6422,7 +6422,7 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
6422
6422
  case "BUNDLE_START":
6423
6423
  if (changedFile.length) {
6424
6424
  logger.clearScreen("info");
6425
- logger.info(`Found ${bold(changedFile.join(", "))} changed, rebuilding...`);
6425
+ logger.info(`Found ${styleText$1.bold(changedFile.join(", "))} changed, rebuilding...`);
6426
6426
  }
6427
6427
  changedFile.length = 0;
6428
6428
  break;
@@ -6436,6 +6436,7 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
6436
6436
  hasError = true;
6437
6437
  }
6438
6438
  });
6439
+ return ready.promise;
6439
6440
  }
6440
6441
  async function initBuildOptions() {
6441
6442
  const buildOptions = await getBuildOptions(config, format, configDeps, bundle, false, isDualFormat);
@@ -6445,7 +6446,7 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
6445
6446
  });
6446
6447
  if (debugRolldownConfigDir) await debugBuildOptions(debugRolldownConfigDir, config.name, format, buildOptions);
6447
6448
  const configs = [buildOptions];
6448
- if (format === "cjs" && dts && (!isDualFormat || !dts.cjsReexport)) configs.push(await getBuildOptions(config, format, configDeps, bundle, true, isDualFormat));
6449
+ if (format === "cjs" && dts) configs.push(await getBuildOptions(config, format, configDeps, bundle, true, isDualFormat));
6449
6450
  return configs;
6450
6451
  }
6451
6452
  async function postBuild() {
@@ -6462,4 +6463,4 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
6462
6463
  }
6463
6464
  }
6464
6465
  //#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 };
6466
+ 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 };