@dpuse/dpuse-development 1.0.127 → 1.0.128

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,7 +1,7 @@
1
- import { C as e, D as t, E as n, M as r, O as i, S as a, T as o, _ as s, a as c, b as l, c as u, d, f, g as p, h as m, i as h, j as g, k as _, l as v, m as ee, n as te, o as ne, p as y, r as re, s as ie, t as ae, u as oe, v as b, w as x, x as S, y as C } from "./utilities-Bqc7DQXv.js";
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-CcYG1K5H.js";
2
2
  import { SHIPPED_PACKAGES_FILE_NAME as se } from "./vite.es.js";
3
- import { existsSync as ce, promises as w } from "node:fs";
4
- import T from "node:path";
3
+ import { existsSync as ce, promises as T } from "node:fs";
4
+ import E from "node:path";
5
5
  import { promisify as le } from "node:util";
6
6
  import { execFile as ue } from "node:child_process";
7
7
  import { fileURLToPath as de } from "node:url";
@@ -30,14 +30,14 @@ var _e = [
30
30
  ], ve = /* @__PURE__ */ new Set(["critical", "high"]);
31
31
  async function ye() {
32
32
  try {
33
- s("Audit Dependencies");
34
- let e = await S("package.json");
35
- re.has(e.name ?? "") ? C(`1️⃣ Shipped dependencies NOT checked: ${e.name ?? ""} is a development-only tool`) : await o("1️⃣ Check shipped dependencies for any vulnerability", "npm", ["audit", "--omit=dev"]);
36
- let t = await n("2️⃣ Check all dependencies for high or critical vulnerabilities", "npm", ["audit", "--json"]), r = JSON.parse(t);
37
- if (r.error !== void 0) throw Error(r.error.summary);
38
- let i = xe(Ce(r));
39
- if (i.length > 0) throw Error(`${String(i.length)} high or critical vulnerabilities found`);
40
- b("Dependencies audited");
33
+ l("Audit Dependencies");
34
+ let e = await C("package.json");
35
+ re.has(e.name ?? "") ? w(`1️⃣ Shipped dependencies NOT checked: ${e.name ?? ""} is a development-only tool`) : await r("1️⃣ Check shipped dependencies for any vulnerability", "npm", ["audit", "--omit=dev"]);
36
+ let t = await n("2️⃣ Check all dependencies for high or critical vulnerabilities", "npm", ["audit", "--json"]), i = JSON.parse(t);
37
+ if (i.error !== void 0) throw Error(i.error.summary);
38
+ let a = xe(Ce(i));
39
+ if (a.length > 0) throw Error(`${String(a.length)} high or critical vulnerabilities found`);
40
+ x("Dependencies audited");
41
41
  } catch (e) {
42
42
  console.error("❌ Error auditing dependencies", e), process.exit(1);
43
43
  }
@@ -78,24 +78,24 @@ function Ce(e) {
78
78
  var we = "build:wasm";
79
79
  async function Te() {
80
80
  try {
81
- s("Build Project"), await Ee("1️⃣ ", await S("package.json")), b("Project built");
81
+ l("Build Project"), await Ee("1️⃣ ", await C("package.json")), x("Project built");
82
82
  } catch (e) {
83
83
  console.error("❌ Error building project", e), process.exit(1);
84
84
  }
85
85
  }
86
86
  async function Ee(e, t) {
87
- t.scripts?.[we] != null && await o(`${e} Build WebAssembly`, "npm", ["run", we]), await o(`${e} Bundle project`, "vite", ["build"]);
87
+ t.scripts?.[we] != null && await r(`${e} Build WebAssembly`, "npm", ["run", we]), await r(`${e} Bundle project`, "vite", ["build"]);
88
88
  }
89
89
  //#endregion
90
90
  //#region src/actions/checkConfigFiles.ts
91
- var E = "@dpuse/dpuse-development/prettierrc", De = "dpuse-development";
91
+ var D = "@dpuse/dpuse-development/prettierrc", De = "dpuse-development";
92
92
  async function Oe() {
93
93
  try {
94
- s("Check configuration files"), C("1️⃣ Check individual files");
95
- let t = await S("config.json"), n = await S("package.json"), r = n.private === !0, i = m(t.id), a = T.dirname(de(import.meta.url));
96
- await D(a, ".editorconfig"), await D(a, ".gitattributes"), await D(a, ".gitignore", [".gitignore_default"]), await D(a, ".markdownlint.json"), await D(a, ".ncurc.json"), await ke(i, a), await D(a, "LICENSE"), await je(i, a), await Me(i, a), await Ne(i, a), await Ie(i, a), Ae(i, n);
97
- let o = await e(v) !== null;
98
- o && await D(a, "rust-toolchain.toml"), await D(a, ".github/dependabot.yml", [`.github/dependabot${r ? ".private" : ""}${o ? ".rust" : ""}.yml`]), r ? await Pe(a) : (await Fe(a), await D(a, "SECURITY.md", [], (e) => e.replaceAll(De, () => t.id))), b("Configuration files checked");
94
+ l("Check configuration files"), w("1️⃣ Check individual files");
95
+ 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));
96
+ 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 ke(i, a), await O(a, "LICENSE"), await je(i, a), await Me(i, a), await Ne(i, a), await Ie(i, a), Ae(i, n);
97
+ let o = await t(y) !== null;
98
+ o && await O(a, "rust-toolchain.toml"), await O(a, ".github/dependabot.yml", [`.github/dependabot${r ? ".private" : ""}${o ? ".rust" : ""}.yml`]), r ? await Pe(a) : (await Fe(a), await O(a, "SECURITY.md", [], (t) => t.replaceAll(De, () => e.id))), x("Configuration files checked");
99
99
  } catch (e) {
100
100
  console.error("❌ Error checking configuration files", e), process.exit(1);
101
101
  }
@@ -107,10 +107,10 @@ async function ke(e, t) {
107
107
  "development",
108
108
  "eslint",
109
109
  "kb"
110
- ].includes(e.typeId) ? console.info("⚠️ File 'eslint.config.js' is UNIQUE to this project") : await D(t, "eslint.config.js", ["eslint.config.default.js"]);
110
+ ].includes(e.typeId) ? console.info("⚠️ File 'eslint.config.js' is UNIQUE to this project") : await O(t, "eslint.config.js", ["eslint.config.default.js"]);
111
111
  }
112
112
  function Ae(e, t) {
113
- 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 === E ? console.info(`ℹ️ Prettier configuration is '${E}'`) : console.info(`❌ Prettier configuration is NOT '${E}'`);
113
+ 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}'`);
114
114
  }
115
115
  async function je(e, t) {
116
116
  ["github"].includes(e.typeId) ? console.info("ℹ️ File 'tsconfig.json' is NOT required by this project") : [
@@ -121,10 +121,10 @@ async function je(e, t) {
121
121
  "presenter",
122
122
  "shared",
123
123
  "tool"
124
- ].includes(e.typeId) ? await D(t, "tsconfig.json") : console.info("⚠️ File 'tsconfig.json' is UNIQUE to this project");
124
+ ].includes(e.typeId) ? await O(t, "tsconfig.json") : console.info("⚠️ File 'tsconfig.json' is UNIQUE to this project");
125
125
  }
126
126
  async function Me(e, t) {
127
- ["github"].includes(e.typeId) ? console.info("ℹ️ File 'scripts/tsconfig.json' is NOT required by this project") : await D(t, "scripts/tsconfig.json");
127
+ ["github"].includes(e.typeId) ? console.info("ℹ️ File 'scripts/tsconfig.json' is NOT required by this project") : await O(t, "scripts/tsconfig.json");
128
128
  }
129
129
  async function Ne(e, t) {
130
130
  if ([
@@ -150,15 +150,15 @@ async function Ne(e, t) {
150
150
  break;
151
151
  default: n = ["vite.config.default.ts"];
152
152
  }
153
- await D(t, "vite.config.ts", n);
153
+ await O(t, "vite.config.ts", n);
154
154
  }
155
155
  }
156
- async function Pe(t) {
157
- for (let n of [".github/workflows/ci.yml", ".github/workflows/publish.yml"]) await e(n) !== null && await D(t, n);
156
+ async function Pe(e) {
157
+ for (let n of [".github/workflows/ci.yml", ".github/workflows/publish.yml"]) await t(n) !== null && await O(e, n);
158
158
  console.info("ℹ️ CodeQL and Scorecard workflows and file 'SECURITY.md' are NOT required by this project");
159
159
  }
160
160
  async function Fe(e) {
161
- await D(e, ".github/workflows/ci.yml"), await D(e, ".github/workflows/codeql.yml"), await D(e, ".github/workflows/publish.yml"), await D(e, ".github/workflows/scorecard.yml");
161
+ 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");
162
162
  }
163
163
  async function Ie(e, t) {
164
164
  [
@@ -166,36 +166,35 @@ async function Ie(e, t) {
166
166
  "api",
167
167
  "github",
168
168
  "kb"
169
- ].includes(e.typeId) ? console.info("ℹ️ File 'vitest.config.ts' is NOT required by this project") : await D(t, "vitest.config.ts");
169
+ ].includes(e.typeId) ? console.info("ℹ️ File 'vitest.config.ts' is NOT required by this project") : await O(t, "vitest.config.ts");
170
170
  }
171
- async function D(e, t, n = [], r = (e) => e) {
172
- let i = T.resolve(process.cwd(), t), o = n.length > 0 ? n : [t], s;
171
+ async function O(e, t, n = [], r = (e) => e) {
172
+ let i = E.resolve(process.cwd(), t), a = n.length > 0 ? n : [t], o;
173
173
  try {
174
- s = await a(i);
174
+ o = await s(i);
175
175
  } catch (e) {
176
176
  if (e.code !== "ENOENT") throw e;
177
177
  }
178
- if (s === void 0) {
179
- console.info(`❌ File '${t}' is MISSING`);
180
- return;
181
- }
182
- for (let n of o) {
183
- let i = T.resolve(e, `../${n}`), o = r(await a(i));
184
- if (s === o) {
185
- console.info(`ℹ️ File '${t}' is the same as '${n}'`);
186
- return;
178
+ if (o === void 0) console.info(`❌ File '${t}' is MISSING`);
179
+ else {
180
+ for (let n of a) {
181
+ let i = E.resolve(e, `../${n}`), a = r(await s(i));
182
+ if (o === a) {
183
+ console.info(`ℹ️ File '${t}' is the same as '${n}'`);
184
+ return;
185
+ }
187
186
  }
187
+ console.info(`❌ File '${t}' is NOT the same`);
188
188
  }
189
- console.info(`❌ File '${t}' is NOT the same`);
190
189
  }
191
190
  //#endregion
192
191
  //#region src/actions/checkDependencies.ts
193
192
  async function Le() {
194
193
  try {
195
- s("Check Dependencies"), await o("1️⃣ Check using 'npm outdated'", "npm", ["outdated"], !0), C("2️⃣ Check using 'npm-check-updates'");
194
+ l("Check Dependencies"), await r("1️⃣ Check using 'npm outdated'", "npm", ["outdated"], !0), w("2️⃣ Check using 'npm-check-updates'");
196
195
  let e = {};
197
196
  try {
198
- e = await S(T.resolve(process.cwd(), ".ncurc.json"));
197
+ e = await C(E.resolve(process.cwd(), ".ncurc.json"));
199
198
  } catch (e) {
200
199
  if (e.code !== "ENOENT") throw e;
201
200
  }
@@ -205,39 +204,39 @@ async function Le() {
205
204
  dep: "dev,prod,peer,optional",
206
205
  install: "never",
207
206
  ...e
208
- }), await o("3️⃣ Install updated dependencies", "npm", [
207
+ }), await r("3️⃣ Install updated dependencies", "npm", [
209
208
  "install",
210
209
  "--prefer-online",
211
210
  "--no-strict-allow-scripts",
212
211
  "--no-audit",
213
212
  "--no-fund"
214
- ]), await o("4️⃣ Fix vulnerabilities where a compatible upgrade exists", "npm", [
213
+ ]), await r("4️⃣ Fix vulnerabilities where a compatible upgrade exists", "npm", [
215
214
  "audit",
216
215
  "fix",
217
216
  "--no-strict-allow-scripts",
218
217
  "--no-fund"
219
218
  ], !0), await be("4️⃣ Name the advisories above that the CI audit ignores");
220
219
  let t = await Re();
221
- t.length > 0 ? await o("5️⃣ Move install-script pins to installed versions", "npm", [
220
+ t.length > 0 ? await r("5️⃣ Move install-script pins to installed versions", "npm", [
222
221
  "install-scripts",
223
222
  "approve",
224
223
  ...t
225
- ]) : C("5️⃣ No pinned install-script approvals to move"), process.platform === "darwin" ? await o("6️⃣ Remove unused install-script entries", "npm", ["install-scripts", "prune"]) : C("6️⃣ Skipped removing unused install-script entries (macOS only)"), t.length > 0 && await o("7️⃣ Run install scripts skipped in steps 3 and 4", "npm", [
224
+ ]) : w("5️⃣ No pinned install-script approvals to move"), process.platform === "darwin" ? await r("6️⃣ Remove unused install-script entries", "npm", ["install-scripts", "prune"]) : w("6️⃣ Skipped removing unused install-script entries (macOS only)"), t.length > 0 && await r("7️⃣ Run install scripts skipped in steps 3 and 4", "npm", [
226
225
  "rebuild",
227
226
  ...t,
228
227
  "--no-strict-allow-scripts"
229
- ]), await o("8️⃣ Confirm every install script is reviewed", "npm", [
228
+ ]), await r("8️⃣ Confirm every install script is reviewed", "npm", [
230
229
  "install",
231
230
  "--strict-allow-scripts",
232
231
  "--no-audit",
233
232
  "--no-fund"
234
- ]), b("Dependencies checked");
233
+ ]), x("Dependencies checked");
235
234
  } catch (e) {
236
235
  console.error("❌ Error checking dependencies", e), process.exit(1);
237
236
  }
238
237
  }
239
238
  async function Re() {
240
- let { allowScripts: e = {} } = await S(T.resolve(process.cwd(), "package.json")), t = Object.entries(e).filter(([e, t]) => t && e.lastIndexOf("@") > 0).map(([e]) => e.slice(0, e.lastIndexOf("@")));
239
+ let { allowScripts: e = {} } = await C(E.resolve(process.cwd(), "package.json")), t = Object.entries(e).filter(([e, t]) => t && e.lastIndexOf("@") > 0).map(([e]) => e.slice(0, e.lastIndexOf("@")));
241
240
  return [...new Set(t)];
242
241
  }
243
242
  //#endregion
@@ -255,9 +254,9 @@ var Be = "<!-- SUPPORTED_ACTIONS_START -->", Ve = "<!-- SUPPORTED_ACTIONS_END --
255
254
  }, We = "The table below lists all connector actions and highlights those supported by this connector.";
256
255
  async function Ge() {
257
256
  try {
258
- s("Document Actions"), C("1️⃣ Insert actions description and table into 'README.md'");
259
- let e = (await S("config.json")).actionNames ?? [], t = g(e), n = r(e), i = `## Supported Actions\n\n${He}\n\n${Ue[t]} ${We}\n\n${n}`;
260
- await _(i, Be, Ve), b("Actions documented");
257
+ l("Document Actions"), w("1️⃣ Insert actions description and table into 'README.md'");
258
+ let t = (await C("config.json")).actionNames ?? [], n = i(t), r = a(t), o = `## Supported Actions\n\n${He}\n\n${Ue[n]} ${We}\n\n${r}`;
259
+ await e(o, Be, Ve), x("Actions documented");
261
260
  } catch (e) {
262
261
  console.error("❌ Error documenting actions", e), process.exit(1);
263
262
  }
@@ -266,9 +265,9 @@ async function Ge() {
266
265
  //#region src/actions/documentContributingLicense.ts
267
266
  async function Ke() {
268
267
  try {
269
- s("Document Contributing & License");
270
- let [e, t] = await Promise.all([S("package.json"), S("config.json")]), { owner: n, repository: r } = x(e, "document contributing and license"), i = qe(e), a = Je(t.firstCreatedAt);
271
- C("1️⃣ Insert contributing and license content into 'README.md'"), await l(), await _(Ye(n, r, i, a), te, ae), b("Contributing & license documented");
268
+ l("Document Contributing & License");
269
+ let [t, n] = await Promise.all([C("package.json"), C("config.json")]), { owner: r, repository: i } = S(t, "document contributing and license"), a = qe(t), o = Je(n.firstCreatedAt);
270
+ w("1️⃣ Insert contributing and license content into 'README.md'"), await d(), await e(Ye(r, i, a, o), te, ae), x("Contributing & license documented");
272
271
  } catch (e) {
273
272
  console.error("❌ Error documenting contributing and license", e), process.exit(1);
274
273
  }
@@ -300,38 +299,38 @@ This project is licensed under the MIT License, permitting free use, modificatio
300
299
  }
301
300
  //#endregion
302
301
  //#region src/utilities/rustCrates.ts
303
- var O = "licenses/cargoMetadata.json", k = "licenses/cargoTree.txt", Xe = 1e3, Ze = 1e4, Qe = "dpuse-development (https://github.com/dpuse/dpuse-development)", $e = /^(?:copying|licen[cs]e|unlicense)/i, et = "wasm32-unknown-unknown";
304
- async function tt(n, r) {
305
- if (await e("rust/Cargo.toml") === null) return null;
306
- let i = [
302
+ var k = "licenses/cargoMetadata.json", Xe = "licenses/cargoTree.txt", Ze = 1e3, Qe = 1e4, $e = "dpuse-development (https://github.com/dpuse/dpuse-development)", et = /^(?:copying|licen[cs]e|unlicense)/i, tt = "wasm32-unknown-unknown";
303
+ async function nt(e, n) {
304
+ if (await t("rust/Cargo.toml") === null) return null;
305
+ let r = [
307
306
  "--manifest-path",
308
- v,
307
+ y,
309
308
  "--locked"
310
- ], o = [
309
+ ], i = [
311
310
  "tree",
312
- ...i,
311
+ ...r,
313
312
  "--workspace",
314
313
  "--edges",
315
314
  "normal,no-proc-macro",
316
315
  "--target",
317
- et,
316
+ tt,
318
317
  "--prefix",
319
318
  "depth",
320
319
  "--format",
321
320
  "{p}|{l}|{r}"
322
321
  ];
323
- await t(n, "cargo", o, k), await t(n, "cargo", [
322
+ await o(e, "cargo", i, Xe), await o(e, "cargo", [
324
323
  "metadata",
325
- ...i,
324
+ ...r,
326
325
  "--format-version",
327
326
  "1",
328
327
  "--filter-platform",
329
- et
330
- ], O);
331
- let s = nt(await a(k)), c = await S(O);
332
- await w.rm(k, { force: !0 }), await w.rm(O, { force: !0 });
328
+ tt
329
+ ], k);
330
+ let a = rt(await s(Xe)), c = await C(k);
331
+ await T.rm(Xe, { force: !0 }), await T.rm(k, { force: !0 });
333
332
  let l = /* @__PURE__ */ new Map();
334
- for (let e of s) e.isOwn || l.has(`${e.name}@${e.version}`) || l.set(`${e.name}@${e.version}`, {
333
+ for (let e of a) e.isOwn || l.has(`${e.name}@${e.version}`) || l.set(`${e.name}@${e.version}`, {
335
334
  name: e.name,
336
335
  version: e.version,
337
336
  licenseExpression: e.licenseExpression,
@@ -342,11 +341,11 @@ async function tt(n, r) {
342
341
  latestPublishedDate: ""
343
342
  });
344
343
  let u = l.values().toArray();
345
- rt(u, r);
346
- for (let e of u) e.licenseFiles = await ot(e, c);
347
- return await st(n, u), {
344
+ it(u, n);
345
+ for (let e of u) e.licenseFiles = await st(e, c);
346
+ return await ct(e, u), {
348
347
  crates: u,
349
- treeItems: s.map(({ name: e, version: t, depth: n, isOwn: r }) => ({
348
+ treeItems: a.map(({ name: e, version: t, depth: n, isOwn: r }) => ({
350
349
  name: e,
351
350
  version: t,
352
351
  depth: n,
@@ -354,7 +353,7 @@ async function tt(n, r) {
354
353
  }))
355
354
  };
356
355
  }
357
- function nt(e) {
356
+ function rt(e) {
358
357
  let t = [];
359
358
  for (let n of e.split("\n")) {
360
359
  let [e = "", r = "", i = ""] = n.trim().split("|", 3), a = /^\d+/.exec(e)?.[0];
@@ -371,49 +370,49 @@ function nt(e) {
371
370
  }
372
371
  return t;
373
372
  }
374
- function rt(e, t) {
375
- let n = t.split(";").filter((e) => it(e)), r = e.filter((e) => !at(e.licenseExpression, n));
373
+ function it(e, t) {
374
+ let n = t.split(";").filter((e) => at(e)), r = e.filter((e) => !ot(e.licenseExpression, n));
376
375
  if (r.length === 0) return;
377
376
  let i = r.map((e) => `${e.name}@${e.version} (${e.licenseExpression === "" ? "no licence" : e.licenseExpression})`).join(", ");
378
377
  throw Error(`Rust crates with licences not allowed: ${i}.`);
379
378
  }
380
- function it(e) {
379
+ function at(e) {
381
380
  try {
382
381
  return he(e, [e]);
383
382
  } catch {
384
383
  return !1;
385
384
  }
386
385
  }
387
- function at(e, t) {
386
+ function ot(e, t) {
388
387
  try {
389
388
  return he(e.replaceAll("/", " OR "), t);
390
389
  } catch {
391
390
  return !1;
392
391
  }
393
392
  }
394
- async function ot(e, t) {
393
+ async function st(e, t) {
395
394
  let n = t.packages.find((t) => t.name === e.name && t.version === e.version);
396
395
  if (n == null) return [];
397
- let r = T.dirname(n.manifest_path), i = (await w.readdir(r)).filter((e) => $e.test(e)).toSorted((e, t) => e.localeCompare(t, "en"));
398
- await w.mkdir("licenses/downloads", { recursive: !0 });
396
+ let r = E.dirname(n.manifest_path), i = (await T.readdir(r)).filter((e) => et.test(e)).toSorted((e, t) => e.localeCompare(t, "en"));
397
+ await T.mkdir("licenses/downloads", { recursive: !0 });
399
398
  let a = [];
400
399
  for (let t of i) {
401
400
  let n = `downloads/${e.name}@${e.version}-${t}`;
402
- await w.copyFile(T.join(r, t), T.join("licenses", n)), a.push({
401
+ await T.copyFile(E.join(r, t), E.join("licenses", n)), a.push({
403
402
  label: t,
404
403
  path: n
405
404
  });
406
405
  }
407
406
  return a;
408
407
  }
409
- async function st(e, t) {
410
- C(`${e} - fetch release dates from crates.io`);
408
+ async function ct(e, t) {
409
+ w(`${e} - fetch release dates from crates.io`);
411
410
  for (let [e, n] of t.entries()) {
412
- e > 0 && await me(Xe), console.info(`⚙️ Fetching '${n.name}' (${String(e + 1)} of ${String(t.length)})...`);
411
+ e > 0 && await me(Ze), console.info(`⚙️ Fetching '${n.name}' (${String(e + 1)} of ${String(t.length)})...`);
413
412
  try {
414
413
  let e = await fetch(`https://crates.io/api/v1/crates/${encodeURIComponent(n.name)}`, {
415
- headers: { "User-Agent": Qe },
416
- signal: AbortSignal.timeout(Ze)
414
+ headers: { "User-Agent": $e },
415
+ signal: AbortSignal.timeout(Qe)
417
416
  });
418
417
  if (!e.ok) continue;
419
418
  let t = await e.json(), r = new Map((t.versions ?? []).map((e) => [e.num, e.created_at]));
@@ -423,77 +422,77 @@ async function st(e, t) {
423
422
  }
424
423
  //#endregion
425
424
  //#region src/actions/documentDependencies.ts
426
- var A = "<!-- DEPENDENCY_LICENSES_START -->", j = "<!-- DEPENDENCY_LICENSES_END -->", M = "## Dependency Licenses", ct = `bundle-analysis-reports/${se}`, N = "licenses/licenseTree.json", lt = "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.", ut = `The dependency tree below lists every package in this project — direct and transitive — along with its installed version, release date, and update status. ${lt}`, dt = `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. ${lt}`;
427
- async function ft(e = "MIT") {
425
+ var A = "<!-- DEPENDENCY_LICENSES_START -->", j = "<!-- DEPENDENCY_LICENSES_END -->", M = "## Dependency Licenses", lt = `bundle-analysis-reports/${se}`, N = "licenses/licenseTree.json", ut = "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.", dt = `The dependency tree below lists every package in this project — direct and transitive — along with its installed version, release date, and update status. ${ut}`, ft = `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. ${ut}`;
426
+ async function pt(e = "MIT") {
428
427
  try {
429
- s("Document Dependencies");
430
- let n = await S("package.json"), r = n.name ?? "";
431
- if (re.has(r)) {
432
- await pt(r), b("Dependencies documented");
428
+ l("Document Dependencies");
429
+ let t = await C("package.json"), n = t.name ?? "";
430
+ if (re.has(n)) {
431
+ await mt(n), x("Dependencies documented");
433
432
  return;
434
433
  }
435
- await f("1️⃣ Clear downloaded licenses", "licenses/downloads");
436
- let i = await St(), a = await Ct();
437
- if (a === null) {
438
- let r = Dt(i);
439
- await xt("2️⃣ Identify production licenses", e, [n.name ?? "", ...r], !0), await t("3️⃣ Identify transitive dependencies", "npm", [
434
+ await m("1️⃣ Clear downloaded licenses", "licenses/downloads");
435
+ let r = await Ct(), i = await wt();
436
+ if (i === null) {
437
+ let n = Ot(r);
438
+ await St("2️⃣ Identify production licenses", e, [t.name ?? "", ...n], !0), await o("3️⃣ Identify transitive dependencies", "npm", [
440
439
  "ls",
441
440
  "--all",
442
441
  "--json",
443
442
  "--omit=dev"
444
- ], N), await mt("4️⃣ ", e, new Set(r));
443
+ ], N), await ht("4️⃣ ", e, new Set(n));
445
444
  } else {
446
- let r = wt(a, i), o = Tt(i), s = o.filter((e) => !r.has(e));
447
- await xt("2️⃣ Identify shipped licenses", e, [n.name ?? "", ...s], !1), Et(r, new Set(o)), await t("3️⃣ Identify transitive dependencies", "npm", [
445
+ let n = Tt(i, r), a = Et(r), s = a.filter((e) => !n.has(e));
446
+ await St("2️⃣ Identify shipped licenses", e, [t.name ?? "", ...s], !1), Dt(n, new Set(a)), await o("3️⃣ Identify transitive dependencies", "npm", [
448
447
  "ls",
449
448
  "--all",
450
449
  "--json"
451
450
  ], N, !0);
452
- let c = await tt("4️⃣ Identify Rust crates compiled into the WebAssembly", e), l = {
451
+ let c = await nt("4️⃣ Identify Rust crates compiled into the WebAssembly", e), l = {
453
452
  allowedLicenses: e,
454
- productionNames: yt(n),
453
+ productionNames: bt(t),
455
454
  rustCrates: c,
456
- shippedKeys: r
455
+ shippedKeys: n
457
456
  };
458
- await ht(c === null ? "4️⃣ " : "5️⃣ ", l);
457
+ await gt(c === null ? "4️⃣ " : "5️⃣ ", l);
459
458
  }
460
- b("Dependencies documented");
459
+ x("Dependencies documented");
461
460
  } catch (e) {
462
461
  console.error("❌ Error documenting dependencies", e), process.exit(1);
463
462
  }
464
463
  }
465
- async function pt(e) {
466
- C(`1️⃣ Skip: ${e} is a development-only tool and is never part of a production release.`);
467
- let t = `> [!WARNING]\n> Dependency licenses are not documented here: ${e} is a development-only tool and is never part of a production release.`;
468
- await _(`${M}\n\n${t}`, A, j);
469
- }
470
- async function mt(e, t, n) {
471
- C(`${e} Insert licenses into 'README.md'`);
472
- let r = await S(N), i = await bt(), a = `${jt(t, !1)}\n\n|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|\n`;
473
- for (let e of i.values()) a += F(e);
474
- let o = [];
475
- r.dependencies != null && Ft(r.dependencies, i, n, o, 0);
476
- let s = `${ut}\n\n${o.join("\n")}`;
477
- await _(`${M}\n\n${a.trimEnd()}\n\n### Dependency Tree\n\n${s}`, A, j);
478
- }
479
- async function ht(e, t) {
480
- C(`${e} Insert licenses into 'README.md'`);
481
- let { allowedLicenses: n, productionNames: r, rustCrates: i, shippedKeys: a } = t, o = await bt(), s = new Map((i?.crates ?? []).map((e) => [`${e.name}@${e.version}`, _t(e)])), c = i !== null, l = c ? "|Type|Dependency|Version|License(s)|Document|\n|:-|:-|:-:|:-|:-|" : "|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|", u = `${jt(n, !0, c)}\n\n${l}\n`;
482
- for (let e of o.values().toArray().toSorted(gt)) u += F(e, c ? "JavaScript" : void 0);
483
- for (let e of s.values().toArray().toSorted(gt)) u += F(e, "Rust");
484
- let d = await S(N), f = Object.entries(d.dependencies ?? {}).toSorted(([e], [t]) => Number(!r.has(e)) - Number(!r.has(t))), p = [];
485
- I(f, {
486
- licensesByKey: o,
487
- shippedKeys: a,
464
+ async function mt(t) {
465
+ w(`1️⃣ Skip: ${t} is a development-only tool and is never part of a production release.`);
466
+ let n = `> [!WARNING]\n> Dependency licenses are not documented here: ${t} is a development-only tool and is never part of a production release.`;
467
+ await e(`${M}\n\n${n}`, A, j);
468
+ }
469
+ async function ht(t, n, r) {
470
+ w(`${t} Insert licenses into 'README.md'`);
471
+ let i = await C(N), a = await xt(), o = `${Mt(n, !1)}\n\n|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|\n`;
472
+ for (let e of a.values()) o += F(e);
473
+ let s = [];
474
+ i.dependencies != null && It(i.dependencies, a, r, s, 0);
475
+ let c = `${dt}\n\n${s.join("\n")}`;
476
+ await e(`${M}\n\n${o.trimEnd()}\n\n### Dependency Tree\n\n${c}`, A, j);
477
+ }
478
+ async function gt(t, n) {
479
+ w(`${t} Insert licenses into 'README.md'`);
480
+ let { allowedLicenses: r, productionNames: i, rustCrates: a, shippedKeys: o } = n, s = await xt(), c = new Map((a?.crates ?? []).map((e) => [`${e.name}@${e.version}`, vt(e)])), l = a !== null, u = l ? "|Type|Dependency|Version|License(s)|Document|\n|:-|:-|:-:|:-|:-|" : "|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|", d = `${Mt(r, !0, l)}\n\n${u}\n`;
481
+ for (let e of s.values().toArray().toSorted(_t)) d += F(e, l ? "JavaScript" : void 0);
482
+ for (let e of c.values().toArray().toSorted(_t)) d += F(e, "Rust");
483
+ let f = await C(N), p = Object.entries(f.dependencies ?? {}).toSorted(([e], [t]) => Number(!i.has(e)) - Number(!i.has(t))), m = [];
484
+ I(p, {
485
+ licensesByKey: s,
486
+ shippedKeys: o,
488
487
  shownKeys: /* @__PURE__ */ new Set()
489
- }, p, 0, !1);
490
- let m = p.length === 0 ? "None." : p.join("\n"), h = (i?.treeItems ?? []).map((e) => vt(e, s)).join("\n"), g = c ? `${dt}\n\n#### JavaScript\n\n${m}\n\n#### Rust\n\n${h}` : `${dt}\n\n${m}`;
491
- await _(`${M}\n\n${u.trimEnd()}\n\n### Dependency Tree\n\n${g}`, A, j);
488
+ }, m, 0, !1);
489
+ let h = m.length === 0 ? "None." : m.join("\n"), g = (a?.treeItems ?? []).map((e) => yt(e, c)).join("\n"), _ = l ? `${ft}\n\n#### JavaScript\n\n${h}\n\n#### Rust\n\n${g}` : `${ft}\n\n${h}`;
490
+ await e(`${M}\n\n${d.trimEnd()}\n\n### Dependency Tree\n\n${_}`, A, j);
492
491
  }
493
- function gt(e, t) {
492
+ function _t(e, t) {
494
493
  return e.name.localeCompare(t.name, "en") || e.installedVersion.localeCompare(t.installedVersion, "en");
495
494
  }
496
- function _t(e) {
495
+ function vt(e) {
497
496
  return {
498
497
  name: e.name,
499
498
  repository: e.repository,
@@ -506,27 +505,27 @@ function _t(e) {
506
505
  licenseFiles: e.licenseFiles
507
506
  };
508
507
  }
509
- function vt(e, t) {
508
+ function yt(e, t) {
510
509
  let n = " ".repeat(e.depth);
511
510
  return e.isOwn ? `${n}- **${e.name}** ${e.version} — this project's Rust code, compiled into its WebAssembly` : L(e.name, e.version, t.get(`${e.name}@${e.version}`), n);
512
511
  }
513
- function yt(e) {
512
+ function bt(e) {
514
513
  return /* @__PURE__ */ new Set([
515
514
  ...Object.keys(e.dependencies ?? {}),
516
515
  ...Object.keys(e.optionalDependencies ?? {}),
517
516
  ...Object.keys(e.peerDependencies ?? {})
518
517
  ]);
519
518
  }
520
- async function bt() {
521
- let e = await S("licenses/licenses.json"), t = /* @__PURE__ */ new Map();
522
- for (let [n, r] of Object.entries(e)) t.set(n, Nt(n, r));
519
+ async function xt() {
520
+ let e = await C("licenses/licenses.json"), t = /* @__PURE__ */ new Map();
521
+ for (let [n, r] of Object.entries(e)) t.set(n, Pt(n, r));
523
522
  return await Promise.all(t.values().map(async (e) => {
524
- let t = await Pt(e.name, e.installedVersion);
523
+ let t = await Ft(e.name, e.installedVersion);
525
524
  e.latestVersion = t.latestVersion, e.latestPublishedDate = t.latestPublishedDate, e.publishedDate = t.publishedDate;
526
525
  })), t;
527
526
  }
528
- async function xt(e, t, n, r) {
529
- C(e), await new Promise((e, i) => {
527
+ async function St(e, t, n, r) {
528
+ w(e), await new Promise((e, i) => {
530
529
  let a = {
531
530
  start: process.cwd(),
532
531
  production: r,
@@ -543,39 +542,39 @@ async function xt(e, t, n, r) {
543
542
  });
544
543
  });
545
544
  }
546
- async function St() {
547
- let t = await e("package-lock.json");
548
- return t === null ? {} : JSON.parse(t).packages ?? {};
549
- }
550
545
  async function Ct() {
551
- let t = await e(ct);
552
- return t === null ? null : JSON.parse(t);
546
+ let e = await t("package-lock.json");
547
+ return e === null ? {} : JSON.parse(e).packages ?? {};
553
548
  }
554
- function wt(e, t) {
549
+ async function wt() {
550
+ let e = await t(lt);
551
+ return e === null ? null : JSON.parse(e);
552
+ }
553
+ function Tt(e, t) {
555
554
  let n = new Set(e.packages);
556
555
  for (let r of e.external) {
557
- let e = At(t, "", r);
558
- if (e !== void 0) for (let r of [e, ...Ot(t, e)]) {
556
+ let e = jt(t, "", r);
557
+ if (e !== void 0) for (let r of [e, ...kt(t, e)]) {
559
558
  let e = t[r];
560
559
  e?.version !== void 0 && n.add(P(r, e));
561
560
  }
562
561
  }
563
562
  return n;
564
563
  }
565
- function Tt(e) {
564
+ function Et(e) {
566
565
  let t = /* @__PURE__ */ new Set();
567
566
  for (let [n, r] of Object.entries(e)) n !== "" && r.version !== void 0 && t.add(P(n, r));
568
567
  return [...t];
569
568
  }
570
- function Et(e, t) {
569
+ function Dt(e, t) {
571
570
  let n = [...e.difference(t)];
572
571
  n.length > 0 && console.warn(`⚠️ Not installed, so not checked; rebuild to refresh the record: ${n.join(", ")}`);
573
572
  }
574
573
  function P(e, t) {
575
574
  return `${t.name ?? e.slice(e.lastIndexOf("node_modules/") + 13)}@${String(t.version)}`;
576
575
  }
577
- function Dt(e) {
578
- let t = Ot(e, ""), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
576
+ function Ot(e) {
577
+ let t = kt(e, ""), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
579
578
  for (let [i, a] of Object.entries(e)) {
580
579
  if (i === "" || a.version === void 0) continue;
581
580
  let e = P(i, a);
@@ -583,18 +582,18 @@ function Dt(e) {
583
582
  }
584
583
  return r.values().filter((e) => !n.has(e)).toArray();
585
584
  }
586
- function Ot(e, t) {
585
+ function kt(e, t) {
587
586
  let n = /* @__PURE__ */ new Set(), r = [t];
588
587
  for (; r.length > 0;) {
589
588
  let t = r.pop() ?? "", i = e[t];
590
- if (i !== void 0) for (let a of kt(i)) {
591
- let i = At(e, t, a);
589
+ if (i !== void 0) for (let a of At(i)) {
590
+ let i = jt(e, t, a);
592
591
  i === void 0 || n.has(i) || (n.add(i), r.push(i));
593
592
  }
594
593
  }
595
594
  return n;
596
595
  }
597
- function kt(e) {
596
+ function At(e) {
598
597
  let t = Object.keys(e.peerDependencies ?? {}).filter((t) => e.peerDependenciesMeta?.[t]?.optional !== !0);
599
598
  return [
600
599
  ...Object.keys(e.dependencies ?? {}),
@@ -602,7 +601,7 @@ function kt(e) {
602
601
  ...t
603
602
  ];
604
603
  }
605
- function At(e, t, n) {
604
+ function jt(e, t, n) {
606
605
  let r = t;
607
606
  for (;;) {
608
607
  let t = r === "" ? `node_modules/${n}` : `${r}/node_modules/${n}`, i = e[t];
@@ -612,14 +611,14 @@ function At(e, t, n) {
612
611
  r = a === -1 ? "" : r.slice(0, a);
613
612
  }
614
613
  }
615
- function jt(e, t, n = !1) {
616
- let r = Mt(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.";
614
+ function Mt(e, t, n = !1) {
615
+ let r = Nt(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.";
617
616
  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.`;
618
617
  }
619
- function Mt(e) {
618
+ function Nt(e) {
620
619
  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))}`;
621
620
  }
622
- function Nt(e, t) {
621
+ function Pt(e, t) {
623
622
  let n = e.lastIndexOf("@"), r = n > 0 ? e.slice(0, n) : e, i = n > 0 ? e.slice(n + 1) : "";
624
623
  return {
625
624
  name: r,
@@ -636,7 +635,7 @@ function Nt(e, t) {
636
635
  }]
637
636
  };
638
637
  }
639
- async function Pt(e, t) {
638
+ async function Ft(e, t) {
640
639
  try {
641
640
  let n = await fetch(`https://registry.npmjs.org/${encodeURIComponent(e)}`);
642
641
  if (n.ok) {
@@ -658,36 +657,32 @@ function F(e, t) {
658
657
  let n = e.licenseFiles.length === 0 ? "⚠️ No license file" : e.licenseFiles.map((e) => `[${e.label}](licenses/${e.path})`).join(" ");
659
658
  return `${t === void 0 ? "" : `|${t}`}|[${e.name}](${e.repository})|${e.installedVersion}|${e.licenseTypes}|${n}|\n`;
660
659
  }
661
- function Ft(e, t, n, r, i) {
660
+ function It(e, t, n, r, i) {
662
661
  let a = " ".repeat(i);
663
662
  for (let [o, s] of Object.entries(e)) {
664
663
  if (s.version === void 0) continue;
665
664
  let e = s.version;
666
- n.has(`${o}@${e}`) || (r.push(L(o, e, t.get(`${o}@${e}`), a)), s.dependencies != null && Ft(s.dependencies, t, n, r, i + 1));
665
+ n.has(`${o}@${e}`) || (r.push(L(o, e, t.get(`${o}@${e}`), a)), s.dependencies != null && It(s.dependencies, t, n, r, i + 1));
667
666
  }
668
667
  }
669
668
  function I(e, t, n, r, i) {
670
669
  for (let [a, o] of e) {
671
670
  if (o.version === void 0) continue;
672
671
  let e = `${a}@${o.version}`, s = Object.entries(o.dependencies ?? {});
673
- if (!t.shippedKeys.has(e)) {
674
- I(s, t, n, r, !0);
675
- continue;
676
- }
677
- i && t.shownKeys.has(e) || (t.shownKeys.add(e), n.push(L(a, o.version, t.licensesByKey.get(e), " ".repeat(r))), I(s, t, n, r + 1, !1));
672
+ t.shippedKeys.has(e) ? i && t.shownKeys.has(e) || (t.shownKeys.add(e), n.push(L(a, o.version, t.licensesByKey.get(e), " ".repeat(r))), I(s, t, n, r + 1, !1)) : I(s, t, n, r, !0);
678
673
  }
679
674
  }
680
675
  function L(e, t, n, r) {
681
- return `${r}- **${n == null ? e : `[${e}](${n.repository})`}** ${t}${It(n)}`;
676
+ return `${r}- **${n == null ? e : `[${e}](${n.repository})`}** ${t}${Lt(n)}`;
682
677
  }
683
- function It(e) {
678
+ function Lt(e) {
684
679
  if (e == null) return "";
685
- let t = e.publishedDate ? Lt(e.publishedDate.split("T", 1)[0]) : "";
680
+ let t = e.publishedDate ? Rt(e.publishedDate.split("T", 1)[0]) : "";
686
681
  if (e.latestVersion === "" || e.latestVersion === e.installedVersion) return t === "" ? "" : ` — ${t}`;
687
- let n = e.latestPublishedDate ? Lt(e.latestPublishedDate.split("T", 1)[0]) : "", r = n === "" ? `latest: ${e.latestVersion} ❗` : `latest: ${e.latestVersion} — ${n} ❗`;
682
+ let n = e.latestPublishedDate ? Rt(e.latestPublishedDate.split("T", 1)[0]) : "", r = n === "" ? `latest: ${e.latestVersion} ❗` : `latest: ${e.latestVersion} — ${n} ❗`;
688
683
  return t === "" ? ` — → ${r}` : ` — ${t} → ${r}`;
689
684
  }
690
- function Lt(e) {
685
+ function Rt(e) {
691
686
  if (e == null || e === "") return "n/a";
692
687
  let t = e.split("T", 1)[0];
693
688
  if (t == null || t === "") return "n/a";
@@ -696,42 +691,42 @@ function Lt(e) {
696
691
  }
697
692
  //#endregion
698
693
  //#region src/actions/documentOpening.ts
699
- var Rt = "<!-- OPENING_START -->", zt = "<!-- OPENING_END -->";
700
- async function Bt() {
694
+ var zt = "<!-- OPENING_START -->", Bt = "<!-- OPENING_END -->";
695
+ async function Vt() {
701
696
  try {
702
- s("Document Opening"), C("1️⃣ Insert opening content into 'README.md'");
703
- let e = await S("package.json"), t = await S("config.json"), { owner: n, repository: r } = x(e, "document opening"), i = Ht(e), a = Wt(t), o = m(t.id), c = o.uploadGroupName === void 0 ? void 0 : t.id, l = o.publishedTo === "npm" ? Ut(e) : void 0, u = Gt(n, r, i, {
704
- description: e.description,
697
+ l("Document Opening"), w("1️⃣ Insert opening content into 'README.md'");
698
+ let t = await C("package.json"), n = await C("config.json"), { owner: r, repository: i } = S(t, "document opening"), a = Ut(t), o = Gt(n), s = g(n.id), c = s.uploadGroupName === void 0 ? void 0 : n.id, u = s.publishedTo === "npm" ? Wt(t) : void 0, d = Kt(r, i, a, {
699
+ description: t.description,
705
700
  dpuseModuleId: c,
706
- introduction: a,
707
- npmPackageName: l,
708
- version: e.version
701
+ introduction: o,
702
+ npmPackageName: u,
703
+ version: t.version
709
704
  });
710
- await _(u, Rt, zt), b("Opening documented");
705
+ await e(d, zt, Bt), x("Opening documented");
711
706
  } catch (e) {
712
707
  console.error("❌ Error documenting opening", e), process.exit(1);
713
708
  }
714
709
  }
715
- function Vt(e) {
710
+ function Ht(e) {
716
711
  return e === void 0 ? "blue" : /^v?0/.test(e) || /alpha|beta|snapshot|dev|pre|rc/i.test(e) ? "orange" : "blue";
717
712
  }
718
- function Ht(e) {
713
+ function Ut(e) {
719
714
  let t = e.license;
720
715
  if (t == null || t === "") throw Error("package.json 'license' field is required to document opening.");
721
716
  return t;
722
717
  }
723
- function Ut(e) {
718
+ function Wt(e) {
724
719
  let t = e.name;
725
720
  if (t == null || t === "") throw Error("package.json 'name' field is required to document opening.");
726
721
  return t;
727
722
  }
728
- function Wt(e) {
723
+ function Gt(e) {
729
724
  let t = e.description.en?.trim();
730
725
  return t === void 0 || t === "" ? void 0 : t;
731
726
  }
732
- function Gt(e, t, n, r) {
727
+ function Kt(e, t, n, r) {
733
728
  let { description: i, dpuseModuleId: a, introduction: o, npmPackageName: s, version: c } = r, l = `https://github.com/${e}/${t}`, u = n.replaceAll("-", "--"), d = encodeURIComponent(`https://api.dpuse.app/configs/${a ?? ""}`);
734
- return `[![License: ${n}](https://img.shields.io/badge/License-${u}-blue.svg)](./LICENSE)${a === void 0 ? "" : `\n[![DPUse version](https://img.shields.io/badge/dynamic/json?url=${d}&query=%24.data.version&prefix=v&label=DPUse&color=${Vt(c)})](${l}/releases/latest)`}${s === void 0 ? "" : `\n[![npm version](https://img.shields.io/npm/v/${s}?label=npm)](https://www.npmjs.com/package/${s})`}
729
+ return `[![License: ${n}](https://img.shields.io/badge/License-${u}-blue.svg)](./LICENSE)${a === void 0 ? "" : `\n[![DPUse version](https://img.shields.io/badge/dynamic/json?url=${d}&query=%24.data.version&prefix=v&label=DPUse&color=${Ht(c)})](${l}/releases/latest)`}${s === void 0 ? "" : `\n[![npm version](https://img.shields.io/npm/v/${s}?label=npm)](https://www.npmjs.com/package/${s})`}
735
730
  [![CI](${l}/actions/workflows/ci.yml/badge.svg)](${l}/actions/workflows/ci.yml)${i == null || i === "" ? "" : `\n\n${i}`}
736
731
 
737
732
  [Report a Vulnerability](${l}/security/advisories/new) · [Open an Issue](${l}/issues)
@@ -750,105 +745,105 @@ In addition, DPUse provides [Tools](https://www.dpuse.app) used by the applicati
750
745
  }
751
746
  //#endregion
752
747
  //#region src/actions/documentQualitySecurity.ts
753
- var Kt = {
748
+ var qt = {
754
749
  "Branch-Protection": 3,
755
750
  "Code-Review": 0,
756
751
  Contributors: 0
757
- }, qt = /* @__PURE__ */ new Set(["CII-Best-Practices"]), Jt = "coverage/coverage-final.json", Yt = "coverage/coverage-summary.json", Xt = 80, Zt = 60, Qt = "code-health-reports/vitest/badge.json", $t = {
752
+ }, Jt = /* @__PURE__ */ new Set(["CII-Best-Practices"]), Yt = "coverage/coverage-final.json", Xt = "coverage/coverage-summary.json", Zt = 80, Qt = 60, $t = "code-health-reports/vitest/badge.json", en = {
758
753
  actions: "GitHub Actions",
759
754
  "javascript-typescript": "JavaScript/TypeScript",
760
755
  rust: "Rust"
761
- }, en = {
756
+ }, tn = {
762
757
  A: "brightgreen",
763
758
  B: "green",
764
759
  C: "yellow",
765
760
  D: "orange",
766
761
  F: "red"
767
- }, tn = `${c}/health.json`, nn = le(ue);
768
- async function rn() {
762
+ }, nn = `${u}/health.json`, rn = le(ue);
763
+ async function an() {
769
764
  try {
770
- s("Document Quality & Security");
771
- let e = await S("package.json"), t = await an(e), n = await sn(e, t === void 0 ? [] : ["--coverage", Jt]), { owner: r, repository: i } = x(e, "document quality and security");
772
- C("4️⃣ Read security checks and settings");
773
- let a = await ln(r, i, e);
774
- C("5️⃣ Look up OpenSSF Best Practices badge and Scorecard results");
775
- let [o, c] = await Promise.all([un(`https://github.com/${r}/${i}`), dn(`github.com/${r}/${i}`)]);
776
- C("6️⃣ Insert quality and security content into 'README.md'");
777
- let d = gn(r, i, {
778
- coveragePercent: t,
779
- fallowHealth: n,
780
- securitySettings: a
781
- }, o, c);
782
- await l(), await _(d, u, ie), b("Quality & security documented");
765
+ l("Document Quality & Security");
766
+ let t = await C("package.json"), n = await on(t), r = await cn(t, n === void 0 ? [] : ["--coverage", Yt]), { owner: i, repository: a } = S(t, "document quality and security");
767
+ w("4️⃣ Read security checks and settings");
768
+ let o = await un(i, a, t);
769
+ w("5️⃣ Look up OpenSSF Best Practices badge and Scorecard results");
770
+ let [s, c] = await Promise.all([dn(`https://github.com/${i}/${a}`), fn(`github.com/${i}/${a}`)]);
771
+ w("6️⃣ Insert quality and security content into 'README.md'");
772
+ let u = _n(i, a, {
773
+ coveragePercent: n,
774
+ fallowHealth: r,
775
+ securitySettings: o
776
+ }, s, c);
777
+ await d(), await e(u, f, ie), x("Quality & security documented");
783
778
  } catch (e) {
784
779
  console.error("❌ Error documenting quality and security", e), process.exit(1);
785
780
  }
786
781
  }
787
- async function an(t) {
788
- if (t.devDependencies?.["@vitest/coverage-v8"] == null) {
789
- C("1️⃣ Test coverage NOT measured, as '@vitest/coverage-v8' is not installed");
782
+ async function on(e) {
783
+ if (e.devDependencies?.["@vitest/coverage-v8"] == null) {
784
+ w("1️⃣ Test coverage NOT measured, as '@vitest/coverage-v8' is not installed");
790
785
  return;
791
786
  }
792
- await o("1️⃣ Measure test coverage", "vitest", [
787
+ await r("1️⃣ Measure test coverage", "vitest", [
793
788
  "run",
794
789
  "--passWithNoTests",
795
790
  "--coverage"
796
791
  ]);
797
- let n = await e(Yt);
792
+ let n = await t(Xt);
798
793
  if (n === null) return;
799
- let r = JSON.parse(n).total.lines.pct;
800
- return await on(r), r;
794
+ let i = JSON.parse(n).total.lines.pct;
795
+ return await sn(i), i;
801
796
  }
802
- async function on(e) {
797
+ async function sn(e) {
803
798
  let t = [
804
799
  "red",
805
800
  "yellow",
806
801
  "brightgreen"
807
- ], n = Number(e >= Zt) + Number(e >= Xt);
808
- await i(Qt, {
802
+ ], n = Number(e >= Qt) + Number(e >= Zt);
803
+ await v($t, {
809
804
  schemaVersion: 1,
810
805
  label: "coverage",
811
806
  message: `${e.toFixed(1)}%`,
812
807
  color: t[n]
813
808
  });
814
809
  }
815
- async function sn(e, n) {
810
+ async function cn(e, t) {
816
811
  if (e.devDependencies?.fallow == null) {
817
- C("2️⃣ Code health NOT measured, as Fallow is not installed"), C("3️⃣ Code health report NOT required");
812
+ w("2️⃣ Code health NOT measured, as Fallow is not installed"), w("3️⃣ Code health report NOT required");
818
813
  return;
819
814
  }
820
- await t("2️⃣ Measure code health", "fallow", [
815
+ await o("2️⃣ Measure code health", "fallow", [
821
816
  "health",
822
817
  "--report-only",
823
818
  "--format",
824
819
  "json",
825
- ...n
826
- ], tn), await t("3️⃣ Write code health report", "fallow", ["--format", "markdown"], ne, !0);
827
- let r = await S(tn);
828
- return await cn(r), r;
820
+ ...t
821
+ ], nn), await o("3️⃣ Write code health report", "fallow", ["--format", "markdown"], ne, !0);
822
+ let n = await C(nn);
823
+ return await ln(n), n;
829
824
  }
830
- async function cn(e) {
825
+ async function ln(e) {
831
826
  let { score: t, grade: n } = e.health_score;
832
- await i(h, {
827
+ await v(_, {
833
828
  schemaVersion: 1,
834
829
  label: "fallow",
835
830
  message: `${n} (${String(Math.round(t))})`,
836
- color: en[n] ?? "lightgrey"
831
+ color: tn[n] ?? "lightgrey"
837
832
  });
838
833
  }
839
- async function ln(t, n, r) {
834
+ async function un(e, n, r) {
840
835
  let [i, a, o] = await Promise.all([
841
- e(".github/workflows/ci.yml"),
842
- e(".github/dependabot.yml"),
843
- e(v)
844
- ]), s = await e(".github/workflows/codeql.yml") ?? "", [c, l, u, d] = await Promise.all([
845
- R(`repos/${t}/${n}`),
846
- R(`repos/${t}/${n}/private-vulnerability-reporting`),
847
- R(`repos/${t}/${n}/vulnerability-alerts`),
848
- R(`repos/${t}/${n}/commits/main/check-runs?per_page=100`)
836
+ t(".github/workflows/ci.yml"),
837
+ t(".github/dependabot.yml"),
838
+ t(y)
839
+ ]), s = await t(".github/workflows/codeql.yml") ?? "", [c, l, u, d] = await Promise.all([
840
+ R(`repos/${e}/${n}`),
841
+ R(`repos/${e}/${n}/private-vulnerability-reporting`),
842
+ R(`repos/${e}/${n}/vulnerability-alerts`),
843
+ R(`repos/${e}/${n}/commits/main/check-runs?per_page=100`)
849
844
  ]), 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;
850
845
  return {
851
- codeQLLanguages: s.matchAll(/- language: ([\w-]+)/g).filter(([, e]) => e !== "rust" || o !== null).map(([, e = ""]) => $t[e] ?? e).toArray(),
846
+ codeQLLanguages: s.matchAll(/- language: ([\w-]+)/g).filter(([, e]) => e !== "rust" || o !== null).map(([, e = ""]) => en[e] ?? e).toArray(),
852
847
  codeQLQueries: /queries: ([\w-]+)/.exec(s)?.[1],
853
848
  dependabotAlerts: u !== void 0,
854
849
  dependabotSecurityUpdates: p("dependabot_security_updates"),
@@ -867,29 +862,29 @@ async function ln(t, n, r) {
867
862
  }
868
863
  async function R(e) {
869
864
  try {
870
- let { stdout: t } = await nn("gh", ["api", e]);
865
+ let { stdout: t } = await rn("gh", ["api", e]);
871
866
  return t;
872
867
  } catch (e) {
873
868
  if (String(e.stderr).includes("HTTP 404")) return;
874
869
  throw e;
875
870
  }
876
871
  }
877
- async function un(e) {
872
+ async function dn(e) {
878
873
  let t = await fetch(`https://www.bestpractices.dev/projects.json?url=${encodeURIComponent(e)}`);
879
874
  if (!t.ok) throw Error(`OpenSSF Best Practices lookup failed with status ${String(t.status)}.`);
880
875
  return (await t.json()).find((t) => t.repo_url === e)?.id;
881
876
  }
882
- async function dn(e) {
877
+ async function fn(e) {
883
878
  let t = await fetch(`https://api.scorecard.dev/projects/${e}`);
884
879
  if (t.status !== 404) {
885
880
  if (!t.ok) throw Error(`OpenSSF Scorecard lookup failed with status ${String(t.status)}.`);
886
881
  return await t.json();
887
882
  }
888
883
  }
889
- function fn(e) {
890
- return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || qt.has(e) || Kt[e] !== void 0 && t >= Kt[e]);
891
- }
892
884
  function pn(e) {
885
+ return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || Jt.has(e) || qt[e] !== void 0 && t >= qt[e]);
886
+ }
887
+ function mn(e) {
893
888
  return e === !1 ? " These are handled manually." : "";
894
889
  }
895
890
  function z(e) {
@@ -904,10 +899,10 @@ ${t.map((e) => `|${e.join("|")}|`).join("\n")}
904
899
 
905
900
  `;
906
901
  }
907
- function mn(e, t, n, r) {
902
+ function hn(e, t, n, r) {
908
903
  return `![${n}](https://img.shields.io/endpoint?url=${encodeURIComponent(`https://raw.githubusercontent.com/${e}/${t}/main/${r}`)})`;
909
904
  }
910
- function hn(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i }) {
905
+ function gn(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i }) {
911
906
  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 = [[
912
907
  "Unit tests",
913
908
  z(i.testsInCI),
@@ -920,7 +915,7 @@ function hn(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i })
920
915
  n !== void 0 && s.push([
921
916
  "Test coverage",
922
917
  z(!0),
923
- `${mn(e, t, "Coverage", Qt)} [Vitest's V8 coverage](https://vitest.dev/guide/coverage) measures the share of source lines the unit tests run. The target is ${String(Xt)}%.`
918
+ `${hn(e, t, "Coverage", $t)} [Vitest's V8 coverage](https://vitest.dev/guide/coverage) measures the share of source lines the unit tests run. The target is ${String(Zt)}%.`
924
919
  ]);
925
920
  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 = [[
926
921
  "Code analysis",
@@ -934,7 +929,7 @@ function hn(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i })
934
929
  r !== void 0 && l.unshift([
935
930
  "Code health",
936
931
  z(!0),
937
- `[${mn(e, t, "Fallow code health", h)}](./${ne}) [Fallow](https://github.com/fallow-rs/fallow) finds unused code, duplication, complexity and dependency problems.`
932
+ `[${hn(e, t, "Fallow code health", _)}](./${ne}) [Fallow](https://github.com/fallow-rs/fallow) finds unused code, duplication, complexity and dependency problems.`
938
933
  ]);
939
934
  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 = [
940
935
  [
@@ -952,7 +947,7 @@ function hn(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i })
952
947
  z(i.secretScanning),
953
948
  "[GitHub secret scanning](https://docs.github.com/en/code-security/secret-scanning) detects credentials, such as API keys and tokens, committed to the repository."
954
949
  ]
955
- ], g = "[Dependabot](https://docs.github.com/en/code-security/dependabot)", _ = [
950
+ ], h = "[Dependabot](https://docs.github.com/en/code-security/dependabot)", g = [
956
951
  [
957
952
  "Vulnerability audit",
958
953
  z(i.npmAuditInCI),
@@ -966,28 +961,28 @@ function hn(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i })
966
961
  [
967
962
  "Security alerts",
968
963
  z(i.dependabotAlerts),
969
- `${g} alerts when a dependency has a known vulnerability, using the GitHub Advisory Database.`
964
+ `${h} alerts when a dependency has a known vulnerability, using the GitHub Advisory Database.`
970
965
  ],
971
966
  [
972
967
  "Security updates",
973
968
  z(i.dependabotSecurityUpdates),
974
- `${g} opens pull requests that update vulnerable dependencies.${pn(i.dependabotSecurityUpdates)}`
969
+ `${h} opens pull requests that update vulnerable dependencies.${mn(i.dependabotSecurityUpdates)}`
975
970
  ],
976
971
  [
977
972
  "Version updates",
978
973
  z(i.dependabotVersionUpdates),
979
- `${g} opens pull requests for new dependency versions.${pn(i.dependabotVersionUpdates)}`
974
+ `${h} opens pull requests for new dependency versions.${mn(i.dependabotVersionUpdates)}`
980
975
  ]
981
976
  ];
982
977
  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.
983
978
 
984
- ${B("Testing", s)}${B("Code Quality", l)}${B("Security Analysis", m)}${B("Dependencies", _)}`;
979
+ ${B("Testing", s)}${B("Code Quality", l)}${B("Security Analysis", m)}${B("Dependencies", g)}`;
985
980
  }
986
- function gn(e, t, n, r, i) {
987
- let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 && fn(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.";
981
+ function _n(e, t, n, r, i) {
982
+ let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 && pn(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.";
988
983
  return `## Quality & Security
989
984
 
990
- ${hn(e, t, n)}### OpenSSF 🚧
985
+ ${gn(e, t, n)}### OpenSSF 🚧
991
986
 
992
987
  ${l}[![OpenSSF Scorecard](https://api.scorecard.dev/projects/${o}/badge)](https://scorecard.dev/viewer/?uri=${o})
993
988
 
@@ -999,26 +994,26 @@ Please do not open public GitHub issues for security vulnerabilities. ${u}`;
999
994
  }
1000
995
  //#endregion
1001
996
  //#region src/actions/documentUsage.ts
1002
- var _n = "<!-- USAGE_START -->", vn = "<!-- USAGE_END -->", yn = /* @__PURE__ */ new Set([
997
+ var vn = "<!-- USAGE_START -->", yn = "<!-- USAGE_END -->", bn = /* @__PURE__ */ new Set([
1003
998
  "connector",
1004
999
  "cookbook",
1005
1000
  "presenter"
1006
- ]), bn = /* @__PURE__ */ new Set(["development", "eslint"]), xn = "> [!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.", Sn = "This repository manages itself using the actions it implements.", Cn = "This repository is managed using the common set of actions provided by [@dpuse/dpuse-development](https://github.com/dpuse/dpuse-development).";
1007
- async function wn() {
1001
+ ]), xn = /* @__PURE__ */ new Set(["development", "eslint"]), Sn = "> [!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.", Cn = "This repository manages itself using the actions it implements.", wn = "This repository is managed using the common set of actions provided by [@dpuse/dpuse-development](https://github.com/dpuse/dpuse-development).";
1002
+ async function Tn() {
1008
1003
  try {
1009
- s("Document Usage"), C("1️⃣ Insert usage content into 'README.md'");
1010
- let [e, t] = await Promise.all([S("package.json"), S("config.json")]), n = Tn(e), r = En(n), i = V(e.engines?.node), a = V(e.engines?.npm), o = V(e.devDependencies?.typescript), c = Dn(m(t.id), e.name), l = `${n.replace(/\.git$/, "")}/blob/main/package.json`, u = On(c, n, r, i, a, o, `${e.name === "@dpuse/dpuse-development" ? Sn : Cn} See the \`scripts\` block in [package.json](${l}) for details.`);
1011
- await _(u, _n, vn), b("Usage documented");
1004
+ l("Document Usage"), w("1️⃣ Insert usage content into 'README.md'");
1005
+ let [t, n] = await Promise.all([C("package.json"), C("config.json")]), r = En(t), i = Dn(r), a = V(t.engines?.node), o = V(t.engines?.npm), s = V(t.devDependencies?.typescript), c = On(g(n.id), t.name), u = `${r.replace(/\.git$/, "")}/blob/main/package.json`, d = kn(c, r, i, a, o, s, `${t.name === "@dpuse/dpuse-development" ? Cn : wn} See the \`scripts\` block in [package.json](${u}) for details.`);
1006
+ await e(d, vn, yn), x("Usage documented");
1012
1007
  } catch (e) {
1013
1008
  console.error("❌ Error documenting usage", e), process.exit(1);
1014
1009
  }
1015
1010
  }
1016
- function Tn(e) {
1011
+ function En(e) {
1017
1012
  let t = e.repository, n = typeof t == "string" ? t : t?.url;
1018
1013
  if (n == null || n === "") throw Error("package.json 'repository' field is required to document usage.");
1019
1014
  return n.replace(/^git\+/, "");
1020
1015
  }
1021
- function En(e) {
1016
+ function Dn(e) {
1022
1017
  return (e.split("/").at(-1) ?? "").replace(/\.git$/, "");
1023
1018
  }
1024
1019
  function V(e) {
@@ -1027,9 +1022,9 @@ function V(e) {
1027
1022
  if (t == null) throw Error(`Unable to parse version from '${e}'.`);
1028
1023
  return t[0];
1029
1024
  }
1030
- function Dn(e, t) {
1025
+ function On(e, t) {
1031
1026
  let { typeId: n } = e;
1032
- if (yn.has(n)) return `This ${n} is automatically uploaded to the DPUse Engine cloud once released and becomes instantly available to all new browser app instances, with existing instances notified of the update.
1027
+ if (bn.has(n)) return `This ${n} is automatically uploaded to the DPUse Engine cloud once released and becomes instantly available to all new browser app instances, with existing instances notified of the update.
1033
1028
 
1034
1029
  You may view or clone this repository for your own purposes, such as building a new, similar ${n}, though there is currently no process to accept third-party ${n}s into DPUse at this stage.`;
1035
1030
  if (e.publishedTo === "npm") {
@@ -1040,11 +1035,11 @@ You may view or clone this repository for your own purposes, such as building a
1040
1035
  npm install ${t}
1041
1036
  \`\`\`
1042
1037
 
1043
- ${bn.has(n) ? `${xn}\n\n` : ""}To work on the source instead, clone this repository.`;
1038
+ ${xn.has(n) ? `${Sn}\n\n` : ""}To work on the source instead, clone this repository.`;
1044
1039
  }
1045
1040
  return "You may view or clone this repository for your own purposes.";
1046
1041
  }
1047
- function On(e, t, n, r, i, a, o) {
1042
+ function kn(e, t, n, r, i, a, o) {
1048
1043
  return `## Usage
1049
1044
 
1050
1045
  ${e}
@@ -1062,61 +1057,61 @@ ${o}`;
1062
1057
  //#endregion
1063
1058
  //#region src/actions/documentApiReference.ts
1064
1059
  var H = "API_REFERENCE.md";
1065
- async function kn() {
1060
+ async function An() {
1066
1061
  try {
1067
- s("Document API Reference");
1068
- let { writeAPIReference: e } = await import("./apiReference-C2-jo0bP.js");
1069
- await e("1️⃣ ", H), b("API reference documented");
1062
+ l("Document API Reference");
1063
+ let { writeAPIReference: e } = await import("./apiReference-C9mSUGDm.js");
1064
+ await e("1️⃣ ", H), x("API reference documented");
1070
1065
  } catch (e) {
1071
1066
  console.error("❌ Error documenting API reference", e), process.exit(1);
1072
1067
  }
1073
1068
  }
1074
1069
  //#endregion
1075
1070
  //#region src/actions/documentBundleSizes.ts
1076
- var An = "bundle-analysis-reports/sonda/index.json", jn = "bundle-analysis-reports/sonda/worker.json", Mn = "<!-- BUNDLE_START -->", Nn = "<!-- BUNDLE_END -->", U = "&nbsp;&nbsp;&nbsp;&nbsp;", W = 20, Pn = "█", Fn = "▒", In = 100 / W / 2, Ln = 100 / W, Rn = 48, zn = "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._", Bn = "Bars show each row's share of its output file.", Vn = "↳ rows are part of the row above.", Hn = "+ 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)", Un = `${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", Wn = `${q}…) = the compiled Rust code, embedded as base64 text, about a third larger than the binary it decodes to, which is the size given.`, Gn = `${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.`;
1077
- async function Kn(t) {
1071
+ var jn = "bundle-analysis-reports/sonda/index.json", Mn = "bundle-analysis-reports/sonda/worker.json", Nn = "<!-- BUNDLE_START -->", Pn = "<!-- BUNDLE_END -->", U = "&nbsp;&nbsp;&nbsp;&nbsp;", W = 20, Fn = "█", In = "▒", Ln = 100 / W / 2, Rn = 100 / W, zn = 48, Bn = "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._", Vn = "Bars show each row's share of its output file.", Hn = "↳ rows are part of the row above.", Un = "+ 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)", Wn = `${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", Gn = `${q}…) = the compiled Rust code, embedded as base64 text, about a third larger than the binary it decodes to, which is the size given.`, Kn = `${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.`;
1072
+ async function qn(n) {
1078
1073
  try {
1079
- s("Document Bundle Sizes"), C("1️⃣ Read bundle analysis report");
1080
- let n = await S(An), r = await e(jn), i = r === null ? void 0 : JSON.parse(r), a = /* @__PURE__ */ new Map();
1081
- for (let t of n.resources) t.kind === "asset" && a.set(t.name, await e(t.name));
1082
- C("2️⃣ Insert table into 'README.md'");
1083
- let o = qn(n, {
1084
- assetContents: a,
1085
- isModuleLevel: t?.moduleLevel ?? !1,
1086
- workerJson: i
1074
+ l("Document Bundle Sizes"), w("1️⃣ Read bundle analysis report");
1075
+ let r = await C(jn), i = await t(Mn), a = i === null ? void 0 : JSON.parse(i), o = /* @__PURE__ */ new Map();
1076
+ for (let e of r.resources) e.kind === "asset" && o.set(e.name, await t(e.name));
1077
+ w("2️⃣ Insert table into 'README.md'");
1078
+ let s = Jn(r, {
1079
+ assetContents: o,
1080
+ isModuleLevel: n?.moduleLevel ?? !1,
1081
+ workerJson: a
1087
1082
  }), c = [
1088
- o.includes("↳") ? `${Bn} ${Vn}` : Bn,
1089
- / \+ \d+ more \|/.test(o) ? Hn : "",
1090
- o.includes(K) ? Un : "",
1091
- o.includes(q) ? Wn : "",
1092
- Gn
1083
+ s.includes("↳") ? `${Vn} ${Hn}` : Vn,
1084
+ / \+ \d+ more \|/.test(s) ? Un : "",
1085
+ s.includes(K) ? Wn : "",
1086
+ s.includes(q) ? Gn : "",
1087
+ Kn
1093
1088
  ].filter((e) => e !== "");
1094
- await _(`## Bundle Analysis\n\n${zn}\n\n${o}\n\n${c.join("\n\n")}`, Mn, Nn), b("Bundle sizes documented");
1089
+ await e(`## Bundle Analysis\n\n${Bn}\n\n${s}\n\n${c.join("\n\n")}`, Nn, Pn), x("Bundle sizes documented");
1095
1090
  } catch (e) {
1096
1091
  console.error("❌ Error documenting bundle sizes", e), process.exit(1);
1097
1092
  }
1098
1093
  }
1099
- function qn(e, t) {
1100
- let { assetContents: n, isModuleLevel: r, workerJson: i } = t, a = cr(e), o = i === void 0 ? void 0 : cr(i).values().next().value;
1094
+ function Jn(e, t) {
1095
+ let { assetContents: n, isModuleLevel: r, workerJson: i } = t, a = lr(e), o = i === void 0 ? void 0 : lr(i).values().next().value;
1101
1096
  for (let [e, t] of a) {
1102
1097
  let r = n.get(e);
1103
- r != null && Jn(t, r, o);
1098
+ r != null && Yn(t, r, o);
1104
1099
  }
1105
- 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, pr(e)]).toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), l = ["|Chunk/Module/File|Composition|", "|:------ |:-----------|"];
1100
+ 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, mr(e)]).toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), l = ["|Chunk/Module/File|Composition|", "|:------ |:-----------|"];
1106
1101
  for (let [e, t] of c) {
1107
- let n = [...a.get(e) ?? /* @__PURE__ */ new Map()].toSorted(nr), i = n.reduce((e, [, t]) => e + t.sizes.uncompressed, 0), o = i > 0 && s > 0 ? ` · ${vr(i, s)} of the build` : "";
1108
- l.push(Z(`**${X(e)}**`, `${mr(t)}${o}`), ...rr(n, i, r));
1102
+ let n = [...a.get(e) ?? /* @__PURE__ */ new Map()].toSorted(rr), i = n.reduce((e, [, t]) => e + t.sizes.uncompressed, 0), o = i > 0 && s > 0 ? ` · ${vr(i, s)} of the build` : "";
1103
+ l.push(Z(`**${X(e)}**`, `${hr(t)}${o}`), ...ir(n, i, r));
1109
1104
  }
1110
1105
  return l.join("\n");
1111
1106
  }
1112
- function Jn(e, t, n) {
1113
- let r = Yn(t), i = Xn(r ?? ""), a = Xn(t);
1114
- Qn(e, {
1107
+ function Yn(e, t, n) {
1108
+ let r = Xn(t), i = Zn(r ?? ""), a = Zn(t);
1109
+ $n(e, {
1115
1110
  bytes: a.bytes - i.bytes,
1116
1111
  binaryBytes: a.binaryBytes - i.binaryBytes
1117
- }), r !== void 0 && $n(e, Buffer.byteLength(r), i, n);
1112
+ }), r !== void 0 && er(e, Buffer.byteLength(r), i, n);
1118
1113
  }
1119
- function Yn(e) {
1114
+ function Xn(e) {
1120
1115
  if (!e.includes("new Worker(")) return;
1121
1116
  let t = /encodeURIComponent\((\w+)\)/.exec(e)?.[1];
1122
1117
  if (t === void 0) return;
@@ -1126,21 +1121,21 @@ function Yn(e) {
1126
1121
  for (; a < e.length && e[a] !== r;) a += e[a] === "\\" ? 2 : 1;
1127
1122
  return e.slice(i, a);
1128
1123
  }
1129
- function Xn(e) {
1124
+ function Zn(e) {
1130
1125
  let t = {
1131
1126
  bytes: 0,
1132
1127
  binaryBytes: 0
1133
1128
  };
1134
1129
  for (let n of e.matchAll(/data:application\/wasm;base64,([A-Za-z\d+/]*={0,2})/g)) {
1135
1130
  let e = n[1] ?? "";
1136
- t.bytes += n[0].length, t.binaryBytes += Math.floor(e.length * 3 / 4) - Zn(e);
1131
+ t.bytes += n[0].length, t.binaryBytes += Math.floor(e.length * 3 / 4) - Qn(e);
1137
1132
  }
1138
1133
  return t;
1139
1134
  }
1140
- function Zn(e) {
1135
+ function Qn(e) {
1141
1136
  return e.endsWith("==") ? 2 : +!!e.endsWith("=");
1142
1137
  }
1143
- function Qn(e, t) {
1138
+ function $n(e, t) {
1144
1139
  if (t.bytes <= 0) return;
1145
1140
  let n = [e.get("wasm"), e.get(G)].flatMap((e) => e === void 0 ? [] : e.files.entries().map(([t, n]) => ({
1146
1141
  group: e,
@@ -1148,8 +1143,8 @@ function Qn(e, t) {
1148
1143
  sizes: n
1149
1144
  })).toArray()).find(({ sizes: e }) => e.uncompressed >= t.bytes);
1150
1145
  if (n === void 0) return;
1151
- tr(e, n.group, n.fileName, n.sizes, t.bytes);
1152
- let r = `${q}, ${Q(t.binaryBytes)} binary)`;
1146
+ nr(e, n.group, n.fileName, n.sizes, t.bytes);
1147
+ let r = `${q}, ${$(t.binaryBytes)} binary)`;
1153
1148
  e.set(r, {
1154
1149
  sizes: {
1155
1150
  uncompressed: t.bytes,
@@ -1161,14 +1156,14 @@ function Qn(e, t) {
1161
1156
  }]])
1162
1157
  });
1163
1158
  }
1164
- function $n(e, t, n, r) {
1159
+ function er(e, t, n, r) {
1165
1160
  let i = e.get(G), a = i?.files.get("");
1166
1161
  if (i === void 0 || a === void 0 || a.uncompressed < t) return;
1167
- tr(e, i, "", a, t);
1162
+ nr(e, i, "", a, t);
1168
1163
  let o = r === void 0 ? /* @__PURE__ */ new Map([["", {
1169
1164
  uncompressed: t,
1170
1165
  gzip: 0
1171
- }]]) : er(r, t, n);
1166
+ }]]) : tr(r, t, n);
1172
1167
  e.set(K, {
1173
1168
  sizes: {
1174
1169
  uncompressed: t,
@@ -1177,96 +1172,92 @@ function $n(e, t, n, r) {
1177
1172
  files: o
1178
1173
  });
1179
1174
  }
1180
- function er(e, t, n) {
1181
- Qn(e, n);
1175
+ function tr(e, t, n) {
1176
+ $n(e, n);
1182
1177
  let r = /* @__PURE__ */ new Map();
1183
1178
  for (let [t, n] of e) if (t === "src") for (let [e, t] of n.files) r.set(e, { ...t });
1184
1179
  else {
1185
- let e = n.files.size === 1 ? Y(t, sr(n.files)) : t;
1180
+ let e = n.files.size === 1 ? Y(t, cr(n.files)) : t;
1186
1181
  r.set(e, { ...n.sizes });
1187
1182
  }
1188
- let i = r.values().reduce((e, t) => e + t.uncompressed, 0), a = r.get(G) ?? gr();
1183
+ let i = r.values().reduce((e, t) => e + t.uncompressed, 0), a = r.get(G) ?? Q();
1189
1184
  return a.uncompressed += Math.max(0, t - i), a.uncompressed > 0 && r.set(G, a), r;
1190
1185
  }
1191
- function tr(e, t, n, r, i) {
1186
+ function nr(e, t, n, r, i) {
1192
1187
  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);
1193
1188
  }
1194
- function nr(e, t) {
1189
+ function rr(e, t) {
1195
1190
  return e[0] === G == (t[0] === G) ? t[1].sizes.uncompressed - e[1].sizes.uncompressed : e[0] === G ? 1 : -1;
1196
1191
  }
1197
- function rr(e, t, n) {
1192
+ function ir(e, t, n) {
1198
1193
  let r = [];
1199
- for (let [i, { sizes: a, files: o }] of e) {
1200
- if (o.size === 1) {
1201
- let e = sr(o);
1202
- r.push(Z(`${U}${X(Y(i, e))}`, J(a.uncompressed, t)));
1203
- continue;
1204
- }
1205
- r.push(Z(`${U}${or(i, o)}`, J(a.uncompressed, t))), n || r.push(...ir(o, t));
1206
- }
1194
+ for (let [i, { sizes: a, files: o }] of e) if (o.size === 1) {
1195
+ let e = cr(o);
1196
+ r.push(Z(`${U}${X(Y(i, e))}`, J(a.uncompressed, t)));
1197
+ } else r.push(Z(`${U}${sr(i, o)}`, J(a.uncompressed, t))), n || r.push(...ar(o, t));
1207
1198
  return r;
1208
1199
  }
1209
- function ir(e, t) {
1210
- let n = [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), r = ar(n, t), i = (r > 0 ? n.slice(0, -r) : n).map(([e, n]) => Z(`${U}${U}↳ ${X(e)}`, J(n.uncompressed, t, Fn)));
1200
+ function ar(e, t) {
1201
+ let n = [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), r = or(n, t), i = (r > 0 ? n.slice(0, -r) : n).map(([e, n]) => Z(`${U}${U}↳ ${X(e)}`, J(n.uncompressed, t, In)));
1211
1202
  if (r > 0) {
1212
1203
  let e = n.slice(-r).reduce((e, [, t]) => e + t.uncompressed, 0);
1213
- i.push(Z(`${U}${U}↳ ${String(r)} smaller files`, J(e, t, Fn)));
1204
+ i.push(Z(`${U}${U}↳ ${String(r)} smaller files`, J(e, t, In)));
1214
1205
  }
1215
1206
  return i;
1216
1207
  }
1217
- function ar(e, t) {
1208
+ function or(e, t) {
1218
1209
  if (t <= 0) return 0;
1219
1210
  let n = 0, r = 0;
1220
1211
  for (let [, i] of e.toReversed()) {
1221
- let e = i.uncompressed / t * 100 < In, a = (r + i.uncompressed) / t * 100 <= Ln;
1212
+ let e = i.uncompressed / t * 100 < Ln, a = (r + i.uncompressed) / t * 100 <= Rn;
1222
1213
  if (!e || !a) break;
1223
1214
  n++, r += i.uncompressed;
1224
1215
  }
1225
1216
  return n >= 2 ? n : 0;
1226
1217
  }
1227
- function J(e, t, n = Pn) {
1228
- return `${hr(t > 0 ? e / t * 100 : 0, n)} · ${Q(e)}`;
1218
+ function J(e, t, n = Fn) {
1219
+ return `${gr(t > 0 ? e / t * 100 : 0, n)} · ${$(e)}`;
1229
1220
  }
1230
1221
  function Y(e, t) {
1231
1222
  return t === "" ? e : `${e} → ${t}`;
1232
1223
  }
1233
- function or(e, t) {
1224
+ function sr(e, t) {
1234
1225
  if (e === K) return e;
1235
1226
  let [n] = [...t].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed)[0] ?? [""];
1236
1227
  return `${X(Y(e, n))} + ${String(t.size - 1)} more`;
1237
1228
  }
1238
1229
  function X(e) {
1239
- let t = e.indexOf(" → "), n = t === -1 ? "" : e.slice(0, t + 3), r = e.slice(n.length), i = Math.max(Rn - n.length, 2);
1230
+ let t = e.indexOf(" → "), n = t === -1 ? "" : e.slice(0, t + 3), r = e.slice(n.length), i = Math.max(zn - n.length, 2);
1240
1231
  return r.length > i ? `${n}<abbr title="${r.replaceAll("&", "&amp;").replaceAll("\"", "&quot;")}">…${r.slice(r.length - (i - 1))}</abbr>` : e;
1241
1232
  }
1242
1233
  function Z(e, t) {
1243
1234
  return `| ${e} | ${t.replaceAll(" ", "&nbsp;")} |`;
1244
1235
  }
1245
- function sr(e) {
1236
+ function cr(e) {
1246
1237
  let [t] = e.keys();
1247
1238
  if (t === void 0) throw Error("Expected exactly one file");
1248
1239
  return t;
1249
1240
  }
1250
- function cr(e) {
1251
- let t = lr(e.dependencies), n = /* @__PURE__ */ new Map();
1241
+ function lr(e) {
1242
+ let t = ur(e.dependencies), n = /* @__PURE__ */ new Map();
1252
1243
  for (let r of e.resources) {
1253
1244
  if (r.kind !== "chunk" || !r.parent) continue;
1254
- let { group: e, file: i } = ur(r.name, t), a = pr(r), o = n.get(r.parent) ?? /* @__PURE__ */ new Map();
1245
+ let { group: e, file: i } = dr(r.name, t), a = mr(r), o = n.get(r.parent) ?? /* @__PURE__ */ new Map();
1255
1246
  n.set(r.parent, o);
1256
1247
  let s = o.get(e) ?? {
1257
- sizes: gr(),
1248
+ sizes: Q(),
1258
1249
  files: /* @__PURE__ */ new Map()
1259
1250
  };
1260
1251
  o.set(e, s), _r(s.sizes, a);
1261
- let c = s.files.get(i) ?? gr();
1252
+ let c = s.files.get(i) ?? Q();
1262
1253
  s.files.set(i, c), _r(c, a);
1263
1254
  }
1264
1255
  return n;
1265
1256
  }
1266
- function lr(e) {
1257
+ function ur(e) {
1267
1258
  return e.flatMap((e) => e.paths.map((t) => [t, e.name])).toSorted((e, t) => t[0].length - e[0].length);
1268
1259
  }
1269
- function ur(e, t) {
1260
+ function dr(e, t) {
1270
1261
  let n = t.find(([t]) => e === t || e.startsWith(`${t}/`));
1271
1262
  if (n) {
1272
1263
  let [t, r] = n;
@@ -1283,33 +1274,33 @@ function ur(e, t) {
1283
1274
  file: e.slice(1)
1284
1275
  } : e.startsWith("rust/") ? {
1285
1276
  group: "wasm",
1286
- file: dr(e)
1277
+ file: fr(e)
1287
1278
  } : {
1288
1279
  group: "src",
1289
- file: fr(e)
1280
+ file: pr(e)
1290
1281
  };
1291
1282
  }
1292
- function dr(e) {
1293
- let t = e.split("/", 2)[1] ?? "", n = fr(e);
1283
+ function fr(e) {
1284
+ let t = e.split("/", 2)[1] ?? "", n = pr(e);
1294
1285
  return t !== "" && n.startsWith(t) ? `…${n.slice(t.length)}` : n;
1295
1286
  }
1296
- function fr(e) {
1287
+ function pr(e) {
1297
1288
  return e.split("/").at(-1) ?? e;
1298
1289
  }
1299
- function pr(e) {
1290
+ function mr(e) {
1300
1291
  return {
1301
1292
  uncompressed: e.uncompressed,
1302
1293
  gzip: e.gzip ?? 0
1303
1294
  };
1304
1295
  }
1305
- function mr(e) {
1306
- return `${Q(e.uncompressed)} · gzip ${Q(e.gzip)}`;
1296
+ function hr(e) {
1297
+ return `${$(e.uncompressed)} · gzip ${$(e.gzip)}`;
1307
1298
  }
1308
- function hr(e, t = Pn) {
1299
+ function gr(e, t = Fn) {
1309
1300
  let n = Math.round(e / 100 * W);
1310
1301
  return `\`${t.repeat(n)}${"░".repeat(W - n)}\` ${e.toFixed(1)}%`;
1311
1302
  }
1312
- function gr() {
1303
+ function Q() {
1313
1304
  return {
1314
1305
  uncompressed: 0,
1315
1306
  gzip: 0
@@ -1321,20 +1312,20 @@ function _r(e, t) {
1321
1312
  function vr(e, t) {
1322
1313
  return `${(e / t * 100).toFixed(1)}%`;
1323
1314
  }
1324
- function Q(e) {
1315
+ function $(e) {
1325
1316
  return e < 1024 ? `${String(e)} B` : `${(e / 1024).toFixed(1)} kB`;
1326
1317
  }
1327
1318
  //#endregion
1328
1319
  //#region src/actions/documentProject.ts
1329
- async function yr(t = "MIT", n = !1) {
1320
+ async function yr(e = "MIT", n = !1) {
1330
1321
  try {
1331
- let r = await S("config.json"), i = m(r.id).typeId === "connector";
1332
- await Bt(), i && await Ge(), await wn(), await ft(t), await e("bundle-analysis-reports/sonda/index.json") === null ? C(`ℹ️ Bundle sizes NOT documented, as there is no '${An}' yet. Build the project first.`) : await Kn({ moduleLevel: n }), await rn(), await Ke();
1333
- let a = await e(H) !== null;
1334
- a ? await kn() : C(`ℹ️ '${H}' NOT required by this project`), await o("ℹ️ Format generated files", "prettier", [
1322
+ let i = await C("config.json"), a = g(i.id).typeId === "connector";
1323
+ await Vt(), a && await Ge(), await Tn(), await pt(e), await t("bundle-analysis-reports/sonda/index.json") === null ? w(`ℹ️ Bundle sizes NOT documented, as there is no '${jn}' yet. Build the project first.`) : await qn({ moduleLevel: n }), await an(), await Ke();
1324
+ let o = await t(H) !== null;
1325
+ o ? await An() : w(`ℹ️ '${H}' NOT required by this project`), await r("ℹ️ Format generated files", "prettier", [
1335
1326
  "--write",
1336
1327
  "README.md",
1337
- ...a ? [H] : []
1328
+ ...o ? [H] : []
1338
1329
  ]);
1339
1330
  } catch (e) {
1340
1331
  console.error("❌ Error documenting project", e), process.exit(1);
@@ -1344,7 +1335,7 @@ async function yr(t = "MIT", n = !1) {
1344
1335
  //#region src/actions/formatCode.ts
1345
1336
  async function br() {
1346
1337
  try {
1347
- s("Format Code");
1338
+ l("Format Code");
1348
1339
  let e = [
1349
1340
  "--write",
1350
1341
  "*.json",
@@ -1356,7 +1347,7 @@ async function br() {
1356
1347
  "tests"
1357
1348
  ].filter((e) => ce(e)).map((e) => `${e}/**`)
1358
1349
  ];
1359
- await o("1️⃣ Format", "prettier", e), b("Code formatted");
1350
+ await r("1️⃣ Format", "prettier", e), x("Code formatted");
1360
1351
  } catch (e) {
1361
1352
  console.error("❌ Error formatting code", e), process.exit(1);
1362
1353
  }
@@ -1365,38 +1356,28 @@ async function br() {
1365
1356
  //#region src/actions/lintCode.ts
1366
1357
  async function xr() {
1367
1358
  try {
1368
- s("Lint Code"), await o("1️⃣ Lint", "eslint", ["."]), b("Code linted");
1359
+ l("Lint Code"), await r("1️⃣ Lint", "eslint", ["."]), x("Code linted");
1369
1360
  } catch (e) {
1370
1361
  console.error("❌ Error linting code", e), process.exit(1);
1371
1362
  }
1372
1363
  }
1373
1364
  //#endregion
1374
1365
  //#region src/utilities/cloudflare.ts
1375
- var Sr = "dpuse-sample-data-eu", Cr = {
1376
- bin: "application/octet-stream",
1377
- csv: "text/csv",
1378
- json: "application/json",
1379
- md: "text/markdown",
1380
- spss: "application/octet-stream",
1381
- txt: "text/plain",
1382
- xls: "application/vnd.ms-excel",
1383
- xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
1384
- xml: "application/xml"
1385
- };
1386
- async function wr() {
1387
- let e = await S("config.json"), t = {
1366
+ var Sr = "dpuse-sample-data-eu";
1367
+ async function Cr() {
1368
+ let e = await C("config.json"), t = {
1388
1369
  body: JSON.stringify(e),
1389
1370
  headers: { "Content-Type": "application/json" },
1390
1371
  method: "PUT"
1391
1372
  }, n = await fetch(`https://api.dpuse.app/configs/${e.id}`, t);
1392
1373
  if (!n.ok) throw Error(await n.text());
1393
1374
  }
1394
- async function $(e, t) {
1395
- let n = await kr(`${e}/${t}`, t), r = Map.groupBy(n, ({ key: e }) => Ar(e));
1375
+ async function wr(e, t) {
1376
+ let n = await kr(`${e}/${t}`, t), r = Map.groupBy(n, ({ key: e }) => c(e));
1396
1377
  for (let [e, t] of r) await Or(t, ["--content-type", e]);
1397
1378
  }
1398
1379
  async function Tr(e) {
1399
- await $(e, "application"), await $(e, "fileStore"), await Or(["applicationIndex.json", "fileStoreIndex.json"].map((t) => ({
1380
+ await wr(e, "application"), await wr(e, "fileStore"), await Or(["applicationIndex.json", "fileStoreIndex.json"].map((t) => ({
1400
1381
  file: `${e}/${t}`,
1401
1382
  key: t
1402
1383
  })), [
@@ -1421,7 +1402,7 @@ async function Dr(e, t) {
1421
1402
  for (let a of i) {
1422
1403
  if (a.isDirectory() || a.name.endsWith(".map")) continue;
1423
1404
  let i = `${e}/${a.name}`, o = r ? `${r}/${a.name}` : a.name, s = `${t}_${n}/${o}`.replaceAll("\\", "/"), c = a.name.endsWith(".css") ? "text/css" : "application/octet-stream", l = a.name.endsWith(".js") ? "application/javascript" : c;
1424
- console.info(`⚙️ Uploading '${o}' → '${s}'...`), await y(void 0, "wrangler", [
1405
+ console.info(`⚙️ Uploading '${o}' → '${s}'...`), await b(void 0, "wrangler", [
1425
1406
  "r2",
1426
1407
  "object",
1427
1408
  "put",
@@ -1438,9 +1419,9 @@ async function Dr(e, t) {
1438
1419
  }
1439
1420
  async function Or(e, t) {
1440
1421
  if (e.length === 0) return;
1441
- let n = await w.mkdtemp(T.join(ge.tmpdir(), "dpuse-r2-bulk-")), r = T.join(n, "files.json");
1422
+ let n = await T.mkdtemp(E.join(ge.tmpdir(), "dpuse-r2-bulk-")), r = E.join(n, "files.json");
1442
1423
  try {
1443
- await i(r, e), console.info(`⚙️ Uploading ${String(e.length)} files (${t.join(" ")})...`), await y(void 0, "wrangler", [
1424
+ await v(r, e), console.info(`⚙️ Uploading ${String(e.length)} files (${t.join(" ")})...`), await b(void 0, "wrangler", [
1444
1425
  "r2",
1445
1426
  "bulk",
1446
1427
  "put",
@@ -1452,7 +1433,7 @@ async function Or(e, t) {
1452
1433
  "--remote"
1453
1434
  ]);
1454
1435
  } finally {
1455
- await w.rm(n, {
1436
+ await T.rm(n, {
1456
1437
  force: !0,
1457
1438
  recursive: !0
1458
1439
  });
@@ -1463,66 +1444,59 @@ async function kr(e, t) {
1463
1444
  for (let i of n) {
1464
1445
  if (i.startsWith(".")) continue;
1465
1446
  let n = `${e}/${i}`, a = `${t}/${i}`;
1466
- (await p(n)).isDirectory() ? r.push(...await kr(n, a)) : r.push({
1447
+ (await h(n)).isDirectory() ? r.push(...await kr(n, a)) : r.push({
1467
1448
  file: n,
1468
1449
  key: a
1469
1450
  });
1470
1451
  }
1471
1452
  return r;
1472
1453
  }
1473
- function Ar(e) {
1474
- let t = e.slice(e.lastIndexOf("/") + 1), n = t.lastIndexOf(".");
1475
- if (n === -1) return t === "LICENSE" ? "text/plain" : "application/octet-stream";
1476
- let r = Cr[t.slice(n + 1).toLowerCase()];
1477
- if (r === void 0) throw Error(`No content type for '${e}'. Add its extension to 'SAMPLE_DATA_CONTENT_TYPES'.`);
1478
- return r;
1479
- }
1480
1454
  //#endregion
1481
1455
  //#region src/actions/publishProject.ts
1482
- async function jr() {
1456
+ async function Ar() {
1483
1457
  try {
1484
- s("Publish Project");
1485
- let e = await S("package.json"), t = await S("config.json"), n = m(t.id);
1486
- n.publishedTo === "npm" ? await o("1️⃣ Publish to npm", "npm", ["publish", "--provenance"]) : C("1️⃣ Publishing to npm NOT required");
1487
- let r = [
1458
+ l("Publish Project");
1459
+ let e = await C("package.json"), t = await C("config.json"), n = g(t.id);
1460
+ n.publishedTo === "npm" ? await r("1️⃣ Publish to npm", "npm", ["publish", "--provenance"]) : w("1️⃣ Publishing to npm NOT required");
1461
+ let i = [
1488
1462
  "api",
1489
1463
  "app",
1490
1464
  "kb"
1491
1465
  ].includes(n.publishedTo);
1492
- r && await o("2️⃣ Deploy", "npm", ["run", "deploy"]), await Mr(r ? "3️⃣ " : "2️⃣ ", e, t, n), n.publishedTo === "sampleData" && (C("3️⃣ Upload sample data"), await Tr("public")), b(`Project version '${e.version ?? "unknown"}' published.`);
1466
+ i && await r("2️⃣ Deploy", "npm", ["run", "deploy"]), await jr(i ? "3️⃣ " : "2️⃣ ", e, t, n), n.publishedTo === "sampleData" && (w("3️⃣ Upload sample data"), await Tr("public")), x(`Project version '${e.version ?? "unknown"}' published.`);
1493
1467
  } catch (e) {
1494
1468
  console.error("❌ Error publishing project", e), process.exit(1);
1495
1469
  }
1496
1470
  }
1497
- async function Mr(e, t, n, r) {
1498
- if (r.typeId === "app") C(`${e} Register module`), await wr();
1499
- else if (r.typeId === "engine") C(`${e} Register module`), await Dr(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await Er(n);
1500
- else if (r.uploadGroupName === void 0) C(`${e} Registration NOT required`);
1471
+ async function jr(e, t, n, r) {
1472
+ if (r.typeId === "app") w(`${e} Register module`), await Cr();
1473
+ else if (r.typeId === "engine") w(`${e} Register module`), await Dr(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await Er(n);
1474
+ else if (r.uploadGroupName === void 0) w(`${e} Registration NOT required`);
1501
1475
  else {
1502
- C(`${e} Register module`);
1476
+ w(`${e} Register module`);
1503
1477
  let i = n.id.split("-").slice(2).join("-");
1504
1478
  await Dr(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await Er(n);
1505
1479
  }
1506
1480
  }
1507
1481
  //#endregion
1508
1482
  //#region src/actions/releaseProject.ts
1509
- async function Nr(e = "MIT", t = !1) {
1483
+ async function Mr(e = "MIT", t = !1) {
1510
1484
  try {
1511
- s("Release Project");
1512
- let n = await S("package.json"), r = await S("config.json"), i = m(r.id);
1513
- await d("1️⃣ ", n);
1514
- let a = await oe("2️⃣ ", n, i);
1515
- if (await Ee("3️⃣ ", n), C("4️⃣ Regenerate README"), await yr(e, t), await y("5️⃣ Stage changes", "git", ["add", "."]), await y("6️⃣ Commit changes", "git", [
1485
+ l("Release Project");
1486
+ let n = await C("package.json"), i = await C("config.json"), a = g(i.id);
1487
+ await p("1️⃣ ", n);
1488
+ let o = await oe("2️⃣ ", n, a);
1489
+ if (await Ee("3️⃣ ", n), w("4️⃣ Regenerate README"), await yr(e, t), await b("5️⃣ Stage changes", "git", ["add", "."]), await b("6️⃣ Commit changes", "git", [
1516
1490
  "commit",
1517
1491
  "-m",
1518
1492
  `v${n.version ?? "unknown"}`
1519
- ]), await y("7️⃣ Push changes", "git", [
1493
+ ]), await b("7️⃣ Push changes", "git", [
1520
1494
  "push",
1521
1495
  "origin",
1522
1496
  "main:main"
1523
- ]), await Mr("8️⃣ ", n, a, i), i.publishedTo === "npm") {
1497
+ ]), await jr("8️⃣ ", n, o, a), a.publishedTo === "npm") {
1524
1498
  let e = `v${n.version ?? "unknown"}`;
1525
- await o("9️⃣ Trigger GitHub release", "gh", [
1499
+ await r("9️⃣ Trigger GitHub release", "gh", [
1526
1500
  "release",
1527
1501
  "create",
1528
1502
  e,
@@ -1531,39 +1505,39 @@ async function Nr(e = "MIT", t = !1) {
1531
1505
  "--generate-notes",
1532
1506
  "--latest"
1533
1507
  ]);
1534
- } else C(`9️⃣ Publishing NOT required for package with type identifier of '${i.typeId}'.`);
1535
- b(`Project version '${n.version ?? "unknown"}' released.`);
1508
+ } else w(`9️⃣ Publishing NOT required for package with type identifier of '${a.typeId}'.`);
1509
+ x(`Project version '${n.version ?? "unknown"}' released.`);
1536
1510
  } catch (e) {
1537
1511
  console.error("❌ Error releasing project", e), process.exit(1);
1538
1512
  }
1539
1513
  }
1540
1514
  //#endregion
1541
1515
  //#region src/actions/syncProjectWithGitHub.ts
1542
- async function Pr() {
1516
+ async function Nr() {
1543
1517
  try {
1544
- s("Synchronise Project with GitHub");
1545
- let e = await S("package.json"), t = await S("config.json"), n = m(t.id);
1546
- await d("1️⃣ ", e), await oe("2️⃣ ", e, n), await y("3️⃣ Stage changes", "git", ["add", "."]), await y("4️⃣ Commit changes", "git", [
1518
+ l("Synchronise Project with GitHub");
1519
+ let e = await C("package.json"), t = await C("config.json"), n = g(t.id);
1520
+ await p("1️⃣ ", e), await oe("2️⃣ ", e, n), await b("3️⃣ Stage changes", "git", ["add", "."]), await b("4️⃣ Commit changes", "git", [
1547
1521
  "commit",
1548
1522
  "-m",
1549
1523
  `v${e.version ?? "unknown"}`
1550
- ]), await y("5️⃣ Push changes", "git", [
1524
+ ]), await b("5️⃣ Push changes", "git", [
1551
1525
  "push",
1552
1526
  "origin",
1553
1527
  "main:main"
1554
- ]), b(`Project version '${e.version ?? "unknown"}' synchronised with GitHub.`);
1528
+ ]), x(`Project version '${e.version ?? "unknown"}' synchronised with GitHub.`);
1555
1529
  } catch (e) {
1556
1530
  console.error("❌ Error synchronising project with GitHub", e), process.exit(1);
1557
1531
  }
1558
1532
  }
1559
1533
  //#endregion
1560
1534
  //#region src/actions/testProject.ts
1561
- var Fr = [
1535
+ var Pr = [
1562
1536
  "1️⃣ ",
1563
1537
  "2️⃣ ",
1564
1538
  "3️⃣ ",
1565
1539
  "4️⃣ "
1566
- ], Ir = [{
1540
+ ], Fr = [{
1567
1541
  id: "unit",
1568
1542
  label: "Run unit tests",
1569
1543
  command: "vitest",
@@ -1576,31 +1550,31 @@ var Fr = [
1576
1550
  arguments: ["test", "--pass-with-no-tests"],
1577
1551
  configFileName: "playwright.config.ts"
1578
1552
  }];
1579
- async function Lr(t = ["unit"]) {
1553
+ async function Ir(e = ["unit"]) {
1580
1554
  try {
1581
- s("Test Project");
1555
+ l("Test Project");
1582
1556
  let n = 0;
1583
- for (let r of Ir) {
1584
- if (!t.includes(r.id) || await e(r.configFileName) === null) continue;
1585
- let i = `${Fr[n] ?? ""} ${r.label}`;
1586
- await o(i, r.command, r.arguments), n += 1;
1557
+ for (let i of Fr) {
1558
+ if (!e.includes(i.id) || await t(i.configFileName) === null) continue;
1559
+ let a = `${Pr[n] ?? ""} ${i.label}`;
1560
+ await r(a, i.command, i.arguments), n += 1;
1587
1561
  }
1588
1562
  if (n === 0) {
1589
1563
  console.warn("\n⚠️ No tests configured for this project.\n");
1590
1564
  return;
1591
1565
  }
1592
- b("Project tested");
1566
+ x("Project tested");
1593
1567
  } catch (e) {
1594
1568
  console.error("❌ Error testing project", e), process.exit(1);
1595
1569
  }
1596
1570
  }
1597
1571
  //#endregion
1598
1572
  //#region src/actions/triggerGitHubRelease.ts
1599
- async function Rr() {
1573
+ async function Lr() {
1600
1574
  try {
1601
- s("Trigger GitHub Release");
1602
- let e = `v${(await S("package.json")).version ?? "unknown"}`;
1603
- await o("1️⃣ Trigger GitHub release", "gh", [
1575
+ l("Trigger GitHub Release");
1576
+ let e = `v${(await C("package.json")).version ?? "unknown"}`;
1577
+ await r("1️⃣ Trigger GitHub release", "gh", [
1604
1578
  "release",
1605
1579
  "create",
1606
1580
  e,
@@ -1608,10 +1582,10 @@ async function Rr() {
1608
1582
  "main",
1609
1583
  "--generate-notes",
1610
1584
  "--latest"
1611
- ]), b(`GitHub release '${e}' created.`);
1585
+ ]), x(`GitHub release '${e}' created.`);
1612
1586
  } catch (e) {
1613
1587
  console.error("❌ Error triggering GitHub release", e), process.exit(1);
1614
1588
  }
1615
1589
  }
1616
1590
  //#endregion
1617
- export { ye as auditDependencies, Te as buildProject, ze as checkProject, yr as documentProject, br as formatCode, xr as lintCode, jr as publishProject, Nr as releaseProject, Pr as syncProjectWithGitHub, Lr as testProject, Rr as triggerGitHubRelease, $ as uploadDirectoryToR2 };
1591
+ export { ye as auditDependencies, Te as buildProject, ze as checkProject, yr as documentProject, br as formatCode, xr as lintCode, Ar as publishProject, Mr as releaseProject, c as resolveSampleDataContentType, Nr as syncProjectWithGitHub, Ir as testProject, Lr as triggerGitHubRelease, wr as uploadDirectoryToR2 };