@voidzero-dev/vite-plus-core 0.2.4 → 0.2.6

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 (88) hide show
  1. package/LICENSE +36 -120
  2. package/dist/rolldown/cli.d.mts +1 -1
  3. package/dist/rolldown/cli.mjs +11 -8
  4. package/dist/rolldown/config.d.mts +22 -10
  5. package/dist/rolldown/config.mjs +2 -2
  6. package/dist/rolldown/experimental-index.d.mts +164 -155
  7. package/dist/rolldown/experimental-index.mjs +23 -14
  8. package/dist/rolldown/experimental-runtime-types.d.ts +111 -41
  9. package/dist/rolldown/filter-index.d.mts +6 -5
  10. package/dist/rolldown/get-log-filter.d.mts +2 -2
  11. package/dist/rolldown/index.d.mts +4 -4
  12. package/dist/rolldown/index.mjs +10 -4
  13. package/dist/rolldown/parallel-plugin-worker.d.mts +1 -1
  14. package/dist/rolldown/parallel-plugin-worker.mjs +2 -2
  15. package/dist/rolldown/parallel-plugin.d.mts +3 -4
  16. package/dist/rolldown/parse-ast-index.d.mts +19 -20
  17. package/dist/rolldown/parse-ast-index.mjs +2 -2
  18. package/dist/rolldown/plugins-index.d.mts +27 -28
  19. package/dist/rolldown/plugins-index.mjs +2 -2
  20. package/dist/rolldown/shared/{binding-B1q9aYT-.d.mts → binding-Dbbi0RbO.d.mts} +49 -25
  21. package/dist/rolldown/shared/{binding-BmkJW3Wy.mjs → binding-Dby9rwGk.mjs} +26 -26
  22. package/dist/rolldown/shared/{bindingify-input-options-Cmm60vfj.mjs → bindingify-input-options-DVQ4K-zY.mjs} +11 -13
  23. package/dist/rolldown/shared/{constructors-2i1T9YcF.d.mts → constructors-CSWbNgBZ.d.mts} +9 -10
  24. package/dist/rolldown/shared/{constructors-CE6zZSUt.mjs → constructors-CuGa75s-.mjs} +1 -1
  25. package/dist/rolldown/shared/define-config-B-IDOhDz.d.mts +4003 -0
  26. package/dist/rolldown/shared/dist-DX3cAjHx.mjs +154 -0
  27. package/dist/rolldown/shared/{error-BlQ0-ek7.mjs → error-DFGNOCle.mjs} +1 -1
  28. package/dist/rolldown/shared/get-log-filter-AjBknEEO.d.mts +34 -0
  29. package/dist/rolldown/shared/{load-config-CVVMWSlg.mjs → load-config-R0z2olkB.mjs} +19 -2
  30. package/dist/rolldown/shared/{logging-BSNejiLS.d.mts → logging-xuHO4mAy.d.mts} +6 -6
  31. package/dist/rolldown/shared/{logs-aMKUxRpj.mjs → logs-ZGEh6uhb.mjs} +6 -1
  32. package/dist/rolldown/shared/{normalize-string-or-regex-BYkbbGqQ.mjs → normalize-string-or-regex-SiXbePVH.mjs} +2 -2
  33. package/dist/rolldown/shared/{parse-Dphnedsw.mjs → parse-D5dkElpf.mjs} +2 -2
  34. package/dist/rolldown/shared/{prompt-Bgj-uEyc.mjs → prompt-pZFoa1TT.mjs} +59 -17
  35. package/dist/rolldown/shared/{resolve-tsconfig-CdIAR1Eb.mjs → resolve-tsconfig-2TXRF_zr.mjs} +2 -2
  36. package/dist/rolldown/shared/{rolldown-Bnp916iM.mjs → rolldown-BnV7isAX.mjs} +1 -1
  37. package/dist/rolldown/shared/{rolldown-build-Cs2iVJuw.mjs → rolldown-build-BGXNOfvH.mjs} +33 -13
  38. package/dist/rolldown/shared/transform-Cs2bUDRH.d.mts +148 -0
  39. package/dist/rolldown/shared/{watch-ECGr-_QS.mjs → watch-DVucf-VG.mjs} +5 -5
  40. package/dist/rolldown/utils-index.d.mts +29 -30
  41. package/dist/rolldown/utils-index.mjs +9 -9
  42. package/dist/tsdown/{build-B_nvJe4A-CvbtVBxy.js → build-oq13wECG-Bymq3jT5.js} +210 -1229
  43. package/dist/tsdown/debug-BntVTkRq-BGIoAiTa.js +159 -0
  44. package/dist/tsdown/{detect-B97OSl92-BJPZyIKJ.js → detect-DGhJGEqb-S-tkSzpt.js} +13 -2
  45. package/dist/tsdown/dist-CxIM8o7n.js +2613 -0
  46. package/dist/tsdown/dist-DCMiHFrJ.js +1061 -0
  47. package/dist/tsdown/index-types.d.ts +2106 -1895
  48. package/dist/tsdown/index.js +7 -4
  49. package/dist/tsdown/internal-C7ewSPAZ.js +3 -0
  50. package/dist/tsdown/load-tsc-BKULZsrs-BFmeD6Bu.js +18 -0
  51. package/dist/tsdown/{main-BlTcyuFi.js → main-BdzlWPt6.js} +214 -9
  52. package/dist/tsdown/npm_entry_picomatch.cjs +44 -15
  53. package/dist/tsdown/{resolver-DtsKFXi2-B8Z3WwZh.js → resolver-cwLsPb2o-oj1hqxK6.js} +4 -3
  54. package/dist/tsdown/run.js +4 -4
  55. package/dist/tsdown/{src-CISfE_A0.js → src-BV-UJr_R.js} +5 -5
  56. package/dist/tsdown/target-CNxIDvSz-eoHNdJNs.js +576 -0
  57. package/dist/tsdown/{tsc-context-CX_GXdyS.js → tsc-context-CA76SkkZ.js} +2 -2
  58. package/dist/tsdown/{tsc-CdZE7QwS.js → tsc-zcbB6ZVY.js} +58 -117
  59. package/dist/tsdown/tsdown-css.js +74 -23
  60. package/dist/tsdown/tsdown-exe.js +129 -876
  61. package/dist/vite/client/client.mjs +5 -5
  62. package/dist/vite/node/chunks/build.js +204 -94
  63. package/dist/vite/node/chunks/dist2.js +1 -1
  64. package/dist/vite/node/chunks/lib.js +1 -1
  65. package/dist/vite/node/chunks/moduleRunnerTransport.d.ts +25 -26
  66. package/dist/vite/node/chunks/node.js +552 -104
  67. package/dist/vite/node/chunks/postcss-import.js +11 -11
  68. package/dist/vite/node/cli.js +3 -4
  69. package/dist/vite/node/index.d.ts +1284 -1285
  70. package/dist/vite/node/index.js +1 -2
  71. package/dist/vite/node/module-runner.d.ts +76 -77
  72. package/dist/vite/node/module-runner.js +6 -7
  73. package/package.json +20 -18
  74. package/dist/rolldown/shared/define-config-BBz954-q.d.mts +0 -3901
  75. package/dist/rolldown/shared/get-log-filter-BpNVNJ5-.d.mts +0 -35
  76. package/dist/rolldown/shared/transform-CEmFsvJW.d.mts +0 -149
  77. package/dist/tsdown/debug-DLdR-9XB-DQZ6QLC0.js +0 -250
  78. package/dist/tsdown/dist-CZtGyfn3.js +0 -200
  79. package/dist/tsdown/dist-CqbVlnVq.js +0 -32057
  80. package/dist/tsdown/general-Cp4NiJNK-CbyrS9q1.js +0 -97
  81. package/dist/tsdown/internal-bfoxcI4F.js +0 -3
  82. package/dist/tsdown/npm_cjs_chunk_range.cjs +0 -474
  83. package/dist/tsdown/npm_cjs_chunk_semver.cjs +0 -357
  84. package/dist/tsdown/npm_entry_semver_functions_coerce.cjs +0 -52
  85. package/dist/tsdown/npm_entry_semver_functions_satisfies.cjs +0 -19
  86. package/dist/tsdown/npm_entry_semver_ranges_min-version.cjs +0 -46
  87. package/dist/tsdown/target-CqeSqtms-FAqYuGyB.js +0 -79
  88. package/dist/vite/node/chunks/logger.js +0 -361
@@ -1,1064 +1,34 @@
1
- import { a as pkgExists, c as resolveRegex, d as __commonJSMin, f as __exportAll$1, i as noop, l as slash, m as __toESM, n as importWithError, o as promiseWithResolvers, r as matchPattern, s as resolveComma, t as debounce, u as toArray } from "./general-Cp4NiJNK-CbyrS9q1.js";
2
- import { a as generateColor, c as prettyFormat, d as dim, f as green, g as yellow, h as underline, i as createLogger, l as blue, m as red, n as version, o as getNameLabel, r as LogLevels, s as globalLogger, u as bold } from "./debug-DLdR-9XB-DQZ6QLC0.js";
3
- import { n as z$1, r as createDebug, t as R$2 } from "./main-BlTcyuFi.js";
4
- import { a as fsRemove, c as stripExtname, i as fsExists, n as resolveTarget, o as fsStat, r as fsCopy, s as lowestCommonAncestor } from "./target-CqeSqtms-FAqYuGyB.js";
1
+ import { A as __toESM, C as resolveComma, D as __commonJSMin, E as toArray, O as __exportAll$1, S as promiseWithResolvers, T as slash, _ as debounce, b as noop, c as blue, d as green, g as yellow, h as underline, l as bold, n as z, r as createDebug, t as R, u as dim, v as importWithError, w as resolveRegex, x as pkgExists, y as matchPattern } from "./main-BdzlWPt6.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-BntVTkRq-BGIoAiTa.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-CNxIDvSz-eoHNdJNs.js";
4
+ import { n as ee } from "./dist-DCMiHFrJ.js";
5
5
  import module$1, { builtinModules, createRequire, isBuiltin } from "node:module";
6
6
  import process$1 from "node:process";
7
7
  import readline from "node:readline";
8
- import { formatWithOptions, inspect, isDeepStrictEqual, promisify } from "node:util";
8
+ import { formatWithOptions, inspect, isDeepStrictEqual, parseEnv, promisify } from "node:util";
9
9
  import path, { dirname, isAbsolute, join, parse, resolve } from "node:path";
10
10
  import re, { existsSync, readFileSync, writeFileSync } from "node:fs";
11
- import { RUNTIME_MODULE_ID, VERSION, build, watch } from "@voidzero-dev/vite-plus-core/rolldown";
12
- import { chmod, mkdir, mkdtemp, readFile, readdir, writeFile } from "node:fs/promises";
13
- import { and, exactRegex, id, importerId, include } from "@voidzero-dev/vite-plus-core/rolldown/filter";
11
+ import { VERSION, build, watch } from "@voidzero-dev/vite-plus-core/rolldown";
12
+ import { chmod, mkdtemp, readFile, readdir, writeFile } from "node:fs/promises";
13
+ import { and, id, importerId, include } from "@voidzero-dev/vite-plus-core/rolldown/filter";
14
14
  import * as nativeFs from "fs";
15
- import Ue, { readdir as readdir$1, readdirSync, realpath, realpathSync, stat as stat$1, statSync as statSync$1 } from "fs";
16
- import Ie from "os";
17
- 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";
15
+ import { readdir as readdir$1, readdirSync, realpath, realpathSync, stat as stat$1, statSync as statSync$1 } from "fs";
16
+ import { basename as basename$1, dirname as dirname$1, isAbsolute as isAbsolute$1, normalize as normalize$1, posix, relative, resolve as resolve$1, sep } from "path";
17
+ import { Visitor, parse as parse$1 } from "@voidzero-dev/vite-plus-core/rolldown/utils";
18
+ import { tmpdir } from "node:os";
18
19
  import { fileURLToPath } from "url";
19
20
  import { createRequire as createRequire$1 } from "module";
20
- import { tmpdir } from "node:os";
21
21
  import { fileURLToPath as fileURLToPath$1, pathToFileURL } from "node:url";
22
22
  import { AsyncLocalStorage } from "node:async_hooks";
23
23
  import { Buffer } from "node:buffer";
24
24
  import { brotliCompress, gzip } from "node:zlib";
25
25
  import { importGlobPlugin } from "@voidzero-dev/vite-plus-core/rolldown/experimental";
26
- //#region ../../node_modules/.pnpm/rolldown-plugin-dts@0.26.0_@typescript+native-preview@7.0.0-dev.20260605.1_oxc-resolver_4fe2e1acd1a0882df7c50b3958bba707/node_modules/rolldown-plugin-dts/dist/filename-BR9JpwkC.mjs
27
- const RE_JS = /\.([cm]?)jsx?$/;
28
- const RE_TS = /\.([cm]?)tsx?$/;
29
- const RE_DTS = /\.d\.([cm]?)ts$/;
30
- const RE_DTS_MAP = /\.d\.([cm]?)ts\.map$/;
31
- const RE_NODE_MODULES$1 = /[\\/]node_modules[\\/]/;
32
- const RE_CSS = /\.(?:css|scss|sass|less|styl|stylus)$/;
33
- const RE_VUE = /\.vue$/;
34
- const RE_JSON = /\.json$/;
35
- const RE_ROLLDOWN_RUNTIME = exactRegex(RUNTIME_MODULE_ID);
36
- function filename_js_to_dts(id) {
37
- return id.replace(RE_JS, ".d.$1ts");
38
- }
39
- function filename_to_dts(id) {
40
- return id.replace(RE_VUE, ".vue.ts").replace(RE_TS, ".d.$1ts").replace(RE_JS, ".d.$1ts").replace(RE_JSON, ".json.d.ts");
41
- }
42
- function filename_dts_to(id, ext) {
43
- return id.replace(RE_DTS, `.$1${ext}`);
44
- }
45
- function resolveTemplateFn(fn, chunk) {
46
- return typeof fn === "function" ? fn(chunk) : fn;
47
- }
48
- function replaceTemplateName(template, name) {
49
- return template.replaceAll("[name]", name);
50
- }
51
- //#endregion
52
- //#region ../../node_modules/.pnpm/resolve-pkg-maps@1.0.0/node_modules/resolve-pkg-maps/dist/index.mjs
53
- const A = (r) => r !== null && typeof r == "object", a = (r, t) => Object.assign(/* @__PURE__ */ new Error(`[${r}]: ${t}`), { code: r }), _$1 = "ERR_INVALID_PACKAGE_CONFIG", E = "ERR_INVALID_PACKAGE_TARGET", I$1 = "ERR_PACKAGE_PATH_NOT_EXPORTED", R$1 = /^\d+$/, O = /^(\.{1,2}|node_modules)$/i, w = /\/|\\/;
54
- var h = ((r) => (r.Export = "exports", r.Import = "imports", r))(h || {});
55
- const f = (r, t, e, o, c) => {
56
- if (t == null) return [];
57
- if (typeof t == "string") {
58
- const [n, ...i] = t.split(w);
59
- if (n === ".." || i.some((l) => O.test(l))) throw a(E, `Invalid "${r}" target "${t}" defined in the package config`);
60
- return [c ? t.replace(/\*/g, c) : t];
61
- }
62
- if (Array.isArray(t)) return t.flatMap((n) => f(r, n, e, o, c));
63
- if (A(t)) {
64
- for (const n of Object.keys(t)) {
65
- if (R$1.test(n)) throw a(_$1, "Cannot contain numeric property keys");
66
- if (n === "default" || o.includes(n)) return f(r, t[n], e, o, c);
67
- }
68
- return [];
69
- }
70
- throw a(E, `Invalid "${r}" target "${t}"`);
71
- }, s = "*", m = (r, t) => {
72
- const e = r.indexOf(s), o = t.indexOf(s);
73
- return e === o ? t.length > r.length : o > e;
74
- };
75
- function d(r, t) {
76
- if (!t.includes(s) && r.hasOwnProperty(t)) return [t];
77
- let e, o;
78
- for (const c of Object.keys(r)) if (c.includes(s)) {
79
- const [n, i, l] = c.split(s);
80
- if (l === void 0 && t.startsWith(n) && t.endsWith(i)) {
81
- const g = t.slice(n.length, -i.length || void 0);
82
- g && (!e || m(e, c)) && (e = c, o = g);
83
- }
84
- }
85
- return [e, o];
86
- }
87
- const p = (r) => Object.keys(r).reduce((t, e) => {
88
- const o = e === "" || e[0] !== ".";
89
- if (t === void 0 || t === o) return o;
90
- throw a(_$1, "\"exports\" cannot contain some keys starting with \".\" and some not");
91
- }, void 0), u = /^\w+:/, v = (r, t, e) => {
92
- if (!r) throw new Error("\"exports\" is required");
93
- t = t === "" ? "." : `./${t}`, (typeof r == "string" || Array.isArray(r) || A(r) && p(r)) && (r = { ".": r });
94
- const [o, c] = d(r, t), n = f(h.Export, r[o], t, e, c);
95
- if (n.length === 0) throw a(I$1, t === "." ? "No \"exports\" main defined" : `Package subpath '${t}' is not defined by "exports"`);
96
- for (const i of n) if (!i.startsWith("./") && !u.test(i)) throw a(E, `Invalid "exports" target "${i}" defined in the package config`);
97
- return n;
98
- };
99
- //#endregion
100
- //#region ../../node_modules/.pnpm/get-tsconfig@5.0.0-beta.5/node_modules/get-tsconfig/dist/index.mjs
101
- var Le = Object.defineProperty;
102
- var i = (e, n) => Le(e, "name", {
103
- value: n,
104
- configurable: !0
105
- });
106
- function x(e) {
107
- return e.startsWith("\\\\?\\") ? e : e.replace(/\\/g, "/");
108
- }
109
- i(x, "slash");
110
- const _e = i((e, n) => {
111
- const s = `readFileSync:${n}`;
112
- let t = e?.get(s);
113
- return t === void 0 && (t = re.readFileSync(n, "utf8"), e?.set(s, t)), t;
114
- }, "readFile"), F = i((e, n) => {
115
- const s = `tryStat:${n}`;
116
- let t = e?.get(s);
117
- if (t === void 0) {
118
- try {
119
- t = re.statSync(n);
120
- } catch {
121
- t = null;
122
- }
123
- e?.set(s, t);
124
- }
125
- return t ?? void 0;
126
- }, "tryStat"), R = i((e, n, s) => {
127
- for (;;) {
128
- const t = path.posix.join(e, n);
129
- if (F(s, t)) return t;
130
- const o = path.dirname(e);
131
- if (o === e) return;
132
- e = o;
133
- }
134
- }, "findUp");
135
- function Ne(e, n = !1) {
136
- const s = e.length;
137
- let t = 0, o = "", r = 0, l = 16, g = 0, m = 0, k = 0, w = 0, u = 0;
138
- function A(f, y) {
139
- let j = 0, v = 0;
140
- for (; j < f;) {
141
- let d = e.charCodeAt(t);
142
- if (d >= 48 && d <= 57) v = v * 16 + d - 48;
143
- else if (d >= 65 && d <= 70) v = v * 16 + d - 65 + 10;
144
- else if (d >= 97 && d <= 102) v = v * 16 + d - 97 + 10;
145
- else break;
146
- t++, j++;
147
- }
148
- return j < f && (v = -1), v;
149
- }
150
- i(A, "scanHexDigits");
151
- function O(f) {
152
- t = f, o = "", r = 0, l = 16, u = 0;
153
- }
154
- i(O, "setPosition");
155
- function h() {
156
- let f = t;
157
- if (e.charCodeAt(t) === 48) t++;
158
- else for (t++; t < e.length && S(e.charCodeAt(t));) t++;
159
- 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++;
160
- else return u = 3, e.substring(f, t);
161
- let y = t;
162
- 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))) {
163
- for (t++; t < e.length && S(e.charCodeAt(t));) t++;
164
- y = t;
165
- } else u = 3;
166
- return e.substring(f, y);
167
- }
168
- i(h, "scanNumber");
169
- function D() {
170
- let f = "", y = t;
171
- for (;;) {
172
- if (t >= s) {
173
- f += e.substring(y, t), u = 2;
174
- break;
175
- }
176
- const j = e.charCodeAt(t);
177
- if (j === 34) {
178
- f += e.substring(y, t), t++;
179
- break;
180
- }
181
- if (j === 92) {
182
- if (f += e.substring(y, t), t++, t >= s) {
183
- u = 2;
184
- break;
185
- }
186
- switch (e.charCodeAt(t++)) {
187
- case 34:
188
- f += "\"";
189
- break;
190
- case 92:
191
- f += "\\";
192
- break;
193
- case 47:
194
- f += "/";
195
- break;
196
- case 98:
197
- f += "\b";
198
- break;
199
- case 102:
200
- f += "\f";
201
- break;
202
- case 110:
203
- f += `
204
- `;
205
- break;
206
- case 114:
207
- f += "\r";
208
- break;
209
- case 116:
210
- f += " ";
211
- break;
212
- case 117:
213
- const d = A(4);
214
- d >= 0 ? f += String.fromCharCode(d) : u = 4;
215
- break;
216
- default: u = 5;
217
- }
218
- y = t;
219
- continue;
220
- }
221
- if (j >= 0 && j <= 31) if (P(j)) {
222
- f += e.substring(y, t), u = 2;
223
- break;
224
- } else u = 6;
225
- t++;
226
- }
227
- return f;
228
- }
229
- i(D, "scanString");
230
- function c() {
231
- if (o = "", u = 0, r = t, m = g, w = k, t >= s) return r = s, l = 17;
232
- let f = e.charCodeAt(t);
233
- if (X(f)) {
234
- do
235
- t++, o += String.fromCharCode(f), f = e.charCodeAt(t);
236
- while (X(f));
237
- return l = 15;
238
- }
239
- if (P(f)) return t++, o += String.fromCharCode(f), f === 13 && e.charCodeAt(t) === 10 && (t++, o += `
240
- `), g++, k = t, l = 14;
241
- switch (f) {
242
- case 123: return t++, l = 1;
243
- case 125: return t++, l = 2;
244
- case 91: return t++, l = 3;
245
- case 93: return t++, l = 4;
246
- case 58: return t++, l = 6;
247
- case 44: return t++, l = 5;
248
- case 34: return t++, o = D(), l = 10;
249
- case 47:
250
- const y = t - 1;
251
- if (e.charCodeAt(t + 1) === 47) {
252
- for (t += 2; t < s && !P(e.charCodeAt(t));) t++;
253
- return o = e.substring(y, t), l = 12;
254
- }
255
- if (e.charCodeAt(t + 1) === 42) {
256
- t += 2;
257
- const j = s - 1;
258
- let v = !1;
259
- for (; t < j;) {
260
- const d = e.charCodeAt(t);
261
- if (d === 42 && e.charCodeAt(t + 1) === 47) {
262
- t += 2, v = !0;
263
- break;
264
- }
265
- t++, P(d) && (d === 13 && e.charCodeAt(t) === 10 && t++, g++, k = t);
266
- }
267
- return v || (t++, u = 1), o = e.substring(y, t), l = 13;
268
- }
269
- return o += String.fromCharCode(f), t++, l = 16;
270
- case 45: if (o += String.fromCharCode(f), t++, t === s || !S(e.charCodeAt(t))) return l = 16;
271
- case 48:
272
- case 49:
273
- case 50:
274
- case 51:
275
- case 52:
276
- case 53:
277
- case 54:
278
- case 55:
279
- case 56:
280
- case 57: return o += h(), l = 11;
281
- default:
282
- for (; t < s && p(f);) t++, f = e.charCodeAt(t);
283
- if (r !== t) {
284
- switch (o = e.substring(r, t), o) {
285
- case "true": return l = 8;
286
- case "false": return l = 9;
287
- case "null": return l = 7;
288
- }
289
- return l = 16;
290
- }
291
- return o += String.fromCharCode(f), t++, l = 16;
292
- }
293
- }
294
- i(c, "scanNext");
295
- function p(f) {
296
- if (X(f) || P(f)) return !1;
297
- switch (f) {
298
- case 125:
299
- case 93:
300
- case 123:
301
- case 91:
302
- case 34:
303
- case 58:
304
- case 44:
305
- case 47: return !1;
306
- }
307
- return !0;
308
- }
309
- i(p, "isUnknownContentCharacter");
310
- function b() {
311
- let f;
312
- do
313
- f = c();
314
- while (f >= 12 && f <= 15);
315
- return f;
316
- }
317
- return i(b, "scanNextNonTrivia"), {
318
- setPosition: O,
319
- getPosition: i(() => t, "getPosition"),
320
- scan: n ? b : c,
321
- getToken: i(() => l, "getToken"),
322
- getTokenValue: i(() => o, "getTokenValue"),
323
- getTokenOffset: i(() => r, "getTokenOffset"),
324
- getTokenLength: i(() => t - r, "getTokenLength"),
325
- getTokenStartLine: i(() => m, "getTokenStartLine"),
326
- getTokenStartCharacter: i(() => r - w, "getTokenStartCharacter"),
327
- getTokenError: i(() => u, "getTokenError")
328
- };
329
- }
330
- i(Ne, "createScanner");
331
- function X(e) {
332
- return e === 32 || e === 9;
333
- }
334
- i(X, "isWhiteSpace");
335
- function P(e) {
336
- return e === 10 || e === 13;
337
- }
338
- i(P, "isLineBreak");
339
- function S(e) {
340
- return e >= 48 && e <= 57;
341
- }
342
- i(S, "isDigit");
343
- var ce;
344
- (function(e) {
345
- 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";
346
- })(ce || (ce = {})), new Array(20).fill(0).map((e, n) => " ".repeat(n));
347
- const _ = 200;
348
- new Array(_).fill(0).map((e, n) => `
349
- ` + " ".repeat(n)), new Array(_).fill(0).map((e, n) => "\r" + " ".repeat(n)), new Array(_).fill(0).map((e, n) => `\r
350
- ` + " ".repeat(n)), new Array(_).fill(0).map((e, n) => `
351
- ` + " ".repeat(n)), new Array(_).fill(0).map((e, n) => "\r" + " ".repeat(n)), new Array(_).fill(0).map((e, n) => `\r
352
- ` + " ".repeat(n));
353
- var W;
354
- (function(e) {
355
- e.DEFAULT = { allowTrailingComma: !1 };
356
- })(W || (W = {}));
357
- function Re(e, n = [], s = W.DEFAULT) {
358
- let t = null, o = [];
359
- const r = [];
360
- function l(m) {
361
- Array.isArray(o) ? o.push(m) : t !== null && (o[t] = m);
362
- }
363
- return i(l, "onValue"), Pe(e, {
364
- onObjectBegin: i(() => {
365
- const m = {};
366
- l(m), r.push(o), o = m, t = null;
367
- }, "onObjectBegin"),
368
- onObjectProperty: i((m) => {
369
- t = m;
370
- }, "onObjectProperty"),
371
- onObjectEnd: i(() => {
372
- o = r.pop();
373
- }, "onObjectEnd"),
374
- onArrayBegin: i(() => {
375
- const m = [];
376
- l(m), r.push(o), o = m, t = null;
377
- }, "onArrayBegin"),
378
- onArrayEnd: i(() => {
379
- o = r.pop();
380
- }, "onArrayEnd"),
381
- onLiteralValue: l,
382
- onError: i((m, k, w) => {
383
- n.push({
384
- error: m,
385
- offset: k,
386
- length: w
387
- });
388
- }, "onError")
389
- }, s), o[0];
390
- }
391
- i(Re, "parse$1");
392
- function Pe(e, n, s = W.DEFAULT) {
393
- const t = Ne(e, !1), o = [];
394
- let r = 0;
395
- function l(T) {
396
- return T ? () => r === 0 && T(t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter()) : () => !0;
397
- }
398
- i(l, "toNoArgVisit");
399
- function g(T) {
400
- return T ? (E) => r === 0 && T(E, t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter()) : () => !0;
401
- }
402
- i(g, "toOneArgVisit");
403
- function m(T) {
404
- return T ? (E) => r === 0 && T(E, t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter(), () => o.slice()) : () => !0;
405
- }
406
- i(m, "toOneArgVisitWithPath");
407
- function k(T) {
408
- return T ? () => {
409
- r > 0 ? r++ : T(t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter(), () => o.slice()) === !1 && (r = 1);
410
- } : () => !0;
411
- }
412
- i(k, "toBeginVisit");
413
- function w(T) {
414
- return T ? () => {
415
- r > 0 && r--, r === 0 && T(t.getTokenOffset(), t.getTokenLength(), t.getTokenStartLine(), t.getTokenStartCharacter());
416
- } : () => !0;
417
- }
418
- i(w, "toEndVisit");
419
- 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;
420
- function v() {
421
- for (;;) {
422
- const T = t.scan();
423
- switch (t.getTokenError()) {
424
- case 4:
425
- d(14);
426
- break;
427
- case 5:
428
- d(15);
429
- break;
430
- case 3:
431
- d(13);
432
- break;
433
- case 1:
434
- y || d(11);
435
- break;
436
- case 2:
437
- d(12);
438
- break;
439
- case 6:
440
- d(16);
441
- break;
442
- }
443
- switch (T) {
444
- case 12:
445
- case 13:
446
- y ? d(10) : b();
447
- break;
448
- case 16:
449
- d(1);
450
- break;
451
- case 15:
452
- case 14: break;
453
- default: return T;
454
- }
455
- }
456
- }
457
- i(v, "scanNext");
458
- function d(T, E = [], ie = []) {
459
- if (f(T), E.length + ie.length > 0) {
460
- let V = t.getToken();
461
- for (; V !== 17;) {
462
- if (E.indexOf(V) !== -1) {
463
- v();
464
- break;
465
- } else if (ie.indexOf(V) !== -1) break;
466
- V = v();
467
- }
468
- }
469
- }
470
- i(d, "handleError");
471
- function L(T) {
472
- const E = t.getTokenValue();
473
- return T ? c(E) : (A(E), o.push(E)), v(), !0;
474
- }
475
- i(L, "parseString");
476
- function B() {
477
- switch (t.getToken()) {
478
- case 11:
479
- const T = t.getTokenValue();
480
- let E = Number(T);
481
- isNaN(E) && (d(2), E = 0), c(E);
482
- break;
483
- case 7:
484
- c(null);
485
- break;
486
- case 8:
487
- c(!0);
488
- break;
489
- case 9:
490
- c(!1);
491
- break;
492
- default: return !1;
493
- }
494
- return v(), !0;
495
- }
496
- i(B, "parseLiteral");
497
- function $() {
498
- 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);
499
- }
500
- i($, "parseProperty");
501
- function N() {
502
- u(), v();
503
- let T = !1;
504
- for (; t.getToken() !== 2 && t.getToken() !== 17;) {
505
- if (t.getToken() === 5) {
506
- if (T || d(4, [], []), p(","), v(), t.getToken() === 2 && j) break;
507
- } else T && d(6, [], []);
508
- $() || d(4, [], [2, 5]), T = !0;
509
- }
510
- return O(), t.getToken() !== 2 ? d(7, [2], []) : v(), !0;
511
- }
512
- i(N, "parseObject");
513
- function $e() {
514
- h(), v();
515
- let T = !0, E = !1;
516
- for (; t.getToken() !== 4 && t.getToken() !== 17;) {
517
- if (t.getToken() === 5) {
518
- if (E || d(4, [], []), p(","), v(), t.getToken() === 4 && j) break;
519
- } else E && d(6, [], []);
520
- T ? (o.push(0), T = !1) : o[o.length - 1]++, H() || d(4, [], [4, 5]), E = !0;
521
- }
522
- return D(), T || o.pop(), t.getToken() !== 4 ? d(8, [4], []) : v(), !0;
523
- }
524
- i($e, "parseArray");
525
- function H() {
526
- switch (t.getToken()) {
527
- case 3: return $e();
528
- case 1: return N();
529
- case 10: return L(!0);
530
- default: return B();
531
- }
532
- }
533
- return i(H, "parseValue"), v(), t.getToken() === 17 ? s.allowEmptyContent ? !0 : (d(4, [], []), !1) : H() ? (t.getToken() !== 17 && d(9, [], []), !0) : (d(4, [], []), !1);
534
- }
535
- i(Pe, "visit");
536
- var fe;
537
- (function(e) {
538
- 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";
539
- })(fe || (fe = {}));
540
- var ue;
541
- (function(e) {
542
- 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";
543
- })(ue || (ue = {}));
544
- const Ve = Re;
545
- var ae;
546
- (function(e) {
547
- 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";
548
- })(ae || (ae = {}));
549
- const Y = i((e, n) => Ve(_e(n, e)), "readJsonc"), pe = i(() => {
550
- const { findPnpApi: e } = module$1;
551
- return e && e(process.cwd());
552
- }, "getPnpApi"), We = "detectTypeScriptVersion:", Me = i((e, n) => {
553
- const s = `${We}${e}`, t = n?.get(s);
554
- if (t !== void 0) return t ?? void 0;
555
- let o;
556
- const r = pe();
557
- if (r) try {
558
- o = r.resolveRequest("typescript/package.json", e) ?? void 0;
559
- } catch {}
560
- o ??= R(path.resolve(e), path.join("node_modules", "typescript", "package.json"), n);
561
- let l;
562
- if (o) try {
563
- const g = Y(o, n);
564
- typeof g?.version == "string" && (l = g.version);
565
- } catch {}
566
- return n?.set(s, l ?? null), l;
567
- }, "detectTypeScriptVersion"), I = "package.json", M = "tsconfig.json", Je = i((e, n, s) => {
568
- const t = module$1.createRequire(path.join(s, "tsconfig.json"));
569
- if (e !== n) try {
570
- return t.resolve(e);
571
- } catch {}
572
- try {
573
- return t.resolve(n);
574
- } catch {}
575
- try {
576
- return t.resolve(`${n}/${I}`);
577
- } catch {}
578
- }, "resolvePackageEntryWithNode"), Z = i((e, n, s, t) => {
579
- const o = `resolveFromPackageJsonPath:${e}:${n}:${s}`;
580
- if (t?.has(o)) return t.get(o) || !1;
581
- const r = Y(e, t);
582
- if (!r) return;
583
- let l = n || M;
584
- if (!s && r.exports) try {
585
- const [g] = v(r.exports, n, ["require", "types"]);
586
- l = g;
587
- } catch {
588
- return t?.set(o, ""), !1;
589
- }
590
- else !n && r.tsconfig && (l = r.tsconfig);
591
- return l = path.join(e, "..", l), t?.set(o, l), l;
592
- }, "resolveFromPackageJsonPath"), ze = i((e, n, s) => {
593
- const t = `resolveExtendsPath:${e}:${n}`;
594
- if (s?.has(t)) return s.get(t) || void 0;
595
- const o = Ge(e, n, s);
596
- return s?.set(t, o || ""), o;
597
- }, "resolveExtendsPath"), Ge = i((e, n, s) => {
598
- let t = e;
599
- if (e === ".." && (t = path.join(t, M)), e[0] === "." && (t = path.resolve(n, t)), path.isAbsolute(t)) {
600
- const c = F(s, t);
601
- if (c) {
602
- if (c.isFile()) return t;
603
- } else if (!t.endsWith(".json")) {
604
- const p = `${t}.json`;
605
- if (F(s, p)) return p;
606
- }
607
- return;
608
- }
609
- const [o, ...r] = e.split("/"), l = o[0] === "@" ? `${o}/${r.shift()}` : o, g = r.join("/"), m = pe();
610
- if (m) {
611
- const { resolveRequest: c } = m;
612
- try {
613
- if (l === e) {
614
- const p = c(path.join(l, I), n);
615
- if (p) {
616
- const b = Z(p, g, !1, s);
617
- if (b && F(s, b)) return b;
618
- }
619
- } else {
620
- let p;
621
- try {
622
- p = c(e, n, { extensions: [".json"] });
623
- } catch {
624
- p = c(path.join(e, M), n);
625
- }
626
- if (p) return p;
627
- }
628
- } catch {}
629
- }
630
- const k = Je(e, l, n);
631
- let w;
632
- if (k) {
633
- if (path.basename(k) !== I && k.endsWith(".json")) return k;
634
- w = path.basename(k) === I ? k : R(path.dirname(k), I, s);
635
- }
636
- const u = w && path.dirname(w) || R(path.resolve(n), path.join("node_modules", l), s);
637
- if (!u || !F(s, u)?.isDirectory()) return;
638
- const A = path.join(u, I);
639
- if (F(s, A)) {
640
- const c = Z(A, g, !1, s);
641
- if (c === !1) return;
642
- if (c && F(s, c)?.isFile()) return c;
643
- }
644
- const O = path.join(u, g), h = O.endsWith(".json");
645
- if (!h) {
646
- const c = `${O}.json`;
647
- if (F(s, c)) return c;
648
- }
649
- const D = F(s, O);
650
- if (D) {
651
- if (D.isDirectory()) {
652
- const c = path.join(O, I);
653
- if (F(s, c)) {
654
- const b = Z(c, "", !0, s);
655
- if (b && F(s, b)) return b;
656
- }
657
- const p = path.join(O, M);
658
- if (F(s, p)) return p;
659
- } else if (h) return O;
660
- }
661
- }, "resolveExtendsPathUncached"), q = Symbol("implicitBaseUrl"), U = "${configDir}", K = /^\.{1,2}(\/.*)?$/, J = i((e) => {
662
- const n = x(e);
663
- return K.test(n) ? n : `./${n}`;
664
- }, "normalizeRelativePath"), Qe = i((e) => {
665
- const n = { ...e };
666
- if (n.strict) for (const t of [
667
- "noImplicitAny",
668
- "noImplicitThis",
669
- "strictNullChecks",
670
- "strictFunctionTypes",
671
- "strictBindCallApply",
672
- "strictPropertyInitialization",
673
- "strictBuiltinIteratorReturn",
674
- "alwaysStrict",
675
- "useUnknownInCatchVariables"
676
- ]) n[t] === void 0 && (n[t] = !0);
677
- if (n.composite && (n.declaration ??= !0, n.incremental ??= !0), n.target) {
678
- let s = n.target.toLowerCase();
679
- s === "es2015" && (s = "es6"), n.target = s, s === "esnext" && (n.module ??= "es6", n.useDefineForClassFields ??= !0), (s === "es6" || s === "es2016" || s === "es2017" || s === "es2018" || s === "es2019" || s === "es2020" || s === "es2021" || s === "es2022" || s === "es2023" || s === "es2024" || s === "es2025") && (n.module ??= "es6"), (s === "es2022" || s === "es2023" || s === "es2024" || s === "es2025") && (n.useDefineForClassFields ??= !0);
680
- }
681
- if (n.module) {
682
- let s = n.module.toLowerCase();
683
- if (s === "es2015" && (s = "es6"), n.module = s, (s === "es6" || s === "es2020" || s === "es2022" || s === "esnext" || s === "none" || s === "system" || s === "umd" || s === "amd") && (n.moduleResolution ??= "classic"), s === "system" && (n.allowSyntheticDefaultImports ??= !0), (s === "node16" || s === "node18" || s === "node20" || s === "nodenext" || s === "preserve") && (n.esModuleInterop ??= !0, n.allowSyntheticDefaultImports ??= !0), (s === "node16" || s === "node18" || s === "node20" || s === "nodenext") && (n.moduleDetection ??= "force"), (s === "node16" || s === "node18") && (n.target ??= "es2022", n.moduleResolution ??= "node16"), s === "node20" && (n.target ??= "es2023", n.moduleResolution ??= "node16", n.resolveJsonModule ??= !0), s === "nodenext" && (n.target ??= "esnext", n.moduleResolution ??= "nodenext", n.resolveJsonModule ??= !0), s === "node16" || s === "node18" || s === "node20" || s === "nodenext") {
684
- const t = n.target;
685
- (t === "es3" || t === "es2022" || t === "es2023" || t === "es2024" || t === "esnext") && (n.useDefineForClassFields ??= !0);
686
- }
687
- s === "preserve" && (n.moduleResolution ??= "bundler");
688
- }
689
- if (n.moduleResolution) {
690
- let s = n.moduleResolution.toLowerCase();
691
- s === "node" && (s = "node10"), n.moduleResolution = s, (s === "node16" || s === "nodenext" || s === "bundler") && (n.resolvePackageJsonExports ??= !0, n.resolvePackageJsonImports ??= !0), s === "bundler" && (n.allowSyntheticDefaultImports ??= !0, n.resolveJsonModule ??= !0);
692
- }
693
- for (const s of [
694
- "jsx",
695
- "moduleDetection",
696
- "importsNotUsedAsValues",
697
- "newLine"
698
- ]) n[s] && (n[s] = n[s].toLowerCase());
699
- 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;
700
- }, "normalizeCompilerOptions"), He = i((e, n) => {
701
- !n.has("target") && !Xe(e.module) && (e.target = "es3");
702
- }, "applyV4Defaults"), Xe = i((e) => e === "node16" || e === "node18" || e === "node20" || e === "nodenext", "moduleDictatesTarget$1"), Ye = i((e, n) => {
703
- !n.has("target") && !Ze(e.module) && (e.target = "es5");
704
- }, "applyV5Defaults"), Ze = i((e) => e === "node16" || e === "node18" || e === "node20" || e === "nodenext", "moduleDictatesTarget"), qe = i((e, n) => {
705
- 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);
706
- }, "applyV6Defaults"), Ke = [
707
- [4, He],
708
- [5, Ye],
709
- [6, qe]
710
- ], Ce = i((e) => {
711
- const n = /^v?(\d+)/.exec(e);
712
- return n ? Number(n[1]) : void 0;
713
- }, "parseMajor"), et = i((e, n) => {
714
- const s = Ce(n);
715
- if (s === void 0) return;
716
- const t = new Set(Object.keys(e));
717
- for (const [o, r] of Ke) o <= s && r(e, t);
718
- }, "applyVersionDefaults"), C = i((e, n) => J(path.relative(e, n)), "pathRelative"), me = [
719
- "files",
720
- "include",
721
- "exclude"
722
- ], ge = i((e, n, s) => {
723
- const t = path.join(n, s);
724
- return x(path.relative(e, t)) || "./";
725
- }, "resolveAndRelativize"), tt = i((e, n, s) => {
726
- const t = path.relative(e, n);
727
- if (!t) return s;
728
- return x(`${t}/${s.startsWith("./") ? s.slice(2) : s}`);
729
- }, "prefixPattern"), de = ["outDir", "declarationDir"], z = i((e, n) => {
730
- if (e.startsWith(U)) return x(path.join(n, e.slice(12)));
731
- }, "interpolateConfigDir"), nt = [
732
- "outDir",
733
- "declarationDir",
734
- "outFile",
735
- "rootDir",
736
- "baseUrl",
737
- "tsBuildInfoFile"
738
- ], ke = i((e, n = {}) => {
739
- if (e.length === 0) throw new Error("Chain must not be empty");
740
- const { typescriptVersion: s } = n, t = new Map(e.map((u) => [u.path, u])), o = /* @__PURE__ */ new Map(), r = i((u) => {
741
- const A = o.get(u);
742
- if (A) return A;
743
- const O = t.get(u);
744
- if (!O) throw new Error(`Config not found in chain: ${u}`);
745
- const h = O.config, D = path.dirname(u);
746
- let c = {
747
- ...h,
748
- ...h.compilerOptions && { compilerOptions: { ...h.compilerOptions } },
749
- ...h.watchOptions && { watchOptions: { ...h.watchOptions } }
750
- };
751
- if (delete c.extends, c.compilerOptions?.paths && !c.compilerOptions.baseUrl && (c.compilerOptions[q] = D), h.extends) {
752
- const p = Array.isArray(h.extends) ? h.extends : [h.extends];
753
- for (const b of p.toReversed()) {
754
- const f = r(b), y = path.dirname(b), { references: j, ...v } = f;
755
- if (v.compilerOptions) {
756
- const L = { ...v.compilerOptions };
757
- for (const B of [
758
- "baseUrl",
759
- "outDir",
760
- "declarationDir",
761
- "rootDir"
762
- ]) {
763
- const $ = L[B];
764
- $ && !$.startsWith(U) && (L[B] = ge(D, y, $));
765
- }
766
- for (const B of ["rootDirs", "typeRoots"]) {
767
- const $ = L[B];
768
- $ && (L[B] = $.map((N) => N.startsWith(U) ? N : ge(D, y, N)));
769
- }
770
- v.compilerOptions = L;
771
- }
772
- for (const L of me) {
773
- const B = v[L];
774
- B && (v[L] = B.map(($) => $.startsWith(U) ? $ : tt(D, y, $)));
775
- }
776
- const d = {
777
- ...v,
778
- ...c,
779
- compilerOptions: {
780
- ...v.compilerOptions,
781
- ...c.compilerOptions
782
- }
783
- };
784
- v.watchOptions && (d.watchOptions = {
785
- ...v.watchOptions,
786
- ...c.watchOptions
787
- }), c = d;
788
- }
789
- }
790
- if (c.compilerOptions) {
791
- const { compilerOptions: p } = c;
792
- for (const f of ["baseUrl", "rootDir"]) {
793
- const y = p[f];
794
- if (y && !y.startsWith(U)) {
795
- const j = path.resolve(D, y);
796
- p[f] = C(D, j);
797
- }
798
- }
799
- for (const f of de) {
800
- let y = p[f];
801
- y && (Array.isArray(c.exclude) || (c.exclude = de.map((j) => p[j]).filter(Boolean)), y.startsWith(U) || (y = J(y)), p[f] = y);
802
- }
803
- } else c.compilerOptions = {};
804
- 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) {
805
- const { watchOptions: p } = c;
806
- for (const b of ["excludeDirectories", "excludeFiles"]) p[b] && (p[b] = p[b].map((f) => x(path.resolve(D, f))));
807
- for (const b of [
808
- "watchFile",
809
- "watchDirectory",
810
- "fallbackPolling"
811
- ]) if (p[b]) {
812
- const f = p;
813
- f[b] = p[b].toLowerCase();
814
- }
815
- }
816
- return o.set(u, c), c;
817
- }, "resolveEntry"), l = e[0], g = r(l.path), m = path.dirname(l.path), k = {
818
- ...g,
819
- compilerOptions: g.compilerOptions ? { ...g.compilerOptions } : {}
820
- }, { compilerOptions: w } = k;
821
- if (w) {
822
- for (const u of nt) {
823
- const A = w[u];
824
- if (A) {
825
- const O = z(A, m);
826
- w[u] = O ? C(m, O) : A;
827
- }
828
- }
829
- for (const u of ["rootDirs", "typeRoots"]) {
830
- const A = w[u];
831
- A && (w[u] = A.map((O) => {
832
- const h = z(O, m);
833
- return h ? C(m, h) : J(O);
834
- }));
835
- }
836
- if (w.paths) {
837
- const u = {};
838
- for (const [A, O] of Object.entries(w.paths)) u[A] = O.map((h) => z(h, m) ?? h);
839
- w.paths = u;
840
- }
841
- s && et(w, s), k.compilerOptions = Qe(w);
842
- }
843
- for (const u of me) {
844
- const A = k[u];
845
- A && (k[u] = A.map((O) => z(O, m) ?? O));
846
- }
847
- return {
848
- path: l.path,
849
- config: k,
850
- sources: e.map((u) => u.path)
851
- };
852
- }, "resolveExtendsChain"), we = i((e, n = {}) => {
853
- const { cache: s = /* @__PURE__ */ new Map() } = n, t = path.resolve(e), o = [], r = /* @__PURE__ */ new Set(), l = i((g, m) => {
854
- const k = x(g);
855
- if (r.has(k)) return;
856
- r.add(k);
857
- let w;
858
- try {
859
- w = Y(g, s) || {};
860
- } catch {
861
- throw new Error(`Cannot resolve tsconfig at path: ${g}`);
862
- }
863
- if (typeof w != "object") throw new SyntaxError(`Failed to parse tsconfig at: ${g}`);
864
- const u = path.dirname(g);
865
- if (w.extends) {
866
- const A = Array.isArray(w.extends), h = (A ? w.extends : [w.extends]).map((c) => {
867
- const p = ze(c, u, s);
868
- if (!p) throw new Error(`File '${c}' not found.`);
869
- const b = x(p);
870
- if (m.has(b) || b === k) throw new Error(`Circularity detected while resolving configuration: ${b}`);
871
- return b;
872
- });
873
- w.extends = A ? h : h[0], o.push({
874
- path: k,
875
- config: w
876
- });
877
- const D = new Set(m);
878
- D.add(k);
879
- for (const c of [...h].reverse()) l(c, D);
880
- } else o.push({
881
- path: k,
882
- config: w
883
- });
884
- }, "collect");
885
- return l(t, /* @__PURE__ */ new Set()), o;
886
- }, "getExtendsChain"), ee = i((e, n = {}) => {
887
- const { cache: s = /* @__PURE__ */ new Map(), typescriptVersion: t = "auto" } = n, o = we(e, { cache: s });
888
- let r;
889
- return t === "auto" ? r = Me(path.dirname(o[0].path), s) : t !== !1 && (r = t), ke(o, { typescriptVersion: r });
890
- }, "readTsconfig");
891
- var st = Object.defineProperty, G = i((e, n) => st(e, "name", {
892
- value: n,
893
- configurable: !0
894
- }), "s");
895
- const ve = G((e) => {
896
- let n = "";
897
- for (let s = 0; s < e.length; s += 1) {
898
- const t = e[s], o = t.toUpperCase();
899
- n += t === o ? t.toLowerCase() : o;
900
- }
901
- return n;
902
- }, "invertCase"), te = /* @__PURE__ */ new Map(), be = G((e, n) => {
903
- const s = Se.join(e, `.is-fs-case-sensitive-test-${process.pid}`);
904
- try {
905
- return n.writeFileSync(s, ""), !n.existsSync(ve(s));
906
- } finally {
907
- try {
908
- n.unlinkSync(s);
909
- } catch {}
910
- }
911
- }, "checkDirectoryCaseWithWrite"), ot = G((e, n, s) => {
912
- try {
913
- return be(e, s);
914
- } catch (t) {
915
- if (n === void 0) return be(Ie.tmpdir(), s);
916
- throw t;
917
- }
918
- }, "checkDirectoryCaseWithFallback"), it = G((e, n = Ue, s = !0) => {
919
- const t = e ?? process.cwd();
920
- if (s && te.has(t)) return te.get(t);
921
- let o;
922
- const r = ve(t);
923
- return r !== t && n.existsSync(t) ? o = !n.existsSync(r) : o = ot(t, e, n), s && te.set(t, o), o;
924
- }, "isFsCaseSensitive"), { join: ye } = path.posix, ne = {
925
- ts: [
926
- ".ts",
927
- ".tsx",
928
- ".d.ts"
929
- ],
930
- cts: [".cts", ".d.cts"],
931
- mts: [".mts", ".d.mts"]
932
- }, rt = i((e) => {
933
- const n = [...ne.ts], s = [...ne.cts], t = [...ne.mts];
934
- return e?.allowJs && (n.push(".js", ".jsx"), s.push(".cjs"), t.push(".mjs")), [
935
- ...n,
936
- ...s,
937
- ...t
938
- ];
939
- }, "getSupportedExtensions"), lt = i((e) => {
940
- const n = [];
941
- if (!e) return n;
942
- const { outDir: s, declarationDir: t } = e;
943
- return s && n.push(s), t && n.push(t), n;
944
- }, "getDefaultExcludeSpec"), Te = i((e) => e.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`), "escapeForRegexp"), se = `(?!(${[
945
- "node_modules",
946
- "bower_components",
947
- "jspm_packages"
948
- ].join("|")})(/|$))`, ft = /(?:^|\/)[^.*?]+$/, he = "**/*", Q = "[^/]", oe = "[^./]", Oe = process.platform === "win32", ut = i(({ config: e, path: n }, s) => {
949
- if ("extends" in e) throw new Error("tsconfig#extends must be resolved. Use getTsconfig or readTsconfig to resolve it.");
950
- if (!path.isAbsolute(n)) throw new Error("The tsconfig path must be absolute");
951
- Oe && (n = x(n));
952
- 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) => {
953
- const p = m(c), b = Te(p).replaceAll(String.raw`\*\*/`, "(.+/)?").replaceAll(String.raw`\*`, `${Q}*`).replaceAll(String.raw`\?`, Q);
954
- return new RegExp(`^${b}($|/)`, u);
955
- }), h = o || r ? r : [he];
956
- return {
957
- filesSet: k,
958
- extensions: w,
959
- excludePatterns: O,
960
- includePatterns: h ? h.map((c) => {
961
- let p = m(c);
962
- ft.test(p) && (p = ye(p, he));
963
- const b = Te(p).replaceAll(String.raw`/\*\*`, `(/${se}${oe}${Q}*)*?`).replaceAll(/(\/)?\\\*/g, (f, y) => {
964
- const j = String.raw`(${oe}|(\.(?!min\.js$))?)*`;
965
- return y ? `/${se}${oe}${j}` : j;
966
- }).replaceAll(/(\/)?\\\?/g, (f, y) => {
967
- const j = Q;
968
- return y ? `/${se}${j}` : j;
969
- });
970
- return new RegExp(`^${b}$`, u);
971
- }) : void 0
972
- };
973
- }, "compilePatterns"), Ae = /* @__PURE__ */ new WeakMap(), je = i((e, n) => {
974
- if (!path.isAbsolute(n)) return !1;
975
- Oe && (n = x(n));
976
- let s = Ae.get(e);
977
- s || (s = ut(e, it()), Ae.set(e, s));
978
- const { filesSet: t, extensions: o, excludePatterns: r, includePatterns: l } = s;
979
- 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)));
980
- }, "isFileIncluded"), De = i((e, n, s, t) => {
981
- const o = path.resolve(e);
982
- let r = x(e);
983
- for (;;) {
984
- const l = R(r, n, s);
985
- if (!l) return;
986
- const g = path.resolve(l), m = ee(g, {
987
- cache: s,
988
- typescriptVersion: t
989
- });
990
- if (je(m, o)) return m;
991
- const k = path.dirname(l), w = path.dirname(k);
992
- if (w === k) return;
993
- r = w;
994
- }
995
- }, "findConfigApplicable"), Ee = i((e = process.cwd(), n = {}) => {
996
- const { configName: s = "tsconfig.json", cache: t = /* @__PURE__ */ new Map(), includes: o = !1 } = n;
997
- if (!o) {
998
- const r = path.resolve(e);
999
- return path.basename(r) === s && F(t, r)?.isFile() ? x(r) : R(x(e), s, t);
1000
- }
1001
- return De(e, s, t, !1)?.path;
1002
- }, "findTsconfig"), at = i((e = process.cwd(), n = {}) => {
1003
- const { configName: s = "tsconfig.json", cache: t = /* @__PURE__ */ new Map(), includes: o = !1, typescriptVersion: r = "auto" } = n;
1004
- if (!o) {
1005
- const l = Ee(e, {
1006
- configName: s,
1007
- cache: t
1008
- });
1009
- return l ? ee(l, {
1010
- cache: t,
1011
- typescriptVersion: r
1012
- }) : void 0;
1013
- }
1014
- return De(e, s, t, r);
1015
- }, "getTsconfig"), pt = /\*/g, xe = i((e, n) => {
1016
- const s = e.match(pt);
1017
- if (s && s.length > 1) throw new Error(n);
1018
- }, "assertStarCount"), mt = i((e) => {
1019
- if (e.includes("*")) {
1020
- const [n, s] = e.split("*");
1021
- return {
1022
- prefix: n,
1023
- suffix: s
1024
- };
1025
- }
1026
- return e;
1027
- }, "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.`), {
1028
- pattern: mt(t),
1029
- substitutions: o.map((r) => {
1030
- 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 './'?");
1031
- return path.resolve(s, r);
1032
- })
1033
- })), "parsePaths"), kt = i((e) => {
1034
- const { compilerOptions: n } = e.config;
1035
- if (!n) return null;
1036
- const { baseUrl: s, paths: t } = n;
1037
- if (!s && !t) return null;
1038
- 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 = [];
1039
- for (const k of l) typeof k.pattern == "string" ? g.set(k.pattern, k.substitutions) : m.push(k);
1040
- return {
1041
- exactEntries: g,
1042
- patternEntries: m,
1043
- resolvedBaseUrl: r,
1044
- baseUrl: s
1045
- };
1046
- }, "compilePaths"), Fe = /* @__PURE__ */ new WeakMap();
1047
- i((e, n) => {
1048
- let s = Fe.get(e);
1049
- if (s === void 0 && (s = kt(e), Fe.set(e, s)), !s) return [];
1050
- if (K.test(n)) return [];
1051
- const { exactEntries: t, patternEntries: o, resolvedBaseUrl: r, baseUrl: l } = s, g = t.get(n);
1052
- if (g) return g.map(x);
1053
- let m, k = -1;
1054
- for (const u of o) gt(u.pattern, n) && u.pattern.prefix.length > k && (k = u.pattern.prefix.length, m = u);
1055
- if (!m) return l ? [x(path.join(r, n))] : [];
1056
- const w = n.slice(m.pattern.prefix.length, n.length - m.pattern.suffix.length);
1057
- return m.substitutions.map((u) => x(u.replace("*", w)));
1058
- }, "resolvePathAlias");
1059
- //#endregion
1060
- //#region ../../node_modules/.pnpm/tsdown@0.22.3_@arethetypeswrong+core@0.18.2_@tsdown+css@0.22.3_@tsdown+exe@0.22.3_@type_b3805a6765df28d505319221a7193e18/node_modules/tsdown/dist/format-DMceewlS.mjs
26
+ //#region ../../node_modules/.pnpm/tsdown@0.22.13_@arethetypeswrong+core@0.18.2_@tsdown+css@0.22.13_@tsdown+exe@0.22.13_@t_f26a610f558bef85f3db2230cc877c56/node_modules/tsdown/dist/deps-BM9kaLOG.mjs
1061
27
  const shimFile = path.resolve(import.meta.dirname, "..", "esm-shims.js");
28
+ const shimsInject = {
29
+ __dirname: [shimFile, "__dirname"],
30
+ __filename: [shimFile, "__filename"]
31
+ };
1062
32
  const shimsDefine = {
1063
33
  __dirname: "__TSDOWN_SHIM_DIRNAME__",
1064
34
  __filename: "__TSDOWN_SHIM_FILENAME__"
@@ -1073,15 +43,22 @@ const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPat
1073
43
  const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
1074
44
  `
1075
45
  };
1076
- function getShimsInject(format, platform) {
1077
- if (format === "es" && platform === "node") return {
1078
- __dirname: [shimFile, "__dirname"],
1079
- __filename: [shimFile, "__filename"]
46
+ function getShims(config) {
47
+ if (config.format !== "es" || config.platform !== "node") return {};
48
+ if (config.unbundle) return {
49
+ define: shimsDefine,
50
+ plugin: shimsPlugin
1080
51
  };
52
+ return { inject: shimsInject };
1081
53
  }
1082
54
  const debug$7 = createDebug("tsdown:deps");
55
+ /**
56
+ * Matches specifiers that follow npm package naming conventions,
57
+ * e.g. `pkg`, `pkg/subpath`, `@scope/pkg/subpath`.
58
+ */
59
+ const RE_PACKAGE_SPECIFIER = /^(?:@[a-z0-9-][a-z0-9-._]*\/)?[a-z0-9-][a-z0-9-._]*(?:\/|$)/;
1083
60
  function resolveDepsConfig(config, logger) {
1084
- let { neverBundle, alwaysBundle, onlyBundle, skipNodeModulesBundle = false } = config.deps || {};
61
+ let { neverBundle, alwaysBundle, onlyBundle, onlyImport, skipNodeModulesBundle, resolveDepSubpath = true } = config.deps || {};
1085
62
  if (config.external != null) {
1086
63
  if (neverBundle != null) throw new TypeError("`external` is deprecated. Cannot be used with `deps.neverBundle`.");
1087
64
  logger?.warn("`external` is deprecated. Use `deps.neverBundle` instead.");
@@ -1092,27 +69,33 @@ function resolveDepsConfig(config, logger) {
1092
69
  logger?.warn("`noExternal` is deprecated. Use `deps.alwaysBundle` instead.");
1093
70
  alwaysBundle = config.noExternal;
1094
71
  }
1095
- if (config.deps?.onlyAllowBundle != null) {
1096
- if (onlyBundle != null) throw new TypeError("`deps.onlyAllowBundle` is deprecated. Cannot be used with `deps.onlyBundle`.");
1097
- logger?.warn("`deps.onlyAllowBundle` is deprecated. Use `deps.onlyBundle` instead.");
1098
- onlyBundle = config.deps.onlyAllowBundle;
1099
- }
1100
72
  if (config.inlineOnly != null) {
1101
73
  if (onlyBundle != null) throw new TypeError("`inlineOnly` is deprecated. Cannot be used with `deps.onlyBundle`.");
1102
74
  logger?.warn("`inlineOnly` is deprecated. Use `deps.onlyBundle` instead.");
1103
75
  onlyBundle = config.inlineOnly;
1104
76
  }
77
+ if (config.deps?.onlyAllowBundle != null) {
78
+ if (onlyBundle != null) throw new TypeError("`deps.onlyAllowBundle` is deprecated. Cannot be used with `deps.onlyBundle`.");
79
+ logger?.warn("`deps.onlyAllowBundle` is deprecated. Use `deps.onlyBundle` instead.");
80
+ onlyBundle = config.deps.onlyAllowBundle;
81
+ }
1105
82
  if (config.skipNodeModulesBundle != null) {
1106
83
  if (config.deps?.skipNodeModulesBundle != null) throw new TypeError("`skipNodeModulesBundle` is deprecated. Cannot be used with `deps.skipNodeModulesBundle`.");
1107
- logger?.warn("`skipNodeModulesBundle` is deprecated. Use `deps.skipNodeModulesBundle` instead.");
84
+ logger?.warn("`skipNodeModulesBundle` is deprecated. Use `deps.neverBundle: true` instead.");
1108
85
  skipNodeModulesBundle = config.skipNodeModulesBundle;
86
+ } else if (skipNodeModulesBundle != null) logger?.warn("`deps.skipNodeModulesBundle` is deprecated. Use `deps.neverBundle: true` instead.");
87
+ if (skipNodeModulesBundle) {
88
+ if (neverBundle === true) throw new TypeError("`deps.skipNodeModulesBundle` is deprecated. Cannot be used with `deps.neverBundle: true`.");
89
+ if (alwaysBundle != null) throw new TypeError("`deps.skipNodeModulesBundle` and `deps.alwaysBundle` are mutually exclusive options and cannot be used together.");
1109
90
  }
1110
- if (skipNodeModulesBundle && alwaysBundle != null) throw new TypeError("`deps.skipNodeModulesBundle` and `deps.alwaysBundle` are mutually exclusive options and cannot be used together.");
1111
91
  if (onlyBundle != null && onlyBundle !== false) onlyBundle = toArray(onlyBundle);
92
+ if (onlyImport != null) onlyImport = toArray(onlyImport);
1112
93
  return {
1113
94
  ...normalizeDepsOptions(alwaysBundle, neverBundle),
1114
95
  onlyBundle,
96
+ onlyImport,
1115
97
  skipNodeModulesBundle,
98
+ resolveDepSubpath,
1116
99
  dts: normalizeDepsOptions(config.deps?.dts?.alwaysBundle, config.deps?.dts?.neverBundle)
1117
100
  };
1118
101
  }
@@ -1126,7 +109,7 @@ function normalizeDepsOptions(alwaysBundle, neverBundle) {
1126
109
  neverBundle: resolveRegex(neverBundle)
1127
110
  };
1128
111
  }
1129
- function DepsPlugin({ pkg, deps: { alwaysBundle: jsAlwaysBundle, onlyBundle, skipNodeModulesBundle, dts }, logger, nameLabel }, tsdownBundle) {
112
+ function DepsPlugin({ pkg, deps: { neverBundle, alwaysBundle: jsAlwaysBundle, onlyBundle, onlyImport, skipNodeModulesBundle, resolveDepSubpath: shouldResolveDepSubpath, dts }, logger, nameLabel, platform }, tsdownBundle) {
1130
113
  const deps = pkg && Array.from(getProductionDeps(pkg));
1131
114
  return {
1132
115
  name: "tsdown:deps",
@@ -1134,11 +117,12 @@ function DepsPlugin({ pkg, deps: { alwaysBundle: jsAlwaysBundle, onlyBundle, ski
1134
117
  filter: [include(and(id(/^[^.]/), importerId(/./)))],
1135
118
  async handler(id, importer, extraOptions) {
1136
119
  if (extraOptions.isEntry) return;
1137
- const resolved = await this.resolve(id, importer, {
120
+ let resolveResult;
121
+ const resolve = () => resolveResult ??= this.resolve(id, importer, {
1138
122
  ...extraOptions,
1139
123
  skipSelf: true
1140
124
  });
1141
- let shouldExternal = await externalStrategy(id, importer, resolved);
125
+ let shouldExternal = await externalStrategy(id, importer, resolve);
1142
126
  if (Array.isArray(shouldExternal)) {
1143
127
  debug$7("custom resolved id for %o -> %o", id, shouldExternal[1]);
1144
128
  id = shouldExternal[1];
@@ -1151,6 +135,7 @@ function DepsPlugin({ pkg, deps: { alwaysBundle: jsAlwaysBundle, onlyBundle, ski
1151
135
  external: shouldExternal,
1152
136
  moduleSideEffects
1153
137
  };
138
+ const resolved = await resolve();
1154
139
  if (resolved) return {
1155
140
  ...resolved,
1156
141
  moduleSideEffects
@@ -1162,8 +147,19 @@ function DepsPlugin({ pkg, deps: { alwaysBundle: jsAlwaysBundle, onlyBundle, ski
1162
147
  async handler(options, bundle) {
1163
148
  const deps = /* @__PURE__ */ new Set();
1164
149
  const importers = /* @__PURE__ */ new Map();
150
+ const errors = [];
151
+ const moduleIds = [...this.getModuleIds()].filter((id) => platform !== "node" || !isBuiltin(id));
1165
152
  for (const chunk of Object.values(bundle)) {
1166
153
  if (chunk.type === "asset") continue;
154
+ if (onlyImport && chunk.code && moduleIds.some((id) => chunk.code.includes(id))) {
155
+ const { program } = await parse$1(chunk.fileName, chunk.code);
156
+ for (const source of collectImportSources(program)) {
157
+ if (source[0] === ".") continue;
158
+ if (platform === "node" && isBuiltin(source)) continue;
159
+ if (matchPattern(parsePackageSpecifier(source)[0], onlyImport)) continue;
160
+ errors.push(`${yellow(source)} is imported in ${blue(chunk.fileName)} but is not included in ${blue`deps.onlyImport`} option.\nTo fix this, either add it to ${blue`deps.onlyImport`} or bundle it manually by adding it to ${blue`deps.alwaysBundle`} option.`);
161
+ }
162
+ }
1167
163
  for (const id of chunk.moduleIds) {
1168
164
  if (id === shimFile) continue;
1169
165
  const parsed = await readBundledDepInfo(id);
@@ -1176,9 +172,9 @@ function DepsPlugin({ pkg, deps: { alwaysBundle: jsAlwaysBundle, onlyBundle, ski
1176
172
  }
1177
173
  }
1178
174
  debug$7("found deps in bundle: %o", deps);
175
+ if (onlyBundle) errors.push(...Array.from(deps).filter((dep) => !matchPattern(dep, onlyBundle)).map((dep) => `${yellow(dep)} is located in ${blue`node_modules`} but is not included in ${blue`deps.onlyBundle`} option.\nTo fix this, either add it to ${blue`deps.onlyBundle`}, declare it as a production or peer dependency in your package.json, or externalize it manually.\nImported by\n${[...importers.get(dep) || []].map((s) => `- ${underline(s)}`).join("\n")}`));
176
+ if (errors.length) this.error(errors.join("\n\n"));
1179
177
  if (onlyBundle) {
1180
- const errors = 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")}`);
1181
- if (errors.length) this.error(errors.join("\n\n"));
1182
178
  const unusedPatterns = onlyBundle.filter((pattern) => !Array.from(deps).some((dep) => matchPattern(dep, [pattern])));
1183
179
  if (unusedPatterns.length) logger.info(nameLabel, `The following entries in ${blue`deps.onlyBundle`} are not used in the bundle:\n${unusedPatterns.map((pattern) => `- ${yellow(pattern)}`).join("\n")}\nConsider removing them to keep your configuration clean.`);
1184
180
  } else if (onlyBundle == null && deps.size) logger.info(nameLabel, `Hint: consider adding ${blue`deps.onlyBundle`} option to avoid unintended bundling of dependencies, or set ${blue`deps.onlyBundle: false`} to disable this hint.\nSee more at ${underline`https://tsdown.dev/options/dependencies#deps-onlybundle`}\nDetected dependencies in bundle:\n${Array.from(deps).map((dep) => `- ${blue(dep)}`).join("\n")}`);
@@ -1192,19 +188,29 @@ function DepsPlugin({ pkg, deps: { alwaysBundle: jsAlwaysBundle, onlyBundle, ski
1192
188
  * - `'absolute'`: external as absolute path
1193
189
  * - `'no-external'`: skip, but mark as non-external for inlineOnly check
1194
190
  */
1195
- async function externalStrategy(id, importer, resolved) {
191
+ async function externalStrategy(id, importer, resolve) {
1196
192
  if (id === shimFile) return false;
1197
- if (((importer ? RE_DTS.test(importer) : false) && dts?.alwaysBundle || jsAlwaysBundle)?.(id, importer)) return "no-external";
1198
- if (skipNodeModulesBundle && resolved && (resolved.external || RE_NODE_MODULES$1.test(resolved.id))) {
1199
- const resolvedDep = await resolveDepSubpath(id, resolved);
1200
- return resolvedDep ? [true, resolvedDep] : true;
193
+ const isDts = RE_DTS.test(importer);
194
+ if ((isDts && dts?.alwaysBundle || jsAlwaysBundle)?.(id, importer)) return "no-external";
195
+ if ((isDts && dts?.neverBundle != null ? dts.neverBundle : neverBundle) === true) {
196
+ if (id[0] === "\0" || id.startsWith("data:") || path.isAbsolute(id)) return false;
197
+ if (isBuiltin(id) || RE_PACKAGE_SPECIFIER.test(id)) return true;
198
+ const resolved = await resolve();
199
+ return !!resolved && (!!resolved.external || RE_NODE_MODULES$1.test(resolved.id));
200
+ }
201
+ if (skipNodeModulesBundle) {
202
+ const resolved = await resolve();
203
+ if (resolved && (resolved.external || RE_NODE_MODULES$1.test(resolved.id))) {
204
+ const resolvedDep = shouldResolveDepSubpath && await resolveDepSubpath(id, resolve);
205
+ return resolvedDep ? [true, resolvedDep] : true;
206
+ }
1201
207
  }
1202
208
  if (deps) {
1203
209
  if (deps.includes(id) || deps.some((dep) => id.startsWith(`${dep}/`))) {
1204
- const resolvedDep = await resolveDepSubpath(id, resolved);
210
+ const resolvedDep = shouldResolveDepSubpath && await resolveDepSubpath(id, resolve);
1205
211
  return resolvedDep ? [true, resolvedDep] : true;
1206
212
  }
1207
- if (importer && RE_DTS.test(importer) && !id.startsWith("@types/")) {
213
+ if (isDts && !id.startsWith("@types/")) {
1208
214
  const typesName = getTypesPackageName(id);
1209
215
  if (typesName && deps.includes(typesName)) return true;
1210
216
  }
@@ -1212,6 +218,32 @@ function DepsPlugin({ pkg, deps: { alwaysBundle: jsAlwaysBundle, onlyBundle, ski
1212
218
  return false;
1213
219
  }
1214
220
  }
221
+ function collectImportSources(program) {
222
+ const sources = [];
223
+ new Visitor({
224
+ ImportDeclaration(node) {
225
+ sources.push(node.source.value);
226
+ },
227
+ ExportAllDeclaration(node) {
228
+ sources.push(node.source.value);
229
+ },
230
+ ExportNamedDeclaration(node) {
231
+ if (node.source) sources.push(node.source.value);
232
+ },
233
+ ImportExpression(node) {
234
+ const source = getStaticString(node.source);
235
+ if (source) sources.push(source);
236
+ }
237
+ }).visit(program);
238
+ return sources;
239
+ }
240
+ function getStaticString(value) {
241
+ if (value.type === "Literal" && typeof value.value === "string") return value.value;
242
+ if (value.type !== "TemplateLiteral") return;
243
+ if (value.expressions.length || value.quasis.length !== 1) return;
244
+ const { cooked, raw } = value.quasis[0].value;
245
+ return cooked ?? raw;
246
+ }
1215
247
  function parsePackageSpecifier(id) {
1216
248
  const [first, second] = id.split("/", 3);
1217
249
  const name = first[0] === "@" && second ? `${first}/${second}` : first;
@@ -1247,11 +279,12 @@ function getTypesPackageName(id) {
1247
279
  if (!name) return;
1248
280
  return `@types/${name.replace(/^@/, "").replace("/", "__")}`;
1249
281
  }
1250
- async function resolveDepSubpath(id, resolved) {
1251
- if (!resolved?.packageJsonPath) return;
282
+ async function resolveDepSubpath(id, resolve) {
1252
283
  const parts = id.split("/");
1253
284
  if (parts[0][0] === "@") parts.shift();
1254
285
  if (parts.length === 1 || parts.at(-1).includes(".")) return;
286
+ const resolved = await resolve();
287
+ if (!resolved?.packageJsonPath) return;
1255
288
  let pkgJson;
1256
289
  try {
1257
290
  pkgJson = JSON.parse(await readFile(resolved.packageJsonPath, "utf8"));
@@ -1269,14 +302,10 @@ function getProductionDeps(pkg) {
1269
302
  return /* @__PURE__ */ new Set([
1270
303
  ...Object.keys(pkg.dependencies || {}),
1271
304
  ...Object.keys(pkg.peerDependencies || {}),
305
+ ...Object.keys(pkg.peerDependenciesMeta || {}),
1272
306
  ...Object.keys(pkg.optionalDependencies || {})
1273
307
  ]);
1274
308
  }
1275
- function formatBytes(bytes) {
1276
- if (bytes === Infinity) return void 0;
1277
- if (bytes > 1e6) return `${(bytes / 1e6).toFixed(2)} MB`;
1278
- return `${(bytes / 1e3).toFixed(2)} kB`;
1279
- }
1280
309
  //#endregion
1281
310
  //#region ../../node_modules/.pnpm/defu@6.1.7/node_modules/defu/dist/defu.mjs
1282
311
  function isPlainObject(value) {
@@ -1305,7 +334,7 @@ function createDefu(merger) {
1305
334
  return (...arguments_) => arguments_.reduce((p, c) => _defu(p, c, "", merger), {});
1306
335
  }
1307
336
  //#endregion
1308
- //#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.4/node_modules/fdir/dist/index.mjs
337
+ //#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.5/node_modules/fdir/dist/index.mjs
1309
338
  var __require$1 = /* @__PURE__ */ createRequire$1(import.meta.url);
1310
339
  function cleanPath(path) {
1311
340
  let normalized = normalize$1(path);
@@ -1813,7 +842,7 @@ var Builder = class {
1813
842
  }
1814
843
  };
1815
844
  //#endregion
1816
- //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js
845
+ //#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/constants.js
1817
846
  var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1818
847
  const WIN_SLASH = "\\\\/";
1819
848
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
@@ -1982,7 +1011,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1982
1011
  };
1983
1012
  }));
1984
1013
  //#endregion
1985
- //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js
1014
+ //#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/utils.js
1986
1015
  var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
1987
1016
  const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
1988
1017
  exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
@@ -2030,7 +1059,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
2030
1059
  };
2031
1060
  }));
2032
1061
  //#endregion
2033
- //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js
1062
+ //#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/scan.js
2034
1063
  var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2035
1064
  const utils = require_utils();
2036
1065
  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();
@@ -2317,7 +1346,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2317
1346
  module.exports = scan;
2318
1347
  }));
2319
1348
  //#endregion
2320
- //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js
1349
+ //#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/parse.js
2321
1350
  var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2322
1351
  const constants = require_constants();
2323
1352
  const utils = require_utils();
@@ -2472,7 +1501,10 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2472
1501
  }
2473
1502
  }
2474
1503
  };
2475
- const getStarExtglobSequenceOutput = (pattern) => {
1504
+ const buildCharClassStar = (chars) => {
1505
+ return `${chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`}*`;
1506
+ };
1507
+ const getStarExtglobSequenceChars = (pattern) => {
2476
1508
  let index = 0;
2477
1509
  const chars = [];
2478
1510
  while (index < pattern.length) {
@@ -2486,7 +1518,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2486
1518
  index += match.end + 1;
2487
1519
  }
2488
1520
  if (chars.length < 1) return;
2489
- return `${chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`}*`;
1521
+ return chars;
2490
1522
  };
2491
1523
  const repeatedExtglobRecursion = (pattern) => {
2492
1524
  let depth = 0;
@@ -2506,14 +1538,28 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2506
1538
  if (branches.length > 1) {
2507
1539
  if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) return { risky: true };
2508
1540
  }
1541
+ const safeChars = [];
1542
+ let sawStarSequence = false;
1543
+ let combinable = true;
2509
1544
  for (const branch of branches) {
2510
- const safeOutput = getStarExtglobSequenceOutput(branch);
2511
- if (safeOutput) return {
2512
- risky: true,
2513
- safeOutput
2514
- };
1545
+ const chars = getStarExtglobSequenceChars(branch);
1546
+ if (chars) {
1547
+ sawStarSequence = true;
1548
+ safeChars.push(...chars);
1549
+ continue;
1550
+ }
1551
+ const literal = normalizeSimpleBranch(branch);
1552
+ if (literal && literal.length === 1) {
1553
+ safeChars.push(literal);
1554
+ continue;
1555
+ }
1556
+ combinable = false;
2515
1557
  if (repeatedExtglobRecursion(branch) > max) return { risky: true };
2516
1558
  }
1559
+ if (sawStarSequence) return combinable ? {
1560
+ risky: true,
1561
+ safeOutput: buildCharClassStar([...new Set(safeChars)])
1562
+ } : { risky: true };
2517
1563
  return { risky: false };
2518
1564
  };
2519
1565
  /**
@@ -3374,7 +2420,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3374
2420
  module.exports = parse;
3375
2421
  }));
3376
2422
  //#endregion
3377
- //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js
2423
+ //#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/picomatch.js
3378
2424
  var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3379
2425
  const scan = require_scan();
3380
2426
  const parse = require_parse();
@@ -3395,6 +2441,18 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3395
2441
  * const isMatch = picomatch('*.!(*a)');
3396
2442
  * console.log(isMatch('a.a')); //=> false
3397
2443
  * console.log(isMatch('a.b')); //=> true
2444
+ *
2445
+ * // For environments without `node.js`, `picomatch/posix` provides you a dependency-free matcher, without automatic OS detection.
2446
+ * const picomatch = require('picomatch/posix');
2447
+ * // the same API, defaulting to posix paths
2448
+ * const isMatch = picomatch('a/*');
2449
+ * console.log(isMatch('a\\b')); //=> false
2450
+ * console.log(isMatch('a/b')); //=> true
2451
+ *
2452
+ * // you can still configure the matcher function to accept windows paths
2453
+ * const isMatch = picomatch('a/*', { options: windows });
2454
+ * console.log(isMatch('a\\b')); //=> true
2455
+ * console.log(isMatch('a/b')); //=> true
3398
2456
  * ```
3399
2457
  * @name picomatch
3400
2458
  * @param {String|Array} `globs` One or more glob patterns.
@@ -3513,8 +2571,8 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3513
2571
  * @return {Boolean}
3514
2572
  * @api public
3515
2573
  */
3516
- picomatch.matchBase = (input, glob, options) => {
3517
- return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(utils.basename(input));
2574
+ picomatch.matchBase = (input, glob, options, posix = options && options.windows) => {
2575
+ return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(utils.basename(input, { windows: posix }));
3518
2576
  };
3519
2577
  /**
3520
2578
  * Returns true if **any** of the given glob `patterns` match the specified `string`.
@@ -4334,12 +3392,8 @@ function createConfigCoreLoader(options) {
4334
3392
  findConfigs
4335
3393
  };
4336
3394
  }
4337
- //#endregion
4338
- //#region ../../node_modules/.pnpm/tsdown@0.22.3_@arethetypeswrong+core@0.18.2_@tsdown+css@0.22.3_@tsdown+exe@0.22.3_@type_b3805a6765df28d505319221a7193e18/node_modules/tsdown/dist/options-Ce3ueyZH.mjs
4339
- const __cjs_require$1 = createRequire(import.meta.url);
4340
- const picomatch = __cjs_require$1("./npm_entry_picomatch.cjs");
4341
- const satisfies$1 = __cjs_require$1("./npm_entry_semver_functions_satisfies.cjs");
4342
- const debug$4$2 = createDebug("tsdown:clean");
3395
+ const picomatch = createRequire(import.meta.url)("./npm_entry_picomatch.cjs");
3396
+ const debug$3$2 = createDebug("tsdown:clean");
4343
3397
  const RE_LAST_SLASH = /[/\\]$/;
4344
3398
  async function cleanOutDir(configs) {
4345
3399
  const removes = /* @__PURE__ */ new Set();
@@ -4362,10 +3416,10 @@ async function cleanOutDir(configs) {
4362
3416
  if (!removes.size) return;
4363
3417
  globalLogger.info(`Cleaning ${removes.size} files`);
4364
3418
  await Promise.all([...removes].map(async (file) => {
4365
- debug$4$2("Removing", file);
3419
+ debug$3$2("Removing", file);
4366
3420
  await fsRemove(file);
4367
3421
  }));
4368
- debug$4$2("Removed %d files", removes.size);
3422
+ debug$3$2("Removed %d files", removes.size);
4369
3423
  }
4370
3424
  function resolveClean(clean, outDir, cwd) {
4371
3425
  if (clean === true) clean = [slash(outDir)];
@@ -4376,7 +3430,7 @@ function resolveClean(clean, outDir, cwd) {
4376
3430
  async function cleanChunks(outDir, chunks) {
4377
3431
  await Promise.all(chunks.map(async (chunk) => {
4378
3432
  const filePath = path.resolve(outDir, chunk.fileName);
4379
- debug$4$2("Removing chunk file", filePath);
3433
+ debug$3$2("Removing chunk file", filePath);
4380
3434
  await fsRemove(filePath);
4381
3435
  }));
4382
3436
  }
@@ -4451,92 +3505,6 @@ async function resolveArrayEntry(entries, cwd, root) {
4451
3505
  }));
4452
3506
  return [Object.assign({}, arrayEntryMap, ...resolvedObjectEntries), computedRoot];
4453
3507
  }
4454
- const debug$3$2 = createDebug("tsdown:exe");
4455
- function validateSea({ dts, entry, logger, nameLabel }) {
4456
- if (process$1.versions.bun || process$1.versions.deno) throw new Error("The `exe` option is not supported in Bun and Deno environments.");
4457
- if (!satisfies$1(process$1.version, ">=25.7.0")) throw new Error(`Node.js version ${process$1.version} does not support \`exe\` option. Please upgrade to Node.js 25.7.0 or later.`);
4458
- if (Object.keys(entry).length > 1) throw new Error(`The \`exe\` feature currently only supports single entry points. Found entries:\n${JSON.stringify(entry, void 0, 2)}`);
4459
- if (dts) logger.warn(nameLabel, `Generating .d.ts files with \`exe\` option is not recommended since they won't be included in the executable. Consider separating your library and executable targets if you need type declarations.`);
4460
- logger.info(nameLabel, "`exe` option is experimental and may change in future releases.");
4461
- }
4462
- async function buildExe(config, chunks) {
4463
- if (!config.exe) return;
4464
- const filteredChunks = chunks.filter((chunk) => !RE_DTS.test(chunk.fileName));
4465
- if (filteredChunks.length > 1) throw new Error(`The 'exe' feature currently only supports single-chunk outputs. Found ${filteredChunks.length} chunks.\nChunks:\n${filteredChunks.map((c) => `- ${c.fileName}`).join("\n")}`);
4466
- const chunk = filteredChunks[0];
4467
- debug$3$2("Building executable with SEA for chunk:", chunk.fileName);
4468
- const bundledFile = path.join(config.outDir, chunk.fileName);
4469
- const { targets } = config.exe;
4470
- if (targets?.length) {
4471
- if (config.exe.seaConfig?.executable) config.logger.warn(config.nameLabel, "`seaConfig.executable` is ignored when `targets` is specified.");
4472
- const { resolveNodeBinary, getTargetSuffix } = await import("./tsdown-exe.js");
4473
- for (const target of targets) {
4474
- const nodeBinaryPath = await resolveNodeBinary(target, config.logger);
4475
- const suffix = getTargetSuffix(target);
4476
- await buildSingleExe(config, bundledFile, resolveOutputFileName(config.exe, chunk, bundledFile, target, suffix), nodeBinaryPath, target);
4477
- }
4478
- } else await buildSingleExe(config, bundledFile, resolveOutputFileName(config.exe, chunk, bundledFile));
4479
- }
4480
- function resolveOutputFileName(exe, chunk, bundledFile, target, suffix) {
4481
- let baseName;
4482
- if (exe.fileName) baseName = typeof exe.fileName === "function" ? exe.fileName(chunk) : exe.fileName;
4483
- else baseName = path.basename(bundledFile, path.extname(bundledFile));
4484
- if (suffix) baseName += suffix;
4485
- if (target?.platform ? target.platform === "win" : process$1.platform === "win32") baseName += ".exe";
4486
- return baseName;
4487
- }
4488
- async function buildSingleExe(config, bundledFile, outputFile, executable, target) {
4489
- const exe = config.exe;
4490
- const exeOutDir = path.resolve(config.cwd, exe.outDir || "build");
4491
- await mkdir(exeOutDir, { recursive: true });
4492
- const outputPath = path.join(exeOutDir, outputFile);
4493
- debug$3$2("Building SEA executable: %s -> %s", bundledFile, outputPath);
4494
- const t = performance.now();
4495
- const tempDir = await mkdtemp(path.join(tmpdir(), "tsdown-sea-"));
4496
- try {
4497
- const seaConfig = {
4498
- disableExperimentalSEAWarning: true,
4499
- ...exe.seaConfig,
4500
- main: bundledFile,
4501
- output: outputPath,
4502
- mainFormat: config.format === "es" ? "module" : "commonjs"
4503
- };
4504
- if (executable) seaConfig.executable = executable;
4505
- const seaConfigPath = path.join(tempDir, "sea-config.json");
4506
- await writeFile(seaConfigPath, JSON.stringify(seaConfig));
4507
- debug$3$2("Wrote sea-config.json: %O -> %s", seaConfig, seaConfigPath);
4508
- debug$3$2("Running: %s --build-sea %s", process$1.execPath, seaConfigPath);
4509
- await R$2(process$1.execPath, ["--build-sea", seaConfigPath], {
4510
- nodeOptions: { stdio: [
4511
- "ignore",
4512
- "ignore",
4513
- "inherit"
4514
- ] },
4515
- throwOnError: true
4516
- });
4517
- } finally {
4518
- if (debug$3$2.enabled) debug$3$2("Preserving temp directory for debugging: %s", tempDir);
4519
- else await fsRemove(tempDir);
4520
- }
4521
- if ((target?.platform || process$1.platform) === "darwin") try {
4522
- await R$2("codesign", [
4523
- "--sign",
4524
- "-",
4525
- outputPath
4526
- ], {
4527
- nodeOptions: { stdio: "inherit" },
4528
- throwOnError: true
4529
- });
4530
- } catch {
4531
- config.logger.warn(config.nameLabel, `Failed to code-sign the executable. ${process$1.platform === "darwin" ? `You can sign it manually using:\n codesign --sign - "${outputPath}"` : `Automatic code signing is not supported on ${process$1.platform}.`}`);
4532
- }
4533
- const stat = await fsStat(outputPath);
4534
- if (stat) {
4535
- const sizeText = formatBytes(stat.size);
4536
- config.logger.info(config.nameLabel, bold(path.relative(config.cwd, outputPath)), ` ${dim(sizeText)}`);
4537
- }
4538
- config.logger.success(config.nameLabel, `Built executable: ${red(path.relative(config.cwd, outputPath))}`, dim`(${Math.round(performance.now() - t)}ms)`);
4539
- }
4540
3508
  function writeJsonFile(filePath, content) {
4541
3509
  let originalText;
4542
3510
  let originalJson = void 0;
@@ -4996,7 +3964,6 @@ async function unrunImport(id) {
4996
3964
  return [module, new Set(dependencies)];
4997
3965
  }
4998
3966
  const debug$8 = createDebug("tsdown:config:options");
4999
- const parseEnv = process$1.getBuiltinModule("node:util").parseEnv;
5000
3967
  /**
5001
3968
  * Resolve user config into resolved configs
5002
3969
  *
@@ -5011,7 +3978,7 @@ async function resolveUserConfig(userConfig, inlineConfig, configDeps) {
5011
3978
  if (result) userConfig = mergeConfig(userConfig, result);
5012
3979
  }
5013
3980
  }
5014
- let { entry, format, plugins = [], clean = true, logLevel = "info", failOnWarn = false, 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;
3981
+ 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;
5015
3982
  const pkg = await readPackageJson(cwd);
5016
3983
  if (workspace) name ||= pkg?.name;
5017
3984
  const color = generateColor(name);
@@ -5022,7 +3989,8 @@ async function resolveUserConfig(userConfig, inlineConfig, configDeps) {
5022
3989
  }
5023
3990
  const logger = createLogger(logLevel, {
5024
3991
  customLogger,
5025
- failOnWarn: resolveFeatureOption(failOnWarn, true)
3992
+ failOnWarn: resolveFeatureOption(failOnWarn, true),
3993
+ suppressWarnings
5026
3994
  });
5027
3995
  if (typeof bundle === "boolean") logger.warn("`bundle` option is deprecated. Use `unbundle` instead.");
5028
3996
  if (removeNodeProtocol) {
@@ -5072,7 +4040,6 @@ async function resolveUserConfig(userConfig, inlineConfig, configDeps) {
5072
4040
  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.");
5073
4041
  const envFromProcess = filterEnv(process$1.env, envPrefix);
5074
4042
  if (envFile) {
5075
- if (!parseEnv) throw new Error(`Your runtime does not support 'util.parseEnv()'. Please upgrade to Node.js v20.12.0 or later.`);
5076
4043
  const resolvedPath = path.resolve(cwd, envFile);
5077
4044
  logger.info(nameLabel, `env file: ${color(resolvedPath)}`);
5078
4045
  env = {
@@ -5180,7 +4147,11 @@ function filterEnv(envDict, envPrefixes) {
5180
4147
  for (const [key, value] of Object.entries(envDict)) if (value != null && envPrefixes.some((prefix) => key.startsWith(prefix))) env[key] = value;
5181
4148
  return env;
5182
4149
  }
5183
- const defu = createDefu((obj, key, value) => {
4150
+ const defu = createDefu((obj, key, value, namespace) => {
4151
+ if (key === "plugins" && (namespace === "" || namespace === "inputOptions" || namespace === "outputOptions")) {
4152
+ obj[key] = [].concat(obj[key], value);
4153
+ return true;
4154
+ }
5184
4155
  if (Array.isArray(obj[key]) && Array.isArray(value)) {
5185
4156
  obj[key] = value;
5186
4157
  return true;
@@ -5190,9 +4161,9 @@ function mergeConfig(defaults, ...overrides) {
5190
4161
  return defu(...overrides.toReversed(), defaults);
5191
4162
  }
5192
4163
  async function mergeUserOptions(defaults, user, args) {
5193
- const userOutputOptions = typeof user === "function" ? await user(defaults, ...args) : user;
5194
- if (!userOutputOptions) return defaults;
5195
- return defu(userOutputOptions, defaults);
4164
+ if (!user) return defaults;
4165
+ if (typeof user === "function") return await user(defaults, ...args) ?? defaults;
4166
+ return defu(user, defaults);
5196
4167
  }
5197
4168
  function resolveFeatureOption(value, defaults) {
5198
4169
  if (typeof value === "object" && value !== null) return resolveCIOption(value.enabled ?? true) ? value : false;
@@ -5211,7 +4182,7 @@ function filterConfig(filter, configCwd, name) {
5211
4182
  return toArray(filter).some((value) => name && name === value || cwd === value);
5212
4183
  }
5213
4184
  //#endregion
5214
- //#region ../../node_modules/.pnpm/tsdown@0.22.3_@arethetypeswrong+core@0.18.2_@tsdown+css@0.22.3_@tsdown+exe@0.22.3_@type_b3805a6765df28d505319221a7193e18/node_modules/tsdown/dist/watch-C3ocHLCt.mjs
4185
+ //#region ../../node_modules/.pnpm/tsdown@0.22.13_@arethetypeswrong+core@0.18.2_@tsdown+css@0.22.13_@tsdown+exe@0.22.13_@t_f26a610f558bef85f3db2230cc877c56/node_modules/tsdown/dist/watch-CiWfWcBn.mjs
5215
4186
  async function copy(options) {
5216
4187
  if (!options.copy) return;
5217
4188
  const resolved = await resolveCopyEntries(options);
@@ -5591,16 +4562,13 @@ var Hookable = class {
5591
4562
  }
5592
4563
  };
5593
4564
  //#endregion
5594
- //#region ../../node_modules/.pnpm/tsdown@0.22.3_@arethetypeswrong+core@0.18.2_@tsdown+css@0.22.3_@tsdown+exe@0.22.3_@type_b3805a6765df28d505319221a7193e18/node_modules/tsdown/dist/build-B_nvJe4A.mjs
5595
- var build_B_nvJe4A_exports = /* @__PURE__ */ __exportAll$1({
4565
+ //#region ../../node_modules/.pnpm/tsdown@0.22.13_@arethetypeswrong+core@0.18.2_@tsdown+css@0.22.13_@tsdown+exe@0.22.13_@t_f26a610f558bef85f3db2230cc877c56/node_modules/tsdown/dist/build-oq13wECG.mjs
4566
+ var build_oq13wECG_exports = /* @__PURE__ */ __exportAll$1({
5596
4567
  n: () => buildWithConfigs,
5597
4568
  r: () => build_exports,
5598
4569
  t: () => build$1
5599
4570
  });
5600
- const __cjs_require = createRequire(import.meta.url);
5601
- const satisfies = __cjs_require("./npm_entry_semver_functions_satisfies.cjs");
5602
- const coerce = __cjs_require("./npm_entry_semver_functions_coerce.cjs");
5603
- const treeKill = __cjs_require("./npm_entry_tree-kill.cjs");
4571
+ const treeKill = createRequire(import.meta.url)("./npm_entry_tree-kill.cjs");
5604
4572
  var __defProp = Object.defineProperty;
5605
4573
  var __exportAll = (all, no_symbols) => {
5606
4574
  let target = {};
@@ -5677,11 +4645,12 @@ async function resolveConfig(inlineConfig) {
5677
4645
  deps: globalDeps
5678
4646
  };
5679
4647
  }
4648
+ const RANGE_REQUIRING_ESM = parseRange("^20.19.0 || >=22.12.0");
5680
4649
  function warnLegacyCJS(config) {
5681
4650
  if (config.exe || !config.target || !(config.checks?.legacyCjs ?? true) || !config.format.includes("cjs")) return;
5682
4651
  if (config.target.some((t) => {
5683
- const version = coerce(t.split("node")[1]);
5684
- return version && satisfies(version, "^20.19.0 || >=22.12.0");
4652
+ const version = coerce(t.split("node", 2)[1]);
4653
+ return version && satisfies(version, RANGE_REQUIRING_ESM);
5685
4654
  })) 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");
5686
4655
  }
5687
4656
  function CjsDtsReexportPlugin() {
@@ -5725,7 +4694,7 @@ function executeOnSuccess(config) {
5725
4694
  if (!config.onSuccess) return;
5726
4695
  const ab = new AbortController();
5727
4696
  if (typeof config.onSuccess === "string") {
5728
- const p = z$1(config.onSuccess, [], { nodeOptions: {
4697
+ const p = z(config.onSuccess, [], { nodeOptions: {
5729
4698
  shell: true,
5730
4699
  stdio: "inherit",
5731
4700
  cwd: config.cwd
@@ -5906,14 +4875,14 @@ async function bundleDone(bundleByPkg, bundle) {
5906
4875
  async function packTarball(packageJsonPath) {
5907
4876
  const pkgDir = path.dirname(packageJsonPath);
5908
4877
  const destination = await mkdtemp(path.join(tmpdir(), "tsdown-pack-"));
5909
- const { detect } = await import("./detect-B97OSl92-BJPZyIKJ.js");
4878
+ const { detect } = await import("./detect-DGhJGEqb-S-tkSzpt.js");
5910
4879
  try {
5911
4880
  const detected = await detect({ cwd: pkgDir });
5912
4881
  debug$1("Detected package manager: %o", detected);
5913
4882
  if (detected?.name === "deno") throw new Error(`Cannot pack tarball for Deno projects at ${pkgDir}`);
5914
4883
  const tarballPath = await pack(pkgDir, detected, destination, true);
5915
4884
  debug$1("Packed tarball at %s", tarballPath);
5916
- return readFile(tarballPath);
4885
+ return await readFile(tarballPath);
5917
4886
  } finally {
5918
4887
  if (debug$1.enabled) debug$1("Preserving pack directory for debugging: %s", destination);
5919
4888
  else await fsRemove(destination);
@@ -5977,7 +4946,10 @@ async function pack(dir, pm, destination, ignoreScripts) {
5977
4946
  args.push("--ignore-scripts");
5978
4947
  break;
5979
4948
  }
5980
- const output = await R$2(command, args, { nodeOptions: { cwd: dir } });
4949
+ const output = await R(command, args, {
4950
+ nodePath: false,
4951
+ nodeOptions: { cwd: dir }
4952
+ });
5981
4953
  const tarballFile = await readdir(destination).then((files) => files.find((file) => file.endsWith(".tgz")));
5982
4954
  if (!tarballFile) throw new Error(`Failed to find packed tarball file in ${destination}. Command output:\n${JSON.stringify(output, null, 2)}`);
5983
4955
  return path.join(destination, tarballFile);
@@ -6015,15 +4987,15 @@ function createChunkFilename(basename, jsExtension, dtsExtension) {
6015
4987
  function resolveChunkAddon(chunkAddon, format) {
6016
4988
  if (!chunkAddon) return;
6017
4989
  return (chunk) => {
6018
- if (typeof chunkAddon === "function") chunkAddon = chunkAddon({
4990
+ const resolved = typeof chunkAddon === "function" ? chunkAddon({
6019
4991
  format,
6020
4992
  fileName: chunk.fileName
6021
- });
6022
- if (typeof chunkAddon === "string") return chunkAddon;
4993
+ }) : chunkAddon;
4994
+ if (typeof resolved === "string") return resolved;
6023
4995
  switch (true) {
6024
- case RE_JS.test(chunk.fileName): return chunkAddon?.js || "";
6025
- case RE_CSS.test(chunk.fileName): return chunkAddon?.css || "";
6026
- case RE_DTS.test(chunk.fileName): return chunkAddon?.dts || "";
4996
+ case RE_JS.test(chunk.fileName): return resolved?.js || "";
4997
+ case RE_CSS.test(chunk.fileName): return resolved?.css || "";
4998
+ case RE_DTS.test(chunk.fileName): return resolved?.dts || "";
6027
4999
  default: return "";
6028
5000
  }
6029
5001
  };
@@ -6041,15 +5013,18 @@ async function getBuildOptions(config, format, configDeps, bundle, cjsDts = fals
6041
5013
  return rolldownConfig;
6042
5014
  }
6043
5015
  async function resolveInputOptions(config, format, configDeps, bundle, cjsDts, isDualFormat) {
6044
- const { alias, checks: { legacyCjs, ...checks } = {}, cjsDefault, cwd, deps, devtools, dts, entry, env, globImport, loader, logger, nameLabel, nodeProtocol, platform, plugins: userPlugins, report, shims, target, treeshake, tsconfig, unbundle, unused, watch } = config;
5016
+ const { alias, checks: { legacyCjs, ...checks } = {}, cjsDefault, cwd, deps, devtools, dts, entry, env, globImport, loader, logger, nameLabel, nodeProtocol, platform, plugins: userPlugins, report, shims, target, treeshake, tsconfig, unused, watch } = config;
5017
+ const loggerLevelIndex = LogLevels[logger.level];
5018
+ const isSuppressed = createSuppressWarnings(logger.options?.suppressWarnings);
6045
5019
  const plugins = [];
6046
5020
  if (nodeProtocol) plugins.push(NodeProtocolPlugin(nodeProtocol));
6047
- if (config.pkg || config.deps.skipNodeModulesBundle) plugins.push(DepsPlugin(config, bundle));
5021
+ if (config.pkg || config.deps.skipNodeModulesBundle || config.deps.neverBundle === true || config.deps.dts.neverBundle === true) plugins.push(DepsPlugin(config, bundle));
6048
5022
  if (dts) {
6049
- const { dts: dtsPlugin } = await import("./dist-CqbVlnVq.js");
5023
+ const { dts: dtsPlugin } = await import("./dist-CxIM8o7n.js");
6050
5024
  const { cjsReexport: _, ...dtsPluginOptions } = dts;
6051
5025
  const options = {
6052
5026
  tsconfig,
5027
+ logger,
6053
5028
  ...dtsPluginOptions
6054
5029
  };
6055
5030
  if (format === "es") plugins.push(dtsPlugin(options));
@@ -6078,7 +5053,7 @@ async function resolveInputOptions(config, format, configDeps, bundle, cjsDts, i
6078
5053
  plugins.push(ShebangPlugin(logger, cwd, nameLabel, isDualFormat));
6079
5054
  if (globImport) plugins.push(importGlobPlugin({ root: cwd }));
6080
5055
  }
6081
- if (report && LogLevels[logger.level] >= 3) plugins.push(ReportPlugin(config, cjsDts, isDualFormat));
5056
+ if (report && loggerLevelIndex >= 3) plugins.push(ReportPlugin(config, cjsDts, isDualFormat));
6082
5057
  if (watch) plugins.push(WatchPlugin(configDeps, bundle));
6083
5058
  if (!cjsDts) plugins.push(userPlugins);
6084
5059
  if (cssPostPlugins) plugins.push(...cssPostPlugins);
@@ -6092,24 +5067,29 @@ async function resolveInputOptions(config, format, configDeps, bundle, cjsDts, i
6092
5067
  }, Object.create(null))
6093
5068
  };
6094
5069
  let inject;
6095
- if (shims && !cjsDts) if (unbundle) {
5070
+ if (shims && !cjsDts) {
5071
+ const shims = getShims(config);
5072
+ inject = shims.inject;
6096
5073
  define = {
6097
5074
  ...define,
6098
- ...shimsDefine
5075
+ ...shims.define
6099
5076
  };
6100
- plugins.push(shimsPlugin);
6101
- } else inject = getShimsInject(format, platform);
6102
- const dtsExternal = deps.dts.neverBundle ? functionifyExternal(deps.dts.neverBundle) : void 0;
5077
+ if (shims.plugin) plugins.push(shims.plugin);
5078
+ }
5079
+ const jsNeverBundle = deps.neverBundle === true ? void 0 : deps.neverBundle;
5080
+ const dtsNeverBundle = deps.dts.neverBundle === true ? void 0 : deps.dts.neverBundle;
5081
+ const dtsExternal = dtsNeverBundle ? functionifyExternal(dtsNeverBundle) : void 0;
6103
5082
  let external;
6104
- if (deps.neverBundle && dtsExternal) {
6105
- const jsExternal = functionifyExternal(deps.neverBundle);
5083
+ if (jsNeverBundle && dtsExternal) {
5084
+ const jsExternal = functionifyExternal(jsNeverBundle);
6106
5085
  external = (id, importer, ...args) => {
6107
5086
  return ((importer ? RE_DTS.test(importer) : false) ? dtsExternal : jsExternal)(id, importer, ...args);
6108
5087
  };
6109
5088
  } else if (dtsExternal) external = (id, importer, ...args) => {
6110
5089
  return (importer ? RE_DTS.test(importer) : false) ? dtsExternal(id, importer, ...args) : void 0;
6111
5090
  };
6112
- else external = deps.neverBundle;
5091
+ else external = jsNeverBundle;
5092
+ const logLevel = logger.options?.failOnWarn && loggerLevelIndex < 2 ? "warn" : logger.level === "error" ? "silent" : logger.level;
6113
5093
  return await mergeUserOptions({
6114
5094
  input: entry,
6115
5095
  cwd,
@@ -6128,9 +5108,10 @@ async function resolveInputOptions(config, format, configDeps, bundle, cjsDts, i
6128
5108
  ".node": "copy",
6129
5109
  ...loader
6130
5110
  },
6131
- logLevel: logger.level === "error" ? "silent" : logger.level,
5111
+ logLevel,
6132
5112
  onLog(level, log, defaultHandler) {
6133
5113
  if (cjsDefault && log.code === "MIXED_EXPORT") return;
5114
+ if (level === "warn" && isSuppressed(log.message)) return;
6134
5115
  if (logger.options?.failOnWarn && level === "warn" && log.code !== "PLUGIN_TIMINGS") defaultHandler("error", log);
6135
5116
  defaultHandler(level, log);
6136
5117
  },
@@ -6423,4 +5404,4 @@ async function buildSingle(config, configDeps, isDualFormat, clean, restart, don
6423
5404
  }
6424
5405
  }
6425
5406
  //#endregion
6426
- export { filename_dts_to as _, resolveUserConfig as a, replaceTemplateName as b, RE_CSS as c, RE_JS as d, RE_JSON as f, RE_VUE as g, RE_TS as h, mergeConfig as i, RE_DTS as l, RE_ROLLDOWN_RUNTIME as m, buildWithConfigs as n, at as o, RE_NODE_MODULES$1 as p, build_B_nvJe4A_exports as r, ee as s, build$1 as t, RE_DTS_MAP as u, filename_js_to_dts as v, resolveTemplateFn as x, filename_to_dts as y };
5407
+ export { resolveUserConfig as a, mergeConfig as i, buildWithConfigs as n, build_oq13wECG_exports as r, build$1 as t };