@dpuse/dpuse-development 0.3.814 → 0.3.816

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,16 @@
1
- import { A as e, C as t, D as n, E as r, S as i, T as a, _ as o, a as s, b as c, c as l, d as u, f as d, g as f, h as p, i as m, k as h, l as g, m as _, n as ee, o as te, p as v, r as ne, s as re, t as ie, u as y, v as b, w as x, x as S, y as C } from "./utilities-CQ2h3IWL.js";
1
+ import { A as e, C as t, D as n, E as r, S as i, T as a, _ as o, a as s, b as c, c as l, d as u, f as d, g as f, h as p, i as m, k as h, l as g, m as _, n as ee, o as te, p as v, r as y, s as ne, t as re, u as ie, v as b, w as x, x as S, y as C } from "./utilities-CQ2h3IWL.js";
2
2
  import { SHIPPED_PACKAGES_FILE_NAME as ae } from "./vite.es.js";
3
- import { existsSync as oe } from "node:fs";
4
- import w from "node:path";
3
+ import { existsSync as oe, promises as w } from "node:fs";
4
+ import T from "node:path";
5
5
  import { promisify as se } from "node:util";
6
6
  import { execFile as ce } from "node:child_process";
7
7
  import { fileURLToPath as le } from "node:url";
8
8
  import { run as ue } from "npm-check-updates";
9
9
  import { init as de } from "license-checker-rseidelsohn";
10
+ import { setTimeout as fe } from "node:timers/promises";
11
+ import pe from "spdx-satisfies";
10
12
  //#region src/actions/auditDependencies.ts
11
- async function fe() {
13
+ async function me() {
12
14
  try {
13
15
  f("Audit Dependencies"), await x("1️⃣ Check shipped dependencies for any vulnerability", "npm", ["audit", "--omit=dev"]), await x("2️⃣ Check all dependencies for high or critical vulnerabilities", "npm", ["audit", "--audit-level=high"]), o("Dependencies audited");
14
16
  } catch (e) {
@@ -17,43 +19,43 @@ async function fe() {
17
19
  }
18
20
  //#endregion
19
21
  //#region src/actions/buildProject.ts
20
- var pe = "build:wasm";
21
- async function me() {
22
+ var he = "build:wasm";
23
+ async function ge() {
22
24
  try {
23
- f("Build Project"), await he("1️⃣ ", await c("package.json")), o("Project built");
25
+ f("Build Project"), await _e("1️⃣ ", await c("package.json")), o("Project built");
24
26
  } catch (e) {
25
27
  console.error("❌ Error building project", e), process.exit(1);
26
28
  }
27
29
  }
28
- async function he(e, t) {
29
- t.scripts?.[pe] != null && await x(`${e} Build WebAssembly`, "npm", ["run", pe]), await x(`${e} Bundle project`, "vite", ["build"]);
30
+ async function _e(e, t) {
31
+ t.scripts?.[he] != null && await x(`${e} Build WebAssembly`, "npm", ["run", he]), await x(`${e} Bundle project`, "vite", ["build"]);
30
32
  }
31
33
  //#endregion
32
34
  //#region src/actions/checkConfigFiles.ts
33
- var T = "@dpuse/dpuse-development/prettierrc", ge = "dpuse-development";
34
- async function _e() {
35
+ var E = "@dpuse/dpuse-development/prettierrc", ve = "dpuse-development";
36
+ async function ye() {
35
37
  try {
36
38
  f("Check configuration files"), b("1️⃣ Check individual files");
37
- let e = await c("config.json"), t = await c("package.json"), n = t.private === !0, r = _(e.id), a = w.dirname(le(import.meta.url));
38
- await E(a, ".editorconfig"), await E(a, ".gitattributes"), await E(a, ".gitignore", [".gitignore_default"]), await E(a, ".markdownlint.json"), await E(a, ".ncurc.json"), await ve(r, a), await E(a, "LICENSE"), await be(r, a), await xe(r, a), await Se(r, a), await we(r, a), ye(r, t);
39
+ let e = await c("config.json"), t = await c("package.json"), n = t.private === !0, r = _(e.id), a = T.dirname(le(import.meta.url));
40
+ 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 be(r, a), await D(a, "LICENSE"), await Se(r, a), await Ce(r, a), await we(r, a), await Ee(r, a), xe(r, t);
39
41
  let s = await i(l) !== null;
40
- s && await E(a, "rust-toolchain.toml"), await E(a, ".github/dependabot.yml", [`.github/dependabot${n ? ".private" : ""}${s ? ".rust" : ""}.yml`]), n ? console.info("ℹ️ GitHub workflows and file 'SECURITY.md' are NOT required by this project") : (await Ce(a), await E(a, "SECURITY.md", [], (t) => t.replaceAll(ge, () => e.id))), o("Configuration files checked");
42
+ s && await D(a, "rust-toolchain.toml"), await D(a, ".github/dependabot.yml", [`.github/dependabot${n ? ".private" : ""}${s ? ".rust" : ""}.yml`]), n ? console.info("ℹ️ GitHub workflows and file 'SECURITY.md' are NOT required by this project") : (await Te(a), await D(a, "SECURITY.md", [], (t) => t.replaceAll(ve, () => e.id))), o("Configuration files checked");
41
43
  } catch (e) {
42
44
  console.error("❌ Error checking configuration files", e), process.exit(1);
43
45
  }
44
46
  }
45
- async function ve(e, t) {
47
+ async function be(e, t) {
46
48
  ["github", "kb"].includes(e.typeId) ? console.info("ℹ️ File 'eslint.config.js' is NOT required by this project") : [
47
49
  "app",
48
50
  "api",
49
51
  "development",
50
52
  "eslint"
51
- ].includes(e.typeId) ? console.info("⚠️ File 'eslint.config.js' is UNIQUE to this project") : await E(t, "eslint.config.js", ["eslint.config.default.js"]);
53
+ ].includes(e.typeId) ? console.info("⚠️ File 'eslint.config.js' is UNIQUE to this project") : await D(t, "eslint.config.js", ["eslint.config.default.js"]);
52
54
  }
53
- function ye(e, t) {
54
- 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 === T ? console.info(`ℹ️ Prettier configuration is '${T}'`) : console.info(`❌ Prettier configuration is NOT '${T}'`);
55
+ function xe(e, t) {
56
+ 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}'`);
55
57
  }
56
- async function be(e, t) {
58
+ async function Se(e, t) {
57
59
  ["github"].includes(e.typeId) ? console.info("ℹ️ File 'tsconfig.json' is NOT required by this project") : [
58
60
  "connector",
59
61
  "cookbook",
@@ -62,12 +64,12 @@ async function be(e, t) {
62
64
  "presenter",
63
65
  "shared",
64
66
  "tool"
65
- ].includes(e.typeId) ? await E(t, "tsconfig.json") : console.info("⚠️ File 'tsconfig.json' is UNIQUE to this project");
67
+ ].includes(e.typeId) ? await D(t, "tsconfig.json") : console.info("⚠️ File 'tsconfig.json' is UNIQUE to this project");
66
68
  }
67
- async function xe(e, t) {
68
- ["github"].includes(e.typeId) ? console.info("ℹ️ File 'scripts/tsconfig.json' is NOT required by this project") : await E(t, "scripts/tsconfig.json");
69
+ async function Ce(e, t) {
70
+ ["github"].includes(e.typeId) ? console.info("ℹ️ File 'scripts/tsconfig.json' is NOT required by this project") : await D(t, "scripts/tsconfig.json");
69
71
  }
70
- async function Se(e, t) {
72
+ async function we(e, t) {
71
73
  if ([
72
74
  "eslint",
73
75
  "github",
@@ -90,23 +92,23 @@ async function Se(e, t) {
90
92
  break;
91
93
  default: n = ["vite.config.default.ts"];
92
94
  }
93
- await E(t, "vite.config.ts", n);
95
+ await D(t, "vite.config.ts", n);
94
96
  }
95
97
  }
96
- async function Ce(e) {
97
- await E(e, ".github/workflows/ci.yml"), await E(e, ".github/workflows/codeql.yml"), await E(e, ".github/workflows/publish.yml"), await E(e, ".github/workflows/scorecard.yml");
98
+ async function Te(e) {
99
+ 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");
98
100
  }
99
- async function we(e, t) {
101
+ async function Ee(e, t) {
100
102
  [
101
103
  "app",
102
104
  "api",
103
105
  "eslint",
104
106
  "github",
105
107
  "kb"
106
- ].includes(e.typeId) ? console.info("ℹ️ File 'vitest.config.ts' is NOT required by this project") : await E(t, "vitest.config.ts");
108
+ ].includes(e.typeId) ? console.info("ℹ️ File 'vitest.config.ts' is NOT required by this project") : await D(t, "vitest.config.ts");
107
109
  }
108
- async function E(e, t, n = [], r = (e) => e) {
109
- let i = w.resolve(process.cwd(), t), a = n.length > 0 ? n : [t], o;
110
+ async function D(e, t, n = [], r = (e) => e) {
111
+ let i = T.resolve(process.cwd(), t), a = n.length > 0 ? n : [t], o;
110
112
  try {
111
113
  o = await S(i);
112
114
  } catch (e) {
@@ -117,7 +119,7 @@ async function E(e, t, n = [], r = (e) => e) {
117
119
  return;
118
120
  }
119
121
  for (let n of a) {
120
- let i = w.resolve(e, `../${n}`), a = r(await S(i));
122
+ let i = T.resolve(e, `../${n}`), a = r(await S(i));
121
123
  if (o === a) {
122
124
  console.info(`ℹ️ File '${t}' is the same as '${n}'`);
123
125
  return;
@@ -127,12 +129,12 @@ async function E(e, t, n = [], r = (e) => e) {
127
129
  }
128
130
  //#endregion
129
131
  //#region src/actions/checkDependencies.ts
130
- async function Te() {
132
+ async function De() {
131
133
  try {
132
134
  f("Check Dependencies"), await x("1️⃣ Check using 'npm outdated'", "npm", ["outdated"], !0), b("2️⃣ Check using 'npm-check-updates'");
133
135
  let e = {};
134
136
  try {
135
- e = await c(w.resolve(process.cwd(), ".ncurc.json"));
137
+ e = await c(T.resolve(process.cwd(), ".ncurc.json"));
136
138
  } catch (e) {
137
139
  if (e.code !== "ENOENT") throw e;
138
140
  }
@@ -154,7 +156,7 @@ async function Te() {
154
156
  "--no-strict-allow-scripts",
155
157
  "--no-fund"
156
158
  ], !0);
157
- let t = await Ee();
159
+ let t = await Oe();
158
160
  t.length > 0 ? await x("5️⃣ Move install-script pins to installed versions", "npm", [
159
161
  "install-scripts",
160
162
  "approve",
@@ -173,56 +175,56 @@ async function Te() {
173
175
  console.error("❌ Error checking dependencies", e), process.exit(1);
174
176
  }
175
177
  }
176
- async function Ee() {
177
- let { allowScripts: e = {} } = await c(w.resolve(process.cwd(), "package.json")), t = Object.entries(e).filter(([e, t]) => t && e.lastIndexOf("@") > 0).map(([e]) => e.slice(0, e.lastIndexOf("@")));
178
+ async function Oe() {
179
+ let { allowScripts: e = {} } = await c(T.resolve(process.cwd(), "package.json")), t = Object.entries(e).filter(([e, t]) => t && e.lastIndexOf("@") > 0).map(([e]) => e.slice(0, e.lastIndexOf("@")));
178
180
  return [...new Set(t)];
179
181
  }
180
182
  //#endregion
181
183
  //#region src/actions/checkProject.ts
182
- async function De() {
183
- await _e(), await Te();
184
+ async function ke() {
185
+ await ye(), await De();
184
186
  }
185
187
  //#endregion
186
188
  //#region src/actions/documentActions.ts
187
- var Oe = "<!-- SUPPORTED_ACTIONS_START -->", ke = "<!-- SUPPORTED_ACTIONS_END -->", Ae = "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.", je = {
189
+ var Ae = "<!-- SUPPORTED_ACTIONS_START -->", je = "<!-- SUPPORTED_ACTIONS_END -->", Me = "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.", Ne = {
188
190
  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.",
189
191
  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.",
190
192
  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.",
191
193
  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."
192
- }, Me = "The table below lists all connector actions and highlights those supported by this connector.";
193
- async function Ne() {
194
+ }, Pe = "The table below lists all connector actions and highlights those supported by this connector.";
195
+ async function Fe() {
194
196
  try {
195
197
  f("Document Actions"), b("1️⃣ Insert actions description and table into 'README.md'");
196
- let t = (await c("config.json")).actionNames ?? [], r = h(t), i = e(t), a = `## Supported Actions\n\n${Ae}\n\n${je[r]} ${Me}\n\n${i}`;
197
- await n(a, Oe, ke), o("Actions documented");
198
+ let t = (await c("config.json")).actionNames ?? [], r = h(t), i = e(t), a = `## Supported Actions\n\n${Me}\n\n${Ne[r]} ${Pe}\n\n${i}`;
199
+ await n(a, Ae, je), o("Actions documented");
198
200
  } catch (e) {
199
201
  console.error("❌ Error documenting actions", e), process.exit(1);
200
202
  }
201
203
  }
202
204
  //#endregion
203
205
  //#region src/actions/documentContributingLicense.ts
204
- async function Pe() {
206
+ async function Ie() {
205
207
  try {
206
208
  f("Document Contributing & License");
207
- let [e, r] = await Promise.all([c("package.json"), c("config.json")]), { owner: i, repo: a } = t(e, "document contributing and license"), s = Fe(e), l = Ie(r.firstCreatedAt);
208
- b("1️⃣ Insert contributing and license content into 'README.md'"), await C(), await n(Le(i, a, s, l), ee, ie), o("Contributing & license documented");
209
+ let [e, r] = await Promise.all([c("package.json"), c("config.json")]), { owner: i, repo: a } = t(e, "document contributing and license"), s = Le(e), l = Re(r.firstCreatedAt);
210
+ b("1️⃣ Insert contributing and license content into 'README.md'"), await C(), await n(ze(i, a, s, l), ee, re), o("Contributing & license documented");
209
211
  } catch (e) {
210
212
  console.error("❌ Error documenting contributing and license", e), process.exit(1);
211
213
  }
212
214
  }
213
- function Fe(e) {
215
+ function Le(e) {
214
216
  let t = e.author, n = typeof t == "string" ? t : t?.name;
215
217
  if (n == null || n === "") throw Error("package.json 'author' field is required to document contributing and license.");
216
218
  let r = n.indexOf("<"), i = r === -1 ? -1 : n.indexOf(">", r);
217
219
  return i === -1 ? n.trim() : [n.slice(0, r).trim(), n.slice(i + 1).trim()].filter((e) => e !== "").join(" ");
218
220
  }
219
- function Ie(e) {
221
+ function Re(e) {
220
222
  let t = (/* @__PURE__ */ new Date()).getFullYear();
221
223
  if (e == null) return String(t);
222
224
  let n = new Date(e).getFullYear();
223
225
  return n === t ? String(t) : `${String(n)}-present`;
224
226
  }
225
- function Le(e, t, n, r) {
227
+ function ze(e, t, n, r) {
226
228
  return `## Contributing
227
229
 
228
230
  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.
@@ -236,82 +238,227 @@ This project is licensed under the MIT License, permitting free use, modificatio
236
238
  [MIT](./LICENSE) © ${r} ${n}`;
237
239
  }
238
240
  //#endregion
241
+ //#region src/utilities/rustCrates.ts
242
+ var O = "licenses/cargoMetadata.json", k = "licenses/cargoTree.txt", Be = 1e3, Ve = "dpuse-development (https://github.com/dpuse/dpuse-development)", He = /^(?:copying|licen[cs]e|unlicense)/i, A = "wasm32-unknown-unknown";
243
+ async function Ue(e, t) {
244
+ if (await i("rust/Cargo.toml") === null) return null;
245
+ let n = [
246
+ "--manifest-path",
247
+ l,
248
+ "--locked"
249
+ ], r = [
250
+ "tree",
251
+ ...n,
252
+ "--workspace",
253
+ "--edges",
254
+ "normal,no-proc-macro",
255
+ "--target",
256
+ A,
257
+ "--prefix",
258
+ "depth",
259
+ "--format",
260
+ "{p}|{l}|{r}"
261
+ ];
262
+ await a(e, "cargo", r, k), await a(e, "cargo", [
263
+ "metadata",
264
+ ...n,
265
+ "--format-version",
266
+ "1",
267
+ "--filter-platform",
268
+ A
269
+ ], O);
270
+ let o = We(await S(k)), s = await c(O);
271
+ await w.rm(k, { force: !0 }), await w.rm(O, { force: !0 });
272
+ let u = /* @__PURE__ */ new Map();
273
+ for (let e of o) e.isOwn || u.has(`${e.name}@${e.version}`) || u.set(`${e.name}@${e.version}`, {
274
+ name: e.name,
275
+ version: e.version,
276
+ licenseExpression: e.licenseExpression,
277
+ repository: e.repository === "" ? `https://crates.io/crates/${e.name}` : e.repository,
278
+ licenseFiles: [],
279
+ publishedDate: "",
280
+ latestVersion: "",
281
+ latestPublishedDate: ""
282
+ });
283
+ let d = u.values().toArray();
284
+ Ge(d, t);
285
+ for (let e of d) e.licenseFiles = await Je(e, s);
286
+ return await Ye(d), {
287
+ crates: d,
288
+ treeItems: o.map(({ name: e, version: t, depth: n, isOwn: r }) => ({
289
+ name: e,
290
+ version: t,
291
+ depth: n,
292
+ isOwn: r
293
+ }))
294
+ };
295
+ }
296
+ function We(e) {
297
+ let t = [];
298
+ for (let n of e.split("\n")) {
299
+ let [e = "", r = "", i = ""] = n.trim().split("|", 3), a = /^\d+/.exec(e)?.[0];
300
+ if (a === void 0) continue;
301
+ let [o = "", s = "", ...c] = e.slice(a.length).split(" "), l = c.join(" ").replace(/^\(/, "").replace(/\)$/, ""), u = l !== "" && !l.includes("://"), d = i.replace(/ \(\*\)$/, "");
302
+ t.push({
303
+ name: o,
304
+ version: s.replace(/^v/, ""),
305
+ depth: Number(a),
306
+ isOwn: u,
307
+ licenseExpression: r,
308
+ repository: d
309
+ });
310
+ }
311
+ return t;
312
+ }
313
+ function Ge(e, t) {
314
+ let n = t.split(";").filter((e) => Ke(e)), r = e.filter((e) => !qe(e.licenseExpression, n));
315
+ if (r.length === 0) return;
316
+ let i = r.map((e) => `${e.name}@${e.version} (${e.licenseExpression === "" ? "no licence" : e.licenseExpression})`).join(", ");
317
+ throw Error(`Rust crates with licences not allowed: ${i}.`);
318
+ }
319
+ function Ke(e) {
320
+ try {
321
+ return pe(e, [e]);
322
+ } catch {
323
+ return !1;
324
+ }
325
+ }
326
+ function qe(e, t) {
327
+ try {
328
+ return pe(e.replaceAll("/", " OR "), t);
329
+ } catch {
330
+ return !1;
331
+ }
332
+ }
333
+ async function Je(e, t) {
334
+ let n = t.packages.find((t) => t.name === e.name && t.version === e.version);
335
+ if (n == null) return [];
336
+ let r = T.dirname(n.manifest_path), i = (await w.readdir(r)).filter((e) => He.test(e)).toSorted((e, t) => e.localeCompare(t, "en"));
337
+ await w.mkdir("licenses/downloads", { recursive: !0 });
338
+ let a = [];
339
+ for (let t of i) {
340
+ let n = `downloads/${e.name}@${e.version}-${t}`;
341
+ await w.copyFile(T.join(r, t), T.join("licenses", n)), a.push({
342
+ label: t,
343
+ path: n
344
+ });
345
+ }
346
+ return a;
347
+ }
348
+ async function Ye(e) {
349
+ for (let [t, n] of e.entries()) {
350
+ t > 0 && await fe(Be);
351
+ try {
352
+ let e = await fetch(`https://crates.io/api/v1/crates/${encodeURIComponent(n.name)}`, { headers: { "User-Agent": Ve } });
353
+ if (!e.ok) continue;
354
+ let t = await e.json(), r = new Map((t.versions ?? []).map((e) => [e.num, e.created_at]));
355
+ n.latestVersion = t.crate?.max_stable_version ?? t.crate?.max_version ?? "", n.publishedDate = r.get(n.version) ?? "", n.latestPublishedDate = n.latestVersion === n.version ? "" : r.get(n.latestVersion) ?? "";
356
+ } catch {}
357
+ }
358
+ }
359
+ //#endregion
239
360
  //#region src/actions/documentDependencies.ts
240
- var D = "<!-- DEPENDENCY_LICENSES_START -->", O = "<!-- DEPENDENCY_LICENSES_END -->", k = "## Dependency Licenses", Re = `bundle-analysis-reports/${ae}`, A = "licenses/licenseTree.json", j = "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.", ze = `The dependency tree below lists every package in this project — direct and transitive — along with its installed version, release date, and update status. ${j}`, Be = `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. ${j}`;
241
- async function Ve(e = "MIT") {
361
+ var j = "<!-- DEPENDENCY_LICENSES_START -->", M = "<!-- DEPENDENCY_LICENSES_END -->", N = "## Dependency Licenses", Xe = `bundle-analysis-reports/${ae}`, P = "licenses/licenseTree.json", F = "Packages flagged ❗ have a newer version available; ⚠️ indicates a package that hasn't been updated in the last 6 months or longer. Neither flag necessarily indicates a problem: we let new releases stabilise before upgrading, and some packages are mature and stable (have limited or no dependencies), so they require no active development.", Ze = `The dependency tree below lists every package in this project — direct and transitive — along with its installed version, release date, and update status. ${F}`, Qe = `The dependency tree below shows how each package in the table above is reached — direct and transitive — along with its installed version, release date, and update status. A package that does not ship itself, such as one whose parts are bundled separately, is left out and what ships beneath it is shown in its place. ${F}`;
362
+ async function $e(e = "MIT") {
242
363
  try {
243
364
  f("Document Dependencies");
244
365
  let t = await c("package.json");
245
366
  if (t.name === "@dpuse/dpuse-development" || t.name === "@dpuse/eslint-config-dpuse") {
246
- await He(t.name), o("Dependencies documented");
367
+ await et(t.name), o("Dependencies documented");
247
368
  return;
248
369
  }
249
370
  await u("1️⃣ Clear downloaded licenses", "licenses/downloads");
250
- let n = await Ke(), r = await qe();
371
+ let n = await ot(), r = await st();
251
372
  if (r === null) {
252
- let r = Ze(n);
253
- await N("2️⃣ Identify production licenses", e, [t.name ?? "", ...r], !0), await a("3️⃣ Identify transitive dependencies", "npm", [
373
+ let r = dt(n);
374
+ await L("2️⃣ Identify production licenses", e, [t.name ?? "", ...r], !0), await a("3️⃣ Identify transitive dependencies", "npm", [
254
375
  "ls",
255
376
  "--all",
256
377
  "--json",
257
378
  "--omit=dev"
258
- ], A), await Ue("4️⃣ ", e, new Set(r));
379
+ ], P), await tt("4️⃣ ", e, new Set(r));
259
380
  } else {
260
- let i = Je(r, n), o = Ye(n), s = o.filter((e) => !i.has(e));
261
- await N("2️⃣ Identify shipped licenses", e, [t.name ?? "", ...s], !1), Xe(i, new Set(o)), await a("3️⃣ Identify transitive dependencies", "npm", [
381
+ let i = ct(r, n), o = lt(n), s = o.filter((e) => !i.has(e));
382
+ await L("2️⃣ Identify shipped licenses", e, [t.name ?? "", ...s], !1), ut(i, new Set(o)), await a("3️⃣ Identify transitive dependencies", "npm", [
262
383
  "ls",
263
384
  "--all",
264
385
  "--json"
265
- ], A, !0), await We("4️⃣ ", e, i, Ge(t));
386
+ ], P, !0);
387
+ let c = await Ue("4️⃣ Identify Rust crates compiled into the WebAssembly", e), l = {
388
+ allowedLicenses: e,
389
+ productionNames: at(t),
390
+ rustCrates: c,
391
+ shippedKeys: i
392
+ };
393
+ await nt(c === null ? "4️⃣ " : "5️⃣ ", l);
266
394
  }
267
395
  o("Dependencies documented");
268
396
  } catch (e) {
269
397
  console.error("❌ Error documenting dependencies", e), process.exit(1);
270
398
  }
271
399
  }
272
- async function He(e) {
400
+ async function et(e) {
273
401
  b(`1️⃣ Skip: ${e} is a development-only tool and is never part of a production release.`);
274
402
  let t = `> [!WARNING]\n> Dependency licenses are not documented here: ${e} is a development-only tool and is never part of a production release.`;
275
- await n(`${k}\n\n${t}`, D, O);
403
+ await n(`${N}\n\n${t}`, j, M);
276
404
  }
277
- async function Ue(e, t, r) {
405
+ async function tt(e, t, r) {
278
406
  b(`${e} Insert licenses into 'README.md'`);
279
- let i = await c(A), a = await M(), o = `${L(t, !1)}\n\n|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|\n`;
280
- for (let e of a.values()) o += nt(e);
407
+ let i = await c(P), a = await I(), o = `${pt(t, !1)}\n\n|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|\n`;
408
+ for (let e of a.values()) o += _t(e);
281
409
  let s = [];
282
- i.dependencies != null && R(i.dependencies, a, r, s, 0);
283
- let l = `${ze}\n\n${s.join("\n")}`;
284
- await n(`${k}\n\n${o.trimEnd()}\n\n### Dependency Tree\n\n${l}`, D, O);
410
+ i.dependencies != null && vt(i.dependencies, a, r, s, 0);
411
+ let l = `${Ze}\n\n${s.join("\n")}`;
412
+ await n(`${N}\n\n${o.trimEnd()}\n\n### Dependency Tree\n\n${l}`, j, M);
285
413
  }
286
- async function We(e, t, r, i) {
414
+ async function nt(e, t) {
287
415
  b(`${e} Insert licenses into 'README.md'`);
288
- let a = await M(), o = a.values().toArray().toSorted((e, t) => e.name.localeCompare(t.name, "en") || e.installedVersion.localeCompare(t.installedVersion, "en")), s = `${L(t, !0)}\n\n|Dependency|Version|Release|License(s)|Document|\n|:-|:-:|:-|:-|:-|\n`;
289
- for (let e of o) s += rt(e);
290
- let l = await c(A), u = Object.entries(l.dependencies ?? {}).toSorted(([e], [t]) => Number(!i.has(e)) - Number(!i.has(t))), d = [];
291
- z(u, {
292
- licensesByKey: a,
293
- shippedKeys: r,
416
+ let { allowedLicenses: r, productionNames: i, rustCrates: a, shippedKeys: o } = t, s = await I(), l = new Map((a?.crates ?? []).map((e) => [`${e.name}@${e.version}`, rt(e)])), u = [...s.values(), ...l.values()].toSorted((e, t) => e.name.localeCompare(t.name, "en") || e.installedVersion.localeCompare(t.installedVersion, "en")), d = `${pt(r, !0, a !== null)}\n\n|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|\n`;
417
+ for (let e of u) d += _t(e);
418
+ let f = await c(P), p = Object.entries(f.dependencies ?? {}).toSorted(([e], [t]) => Number(!i.has(e)) - Number(!i.has(t))), m = [];
419
+ V(p, {
420
+ licensesByKey: s,
421
+ shippedKeys: o,
294
422
  shownKeys: /* @__PURE__ */ new Set()
295
- }, d, 0, !1);
296
- let f = `${Be}\n\n${d.join("\n")}`;
297
- await n(`${k}\n\n${s.trimEnd()}\n\n### Dependency Tree\n\n${f}`, D, O);
423
+ }, m, 0, !1);
424
+ let h = a?.treeItems ?? [];
425
+ for (let e of h) m.push(it(e, l));
426
+ let g = `${Qe}\n\n${m.join("\n")}`;
427
+ await n(`${N}\n\n${d.trimEnd()}\n\n### Dependency Tree\n\n${g}`, j, M);
428
+ }
429
+ function rt(e) {
430
+ return {
431
+ name: e.name,
432
+ repository: e.repository,
433
+ licenseTypes: e.licenseExpression,
434
+ installedVersion: e.version,
435
+ latestVersion: e.latestVersion,
436
+ latestPublishedDate: e.latestPublishedDate,
437
+ author: "",
438
+ publishedDate: e.publishedDate,
439
+ licenseFiles: e.licenseFiles
440
+ };
441
+ }
442
+ function it(e, t) {
443
+ let n = " ".repeat(e.depth);
444
+ return e.isOwn ? `${n}- **${e.name}** ${e.version} — this project's Rust code, compiled into its WebAssembly` : H(e.name, e.version, t.get(`${e.name}@${e.version}`), n);
298
445
  }
299
- function Ge(e) {
446
+ function at(e) {
300
447
  return /* @__PURE__ */ new Set([
301
448
  ...Object.keys(e.dependencies ?? {}),
302
449
  ...Object.keys(e.optionalDependencies ?? {}),
303
450
  ...Object.keys(e.peerDependencies ?? {})
304
451
  ]);
305
452
  }
306
- async function M() {
453
+ async function I() {
307
454
  let e = await c("licenses/licenses.json"), t = /* @__PURE__ */ new Map();
308
- for (let [n, r] of Object.entries(e)) t.set(n, et(n, r));
455
+ for (let [n, r] of Object.entries(e)) t.set(n, ht(n, r));
309
456
  return await Promise.all(t.values().map(async (e) => {
310
- let t = await tt(e.name, e.installedVersion);
457
+ let t = await gt(e.name, e.installedVersion);
311
458
  e.latestVersion = t.latestVersion, e.latestPublishedDate = t.latestPublishedDate, e.publishedDate = t.publishedDate;
312
459
  })), t;
313
460
  }
314
- async function N(e, t, n, r) {
461
+ async function L(e, t, n, r) {
315
462
  b(e), await new Promise((e, i) => {
316
463
  let a = {
317
464
  start: process.cwd(),
@@ -329,58 +476,58 @@ async function N(e, t, n, r) {
329
476
  });
330
477
  });
331
478
  }
332
- async function Ke() {
479
+ async function ot() {
333
480
  let e = await i("package-lock.json");
334
481
  return e === null ? {} : JSON.parse(e).packages ?? {};
335
482
  }
336
- async function qe() {
337
- let e = await i(Re);
483
+ async function st() {
484
+ let e = await i(Xe);
338
485
  return e === null ? null : JSON.parse(e);
339
486
  }
340
- function Je(e, t) {
487
+ function ct(e, t) {
341
488
  let n = new Set(e.packages);
342
489
  for (let r of e.external) {
343
- let e = I(t, "", r);
344
- if (e !== void 0) for (let r of [e, ...F(t, e)]) {
490
+ let e = B(t, "", r);
491
+ if (e !== void 0) for (let r of [e, ...z(t, e)]) {
345
492
  let e = t[r];
346
- e?.version !== void 0 && n.add(P(r, e));
493
+ e?.version !== void 0 && n.add(R(r, e));
347
494
  }
348
495
  }
349
496
  return n;
350
497
  }
351
- function Ye(e) {
498
+ function lt(e) {
352
499
  let t = /* @__PURE__ */ new Set();
353
- for (let [n, r] of Object.entries(e)) n !== "" && r.version !== void 0 && t.add(P(n, r));
500
+ for (let [n, r] of Object.entries(e)) n !== "" && r.version !== void 0 && t.add(R(n, r));
354
501
  return [...t];
355
502
  }
356
- function Xe(e, t) {
503
+ function ut(e, t) {
357
504
  let n = [...e.difference(t)];
358
505
  n.length > 0 && console.warn(`⚠️ Not installed, so not checked; rebuild to refresh the record: ${n.join(", ")}`);
359
506
  }
360
- function P(e, t) {
507
+ function R(e, t) {
361
508
  return `${t.name ?? e.slice(e.lastIndexOf("node_modules/") + 13)}@${String(t.version)}`;
362
509
  }
363
- function Ze(e) {
364
- let t = F(e, ""), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
510
+ function dt(e) {
511
+ let t = z(e, ""), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
365
512
  for (let [i, a] of Object.entries(e)) {
366
513
  if (i === "" || a.version === void 0) continue;
367
- let e = P(i, a);
514
+ let e = R(i, a);
368
515
  t.has(i) ? n.add(e) : r.add(e);
369
516
  }
370
517
  return r.values().filter((e) => !n.has(e)).toArray();
371
518
  }
372
- function F(e, t) {
519
+ function z(e, t) {
373
520
  let n = /* @__PURE__ */ new Set(), r = [t];
374
521
  for (; r.length > 0;) {
375
522
  let t = r.pop() ?? "", i = e[t];
376
- if (i !== void 0) for (let a of Qe(i)) {
377
- let i = I(e, t, a);
523
+ if (i !== void 0) for (let a of ft(i)) {
524
+ let i = B(e, t, a);
378
525
  i === void 0 || n.has(i) || (n.add(i), r.push(i));
379
526
  }
380
527
  }
381
528
  return n;
382
529
  }
383
- function Qe(e) {
530
+ function ft(e) {
384
531
  let t = Object.keys(e.peerDependencies ?? {}).filter((t) => e.peerDependenciesMeta?.[t]?.optional !== !0);
385
532
  return [
386
533
  ...Object.keys(e.dependencies ?? {}),
@@ -388,7 +535,7 @@ function Qe(e) {
388
535
  ...t
389
536
  ];
390
537
  }
391
- function I(e, t, n) {
538
+ function B(e, t, n) {
392
539
  let r = t;
393
540
  for (;;) {
394
541
  let t = r === "" ? `node_modules/${n}` : `${r}/node_modules/${n}`, i = e[t];
@@ -398,14 +545,14 @@ function I(e, t, n) {
398
545
  r = a === -1 ? "" : r.slice(0, a);
399
546
  }
400
547
  }
401
- function L(e, t) {
402
- let n = $e(e.split(";"));
403
- return `License data is updated each time \`npm run document\` is run, using [license-checker](https://github.com/RSeidelsohn/license-checker-rseidelsohn). ${t ? "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." : "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 ${n}, 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.`;
548
+ function pt(e, t, n = !1) {
549
+ 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.";
550
+ 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.`;
404
551
  }
405
- function $e(e) {
552
+ function mt(e) {
406
553
  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))}`;
407
554
  }
408
- function et(e, t) {
555
+ function ht(e, t) {
409
556
  let n = e.lastIndexOf("@"), r = n > 0 ? e.slice(0, n) : e, i = n > 0 ? e.slice(n + 1) : "";
410
557
  return {
411
558
  name: r,
@@ -416,10 +563,13 @@ function et(e, t) {
416
563
  latestVersion: "",
417
564
  latestPublishedDate: "",
418
565
  publishedDate: "",
419
- ...t.licenseFile != null && { licenseFileLink: t.licenseFile }
566
+ licenseFiles: t.licenseFile == null ? [] : [{
567
+ label: "LICENSE",
568
+ path: t.licenseFile
569
+ }]
420
570
  };
421
571
  }
422
- async function tt(e, t) {
572
+ async function gt(e, t) {
423
573
  try {
424
574
  let n = await fetch(`https://registry.npmjs.org/${encodeURIComponent(e)}`);
425
575
  if (n.ok) {
@@ -437,44 +587,40 @@ async function tt(e, t) {
437
587
  publishedDate: ""
438
588
  };
439
589
  }
440
- function nt(e) {
441
- let t = e.licenseFileLink == null || e.licenseFileLink === "" ? "⚠️ No license file" : `[LICENSE](licenses/${e.licenseFileLink})`;
590
+ function _t(e) {
591
+ let t = e.licenseFiles.length === 0 ? "⚠️ No license file" : e.licenseFiles.map((e) => `[${e.label}](licenses/${e.path})`).join(" ");
442
592
  return `|[${e.name}](${e.repository})|${e.installedVersion}|${e.licenseTypes}|${t}|\n`;
443
593
  }
444
- function rt(e) {
445
- let t = e.licenseFileLink == null || e.licenseFileLink === "" ? "⚠️ No license file" : `[LICENSE](licenses/${e.licenseFileLink})`;
446
- return `|[${e.name}](${e.repository})|${e.installedVersion}|${V(e).replace(/^ — /, "")}|${e.licenseTypes}|${t}|\n`;
447
- }
448
- function R(e, t, n, r, i) {
594
+ function vt(e, t, n, r, i) {
449
595
  let a = " ".repeat(i);
450
596
  for (let [o, s] of Object.entries(e)) {
451
597
  if (s.version === void 0) continue;
452
598
  let e = s.version;
453
- n.has(`${o}@${e}`) || (r.push(B(o, e, t.get(`${o}@${e}`), a)), s.dependencies != null && R(s.dependencies, t, n, r, i + 1));
599
+ n.has(`${o}@${e}`) || (r.push(H(o, e, t.get(`${o}@${e}`), a)), s.dependencies != null && vt(s.dependencies, t, n, r, i + 1));
454
600
  }
455
601
  }
456
- function z(e, t, n, r, i) {
602
+ function V(e, t, n, r, i) {
457
603
  for (let [a, o] of e) {
458
604
  if (o.version === void 0) continue;
459
605
  let e = `${a}@${o.version}`, s = Object.entries(o.dependencies ?? {});
460
606
  if (!t.shippedKeys.has(e)) {
461
- z(s, t, n, r, !0);
607
+ V(s, t, n, r, !0);
462
608
  continue;
463
609
  }
464
- i && t.shownKeys.has(e) || (t.shownKeys.add(e), n.push(B(a, o.version, t.licensesByKey.get(e), " ".repeat(r))), z(s, t, n, r + 1, !1));
610
+ i && t.shownKeys.has(e) || (t.shownKeys.add(e), n.push(H(a, o.version, t.licensesByKey.get(e), " ".repeat(r))), V(s, t, n, r + 1, !1));
465
611
  }
466
612
  }
467
- function B(e, t, n, r) {
468
- return `${r}- **${n == null ? e : `[${e}](${n.repository})`}** ${t}${V(n)}`;
613
+ function H(e, t, n, r) {
614
+ return `${r}- **${n == null ? e : `[${e}](${n.repository})`}** ${t}${yt(n)}`;
469
615
  }
470
- function V(e) {
616
+ function yt(e) {
471
617
  if (e == null) return "";
472
- let t = e.publishedDate ? H(e.publishedDate.split("T", 1)[0]) : "";
618
+ let t = e.publishedDate ? bt(e.publishedDate.split("T", 1)[0]) : "";
473
619
  if (e.latestVersion === "" || e.latestVersion === e.installedVersion) return t === "" ? "" : ` — ${t}`;
474
- let n = e.latestPublishedDate ? H(e.latestPublishedDate.split("T", 1)[0]) : "", r = n === "" ? `**latest**: ${e.latestVersion} ❗` : `**latest**: ${e.latestVersion} — ${n} ❗`;
620
+ let n = e.latestPublishedDate ? bt(e.latestPublishedDate.split("T", 1)[0]) : "", r = n === "" ? `**latest**: ${e.latestVersion} ❗` : `**latest**: ${e.latestVersion} — ${n} ❗`;
475
621
  return t === "" ? ` — → ${r}` : ` — ${t} → ${r}`;
476
622
  }
477
- function H(e) {
623
+ function bt(e) {
478
624
  if (e == null || e === "") return "n/a";
479
625
  let t = e.split("T", 1)[0];
480
626
  if (t == null || t === "") return "n/a";
@@ -483,31 +629,31 @@ function H(e) {
483
629
  }
484
630
  //#endregion
485
631
  //#region src/actions/documentOpening.ts
486
- var it = "<!-- OPENING_START -->", at = "<!-- OPENING_END -->";
487
- async function ot() {
632
+ var xt = "<!-- OPENING_START -->", St = "<!-- OPENING_END -->";
633
+ async function Ct() {
488
634
  try {
489
635
  f("Document Opening"), b("1️⃣ Insert opening content into 'README.md'");
490
- let e = await c("package.json"), r = await c("config.json"), { owner: i, repo: a } = t(e, "document opening"), s = st(e), l = lt(r), u = ut(i, a, s, _(r.id).publishedTo === "npm" ? ct(e) : void 0, e.description, l);
491
- await n(u, it, at), o("Opening documented");
636
+ let e = await c("package.json"), r = await c("config.json"), { owner: i, repo: a } = t(e, "document opening"), s = wt(e), l = Et(r), u = Dt(i, a, s, _(r.id).publishedTo === "npm" ? Tt(e) : void 0, e.description, l);
637
+ await n(u, xt, St), o("Opening documented");
492
638
  } catch (e) {
493
639
  console.error("❌ Error documenting opening", e), process.exit(1);
494
640
  }
495
641
  }
496
- function st(e) {
642
+ function wt(e) {
497
643
  let t = e.license;
498
644
  if (t == null || t === "") throw Error("package.json 'license' field is required to document opening.");
499
645
  return t;
500
646
  }
501
- function ct(e) {
647
+ function Tt(e) {
502
648
  let t = e.name;
503
649
  if (t == null || t === "") throw Error("package.json 'name' field is required to document opening.");
504
650
  return t;
505
651
  }
506
- function lt(e) {
652
+ function Et(e) {
507
653
  let t = e.description.en?.trim();
508
654
  return t === void 0 || t === "" ? void 0 : t;
509
655
  }
510
- function ut(e, t, n, r, i, a) {
656
+ function Dt(e, t, n, r, i, a) {
511
657
  let o = `https://github.com/${e}/${t}`;
512
658
  return `[![License: ${n}](https://img.shields.io/badge/License-${n.replaceAll("-", "--")}-blue.svg)](./LICENSE)
513
659
  [![DPUse version](https://img.shields.io/github/v/release/${e}/${t}?color=f6821f&label=DPUse)](${o}/releases/latest)${r === void 0 ? "" : `\n[![npm version](https://img.shields.io/npm/v/${r}?color=cb3837&label=npm)](https://www.npmjs.com/package/${r})`}
@@ -529,41 +675,41 @@ In addition, DPUse provides [Tools](https://www.dpuse.app) used by the applicati
529
675
  }
530
676
  //#endregion
531
677
  //#region src/actions/documentQualitySecurity.ts
532
- var U = {
678
+ var Ot = {
533
679
  "Branch-Protection": 3,
534
680
  "Code-Review": 0,
535
681
  Contributors: 0
536
- }, dt = /* @__PURE__ */ new Set(["CII-Best-Practices"]), ft = "coverage/coverage-final.json", pt = "coverage/coverage-summary.json", mt = 80, ht = 60, gt = "code-health-reports/vitest/badge.json", _t = {
682
+ }, kt = /* @__PURE__ */ new Set(["CII-Best-Practices"]), At = "coverage/coverage-final.json", jt = "coverage/coverage-summary.json", Mt = 80, Nt = 60, Pt = "code-health-reports/vitest/badge.json", Ft = {
537
683
  actions: "GitHub Actions",
538
684
  "javascript-typescript": "JavaScript/TypeScript",
539
685
  rust: "Rust"
540
- }, vt = {
686
+ }, It = {
541
687
  A: "brightgreen",
542
688
  B: "green",
543
689
  C: "yellow",
544
690
  D: "orange",
545
691
  F: "red"
546
- }, yt = `${m}/health.json`, bt = se(ce);
547
- async function xt() {
692
+ }, Lt = `${m}/health.json`, Rt = se(ce);
693
+ async function zt() {
548
694
  try {
549
695
  f("Document Quality & Security");
550
- let e = await c("package.json"), r = await St(e), i = await wt(e, r === void 0 ? [] : ["--coverage", ft]), { owner: a, repo: s } = t(e, "document quality and security");
696
+ let e = await c("package.json"), r = await Bt(e), i = await Ht(e, r === void 0 ? [] : ["--coverage", At]), { owner: a, repo: s } = t(e, "document quality and security");
551
697
  b("4️⃣ Read security checks and settings");
552
- let l = await Et(a, s, e);
698
+ let l = await Wt(a, s, e);
553
699
  b("5️⃣ Look up OpenSSF Best Practices badge and Scorecard results");
554
- let [u, d] = await Promise.all([Dt(`https://github.com/${a}/${s}`), Ot(`github.com/${a}/${s}`)]);
700
+ let [u, d] = await Promise.all([Gt(`https://github.com/${a}/${s}`), Kt(`github.com/${a}/${s}`)]);
555
701
  b("6️⃣ Insert quality and security content into 'README.md'");
556
- let p = Nt(a, s, {
702
+ let p = Zt(a, s, {
557
703
  coveragePercent: r,
558
704
  fallowHealth: i,
559
705
  securitySettings: l
560
706
  }, u, d);
561
- await C(), await n(p, re, te), o("Quality & security documented");
707
+ await C(), await n(p, ne, te), o("Quality & security documented");
562
708
  } catch (e) {
563
709
  console.error("❌ Error documenting quality and security", e), process.exit(1);
564
710
  }
565
711
  }
566
- async function St(e) {
712
+ async function Bt(e) {
567
713
  if (e.devDependencies?.["@vitest/coverage-v8"] == null) {
568
714
  b("1️⃣ Test coverage NOT measured, as '@vitest/coverage-v8' is not installed");
569
715
  return;
@@ -573,25 +719,25 @@ async function St(e) {
573
719
  "--passWithNoTests",
574
720
  "--coverage"
575
721
  ]);
576
- let t = await i(pt);
722
+ let t = await i(jt);
577
723
  if (t === null) return;
578
724
  let n = JSON.parse(t).total.lines.pct;
579
- return await Ct(n), n;
725
+ return await Vt(n), n;
580
726
  }
581
- async function Ct(e) {
727
+ async function Vt(e) {
582
728
  let t = [
583
729
  "red",
584
730
  "yellow",
585
731
  "brightgreen"
586
- ], n = Number(e >= ht) + Number(e >= mt);
587
- await r(gt, {
732
+ ], n = Number(e >= Nt) + Number(e >= Mt);
733
+ await r(Pt, {
588
734
  schemaVersion: 1,
589
735
  label: "coverage",
590
736
  message: `${e.toFixed(1)}%`,
591
737
  color: t[n]
592
738
  });
593
739
  }
594
- async function wt(e, t) {
740
+ async function Ht(e, t) {
595
741
  if (e.devDependencies?.fallow == null) {
596
742
  b("2️⃣ Code health NOT measured, as Fallow is not installed"), b("3️⃣ Code health report NOT required");
597
743
  return;
@@ -602,33 +748,33 @@ async function wt(e, t) {
602
748
  "--format",
603
749
  "json",
604
750
  ...t
605
- ], yt), await a("3️⃣ Write code health report", "fallow", ["--format", "markdown"], s, !0);
606
- let n = await c(yt);
607
- return await Tt(n), n;
751
+ ], Lt), await a("3️⃣ Write code health report", "fallow", ["--format", "markdown"], s, !0);
752
+ let n = await c(Lt);
753
+ return await Ut(n), n;
608
754
  }
609
- async function Tt(e) {
755
+ async function Ut(e) {
610
756
  let { score: t, grade: n } = e.health_score;
611
- await r(ne, {
757
+ await r(y, {
612
758
  schemaVersion: 1,
613
759
  label: "fallow",
614
760
  message: `${n} (${String(Math.round(t))})`,
615
- color: vt[n] ?? "lightgrey"
761
+ color: It[n] ?? "lightgrey"
616
762
  });
617
763
  }
618
- async function Et(e, t, n) {
764
+ async function Wt(e, t, n) {
619
765
  let [r, a, o, s] = await Promise.all([
620
766
  i(".github/workflows/ci.yml"),
621
767
  i(".github/workflows/codeql.yml"),
622
768
  i(".github/dependabot.yml"),
623
769
  i(l)
624
770
  ]), [c, u, d, f] = await Promise.all([
625
- W(`repos/${e}/${t}`),
626
- W(`repos/${e}/${t}/private-vulnerability-reporting`),
627
- W(`repos/${e}/${t}/vulnerability-alerts`),
628
- W(`repos/${e}/${t}/commits/main/check-runs?per_page=100`)
771
+ U(`repos/${e}/${t}`),
772
+ U(`repos/${e}/${t}/private-vulnerability-reporting`),
773
+ U(`repos/${e}/${t}/vulnerability-alerts`),
774
+ U(`repos/${e}/${t}/commits/main/check-runs?per_page=100`)
629
775
  ]), p = c === void 0 ? void 0 : JSON.parse(c).security_and_analysis, m = (e) => p?.[e] === void 0 ? void 0 : p[e].status === "enabled", h = new Set((f === void 0 ? [] : JSON.parse(f).check_runs).map((e) => e.app?.slug)), g = o?.match(/package-ecosystem:/g)?.length ?? 0, _ = o?.match(/open-pull-requests-limit: 0\b/g)?.length ?? 0;
630
776
  return {
631
- codeQLLanguages: (a ?? "").matchAll(/- language: ([\w-]+)/g).filter(([, e]) => e !== "rust" || s !== null).map(([, e = ""]) => _t[e] ?? e).toArray(),
777
+ codeQLLanguages: (a ?? "").matchAll(/- language: ([\w-]+)/g).filter(([, e]) => e !== "rust" || s !== null).map(([, e = ""]) => Ft[e] ?? e).toArray(),
632
778
  codeQLQueries: /queries: ([\w-]+)/.exec(a ?? "")?.[1],
633
779
  dependabotAlerts: d !== void 0,
634
780
  dependabotSecurityUpdates: m("dependabot_security_updates"),
@@ -645,37 +791,37 @@ async function Et(e, t, n) {
645
791
  testsInCI: r?.includes("npm test") ?? !1
646
792
  };
647
793
  }
648
- async function W(e) {
794
+ async function U(e) {
649
795
  try {
650
- let { stdout: t } = await bt("gh", ["api", e]);
796
+ let { stdout: t } = await Rt("gh", ["api", e]);
651
797
  return t;
652
798
  } catch (e) {
653
799
  if (String(e.stderr).includes("HTTP 404")) return;
654
800
  throw e;
655
801
  }
656
802
  }
657
- async function Dt(e) {
803
+ async function Gt(e) {
658
804
  let t = await fetch(`https://www.bestpractices.dev/projects.json?url=${encodeURIComponent(e)}`);
659
805
  if (!t.ok) throw Error(`OpenSSF Best Practices lookup failed with status ${String(t.status)}.`);
660
806
  return (await t.json()).find((t) => t.repo_url === e)?.id;
661
807
  }
662
- async function Ot(e) {
808
+ async function Kt(e) {
663
809
  let t = await fetch(`https://api.scorecard.dev/projects/${e}`);
664
810
  if (t.status !== 404) {
665
811
  if (!t.ok) throw Error(`OpenSSF Scorecard lookup failed with status ${String(t.status)}.`);
666
812
  return await t.json();
667
813
  }
668
814
  }
669
- function kt(e) {
670
- return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || dt.has(e) || U[e] !== void 0 && t >= U[e]);
815
+ function qt(e) {
816
+ return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || kt.has(e) || Ot[e] !== void 0 && t >= Ot[e]);
671
817
  }
672
- function At(e) {
818
+ function Jt(e) {
673
819
  return e === !1 ? " These are handled manually." : "";
674
820
  }
675
- function G(e) {
821
+ function W(e) {
676
822
  return e === void 0 ? "❔ Unknown" : e ? "✅ On" : "❌ Off";
677
823
  }
678
- function K(e, t) {
824
+ function G(e, t) {
679
825
  return t.length === 0 ? "" : `### ${e}
680
826
 
681
827
  |Check|Status|What it does|
@@ -684,90 +830,90 @@ ${t.map((e) => `|${e.join("|")}|`).join("\n")}
684
830
 
685
831
  `;
686
832
  }
687
- function jt(e, t, n, r) {
833
+ function Yt(e, t, n, r) {
688
834
  return `![${n}](https://img.shields.io/endpoint?url=${encodeURIComponent(`https://raw.githubusercontent.com/${e}/${t}/main/${r}`)})`;
689
835
  }
690
- function Mt(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i }) {
836
+ function Xt(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i }) {
691
837
  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\`.` : "", c = [[
692
838
  "Unit tests",
693
- G(i.testsInCI),
839
+ W(i.testsInCI),
694
840
  `[Vitest](https://vitest.dev) runs the unit tests.${o(i.testsInCI)}`
695
841
  ], [
696
842
  "Property-based tests",
697
- G(i.propertyTests),
843
+ W(i.propertyTests),
698
844
  `[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)}`
699
845
  ]];
700
846
  n !== void 0 && c.push([
701
847
  "Test coverage",
702
- G(!0),
703
- `${jt(e, t, "Coverage", gt)} [Vitest's V8 coverage](https://vitest.dev/guide/coverage) measures the share of source lines the unit tests run. The target is ${String(mt)}%.`
848
+ W(!0),
849
+ `${Yt(e, t, "Coverage", Pt)} [Vitest's V8 coverage](https://vitest.dev/guide/coverage) measures the share of source lines the unit tests run. The target is ${String(Mt)}%.`
704
850
  ]);
705
851
  let l = `[![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}) `, u = [[
706
852
  "Code analysis",
707
- G(i.sonarCloud),
853
+ W(i.sonarCloud),
708
854
  `${i.sonarCloud ? l : ""}[SonarCloud](https://sonarcloud.io) checks every push for bugs, code smells and vulnerabilities.`
709
855
  ], [
710
856
  "Linting",
711
- G(i.lintInCI),
857
+ W(i.lintInCI),
712
858
  `[ESLint](https://eslint.org) checks the code for errors and style problems.${o(i.lintInCI)}`
713
859
  ]];
714
860
  r !== void 0 && u.unshift([
715
861
  "Code health",
716
- G(!0),
717
- `[${jt(e, t, "Fallow code health", ne)}](./${s}) [Fallow](https://github.com/fallow-rs/fallow) finds unused code, duplication, complexity and dependency problems.`
862
+ W(!0),
863
+ `[${Yt(e, t, "Fallow code health", y)}](./${s}) [Fallow](https://github.com/fallow-rs/fallow) finds unused code, duplication, complexity and dependency problems.`
718
864
  ]);
719
865
  let d = i.codeQLLanguages.length > 0, f = `[![CodeQL](${a}/actions/workflows/codeql.yml/badge.svg)](${a}/security/code-scanning) `, p = i.codeQLQueries === "security-extended" ? "using the extended security queries" : "using the default queries", m = d ? ` ${i.codeQLLanguages.join(" and ")}` : "", h = [
720
866
  [
721
867
  "Push protection",
722
- G(i.pushProtection),
868
+ W(i.pushProtection),
723
869
  "[GitHub push protection](https://docs.github.com/en/code-security/secret-scanning/push-protection-for-repositories-and-organizations) blocks pushes that contain credentials."
724
870
  ],
725
871
  [
726
872
  "Static analysis",
727
- G(d),
873
+ W(d),
728
874
  `${d ? f : ""}[CodeQL](https://codeql.github.com) scans${m} for security vulnerabilities, ${p}, on every push and pull request to \`main\` and weekly.`
729
875
  ],
730
876
  [
731
877
  "Secret scanning",
732
- G(i.secretScanning),
878
+ W(i.secretScanning),
733
879
  "[GitHub secret scanning](https://docs.github.com/en/code-security/secret-scanning) detects credentials, such as API keys and tokens, committed to the repository."
734
880
  ]
735
881
  ], g = "[Dependabot](https://docs.github.com/en/code-security/dependabot)", _ = [
736
882
  [
737
883
  "Vulnerability audit",
738
- G(i.npmAuditInCI),
884
+ W(i.npmAuditInCI),
739
885
  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)}`
740
886
  ],
741
887
  [
742
888
  "Supply chain risk",
743
- G(i.socket),
889
+ W(i.socket),
744
890
  "[Socket](https://socket.dev) flags malicious packages, typosquatting and suspicious behaviour that may not yet have a CVE."
745
891
  ],
746
892
  [
747
893
  "Security alerts",
748
- G(i.dependabotAlerts),
894
+ W(i.dependabotAlerts),
749
895
  `${g} alerts when a dependency has a known vulnerability, using the GitHub Advisory Database.`
750
896
  ],
751
897
  [
752
898
  "Security updates",
753
- G(i.dependabotSecurityUpdates),
754
- `${g} opens pull requests that update vulnerable dependencies.${At(i.dependabotSecurityUpdates)}`
899
+ W(i.dependabotSecurityUpdates),
900
+ `${g} opens pull requests that update vulnerable dependencies.${Jt(i.dependabotSecurityUpdates)}`
755
901
  ],
756
902
  [
757
903
  "Version updates",
758
- G(i.dependabotVersionUpdates),
759
- `${g} opens pull requests for new dependency versions.${At(i.dependabotVersionUpdates)}`
904
+ W(i.dependabotVersionUpdates),
905
+ `${g} opens pull requests for new dependency versions.${Jt(i.dependabotVersionUpdates)}`
760
906
  ]
761
907
  ];
762
908
  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.
763
909
 
764
- ${K("Testing", c)}${K("Code Quality", u)}${K("Security Analysis", h)}${K("Dependencies", _)}`;
910
+ ${G("Testing", c)}${G("Code Quality", u)}${G("Security Analysis", h)}${G("Dependencies", _)}`;
765
911
  }
766
- function Nt(e, t, n, r, i) {
767
- let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 && kt(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.";
912
+ function Zt(e, t, n, r, i) {
913
+ let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 && qt(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.";
768
914
  return `## Quality & Security
769
915
 
770
- ${Mt(e, t, n)}### OpenSSF 🚧
916
+ ${Xt(e, t, n)}### OpenSSF 🚧
771
917
 
772
918
  ${l}[![OpenSSF Scorecard](https://api.scorecard.dev/projects/${o}/badge)](https://scorecard.dev/viewer/?uri=${o})
773
919
 
@@ -779,37 +925,37 @@ Please do not open public GitHub issues for security vulnerabilities. ${u}`;
779
925
  }
780
926
  //#endregion
781
927
  //#region src/actions/documentUsage.ts
782
- var Pt = "<!-- USAGE_START -->", Ft = "<!-- USAGE_END -->", It = /* @__PURE__ */ new Set([
928
+ var Qt = "<!-- USAGE_START -->", $t = "<!-- USAGE_END -->", en = /* @__PURE__ */ new Set([
783
929
  "connector",
784
930
  "cookbook",
785
931
  "presenter"
786
- ]), Lt = /* @__PURE__ */ new Set(["development", "eslint"]), Rt = "> [!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.", zt = "This repository manages itself using the actions it implements.", Bt = "This repository is managed using the common set of actions provided by [@dpuse/dpuse-development](https://github.com/dpuse/dpuse-development).";
787
- async function Vt() {
932
+ ]), tn = /* @__PURE__ */ new Set(["development", "eslint"]), nn = "> [!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.", rn = "This repository manages itself using the actions it implements.", an = "This repository is managed using the common set of actions provided by [@dpuse/dpuse-development](https://github.com/dpuse/dpuse-development).";
933
+ async function on() {
788
934
  try {
789
935
  f("Document Usage"), b("1️⃣ Insert usage content into 'README.md'");
790
- let [e, t] = await Promise.all([c("package.json"), c("config.json")]), r = Ht(e), i = Ut(r), a = q(e.engines?.node), s = q(e.engines?.npm), l = q(e.devDependencies?.typescript), u = Wt(_(t.id), e.name), d = `${r.replace(/\.git$/, "")}/blob/main/package.json`, p = Gt(u, r, i, a, s, l, `${e.name === "@dpuse/dpuse-development" ? zt : Bt} See the \`scripts\` block in [package.json](${d}) for details.`);
791
- await n(p, Pt, Ft), o("Usage documented");
936
+ let [e, t] = await Promise.all([c("package.json"), c("config.json")]), r = sn(e), i = cn(r), a = K(e.engines?.node), s = K(e.engines?.npm), l = K(e.devDependencies?.typescript), u = ln(_(t.id), e.name), d = `${r.replace(/\.git$/, "")}/blob/main/package.json`, p = un(u, r, i, a, s, l, `${e.name === "@dpuse/dpuse-development" ? rn : an} See the \`scripts\` block in [package.json](${d}) for details.`);
937
+ await n(p, Qt, $t), o("Usage documented");
792
938
  } catch (e) {
793
939
  console.error("❌ Error documenting usage", e), process.exit(1);
794
940
  }
795
941
  }
796
- function Ht(e) {
942
+ function sn(e) {
797
943
  let t = e.repository, n = typeof t == "string" ? t : t?.url;
798
944
  if (n == null || n === "") throw Error("package.json 'repository' field is required to document usage.");
799
945
  return n.replace(/^git\+/, "");
800
946
  }
801
- function Ut(e) {
947
+ function cn(e) {
802
948
  return (e.split("/").at(-1) ?? "").replace(/\.git$/, "");
803
949
  }
804
- function q(e) {
950
+ function K(e) {
805
951
  if (e == null) throw Error("package.json version range is required to document usage.");
806
952
  let t = /\d+(?:\.\d+)*/.exec(e);
807
953
  if (t == null) throw Error(`Unable to parse version from '${e}'.`);
808
954
  return t[0];
809
955
  }
810
- function Wt(e, t) {
956
+ function ln(e, t) {
811
957
  let { typeId: n } = e;
812
- if (It.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.
958
+ if (en.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.
813
959
 
814
960
  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.`;
815
961
  if (e.publishedTo === "npm") {
@@ -820,11 +966,11 @@ You may view or clone this repository for your own purposes, such as building a
820
966
  npm install ${t}
821
967
  \`\`\`
822
968
 
823
- ${Lt.has(n) ? `${Rt}\n\n` : ""}To work on the source instead, clone this repository.`;
969
+ ${tn.has(n) ? `${nn}\n\n` : ""}To work on the source instead, clone this repository.`;
824
970
  }
825
971
  return "You may view or clone this repository for your own purposes.";
826
972
  }
827
- function Gt(e, t, n, r, i, a, o) {
973
+ function un(e, t, n, r, i, a, o) {
828
974
  return `## Usage
829
975
 
830
976
  ${e}
@@ -841,102 +987,102 @@ ${o}`;
841
987
  }
842
988
  //#endregion
843
989
  //#region src/actions/documentApiReference.ts
844
- var J = "API_REFERENCE.md";
845
- async function Kt() {
990
+ var q = "API_REFERENCE.md";
991
+ async function dn() {
846
992
  try {
847
993
  f("Document API Reference");
848
994
  let { writeAPIReference: e } = await import("./apiReference-Fj5_02JP.js");
849
- await e("1️⃣ ", J), o("API reference documented");
995
+ await e("1️⃣ ", q), o("API reference documented");
850
996
  } catch (e) {
851
997
  console.error("❌ Error documenting API reference", e), process.exit(1);
852
998
  }
853
999
  }
854
1000
  //#endregion
855
1001
  //#region src/actions/documentBundleSizes.ts
856
- var qt = "bundle-analysis-reports/sonda/index.json", Jt = "<!-- BUNDLE_START -->", Yt = "<!-- BUNDLE_END -->", Y = "&nbsp;&nbsp;&nbsp;&nbsp;", X = 20, Xt = "█", Zt = "▒", Qt = 100 / X / 2, $t = 100 / X, en = "This report is updated with each release, from the bundle the release builds, using [Sonda](https://sonda.dev/), which analyses final source maps to reveal the actual effects of tree-shaking and minification rather than relying on pre-build estimates.\n\n_Note: Sonda's Vite reports currently exclude CSS files, since Vite does not generate source maps for CSS._", tn = "Bars show each row's share of its output file.", nn = "↳ rows are part of the row above.", Z = "(bundler output, whitespace & JSON)", rn = `${Z} = bytes Sonda can't trace to a source file: whitespace (indentation and line breaks), code the bundler generates (region comments, the combined import/export lines, its small runtime helper and wrappers), and imported JSON such as \`config.json\`, which the bundler doesn't map. The JSON and the generated code are real bytes that ship; the whitespace mostly disappears once compressed.`;
857
- async function an(e) {
1002
+ var fn = "bundle-analysis-reports/sonda/index.json", pn = "<!-- BUNDLE_START -->", mn = "<!-- BUNDLE_END -->", J = "&nbsp;&nbsp;&nbsp;&nbsp;", Y = 20, hn = "█", gn = "▒", _n = 100 / Y / 2, vn = 100 / Y, yn = "This report is updated with each release, from the bundle the release builds, using [Sonda](https://sonda.dev/), which analyses final source maps to reveal the actual effects of tree-shaking and minification rather than relying on pre-build estimates.\n\n_Note: Sonda's Vite reports currently exclude CSS files, since Vite does not generate source maps for CSS._", bn = "Bars show each row's share of its output file.", xn = "↳ rows are part of the row above.", X = "(bundler output, whitespace & JSON)", Sn = `${X} = bytes Sonda can't trace to a source file: whitespace (indentation and line breaks), code the bundler generates (region comments, the combined import/export lines, its small runtime helper and wrappers), and imported JSON such as \`config.json\`, which the bundler doesn't map. The JSON and the generated code are real bytes that ship; the whitespace mostly disappears once compressed.`;
1003
+ async function Cn(e) {
858
1004
  try {
859
1005
  f("Document Bundle Sizes"), b("1️⃣ Read bundle analysis report");
860
- let t = await c(qt);
1006
+ let t = await c(fn);
861
1007
  b("2️⃣ Insert table into 'README.md'");
862
- let r = on(t, e?.moduleLevel ?? !1), i = r.includes("↳") ? `${tn} ${nn}` : tn;
863
- await n(`## Bundle Analysis\n\n${en}\n\n${r}\n\n${i}\n\n${rn}`, Jt, Yt), o("Bundle sizes documented");
1008
+ let r = wn(t, e?.moduleLevel ?? !1), i = r.includes("↳") ? `${bn} ${xn}` : bn;
1009
+ await n(`## Bundle Analysis\n\n${yn}\n\n${r}\n\n${i}\n\n${Sn}`, pn, mn), o("Bundle sizes documented");
864
1010
  } catch (e) {
865
1011
  console.error("❌ Error documenting bundle sizes", e), process.exit(1);
866
1012
  }
867
1013
  }
868
- function on(e, t) {
869
- let n = pn(e), r = n.values().flatMap((e) => e.values().toArray()).reduce((e, t) => e + t.sizes.uncompressed, 0), i = e.resources.filter((e) => e.kind === "asset").map((e) => [e.name, vn(e)]).toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), a = ["|Chunk/Module/File|Composition|", "|:------ |:-----------|"];
1014
+ function wn(e, t) {
1015
+ let n = jn(e), r = n.values().flatMap((e) => e.values().toArray()).reduce((e, t) => e + t.sizes.uncompressed, 0), i = e.resources.filter((e) => e.kind === "asset").map((e) => [e.name, In(e)]).toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), a = ["|Chunk/Module/File|Composition|", "|:------ |:-----------|"];
870
1016
  for (let [e, o] of i) {
871
- let i = [...n.get(e) ?? /* @__PURE__ */ new Map()].toSorted(sn), s = i.reduce((e, [, t]) => e + t.sizes.uncompressed, 0), c = s > 0 && r > 0 ? ` · ${Cn(s, r)} of the build` : "";
872
- a.push(`| **${e}** | ${yn(o)}${c} |`, ...cn(i, s, t));
1017
+ let i = [...n.get(e) ?? /* @__PURE__ */ new Map()].toSorted(Tn), s = i.reduce((e, [, t]) => e + t.sizes.uncompressed, 0), c = s > 0 && r > 0 ? ` · ${Vn(s, r)} of the build` : "";
1018
+ a.push(`| **${e}** | ${Ln(o)}${c} |`, ...En(i, s, t));
873
1019
  }
874
1020
  return a.join("\n");
875
1021
  }
876
- function sn(e, t) {
877
- return e[0] === Z == (t[0] === Z) ? t[1].sizes.uncompressed - e[1].sizes.uncompressed : e[0] === Z ? 1 : -1;
1022
+ function Tn(e, t) {
1023
+ return e[0] === X == (t[0] === X) ? t[1].sizes.uncompressed - e[1].sizes.uncompressed : e[0] === X ? 1 : -1;
878
1024
  }
879
- function cn(e, t, n) {
1025
+ function En(e, t, n) {
880
1026
  let r = [];
881
1027
  for (let [i, { sizes: a, files: o }] of e) {
882
1028
  if (o.size === 1) {
883
- let e = fn(o);
884
- r.push(`| ${Y}${dn(i, e)} | ${Q(a.uncompressed, t)} |`);
1029
+ let e = An(o);
1030
+ r.push(`| ${J}${kn(i, e)} | ${Z(a.uncompressed, t)} |`);
885
1031
  continue;
886
1032
  }
887
- r.push(`| ${Y}${i} | ${Q(a.uncompressed, t)} |`), n || r.push(...ln(o, t));
1033
+ r.push(`| ${J}${i} | ${Z(a.uncompressed, t)} |`), n || r.push(...Dn(o, t));
888
1034
  }
889
1035
  return r;
890
1036
  }
891
- function ln(e, t) {
892
- let n = [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), r = un(n, t), i = (r > 0 ? n.slice(0, -r) : n).map(([e, n]) => `| ${Y}${Y}↳ ${e} | ${Q(n.uncompressed, t, Zt)} |`);
1037
+ function Dn(e, t) {
1038
+ let n = [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), r = On(n, t), i = (r > 0 ? n.slice(0, -r) : n).map(([e, n]) => `| ${J}${J}↳ ${e} | ${Z(n.uncompressed, t, gn)} |`);
893
1039
  if (r > 0) {
894
1040
  let e = n.slice(-r).reduce((e, [, t]) => e + t.uncompressed, 0);
895
- i.push(`| ${Y}${Y}↳ ${String(r)} smaller files | ${Q(e, t, Zt)} |`);
1041
+ i.push(`| ${J}${J}↳ ${String(r)} smaller files | ${Z(e, t, gn)} |`);
896
1042
  }
897
1043
  return i;
898
1044
  }
899
- function un(e, t) {
1045
+ function On(e, t) {
900
1046
  if (t <= 0) return 0;
901
1047
  let n = 0, r = 0;
902
1048
  for (let [, i] of e.toReversed()) {
903
- let e = i.uncompressed / t * 100 < Qt, a = (r + i.uncompressed) / t * 100 <= $t;
1049
+ let e = i.uncompressed / t * 100 < _n, a = (r + i.uncompressed) / t * 100 <= vn;
904
1050
  if (!e || !a) break;
905
1051
  n++, r += i.uncompressed;
906
1052
  }
907
1053
  return n >= 2 ? n : 0;
908
1054
  }
909
- function Q(e, t, n = Xt) {
910
- return `${bn(t > 0 ? e / t * 100 : 0, n)} · ${$(e)}`;
1055
+ function Z(e, t, n = hn) {
1056
+ return `${Rn(t > 0 ? e / t * 100 : 0, n)} · ${Q(e)}`;
911
1057
  }
912
- function dn(e, t) {
1058
+ function kn(e, t) {
913
1059
  return t === "" ? e : `${e} → ${t}`;
914
1060
  }
915
- function fn(e) {
1061
+ function An(e) {
916
1062
  let [t] = e.keys();
917
1063
  if (t === void 0) throw Error("Expected exactly one file");
918
1064
  return t;
919
1065
  }
920
- function pn(e) {
921
- let t = mn(e.dependencies), n = /* @__PURE__ */ new Map();
1066
+ function jn(e) {
1067
+ let t = Mn(e.dependencies), n = /* @__PURE__ */ new Map();
922
1068
  for (let r of e.resources) {
923
1069
  if (r.kind !== "chunk" || !r.parent) continue;
924
- let { group: e, file: i } = hn(r.name, t), a = vn(r), o = n.get(r.parent) ?? /* @__PURE__ */ new Map();
1070
+ let { group: e, file: i } = Nn(r.name, t), a = In(r), o = n.get(r.parent) ?? /* @__PURE__ */ new Map();
925
1071
  n.set(r.parent, o);
926
1072
  let s = o.get(e) ?? {
927
- sizes: xn(),
1073
+ sizes: zn(),
928
1074
  files: /* @__PURE__ */ new Map()
929
1075
  };
930
- o.set(e, s), Sn(s.sizes, a);
931
- let c = s.files.get(i) ?? xn();
932
- s.files.set(i, c), Sn(c, a);
1076
+ o.set(e, s), Bn(s.sizes, a);
1077
+ let c = s.files.get(i) ?? zn();
1078
+ s.files.set(i, c), Bn(c, a);
933
1079
  }
934
1080
  return n;
935
1081
  }
936
- function mn(e) {
1082
+ function Mn(e) {
937
1083
  return e.flatMap((e) => e.paths.map((t) => [t, e.name])).toSorted((e, t) => t[0].length - e[0].length);
938
1084
  }
939
- function hn(e, t) {
1085
+ function Nn(e, t) {
940
1086
  let n = t.find(([t]) => e === t || e.startsWith(`${t}/`));
941
1087
  if (n) {
942
1088
  let [t, r] = n;
@@ -946,65 +1092,65 @@ function hn(e, t) {
946
1092
  };
947
1093
  }
948
1094
  return e === "[unassigned]" ? {
949
- group: Z,
1095
+ group: X,
950
1096
  file: ""
951
1097
  } : e.startsWith("\0") ? {
952
1098
  group: "(runtime)",
953
1099
  file: e.slice(1)
954
1100
  } : e.startsWith("rust/") ? {
955
1101
  group: "wasm",
956
- file: gn(e)
1102
+ file: Pn(e)
957
1103
  } : {
958
1104
  group: "src",
959
- file: _n(e)
1105
+ file: Fn(e)
960
1106
  };
961
1107
  }
962
- function gn(e) {
963
- let t = e.split("/", 2)[1] ?? "", n = _n(e);
1108
+ function Pn(e) {
1109
+ let t = e.split("/", 2)[1] ?? "", n = Fn(e);
964
1110
  return t !== "" && n.startsWith(t) ? `…${n.slice(t.length)}` : n;
965
1111
  }
966
- function _n(e) {
1112
+ function Fn(e) {
967
1113
  return e.split("/").at(-1) ?? e;
968
1114
  }
969
- function vn(e) {
1115
+ function In(e) {
970
1116
  return {
971
1117
  uncompressed: e.uncompressed,
972
1118
  gzip: e.gzip ?? 0
973
1119
  };
974
1120
  }
975
- function yn(e) {
976
- return `${$(e.uncompressed)} · gzip ${$(e.gzip)}`;
1121
+ function Ln(e) {
1122
+ return `${Q(e.uncompressed)} · gzip ${Q(e.gzip)}`;
977
1123
  }
978
- function bn(e, t = Xt) {
979
- let n = Math.round(e / 100 * X);
980
- return `\`${t.repeat(n)}${"░".repeat(X - n)}\` ${e.toFixed(1)}%`;
1124
+ function Rn(e, t = hn) {
1125
+ let n = Math.round(e / 100 * Y);
1126
+ return `\`${t.repeat(n)}${"░".repeat(Y - n)}\` ${e.toFixed(1)}%`;
981
1127
  }
982
- function xn() {
1128
+ function zn() {
983
1129
  return {
984
1130
  uncompressed: 0,
985
1131
  gzip: 0
986
1132
  };
987
1133
  }
988
- function Sn(e, t) {
1134
+ function Bn(e, t) {
989
1135
  e.uncompressed += t.uncompressed, e.gzip += t.gzip;
990
1136
  }
991
- function Cn(e, t) {
1137
+ function Vn(e, t) {
992
1138
  return `${(e / t * 100).toFixed(1)}%`;
993
1139
  }
994
- function $(e) {
1140
+ function Q(e) {
995
1141
  return e < 1024 ? `${String(e)} B` : `${(e / 1024).toFixed(1)} kB`;
996
1142
  }
997
1143
  //#endregion
998
1144
  //#region src/actions/documentProject.ts
999
- async function wn(e = "MIT", t = !1) {
1145
+ async function Hn(e = "MIT", t = !1) {
1000
1146
  try {
1001
1147
  let n = await c("config.json"), r = _(n.id).typeId === "connector";
1002
- await ot(), r && await Ne(), await Vt(), await Ve(e), await i("bundle-analysis-reports/sonda/index.json") === null ? b(`ℹ️ Bundle sizes NOT documented, as there is no '${qt}' yet. Build the project first.`) : await an({ moduleLevel: t }), await xt(), await Pe();
1003
- let a = await i(J) !== null;
1004
- a ? await Kt() : b(`ℹ️ '${J}' NOT required by this project`), await x("ℹ️ Format generated files", "prettier", [
1148
+ await Ct(), r && await Fe(), await on(), await $e(e), await i("bundle-analysis-reports/sonda/index.json") === null ? b(`ℹ️ Bundle sizes NOT documented, as there is no '${fn}' yet. Build the project first.`) : await Cn({ moduleLevel: t }), await zt(), await Ie();
1149
+ let a = await i(q) !== null;
1150
+ a ? await dn() : b(`ℹ️ '${q}' NOT required by this project`), await x("ℹ️ Format generated files", "prettier", [
1005
1151
  "--write",
1006
1152
  "README.md",
1007
- ...a ? [J] : []
1153
+ ...a ? [q] : []
1008
1154
  ]);
1009
1155
  } catch (e) {
1010
1156
  console.error("❌ Error documenting project", e), process.exit(1);
@@ -1012,7 +1158,7 @@ async function wn(e = "MIT", t = !1) {
1012
1158
  }
1013
1159
  //#endregion
1014
1160
  //#region src/actions/formatCode.ts
1015
- async function Tn() {
1161
+ async function Un() {
1016
1162
  try {
1017
1163
  f("Format Code");
1018
1164
  let e = [
@@ -1033,7 +1179,7 @@ async function Tn() {
1033
1179
  }
1034
1180
  //#endregion
1035
1181
  //#region src/actions/lintCode.ts
1036
- async function En() {
1182
+ async function Wn() {
1037
1183
  try {
1038
1184
  f("Lint Code"), await x("1️⃣ Lint", "eslint", ["."]), o("Code linted");
1039
1185
  } catch (e) {
@@ -1042,7 +1188,7 @@ async function En() {
1042
1188
  }
1043
1189
  //#endregion
1044
1190
  //#region src/utilities/cloudflare.ts
1045
- async function Dn() {
1191
+ async function Gn() {
1046
1192
  let e = await c("config.json"), t = {
1047
1193
  body: JSON.stringify(e),
1048
1194
  headers: { "Content-Type": "application/json" },
@@ -1050,7 +1196,7 @@ async function Dn() {
1050
1196
  }, n = await fetch(`https://api.dpuse.app/configs/${e.id}`, t);
1051
1197
  if (!n.ok) throw Error(await n.text());
1052
1198
  }
1053
- async function On(e, t) {
1199
+ async function Kn(e, t) {
1054
1200
  async function n(e, t, r) {
1055
1201
  for (let i of r) {
1056
1202
  let r = `${e}/${i}`, a = `${t}/${i}`;
@@ -1068,7 +1214,7 @@ async function On(e, t) {
1068
1214
  let r = await v(`${e}/${t}/`);
1069
1215
  await n(`${e}/${t}`, t, r);
1070
1216
  }
1071
- async function kn(e) {
1217
+ async function qn(e) {
1072
1218
  let t = e.id, n = {
1073
1219
  body: JSON.stringify(e),
1074
1220
  headers: { "Content-Type": "application/json" },
@@ -1076,7 +1222,7 @@ async function kn(e) {
1076
1222
  }, r = await fetch(`https://api.dpuse.app/configs/${t}`, n);
1077
1223
  if (!r.ok) throw Error(await r.text());
1078
1224
  }
1079
- async function An(e, t) {
1225
+ async function Jn(e, t) {
1080
1226
  let n = `v${e.version ?? "unknown"}`;
1081
1227
  async function r(e, r = "") {
1082
1228
  let i = await v(e, { withFileTypes: !0 });
@@ -1100,34 +1246,34 @@ async function An(e, t) {
1100
1246
  }
1101
1247
  //#endregion
1102
1248
  //#region src/actions/publishProject.ts
1103
- async function jn() {
1249
+ async function Yn() {
1104
1250
  try {
1105
1251
  f("Publish Project");
1106
1252
  let e = await c("package.json"), t = await c("config.json"), n = _(t.id);
1107
- n.publishedTo === "npm" ? await x("1️⃣ Publish to npm", "npm", ["publish", "--provenance"]) : b("1️⃣ Publishing to npm NOT required"), await Mn("2️⃣ ", e, t, n), o(`Project version '${e.version ?? "unknown"}' published.`);
1253
+ n.publishedTo === "npm" ? await x("1️⃣ Publish to npm", "npm", ["publish", "--provenance"]) : b("1️⃣ Publishing to npm NOT required"), await $("2️⃣ ", e, t, n), o(`Project version '${e.version ?? "unknown"}' published.`);
1108
1254
  } catch (e) {
1109
1255
  console.error("❌ Error publishing project", e), process.exit(1);
1110
1256
  }
1111
1257
  }
1112
- async function Mn(e, t, n, r) {
1113
- if (r.typeId === "app") b(`${e} Register module`), await Dn();
1114
- else if (r.typeId === "engine") b(`${e} Register module`), await An(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await kn(n);
1258
+ async function $(e, t, n, r) {
1259
+ if (r.typeId === "app") b(`${e} Register module`), await Gn();
1260
+ else if (r.typeId === "engine") b(`${e} Register module`), await Jn(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await qn(n);
1115
1261
  else if (r.uploadGroupName === void 0) b(`${e} Registration NOT required`);
1116
1262
  else {
1117
1263
  b(`${e} Register module`);
1118
1264
  let i = n.id.split("-").slice(2).join("-");
1119
- await An(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await kn(n);
1265
+ await Jn(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await qn(n);
1120
1266
  }
1121
1267
  }
1122
1268
  //#endregion
1123
1269
  //#region src/actions/releaseProject.ts
1124
- async function Nn(e = "MIT", t = !1) {
1270
+ async function Xn(e = "MIT", t = !1) {
1125
1271
  try {
1126
1272
  f("Release Project");
1127
1273
  let n = await c("package.json"), r = await c("config.json"), i = _(r.id);
1128
- await y("1️⃣ ", n);
1274
+ await ie("1️⃣ ", n);
1129
1275
  let a = await g("2️⃣ ", n, i);
1130
- if (await he("3️⃣ ", n), b("4️⃣ Regenerate README"), await wn(e, t), await d("5️⃣ Stage changes", "git", ["add", "."]), await d("6️⃣ Commit changes", "git", [
1276
+ if (await _e("3️⃣ ", n), b("4️⃣ Regenerate README"), await Hn(e, t), await d("5️⃣ Stage changes", "git", ["add", "."]), await d("6️⃣ Commit changes", "git", [
1131
1277
  "commit",
1132
1278
  "-m",
1133
1279
  `v${n.version ?? "unknown"}`
@@ -1135,7 +1281,7 @@ async function Nn(e = "MIT", t = !1) {
1135
1281
  "push",
1136
1282
  "origin",
1137
1283
  "main:main"
1138
- ]), await Mn("8️⃣ ", n, a, i), i.publishedTo === "npm") {
1284
+ ]), await $("8️⃣ ", n, a, i), i.publishedTo === "npm") {
1139
1285
  let e = `v${n.version ?? "unknown"}`;
1140
1286
  await x("9️⃣ Create GitHub release", "gh", [
1141
1287
  "release",
@@ -1154,11 +1300,11 @@ async function Nn(e = "MIT", t = !1) {
1154
1300
  }
1155
1301
  //#endregion
1156
1302
  //#region src/actions/syncProjectWithGitHub.ts
1157
- async function Pn() {
1303
+ async function Zn() {
1158
1304
  try {
1159
1305
  f("Synchronise Project with GitHub");
1160
1306
  let e = await c("package.json"), t = await c("config.json"), n = _(t.id);
1161
- await y("1️⃣ ", e), await g("2️⃣ ", e, n), await d("3️⃣ Stage changes", "git", ["add", "."]), await d("4️⃣ Commit changes", "git", [
1307
+ await ie("1️⃣ ", e), await g("2️⃣ ", e, n), await d("3️⃣ Stage changes", "git", ["add", "."]), await d("4️⃣ Commit changes", "git", [
1162
1308
  "commit",
1163
1309
  "-m",
1164
1310
  `v${e.version ?? "unknown"}`
@@ -1173,12 +1319,12 @@ async function Pn() {
1173
1319
  }
1174
1320
  //#endregion
1175
1321
  //#region src/actions/testProject.ts
1176
- var Fn = [
1322
+ var Qn = [
1177
1323
  "1️⃣ ",
1178
1324
  "2️⃣ ",
1179
1325
  "3️⃣ ",
1180
1326
  "4️⃣ "
1181
- ], In = [{
1327
+ ], $n = [{
1182
1328
  id: "unit",
1183
1329
  label: "Run unit tests",
1184
1330
  command: "vitest",
@@ -1191,13 +1337,13 @@ var Fn = [
1191
1337
  arguments: ["test", "--pass-with-no-tests"],
1192
1338
  configFileName: "playwright.config.ts"
1193
1339
  }];
1194
- async function Ln(e = ["unit"]) {
1340
+ async function er(e = ["unit"]) {
1195
1341
  try {
1196
1342
  f("Test Project");
1197
1343
  let t = 0;
1198
- for (let n of In) {
1344
+ for (let n of $n) {
1199
1345
  if (!e.includes(n.id) || await i(n.configFileName) === null) continue;
1200
- let r = `${Fn[t] ?? ""} ${n.label}`;
1346
+ let r = `${Qn[t] ?? ""} ${n.label}`;
1201
1347
  await x(r, n.command, n.arguments), t += 1;
1202
1348
  }
1203
1349
  if (t === 0) {
@@ -1210,4 +1356,23 @@ async function Ln(e = ["unit"]) {
1210
1356
  }
1211
1357
  }
1212
1358
  //#endregion
1213
- export { fe as auditDependencies, me as buildProject, De as checkProject, wn as documentProject, Tn as formatCode, En as lintCode, jn as publishProject, Nn as releaseProject, Pn as syncProjectWithGitHub, Ln as testProject, On as uploadDirectoryToR2 };
1359
+ //#region src/actions/triggerGitHubRelease.ts
1360
+ async function tr() {
1361
+ try {
1362
+ f("Trigger GitHub Release");
1363
+ let e = `v${(await c("package.json")).version ?? "unknown"}`;
1364
+ await x("1️⃣ Create GitHub release", "gh", [
1365
+ "release",
1366
+ "create",
1367
+ e,
1368
+ "--target",
1369
+ "main",
1370
+ "--generate-notes",
1371
+ "--latest"
1372
+ ]), o(`GitHub release '${e}' created.`);
1373
+ } catch (e) {
1374
+ console.error("❌ Error triggering GitHub release", e), process.exit(1);
1375
+ }
1376
+ }
1377
+ //#endregion
1378
+ export { me as auditDependencies, ge as buildProject, ke as checkProject, Hn as documentProject, Un as formatCode, Wn as lintCode, Yn as publishProject, Xn as releaseProject, Zn as syncProjectWithGitHub, er as testProject, tr as triggerGitHubRelease, Kn as uploadDirectoryToR2 };