@dpuse/dpuse-development 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,16 @@
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 y, n as ee, o as te, p as b, r as x, s as ne, t as re, u as S, v as C, w, x as T, y as E } from "./utilities-BLjGg0iM.js";
2
- import { SHIPPED_PACKAGES_FILE_NAME as ie } from "./vite.es.js";
3
- import { existsSync as ae, promises as D } from "node:fs";
4
- import O from "node:path";
5
- import { promisify as oe } from "node:util";
6
- import { execFile as se } from "node:child_process";
7
- import { fileURLToPath as ce } from "node:url";
8
- import { run as le } from "npm-check-updates";
9
- import { init as ue } from "license-checker-rseidelsohn";
10
- import { setTimeout as de } from "node:timers/promises";
11
- import fe from "spdx-satisfies";
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 y, n as ee, o as te, p as b, r as ne, s as re, t as ie, u as ae, v as x, w as S, x as C, y as w } from "./utilities-BLjGg0iM.js";
2
+ import { SHIPPED_PACKAGES_FILE_NAME as oe } from "./vite.es.js";
3
+ import { existsSync as se, promises as T } from "node:fs";
4
+ import E from "node:path";
5
+ import { promisify as ce } from "node:util";
6
+ import { execFile as le } from "node:child_process";
7
+ import { fileURLToPath as ue } from "node:url";
8
+ import { run as de } from "npm-check-updates";
9
+ import { init as fe } from "license-checker-rseidelsohn";
10
+ import { setTimeout as pe } from "node:timers/promises";
11
+ import me from "spdx-satisfies";
12
12
  //#region src/actions/auditDependencies_.json
13
- var pe = [
13
+ var he = [
14
14
  {
15
15
  id: "GHSA-ch52-4w7c-c8xp",
16
16
  reason: "'http-cache-semantics', used by the licence checker, which only reads the npm registry locally, with no shared cache to leak from",
@@ -26,75 +26,75 @@ var pe = [
26
26
  reason: "'braces', used by ESLint's file matching in dpuse-app, which only reads glob patterns from the project's own config",
27
27
  reviewBy: "2026-12-31"
28
28
  }
29
- ], me = /* @__PURE__ */ new Set(["critical", "high"]);
30
- async function he() {
29
+ ], ge = /* @__PURE__ */ new Set(["critical", "high"]);
30
+ async function _e() {
31
31
  try {
32
32
  s("Audit Dependencies");
33
- let e = await T("package.json");
34
- x.has(e.name ?? "") ? E(`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"]);
33
+ let e = await C("package.json");
34
+ ne.has(e.name ?? "") ? w(`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"]);
35
35
  let t = await n("2️⃣ Check all dependencies for high or critical vulnerabilities", "npm", ["audit", "--json"]), r = JSON.parse(t);
36
36
  if (r.error !== void 0) throw Error(r.error.summary);
37
- let i = ge(_e(r));
37
+ let i = ve(ye(r));
38
38
  if (i.length > 0) throw Error(`${String(i.length)} high or critical vulnerabilities found`);
39
- C("Dependencies audited");
39
+ x("Dependencies audited");
40
40
  } catch (e) {
41
41
  console.error("❌ Error auditing dependencies", e), process.exit(1);
42
42
  }
43
43
  }
44
- function ge(e) {
44
+ function ve(e) {
45
45
  let t = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), n = [];
46
46
  for (let r of e) {
47
- if (!me.has(r.severity)) continue;
48
- let e = r.url.slice(r.url.lastIndexOf("/") + 1), i = pe.find((t) => t.id === e);
47
+ if (!ge.has(r.severity)) continue;
48
+ let e = r.url.slice(r.url.lastIndexOf("/") + 1), i = he.find((t) => t.id === e);
49
49
  i === void 0 ? (console.error(`❌ ${r.severity} '${r.name}': ${r.title} (${r.url})`), n.push(r)) : i.reviewBy < t ? console.warn(`⚠️ Ignored ${e}, but its review date ${i.reviewBy} has passed: ${i.reason}`) : console.info(`ℹ️ Ignored ${e}: ${i.reason}`);
50
50
  }
51
51
  return n;
52
52
  }
53
- function _e(e) {
53
+ function ye(e) {
54
54
  let t = /* @__PURE__ */ new Map(), n = Object.values(e.vulnerabilities ?? {});
55
55
  for (let e of n) for (let n of e.via) typeof n != "string" && t.set(n.url, n);
56
56
  return t.values().toArray();
57
57
  }
58
58
  //#endregion
59
59
  //#region src/actions/buildProject.ts
60
- var ve = "build:wasm";
61
- async function ye() {
60
+ var be = "build:wasm";
61
+ async function xe() {
62
62
  try {
63
- s("Build Project"), await be("1️⃣ ", await T("package.json")), C("Project built");
63
+ s("Build Project"), await Se("1️⃣ ", await C("package.json")), x("Project built");
64
64
  } catch (e) {
65
65
  console.error("❌ Error building project", e), process.exit(1);
66
66
  }
67
67
  }
68
- async function be(e, t) {
69
- t.scripts?.[ve] != null && await o(`${e} Build WebAssembly`, "npm", ["run", ve]), await o(`${e} Bundle project`, "vite", ["build"]);
68
+ async function Se(e, t) {
69
+ t.scripts?.[be] != null && await o(`${e} Build WebAssembly`, "npm", ["run", be]), await o(`${e} Bundle project`, "vite", ["build"]);
70
70
  }
71
71
  //#endregion
72
72
  //#region src/actions/checkConfigFiles.ts
73
- var k = "@dpuse/dpuse-development/prettierrc", xe = "dpuse-development";
74
- async function Se() {
73
+ var D = "@dpuse/dpuse-development/prettierrc", Ce = "dpuse-development";
74
+ async function we() {
75
75
  try {
76
- s("Check configuration files"), E("1️⃣ Check individual files");
77
- let t = await T("config.json"), n = await T("package.json"), r = n.private === !0, i = m(t.id), a = O.dirname(ce(import.meta.url));
78
- await A(a, ".editorconfig"), await A(a, ".gitattributes"), await A(a, ".gitignore", [".gitignore_default"]), await A(a, ".markdownlint.json"), await A(a, ".ncurc.json"), await Ce(i, a), await A(a, "LICENSE"), await Te(i, a), await Ee(i, a), await De(i, a), await ke(i, a), we(i, n);
76
+ s("Check configuration files"), w("1️⃣ Check individual files");
77
+ let t = await C("config.json"), n = await C("package.json"), r = n.private === !0, i = m(t.id), a = E.dirname(ue(import.meta.url));
78
+ 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 Te(i, a), await O(a, "LICENSE"), await De(i, a), await Oe(i, a), await ke(i, a), await Me(i, a), Ee(i, n);
79
79
  let o = await e(v) !== null;
80
- o && await A(a, "rust-toolchain.toml"), await A(a, ".github/dependabot.yml", [`.github/dependabot${r ? ".private" : ""}${o ? ".rust" : ""}.yml`]), r ? console.info("ℹ️ GitHub workflows and file 'SECURITY.md' are NOT required by this project") : (await Oe(a), await A(a, "SECURITY.md", [], (e) => e.replaceAll(xe, () => t.id))), C("Configuration files checked");
80
+ o && await O(a, "rust-toolchain.toml"), await O(a, ".github/dependabot.yml", [`.github/dependabot${r ? ".private" : ""}${o ? ".rust" : ""}.yml`]), r ? await Ae(a) : (await je(a), await O(a, "SECURITY.md", [], (e) => e.replaceAll(Ce, () => t.id))), x("Configuration files checked");
81
81
  } catch (e) {
82
82
  console.error("❌ Error checking configuration files", e), process.exit(1);
83
83
  }
84
84
  }
85
- async function Ce(e, t) {
85
+ async function Te(e, t) {
86
86
  ["github"].includes(e.typeId) ? console.info("ℹ️ File 'eslint.config.js' is NOT required by this project") : [
87
87
  "app",
88
88
  "api",
89
89
  "development",
90
90
  "eslint",
91
91
  "kb"
92
- ].includes(e.typeId) ? console.info("⚠️ File 'eslint.config.js' is UNIQUE to this project") : await A(t, "eslint.config.js", ["eslint.config.default.js"]);
92
+ ].includes(e.typeId) ? console.info("⚠️ File 'eslint.config.js' is UNIQUE to this project") : await O(t, "eslint.config.js", ["eslint.config.default.js"]);
93
93
  }
94
- function we(e, t) {
95
- 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 === k ? console.info(`ℹ️ Prettier configuration is '${k}'`) : console.info(`❌ Prettier configuration is NOT '${k}'`);
94
+ function Ee(e, t) {
95
+ 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}'`);
96
96
  }
97
- async function Te(e, t) {
97
+ async function De(e, t) {
98
98
  ["github"].includes(e.typeId) ? console.info("ℹ️ File 'tsconfig.json' is NOT required by this project") : [
99
99
  "connector",
100
100
  "cookbook",
@@ -103,12 +103,12 @@ async function Te(e, t) {
103
103
  "presenter",
104
104
  "shared",
105
105
  "tool"
106
- ].includes(e.typeId) ? await A(t, "tsconfig.json") : console.info("⚠️ File 'tsconfig.json' is UNIQUE to this project");
106
+ ].includes(e.typeId) ? await O(t, "tsconfig.json") : console.info("⚠️ File 'tsconfig.json' is UNIQUE to this project");
107
107
  }
108
- async function Ee(e, t) {
109
- ["github"].includes(e.typeId) ? console.info("ℹ️ File 'scripts/tsconfig.json' is NOT required by this project") : await A(t, "scripts/tsconfig.json");
108
+ async function Oe(e, t) {
109
+ ["github"].includes(e.typeId) ? console.info("ℹ️ File 'scripts/tsconfig.json' is NOT required by this project") : await O(t, "scripts/tsconfig.json");
110
110
  }
111
- async function De(e, t) {
111
+ async function ke(e, t) {
112
112
  if ([
113
113
  "eslint",
114
114
  "github",
@@ -131,22 +131,26 @@ async function De(e, t) {
131
131
  break;
132
132
  default: n = ["vite.config.default.ts"];
133
133
  }
134
- await A(t, "vite.config.ts", n);
134
+ await O(t, "vite.config.ts", n);
135
135
  }
136
136
  }
137
- async function Oe(e) {
138
- await A(e, ".github/workflows/ci.yml"), await A(e, ".github/workflows/codeql.yml"), await A(e, ".github/workflows/publish.yml"), await A(e, ".github/workflows/scorecard.yml");
137
+ async function Ae(t) {
138
+ for (let n of [".github/workflows/ci.yml", ".github/workflows/publish.yml"]) await e(n) !== null && await O(t, n);
139
+ console.info("ℹ️ CodeQL and Scorecard workflows and file 'SECURITY.md' are NOT required by this project");
139
140
  }
140
- async function ke(e, t) {
141
+ async function je(e) {
142
+ 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");
143
+ }
144
+ async function Me(e, t) {
141
145
  [
142
146
  "app",
143
147
  "api",
144
148
  "github",
145
149
  "kb"
146
- ].includes(e.typeId) ? console.info("ℹ️ File 'vitest.config.ts' is NOT required by this project") : await A(t, "vitest.config.ts");
150
+ ].includes(e.typeId) ? console.info("ℹ️ File 'vitest.config.ts' is NOT required by this project") : await O(t, "vitest.config.ts");
147
151
  }
148
- async function A(e, t, n = [], r = (e) => e) {
149
- let i = O.resolve(process.cwd(), t), o = n.length > 0 ? n : [t], s;
152
+ async function O(e, t, n = [], r = (e) => e) {
153
+ let i = E.resolve(process.cwd(), t), o = n.length > 0 ? n : [t], s;
150
154
  try {
151
155
  s = await a(i);
152
156
  } catch (e) {
@@ -157,7 +161,7 @@ async function A(e, t, n = [], r = (e) => e) {
157
161
  return;
158
162
  }
159
163
  for (let n of o) {
160
- let i = O.resolve(e, `../${n}`), o = r(await a(i));
164
+ let i = E.resolve(e, `../${n}`), o = r(await a(i));
161
165
  if (s === o) {
162
166
  console.info(`ℹ️ File '${t}' is the same as '${n}'`);
163
167
  return;
@@ -167,16 +171,16 @@ async function A(e, t, n = [], r = (e) => e) {
167
171
  }
168
172
  //#endregion
169
173
  //#region src/actions/checkDependencies.ts
170
- async function Ae() {
174
+ async function Ne() {
171
175
  try {
172
- s("Check Dependencies"), await o("1️⃣ Check using 'npm outdated'", "npm", ["outdated"], !0), E("2️⃣ Check using 'npm-check-updates'");
176
+ s("Check Dependencies"), await o("1️⃣ Check using 'npm outdated'", "npm", ["outdated"], !0), w("2️⃣ Check using 'npm-check-updates'");
173
177
  let e = {};
174
178
  try {
175
- e = await T(O.resolve(process.cwd(), ".ncurc.json"));
179
+ e = await C(E.resolve(process.cwd(), ".ncurc.json"));
176
180
  } catch (e) {
177
181
  if (e.code !== "ENOENT") throw e;
178
182
  }
179
- await le({
183
+ await de({
180
184
  interactive: !0,
181
185
  upgrade: !0,
182
186
  dep: "dev,prod,peer,optional",
@@ -194,12 +198,12 @@ async function Ae() {
194
198
  "--no-strict-allow-scripts",
195
199
  "--no-fund"
196
200
  ], !0);
197
- let t = await je();
201
+ let t = await Pe();
198
202
  t.length > 0 ? await o("5️⃣ Move install-script pins to installed versions", "npm", [
199
203
  "install-scripts",
200
204
  "approve",
201
205
  ...t
202
- ]) : E("5️⃣ No pinned install-script approvals to move"), process.platform === "darwin" ? await o("6️⃣ Remove unused install-script entries", "npm", ["install-scripts", "prune"]) : E("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", [
206
+ ]) : w("5️⃣ No pinned install-script approvals to move"), process.platform === "darwin" ? await o("6️⃣ Remove unused install-script entries", "npm", ["install-scripts", "prune"]) : w("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", [
203
207
  "rebuild",
204
208
  ...t,
205
209
  "--no-strict-allow-scripts"
@@ -208,61 +212,61 @@ async function Ae() {
208
212
  "--strict-allow-scripts",
209
213
  "--no-audit",
210
214
  "--no-fund"
211
- ]), C("Dependencies checked");
215
+ ]), x("Dependencies checked");
212
216
  } catch (e) {
213
217
  console.error("❌ Error checking dependencies", e), process.exit(1);
214
218
  }
215
219
  }
216
- async function je() {
217
- let { allowScripts: e = {} } = await T(O.resolve(process.cwd(), "package.json")), t = Object.entries(e).filter(([e, t]) => t && e.lastIndexOf("@") > 0).map(([e]) => e.slice(0, e.lastIndexOf("@")));
220
+ async function Pe() {
221
+ 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("@")));
218
222
  return [...new Set(t)];
219
223
  }
220
224
  //#endregion
221
225
  //#region src/actions/checkProject.ts
222
- async function Me() {
223
- await Se(), await Ae();
226
+ async function Fe() {
227
+ await we(), await Ne();
224
228
  }
225
229
  //#endregion
226
230
  //#region src/actions/documentActions.ts
227
- var Ne = "<!-- SUPPORTED_ACTIONS_START -->", Pe = "<!-- SUPPORTED_ACTIONS_END -->", Fe = "Connectors conform to a unified interface contract by implementing a specific subset of standard actions. These standardised actions allow the DPUse application to interact with any underlying data source in the same way, enabling Connectors to be built independently and loaded dynamically at runtime.", Ie = {
231
+ var Ie = "<!-- SUPPORTED_ACTIONS_START -->", Le = "<!-- SUPPORTED_ACTIONS_END -->", Re = "Connectors conform to a unified interface contract by implementing a specific subset of standard actions. These standardised actions allow the DPUse application to interact with any underlying data source in the same way, enabling Connectors to be built independently and loaded dynamically at runtime.", ze = {
228
232
  source: "This connector is a Source connector that supports only read actions. Connectors can also function as a Destination (write-only) or Bidirectional (read/write), depending on the actions they support.",
229
233
  destination: "This connector is a Destination connector that supports only write actions. Connectors can also function as a Source (read-only) or Bidirectional (read/write), depending on the actions they support.",
230
234
  bidirectional: "This connector is a Bidirectional connector that supports both read and write actions. Connectors can also function as a Source (read-only) or Destination (write-only), depending on the actions they support.",
231
235
  unknown: "This connector does not yet implement any read or write actions, so its type cannot be determined. Connectors function as a Source (read-only), a Destination (write-only), or Bidirectional (read/write), depending on the actions they support."
232
- }, Le = "The table below lists all connector actions and highlights those supported by this connector.";
233
- async function Re() {
236
+ }, Be = "The table below lists all connector actions and highlights those supported by this connector.";
237
+ async function Ve() {
234
238
  try {
235
- s("Document Actions"), E("1️⃣ Insert actions description and table into 'README.md'");
236
- let e = (await T("config.json")).actionNames ?? [], t = g(e), n = r(e), i = `## Supported Actions\n\n${Fe}\n\n${Ie[t]} ${Le}\n\n${n}`;
237
- await _(i, Ne, Pe), C("Actions documented");
239
+ s("Document Actions"), w("1️⃣ Insert actions description and table into 'README.md'");
240
+ let e = (await C("config.json")).actionNames ?? [], t = g(e), n = r(e), i = `## Supported Actions\n\n${Re}\n\n${ze[t]} ${Be}\n\n${n}`;
241
+ await _(i, Ie, Le), x("Actions documented");
238
242
  } catch (e) {
239
243
  console.error("❌ Error documenting actions", e), process.exit(1);
240
244
  }
241
245
  }
242
246
  //#endregion
243
247
  //#region src/actions/documentContributingLicense.ts
244
- async function ze() {
248
+ async function He() {
245
249
  try {
246
250
  s("Document Contributing & License");
247
- let [e, t] = await Promise.all([T("package.json"), T("config.json")]), { owner: n, repository: r } = w(e, "document contributing and license"), i = Be(e), a = Ve(t.firstCreatedAt);
248
- E("1️⃣ Insert contributing and license content into 'README.md'"), await l(), await _(He(n, r, i, a), ee, re), C("Contributing & license documented");
251
+ let [e, t] = await Promise.all([C("package.json"), C("config.json")]), { owner: n, repository: r } = S(e, "document contributing and license"), i = Ue(e), a = We(t.firstCreatedAt);
252
+ w("1️⃣ Insert contributing and license content into 'README.md'"), await l(), await _(Ge(n, r, i, a), ee, ie), x("Contributing & license documented");
249
253
  } catch (e) {
250
254
  console.error("❌ Error documenting contributing and license", e), process.exit(1);
251
255
  }
252
256
  }
253
- function Be(e) {
257
+ function Ue(e) {
254
258
  let t = e.author, n = typeof t == "string" ? t : t?.name;
255
259
  if (n == null || n === "") throw Error("package.json 'author' field is required to document contributing and license.");
256
260
  let r = n.indexOf("<"), i = r === -1 ? -1 : n.indexOf(">", r);
257
261
  return i === -1 ? n.trim() : [n.slice(0, r).trim(), n.slice(i + 1).trim()].filter((e) => e !== "").join(" ");
258
262
  }
259
- function Ve(e) {
263
+ function We(e) {
260
264
  let t = (/* @__PURE__ */ new Date()).getFullYear();
261
265
  if (e == null) return String(t);
262
266
  let n = new Date(e).getFullYear();
263
267
  return n === t ? String(t) : `${String(n)}-present`;
264
268
  }
265
- function He(e, t, n, r) {
269
+ function Ge(e, t, n, r) {
266
270
  return `## Contributing
267
271
 
268
272
  This repository is maintained solely by its owner and does not, at present, accept external contributions into the canonical repo. Its source is published openly under the MIT License — every DPUse project is fully open source except DPUse Engine, which remains closed and proprietary.
@@ -277,8 +281,8 @@ This project is licensed under the MIT License, permitting free use, modificatio
277
281
  }
278
282
  //#endregion
279
283
  //#region src/utilities/rustCrates.ts
280
- var j = "licenses/cargoMetadata.json", M = "licenses/cargoTree.txt", Ue = 1e3, We = 1e4, Ge = "dpuse-development (https://github.com/dpuse/dpuse-development)", Ke = /^(?:copying|licen[cs]e|unlicense)/i, N = "wasm32-unknown-unknown";
281
- async function qe(n, r) {
284
+ var k = "licenses/cargoMetadata.json", A = "licenses/cargoTree.txt", Ke = 1e3, qe = 1e4, Je = "dpuse-development (https://github.com/dpuse/dpuse-development)", Ye = /^(?:copying|licen[cs]e|unlicense)/i, Xe = "wasm32-unknown-unknown";
285
+ async function Ze(n, r) {
282
286
  if (await e("rust/Cargo.toml") === null) return null;
283
287
  let i = [
284
288
  "--manifest-path",
@@ -291,22 +295,22 @@ async function qe(n, r) {
291
295
  "--edges",
292
296
  "normal,no-proc-macro",
293
297
  "--target",
294
- N,
298
+ Xe,
295
299
  "--prefix",
296
300
  "depth",
297
301
  "--format",
298
302
  "{p}|{l}|{r}"
299
303
  ];
300
- await t(n, "cargo", o, M), await t(n, "cargo", [
304
+ await t(n, "cargo", o, A), await t(n, "cargo", [
301
305
  "metadata",
302
306
  ...i,
303
307
  "--format-version",
304
308
  "1",
305
309
  "--filter-platform",
306
- N
307
- ], j);
308
- let s = Je(await a(M)), c = await T(j);
309
- await D.rm(M, { force: !0 }), await D.rm(j, { force: !0 });
310
+ Xe
311
+ ], k);
312
+ let s = Qe(await a(A)), c = await C(k);
313
+ await T.rm(A, { force: !0 }), await T.rm(k, { force: !0 });
310
314
  let l = /* @__PURE__ */ new Map();
311
315
  for (let e of s) e.isOwn || l.has(`${e.name}@${e.version}`) || l.set(`${e.name}@${e.version}`, {
312
316
  name: e.name,
@@ -319,9 +323,9 @@ async function qe(n, r) {
319
323
  latestPublishedDate: ""
320
324
  });
321
325
  let u = l.values().toArray();
322
- Ye(u, r);
323
- for (let e of u) e.licenseFiles = await Qe(e, c);
324
- return await $e(n, u), {
326
+ $e(u, r);
327
+ for (let e of u) e.licenseFiles = await nt(e, c);
328
+ return await rt(n, u), {
325
329
  crates: u,
326
330
  treeItems: s.map(({ name: e, version: t, depth: n, isOwn: r }) => ({
327
331
  name: e,
@@ -331,7 +335,7 @@ async function qe(n, r) {
331
335
  }))
332
336
  };
333
337
  }
334
- function Je(e) {
338
+ function Qe(e) {
335
339
  let t = [];
336
340
  for (let n of e.split("\n")) {
337
341
  let [e = "", r = "", i = ""] = n.trim().split("|", 3), a = /^\d+/.exec(e)?.[0];
@@ -348,49 +352,49 @@ function Je(e) {
348
352
  }
349
353
  return t;
350
354
  }
351
- function Ye(e, t) {
352
- let n = t.split(";").filter((e) => Xe(e)), r = e.filter((e) => !Ze(e.licenseExpression, n));
355
+ function $e(e, t) {
356
+ let n = t.split(";").filter((e) => et(e)), r = e.filter((e) => !tt(e.licenseExpression, n));
353
357
  if (r.length === 0) return;
354
358
  let i = r.map((e) => `${e.name}@${e.version} (${e.licenseExpression === "" ? "no licence" : e.licenseExpression})`).join(", ");
355
359
  throw Error(`Rust crates with licences not allowed: ${i}.`);
356
360
  }
357
- function Xe(e) {
361
+ function et(e) {
358
362
  try {
359
- return fe(e, [e]);
363
+ return me(e, [e]);
360
364
  } catch {
361
365
  return !1;
362
366
  }
363
367
  }
364
- function Ze(e, t) {
368
+ function tt(e, t) {
365
369
  try {
366
- return fe(e.replaceAll("/", " OR "), t);
370
+ return me(e.replaceAll("/", " OR "), t);
367
371
  } catch {
368
372
  return !1;
369
373
  }
370
374
  }
371
- async function Qe(e, t) {
375
+ async function nt(e, t) {
372
376
  let n = t.packages.find((t) => t.name === e.name && t.version === e.version);
373
377
  if (n == null) return [];
374
- let r = O.dirname(n.manifest_path), i = (await D.readdir(r)).filter((e) => Ke.test(e)).toSorted((e, t) => e.localeCompare(t, "en"));
375
- await D.mkdir("licenses/downloads", { recursive: !0 });
378
+ let r = E.dirname(n.manifest_path), i = (await T.readdir(r)).filter((e) => Ye.test(e)).toSorted((e, t) => e.localeCompare(t, "en"));
379
+ await T.mkdir("licenses/downloads", { recursive: !0 });
376
380
  let a = [];
377
381
  for (let t of i) {
378
382
  let n = `downloads/${e.name}@${e.version}-${t}`;
379
- await D.copyFile(O.join(r, t), O.join("licenses", n)), a.push({
383
+ await T.copyFile(E.join(r, t), E.join("licenses", n)), a.push({
380
384
  label: t,
381
385
  path: n
382
386
  });
383
387
  }
384
388
  return a;
385
389
  }
386
- async function $e(e, t) {
387
- E(`${e} - fetch release dates from crates.io`);
390
+ async function rt(e, t) {
391
+ w(`${e} - fetch release dates from crates.io`);
388
392
  for (let [e, n] of t.entries()) {
389
- e > 0 && await de(Ue), console.info(`⚙️ Fetching '${n.name}' (${String(e + 1)} of ${String(t.length)})...`);
393
+ e > 0 && await pe(Ke), console.info(`⚙️ Fetching '${n.name}' (${String(e + 1)} of ${String(t.length)})...`);
390
394
  try {
391
395
  let e = await fetch(`https://crates.io/api/v1/crates/${encodeURIComponent(n.name)}`, {
392
- headers: { "User-Agent": Ge },
393
- signal: AbortSignal.timeout(We)
396
+ headers: { "User-Agent": Je },
397
+ signal: AbortSignal.timeout(qe)
394
398
  });
395
399
  if (!e.ok) continue;
396
400
  let t = await e.json(), r = new Map((t.versions ?? []).map((e) => [e.num, e.created_at]));
@@ -400,75 +404,75 @@ async function $e(e, t) {
400
404
  }
401
405
  //#endregion
402
406
  //#region src/actions/documentDependencies.ts
403
- var P = "<!-- DEPENDENCY_LICENSES_START -->", F = "<!-- DEPENDENCY_LICENSES_END -->", I = "## Dependency Licenses", et = `bundle-analysis-reports/${ie}`, L = "licenses/licenseTree.json", R = "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.", tt = `The dependency tree below lists every package in this project — direct and transitive — along with its installed version, release date, and update status. ${R}`, nt = `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. ${R}`;
404
- async function rt(e = "MIT") {
407
+ var j = "<!-- DEPENDENCY_LICENSES_START -->", M = "<!-- DEPENDENCY_LICENSES_END -->", N = "## Dependency Licenses", it = `bundle-analysis-reports/${oe}`, P = "licenses/licenseTree.json", F = "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.", at = `The dependency tree below lists every package in this project — direct and transitive — along with its installed version, release date, and update status. ${F}`, ot = `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. ${F}`;
408
+ async function st(e = "MIT") {
405
409
  try {
406
410
  s("Document Dependencies");
407
- let n = await T("package.json"), r = n.name ?? "";
408
- if (x.has(r)) {
409
- await it(r), C("Dependencies documented");
411
+ let n = await C("package.json"), r = n.name ?? "";
412
+ if (ne.has(r)) {
413
+ await ct(r), x("Dependencies documented");
410
414
  return;
411
415
  }
412
416
  await f("1️⃣ Clear downloaded licenses", "licenses/downloads");
413
- let i = await dt(), a = await ft();
417
+ let i = await ht(), a = await gt();
414
418
  if (a === null) {
415
- let r = gt(i);
416
- await ut("2️⃣ Identify production licenses", e, [n.name ?? "", ...r], !0), await t("3️⃣ Identify transitive dependencies", "npm", [
419
+ let r = bt(i);
420
+ await mt("2️⃣ Identify production licenses", e, [n.name ?? "", ...r], !0), await t("3️⃣ Identify transitive dependencies", "npm", [
417
421
  "ls",
418
422
  "--all",
419
423
  "--json",
420
424
  "--omit=dev"
421
- ], L), await at("4️⃣ ", e, new Set(r));
425
+ ], P), await lt("4️⃣ ", e, new Set(r));
422
426
  } else {
423
- let r = pt(a, i), o = mt(i), s = o.filter((e) => !r.has(e));
424
- await ut("2️⃣ Identify shipped licenses", e, [n.name ?? "", ...s], !1), ht(r, new Set(o)), await t("3️⃣ Identify transitive dependencies", "npm", [
427
+ let r = _t(a, i), o = vt(i), s = o.filter((e) => !r.has(e));
428
+ await mt("2️⃣ Identify shipped licenses", e, [n.name ?? "", ...s], !1), yt(r, new Set(o)), await t("3️⃣ Identify transitive dependencies", "npm", [
425
429
  "ls",
426
430
  "--all",
427
431
  "--json"
428
- ], L, !0);
429
- let c = await qe("4️⃣ Identify Rust crates compiled into the WebAssembly", e), l = {
432
+ ], P, !0);
433
+ let c = await Ze("4️⃣ Identify Rust crates compiled into the WebAssembly", e), l = {
430
434
  allowedLicenses: e,
431
- productionNames: lt(n),
435
+ productionNames: pt(n),
432
436
  rustCrates: c,
433
437
  shippedKeys: r
434
438
  };
435
- await ot(c === null ? "4️⃣ " : "5️⃣ ", l);
439
+ await ut(c === null ? "4️⃣ " : "5️⃣ ", l);
436
440
  }
437
- C("Dependencies documented");
441
+ x("Dependencies documented");
438
442
  } catch (e) {
439
443
  console.error("❌ Error documenting dependencies", e), process.exit(1);
440
444
  }
441
445
  }
442
- async function it(e) {
443
- E(`1️⃣ Skip: ${e} is a development-only tool and is never part of a production release.`);
446
+ async function ct(e) {
447
+ w(`1️⃣ Skip: ${e} is a development-only tool and is never part of a production release.`);
444
448
  let t = `> [!WARNING]\n> Dependency licenses are not documented here: ${e} is a development-only tool and is never part of a production release.`;
445
- await _(`${I}\n\n${t}`, P, F);
449
+ await _(`${N}\n\n${t}`, j, M);
446
450
  }
447
- async function at(e, t, n) {
448
- E(`${e} Insert licenses into 'README.md'`);
449
- let r = await T(L), i = await z(), a = `${bt(t, !1)}\n\n|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|\n`;
450
- for (let e of i.values()) a += wt(e);
451
+ async function lt(e, t, n) {
452
+ w(`${e} Insert licenses into 'README.md'`);
453
+ let r = await C(P), i = await I(), a = `${wt(t, !1)}\n\n|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|\n`;
454
+ for (let e of i.values()) a += Ot(e);
451
455
  let o = [];
452
- r.dependencies != null && Tt(r.dependencies, i, n, o, 0);
453
- let s = `${tt}\n\n${o.join("\n")}`;
454
- await _(`${I}\n\n${a.trimEnd()}\n\n### Dependency Tree\n\n${s}`, P, F);
455
- }
456
- async function ot(e, t) {
457
- E(`${e} Insert licenses into 'README.md'`);
458
- let { allowedLicenses: n, productionNames: r, rustCrates: i, shippedKeys: a } = t, o = await z(), s = new Map((i?.crates ?? []).map((e) => [`${e.name}@${e.version}`, st(e)])), c = [...o.values(), ...s.values()].toSorted((e, t) => e.name.localeCompare(t.name, "en") || e.installedVersion.localeCompare(t.installedVersion, "en")), l = `${bt(n, !0, i !== null)}\n\n|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|\n`;
459
- for (let e of c) l += wt(e);
460
- let u = await T(L), d = Object.entries(u.dependencies ?? {}).toSorted(([e], [t]) => Number(!r.has(e)) - Number(!r.has(t))), f = [];
461
- V(d, {
456
+ r.dependencies != null && kt(r.dependencies, i, n, o, 0);
457
+ let s = `${at}\n\n${o.join("\n")}`;
458
+ await _(`${N}\n\n${a.trimEnd()}\n\n### Dependency Tree\n\n${s}`, j, M);
459
+ }
460
+ async function ut(e, t) {
461
+ w(`${e} Insert licenses into 'README.md'`);
462
+ let { allowedLicenses: n, productionNames: r, rustCrates: i, shippedKeys: a } = t, o = await I(), s = new Map((i?.crates ?? []).map((e) => [`${e.name}@${e.version}`, dt(e)])), c = [...o.values(), ...s.values()].toSorted((e, t) => e.name.localeCompare(t.name, "en") || e.installedVersion.localeCompare(t.installedVersion, "en")), l = `${wt(n, !0, i !== null)}\n\n|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|\n`;
463
+ for (let e of c) l += Ot(e);
464
+ let u = await C(P), d = Object.entries(u.dependencies ?? {}).toSorted(([e], [t]) => Number(!r.has(e)) - Number(!r.has(t))), f = [];
465
+ R(d, {
462
466
  licensesByKey: o,
463
467
  shippedKeys: a,
464
468
  shownKeys: /* @__PURE__ */ new Set()
465
469
  }, f, 0, !1);
466
470
  let p = i?.treeItems ?? [];
467
- for (let e of p) f.push(ct(e, s));
468
- let m = `${nt}\n\n${f.join("\n")}`;
469
- await _(`${I}\n\n${l.trimEnd()}\n\n### Dependency Tree\n\n${m}`, P, F);
471
+ for (let e of p) f.push(ft(e, s));
472
+ let m = `${ot}\n\n${f.join("\n")}`;
473
+ await _(`${N}\n\n${l.trimEnd()}\n\n### Dependency Tree\n\n${m}`, j, M);
470
474
  }
471
- function st(e) {
475
+ function dt(e) {
472
476
  return {
473
477
  name: e.name,
474
478
  repository: e.repository,
@@ -481,27 +485,27 @@ function st(e) {
481
485
  licenseFiles: e.licenseFiles
482
486
  };
483
487
  }
484
- function ct(e, t) {
488
+ function ft(e, t) {
485
489
  let n = " ".repeat(e.depth);
486
- return e.isOwn ? `${n}- **${e.name}** ${e.version} — this project's Rust code, compiled into its WebAssembly` : H(e.name, e.version, t.get(`${e.name}@${e.version}`), n);
490
+ return e.isOwn ? `${n}- **${e.name}** ${e.version} — this project's Rust code, compiled into its WebAssembly` : z(e.name, e.version, t.get(`${e.name}@${e.version}`), n);
487
491
  }
488
- function lt(e) {
492
+ function pt(e) {
489
493
  return /* @__PURE__ */ new Set([
490
494
  ...Object.keys(e.dependencies ?? {}),
491
495
  ...Object.keys(e.optionalDependencies ?? {}),
492
496
  ...Object.keys(e.peerDependencies ?? {})
493
497
  ]);
494
498
  }
495
- async function z() {
496
- let e = await T("licenses/licenses.json"), t = /* @__PURE__ */ new Map();
497
- for (let [n, r] of Object.entries(e)) t.set(n, St(n, r));
499
+ async function I() {
500
+ let e = await C("licenses/licenses.json"), t = /* @__PURE__ */ new Map();
501
+ for (let [n, r] of Object.entries(e)) t.set(n, Et(n, r));
498
502
  return await Promise.all(t.values().map(async (e) => {
499
- let t = await Ct(e.name, e.installedVersion);
503
+ let t = await Dt(e.name, e.installedVersion);
500
504
  e.latestVersion = t.latestVersion, e.latestPublishedDate = t.latestPublishedDate, e.publishedDate = t.publishedDate;
501
505
  })), t;
502
506
  }
503
- async function ut(e, t, n, r) {
504
- E(e), await new Promise((e, i) => {
507
+ async function mt(e, t, n, r) {
508
+ w(e), await new Promise((e, i) => {
505
509
  let a = {
506
510
  start: process.cwd(),
507
511
  production: r,
@@ -513,63 +517,63 @@ async function ut(e, t, n, r) {
513
517
  excludePackages: n.join(";"),
514
518
  out: "licenses/licenses.json"
515
519
  };
516
- ue(a, (t) => {
520
+ fe(a, (t) => {
517
521
  t == null ? e() : i(t);
518
522
  });
519
523
  });
520
524
  }
521
- async function dt() {
525
+ async function ht() {
522
526
  let t = await e("package-lock.json");
523
527
  return t === null ? {} : JSON.parse(t).packages ?? {};
524
528
  }
525
- async function ft() {
526
- let t = await e(et);
529
+ async function gt() {
530
+ let t = await e(it);
527
531
  return t === null ? null : JSON.parse(t);
528
532
  }
529
- function pt(e, t) {
533
+ function _t(e, t) {
530
534
  let n = new Set(e.packages);
531
535
  for (let r of e.external) {
532
- let e = yt(t, "", r);
533
- if (e !== void 0) for (let r of [e, ..._t(t, e)]) {
536
+ let e = Ct(t, "", r);
537
+ if (e !== void 0) for (let r of [e, ...xt(t, e)]) {
534
538
  let e = t[r];
535
- e?.version !== void 0 && n.add(B(r, e));
539
+ e?.version !== void 0 && n.add(L(r, e));
536
540
  }
537
541
  }
538
542
  return n;
539
543
  }
540
- function mt(e) {
544
+ function vt(e) {
541
545
  let t = /* @__PURE__ */ new Set();
542
- for (let [n, r] of Object.entries(e)) n !== "" && r.version !== void 0 && t.add(B(n, r));
546
+ for (let [n, r] of Object.entries(e)) n !== "" && r.version !== void 0 && t.add(L(n, r));
543
547
  return [...t];
544
548
  }
545
- function ht(e, t) {
549
+ function yt(e, t) {
546
550
  let n = [...e.difference(t)];
547
551
  n.length > 0 && console.warn(`⚠️ Not installed, so not checked; rebuild to refresh the record: ${n.join(", ")}`);
548
552
  }
549
- function B(e, t) {
553
+ function L(e, t) {
550
554
  return `${t.name ?? e.slice(e.lastIndexOf("node_modules/") + 13)}@${String(t.version)}`;
551
555
  }
552
- function gt(e) {
553
- let t = _t(e, ""), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
556
+ function bt(e) {
557
+ let t = xt(e, ""), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
554
558
  for (let [i, a] of Object.entries(e)) {
555
559
  if (i === "" || a.version === void 0) continue;
556
- let e = B(i, a);
560
+ let e = L(i, a);
557
561
  t.has(i) ? n.add(e) : r.add(e);
558
562
  }
559
563
  return r.values().filter((e) => !n.has(e)).toArray();
560
564
  }
561
- function _t(e, t) {
565
+ function xt(e, t) {
562
566
  let n = /* @__PURE__ */ new Set(), r = [t];
563
567
  for (; r.length > 0;) {
564
568
  let t = r.pop() ?? "", i = e[t];
565
- if (i !== void 0) for (let a of vt(i)) {
566
- let i = yt(e, t, a);
569
+ if (i !== void 0) for (let a of St(i)) {
570
+ let i = Ct(e, t, a);
567
571
  i === void 0 || n.has(i) || (n.add(i), r.push(i));
568
572
  }
569
573
  }
570
574
  return n;
571
575
  }
572
- function vt(e) {
576
+ function St(e) {
573
577
  let t = Object.keys(e.peerDependencies ?? {}).filter((t) => e.peerDependenciesMeta?.[t]?.optional !== !0);
574
578
  return [
575
579
  ...Object.keys(e.dependencies ?? {}),
@@ -577,7 +581,7 @@ function vt(e) {
577
581
  ...t
578
582
  ];
579
583
  }
580
- function yt(e, t, n) {
584
+ function Ct(e, t, n) {
581
585
  let r = t;
582
586
  for (;;) {
583
587
  let t = r === "" ? `node_modules/${n}` : `${r}/node_modules/${n}`, i = e[t];
@@ -587,14 +591,14 @@ function yt(e, t, n) {
587
591
  r = a === -1 ? "" : r.slice(0, a);
588
592
  }
589
593
  }
590
- function bt(e, t, n = !1) {
591
- let r = xt(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.";
594
+ function wt(e, t, n = !1) {
595
+ let r = Tt(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.";
592
596
  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.`;
593
597
  }
594
- function xt(e) {
598
+ function Tt(e) {
595
599
  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))}`;
596
600
  }
597
- function St(e, t) {
601
+ function Et(e, t) {
598
602
  let n = e.lastIndexOf("@"), r = n > 0 ? e.slice(0, n) : e, i = n > 0 ? e.slice(n + 1) : "";
599
603
  return {
600
604
  name: r,
@@ -611,7 +615,7 @@ function St(e, t) {
611
615
  }]
612
616
  };
613
617
  }
614
- async function Ct(e, t) {
618
+ async function Dt(e, t) {
615
619
  try {
616
620
  let n = await fetch(`https://registry.npmjs.org/${encodeURIComponent(e)}`);
617
621
  if (n.ok) {
@@ -629,40 +633,40 @@ async function Ct(e, t) {
629
633
  publishedDate: ""
630
634
  };
631
635
  }
632
- function wt(e) {
636
+ function Ot(e) {
633
637
  let t = e.licenseFiles.length === 0 ? "⚠️ No license file" : e.licenseFiles.map((e) => `[${e.label}](licenses/${e.path})`).join(" ");
634
638
  return `|[${e.name}](${e.repository})|${e.installedVersion}|${e.licenseTypes}|${t}|\n`;
635
639
  }
636
- function Tt(e, t, n, r, i) {
640
+ function kt(e, t, n, r, i) {
637
641
  let a = " ".repeat(i);
638
642
  for (let [o, s] of Object.entries(e)) {
639
643
  if (s.version === void 0) continue;
640
644
  let e = s.version;
641
- n.has(`${o}@${e}`) || (r.push(H(o, e, t.get(`${o}@${e}`), a)), s.dependencies != null && Tt(s.dependencies, t, n, r, i + 1));
645
+ n.has(`${o}@${e}`) || (r.push(z(o, e, t.get(`${o}@${e}`), a)), s.dependencies != null && kt(s.dependencies, t, n, r, i + 1));
642
646
  }
643
647
  }
644
- function V(e, t, n, r, i) {
648
+ function R(e, t, n, r, i) {
645
649
  for (let [a, o] of e) {
646
650
  if (o.version === void 0) continue;
647
651
  let e = `${a}@${o.version}`, s = Object.entries(o.dependencies ?? {});
648
652
  if (!t.shippedKeys.has(e)) {
649
- V(s, t, n, r, !0);
653
+ R(s, t, n, r, !0);
650
654
  continue;
651
655
  }
652
- i && t.shownKeys.has(e) || (t.shownKeys.add(e), n.push(H(a, o.version, t.licensesByKey.get(e), " ".repeat(r))), V(s, t, n, r + 1, !1));
656
+ i && t.shownKeys.has(e) || (t.shownKeys.add(e), n.push(z(a, o.version, t.licensesByKey.get(e), " ".repeat(r))), R(s, t, n, r + 1, !1));
653
657
  }
654
658
  }
655
- function H(e, t, n, r) {
656
- return `${r}- **${n == null ? e : `[${e}](${n.repository})`}** ${t}${Et(n)}`;
659
+ function z(e, t, n, r) {
660
+ return `${r}- **${n == null ? e : `[${e}](${n.repository})`}** ${t}${At(n)}`;
657
661
  }
658
- function Et(e) {
662
+ function At(e) {
659
663
  if (e == null) return "";
660
- let t = e.publishedDate ? Dt(e.publishedDate.split("T", 1)[0]) : "";
664
+ let t = e.publishedDate ? B(e.publishedDate.split("T", 1)[0]) : "";
661
665
  if (e.latestVersion === "" || e.latestVersion === e.installedVersion) return t === "" ? "" : ` — ${t}`;
662
- let n = e.latestPublishedDate ? Dt(e.latestPublishedDate.split("T", 1)[0]) : "", r = n === "" ? `**latest**: ${e.latestVersion} ❗` : `**latest**: ${e.latestVersion} — ${n} ❗`;
666
+ let n = e.latestPublishedDate ? B(e.latestPublishedDate.split("T", 1)[0]) : "", r = n === "" ? `**latest**: ${e.latestVersion} ❗` : `**latest**: ${e.latestVersion} — ${n} ❗`;
663
667
  return t === "" ? ` — → ${r}` : ` — ${t} → ${r}`;
664
668
  }
665
- function Dt(e) {
669
+ function B(e) {
666
670
  if (e == null || e === "") return "n/a";
667
671
  let t = e.split("T", 1)[0];
668
672
  if (t == null || t === "") return "n/a";
@@ -671,31 +675,31 @@ function Dt(e) {
671
675
  }
672
676
  //#endregion
673
677
  //#region src/actions/documentOpening.ts
674
- var Ot = "<!-- OPENING_START -->", kt = "<!-- OPENING_END -->";
675
- async function At() {
678
+ var jt = "<!-- OPENING_START -->", Mt = "<!-- OPENING_END -->";
679
+ async function Nt() {
676
680
  try {
677
- s("Document Opening"), E("1️⃣ Insert opening content into 'README.md'");
678
- let e = await T("package.json"), t = await T("config.json"), { owner: n, repository: r } = w(e, "document opening"), i = jt(e), a = Nt(t), o = m(t.id), c = Pt(n, r, i, o.uploadGroupName !== void 0, o.publishedTo === "npm" ? Mt(e) : void 0, e.description, a);
679
- await _(c, Ot, kt), C("Opening documented");
681
+ s("Document Opening"), w("1️⃣ Insert opening content into 'README.md'");
682
+ let e = await C("package.json"), t = await C("config.json"), { owner: n, repository: r } = S(e, "document opening"), i = Pt(e), a = It(t), o = m(t.id), c = Lt(n, r, i, o.uploadGroupName !== void 0, o.publishedTo === "npm" ? Ft(e) : void 0, e.description, a);
683
+ await _(c, jt, Mt), x("Opening documented");
680
684
  } catch (e) {
681
685
  console.error("❌ Error documenting opening", e), process.exit(1);
682
686
  }
683
687
  }
684
- function jt(e) {
688
+ function Pt(e) {
685
689
  let t = e.license;
686
690
  if (t == null || t === "") throw Error("package.json 'license' field is required to document opening.");
687
691
  return t;
688
692
  }
689
- function Mt(e) {
693
+ function Ft(e) {
690
694
  let t = e.name;
691
695
  if (t == null || t === "") throw Error("package.json 'name' field is required to document opening.");
692
696
  return t;
693
697
  }
694
- function Nt(e) {
698
+ function It(e) {
695
699
  let t = e.description.en?.trim();
696
700
  return t === void 0 || t === "" ? void 0 : t;
697
701
  }
698
- function Pt(e, t, n, r, i, a, o) {
702
+ function Lt(e, t, n, r, i, a, o) {
699
703
  let s = `https://github.com/${e}/${t}`;
700
704
  return `[![License: ${n}](https://img.shields.io/badge/License-${n.replaceAll("-", "--")}-blue.svg)](./LICENSE)${r ? `\n[![DPUse version](https://img.shields.io/github/v/release/${e}/${t}?color=f6821f&label=DPUse)](${s}/releases/latest)` : ""}${i === void 0 ? "" : `\n[![npm version](https://img.shields.io/npm/v/${i}?color=cb3837&label=npm)](https://www.npmjs.com/package/${i})`}
701
705
  [![CI](${s}/actions/workflows/ci.yml/badge.svg)](${s}/actions/workflows/ci.yml)${a == null || a === "" ? "" : `\n\n${a}`}
@@ -716,43 +720,43 @@ In addition, DPUse provides [Tools](https://www.dpuse.app) used by the applicati
716
720
  }
717
721
  //#endregion
718
722
  //#region src/actions/documentQualitySecurity.ts
719
- var Ft = {
723
+ var V = {
720
724
  "Branch-Protection": 3,
721
725
  "Code-Review": 0,
722
726
  Contributors: 0
723
- }, It = /* @__PURE__ */ new Set(["CII-Best-Practices"]), Lt = "coverage/coverage-final.json", Rt = "coverage/coverage-summary.json", zt = 80, Bt = 60, Vt = "code-health-reports/vitest/badge.json", Ht = {
727
+ }, Rt = /* @__PURE__ */ new Set(["CII-Best-Practices"]), zt = "coverage/coverage-final.json", Bt = "coverage/coverage-summary.json", H = 80, Vt = 60, Ht = "code-health-reports/vitest/badge.json", Ut = {
724
728
  actions: "GitHub Actions",
725
729
  "javascript-typescript": "JavaScript/TypeScript",
726
730
  rust: "Rust"
727
- }, Ut = {
731
+ }, Wt = {
728
732
  A: "brightgreen",
729
733
  B: "green",
730
734
  C: "yellow",
731
735
  D: "orange",
732
736
  F: "red"
733
- }, Wt = `${c}/health.json`, Gt = oe(se);
734
- async function Kt() {
737
+ }, Gt = `${c}/health.json`, Kt = ce(le);
738
+ async function qt() {
735
739
  try {
736
740
  s("Document Quality & Security");
737
- let e = await T("package.json"), t = await qt(e), n = await Yt(e, t === void 0 ? [] : ["--coverage", Lt]), { owner: r, repository: i } = w(e, "document quality and security");
738
- E("4️⃣ Read security checks and settings");
739
- let a = await Zt(r, i, e);
740
- E("5️⃣ Look up OpenSSF Best Practices badge and Scorecard results");
741
- let [o, c] = await Promise.all([Qt(`https://github.com/${r}/${i}`), $t(`github.com/${r}/${i}`)]);
742
- E("6️⃣ Insert quality and security content into 'README.md'");
743
- let d = an(r, i, {
741
+ let e = await C("package.json"), t = await Jt(e), n = await Xt(e, t === void 0 ? [] : ["--coverage", zt]), { owner: r, repository: i } = S(e, "document quality and security");
742
+ w("4️⃣ Read security checks and settings");
743
+ let a = await Qt(r, i, e);
744
+ w("5️⃣ Look up OpenSSF Best Practices badge and Scorecard results");
745
+ let [o, c] = await Promise.all([$t(`https://github.com/${r}/${i}`), en(`github.com/${r}/${i}`)]);
746
+ w("6️⃣ Insert quality and security content into 'README.md'");
747
+ let d = on(r, i, {
744
748
  coveragePercent: t,
745
749
  fallowHealth: n,
746
750
  securitySettings: a
747
751
  }, o, c);
748
- await l(), await _(d, u, ne), C("Quality & security documented");
752
+ await l(), await _(d, u, re), x("Quality & security documented");
749
753
  } catch (e) {
750
754
  console.error("❌ Error documenting quality and security", e), process.exit(1);
751
755
  }
752
756
  }
753
- async function qt(t) {
757
+ async function Jt(t) {
754
758
  if (t.devDependencies?.["@vitest/coverage-v8"] == null) {
755
- E("1️⃣ Test coverage NOT measured, as '@vitest/coverage-v8' is not installed");
759
+ w("1️⃣ Test coverage NOT measured, as '@vitest/coverage-v8' is not installed");
756
760
  return;
757
761
  }
758
762
  await o("1️⃣ Measure test coverage", "vitest", [
@@ -760,27 +764,27 @@ async function qt(t) {
760
764
  "--passWithNoTests",
761
765
  "--coverage"
762
766
  ]);
763
- let n = await e(Rt);
767
+ let n = await e(Bt);
764
768
  if (n === null) return;
765
769
  let r = JSON.parse(n).total.lines.pct;
766
- return await Jt(r), r;
770
+ return await Yt(r), r;
767
771
  }
768
- async function Jt(e) {
772
+ async function Yt(e) {
769
773
  let t = [
770
774
  "red",
771
775
  "yellow",
772
776
  "brightgreen"
773
- ], n = Number(e >= Bt) + Number(e >= zt);
774
- await i(Vt, {
777
+ ], n = Number(e >= Vt) + Number(e >= H);
778
+ await i(Ht, {
775
779
  schemaVersion: 1,
776
780
  label: "coverage",
777
781
  message: `${e.toFixed(1)}%`,
778
782
  color: t[n]
779
783
  });
780
784
  }
781
- async function Yt(e, n) {
785
+ async function Xt(e, n) {
782
786
  if (e.devDependencies?.fallow == null) {
783
- E("2️⃣ Code health NOT measured, as Fallow is not installed"), E("3️⃣ Code health report NOT required");
787
+ w("2️⃣ Code health NOT measured, as Fallow is not installed"), w("3️⃣ Code health report NOT required");
784
788
  return;
785
789
  }
786
790
  await t("2️⃣ Measure code health", "fallow", [
@@ -789,20 +793,20 @@ async function Yt(e, n) {
789
793
  "--format",
790
794
  "json",
791
795
  ...n
792
- ], Wt), await t("3️⃣ Write code health report", "fallow", ["--format", "markdown"], te, !0);
793
- let r = await T(Wt);
794
- return await Xt(r), r;
796
+ ], Gt), await t("3️⃣ Write code health report", "fallow", ["--format", "markdown"], te, !0);
797
+ let r = await C(Gt);
798
+ return await Zt(r), r;
795
799
  }
796
- async function Xt(e) {
800
+ async function Zt(e) {
797
801
  let { score: t, grade: n } = e.health_score;
798
802
  await i(h, {
799
803
  schemaVersion: 1,
800
804
  label: "fallow",
801
805
  message: `${n} (${String(Math.round(t))})`,
802
- color: Ut[n] ?? "lightgrey"
806
+ color: Wt[n] ?? "lightgrey"
803
807
  });
804
808
  }
805
- async function Zt(t, n, r) {
809
+ async function Qt(t, n, r) {
806
810
  let [i, a, o] = await Promise.all([
807
811
  e(".github/workflows/ci.yml"),
808
812
  e(".github/dependabot.yml"),
@@ -814,7 +818,7 @@ async function Zt(t, n, r) {
814
818
  U(`repos/${t}/${n}/commits/main/check-runs?per_page=100`)
815
819
  ]), 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;
816
820
  return {
817
- codeQLLanguages: s.matchAll(/- language: ([\w-]+)/g).filter(([, e]) => e !== "rust" || o !== null).map(([, e = ""]) => Ht[e] ?? e).toArray(),
821
+ codeQLLanguages: s.matchAll(/- language: ([\w-]+)/g).filter(([, e]) => e !== "rust" || o !== null).map(([, e = ""]) => Ut[e] ?? e).toArray(),
818
822
  codeQLQueries: /queries: ([\w-]+)/.exec(s)?.[1],
819
823
  dependabotAlerts: u !== void 0,
820
824
  dependabotSecurityUpdates: p("dependabot_security_updates"),
@@ -833,29 +837,29 @@ async function Zt(t, n, r) {
833
837
  }
834
838
  async function U(e) {
835
839
  try {
836
- let { stdout: t } = await Gt("gh", ["api", e]);
840
+ let { stdout: t } = await Kt("gh", ["api", e]);
837
841
  return t;
838
842
  } catch (e) {
839
843
  if (String(e.stderr).includes("HTTP 404")) return;
840
844
  throw e;
841
845
  }
842
846
  }
843
- async function Qt(e) {
847
+ async function $t(e) {
844
848
  let t = await fetch(`https://www.bestpractices.dev/projects.json?url=${encodeURIComponent(e)}`);
845
849
  if (!t.ok) throw Error(`OpenSSF Best Practices lookup failed with status ${String(t.status)}.`);
846
850
  return (await t.json()).find((t) => t.repo_url === e)?.id;
847
851
  }
848
- async function $t(e) {
852
+ async function en(e) {
849
853
  let t = await fetch(`https://api.scorecard.dev/projects/${e}`);
850
854
  if (t.status !== 404) {
851
855
  if (!t.ok) throw Error(`OpenSSF Scorecard lookup failed with status ${String(t.status)}.`);
852
856
  return await t.json();
853
857
  }
854
858
  }
855
- function en(e) {
856
- return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || It.has(e) || Ft[e] !== void 0 && t >= Ft[e]);
857
- }
858
859
  function tn(e) {
860
+ return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || Rt.has(e) || V[e] !== void 0 && t >= V[e]);
861
+ }
862
+ function nn(e) {
859
863
  return e === !1 ? " These are handled manually." : "";
860
864
  }
861
865
  function W(e) {
@@ -870,10 +874,10 @@ ${t.map((e) => `|${e.join("|")}|`).join("\n")}
870
874
 
871
875
  `;
872
876
  }
873
- function nn(e, t, n, r) {
877
+ function rn(e, t, n, r) {
874
878
  return `![${n}](https://img.shields.io/endpoint?url=${encodeURIComponent(`https://raw.githubusercontent.com/${e}/${t}/main/${r}`)})`;
875
879
  }
876
- function rn(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i }) {
880
+ function an(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i }) {
877
881
  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 = [[
878
882
  "Unit tests",
879
883
  W(i.testsInCI),
@@ -886,7 +890,7 @@ function rn(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i })
886
890
  n !== void 0 && s.push([
887
891
  "Test coverage",
888
892
  W(!0),
889
- `${nn(e, t, "Coverage", Vt)} [Vitest's V8 coverage](https://vitest.dev/guide/coverage) measures the share of source lines the unit tests run. The target is ${String(zt)}%.`
893
+ `${rn(e, t, "Coverage", Ht)} [Vitest's V8 coverage](https://vitest.dev/guide/coverage) measures the share of source lines the unit tests run. The target is ${String(H)}%.`
890
894
  ]);
891
895
  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 = [[
892
896
  "Code analysis",
@@ -900,7 +904,7 @@ function rn(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i })
900
904
  r !== void 0 && l.unshift([
901
905
  "Code health",
902
906
  W(!0),
903
- `[${nn(e, t, "Fallow code health", h)}](./${te}) [Fallow](https://github.com/fallow-rs/fallow) finds unused code, duplication, complexity and dependency problems.`
907
+ `[${rn(e, t, "Fallow code health", h)}](./${te}) [Fallow](https://github.com/fallow-rs/fallow) finds unused code, duplication, complexity and dependency problems.`
904
908
  ]);
905
909
  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 = [
906
910
  [
@@ -937,23 +941,23 @@ function rn(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i })
937
941
  [
938
942
  "Security updates",
939
943
  W(i.dependabotSecurityUpdates),
940
- `${g} opens pull requests that update vulnerable dependencies.${tn(i.dependabotSecurityUpdates)}`
944
+ `${g} opens pull requests that update vulnerable dependencies.${nn(i.dependabotSecurityUpdates)}`
941
945
  ],
942
946
  [
943
947
  "Version updates",
944
948
  W(i.dependabotVersionUpdates),
945
- `${g} opens pull requests for new dependency versions.${tn(i.dependabotVersionUpdates)}`
949
+ `${g} opens pull requests for new dependency versions.${nn(i.dependabotVersionUpdates)}`
946
950
  ]
947
951
  ];
948
952
  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.
949
953
 
950
954
  ${G("Testing", s)}${G("Code Quality", l)}${G("Security Analysis", m)}${G("Dependencies", _)}`;
951
955
  }
952
- function an(e, t, n, r, i) {
953
- let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 && en(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.";
956
+ function on(e, t, n, r, i) {
957
+ let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 && tn(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.";
954
958
  return `## Quality & Security
955
959
 
956
- ${rn(e, t, n)}### OpenSSF 🚧
960
+ ${an(e, t, n)}### OpenSSF 🚧
957
961
 
958
962
  ${l}[![OpenSSF Scorecard](https://api.scorecard.dev/projects/${o}/badge)](https://scorecard.dev/viewer/?uri=${o})
959
963
 
@@ -965,26 +969,26 @@ Please do not open public GitHub issues for security vulnerabilities. ${u}`;
965
969
  }
966
970
  //#endregion
967
971
  //#region src/actions/documentUsage.ts
968
- var on = "<!-- USAGE_START -->", sn = "<!-- USAGE_END -->", cn = /* @__PURE__ */ new Set([
972
+ var sn = "<!-- USAGE_START -->", cn = "<!-- USAGE_END -->", ln = /* @__PURE__ */ new Set([
969
973
  "connector",
970
974
  "cookbook",
971
975
  "presenter"
972
- ]), ln = /* @__PURE__ */ new Set(["development", "eslint"]), un = "> [!WARNING]\n> This project is not designed for general use. It is custom built for the DPUse CI/CD process. You are welcome to clone and customise it for your own purposes, but you will need to adapt it to your own project structure and tooling.", dn = "This repository manages itself using the actions it implements.", fn = "This repository is managed using the common set of actions provided by [@dpuse/dpuse-development](https://github.com/dpuse/dpuse-development).";
973
- async function pn() {
976
+ ]), un = /* @__PURE__ */ new Set(["development", "eslint"]), dn = "> [!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.", fn = "This repository manages itself using the actions it implements.", pn = "This repository is managed using the common set of actions provided by [@dpuse/dpuse-development](https://github.com/dpuse/dpuse-development).";
977
+ async function mn() {
974
978
  try {
975
- s("Document Usage"), E("1️⃣ Insert usage content into 'README.md'");
976
- let [e, t] = await Promise.all([T("package.json"), T("config.json")]), n = mn(e), r = hn(n), i = K(e.engines?.node), a = K(e.engines?.npm), o = K(e.devDependencies?.typescript), c = gn(m(t.id), e.name), l = `${n.replace(/\.git$/, "")}/blob/main/package.json`, u = _n(c, n, r, i, a, o, `${e.name === "@dpuse/dpuse-development" ? dn : fn} See the \`scripts\` block in [package.json](${l}) for details.`);
977
- await _(u, on, sn), C("Usage documented");
979
+ s("Document Usage"), w("1️⃣ Insert usage content into 'README.md'");
980
+ let [e, t] = await Promise.all([C("package.json"), C("config.json")]), n = hn(e), r = gn(n), i = K(e.engines?.node), a = K(e.engines?.npm), o = K(e.devDependencies?.typescript), c = _n(m(t.id), e.name), l = `${n.replace(/\.git$/, "")}/blob/main/package.json`, u = vn(c, n, r, i, a, o, `${e.name === "@dpuse/dpuse-development" ? fn : pn} See the \`scripts\` block in [package.json](${l}) for details.`);
981
+ await _(u, sn, cn), x("Usage documented");
978
982
  } catch (e) {
979
983
  console.error("❌ Error documenting usage", e), process.exit(1);
980
984
  }
981
985
  }
982
- function mn(e) {
986
+ function hn(e) {
983
987
  let t = e.repository, n = typeof t == "string" ? t : t?.url;
984
988
  if (n == null || n === "") throw Error("package.json 'repository' field is required to document usage.");
985
989
  return n.replace(/^git\+/, "");
986
990
  }
987
- function hn(e) {
991
+ function gn(e) {
988
992
  return (e.split("/").at(-1) ?? "").replace(/\.git$/, "");
989
993
  }
990
994
  function K(e) {
@@ -993,9 +997,9 @@ function K(e) {
993
997
  if (t == null) throw Error(`Unable to parse version from '${e}'.`);
994
998
  return t[0];
995
999
  }
996
- function gn(e, t) {
1000
+ function _n(e, t) {
997
1001
  let { typeId: n } = e;
998
- if (cn.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.
1002
+ if (ln.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.
999
1003
 
1000
1004
  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.`;
1001
1005
  if (e.publishedTo === "npm") {
@@ -1006,11 +1010,11 @@ You may view or clone this repository for your own purposes, such as building a
1006
1010
  npm install ${t}
1007
1011
  \`\`\`
1008
1012
 
1009
- ${ln.has(n) ? `${un}\n\n` : ""}To work on the source instead, clone this repository.`;
1013
+ ${un.has(n) ? `${dn}\n\n` : ""}To work on the source instead, clone this repository.`;
1010
1014
  }
1011
1015
  return "You may view or clone this repository for your own purposes.";
1012
1016
  }
1013
- function _n(e, t, n, r, i, a, o) {
1017
+ function vn(e, t, n, r, i, a, o) {
1014
1018
  return `## Usage
1015
1019
 
1016
1020
  ${e}
@@ -1028,25 +1032,25 @@ ${o}`;
1028
1032
  //#endregion
1029
1033
  //#region src/actions/documentApiReference.ts
1030
1034
  var q = "API_REFERENCE.md";
1031
- async function vn() {
1035
+ async function yn() {
1032
1036
  try {
1033
1037
  s("Document API Reference");
1034
1038
  let { writeAPIReference: e } = await import("./apiReference-cMfpNKxR.js");
1035
- await e("1️⃣ ", q), C("API reference documented");
1039
+ await e("1️⃣ ", q), x("API reference documented");
1036
1040
  } catch (e) {
1037
1041
  console.error("❌ Error documenting API reference", e), process.exit(1);
1038
1042
  }
1039
1043
  }
1040
1044
  //#endregion
1041
1045
  //#region src/actions/documentBundleSizes.ts
1042
- var yn = "bundle-analysis-reports/sonda/index.json", bn = "<!-- BUNDLE_START -->", xn = "<!-- BUNDLE_END -->", J = "&nbsp;&nbsp;&nbsp;&nbsp;", Y = 20, Sn = "█", Cn = "▒", wn = 100 / Y / 2, Tn = 100 / Y, En = "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._", Dn = "Bars show each row's share of its output file.", On = "↳ rows are part of the row above.", X = "(bundler output, whitespace & JSON)", kn = `${X} = 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.`;
1046
+ var J = "bundle-analysis-reports/sonda/index.json", bn = "<!-- BUNDLE_START -->", xn = "<!-- BUNDLE_END -->", Y = "&nbsp;&nbsp;&nbsp;&nbsp;", X = 20, Sn = "█", Cn = "▒", wn = 100 / X / 2, Tn = 100 / X, En = "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._", Dn = "Bars show each row's share of its output file.", On = "↳ rows are part of the row above.", Z = "(bundler output, whitespace & JSON)", kn = `${Z} = 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.`;
1043
1047
  async function An(e) {
1044
1048
  try {
1045
- s("Document Bundle Sizes"), E("1️⃣ Read bundle analysis report");
1046
- let t = await T(yn);
1047
- E("2️⃣ Insert table into 'README.md'");
1049
+ s("Document Bundle Sizes"), w("1️⃣ Read bundle analysis report");
1050
+ let t = await C(J);
1051
+ w("2️⃣ Insert table into 'README.md'");
1048
1052
  let n = jn(t, e?.moduleLevel ?? !1), r = n.includes("↳") ? `${Dn} ${On}` : Dn;
1049
- await _(`## Bundle Analysis\n\n${En}\n\n${n}\n\n${r}\n\n${kn}`, bn, xn), C("Bundle sizes documented");
1053
+ await _(`## Bundle Analysis\n\n${En}\n\n${n}\n\n${r}\n\n${kn}`, bn, xn), x("Bundle sizes documented");
1050
1054
  } catch (e) {
1051
1055
  console.error("❌ Error documenting bundle sizes", e), process.exit(1);
1052
1056
  }
@@ -1060,25 +1064,25 @@ function jn(e, t) {
1060
1064
  return a.join("\n");
1061
1065
  }
1062
1066
  function Mn(e, t) {
1063
- return e[0] === X == (t[0] === X) ? t[1].sizes.uncompressed - e[1].sizes.uncompressed : e[0] === X ? 1 : -1;
1067
+ return e[0] === Z == (t[0] === Z) ? t[1].sizes.uncompressed - e[1].sizes.uncompressed : e[0] === Z ? 1 : -1;
1064
1068
  }
1065
1069
  function Nn(e, t, n) {
1066
1070
  let r = [];
1067
1071
  for (let [i, { sizes: a, files: o }] of e) {
1068
1072
  if (o.size === 1) {
1069
1073
  let e = Ln(o);
1070
- r.push(`| ${J}${In(i, e)} | ${Z(a.uncompressed, t)} |`);
1074
+ r.push(`| ${Y}${In(i, e)} | ${Q(a.uncompressed, t)} |`);
1071
1075
  continue;
1072
1076
  }
1073
- r.push(`| ${J}${i} | ${Z(a.uncompressed, t)} |`), n || r.push(...Pn(o, t));
1077
+ r.push(`| ${Y}${i} | ${Q(a.uncompressed, t)} |`), n || r.push(...Pn(o, t));
1074
1078
  }
1075
1079
  return r;
1076
1080
  }
1077
1081
  function Pn(e, t) {
1078
- let n = [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), r = Fn(n, t), i = (r > 0 ? n.slice(0, -r) : n).map(([e, n]) => `| ${J}${J}↳ ${e} | ${Z(n.uncompressed, t, Cn)} |`);
1082
+ let n = [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), r = Fn(n, t), i = (r > 0 ? n.slice(0, -r) : n).map(([e, n]) => `| ${Y}${Y}↳ ${e} | ${Q(n.uncompressed, t, Cn)} |`);
1079
1083
  if (r > 0) {
1080
1084
  let e = n.slice(-r).reduce((e, [, t]) => e + t.uncompressed, 0);
1081
- i.push(`| ${J}${J}↳ ${String(r)} smaller files | ${Z(e, t, Cn)} |`);
1085
+ i.push(`| ${Y}${Y}↳ ${String(r)} smaller files | ${Q(e, t, Cn)} |`);
1082
1086
  }
1083
1087
  return i;
1084
1088
  }
@@ -1092,8 +1096,8 @@ function Fn(e, t) {
1092
1096
  }
1093
1097
  return n >= 2 ? n : 0;
1094
1098
  }
1095
- function Z(e, t, n = Sn) {
1096
- return `${Gn(t > 0 ? e / t * 100 : 0, n)} · ${Q(e)}`;
1099
+ function Q(e, t, n = Sn) {
1100
+ return `${Gn(t > 0 ? e / t * 100 : 0, n)} · ${$(e)}`;
1097
1101
  }
1098
1102
  function In(e, t) {
1099
1103
  return t === "" ? e : `${e} → ${t}`;
@@ -1132,7 +1136,7 @@ function Bn(e, t) {
1132
1136
  };
1133
1137
  }
1134
1138
  return e === "[unassigned]" ? {
1135
- group: X,
1139
+ group: Z,
1136
1140
  file: ""
1137
1141
  } : e.startsWith("\0") ? {
1138
1142
  group: "(runtime)",
@@ -1159,11 +1163,11 @@ function Un(e) {
1159
1163
  };
1160
1164
  }
1161
1165
  function Wn(e) {
1162
- return `${Q(e.uncompressed)} · gzip ${Q(e.gzip)}`;
1166
+ return `${$(e.uncompressed)} · gzip ${$(e.gzip)}`;
1163
1167
  }
1164
1168
  function Gn(e, t = Sn) {
1165
- let n = Math.round(e / 100 * Y);
1166
- return `\`${t.repeat(n)}${"░".repeat(Y - n)}\` ${e.toFixed(1)}%`;
1169
+ let n = Math.round(e / 100 * X);
1170
+ return `\`${t.repeat(n)}${"░".repeat(X - n)}\` ${e.toFixed(1)}%`;
1167
1171
  }
1168
1172
  function Kn() {
1169
1173
  return {
@@ -1177,17 +1181,17 @@ function qn(e, t) {
1177
1181
  function Jn(e, t) {
1178
1182
  return `${(e / t * 100).toFixed(1)}%`;
1179
1183
  }
1180
- function Q(e) {
1184
+ function $(e) {
1181
1185
  return e < 1024 ? `${String(e)} B` : `${(e / 1024).toFixed(1)} kB`;
1182
1186
  }
1183
1187
  //#endregion
1184
1188
  //#region src/actions/documentProject.ts
1185
1189
  async function Yn(t = "MIT", n = !1) {
1186
1190
  try {
1187
- let r = await T("config.json"), i = m(r.id).typeId === "connector";
1188
- await At(), i && await Re(), await pn(), await rt(t), await e("bundle-analysis-reports/sonda/index.json") === null ? E(`ℹ️ Bundle sizes NOT documented, as there is no '${yn}' yet. Build the project first.`) : await An({ moduleLevel: n }), await Kt(), await ze();
1191
+ let r = await C("config.json"), i = m(r.id).typeId === "connector";
1192
+ await Nt(), i && await Ve(), await mn(), await st(t), await e("bundle-analysis-reports/sonda/index.json") === null ? w(`ℹ️ Bundle sizes NOT documented, as there is no '${J}' yet. Build the project first.`) : await An({ moduleLevel: n }), await qt(), await He();
1189
1193
  let a = await e(q) !== null;
1190
- a ? await vn() : E(`ℹ️ '${q}' NOT required by this project`), await o("ℹ️ Format generated files", "prettier", [
1194
+ a ? await yn() : w(`ℹ️ '${q}' NOT required by this project`), await o("ℹ️ Format generated files", "prettier", [
1191
1195
  "--write",
1192
1196
  "README.md",
1193
1197
  ...a ? [q] : []
@@ -1210,9 +1214,9 @@ async function Xn() {
1210
1214
  "app",
1211
1215
  "src",
1212
1216
  "tests"
1213
- ].filter((e) => ae(e)).map((e) => `${e}/**`)
1217
+ ].filter((e) => se(e)).map((e) => `${e}/**`)
1214
1218
  ];
1215
- await o("1️⃣ Format", "prettier", e), C("Code formatted");
1219
+ await o("1️⃣ Format", "prettier", e), x("Code formatted");
1216
1220
  } catch (e) {
1217
1221
  console.error("❌ Error formatting code", e), process.exit(1);
1218
1222
  }
@@ -1221,7 +1225,7 @@ async function Xn() {
1221
1225
  //#region src/actions/lintCode.ts
1222
1226
  async function Zn() {
1223
1227
  try {
1224
- s("Lint Code"), await o("1️⃣ Lint", "eslint", ["."]), C("Code linted");
1228
+ s("Lint Code"), await o("1️⃣ Lint", "eslint", ["."]), x("Code linted");
1225
1229
  } catch (e) {
1226
1230
  console.error("❌ Error linting code", e), process.exit(1);
1227
1231
  }
@@ -1229,7 +1233,7 @@ async function Zn() {
1229
1233
  //#endregion
1230
1234
  //#region src/utilities/cloudflare.ts
1231
1235
  async function Qn() {
1232
- let e = await T("config.json"), t = {
1236
+ let e = await C("config.json"), t = {
1233
1237
  body: JSON.stringify(e),
1234
1238
  headers: { "Content-Type": "application/json" },
1235
1239
  method: "PUT"
@@ -1289,31 +1293,31 @@ async function tr(e, t) {
1289
1293
  async function nr() {
1290
1294
  try {
1291
1295
  s("Publish Project");
1292
- let e = await T("package.json"), t = await T("config.json"), n = m(t.id);
1293
- n.publishedTo === "npm" ? await o("1️⃣ Publish to npm", "npm", ["publish", "--provenance"]) : E("1️⃣ Publishing to npm NOT required"), await $("2️⃣ ", e, t, n), n.publishedTo === "kb" && await o("3️⃣ Deploy", "npm", ["run", "deploy"]), C(`Project version '${e.version ?? "unknown"}' published.`);
1296
+ let e = await C("package.json"), t = await C("config.json"), n = m(t.id);
1297
+ n.publishedTo === "npm" ? await o("1️⃣ Publish to npm", "npm", ["publish", "--provenance"]) : w("1️⃣ Publishing to npm NOT required"), await rr("2️⃣ ", e, t, n), n.publishedTo === "kb" && await o("3️⃣ Deploy", "npm", ["run", "deploy"]), x(`Project version '${e.version ?? "unknown"}' published.`);
1294
1298
  } catch (e) {
1295
1299
  console.error("❌ Error publishing project", e), process.exit(1);
1296
1300
  }
1297
1301
  }
1298
- async function $(e, t, n, r) {
1299
- if (r.typeId === "app") E(`${e} Register module`), await Qn();
1300
- else if (r.typeId === "engine") E(`${e} Register module`), await tr(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await er(n);
1301
- else if (r.uploadGroupName === void 0) E(`${e} Registration NOT required`);
1302
+ async function rr(e, t, n, r) {
1303
+ if (r.typeId === "app") w(`${e} Register module`), await Qn();
1304
+ else if (r.typeId === "engine") w(`${e} Register module`), await tr(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await er(n);
1305
+ else if (r.uploadGroupName === void 0) w(`${e} Registration NOT required`);
1302
1306
  else {
1303
- E(`${e} Register module`);
1307
+ w(`${e} Register module`);
1304
1308
  let i = n.id.split("-").slice(2).join("-");
1305
1309
  await tr(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await er(n);
1306
1310
  }
1307
1311
  }
1308
1312
  //#endregion
1309
1313
  //#region src/actions/releaseProject.ts
1310
- async function rr(e = "MIT", t = !1) {
1314
+ async function ir(e = "MIT", t = !1) {
1311
1315
  try {
1312
1316
  s("Release Project");
1313
- let n = await T("package.json"), r = await T("config.json"), i = m(r.id);
1317
+ let n = await C("package.json"), r = await C("config.json"), i = m(r.id);
1314
1318
  await d("1️⃣ ", n);
1315
- let a = await S("2️⃣ ", n, i);
1316
- if (await be("3️⃣ ", n), E("4️⃣ Regenerate README"), await Yn(e, t), await b("5️⃣ Stage changes", "git", ["add", "."]), await b("6️⃣ Commit changes", "git", [
1319
+ let a = await ae("2️⃣ ", n, i);
1320
+ if (await Se("3️⃣ ", n), w("4️⃣ Regenerate README"), await Yn(e, t), await b("5️⃣ Stage changes", "git", ["add", "."]), await b("6️⃣ Commit changes", "git", [
1317
1321
  "commit",
1318
1322
  "-m",
1319
1323
  `v${n.version ?? "unknown"}`
@@ -1321,7 +1325,7 @@ async function rr(e = "MIT", t = !1) {
1321
1325
  "push",
1322
1326
  "origin",
1323
1327
  "main:main"
1324
- ]), await $("8️⃣ ", n, a, i), i.publishedTo === "npm") {
1328
+ ]), await rr("8️⃣ ", n, a, i), i.publishedTo === "npm") {
1325
1329
  let e = `v${n.version ?? "unknown"}`;
1326
1330
  await o("9️⃣ Trigger GitHub release", "gh", [
1327
1331
  "release",
@@ -1332,19 +1336,19 @@ async function rr(e = "MIT", t = !1) {
1332
1336
  "--generate-notes",
1333
1337
  "--latest"
1334
1338
  ]);
1335
- } else E(`9️⃣ Publishing NOT required for package with type identifier of '${i.typeId}'.`);
1336
- C(`Project version '${n.version ?? "unknown"}' released.`);
1339
+ } else w(`9️⃣ Publishing NOT required for package with type identifier of '${i.typeId}'.`);
1340
+ x(`Project version '${n.version ?? "unknown"}' released.`);
1337
1341
  } catch (e) {
1338
1342
  console.error("❌ Error releasing project", e), process.exit(1);
1339
1343
  }
1340
1344
  }
1341
1345
  //#endregion
1342
1346
  //#region src/actions/syncProjectWithGitHub.ts
1343
- async function ir() {
1347
+ async function ar() {
1344
1348
  try {
1345
1349
  s("Synchronise Project with GitHub");
1346
- let e = await T("package.json"), t = await T("config.json"), n = m(t.id);
1347
- await d("1️⃣ ", e), await S("2️⃣ ", e, n), await b("3️⃣ Stage changes", "git", ["add", "."]), await b("4️⃣ Commit changes", "git", [
1350
+ let e = await C("package.json"), t = await C("config.json"), n = m(t.id);
1351
+ await d("1️⃣ ", e), await ae("2️⃣ ", e, n), await b("3️⃣ Stage changes", "git", ["add", "."]), await b("4️⃣ Commit changes", "git", [
1348
1352
  "commit",
1349
1353
  "-m",
1350
1354
  `v${e.version ?? "unknown"}`
@@ -1352,19 +1356,19 @@ async function ir() {
1352
1356
  "push",
1353
1357
  "origin",
1354
1358
  "main:main"
1355
- ]), C(`Project version '${e.version ?? "unknown"}' synchronised with GitHub.`);
1359
+ ]), x(`Project version '${e.version ?? "unknown"}' synchronised with GitHub.`);
1356
1360
  } catch (e) {
1357
1361
  console.error("❌ Error synchronising project with GitHub", e), process.exit(1);
1358
1362
  }
1359
1363
  }
1360
1364
  //#endregion
1361
1365
  //#region src/actions/testProject.ts
1362
- var ar = [
1366
+ var or = [
1363
1367
  "1️⃣ ",
1364
1368
  "2️⃣ ",
1365
1369
  "3️⃣ ",
1366
1370
  "4️⃣ "
1367
- ], or = [{
1371
+ ], sr = [{
1368
1372
  id: "unit",
1369
1373
  label: "Run unit tests",
1370
1374
  command: "vitest",
@@ -1377,30 +1381,30 @@ var ar = [
1377
1381
  arguments: ["test", "--pass-with-no-tests"],
1378
1382
  configFileName: "playwright.config.ts"
1379
1383
  }];
1380
- async function sr(t = ["unit"]) {
1384
+ async function cr(t = ["unit"]) {
1381
1385
  try {
1382
1386
  s("Test Project");
1383
1387
  let n = 0;
1384
- for (let r of or) {
1388
+ for (let r of sr) {
1385
1389
  if (!t.includes(r.id) || await e(r.configFileName) === null) continue;
1386
- let i = `${ar[n] ?? ""} ${r.label}`;
1390
+ let i = `${or[n] ?? ""} ${r.label}`;
1387
1391
  await o(i, r.command, r.arguments), n += 1;
1388
1392
  }
1389
1393
  if (n === 0) {
1390
1394
  console.warn("\n⚠️ No tests configured for this project.\n");
1391
1395
  return;
1392
1396
  }
1393
- C("Project tested");
1397
+ x("Project tested");
1394
1398
  } catch (e) {
1395
1399
  console.error("❌ Error testing project", e), process.exit(1);
1396
1400
  }
1397
1401
  }
1398
1402
  //#endregion
1399
1403
  //#region src/actions/triggerGitHubRelease.ts
1400
- async function cr() {
1404
+ async function lr() {
1401
1405
  try {
1402
1406
  s("Trigger GitHub Release");
1403
- let e = `v${(await T("package.json")).version ?? "unknown"}`;
1407
+ let e = `v${(await C("package.json")).version ?? "unknown"}`;
1404
1408
  await o("1️⃣ Trigger GitHub release", "gh", [
1405
1409
  "release",
1406
1410
  "create",
@@ -1409,10 +1413,10 @@ async function cr() {
1409
1413
  "main",
1410
1414
  "--generate-notes",
1411
1415
  "--latest"
1412
- ]), C(`GitHub release '${e}' created.`);
1416
+ ]), x(`GitHub release '${e}' created.`);
1413
1417
  } catch (e) {
1414
1418
  console.error("❌ Error triggering GitHub release", e), process.exit(1);
1415
1419
  }
1416
1420
  }
1417
1421
  //#endregion
1418
- export { he as auditDependencies, ye as buildProject, Me as checkProject, Yn as documentProject, Xn as formatCode, Zn as lintCode, nr as publishProject, rr as releaseProject, ir as syncProjectWithGitHub, sr as testProject, cr as triggerGitHubRelease, $n as uploadDirectoryToR2 };
1422
+ export { _e as auditDependencies, xe as buildProject, Fe as checkProject, Yn as documentProject, Xn as formatCode, Zn as lintCode, nr as publishProject, ir as releaseProject, ar as syncProjectWithGitHub, cr as testProject, lr as triggerGitHubRelease, $n as uploadDirectoryToR2 };