@dpuse/dpuse-development 1.0.110 → 1.0.112

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