@dpuse/dpuse-development 0.3.812 → 0.3.814

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