@dpuse/dpuse-development 0.3.782 → 0.3.787

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.
@@ -6384,8 +6384,8 @@ async function Br(e) {
6384
6384
  throw e;
6385
6385
  }
6386
6386
  }
6387
- async function Vr(e, n) {
6388
- await t.writeFile(e, `${JSON.stringify(n, void 0, 4)}\n`, "utf-8");
6387
+ async function Vr(e, r) {
6388
+ await t.mkdir(n.dirname(e), { recursive: !0 }), await t.writeFile(e, `${JSON.stringify(r, void 0, 4)}\n`, "utf-8");
6389
6389
  }
6390
6390
  async function Hr(e, t, n) {
6391
6391
  await Ur("README.md", ei(await zr("./README.md"), e, t, n));
@@ -6819,7 +6819,7 @@ async function Wi() {
6819
6819
  try {
6820
6820
  Y("Document Opening"), Z("1️⃣ Insert opening content into 'README.md'");
6821
6821
  let e = await J("package.json"), t = await J("config.json"), { owner: n, repo: r } = Gr(e, "document opening"), i = Gi(e), a = Ki(t);
6822
- await Hr(qi(n, r, i, e.description, a, e.devDependencies?.fallow != null), Hi, Ui), X("Opening documented");
6822
+ await Hr(qi(n, r, i, e.description, a), Hi, Ui), X("Opening documented");
6823
6823
  } catch (e) {
6824
6824
  console.error("❌ Error documenting opening", e), process.exit(1);
6825
6825
  }
@@ -6833,15 +6833,13 @@ function Ki(e) {
6833
6833
  let t = e.description.en, n = (Array.isArray(t) ? t : [t]).filter((e) => typeof e == "string" && e !== "");
6834
6834
  return n.length === 0 ? void 0 : n.join("\n\n");
6835
6835
  }
6836
- function qi(e, t, n, r, i, a) {
6837
- let o = `https://github.com/${e}/${t}`, s = n.replaceAll("-", "--"), c = encodeURIComponent(`https://raw.githubusercontent.com/${e}/${t}/main/${wr}`), l = r == null || r === "" ? "" : `\n\n${r}`, u = i === void 0 ? "" : `\n\n## Introduction\n\n${i}`;
6838
- return `[![License: ${n}](https://img.shields.io/badge/License-${s}-blue.svg)](./LICENSE)
6839
- [![DPUse version](https://img.shields.io/github/v/release/${e}/${t}?color=f6821f&label=DPUse)](${o}/releases/latest)
6840
- [![CI](${o}/actions/workflows/ci.yml/badge.svg)](${o}/actions/workflows/ci.yml)
6841
- [![CodeQL](${o}/actions/workflows/codeql.yml/badge.svg)](${o}/actions/workflows/codeql.yml)
6842
- ${a ? `[![Fallow code health](https://img.shields.io/endpoint?url=${c})](./${Tr})\n` : ""}[![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})
6836
+ function qi(e, t, n, r, i) {
6837
+ let a = `https://github.com/${e}/${t}`;
6838
+ return `[![License: ${n}](https://img.shields.io/badge/License-${n.replaceAll("-", "--")}-blue.svg)](./LICENSE)
6839
+ [![DPUse version](https://img.shields.io/github/v/release/${e}/${t}?color=f6821f&label=DPUse)](${a}/releases/latest)
6840
+ [![CI](${a}/actions/workflows/ci.yml/badge.svg)](${a}/actions/workflows/ci.yml)
6843
6841
 
6844
- [DPUse](https://www.dpuse.app) · [Report a Vulnerability](${o}/security/advisories/new) · [Open an Issue](${o}/issues)${l}
6842
+ [DPUse](https://www.dpuse.app) · [Report a Vulnerability](${a}/security/advisories/new) · [Open an Issue](${a}/issues)${r == null || r === "" ? "" : `\n\n${r}`}
6845
6843
 
6846
6844
  ## About DPUse
6847
6845
 
@@ -6853,7 +6851,7 @@ DPUse (Data Positioning & Use) is an in-browser application that positions your
6853
6851
 
6854
6852
  **Publishing** uses a library of [Presenters](https://www.dpuse.app) to render standard [Presentations](https://www.dpuse.app) immediately using the contextualised data; additionally, [Cookbooks](https://www.dpuse.app) of [Recipes](https://www.dpuse.app) let you build Data Apps using your preferred tools.
6855
6853
 
6856
- In addition, DPUse provides [Tools](https://www.dpuse.app) used by the application, and you can use them to construct connectors and presenters.${u}`;
6854
+ In addition, DPUse provides [Tools](https://www.dpuse.app) used by the application, and you can use them to construct connectors and presenters.${i === void 0 ? "" : `\n\n## Introduction\n\n${i}`}`;
6857
6855
  }
6858
6856
  //#endregion
6859
6857
  //#region src/actions/documentQualitySecurity.ts
@@ -6861,27 +6859,27 @@ var Ji = {
6861
6859
  "Branch-Protection": 3,
6862
6860
  "Code-Review": 0,
6863
6861
  Contributors: 0
6864
- }, Yi = /* @__PURE__ */ new Set(["CII-Best-Practices"]), Xi = "coverage/coverage-final.json", Zi = "coverage/coverage-summary.json", Qi = 80, $i = {
6862
+ }, Yi = /* @__PURE__ */ new Set(["CII-Best-Practices"]), Xi = "coverage/coverage-final.json", Zi = "coverage/coverage-summary.json", Qi = 80, $i = 60, ea = "code-health-reports/vitest/badge.json", ta = {
6865
6863
  actions: "GitHub Actions",
6866
6864
  "javascript-typescript": "JavaScript/TypeScript",
6867
6865
  rust: "Rust"
6868
- }, ea = {
6866
+ }, na = {
6869
6867
  A: "brightgreen",
6870
6868
  B: "green",
6871
6869
  C: "yellow",
6872
6870
  D: "orange",
6873
6871
  F: "red"
6874
- }, ta = `${Cr}/health.json`, na = r(i);
6875
- async function ra() {
6872
+ }, ra = `${Cr}/health.json`, ia = r(i);
6873
+ async function aa() {
6876
6874
  try {
6877
6875
  Y("Document Quality & Security");
6878
- let e = await J("package.json"), t = await ia(e), n = await aa(e, t === void 0 ? [] : ["--coverage", Xi]), { owner: r, repo: i } = Gr(e, "document quality and security");
6876
+ let e = await J("package.json"), t = await oa(e), n = await ca(e, t === void 0 ? [] : ["--coverage", Xi]), { owner: r, repo: i } = Gr(e, "document quality and security");
6879
6877
  Z("4️⃣ Read security checks and settings");
6880
- let a = await sa(r, i, e);
6878
+ let a = await ua(r, i, e);
6881
6879
  Z("5️⃣ Look up OpenSSF Best Practices badge and Scorecard results");
6882
- let [o, s] = await Promise.all([la(`https://github.com/${r}/${i}`), ua(`github.com/${r}/${i}`)]);
6880
+ let [o, s] = await Promise.all([fa(`https://github.com/${r}/${i}`), pa(`github.com/${r}/${i}`)]);
6883
6881
  Z("6️⃣ Insert quality and security content into 'README.md'");
6884
- let c = ma(r, i, {
6882
+ let c = ya(r, i, {
6885
6883
  coveragePercent: t,
6886
6884
  fallowHealth: n,
6887
6885
  securitySettings: a
@@ -6891,7 +6889,7 @@ async function ra() {
6891
6889
  console.error("❌ Error documenting quality and security", e), process.exit(1);
6892
6890
  }
6893
6891
  }
6894
- async function ia(e) {
6892
+ async function oa(e) {
6895
6893
  if (e.devDependencies?.["@vitest/coverage-v8"] == null) {
6896
6894
  Z("1️⃣ Test coverage NOT measured, as '@vitest/coverage-v8' is not installed");
6897
6895
  return;
@@ -6902,9 +6900,24 @@ async function ia(e) {
6902
6900
  "--coverage"
6903
6901
  ]);
6904
6902
  let t = await Br(Zi);
6905
- return t === null ? void 0 : JSON.parse(t).total.lines.pct;
6903
+ if (t === null) return;
6904
+ let n = JSON.parse(t).total.lines.pct;
6905
+ return await sa(n), n;
6906
+ }
6907
+ async function sa(e) {
6908
+ let t = [
6909
+ "red",
6910
+ "yellow",
6911
+ "brightgreen"
6912
+ ], n = Number(e >= $i) + Number(e >= Qi);
6913
+ await Vr(ea, {
6914
+ schemaVersion: 1,
6915
+ label: "coverage",
6916
+ message: `${e.toFixed(1)}%`,
6917
+ color: t[n]
6918
+ });
6906
6919
  }
6907
- async function aa(e, t) {
6920
+ async function ca(e, t) {
6908
6921
  if (e.devDependencies?.fallow == null) {
6909
6922
  Z("2️⃣ Code health NOT measured, as Fallow is not installed"), Z("3️⃣ Code health report NOT required");
6910
6923
  return;
@@ -6915,36 +6928,37 @@ async function aa(e, t) {
6915
6928
  "--format",
6916
6929
  "json",
6917
6930
  ...t
6918
- ], ta), await Lr("3️⃣ Write code health report", "fallow", ["--format", "markdown"], Tr, !0);
6919
- let n = await J(ta);
6920
- return await oa(n), n;
6931
+ ], ra), await Lr("3️⃣ Write code health report", "fallow", ["--format", "markdown"], Tr, !0);
6932
+ let n = await J(ra);
6933
+ return await la(n), n;
6921
6934
  }
6922
- async function oa(e) {
6935
+ async function la(e) {
6923
6936
  let { score: t, grade: n } = e.health_score;
6924
6937
  await Vr(wr, {
6925
6938
  schemaVersion: 1,
6926
6939
  label: "fallow",
6927
6940
  message: `${n} (${String(Math.round(t))})`,
6928
- color: ea[n] ?? "lightgrey"
6941
+ color: na[n] ?? "lightgrey"
6929
6942
  });
6930
6943
  }
6931
- async function sa(e, t, n) {
6944
+ async function ua(e, t, n) {
6932
6945
  let [r, i, a] = await Promise.all([
6933
6946
  Br(".github/workflows/ci.yml"),
6934
6947
  Br(".github/workflows/codeql.yml"),
6935
6948
  Br(".github/dependabot.yml")
6936
6949
  ]), [o, s, c, l] = await Promise.all([
6937
- ca(`repos/${e}/${t}`),
6938
- ca(`repos/${e}/${t}/private-vulnerability-reporting`),
6939
- ca(`repos/${e}/${t}/vulnerability-alerts`),
6940
- ca(`repos/${e}/${t}/commits/main/check-runs?per_page=100`)
6950
+ da(`repos/${e}/${t}`),
6951
+ da(`repos/${e}/${t}/private-vulnerability-reporting`),
6952
+ da(`repos/${e}/${t}/vulnerability-alerts`),
6953
+ da(`repos/${e}/${t}/commits/main/check-runs?per_page=100`)
6941
6954
  ]), u = o === void 0 ? void 0 : JSON.parse(o).security_and_analysis, d = (e) => u?.[e] === void 0 ? void 0 : u[e].status === "enabled", f = new Set((l === void 0 ? [] : JSON.parse(l).check_runs).map((e) => e.app?.slug)), p = a?.match(/package-ecosystem:/g)?.length ?? 0, m = a?.match(/open-pull-requests-limit: 0\b/g)?.length ?? 0;
6942
6955
  return {
6943
- codeQLLanguages: (i ?? "").matchAll(/- language: ([\w-]+)/g).map(([, e = ""]) => $i[e] ?? e).toArray(),
6956
+ codeQLLanguages: (i ?? "").matchAll(/- language: ([\w-]+)/g).map(([, e = ""]) => ta[e] ?? e).toArray(),
6944
6957
  codeQLQueries: /queries: ([\w-]+)/.exec(i ?? "")?.[1],
6945
6958
  dependabotAlerts: c !== void 0,
6946
6959
  dependabotSecurityUpdates: d("dependabot_security_updates"),
6947
6960
  dependabotVersionUpdates: p > m,
6961
+ lintInCI: (r ?? "").includes("npm run lint"),
6948
6962
  npmAuditInCI: /npm (?:run )?audit/.test(r ?? ""),
6949
6963
  npmAuditLevel: /npm audit --audit-level=(\w+)/.exec(r ?? "")?.[1],
6950
6964
  privateVulnerabilityReporting: s === void 0 ? void 0 : JSON.parse(s).enabled,
@@ -6956,125 +6970,129 @@ async function sa(e, t, n) {
6956
6970
  testsInCI: r?.includes("npm test") ?? !1
6957
6971
  };
6958
6972
  }
6959
- async function ca(e) {
6973
+ async function da(e) {
6960
6974
  try {
6961
- let { stdout: t } = await na("gh", ["api", e]);
6975
+ let { stdout: t } = await ia("gh", ["api", e]);
6962
6976
  return t;
6963
6977
  } catch (e) {
6964
6978
  if (String(e.stderr).includes("HTTP 404")) return;
6965
6979
  throw e;
6966
6980
  }
6967
6981
  }
6968
- async function la(e) {
6982
+ async function fa(e) {
6969
6983
  let t = await fetch(`https://www.bestpractices.dev/projects.json?url=${encodeURIComponent(e)}`);
6970
6984
  if (!t.ok) throw Error(`OpenSSF Best Practices lookup failed with status ${String(t.status)}.`);
6971
6985
  return (await t.json()).find((t) => t.repo_url === e)?.id;
6972
6986
  }
6973
- async function ua(e) {
6987
+ async function pa(e) {
6974
6988
  let t = await fetch(`https://api.scorecard.dev/projects/${e}`);
6975
6989
  if (t.status !== 404) {
6976
6990
  if (!t.ok) throw Error(`OpenSSF Scorecard lookup failed with status ${String(t.status)}.`);
6977
6991
  return await t.json();
6978
6992
  }
6979
6993
  }
6980
- function da(e) {
6994
+ function ma(e) {
6981
6995
  return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || Yi.has(e) || Ji[e] !== void 0 && t >= Ji[e]);
6982
6996
  }
6983
- function $(e, t = "On") {
6984
- return e === void 0 ? "❔ Unknown" : e ? `✅ ${t}` : "❌ Off";
6997
+ function ha(e) {
6998
+ return e === !1 ? " These are handled manually." : "";
6985
6999
  }
6986
- function fa(e, t) {
7000
+ function $(e) {
7001
+ return e === void 0 ? "❔ Unknown" : e ? "✅ On" : "❌ Off";
7002
+ }
7003
+ function ga(e, t) {
6987
7004
  return t.length === 0 ? "" : `### ${e}
6988
7005
 
6989
- |Check or setting|Status|What it does|
7006
+ |Check|Status|What it does|
6990
7007
  |:-|:-|:-|
6991
7008
  ${t.map((e) => `|${e.join("|")}|`).join("\n")}
6992
7009
 
6993
7010
  `;
6994
7011
  }
6995
- function pa(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i }) {
6996
- let a = `https://github.com/${e}/${t}`, o = [[
6997
- `[SonarCloud](https://sonarcloud.io/summary/new_code?id=${e}_${t})`,
7012
+ function _a(e, t, n, r) {
7013
+ return `![${n}](https://img.shields.io/endpoint?url=${encodeURIComponent(`https://raw.githubusercontent.com/${e}/${t}/main/${r}`)})`;
7014
+ }
7015
+ function va(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i }) {
7016
+ let a = `https://github.com/${e}/${t}`, o = (e) => e ? ` Runs in the [CI workflow](${a}/actions/workflows/ci.yml) on every push to \`main\`.` : "", s = [[
7017
+ "Unit tests",
7018
+ $(i.testsInCI),
7019
+ `[Vitest](https://vitest.dev) runs the unit tests.${o(i.testsInCI)}`
7020
+ ], [
7021
+ "Property-based tests",
7022
+ $(i.propertyTests),
7023
+ `[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)}`
7024
+ ]];
7025
+ n !== void 0 && s.push([
7026
+ "Test coverage",
7027
+ $(!0),
7028
+ `${_a(e, t, "Coverage", ea)} [Vitest's V8 coverage](https://vitest.dev/guide/coverage) measures the share of source lines the unit tests run. The target is ${String(Qi)}%.`
7029
+ ]);
7030
+ 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 = [[
7031
+ "Code analysis",
6998
7032
  $(i.sonarCloud),
6999
- "Code quality and security analysis on every push: bugs, code smells and vulnerabilities."
7033
+ `${i.sonarCloud ? c : ""}[SonarCloud](https://sonarcloud.io) checks every push for bugs, code smells and vulnerabilities.`
7034
+ ], [
7035
+ "Linting",
7036
+ $(i.lintInCI),
7037
+ `[ESLint](https://eslint.org) checks the code for errors and style problems.${o(i.lintInCI)}`
7000
7038
  ]];
7001
- if (r !== void 0) {
7002
- let { score: e, grade: t } = r.health_score;
7003
- o.unshift([
7004
- `[Fallow](./${Tr})`,
7005
- `✅ ${t} (${String(Math.round(e))})`,
7006
- "Unused code, duplication, complexity and dependency hygiene."
7007
- ]);
7008
- }
7009
- let s = i.codeQLQueries === "security-extended" ? "using the extended security queries" : "using the default queries", c = [
7039
+ r !== void 0 && l.unshift([
7040
+ "Code health",
7041
+ $(!0),
7042
+ `[${_a(e, t, "Fallow code health", wr)}](./${Tr}) [Fallow](https://github.com/fallow-rs/fallow) finds unused code, duplication, complexity and dependency problems.`
7043
+ ]);
7044
+ 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 = [
7010
7045
  [
7011
- `[CodeQL](${a}/security/code-scanning)`,
7012
- $(i.codeQLLanguages.length > 0, i.codeQLLanguages.join(", ")),
7013
- `Static analysis for security vulnerabilities, ${s}, on every push and pull request to \`main\` and weekly.`
7046
+ "Push protection",
7047
+ $(i.pushProtection),
7048
+ "[GitHub push protection](https://docs.github.com/en/code-security/secret-scanning/push-protection-for-repositories-and-organizations) blocks pushes that contain credentials."
7014
7049
  ],
7015
7050
  [
7016
- "Secret scanning",
7017
- $(i.secretScanning),
7018
- "Detects credentials, such as API keys and tokens, committed to the repository."
7051
+ "Static analysis",
7052
+ $(u),
7053
+ `${u ? d : ""}[CodeQL](https://codeql.github.com) scans${p} for security vulnerabilities, ${f}, on every push and pull request to \`main\` and weekly.`
7019
7054
  ],
7020
7055
  [
7021
- "Push protection",
7022
- $(i.pushProtection),
7023
- "Blocks pushes that contain credentials."
7056
+ "Secret scanning",
7057
+ $(i.secretScanning),
7058
+ "[GitHub secret scanning](https://docs.github.com/en/code-security/secret-scanning) detects credentials, such as API keys and tokens, committed to the repository."
7024
7059
  ]
7025
- ], l = [[
7026
- "Unit tests",
7027
- $(i.testsInCI),
7028
- "Run in CI on every push to `main`."
7029
- ], [
7030
- "Property-based tests",
7031
- $(i.propertyTests, "fast-check"),
7032
- "Fuzz testing: many random inputs per test to find edge cases, run with the unit tests."
7033
- ]];
7034
- if (n !== void 0) {
7035
- let e = n >= Qi ? "✅" : "⚠️";
7036
- l.push([
7037
- "Test coverage",
7038
- `${e} ${n.toFixed(1)}% of lines`,
7039
- `Share of source lines the unit tests run. The target is ${String(Qi)}%.`
7040
- ]);
7041
- }
7042
- let u = [
7060
+ ], h = "[Dependabot](https://docs.github.com/en/code-security/dependabot)", g = [
7043
7061
  [
7044
- "npm audit",
7062
+ "Vulnerability audit",
7045
7063
  $(i.npmAuditInCI),
7046
- i.npmAuditLevel === void 0 ? "Fails CI when any dependency has a known vulnerability." : `Fails CI when a dependency has a known vulnerability of ${i.npmAuditLevel} severity or above.`
7064
+ i.npmAuditLevel === void 0 ? `[npm audit](https://docs.npmjs.com/cli/commands/npm-audit) fails when any dependency has a known vulnerability.${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)}`
7047
7065
  ],
7048
7066
  [
7049
- "[Socket.dev](https://socket.dev)",
7067
+ "Supply chain risk",
7050
7068
  $(i.socket),
7051
- "Flags supply chain risk in dependencies: malicious packages, typosquatting and suspicious behaviour that may not yet have a CVE."
7069
+ "[Socket](https://socket.dev) flags malicious packages, typosquatting and suspicious behaviour that may not yet have a CVE."
7052
7070
  ],
7053
7071
  [
7054
- "Dependabot alerts",
7072
+ "Security alerts",
7055
7073
  $(i.dependabotAlerts),
7056
- "Alerts when a dependency has a known vulnerability, using the GitHub Advisory Database."
7074
+ `${h} alerts when a dependency has a known vulnerability, using the GitHub Advisory Database.`
7057
7075
  ],
7058
7076
  [
7059
- "Dependabot security updates",
7077
+ "Security updates",
7060
7078
  $(i.dependabotSecurityUpdates),
7061
- "Opens pull requests that update vulnerable dependencies."
7079
+ `${h} opens pull requests that update vulnerable dependencies.${ha(i.dependabotSecurityUpdates)}`
7062
7080
  ],
7063
7081
  [
7064
- "Dependabot version updates",
7082
+ "Version updates",
7065
7083
  $(i.dependabotVersionUpdates),
7066
- "Opens pull requests for new dependency versions."
7084
+ `${h} opens pull requests for new dependency versions.${ha(i.dependabotVersionUpdates)}`
7067
7085
  ]
7068
7086
  ];
7069
- return `This section is updated each time \`npm run document\` is run. Settings come from the repository's workflow files and GitHub, and test coverage and the Fallow score are measured at the same time.
7087
+ 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.
7070
7088
 
7071
- ${fa("Testing", l)}${fa("Code Quality", o)}${fa("Security Analysis", c)}${fa("Dependencies", u)}`;
7089
+ ${ga("Testing", s)}${ga("Code Quality", l)}${ga("Security Analysis", m)}${ga("Dependencies", g)}`;
7072
7090
  }
7073
- function ma(e, t, n, r, i) {
7074
- let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 && da(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.";
7091
+ function ya(e, t, n, r, i) {
7092
+ let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 && ma(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.";
7075
7093
  return `## Quality & Security
7076
7094
 
7077
- ${pa(e, t, n)}### OpenSSF 🚧
7095
+ ${va(e, t, n)}### OpenSSF 🚧
7078
7096
 
7079
7097
  ${l}[![OpenSSF Scorecard](https://api.scorecard.dev/projects/${o}/badge)](https://scorecard.dev/viewer/?uri=${o})
7080
7098
 
@@ -7086,37 +7104,37 @@ Please do not open public GitHub issues for security vulnerabilities. ${u}`;
7086
7104
  }
7087
7105
  //#endregion
7088
7106
  //#region src/actions/documentUsage.ts
7089
- var ha = "<!-- USAGE_START -->", ga = "<!-- USAGE_END -->", _a = /* @__PURE__ */ new Set([
7107
+ var ba = "<!-- USAGE_START -->", xa = "<!-- USAGE_END -->", Sa = /* @__PURE__ */ new Set([
7090
7108
  "connector",
7091
7109
  "cookbook",
7092
7110
  "presenter"
7093
- ]), va = /* @__PURE__ */ new Set(["development", "eslint"]), ya = "> [!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.", ba = "This repository manages itself using the actions it implements.", xa = "This repository is managed using the common set of actions provided by [@dpuse/dpuse-development](https://github.com/dpuse/dpuse-development).";
7094
- async function Sa() {
7111
+ ]), Ca = /* @__PURE__ */ new Set(["development", "eslint"]), wa = "> [!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.", Ta = "This repository manages itself using the actions it implements.", Ea = "This repository is managed using the common set of actions provided by [@dpuse/dpuse-development](https://github.com/dpuse/dpuse-development).";
7112
+ async function Da() {
7095
7113
  try {
7096
7114
  Y("Document Usage"), Z("1️⃣ Insert usage content into 'README.md'");
7097
- let [e, t] = await Promise.all([J("package.json"), J("config.json")]), n = Ca(e), r = wa(n), i = Ta(e.engines?.node), a = Ta(e.engines?.npm), o = Ta(e.devDependencies?.typescript);
7098
- await Hr(Da(Ea(Wr(t.id), e.name), n, r, i, a, o, e.name === "@dpuse/dpuse-development" ? ba : xa), ha, ga), X("Usage documented");
7115
+ let [e, t] = await Promise.all([J("package.json"), J("config.json")]), n = Oa(e), r = ka(n), i = Aa(e.engines?.node), a = Aa(e.engines?.npm), o = Aa(e.devDependencies?.typescript), s = ja(Wr(t.id), e.name), c = `${n.replace(/\.git$/, "")}/blob/main/package.json`;
7116
+ await Hr(Ma(s, n, r, i, a, o, `${e.name === "@dpuse/dpuse-development" ? Ta : Ea} See the \`scripts\` block in [package.json](${c}) for details.`), ba, xa), X("Usage documented");
7099
7117
  } catch (e) {
7100
7118
  console.error("❌ Error documenting usage", e), process.exit(1);
7101
7119
  }
7102
7120
  }
7103
- function Ca(e) {
7121
+ function Oa(e) {
7104
7122
  let t = e.repository, n = typeof t == "string" ? t : t?.url;
7105
7123
  if (n == null || n === "") throw Error("package.json 'repository' field is required to document usage.");
7106
7124
  return n.replace(/^git\+/, "");
7107
7125
  }
7108
- function wa(e) {
7126
+ function ka(e) {
7109
7127
  return (e.split("/").at(-1) ?? "").replace(/\.git$/, "");
7110
7128
  }
7111
- function Ta(e) {
7129
+ function Aa(e) {
7112
7130
  if (e == null) throw Error("package.json version range is required to document usage.");
7113
7131
  let t = /\d+(?:\.\d+)*/.exec(e);
7114
7132
  if (t == null) throw Error(`Unable to parse version from '${e}'.`);
7115
7133
  return t[0];
7116
7134
  }
7117
- function Ea(e, t) {
7135
+ function ja(e, t) {
7118
7136
  let { typeId: n } = e;
7119
- if (_a.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.
7137
+ if (Sa.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.
7120
7138
 
7121
7139
  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.`;
7122
7140
  if (e.publishedTo === "npm") {
@@ -7127,11 +7145,11 @@ You may view or clone this repository for your own purposes, such as building a
7127
7145
  npm install ${t}
7128
7146
  \`\`\`
7129
7147
 
7130
- ${va.has(n) ? `${ya}\n\n` : ""}To work on the source instead, clone this repository.`;
7148
+ ${Ca.has(n) ? `${wa}\n\n` : ""}To work on the source instead, clone this repository.`;
7131
7149
  }
7132
7150
  return "You may view or clone this repository for your own purposes.";
7133
7151
  }
7134
- function Da(e, t, n, r, i, a, o) {
7152
+ function Ma(e, t, n, r, i, a, o) {
7135
7153
  return `## Usage
7136
7154
 
7137
7155
  ${e}
@@ -7148,32 +7166,32 @@ ${o}`;
7148
7166
  }
7149
7167
  //#endregion
7150
7168
  //#region src/actions/documentApiReference.ts
7151
- var Oa = "API_REFERENCE.md", ka = [
7169
+ var Na = "API_REFERENCE.md", Pa = [
7152
7170
  "Functions",
7153
7171
  "Classes",
7154
7172
  "Constants",
7155
7173
  "Schemas",
7156
7174
  "Types"
7157
- ], Aa = "Every export, grouped by import path. This file is updated each time `npm run document` is run, and with each release.";
7158
- async function ja() {
7175
+ ], Fa = "Every export, grouped by import path. This file is updated each time `npm run document` is run, and with each release.";
7176
+ async function Ia() {
7159
7177
  try {
7160
- Y("Document API Reference"), await Ma("1️⃣ "), X("API reference documented");
7178
+ Y("Document API Reference"), await La("1️⃣ "), X("API reference documented");
7161
7179
  } catch (e) {
7162
7180
  console.error("❌ Error documenting API reference", e), process.exit(1);
7163
7181
  }
7164
7182
  }
7165
- async function Ma(e) {
7166
- Z(`${e} Write '${Oa}'`);
7167
- let t = Na(await J("package.json"));
7183
+ async function La(e) {
7184
+ Z(`${e} Write '${Na}'`);
7185
+ let t = Ra(await J("package.json"));
7168
7186
  if (t.length === 0) throw Error("package.json 'exports' must name at least one import path with types to document the API reference.");
7169
- let n = l.createProgram(t.map(({ sourcePath: e }) => e), Pa()), r = n.getTypeChecker(), i = Va(n, r);
7170
- await Ur(Oa, `# API Reference\n\n${Aa}\n\n${t.map(({ importPath: e, sourcePath: t }) => {
7187
+ let n = l.createProgram(t.map(({ sourcePath: e }) => e), za()), r = n.getTypeChecker(), i = Ka(n, r);
7188
+ await Ur(Na, `# API Reference\n\n${Fa}\n\n${t.map(({ importPath: e, sourcePath: t }) => {
7171
7189
  let a = n.getSourceFile(t);
7172
7190
  if (a === void 0) throw Error(`Unable to read '${t}', the source of '${e}'.`);
7173
- return $a(e, Fa(r, a, i));
7191
+ return io(e, Ba(r, a, i));
7174
7192
  }).join("\n\n")}\n`);
7175
7193
  }
7176
- function Na(e) {
7194
+ function Ra(e) {
7177
7195
  let t = e.name ?? "", n = e.exports;
7178
7196
  return (typeof n == "object" && n && !Array.isArray(n) ? Object.entries(n) : []).flatMap(([e, n]) => {
7179
7197
  let r = typeof n == "object" && n && !Array.isArray(n) ? n.types : void 0;
@@ -7183,7 +7201,7 @@ function Na(e) {
7183
7201
  }] : [];
7184
7202
  });
7185
7203
  }
7186
- function Pa() {
7204
+ function za() {
7187
7205
  let e = l.findConfigFile(process.cwd(), (e) => l.sys.fileExists(e));
7188
7206
  if (e === void 0) return {
7189
7207
  module: l.ModuleKind.ESNext,
@@ -7193,22 +7211,22 @@ function Pa() {
7193
7211
  let { config: t } = l.readConfigFile(e, (e) => l.sys.readFile(e));
7194
7212
  return l.parseJsonConfigFileContent(t, l.sys, process.cwd()).options;
7195
7213
  }
7196
- function Fa(e, t, n) {
7197
- let r = new Map(ka.map((e) => [e, []])), i = e.getSymbolAtLocation(t), a = i === void 0 ? [] : e.getExportsOfModule(i);
7214
+ function Ba(e, t, n) {
7215
+ let r = new Map(Pa.map((e) => [e, []])), i = e.getSymbolAtLocation(t), a = i === void 0 ? [] : e.getExportsOfModule(i);
7198
7216
  for (let t of a) {
7199
- let i = Ja(e, t), a = Ia(e, Ya(t, i), i, n);
7217
+ let i = $a(e, t), a = Va(e, eo(t, i), i, n);
7200
7218
  a !== void 0 && r.get(a.kind)?.push({
7201
7219
  ...a,
7202
- description: La(e, i)
7220
+ description: Ha(e, i)
7203
7221
  });
7204
7222
  }
7205
7223
  for (let e of r.values()) e.sort((e, t) => e.name.localeCompare(t.name));
7206
7224
  return r;
7207
7225
  }
7208
- function Ia(e, t, n, r) {
7226
+ function Va(e, t, n, r) {
7209
7227
  let [i] = (n.flags & (l.SymbolFlags.Function | l.SymbolFlags.Variable)) === 0 ? [] : e.getSignaturesOfType(e.getTypeOfSymbol(n), l.SignatureKind.Call), a = t.endsWith("Schema");
7210
7228
  return i !== void 0 && !a ? {
7211
- detail: `(${i.parameters.map((t) => Xa(e, t)).join(", ")})`,
7229
+ detail: `(${i.parameters.map((t) => to(e, t)).join(", ")})`,
7212
7230
  kind: "Functions",
7213
7231
  name: t,
7214
7232
  origin: ""
@@ -7221,9 +7239,9 @@ function Ia(e, t, n, r) {
7221
7239
  detail: "",
7222
7240
  kind: "Types",
7223
7241
  name: t,
7224
- origin: za(e, n, r)
7242
+ origin: Wa(e, n, r)
7225
7243
  } : {
7226
- detail: `: ${Ra(e, n)}`,
7244
+ detail: `: ${Ua(e, n)}`,
7227
7245
  kind: "Constants",
7228
7246
  name: t,
7229
7247
  origin: ""
@@ -7231,37 +7249,37 @@ function Ia(e, t, n, r) {
7231
7249
  detail: "",
7232
7250
  kind: "Classes",
7233
7251
  name: t,
7234
- origin: za(e, n, r)
7252
+ origin: Wa(e, n, r)
7235
7253
  };
7236
7254
  }
7237
- function La(e, t) {
7255
+ function Ha(e, t) {
7238
7256
  let n = l.displayPartsToString(t.getDocumentationComment(e)).replaceAll(/\s+/g, " ").trim();
7239
7257
  return n === "" ? void 0 : n;
7240
7258
  }
7241
- function Ra(e, t) {
7259
+ function Ua(e, t) {
7242
7260
  let n = t.valueDeclaration, r = n !== void 0 && l.isVariableDeclaration(n) ? n : void 0, i = r?.initializer, a = i !== void 0 && l.isAsExpression(i) && !l.isConstTypeReference(i.type), o = r?.type ?? (a ? i.type : void 0);
7243
- return o === void 0 ? e.typeToString(e.getBaseTypeOfLiteralType(e.getTypeOfSymbol(t)), n) : Qa(o);
7261
+ return o === void 0 ? e.typeToString(e.getBaseTypeOfLiteralType(e.getTypeOfSymbol(t)), n) : ro(o);
7244
7262
  }
7245
- function za(e, t, n) {
7246
- let r = (t.declarations ?? []).flatMap((e) => l.isClassDeclaration(e) || l.isInterfaceDeclaration(e) ? [...e.heritageClauses ?? []] : []).map((e) => `${e.token === l.SyntaxKind.ExtendsKeyword ? "extends" : "implements"} ${e.types.map((e) => to(Qa(e))).join(", ")}`), i = t.declarations?.find((e) => l.isTypeAliasDeclaration(e)), a = i === void 0 ? void 0 : Ua(i);
7263
+ function Wa(e, t, n) {
7264
+ let r = (t.declarations ?? []).flatMap((e) => l.isClassDeclaration(e) || l.isInterfaceDeclaration(e) ? [...e.heritageClauses ?? []] : []).map((e) => `${e.token === l.SyntaxKind.ExtendsKeyword ? "extends" : "implements"} ${e.types.map((e) => oo(ro(e))).join(", ")}`), i = t.declarations?.find((e) => l.isTypeAliasDeclaration(e)), a = i === void 0 ? void 0 : Ja(i);
7247
7265
  if (i !== void 0 && a !== void 0) {
7248
- r.push(`inferred from ${to(a.getText())}`);
7249
- let t = Wa(e, i), o = t === void 0 ? [] : Ba(e, t, i.name.text, n);
7250
- o.length > 0 && r.push(`extends ${o.map((e) => to(e)).join(", ")}`);
7266
+ r.push(`inferred from ${oo(a.getText())}`);
7267
+ let t = Ya(e, i), o = t === void 0 ? [] : Ga(e, t, i.name.text, n);
7268
+ o.length > 0 && r.push(`extends ${o.map((e) => oo(e)).join(", ")}`);
7251
7269
  }
7252
7270
  return r.length === 0 ? "" : ` (${r.join(", ")})`;
7253
7271
  }
7254
- function Ba(e, t, n, r) {
7272
+ function Ga(e, t, n, r) {
7255
7273
  return t.properties.flatMap((t) => {
7256
- let i = l.isSpreadAssignment(t) ? Ka(e, t.expression) : void 0;
7274
+ let i = l.isSpreadAssignment(t) ? Za(e, t.expression) : void 0;
7257
7275
  if (i === void 0) return [];
7258
7276
  let a = r.get(i);
7259
- return a === n ? Ba(e, i, n, r) : a === void 0 ? [] : [a];
7277
+ return a === n ? Ga(e, i, n, r) : a === void 0 ? [] : [a];
7260
7278
  });
7261
7279
  }
7262
- function Va(e, t) {
7280
+ function Ka(e, t) {
7263
7281
  let n = /* @__PURE__ */ new Map(), r = e.getSourceFiles().filter((t) => !t.isDeclarationFile && !e.isSourceFileFromExternalLibrary(t)).flatMap((e) => e.statements.filter((e) => l.isTypeAliasDeclaration(e)));
7264
- for (let e of r) for (let { addedFieldCount: r, group: i } of Ha(t, e)) n.set(i, [...n.get(i) ?? [], {
7282
+ for (let e of r) for (let { addedFieldCount: r, group: i } of qa(t, e)) n.set(i, [...n.get(i) ?? [], {
7265
7283
  addedFieldCount: r,
7266
7284
  typeName: e.name.text
7267
7285
  }]);
@@ -7272,14 +7290,14 @@ function Va(e, t) {
7272
7290
  }
7273
7291
  return i;
7274
7292
  }
7275
- function Ha(e, t) {
7276
- let n = Wa(e, t);
7293
+ function qa(e, t) {
7294
+ let n = Ya(e, t);
7277
7295
  if (n === void 0) return [];
7278
7296
  let r = l.isVariableDeclaration(n.parent) ? [{
7279
7297
  addedFieldCount: 0,
7280
7298
  group: n
7281
7299
  }] : [], i = n.properties.flatMap((t) => {
7282
- let r = l.isSpreadAssignment(t) ? Ka(e, t.expression) : void 0;
7300
+ let r = l.isSpreadAssignment(t) ? Za(e, t.expression) : void 0;
7283
7301
  return r === void 0 ? [] : [{
7284
7302
  addedFieldCount: n.properties.length - 1,
7285
7303
  group: r
@@ -7287,141 +7305,141 @@ function Ha(e, t) {
7287
7305
  });
7288
7306
  return [...r, ...i];
7289
7307
  }
7290
- function Ua(e) {
7291
- let [t] = Ga(e.type, "InferOutput") ? e.type.typeArguments ?? [] : [];
7308
+ function Ja(e) {
7309
+ let [t] = Xa(e.type, "InferOutput") ? e.type.typeArguments ?? [] : [];
7292
7310
  if (t === void 0) return;
7293
7311
  if (l.isTypeQueryNode(t)) return t.exprName;
7294
- let [n] = Ga(t, "ReturnType") ? t.typeArguments ?? [] : [], [r] = n !== void 0 && l.isTypeQueryNode(n) ? n.typeArguments ?? [] : [];
7312
+ let [n] = Xa(t, "ReturnType") ? t.typeArguments ?? [] : [], [r] = n !== void 0 && l.isTypeQueryNode(n) ? n.typeArguments ?? [] : [];
7295
7313
  return r !== void 0 && l.isTypeQueryNode(r) ? r.exprName : void 0;
7296
7314
  }
7297
- function Wa(e, t) {
7298
- let n = Ua(t), r = n === void 0 ? void 0 : qa(e, n);
7315
+ function Ya(e, t) {
7316
+ let n = Ja(t), r = n === void 0 ? void 0 : Qa(e, n);
7299
7317
  if (r === void 0) return;
7300
7318
  if (l.isObjectLiteralExpression(r)) return r;
7301
7319
  let [i] = l.isCallExpression(r) ? r.arguments : [];
7302
- return i === void 0 ? void 0 : Ka(e, i);
7320
+ return i === void 0 ? void 0 : Za(e, i);
7303
7321
  }
7304
- function Ga(e, t) {
7322
+ function Xa(e, t) {
7305
7323
  return l.isTypeReferenceNode(e) ? (l.isQualifiedName(e.typeName) ? e.typeName.right : e.typeName).text === t : !1;
7306
7324
  }
7307
- function Ka(e, t) {
7325
+ function Za(e, t) {
7308
7326
  if (l.isObjectLiteralExpression(t)) return t;
7309
- let n = qa(e, t);
7327
+ let n = Qa(e, t);
7310
7328
  return n !== void 0 && l.isObjectLiteralExpression(n) ? n : void 0;
7311
7329
  }
7312
- function qa(e, t) {
7313
- let n = e.getSymbolAtLocation(t), r = n === void 0 ? void 0 : Ja(e, n).valueDeclaration;
7330
+ function Qa(e, t) {
7331
+ let n = e.getSymbolAtLocation(t), r = n === void 0 ? void 0 : $a(e, n).valueDeclaration;
7314
7332
  return r !== void 0 && l.isVariableDeclaration(r) ? r.initializer : void 0;
7315
7333
  }
7316
- function Ja(e, t) {
7334
+ function $a(e, t) {
7317
7335
  return (t.flags & l.SymbolFlags.Alias) === 0 ? t : e.getAliasedSymbol(t);
7318
7336
  }
7319
- function Ya(e, t) {
7337
+ function eo(e, t) {
7320
7338
  if (e.name !== "default") return e.name;
7321
7339
  let n = t.declarations?.map((e) => l.getNameOfDeclaration(e)?.getText()).find((e) => e !== void 0);
7322
7340
  return n === void 0 || n === "default" ? "default" : `default (${n})`;
7323
7341
  }
7324
- function Xa(e, t) {
7325
- let n = t.valueDeclaration, r = n !== void 0 && l.isParameter(n) ? n : void 0, i = r?.questionToken !== void 0 || r?.initializer !== void 0, a = r?.type === void 0 ? e.typeToString(e.getTypeOfSymbol(t), n) : Qa(r.type);
7326
- return `${r === void 0 ? t.name : Za(r.name)}${i ? "?" : ""}: ${a}`;
7342
+ function to(e, t) {
7343
+ let n = t.valueDeclaration, r = n !== void 0 && l.isParameter(n) ? n : void 0, i = r?.questionToken !== void 0 || r?.initializer !== void 0, a = r?.type === void 0 ? e.typeToString(e.getTypeOfSymbol(t), n) : ro(r.type);
7344
+ return `${r === void 0 ? t.name : no(r.name)}${i ? "?" : ""}: ${a}`;
7327
7345
  }
7328
- function Za(e) {
7346
+ function no(e) {
7329
7347
  if (l.isIdentifier(e)) return e.text;
7330
- let t = e.elements.flatMap((e) => l.isBindingElement(e) ? [(e.dotDotDotToken === void 0 ? "" : "...") + Za(e.name)] : []);
7348
+ let t = e.elements.flatMap((e) => l.isBindingElement(e) ? [(e.dotDotDotToken === void 0 ? "" : "...") + no(e.name)] : []);
7331
7349
  return l.isObjectBindingPattern(e) ? `{ ${t.join(", ")} }` : `[${t.join(", ")}]`;
7332
7350
  }
7333
- function Qa(e) {
7351
+ function ro(e) {
7334
7352
  return e.getText().replaceAll(/\s+/g, " ");
7335
7353
  }
7336
- function $a(e, t) {
7337
- let n = ka.flatMap((e) => {
7338
- let n = t.get(e) ?? [], r = n.map((e) => eo(e));
7354
+ function io(e, t) {
7355
+ let n = Pa.flatMap((e) => {
7356
+ let n = t.get(e) ?? [], r = n.map((e) => ao(e));
7339
7357
  return n.length === 0 ? [] : [`### ${e}\n\n${r.join("\n")}`];
7340
7358
  });
7341
7359
  return [`## ${e}`, ...n].join("\n\n");
7342
7360
  }
7343
- function eo({ description: e, detail: t, name: n, origin: r }) {
7344
- let i = t === "" ? "" : to(t), a = `- **${to(n)}**${i}${r}`;
7361
+ function ao({ description: e, detail: t, name: n, origin: r }) {
7362
+ let i = t === "" ? "" : oo(t), a = `- **${oo(n)}**${i}${r}`;
7345
7363
  return e === void 0 ? a : `${a}\n > ${e}`;
7346
7364
  }
7347
- function to(e) {
7365
+ function oo(e) {
7348
7366
  return `\`${e}\``;
7349
7367
  }
7350
7368
  //#endregion
7351
7369
  //#region src/actions/documentBundleSizes.ts
7352
- var no = "bundle-analysis-reports/sonda/index.json", ro = "<!-- BUNDLE_START -->", io = "<!-- BUNDLE_END -->", ao = "&nbsp;&nbsp;&nbsp;&nbsp;", oo = 20, so = "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._", co = "(bundler output, whitespace & JSON)", lo = `${co} = 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.`;
7353
- async function uo(e) {
7370
+ var so = "bundle-analysis-reports/sonda/index.json", co = "<!-- BUNDLE_START -->", lo = "<!-- BUNDLE_END -->", uo = "&nbsp;&nbsp;&nbsp;&nbsp;", fo = 20, po = "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._", mo = "(bundler output, whitespace & JSON)", ho = `${mo} = 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.`;
7371
+ async function go(e) {
7354
7372
  try {
7355
7373
  Y("Document Bundle Sizes"), Z("1️⃣ Read bundle analysis report");
7356
- let t = await J(no);
7357
- Z("2️⃣ Insert table into 'README.md'"), await Hr(`## Bundle Analysis\n\n${so}\n\n${fo(t, e?.moduleLevel ?? !1)}\n\n${lo}`, ro, io), X("Bundle sizes documented");
7374
+ let t = await J(so);
7375
+ Z("2️⃣ Insert table into 'README.md'"), await Hr(`## Bundle Analysis\n\n${po}\n\n${_o(t, e?.moduleLevel ?? !1)}\n\n${ho}`, co, lo), X("Bundle sizes documented");
7358
7376
  } catch (e) {
7359
7377
  console.error("❌ Error documenting bundle sizes", e), process.exit(1);
7360
7378
  }
7361
7379
  }
7362
- function fo(e, t) {
7363
- let n = yo(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, Co(e)]).toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), a = ["|Chunk/Module/File|Composition|", "|:------ |:-----------|"];
7380
+ function _o(e, t) {
7381
+ let n = wo(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, Oo(e)]).toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), a = ["|Chunk/Module/File|Composition|", "|:------ |:-----------|"];
7364
7382
  for (let [e, o] of i) {
7365
- let i = [...n.get(e) ?? /* @__PURE__ */ new Map()].toSorted((e, t) => t[1].sizes.uncompressed - e[1].sizes.uncompressed), s = i.length === 1 ? po(e, o, _o(i), r, t) : mo(e, o, i, r, t);
7383
+ let i = [...n.get(e) ?? /* @__PURE__ */ new Map()].toSorted((e, t) => t[1].sizes.uncompressed - e[1].sizes.uncompressed), s = i.length === 1 ? vo(e, o, So(i), r, t) : yo(e, o, i, r, t);
7366
7384
  a.push(...s);
7367
7385
  }
7368
7386
  return a.join("\n");
7369
7387
  }
7370
- function po(e, t, n, r, i) {
7388
+ function vo(e, t, n, r, i) {
7371
7389
  let [a, { sizes: o, files: s }] = n, c = r > 0 ? o.uncompressed / r * 100 : 0;
7372
- if (s.size === 1) return [`| ${e} → ${go(a, vo(s))} | ${wo(t)} · ${To(c)} |`];
7373
- let l = [`| ${e} → ${a} | ${wo(t)} · ${To(c)} |`];
7374
- return i || l.push(...ho(s, ao, r)), l;
7390
+ if (s.size === 1) return [`| ${e} → ${xo(a, Co(s))} | ${ko(t)} · ${Ao(c)} |`];
7391
+ let l = [`| ${e} → ${a} | ${ko(t)} · ${Ao(c)} |`];
7392
+ return i || l.push(...bo(s, uo, r)), l;
7375
7393
  }
7376
- function mo(e, t, n, r, i) {
7377
- let a = [`| ${e} | ${wo(t)} |`];
7394
+ function yo(e, t, n, r, i) {
7395
+ let a = [`| ${e} | ${ko(t)} |`];
7378
7396
  for (let [e, { sizes: t, files: o }] of n) {
7379
7397
  let n = r > 0 ? t.uncompressed / r * 100 : 0;
7380
7398
  if (o.size === 1) {
7381
- let t = vo(o);
7382
- a.push(`| ${ao}${go(e, t)} | ${To(n)} |`);
7399
+ let t = Co(o);
7400
+ a.push(`| ${uo}${xo(e, t)} | ${Ao(n)} |`);
7383
7401
  continue;
7384
7402
  }
7385
- a.push(`| ${ao}${e} | ${To(n)} |`), i || a.push(...ho(o, `${ao}${ao}`, r));
7403
+ a.push(`| ${uo}${e} | ${Ao(n)} |`), i || a.push(...bo(o, `${uo}${uo}`, r));
7386
7404
  }
7387
7405
  return a;
7388
7406
  }
7389
- function ho(e, t, n) {
7390
- return [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed).map(([e, r]) => `| ${t}${e} | ${To(n > 0 ? r.uncompressed / n * 100 : 0)} |`);
7407
+ function bo(e, t, n) {
7408
+ return [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed).map(([e, r]) => `| ${t}${e} | ${Ao(n > 0 ? r.uncompressed / n * 100 : 0)} |`);
7391
7409
  }
7392
- function go(e, t) {
7410
+ function xo(e, t) {
7393
7411
  return t === "" ? e : `${e} → ${t}`;
7394
7412
  }
7395
- function _o(e) {
7413
+ function So(e) {
7396
7414
  let [t] = e;
7397
7415
  if (t === void 0) throw Error("Expected exactly one entry");
7398
7416
  return t;
7399
7417
  }
7400
- function vo(e) {
7418
+ function Co(e) {
7401
7419
  let [t] = e.keys();
7402
7420
  if (t === void 0) throw Error("Expected exactly one file");
7403
7421
  return t;
7404
7422
  }
7405
- function yo(e) {
7406
- let t = bo(e.dependencies), n = /* @__PURE__ */ new Map();
7423
+ function wo(e) {
7424
+ let t = To(e.dependencies), n = /* @__PURE__ */ new Map();
7407
7425
  for (let r of e.resources) {
7408
7426
  if (r.kind !== "chunk" || !r.parent) continue;
7409
- let { group: e, file: i } = xo(r.name, t), a = Co(r), o = n.get(r.parent) ?? /* @__PURE__ */ new Map();
7427
+ let { group: e, file: i } = Eo(r.name, t), a = Oo(r), o = n.get(r.parent) ?? /* @__PURE__ */ new Map();
7410
7428
  n.set(r.parent, o);
7411
7429
  let s = o.get(e) ?? {
7412
- sizes: Eo(),
7430
+ sizes: jo(),
7413
7431
  files: /* @__PURE__ */ new Map()
7414
7432
  };
7415
- o.set(e, s), Do(s.sizes, a);
7416
- let c = s.files.get(i) ?? Eo();
7417
- s.files.set(i, c), Do(c, a);
7433
+ o.set(e, s), Mo(s.sizes, a);
7434
+ let c = s.files.get(i) ?? jo();
7435
+ s.files.set(i, c), Mo(c, a);
7418
7436
  }
7419
7437
  return n;
7420
7438
  }
7421
- function bo(e) {
7439
+ function To(e) {
7422
7440
  return e.flatMap((e) => e.paths.map((t) => [t, e.name])).toSorted((e, t) => t[0].length - e[0].length);
7423
7441
  }
7424
- function xo(e, t) {
7442
+ function Eo(e, t) {
7425
7443
  let n = t.find(([t]) => e === t || e.startsWith(`${t}/`));
7426
7444
  if (n) {
7427
7445
  let [t, r] = n;
@@ -7431,55 +7449,55 @@ function xo(e, t) {
7431
7449
  };
7432
7450
  }
7433
7451
  return e === "[unassigned]" ? {
7434
- group: co,
7452
+ group: mo,
7435
7453
  file: ""
7436
7454
  } : e.startsWith("\0") ? {
7437
7455
  group: "(runtime)",
7438
7456
  file: e.slice(1)
7439
7457
  } : {
7440
7458
  group: e.startsWith("rust/") || e.includes("vite-plugin-wasm") ? "wasm" : "src",
7441
- file: So(e)
7459
+ file: Do(e)
7442
7460
  };
7443
7461
  }
7444
- function So(e) {
7462
+ function Do(e) {
7445
7463
  return e.split("/").at(-1) ?? e;
7446
7464
  }
7447
- function Co(e) {
7465
+ function Oo(e) {
7448
7466
  return {
7449
7467
  uncompressed: e.uncompressed,
7450
7468
  gzip: e.gzip ?? 0
7451
7469
  };
7452
7470
  }
7453
- function wo(e) {
7454
- return `${Oo(e.uncompressed)} · gzip ${Oo(e.gzip)}`;
7471
+ function ko(e) {
7472
+ return `${No(e.uncompressed)} · gzip ${No(e.gzip)}`;
7455
7473
  }
7456
- function To(e) {
7457
- let t = Math.round(e / 100 * oo);
7458
- return `\`${"█".repeat(t)}${"░".repeat(oo - t)}\` ${e.toFixed(1)}%`;
7474
+ function Ao(e) {
7475
+ let t = Math.round(e / 100 * fo);
7476
+ return `\`${"█".repeat(t)}${"░".repeat(fo - t)}\` ${e.toFixed(1)}%`;
7459
7477
  }
7460
- function Eo() {
7478
+ function jo() {
7461
7479
  return {
7462
7480
  uncompressed: 0,
7463
7481
  gzip: 0
7464
7482
  };
7465
7483
  }
7466
- function Do(e, t) {
7484
+ function Mo(e, t) {
7467
7485
  e.uncompressed += t.uncompressed, e.gzip += t.gzip;
7468
7486
  }
7469
- function Oo(e) {
7487
+ function No(e) {
7470
7488
  return e < 1024 ? `${String(e)} B` : `${(e / 1024).toFixed(1)} kB`;
7471
7489
  }
7472
7490
  //#endregion
7473
7491
  //#region src/actions/documentProject.ts
7474
- async function ko({ allowedLicenses: e = "MIT", moduleLevel: t = !1 } = {}) {
7492
+ async function Po({ allowedLicenses: e = "MIT", moduleLevel: t = !1 } = {}) {
7475
7493
  try {
7476
7494
  let n = Wr((await J("config.json")).id).typeId === "connector";
7477
- await Wi(), n && await Si(), await Sa(), await ji(e), await Br("bundle-analysis-reports/sonda/index.json") === null ? Z(`ℹ️ Bundle sizes NOT documented, as there is no '${no}' yet. Build the project first.`) : await uo({ moduleLevel: t }), await ra(), await Ci();
7478
- let r = await Br(Oa) !== null;
7479
- r ? await ja() : Z(`ℹ️ '${Oa}' NOT required by this project`), await q("ℹ️ Format generated files", "prettier", [
7495
+ await Wi(), n && await Si(), await Da(), await ji(e), await Br("bundle-analysis-reports/sonda/index.json") === null ? Z(`ℹ️ Bundle sizes NOT documented, as there is no '${so}' yet. Build the project first.`) : await go({ moduleLevel: t }), await aa(), await Ci();
7496
+ let r = await Br(Na) !== null;
7497
+ r ? await Ia() : Z(`ℹ️ '${Na}' NOT required by this project`), await q("ℹ️ Format generated files", "prettier", [
7480
7498
  "--write",
7481
7499
  "README.md",
7482
- ...r ? [Oa] : []
7500
+ ...r ? [Na] : []
7483
7501
  ]);
7484
7502
  } catch (e) {
7485
7503
  console.error("❌ Error documenting project", e), process.exit(1);
@@ -7487,7 +7505,7 @@ async function ko({ allowedLicenses: e = "MIT", moduleLevel: t = !1 } = {}) {
7487
7505
  }
7488
7506
  //#endregion
7489
7507
  //#region src/actions/formatCode.ts
7490
- async function Ao() {
7508
+ async function Fo() {
7491
7509
  try {
7492
7510
  Y("Format Code"), await q("1️⃣ Format", "prettier", [
7493
7511
  "--write",
@@ -7506,7 +7524,7 @@ async function Ao() {
7506
7524
  }
7507
7525
  //#endregion
7508
7526
  //#region src/actions/lintCode.ts
7509
- async function jo() {
7527
+ async function Io() {
7510
7528
  try {
7511
7529
  Y("Lint Code"), await q("1️⃣ Lint", "eslint", ["."]), X("Code linted");
7512
7530
  } catch (e) {
@@ -7515,7 +7533,7 @@ async function jo() {
7515
7533
  }
7516
7534
  //#endregion
7517
7535
  //#region src/utilities/cloudflare.ts
7518
- async function Mo() {
7536
+ async function Lo() {
7519
7537
  let e = await J("config.json"), t = {
7520
7538
  body: JSON.stringify(e),
7521
7539
  headers: { "Content-Type": "application/json" },
@@ -7523,7 +7541,7 @@ async function Mo() {
7523
7541
  }, n = await fetch(`https://api.dpuse.app/configs/${e.id}`, t);
7524
7542
  if (!n.ok) throw Error(await n.text());
7525
7543
  }
7526
- async function No(e, t) {
7544
+ async function Ro(e, t) {
7527
7545
  async function n(e, t, r) {
7528
7546
  for (let i of r) {
7529
7547
  let r = `${e}/${i}`, a = `${t}/${i}`;
@@ -7541,7 +7559,7 @@ async function No(e, t) {
7541
7559
  let r = await Fr(`${e}/${t}/`);
7542
7560
  await n(`${e}/${t}`, t, r);
7543
7561
  }
7544
- async function Po(e) {
7562
+ async function zo(e) {
7545
7563
  let t = e.id, n = {
7546
7564
  body: JSON.stringify(e),
7547
7565
  headers: { "Content-Type": "application/json" },
@@ -7549,7 +7567,7 @@ async function Po(e) {
7549
7567
  }, r = await fetch(`https://api.dpuse.app/configs/${t}`, n);
7550
7568
  if (!r.ok) throw Error(await r.text());
7551
7569
  }
7552
- async function Fo(e, t) {
7570
+ async function Bo(e, t) {
7553
7571
  let n = `v${e.version ?? "unknown"}`;
7554
7572
  async function r(e, r = "") {
7555
7573
  let i = await Fr(e, { withFileTypes: !0 });
@@ -7573,34 +7591,34 @@ async function Fo(e, t) {
7573
7591
  }
7574
7592
  //#endregion
7575
7593
  //#region src/actions/publishProject.ts
7576
- async function Io() {
7594
+ async function Vo() {
7577
7595
  try {
7578
7596
  Y("Publish Project");
7579
7597
  let e = await J("package.json"), t = await J("config.json");
7580
- await Lo("1️⃣ ", e, t, Wr(t.id)), X(`Project version '${e.version ?? "unknown"}' published.`);
7598
+ await Ho("1️⃣ ", e, t, Wr(t.id)), X(`Project version '${e.version ?? "unknown"}' published.`);
7581
7599
  } catch (e) {
7582
7600
  console.error("❌ Error publishing project", e), process.exit(1);
7583
7601
  }
7584
7602
  }
7585
- async function Lo(e, t, n, r) {
7586
- if (r.typeId === "app") Z(`${e} Register module`), await Mo();
7587
- else if (r.typeId === "engine") Z(`${e} Register module`), await Fo(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await Po(n);
7603
+ async function Ho(e, t, n, r) {
7604
+ if (r.typeId === "app") Z(`${e} Register module`), await Lo();
7605
+ else if (r.typeId === "engine") Z(`${e} Register module`), await Bo(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await zo(n);
7588
7606
  else if (r.uploadGroupName === void 0) Z(`${e} Registration NOT required`);
7589
7607
  else {
7590
7608
  Z(`${e} Register module`);
7591
7609
  let i = n.id.split("-").slice(2).join("-");
7592
- await Fo(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await Po(n);
7610
+ await Bo(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await zo(n);
7593
7611
  }
7594
7612
  }
7595
7613
  //#endregion
7596
7614
  //#region src/actions/releaseProject.ts
7597
- async function Ro(e = {}) {
7615
+ async function Uo(e = {}) {
7598
7616
  try {
7599
7617
  Y("Release Project");
7600
7618
  let t = await J("package.json"), n = Wr((await J("config.json")).id);
7601
7619
  await Jr("1️⃣ ", t);
7602
7620
  let r = await qr("2️⃣ ", t, n);
7603
- await q("3️⃣ Bundle project", "vite", ["build"]), Z("4️⃣ Regenerate README"), await ko(e), await Ir("5️⃣ Stage changes", "git", ["add", "."]), await Ir("6️⃣ Commit changes", "git", [
7621
+ await q("3️⃣ Bundle project", "vite", ["build"]), Z("4️⃣ Regenerate README"), await Po(e), await Ir("5️⃣ Stage changes", "git", ["add", "."]), await Ir("6️⃣ Commit changes", "git", [
7604
7622
  "commit",
7605
7623
  "-m",
7606
7624
  `v${t.version ?? "unknown"}`
@@ -7608,7 +7626,7 @@ async function Ro(e = {}) {
7608
7626
  "push",
7609
7627
  "origin",
7610
7628
  "main:main"
7611
- ]), await Lo("8️⃣ ", t, r, n), n.publishedTo === "npm" ? await q("9️⃣ Create GitHub release", "gh", [
7629
+ ]), await Ho("8️⃣ ", t, r, n), n.publishedTo === "npm" ? await q("9️⃣ Create GitHub release", "gh", [
7612
7630
  "release",
7613
7631
  "create",
7614
7632
  `v${t.version ?? "unknown"}`,
@@ -7623,7 +7641,7 @@ async function Ro(e = {}) {
7623
7641
  }
7624
7642
  //#endregion
7625
7643
  //#region src/actions/syncProjectWithGitHub.ts
7626
- async function zo() {
7644
+ async function Wo() {
7627
7645
  try {
7628
7646
  Y("Synchronise Project with GitHub");
7629
7647
  let e = await J("package.json"), t = Wr((await J("config.json")).id);
@@ -7642,12 +7660,12 @@ async function zo() {
7642
7660
  }
7643
7661
  //#endregion
7644
7662
  //#region src/actions/testProject.ts
7645
- var Bo = [
7663
+ var Go = [
7646
7664
  "1️⃣ ",
7647
7665
  "2️⃣ ",
7648
7666
  "3️⃣ ",
7649
7667
  "4️⃣ "
7650
- ], Vo = [{
7668
+ ], Ko = [{
7651
7669
  id: "unit",
7652
7670
  label: "Run unit tests",
7653
7671
  command: "vitest",
@@ -7660,16 +7678,12 @@ var Bo = [
7660
7678
  arguments: ["test", "--pass-with-no-tests"],
7661
7679
  configFileName: "playwright.config.ts"
7662
7680
  }];
7663
- async function Ho(e = ["unit"], t = !1) {
7681
+ async function qo(e = ["unit"]) {
7664
7682
  try {
7665
7683
  Y("Test Project");
7666
- let n = 0;
7667
- for (let r of Vo) {
7668
- if (!e.includes(r.id) || await Br(r.configFileName) === null) continue;
7669
- let i = t && r.id === "unit" ? ["--coverage"] : [];
7670
- await q(`${Bo[n] ?? ""} ${r.label}`, r.command, [...r.arguments, ...i]), n += 1;
7671
- }
7672
- if (n === 0) {
7684
+ let t = 0;
7685
+ for (let n of Ko) e.includes(n.id) && await Br(n.configFileName) !== null && (await q(`${Go[t] ?? ""} ${n.label}`, n.command, n.arguments), t += 1);
7686
+ if (t === 0) {
7673
7687
  console.warn("\n⚠️ No tests configured for this project.\n");
7674
7688
  return;
7675
7689
  }
@@ -7679,4 +7693,4 @@ async function Ho(e = ["unit"], t = !1) {
7679
7693
  }
7680
7694
  }
7681
7695
  //#endregion
7682
- export { ni as auditDependencies, ri as buildProject, gi as checkProject, ko as documentProject, Ao as formatCode, jo as lintCode, Io as publishProject, Ro as releaseProject, zo as syncProjectWithGitHub, Ho as testProject, No as uploadDirectoryToR2 };
7696
+ export { ni as auditDependencies, ri as buildProject, gi as checkProject, Po as documentProject, Fo as formatCode, Io as lintCode, Vo as publishProject, Uo as releaseProject, Wo as syncProjectWithGitHub, qo as testProject, Ro as uploadDirectoryToR2 };