zotero-plugin-scaffold 0.9.3 → 0.9.4

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.
@@ -1,4 +1,4 @@
1
- import { a as parseRepoUrl, i as dateFormat, l as logger, n as replaceDefine, o as template, s as toArray } from "./scaffold-replace-Dn0wBA9W.mjs";
1
+ import { a as parseRepoUrl, i as dateFormat, l as logger, n as replaceDefine, o as template, s as toArray } from "./scaffold-replace-CI5Lu8Fb.mjs";
2
2
  import { loadConfig, setupDotenv } from "c12";
3
3
  import { debounce, delay, escapeRegExp, kebabCase, mapValues, toMerged } from "es-toolkit";
4
4
  import { copy, emptyDir, ensureDir, ensureDirSync, move, outputFile, outputJSON, pathExists, readJSON, readJsonSync, remove, writeJson } from "fs-extra/esm";
@@ -7,11 +7,11 @@ import process$1 from "node:process";
7
7
  import { format, inspect, styleText } from "node:util";
8
8
  import { isAgent, isCI, isDebug, isLinux, isMacOS, isWindows } from "std-env";
9
9
  import { glob, globSync } from "tinyglobby";
10
- import path, { basename, dirname, extname, isAbsolute, join, resolve } from "node:path";
10
+ import path, { basename, dirname, extname, isAbsolute, join, resolve, sep } from "node:path";
11
11
  import { build, context } from "esbuild";
12
12
  import { readFile, readdir, stat, unlink, writeFile } from "node:fs/promises";
13
13
  import { Transformer, parse, serialize } from "@fluent/syntax";
14
- import fs, { closeSync, createReadStream, existsSync, lstatSync, openSync, promises, realpathSync, statSync, writeSync } from "node:fs";
14
+ import fs, { closeSync, createReadStream, existsSync, openSync, promises, realpathSync, statSync, writeSync } from "node:fs";
15
15
  import { parseSync, printSync } from "@swc/core";
16
16
  import { createHash } from "node:crypto";
17
17
  import AdmZip from "adm-zip";
@@ -24,11 +24,10 @@ import { Octokit } from "@octokit/rest";
24
24
  import chokidar from "chokidar";
25
25
  import net from "node:net";
26
26
  import { Buffer } from "node:buffer";
27
- import domain from "node:domain";
28
27
  import EventEmitter from "node:events";
29
28
  import { Xvfb } from "xvfb-ts";
30
29
  import http from "node:http";
31
- //#region src/config.ts
30
+ // src/config.ts
32
31
  /**
33
32
  * Helper for user define configuration.
34
33
  */
@@ -179,8 +178,7 @@ const defaultConfig = {
179
178
  logLevel: "INFO"
180
179
  };
181
180
  const getDefaultConfig$1 = () => defaultConfig;
182
- //#endregion
183
- //#region src/core/base.ts
181
+ // src/core/base.ts
184
182
  var Base = class {
185
183
  ctx;
186
184
  constructor(ctx) {
@@ -190,8 +188,7 @@ var Base = class {
190
188
  return this.ctx.logger;
191
189
  }
192
190
  };
193
- //#endregion
194
- //#region src/core/builder/assets.ts
191
+ // src/core/builder/assets.ts
195
192
  const DEFAULT_IGNORE = ["node_modules", ".git"];
196
193
  async function copyAssets(source, dist, assets) {
197
194
  const sourceArr = toArray(source);
@@ -206,8 +203,7 @@ function getNewPath(sources, dist, path) {
206
203
  const pattern = new RegExp(sources.join("|"));
207
204
  return `${dist}/addon/${path.replace(pattern, "")}`;
208
205
  }
209
- //#endregion
210
- //#region src/core/builder/esbuild.ts
206
+ // src/core/builder/esbuild.ts
211
207
  function resolveConfig(dist, esbuildOptions) {
212
208
  const distAbsolute = resolve(dist);
213
209
  return esbuildOptions.map((option, i) => {
@@ -227,8 +223,7 @@ async function esbuild(dist, esbuildOptions) {
227
223
  const options = resolveConfig(dist, esbuildOptions);
228
224
  return await Promise.all(options.map((esbuildOption) => build(esbuildOption)));
229
225
  }
230
- //#endregion
231
- //#region src/core/builder/fluent.ts
226
+ // src/core/builder/fluent.ts
232
227
  async function buildLocale(dist, namespace, options) {
233
228
  const ignores = toArray(options.ignore);
234
229
  const localeNames = await getLocales(dist);
@@ -379,8 +374,7 @@ export type FluentMessageId =
379
374
  ${messages.toSorted().map((id) => ` | '${id}'`).join("\n")};
380
375
  `;
381
376
  }
382
- //#endregion
383
- //#region src/core/builder/manifest.ts
377
+ // src/core/builder/manifest.ts
384
378
  async function buildManifest(ctx) {
385
379
  if (!ctx.build.makeManifest.enable) return;
386
380
  const { name, id, updateURL, dist, version } = ctx;
@@ -400,8 +394,7 @@ async function buildManifest(ctx) {
400
394
  logger.debug(`manifest: ${JSON.stringify(data, null, 2)}`);
401
395
  outputJSON(manifestPath, data, { spaces: 2 });
402
396
  }
403
- //#endregion
404
- //#region src/utils/number.ts
397
+ // src/utils/number.ts
405
398
  /**
406
399
  * Check if a number is a C++ integer.
407
400
  *
@@ -410,8 +403,7 @@ async function buildManifest(ctx) {
410
403
  function is32BitNumber(n) {
411
404
  return Number.isInteger(n) && n >= -2147483648 && n <= 2147483647;
412
405
  }
413
- //#endregion
414
- //#region src/utils/prefs-manager.ts
406
+ // src/utils/prefs-manager.ts
415
407
  var PrefsManager = class {
416
408
  namespace;
417
409
  prefs = {};
@@ -593,8 +585,7 @@ var PrefsManager = class {
593
585
  return _prefs;
594
586
  }
595
587
  };
596
- //#endregion
597
- //#region src/core/builder/prefs.ts
588
+ // src/core/builder/prefs.ts
598
589
  async function buildPrefs(dist, options) {
599
590
  const { dts, prefixPrefKeys, prefix } = options;
600
591
  if (!prefixPrefKeys && !dts) return;
@@ -664,8 +655,7 @@ declare namespace _ZoteroTypes {
664
655
  }
665
656
  `;
666
657
  }
667
- //#endregion
668
- //#region src/core/builder/update-json.ts
658
+ // src/core/builder/update-json.ts
669
659
  function generateHash(filePath, algorithm) {
670
660
  return new Promise((resolve, reject) => {
671
661
  const hash = createHash(algorithm);
@@ -700,15 +690,13 @@ async function buildUpdateJson(ctx) {
700
690
  if (!ctx.templateData.isPreRelease) await writeJson(`${dist}/update.json`, data, { spaces: 2 });
701
691
  logger.debug(`Prepare Update.json for ${ctx.templateData.isPreRelease ? "\x1B[31m Prerelease \x1B[0m" : "\x1B[32m Release \x1B[0m"}`);
702
692
  }
703
- //#endregion
704
- //#region src/core/builder/zip.ts
693
+ // src/core/builder/zip.ts
705
694
  async function pack(dist, xpiName) {
706
695
  const zip = new AdmZip();
707
696
  zip.addLocalFolder(`${dist}/addon`);
708
697
  zip.writeZip(`${dist}/${xpiName}.xpi`);
709
698
  }
710
- //#endregion
711
- //#region src/core/builder/index.ts
699
+ // src/core/builder/index.ts
712
700
  var Build = class extends Base {
713
701
  buildTime;
714
702
  constructor(ctx) {
@@ -767,8 +755,7 @@ var Build = class extends Base {
767
755
  }
768
756
  exit() {}
769
757
  };
770
- //#endregion
771
- //#region src/core/releaser/base.ts
758
+ // src/core/releaser/base.ts
772
759
  var ReleaseBase = class {
773
760
  isCI;
774
761
  ctx;
@@ -784,8 +771,7 @@ var ReleaseBase = class {
784
771
  return this.ctx.logger;
785
772
  }
786
773
  };
787
- //#endregion
788
- //#region src/core/releaser/bump.ts
774
+ // src/core/releaser/bump.ts
789
775
  var Bump = class extends ReleaseBase {
790
776
  constructor(ctx) {
791
777
  super(ctx);
@@ -837,8 +823,7 @@ var Bump = class extends ReleaseBase {
837
823
  };
838
824
  }
839
825
  };
840
- //#endregion
841
- //#region node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
826
+ // node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
842
827
  const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
843
828
  function normalizeWindowsPath(input = "") {
844
829
  if (!input) return input;
@@ -950,13 +935,11 @@ function normalizeString(path, allowAboveRoot) {
950
935
  const isAbsolute$1 = function(p) {
951
936
  return _IS_ABSOLUTE_RE.test(p);
952
937
  };
953
- //#endregion
954
- //#region node_modules/.pnpm/scule@1.3.0/node_modules/scule/dist/index.mjs
938
+ // node_modules/.pnpm/scule@1.3.0/node_modules/scule/dist/index.mjs
955
939
  function upperFirst(str) {
956
940
  return str ? str[0].toUpperCase() + str.slice(1) : "";
957
941
  }
958
- //#endregion
959
- //#region node_modules/.pnpm/convert-gitmoji@0.1.5/node_modules/convert-gitmoji/dist/index.mjs
942
+ // node_modules/.pnpm/convert-gitmoji@0.1.5/node_modules/convert-gitmoji/dist/index.mjs
960
943
  const gitmojis = {
961
944
  ":art:": "🎨",
962
945
  ":zap:": "⚡️",
@@ -1055,425 +1038,84 @@ globalThis.AbortController;
1055
1038
  const l = globalThis.fetch || (() => {
1056
1039
  throw new Error("[node-fetch-native] Failed to fetch: `globalThis.fetch` is not available!");
1057
1040
  });
1058
- //#endregion
1059
- //#region node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/_format.mjs
1041
+ // node_modules/.pnpm/confbox@0.3.2/node_modules/confbox/dist/_chunks/_format.mjs
1060
1042
  const t$1 = Symbol.for(`__confbox_fmt__`);
1061
- const n$2 = /^(\s+)/;
1062
- const r$2 = /(\s+)$/;
1063
- function i$1(e, t = {}) {
1043
+ const n$1 = /^(\s+)/;
1044
+ const r$2 = /^[ \t]+(?=\r?$)/gm;
1045
+ function i$2(e) {
1046
+ return e.charCodeAt(0) === 65279 ? e.slice(1) : e;
1047
+ }
1048
+ function a$1(e, t) {
1049
+ let i = (n$1.exec(e)?.[0] || ``).lastIndexOf(`
1050
+ `) + 1;
1051
+ return e.slice(i, i + t).replace(r$2, ``);
1052
+ }
1053
+ function o(e, t = {}) {
1054
+ let r = t.indent === void 0 && t.preserveIndentation !== !1 ? a$1(i$2(e), t?.sampleSize || 1024) : void 0, o = t.preserveWhitespace === !1 ? void 0 : {
1055
+ start: n$1.exec(e)?.[0] || ``,
1056
+ end: e.slice(e.trimEnd().length)
1057
+ };
1064
1058
  return {
1065
- sample: t.indent === void 0 && t.preserveIndentation !== !1 && e.slice(0, t?.sampleSize || 1024),
1066
- whiteSpace: t.preserveWhitespace === !1 ? void 0 : {
1067
- start: n$2.exec(e)?.[0] || ``,
1068
- end: r$2.exec(e)?.[0] || ``
1069
- }
1059
+ indent: t.indent,
1060
+ sample: r,
1061
+ whiteSpace: o
1070
1062
  };
1071
1063
  }
1072
- function a$1(e, n, r) {
1073
- !n || typeof n != `object` || Object.defineProperty(n, t$1, {
1064
+ function s(e, n, r) {
1065
+ n && typeof n == `object` && Object.defineProperty(n, t$1, {
1074
1066
  enumerable: !1,
1075
1067
  configurable: !0,
1076
1068
  writable: !0,
1077
- value: i$1(e, r)
1069
+ value: o(e, r)
1078
1070
  });
1079
1071
  }
1080
- //#endregion
1081
- //#region node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/jsonc-parser.mjs
1082
- function e(e, i = !1) {
1083
- let a = e.length, o = 0, s = ``, c = 0, l = 16, u = 0, d = 0, f = 0, p = 0, m = 0;
1084
- function h(t, n) {
1085
- let r = 0, i = 0;
1086
- for (; r < t || !n;) {
1087
- let t = e.charCodeAt(o);
1088
- if (t >= 48 && t <= 57) i = i * 16 + t - 48;
1089
- else if (t >= 65 && t <= 70) i = i * 16 + t - 65 + 10;
1090
- else if (t >= 97 && t <= 102) i = i * 16 + t - 97 + 10;
1091
- else break;
1092
- o++, r++;
1093
- }
1094
- return r < t && (i = -1), i;
1095
- }
1096
- function g(e) {
1097
- o = e, s = ``, c = 0, l = 16, m = 0;
1098
- }
1099
- function _() {
1100
- let t = o;
1101
- if (e.charCodeAt(o) === 48) o++;
1102
- else for (o++; o < e.length && r$1(e.charCodeAt(o));) o++;
1103
- if (o < e.length && e.charCodeAt(o) === 46) if (o++, o < e.length && r$1(e.charCodeAt(o))) for (o++; o < e.length && r$1(e.charCodeAt(o));) o++;
1104
- else return m = 3, e.substring(t, o);
1105
- let n = o;
1106
- if (o < e.length && (e.charCodeAt(o) === 69 || e.charCodeAt(o) === 101)) if (o++, (o < e.length && e.charCodeAt(o) === 43 || e.charCodeAt(o) === 45) && o++, o < e.length && r$1(e.charCodeAt(o))) {
1107
- for (o++; o < e.length && r$1(e.charCodeAt(o));) o++;
1108
- n = o;
1109
- } else m = 3;
1110
- return e.substring(t, n);
1111
- }
1112
- function v() {
1113
- let t = ``, r = o;
1114
- for (;;) {
1115
- if (o >= a) {
1116
- t += e.substring(r, o), m = 2;
1117
- break;
1118
- }
1119
- let i = e.charCodeAt(o);
1120
- if (i === 34) {
1121
- t += e.substring(r, o), o++;
1122
- break;
1123
- }
1124
- if (i === 92) {
1125
- if (t += e.substring(r, o), o++, o >= a) {
1126
- m = 2;
1127
- break;
1128
- }
1129
- switch (e.charCodeAt(o++)) {
1130
- case 34:
1131
- t += `"`;
1132
- break;
1133
- case 92:
1134
- t += `\\`;
1135
- break;
1136
- case 47:
1137
- t += `/`;
1138
- break;
1139
- case 98:
1140
- t += `\b`;
1141
- break;
1142
- case 102:
1143
- t += `\f`;
1144
- break;
1145
- case 110:
1146
- t += `
1147
- `;
1148
- break;
1149
- case 114:
1150
- t += `\r`;
1151
- break;
1152
- case 116:
1153
- t += ` `;
1154
- break;
1155
- case 117:
1156
- let e = h(4, !0);
1157
- e >= 0 ? t += String.fromCharCode(e) : m = 4;
1158
- break;
1159
- default: m = 5;
1160
- }
1161
- r = o;
1072
+ // node_modules/.pnpm/confbox@0.3.2/node_modules/confbox/dist/_chunks/libs/strip-json-comments.mjs
1073
+ const e = Symbol(`singleComment`);
1074
+ const t = Symbol(`multiComment`);
1075
+ const n = () => ``;
1076
+ const r$1 = (e, t, n) => e.slice(t, n).replace(/[^ \t\r\n]/g, ` `);
1077
+ const i$1 = (e, t) => {
1078
+ let n = t - 1, r = 0;
1079
+ for (; e[n] === `\\`;) --n, r += 1;
1080
+ return !!(r % 2);
1081
+ };
1082
+ function a(a, { whitespace: o = !0, trailingCommas: s = !1 } = {}) {
1083
+ if (typeof a != `string`) throw TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof a}\``);
1084
+ let c = o ? r$1 : n, l = !1, u = !1, d = 0, f = ``, p = ``, m = -1;
1085
+ for (let n = 0; n < a.length; n++) {
1086
+ let r = a[n], o = a[n + 1];
1087
+ if (u || r !== `"` || i$1(a, n) || (l = !l), !l) {
1088
+ if (!u && r + o === `//`) f += a.slice(d, n), d = n, u = e, n++;
1089
+ else if (u === e && r + o === `\r
1090
+ `) {
1091
+ n++, u = !1, f += c(a, d, n), d = n;
1162
1092
  continue;
1163
- }
1164
- if (i >= 0 && i <= 31) if (n$1(i)) {
1165
- t += e.substring(r, o), m = 2;
1166
- break;
1167
- } else m = 6;
1168
- o++;
1169
- }
1170
- return t;
1171
- }
1172
- function y() {
1173
- if (s = ``, m = 0, c = o, d = u, p = f, o >= a) return c = a, l = 17;
1174
- let i = e.charCodeAt(o);
1175
- if (t(i)) {
1176
- do
1177
- o++, s += String.fromCharCode(i), i = e.charCodeAt(o);
1178
- while (t(i));
1179
- return l = 15;
1180
- }
1181
- if (n$1(i)) return o++, s += String.fromCharCode(i), i === 13 && e.charCodeAt(o) === 10 && (o++, s += `
1182
- `), u++, f = o, l = 14;
1183
- switch (i) {
1184
- case 123: return o++, l = 1;
1185
- case 125: return o++, l = 2;
1186
- case 91: return o++, l = 3;
1187
- case 93: return o++, l = 4;
1188
- case 58: return o++, l = 6;
1189
- case 44: return o++, l = 5;
1190
- case 34: return o++, s = v(), l = 10;
1191
- case 47:
1192
- let t = o - 1;
1193
- if (e.charCodeAt(o + 1) === 47) {
1194
- for (o += 2; o < a && !n$1(e.charCodeAt(o));) o++;
1195
- return s = e.substring(t, o), l = 12;
1196
- }
1197
- if (e.charCodeAt(o + 1) === 42) {
1198
- o += 2;
1199
- let r = a - 1, i = !1;
1200
- for (; o < r;) {
1201
- let t = e.charCodeAt(o);
1202
- if (t === 42 && e.charCodeAt(o + 1) === 47) {
1203
- o += 2, i = !0;
1204
- break;
1205
- }
1206
- o++, n$1(t) && (t === 13 && e.charCodeAt(o) === 10 && o++, u++, f = o);
1207
- }
1208
- return i || (o++, m = 1), s = e.substring(t, o), l = 13;
1209
- }
1210
- return s += String.fromCharCode(i), o++, l = 16;
1211
- case 45: if (s += String.fromCharCode(i), o++, o === a || !r$1(e.charCodeAt(o))) return l = 16;
1212
- case 48:
1213
- case 49:
1214
- case 50:
1215
- case 51:
1216
- case 52:
1217
- case 53:
1218
- case 54:
1219
- case 55:
1220
- case 56:
1221
- case 57: return s += _(), l = 11;
1222
- default:
1223
- for (; o < a && b(i);) o++, i = e.charCodeAt(o);
1224
- if (c !== o) {
1225
- switch (s = e.substring(c, o), s) {
1226
- case `true`: return l = 8;
1227
- case `false`: return l = 9;
1228
- case `null`: return l = 7;
1229
- }
1230
- return l = 16;
1231
- }
1232
- return s += String.fromCharCode(i), o++, l = 16;
1233
- }
1234
- }
1235
- function b(e) {
1236
- if (t(e) || n$1(e)) return !1;
1237
- switch (e) {
1238
- case 125:
1239
- case 93:
1240
- case 123:
1241
- case 91:
1242
- case 34:
1243
- case 58:
1244
- case 44:
1245
- case 47: return !1;
1093
+ } else if (u === e && r === `
1094
+ `) u = !1, f += c(a, d, n), d = n;
1095
+ else if (!u && r + o === `/*`) {
1096
+ f += a.slice(d, n), d = n, u = t, n++;
1097
+ continue;
1098
+ } else if (u === t && r + o === `*/`) {
1099
+ n++, u = !1, f += c(a, d, n + 1), d = n + 1;
1100
+ continue;
1101
+ } else s && !u && (m === -1 ? r === `,` && (p += f + a.slice(d, n), f = ``, d = n, m = n) : r === `}` || r === `]` ? (f += a.slice(d, n), p += c(f, 0, 1) + f.slice(1), f = ``, d = n, m = -1) : r !== ` ` && r !== ` ` && r !== `\r` && r !== `
1102
+ ` && (f += a.slice(d, n), d = n, m = -1));
1246
1103
  }
1247
- return !0;
1248
- }
1249
- function x() {
1250
- let e;
1251
- do
1252
- e = y();
1253
- while (e >= 12 && e <= 15);
1254
- return e;
1255
1104
  }
1256
- return {
1257
- setPosition: g,
1258
- getPosition: () => o,
1259
- scan: i ? x : y,
1260
- getToken: () => l,
1261
- getTokenValue: () => s,
1262
- getTokenOffset: () => c,
1263
- getTokenLength: () => o - c,
1264
- getTokenStartLine: () => d,
1265
- getTokenStartCharacter: () => c - p,
1266
- getTokenError: () => m
1267
- };
1105
+ let h = u === e ? c(a, d) : a.slice(d);
1106
+ return p + f + h;
1268
1107
  }
1269
- function t(e) {
1270
- return e === 32 || e === 9;
1271
- }
1272
- function n$1(e) {
1273
- return e === 10 || e === 13;
1274
- }
1275
- function r$1(e) {
1276
- return e >= 48 && e <= 57;
1277
- }
1278
- var i;
1279
- (function(e) {
1280
- e[e.lineFeed = 10] = `lineFeed`, e[e.carriageReturn = 13] = `carriageReturn`, e[e.space = 32] = `space`, e[e._0 = 48] = `_0`, e[e._1 = 49] = `_1`, e[e._2 = 50] = `_2`, e[e._3 = 51] = `_3`, e[e._4 = 52] = `_4`, e[e._5 = 53] = `_5`, e[e._6 = 54] = `_6`, e[e._7 = 55] = `_7`, e[e._8 = 56] = `_8`, e[e._9 = 57] = `_9`, e[e.a = 97] = `a`, e[e.b = 98] = `b`, e[e.c = 99] = `c`, e[e.d = 100] = `d`, e[e.e = 101] = `e`, e[e.f = 102] = `f`, e[e.g = 103] = `g`, e[e.h = 104] = `h`, e[e.i = 105] = `i`, e[e.j = 106] = `j`, e[e.k = 107] = `k`, e[e.l = 108] = `l`, e[e.m = 109] = `m`, e[e.n = 110] = `n`, e[e.o = 111] = `o`, e[e.p = 112] = `p`, e[e.q = 113] = `q`, e[e.r = 114] = `r`, e[e.s = 115] = `s`, e[e.t = 116] = `t`, e[e.u = 117] = `u`, e[e.v = 118] = `v`, e[e.w = 119] = `w`, e[e.x = 120] = `x`, e[e.y = 121] = `y`, e[e.z = 122] = `z`, e[e.A = 65] = `A`, e[e.B = 66] = `B`, e[e.C = 67] = `C`, e[e.D = 68] = `D`, e[e.E = 69] = `E`, e[e.F = 70] = `F`, e[e.G = 71] = `G`, e[e.H = 72] = `H`, e[e.I = 73] = `I`, e[e.J = 74] = `J`, e[e.K = 75] = `K`, e[e.L = 76] = `L`, e[e.M = 77] = `M`, e[e.N = 78] = `N`, e[e.O = 79] = `O`, e[e.P = 80] = `P`, e[e.Q = 81] = `Q`, e[e.R = 82] = `R`, e[e.S = 83] = `S`, e[e.T = 84] = `T`, e[e.U = 85] = `U`, e[e.V = 86] = `V`, e[e.W = 87] = `W`, e[e.X = 88] = `X`, e[e.Y = 89] = `Y`, e[e.Z = 90] = `Z`, e[e.asterisk = 42] = `asterisk`, e[e.backslash = 92] = `backslash`, e[e.closeBrace = 125] = `closeBrace`, e[e.closeBracket = 93] = `closeBracket`, e[e.colon = 58] = `colon`, e[e.comma = 44] = `comma`, e[e.dot = 46] = `dot`, e[e.doubleQuote = 34] = `doubleQuote`, e[e.minus = 45] = `minus`, e[e.openBrace = 123] = `openBrace`, e[e.openBracket = 91] = `openBracket`, e[e.plus = 43] = `plus`, e[e.slash = 47] = `slash`, e[e.formFeed = 12] = `formFeed`, e[e.tab = 9] = `tab`;
1281
- })(i ||= {}), Array(20).fill(0).map((e, t) => ` `.repeat(t)), Array(200).fill(0).map((e, t) => `
1282
- ` + ` `.repeat(t)), Array(200).fill(0).map((e, t) => `\r` + ` `.repeat(t)), Array(200).fill(0).map((e, t) => `\r
1283
- ` + ` `.repeat(t)), Array(200).fill(0).map((e, t) => `
1284
- ` + ` `.repeat(t)), Array(200).fill(0).map((e, t) => `\r` + ` `.repeat(t)), Array(200).fill(0).map((e, t) => `\r
1285
- ` + ` `.repeat(t));
1286
- var a;
1287
- (function(e) {
1288
- e.DEFAULT = { allowTrailingComma: !1 };
1289
- })(a ||= {});
1290
- function o(e, t = [], n = a.DEFAULT) {
1291
- let r = null, i = [], o = [];
1292
- function s(e) {
1293
- Array.isArray(i) ? i.push(e) : r !== null && (i[r] = e);
1294
- }
1295
- return d(e, {
1296
- onObjectBegin: () => {
1297
- let e = {};
1298
- s(e), o.push(i), i = e, r = null;
1299
- },
1300
- onObjectProperty: (e) => {
1301
- r = e;
1302
- },
1303
- onObjectEnd: () => {
1304
- i = o.pop();
1305
- },
1306
- onArrayBegin: () => {
1307
- let e = [];
1308
- s(e), o.push(i), i = e, r = null;
1309
- },
1310
- onArrayEnd: () => {
1311
- i = o.pop();
1312
- },
1313
- onLiteralValue: s,
1314
- onError: (e, n, r) => {
1315
- t.push({
1316
- error: e,
1317
- offset: n,
1318
- length: r
1319
- });
1320
- }
1321
- }, n), i[0];
1322
- }
1323
- function d(t, n, r = a.DEFAULT) {
1324
- let i = e(t, !1), o = [], s = 0;
1325
- function c(e) {
1326
- return e ? () => s === 0 && e(i.getTokenOffset(), i.getTokenLength(), i.getTokenStartLine(), i.getTokenStartCharacter()) : () => !0;
1327
- }
1328
- function l(e) {
1329
- return e ? (t) => s === 0 && e(t, i.getTokenOffset(), i.getTokenLength(), i.getTokenStartLine(), i.getTokenStartCharacter()) : () => !0;
1330
- }
1331
- function u(e) {
1332
- return e ? (t) => s === 0 && e(t, i.getTokenOffset(), i.getTokenLength(), i.getTokenStartLine(), i.getTokenStartCharacter(), () => o.slice()) : () => !0;
1333
- }
1334
- function d(e) {
1335
- return e ? () => {
1336
- s > 0 ? s++ : e(i.getTokenOffset(), i.getTokenLength(), i.getTokenStartLine(), i.getTokenStartCharacter(), () => o.slice()) === !1 && (s = 1);
1337
- } : () => !0;
1338
- }
1339
- function f(e) {
1340
- return e ? () => {
1341
- s > 0 && s--, s === 0 && e(i.getTokenOffset(), i.getTokenLength(), i.getTokenStartLine(), i.getTokenStartCharacter());
1342
- } : () => !0;
1343
- }
1344
- let p = d(n.onObjectBegin), m = u(n.onObjectProperty), h = f(n.onObjectEnd), g = d(n.onArrayBegin), _ = f(n.onArrayEnd), v = u(n.onLiteralValue), y = l(n.onSeparator), b = c(n.onComment), x = l(n.onError), S = r && r.disallowComments, C = r && r.allowTrailingComma;
1345
- function w() {
1346
- for (;;) {
1347
- let e = i.scan();
1348
- switch (i.getTokenError()) {
1349
- case 4:
1350
- T(14);
1351
- break;
1352
- case 5:
1353
- T(15);
1354
- break;
1355
- case 3:
1356
- T(13);
1357
- break;
1358
- case 1:
1359
- S || T(11);
1360
- break;
1361
- case 2:
1362
- T(12);
1363
- break;
1364
- case 6: T(16);
1365
- }
1366
- switch (e) {
1367
- case 12:
1368
- case 13:
1369
- S ? T(10) : b();
1370
- break;
1371
- case 16:
1372
- T(1);
1373
- break;
1374
- case 15:
1375
- case 14: break;
1376
- default: return e;
1377
- }
1378
- }
1379
- }
1380
- function T(e, t = [], n = []) {
1381
- if (x(e), t.length + n.length > 0) {
1382
- let e = i.getToken();
1383
- for (; e !== 17;) {
1384
- if (t.indexOf(e) !== -1) {
1385
- w();
1386
- break;
1387
- } else if (n.indexOf(e) !== -1) break;
1388
- e = w();
1389
- }
1390
- }
1391
- }
1392
- function E(e) {
1393
- let t = i.getTokenValue();
1394
- return e ? v(t) : (m(t), o.push(t)), w(), !0;
1395
- }
1396
- function D() {
1397
- switch (i.getToken()) {
1398
- case 11:
1399
- let e = i.getTokenValue(), t = Number(e);
1400
- isNaN(t) && (T(2), t = 0), v(t);
1401
- break;
1402
- case 7:
1403
- v(null);
1404
- break;
1405
- case 8:
1406
- v(!0);
1407
- break;
1408
- case 9:
1409
- v(!1);
1410
- break;
1411
- default: return !1;
1412
- }
1413
- return w(), !0;
1414
- }
1415
- function O() {
1416
- return i.getToken() === 10 ? (E(!1), i.getToken() === 6 ? (y(`:`), w(), j() || T(4, [], [2, 5])) : T(5, [], [2, 5]), o.pop(), !0) : (T(3, [], [2, 5]), !1);
1417
- }
1418
- function k() {
1419
- p(), w();
1420
- let e = !1;
1421
- for (; i.getToken() !== 2 && i.getToken() !== 17;) {
1422
- if (i.getToken() === 5) {
1423
- if (e || T(4, [], []), y(`,`), w(), i.getToken() === 2 && C) break;
1424
- } else e && T(6, [], []);
1425
- O() || T(4, [], [2, 5]), e = !0;
1426
- }
1427
- return h(), i.getToken() === 2 ? w() : T(7, [2], []), !0;
1428
- }
1429
- function A() {
1430
- g(), w();
1431
- let e = !0, t = !1;
1432
- for (; i.getToken() !== 4 && i.getToken() !== 17;) {
1433
- if (i.getToken() === 5) {
1434
- if (t || T(4, [], []), y(`,`), w(), i.getToken() === 4 && C) break;
1435
- } else t && T(6, [], []);
1436
- e ? (o.push(0), e = !1) : o[o.length - 1]++, j() || T(4, [], [4, 5]), t = !0;
1437
- }
1438
- return _(), e || o.pop(), i.getToken() === 4 ? w() : T(8, [4], []), !0;
1439
- }
1440
- function j() {
1441
- switch (i.getToken()) {
1442
- case 3: return A();
1443
- case 1: return k();
1444
- case 10: return E(!0);
1445
- default: return D();
1446
- }
1447
- }
1448
- return w(), i.getToken() === 17 ? r.allowEmptyContent ? !0 : (T(4, [], []), !1) : j() ? (i.getToken() !== 17 && T(9, [], []), !0) : (T(4, [], []), !1);
1449
- }
1450
- var f;
1451
- (function(e) {
1452
- e[e.None = 0] = `None`, e[e.UnexpectedEndOfComment = 1] = `UnexpectedEndOfComment`, e[e.UnexpectedEndOfString = 2] = `UnexpectedEndOfString`, e[e.UnexpectedEndOfNumber = 3] = `UnexpectedEndOfNumber`, e[e.InvalidUnicode = 4] = `InvalidUnicode`, e[e.InvalidEscapeCharacter = 5] = `InvalidEscapeCharacter`, e[e.InvalidCharacter = 6] = `InvalidCharacter`;
1453
- })(f ||= {});
1454
- var p;
1455
- (function(e) {
1456
- e[e.OpenBraceToken = 1] = `OpenBraceToken`, e[e.CloseBraceToken = 2] = `CloseBraceToken`, e[e.OpenBracketToken = 3] = `OpenBracketToken`, e[e.CloseBracketToken = 4] = `CloseBracketToken`, e[e.CommaToken = 5] = `CommaToken`, e[e.ColonToken = 6] = `ColonToken`, e[e.NullKeyword = 7] = `NullKeyword`, e[e.TrueKeyword = 8] = `TrueKeyword`, e[e.FalseKeyword = 9] = `FalseKeyword`, e[e.StringLiteral = 10] = `StringLiteral`, e[e.NumericLiteral = 11] = `NumericLiteral`, e[e.LineCommentTrivia = 12] = `LineCommentTrivia`, e[e.BlockCommentTrivia = 13] = `BlockCommentTrivia`, e[e.LineBreakTrivia = 14] = `LineBreakTrivia`, e[e.Trivia = 15] = `Trivia`, e[e.Unknown = 16] = `Unknown`, e[e.EOF = 17] = `EOF`;
1457
- })(p ||= {});
1458
- const m = o;
1459
- var h;
1460
- (function(e) {
1461
- e[e.InvalidSymbol = 1] = `InvalidSymbol`, e[e.InvalidNumberFormat = 2] = `InvalidNumberFormat`, e[e.PropertyNameExpected = 3] = `PropertyNameExpected`, e[e.ValueExpected = 4] = `ValueExpected`, e[e.ColonExpected = 5] = `ColonExpected`, e[e.CommaExpected = 6] = `CommaExpected`, e[e.CloseBraceExpected = 7] = `CloseBraceExpected`, e[e.CloseBracketExpected = 8] = `CloseBracketExpected`, e[e.EndOfFileExpected = 9] = `EndOfFileExpected`, e[e.InvalidCommentToken = 10] = `InvalidCommentToken`, e[e.UnexpectedEndOfComment = 11] = `UnexpectedEndOfComment`, e[e.UnexpectedEndOfString = 12] = `UnexpectedEndOfString`, e[e.UnexpectedEndOfNumber = 13] = `UnexpectedEndOfNumber`, e[e.InvalidUnicode = 14] = `InvalidUnicode`, e[e.InvalidEscapeCharacter = 15] = `InvalidEscapeCharacter`, e[e.InvalidCharacter = 16] = `InvalidCharacter`;
1462
- })(h ||= {});
1463
- //#endregion
1464
- //#region node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/json.mjs
1465
- function n(t, n) {
1466
- let r = JSON.parse(t, n?.reviver);
1467
- return a$1(t, r, n), r;
1468
- }
1469
- //#endregion
1470
- //#region node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/jsonc.mjs
1471
- function r(n, r) {
1472
- let i = m(n, r?.errors, r);
1473
- return a$1(n, i, r), i;
1474
- }
1475
- //#endregion
1476
- //#region node_modules/.pnpm/exsolve@1.1.1/node_modules/exsolve/dist/index.mjs
1108
+ // node_modules/.pnpm/confbox@0.3.2/node_modules/confbox/dist/json.mjs
1109
+ function r(e, r) {
1110
+ let i = JSON.parse(i$2(e), r?.reviver);
1111
+ return s(e, i, r), i;
1112
+ }
1113
+ // node_modules/.pnpm/confbox@0.3.2/node_modules/confbox/dist/jsonc.mjs
1114
+ function i(r, i) {
1115
+ let a$3 = JSON.parse(a(i$2(r), { trailingCommas: i?.allowTrailingComma }));
1116
+ return s(r, a$3, i), a$3;
1117
+ }
1118
+ // node_modules/.pnpm/exsolve@1.2.0/node_modules/exsolve/dist/index.mjs
1477
1119
  const nodeBuiltins = [
1478
1120
  "_http_agent",
1479
1121
  "_http_client",
@@ -1674,9 +1316,11 @@ function determineSpecificType(value) {
1674
1316
  case "boolean": return value ? "type boolean (true)" : "type boolean (false)";
1675
1317
  case "symbol": return `type symbol (${String(value)})`;
1676
1318
  case "function": return `function ${value.name}`;
1677
- case "object":
1678
- if (value.constructor && value.constructor.name) return `an instance of ${value.constructor.name}`;
1319
+ case "object": {
1320
+ const name = value.constructor?.name;
1321
+ if (typeof name === "string" && name !== "") return `an instance of ${name}`;
1679
1322
  return `${inspect(value, { depth: -1 })}`;
1323
+ }
1680
1324
  case "string": {
1681
1325
  let string = value;
1682
1326
  if (string.length > 28) string = `${string.slice(0, 25)}...`;
@@ -1726,10 +1370,12 @@ createError("ERR_INVALID_ARG_TYPE", (name, expected, actual) => {
1726
1370
  message += `an instance of ${formatList(instances, "or")}`;
1727
1371
  if (other.length > 0) message += " or ";
1728
1372
  }
1729
- if (other.length > 0) if (other.length > 1) message += `one of ${formatList(other, "or")}`;
1730
- else {
1731
- if (other[0]?.toLowerCase() !== other[0]) message += "an ";
1732
- message += `${other[0]}`;
1373
+ if (other.length > 0) {
1374
+ if (other.length > 1) message += `one of ${formatList(other, "or")}`;
1375
+ else {
1376
+ if (other[0]?.toLowerCase() !== other[0]) message += "an ";
1377
+ message += `${other[0]}`;
1378
+ }
1733
1379
  }
1734
1380
  message += `. Received ${determineSpecificType(actual)}`;
1735
1381
  return message;
@@ -1773,7 +1419,12 @@ createError("ERR_INVALID_ARG_VALUE", (name, value, reason = "is invalid") => {
1773
1419
  return `The ${name.includes(".") ? "property" : "argument"} '${name}' ${reason}. Received ${inspected}`;
1774
1420
  }, TypeError);
1775
1421
  const hasOwnProperty$1 = {}.hasOwnProperty;
1776
- const cache = /* @__PURE__ */ new Map();
1422
+ let cache = /* @__PURE__ */ new Map();
1423
+ function setPackageJSONCache(newCache) {
1424
+ const previous = cache;
1425
+ cache = newCache;
1426
+ return previous;
1427
+ }
1777
1428
  function read(jsonPath, { base, specifier }) {
1778
1429
  const existing = cache.get(jsonPath);
1779
1430
  if (existing) return existing;
@@ -1782,7 +1433,11 @@ function read(jsonPath, { base, specifier }) {
1782
1433
  string = fs.readFileSync(path.toNamespacedPath(jsonPath), "utf8");
1783
1434
  } catch (error) {
1784
1435
  const exception = error;
1785
- if (exception.code !== "ENOENT") throw exception;
1436
+ if (exception.code !== "ENOENT" && exception.code !== "ENOTDIR" && exception.code !== "EISDIR") {
1437
+ const error = new ERR_INVALID_PACKAGE_CONFIG(jsonPath, (base ? `"${specifier}" from ` : "") + fileURLToPath(base || specifier), `Cannot read package config: ${exception.message}`);
1438
+ error.cause = exception;
1439
+ throw error;
1440
+ }
1786
1441
  }
1787
1442
  const result = {
1788
1443
  exists: false,
@@ -1851,7 +1506,7 @@ function mimeToFormat(mime) {
1851
1506
  return null;
1852
1507
  }
1853
1508
  function getDataProtocolModuleFormat(parsed) {
1854
- const { 1: mime } = /^([^/]+\/[^;,]+)(?:[^,]*?)(;base64)?,/.exec(parsed.pathname) || [
1509
+ const { 1: mime } = /^([^/]+\/[^;,]+)(?:;[^,]*)?,/.exec(parsed.pathname) || [
1855
1510
  null,
1856
1511
  null,
1857
1512
  null
@@ -1884,7 +1539,8 @@ function getFileProtocolModuleFormat(url, _context, ignoreErrors) {
1884
1539
  const format = extensionFormatMap[ext];
1885
1540
  if (format) return format;
1886
1541
  if (ignoreErrors) return;
1887
- throw new ERR_UNKNOWN_FILE_EXTENSION(ext, fileURLToPath(url));
1542
+ const filepath = fileURLToPath(url);
1543
+ throw new ERR_UNKNOWN_FILE_EXTENSION(ext, filepath);
1888
1544
  }
1889
1545
  function defaultGetFormatWithoutErrors(url, context) {
1890
1546
  const protocol = url.protocol;
@@ -1917,7 +1573,7 @@ function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
1917
1573
  }
1918
1574
  function tryStatSync(path) {
1919
1575
  try {
1920
- return statSync(path);
1576
+ return statSync(path, { throwIfNoEntry: false });
1921
1577
  } catch {}
1922
1578
  }
1923
1579
  function fileExists(url) {
@@ -1976,13 +1632,13 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
1976
1632
  Object.defineProperty(error, "module", { value: String(base) });
1977
1633
  throw error;
1978
1634
  }
1979
- const stats = tryStatSync(filePath.endsWith("/") ? filePath.slice(-1) : filePath);
1635
+ const stats = tryStatSync(filePath);
1980
1636
  if (stats && stats.isDirectory()) {
1981
1637
  const error = new ERR_UNSUPPORTED_DIR_IMPORT(filePath, fileURLToPath(base));
1982
1638
  error.url = String(resolved);
1983
1639
  throw error;
1984
1640
  }
1985
- if (!stats || !stats.isFile()) {
1641
+ if (!stats || !stats.isFile() || resolved.pathname.endsWith("/")) {
1986
1642
  const error = new ERR_MODULE_NOT_FOUND(filePath || resolved.pathname, base && fileURLToPath(base), true);
1987
1643
  error.url = String(resolved);
1988
1644
  throw error;
@@ -1990,7 +1646,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
1990
1646
  if (!preserveSymlinks) {
1991
1647
  const real = realpathSync(filePath);
1992
1648
  const { search, hash } = resolved;
1993
- resolved = pathToFileURL(real + (filePath.endsWith(path.sep) ? "/" : ""));
1649
+ resolved = pathToFileURL(real);
1994
1650
  resolved.search = search;
1995
1651
  resolved.hash = hash;
1996
1652
  }
@@ -2003,7 +1659,8 @@ function exportsNotFound(subpath, packageJsonUrl, base) {
2003
1659
  return new ERR_PACKAGE_PATH_NOT_EXPORTED(fileURLToPath(new URL$1(".", packageJsonUrl)), subpath, base && fileURLToPath(base));
2004
1660
  }
2005
1661
  function throwInvalidSubpath(request, match, packageJsonUrl, internal, base) {
2006
- throw new ERR_INVALID_MODULE_SPECIFIER(request, `request is not a valid match in pattern "${match}" for the "${internal ? "imports" : "exports"}" resolution of ${fileURLToPath(packageJsonUrl)}`, base && fileURLToPath(base));
1662
+ const reason = `request is not a valid match in pattern "${match}" for the "${internal ? "imports" : "exports"}" resolution of ${fileURLToPath(packageJsonUrl)}`;
1663
+ throw new ERR_INVALID_MODULE_SPECIFIER(request, reason, base && fileURLToPath(base));
2007
1664
  }
2008
1665
  function invalidPackageTarget(subpath, target, packageJsonUrl, internal, base) {
2009
1666
  target = typeof target === "object" && target !== null ? JSON.stringify(target, null, "") : `${target}`;
@@ -2022,12 +1679,14 @@ function resolvePackageTargetString(target, subpath, match, packageJsonUrl, base
2022
1679
  }
2023
1680
  throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
2024
1681
  }
2025
- if (invalidSegmentRegEx.exec(target.slice(2)) !== null) if (deprecatedInvalidSegmentRegEx.exec(target.slice(2)) === null) {
2026
- if (!isPathMap) {
2027
- const request = pattern ? match.replace("*", () => subpath) : match + subpath;
2028
- emitInvalidSegmentDeprecation(pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, () => subpath) : target, request, match, packageJsonUrl, internal, base, true);
2029
- }
2030
- } else throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
1682
+ if (invalidSegmentRegEx.exec(target.slice(2)) !== null) {
1683
+ if (deprecatedInvalidSegmentRegEx.exec(target.slice(2)) === null) {
1684
+ if (!isPathMap) {
1685
+ const request = pattern ? match.replace("*", () => subpath) : match + subpath;
1686
+ emitInvalidSegmentDeprecation(pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, () => subpath) : target, request, match, packageJsonUrl, internal, base, true);
1687
+ }
1688
+ } else throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
1689
+ }
2031
1690
  const resolved = new URL$1(target, packageJsonUrl);
2032
1691
  const resolvedPath = resolved.pathname;
2033
1692
  const packagePath = new URL$1(".", packageJsonUrl).pathname;
@@ -2172,29 +1831,31 @@ function packageImportsResolve(name, base, conditions) {
2172
1831
  if (packageConfig.exists) {
2173
1832
  packageJsonUrl = pathToFileURL(packageConfig.pjsonPath);
2174
1833
  const imports = packageConfig.imports;
2175
- if (imports) if (own.call(imports, name) && !name.includes("*")) {
2176
- const resolveResult = resolvePackageTarget(packageJsonUrl, imports[name], "", name, base, false, true, false, conditions);
2177
- if (resolveResult !== null && resolveResult !== void 0) return resolveResult;
2178
- } else {
2179
- let bestMatch = "";
2180
- let bestMatchSubpath = "";
2181
- const keys = Object.getOwnPropertyNames(imports);
2182
- let i = -1;
2183
- while (++i < keys.length) {
2184
- const key = keys[i];
2185
- const patternIndex = key.indexOf("*");
2186
- if (patternIndex !== -1 && name.startsWith(key.slice(0, patternIndex))) {
2187
- const patternTrailer = key.slice(patternIndex + 1);
2188
- if (name.length >= key.length && name.endsWith(patternTrailer) && patternKeyCompare(bestMatch, key) === 1 && key.lastIndexOf("*") === patternIndex) {
2189
- bestMatch = key;
2190
- bestMatchSubpath = name.slice(patternIndex, name.length - patternTrailer.length);
1834
+ if (imports) {
1835
+ if (own.call(imports, name) && !name.includes("*")) {
1836
+ const resolveResult = resolvePackageTarget(packageJsonUrl, imports[name], "", name, base, false, true, false, conditions);
1837
+ if (resolveResult !== null && resolveResult !== void 0) return resolveResult;
1838
+ } else {
1839
+ let bestMatch = "";
1840
+ let bestMatchSubpath = "";
1841
+ const keys = Object.getOwnPropertyNames(imports);
1842
+ let i = -1;
1843
+ while (++i < keys.length) {
1844
+ const key = keys[i];
1845
+ const patternIndex = key.indexOf("*");
1846
+ if (patternIndex !== -1 && name.startsWith(key.slice(0, patternIndex))) {
1847
+ const patternTrailer = key.slice(patternIndex + 1);
1848
+ if (name.length >= key.length && name.endsWith(patternTrailer) && patternKeyCompare(bestMatch, key) === 1 && key.lastIndexOf("*") === patternIndex) {
1849
+ bestMatch = key;
1850
+ bestMatchSubpath = name.slice(patternIndex, name.length - patternTrailer.length);
1851
+ }
2191
1852
  }
2192
1853
  }
2193
- }
2194
- if (bestMatch) {
2195
- const target = imports[bestMatch];
2196
- const resolveResult = resolvePackageTarget(packageJsonUrl, target, bestMatchSubpath, bestMatch, base, true, true, false, conditions);
2197
- if (resolveResult !== null && resolveResult !== void 0) return resolveResult;
1854
+ if (bestMatch) {
1855
+ const target = imports[bestMatch];
1856
+ const resolveResult = resolvePackageTarget(packageJsonUrl, target, bestMatchSubpath, bestMatch, base, true, true, false, conditions);
1857
+ if (resolveResult !== null && resolveResult !== void 0) return resolveResult;
1858
+ }
2198
1859
  }
2199
1860
  }
2200
1861
  }
@@ -2286,16 +1947,17 @@ const DEFAULT_CONDITIONS_SET = /* #__PURE__ */ new Set(["node", "import"]);
2286
1947
  const DEFAULT_CONDITIONS_KEY = "2:6:import4:node";
2287
1948
  const isWindows$1 = /* #__PURE__ */ (() => process.platform === "win32")();
2288
1949
  const globalCache = /* #__PURE__ */ (() => globalThis["__EXSOLVE_CACHE__"] ||= /* @__PURE__ */ new Map())();
1950
+ const packageJSONCaches = /* #__PURE__ */ new WeakMap();
2289
1951
  function resolveModuleURL(input, options) {
2290
1952
  const parsedInput = _parseInput(input);
2291
1953
  if ("external" in parsedInput) return parsedInput.external;
2292
1954
  const specifier = parsedInput.specifier;
2293
1955
  let url = parsedInput.url;
2294
- let absolutePath = parsedInput.absolutePath;
1956
+ const absolutePath = parsedInput.absolutePath;
2295
1957
  let cacheKey;
2296
1958
  let cacheObj;
2297
1959
  if (options?.cache !== false) {
2298
- cacheKey = _cacheKey(absolutePath || specifier, options);
1960
+ cacheKey = _cacheKey(url ? url.href : absolutePath || specifier, options, !!absolutePath);
2299
1961
  cacheObj = options?.cache && typeof options?.cache === "object" ? options.cache : globalCache;
2300
1962
  }
2301
1963
  if (cacheObj) {
@@ -2303,50 +1965,69 @@ function resolveModuleURL(input, options) {
2303
1965
  if (typeof cached === "string") return cached;
2304
1966
  if (cached instanceof Error) {
2305
1967
  if (options?.try) return;
2306
- throw cached;
1968
+ throw _copyError(cached);
2307
1969
  }
2308
1970
  }
2309
- if (absolutePath) try {
2310
- const stat = lstatSync(absolutePath);
2311
- if (stat.isSymbolicLink()) {
2312
- absolutePath = realpathSync(absolutePath);
2313
- url = pathToFileURL(absolutePath);
2314
- }
2315
- if (stat.isFile()) {
2316
- if (cacheObj) cacheObj.set(cacheKey, url.href);
2317
- return url.href;
2318
- }
2319
- } catch (error) {
2320
- if (error?.code !== "ENOENT") {
2321
- if (cacheObj) cacheObj.set(cacheKey, error);
2322
- throw error;
1971
+ if (absolutePath) {
1972
+ url ||= pathToFileURL(absolutePath);
1973
+ try {
1974
+ if (statSync(absolutePath).isFile() && !url.pathname.endsWith("/")) {
1975
+ const realPath = options?.preserveSymlinks ? absolutePath : realpathSync(absolutePath);
1976
+ if (realPath !== absolutePath) {
1977
+ const { search, hash } = url;
1978
+ url = pathToFileURL(realPath);
1979
+ url.search = search;
1980
+ url.hash = hash;
1981
+ }
1982
+ if (cacheObj) cacheObj.set(cacheKey, url.href);
1983
+ return url.href;
1984
+ }
1985
+ } catch (error) {
1986
+ if (error?.code !== "ENOENT" && error?.code !== "ENOTDIR") {
1987
+ if (cacheObj) _cacheError(cacheObj, cacheKey, error);
1988
+ if (options?.try) return;
1989
+ throw error;
1990
+ }
2323
1991
  }
2324
1992
  }
2325
1993
  const conditionsSet = options?.conditions ? new Set(options.conditions) : DEFAULT_CONDITIONS_SET;
2326
- const target = specifier || url.href;
2327
- const bases = _normalizeBases(options?.from);
1994
+ let target = specifier;
1995
+ if (absolutePath) {
1996
+ const targetURL = new URL(url);
1997
+ targetURL.search = "";
1998
+ targetURL.hash = "";
1999
+ target = targetURL.href;
2000
+ }
2001
+ const bases = absolutePath ? [url] : _normalizeBases(options?.from);
2328
2002
  const suffixes = options?.suffixes || [""];
2329
2003
  const extensions = options?.extensions ? ["", ...options.extensions] : [""];
2330
2004
  let resolved;
2005
+ const previousPackageJSONCache = setPackageJSONCache(_packageJSONCache(cacheObj, cacheKey));
2331
2006
  for (const base of bases) {
2332
2007
  for (const suffix of suffixes) {
2333
2008
  let name = _join(target, suffix);
2334
2009
  if (name === ".") name += "/.";
2335
2010
  for (const extension of extensions) {
2336
- resolved = _tryModuleResolve(name + extension, base, conditionsSet);
2011
+ resolved = _tryModuleResolve(name + extension, base, conditionsSet, options?.preserveSymlinks);
2337
2012
  if (resolved) break;
2338
2013
  }
2339
2014
  if (resolved) break;
2340
2015
  }
2341
2016
  if (resolved) break;
2342
2017
  }
2018
+ setPackageJSONCache(previousPackageJSONCache);
2343
2019
  if (!resolved) {
2344
- const error = /* @__PURE__ */ new Error(`Cannot resolve module "${input}" (from: ${bases.map((u) => _fmtPath(u)).join(", ")})`);
2020
+ const from = absolutePath ? _normalizeBases(options?.from) : bases;
2021
+ const error = /* @__PURE__ */ new Error(`Cannot resolve module "${input}" (from: ${from.map((u) => _fmtPath(u)).join(", ")})`);
2345
2022
  error.code = "ERR_MODULE_NOT_FOUND";
2346
- if (cacheObj) cacheObj.set(cacheKey, error);
2023
+ if (cacheObj) _cacheError(cacheObj, cacheKey, error);
2347
2024
  if (options?.try) return;
2348
2025
  throw error;
2349
2026
  }
2027
+ if (absolutePath) {
2028
+ resolved.search = url.search;
2029
+ resolved.hash = url.hash;
2030
+ }
2350
2031
  if (cacheObj) cacheObj.set(cacheKey, resolved.href);
2351
2032
  return resolved.href;
2352
2033
  }
@@ -2357,9 +2038,9 @@ function resolveModulePath(id, options) {
2357
2038
  const absolutePath = fileURLToPath(resolved);
2358
2039
  return isWindows$1 ? _normalizeWinPath(absolutePath) : absolutePath;
2359
2040
  }
2360
- function _tryModuleResolve(specifier, base, conditions) {
2041
+ function _tryModuleResolve(specifier, base, conditions, preserveSymlinks) {
2361
2042
  try {
2362
- return moduleResolve(specifier, base, conditions);
2043
+ return moduleResolve(specifier, base, conditions, preserveSymlinks);
2363
2044
  } catch {}
2364
2045
  }
2365
2046
  function _normalizeBases(inputs) {
@@ -2386,11 +2067,44 @@ function _fmtPath(input) {
2386
2067
  return input;
2387
2068
  }
2388
2069
  }
2389
- function _cacheKey(id, options) {
2070
+ function _cacheError(cache, key, error) {
2071
+ const copy = _copyError(error);
2072
+ copy.stack = error.stack;
2073
+ cache.set(key, copy);
2074
+ }
2075
+ function _copyError(error) {
2076
+ const copy = /* @__PURE__ */ new Error();
2077
+ Object.setPrototypeOf(copy, Object.getPrototypeOf(error));
2078
+ for (const key of Reflect.ownKeys(error)) if (key !== "stack") Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(error, key));
2079
+ return copy;
2080
+ }
2081
+ function _packageJSONCache(cacheObj, key) {
2082
+ if (!cacheObj) return /* @__PURE__ */ new Map();
2083
+ let packageJSONCache = packageJSONCaches.get(cacheObj);
2084
+ if (!packageJSONCache || !cacheObj.has(packageJSONCache.key)) {
2085
+ packageJSONCache = {
2086
+ key,
2087
+ packages: /* @__PURE__ */ new Map()
2088
+ };
2089
+ packageJSONCaches.set(cacheObj, packageJSONCache);
2090
+ }
2091
+ return packageJSONCache.packages;
2092
+ }
2093
+ function _cacheKey(id, options, absolute) {
2390
2094
  let from;
2391
2095
  if (Array.isArray(options?.from)) from = options.from;
2392
2096
  else if (options?.from) from = [options.from];
2393
- return _cacheKeyValues([id]) + _conditionsKey(options?.conditions) + _cacheKeyValues(options?.extensions) + _cacheKeyValues(from) + _cacheKeyValues(options?.suffixes);
2097
+ const cwd = !absolute && _usesCwd(from) ? [process.cwd()] : void 0;
2098
+ return _cacheKeyValues([id]) + _cacheKeyValues(cwd) + _conditionsKey(options?.conditions) + _cacheKeyValues(options?.extensions) + _cacheKeyValues(from) + _cacheKeyValues(options?.suffixes) + (options?.preserveSymlinks ? "1" : "0");
2099
+ }
2100
+ function _usesCwd(from) {
2101
+ let hasBase = false;
2102
+ for (const base of from || []) if (_isURL(base)) hasBase = true;
2103
+ else if (typeof base === "string" && base) {
2104
+ if (!(isWindows$1 ? /^(?:[a-z]:[/\\]|[/\\]{2})/i.test(base) : isAbsolute(base)) && !/^(?:node|data|http|https|file):/.test(base)) return true;
2105
+ hasBase = true;
2106
+ }
2107
+ return !hasBase;
2394
2108
  }
2395
2109
  function _conditionsKey(conditions) {
2396
2110
  if (!conditions) return DEFAULT_CONDITIONS_KEY;
@@ -2415,6 +2129,13 @@ function _normalizeWinPath(path) {
2415
2129
  function _isURL(input) {
2416
2130
  return input instanceof URL || input?.constructor?.name === "URL";
2417
2131
  }
2132
+ function _normalizeAbsolutePath(input) {
2133
+ if (isWindows$1 && input.startsWith("\\\\?\\")) return fileURLToPath(pathToFileURL(input));
2134
+ const path = resolve(input);
2135
+ const last = input.at(-1);
2136
+ if ((last === "/" || isWindows$1 && last === "\\") && !path.endsWith(sep)) return path + sep;
2137
+ return path;
2138
+ }
2418
2139
  function _parseInput(input) {
2419
2140
  if (typeof input === "string") {
2420
2141
  if (input.startsWith("file:")) {
@@ -2424,10 +2145,7 @@ function _parseInput(input) {
2424
2145
  absolutePath: fileURLToPath(url)
2425
2146
  };
2426
2147
  }
2427
- if (isAbsolute(input)) return {
2428
- url: pathToFileURL(input),
2429
- absolutePath: input
2430
- };
2148
+ if (isAbsolute(input)) return { absolutePath: _normalizeAbsolutePath(input) };
2431
2149
  if (/^(?:node|data|http|https):/.test(input)) return { external: input };
2432
2150
  if (nodeBuiltins.includes(input) && !input.includes(":")) return { external: `node:${input}` };
2433
2151
  return { specifier: input };
@@ -2441,8 +2159,7 @@ function _parseInput(input) {
2441
2159
  }
2442
2160
  throw new TypeError("id must be a `string` or `URL`");
2443
2161
  }
2444
- //#endregion
2445
- //#region node_modules/.pnpm/pkg-types@2.3.1/node_modules/pkg-types/dist/index.mjs
2162
+ // node_modules/.pnpm/pkg-types@2.4.0/node_modules/pkg-types/dist/index.mjs
2446
2163
  const defaultFindOptions = {
2447
2164
  startingFrom: ".",
2448
2165
  rootPattern: /^node_modules$/,
@@ -2487,7 +2204,7 @@ function _resolvePath(id, opts = {}) {
2487
2204
  from: opts.from || opts.parent || opts.url
2488
2205
  });
2489
2206
  }
2490
- const FileCache = /* @__PURE__ */ new Map();
2207
+ const FileCache = /* #__PURE__ */ new Map();
2491
2208
  async function readPackageJSON(id, options = {}) {
2492
2209
  const resolvedPath = await resolvePackageJSON(id, options);
2493
2210
  const cache = options.cache && typeof options.cache !== "boolean" ? options.cache : FileCache;
@@ -2495,9 +2212,9 @@ async function readPackageJSON(id, options = {}) {
2495
2212
  const blob = await promises.readFile(resolvedPath, "utf8");
2496
2213
  let parsed;
2497
2214
  try {
2498
- parsed = n(blob);
2499
- } catch {
2500
2215
  parsed = r(blob);
2216
+ } catch {
2217
+ parsed = i(blob);
2501
2218
  }
2502
2219
  cache.set(resolvedPath, parsed);
2503
2220
  return parsed;
@@ -2508,8 +2225,7 @@ async function resolvePackageJSON(id = process.cwd(), options = {}) {
2508
2225
  startingFrom: _resolvePath(id, options)
2509
2226
  });
2510
2227
  }
2511
- //#endregion
2512
- //#region node_modules/.pnpm/changelogen@0.6.2/node_modules/changelogen/dist/shared/changelogen.D-9f3HTX.mjs
2228
+ // node_modules/.pnpm/changelogen@0.6.2/node_modules/changelogen/dist/shared/changelogen.D-9f3HTX.mjs
2513
2229
  function execCommand(cmd, cwd) {
2514
2230
  return execSync(cmd, {
2515
2231
  encoding: "utf8",
@@ -2820,8 +2536,7 @@ async function resolveChangelogConfig(config, cwd) {
2820
2536
  if (typeof config.repo === "string") config.repo = getRepoConfig(config.repo);
2821
2537
  return config;
2822
2538
  }
2823
- //#endregion
2824
- //#region src/core/releaser/changelog.ts
2539
+ // src/core/releaser/changelog.ts
2825
2540
  async function getConventionalChangelog(commits) {
2826
2541
  if (!commits[0].type) return commits.map((c) => c.message).join("\n");
2827
2542
  return (await generateMarkDown(commits.map((c) => {
@@ -2879,8 +2594,7 @@ async function getGitCommits(currentTag, commitMessageTemplate) {
2879
2594
  const filterRegex = new RegExp(escapeRegExp(commitMessageTemplate));
2880
2595
  return parseCommits((await getGitDiff(previousTag, currentTag)).filter((c) => !filterRegex.test(c.message)), { scopeMap: {} });
2881
2596
  }
2882
- //#endregion
2883
- //#region src/utils/mime.ts
2597
+ // src/utils/mime.ts
2884
2598
  const mimeTypes = {
2885
2599
  json: "application/json",
2886
2600
  xpi: "application/x-xpinstall"
@@ -2889,8 +2603,7 @@ function getMimeTypeByFileName(filename) {
2889
2603
  const ext = extname(filename);
2890
2604
  for (const type in mimeTypes) if (ext === `.${type}`) return mimeTypes[type];
2891
2605
  }
2892
- //#endregion
2893
- //#region src/core/releaser/github.ts
2606
+ // src/core/releaser/github.ts
2894
2607
  var GitHub = class extends ReleaseBase {
2895
2608
  client;
2896
2609
  constructor(ctx) {
@@ -2906,21 +2619,51 @@ var GitHub = class extends ReleaseBase {
2906
2619
  return this.ctx;
2907
2620
  }
2908
2621
  /**
2909
- * Create new release and upload XPI to asset
2622
+ * Create the release of the current version and upload the XPI.
2623
+ *
2624
+ * The release is created as a draft and published only after all assets are
2625
+ * uploaded, so that the process is compatible with
2626
+ * [immutable releases](https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/immutable-releases):
2627
+ * the assets of a published immutable release can neither be added nor deleted.
2628
+ *
2629
+ * @see https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/immutable-releases
2910
2630
  */
2911
2631
  async uploadXPI() {
2912
2632
  const { version, dist, xpiName } = this.ctx;
2913
- const release = await this.createRelease({
2914
- ...this.remote,
2915
- tag_name: this.ctx.release.bumpp.tag.toString().replaceAll("%s", version),
2916
- name: `Release v${version}`,
2917
- body: await this.getChangelog(),
2918
- prerelease: version.includes("-"),
2919
- make_latest: "true"
2920
- });
2633
+ const tag = this.versionTag;
2634
+ const assetName = `${xpiName}.xpi`;
2635
+ const assetPath = join(dist, assetName);
2636
+ let release = await this.findReleaseByTag(tag);
2637
+ if (release && !release.draft) {
2638
+ if ((await this.listAssets(release.id)).some((asset) => asset.name === assetName)) {
2639
+ this.logger.warn(`Release "${tag}" already contains "${assetName}", skip uploading the XPI.`);
2640
+ return;
2641
+ }
2642
+ if (release.immutable) {
2643
+ this.logger.error(`GitHub does not allow adding assets to the published immutable release "${tag}". Please bump a new version and release again, note that the tag "${tag}" cannot be reused.`);
2644
+ throw new Error(`Unable to upload "${assetName}" to the immutable release "${tag}".`);
2645
+ }
2646
+ }
2647
+ if (!release) {
2648
+ this.logger.debug(`Creating draft release "${tag}"...`);
2649
+ release = await this.createRelease({
2650
+ ...this.remote,
2651
+ tag_name: tag,
2652
+ name: `Release v${version}`,
2653
+ body: await this.getChangelog(),
2654
+ draft: true,
2655
+ prerelease: version.includes("-")
2656
+ });
2657
+ }
2921
2658
  if (!release) throw new Error("Create release failed!");
2922
- this.logger.debug("Uploading xpi asset...");
2923
- await this.uploadAsset(release.id, join(dist, `${xpiName}.xpi`));
2659
+ await this.replaceAsset(release.id, assetPath);
2660
+ if (release.draft) {
2661
+ this.logger.debug(`Publishing release "${tag}"...`);
2662
+ if ((await this.publishRelease(release.id, {
2663
+ prerelease: version.includes("-"),
2664
+ makeLatest: true
2665
+ }))?.immutable) this.logger.debug(`Release "${tag}" is immutable and covered by a release attestation.`);
2666
+ }
2924
2667
  }
2925
2668
  async getReleaseByTag(tag) {
2926
2669
  return await this.client.rest.repos.getReleaseByTag({
@@ -2930,11 +2673,27 @@ var GitHub = class extends ReleaseBase {
2930
2673
  this.logger.debug(`Release with tag ${tag} not found. ${e}`);
2931
2674
  }).then((res) => {
2932
2675
  if (res && res.status === 200) {
2933
- this.logger.debug(`Found release with tag "${tag}", id=${res.data.id}.`);
2676
+ this.logger.debug(`Found release with tag "${tag}", id=${res.data.id}, immutable=${res.data.immutable}.`);
2934
2677
  return res.data;
2935
2678
  }
2936
2679
  });
2937
2680
  }
2681
+ /**
2682
+ * Find the release with the given tag, including drafts.
2683
+ *
2684
+ * `getReleaseByTag` does not return drafts, but a draft keeps the tag name it
2685
+ * will use once published, so it must be reused to retry a failed release.
2686
+ */
2687
+ async findReleaseByTag(tag) {
2688
+ const published = await this.getReleaseByTag(tag);
2689
+ if (published) return published;
2690
+ const draft = (await this.client.paginate(this.client.rest.repos.listReleases, {
2691
+ ...this.remote,
2692
+ per_page: 100
2693
+ })).find((release) => release.draft && release.tag_name === tag);
2694
+ if (draft) this.logger.debug(`Found draft release with tag "${tag}", id=${draft.id}.`);
2695
+ return draft;
2696
+ }
2938
2697
  async createRelease(options) {
2939
2698
  this.logger.debug("Creating release...");
2940
2699
  this.logger.debug(options);
@@ -2948,8 +2707,51 @@ var GitHub = class extends ReleaseBase {
2948
2707
  }
2949
2708
  });
2950
2709
  }
2710
+ /**
2711
+ * Publish a draft release.
2712
+ *
2713
+ * For repositories with immutable releases enabled, the release becomes
2714
+ * immutable as soon as it is published, so all assets must be uploaded before.
2715
+ */
2716
+ async publishRelease(releaseID, options) {
2717
+ const { prerelease, makeLatest = false } = options;
2718
+ this.logger.debug(`Publishing release ${releaseID} (prerelease=${prerelease}, makeLatest=${makeLatest})...`);
2719
+ return await this.client.rest.repos.updateRelease({
2720
+ ...this.remote,
2721
+ release_id: releaseID,
2722
+ draft: false,
2723
+ prerelease,
2724
+ ...makeLatest && !prerelease ? { make_latest: "true" } : {}
2725
+ }).then((res) => {
2726
+ this.logger.debug(`Publish release ${releaseID} success, immutable=${res.data.immutable}.`);
2727
+ return res.data;
2728
+ });
2729
+ }
2730
+ async listAssets(releaseID) {
2731
+ return await this.client.paginate(this.client.rest.repos.listReleaseAssets, {
2732
+ ...this.remote,
2733
+ release_id: releaseID,
2734
+ per_page: 100
2735
+ });
2736
+ }
2737
+ /**
2738
+ * Upload an asset, replacing the asset with the same name if it exists.
2739
+ */
2740
+ async replaceAsset(releaseID, assetPath) {
2741
+ const assetName = basename(assetPath);
2742
+ const existing = (await this.listAssets(releaseID)).find((asset) => asset.name === assetName);
2743
+ if (existing) {
2744
+ this.logger.debug(`Deleting existed asset "${assetName}" (id: ${existing.id}) in release ${releaseID}...`);
2745
+ await this.client.rest.repos.deleteReleaseAsset({
2746
+ ...this.remote,
2747
+ asset_id: existing.id
2748
+ });
2749
+ }
2750
+ await this.uploadAsset(releaseID, assetPath);
2751
+ }
2951
2752
  async uploadAsset(releaseID, asset) {
2952
- this.logger.debug(`Uploading ${asset} to release ${releaseID}`);
2753
+ const assetName = basename(asset);
2754
+ this.logger.debug(`Uploading ${assetName} to release ${releaseID}`);
2953
2755
  return await this.client.rest.repos.uploadReleaseAsset({
2954
2756
  ...this.remote,
2955
2757
  release_id: releaseID,
@@ -2958,7 +2760,10 @@ var GitHub = class extends ReleaseBase {
2958
2760
  "content-type": getMimeTypeByFileName(asset) || "application/octet-stream",
2959
2761
  "content-length": (await stat(asset)).size
2960
2762
  },
2961
- name: basename(asset)
2763
+ name: assetName
2764
+ }).catch((error) => {
2765
+ if (isImmutableReleaseError(error)) this.logImmutableHint();
2766
+ throw error;
2962
2767
  }).then((res) => {
2963
2768
  this.logger.debug(`Upload "${res.data.name}" success, assetId: ${res.data.id}`);
2964
2769
  return res.data;
@@ -2970,36 +2775,44 @@ var GitHub = class extends ReleaseBase {
2970
2775
  this.logger.debug(`Skip refresh update.json because release.github.updater = false`);
2971
2776
  return;
2972
2777
  }
2973
- const { dist, version } = this.ctx;
2974
- const assets = (await glob(`${dist}/update*.json`)).map((p) => basename(p));
2975
- const release = await this.getReleaseByTag(updater) ?? await this.createRelease({
2976
- ...this.remote,
2977
- tag_name: updater,
2978
- prerelease: true,
2979
- make_latest: "false"
2980
- });
2981
- if (!release) throw new Error("Get or create 'release' failed.");
2982
- const existAssets = await this.client.rest.repos.listReleaseAssets({
2983
- ...this.remote,
2984
- release_id: release.id
2985
- }).then((res) => {
2986
- return res.data.filter((asset) => assets.includes(asset.name));
2987
- });
2988
- if (existAssets) {
2989
- for (const existAsset of existAssets) if (assets.includes(existAsset.name)) {
2990
- this.logger.debug(`Delete existed asset ${existAsset.name} in release ${updater}`);
2991
- await this.client.rest.repos.deleteReleaseAsset({
2992
- ...this.remote,
2993
- asset_id: existAsset.id
2994
- });
2995
- }
2778
+ const { dist } = this.ctx;
2779
+ const manifests = (await glob(`${dist}/update*.json`)).map((p) => basename(p));
2780
+ const release = await this.findReleaseByTag(updater);
2781
+ if (!release || release.draft) {
2782
+ const draft = release ?? await this.createRelease({
2783
+ ...this.remote,
2784
+ tag_name: updater,
2785
+ name: "Release Manifest",
2786
+ body: this.manifestBody,
2787
+ draft: true,
2788
+ prerelease: true
2789
+ });
2790
+ if (!draft) throw new Error("Create the release for update.json failed.");
2791
+ for (const manifest of manifests) await this.replaceAsset(draft.id, join(dist, manifest));
2792
+ if ((await this.publishRelease(draft.id, { prerelease: true }))?.immutable) this.logger.warn(`The release "${updater}" was published as an immutable release, so \`update.json\` cannot be updated in it by the next release. Create this release while immutable releases are disabled, then enable immutability.`);
2793
+ return;
2794
+ }
2795
+ if (release.immutable) {
2796
+ this.logger.error(`The release "${updater}" is immutable, so \`update.json\` cannot be uploaded to it.`);
2797
+ this.logImmutableHint();
2798
+ throw new Error(`Unable to update the immutable release "${updater}".`);
2799
+ }
2800
+ const existedAssets = await this.listAssets(release.id);
2801
+ for (const manifest of manifests) {
2802
+ const existedAsset = existedAssets.find((asset) => asset.name === manifest);
2803
+ if (!existedAsset) continue;
2804
+ this.logger.debug(`Delete existed asset ${manifest} in release ${updater}`);
2805
+ await this.client.rest.repos.deleteReleaseAsset({
2806
+ ...this.remote,
2807
+ asset_id: existedAsset.id
2808
+ });
2996
2809
  }
2997
- for (const asset of assets) await this.uploadAsset(release.id, join(dist, asset));
2810
+ for (const manifest of manifests) await this.uploadAsset(release.id, join(dist, manifest));
2998
2811
  await this.client.rest.repos.updateRelease({
2999
2812
  ...this.remote,
3000
2813
  release_id: release.id,
3001
2814
  name: "Release Manifest",
3002
- body: `This release is used to host \`update.json\`, please do not delete or modify it! \n Updated in UTC ${(/* @__PURE__ */ new Date()).toISOString()} for version ${version}`,
2815
+ body: this.manifestBody,
3003
2816
  prerelease: true,
3004
2817
  make_latest: "false"
3005
2818
  });
@@ -3024,9 +2837,43 @@ var GitHub = class extends ReleaseBase {
3024
2837
  repo
3025
2838
  };
3026
2839
  }
2840
+ /**
2841
+ * The tag of the release of the current version, e.g. `v1.0.0`.
2842
+ */
2843
+ get versionTag() {
2844
+ return this.ctx.release.bumpp.tag.toString().replaceAll("%s", this.ctx.version);
2845
+ }
2846
+ get manifestBody() {
2847
+ return `This release is used to host \`update.json\`, please do not delete or modify it! \n Updated in UTC ${(/* @__PURE__ */ new Date()).toISOString()} for version ${this.ctx.version}`;
2848
+ }
2849
+ /**
2850
+ * Explain how to handle immutable releases, called when an immutable release
2851
+ * blocks the current operation.
2852
+ */
2853
+ logImmutableHint() {
2854
+ this.logger.error([
2855
+ "GitHub immutable releases cannot be changed after publication:",
2856
+ "assets can neither be added nor deleted, and tag names cannot be reused.",
2857
+ "Only releases published after immutable releases were enabled are affected,",
2858
+ "so releases created before enabling it can still be updated.",
2859
+ "",
2860
+ "To host update.json on a GitHub release, publish it once while immutable",
2861
+ "releases are disabled, then enable immutability.",
2862
+ "Alternatively, host update.json yourself and set `release.github.updater: false`.",
2863
+ "",
2864
+ "See https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/immutable-releases"
2865
+ ].join("\n"));
2866
+ }
3027
2867
  };
3028
- //#endregion
3029
- //#region src/core/releaser/index.ts
2868
+ /**
2869
+ * Whether the error was raised because the release is immutable.
2870
+ */
2871
+ function isImmutableReleaseError(error) {
2872
+ if (typeof error !== "object" || error === null) return false;
2873
+ const { message, status } = error;
2874
+ return status === 422 && typeof message === "string" && message.includes("immutable release");
2875
+ }
2876
+ // src/core/releaser/index.ts
3030
2877
  var Release = class extends Base {
3031
2878
  constructor(ctx) {
3032
2879
  super(ctx);
@@ -3087,8 +2934,7 @@ var Release = class extends Base {
3087
2934
  return this.ctx.release.bumpp.commit.replace("%s", this.ctx.version);
3088
2935
  }
3089
2936
  };
3090
- //#endregion
3091
- //#region src/utils/watcher.ts
2937
+ // src/utils/watcher.ts
3092
2938
  function watch(source, ignore, event) {
3093
2939
  const watcher = chokidar.watch(source, {
3094
2940
  ignored: [
@@ -3129,8 +2975,7 @@ function safeDebounce(fn) {
3129
2975
  }
3130
2976
  }, 500);
3131
2977
  }
3132
- //#endregion
3133
- //#region src/constant.ts
2978
+ // src/constant.ts
3134
2979
  const CACHE_DIR = `.scaffold/cache`;
3135
2980
  const ZOTERO_LOG_DIR = `.scaffold/logs`;
3136
2981
  const TESTER_PROFILE_DIR = `.scaffold/test/profile`;
@@ -3138,8 +2983,7 @@ const TESTER_DATA_DIR = `.scaffold/test/data`;
3138
2983
  const TESTER_PLUGIN_DIR = `.scaffold/test/resource`;
3139
2984
  const TESTER_PLUGIN_REF = "zotero-plugin-scaffold-test-runner";
3140
2985
  const TESTER_PLUGIN_ID = "scaffold-test@northword.cn";
3141
- //#endregion
3142
- //#region src/utils/process.ts
2986
+ // src/utils/process.ts
3143
2987
  function isRunning(query) {
3144
2988
  let cmd = "";
3145
2989
  switch (process$1.platform) {
@@ -3165,8 +3009,7 @@ const ExitSignals = [
3165
3009
  "SIGINT",
3166
3010
  "SIGTERM"
3167
3011
  ];
3168
- //#endregion
3169
- //#region src/utils/zotero/log-normalizer.ts
3012
+ // src/utils/zotero/log-normalizer.ts
3170
3013
  /**
3171
3014
  * ANSI escape sequences (e.g. `\x1b[31;40m`, `\x1b[0m`) that Zotero embeds
3172
3015
  * in terminal output. Zotero's Debug Output window strips these, but they
@@ -3272,8 +3115,7 @@ function createMessageNormalizer(onMessage) {
3272
3115
  }
3273
3116
  };
3274
3117
  }
3275
- //#endregion
3276
- //#region src/utils/zotero/preference.ts
3118
+ // src/utils/zotero/preference.ts
3277
3119
  const prefsCommon = {
3278
3120
  "browser.dom.window.dump.enabled": true,
3279
3121
  "datareporting.policy.dataSubmissionEnabled": false,
@@ -3329,8 +3171,8 @@ const prefs = {
3329
3171
  ...prefsFirefox,
3330
3172
  ...prefsZotero
3331
3173
  };
3332
- //#endregion
3333
- //#region src/utils/zotero/rdp-client.ts
3174
+ // src/utils/zotero/rdp-client.ts
3175
+ const DEFAULT_HOST = "127.0.0.1";
3334
3176
  const UNSOLICITED_EVENTS = /* @__PURE__ */ new Set([
3335
3177
  "tabNavigated",
3336
3178
  "styleApplied",
@@ -3378,25 +3220,21 @@ var MessagingClient = class extends EventEmitter {
3378
3220
  }
3379
3221
  async connect(port) {
3380
3222
  await new Promise((resolve, reject) => {
3381
- const d = domain.create();
3382
- d.once("error", reject);
3383
- d.run(() => {
3384
- const connectionOptions = {
3385
- port,
3386
- host: "127.0.0.1"
3387
- };
3388
- const conn = net.createConnection(connectionOptions, () => {
3389
- resolve();
3390
- });
3391
- this.connection = conn;
3392
- conn.on("data", this.onData.bind(this));
3393
- conn.on("error", reject);
3394
- conn.on("end", this.onEnd.bind(this));
3395
- conn.on("timeout", this.onTimeout.bind(this));
3396
- this.expectReply("root", {
3397
- resolve,
3398
- reject
3399
- });
3223
+ const connectionOptions = {
3224
+ port,
3225
+ host: DEFAULT_HOST
3226
+ };
3227
+ const conn = net.createConnection(connectionOptions, () => {
3228
+ resolve();
3229
+ });
3230
+ this.connection = conn;
3231
+ conn.on("data", this.onData.bind(this));
3232
+ conn.on("error", reject);
3233
+ conn.on("end", this.onEnd.bind(this));
3234
+ conn.on("timeout", this.onTimeout.bind(this));
3235
+ this.expectReply("root", {
3236
+ resolve,
3237
+ reject
3400
3238
  });
3401
3239
  });
3402
3240
  }
@@ -3502,8 +3340,7 @@ var MessagingClient = class extends EventEmitter {
3502
3340
  this.emit("timeout");
3503
3341
  }
3504
3342
  };
3505
- //#endregion
3506
- //#region src/utils/zotero/remote-zotero.ts
3343
+ // src/utils/zotero/remote-zotero.ts
3507
3344
  const MAX_RETRIES = 150;
3508
3345
  const RETRY_INTERVAL = 1e3;
3509
3346
  function requestErrorToMessage(err) {
@@ -3519,28 +3356,39 @@ var RemoteFirefox = class {
3519
3356
  client;
3520
3357
  checkedForAddonReloading;
3521
3358
  constructor() {
3522
- this.client = new MessagingClient();
3359
+ this.client = this.createClient();
3523
3360
  this.checkedForAddonReloading = false;
3524
- this.client.on("disconnect", () => {
3361
+ }
3362
+ /**
3363
+ * Create a client with all listeners attached.
3364
+ *
3365
+ * This has to be used for every (re)connection attempt, otherwise errors
3366
+ * emitted by a fresh client would have no listener and be thrown as
3367
+ * uncaught exceptions.
3368
+ */
3369
+ createClient() {
3370
+ const client = new MessagingClient();
3371
+ client.on("disconnect", () => {
3525
3372
  logger.debug("Received \"disconnect\" from Firefox client");
3526
3373
  });
3527
- this.client.on("end", () => {
3374
+ client.on("end", () => {
3528
3375
  logger.debug("Received \"end\" from Firefox client");
3529
3376
  });
3530
- this.client.on("unsolicited-event", (info) => {
3377
+ client.on("unsolicited-event", (info) => {
3531
3378
  logger.debug(`Received message from client: ${JSON.stringify(info)}`);
3532
3379
  });
3533
- this.client.on("rdp-error", (rdpError) => {
3380
+ client.on("rdp-error", (rdpError) => {
3534
3381
  logger.debug(`Received error from client: ${JSON.stringify(rdpError)}`);
3535
3382
  });
3536
- this.client.on("error", (error) => {
3383
+ client.on("error", (error) => {
3537
3384
  logger.debug(`Received error from client: ${String(error)}`);
3538
3385
  });
3386
+ return client;
3539
3387
  }
3540
3388
  async connect(port) {
3541
3389
  let lastError;
3542
3390
  for (const _ of Array.from({ length: MAX_RETRIES })) try {
3543
- this.client = new MessagingClient();
3391
+ this.client = this.createClient();
3544
3392
  await this.client.connect(port);
3545
3393
  return this.client;
3546
3394
  } catch (error) {
@@ -3663,8 +3511,7 @@ function findFreeTcpPort() {
3663
3511
  });
3664
3512
  });
3665
3513
  }
3666
- //#endregion
3667
- //#region src/utils/zotero-runner.ts
3514
+ // src/utils/zotero-runner.ts
3668
3515
  const default_options = {
3669
3516
  binary: {
3670
3517
  args: [],
@@ -3915,8 +3762,7 @@ async function cleanupOldLogs(dir) {
3915
3762
  } catch {}
3916
3763
  }));
3917
3764
  }
3918
- //#endregion
3919
- //#region src/core/server.ts
3765
+ // src/core/server.ts
3920
3766
  var Serve = class extends Base {
3921
3767
  builder;
3922
3768
  runner;
@@ -4005,8 +3851,7 @@ var Serve = class extends Base {
4005
3851
  return process$1.env.ZOTERO_PLUGIN_DATA_DIR;
4006
3852
  }
4007
3853
  };
4008
- //#endregion
4009
- //#region src/core/tester/headless.ts
3854
+ // src/core/tester/headless.ts
4010
3855
  async function prepareHeadless() {
4011
3856
  await installXvfb();
4012
3857
  await installDepsForUbuntu24();
@@ -4073,8 +3918,7 @@ async function installZoteroLinux() {
4073
3918
  process$1.env.ZOTERO_PLUGIN_ZOTERO_BIN_PATH = `${process$1.cwd()}/Zotero_linux-x86_64/zotero`;
4074
3919
  execSync("cd -");
4075
3920
  }
4076
- //#endregion
4077
- //#region src/core/tester/http-reporter.ts
3921
+ // src/core/tester/http-reporter.ts
4078
3922
  var TestHttpReporter = class {
4079
3923
  _server;
4080
3924
  _port;
@@ -4173,26 +4017,20 @@ var TestHttpReporter = class {
4173
4017
  this._server?.close();
4174
4018
  }
4175
4019
  };
4176
- //#endregion
4177
- //#region src/utils/file.ts
4020
+ // src/utils/file.ts
4178
4021
  async function saveResource(url, path) {
4179
4022
  const res = await fetch(url);
4180
4023
  await outputFile(path, await res.text());
4181
4024
  }
4182
- //#endregion
4183
- //#region src/core/tester/test-bundler-template/raw/bootstrap.js?raw
4025
+ // src/core/tester/test-bundler-template/raw/bootstrap.js?raw
4184
4026
  var bootstrap_default = "/* eslint-disable eslint-comments/no-unlimited-disable */\n/* eslint-disable */\n// Code generated by the zotero-plugin-scaffold tester\nvar chromeHandle;\n\nfunction install(data, reason) {}\n\nasync function startup({ id, version, resourceURI, rootURI }, reason) {\n await Zotero.initializationPromise;\n const aomStartup = Components.classes[\n \"@mozilla.org/addons/addon-manager-startup;1\"\n ].getService(Components.interfaces.amIAddonManagerStartup);\n const manifestURI = Services.io.newURI(rootURI + \"manifest.json\");\n chromeHandle = aomStartup.registerChrome(manifestURI, [\n [\"content\", \"__TESTER_PLUGIN_REF__\", rootURI + \"content/\"],\n ]);\n\n launchTests().catch((error) => {\n Zotero.debug(error);\n Zotero.HTTP.request(\n \"POST\",\n \"http://localhost:__PORT__/update\",\n {\n body: JSON.stringify({\n type: \"error\",\n data: {\n title: error.message,\n },\n }),\n }\n );\n // Although this is an exception, we still need to use the status code 0, \n // because status code 1 will cause Zotero to auto-restart.\n Zotero.Utilities.Internal.quit(0);\n });\n}\n\nfunction onMainWindowLoad({ window: win }) {}\n\nfunction onMainWindowUnload({ window: win }) {}\n\nfunction shutdown({ id, version, resourceURI, rootURI }, reason) {\n if (reason === APP_SHUTDOWN) {\n return;\n }\n\n if (chromeHandle) {\n chromeHandle.destruct();\n chromeHandle = null;\n }\n}\n\nfunction uninstall(data, reason) {}\n\nasync function launchTests() {\n // Delay to allow plugin to fully load before opening the test page\n if (__STARTUP_DELAY__) {\n await Zotero.Promise.delay(__STARTUP_DELAY__);\n }\n\n const waitForPlugin = \"__WAIT_FOR_PLUGIN__\";\n if (waitForPlugin) {\n // Wait for a plugin to be installed\n await waitUtilAsync(() => {\n try {\n return !!eval(waitForPlugin)();\n } catch (error) {\n return false;\n }\n }).catch(() => {\n throw new Error(\"Internal: Plugin awaiting timeout\");\n });\n }\n\n Services.ww.openWindow(\n null,\n \"chrome://__TESTER_PLUGIN_REF__/content/index.xhtml\",\n \"Zotero Plugin Scaffold Test Runnner\",\n \"chrome,centerscreen,resizable=yes\",\n {}\n );\n}\n\nfunction waitUtilAsync(condition, interval = 100, timeout = 1e4) {\n return new Promise((resolve, reject) => {\n const start = Date.now();\n const intervalId = setInterval(() => {\n if (condition()) {\n clearInterval(intervalId);\n resolve();\n } else if (Date.now() - start > timeout) {\n clearInterval(intervalId);\n reject();\n }\n }, interval);\n });\n}\n";
4185
- //#endregion
4186
- //#region src/core/tester/test-bundler-template/raw/index.html?raw
4027
+ // src/core/tester/test-bundler-template/raw/index.html?raw
4187
4028
  var raw_default = "<!-- Generated by zotero-plugin-scaffold -->\n<html lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>Zotero Plugin Test</title>\n <style>\n html {\n min-width: 400px;\n min-height: 600px;\n }\n body {\n font-family: Arial, sans-serif;\n }\n </style>\n </head>\n <body>\n <div id=\"mocha\"></div>\n\n <!-- Include Zotero Vars -->\n <script src=\"chrome://zotero/content/include.js\"><\/script>\n\n <!-- Mocha and Chai Libraries -->\n <script src=\"mocha.js\"><\/script>\n <script src=\"chai.js\"><\/script>\n\n <!-- Setup Mocha -->\n <script>\n __SETUP_CODE__;\n <\/script>\n\n <!-- Unit tests -->\n __TEST_FILES__\n\n <!-- Run Mocha -->\n <script class=\"mocha-exec\">\n mocha.run();\n <\/script>\n </body>\n</html>\n";
4188
- //#endregion
4189
- //#region src/core/tester/test-bundler-template/raw/manifest.json?raw
4029
+ // src/core/tester/test-bundler-template/raw/manifest.json?raw
4190
4030
  var manifest_default = "{\n \"manifest_version\": 2,\n \"name\": \"Zotero Plugin Scaffold Test Runner\",\n \"version\": \"0.0.1\",\n \"description\": \"Test suite for the Zotero plugin. This is a runtime-generated plugin only for testing purposes.\",\n \"applications\": {\n \"zotero\": {\n \"id\": \"__TESTER_PLUGIN_ID__\",\n \"update_url\": \"https://example.com\",\n \"strict_max_version\": \"999.*.*\"\n }\n }\n}\n";
4191
- //#endregion
4192
- //#region src/core/tester/test-bundler-template/raw/mocha-setup.js?raw
4031
+ // src/core/tester/test-bundler-template/raw/mocha-setup.js?raw
4193
4032
  var mocha_setup_default = "/* eslint-disable eslint-comments/no-unlimited-disable */\n/* eslint-disable */\n// Generated by zotero-plugin-scaffold\nmocha.setup({ \n ui: \"bdd\",\n reporter: Reporter,\n timeout: __TIMEOUT__ || 10000,\n bail: __ABORT_ON_FAIL__\n});\n\nwindow.expect = chai.expect;\nwindow.assert = chai.assert;\n\nasync function send(data) {\n const req = await Zotero.HTTP.request(\n \"POST\",\n \"http://localhost:__PORT__/update\",\n {\n body: JSON.stringify(data),\n }\n );\n\n if (req.status !== 200) {\n dump(\"Error sending data to server\" + req.responseText);\n return null;\n } else {\n const result = JSON.parse(req.responseText);\n return result;\n }\n}\n\nwindow.debug = function (data) {\n send({ type: \"debug\", data });\n};\n\nlet indents = 0,\n passed = 0,\n failed = 0,\n aborted = false;\n\n// Inherit the default test settings from Zotero\nfunction Reporter(runner) {\n function indent() {\n return \" \".repeat(indents);\n }\n\n function dump(str) {\n document.querySelector(\"#mocha\").innerText += str;\n }\n\n runner.on(\"start\", async function () {\n console.log(\"start\")\n await send({ type: \"start\", data: { indents } });\n });\n\n runner.on(\"suite\", async function (suite) {\n console.log(\"suite\", suite)\n indents++;\n const str = indent() + suite.title + \"\\n\";\n dump(str);\n await send({ type: \"suite\", data: { title: suite.title, root: suite.root, indents } });\n });\n\n runner.on(\"suite end\", async function (suite) {\n console.log(\"suite end\", suite)\n indents--;\n const str = indents === 1 ? \"\\n\" : \"\";\n dump(str);\n await send({ type: \"suite end\", data: { title: suite.title, root: suite.root, indents } });\n });\n\n runner.on(\"pending\", async function (test) {\n console.log(\"pending\", test)\n const str = indent() + \"pending -\" + test.title + \"\\n\";\n dump(str);\n await send({ type: \"pending\", data: { title: test.title, fulltest: test.fullTitle(), duration: test.duration, indents: indents + 1 } });\n });\n\n runner.on(\"pass\", async function (test) {\n console.log(\"pass\", test)\n passed++;\n let str = indent() + Mocha.reporters.Base.symbols.ok + \" \" + test.title;\n if (\"fast\" != test.speed) {\n str += \" (\" + Math.round(test.duration) + \" ms)\";\n }\n str += \"\\n\";\n dump(str);\n await send({ type: \"pass\", data: { title: test.title, fulltest: test.fullTitle(), duration: test.duration, indents: indents + 1 } });\n\n });\n\n runner.on(\"fail\", async function (test, error) {\n console.log(\"fail\", test, error)\n\n failed++;\n let indentStr = indent();\n const str =\n indentStr +\n Mocha.reporters.Base.symbols.err +\n (Zotero.automatedTest ? \"\" : \"\\x07\") +\n \" \" +\n test.title +\n \"\\n\" +\n indentStr +\n \" \" +\n error.message +\n \"\\n\\n\";\n dump(str);\n\n // Serialize the error explicitly: send() JSON-stringifies the payload,\n // and Error instances stringify to {} (message/stack are non-enumerable),\n // so thrown errors / timeouts / XPCOM exceptions reached the terminal as\n // \", undefined\". Chai AssertionErrors were unaffected (own-enumerable\n // props), which is why this went unnoticed in assertion-heavy suites.\n // NOTE: this file is inlined verbatim into index.xhtml, an XML document.\n // Never use raw ampersands or less-than signs here -- they break XML\n // parsing and with it the whole runner page. Optional chaining and\n // nullish coalescing are XML-safe.\n await send({ type: \"fail\", data: { title: test.title, fulltest: test.fullTitle(), duration: test.duration, error: { message: String(error?.message ?? error), stack: error?.stack, actual: error?.actual, expected: error?.expected, showDiff: error?.showDiff, operator: error?.operator }, indents: indents + 1 } });\n\n });\n\n runner.on(\"end\", async function () {\n console.log(\"end\")\n const str =\n passed +\n \"/\" +\n (passed + failed) +\n \" tests passed\" +\n (aborted ? \" -- aborting\" : \"\") +\n \"\\n\";\n dump(str);\n\n await send({\n type: \"end\",\n data: { passed: passed, failed: failed, aborted: aborted, str, indents },\n });\n\n // Must exit on Zotero side, otherwise the exit code will not be 0 and CI will fail\n if (__EXIT_ON_FINISH__) {\n Zotero.Utilities.Internal.quit(0);\n }\n });\n}\n";
4194
- //#endregion
4195
- //#region src/core/tester/test-bundler-template/index.ts
4033
+ // src/core/tester/test-bundler-template/index.ts
4196
4034
  function generateManifest() {
4197
4035
  const manifestStr = manifest_default.replaceAll("__TESTER_PLUGIN_ID__", TESTER_PLUGIN_ID);
4198
4036
  return JSON.parse(manifestStr);
@@ -4207,8 +4045,7 @@ function generateHtml(setupCode, testFiles) {
4207
4045
  function generateMochaSetup(options) {
4208
4046
  return mocha_setup_default.replaceAll("__TIMEOUT__", String(options.timeout || 1e4)).replaceAll("__PORT__", String(options.port)).replaceAll("__ABORT_ON_FAIL__", String(options.abortOnFail)).replaceAll("__EXIT_ON_FINISH__", String(options.exitOnFinish ? "true" : "false"));
4209
4047
  }
4210
- //#endregion
4211
- //#region src/core/tester/test-bundler.ts
4048
+ // src/core/tester/test-bundler.ts
4212
4049
  var TestBundler = class {
4213
4050
  ctx;
4214
4051
  port;
@@ -4310,8 +4147,7 @@ function findImpactedTests(changedFilePath, buildMetadata) {
4310
4147
  }
4311
4148
  return [...impactedTestFiles];
4312
4149
  }
4313
- //#endregion
4314
- //#region src/core/tester/index.ts
4150
+ // src/core/tester/index.ts
4315
4151
  var Test = class extends Base {
4316
4152
  builder;
4317
4153
  zotero;
@@ -4444,11 +4280,9 @@ var Test = class extends Base {
4444
4280
  }, this.ctx.test.prefs || {});
4445
4281
  }
4446
4282
  };
4447
- //#endregion
4448
- //#region src/index.ts
4283
+ // src/index.ts
4449
4284
  const Config = {
4450
4285
  defineConfig,
4451
4286
  loadConfig: loadConfig$1
4452
4287
  };
4453
- //#endregion
4454
4288
  export { Release as a, ExitSignals as i, Test as n, Build as o, Serve as r, defineConfig as s, Config as t };