@dpuse/dpuse-development 1.0.156 → 1.0.158

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,14 +1,15 @@
1
- import { A as e, C as t, D as n, E as r, M as i, N as a, O as o, S as s, T as c, _ as l, a as u, b as d, c as f, d as p, f as m, g as h, h as g, i as ee, k as _, l as v, m as te, n as ne, o as re, p as y, r as ie, s as ae, t as oe, u as se, v as b, w as x, x as S, y as C } from "./utilities-FE2RzZB9.js";
2
- import { SHIPPED_PACKAGES_FILE_NAME as ce } from "./vite.es.js";
3
- import { existsSync as le, promises as w } from "node:fs";
4
- import T from "node:path";
5
- import { promisify as ue } from "node:util";
6
- import { execFile as de } from "node:child_process";
7
- import { fileURLToPath as fe } from "node:url";
8
- import { run as pe } from "npm-check-updates";
9
- import { init as me } from "license-checker-rseidelsohn";
10
- import { setTimeout as he } from "node:timers/promises";
11
- import ge from "spdx-satisfies";
1
+ import { A as e, C as t, D as n, E as r, M as i, N as a, O as o, S as s, T as c, _ as l, a as u, b as d, c as f, d as p, f as m, g as h, h as g, i as _, k as v, l as y, m as ee, n as te, o as ne, p as b, r as re, s as ie, t as ae, u as oe, v as x, w as S, x as C, y as w } from "./utilities-Cr4u5egW.js";
2
+ import { SHIPPED_PACKAGES_FILE_NAME as se } from "./vite.es.js";
3
+ import { existsSync as ce, promises as T } from "node:fs";
4
+ import E from "node:path";
5
+ import { promisify as le } from "node:util";
6
+ import { execFile as ue } from "node:child_process";
7
+ import { fileURLToPath as de } from "node:url";
8
+ import { run as fe } from "npm-check-updates";
9
+ import { init as pe } from "license-checker-rseidelsohn";
10
+ import { setTimeout as me } from "node:timers/promises";
11
+ import he from "spdx-satisfies";
12
+ import { gzipSync as ge } from "node:zlib";
12
13
  import _e from "node:os";
13
14
  // src/actions/auditDependencies_.json
14
15
  var ve = [
@@ -55,8 +56,8 @@ var ve = [
55
56
  async function Se() {
56
57
  try {
57
58
  l("Audit Dependencies");
58
- let e = await S("package.json");
59
- if (ie.has(e.name ?? "")) C(`1️⃣ Shipped dependencies NOT checked: ${e.name ?? ""} is a development-only tool`);
59
+ let e = await C("package.json");
60
+ if (re.has(e.name ?? "")) w(`1️⃣ Shipped dependencies NOT checked: ${e.name ?? ""} is a development-only tool`);
60
61
  else {
61
62
  let e = await n("1️⃣ Check shipped dependencies for any vulnerability", "npm", [
62
63
  "audit",
@@ -64,14 +65,14 @@ async function Se() {
64
65
  "--json"
65
66
  ]), t = JSON.parse(e);
66
67
  if (t.error !== void 0) throw Error(t.error.summary);
67
- let r = we(E(t), ye, !0);
68
+ let r = we(D(t), ye, !0);
68
69
  if (r.length > 0) throw Error(`${String(r.length)} vulnerabilities found in shipped dependencies`);
69
70
  }
70
71
  let t = await n("2️⃣ Check all dependencies for high or critical vulnerabilities", "npm", ["audit", "--json"]), r = JSON.parse(t);
71
72
  if (r.error !== void 0) throw Error(r.error.summary);
72
- let i = we(E(r), xe, !1);
73
+ let i = we(D(r), xe, !1);
73
74
  if (i.length > 0) throw Error(`${String(i.length)} high or critical vulnerabilities found`);
74
- b("Dependencies audited");
75
+ x("Dependencies audited");
75
76
  } catch (e) {
76
77
  console.error("❌ Error auditing dependencies", e), process.exit(1);
77
78
  }
@@ -83,7 +84,7 @@ async function Ce(e) {
83
84
  return;
84
85
  }
85
86
  let r = 0;
86
- for (let e of E(t)) {
87
+ for (let e of D(t)) {
87
88
  let t = be.has(e.severity) ? Te(e, xe) : void 0;
88
89
  t !== void 0 && (console.warn(`⚠️ ${t.id} ('${e.name}') is on the allow list, so the CI audit ignores it: ${t.reason}`), r++);
89
90
  }
@@ -102,7 +103,7 @@ function Te(e, t) {
102
103
  let n = e.url.slice(e.url.lastIndexOf("/") + 1);
103
104
  return t.find((e) => e.id === n);
104
105
  }
105
- function E(e) {
106
+ function D(e) {
106
107
  let t = /* @__PURE__ */ new Map(), n = Object.values(e.vulnerabilities ?? {});
107
108
  for (let e of n) for (let n of e.via) typeof n != "string" && t.set(n.url, n);
108
109
  return t.values().toArray();
@@ -111,7 +112,7 @@ function E(e) {
111
112
  var Ee = "build:wasm";
112
113
  async function De() {
113
114
  try {
114
- l("Build Project"), await Oe("1️⃣ ", await S("package.json")), b("Project built");
115
+ l("Build Project"), await Oe("1️⃣ ", await C("package.json")), x("Project built");
115
116
  } catch (e) {
116
117
  console.error("❌ Error building project", e), process.exit(1);
117
118
  }
@@ -120,14 +121,14 @@ async function Oe(e, t) {
120
121
  t.scripts?.[Ee] != null && await r(`${e} Build WebAssembly`, "npm", ["run", Ee]), await r(`${e} Bundle project`, "vite", ["build"]);
121
122
  }
122
123
  // src/actions/checkConfigFiles.ts
123
- var D = "@dpuse/dpuse-development/prettierrc", ke = "dpuse-development";
124
+ var O = "@dpuse/dpuse-development/prettierrc", ke = "dpuse-development";
124
125
  async function Ae() {
125
126
  try {
126
- l("Check configuration files"), C("1️⃣ Check individual files");
127
- let e = await S("config.json"), n = await S("package.json"), r = n.private === !0, i = g(e.id), a = T.dirname(fe(import.meta.url));
128
- await O(a, ".editorconfig"), await O(a, ".gitattributes"), await O(a, ".gitignore", [".gitignore_default"]), await O(a, ".markdownlint.json"), await O(a, ".ncurc.json"), await je(i, a), await O(a, "LICENSE"), await Ne(i, a), await Pe(i, a), await Fe(i, a), await Re(i, a), Me(i, n);
129
- let o = await t(v) !== null;
130
- o && await O(a, "rust-toolchain.toml"), await O(a, ".github/dependabot.yml", [`.github/dependabot${r ? ".private" : ""}${o ? ".rust" : ""}.yml`]), r ? await Ie(a) : (await Le(a), await O(a, "SECURITY.md", [], (t) => t.replaceAll(ke, () => e.id))), b("Configuration files checked");
127
+ l("Check configuration files"), w("1️⃣ Check individual files");
128
+ let e = await C("config.json"), n = await C("package.json"), r = n.private === !0, i = g(e.id), a = E.dirname(de(import.meta.url));
129
+ await k(a, ".editorconfig"), await k(a, ".gitattributes"), await k(a, ".gitignore", [".gitignore_default"]), await k(a, ".markdownlint.json"), await k(a, ".ncurc.json"), await je(i, a), await k(a, "LICENSE"), await Ne(i, a), await Pe(i, a), await Fe(i, a), await Re(i, a), Me(i, n);
130
+ let o = await t(y) !== null;
131
+ o && await k(a, "rust-toolchain.toml"), await k(a, ".github/dependabot.yml", [`.github/dependabot${r ? ".private" : ""}${o ? ".rust" : ""}.yml`]), r ? await Ie(a) : (await Le(a), await k(a, "SECURITY.md", [], (t) => t.replaceAll(ke, () => e.id))), x("Configuration files checked");
131
132
  } catch (e) {
132
133
  console.error("❌ Error checking configuration files", e), process.exit(1);
133
134
  }
@@ -139,10 +140,10 @@ async function je(e, t) {
139
140
  "development",
140
141
  "eslint",
141
142
  "kb"
142
- ].includes(e.typeId) ? console.info("⚠️ File 'eslint.config.js' is UNIQUE to this project") : await O(t, "eslint.config.js", ["eslint.config.default.js"]);
143
+ ].includes(e.typeId) ? console.info("⚠️ File 'eslint.config.js' is UNIQUE to this project") : await k(t, "eslint.config.js", ["eslint.config.default.js"]);
143
144
  }
144
145
  function Me(e, t) {
145
- e.typeId === "development" ? console.info("ℹ️ File '.prettierrc.json' is the template") : e.typeId === "app" ? console.info("⚠️ File '.prettierrc.json' is UNIQUE to this project") : t.prettier === D ? console.info(`ℹ️ Prettier configuration is '${D}'`) : console.info(`❌ Prettier configuration is NOT '${D}'`);
146
+ e.typeId === "development" ? console.info("ℹ️ File '.prettierrc.json' is the template") : e.typeId === "app" ? console.info("⚠️ File '.prettierrc.json' is UNIQUE to this project") : t.prettier === O ? console.info(`ℹ️ Prettier configuration is '${O}'`) : console.info(`❌ Prettier configuration is NOT '${O}'`);
146
147
  }
147
148
  async function Ne(e, t) {
148
149
  ["github"].includes(e.typeId) ? console.info("ℹ️ File 'tsconfig.json' is NOT required by this project") : [
@@ -153,10 +154,10 @@ async function Ne(e, t) {
153
154
  "presenter",
154
155
  "shared",
155
156
  "tool"
156
- ].includes(e.typeId) ? await O(t, "tsconfig.json") : console.info("⚠️ File 'tsconfig.json' is UNIQUE to this project");
157
+ ].includes(e.typeId) ? await k(t, "tsconfig.json") : console.info("⚠️ File 'tsconfig.json' is UNIQUE to this project");
157
158
  }
158
159
  async function Pe(e, t) {
159
- ["github"].includes(e.typeId) ? console.info("ℹ️ File 'scripts/tsconfig.json' is NOT required by this project") : await O(t, "scripts/tsconfig.json");
160
+ ["github"].includes(e.typeId) ? console.info("ℹ️ File 'scripts/tsconfig.json' is NOT required by this project") : await k(t, "scripts/tsconfig.json");
160
161
  }
161
162
  async function Fe(e, t) {
162
163
  if ([
@@ -182,15 +183,15 @@ async function Fe(e, t) {
182
183
  break;
183
184
  default: n = ["vite.config.default.ts"];
184
185
  }
185
- await O(t, "vite.config.ts", n);
186
+ await k(t, "vite.config.ts", n);
186
187
  }
187
188
  }
188
189
  async function Ie(e) {
189
- for (let n of [".github/workflows/ci.yml", ".github/workflows/publish.yml"]) await t(n) !== null && await O(e, n);
190
+ for (let n of [".github/workflows/ci.yml", ".github/workflows/publish.yml"]) await t(n) !== null && await k(e, n);
190
191
  console.info("ℹ️ CodeQL and Scorecard workflows and file 'SECURITY.md' are NOT required by this project");
191
192
  }
192
193
  async function Le(e) {
193
- await O(e, ".github/workflows/ci.yml"), await O(e, ".github/workflows/codeql.yml"), await O(e, ".github/workflows/publish.yml"), await O(e, ".github/workflows/scorecard.yml");
194
+ await k(e, ".github/workflows/ci.yml"), await k(e, ".github/workflows/codeql.yml"), await k(e, ".github/workflows/publish.yml"), await k(e, ".github/workflows/scorecard.yml");
194
195
  }
195
196
  async function Re(e, t) {
196
197
  [
@@ -198,10 +199,10 @@ async function Re(e, t) {
198
199
  "api",
199
200
  "github",
200
201
  "kb"
201
- ].includes(e.typeId) ? console.info("ℹ️ File 'vitest.config.ts' is NOT required by this project") : await O(t, "vitest.config.ts");
202
+ ].includes(e.typeId) ? console.info("ℹ️ File 'vitest.config.ts' is NOT required by this project") : await k(t, "vitest.config.ts");
202
203
  }
203
- async function O(e, t, n = [], r = (e) => e) {
204
- let i = T.resolve(process.cwd(), t), a = n.length > 0 ? n : [t], o;
204
+ async function k(e, t, n = [], r = (e) => e) {
205
+ let i = E.resolve(process.cwd(), t), a = n.length > 0 ? n : [t], o;
205
206
  try {
206
207
  o = await s(i);
207
208
  } catch (e) {
@@ -210,7 +211,7 @@ async function O(e, t, n = [], r = (e) => e) {
210
211
  if (o === void 0) console.info(`❌ File '${t}' is MISSING`);
211
212
  else {
212
213
  for (let n of a) {
213
- let i = T.resolve(e, `../${n}`), a = r(await s(i));
214
+ let i = E.resolve(e, `../${n}`), a = r(await s(i));
214
215
  if (o === a) {
215
216
  console.info(`ℹ️ File '${t}' is the same as '${n}'`);
216
217
  return;
@@ -222,14 +223,14 @@ async function O(e, t, n = [], r = (e) => e) {
222
223
  // src/actions/checkDependencies.ts
223
224
  async function ze() {
224
225
  try {
225
- l("Check Dependencies"), await r("1️⃣ Check using 'npm outdated'", "npm", ["outdated"], !0), C("2️⃣ Check using 'npm-check-updates'");
226
+ l("Check Dependencies"), await r("1️⃣ Check using 'npm outdated'", "npm", ["outdated"], !0), w("2️⃣ Check using 'npm-check-updates'");
226
227
  let e = {};
227
228
  try {
228
- e = await S(T.resolve(process.cwd(), ".ncurc.json"));
229
+ e = await C(E.resolve(process.cwd(), ".ncurc.json"));
229
230
  } catch (e) {
230
231
  if (e.code !== "ENOENT") throw e;
231
232
  }
232
- await pe({
233
+ await fe({
233
234
  interactive: !0,
234
235
  upgrade: !0,
235
236
  dep: "dev,prod,peer,optional",
@@ -252,10 +253,10 @@ async function ze() {
252
253
  "install-scripts",
253
254
  "approve",
254
255
  ...t
255
- ]) : C("5️⃣ No pinned install-script approvals to move"), process.platform === "darwin") {
256
+ ]) : w("5️⃣ No pinned install-script approvals to move"), process.platform === "darwin") {
256
257
  let e = await Ve();
257
258
  await r("6️⃣ Remove unused install-script entries", "npm", ["install-scripts", "prune"]), await He(e);
258
- } else C("6️⃣ Skipped removing unused install-script entries (macOS only)");
259
+ } else w("6️⃣ Skipped removing unused install-script entries (macOS only)");
259
260
  t.length > 0 && await r("7️⃣ Run install scripts skipped in steps 3 and 4", "npm", [
260
261
  "rebuild",
261
262
  ...t,
@@ -265,7 +266,7 @@ async function ze() {
265
266
  "--strict-allow-scripts",
266
267
  "--no-audit",
267
268
  "--no-fund"
268
- ]), b("Dependencies checked");
269
+ ]), x("Dependencies checked");
269
270
  } catch (e) {
270
271
  console.error("❌ Error checking dependencies", e), process.exit(1);
271
272
  }
@@ -275,17 +276,17 @@ async function Be() {
275
276
  return [...new Set(t)];
276
277
  }
277
278
  async function Ve() {
278
- let { allowScripts: e = {} } = await S(T.resolve(process.cwd(), "package.json"));
279
+ let { allowScripts: e = {} } = await C(E.resolve(process.cwd(), "package.json"));
279
280
  return e;
280
281
  }
281
282
  async function He(e) {
282
- let t = T.resolve(process.cwd(), "package.json"), n = await S(t), r = n.allowScripts ?? {}, i = Object.keys(e).filter((e) => !Object.hasOwn(r, e));
283
+ let t = E.resolve(process.cwd(), "package.json"), n = await C(t), r = n.allowScripts ?? {}, i = Object.keys(e).filter((e) => !Object.hasOwn(r, e));
283
284
  if (i.length === 0) return;
284
- let { packages: a = {} } = await S(T.resolve(process.cwd(), "package-lock.json")), o = Object.entries(a), s = i.filter((e) => {
285
+ let { packages: a = {} } = await C(E.resolve(process.cwd(), "package-lock.json")), o = Object.entries(a), s = i.filter((e) => {
285
286
  let t = e.lastIndexOf("@"), n = t > 0 ? e.slice(0, t) : e, r = t > 0 ? e.slice(t + 1) : void 0;
286
287
  return o.some(([e, t]) => e.endsWith(`node_modules/${n}`) && t.hasInstallScript === !0 && (r === void 0 || t.version === r));
287
288
  });
288
- s.length !== 0 && (n.allowScripts = Object.fromEntries(Object.entries(e).filter(([e]) => Object.hasOwn(r, e) || s.includes(e))), await _(t, n), C(`6️⃣ Restored install-script entries the lockfile still needs: ${s.join(", ")}`));
289
+ s.length !== 0 && (n.allowScripts = Object.fromEntries(Object.entries(e).filter(([e]) => Object.hasOwn(r, e) || s.includes(e))), await v(t, n), w(`6️⃣ Restored install-script entries the lockfile still needs: ${s.join(", ")}`));
289
290
  }
290
291
  // src/actions/checkProject.ts
291
292
  async function Ue() {
@@ -300,9 +301,9 @@ var We = "<!-- SUPPORTED_ACTIONS_START -->", Ge = "<!-- SUPPORTED_ACTIONS_END --
300
301
  }, Je = "The table below lists all connector actions and highlights those supported by this connector.";
301
302
  async function Ye() {
302
303
  try {
303
- l("Document Actions"), C("1️⃣ Insert actions description and table into 'README.md'");
304
- let t = (await S("config.json")).actionNames ?? [], n = a(t), r = i(t), o = `## Supported Actions\n\n${Ke}\n\n${qe[n]} ${Je}\n\n${r}`;
305
- await e(o, We, Ge), b("Actions documented");
304
+ l("Document Actions"), w("1️⃣ Insert actions description and table into 'README.md'");
305
+ let t = (await C("config.json")).actionNames ?? [], n = i(t), r = a(t), o = `## Supported Actions\n\n${Ke}\n\n${qe[n]} ${Je}\n\n${r}`;
306
+ await e(o, We, Ge), x("Actions documented");
306
307
  } catch (e) {
307
308
  console.error("❌ Error documenting actions", e), process.exit(1);
308
309
  }
@@ -311,8 +312,8 @@ async function Ye() {
311
312
  async function Xe() {
312
313
  try {
313
314
  l("Document Contributing & License");
314
- let [t, n] = await Promise.all([S("package.json"), S("config.json")]), { owner: r, repository: i } = x(t, "document contributing and license"), a = Ze(t), o = Qe(n.firstCreatedAt);
315
- C("1️⃣ Insert contributing and license content into 'README.md'"), await d(), await e($e(r, i, a, o), ne, oe), b("Contributing & license documented");
315
+ let [t, n] = await Promise.all([C("package.json"), C("config.json")]), { owner: r, repository: i } = S(t, "document contributing and license"), a = Ze(t), o = Qe(n.firstCreatedAt);
316
+ w("1️⃣ Insert contributing and license content into 'README.md'"), await d(), await e($e(r, i, a, o), te, ae), x("Contributing & license documented");
316
317
  } catch (e) {
317
318
  console.error("❌ Error documenting contributing and license", e), process.exit(1);
318
319
  }
@@ -343,12 +344,12 @@ This project is licensed under the MIT License, permitting free use, modificatio
343
344
  [MIT](./LICENSE) © ${r} ${n}`;
344
345
  }
345
346
  // src/utilities/rustCrates.ts
346
- var k = "licenses/cargoMetadata.json", A = "licenses/cargoTree.txt", et = 1e3, tt = 1e4, nt = "dpuse-development (https://github.com/dpuse/dpuse-development)", rt = /^(?:copying|licen[cs]e|unlicense)/i, it = "wasm32-unknown-unknown";
347
+ var A = "licenses/cargoMetadata.json", j = "licenses/cargoTree.txt", et = 1e3, tt = 1e4, nt = "dpuse-development (https://github.com/dpuse/dpuse-development)", rt = /^(?:copying|licen[cs]e|unlicense)/i, it = "wasm32-unknown-unknown";
347
348
  async function at(e, n) {
348
349
  if (await t("rust/Cargo.toml") === null) return null;
349
350
  let r = [
350
351
  "--manifest-path",
351
- v,
352
+ y,
352
353
  "--locked"
353
354
  ], i = [
354
355
  "tree",
@@ -363,16 +364,16 @@ async function at(e, n) {
363
364
  "--format",
364
365
  "{p}|{l}|{r}"
365
366
  ];
366
- await o(e, "cargo", i, A), await o(e, "cargo", [
367
+ await o(e, "cargo", i, j), await o(e, "cargo", [
367
368
  "metadata",
368
369
  ...r,
369
370
  "--format-version",
370
371
  "1",
371
372
  "--filter-platform",
372
373
  it
373
- ], k);
374
- let a = ot(await s(A)), c = await S(k);
375
- await w.rm(A, { force: !0 }), await w.rm(k, { force: !0 });
374
+ ], A);
375
+ let a = ot(await s(j)), c = await C(A);
376
+ await T.rm(j, { force: !0 }), await T.rm(A, { force: !0 });
376
377
  let l = /* @__PURE__ */ new Map();
377
378
  for (let e of a) e.isOwn || l.has(`${e.name}@${e.version}`) || l.set(`${e.name}@${e.version}`, {
378
379
  name: e.name,
@@ -386,8 +387,8 @@ async function at(e, n) {
386
387
  });
387
388
  let u = l.values().toArray();
388
389
  st(u, n);
389
- for (let e of u) e.licenseFiles = await ut(e, c);
390
- return await dt(e, u), {
390
+ for (let e of u) e.licenseFiles = await lt(e, c);
391
+ return await ut(e, u), {
391
392
  crates: u,
392
393
  treeItems: a.map(({ name: e, version: t, depth: n, isOwn: r }) => ({
393
394
  name: e,
@@ -397,6 +398,13 @@ async function at(e, n) {
397
398
  }))
398
399
  };
399
400
  }
401
+ function M(e) {
402
+ try {
403
+ return he(e, [e]);
404
+ } catch {
405
+ return !1;
406
+ }
407
+ }
400
408
  function ot(e) {
401
409
  let t = [];
402
410
  for (let n of e.split("\n")) {
@@ -415,44 +423,37 @@ function ot(e) {
415
423
  return t;
416
424
  }
417
425
  function st(e, t) {
418
- let n = t.split(";").filter((e) => ct(e)), r = e.filter((e) => !lt(e.licenseExpression, n));
426
+ let n = t.split(";").filter((e) => M(e)), r = e.filter((e) => !ct(e.licenseExpression, n));
419
427
  if (r.length === 0) return;
420
428
  let i = r.map((e) => `${e.name}@${e.version} (${e.licenseExpression === "" ? "no licence" : e.licenseExpression})`).join(", ");
421
429
  throw Error(`Rust crates with licences not allowed: ${i}.`);
422
430
  }
423
- function ct(e) {
424
- try {
425
- return ge(e, [e]);
426
- } catch {
427
- return !1;
428
- }
429
- }
430
- function lt(e, t) {
431
+ function ct(e, t) {
431
432
  try {
432
- return ge(e.replaceAll("/", " OR "), t);
433
+ return he(e.replaceAll("/", " OR "), t);
433
434
  } catch {
434
435
  return !1;
435
436
  }
436
437
  }
437
- async function ut(e, t) {
438
+ async function lt(e, t) {
438
439
  let n = t.packages.find((t) => t.name === e.name && t.version === e.version);
439
440
  if (n == null) return [];
440
- let r = T.dirname(n.manifest_path), i = (await w.readdir(r)).filter((e) => rt.test(e)).toSorted((e, t) => e.localeCompare(t, "en"));
441
- await w.mkdir("licenses/downloads", { recursive: !0 });
441
+ let r = E.dirname(n.manifest_path), i = (await T.readdir(r)).filter((e) => rt.test(e)).toSorted((e, t) => e.localeCompare(t, "en"));
442
+ await T.mkdir("licenses/downloads", { recursive: !0 });
442
443
  let a = [];
443
444
  for (let t of i) {
444
445
  let n = `downloads/${e.name}@${e.version}-${t}`;
445
- await w.copyFile(T.join(r, t), T.join("licenses", n)), a.push({
446
+ await T.copyFile(E.join(r, t), E.join("licenses", n)), a.push({
446
447
  label: t,
447
448
  path: n
448
449
  });
449
450
  }
450
451
  return a;
451
452
  }
452
- async function dt(e, t) {
453
- C(`${e} - fetch release dates from crates.io`);
453
+ async function ut(e, t) {
454
+ w(`${e} - fetch release dates from crates.io`);
454
455
  for (let [e, n] of t.entries()) {
455
- e > 0 && await he(et), console.info(`⚙️ Fetching '${n.name}' (${String(e + 1)} of ${String(t.length)})...`);
456
+ e > 0 && await me(et), console.info(`⚙️ Fetching '${n.name}' (${String(e + 1)} of ${String(t.length)})...`);
456
457
  try {
457
458
  let e = await fetch(`https://crates.io/api/v1/crates/${encodeURIComponent(n.name)}`, {
458
459
  headers: { "User-Agent": nt },
@@ -465,77 +466,77 @@ async function dt(e, t) {
465
466
  }
466
467
  }
467
468
  // src/actions/documentDependencies.ts
468
- var j = "<!-- DEPENDENCY_LICENSES_START -->", M = "<!-- DEPENDENCY_LICENSES_END -->", N = "## Dependency Licenses", ft = `bundle-analysis-reports/${ce}`, P = "licenses/licenseTree.json", pt = "Packages flagged ❗ have a newer version available; ⚠️ indicates a package that hasn't been updated in the last 6 months or longer. Neither flag necessarily indicates a problem: we let new releases stabilise before upgrading, and some packages are mature and stable (have limited or no dependencies), so they require no active development.", mt = `The dependency tree below lists every package in this project — direct and transitive — along with its installed version, release date, and update status. ${pt}`, ht = `The dependency tree below shows how each package in the table above is reached — direct and transitive — along with its installed version, release date, and update status. A package that does not ship itself, such as one whose parts are bundled separately, is left out and what ships beneath it is shown in its place. ${pt}`;
469
- async function gt(e = "MIT") {
469
+ var N = "<!-- DEPENDENCY_LICENSES_START -->", dt = "<!-- DEPENDENCY_LICENSES_END -->", P = "## Dependency Licenses", ft = `bundle-analysis-reports/${se}`, F = "licenses/licenseTree.json", pt = 1e4, mt = "Packages flagged ❗ have a newer version available; ⚠️ indicates a package that hasn't been updated in the last 6 months or longer. Neither flag necessarily indicates a problem: we let new releases stabilise before upgrading, and some packages are mature and stable (have limited or no dependencies), so they require no active development.", ht = `The dependency tree below lists every package in this project — direct and transitive — along with its installed version, release date, and update status. ${mt}`, gt = `The dependency tree below shows how each package in the table above is reached — direct and transitive — along with its installed version, release date, and update status. A package that does not ship itself, such as one whose parts are bundled separately, is left out and what ships beneath it is shown in its place. ${mt}`;
470
+ async function _t(e = "MIT") {
470
471
  try {
471
472
  l("Document Dependencies");
472
- let t = await S("package.json"), n = t.name ?? "";
473
- if (ie.has(n)) {
474
- await _t(n), b("Dependencies documented");
473
+ let t = await C("package.json"), n = t.name ?? "";
474
+ if (re.has(n)) {
475
+ await vt(n), x("Dependencies documented");
475
476
  return;
476
477
  }
477
478
  await m("1️⃣ Clear downloaded licenses", "licenses/downloads");
478
- let r = await Et(), i = await Dt();
479
+ let r = await Dt(), i = await Ot();
479
480
  if (i === null) {
480
- let n = jt(r);
481
- await Tt("2️⃣ Identify production licenses", e, [t.name ?? "", ...n], !0), await o("3️⃣ Identify transitive dependencies", "npm", [
481
+ let n = Mt(r);
482
+ await Et("2️⃣ Identify production licenses", e, [t.name ?? "", ...n], !0), await o("3️⃣ Identify transitive dependencies", "npm", [
482
483
  "ls",
483
484
  "--all",
484
485
  "--json",
485
486
  "--omit=dev"
486
- ], P), await vt("4️⃣ ", e, new Set(n));
487
+ ], F), await yt("4️⃣ ", e, new Set(n));
487
488
  } else {
488
- let n = Ot(i, r), a = kt(r), s = a.filter((e) => !n.has(e));
489
- await Tt("2️⃣ Identify shipped licenses", e, [t.name ?? "", ...s], !1), At(n, new Set(a)), await o("3️⃣ Identify transitive dependencies", "npm", [
489
+ let n = kt(i, r), a = At(r), s = a.filter((e) => !n.has(e));
490
+ await Et("2️⃣ Identify shipped licenses", e, [t.name ?? "", ...s], !1), jt(n, new Set(a)), await o("3️⃣ Identify transitive dependencies", "npm", [
490
491
  "ls",
491
492
  "--all",
492
493
  "--json"
493
- ], P, !0);
494
+ ], F, !0);
494
495
  let c = await at("4️⃣ Identify Rust crates compiled into the WebAssembly", e), l = {
495
496
  allowedLicenses: e,
496
- productionNames: Ct(t),
497
+ productionNames: wt(t),
497
498
  rustCrates: c,
498
499
  shippedKeys: n
499
500
  };
500
- await yt(c === null ? "4️⃣ " : "5️⃣ ", l);
501
+ await bt(c === null ? "4️⃣ " : "5️⃣ ", l);
501
502
  }
502
- b("Dependencies documented");
503
+ x("Dependencies documented");
503
504
  } catch (e) {
504
505
  console.error("❌ Error documenting dependencies", e), process.exit(1);
505
506
  }
506
507
  }
507
- async function _t(t) {
508
- C(`1️⃣ Skip: ${t} is a development-only tool and is never part of a production release.`);
508
+ async function vt(t) {
509
+ w(`1️⃣ Skip: ${t} is a development-only tool and is never part of a production release.`);
509
510
  let n = `> [!WARNING]\n> Dependency licenses are not documented here: ${t} is a development-only tool and is never part of a production release.`;
510
- await e(`${N}\n\n${n}`, j, M);
511
+ await e(`${P}\n\n${n}`, N, dt);
511
512
  }
512
- async function vt(t, n, r) {
513
- C(`${t} Insert licenses into 'README.md'`);
514
- let i = await S(P), a = await wt(), o = `${Ft(n, !1)}\n\n|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|\n`;
515
- for (let e of a.values()) o += I(e);
513
+ async function yt(t, n, r) {
514
+ w(`${t} Insert licenses into 'README.md'`);
515
+ let i = await C(F), a = await Tt(), o = `${It(n, !1)}\n\n|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|\n`;
516
+ for (let e of a.values()) o += L(e);
516
517
  let s = [];
517
- i.dependencies != null && zt(i.dependencies, a, r, s, 0);
518
- let c = `${mt}\n\n${s.join("\n")}`;
519
- await e(`${N}\n\n${o.trimEnd()}\n\n### Dependency Tree\n\n${c}`, j, M);
520
- }
521
- async function yt(t, n) {
522
- C(`${t} Insert licenses into 'README.md'`);
523
- let { allowedLicenses: r, productionNames: i, rustCrates: a, shippedKeys: o } = n, s = await wt(), c = new Map((a?.crates ?? []).map((e) => [`${e.name}@${e.version}`, xt(e)])), l = a !== null, u = l ? "|Type|Dependency|Version|License(s)|Document|\n|:-|:-|:-:|:-|:-|" : "|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|", d = `${Ft(r, !0, l)}\n\n${u}\n`;
524
- for (let e of s.values().toArray().toSorted(bt)) d += I(e, l ? "JavaScript" : void 0);
525
- for (let e of c.values().toArray().toSorted(bt)) d += I(e, "Rust");
526
- let f = await S(P), p = Object.entries(f.dependencies ?? {}).toSorted(([e], [t]) => Number(!i.has(e)) - Number(!i.has(t))), m = [];
527
- L(p, {
518
+ i.dependencies != null && Bt(i.dependencies, a, r, s, 0);
519
+ let c = `${ht}\n\n${s.join("\n")}`;
520
+ await e(`${P}\n\n${o.trimEnd()}\n\n### Dependency Tree\n\n${c}`, N, dt);
521
+ }
522
+ async function bt(t, n) {
523
+ w(`${t} Insert licenses into 'README.md'`);
524
+ let { allowedLicenses: r, productionNames: i, rustCrates: a, shippedKeys: o } = n, s = await Tt(), c = new Map((a?.crates ?? []).map((e) => [`${e.name}@${e.version}`, St(e)])), l = a !== null, u = l ? "|Type|Dependency|Version|License(s)|Document|\n|:-|:-|:-:|:-|:-|" : "|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|", d = `${It(r, !0, l)}\n\n${u}\n`;
525
+ for (let e of s.values().toArray().toSorted(xt)) d += L(e, l ? "JavaScript" : void 0);
526
+ for (let e of c.values().toArray().toSorted(xt)) d += L(e, "Rust");
527
+ let f = await C(F), p = Object.entries(f.dependencies ?? {}).toSorted(([e], [t]) => Number(!i.has(e)) - Number(!i.has(t))), m = [];
528
+ R(p, {
528
529
  licensesByKey: s,
529
530
  shippedKeys: o,
530
531
  shownKeys: /* @__PURE__ */ new Set()
531
- }, m, 0, !1);
532
- let h = m.length === 0 ? "None." : m.join("\n"), g = (a?.treeItems ?? []).map((e) => St(e, c)).join("\n"), ee = l ? `${ht}\n\n#### JavaScript\n\n${h}\n\n#### Rust\n\n${g}` : `${ht}\n\n${h}`;
533
- await e(`${N}\n\n${d.trimEnd()}\n\n### Dependency Tree\n\n${ee}`, j, M);
532
+ }, m, 0);
533
+ let h = m.length === 0 ? "None." : m.join("\n"), g = (a?.treeItems ?? []).map((e) => Ct(e, c)).join("\n"), _ = l ? `${gt}\n\n#### JavaScript\n\n${h}\n\n#### Rust\n\n${g}` : `${gt}\n\n${h}`;
534
+ await e(`${P}\n\n${d.trimEnd()}\n\n### Dependency Tree\n\n${_}`, N, dt);
534
535
  }
535
- function bt(e, t) {
536
+ function xt(e, t) {
536
537
  return e.name.localeCompare(t.name, "en") || e.installedVersion.localeCompare(t.installedVersion, "en");
537
538
  }
538
- function xt(e) {
539
+ function St(e) {
539
540
  return {
540
541
  name: e.name,
541
542
  repository: e.repository,
@@ -548,27 +549,29 @@ function xt(e) {
548
549
  licenseFiles: e.licenseFiles
549
550
  };
550
551
  }
551
- function St(e, t) {
552
+ function Ct(e, t) {
552
553
  let n = " ".repeat(e.depth);
553
- return e.isOwn ? `${n}- **${e.name}** ${e.version} — this project's Rust code, compiled into its WebAssembly` : Bt(e.name, e.version, t.get(`${e.name}@${e.version}`), n);
554
+ return e.isOwn ? `${n}- **${e.name}** ${e.version} — this project's Rust code, compiled into its WebAssembly` : z(e.name, e.version, t.get(`${e.name}@${e.version}`), n);
554
555
  }
555
- function Ct(e) {
556
+ function wt(e) {
556
557
  return /* @__PURE__ */ new Set([
557
558
  ...Object.keys(e.dependencies ?? {}),
558
559
  ...Object.keys(e.optionalDependencies ?? {}),
559
560
  ...Object.keys(e.peerDependencies ?? {})
560
561
  ]);
561
562
  }
562
- async function wt() {
563
- let e = await S("licenses/licenses.json"), t = /* @__PURE__ */ new Map();
564
- for (let [n, r] of Object.entries(e)) t.set(n, Lt(n, r));
565
- return await Promise.all(t.values().map(async (e) => {
566
- let t = await Rt(e.name, e.installedVersion);
563
+ async function Tt() {
564
+ let e = await C("licenses/licenses.json"), t = /* @__PURE__ */ new Map();
565
+ for (let [n, r] of Object.entries(e)) t.set(n, Rt(n, r));
566
+ await Promise.all(t.values().map(async (e) => {
567
+ let t = await zt(e.name, e.installedVersion);
567
568
  e.latestVersion = t.latestVersion, e.latestPublishedDate = t.latestPublishedDate, e.publishedDate = t.publishedDate;
568
- })), t;
569
+ }));
570
+ let n = [...t.values().flatMap((e) => e.latestVersion === "" ? [e.name] : [])].join(", ");
571
+ return n !== "" && console.warn(`⚠️ No answer from the npm registry, so shown without release dates: ${n}`), t;
569
572
  }
570
- async function Tt(e, t, n, r) {
571
- C(e), await new Promise((e, i) => {
573
+ async function Et(e, t, n, r) {
574
+ w(e), await new Promise((e, i) => {
572
575
  let a = {
573
576
  start: process.cwd(),
574
577
  production: r,
@@ -580,63 +583,63 @@ async function Tt(e, t, n, r) {
580
583
  excludePackages: n.join(";"),
581
584
  out: "licenses/licenses.json"
582
585
  };
583
- me(a, (t) => {
586
+ pe(a, (t) => {
584
587
  t == null ? e() : i(t);
585
588
  });
586
589
  });
587
590
  }
588
- async function Et() {
591
+ async function Dt() {
589
592
  let e = await t("package-lock.json");
590
593
  return e === null ? {} : JSON.parse(e).packages ?? {};
591
594
  }
592
- async function Dt() {
595
+ async function Ot() {
593
596
  let e = await t(ft);
594
597
  return e === null ? null : JSON.parse(e);
595
598
  }
596
- function Ot(e, t) {
599
+ function kt(e, t) {
597
600
  let n = new Set(e.packages);
598
601
  for (let r of e.external) {
599
- let e = Pt(t, "", r);
600
- if (e !== void 0) for (let r of [e, ...Mt(t, e)]) {
602
+ let e = Ft(t, "", r);
603
+ if (e !== void 0) for (let r of [e, ...Nt(t, e)]) {
601
604
  let e = t[r];
602
- e?.version !== void 0 && n.add(F(r, e));
605
+ e?.version !== void 0 && n.add(I(r, e));
603
606
  }
604
607
  }
605
608
  return n;
606
609
  }
607
- function kt(e) {
610
+ function At(e) {
608
611
  let t = /* @__PURE__ */ new Set();
609
- for (let [n, r] of Object.entries(e)) n !== "" && r.version !== void 0 && t.add(F(n, r));
612
+ for (let [n, r] of Object.entries(e)) n !== "" && r.version !== void 0 && t.add(I(n, r));
610
613
  return [...t];
611
614
  }
612
- function At(e, t) {
615
+ function jt(e, t) {
613
616
  let n = [...e.difference(t)];
614
617
  n.length > 0 && console.warn(`⚠️ Not installed, so not checked; rebuild to refresh the record: ${n.join(", ")}`);
615
618
  }
616
- function F(e, t) {
619
+ function I(e, t) {
617
620
  return `${t.name ?? e.slice(e.lastIndexOf("node_modules/") + 13)}@${String(t.version)}`;
618
621
  }
619
- function jt(e) {
620
- let t = Mt(e, ""), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
622
+ function Mt(e) {
623
+ let t = Nt(e, ""), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
621
624
  for (let [i, a] of Object.entries(e)) {
622
625
  if (i === "" || a.version === void 0) continue;
623
- let e = F(i, a);
626
+ let e = I(i, a);
624
627
  t.has(i) ? n.add(e) : r.add(e);
625
628
  }
626
629
  return r.values().filter((e) => !n.has(e)).toArray();
627
630
  }
628
- function Mt(e, t) {
631
+ function Nt(e, t) {
629
632
  let n = /* @__PURE__ */ new Set(), r = [t];
630
633
  for (; r.length > 0;) {
631
634
  let t = r.pop() ?? "", i = e[t];
632
- if (i !== void 0) for (let a of Nt(i)) {
633
- let i = Pt(e, t, a);
635
+ if (i !== void 0) for (let a of Pt(i)) {
636
+ let i = Ft(e, t, a);
634
637
  i === void 0 || n.has(i) || (n.add(i), r.push(i));
635
638
  }
636
639
  }
637
640
  return n;
638
641
  }
639
- function Nt(e) {
642
+ function Pt(e) {
640
643
  let t = Object.keys(e.peerDependencies ?? {}).filter((t) => e.peerDependenciesMeta?.[t]?.optional !== !0);
641
644
  return [
642
645
  ...Object.keys(e.dependencies ?? {}),
@@ -644,7 +647,7 @@ function Nt(e) {
644
647
  ...t
645
648
  ];
646
649
  }
647
- function Pt(e, t, n) {
650
+ function Ft(e, t, n) {
648
651
  let r = t;
649
652
  for (;;) {
650
653
  let t = r === "" ? `node_modules/${n}` : `${r}/node_modules/${n}`, i = e[t];
@@ -654,14 +657,14 @@ function Pt(e, t, n) {
654
657
  r = a === -1 ? "" : r.slice(0, a);
655
658
  }
656
659
  }
657
- function Ft(e, t, n = !1) {
658
- let r = It(e.split(";")), i = n ? "[license-checker](https://github.com/RSeidelsohn/license-checker-rseidelsohn) and [cargo tree](https://doc.rust-lang.org/cargo/commands/cargo-tree.html)" : "[license-checker](https://github.com/RSeidelsohn/license-checker-rseidelsohn)", a = "The following table lists every package whose code, styles or assets are included in this project's build, as recorded by the build itself. Modules loaded at run time are not included; each documents its own.";
659
- return `License data is updated each time \`npm run document\` is run, using ${i}. ${t ? n ? `${a} It also lists every Rust crate compiled into its WebAssembly, as resolved by Cargo; macros and other crates used only while compiling put none of their code in it, so are left out.` : a : "The following table lists all production dependencies. This project has no build record, so the list is taken from its declared dependencies."} These dependencies have been checked and confirmed to use ${r}, all of which allow commercial use. All are used unmodified, so any licence conditions that apply only to modified versions are not triggered. Developers cloning this repository should independently verify development dependencies.`;
660
+ function It(e, t, n = !1) {
661
+ let r = e.split(";"), i = r.filter((e) => M(e)), a = r.filter((e) => !M(e)), o = [i.length === 0 ? "" : `${Lt(i)}, all of which allow commercial use`, a.length === 0 ? "" : `${Lt(a)}, whose own terms decide whether commercial use is allowed`].filter((e) => e !== "").join(", or "), s = n ? "[license-checker](https://github.com/RSeidelsohn/license-checker-rseidelsohn) and [cargo tree](https://doc.rust-lang.org/cargo/commands/cargo-tree.html)" : "[license-checker](https://github.com/RSeidelsohn/license-checker-rseidelsohn)", c = "The following table lists every package whose code, styles or assets are included in this project's build, as recorded by the build itself. Modules loaded at run time are not included; each documents its own.";
662
+ return `License data is updated each time \`npm run document\` is run, using ${s}. ${t ? n ? `${c} It also lists every Rust crate compiled into its WebAssembly, as resolved by Cargo; macros and other crates used only while compiling put none of their code in it, so are left out.` : c : "The following table lists all production dependencies. This project has no build record, so the list is taken from its declared dependencies."} These dependencies have been checked and confirmed to use ${o}. All are used as published. Where the build has to adjust a dependency so it can be bundled, the adjustment only affects how its files are located and loaded, never what the code does. Developers cloning this repository should independently verify development dependencies.`;
660
663
  }
661
- function It(e) {
664
+ function Lt(e) {
662
665
  return e.length === 1 ? e[0] ?? "" : e.length === 2 ? `${String(e[0])} or ${String(e[1])}` : `${e.slice(0, -1).join(", ")}, or ${String(e.at(-1))}`;
663
666
  }
664
- function Lt(e, t) {
667
+ function Rt(e, t) {
665
668
  let n = e.lastIndexOf("@"), r = n > 0 ? e.slice(0, n) : e, i = n > 0 ? e.slice(n + 1) : "";
666
669
  return {
667
670
  name: r,
@@ -678,9 +681,9 @@ function Lt(e, t) {
678
681
  }]
679
682
  };
680
683
  }
681
- async function Rt(e, t) {
684
+ async function zt(e, t) {
682
685
  try {
683
- let n = await fetch(`https://registry.npmjs.org/${encodeURIComponent(e)}`);
686
+ let n = await fetch(`https://registry.npmjs.org/${encodeURIComponent(e)}`, { signal: AbortSignal.timeout(pt) });
684
687
  if (n.ok) {
685
688
  let e = await n.json(), r = new Map(Object.entries(e["dist-tags"] ?? {})), i = new Map(Object.entries(e.time ?? {})), a = r.get("latest") ?? "", o = i.get(t) ?? "";
686
689
  return {
@@ -696,34 +699,35 @@ async function Rt(e, t) {
696
699
  publishedDate: ""
697
700
  };
698
701
  }
699
- function I(e, t) {
702
+ function L(e, t) {
700
703
  let n = e.licenseFiles.length === 0 ? "⚠️ No license file" : e.licenseFiles.map((e) => `[${e.label}](licenses/${e.path})`).join(" ");
701
704
  return `${t === void 0 ? "" : `|${t}`}|[${e.name}](${e.repository})|${e.installedVersion}|${e.licenseTypes}|${n}|\n`;
702
705
  }
703
- function zt(e, t, n, r, i) {
706
+ function Bt(e, t, n, r, i) {
704
707
  let a = " ".repeat(i);
705
708
  for (let [o, s] of Object.entries(e)) {
706
709
  if (s.version === void 0) continue;
707
710
  let e = s.version;
708
- n.has(`${o}@${e}`) || (r.push(Bt(o, e, t.get(`${o}@${e}`), a)), s.dependencies != null && zt(s.dependencies, t, n, r, i + 1));
711
+ n.has(`${o}@${e}`) || (r.push(z(o, e, t.get(`${o}@${e}`), a)), s.dependencies != null && Bt(s.dependencies, t, n, r, i + 1));
709
712
  }
710
713
  }
711
- function L(e, t, n, r, i) {
712
- for (let [a, o] of e) {
713
- if (o.version === void 0) continue;
714
- let e = `${a}@${o.version}`, s = Object.entries(o.dependencies ?? {});
715
- t.shippedKeys.has(e) ? i && t.shownKeys.has(e) || (t.shownKeys.add(e), n.push(Bt(a, o.version, t.licensesByKey.get(e), " ".repeat(r))), L(s, t, n, r + 1, !1)) : L(s, t, n, r, !0);
714
+ function R(e, t, n, r, i) {
715
+ let a = i ?? /* @__PURE__ */ new Set();
716
+ for (let [o, s] of e) {
717
+ if (s.version === void 0) continue;
718
+ let e = `${o}@${s.version}`, c = Object.entries(s.dependencies ?? {});
719
+ t.shippedKeys.has(e) ? a.has(e) || i !== void 0 && t.shownKeys.has(e) || (a.add(e), t.shownKeys.add(e), n.push(z(o, s.version, t.licensesByKey.get(e), " ".repeat(r))), R(c, t, n, r + 1)) : R(c, t, n, r, a);
716
720
  }
717
721
  }
718
- function Bt(e, t, n, r) {
722
+ function z(e, t, n, r) {
719
723
  return `${r}- **${n == null ? e : `[${e}](${n.repository})`}** ${t}${Vt(n)}`;
720
724
  }
721
725
  function Vt(e) {
722
726
  if (e == null) return "";
723
- let t = e.publishedDate ? Ht(e.publishedDate.split("T", 1)[0]) : "";
724
- if (e.latestVersion === "" || e.latestVersion === e.installedVersion) return t === "" ? "" : ` — ${t}`;
725
- let n = e.latestPublishedDate ? Ht(e.latestPublishedDate.split("T", 1)[0]) : "", r = n === "" ? `latest: ${e.latestVersion} ❗` : `latest: ${e.latestVersion} — ${n} ❗`;
726
- return t === "" ? ` — → ${r}` : ` — ${t} → ${r}`;
727
+ let t = e.publishedDate ? Ht(e.publishedDate.split("T", 1)[0]) : "", n = e.publishedDate !== "" && e.latestPublishedDate !== "" && Date.parse(e.latestPublishedDate) <= Date.parse(e.publishedDate);
728
+ if (e.latestVersion === "" || e.latestVersion === e.installedVersion || n) return t === "" ? "" : ` — ${t}`;
729
+ let r = e.latestPublishedDate ? Ht(e.latestPublishedDate.split("T", 1)[0]) : "", i = r === "" ? `latest: ${e.latestVersion} ❗` : `latest: ${e.latestVersion} — ${r} ❗`;
730
+ return t === "" ? ` — → ${i}` : ` — ${t} → ${i}`;
727
731
  }
728
732
  function Ht(e) {
729
733
  if (e == null || e === "") return "n/a";
@@ -736,15 +740,15 @@ function Ht(e) {
736
740
  var Ut = "<!-- OPENING_START -->", Wt = "<!-- OPENING_END -->";
737
741
  async function Gt() {
738
742
  try {
739
- l("Document Opening"), C("1️⃣ Insert opening content into 'README.md'");
740
- let t = await S("package.json"), n = await S("config.json"), { owner: r, repository: i } = x(t, "document opening"), a = qt(t), o = Yt(n), s = g(n.id), c = s.uploadGroupName === void 0 ? void 0 : n.id, u = s.publishedTo === "npm" ? Jt(t) : void 0, d = Xt(r, i, a, {
743
+ l("Document Opening"), w("1️⃣ Insert opening content into 'README.md'");
744
+ let t = await C("package.json"), n = await C("config.json"), { owner: r, repository: i } = S(t, "document opening"), a = qt(t), o = Yt(n), s = g(n.id), c = s.uploadGroupName === void 0 ? void 0 : n.id, u = s.publishedTo === "npm" ? Jt(t) : void 0, d = Xt(r, i, a, {
741
745
  description: t.description,
742
746
  dpuseModuleId: c,
743
747
  introduction: o,
744
748
  npmPackageName: u,
745
749
  version: t.version
746
750
  });
747
- await e(d, Ut, Wt), b("Opening documented");
751
+ await e(d, Ut, Wt), x("Opening documented");
748
752
  } catch (e) {
749
753
  console.error("❌ Error documenting opening", e), process.exit(1);
750
754
  }
@@ -800,29 +804,29 @@ var Zt = {
800
804
  C: "yellow",
801
805
  D: "orange",
802
806
  F: "red"
803
- }, sn = `${u}/health.json`, cn = ue(de);
807
+ }, sn = `${u}/health.json`, cn = le(ue);
804
808
  async function ln() {
805
809
  try {
806
810
  l("Document Quality & Security");
807
- let t = await S("package.json"), n = await un(t), r = await fn(t, n === void 0 ? [] : ["--coverage", $t]), { owner: i, repository: a } = x(t, "document quality and security");
808
- C("4️⃣ Read security checks and settings");
811
+ let t = await C("package.json"), n = await un(t), r = await fn(t, n === void 0 ? [] : ["--coverage", $t]), { owner: i, repository: a } = S(t, "document quality and security");
812
+ w("4️⃣ Read security checks and settings");
809
813
  let o = await mn(i, a, t);
810
- C("5️⃣ Look up OpenSSF Best Practices badge and Scorecard results");
814
+ w("5️⃣ Look up OpenSSF Best Practices badge and Scorecard results");
811
815
  let [s, c] = await Promise.all([hn(`https://github.com/${i}/${a}`), gn(`github.com/${i}/${a}`)]);
812
- C("6️⃣ Insert quality and security content into 'README.md'");
816
+ w("6️⃣ Insert quality and security content into 'README.md'");
813
817
  let u = xn(i, a, {
814
818
  coveragePercent: n,
815
819
  fallowHealth: r,
816
820
  securitySettings: o
817
821
  }, s, c);
818
- await d(), await e(u, f, ae), b("Quality & security documented");
822
+ await d(), await e(u, f, ie), x("Quality & security documented");
819
823
  } catch (e) {
820
824
  console.error("❌ Error documenting quality and security", e), process.exit(1);
821
825
  }
822
826
  }
823
827
  async function un(e) {
824
828
  if (e.devDependencies?.["@vitest/coverage-v8"] == null) {
825
- C("1️⃣ Test coverage NOT measured, as '@vitest/coverage-v8' is not installed");
829
+ w("1️⃣ Test coverage NOT measured, as '@vitest/coverage-v8' is not installed");
826
830
  return;
827
831
  }
828
832
  await r("1️⃣ Measure test coverage", "vitest", [
@@ -841,7 +845,7 @@ async function dn(e) {
841
845
  "yellow",
842
846
  "brightgreen"
843
847
  ], n = Number(e >= nn) + Number(e >= tn);
844
- await _(rn, {
848
+ await v(rn, {
845
849
  schemaVersion: 1,
846
850
  label: "coverage",
847
851
  message: `${e.toFixed(1)}%`,
@@ -850,7 +854,7 @@ async function dn(e) {
850
854
  }
851
855
  async function fn(e, t) {
852
856
  if (e.devDependencies?.fallow == null) {
853
- C("2️⃣ Code health NOT measured, as Fallow is not installed"), C("3️⃣ Code health report NOT required");
857
+ w("2️⃣ Code health NOT measured, as Fallow is not installed"), w("3️⃣ Code health report NOT required");
854
858
  return;
855
859
  }
856
860
  await o("2️⃣ Measure code health", "fallow", [
@@ -859,13 +863,13 @@ async function fn(e, t) {
859
863
  "--format",
860
864
  "json",
861
865
  ...t
862
- ], sn), await o("3️⃣ Write code health report", "fallow", ["--format", "markdown"], re, !0);
863
- let n = await S(sn);
866
+ ], sn), await o("3️⃣ Write code health report", "fallow", ["--format", "markdown"], ne, !0);
867
+ let n = await C(sn);
864
868
  return await pn(n), n;
865
869
  }
866
870
  async function pn(e) {
867
871
  let { score: t, grade: n } = e.health_score;
868
- await _(ee, {
872
+ await v(_, {
869
873
  schemaVersion: 1,
870
874
  label: "fallow",
871
875
  message: `${n} (${String(Math.round(t))})`,
@@ -876,12 +880,12 @@ async function mn(e, n, r) {
876
880
  let [i, a, o] = await Promise.all([
877
881
  t(".github/workflows/ci.yml"),
878
882
  t(".github/dependabot.yml"),
879
- t(v)
883
+ t(y)
880
884
  ]), s = await t(".github/workflows/codeql.yml") ?? "", [c, l, u, d] = await Promise.all([
881
- R(`repos/${e}/${n}`),
882
- R(`repos/${e}/${n}/private-vulnerability-reporting`),
883
- R(`repos/${e}/${n}/vulnerability-alerts`),
884
- R(`repos/${e}/${n}/commits/main/check-runs?per_page=100`)
885
+ B(`repos/${e}/${n}`),
886
+ B(`repos/${e}/${n}/private-vulnerability-reporting`),
887
+ B(`repos/${e}/${n}/vulnerability-alerts`),
888
+ B(`repos/${e}/${n}/commits/main/check-runs?per_page=100`)
885
889
  ]), f = c === void 0 ? void 0 : JSON.parse(c).security_and_analysis, p = (e) => f?.[e] === void 0 ? void 0 : f[e].status === "enabled", m = new Set((d === void 0 ? [] : JSON.parse(d).check_runs).map((e) => e.app?.slug)), h = a?.match(/package-ecosystem:/g)?.length ?? 0, g = a?.match(/open-pull-requests-limit: 0\b/g)?.length ?? 0;
886
890
  return {
887
891
  codeQLLanguages: s.matchAll(/- language: ([\w-]+)/g).filter(([, e]) => e !== "rust" || o !== null).map(([, e = ""]) => an[e] ?? e).toArray(),
@@ -901,7 +905,7 @@ async function mn(e, n, r) {
901
905
  testsInCI: i?.includes("npm test") ?? !1
902
906
  };
903
907
  }
904
- async function R(e) {
908
+ async function B(e) {
905
909
  try {
906
910
  let { stdout: t } = await cn("gh", ["api", e]);
907
911
  return t;
@@ -928,10 +932,10 @@ function _n(e) {
928
932
  function vn(e) {
929
933
  return e === !1 ? " These are handled manually." : "";
930
934
  }
931
- function z(e) {
935
+ function V(e) {
932
936
  return e === void 0 ? "❔ Unknown" : e ? "✅ On" : "❌ Off";
933
937
  }
934
- function B(e, t) {
938
+ function H(e, t) {
935
939
  return t.length === 0 ? "" : `### ${e}
936
940
 
937
941
  |Check|Status|What it does|
@@ -946,78 +950,78 @@ function yn(e, t, n, r) {
946
950
  function bn(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i }) {
947
951
  let a = `https://github.com/${e}/${t}`, o = (e) => e ? ` Part of the [CI workflow](${a}/actions/workflows/ci.yml) on every push and pull request to \`main\`.` : "", s = [[
948
952
  "Unit tests",
949
- z(i.testsInCI),
953
+ V(i.testsInCI),
950
954
  `[Vitest](https://vitest.dev) runs the unit tests.${o(i.testsInCI)}`
951
955
  ], [
952
956
  "Property-based tests",
953
- z(i.propertyTests),
957
+ V(i.propertyTests),
954
958
  `[fast-check](https://fast-check.dev) runs many random inputs per test to find edge cases, alongside the unit tests.${o(i.propertyTests && i.testsInCI)}`
955
959
  ]];
956
960
  n !== void 0 && s.push([
957
961
  "Test coverage",
958
- z(!0),
962
+ V(!0),
959
963
  `${yn(e, t, "Coverage", rn)} [Vitest's V8 coverage](https://vitest.dev/guide/coverage) measures the share of source lines the unit tests run. The target is ${String(tn)}%.`
960
964
  ]);
961
965
  let c = `[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=${e}_${t}&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=${e}_${t}) `, l = [[
962
966
  "Code analysis",
963
- z(i.sonarCloud),
967
+ V(i.sonarCloud),
964
968
  `${i.sonarCloud ? c : ""}[SonarCloud](https://sonarcloud.io) checks every push for bugs, code smells and vulnerabilities.`
965
969
  ], [
966
970
  "Linting",
967
- z(i.lintInCI),
971
+ V(i.lintInCI),
968
972
  `[ESLint](https://eslint.org) checks the code for errors and style problems.${o(i.lintInCI)}`
969
973
  ]];
970
974
  r !== void 0 && l.unshift([
971
975
  "Code health",
972
- z(!0),
973
- `[${yn(e, t, "Fallow code health", ee)}](./${re}) [Fallow](https://github.com/fallow-rs/fallow) finds unused code, duplication, complexity and dependency problems.`
976
+ V(!0),
977
+ `[${yn(e, t, "Fallow code health", _)}](./${ne}) [Fallow](https://github.com/fallow-rs/fallow) finds unused code, duplication, complexity and dependency problems.`
974
978
  ]);
975
979
  let u = i.codeQLLanguages.length > 0, d = `[![CodeQL](${a}/actions/workflows/codeql.yml/badge.svg)](${a}/security/code-scanning) `, f = i.codeQLQueries === "security-extended" ? "using the extended security queries" : "using the default queries", p = u ? ` ${i.codeQLLanguages.join(" and ")}` : "", m = [
976
980
  [
977
981
  "Push protection",
978
- z(i.pushProtection),
982
+ V(i.pushProtection),
979
983
  "[GitHub push protection](https://docs.github.com/en/code-security/secret-scanning/push-protection-for-repositories-and-organizations) blocks pushes that contain credentials."
980
984
  ],
981
985
  [
982
986
  "Static analysis",
983
- z(u),
987
+ V(u),
984
988
  `${u ? d : ""}[CodeQL](https://codeql.github.com) scans${p} for security vulnerabilities, ${f}, on every push and pull request to \`main\` and weekly.`
985
989
  ],
986
990
  [
987
991
  "Secret scanning",
988
- z(i.secretScanning),
992
+ V(i.secretScanning),
989
993
  "[GitHub secret scanning](https://docs.github.com/en/code-security/secret-scanning) detects credentials, such as API keys and tokens, committed to the repository."
990
994
  ]
991
995
  ], h = "[Dependabot](https://docs.github.com/en/code-security/dependabot)", g = [
992
996
  [
993
997
  "Vulnerability audit",
994
- z(i.npmAuditInCI),
998
+ V(i.npmAuditInCI),
995
999
  i.npmAuditLevel === void 0 ? `[npm audit](https://docs.npmjs.com/cli/commands/npm-audit) fails when a shipped dependency has any known vulnerability, or a development dependency has a high or critical one.${o(i.npmAuditInCI)}` : `[npm audit](https://docs.npmjs.com/cli/commands/npm-audit) fails when a dependency has a known vulnerability of ${i.npmAuditLevel} severity or above.${o(i.npmAuditInCI)}`
996
1000
  ],
997
1001
  [
998
1002
  "Supply chain risk",
999
- z(i.socket),
1003
+ V(i.socket),
1000
1004
  "[Socket](https://socket.dev) flags malicious packages, typosquatting and suspicious behaviour that may not yet have a CVE."
1001
1005
  ],
1002
1006
  [
1003
1007
  "Security alerts",
1004
- z(i.dependabotAlerts),
1008
+ V(i.dependabotAlerts),
1005
1009
  `${h} alerts when a dependency has a known vulnerability, using the GitHub Advisory Database.`
1006
1010
  ],
1007
1011
  [
1008
1012
  "Security updates",
1009
- z(i.dependabotSecurityUpdates),
1013
+ V(i.dependabotSecurityUpdates),
1010
1014
  `${h} opens pull requests that update vulnerable dependencies.${vn(i.dependabotSecurityUpdates)}`
1011
1015
  ],
1012
1016
  [
1013
1017
  "Version updates",
1014
- z(i.dependabotVersionUpdates),
1018
+ V(i.dependabotVersionUpdates),
1015
1019
  `${h} opens pull requests for new dependency versions.${vn(i.dependabotVersionUpdates)}`
1016
1020
  ]
1017
1021
  ];
1018
1022
  return `This section is updated each time \`npm run document\` is run. Settings come from the repository's workflow files and GitHub. Test coverage and the Fallow score are measured at the same time.
1019
1023
 
1020
- ${B("Testing", s)}${B("Code Quality", l)}${B("Security Analysis", m)}${B("Dependencies", g)}`;
1024
+ ${H("Testing", s)}${H("Code Quality", l)}${H("Security Analysis", m)}${H("Dependencies", g)}`;
1021
1025
  }
1022
1026
  function xn(e, t, n, r, i) {
1023
1027
  let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 && _n(i) ? "\n\n> [!NOTE]\n> Apart from the Best Practices badge above, the remaining Scorecard gaps need multi-person review or a pull-request workflow, which this solo-maintained project doesn't use." : "", l = r === void 0 ? "" : `[![OpenSSF Best Practices](${s}/badge)](${s})\n`, u = n.securitySettings.privateVulnerabilityReporting === !0 ? `Use [GitHub private vulnerability reporting](${a}/security/advisories/new) instead. See [SECURITY.md](./SECURITY.md) for the full disclosure policy, contact details, and expected response times.` : "See [SECURITY.md](./SECURITY.md) for how to report one privately, the full disclosure policy, and expected response times.";
@@ -1041,9 +1045,9 @@ var Sn = "<!-- USAGE_START -->", Cn = "<!-- USAGE_END -->", wn = /* @__PURE__ */
1041
1045
  ]), Tn = /* @__PURE__ */ new Set(["development", "eslint"]), En = "> [!WARNING]\n> This project is not designed for general use. It is custom built for the DPUse CI/CD process. You are welcome to clone and customise it for your own purposes, but you will need to adapt it to your own project structure and tooling.", Dn = "This repository manages itself using the actions it implements.", On = "This repository is managed using the common set of actions provided by [@dpuse/dpuse-development](https://github.com/dpuse/dpuse-development).";
1042
1046
  async function kn() {
1043
1047
  try {
1044
- l("Document Usage"), C("1️⃣ Insert usage content into 'README.md'");
1045
- let [t, n] = await Promise.all([S("package.json"), S("config.json")]), r = An(t), i = jn(r), a = V(t.engines?.node), o = V(t.engines?.npm), s = V(t.devDependencies?.typescript), c = Mn(g(n.id), t.name), u = `${r.replace(/\.git$/, "")}/blob/main/package.json`, d = Nn(c, r, i, a, o, s, `${t.name === "@dpuse/dpuse-development" ? Dn : On} See the \`scripts\` block in [package.json](${u}) for details.`);
1046
- await e(d, Sn, Cn), b("Usage documented");
1048
+ l("Document Usage"), w("1️⃣ Insert usage content into 'README.md'");
1049
+ let [t, n] = await Promise.all([C("package.json"), C("config.json")]), r = An(t), i = jn(r), a = U(t.engines?.node), o = U(t.engines?.npm), s = U(t.devDependencies?.typescript), c = Mn(g(n.id), t.name), u = `${r.replace(/\.git$/, "")}/blob/main/package.json`, d = Nn(c, r, i, a, o, s, `${t.name === "@dpuse/dpuse-development" ? Dn : On} See the \`scripts\` block in [package.json](${u}) for details.`);
1050
+ await e(d, Sn, Cn), x("Usage documented");
1047
1051
  } catch (e) {
1048
1052
  console.error("❌ Error documenting usage", e), process.exit(1);
1049
1053
  }
@@ -1056,7 +1060,7 @@ function An(e) {
1056
1060
  function jn(e) {
1057
1061
  return (e.split("/").at(-1) ?? "").replace(/\.git$/, "");
1058
1062
  }
1059
- function V(e) {
1063
+ function U(e) {
1060
1064
  if (e == null) throw Error("package.json version range is required to document usage.");
1061
1065
  let t = /\d+(?:\.\d+)*/.exec(e);
1062
1066
  if (t == null) throw Error(`Unable to parse version from '${e}'.`);
@@ -1095,94 +1099,119 @@ _Requires [Node.js](https://nodejs.org/) ${r} or later, [npm](https://www.npmjs.
1095
1099
  ${o}`;
1096
1100
  }
1097
1101
  // src/actions/documentApiReference.ts
1098
- var H = "API_REFERENCE.md";
1102
+ var W = "API_REFERENCE.md";
1099
1103
  async function Pn() {
1100
1104
  try {
1101
1105
  l("Document API Reference");
1102
- let { writeAPIReference: e } = await import("./apiReference-CxbLrkzr.js");
1103
- await e("1️⃣ ", H), b("API reference documented");
1106
+ let { writeAPIReference: e } = await import("./apiReference-BdQJPhGc.js");
1107
+ await e("1️⃣ ", W), x("API reference documented");
1104
1108
  } catch (e) {
1105
1109
  console.error("❌ Error documenting API reference", e), process.exit(1);
1106
1110
  }
1107
1111
  }
1108
1112
  // src/actions/documentBundleSizes.ts
1109
- var Fn = "bundle-analysis-reports/sonda/index.json", In = "bundle-analysis-reports/sonda/worker.json", Ln = "<!-- BUNDLE_START -->", Rn = "<!-- BUNDLE_END -->", U = "&nbsp;&nbsp;&nbsp;&nbsp;", W = 20, zn = "█", Bn = "▒", Vn = 100 / W / 2, Hn = 100 / W, Un = 48, Wn = "This report is updated with each release, from the bundle the release builds, using [Sonda](https://sonda.dev/), which analyses final source maps to reveal the actual effects of tree-shaking and minification rather than relying on pre-build estimates.\n\n_Note: Sonda's Vite reports currently exclude CSS files, since Vite does not generate source maps for CSS._", Gn = "Bars show each row's share of its output file.", Kn = "↳ rows are part of the row above.", qn = "+ n more = the row also holds n more files from the same package or folder, each no larger than the one named. A package can appear under several output files, each holding different files, never the same file twice.", G = "(bundler output, whitespace & JSON)", K = "(inlined worker)", Jn = `${K} = a Web Worker built separately and embedded in its output file as text. Where the build records what it contains, its rows list that; any few bytes over are the escaping needed to embed it.`, q = "(Rust WebAssembly as base64", Yn = `${q}…) = the compiled Rust code, embedded as base64 text, about a third larger than the binary it decodes to, which is the size given.`, Xn = `${G} = bytes Sonda can't trace to a source file: whitespace (indentation and line breaks), code the bundler generates (region comments, the combined import/export lines, its small runtime helper and wrappers), and imported JSON such as \`config.json\`, which the bundler doesn't map. The JSON and the generated code are real bytes that ship; the whitespace mostly disappears once compressed.`;
1110
- async function Zn(n) {
1113
+ var Fn = "bundle-analysis-reports/sonda/index.json", In = "bundle-analysis-reports/sonda/worker.json", Ln = "dist", Rn = /^\.|\.map$|\.d\.ts$|^shipped-packages\.json$/, zn = "<!-- BUNDLE_START -->", Bn = "<!-- BUNDLE_END -->", G = "&nbsp;&nbsp;&nbsp;&nbsp;", Vn = 20, Hn = "█", Un = "▒", Wn = 48, Gn = "This report is updated with each release, from the bundle the release builds, using [Sonda](https://sonda.dev/), which analyses final source maps to reveal the actual effects of tree-shaking and minification rather than relying on pre-build estimates.\n\n_Note: Sonda's Vite reports currently exclude CSS files, since Vite does not generate source maps for CSS._", Kn = "Bars show each row's share of its output file.", qn = "↳ rows are part of the row above.", Jn = "A file with no rows beneath it is shipped as it is, such as WebAssembly, so it has no breakdown. Source maps and type declarations are left out.", Yn = "+ n more = the row also holds n more files from the same package or folder, each no larger than the one named. A package can appear under several output files, each holding different files, never the same file twice.", K = "(bundler output, whitespace & JSON)", q = "(inlined worker)", Xn = `${q} = a Web Worker built separately and embedded in its output file as text. Its rows list what it contains.`, J = "(Rust WebAssembly as base64", Zn = `${J}…) = the compiled Rust code, embedded as base64 text, about a third larger than the binary it decodes to, which is the size given.`, Qn = `${K} = bytes Sonda can't trace to a source file: whitespace (indentation and line breaks), code the bundler generates (region comments, the combined import/export lines, its small runtime helper and wrappers), and imported JSON such as \`config.json\`, which the bundler doesn't map. The JSON and the generated code are real bytes that ship; the whitespace mostly disappears once compressed.`;
1114
+ async function $n() {
1111
1115
  try {
1112
- l("Document Bundle Sizes"), C("1️⃣ Read bundle analysis report");
1113
- let r = await S(Fn), i = await t(In), a = i === null ? void 0 : JSON.parse(i), o = /* @__PURE__ */ new Map();
1114
- for (let e of r.resources) e.kind === "asset" && o.set(e.name, await t(e.name));
1115
- C("2️⃣ Insert table into 'README.md'");
1116
- let s = Qn(r, {
1117
- assetContents: o,
1118
- isModuleLevel: n?.moduleLevel ?? !1,
1119
- workerJson: a
1116
+ l("Document Bundle Sizes"), w("1️⃣ Read bundle analysis report");
1117
+ let n = await C(Fn), r = await t(In), i = r === null ? void 0 : JSON.parse(r), a = /* @__PURE__ */ new Map();
1118
+ for (let e of [...n.resources, ...i?.resources ?? []]) e.kind === "asset" && a.set(e.name, await t(e.name));
1119
+ let o = await er(new Set(a.keys()));
1120
+ w("2️⃣ Insert table into 'README.md'");
1121
+ let s = nr(n, {
1122
+ assetContents: a,
1123
+ otherFiles: o,
1124
+ workerJson: i
1120
1125
  }), c = [
1121
- s.includes("↳") ? `${Gn} ${Kn}` : Gn,
1122
- / \+ \d+ more \|/.test(s) ? qn : "",
1123
- s.includes(K) ? Jn : "",
1124
- s.includes(q) ? Yn : "",
1125
- Xn
1126
+ s.includes("↳") ? `${Kn} ${qn}` : Kn,
1127
+ o.length > 0 ? Jn : "",
1128
+ / \+ \d+ more \|/.test(s) ? Yn : "",
1129
+ s.includes(q) ? Xn : "",
1130
+ s.includes(J) ? Zn : "",
1131
+ Qn
1126
1132
  ].filter((e) => e !== "");
1127
- await e(`## Bundle Analysis\n\n${Wn}\n\n${s}\n\n${c.join("\n\n")}`, Ln, Rn), b("Bundle sizes documented");
1133
+ await e(`## Bundle Analysis\n\n${Gn}\n\n${s}\n\n${c.join("\n\n")}`, zn, Bn), x("Bundle sizes documented");
1128
1134
  } catch (e) {
1129
1135
  console.error("❌ Error documenting bundle sizes", e), process.exit(1);
1130
1136
  }
1131
1137
  }
1132
- function Qn(e, t) {
1133
- let { assetContents: n, isModuleLevel: r, workerJson: i } = t, a = pr(e), o = i === void 0 ? void 0 : pr(i).values().next().value;
1138
+ async function er(e) {
1139
+ let t = [], n = await tr();
1140
+ for (let r of n) {
1141
+ let n = `${r.parentPath}/${r.name}`;
1142
+ if (!r.isFile() || Rn.test(r.name) || e.has(n)) continue;
1143
+ let i = await T.readFile(n);
1144
+ t.push([n, {
1145
+ uncompressed: i.byteLength,
1146
+ gzip: ge(i).byteLength
1147
+ }]);
1148
+ }
1149
+ return t;
1150
+ }
1151
+ async function tr() {
1152
+ try {
1153
+ return await T.readdir(Ln, {
1154
+ recursive: !0,
1155
+ withFileTypes: !0
1156
+ });
1157
+ } catch (e) {
1158
+ if (e.code === "ENOENT") return [];
1159
+ throw e;
1160
+ }
1161
+ }
1162
+ function nr(e, t) {
1163
+ let { assetContents: n, otherFiles: r, workerJson: i } = t, a = pr(e), o = [...e.resources.filter((e) => e.kind === "asset").map((e) => [e.name, vr(e)]), ...r].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), s = Z();
1164
+ for (let [, e] of o) Q(s, e);
1165
+ let c = i === void 0 ? void 0 : rr(i, n), l = c === void 0 ? void 0 : o.find(([e]) => (a.get(e)?.get(K)?.sizes.uncompressed ?? 0) >= c.bytes)?.[0];
1134
1166
  for (let [e, t] of a) {
1135
- let r = n.get(e);
1136
- r != null && $n(t, r, o);
1167
+ let r = ir(n.get(e) ?? "");
1168
+ c !== void 0 && e === l ? (or(t, c), Y(t, {
1169
+ bytes: r.bytes - c.wasm.bytes,
1170
+ binaryBytes: r.binaryBytes - c.wasm.binaryBytes
1171
+ })) : Y(t, r);
1137
1172
  }
1138
- let s = a.values().flatMap((e) => e.values().toArray()).reduce((e, t) => e + t.sizes.uncompressed, 0), c = e.resources.filter((e) => e.kind === "asset").map((e) => [e.name, vr(e)]).toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), l = ["|Chunk/Module/File|Composition|", "|:------ |:-----------|"];
1139
- for (let [e, t] of c) {
1140
- let n = [...a.get(e) ?? /* @__PURE__ */ new Map()].toSorted(sr), i = n.reduce((e, [, t]) => e + t.sizes.uncompressed, 0), o = i > 0 && s > 0 ? ` · ${Sr(i, s)} of the build` : "";
1141
- l.push(Z(`**${X(e)}**`, `${yr(t)}${o}`), ...cr(n, i, r));
1173
+ let u = ["|Chunk/Module/File|Composition|", "|:------ |:-----------|"];
1174
+ o.length > 1 && u.push(X(`**All ${String(o.length)} files**`, yr(s)));
1175
+ for (let [e, t] of o) {
1176
+ let n = a.get(e) ?? /* @__PURE__ */ new Map(), r = n.values().reduce((e, t) => e + t.sizes.uncompressed, 0), i = s.uncompressed > 0 ? ` · ${xr(t.uncompressed, s.uncompressed)} of the build` : "";
1177
+ u.push(X(`**${fr(e)}**`, `${yr(t)}${i}`), ...lr(n, r));
1142
1178
  }
1143
- return l.join("\n");
1144
- }
1145
- function $n(e, t, n) {
1146
- let r = er(t), i = tr(r ?? ""), a = tr(t);
1147
- rr(e, {
1148
- bytes: a.bytes - i.bytes,
1149
- binaryBytes: a.binaryBytes - i.binaryBytes
1150
- }), r !== void 0 && ir(e, Buffer.byteLength(r), i, n);
1151
- }
1152
- function er(e) {
1153
- if (!e.includes("new Worker(")) return;
1154
- let t = /encodeURIComponent\((\w+)\)/.exec(e)?.[1];
1155
- if (t === void 0) return;
1156
- let n = new RegExp(String.raw`(?:var|let|const)\s+${t}\s*=\s*(["'\`])`).exec(e), r = n?.[1];
1157
- if (n === null || r === void 0) return;
1158
- let i = n.index + n[0].length, a = i;
1159
- for (; a < e.length && e[a] !== r;) a += e[a] === "\\" ? 2 : 1;
1160
- return e.slice(i, a);
1161
- }
1162
- function tr(e) {
1179
+ return u.join("\n");
1180
+ }
1181
+ function rr(e, t) {
1182
+ let [n, r] = pr(e).entries().next().value ?? [];
1183
+ if (n === void 0 || r === void 0) return;
1184
+ let i = r.values().reduce((e, t) => e + t.sizes.uncompressed, 0), a = ir(t.get(n) ?? "");
1185
+ return Y(r, a), {
1186
+ bytes: i,
1187
+ groups: r,
1188
+ wasm: a
1189
+ };
1190
+ }
1191
+ function ir(e) {
1163
1192
  let t = {
1164
1193
  bytes: 0,
1165
1194
  binaryBytes: 0
1166
1195
  };
1167
1196
  for (let n of e.matchAll(/data:application\/wasm;base64,([A-Za-z\d+/]*={0,2})/g)) {
1168
1197
  let e = n[1] ?? "";
1169
- t.bytes += n[0].length, t.binaryBytes += Math.floor(e.length * 3 / 4) - nr(e);
1198
+ t.bytes += n[0].length, t.binaryBytes += Math.floor(e.length * 3 / 4) - ar(e);
1170
1199
  }
1171
1200
  return t;
1172
1201
  }
1173
- function nr(e) {
1202
+ function ar(e) {
1174
1203
  return e.endsWith("==") ? 2 : +!!e.endsWith("=");
1175
1204
  }
1176
- function rr(e, t) {
1205
+ function Y(e, t) {
1177
1206
  if (t.bytes <= 0) return;
1178
- let n = [e.get("wasm"), e.get(G)].flatMap((e) => e === void 0 ? [] : e.files.entries().map(([t, n]) => ({
1207
+ let n = [e.get("wasm"), e.get(K)].flatMap((e) => e === void 0 ? [] : e.files.entries().map(([t, n]) => ({
1179
1208
  group: e,
1180
1209
  fileName: t,
1181
1210
  sizes: n
1182
1211
  })).toArray()).find(({ sizes: e }) => e.uncompressed >= t.bytes);
1183
1212
  if (n === void 0) return;
1184
- or(e, n.group, n.fileName, n.sizes, t.bytes);
1185
- let r = `${q}, ${$(t.binaryBytes)} binary)`;
1213
+ sr(e, n.group, n.fileName, n.sizes, t.bytes);
1214
+ let r = `${J}, ${$(t.binaryBytes)} binary)`;
1186
1215
  e.set(r, {
1187
1216
  sizes: {
1188
1217
  uncompressed: t.bytes,
@@ -1194,88 +1223,44 @@ function rr(e, t) {
1194
1223
  }]])
1195
1224
  });
1196
1225
  }
1197
- function ir(e, t, n, r) {
1198
- let i = e.get(G), a = i?.files.get("");
1199
- if (i === void 0 || a === void 0 || a.uncompressed < t) return;
1200
- or(e, i, "", a, t);
1201
- let o = r === void 0 ? /* @__PURE__ */ new Map([["", {
1202
- uncompressed: t,
1226
+ function or(e, t) {
1227
+ let n = e.get(K), r = n?.files.get("");
1228
+ if (n === void 0 || r === void 0) return;
1229
+ sr(e, n, "", r, t.bytes);
1230
+ let i = {
1231
+ uncompressed: t.bytes,
1203
1232
  gzip: 0
1204
- }]]) : ar(r, t, n);
1205
- e.set(K, {
1206
- sizes: {
1207
- uncompressed: t,
1208
- gzip: 0
1209
- },
1210
- files: o
1233
+ };
1234
+ e.set(q, {
1235
+ sizes: i,
1236
+ files: /* @__PURE__ */ new Map([["", { ...i }]]),
1237
+ parts: t.groups
1211
1238
  });
1212
1239
  }
1213
- function ar(e, t, n) {
1214
- rr(e, n);
1215
- let r = /* @__PURE__ */ new Map();
1216
- for (let [t, n] of e) if (t === "src") for (let [e, t] of n.files) r.set(e, { ...t });
1217
- else {
1218
- let e = n.files.size === 1 ? Y(t, fr(n.files)) : t;
1219
- r.set(e, { ...n.sizes });
1220
- }
1221
- let i = r.values().reduce((e, t) => e + t.uncompressed, 0), a = r.get(G) ?? Q();
1222
- return a.uncompressed += Math.max(0, t - i), a.uncompressed > 0 && r.set(G, a), r;
1223
- }
1224
- function or(e, t, n, r, i) {
1240
+ function sr(e, t, n, r, i) {
1225
1241
  if (r.uncompressed -= i, t.sizes.uncompressed -= i, r.uncompressed <= 0 && t.files.delete(n), !(t.sizes.uncompressed > 0)) for (let [n, r] of e) r === t && e.delete(n);
1226
1242
  }
1227
- function sr(e, t) {
1228
- return e[0] === G == (t[0] === G) ? t[1].sizes.uncompressed - e[1].sizes.uncompressed : e[0] === G ? 1 : -1;
1229
- }
1230
- function cr(e, t, n) {
1231
- let r = [];
1232
- for (let [i, { sizes: a, files: o }] of e) if (o.size === 1) {
1233
- let e = fr(o);
1234
- r.push(Z(`${U}${X(Y(i, e))}`, J(a.uncompressed, t)));
1235
- } else r.push(Z(`${U}${dr(i, o)}`, J(a.uncompressed, t))), n || r.push(...lr(o, t));
1236
- return r;
1237
- }
1238
- function lr(e, t) {
1239
- let n = [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), r = ur(n, t), i = (r > 0 ? n.slice(0, -r) : n).map(([e, n]) => Z(`${U}${U}↳ ${X(e)}`, J(n.uncompressed, t, Bn)));
1240
- if (r > 0) {
1241
- let e = n.slice(-r).reduce((e, [, t]) => e + t.uncompressed, 0);
1242
- i.push(Z(`${U}${U}↳ ${String(r)} smaller files`, J(e, t, Bn)));
1243
- }
1244
- return i;
1243
+ function cr(e, t) {
1244
+ return e[0] === K == (t[0] === K) ? t[1].sizes.uncompressed - e[1].sizes.uncompressed : e[0] === K ? 1 : -1;
1245
1245
  }
1246
- function ur(e, t) {
1247
- if (t <= 0) return 0;
1248
- let n = 0, r = 0;
1249
- for (let [, i] of e.toReversed()) {
1250
- let e = i.uncompressed / t * 100 < Vn, a = (r + i.uncompressed) / t * 100 <= Hn;
1251
- if (!e || !a) break;
1252
- n++, r += i.uncompressed;
1253
- }
1254
- return n >= 2 ? n : 0;
1246
+ function lr(e, t, n = !1) {
1247
+ let r = n ? `${G}${G}↳ ` : G;
1248
+ return [...e].toSorted(cr).flatMap(([e, i]) => [X(`${r}${dr(e, i.files)}`, ur(i.sizes.uncompressed, t, n ? Un : Hn)), ...i.parts === void 0 ? [] : lr(i.parts, t, !0)]);
1255
1249
  }
1256
- function J(e, t, n = zn) {
1250
+ function ur(e, t, n) {
1257
1251
  return `${br(t > 0 ? e / t * 100 : 0, n)} · ${$(e)}`;
1258
1252
  }
1259
- function Y(e, t) {
1260
- return t === "" ? e : `${e} → ${t}`;
1261
- }
1262
1253
  function dr(e, t) {
1263
- if (e === K) return e;
1264
- let [n] = [...t].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed)[0] ?? [""];
1265
- return `${X(Y(e, n))} + ${String(t.size - 1)} more`;
1254
+ let [n] = [...t].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed)[0] ?? [""], r = fr(n === "" ? e : `${e} → ${n}`);
1255
+ return t.size > 1 ? `${r} + ${String(t.size - 1)} more` : r;
1266
1256
  }
1267
- function X(e) {
1268
- let t = e.indexOf(" → "), n = t === -1 ? "" : e.slice(0, t + 3), r = e.slice(n.length), i = Math.max(Un - n.length, 2);
1257
+ function fr(e) {
1258
+ let t = e.indexOf(" → "), n = t === -1 ? "" : e.slice(0, t + 3), r = e.slice(n.length), i = Math.max(Wn - n.length, 2);
1269
1259
  return r.length > i ? `${n}<abbr title="${r.replaceAll("&", "&amp;").replaceAll("\"", "&quot;")}">…${r.slice(r.length - (i - 1))}</abbr>` : e;
1270
1260
  }
1271
- function Z(e, t) {
1261
+ function X(e, t) {
1272
1262
  return `| ${e} | ${t.replaceAll(" ", "&nbsp;")} |`;
1273
1263
  }
1274
- function fr(e) {
1275
- let [t] = e.keys();
1276
- if (t === void 0) throw Error("Expected exactly one file");
1277
- return t;
1278
- }
1279
1264
  function pr(e) {
1280
1265
  let t = mr(e.dependencies), n = /* @__PURE__ */ new Map();
1281
1266
  for (let r of e.resources) {
@@ -1283,12 +1268,12 @@ function pr(e) {
1283
1268
  let { group: e, file: i } = hr(r.name, t), a = vr(r), o = n.get(r.parent) ?? /* @__PURE__ */ new Map();
1284
1269
  n.set(r.parent, o);
1285
1270
  let s = o.get(e) ?? {
1286
- sizes: Q(),
1271
+ sizes: Z(),
1287
1272
  files: /* @__PURE__ */ new Map()
1288
1273
  };
1289
- o.set(e, s), xr(s.sizes, a);
1290
- let c = s.files.get(i) ?? Q();
1291
- s.files.set(i, c), xr(c, a);
1274
+ o.set(e, s), Q(s.sizes, a);
1275
+ let c = s.files.get(i) ?? Z();
1276
+ s.files.set(i, c), Q(c, a);
1292
1277
  }
1293
1278
  return n;
1294
1279
  }
@@ -1305,7 +1290,7 @@ function hr(e, t) {
1305
1290
  };
1306
1291
  }
1307
1292
  return e === "[unassigned]" ? {
1308
- group: G,
1293
+ group: K,
1309
1294
  file: ""
1310
1295
  } : e.startsWith("\0") ? {
1311
1296
  group: "(runtime)",
@@ -1334,42 +1319,42 @@ function vr(e) {
1334
1319
  function yr(e) {
1335
1320
  return `${$(e.uncompressed)} · gzip ${$(e.gzip)}`;
1336
1321
  }
1337
- function br(e, t = zn) {
1338
- let n = Math.round(e / 100 * W);
1339
- return `\`${t.repeat(n)}${"░".repeat(W - n)}\` ${e.toFixed(1)}%`;
1322
+ function br(e, t) {
1323
+ let n = Math.round(e / 100 * Vn);
1324
+ return `\`${t.repeat(n)}${"░".repeat(Vn - n)}\` ${e.toFixed(1)}%`;
1340
1325
  }
1341
- function Q() {
1326
+ function Z() {
1342
1327
  return {
1343
1328
  uncompressed: 0,
1344
1329
  gzip: 0
1345
1330
  };
1346
1331
  }
1347
- function xr(e, t) {
1332
+ function Q(e, t) {
1348
1333
  e.uncompressed += t.uncompressed, e.gzip += t.gzip;
1349
1334
  }
1350
- function Sr(e, t) {
1335
+ function xr(e, t) {
1351
1336
  return `${(e / t * 100).toFixed(1)}%`;
1352
1337
  }
1353
1338
  function $(e) {
1354
- return e < 1024 ? `${String(e)} B` : `${(e / 1024).toFixed(1)} kB`;
1339
+ return e < 1024 ? `${String(e)} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} kB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
1355
1340
  }
1356
1341
  // src/actions/documentProject.ts
1357
- async function Cr(e = "MIT", n = !1) {
1342
+ async function Sr(e = "MIT") {
1358
1343
  try {
1359
- let i = await S("config.json"), a = g(i.id).typeId === "connector";
1360
- await Gt(), a && await Ye(), await kn(), await gt(e), await t("bundle-analysis-reports/sonda/index.json") === null ? C(`ℹ️ Bundle sizes NOT documented, as there is no '${Fn}' yet. Build the project first.`) : await Zn({ moduleLevel: n }), await ln(), await Xe();
1361
- let o = await t(H) !== null;
1362
- o ? await Pn() : C(`ℹ️ '${H}' NOT required by this project`), await r("ℹ️ Format generated files", "prettier", [
1344
+ let n = await C("config.json"), i = g(n.id).typeId === "connector";
1345
+ await Gt(), i && await Ye(), await kn(), await _t(e), await t("bundle-analysis-reports/sonda/index.json") === null ? w(`ℹ️ Bundle sizes NOT documented, as there is no '${Fn}' yet. Build the project first.`) : await $n(), await ln(), await Xe();
1346
+ let a = await t(W) !== null;
1347
+ a ? await Pn() : w(`ℹ️ '${W}' NOT required by this project`), await r("ℹ️ Format generated files", "prettier", [
1363
1348
  "--write",
1364
1349
  "README.md",
1365
- ...o ? [H] : []
1350
+ ...a ? [W] : []
1366
1351
  ]);
1367
1352
  } catch (e) {
1368
1353
  console.error("❌ Error documenting project", e), process.exit(1);
1369
1354
  }
1370
1355
  }
1371
1356
  // src/actions/formatCode.ts
1372
- async function wr() {
1357
+ async function Cr() {
1373
1358
  try {
1374
1359
  l("Format Code");
1375
1360
  let e = [
@@ -1381,41 +1366,41 @@ async function wr() {
1381
1366
  "app",
1382
1367
  "src",
1383
1368
  "tests"
1384
- ].filter((e) => le(e)).map((e) => `${e}/**`)
1369
+ ].filter((e) => ce(e)).map((e) => `${e}/**`)
1385
1370
  ];
1386
- await r("1️⃣ Format", "prettier", e), b("Code formatted");
1371
+ await r("1️⃣ Format", "prettier", e), x("Code formatted");
1387
1372
  } catch (e) {
1388
1373
  console.error("❌ Error formatting code", e), process.exit(1);
1389
1374
  }
1390
1375
  }
1391
1376
  // src/actions/lintCode.ts
1392
- async function Tr() {
1377
+ async function wr() {
1393
1378
  try {
1394
- l("Lint Code"), await r("1️⃣ Lint", "eslint", ["."]), b("Code linted");
1379
+ l("Lint Code"), await r("1️⃣ Lint", "eslint", ["."]), x("Code linted");
1395
1380
  } catch (e) {
1396
1381
  console.error("❌ Error linting code", e), process.exit(1);
1397
1382
  }
1398
1383
  }
1399
1384
  // src/utilities/cloudflare.ts
1400
- var Er = {
1385
+ var Tr = {
1401
1386
  ".css": "text/css",
1402
1387
  ".js": "application/javascript",
1403
1388
  ".wasm": "application/wasm"
1404
- }, Dr = "dpuse-sample-data-eu";
1405
- async function Or() {
1406
- let e = await S("config.json"), t = {
1389
+ }, Er = "dpuse-sample-data-eu";
1390
+ async function Dr() {
1391
+ let e = await C("config.json"), t = {
1407
1392
  body: JSON.stringify(e),
1408
1393
  headers: { "Content-Type": "application/json" },
1409
1394
  method: "PUT"
1410
1395
  }, n = await fetch(`https://api.dpuse.app/configs/${e.id}`, t);
1411
1396
  if (!n.ok) throw Error(await n.text());
1412
1397
  }
1413
- async function kr(e, t) {
1414
- let n = await Pr(`${e}/${t}`, t), r = Map.groupBy(n, ({ key: e }) => c(e));
1415
- for (let [e, t] of r) await Nr(t, ["--content-type", e]);
1398
+ async function Or(e, t) {
1399
+ let n = await Nr(`${e}/${t}`, t), r = Map.groupBy(n, ({ key: e }) => c(e));
1400
+ for (let [e, t] of r) await Mr(t, ["--content-type", e]);
1416
1401
  }
1417
- async function Ar(e) {
1418
- await kr(e, "application"), await kr(e, "fileStore"), await Nr(["applicationIndex.json", "fileStoreIndex.json"].map((t) => ({
1402
+ async function kr(e) {
1403
+ await Or(e, "application"), await Or(e, "fileStore"), await Mr(["applicationIndex.json", "fileStoreIndex.json"].map((t) => ({
1419
1404
  file: `${e}/${t}`,
1420
1405
  key: t
1421
1406
  })), [
@@ -1425,7 +1410,7 @@ async function Ar(e) {
1425
1410
  "no-cache"
1426
1411
  ]);
1427
1412
  }
1428
- async function jr(e) {
1413
+ async function Ar(e) {
1429
1414
  let t = e.id, n = {
1430
1415
  body: JSON.stringify(e),
1431
1416
  headers: { "Content-Type": "application/json" },
@@ -1433,14 +1418,14 @@ async function jr(e) {
1433
1418
  }, r = await fetch(`https://api.dpuse.app/configs/${t}`, n);
1434
1419
  if (!r.ok) throw Error(await r.text());
1435
1420
  }
1436
- async function Mr(e, t) {
1421
+ async function jr(e, t) {
1437
1422
  let n = `v${e.version ?? "unknown"}`;
1438
1423
  async function r(e, r = "") {
1439
- let i = await te(e, { withFileTypes: !0 });
1424
+ let i = await ee(e, { withFileTypes: !0 });
1440
1425
  for (let a of i) {
1441
1426
  if (a.isDirectory() || a.name.endsWith(".map")) continue;
1442
- let i = `${e}/${a.name}`, o = r ? `${r}/${a.name}` : a.name, s = `${t}_${n}/${o}`.replaceAll("\\", "/"), c = Er[T.extname(a.name)] ?? "application/octet-stream";
1443
- console.info(`⚙️ Uploading '${o}' → '${s}'...`), await y(void 0, "wrangler", [
1427
+ let i = `${e}/${a.name}`, o = r ? `${r}/${a.name}` : a.name, s = `${t}_${n}/${o}`.replaceAll("\\", "/"), c = Tr[E.extname(a.name)] ?? "application/octet-stream";
1428
+ console.info(`⚙️ Uploading '${o}' → '${s}'...`), await b(void 0, "wrangler", [
1444
1429
  "r2",
1445
1430
  "object",
1446
1431
  "put",
@@ -1455,15 +1440,15 @@ async function Mr(e, t) {
1455
1440
  }
1456
1441
  await r("dist");
1457
1442
  }
1458
- async function Nr(e, t) {
1443
+ async function Mr(e, t) {
1459
1444
  if (e.length === 0) return;
1460
- let n = await w.mkdtemp(T.join(_e.tmpdir(), "dpuse-r2-bulk-")), r = T.join(n, "files.json");
1445
+ let n = await T.mkdtemp(E.join(_e.tmpdir(), "dpuse-r2-bulk-")), r = E.join(n, "files.json");
1461
1446
  try {
1462
- await _(r, e), console.info(`⚙️ Uploading ${String(e.length)} files (${t.join(" ")})...`), await y(void 0, "wrangler", [
1447
+ await v(r, e), console.info(`⚙️ Uploading ${String(e.length)} files (${t.join(" ")})...`), await b(void 0, "wrangler", [
1463
1448
  "r2",
1464
1449
  "bulk",
1465
1450
  "put",
1466
- Dr,
1451
+ Er,
1467
1452
  "--filename",
1468
1453
  r,
1469
1454
  ...t,
@@ -1471,18 +1456,18 @@ async function Nr(e, t) {
1471
1456
  "--remote"
1472
1457
  ]);
1473
1458
  } finally {
1474
- await w.rm(n, {
1459
+ await T.rm(n, {
1475
1460
  force: !0,
1476
1461
  recursive: !0
1477
1462
  });
1478
1463
  }
1479
1464
  }
1480
- async function Pr(e, t) {
1481
- let n = await te(e), r = [];
1465
+ async function Nr(e, t) {
1466
+ let n = await ee(e), r = [];
1482
1467
  for (let i of n) {
1483
1468
  if (i.startsWith(".")) continue;
1484
1469
  let n = `${e}/${i}`, a = `${t}/${i}`;
1485
- (await h(n)).isDirectory() ? r.push(...await Pr(n, a)) : r.push({
1470
+ (await h(n)).isDirectory() ? r.push(...await Nr(n, a)) : r.push({
1486
1471
  file: n,
1487
1472
  key: a
1488
1473
  });
@@ -1490,56 +1475,56 @@ async function Pr(e, t) {
1490
1475
  return r;
1491
1476
  }
1492
1477
  // src/actions/publishProject.ts
1493
- async function Fr() {
1478
+ async function Pr() {
1494
1479
  try {
1495
1480
  l("Publish Project");
1496
- let e = await S("package.json"), t = await S("config.json"), n = g(t.id);
1497
- n.publishedTo === "npm" ? await r("1️⃣ Publish to npm", "npm", ["publish", "--provenance"]) : C("1️⃣ Publishing to npm NOT required");
1481
+ let e = await C("package.json"), t = await C("config.json"), n = g(t.id);
1482
+ n.publishedTo === "npm" ? await r("1️⃣ Publish to npm", "npm", ["publish", "--provenance"]) : w("1️⃣ Publishing to npm NOT required");
1498
1483
  let i = [
1499
1484
  "api",
1500
1485
  "app",
1501
1486
  "kb"
1502
1487
  ].includes(n.publishedTo);
1503
- i && await r("2️⃣ Deploy", "npm", ["run", "deploy"]), await Ir(i ? "3️⃣ " : "2️⃣ ", e, t, n), n.publishedTo === "sampleData" && (C("3️⃣ Upload sample data"), await Ar("public")), b(`Project version '${e.version ?? "unknown"}' published.`);
1488
+ i && await r("2️⃣ Deploy", "npm", ["run", "deploy"]), await Fr(i ? "3️⃣ " : "2️⃣ ", e, t, n), n.publishedTo === "sampleData" && (w("3️⃣ Upload sample data"), await kr("public")), x(`Project version '${e.version ?? "unknown"}' published.`);
1504
1489
  } catch (e) {
1505
1490
  console.error("❌ Error publishing project", e), process.exit(1);
1506
1491
  }
1507
1492
  }
1508
- async function Ir(e, t, n, r) {
1509
- if (r.typeId === "app") C(`${e} Register module`), await Or();
1510
- else if (r.typeId === "engine") C(`${e} Register module`), await Mr(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await jr(n);
1511
- else if (r.uploadGroupName === void 0) C(`${e} Registration NOT required`);
1493
+ async function Fr(e, t, n, r) {
1494
+ if (r.typeId === "app") w(`${e} Register module`), await Dr();
1495
+ else if (r.typeId === "engine") w(`${e} Register module`), await jr(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await Ar(n);
1496
+ else if (r.uploadGroupName === void 0) w(`${e} Registration NOT required`);
1512
1497
  else {
1513
- C(`${e} Register module`);
1498
+ w(`${e} Register module`);
1514
1499
  let i = n.id.split("-").slice(2).join("-");
1515
- await Mr(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await jr(n);
1500
+ await jr(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await Ar(n);
1516
1501
  }
1517
1502
  }
1518
1503
  // src/actions/syncProjectWithGitHub.ts
1519
- async function Lr() {
1504
+ async function Ir() {
1520
1505
  try {
1521
1506
  l("Synchronise Project with GitHub");
1522
- let e = await S("package.json"), t = await S("config.json"), n = g(t.id);
1523
- await p("1️⃣ ", e), await se("2️⃣ ", e, n), await y("3️⃣ Stage changes", "git", ["add", "."]), await y("4️⃣ Commit changes", "git", [
1507
+ let e = await C("package.json"), t = await C("config.json"), n = g(t.id);
1508
+ await p("1️⃣ ", e), await oe("2️⃣ ", e, n), await b("3️⃣ Stage changes", "git", ["add", "."]), await b("4️⃣ Commit changes", "git", [
1524
1509
  "commit",
1525
1510
  "-m",
1526
1511
  `v${e.version ?? "unknown"}`
1527
- ]), await y("5️⃣ Push changes", "git", [
1512
+ ]), await b("5️⃣ Push changes", "git", [
1528
1513
  "push",
1529
1514
  "origin",
1530
1515
  "main:main"
1531
- ]), b(`Project version '${e.version ?? "unknown"}' synchronised with GitHub.`);
1516
+ ]), x(`Project version '${e.version ?? "unknown"}' synchronised with GitHub.`);
1532
1517
  } catch (e) {
1533
1518
  console.error("❌ Error synchronising project with GitHub", e), process.exit(1);
1534
1519
  }
1535
1520
  }
1536
1521
  // src/actions/testProject.ts
1537
- var Rr = [
1522
+ var Lr = [
1538
1523
  "1️⃣ ",
1539
1524
  "2️⃣ ",
1540
1525
  "3️⃣ ",
1541
1526
  "4️⃣ "
1542
- ], zr = [{
1527
+ ], Rr = [{
1543
1528
  id: "unit",
1544
1529
  label: "Run unit tests",
1545
1530
  command: "vitest",
@@ -1552,29 +1537,29 @@ var Rr = [
1552
1537
  arguments: ["test", "--pass-with-no-tests"],
1553
1538
  configFileName: "playwright.config.ts"
1554
1539
  }];
1555
- async function Br(e = ["unit"]) {
1540
+ async function zr(e = ["unit"]) {
1556
1541
  try {
1557
1542
  l("Test Project");
1558
1543
  let n = 0;
1559
- for (let i of zr) {
1544
+ for (let i of Rr) {
1560
1545
  if (!e.includes(i.id) || await t(i.configFileName) === null) continue;
1561
- let a = `${Rr[n] ?? ""} ${i.label}`;
1546
+ let a = `${Lr[n] ?? ""} ${i.label}`;
1562
1547
  await r(a, i.command, i.arguments), n += 1;
1563
1548
  }
1564
1549
  if (n === 0) {
1565
1550
  console.warn("\n⚠️ No tests configured for this project.\n");
1566
1551
  return;
1567
1552
  }
1568
- b("Project tested");
1553
+ x("Project tested");
1569
1554
  } catch (e) {
1570
1555
  console.error("❌ Error testing project", e), process.exit(1);
1571
1556
  }
1572
1557
  }
1573
1558
  // src/actions/triggerGitHubRelease.ts
1574
- async function Vr() {
1559
+ async function Br() {
1575
1560
  try {
1576
1561
  l("Trigger GitHub Release");
1577
- let e = `v${(await S("package.json")).version ?? "unknown"}`;
1562
+ let e = `v${(await C("package.json")).version ?? "unknown"}`;
1578
1563
  await r("1️⃣ Trigger GitHub release", "gh", [
1579
1564
  "release",
1580
1565
  "create",
@@ -1583,9 +1568,9 @@ async function Vr() {
1583
1568
  "main",
1584
1569
  "--generate-notes",
1585
1570
  "--latest"
1586
- ]), b(`GitHub release '${e}' created.`);
1571
+ ]), x(`GitHub release '${e}' created.`);
1587
1572
  } catch (e) {
1588
1573
  console.error("❌ Error triggering GitHub release", e), process.exit(1);
1589
1574
  }
1590
1575
  }
1591
- export { Se as auditDependencies, De as buildProject, Ue as checkProject, Cr as documentProject, wr as formatCode, Tr as lintCode, Fr as publishProject, c as resolveSampleDataContentType, Lr as syncProjectWithGitHub, Br as testProject, Vr as triggerGitHubRelease, kr as uploadDirectoryToR2 };
1576
+ export { Se as auditDependencies, De as buildProject, Ue as checkProject, Sr as documentProject, Cr as formatCode, wr as lintCode, Pr as publishProject, c as resolveSampleDataContentType, Ir as syncProjectWithGitHub, zr as testProject, Br as triggerGitHubRelease, Or as uploadDirectoryToR2 };