@storm-software/esbuild 0.35.11 → 0.35.13

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 (58) hide show
  1. package/README.md +1 -2
  2. package/bin/esbuild.cjs +1225 -2788
  3. package/dist/assets.cjs +6 -6
  4. package/dist/assets.js +5 -5
  5. package/dist/build.cjs +13 -14
  6. package/dist/build.js +12 -13
  7. package/dist/{chunk-C5UZWWWR.js → chunk-2LYIFO7K.js} +3 -9
  8. package/dist/{chunk-KXCV2R7J.cjs → chunk-55UPQQ65.cjs} +288 -179
  9. package/dist/{chunk-INQXL7FE.js → chunk-72UBXZRO.js} +4 -6
  10. package/dist/{chunk-RMRB7CWQ.js → chunk-7KIT5JE6.js} +36 -30
  11. package/dist/{chunk-OHH3RWRK.cjs → chunk-B3MHVZOK.cjs} +10 -12
  12. package/dist/{chunk-NNO5TTNR.cjs → chunk-BK5GLVSJ.cjs} +47 -21
  13. package/dist/{chunk-J3XDBU5Z.cjs → chunk-BWMW4ZUS.cjs} +46 -40
  14. package/dist/{chunk-VITVYHJG.cjs → chunk-C25ALB4J.cjs} +975 -1209
  15. package/dist/chunk-CEJM5IFH.js +37 -0
  16. package/dist/{chunk-ICKIIBXC.js → chunk-FHHEEOIV.js} +2 -2
  17. package/dist/{chunk-PHC57UZZ.cjs → chunk-H7NSISN4.cjs} +33 -24
  18. package/dist/{chunk-QAYURSX7.cjs → chunk-IULOZ7MO.cjs} +5 -5
  19. package/dist/{chunk-QTR5272S.cjs → chunk-JCICRU7K.cjs} +3 -5
  20. package/dist/{chunk-OZEWXLIK.js → chunk-KV6GNLVF.js} +8 -10
  21. package/dist/{chunk-TULJZS5M.js → chunk-KXZCIMKJ.js} +149 -265
  22. package/dist/{chunk-T4UMKHLQ.cjs → chunk-LBRDOW2V.cjs} +18 -9
  23. package/dist/{chunk-5P6GWVMJ.js → chunk-NACKZM5D.js} +189 -116
  24. package/dist/chunk-NLIYZM5H.cjs +25 -0
  25. package/dist/{chunk-WHHAD2OY.js → chunk-Q3WZPCLD.js} +232 -123
  26. package/dist/{chunk-7ESNPD46.js → chunk-QOTJTLX7.js} +1 -1
  27. package/dist/{chunk-J5J57SEI.cjs → chunk-RBXXACL5.cjs} +204 -131
  28. package/dist/{chunk-KYRZY7X7.js → chunk-RNXNYWO3.js} +28 -19
  29. package/dist/{chunk-H35FAHLW.cjs → chunk-T4N45NGL.cjs} +17 -26
  30. package/dist/{chunk-66VO6PT4.js → chunk-VLK67MTI.js} +43 -17
  31. package/dist/{chunk-SR4MG2LN.js → chunk-VNLMOUVN.js} +15 -24
  32. package/dist/chunk-XHTD4QDZ.cjs +6 -0
  33. package/dist/clean.cjs +5 -5
  34. package/dist/clean.js +4 -4
  35. package/dist/config.cjs +6 -6
  36. package/dist/config.js +5 -5
  37. package/dist/context.cjs +7 -8
  38. package/dist/context.js +6 -7
  39. package/dist/index.cjs +15 -16
  40. package/dist/index.js +13 -14
  41. package/dist/package-json.cjs +6 -6
  42. package/dist/package-json.js +5 -5
  43. package/dist/plugins/deps-check.cjs +5 -5
  44. package/dist/plugins/deps-check.js +4 -4
  45. package/dist/plugins/resolve-paths.cjs +82 -5
  46. package/dist/plugins/resolve-paths.js +81 -4
  47. package/dist/tsup.cjs +5 -5
  48. package/dist/tsup.js +4 -4
  49. package/dist/types.cjs +2 -2
  50. package/dist/types.js +2 -2
  51. package/dist/watch.cjs +19 -29
  52. package/dist/watch.js +15 -25
  53. package/package.json +4 -4
  54. package/dist/chunk-AF5YHP7E.cjs +0 -57
  55. package/dist/chunk-BWCGRWHA.cjs +0 -6
  56. package/dist/chunk-ELF4S3RR.cjs +0 -31
  57. package/dist/chunk-IL6FCY37.js +0 -57
  58. package/dist/chunk-LQIX6FZY.js +0 -28
@@ -1,45 +1,37 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard2(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce2(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain2(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class2;
2
2
 
3
3
 
4
- var _chunkJ5J57SEIcjs = require('./chunk-J5J57SEI.cjs');
4
+ var _chunkRBXXACL5cjs = require('./chunk-RBXXACL5.cjs');
5
5
 
6
6
 
7
- var _chunkOHH3RWRKcjs = require('./chunk-OHH3RWRK.cjs');
7
+ var _chunkB3MHVZOKcjs = require('./chunk-B3MHVZOK.cjs');
8
8
 
9
9
 
10
10
 
11
11
 
12
12
 
13
+ var _chunkJCICRU7Kcjs = require('./chunk-JCICRU7K.cjs');
13
14
 
14
- var _chunkQTR5272Scjs = require('./chunk-QTR5272S.cjs');
15
-
16
- // ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=f38aab44b872fc3814414c6a0e9d6e644f0efcadfc3a3eff3f293f7a0295534d__11c18a981686f6a33e045201f02415b6/node_modules/tsup/dist/chunk-BYH4XDRH.js
17
- var require_chunk_BYH4XDRH = _chunkQTR5272Scjs.__commonJS.call(void 0, {
18
- "../../node_modules/.pnpm/tsup@8.4.0_patch_hash=f38aab44b872fc3814414c6a0e9d6e644f0efcadfc3a3eff3f293f7a0295534d__11c18a981686f6a33e045201f02415b6/node_modules/tsup/dist/chunk-BYH4XDRH.js"(exports) {
15
+ // ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=616d4d8468728c5caa25e7b97fe871f667b5342103b43bda8e891020bc6b674a__e7bfd10e92d28211ce978b182e37e925/node_modules/tsup/dist/chunk-BYH4XDRH.js
16
+ var require_chunk_BYH4XDRH = _chunkJCICRU7Kcjs.__commonJS.call(void 0, {
17
+ "../../node_modules/.pnpm/tsup@8.4.0_patch_hash=616d4d8468728c5caa25e7b97fe871f667b5342103b43bda8e891020bc6b674a__e7bfd10e92d28211ce978b182e37e925/node_modules/tsup/dist/chunk-BYH4XDRH.js"(exports) {
19
18
  "use strict";
20
- _chunkQTR5272Scjs.init_cjs_shims.call(void 0, );
21
- Object.defineProperty(exports, "__esModule", {
22
- value: true
23
- });
19
+ _chunkJCICRU7Kcjs.init_cjs_shims.call(void 0, );
20
+ Object.defineProperty(exports, "__esModule", { value: true });
24
21
  var version = "8.4.0";
25
22
  exports.version = version;
26
23
  }
27
24
  });
28
25
 
29
- // ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=f38aab44b872fc3814414c6a0e9d6e644f0efcadfc3a3eff3f293f7a0295534d__11c18a981686f6a33e045201f02415b6/node_modules/tsup/dist/chunk-TWFEYLU4.js
30
- var require_chunk_TWFEYLU4 = _chunkQTR5272Scjs.__commonJS.call(void 0, {
31
- "../../node_modules/.pnpm/tsup@8.4.0_patch_hash=f38aab44b872fc3814414c6a0e9d6e644f0efcadfc3a3eff3f293f7a0295534d__11c18a981686f6a33e045201f02415b6/node_modules/tsup/dist/chunk-TWFEYLU4.js"(exports) {
26
+ // ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=616d4d8468728c5caa25e7b97fe871f667b5342103b43bda8e891020bc6b674a__e7bfd10e92d28211ce978b182e37e925/node_modules/tsup/dist/chunk-TWFEYLU4.js
27
+ var require_chunk_TWFEYLU4 = _chunkJCICRU7Kcjs.__commonJS.call(void 0, {
28
+ "../../node_modules/.pnpm/tsup@8.4.0_patch_hash=616d4d8468728c5caa25e7b97fe871f667b5342103b43bda8e891020bc6b674a__e7bfd10e92d28211ce978b182e37e925/node_modules/tsup/dist/chunk-TWFEYLU4.js"(exports) {
32
29
  "use strict";
33
- _chunkQTR5272Scjs.init_cjs_shims.call(void 0, );
34
- Object.defineProperty(exports, "__esModule", {
35
- value: true
36
- });
30
+ _chunkJCICRU7Kcjs.init_cjs_shims.call(void 0, );
31
+ Object.defineProperty(exports, "__esModule", { value: true });
37
32
  function _interopRequireDefault(obj) {
38
- return obj && obj.__esModule ? obj : {
39
- default: obj
40
- };
33
+ return obj && obj.__esModule ? obj : { default: obj };
41
34
  }
42
- _chunkQTR5272Scjs.__name.call(void 0, _interopRequireDefault, "_interopRequireDefault");
43
35
  function _optionalChain(ops) {
44
36
  let lastAccessLHS = void 0;
45
37
  let value = ops[0];
@@ -61,55 +53,48 @@ var require_chunk_TWFEYLU4 = _chunkQTR5272Scjs.__commonJS.call(void 0, {
61
53
  }
62
54
  return value;
63
55
  }
64
- _chunkQTR5272Scjs.__name.call(void 0, _optionalChain, "_optionalChain");
65
56
  var __create = Object.create;
66
57
  var __defProp = Object.defineProperty;
67
58
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
68
59
  var __getOwnPropNames = Object.getOwnPropertyNames;
69
60
  var __getProtoOf = Object.getPrototypeOf;
70
61
  var __hasOwnProp = Object.prototype.hasOwnProperty;
71
- var __require2 = /* @__PURE__ */ ((x) => typeof _chunkQTR5272Scjs.__require !== "undefined" ? _chunkQTR5272Scjs.__require : typeof Proxy !== "undefined" ? new Proxy(x, {
72
- get: /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (a, b) => (typeof _chunkQTR5272Scjs.__require !== "undefined" ? _chunkQTR5272Scjs.__require : a)[b], "get")
62
+ var __require2 = /* @__PURE__ */ ((x) => typeof _chunkJCICRU7Kcjs.__require !== "undefined" ? _chunkJCICRU7Kcjs.__require : typeof Proxy !== "undefined" ? new Proxy(x, {
63
+ get: (a, b) => (typeof _chunkJCICRU7Kcjs.__require !== "undefined" ? _chunkJCICRU7Kcjs.__require : a)[b]
73
64
  }) : x)(function(x) {
74
- if (typeof _chunkQTR5272Scjs.__require !== "undefined") return _chunkQTR5272Scjs.__require.apply(this, arguments);
65
+ if (typeof _chunkJCICRU7Kcjs.__require !== "undefined") return _chunkJCICRU7Kcjs.__require.apply(this, arguments);
75
66
  throw Error('Dynamic require of "' + x + '" is not supported');
76
67
  });
77
- var __commonJS2 = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (cb, mod) => /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, function __require22() {
78
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = {
79
- exports: {}
80
- }).exports, mod), mod.exports;
81
- }, "__require2"), "__commonJS");
82
- var __copyProps = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (to, from, except, desc) => {
68
+ var __commonJS2 = (cb, mod) => function __require22() {
69
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
70
+ };
71
+ var __copyProps = (to, from, except, desc) => {
83
72
  if (from && typeof from === "object" || typeof from === "function") {
84
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
85
- get: /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, () => from[key], "get"),
86
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
87
- });
73
+ for (let key of __getOwnPropNames(from))
74
+ if (!__hasOwnProp.call(to, key) && key !== except)
75
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
88
76
  }
89
77
  return to;
90
- }, "__copyProps");
91
- var __toESM2 = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
78
+ };
79
+ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
92
80
  // If the importer is in node compatibility mode or this is not an ESM
93
81
  // file that has been converted to a CommonJS file using a Babel-
94
82
  // compatible transform (i.e. "__esModule" has not been set), then set
95
83
  // "default" to the CommonJS "module.exports" for node compatibility.
96
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
97
- value: mod,
98
- enumerable: true
99
- }) : target,
84
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
100
85
  mod
101
- )), "__toESM");
102
- var _fs = _chunkQTR5272Scjs.__require.call(void 0, "fs");
86
+ ));
87
+ var _fs = _chunkJCICRU7Kcjs.__require.call(void 0, "fs");
103
88
  var _fs2 = _interopRequireDefault(_fs);
104
- var _path = _chunkQTR5272Scjs.__require.call(void 0, "path");
89
+ var _path = _chunkJCICRU7Kcjs.__require.call(void 0, "path");
105
90
  var _path2 = _interopRequireDefault(_path);
106
- var _resolvefrom = _chunkQTR5272Scjs.__require.call(void 0, "resolve-from");
91
+ var _resolvefrom = _chunkJCICRU7Kcjs.__require.call(void 0, "resolve-from");
107
92
  var _resolvefrom2 = _interopRequireDefault(_resolvefrom);
108
93
  var singleComment = Symbol("singleComment");
109
94
  var multiComment = Symbol("multiComment");
110
- var stripWithoutWhitespace = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, () => "", "stripWithoutWhitespace");
111
- var stripWithWhitespace = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (string, start, end) => string.slice(start, end).replace(/\S/g, " "), "stripWithWhitespace");
112
- var isEscaped = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (jsonString, quotePosition) => {
95
+ var stripWithoutWhitespace = () => "";
96
+ var stripWithWhitespace = (string, start, end) => string.slice(start, end).replace(/\S/g, " ");
97
+ var isEscaped = (jsonString, quotePosition) => {
113
98
  let index = quotePosition - 1;
114
99
  let backslashCount = 0;
115
100
  while (jsonString[index] === "\\") {
@@ -117,7 +102,7 @@ var require_chunk_TWFEYLU4 = _chunkQTR5272Scjs.__commonJS.call(void 0, {
117
102
  backslashCount += 1;
118
103
  }
119
104
  return Boolean(backslashCount % 2);
120
- }, "isEscaped");
105
+ };
121
106
  function stripJsonComments(jsonString, { whitespace = true, trailingCommas = false } = {}) {
122
107
  if (typeof jsonString !== "string") {
123
108
  throw new TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof jsonString}\``);
@@ -191,21 +176,17 @@ var require_chunk_TWFEYLU4 = _chunkQTR5272Scjs.__commonJS.call(void 0, {
191
176
  }
192
177
  return result + buffer + (isInsideComment ? strip(jsonString.slice(offset)) : jsonString.slice(offset));
193
178
  }
194
- _chunkQTR5272Scjs.__name.call(void 0, stripJsonComments, "stripJsonComments");
195
- var _tinyglobby = _chunkQTR5272Scjs.__require.call(void 0, "tinyglobby");
179
+ var _tinyglobby = _chunkJCICRU7Kcjs.__require.call(void 0, "tinyglobby");
196
180
  function getPostcss() {
197
181
  return localRequire("postcss");
198
182
  }
199
- _chunkQTR5272Scjs.__name.call(void 0, getPostcss, "getPostcss");
200
183
  function getApiExtractor() {
201
184
  return localRequire("@microsoft/api-extractor");
202
185
  }
203
- _chunkQTR5272Scjs.__name.call(void 0, getApiExtractor, "getApiExtractor");
204
186
  function localRequire(moduleName) {
205
187
  const p = _resolvefrom2.default.silent(process.cwd(), moduleName);
206
188
  return p && __require2(p);
207
189
  }
208
- _chunkQTR5272Scjs.__name.call(void 0, localRequire, "localRequire");
209
190
  async function removeFiles(patterns, dir) {
210
191
  const files = await _tinyglobby.glob.call(void 0, patterns, {
211
192
  cwd: dir,
@@ -213,17 +194,16 @@ var require_chunk_TWFEYLU4 = _chunkQTR5272Scjs.__commonJS.call(void 0, {
213
194
  });
214
195
  files.forEach((file) => _fs2.default.existsSync(file) && _fs2.default.unlinkSync(file));
215
196
  }
216
- _chunkQTR5272Scjs.__name.call(void 0, removeFiles, "removeFiles");
217
197
  function debouncePromise(fn, delay, onError) {
218
198
  let timeout;
219
199
  let promiseInFly;
220
200
  let callbackPending;
221
- return /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, function debounced(...args) {
201
+ return function debounced(...args) {
222
202
  if (promiseInFly) {
223
- callbackPending = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, () => {
203
+ callbackPending = () => {
224
204
  debounced(...args);
225
205
  callbackPending = void 0;
226
- }, "callbackPending");
206
+ };
227
207
  } else {
228
208
  if (timeout != null) clearTimeout(timeout);
229
209
  timeout = setTimeout(() => {
@@ -234,9 +214,8 @@ var require_chunk_TWFEYLU4 = _chunkQTR5272Scjs.__commonJS.call(void 0, {
234
214
  });
235
215
  }, delay);
236
216
  }
237
- }, "debounced");
217
+ };
238
218
  }
239
- _chunkQTR5272Scjs.__name.call(void 0, debouncePromise, "debouncePromise");
240
219
  function slash(path2) {
241
220
  const isExtendedLengthPath = path2.startsWith("\\\\?\\");
242
221
  if (isExtendedLengthPath) {
@@ -244,11 +223,9 @@ var require_chunk_TWFEYLU4 = _chunkQTR5272Scjs.__commonJS.call(void 0, {
244
223
  }
245
224
  return path2.replace(/\\/g, "/");
246
225
  }
247
- _chunkQTR5272Scjs.__name.call(void 0, slash, "slash");
248
226
  function truthy(value) {
249
227
  return Boolean(value);
250
228
  }
251
- _chunkQTR5272Scjs.__name.call(void 0, truthy, "truthy");
252
229
  function jsoncParse(data) {
253
230
  try {
254
231
  return new Function(`return ${stripJsonComments(data).trim()}`)();
@@ -256,8 +233,10 @@ var require_chunk_TWFEYLU4 = _chunkQTR5272Scjs.__commonJS.call(void 0, {
256
233
  return {};
257
234
  }
258
235
  }
259
- _chunkQTR5272Scjs.__name.call(void 0, jsoncParse, "jsoncParse");
260
- function defaultOutExtension({ format, pkgType }) {
236
+ function defaultOutExtension({
237
+ format,
238
+ pkgType
239
+ }) {
261
240
  let jsExtension = ".js";
262
241
  let dtsExtension = ".d.ts";
263
242
  const isModule = pkgType === "module";
@@ -277,41 +256,38 @@ var require_chunk_TWFEYLU4 = _chunkQTR5272Scjs.__commonJS.call(void 0, {
277
256
  dts: dtsExtension
278
257
  };
279
258
  }
280
- _chunkQTR5272Scjs.__name.call(void 0, defaultOutExtension, "defaultOutExtension");
281
259
  function ensureTempDeclarationDir(options2) {
282
260
  const cwd = _optionalChain2([options2, 'access', _40 => _40.workspaceConfig, 'optionalAccess', _41 => _41.workspaceRoot]) || process.cwd();
283
261
  const dirPath = _path2.default.join(cwd, ".tsup", "declaration");
284
262
  if (_fs2.default.existsSync(dirPath)) {
285
263
  return dirPath;
286
264
  }
287
- _fs2.default.mkdirSync(dirPath, {
288
- recursive: true
289
- });
265
+ _fs2.default.mkdirSync(dirPath, { recursive: true });
290
266
  const gitIgnorePath = _path2.default.join(cwd, ".tsup", ".gitignore");
291
267
  writeFileSync(gitIgnorePath, "**/*\n");
292
268
  return dirPath;
293
269
  }
294
- _chunkQTR5272Scjs.__name.call(void 0, ensureTempDeclarationDir, "ensureTempDeclarationDir");
295
- var toObjectEntry = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (entry) => {
270
+ var toObjectEntry = (entry) => {
296
271
  if (typeof entry === "string") {
297
- entry = [
298
- entry
299
- ];
272
+ entry = [entry];
300
273
  }
301
274
  if (!Array.isArray(entry)) {
302
275
  return entry;
303
276
  }
304
277
  entry = entry.map((e) => e.replace(/\\/g, "/"));
305
278
  const ancestor = findLowestCommonAncestor(entry);
306
- return entry.reduce((result, item) => {
307
- const key = item.replace(ancestor, "").replace(/^\//, "").replace(/\.[a-z]+$/, "");
308
- return {
309
- ...result,
310
- [key]: item
311
- };
312
- }, {});
313
- }, "toObjectEntry");
314
- var findLowestCommonAncestor = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (filepaths) => {
279
+ return entry.reduce(
280
+ (result, item) => {
281
+ const key = item.replace(ancestor, "").replace(/^\//, "").replace(/\.[a-z]+$/, "");
282
+ return {
283
+ ...result,
284
+ [key]: item
285
+ };
286
+ },
287
+ {}
288
+ );
289
+ };
290
+ var findLowestCommonAncestor = (filepaths) => {
315
291
  if (filepaths.length <= 1) return "";
316
292
  const [first, ...rest] = filepaths;
317
293
  let ancestor = first.split("/");
@@ -329,78 +305,71 @@ var require_chunk_TWFEYLU4 = _chunkQTR5272Scjs.__commonJS.call(void 0, {
329
305
  ancestor = ancestor.slice(0, index);
330
306
  }
331
307
  return ancestor.length <= 1 && ancestor[0] === "" ? `/${ancestor[0]}` : ancestor.join("/");
332
- }, "findLowestCommonAncestor");
308
+ };
333
309
  function toAbsolutePath(p, cwd) {
334
310
  if (_path2.default.isAbsolute(p)) {
335
311
  return p;
336
312
  }
337
313
  return slash(_path2.default.normalize(_path2.default.join(cwd || process.cwd(), p)));
338
314
  }
339
- _chunkQTR5272Scjs.__name.call(void 0, toAbsolutePath, "toAbsolutePath");
340
315
  function writeFileSync(filePath, content) {
341
- _fs2.default.mkdirSync(_path2.default.dirname(filePath), {
342
- recursive: true
343
- });
316
+ _fs2.default.mkdirSync(_path2.default.dirname(filePath), { recursive: true });
344
317
  _fs2.default.writeFileSync(filePath, content);
345
318
  }
346
- _chunkQTR5272Scjs.__name.call(void 0, writeFileSync, "writeFileSync");
347
319
  function replaceDtsWithJsExtensions(dtsFilePath) {
348
- return dtsFilePath.replace(/\.d\.(ts|mts|cts)$/, (_, fileExtension) => {
349
- switch (fileExtension) {
350
- case "ts":
351
- return ".js";
352
- case "mts":
353
- return ".mjs";
354
- case "cts":
355
- return ".cjs";
356
- default:
357
- return "";
320
+ return dtsFilePath.replace(
321
+ /\.d\.(ts|mts|cts)$/,
322
+ (_, fileExtension) => {
323
+ switch (fileExtension) {
324
+ case "ts":
325
+ return ".js";
326
+ case "mts":
327
+ return ".mjs";
328
+ case "cts":
329
+ return ".cjs";
330
+ default:
331
+ return "";
332
+ }
358
333
  }
359
- });
334
+ );
360
335
  }
361
- _chunkQTR5272Scjs.__name.call(void 0, replaceDtsWithJsExtensions, "replaceDtsWithJsExtensions");
362
- var convertArrayEntriesToObjectEntries = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (arrayOfEntries) => {
363
- const objectEntries = Object.fromEntries(arrayOfEntries.map((entry) => [
364
- _path2.default.posix.join(...entry.split(_path2.default.posix.sep).slice(1, -1).concat(_path2.default.parse(entry).name)),
365
- entry
366
- ]));
336
+ var convertArrayEntriesToObjectEntries = (arrayOfEntries) => {
337
+ const objectEntries = Object.fromEntries(
338
+ arrayOfEntries.map(
339
+ (entry) => [
340
+ _path2.default.posix.join(
341
+ ...entry.split(_path2.default.posix.sep).slice(1, -1).concat(_path2.default.parse(entry).name)
342
+ ),
343
+ entry
344
+ ]
345
+ )
346
+ );
367
347
  return objectEntries;
368
- }, "convertArrayEntriesToObjectEntries");
369
- var resolveEntryPaths = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, async (entryPaths) => {
348
+ };
349
+ var resolveEntryPaths = async (entryPaths) => {
370
350
  const resolvedEntryPaths = typeof entryPaths === "string" || Array.isArray(entryPaths) ? convertArrayEntriesToObjectEntries(await _tinyglobby.glob.call(void 0, entryPaths)) : entryPaths;
371
351
  return resolvedEntryPaths;
372
- }, "resolveEntryPaths");
373
- var resolveExperimentalDtsConfig = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, async (options2, tsconfig) => {
374
- const resolvedEntryPaths = await resolveEntryPaths(_optionalChain([
375
- options2,
376
- "access",
377
- (_2) => _2.experimentalDts,
378
- "optionalAccess",
379
- (_3) => _3.entry
380
- ]) || options2.entry);
352
+ };
353
+ var resolveExperimentalDtsConfig = async (options2, tsconfig) => {
354
+ const resolvedEntryPaths = await resolveEntryPaths(
355
+ _optionalChain([options2, "access", (_2) => _2.experimentalDts, "optionalAccess", (_3) => _3.entry]) || options2.entry
356
+ );
381
357
  const experimentalDtsObjectEntry = Object.keys(resolvedEntryPaths).length === 0 ? Array.isArray(options2.entry) ? convertArrayEntriesToObjectEntries(options2.entry) : options2.entry : resolvedEntryPaths;
382
358
  const normalizedExperimentalDtsConfig = {
383
359
  compilerOptions: {
384
360
  ...tsconfig.data.compilerOptions || {},
385
- ..._optionalChain([
386
- options2,
387
- "access",
388
- (_4) => _4.experimentalDts,
389
- "optionalAccess",
390
- (_5) => _5.compilerOptions
391
- ]) || {}
361
+ ..._optionalChain([options2, "access", (_4) => _4.experimentalDts, "optionalAccess", (_5) => _5.compilerOptions]) || {}
392
362
  },
393
363
  entry: experimentalDtsObjectEntry
394
364
  };
395
365
  return normalizedExperimentalDtsConfig;
396
- }, "resolveExperimentalDtsConfig");
397
- var resolveInitialExperimentalDtsConfig = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, async (experimentalDts) => {
366
+ };
367
+ var resolveInitialExperimentalDtsConfig = async (experimentalDts) => {
398
368
  if (experimentalDts == null) {
399
369
  return;
400
370
  }
401
- if (typeof experimentalDts === "boolean") return experimentalDts ? {
402
- entry: {}
403
- } : void 0;
371
+ if (typeof experimentalDts === "boolean")
372
+ return experimentalDts ? { entry: {} } : void 0;
404
373
  if (typeof experimentalDts === "string") {
405
374
  return {
406
375
  entry: convertArrayEntriesToObjectEntries(await _tinyglobby.glob.call(void 0, experimentalDts))
@@ -408,13 +377,9 @@ var require_chunk_TWFEYLU4 = _chunkQTR5272Scjs.__commonJS.call(void 0, {
408
377
  }
409
378
  return {
410
379
  ...experimentalDts,
411
- entry: _optionalChain([
412
- experimentalDts,
413
- "optionalAccess",
414
- (_6) => _6.entry
415
- ]) == null ? {} : await resolveEntryPaths(experimentalDts.entry)
380
+ entry: _optionalChain([experimentalDts, "optionalAccess", (_6) => _6.entry]) == null ? {} : await resolveEntryPaths(experimentalDts.entry)
416
381
  };
417
- }, "resolveInitialExperimentalDtsConfig");
382
+ };
418
383
  exports.__require = __require2;
419
384
  exports.__commonJS = __commonJS2;
420
385
  exports.__toESM = __toESM2;
@@ -437,20 +402,15 @@ var require_chunk_TWFEYLU4 = _chunkQTR5272Scjs.__commonJS.call(void 0, {
437
402
  }
438
403
  });
439
404
 
440
- // ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=f38aab44b872fc3814414c6a0e9d6e644f0efcadfc3a3eff3f293f7a0295534d__11c18a981686f6a33e045201f02415b6/node_modules/tsup/dist/chunk-VGC3FXLU.js
441
- var require_chunk_VGC3FXLU = _chunkQTR5272Scjs.__commonJS.call(void 0, {
442
- "../../node_modules/.pnpm/tsup@8.4.0_patch_hash=f38aab44b872fc3814414c6a0e9d6e644f0efcadfc3a3eff3f293f7a0295534d__11c18a981686f6a33e045201f02415b6/node_modules/tsup/dist/chunk-VGC3FXLU.js"(exports) {
405
+ // ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=616d4d8468728c5caa25e7b97fe871f667b5342103b43bda8e891020bc6b674a__e7bfd10e92d28211ce978b182e37e925/node_modules/tsup/dist/chunk-VGC3FXLU.js
406
+ var require_chunk_VGC3FXLU = _chunkJCICRU7Kcjs.__commonJS.call(void 0, {
407
+ "../../node_modules/.pnpm/tsup@8.4.0_patch_hash=616d4d8468728c5caa25e7b97fe871f667b5342103b43bda8e891020bc6b674a__e7bfd10e92d28211ce978b182e37e925/node_modules/tsup/dist/chunk-VGC3FXLU.js"(exports) {
443
408
  "use strict";
444
- _chunkQTR5272Scjs.init_cjs_shims.call(void 0, );
445
- Object.defineProperty(exports, "__esModule", {
446
- value: true
447
- });
409
+ _chunkJCICRU7Kcjs.init_cjs_shims.call(void 0, );
410
+ Object.defineProperty(exports, "__esModule", { value: true });
448
411
  function _interopRequireDefault(obj) {
449
- return obj && obj.__esModule ? obj : {
450
- default: obj
451
- };
412
+ return obj && obj.__esModule ? obj : { default: obj };
452
413
  }
453
- _chunkQTR5272Scjs.__name.call(void 0, _interopRequireDefault, "_interopRequireDefault");
454
414
  function _optionalChain(ops) {
455
415
  let lastAccessLHS = void 0;
456
416
  let value = ops[0];
@@ -472,27 +432,28 @@ var require_chunk_VGC3FXLU = _chunkQTR5272Scjs.__commonJS.call(void 0, {
472
432
  }
473
433
  return value;
474
434
  }
475
- _chunkQTR5272Scjs.__name.call(void 0, _optionalChain, "_optionalChain");
476
435
  var _chunkTWFEYLU4js = require_chunk_TWFEYLU4();
477
- var _fs = _chunkQTR5272Scjs.__require.call(void 0, "fs");
436
+ var _fs = _chunkJCICRU7Kcjs.__require.call(void 0, "fs");
478
437
  var _fs2 = _interopRequireDefault(_fs);
479
- var _path = _chunkQTR5272Scjs.__require.call(void 0, "path");
438
+ var _path = _chunkJCICRU7Kcjs.__require.call(void 0, "path");
480
439
  var _path2 = _interopRequireDefault(_path);
481
- var _joycon = _chunkQTR5272Scjs.__require.call(void 0, "joycon");
440
+ var _joycon = _chunkJCICRU7Kcjs.__require.call(void 0, "joycon");
482
441
  var _joycon2 = _interopRequireDefault(_joycon);
483
- var _bundlerequire = _chunkQTR5272Scjs.__require.call(void 0, "bundle-require");
442
+ var _bundlerequire = _chunkJCICRU7Kcjs.__require.call(void 0, "bundle-require");
484
443
  var joycon = new (0, _joycon2.default)();
485
- var loadJson = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, async (filepath, options2) => {
444
+ var loadJson = async (filepath, options2) => {
486
445
  try {
487
446
  return _chunkTWFEYLU4js.jsoncParse.call(void 0, await _fs2.default.promises.readFile(filepath, "utf8"));
488
447
  } catch (error) {
489
448
  if (error instanceof Error) {
490
- throw new Error(`Failed to parse ${_path2.default.relative(_optionalChain2([options2, 'access', _42 => _42.workspaceConfig, 'optionalAccess', _43 => _43.workspaceRoot]) || process.cwd(), filepath)}: ${error.message}`);
449
+ throw new Error(
450
+ `Failed to parse ${_path2.default.relative(_optionalChain2([options2, 'access', _42 => _42.workspaceConfig, 'optionalAccess', _43 => _43.workspaceRoot]) || process.cwd(), filepath)}: ${error.message}`
451
+ );
491
452
  } else {
492
453
  throw error;
493
454
  }
494
455
  }
495
- }, "loadJson");
456
+ };
496
457
  var jsonLoader = {
497
458
  test: /\.json$/,
498
459
  load(filepath) {
@@ -503,9 +464,7 @@ var require_chunk_VGC3FXLU = _chunkQTR5272Scjs.__commonJS.call(void 0, {
503
464
  async function loadTsupConfig(cwd, configFile) {
504
465
  const configJoycon = new (0, _joycon2.default)();
505
466
  const configPath = await configJoycon.resolve({
506
- files: configFile ? [
507
- configFile
508
- ] : [
467
+ files: configFile ? [configFile] : [
509
468
  "tsup.config.ts",
510
469
  "tsup.config.cts",
511
470
  "tsup.config.mts",
@@ -526,10 +485,7 @@ var require_chunk_VGC3FXLU = _chunkQTR5272Scjs.__commonJS.call(void 0, {
526
485
  data = data.tsup;
527
486
  }
528
487
  if (data) {
529
- return {
530
- path: configPath,
531
- data
532
- };
488
+ return { path: configPath, data };
533
489
  }
534
490
  return {};
535
491
  }
@@ -543,26 +499,23 @@ var require_chunk_VGC3FXLU = _chunkQTR5272Scjs.__commonJS.call(void 0, {
543
499
  }
544
500
  return {};
545
501
  }
546
- _chunkQTR5272Scjs.__name.call(void 0, loadTsupConfig, "loadTsupConfig");
547
502
  async function loadPkg(cwd, clearCache = false) {
548
503
  if (clearCache) {
549
504
  joycon.clearCache();
550
505
  }
551
- const { data } = await joycon.load([
552
- "package.json"
553
- ], cwd, _path2.default.dirname(cwd));
506
+ const { data } = await joycon.load(["package.json"], cwd, _path2.default.dirname(cwd));
554
507
  return data || {};
555
508
  }
556
- _chunkQTR5272Scjs.__name.call(void 0, loadPkg, "loadPkg");
557
509
  async function getProductionDeps(cwd, clearCache = false) {
558
510
  const data = await loadPkg(cwd, clearCache);
559
- const deps = Array.from(/* @__PURE__ */ new Set([
560
- ...Object.keys(data.dependencies || {}),
561
- ...Object.keys(data.peerDependencies || {})
562
- ]));
511
+ const deps = Array.from(
512
+ /* @__PURE__ */ new Set([
513
+ ...Object.keys(data.dependencies || {}),
514
+ ...Object.keys(data.peerDependencies || {})
515
+ ])
516
+ );
563
517
  return deps;
564
518
  }
565
- _chunkQTR5272Scjs.__name.call(void 0, getProductionDeps, "getProductionDeps");
566
519
  async function getAllDepsHash(cwd) {
567
520
  const data = await loadPkg(cwd, true);
568
521
  return JSON.stringify({
@@ -571,33 +524,30 @@ var require_chunk_VGC3FXLU = _chunkQTR5272Scjs.__commonJS.call(void 0, {
571
524
  ...data.devDependencies
572
525
  });
573
526
  }
574
- _chunkQTR5272Scjs.__name.call(void 0, getAllDepsHash, "getAllDepsHash");
575
- var _util = _chunkQTR5272Scjs.__require.call(void 0, "util");
527
+ var _util = _chunkJCICRU7Kcjs.__require.call(void 0, "util");
576
528
  var _util2 = _interopRequireDefault(_util);
577
- var _worker_threads = _chunkQTR5272Scjs.__require.call(void 0, "worker_threads");
578
- var _picocolors = _chunkQTR5272Scjs.__require.call(void 0, "picocolors");
529
+ var _worker_threads = _chunkJCICRU7Kcjs.__require.call(void 0, "worker_threads");
530
+ var _picocolors = _chunkJCICRU7Kcjs.__require.call(void 0, "picocolors");
579
531
  var _picocolors2 = _interopRequireDefault(_picocolors);
580
- var colorize = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (type, data, onlyImportant = false) => {
532
+ var colorize = (type, data, onlyImportant = false) => {
581
533
  if (onlyImportant && (type === "info" || type === "success")) return data;
582
534
  const color = type === "info" ? "blue" : type === "error" ? "red" : type === "warn" ? "yellow" : "green";
583
535
  return _picocolors2.default[color](data);
584
- }, "colorize");
585
- var makeLabel = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (name, input, type) => {
536
+ };
537
+ var makeLabel = (name, input, type) => {
586
538
  return [
587
539
  name && `${_picocolors2.default.dim("[")}${name.toUpperCase()}${_picocolors2.default.dim("]")}`,
588
540
  colorize(type, input.toUpperCase())
589
541
  ].filter(Boolean).join(" ");
590
- }, "makeLabel");
542
+ };
591
543
  var silent = false;
592
544
  function setSilent(isSilent) {
593
545
  silent = !!isSilent;
594
546
  }
595
- _chunkQTR5272Scjs.__name.call(void 0, setSilent, "setSilent");
596
547
  function getSilent() {
597
548
  return silent;
598
549
  }
599
- _chunkQTR5272Scjs.__name.call(void 0, getSilent, "getSilent");
600
- var createLogger = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (name) => {
550
+ var createLogger = (name) => {
601
551
  return {
602
552
  setName(_name) {
603
553
  name = _name;
@@ -622,16 +572,10 @@ var require_chunk_VGC3FXLU = _chunkQTR5272Scjs.__commonJS.call(void 0, {
622
572
  switch (type) {
623
573
  case "error": {
624
574
  if (!_worker_threads.isMainThread) {
625
- _optionalChain([
626
- _worker_threads.parentPort,
627
- "optionalAccess",
628
- (_) => _.postMessage,
629
- "call",
630
- (_2) => _2({
631
- type: "error",
632
- text: _util2.default.format(...args)
633
- })
634
- ]);
575
+ _optionalChain([_worker_threads.parentPort, "optionalAccess", (_) => _.postMessage, "call", (_2) => _2({
576
+ type: "error",
577
+ text: _util2.default.format(...args)
578
+ })]);
635
579
  return;
636
580
  }
637
581
  return console.error(...args);
@@ -639,54 +583,43 @@ var require_chunk_VGC3FXLU = _chunkQTR5272Scjs.__commonJS.call(void 0, {
639
583
  default:
640
584
  if (silent) return;
641
585
  if (!_worker_threads.isMainThread) {
642
- _optionalChain([
643
- _worker_threads.parentPort,
644
- "optionalAccess",
645
- (_3) => _3.postMessage,
646
- "call",
647
- (_4) => _4({
648
- type: "log",
649
- text: _util2.default.format(...args)
650
- })
651
- ]);
586
+ _optionalChain([_worker_threads.parentPort, "optionalAccess", (_3) => _3.postMessage, "call", (_4) => _4({
587
+ type: "log",
588
+ text: _util2.default.format(...args)
589
+ })]);
652
590
  return;
653
591
  }
654
592
  console.log(...args);
655
593
  }
656
594
  }
657
595
  };
658
- }, "createLogger");
659
- var prettyBytes = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (bytes) => {
596
+ };
597
+ var prettyBytes = (bytes) => {
660
598
  if (bytes === 0) return "0 B";
661
- const unit = [
662
- "B",
663
- "KB",
664
- "MB",
665
- "GB",
666
- "TB",
667
- "PB",
668
- "EB",
669
- "ZB",
670
- "YB"
671
- ];
599
+ const unit = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
672
600
  const exp = Math.floor(Math.log(bytes) / Math.log(1024));
673
601
  return `${(bytes / 1024 ** exp).toFixed(2)} ${unit[exp]}`;
674
- }, "prettyBytes");
675
- var getLengthOfLongestString = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (strings) => {
602
+ };
603
+ var getLengthOfLongestString = (strings) => {
676
604
  return strings.reduce((max, str) => {
677
605
  return Math.max(max, str.length);
678
606
  }, 0);
679
- }, "getLengthOfLongestString");
680
- var padRight = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (str, maxLength) => {
607
+ };
608
+ var padRight = (str, maxLength) => {
681
609
  return str + " ".repeat(maxLength - str.length);
682
- }, "padRight");
683
- var reportSize = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (logger, format, files) => {
610
+ };
611
+ var reportSize = (logger, format, files) => {
684
612
  const filenames = Object.keys(files);
685
613
  const maxLength = getLengthOfLongestString(filenames) + 1;
686
614
  for (const name of filenames) {
687
- logger.success(format, `${_picocolors2.default.bold(padRight(name, maxLength))}${_picocolors2.default.green(prettyBytes(files[name]))}`);
615
+ logger.success(
616
+ format,
617
+ `${_picocolors2.default.bold(padRight(name, maxLength))}${_picocolors2.default.green(
618
+ prettyBytes(files[name])
619
+ )}`
620
+ );
688
621
  }
689
- }, "reportSize");
622
+ };
690
623
  exports.loadTsupConfig = loadTsupConfig;
691
624
  exports.loadPkg = loadPkg;
692
625
  exports.getProductionDeps = getProductionDeps;
@@ -698,27 +631,19 @@ var require_chunk_VGC3FXLU = _chunkQTR5272Scjs.__commonJS.call(void 0, {
698
631
  }
699
632
  });
700
633
 
701
- // ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=f38aab44b872fc3814414c6a0e9d6e644f0efcadfc3a3eff3f293f7a0295534d__11c18a981686f6a33e045201f02415b6/node_modules/tsup/dist/chunk-JZ25TPTY.js
702
- var require_chunk_JZ25TPTY = _chunkQTR5272Scjs.__commonJS.call(void 0, {
703
- "../../node_modules/.pnpm/tsup@8.4.0_patch_hash=f38aab44b872fc3814414c6a0e9d6e644f0efcadfc3a3eff3f293f7a0295534d__11c18a981686f6a33e045201f02415b6/node_modules/tsup/dist/chunk-JZ25TPTY.js"(exports) {
634
+ // ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=616d4d8468728c5caa25e7b97fe871f667b5342103b43bda8e891020bc6b674a__e7bfd10e92d28211ce978b182e37e925/node_modules/tsup/dist/chunk-JZ25TPTY.js
635
+ var require_chunk_JZ25TPTY = _chunkJCICRU7Kcjs.__commonJS.call(void 0, {
636
+ "../../node_modules/.pnpm/tsup@8.4.0_patch_hash=616d4d8468728c5caa25e7b97fe871f667b5342103b43bda8e891020bc6b674a__e7bfd10e92d28211ce978b182e37e925/node_modules/tsup/dist/chunk-JZ25TPTY.js"(exports) {
704
637
  "use strict";
705
- _chunkQTR5272Scjs.init_cjs_shims.call(void 0, );
706
- Object.defineProperty(exports, "__esModule", {
707
- value: true
708
- });
638
+ _chunkJCICRU7Kcjs.init_cjs_shims.call(void 0, );
639
+ Object.defineProperty(exports, "__esModule", { value: true });
709
640
  function _interopRequireDefault(obj) {
710
- return obj && obj.__esModule ? obj : {
711
- default: obj
712
- };
641
+ return obj && obj.__esModule ? obj : { default: obj };
713
642
  }
714
- _chunkQTR5272Scjs.__name.call(void 0, _interopRequireDefault, "_interopRequireDefault");
715
- var _worker_threads = _chunkQTR5272Scjs.__require.call(void 0, "worker_threads");
716
- var _picocolors = _chunkQTR5272Scjs.__require.call(void 0, "picocolors");
643
+ var _worker_threads = _chunkJCICRU7Kcjs.__require.call(void 0, "worker_threads");
644
+ var _picocolors = _chunkJCICRU7Kcjs.__require.call(void 0, "picocolors");
717
645
  var _picocolors2 = _interopRequireDefault(_picocolors);
718
646
  var PrettyError = class extends Error {
719
- static {
720
- _chunkQTR5272Scjs.__name.call(void 0, this, "PrettyError");
721
- }
722
647
  constructor(message) {
723
648
  super(message);
724
649
  this.name = this.constructor.name;
@@ -731,7 +656,13 @@ var require_chunk_JZ25TPTY = _chunkQTR5272Scjs.__commonJS.call(void 0, {
731
656
  };
732
657
  function handleError(error) {
733
658
  if (error.loc) {
734
- console.error(_picocolors2.default.bold(_picocolors2.default.red(`Error parsing: ${error.loc.file}:${error.loc.line}:${error.loc.column}`)));
659
+ console.error(
660
+ _picocolors2.default.bold(
661
+ _picocolors2.default.red(
662
+ `Error parsing: ${error.loc.file}:${error.loc.line}:${error.loc.column}`
663
+ )
664
+ )
665
+ );
735
666
  }
736
667
  if (error.frame) {
737
668
  console.error(_picocolors2.default.red(error.message));
@@ -746,60 +677,49 @@ var require_chunk_JZ25TPTY = _chunkQTR5272Scjs.__commonJS.call(void 0, {
746
677
  _worker_threads.parentPort.postMessage("error");
747
678
  }
748
679
  }
749
- _chunkQTR5272Scjs.__name.call(void 0, handleError, "handleError");
750
680
  exports.PrettyError = PrettyError;
751
681
  exports.handleError = handleError;
752
682
  }
753
683
  });
754
684
 
755
- // ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=f38aab44b872fc3814414c6a0e9d6e644f0efcadfc3a3eff3f293f7a0295534d__11c18a981686f6a33e045201f02415b6/node_modules/tsup/dist/commonjs-plugin.js
756
- var require_commonjs_plugin = _chunkQTR5272Scjs.__commonJS.call(void 0, {
757
- "../../node_modules/.pnpm/tsup@8.4.0_patch_hash=f38aab44b872fc3814414c6a0e9d6e644f0efcadfc3a3eff3f293f7a0295534d__11c18a981686f6a33e045201f02415b6/node_modules/tsup/dist/commonjs-plugin.js"(exports, module) {
685
+ // ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=616d4d8468728c5caa25e7b97fe871f667b5342103b43bda8e891020bc6b674a__e7bfd10e92d28211ce978b182e37e925/node_modules/tsup/dist/commonjs-plugin.js
686
+ var require_commonjs_plugin = _chunkJCICRU7Kcjs.__commonJS.call(void 0, {
687
+ "../../node_modules/.pnpm/tsup@8.4.0_patch_hash=616d4d8468728c5caa25e7b97fe871f667b5342103b43bda8e891020bc6b674a__e7bfd10e92d28211ce978b182e37e925/node_modules/tsup/dist/commonjs-plugin.js"(exports, module) {
758
688
  "use strict";
759
- _chunkQTR5272Scjs.init_cjs_shims.call(void 0, );
689
+ _chunkJCICRU7Kcjs.init_cjs_shims.call(void 0, );
760
690
  var __defProp = Object.defineProperty;
761
691
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
762
692
  var __getOwnPropNames = Object.getOwnPropertyNames;
763
693
  var __hasOwnProp = Object.prototype.hasOwnProperty;
764
- var __export = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (target, all) => {
765
- for (var name in all) __defProp(target, name, {
766
- get: all[name],
767
- enumerable: true
768
- });
769
- }, "__export");
770
- var __copyProps = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (to, from, except, desc) => {
694
+ var __export = (target, all) => {
695
+ for (var name in all)
696
+ __defProp(target, name, { get: all[name], enumerable: true });
697
+ };
698
+ var __copyProps = (to, from, except, desc) => {
771
699
  if (from && typeof from === "object" || typeof from === "function") {
772
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
773
- get: /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, () => from[key], "get"),
774
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
775
- });
700
+ for (let key of __getOwnPropNames(from))
701
+ if (!__hasOwnProp.call(to, key) && key !== except)
702
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
776
703
  }
777
704
  return to;
778
- }, "__copyProps");
779
- var __toCommonJS = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (mod) => __copyProps(__defProp({}, "__esModule", {
780
- value: true
781
- }), mod), "__toCommonJS");
705
+ };
706
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
782
707
  var index_exports = {};
783
708
  __export(index_exports, {
784
- commonjs: /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, () => commonjs, "commonjs"),
785
- default: /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, () => index_default, "default")
709
+ commonjs: () => commonjs,
710
+ default: () => index_default
786
711
  });
787
712
  module.exports = __toCommonJS(index_exports);
788
- var import_fs = _chunkQTR5272Scjs.__require.call(void 0, "fs");
713
+ var import_fs = _chunkJCICRU7Kcjs.__require.call(void 0, "fs");
789
714
  function isNewLine(code) {
790
715
  return code === 10 || code === 13 || code === 8232 || code === 8233;
791
716
  }
792
- _chunkQTR5272Scjs.__name.call(void 0, isNewLine, "isNewLine");
793
717
  function codePointToString(ch) {
794
718
  if (ch <= 65535) return String.fromCharCode(ch);
795
719
  ch -= 65536;
796
720
  return String.fromCharCode((ch >> 10) + 55296, (ch & 1023) + 56320);
797
721
  }
798
- _chunkQTR5272Scjs.__name.call(void 0, codePointToString, "codePointToString");
799
722
  var Lexer = (_class2 = class {constructor() { _class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this); }
800
- static {
801
- _chunkQTR5272Scjs.__name.call(void 0, this, "Lexer");
802
- }
803
723
  __init2() {this.input = ""}
804
724
  __init3() {this.pos = 0}
805
725
  readString(input, pos) {
@@ -924,28 +844,24 @@ var require_commonjs_plugin = _chunkQTR5272Scjs.__commonJS.call(void 0, {
924
844
  for (let val of array) if (!visited.has(val)) visited.add(val), ret.push(val);
925
845
  return ret;
926
846
  }
927
- _chunkQTR5272Scjs.__name.call(void 0, orderedUniq, "orderedUniq");
928
847
  function cachedReduce(array, reducer, s) {
929
- let cache = [
930
- s
931
- ], cacheLen = 1, last = s;
848
+ let cache = [s], cacheLen = 1, last = s;
932
849
  return (len) => {
933
850
  while (cacheLen <= len) cacheLen = cache.push(last = reducer(last, array[cacheLen - 1]));
934
851
  return cache[len];
935
852
  };
936
853
  }
937
- _chunkQTR5272Scjs.__name.call(void 0, cachedReduce, "cachedReduce");
938
854
  var reservedWords = "break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public";
939
855
  var builtin = "arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl";
940
856
  var forbiddenIdentifiers = new Set(`${reservedWords} ${builtin}`.split(" "));
941
857
  forbiddenIdentifiers.add("");
942
- var makeLegalIdentifier = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, function makeLegalIdentifier2(str) {
858
+ var makeLegalIdentifier = function makeLegalIdentifier2(str) {
943
859
  let identifier = str.replace(/-(\w)/g, (_, letter) => letter.toUpperCase()).replace(/[^$_a-zA-Z0-9]/g, "_");
944
860
  if (/\d/.test(identifier[0]) || forbiddenIdentifiers.has(identifier)) {
945
861
  identifier = `_${identifier}`;
946
862
  }
947
863
  return identifier || "_";
948
- }, "makeLegalIdentifier2");
864
+ };
949
865
  function prepend(code, prefix) {
950
866
  if (code.startsWith("#!")) {
951
867
  const i = code.indexOf("\n") + 1;
@@ -953,8 +869,13 @@ var require_commonjs_plugin = _chunkQTR5272Scjs.__commonJS.call(void 0, {
953
869
  }
954
870
  return prefix + code;
955
871
  }
956
- _chunkQTR5272Scjs.__name.call(void 0, prepend, "prepend");
957
- function commonjs({ filter = /\.c?js$/, transform = false, transformConfig, requireReturnsDefault = false, ignore } = {}) {
872
+ function commonjs({
873
+ filter = /\.c?js$/,
874
+ transform = false,
875
+ transformConfig,
876
+ requireReturnsDefault = false,
877
+ ignore
878
+ } = {}) {
958
879
  const init_cjs_module_lexer = transform ? Promise.resolve().then(() => _interopRequireWildcard2(require("cjs-module-lexer"))) : void 0;
959
880
  const use_default_export = typeof requireReturnsDefault === "function" ? requireReturnsDefault : (_path) => requireReturnsDefault;
960
881
  const is_ignored = typeof ignore === "function" ? ignore : Array.isArray(ignore) ? (path) => ignore.includes(path) : () => false;
@@ -962,12 +883,10 @@ var require_commonjs_plugin = _chunkQTR5272Scjs.__commonJS.call(void 0, {
962
883
  name: "commonjs",
963
884
  setup({ onLoad, esbuild }) {
964
885
  let esbuild_shim;
965
- const require_esbuild = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, () => esbuild || esbuild_shim || (esbuild_shim = _chunkQTR5272Scjs.__require.call(void 0, "esbuild")), "require_esbuild");
886
+ const require_esbuild = () => esbuild || (esbuild_shim || (esbuild_shim = _chunkJCICRU7Kcjs.__require.call(void 0, "esbuild")));
966
887
  const read = import_fs.promises.readFile;
967
888
  const lexer = new Lexer();
968
- onLoad({
969
- filter
970
- }, async (args) => {
889
+ onLoad({ filter }, async (args) => {
971
890
  let parseCJS;
972
891
  if (init_cjs_module_lexer) {
973
892
  const { init, parse } = await init_cjs_module_lexer;
@@ -1000,10 +919,7 @@ var require_commonjs_plugin = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1000
919
  exports2 = orderedUniq(cjsExports.exports.concat(_nullishCoalesce2(exports2, () => ( []))));
1001
920
  _nullishCoalesce2(sideEffects, () => ( (sideEffects = _nullishCoalesce2((transformConfig == null ? void 0 : transformConfig.sideEffects), () => ( true)))));
1002
921
  let exportDefault = behavior === "node" ? "export default exports;" : "export default exports.__esModule ? exports.default : exports;";
1003
- let exportsMap = exports2.map((e) => [
1004
- e,
1005
- makeLegalIdentifier(e)
1006
- ]);
922
+ let exportsMap = exports2.map((e) => [e, makeLegalIdentifier(e)]);
1007
923
  if (exportsMap.some(([e]) => e === "default")) {
1008
924
  if (behavior === "node") {
1009
925
  exportsMap = exportsMap.filter(([e]) => e !== "default");
@@ -1023,7 +939,9 @@ var require_commonjs_plugin = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1023
939
  for (const [e, name] of exportsMap) {
1024
940
  transformed.push(`var ${name} = /* @__PURE__ */ (() => exports[${JSON.stringify(e)}])();`);
1025
941
  }
1026
- transformed.push(`export { ${exportsMap.map(([e, name]) => e === name ? e : `${name} as ${JSON.stringify(e)}`).join(", ")} };`);
942
+ transformed.push(
943
+ `export { ${exportsMap.map(([e, name]) => e === name ? e : `${name} as ${JSON.stringify(e)}`).join(", ")} };`
944
+ );
1027
945
  }
1028
946
  } else {
1029
947
  transformed = [
@@ -1031,7 +949,10 @@ var require_commonjs_plugin = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1031
949
  "}; exports = module.exports; " + exportDefault
1032
950
  ];
1033
951
  if (exportsMap.length > 0) {
1034
- transformed.push(`var { ${exportsMap.map(([e, name]) => e === name ? e : `${JSON.stringify(e)}: ${name}`).join(", ")} } = exports;`, `export { ${exportsMap.map(([e, name]) => e === name ? e : `${name} as ${JSON.stringify(e)}`).join(", ")} };`);
952
+ transformed.push(
953
+ `var { ${exportsMap.map(([e, name]) => e === name ? e : `${JSON.stringify(e)}: ${name}`).join(", ")} } = exports;`,
954
+ `export { ${exportsMap.map(([e, name]) => e === name ? e : `${name} as ${JSON.stringify(e)}`).join(", ")} };`
955
+ );
1035
956
  }
1036
957
  }
1037
958
  contents = transformed.join("\n") + (sourcemap ? "\n" + sourcemap : "");
@@ -1045,13 +966,9 @@ var require_commonjs_plugin = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1045
966
  }
1046
967
  return name;
1047
968
  }
1048
- _chunkQTR5272Scjs.__name.call(void 0, makeName, "makeName");
1049
969
  let warnings;
1050
970
  try {
1051
- ({ warnings } = await require_esbuild().transform(contents, {
1052
- format: "esm",
1053
- logLevel: "silent"
1054
- }));
971
+ ({ warnings } = await require_esbuild().transform(contents, { format: "esm", logLevel: "silent" }));
1055
972
  } catch (err) {
1056
973
  ({ warnings } = err);
1057
974
  }
@@ -1075,11 +992,7 @@ var require_commonjs_plugin = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1075
992
  import_statement = `import * as ${name} from ${JSON.stringify(path)};`;
1076
993
  }
1077
994
  let offset2 = getOffset(line - 1);
1078
- edits.push([
1079
- offset2 + column,
1080
- offset2 + rightBrace,
1081
- name
1082
- ]);
995
+ edits.push([offset2 + column, offset2 + rightBrace, name]);
1083
996
  imports.push(import_statement);
1084
997
  }
1085
998
  if (imports.length === 0) return null;
@@ -1089,31 +1002,23 @@ var require_commonjs_plugin = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1089
1002
  contents = contents.slice(0, start + offset) + name + contents.slice(end + offset);
1090
1003
  offset += name.length - (end - start);
1091
1004
  }
1092
- contents = prepend(contents, [
1093
- ...imports,
1094
- cjsExports ? "exports;" : ""
1095
- ].join(""));
1096
- return {
1097
- contents
1098
- };
1005
+ contents = prepend(contents, [...imports, cjsExports ? "exports;" : ""].join(""));
1006
+ return { contents };
1099
1007
  }
1100
1008
  });
1101
1009
  }
1102
1010
  };
1103
1011
  }
1104
- _chunkQTR5272Scjs.__name.call(void 0, commonjs, "commonjs");
1105
1012
  var index_default = commonjs;
1106
1013
  }
1107
1014
  });
1108
1015
 
1109
- // ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=f38aab44b872fc3814414c6a0e9d6e644f0efcadfc3a3eff3f293f7a0295534d__11c18a981686f6a33e045201f02415b6/node_modules/tsup/dist/index.js
1110
- var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1111
- "../../node_modules/.pnpm/tsup@8.4.0_patch_hash=f38aab44b872fc3814414c6a0e9d6e644f0efcadfc3a3eff3f293f7a0295534d__11c18a981686f6a33e045201f02415b6/node_modules/tsup/dist/index.js"(exports) {
1016
+ // ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=616d4d8468728c5caa25e7b97fe871f667b5342103b43bda8e891020bc6b674a__e7bfd10e92d28211ce978b182e37e925/node_modules/tsup/dist/index.js
1017
+ var require_dist = _chunkJCICRU7Kcjs.__commonJS.call(void 0, {
1018
+ "../../node_modules/.pnpm/tsup@8.4.0_patch_hash=616d4d8468728c5caa25e7b97fe871f667b5342103b43bda8e891020bc6b674a__e7bfd10e92d28211ce978b182e37e925/node_modules/tsup/dist/index.js"(exports) {
1112
1019
  "use strict";
1113
- _chunkQTR5272Scjs.init_cjs_shims.call(void 0, );
1114
- Object.defineProperty(exports, "__esModule", {
1115
- value: true
1116
- });
1020
+ _chunkJCICRU7Kcjs.init_cjs_shims.call(void 0, );
1021
+ Object.defineProperty(exports, "__esModule", { value: true });
1117
1022
  function _interopRequireWildcard(obj) {
1118
1023
  if (obj && obj.__esModule) {
1119
1024
  return obj;
@@ -1130,13 +1035,9 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1130
1035
  return newObj;
1131
1036
  }
1132
1037
  }
1133
- _chunkQTR5272Scjs.__name.call(void 0, _interopRequireWildcard, "_interopRequireWildcard");
1134
1038
  function _interopRequireDefault(obj) {
1135
- return obj && obj.__esModule ? obj : {
1136
- default: obj
1137
- };
1039
+ return obj && obj.__esModule ? obj : { default: obj };
1138
1040
  }
1139
- _chunkQTR5272Scjs.__name.call(void 0, _interopRequireDefault, "_interopRequireDefault");
1140
1041
  function _nullishCoalesce(lhs, rhsFn) {
1141
1042
  if (lhs != null) {
1142
1043
  return lhs;
@@ -1144,7 +1045,6 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1144
1045
  return rhsFn();
1145
1046
  }
1146
1047
  }
1147
- _chunkQTR5272Scjs.__name.call(void 0, _nullishCoalesce, "_nullishCoalesce");
1148
1048
  function _optionalChain(ops) {
1149
1049
  let lastAccessLHS = void 0;
1150
1050
  let value = ops[0];
@@ -1166,50 +1066,58 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1166
1066
  }
1167
1067
  return value;
1168
1068
  }
1169
- _chunkQTR5272Scjs.__name.call(void 0, _optionalChain, "_optionalChain");
1170
1069
  var _class;
1171
1070
  var _chunkBYH4XDRHjs = require_chunk_BYH4XDRH();
1172
1071
  var _chunkVGC3FXLUjs = require_chunk_VGC3FXLU();
1173
1072
  var _chunkJZ25TPTYjs = require_chunk_JZ25TPTY();
1174
1073
  var _chunkTWFEYLU4js = require_chunk_TWFEYLU4();
1175
1074
  var _commonjsPluginjs = require_commonjs_plugin();
1176
- var _path = _chunkQTR5272Scjs.__require.call(void 0, "path");
1075
+ var _path = _chunkJCICRU7Kcjs.__require.call(void 0, "path");
1177
1076
  var _path2 = _interopRequireDefault(_path);
1178
- var _fs = _chunkQTR5272Scjs.__require.call(void 0, "fs");
1077
+ var _fs = _chunkJCICRU7Kcjs.__require.call(void 0, "fs");
1179
1078
  var _fs2 = _interopRequireDefault(_fs);
1180
- var _worker_threads = _chunkQTR5272Scjs.__require.call(void 0, "worker_threads");
1181
- var _bundlerequire = _chunkQTR5272Scjs.__require.call(void 0, "bundle-require");
1182
- var _tinyexec = _chunkQTR5272Scjs.__require.call(void 0, "tinyexec");
1183
- var _tinyglobby = _chunkQTR5272Scjs.__require.call(void 0, "tinyglobby");
1184
- var _treekill = _chunkQTR5272Scjs.__require.call(void 0, "tree-kill");
1079
+ var _worker_threads = _chunkJCICRU7Kcjs.__require.call(void 0, "worker_threads");
1080
+ var _bundlerequire = _chunkJCICRU7Kcjs.__require.call(void 0, "bundle-require");
1081
+ var _tinyexec = _chunkJCICRU7Kcjs.__require.call(void 0, "tinyexec");
1082
+ var _tinyglobby = _chunkJCICRU7Kcjs.__require.call(void 0, "tinyglobby");
1083
+ var _treekill = _chunkJCICRU7Kcjs.__require.call(void 0, "tree-kill");
1185
1084
  var _treekill2 = _interopRequireDefault(_treekill);
1186
- var _esbuild = _chunkQTR5272Scjs.__require.call(void 0, "esbuild");
1187
- var _consola = _chunkQTR5272Scjs.__require.call(void 0, "consola");
1085
+ var _esbuild = _chunkJCICRU7Kcjs.__require.call(void 0, "esbuild");
1086
+ var _consola = _chunkJCICRU7Kcjs.__require.call(void 0, "consola");
1188
1087
  var _consola2 = _interopRequireDefault(_consola);
1189
- var nodeProtocolPlugin = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, () => {
1088
+ var nodeProtocolPlugin = () => {
1190
1089
  const nodeProtocol = "node:";
1191
1090
  return {
1192
1091
  name: "node-protocol-plugin",
1193
1092
  setup({ onResolve }) {
1194
- onResolve({
1195
- filter: /^node:/
1196
- }, ({ path: path12 }) => ({
1197
- path: path12.slice(nodeProtocol.length),
1198
- external: true
1199
- }));
1093
+ onResolve(
1094
+ {
1095
+ filter: /^node:/
1096
+ },
1097
+ ({ path: path12 }) => ({
1098
+ path: path12.slice(nodeProtocol.length),
1099
+ external: true
1100
+ })
1101
+ );
1200
1102
  }
1201
1103
  };
1202
- }, "nodeProtocolPlugin");
1104
+ };
1203
1105
  var NON_NODE_MODULE_RE = /^[A-Z]:[/\\]|^\.{0,2}\/|^\.{1,2}$/;
1204
- var externalPlugin = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, ({ external, noExternal, skipNodeModulesBundle, tsconfigResolvePaths }) => {
1106
+ var externalPlugin = ({
1107
+ external,
1108
+ noExternal,
1109
+ skipNodeModulesBundle,
1110
+ tsconfigResolvePaths
1111
+ }) => {
1205
1112
  return {
1206
1113
  name: `external`,
1207
1114
  setup(build2) {
1208
1115
  if (skipNodeModulesBundle) {
1209
- const resolvePatterns = _bundlerequire.tsconfigPathsToRegExp.call(void 0, tsconfigResolvePaths || {});
1210
- build2.onResolve({
1211
- filter: /.*/
1212
- }, (args) => {
1116
+ const resolvePatterns = _bundlerequire.tsconfigPathsToRegExp.call(
1117
+ void 0,
1118
+ tsconfigResolvePaths || {}
1119
+ );
1120
+ build2.onResolve({ filter: /.*/ }, (args) => {
1213
1121
  if (_bundlerequire.match.call(void 0, args.path, resolvePatterns)) {
1214
1122
  return;
1215
1123
  }
@@ -1217,9 +1125,7 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1217
1125
  return;
1218
1126
  }
1219
1127
  if (_bundlerequire.match.call(void 0, args.path, external)) {
1220
- return {
1221
- external: true
1222
- };
1128
+ return { external: true };
1223
1129
  }
1224
1130
  if (!NON_NODE_MODULE_RE.test(args.path)) {
1225
1131
  return {
@@ -1229,62 +1135,54 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1229
1135
  }
1230
1136
  });
1231
1137
  } else {
1232
- build2.onResolve({
1233
- filter: /.*/
1234
- }, (args) => {
1138
+ build2.onResolve({ filter: /.*/ }, (args) => {
1235
1139
  if (_bundlerequire.match.call(void 0, args.path, noExternal)) {
1236
1140
  return;
1237
1141
  }
1238
1142
  if (_bundlerequire.match.call(void 0, args.path, external)) {
1239
- return {
1240
- external: true
1241
- };
1143
+ return { external: true };
1242
1144
  }
1243
1145
  });
1244
1146
  }
1245
1147
  }
1246
1148
  };
1247
- }, "externalPlugin");
1248
- var postcssPlugin = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, ({ options: options1, css, inject, cssLoader }) => {
1149
+ };
1150
+ var postcssPlugin = ({
1151
+ options: options2,
1152
+ css,
1153
+ inject,
1154
+ cssLoader
1155
+ }) => {
1249
1156
  return {
1250
1157
  name: "postcss",
1251
1158
  setup(build2) {
1252
1159
  let configCache;
1253
- const getPostcssConfig = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, async () => {
1160
+ const getPostcssConfig = async () => {
1254
1161
  const loadConfig = _chunkTWFEYLU4js.__require.call(void 0, "postcss-load-config");
1255
1162
  if (configCache) {
1256
1163
  return configCache;
1257
1164
  }
1258
1165
  try {
1259
- const result = await loadConfig({}, _optionalChain2([options1, 'access', _44 => _44.workspaceConfig, 'optionalAccess', _45 => _45.workspaceRoot]) || process.cwd());
1166
+ const result = await loadConfig({}, _optionalChain2([options2, 'access', _44 => _44.workspaceConfig, 'optionalAccess', _45 => _45.workspaceRoot]) || process.cwd());
1260
1167
  configCache = result;
1261
1168
  return result;
1262
1169
  } catch (error) {
1263
1170
  if (error.message.includes("No PostCSS Config found in")) {
1264
- const result = {
1265
- plugins: [],
1266
- options: {}
1267
- };
1171
+ const result = { plugins: [], options: {} };
1268
1172
  return result;
1269
1173
  }
1270
1174
  throw error;
1271
1175
  }
1272
- }, "getPostcssConfig");
1273
- build2.onResolve({
1274
- filter: /^#style-inject$/
1275
- }, () => {
1276
- return {
1277
- path: "#style-inject",
1278
- namespace: "#style-inject"
1279
- };
1176
+ };
1177
+ build2.onResolve({ filter: /^#style-inject$/ }, () => {
1178
+ return { path: "#style-inject", namespace: "#style-inject" };
1280
1179
  });
1281
- build2.onLoad({
1282
- filter: /^#style-inject$/,
1283
- namespace: "#style-inject"
1284
- }, () => {
1285
- return {
1286
- // Taken from https://github.com/egoist/style-inject/blob/master/src/index.js (MIT)
1287
- contents: `
1180
+ build2.onLoad(
1181
+ { filter: /^#style-inject$/, namespace: "#style-inject" },
1182
+ () => {
1183
+ return {
1184
+ // Taken from https://github.com/egoist/style-inject/blob/master/src/index.js (MIT)
1185
+ contents: `
1288
1186
  export default function styleInject(css, { insertAt } = {}) {
1289
1187
  if (!css || typeof document === 'undefined') return
1290
1188
 
@@ -1309,19 +1207,18 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1309
1207
  }
1310
1208
  }
1311
1209
  `,
1312
- loader: "js"
1313
- };
1314
- });
1315
- build2.onLoad({
1316
- filter: /\.css$/
1317
- }, async (args) => {
1210
+ loader: "js"
1211
+ };
1212
+ }
1213
+ );
1214
+ build2.onLoad({ filter: /\.css$/ }, async (args) => {
1318
1215
  let contents;
1319
1216
  if (css && args.path.endsWith(".svelte.css")) {
1320
1217
  contents = css.get(args.path);
1321
1218
  } else {
1322
1219
  contents = await _fs2.default.promises.readFile(args.path, "utf8");
1323
1220
  }
1324
- const { plugins, options: options12 } = await getPostcssConfig();
1221
+ const { plugins, options: options3 } = await getPostcssConfig();
1325
1222
  if (plugins && plugins.length > 0) {
1326
1223
  const postcss = _chunkTWFEYLU4js.getPostcss.call(void 0);
1327
1224
  if (!postcss) {
@@ -1333,20 +1230,7 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1333
1230
  ]
1334
1231
  };
1335
1232
  }
1336
- const result = await _optionalChain([
1337
- postcss,
1338
- "optionalAccess",
1339
- (_2) => _2.default,
1340
- "call",
1341
- (_3) => _3(plugins),
1342
- "access",
1343
- (_4) => _4.process,
1344
- "call",
1345
- (_5) => _5(contents, {
1346
- ...options12,
1347
- from: args.path
1348
- })
1349
- ]);
1233
+ const result = await _optionalChain([postcss, "optionalAccess", (_2) => _2.default, "call", (_3) => _3(plugins), "access", (_4) => _4.process, "call", (_5) => _5(contents, { ...options3, from: args.path })]);
1350
1234
  contents = result.css;
1351
1235
  }
1352
1236
  if (inject) {
@@ -1358,7 +1242,9 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1358
1242
  logLevel: build2.initialOptions.logLevel,
1359
1243
  loader: "css"
1360
1244
  })).code;
1361
- contents = typeof inject === "function" ? await inject(JSON.stringify(contents), args.path) : `import styleInject from '#style-inject';styleInject(${JSON.stringify(contents)})`;
1245
+ contents = typeof inject === "function" ? await inject(JSON.stringify(contents), args.path) : `import styleInject from '#style-inject';styleInject(${JSON.stringify(
1246
+ contents
1247
+ )})`;
1362
1248
  return {
1363
1249
  contents,
1364
1250
  loader: "js"
@@ -1371,37 +1257,35 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1371
1257
  });
1372
1258
  }
1373
1259
  };
1374
- }, "postcssPlugin");
1375
- var useSvelteCssExtension = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (p) => p.replace(/\.svelte$/, ".svelte.css"), "useSvelteCssExtension");
1376
- var sveltePlugin = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, ({ css, options: options1 }) => {
1260
+ };
1261
+ var useSvelteCssExtension = (p) => p.replace(/\.svelte$/, ".svelte.css");
1262
+ var sveltePlugin = ({
1263
+ css,
1264
+ options: options2
1265
+ }) => {
1377
1266
  return {
1378
1267
  name: "svelte",
1379
1268
  setup(build2) {
1380
1269
  let svelte;
1381
1270
  let sveltePreprocessor;
1382
- build2.onResolve({
1383
- filter: /\.svelte\.css$/
1384
- }, (args) => {
1271
+ build2.onResolve({ filter: /\.svelte\.css$/ }, (args) => {
1385
1272
  return {
1386
- path: _path2.default.relative(_optionalChain2([options1, 'access', _46 => _46.workspaceConfig, 'optionalAccess', _47 => _47.workspaceRoot]) || process.cwd(), _path2.default.join(args.resolveDir, args.path)),
1273
+ path: _path2.default.relative(
1274
+ _optionalChain2([options2, 'access', _46 => _46.workspaceConfig, 'optionalAccess', _47 => _47.workspaceRoot]) || process.cwd(),
1275
+ _path2.default.join(args.resolveDir, args.path)
1276
+ ),
1387
1277
  namespace: "svelte-css"
1388
1278
  };
1389
1279
  });
1390
- build2.onLoad({
1391
- filter: /\.svelte$/
1392
- }, async (args) => {
1280
+ build2.onLoad({ filter: /\.svelte$/ }, async (args) => {
1393
1281
  svelte = svelte || _chunkTWFEYLU4js.localRequire.call(void 0, "svelte/compiler");
1394
1282
  sveltePreprocessor = sveltePreprocessor || _chunkTWFEYLU4js.localRequire.call(void 0, "svelte-preprocess");
1395
1283
  if (!svelte) {
1396
1284
  return {
1397
- errors: [
1398
- {
1399
- text: `You need to install "svelte" in your project`
1400
- }
1401
- ]
1285
+ errors: [{ text: `You need to install "svelte" in your project` }]
1402
1286
  };
1403
1287
  }
1404
- const convertMessage = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, ({ message, start, end }) => {
1288
+ const convertMessage = ({ message, start, end }) => {
1405
1289
  let location;
1406
1290
  if (start && end) {
1407
1291
  const lineText = source.split(/\r\n|\r|\n/g)[start.line - 1];
@@ -1414,45 +1298,44 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1414
1298
  lineText
1415
1299
  };
1416
1300
  }
1417
- return {
1418
- text: message,
1419
- location
1420
- };
1421
- }, "convertMessage");
1301
+ return { text: message, location };
1302
+ };
1422
1303
  const source = await _fs2.default.promises.readFile(args.path, "utf8");
1423
- const filename = _path2.default.relative(_optionalChain2([options1, 'access', _48 => _48.workspaceConfig, 'optionalAccess', _49 => _49.workspaceRoot]) || process.cwd(), args.path);
1304
+ const filename = _path2.default.relative(_optionalChain2([options2, 'access', _48 => _48.workspaceConfig, 'optionalAccess', _49 => _49.workspaceRoot]) || process.cwd(), args.path);
1424
1305
  try {
1425
- const preprocess = await svelte.preprocess(source, sveltePreprocessor ? sveltePreprocessor({
1426
- sourceMap: true,
1427
- typescript: {
1428
- compilerOptions: {
1429
- verbatimModuleSyntax: true
1306
+ const preprocess = await svelte.preprocess(
1307
+ source,
1308
+ sveltePreprocessor ? sveltePreprocessor({
1309
+ sourceMap: true,
1310
+ typescript: {
1311
+ compilerOptions: {
1312
+ verbatimModuleSyntax: true
1313
+ }
1430
1314
  }
1315
+ }) : {
1316
+ async script({ content, attributes }) {
1317
+ if (attributes.lang !== "ts") return { code: content };
1318
+ const { code, map } = await _esbuild.transform.call(void 0, content, {
1319
+ sourcefile: args.path,
1320
+ loader: "ts",
1321
+ sourcemap: true,
1322
+ tsconfigRaw: {
1323
+ compilerOptions: {
1324
+ verbatimModuleSyntax: true
1325
+ }
1326
+ },
1327
+ logLevel: build2.initialOptions.logLevel
1328
+ });
1329
+ return {
1330
+ code,
1331
+ map
1332
+ };
1333
+ }
1334
+ },
1335
+ {
1336
+ filename: args.path
1431
1337
  }
1432
- }) : {
1433
- async script({ content, attributes }) {
1434
- if (attributes.lang !== "ts") return {
1435
- code: content
1436
- };
1437
- const { code, map } = await _esbuild.transform.call(void 0, content, {
1438
- sourcefile: args.path,
1439
- loader: "ts",
1440
- sourcemap: true,
1441
- tsconfigRaw: {
1442
- compilerOptions: {
1443
- verbatimModuleSyntax: true
1444
- }
1445
- },
1446
- logLevel: build2.initialOptions.logLevel
1447
- });
1448
- return {
1449
- code,
1450
- map
1451
- };
1452
- }
1453
- }, {
1454
- filename: args.path
1455
- });
1338
+ );
1456
1339
  const result = svelte.compile(preprocess.code, {
1457
1340
  filename,
1458
1341
  css: "external"
@@ -1463,80 +1346,21 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1463
1346
  css.set(cssPath, result.css.code);
1464
1347
  contents = `import '${useSvelteCssExtension(_path2.default.basename(args.path))}';${contents}`;
1465
1348
  }
1466
- return {
1467
- contents,
1468
- warnings: result.warnings.map(convertMessage)
1469
- };
1349
+ return { contents, warnings: result.warnings.map(convertMessage) };
1470
1350
  } catch (error) {
1471
- return {
1472
- errors: [
1473
- convertMessage(error)
1474
- ]
1475
- };
1476
- }
1477
- });
1478
- }
1479
- };
1480
- }, "sveltePlugin");
1481
- var swcPlugin = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, ({ logger: logger3 }) => {
1482
- return {
1483
- name: "swc",
1484
- setup(build2) {
1485
- const swc = _chunkTWFEYLU4js.localRequire.call(void 0, "@swc/core");
1486
- if (!swc) {
1487
- logger3.warn(build2.initialOptions.format, `You have emitDecoratorMetadata enabled but @swc/core was not installed, skipping swc plugin`);
1488
- return;
1489
- }
1490
- build2.initialOptions.keepNames = true;
1491
- build2.onLoad({
1492
- filter: /\.[jt]sx?$/
1493
- }, async (args) => {
1494
- const isTs = /\.tsx?$/.test(args.path);
1495
- const jsc = {
1496
- parser: {
1497
- syntax: isTs ? "typescript" : "ecmascript",
1498
- decorators: true
1499
- },
1500
- transform: {
1501
- legacyDecorator: true,
1502
- decoratorMetadata: true
1503
- },
1504
- keepClassNames: true,
1505
- target: "es2022"
1506
- };
1507
- const result = await swc.transformFile(args.path, {
1508
- jsc,
1509
- sourceMaps: true,
1510
- configFile: false,
1511
- swcrc: false
1512
- });
1513
- let code = result.code;
1514
- if (result.map) {
1515
- const map = JSON.parse(result.map);
1516
- map.sources = map.sources.map((source) => {
1517
- return _path2.default.isAbsolute(source) ? _path2.default.relative(_path2.default.dirname(args.path), source) : source;
1518
- });
1519
- code += `//# sourceMappingURL=data:application/json;base64,${Buffer.from(JSON.stringify(map)).toString("base64")}`;
1351
+ return { errors: [convertMessage(error)] };
1520
1352
  }
1521
- return {
1522
- contents: code
1523
- };
1524
1353
  });
1525
1354
  }
1526
1355
  };
1527
- }, "swcPlugin");
1528
- var nativeNodeModulesPlugin = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, () => {
1356
+ };
1357
+ var nativeNodeModulesPlugin = () => {
1529
1358
  return {
1530
1359
  name: "native-node-modules",
1531
1360
  setup(build2) {
1532
- build2.onResolve({
1533
- filter: /\.node$/,
1534
- namespace: "file"
1535
- }, (args) => {
1361
+ build2.onResolve({ filter: /\.node$/, namespace: "file" }, (args) => {
1536
1362
  const resolvedId = _chunkTWFEYLU4js.__require.resolve(args.path, {
1537
- paths: [
1538
- args.resolveDir
1539
- ]
1363
+ paths: [args.resolveDir]
1540
1364
  });
1541
1365
  if (resolvedId.endsWith(".node")) {
1542
1366
  return {
@@ -1548,10 +1372,7 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1548
1372
  path: resolvedId
1549
1373
  };
1550
1374
  });
1551
- build2.onLoad({
1552
- filter: /.*/,
1553
- namespace: "node-file"
1554
- }, (args) => {
1375
+ build2.onLoad({ filter: /.*/, namespace: "node-file" }, (args) => {
1555
1376
  return {
1556
1377
  contents: `
1557
1378
  import path from ${JSON.stringify(args.path)}
@@ -1561,35 +1382,28 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1561
1382
  resolveDir: _path2.default.dirname(args.path)
1562
1383
  };
1563
1384
  });
1564
- build2.onResolve({
1565
- filter: /\.node$/,
1566
- namespace: "node-file"
1567
- }, (args) => ({
1568
- path: args.path,
1569
- namespace: "file"
1570
- }));
1385
+ build2.onResolve(
1386
+ { filter: /\.node$/, namespace: "node-file" },
1387
+ (args) => ({
1388
+ path: args.path,
1389
+ namespace: "file"
1390
+ })
1391
+ );
1571
1392
  const opts = build2.initialOptions;
1572
1393
  opts.loader = opts.loader || {};
1573
1394
  opts.loader[".node"] = "file";
1574
1395
  }
1575
1396
  };
1576
- }, "nativeNodeModulesPlugin");
1577
- var getOutputExtensionMap = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (options1, format, pkgType) => {
1578
- const outExtension = options1.outExtension || _chunkTWFEYLU4js.defaultOutExtension;
1579
- const defaultExtension = _chunkTWFEYLU4js.defaultOutExtension.call(void 0, {
1580
- format,
1581
- pkgType
1582
- });
1583
- const extension = outExtension({
1584
- options: options1,
1585
- format,
1586
- pkgType
1587
- });
1397
+ };
1398
+ var getOutputExtensionMap = (options2, format, pkgType) => {
1399
+ const outExtension = options2.outExtension || _chunkTWFEYLU4js.defaultOutExtension;
1400
+ const defaultExtension = _chunkTWFEYLU4js.defaultOutExtension.call(void 0, { format, pkgType });
1401
+ const extension = outExtension({ options: options2, format, pkgType });
1588
1402
  return {
1589
1403
  ".js": extension.js || defaultExtension.js
1590
1404
  };
1591
- }, "getOutputExtensionMap");
1592
- var generateExternal = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, async (external) => {
1405
+ };
1406
+ var generateExternal = async (external) => {
1593
1407
  const result = [];
1594
1408
  for (const item of external) {
1595
1409
  if (typeof item !== "string" || !item.endsWith("package.json")) {
@@ -1601,49 +1415,53 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1601
1415
  result.push(...deps);
1602
1416
  }
1603
1417
  return result;
1604
- }, "generateExternal");
1605
- async function runEsbuild(options1, { format, css, logger: logger3, buildDependencies, pluginContainer }) {
1606
- const pkg = await _chunkVGC3FXLUjs.loadPkg.call(void 0, _optionalChain2([options1, 'access', _52 => _52.workspaceConfig, 'optionalAccess', _53 => _53.workspaceRoot]) || process.cwd());
1607
- const deps = await _chunkVGC3FXLUjs.getProductionDeps.call(void 0, _optionalChain2([options1, 'access', _54 => _54.workspaceConfig, 'optionalAccess', _55 => _55.workspaceRoot]) || process.cwd());
1418
+ };
1419
+ async function runEsbuild(options2, {
1420
+ format,
1421
+ css,
1422
+ logger: logger3,
1423
+ buildDependencies,
1424
+ pluginContainer
1425
+ }) {
1426
+ const pkg = await _chunkVGC3FXLUjs.loadPkg.call(void 0, _optionalChain2([options2, 'access', _52 => _52.workspaceConfig, 'optionalAccess', _53 => _53.workspaceRoot]) || process.cwd());
1427
+ const deps = await _chunkVGC3FXLUjs.getProductionDeps.call(void 0, _optionalChain2([options2, 'access', _54 => _54.workspaceConfig, 'optionalAccess', _55 => _55.workspaceRoot]) || process.cwd());
1608
1428
  const external = [
1609
1429
  // Exclude dependencies, e.g. `lodash`, `lodash/get`
1610
1430
  ...deps.map((dep) => new RegExp(`^${dep}($|\\/|\\\\)`)),
1611
- ...await generateExternal(options1.external || [])
1431
+ ...await generateExternal(options2.external || [])
1612
1432
  ];
1613
- const outDir = options1.outDir;
1614
- const outExtension = getOutputExtensionMap(options1, format, pkg.type);
1433
+ const outDir = options2.outDir;
1434
+ const outExtension = getOutputExtensionMap(options2, format, pkg.type);
1615
1435
  const env = {
1616
- ...options1.env
1436
+ ...options2.env
1617
1437
  };
1618
- if (options1.replaceNodeEnv) {
1619
- env.NODE_ENV = options1.minify || options1.minifyWhitespace ? "production" : "development";
1438
+ if (options2.replaceNodeEnv) {
1439
+ env.NODE_ENV = options2.minify || options2.minifyWhitespace ? "production" : "development";
1620
1440
  }
1621
1441
  logger3.info(format, "Build start");
1622
1442
  const startTime = Date.now();
1623
1443
  let result;
1624
- const splitting = format === "iife" ? false : typeof options1.splitting === "boolean" ? options1.splitting : format === "esm";
1625
- const platform = options1.platform || "node";
1626
- const loader = options1.loader || {};
1627
- const injectShims = options1.shims;
1628
- const bundle = typeof options1.bundle === "undefined" ? true : options1.bundle;
1444
+ const splitting = format === "iife" ? false : typeof options2.splitting === "boolean" ? options2.splitting : format === "esm";
1445
+ const platform = options2.platform || "node";
1446
+ const loader = options2.loader || {};
1447
+ const injectShims = options2.shims;
1448
+ const bundle = typeof options2.bundle === "undefined" ? true : options2.bundle;
1629
1449
  pluginContainer.setContext({
1630
1450
  format,
1631
1451
  splitting,
1632
- options: options1,
1452
+ options: options2,
1633
1453
  logger: logger3
1634
1454
  });
1635
1455
  await pluginContainer.buildStarted();
1636
1456
  const esbuildPlugins = [
1637
- format === "cjs" && options1.removeNodeProtocol && nodeProtocolPlugin(),
1457
+ format === "cjs" && options2.removeNodeProtocol && nodeProtocolPlugin(),
1638
1458
  format === "esm" && bundle && _commonjsPluginjs.commonjs.call(void 0),
1639
1459
  {
1640
1460
  name: "modify-options",
1641
1461
  setup(build2) {
1642
1462
  pluginContainer.modifyEsbuildOptions(build2.initialOptions);
1643
- if (options1.esbuildOptions) {
1644
- options1.esbuildOptions(build2.initialOptions, {
1645
- format
1646
- });
1463
+ if (options2.esbuildOptions) {
1464
+ options2.esbuildOptions(build2.initialOptions, { format });
1647
1465
  }
1648
1466
  }
1649
1467
  },
@@ -1651,46 +1469,37 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1651
1469
  // So here we use a custom plugin to implement it
1652
1470
  format !== "iife" && externalPlugin({
1653
1471
  external,
1654
- noExternal: options1.noExternal,
1655
- skipNodeModulesBundle: options1.skipNodeModulesBundle,
1656
- tsconfigResolvePaths: options1.tsconfigResolvePaths
1657
- }),
1658
- options1.tsconfigDecoratorMetadata && swcPlugin({
1659
- logger: logger3
1472
+ noExternal: options2.noExternal,
1473
+ skipNodeModulesBundle: options2.skipNodeModulesBundle,
1474
+ tsconfigResolvePaths: options2.tsconfigResolvePaths
1660
1475
  }),
1476
+ // options.tsconfigDecoratorMetadata && swcPlugin({ logger: logger3 }),
1661
1477
  nativeNodeModulesPlugin(),
1662
1478
  postcssPlugin({
1663
- options: options1,
1479
+ options: options2,
1664
1480
  css,
1665
- inject: options1.injectStyle,
1481
+ inject: options2.injectStyle,
1666
1482
  cssLoader: loader[".css"]
1667
1483
  }),
1668
- sveltePlugin({
1669
- css,
1670
- options: options1
1671
- }),
1672
- ...options1.esbuildPlugins || []
1484
+ sveltePlugin({ css, options: options2 }),
1485
+ ...options2.esbuildPlugins || []
1673
1486
  ];
1674
- const banner = typeof options1.banner === "function" ? options1.banner({
1675
- format
1676
- }) : options1.banner;
1677
- const footer = typeof options1.footer === "function" ? options1.footer({
1678
- format
1679
- }) : options1.footer;
1487
+ const banner = typeof options2.banner === "function" ? options2.banner({ format }) : options2.banner;
1488
+ const footer = typeof options2.footer === "function" ? options2.footer({ format }) : options2.footer;
1680
1489
  try {
1681
1490
  result = await _esbuild.build.call(void 0, {
1682
- entryPoints: options1.entry,
1683
- format: format === "cjs" && splitting || options1.treeshake ? "esm" : format,
1491
+ entryPoints: options2.entry,
1492
+ format: format === "cjs" && splitting || options2.treeshake ? "esm" : format,
1684
1493
  bundle,
1685
1494
  platform,
1686
- globalName: options1.globalName,
1687
- jsxFactory: options1.jsxFactory,
1688
- jsxFragment: options1.jsxFragment,
1689
- sourcemap: options1.sourcemap ? "external" : false,
1690
- target: options1.target,
1495
+ globalName: options2.globalName,
1496
+ jsxFactory: options2.jsxFactory,
1497
+ jsxFragment: options2.jsxFragment,
1498
+ sourcemap: options2.sourcemap ? "external" : false,
1499
+ target: options2.target,
1691
1500
  banner,
1692
1501
  footer,
1693
- tsconfig: options1.tsconfig,
1502
+ tsconfig: options2.tsconfig,
1694
1503
  loader: {
1695
1504
  ".aac": "file",
1696
1505
  ".css": "file",
@@ -1713,21 +1522,14 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1713
1522
  ".woff2": "file",
1714
1523
  ...loader
1715
1524
  },
1716
- mainFields: platform === "node" ? [
1717
- "module",
1718
- "main"
1719
- ] : [
1720
- "browser",
1721
- "module",
1722
- "main"
1723
- ],
1525
+ mainFields: platform === "node" ? ["module", "main"] : ["browser", "module", "main"],
1724
1526
  plugins: esbuildPlugins.filter(_chunkTWFEYLU4js.truthy),
1725
1527
  define: {
1726
1528
  TSUP_FORMAT: JSON.stringify(format),
1727
1529
  ...format === "cjs" && injectShims ? {
1728
1530
  "import.meta.url": "importMetaUrl"
1729
1531
  } : {},
1730
- ...options1.define,
1532
+ ...options2.define,
1731
1533
  ...Object.keys(env).reduce((res, key) => {
1732
1534
  const value = JSON.stringify(env[key]);
1733
1535
  return {
@@ -1740,21 +1542,19 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1740
1542
  inject: [
1741
1543
  format === "cjs" && injectShims ? _path2.default.join(__dirname, "../assets/cjs_shims.js") : "",
1742
1544
  format === "esm" && injectShims && platform === "node" ? _path2.default.join(__dirname, "../assets/esm_shims.js") : "",
1743
- ...options1.inject || []
1545
+ ...options2.inject || []
1744
1546
  ].filter(Boolean),
1745
- outdir: options1.legacyOutput && format !== "cjs" ? _path2.default.join(outDir, format) : outDir,
1746
- outExtension: options1.legacyOutput ? void 0 : outExtension,
1547
+ outdir: options2.legacyOutput && format !== "cjs" ? _path2.default.join(outDir, format) : outDir,
1548
+ outExtension: options2.legacyOutput ? void 0 : outExtension,
1747
1549
  write: false,
1748
1550
  splitting,
1749
1551
  logLevel: "error",
1750
- minify: options1.minify === "terser" ? false : options1.minify,
1751
- minifyWhitespace: options1.minifyWhitespace,
1752
- minifyIdentifiers: options1.minifyIdentifiers,
1753
- minifySyntax: options1.minifySyntax,
1754
- keepNames: options1.keepNames,
1755
- pure: typeof options1.pure === "string" ? [
1756
- options1.pure
1757
- ] : options1.pure,
1552
+ minify: options2.minify === "terser" ? false : options2.minify,
1553
+ minifyWhitespace: options2.minifyWhitespace,
1554
+ minifyIdentifiers: options2.minifyIdentifiers,
1555
+ minifySyntax: options2.minifySyntax,
1556
+ keepNames: options2.keepNames,
1557
+ pure: typeof options2.pure === "string" ? [options2.pure] : options2.pure,
1758
1558
  metafile: true
1759
1559
  });
1760
1560
  } catch (error) {
@@ -1763,7 +1563,10 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1763
1563
  }
1764
1564
  if (result && result.warnings && !_chunkVGC3FXLUjs.getSilent.call(void 0)) {
1765
1565
  const messages = result.warnings.filter((warning) => {
1766
- if (warning.text.includes(`This call to "require" will not be bundled because`) || warning.text.includes(`Indirect calls to "require" will not be bundled`)) return false;
1566
+ if (warning.text.includes(
1567
+ `This call to "require" will not be bundled because`
1568
+ ) || warning.text.includes(`Indirect calls to "require" will not be bundled`))
1569
+ return false;
1767
1570
  return true;
1768
1571
  });
1769
1572
  const formatted = await _esbuild.formatMessages.call(void 0, messages, {
@@ -1776,7 +1579,7 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1776
1579
  }
1777
1580
  if (result && result.outputFiles) {
1778
1581
  await pluginContainer.buildFinished({
1779
- options: options1,
1582
+ options: options2,
1780
1583
  outputFiles: result.outputFiles,
1781
1584
  metafile: result.metafile
1782
1585
  });
@@ -1787,17 +1590,18 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1787
1590
  for (const file of Object.keys(result.metafile.inputs)) {
1788
1591
  buildDependencies.add(file);
1789
1592
  }
1790
- if (options1.metafile) {
1593
+ if (options2.metafile) {
1791
1594
  const outPath = _path2.default.resolve(outDir, `metafile-${format}.json`);
1792
- await _fs2.default.promises.mkdir(_path2.default.dirname(outPath), {
1793
- recursive: true
1794
- });
1795
- await _fs2.default.promises.writeFile(outPath, JSON.stringify(result.metafile), "utf8");
1595
+ await _fs2.default.promises.mkdir(_path2.default.dirname(outPath), { recursive: true });
1596
+ await _fs2.default.promises.writeFile(
1597
+ outPath,
1598
+ JSON.stringify(result.metafile),
1599
+ "utf8"
1600
+ );
1796
1601
  }
1797
1602
  }
1798
1603
  }
1799
- _chunkQTR5272Scjs.__name.call(void 0, runEsbuild, "runEsbuild");
1800
- var shebang = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, () => {
1604
+ var shebang = () => {
1801
1605
  return {
1802
1606
  name: "shebang",
1803
1607
  renderChunk(_, info) {
@@ -1806,8 +1610,8 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1806
1610
  }
1807
1611
  }
1808
1612
  };
1809
- }, "shebang");
1810
- var cjsSplitting = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, () => {
1613
+ };
1614
+ var cjsSplitting = () => {
1811
1615
  return {
1812
1616
  name: "cjs-splitting",
1813
1617
  async renderChunk(code, info) {
@@ -1815,12 +1619,10 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1815
1619
  this.format !== "cjs" || info.type !== "chunk" || !/\.(js|cjs)$/.test(info.path)) {
1816
1620
  return;
1817
1621
  }
1818
- const { transform: transform3 } = await Promise.resolve().then(() => _interopRequireWildcard(_chunkQTR5272Scjs.__require.call(void 0, "sucrase")));
1622
+ const { transform: transform3 } = await Promise.resolve().then(() => _interopRequireWildcard(_chunkJCICRU7Kcjs.__require.call(void 0, "sucrase")));
1819
1623
  const result = transform3(code, {
1820
1624
  filePath: info.path,
1821
- transforms: [
1822
- "imports"
1823
- ],
1625
+ transforms: ["imports"],
1824
1626
  sourceMapOptions: this.options.sourcemap ? {
1825
1627
  compiledFilename: info.path
1826
1628
  } : void 0
@@ -1831,19 +1633,15 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1831
1633
  };
1832
1634
  }
1833
1635
  };
1834
- }, "cjsSplitting");
1835
- var _sourcemap = _chunkQTR5272Scjs.__require.call(void 0, "source-map");
1836
- var outputFile = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, async (filepath, data, options1) => {
1837
- await _fs2.default.promises.mkdir(_path2.default.dirname(filepath), {
1838
- recursive: true
1839
- });
1840
- await _fs2.default.promises.writeFile(filepath, data, options1);
1841
- }, "outputFile");
1636
+ };
1637
+ var _sourcemap = _chunkJCICRU7Kcjs.__require.call(void 0, "source-map");
1638
+ var outputFile = async (filepath, data, options2) => {
1639
+ await _fs2.default.promises.mkdir(_path2.default.dirname(filepath), { recursive: true });
1640
+ await _fs2.default.promises.writeFile(filepath, data, options2);
1641
+ };
1842
1642
  function copyDirSync(srcDir, destDir) {
1843
1643
  if (!_fs2.default.existsSync(srcDir)) return;
1844
- _fs2.default.mkdirSync(destDir, {
1845
- recursive: true
1846
- });
1644
+ _fs2.default.mkdirSync(destDir, { recursive: true });
1847
1645
  for (const file of _fs2.default.readdirSync(srcDir)) {
1848
1646
  const srcFile = _path2.default.resolve(srcDir, file);
1849
1647
  if (srcFile === destDir) {
@@ -1858,16 +1656,12 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1858
1656
  }
1859
1657
  }
1860
1658
  }
1861
- _chunkQTR5272Scjs.__name.call(void 0, copyDirSync, "copyDirSync");
1862
- var parseSourceMap = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (map) => {
1659
+ var parseSourceMap = (map) => {
1863
1660
  return typeof map === "string" ? JSON.parse(map) : map;
1864
- }, "parseSourceMap");
1865
- var isJS = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (path12) => /\.(js|mjs|cjs)$/.test(path12), "isJS");
1866
- var isCSS = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (path12) => /\.css$/.test(path12), "isCSS");
1661
+ };
1662
+ var isJS = (path12) => /\.(js|mjs|cjs)$/.test(path12);
1663
+ var isCSS = (path12) => /\.css$/.test(path12);
1867
1664
  var PluginContainer = class {
1868
- static {
1869
- _chunkQTR5272Scjs.__name.call(void 0, this, "PluginContainer");
1870
- }
1871
1665
  constructor(plugins) {
1872
1666
  this.plugins = plugins;
1873
1667
  }
@@ -1878,10 +1672,10 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1878
1672
  if (!this.context) throw new Error(`Plugin context is not set`);
1879
1673
  return this.context;
1880
1674
  }
1881
- modifyEsbuildOptions(options1) {
1675
+ modifyEsbuildOptions(options2) {
1882
1676
  for (const plugin of this.plugins) {
1883
1677
  if (plugin.esbuildOptions) {
1884
- plugin.esbuildOptions.call(this.getContext(), options1);
1678
+ plugin.esbuildOptions.call(this.getContext(), options2);
1885
1679
  }
1886
1680
  }
1887
1681
  }
@@ -1892,130 +1686,116 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
1892
1686
  }
1893
1687
  }
1894
1688
  }
1895
- async buildFinished({ options: options1, outputFiles, metafile }) {
1689
+ async buildFinished({
1690
+ options: options2,
1691
+ outputFiles,
1692
+ metafile
1693
+ }) {
1896
1694
  const files = outputFiles.filter((file) => !file.path.endsWith(".map")).map((file) => {
1897
1695
  if (isJS(file.path) || isCSS(file.path)) {
1898
- const relativePath = _chunkTWFEYLU4js.slash.call(void 0, _path2.default.relative(_optionalChain2([options1, 'access', _56 => _56.workspaceConfig, 'optionalAccess', _57 => _57.workspaceRoot]) || process.cwd(), file.path));
1899
- const meta = _optionalChain([
1900
- metafile,
1901
- "optionalAccess",
1902
- (_6) => _6.outputs,
1903
- "access",
1904
- (_7) => _7[relativePath]
1905
- ]);
1696
+ const relativePath = _chunkTWFEYLU4js.slash.call(void 0, _path2.default.relative(_optionalChain2([options2, 'access', _56 => _56.workspaceConfig, 'optionalAccess', _57 => _57.workspaceRoot]) || process.cwd(), file.path));
1697
+ const meta = _optionalChain([metafile, "optionalAccess", (_6) => _6.outputs, "access", (_7) => _7[relativePath]]);
1906
1698
  return {
1907
1699
  type: "chunk",
1908
1700
  path: file.path,
1909
1701
  code: file.text,
1910
- map: _optionalChain([
1911
- outputFiles,
1912
- "access",
1913
- (_8) => _8.find,
1914
- "call",
1915
- (_9) => _9((f) => f.path === `${file.path}.map`),
1916
- "optionalAccess",
1917
- (_10) => _10.text
1918
- ]),
1919
- entryPoint: _optionalChain([
1920
- meta,
1921
- "optionalAccess",
1922
- (_11) => _11.entryPoint
1923
- ]),
1924
- exports: _optionalChain([
1925
- meta,
1926
- "optionalAccess",
1927
- (_12) => _12.exports
1928
- ]),
1929
- imports: _optionalChain([
1930
- meta,
1931
- "optionalAccess",
1932
- (_13) => _13.imports
1933
- ])
1702
+ map: _optionalChain([outputFiles, "access", (_8) => _8.find, "call", (_9) => _9((f) => f.path === `${file.path}.map`), "optionalAccess", (_10) => _10.text]),
1703
+ entryPoint: _optionalChain([meta, "optionalAccess", (_11) => _11.entryPoint]),
1704
+ exports: _optionalChain([meta, "optionalAccess", (_12) => _12.exports]),
1705
+ imports: _optionalChain([meta, "optionalAccess", (_13) => _13.imports])
1934
1706
  };
1935
1707
  } else {
1936
- return {
1937
- type: "asset",
1938
- path: file.path,
1939
- contents: file.contents
1940
- };
1708
+ return { type: "asset", path: file.path, contents: file.contents };
1941
1709
  }
1942
1710
  });
1943
1711
  const writtenFiles = [];
1944
- await Promise.all(files.map(async (info) => {
1945
- for (const plugin of this.plugins) {
1946
- if (info.type === "chunk" && plugin.renderChunk) {
1947
- const result = await plugin.renderChunk.call(this.getContext(), info.code, info);
1948
- if (result) {
1949
- info.code = result.code;
1950
- if (result.map) {
1951
- const originalConsumer = await new (0, _sourcemap.SourceMapConsumer)(parseSourceMap(info.map));
1952
- const newConsumer = await new (0, _sourcemap.SourceMapConsumer)(parseSourceMap(result.map));
1953
- const generator = _sourcemap.SourceMapGenerator.fromSourceMap(newConsumer);
1954
- generator.applySourceMap(originalConsumer, info.path);
1955
- info.map = generator.toJSON();
1956
- originalConsumer.destroy();
1957
- newConsumer.destroy();
1712
+ await Promise.all(
1713
+ files.map(async (info) => {
1714
+ for (const plugin of this.plugins) {
1715
+ if (info.type === "chunk" && plugin.renderChunk) {
1716
+ const result = await plugin.renderChunk.call(
1717
+ this.getContext(),
1718
+ info.code,
1719
+ info
1720
+ );
1721
+ if (result) {
1722
+ info.code = result.code;
1723
+ if (result.map) {
1724
+ const originalConsumer = await new (0, _sourcemap.SourceMapConsumer)(
1725
+ parseSourceMap(info.map)
1726
+ );
1727
+ const newConsumer = await new (0, _sourcemap.SourceMapConsumer)(
1728
+ parseSourceMap(result.map)
1729
+ );
1730
+ const generator = _sourcemap.SourceMapGenerator.fromSourceMap(newConsumer);
1731
+ generator.applySourceMap(originalConsumer, info.path);
1732
+ info.map = generator.toJSON();
1733
+ originalConsumer.destroy();
1734
+ newConsumer.destroy();
1735
+ }
1958
1736
  }
1959
1737
  }
1960
1738
  }
1961
- }
1962
- const inlineSourceMap = this.context.options.sourcemap === "inline";
1963
- const contents = info.type === "chunk" ? info.code + getSourcemapComment(inlineSourceMap, info.map, info.path, isCSS(info.path)) : info.contents;
1964
- await outputFile(info.path, contents, {
1965
- mode: info.type === "chunk" ? info.mode : void 0
1966
- });
1967
- writtenFiles.push({
1968
- get name() {
1969
- return _path2.default.relative(_optionalChain2([options1, 'access', _58 => _58.workspaceConfig, 'optionalAccess', _59 => _59.workspaceRoot]) || process.cwd(), info.path);
1970
- },
1971
- get size() {
1972
- return contents.length;
1973
- }
1974
- });
1975
- if (info.type === "chunk" && info.map && !inlineSourceMap) {
1976
- const map = typeof info.map === "string" ? JSON.parse(info.map) : info.map;
1977
- const outPath = `${info.path}.map`;
1978
- const contents2 = JSON.stringify(map);
1979
- await outputFile(outPath, contents2);
1739
+ const inlineSourceMap = this.context.options.sourcemap === "inline";
1740
+ const contents = info.type === "chunk" ? info.code + getSourcemapComment(
1741
+ inlineSourceMap,
1742
+ info.map,
1743
+ info.path,
1744
+ isCSS(info.path)
1745
+ ) : info.contents;
1746
+ await outputFile(info.path, contents, {
1747
+ mode: info.type === "chunk" ? info.mode : void 0
1748
+ });
1980
1749
  writtenFiles.push({
1981
1750
  get name() {
1982
- return _path2.default.relative(_optionalChain2([options1, 'access', _60 => _60.workspaceConfig, 'optionalAccess', _61 => _61.workspaceRoot]) || process.cwd(), outPath);
1751
+ return _path2.default.relative(_optionalChain2([options2, 'access', _58 => _58.workspaceConfig, 'optionalAccess', _59 => _59.workspaceRoot]) || process.cwd(), info.path);
1983
1752
  },
1984
1753
  get size() {
1985
- return contents2.length;
1754
+ return contents.length;
1986
1755
  }
1987
1756
  });
1988
- }
1989
- }));
1757
+ if (info.type === "chunk" && info.map && !inlineSourceMap) {
1758
+ const map = typeof info.map === "string" ? JSON.parse(info.map) : info.map;
1759
+ const outPath = `${info.path}.map`;
1760
+ const contents2 = JSON.stringify(map);
1761
+ await outputFile(outPath, contents2);
1762
+ writtenFiles.push({
1763
+ get name() {
1764
+ return _path2.default.relative(_optionalChain2([options2, 'access', _60 => _60.workspaceConfig, 'optionalAccess', _61 => _61.workspaceRoot]) || process.cwd(), outPath);
1765
+ },
1766
+ get size() {
1767
+ return contents2.length;
1768
+ }
1769
+ });
1770
+ }
1771
+ })
1772
+ );
1990
1773
  for (const plugin of this.plugins) {
1991
1774
  if (plugin.buildEnd) {
1992
- await plugin.buildEnd.call(this.getContext(), {
1993
- writtenFiles
1994
- });
1775
+ await plugin.buildEnd.call(this.getContext(), { writtenFiles });
1995
1776
  }
1996
1777
  }
1997
1778
  }
1998
1779
  };
1999
- var getSourcemapComment = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (inline, map, filepath, isCssFile) => {
1780
+ var getSourcemapComment = (inline, map, filepath, isCssFile) => {
2000
1781
  if (!map) return "";
2001
1782
  const prefix = isCssFile ? "/*" : "//";
2002
1783
  const suffix = isCssFile ? " */" : "";
2003
- const url = inline ? `data:application/json;base64,${Buffer.from(typeof map === "string" ? map : JSON.stringify(map)).toString("base64")}` : `${_path2.default.basename(filepath)}.map`;
1784
+ const url = inline ? `data:application/json;base64,${Buffer.from(
1785
+ typeof map === "string" ? map : JSON.stringify(map)
1786
+ ).toString("base64")}` : `${_path2.default.basename(filepath)}.map`;
2004
1787
  return `${prefix}# sourceMappingURL=${url}${suffix}`;
2005
- }, "getSourcemapComment");
2006
- var TARGETS = [
2007
- "es5",
2008
- "es3"
2009
- ];
2010
- var swcTarget = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, () => {
1788
+ };
1789
+ var TARGETS = ["es5", "es3"];
1790
+ var swcTarget = () => {
2011
1791
  let enabled = false;
2012
1792
  let target;
2013
1793
  return {
2014
1794
  name: "swc-target",
2015
- esbuildOptions(options1) {
2016
- if (typeof options1.target === "string" && TARGETS.includes(options1.target)) {
2017
- target = options1.target;
2018
- options1.target = "es2020";
1795
+ esbuildOptions(options2) {
1796
+ if (typeof options2.target === "string" && TARGETS.includes(options2.target)) {
1797
+ target = options2.target;
1798
+ options2.target = "es2020";
2019
1799
  enabled = true;
2020
1800
  }
2021
1801
  },
@@ -2025,7 +1805,9 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
2025
1805
  }
2026
1806
  const swc = _chunkTWFEYLU4js.localRequire.call(void 0, "@swc/core");
2027
1807
  if (!swc) {
2028
- throw new (0, _chunkJZ25TPTYjs.PrettyError)(`@swc/core is required for ${target} target. Please install it with \`npm install @swc/core -D\``);
1808
+ throw new (0, _chunkJZ25TPTYjs.PrettyError)(
1809
+ `@swc/core is required for ${target} target. Please install it with \`npm install @swc/core -D\``
1810
+ );
2029
1811
  }
2030
1812
  const result = await swc.transform(code, {
2031
1813
  filename: info.path,
@@ -2039,9 +1821,7 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
2039
1821
  minify: this.options.minify === true ? {
2040
1822
  compress: false,
2041
1823
  mangle: {
2042
- reserved: this.options.globalName ? [
2043
- this.options.globalName
2044
- ] : []
1824
+ reserved: this.options.globalName ? [this.options.globalName] : []
2045
1825
  }
2046
1826
  } : void 0
2047
1827
  },
@@ -2055,30 +1835,37 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
2055
1835
  };
2056
1836
  }
2057
1837
  };
2058
- }, "swcTarget");
2059
- var sizeReporter = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, () => {
1838
+ };
1839
+ var sizeReporter = () => {
2060
1840
  return {
2061
1841
  name: "size-reporter",
2062
1842
  buildEnd({ writtenFiles }) {
2063
- _chunkVGC3FXLUjs.reportSize.call(void 0, this.logger, this.format, writtenFiles.reduce((res, file) => {
2064
- return {
2065
- ...res,
2066
- [file.name]: file.size
2067
- };
2068
- }, {}));
1843
+ _chunkVGC3FXLUjs.reportSize.call(
1844
+ void 0,
1845
+ this.logger,
1846
+ this.format,
1847
+ writtenFiles.reduce((res, file) => {
1848
+ return {
1849
+ ...res,
1850
+ [file.name]: file.size
1851
+ };
1852
+ }, {})
1853
+ );
2069
1854
  }
2070
1855
  };
2071
- }, "sizeReporter");
2072
- var _rollup = _chunkQTR5272Scjs.__require.call(void 0, "rollup");
2073
- var treeShakingPlugin = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, ({ treeshake, name, silent }) => {
1856
+ };
1857
+ var _rollup = _chunkJCICRU7Kcjs.__require.call(void 0, "rollup");
1858
+ var treeShakingPlugin = ({
1859
+ treeshake,
1860
+ name,
1861
+ silent
1862
+ }) => {
2074
1863
  return {
2075
1864
  name: "tree-shaking",
2076
1865
  async renderChunk(code, info) {
2077
1866
  if (!treeshake || !/\.(cjs|js|mjs)$/.test(info.path)) return;
2078
1867
  const bundle = await _rollup.rollup.call(void 0, {
2079
- input: [
2080
- info.path
2081
- ],
1868
+ input: [info.path],
2082
1869
  plugins: [
2083
1870
  {
2084
1871
  name: "tsup",
@@ -2087,10 +1874,7 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
2087
1874
  return false;
2088
1875
  },
2089
1876
  load(id) {
2090
- if (id === info.path) return {
2091
- code,
2092
- map: info.map
2093
- };
1877
+ if (id === info.path) return { code, map: info.map };
2094
1878
  }
2095
1879
  }
2096
1880
  ],
@@ -2118,24 +1902,36 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
2118
1902
  }
2119
1903
  }
2120
1904
  };
2121
- }, "treeShakingPlugin");
2122
- var copyPublicDir = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (publicDir, outDir) => {
1905
+ };
1906
+ var copyPublicDir = (publicDir, outDir) => {
2123
1907
  if (!publicDir) return;
2124
1908
  copyDirSync(_path2.default.resolve(publicDir === true ? "public" : publicDir), outDir);
2125
- }, "copyPublicDir");
2126
- var isInPublicDir = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (publicDir, filePath) => {
1909
+ };
1910
+ var isInPublicDir = (publicDir, filePath) => {
2127
1911
  if (!publicDir) return false;
2128
- const publicPath = _chunkTWFEYLU4js.slash.call(void 0, _path2.default.resolve(publicDir === true ? "public" : publicDir));
1912
+ const publicPath = _chunkTWFEYLU4js.slash.call(
1913
+ void 0,
1914
+ _path2.default.resolve(publicDir === true ? "public" : publicDir)
1915
+ );
2129
1916
  return _chunkTWFEYLU4js.slash.call(void 0, _path2.default.resolve(filePath)).startsWith(`${publicPath}/`);
2130
- }, "isInPublicDir");
2131
- var terserPlugin = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, ({ minifyOptions, format, terserOptions = {}, globalName, logger: logger3 }) => {
1917
+ };
1918
+ var terserPlugin = ({
1919
+ minifyOptions,
1920
+ format,
1921
+ terserOptions = {},
1922
+ globalName,
1923
+ logger: logger3
1924
+ }) => {
2132
1925
  return {
2133
1926
  name: "terser",
2134
1927
  async renderChunk(code, info) {
2135
- if (minifyOptions !== "terser" || !/\.(cjs|js|mjs)$/.test(info.path)) return;
1928
+ if (minifyOptions !== "terser" || !/\.(cjs|js|mjs)$/.test(info.path))
1929
+ return;
2136
1930
  const terser = _chunkTWFEYLU4js.localRequire.call(void 0, "terser");
2137
1931
  if (!terser) {
2138
- throw new (0, _chunkJZ25TPTYjs.PrettyError)("terser is required for terser minification. Please install it with `npm install terser -D`");
1932
+ throw new (0, _chunkJZ25TPTYjs.PrettyError)(
1933
+ "terser is required for terser minification. Please install it with `npm install terser -D`"
1934
+ );
2139
1935
  }
2140
1936
  const { minify } = terser;
2141
1937
  const defaultOptions = {};
@@ -2145,39 +1941,28 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
2145
1941
  defaultOptions.toplevel = true;
2146
1942
  }
2147
1943
  try {
2148
- const minifiedOutput = await minify({
2149
- [info.path]: code
2150
- }, {
2151
- ...defaultOptions,
2152
- ...terserOptions
2153
- });
1944
+ const minifiedOutput = await minify(
1945
+ { [info.path]: code },
1946
+ { ...defaultOptions, ...terserOptions }
1947
+ );
2154
1948
  logger3.info("TERSER", "Minifying with Terser");
2155
1949
  if (!minifiedOutput.code) {
2156
1950
  logger3.error("TERSER", "Failed to minify with terser");
2157
1951
  }
2158
1952
  logger3.success("TERSER", "Terser Minification success");
2159
- return {
2160
- code: minifiedOutput.code,
2161
- map: minifiedOutput.map
2162
- };
1953
+ return { code: minifiedOutput.code, map: minifiedOutput.map };
2163
1954
  } catch (error) {
2164
1955
  logger3.error("TERSER", "Failed to minify with terser");
2165
1956
  logger3.error("TERSER", error);
2166
1957
  }
2167
- return {
2168
- code,
2169
- map: info.map
2170
- };
1958
+ return { code, map: info.map };
2171
1959
  }
2172
1960
  };
2173
- }, "terserPlugin");
2174
- var _typescript = _chunkQTR5272Scjs.__require.call(void 0, "typescript");
1961
+ };
1962
+ var _typescript = _chunkJCICRU7Kcjs.__require.call(void 0, "typescript");
2175
1963
  var _typescript2 = _interopRequireDefault(_typescript);
2176
1964
  var logger = _chunkVGC3FXLUjs.createLogger.call(void 0);
2177
1965
  var AliasPool = (_class = class {
2178
- static {
2179
- _chunkQTR5272Scjs.__name.call(void 0, this, "_class");
2180
- }
2181
1966
  constructor() {
2182
1967
  _class.prototype.__init.call(this);
2183
1968
  }
@@ -2190,7 +1975,9 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
2190
1975
  while (this.seen.has(alias)) {
2191
1976
  alias = `${name}_alias_${++suffix}`;
2192
1977
  if (suffix >= 1e3) {
2193
- throw new Error("Alias generation exceeded limit. Possible infinite loop detected.");
1978
+ throw new Error(
1979
+ "Alias generation exceeded limit. Possible infinite loop detected."
1980
+ );
2194
1981
  }
2195
1982
  }
2196
1983
  this.seen.add(alias);
@@ -2216,11 +2003,11 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
2216
2003
  if (!moduleSymbol) {
2217
2004
  return [];
2218
2005
  }
2219
- const exports1 = [];
2006
+ const exports2 = [];
2220
2007
  const exportSymbols = checker.getExportsOfModule(moduleSymbol);
2221
2008
  exportSymbols.forEach((symbol) => {
2222
2009
  const name = symbol.getName();
2223
- exports1.push({
2010
+ exports2.push({
2224
2011
  kind: "named",
2225
2012
  sourceFileName,
2226
2013
  destFileName,
@@ -2229,54 +2016,67 @@ var require_dist = _chunkQTR5272Scjs.__commonJS.call(void 0, {
2229
2016
  isTypeOnly: false
2230
2017
  });
2231
2018
  });
2232
- return exports1;
2019
+ return exports2;
2233
2020
  }
2234
- _chunkQTR5272Scjs.__name.call(void 0, extractExports, "extractExports");
2235
2021
  return program.getRootFileNames().flatMap(extractExports);
2236
2022
  }
2237
- _chunkQTR5272Scjs.__name.call(void 0, getExports, "getExports");
2238
2023
  function emitDtsFiles(program, host) {
2239
2024
  const fileMapping = /* @__PURE__ */ new Map();
2240
- const writeFile = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
2241
- const sourceFile = _optionalChain([
2242
- sourceFiles,
2243
- "optionalAccess",
2244
- (_14) => _14[0]
2245
- ]);
2246
- const sourceFileName = _optionalChain([
2247
- sourceFile,
2248
- "optionalAccess",
2249
- (_15) => _15.fileName
2250
- ]);
2025
+ const writeFile = (fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
2026
+ const sourceFile = _optionalChain([sourceFiles, "optionalAccess", (_14) => _14[0]]);
2027
+ const sourceFileName = _optionalChain([sourceFile, "optionalAccess", (_15) => _15.fileName]);
2251
2028
  if (sourceFileName && !fileName.endsWith(".map")) {
2252
2029
  const cwd = program.getCurrentDirectory();
2253
- fileMapping.set(_chunkTWFEYLU4js.toAbsolutePath.call(void 0, sourceFileName, cwd), _chunkTWFEYLU4js.toAbsolutePath.call(void 0, fileName, cwd));
2030
+ fileMapping.set(
2031
+ _chunkTWFEYLU4js.toAbsolutePath.call(void 0, sourceFileName, cwd),
2032
+ _chunkTWFEYLU4js.toAbsolutePath.call(void 0, fileName, cwd)
2033
+ );
2254
2034
  }
2255
- return host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
2256
- }, "writeFile");
2035
+ return host.writeFile(
2036
+ fileName,
2037
+ text,
2038
+ writeByteOrderMark,
2039
+ onError,
2040
+ sourceFiles,
2041
+ data
2042
+ );
2043
+ };
2257
2044
  const emitResult = program.emit(void 0, writeFile, void 0, true);
2258
2045
  const diagnostics = _typescript2.default.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
2259
2046
  const diagnosticMessages = [];
2260
2047
  diagnostics.forEach((diagnostic) => {
2261
2048
  if (diagnostic.file) {
2262
- const { line, character } = _typescript2.default.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
2263
- const message = _typescript2.default.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
2264
- diagnosticMessages.push(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
2049
+ const { line, character } = _typescript2.default.getLineAndCharacterOfPosition(
2050
+ diagnostic.file,
2051
+ diagnostic.start
2052
+ );
2053
+ const message = _typescript2.default.flattenDiagnosticMessageText(
2054
+ diagnostic.messageText,
2055
+ "\n"
2056
+ );
2057
+ diagnosticMessages.push(
2058
+ `${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`
2059
+ );
2265
2060
  } else {
2266
- const message = _typescript2.default.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
2061
+ const message = _typescript2.default.flattenDiagnosticMessageText(
2062
+ diagnostic.messageText,
2063
+ "\n"
2064
+ );
2267
2065
  diagnosticMessages.push(message);
2268
2066
  }
2269
2067
  });
2270
2068
  const diagnosticMessage = diagnosticMessages.join("\n");
2271
2069
  if (diagnosticMessage) {
2272
- logger.error("TSC", `Failed to emit declaration files.
2070
+ logger.error(
2071
+ "TSC",
2072
+ `Failed to emit declaration files.
2273
2073
 
2274
- ${diagnosticMessage}`);
2074
+ ${diagnosticMessage}`
2075
+ );
2275
2076
  throw new Error("TypeScript compilation failed");
2276
2077
  }
2277
2078
  return fileMapping;
2278
2079
  }
2279
- _chunkQTR5272Scjs.__name.call(void 0, emitDtsFiles, "emitDtsFiles");
2280
2080
  function emit(compilerOptions, tsconfig, _options) {
2281
2081
  const cwd = _optionalChain2([_options, 'access', _62 => _62.workspaceConfig, 'optionalAccess', _63 => _63.workspaceRoot]) || process.cwd();
2282
2082
  let rawTsconfig = _bundlerequire.loadTsConfig.call(void 0, cwd, tsconfig.replace(cwd, ""));
@@ -2287,60 +2087,66 @@ ${diagnosticMessage}`);
2287
2087
  }
2288
2088
  }
2289
2089
  const declarationDir = _chunkTWFEYLU4js.ensureTempDeclarationDir.call(void 0, _options);
2290
- const parsedTsconfig = _typescript2.default.parseJsonConfigFileContent({
2291
- ...rawTsconfig.data,
2292
- compilerOptions: {
2293
- ..._optionalChain([
2294
- rawTsconfig,
2295
- "access",
2296
- (_16) => _16.data,
2297
- "optionalAccess",
2298
- (_17) => _17.compilerOptions
2299
- ]),
2300
- ...compilerOptions,
2301
- // Enable declaration emit and disable javascript emit
2302
- noEmit: false,
2303
- declaration: true,
2304
- declarationMap: true,
2305
- declarationDir,
2306
- emitDeclarationOnly: true
2307
- }
2308
- }, _typescript2.default.sys, tsconfig ? _path.dirname.call(void 0, tsconfig) : "./");
2309
- const options1 = parsedTsconfig.options;
2310
- const host = _typescript2.default.createCompilerHost(options1);
2311
- const program = _typescript2.default.createProgram(parsedTsconfig.fileNames, options1, host);
2090
+ const parsedTsconfig = _typescript2.default.parseJsonConfigFileContent(
2091
+ {
2092
+ ...rawTsconfig.data,
2093
+ compilerOptions: {
2094
+ ..._optionalChain([rawTsconfig, "access", (_16) => _16.data, "optionalAccess", (_17) => _17.compilerOptions]),
2095
+ ...compilerOptions,
2096
+ // Enable declaration emit and disable javascript emit
2097
+ noEmit: false,
2098
+ declaration: true,
2099
+ declarationMap: true,
2100
+ declarationDir,
2101
+ emitDeclarationOnly: true
2102
+ }
2103
+ },
2104
+ _typescript2.default.sys,
2105
+ tsconfig ? _path.dirname.call(void 0, tsconfig) : "./"
2106
+ );
2107
+ const options2 = parsedTsconfig.options;
2108
+ const host = _typescript2.default.createCompilerHost(options2);
2109
+ const program = _typescript2.default.createProgram(
2110
+ parsedTsconfig.fileNames,
2111
+ options2,
2112
+ host
2113
+ );
2312
2114
  const fileMapping = emitDtsFiles(program, host);
2313
2115
  return getExports(program, fileMapping);
2314
2116
  }
2315
- _chunkQTR5272Scjs.__name.call(void 0, emit, "emit");
2316
- function runTypeScriptCompiler(options1) {
2117
+ function runTypeScriptCompiler(options2) {
2317
2118
  try {
2318
2119
  const start = Date.now();
2319
- const getDuration = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, () => {
2120
+ const getDuration = () => {
2320
2121
  return `${Math.floor(Date.now() - start)}ms`;
2321
- }, "getDuration");
2122
+ };
2322
2123
  logger.info("tsc", "Build start");
2323
- const dtsOptions = options1.experimentalDts;
2324
- const exports1 = emit(dtsOptions.compilerOptions, options1.tsconfig, options1);
2124
+ const dtsOptions = options2.experimentalDts;
2125
+ const exports2 = emit(dtsOptions.compilerOptions, options2.tsconfig, options2);
2325
2126
  logger.success("tsc", `\u26A1\uFE0F Build success in ${getDuration()}`);
2326
- return exports1;
2127
+ return exports2;
2327
2128
  } catch (error) {
2328
2129
  _chunkJZ25TPTYjs.handleError.call(void 0, error);
2329
2130
  logger.error("tsc", "Build error");
2330
2131
  }
2331
2132
  }
2332
- _chunkQTR5272Scjs.__name.call(void 0, runTypeScriptCompiler, "runTypeScriptCompiler");
2333
- function formatAggregationExports(exports1, declarationDirPath) {
2334
- const lines = exports1.map((declaration) => formatAggregationExport(declaration, declarationDirPath)).filter(_chunkTWFEYLU4js.truthy);
2133
+ function formatAggregationExports(exports2, declarationDirPath) {
2134
+ const lines = exports2.map(
2135
+ (declaration) => formatAggregationExport(declaration, declarationDirPath)
2136
+ ).filter(_chunkTWFEYLU4js.truthy);
2335
2137
  if (lines.length === 0) {
2336
2138
  lines.push("export {};");
2337
2139
  }
2338
2140
  return `${lines.join("\n")}
2339
2141
  `;
2340
2142
  }
2341
- _chunkQTR5272Scjs.__name.call(void 0, formatAggregationExports, "formatAggregationExports");
2342
2143
  function formatAggregationExport(declaration, declarationDirPath) {
2343
- const dest = _chunkTWFEYLU4js.replaceDtsWithJsExtensions.call(void 0, `./${_path2.default.posix.normalize(_chunkTWFEYLU4js.slash.call(void 0, _path2.default.relative(declarationDirPath, declaration.destFileName)))}`);
2144
+ const dest = _chunkTWFEYLU4js.replaceDtsWithJsExtensions.call(
2145
+ void 0,
2146
+ `./${_path2.default.posix.normalize(
2147
+ _chunkTWFEYLU4js.slash.call(void 0, _path2.default.relative(declarationDirPath, declaration.destFileName))
2148
+ )}`
2149
+ );
2344
2150
  if (declaration.kind === "module") {
2345
2151
  return "";
2346
2152
  } else if (declaration.kind === "named") {
@@ -2357,9 +2163,14 @@ ${diagnosticMessage}`);
2357
2163
  throw new Error("Unknown declaration");
2358
2164
  }
2359
2165
  }
2360
- _chunkQTR5272Scjs.__name.call(void 0, formatAggregationExport, "formatAggregationExport");
2361
- function formatDistributionExports(exports1, fromFilePath, toFilePath) {
2362
- let importPath = _chunkTWFEYLU4js.replaceDtsWithJsExtensions.call(void 0, _path2.default.posix.relative(_path2.default.posix.dirname(_path2.default.posix.normalize(_chunkTWFEYLU4js.slash.call(void 0, fromFilePath))), _path2.default.posix.normalize(_chunkTWFEYLU4js.slash.call(void 0, toFilePath))));
2166
+ function formatDistributionExports(exports2, fromFilePath, toFilePath) {
2167
+ let importPath = _chunkTWFEYLU4js.replaceDtsWithJsExtensions.call(
2168
+ void 0,
2169
+ _path2.default.posix.relative(
2170
+ _path2.default.posix.dirname(_path2.default.posix.normalize(_chunkTWFEYLU4js.slash.call(void 0, fromFilePath))),
2171
+ _path2.default.posix.normalize(_chunkTWFEYLU4js.slash.call(void 0, toFilePath))
2172
+ )
2173
+ );
2363
2174
  if (!/^\.+\//.test(importPath)) {
2364
2175
  importPath = `./${importPath}`;
2365
2176
  }
@@ -2367,7 +2178,7 @@ ${diagnosticMessage}`);
2367
2178
  named: /* @__PURE__ */ new Set(),
2368
2179
  module: /* @__PURE__ */ new Set()
2369
2180
  };
2370
- const lines = exports1.filter((declaration) => {
2181
+ const lines = exports2.filter((declaration) => {
2371
2182
  if (declaration.kind === "module") {
2372
2183
  if (seen.module.has(declaration.moduleName)) {
2373
2184
  return false;
@@ -2390,7 +2201,6 @@ ${diagnosticMessage}`);
2390
2201
  return `${lines.join("\n")}
2391
2202
  `;
2392
2203
  }
2393
- _chunkQTR5272Scjs.__name.call(void 0, formatDistributionExports, "formatDistributionExports");
2394
2204
  function formatDistributionExport(declaration, dest) {
2395
2205
  if (declaration.kind === "named") {
2396
2206
  return [
@@ -2407,10 +2217,9 @@ ${diagnosticMessage}`);
2407
2217
  }
2408
2218
  return "";
2409
2219
  }
2410
- _chunkQTR5272Scjs.__name.call(void 0, formatDistributionExport, "formatDistributionExport");
2411
2220
  var logger2 = _chunkVGC3FXLUjs.createLogger.call(void 0);
2412
- function rollupDtsFile(inputFilePath, outputFilePath, tsconfigFilePath, options1) {
2413
- const cwd = _optionalChain2([options1, 'access', _64 => _64.workspaceConfig, 'optionalAccess', _65 => _65.workspaceRoot]) || process.cwd();
2221
+ function rollupDtsFile(inputFilePath, outputFilePath, tsconfigFilePath, options2) {
2222
+ const cwd = _optionalChain2([options2, 'access', _64 => _64.workspaceConfig, 'optionalAccess', _65 => _65.workspaceRoot]) || process.cwd();
2414
2223
  const packageJsonFullPath = _path2.default.join(cwd, "package.json");
2415
2224
  const configObject = {
2416
2225
  mainEntryPointFilePath: inputFilePath,
@@ -2419,16 +2228,12 @@ ${diagnosticMessage}`);
2419
2228
  // `reportFileName` is not been used. It's just to fit the requirement of API Extractor.
2420
2229
  reportFileName: "tsup-report.api.md"
2421
2230
  },
2422
- docModel: {
2423
- enabled: false
2424
- },
2231
+ docModel: { enabled: false },
2425
2232
  dtsRollup: {
2426
2233
  enabled: true,
2427
2234
  untrimmedFilePath: outputFilePath
2428
2235
  },
2429
- tsdocMetadata: {
2430
- enabled: false
2431
- },
2236
+ tsdocMetadata: { enabled: false },
2432
2237
  compiler: {
2433
2238
  tsconfigFilePath
2434
2239
  },
@@ -2442,7 +2247,9 @@ ${diagnosticMessage}`);
2442
2247
  };
2443
2248
  const imported = _chunkTWFEYLU4js.getApiExtractor.call(void 0);
2444
2249
  if (!imported) {
2445
- throw new Error(`@microsoft/api-extractor is not installed. Please install it first.`);
2250
+ throw new Error(
2251
+ `@microsoft/api-extractor is not installed. Please install it first.`
2252
+ );
2446
2253
  }
2447
2254
  const { ExtractorConfig, Extractor } = imported;
2448
2255
  const extractorConfig = ExtractorConfig.prepare(prepareOptions);
@@ -2453,62 +2260,65 @@ ${diagnosticMessage}`);
2453
2260
  showVerboseMessages: true
2454
2261
  });
2455
2262
  if (!extractorResult.succeeded) {
2456
- throw new Error(`API Extractor completed with ${extractorResult.errorCount} errors and ${extractorResult.warningCount} warnings when processing ${inputFilePath}`);
2263
+ throw new Error(
2264
+ `API Extractor completed with ${extractorResult.errorCount} errors and ${extractorResult.warningCount} warnings when processing ${inputFilePath}`
2265
+ );
2457
2266
  }
2458
2267
  }
2459
- _chunkQTR5272Scjs.__name.call(void 0, rollupDtsFile, "rollupDtsFile");
2460
- async function rollupDtsFiles(options1, exports1, format) {
2461
- if (!options1.experimentalDts || !_optionalChain([
2462
- options1,
2463
- "access",
2464
- (_18) => _18.experimentalDts,
2465
- "optionalAccess",
2466
- (_19) => _19.entry
2467
- ])) {
2268
+ async function rollupDtsFiles(options2, exports2, format) {
2269
+ if (!options2.experimentalDts || !_optionalChain([options2, "access", (_18) => _18.experimentalDts, "optionalAccess", (_19) => _19.entry])) {
2468
2270
  return;
2469
2271
  }
2470
- const declarationDir = _chunkTWFEYLU4js.ensureTempDeclarationDir.call(void 0, options1);
2471
- const outDir = options1.outDir || "dist";
2472
- const pkg = await _chunkVGC3FXLUjs.loadPkg.call(void 0, _optionalChain2([options1, 'access', _66 => _66.workspaceConfig, 'optionalAccess', _67 => _67.workspaceRoot]) || process.cwd());
2473
- const dtsExtension = _chunkTWFEYLU4js.defaultOutExtension.call(void 0, {
2474
- format,
2475
- pkgType: pkg.type
2476
- }).dts;
2477
- const tsconfig = options1.tsconfig || "tsconfig.json";
2478
- let dtsInputFilePath = _path2.default.join(declarationDir, `_tsup-dts-aggregation${dtsExtension}`);
2272
+ const declarationDir = _chunkTWFEYLU4js.ensureTempDeclarationDir.call(void 0, options2);
2273
+ const outDir = options2.outDir || "dist";
2274
+ const pkg = await _chunkVGC3FXLUjs.loadPkg.call(void 0, _optionalChain2([options2, 'access', _66 => _66.workspaceConfig, 'optionalAccess', _67 => _67.workspaceRoot]) || process.cwd());
2275
+ const dtsExtension = _chunkTWFEYLU4js.defaultOutExtension.call(void 0, { format, pkgType: pkg.type }).dts;
2276
+ const tsconfig = options2.tsconfig || "tsconfig.json";
2277
+ let dtsInputFilePath = _path2.default.join(
2278
+ declarationDir,
2279
+ `_tsup-dts-aggregation${dtsExtension}`
2280
+ );
2479
2281
  dtsInputFilePath = dtsInputFilePath.replace(/\.d\.mts$/, ".dmts.d.ts").replace(/\.d\.cts$/, ".dcts.d.ts");
2480
2282
  const dtsOutputFilePath = _path2.default.join(outDir, `_tsup-dts-rollup${dtsExtension}`);
2481
- _chunkTWFEYLU4js.writeFileSync.call(void 0, dtsInputFilePath, formatAggregationExports(exports1, declarationDir, options1));
2482
- rollupDtsFile(dtsInputFilePath, dtsOutputFilePath, tsconfig, options1);
2483
- for (let [out, sourceFileName] of Object.entries(options1.experimentalDts.entry)) {
2283
+ _chunkTWFEYLU4js.writeFileSync.call(
2284
+ void 0,
2285
+ dtsInputFilePath,
2286
+ formatAggregationExports(exports2, declarationDir, options2)
2287
+ );
2288
+ rollupDtsFile(dtsInputFilePath, dtsOutputFilePath, tsconfig, options2);
2289
+ for (let [out, sourceFileName] of Object.entries(
2290
+ options2.experimentalDts.entry
2291
+ )) {
2484
2292
  sourceFileName = _chunkTWFEYLU4js.toAbsolutePath.call(void 0, sourceFileName);
2485
2293
  const outFileName = _path2.default.join(outDir, out + dtsExtension);
2486
- const currentExports = exports1.filter((declaration) => declaration.sourceFileName === sourceFileName);
2487
- _chunkTWFEYLU4js.writeFileSync.call(void 0, outFileName, formatDistributionExports(currentExports, outFileName, dtsOutputFilePath));
2294
+ const currentExports = exports2.filter(
2295
+ (declaration) => declaration.sourceFileName === sourceFileName
2296
+ );
2297
+ _chunkTWFEYLU4js.writeFileSync.call(
2298
+ void 0,
2299
+ outFileName,
2300
+ formatDistributionExports(currentExports, outFileName, dtsOutputFilePath)
2301
+ );
2488
2302
  }
2489
2303
  }
2490
- _chunkQTR5272Scjs.__name.call(void 0, rollupDtsFiles, "rollupDtsFiles");
2491
- async function cleanDtsFiles(options1) {
2492
- if (options1.clean) {
2493
- await _chunkTWFEYLU4js.removeFiles.call(void 0, [
2494
- "**/*.d.{ts,mts,cts}"
2495
- ], options1.outDir);
2304
+ async function cleanDtsFiles(options2) {
2305
+ if (options2.clean) {
2306
+ await _chunkTWFEYLU4js.removeFiles.call(void 0, ["**/*.d.{ts,mts,cts}"], options2.outDir);
2496
2307
  }
2497
2308
  }
2498
- _chunkQTR5272Scjs.__name.call(void 0, cleanDtsFiles, "cleanDtsFiles");
2499
- async function runDtsRollup(options1, exports1) {
2309
+ async function runDtsRollup(options2, exports2) {
2500
2310
  try {
2501
2311
  const start = Date.now();
2502
- const getDuration = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, () => {
2312
+ const getDuration = () => {
2503
2313
  return `${Math.floor(Date.now() - start)}ms`;
2504
- }, "getDuration");
2314
+ };
2505
2315
  logger2.info("dts", "Build start");
2506
- if (!exports1) {
2316
+ if (!exports2) {
2507
2317
  throw new Error("Unexpected internal error: dts exports is not define");
2508
2318
  }
2509
- await cleanDtsFiles(options1);
2510
- for (const format of options1.format) {
2511
- await rollupDtsFiles(options1, exports1, format);
2319
+ await cleanDtsFiles(options2);
2320
+ for (const format of options2.format) {
2321
+ await rollupDtsFiles(options2, exports2, format);
2512
2322
  }
2513
2323
  logger2.success("dts", `\u26A1\uFE0F Build success in ${getDuration()}`);
2514
2324
  } catch (error) {
@@ -2516,18 +2326,11 @@ ${diagnosticMessage}`);
2516
2326
  logger2.error("dts", "Build error");
2517
2327
  }
2518
2328
  }
2519
- _chunkQTR5272Scjs.__name.call(void 0, runDtsRollup, "runDtsRollup");
2520
- var cjsInterop = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, () => {
2329
+ var cjsInterop = () => {
2521
2330
  return {
2522
2331
  name: "cjs-interop",
2523
2332
  renderChunk(code, info) {
2524
- if (!this.options.cjsInterop || this.format !== "cjs" || info.type !== "chunk" || !/\.(js|cjs)$/.test(info.path) || !info.entryPoint || _optionalChain([
2525
- info,
2526
- "access",
2527
- (_20) => _20.exports,
2528
- "optionalAccess",
2529
- (_21) => _21.length
2530
- ]) !== 1 || info.exports[0] !== "default") {
2333
+ if (!this.options.cjsInterop || this.format !== "cjs" || info.type !== "chunk" || !/\.(js|cjs)$/.test(info.path) || !info.entryPoint || _optionalChain([info, "access", (_20) => _20.exports, "optionalAccess", (_21) => _21.length]) !== 1 || info.exports[0] !== "default") {
2531
2334
  return;
2532
2335
  }
2533
2336
  return {
@@ -2538,49 +2341,48 @@ module.exports = exports.default;
2538
2341
  };
2539
2342
  }
2540
2343
  };
2541
- }, "cjsInterop");
2542
- var defineConfig = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (options1) => options1, "defineConfig");
2543
- var isTaskkillCmdProcessNotFoundError = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (err) => {
2344
+ };
2345
+ var defineConfig = (options2) => options2;
2346
+ var isTaskkillCmdProcessNotFoundError = (err) => {
2544
2347
  return process.platform === "win32" && "cmd" in err && "code" in err && typeof err.cmd === "string" && err.cmd.startsWith("taskkill") && err.code === 128;
2545
- }, "isTaskkillCmdProcessNotFoundError");
2546
- var killProcess = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, ({ pid, signal }) => new Promise((resolve, reject) => {
2348
+ };
2349
+ var killProcess = ({ pid, signal }) => new Promise((resolve, reject) => {
2547
2350
  _treekill2.default.call(void 0, pid, signal, (err) => {
2548
2351
  if (err && !isTaskkillCmdProcessNotFoundError(err)) return reject(err);
2549
2352
  resolve();
2550
2353
  });
2551
- }), "killProcess");
2552
- var normalizeOptions = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, async (logger3, optionsFromConfigFile, optionsOverride) => {
2354
+ });
2355
+ var normalizeOptions = async (logger3, optionsFromConfigFile, optionsOverride) => {
2553
2356
  const _options = {
2554
2357
  ...optionsFromConfigFile,
2555
2358
  ...optionsOverride
2556
2359
  };
2557
- const options1 = {
2360
+ const options2 = {
2558
2361
  outDir: "dist",
2559
2362
  removeNodeProtocol: true,
2560
2363
  ..._options,
2561
- format: typeof _options.format === "string" ? [
2562
- _options.format
2563
- ] : _options.format || [
2564
- "cjs"
2565
- ],
2566
- dts: typeof _options.dts === "boolean" ? _options.dts ? {} : void 0 : typeof _options.dts === "string" ? {
2567
- entry: _options.dts
2568
- } : _options.dts,
2569
- experimentalDts: await _chunkTWFEYLU4js.resolveInitialExperimentalDtsConfig.call(void 0, _options.experimentalDts)
2364
+ format: typeof _options.format === "string" ? [_options.format] : _options.format || ["cjs"],
2365
+ dts: typeof _options.dts === "boolean" ? _options.dts ? {} : void 0 : typeof _options.dts === "string" ? { entry: _options.dts } : _options.dts,
2366
+ experimentalDts: await _chunkTWFEYLU4js.resolveInitialExperimentalDtsConfig.call(
2367
+ void 0,
2368
+ _options.experimentalDts
2369
+ )
2570
2370
  };
2571
- if (!options1.workspaceConfig) options1.workspaceConfig = {};
2572
- if (!options1.workspaceConfig.workspaceRoot) options1.workspaceConfig.workspaceRoot = process.cwd();
2573
- _chunkVGC3FXLUjs.setSilent.call(void 0, options1.silent);
2574
- const entry = options1.entry || options1.entryPoints;
2371
+ if (!options2.workspaceConfig)
2372
+ options2.workspaceConfig = {};
2373
+ if (!options2.workspaceConfig.workspaceRoot)
2374
+ options2.workspaceConfig.workspaceRoot = process.cwd();
2375
+ _chunkVGC3FXLUjs.setSilent.call(void 0, options2.silent);
2376
+ const entry = options2.entry || options2.entryPoints;
2575
2377
  if (!entry || Object.keys(entry).length === 0) {
2576
2378
  throw new (0, _chunkJZ25TPTYjs.PrettyError)(`No input files, try "tsup <your-file>" instead`);
2577
2379
  }
2578
2380
  if (Array.isArray(entry)) {
2579
- options1.entry = await _tinyglobby.glob.call(void 0, entry);
2580
- if (!options1.entry || options1.entry.length === 0) {
2381
+ options2.entry = await _tinyglobby.glob.call(void 0, entry);
2382
+ if (!options2.entry || options2.entry.length === 0) {
2581
2383
  throw new (0, _chunkJZ25TPTYjs.PrettyError)(`Cannot find ${entry}`);
2582
2384
  } else {
2583
- logger3.info("CLI", `Building entry: ${options1.entry.join(", ")}`);
2385
+ logger3.info("CLI", `Building entry: ${options2.entry.join(", ")}`);
2584
2386
  }
2585
2387
  } else {
2586
2388
  Object.keys(entry).forEach((alias) => {
@@ -2589,326 +2391,290 @@ module.exports = exports.default;
2589
2391
  throw new (0, _chunkJZ25TPTYjs.PrettyError)(`Cannot find ${alias}: ${filename}`);
2590
2392
  }
2591
2393
  });
2592
- options1.entry = entry;
2394
+ options2.entry = entry;
2593
2395
  logger3.info("CLI", `Building entry: ${JSON.stringify(entry)}`);
2594
2396
  }
2595
- const tsconfig = _bundlerequire.loadTsConfig.call(void 0, _optionalChain2([options1, 'access', _68 => _68.workspaceConfig, 'optionalAccess', _69 => _69.workspaceRoot]) || process.cwd(), options1.tsconfig);
2397
+ const tsconfig = _bundlerequire.loadTsConfig.call(void 0, _optionalChain2([options2, 'access', _68 => _68.workspaceConfig, 'optionalAccess', _69 => _69.workspaceRoot]) || process.cwd(), options2.tsconfig);
2596
2398
  if (tsconfig) {
2597
- logger3.info("CLI", `Using tsconfig: ${_path2.default.relative(_optionalChain2([options1, 'access', _70 => _70.workspaceConfig, 'optionalAccess', _71 => _71.workspaceRoot]) || process.cwd(), tsconfig.path)}`);
2598
- options1.tsconfig = tsconfig.path;
2599
- options1.tsconfigResolvePaths = _optionalChain([
2600
- tsconfig,
2601
- "access",
2602
- (_22) => _22.data,
2603
- "optionalAccess",
2604
- (_23) => _23.compilerOptions,
2605
- "optionalAccess",
2606
- (_24) => _24.paths
2607
- ]) || {};
2608
- options1.tsconfigDecoratorMetadata = _optionalChain([
2609
- tsconfig,
2610
- "access",
2611
- (_25) => _25.data,
2612
- "optionalAccess",
2613
- (_26) => _26.compilerOptions,
2614
- "optionalAccess",
2615
- (_27) => _27.emitDecoratorMetadata
2616
- ]);
2617
- if (options1.dts) {
2618
- options1.dts.compilerOptions = {
2399
+ logger3.info(
2400
+ "CLI",
2401
+ `Using tsconfig: ${_path2.default.relative(_optionalChain2([options2, 'access', _70 => _70.workspaceConfig, 'optionalAccess', _71 => _71.workspaceRoot]) || process.cwd(), tsconfig.path)}`
2402
+ );
2403
+ options2.tsconfig = tsconfig.path;
2404
+ options2.tsconfigResolvePaths = _optionalChain([tsconfig, "access", (_22) => _22.data, "optionalAccess", (_23) => _23.compilerOptions, "optionalAccess", (_24) => _24.paths]) || {};
2405
+ options2.tsconfigDecoratorMetadata = _optionalChain([tsconfig, "access", (_25) => _25.data, "optionalAccess", (_26) => _26.compilerOptions, "optionalAccess", (_27) => _27.emitDecoratorMetadata]);
2406
+ if (options2.dts) {
2407
+ options2.dts.compilerOptions = {
2619
2408
  ...tsconfig.data.compilerOptions || {},
2620
- ...options1.dts.compilerOptions || {}
2409
+ ...options2.dts.compilerOptions || {}
2621
2410
  };
2622
2411
  }
2623
- if (options1.experimentalDts) {
2624
- options1.experimentalDts = await _chunkTWFEYLU4js.resolveExperimentalDtsConfig.call(void 0, options1, tsconfig);
2412
+ if (options2.experimentalDts) {
2413
+ options2.experimentalDts = await _chunkTWFEYLU4js.resolveExperimentalDtsConfig.call(
2414
+ void 0,
2415
+ options2,
2416
+ tsconfig
2417
+ );
2625
2418
  }
2626
- if (!options1.target) {
2627
- options1.target = _optionalChain([
2628
- tsconfig,
2629
- "access",
2630
- (_28) => _28.data,
2631
- "optionalAccess",
2632
- (_29) => _29.compilerOptions,
2633
- "optionalAccess",
2634
- (_30) => _30.target,
2635
- "optionalAccess",
2636
- (_31) => _31.toLowerCase,
2637
- "call",
2638
- (_32) => _32()
2639
- ]);
2419
+ if (!options2.target) {
2420
+ options2.target = _optionalChain([tsconfig, "access", (_28) => _28.data, "optionalAccess", (_29) => _29.compilerOptions, "optionalAccess", (_30) => _30.target, "optionalAccess", (_31) => _31.toLowerCase, "call", (_32) => _32()]);
2640
2421
  }
2641
- } else if (options1.tsconfig) {
2642
- throw new (0, _chunkJZ25TPTYjs.PrettyError)(`Cannot find tsconfig: ${options1.tsconfig}`);
2422
+ } else if (options2.tsconfig) {
2423
+ throw new (0, _chunkJZ25TPTYjs.PrettyError)(`Cannot find tsconfig: ${options2.tsconfig}`);
2643
2424
  }
2644
- if (!options1.target) {
2645
- options1.target = "node16";
2425
+ if (!options2.target) {
2426
+ options2.target = "node16";
2646
2427
  }
2647
- return options1;
2648
- }, "normalizeOptions");
2428
+ return options2;
2429
+ };
2649
2430
  async function build(_options) {
2650
- const config = _options.config === false ? {} : await _chunkVGC3FXLUjs.loadTsupConfig.call(void 0, _optionalChain2([_options, 'access', _72 => _72.workspaceConfig, 'optionalAccess', _73 => _73.workspaceRoot]) || process.cwd(), _options.config === true ? void 0 : _options.config);
2431
+ const config = _options.config === false ? {} : await _chunkVGC3FXLUjs.loadTsupConfig.call(
2432
+ void 0,
2433
+ _optionalChain2([_options, 'access', _72 => _72.workspaceConfig, 'optionalAccess', _73 => _73.workspaceRoot]) || process.cwd(),
2434
+ _options.config === true ? void 0 : _options.config
2435
+ );
2651
2436
  const configData = typeof config.data === "function" ? await config.data(_options) : config.data;
2652
- await Promise.all([
2653
- ...Array.isArray(configData) ? configData : [
2654
- configData
2655
- ]
2656
- ].map(async (item) => {
2657
- const logger3 = _chunkVGC3FXLUjs.createLogger.call(void 0, _optionalChain([
2658
- item,
2659
- "optionalAccess",
2660
- (_33) => _33.name
2661
- ]));
2662
- const options1 = await normalizeOptions(logger3, item, _options);
2663
- logger3.info("CLI", `tsup v${_chunkBYH4XDRHjs.version}`);
2664
- if (config.path) {
2665
- logger3.info("CLI", `Using tsup config: ${config.path}`);
2666
- }
2667
- if (options1.watch) {
2668
- logger3.info("CLI", "Running in watch mode");
2669
- }
2670
- const experimentalDtsTask = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, async () => {
2671
- if (!options1.dts && options1.experimentalDts) {
2672
- const exports1 = runTypeScriptCompiler(options1);
2673
- await runDtsRollup(options1, exports1);
2674
- }
2675
- }, "experimentalDtsTask");
2676
- const dtsTask = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, async () => {
2677
- if (options1.dts && options1.experimentalDts) {
2678
- throw new Error("You can't use both `dts` and `experimentalDts` at the same time");
2679
- }
2680
- await experimentalDtsTask();
2681
- if (options1.dts) {
2682
- await new Promise((resolve, reject) => {
2683
- let workerPath = _path2.default.join(__dirname, "./rollup.cjs");
2684
- if (!_fs2.default.existsSync(workerPath)) {
2685
- workerPath = _path2.default.join(__dirname, "./rollup.js");
2437
+ await Promise.all(
2438
+ [...Array.isArray(configData) ? configData : [configData]].map(
2439
+ async (item) => {
2440
+ const logger3 = _chunkVGC3FXLUjs.createLogger.call(void 0, _optionalChain([item, "optionalAccess", (_33) => _33.name]));
2441
+ const options2 = await normalizeOptions(logger3, item, _options);
2442
+ logger3.info("CLI", `tsup v${_chunkBYH4XDRHjs.version}`);
2443
+ if (config.path) {
2444
+ logger3.info("CLI", `Using tsup config: ${config.path}`);
2445
+ }
2446
+ if (options2.watch) {
2447
+ logger3.info("CLI", "Running in watch mode");
2448
+ }
2449
+ const experimentalDtsTask = async () => {
2450
+ if (!options2.dts && options2.experimentalDts) {
2451
+ const exports2 = runTypeScriptCompiler(options2);
2452
+ await runDtsRollup(options2, exports2);
2686
2453
  }
2687
- const worker = new (0, _worker_threads.Worker)(workerPath);
2688
- const terminateWorker = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, () => {
2689
- if (options1.watch) return;
2690
- worker.terminate();
2691
- }, "terminateWorker");
2692
- worker.postMessage({
2693
- configName: _optionalChain([
2694
- item,
2695
- "optionalAccess",
2696
- (_34) => _34.name
2697
- ]),
2698
- options: {
2699
- ...options1,
2700
- // functions cannot be cloned
2701
- injectStyle: typeof options1.injectStyle === "function" ? void 0 : options1.injectStyle,
2702
- banner: void 0,
2703
- footer: void 0,
2704
- esbuildPlugins: void 0,
2705
- esbuildOptions: void 0,
2706
- plugins: void 0,
2707
- treeshake: void 0,
2708
- onSuccess: void 0,
2709
- outExtension: void 0
2710
- }
2711
- });
2712
- worker.on("message", (data) => {
2713
- if (data === "error") {
2714
- terminateWorker();
2715
- reject(new Error("error occurred in dts build"));
2716
- } else if (data === "success") {
2717
- terminateWorker();
2718
- resolve();
2719
- } else {
2720
- const { type, text } = data;
2721
- if (type === "log") {
2722
- console.log(text);
2723
- } else if (type === "error") {
2724
- console.error(text);
2454
+ };
2455
+ const dtsTask = async () => {
2456
+ if (options2.dts && options2.experimentalDts) {
2457
+ throw new Error(
2458
+ "You can't use both `dts` and `experimentalDts` at the same time"
2459
+ );
2460
+ }
2461
+ await experimentalDtsTask();
2462
+ if (options2.dts) {
2463
+ await new Promise((resolve, reject) => {
2464
+ let workerPath = _path2.default.join(__dirname, "./rollup.cjs");
2465
+ if (!_fs2.default.existsSync(workerPath)) {
2466
+ workerPath = _path2.default.join(__dirname, "./rollup.js");
2725
2467
  }
2726
- }
2727
- });
2728
- });
2729
- }
2730
- }, "dtsTask");
2731
- const mainTasks = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, async () => {
2732
- if (!_optionalChain([
2733
- options1,
2734
- "access",
2735
- (_35) => _35.dts,
2736
- "optionalAccess",
2737
- (_36) => _36.only
2738
- ])) {
2739
- let onSuccessProcess;
2740
- let onSuccessCleanup;
2741
- const buildDependencies = /* @__PURE__ */ new Set();
2742
- let depsHash = await _chunkVGC3FXLUjs.getAllDepsHash.call(void 0, _optionalChain2([options1, 'access', _74 => _74.workspaceConfig, 'optionalAccess', _75 => _75.workspaceRoot]) || process.cwd());
2743
- const doOnSuccessCleanup = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, async () => {
2744
- if (onSuccessProcess) {
2745
- await killProcess({
2746
- pid: onSuccessProcess.pid,
2747
- signal: options1.killSignal || "SIGTERM"
2468
+ const worker = new (0, _worker_threads.Worker)(workerPath);
2469
+ const terminateWorker = () => {
2470
+ if (options2.watch) return;
2471
+ worker.terminate();
2472
+ };
2473
+ worker.postMessage({
2474
+ configName: _optionalChain([item, "optionalAccess", (_34) => _34.name]),
2475
+ options: {
2476
+ ...options2,
2477
+ // functions cannot be cloned
2478
+ injectStyle: typeof options2.injectStyle === "function" ? void 0 : options2.injectStyle,
2479
+ banner: void 0,
2480
+ footer: void 0,
2481
+ esbuildPlugins: void 0,
2482
+ esbuildOptions: void 0,
2483
+ plugins: void 0,
2484
+ treeshake: void 0,
2485
+ onSuccess: void 0,
2486
+ outExtension: void 0
2487
+ }
2488
+ });
2489
+ worker.on("message", (data) => {
2490
+ if (data === "error") {
2491
+ terminateWorker();
2492
+ reject(new Error("error occurred in dts build"));
2493
+ } else if (data === "success") {
2494
+ terminateWorker();
2495
+ resolve();
2496
+ } else {
2497
+ const { type, text } = data;
2498
+ if (type === "log") {
2499
+ console.log(text);
2500
+ } else if (type === "error") {
2501
+ console.error(text);
2502
+ }
2503
+ }
2504
+ });
2748
2505
  });
2749
- } else if (onSuccessCleanup) {
2750
- await onSuccessCleanup();
2751
2506
  }
2752
- onSuccessProcess = void 0;
2753
- onSuccessCleanup = void 0;
2754
- }, "doOnSuccessCleanup");
2755
- const debouncedBuildAll = _chunkTWFEYLU4js.debouncePromise.call(void 0, () => {
2756
- return buildAll();
2757
- }, 100, _chunkJZ25TPTYjs.handleError);
2758
- const buildAll = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, async () => {
2759
- await doOnSuccessCleanup();
2760
- const previousBuildDependencies = new Set(buildDependencies);
2761
- buildDependencies.clear();
2762
- if (options1.clean) {
2763
- const extraPatterns = Array.isArray(options1.clean) ? options1.clean : [];
2764
- if (options1.dts || options1.experimentalDts) {
2765
- extraPatterns.unshift("!**/*.d.{ts,cts,mts}");
2766
- }
2767
- await _chunkTWFEYLU4js.removeFiles.call(void 0, [
2768
- "**/*",
2769
- ...extraPatterns
2770
- ], options1.outDir);
2771
- logger3.info("CLI", "Cleaning output folder");
2772
- }
2773
- const css = /* @__PURE__ */ new Map();
2774
- await Promise.all([
2775
- ...options1.format.map(async (format, index) => {
2776
- const pluginContainer = new PluginContainer([
2777
- shebang(),
2778
- ...options1.plugins || [],
2779
- treeShakingPlugin({
2780
- treeshake: options1.treeshake,
2781
- name: options1.globalName,
2782
- silent: options1.silent
2783
- }),
2784
- cjsSplitting(),
2785
- cjsInterop(),
2786
- swcTarget(),
2787
- sizeReporter(),
2788
- terserPlugin({
2789
- minifyOptions: options1.minify,
2790
- format,
2791
- terserOptions: options1.terserOptions,
2792
- globalName: options1.globalName,
2793
- logger: logger3
2507
+ };
2508
+ const mainTasks = async () => {
2509
+ if (!_optionalChain([options2, "access", (_35) => _35.dts, "optionalAccess", (_36) => _36.only])) {
2510
+ let onSuccessProcess;
2511
+ let onSuccessCleanup;
2512
+ const buildDependencies = /* @__PURE__ */ new Set();
2513
+ let depsHash = await _chunkVGC3FXLUjs.getAllDepsHash.call(void 0, _optionalChain2([options2, 'access', _74 => _74.workspaceConfig, 'optionalAccess', _75 => _75.workspaceRoot]) || process.cwd());
2514
+ const doOnSuccessCleanup = async () => {
2515
+ if (onSuccessProcess) {
2516
+ await killProcess({
2517
+ pid: onSuccessProcess.pid,
2518
+ signal: options2.killSignal || "SIGTERM"
2519
+ });
2520
+ } else if (onSuccessCleanup) {
2521
+ await onSuccessCleanup();
2522
+ }
2523
+ onSuccessProcess = void 0;
2524
+ onSuccessCleanup = void 0;
2525
+ };
2526
+ const debouncedBuildAll = _chunkTWFEYLU4js.debouncePromise.call(
2527
+ void 0,
2528
+ () => {
2529
+ return buildAll();
2530
+ },
2531
+ 100,
2532
+ _chunkJZ25TPTYjs.handleError
2533
+ );
2534
+ const buildAll = async () => {
2535
+ await doOnSuccessCleanup();
2536
+ const previousBuildDependencies = new Set(buildDependencies);
2537
+ buildDependencies.clear();
2538
+ if (options2.clean) {
2539
+ const extraPatterns = Array.isArray(options2.clean) ? options2.clean : [];
2540
+ if (options2.dts || options2.experimentalDts) {
2541
+ extraPatterns.unshift("!**/*.d.{ts,cts,mts}");
2542
+ }
2543
+ await _chunkTWFEYLU4js.removeFiles.call(void 0, ["**/*", ...extraPatterns], options2.outDir);
2544
+ logger3.info("CLI", "Cleaning output folder");
2545
+ }
2546
+ const css = /* @__PURE__ */ new Map();
2547
+ await Promise.all([
2548
+ ...options2.format.map(async (format, index) => {
2549
+ const pluginContainer = new PluginContainer([
2550
+ shebang(),
2551
+ ...options2.plugins || [],
2552
+ treeShakingPlugin({
2553
+ treeshake: options2.treeshake,
2554
+ name: options2.globalName,
2555
+ silent: options2.silent
2556
+ }),
2557
+ cjsSplitting(),
2558
+ cjsInterop(),
2559
+ swcTarget(),
2560
+ sizeReporter(),
2561
+ terserPlugin({
2562
+ minifyOptions: options2.minify,
2563
+ format,
2564
+ terserOptions: options2.terserOptions,
2565
+ globalName: options2.globalName,
2566
+ logger: logger3
2567
+ })
2568
+ ]);
2569
+ await runEsbuild(options2, {
2570
+ pluginContainer,
2571
+ format,
2572
+ css: index === 0 || options2.injectStyle ? css : void 0,
2573
+ logger: logger3,
2574
+ buildDependencies
2575
+ }).catch((error) => {
2576
+ previousBuildDependencies.forEach(
2577
+ (v) => buildDependencies.add(v)
2578
+ );
2579
+ throw error;
2580
+ });
2794
2581
  })
2795
2582
  ]);
2796
- await runEsbuild(options1, {
2797
- pluginContainer,
2798
- format,
2799
- css: index === 0 || options1.injectStyle ? css : void 0,
2800
- logger: logger3,
2801
- buildDependencies
2802
- }).catch((error) => {
2803
- previousBuildDependencies.forEach((v) => buildDependencies.add(v));
2804
- throw error;
2805
- });
2806
- })
2807
- ]);
2808
- if (options1.onSuccess) {
2809
- if (typeof options1.onSuccess === "function") {
2810
- onSuccessCleanup = await options1.onSuccess();
2811
- } else {
2812
- onSuccessProcess = _tinyexec.exec.call(void 0, options1.onSuccess, [], {
2813
- nodeOptions: {
2814
- shell: true,
2815
- stdio: "inherit"
2583
+ if (options2.onSuccess) {
2584
+ if (typeof options2.onSuccess === "function") {
2585
+ onSuccessCleanup = await options2.onSuccess();
2586
+ } else {
2587
+ onSuccessProcess = _tinyexec.exec.call(void 0, options2.onSuccess, [], {
2588
+ nodeOptions: { shell: true, stdio: "inherit" }
2589
+ });
2590
+ _optionalChain([onSuccessProcess, "access", (_37) => _37.process, "optionalAccess", (_38) => _38.on, "call", (_39) => _39("exit", (code) => {
2591
+ if (code && code !== 0) {
2592
+ process.exitCode = code;
2593
+ }
2594
+ })]);
2816
2595
  }
2596
+ }
2597
+ };
2598
+ const startWatcher = async () => {
2599
+ if (!options2.watch) return;
2600
+ const { watch } = await Promise.resolve().then(() => _interopRequireWildcard(_chunkJCICRU7Kcjs.__require.call(void 0, "chokidar")));
2601
+ const customIgnores = options2.ignoreWatch ? Array.isArray(options2.ignoreWatch) ? options2.ignoreWatch : [options2.ignoreWatch] : [];
2602
+ const ignored = [
2603
+ "**/{.git,node_modules}/**",
2604
+ options2.outDir,
2605
+ ...customIgnores
2606
+ ];
2607
+ const watchPaths = typeof options2.watch === "boolean" ? "." : Array.isArray(options2.watch) ? options2.watch.filter((path12) => typeof path12 === "string") : options2.watch;
2608
+ logger3.info(
2609
+ "CLI",
2610
+ `Watching for changes in ${Array.isArray(watchPaths) ? watchPaths.map((v) => `"${v}"`).join(" | ") : `"${watchPaths}"`}`
2611
+ );
2612
+ logger3.info(
2613
+ "CLI",
2614
+ `Ignoring changes in ${ignored.map((v) => `"${v}"`).join(" | ")}`
2615
+ );
2616
+ const watcher = watch(await _tinyglobby.glob.call(void 0, watchPaths), {
2617
+ ignoreInitial: true,
2618
+ ignorePermissionErrors: true,
2619
+ ignored: (p) => _tinyglobby.globSync.call(void 0, p, { ignore: ignored }).length === 0
2817
2620
  });
2818
- _optionalChain([
2819
- onSuccessProcess,
2820
- "access",
2821
- (_37) => _37.process,
2822
- "optionalAccess",
2823
- (_38) => _38.on,
2824
- "call",
2825
- (_39) => _39("exit", (code) => {
2826
- if (code && code !== 0) {
2827
- process.exitCode = code;
2621
+ watcher.on("all", async (type, file) => {
2622
+ file = _chunkTWFEYLU4js.slash.call(void 0, file);
2623
+ if (options2.publicDir && isInPublicDir(options2.publicDir, file)) {
2624
+ logger3.info("CLI", `Change in public dir: ${file}`);
2625
+ copyPublicDir(options2.publicDir, options2.outDir);
2626
+ return;
2627
+ }
2628
+ let shouldSkipChange = false;
2629
+ if (options2.watch === true) {
2630
+ if (file === "package.json" && !buildDependencies.has(file)) {
2631
+ const currentHash = await _chunkVGC3FXLUjs.getAllDepsHash.call(void 0, _optionalChain2([options2, 'access', _76 => _76.workspaceConfig, 'optionalAccess', _77 => _77.workspaceRoot]) || process.cwd());
2632
+ shouldSkipChange = currentHash === depsHash;
2633
+ depsHash = currentHash;
2634
+ } else if (!buildDependencies.has(file)) {
2635
+ shouldSkipChange = true;
2828
2636
  }
2829
- })
2830
- ]);
2831
- }
2637
+ }
2638
+ if (shouldSkipChange) {
2639
+ return;
2640
+ }
2641
+ logger3.info("CLI", `Change detected: ${type} ${file}`);
2642
+ debouncedBuildAll();
2643
+ });
2644
+ };
2645
+ logger3.info("CLI", `Target: ${options2.target}`);
2646
+ await buildAll();
2647
+ copyPublicDir(options2.publicDir, options2.outDir);
2648
+ startWatcher();
2832
2649
  }
2833
- }, "buildAll");
2834
- const startWatcher = /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, async () => {
2835
- if (!options1.watch) return;
2836
- const { watch } = await Promise.resolve().then(() => _interopRequireWildcard(_chunkQTR5272Scjs.__require.call(void 0, "chokidar")));
2837
- const customIgnores = options1.ignoreWatch ? Array.isArray(options1.ignoreWatch) ? options1.ignoreWatch : [
2838
- options1.ignoreWatch
2839
- ] : [];
2840
- const ignored = [
2841
- "**/{.git,node_modules}/**",
2842
- options1.outDir,
2843
- ...customIgnores
2844
- ];
2845
- const watchPaths = typeof options1.watch === "boolean" ? "." : Array.isArray(options1.watch) ? options1.watch.filter((path12) => typeof path12 === "string") : options1.watch;
2846
- logger3.info("CLI", `Watching for changes in ${Array.isArray(watchPaths) ? watchPaths.map((v) => `"${v}"`).join(" | ") : `"${watchPaths}"`}`);
2847
- logger3.info("CLI", `Ignoring changes in ${ignored.map((v) => `"${v}"`).join(" | ")}`);
2848
- const watcher = watch(await _tinyglobby.glob.call(void 0, watchPaths), {
2849
- ignoreInitial: true,
2850
- ignorePermissionErrors: true,
2851
- ignored: /* @__PURE__ */ _chunkQTR5272Scjs.__name.call(void 0, (p) => _tinyglobby.globSync.call(void 0, p, {
2852
- ignore: ignored
2853
- }).length === 0, "ignored")
2854
- });
2855
- watcher.on("all", async (type, file) => {
2856
- file = _chunkTWFEYLU4js.slash.call(void 0, file);
2857
- if (options1.publicDir && isInPublicDir(options1.publicDir, file)) {
2858
- logger3.info("CLI", `Change in public dir: ${file}`);
2859
- copyPublicDir(options1.publicDir, options1.outDir);
2860
- return;
2861
- }
2862
- let shouldSkipChange = false;
2863
- if (options1.watch === true) {
2864
- if (file === "package.json" && !buildDependencies.has(file)) {
2865
- const currentHash = await _chunkVGC3FXLUjs.getAllDepsHash.call(void 0, _optionalChain2([options1, 'access', _76 => _76.workspaceConfig, 'optionalAccess', _77 => _77.workspaceRoot]) || process.cwd());
2866
- shouldSkipChange = currentHash === depsHash;
2867
- depsHash = currentHash;
2868
- } else if (!buildDependencies.has(file)) {
2869
- shouldSkipChange = true;
2870
- }
2871
- }
2872
- if (shouldSkipChange) {
2873
- return;
2874
- }
2875
- logger3.info("CLI", `Change detected: ${type} ${file}`);
2876
- debouncedBuildAll();
2877
- });
2878
- }, "startWatcher");
2879
- logger3.info("CLI", `Target: ${options1.target}`);
2880
- await buildAll();
2881
- copyPublicDir(options1.publicDir, options1.outDir);
2882
- startWatcher();
2650
+ };
2651
+ await Promise.all([dtsTask(), mainTasks()]);
2883
2652
  }
2884
- }, "mainTasks");
2885
- await Promise.all([
2886
- dtsTask(),
2887
- mainTasks()
2888
- ]);
2889
- }));
2653
+ )
2654
+ );
2890
2655
  }
2891
- _chunkQTR5272Scjs.__name.call(void 0, build, "build");
2892
2656
  exports.build = build;
2893
2657
  exports.defineConfig = defineConfig;
2894
2658
  }
2895
2659
  });
2896
2660
 
2897
2661
  // src/tsup.ts
2898
- _chunkQTR5272Scjs.init_cjs_shims.call(void 0, );
2899
- var import_tsup = _chunkQTR5272Scjs.__toESM.call(void 0, require_dist(), 1);
2662
+ _chunkJCICRU7Kcjs.init_cjs_shims.call(void 0, );
2663
+ var import_tsup = _chunkJCICRU7Kcjs.__toESM.call(void 0, require_dist(), 1);
2900
2664
  async function executeTsup(context) {
2901
- _chunkJ5J57SEIcjs.writeDebug.call(void 0, ` \u{1F680} Running ${context.options.name} build`, context.workspaceConfig);
2902
- const stopwatch = _chunkJ5J57SEIcjs.getStopwatch.call(void 0, `${context.options.name} build`);
2665
+ _chunkRBXXACL5cjs.writeDebug.call(void 0,
2666
+ ` \u{1F680} Running ${context.options.name} build`,
2667
+ context.workspaceConfig
2668
+ );
2669
+ const stopwatch = _chunkRBXXACL5cjs.getStopwatch.call(void 0, `${context.options.name} build`);
2903
2670
  await (0, import_tsup.build)({
2904
2671
  ...context.options,
2905
- outDir: context.options.distDir ? _chunkOHH3RWRKcjs.joinPaths.call(void 0, context.outputPath, context.options.distDir) : context.outputPath,
2672
+ outDir: context.options.distDir ? _chunkB3MHVZOKcjs.joinPaths.call(void 0, context.outputPath, context.options.distDir) : context.outputPath,
2906
2673
  workspaceConfig: context.workspaceConfig
2907
2674
  });
2908
2675
  stopwatch();
2909
2676
  return context;
2910
2677
  }
2911
- _chunkQTR5272Scjs.__name.call(void 0, executeTsup, "executeTsup");
2912
2678
 
2913
2679
 
2914
2680