@dpuse/dpuse-development 1.0.155 → 1.0.157

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