@dpuse/dpuse-development 0.3.806 → 0.3.809

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,4 +1,4 @@
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-Bo8LfncX.js";
1
+ import { A as e, C as t, D as n, E as r, S as i, T as a, _ as o, a as s, b as c, c as l, d as u, f as d, g as f, h as p, i as m, k as h, l as g, m as _, n as ee, o as te, p as v, r as y, s as ne, t as re, u as b, v as x, w as S, x as C, y as w } from "./utilities-CQ2h3IWL.js";
2
2
  import { existsSync as ie } from "node:fs";
3
3
  import T from "node:path";
4
4
  import { promisify as ae } from "node:util";
@@ -186,7 +186,7 @@ async function Ce() {
186
186
  }
187
187
  //#endregion
188
188
  //#region src/actions/documentActions.ts
189
- var we = "<!-- CONNECTOR_ACTIONS_START -->", Te = "<!-- CONNECTOR_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 = {
189
+ 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 = {
190
190
  source: "This connector is a Source connector that supports only read actions. Connectors can also function as a Destination (write-only) or Bidirectional (read/write), depending on the actions they support.",
191
191
  destination: "This connector is a Destination connector that supports only write actions. Connectors can also function as a Source (read-only) or Bidirectional (read/write), depending on the actions they support.",
192
192
  bidirectional: "This connector is a Bidirectional connector that supports both read and write actions. Connectors can also function as a Source (read-only) or Destination (write-only), depending on the actions they support.",
@@ -195,7 +195,7 @@ var we = "<!-- CONNECTOR_ACTIONS_START -->", Te = "<!-- CONNECTOR_ACTIONS_END --
195
195
  async function ke() {
196
196
  try {
197
197
  f("Document Actions"), x("1️⃣ Insert actions description and table into 'README.md'");
198
- let t = (await c("config.json")).actionNames ?? [], r = h(t), i = e(t), a = `${Ee}\n\n${De[r]} ${Oe}\n\n${i}`;
198
+ 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}`;
199
199
  await n(a, we, Te), o("Actions documented");
200
200
  } catch (e) {
201
201
  console.error("❌ Error documenting actions", e), process.exit(1);
@@ -417,31 +417,31 @@ In addition, DPUse provides [Tools](https://www.dpuse.app) used by the applicati
417
417
  }
418
418
  //#endregion
419
419
  //#region src/actions/documentQualitySecurity.ts
420
- var N = {
420
+ var et = {
421
421
  "Branch-Protection": 3,
422
422
  "Code-Review": 0,
423
423
  Contributors: 0
424
- }, et = /* @__PURE__ */ new Set(["CII-Best-Practices"]), tt = "coverage/coverage-final.json", nt = "coverage/coverage-summary.json", P = 80, rt = 60, F = "code-health-reports/vitest/badge.json", it = {
424
+ }, tt = /* @__PURE__ */ new Set(["CII-Best-Practices"]), nt = "coverage/coverage-final.json", rt = "coverage/coverage-summary.json", N = 80, it = 60, P = "code-health-reports/vitest/badge.json", at = {
425
425
  actions: "GitHub Actions",
426
426
  "javascript-typescript": "JavaScript/TypeScript",
427
427
  rust: "Rust"
428
- }, at = {
428
+ }, ot = {
429
429
  A: "brightgreen",
430
430
  B: "green",
431
431
  C: "yellow",
432
432
  D: "orange",
433
433
  F: "red"
434
- }, I = `${m}/health.json`, ot = ae(oe);
435
- async function st() {
434
+ }, F = `${m}/health.json`, st = ae(oe);
435
+ async function ct() {
436
436
  try {
437
437
  f("Document Quality & Security");
438
- let e = await c("package.json"), r = await ct(e), i = await ut(e, r === void 0 ? [] : ["--coverage", tt]), { owner: a, repo: s } = t(e, "document quality and security");
438
+ let e = await c("package.json"), r = await lt(e), i = await dt(e, r === void 0 ? [] : ["--coverage", nt]), { owner: a, repo: s } = t(e, "document quality and security");
439
439
  x("4️⃣ Read security checks and settings");
440
- let l = await ft(a, s, e);
440
+ let l = await pt(a, s, e);
441
441
  x("5️⃣ Look up OpenSSF Best Practices badge and Scorecard results");
442
- let [u, d] = await Promise.all([pt(`https://github.com/${a}/${s}`), mt(`github.com/${a}/${s}`)]);
442
+ let [u, d] = await Promise.all([mt(`https://github.com/${a}/${s}`), ht(`github.com/${a}/${s}`)]);
443
443
  x("6️⃣ Insert quality and security content into 'README.md'");
444
- let p = _t(a, s, {
444
+ let p = vt(a, s, {
445
445
  coveragePercent: r,
446
446
  fallowHealth: i,
447
447
  securitySettings: l
@@ -451,7 +451,7 @@ async function st() {
451
451
  console.error("❌ Error documenting quality and security", e), process.exit(1);
452
452
  }
453
453
  }
454
- async function ct(e) {
454
+ async function lt(e) {
455
455
  if (e.devDependencies?.["@vitest/coverage-v8"] == null) {
456
456
  x("1️⃣ Test coverage NOT measured, as '@vitest/coverage-v8' is not installed");
457
457
  return;
@@ -461,25 +461,25 @@ async function ct(e) {
461
461
  "--passWithNoTests",
462
462
  "--coverage"
463
463
  ]);
464
- let t = await i(nt);
464
+ let t = await i(rt);
465
465
  if (t === null) return;
466
466
  let n = JSON.parse(t).total.lines.pct;
467
- return await lt(n), n;
467
+ return await ut(n), n;
468
468
  }
469
- async function lt(e) {
469
+ async function ut(e) {
470
470
  let t = [
471
471
  "red",
472
472
  "yellow",
473
473
  "brightgreen"
474
- ], n = Number(e >= rt) + Number(e >= P);
475
- await r(F, {
474
+ ], n = Number(e >= it) + Number(e >= N);
475
+ await r(P, {
476
476
  schemaVersion: 1,
477
477
  label: "coverage",
478
478
  message: `${e.toFixed(1)}%`,
479
479
  color: t[n]
480
480
  });
481
481
  }
482
- async function ut(e, t) {
482
+ async function dt(e, t) {
483
483
  if (e.devDependencies?.fallow == null) {
484
484
  x("2️⃣ Code health NOT measured, as Fallow is not installed"), x("3️⃣ Code health report NOT required");
485
485
  return;
@@ -490,33 +490,33 @@ async function ut(e, t) {
490
490
  "--format",
491
491
  "json",
492
492
  ...t
493
- ], I), await a("3️⃣ Write code health report", "fallow", ["--format", "markdown"], s, !0);
494
- let n = await c(I);
495
- return await dt(n), n;
493
+ ], F), await a("3️⃣ Write code health report", "fallow", ["--format", "markdown"], s, !0);
494
+ let n = await c(F);
495
+ return await ft(n), n;
496
496
  }
497
- async function dt(e) {
497
+ async function ft(e) {
498
498
  let { score: t, grade: n } = e.health_score;
499
499
  await r(y, {
500
500
  schemaVersion: 1,
501
501
  label: "fallow",
502
502
  message: `${n} (${String(Math.round(t))})`,
503
- color: at[n] ?? "lightgrey"
503
+ color: ot[n] ?? "lightgrey"
504
504
  });
505
505
  }
506
- async function ft(e, t, n) {
506
+ async function pt(e, t, n) {
507
507
  let [r, a, o, s] = await Promise.all([
508
508
  i(".github/workflows/ci.yml"),
509
509
  i(".github/workflows/codeql.yml"),
510
510
  i(".github/dependabot.yml"),
511
511
  i(l)
512
512
  ]), [c, u, d, f] = await Promise.all([
513
- L(`repos/${e}/${t}`),
514
- L(`repos/${e}/${t}/private-vulnerability-reporting`),
515
- L(`repos/${e}/${t}/vulnerability-alerts`),
516
- L(`repos/${e}/${t}/commits/main/check-runs?per_page=100`)
513
+ I(`repos/${e}/${t}`),
514
+ I(`repos/${e}/${t}/private-vulnerability-reporting`),
515
+ I(`repos/${e}/${t}/vulnerability-alerts`),
516
+ I(`repos/${e}/${t}/commits/main/check-runs?per_page=100`)
517
517
  ]), 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;
518
518
  return {
519
- codeQLLanguages: (a ?? "").matchAll(/- language: ([\w-]+)/g).filter(([, e]) => e !== "rust" || s !== null).map(([, e = ""]) => it[e] ?? e).toArray(),
519
+ codeQLLanguages: (a ?? "").matchAll(/- language: ([\w-]+)/g).filter(([, e]) => e !== "rust" || s !== null).map(([, e = ""]) => at[e] ?? e).toArray(),
520
520
  codeQLQueries: /queries: ([\w-]+)/.exec(a ?? "")?.[1],
521
521
  dependabotAlerts: d !== void 0,
522
522
  dependabotSecurityUpdates: m("dependabot_security_updates"),
@@ -533,37 +533,37 @@ async function ft(e, t, n) {
533
533
  testsInCI: r?.includes("npm test") ?? !1
534
534
  };
535
535
  }
536
- async function L(e) {
536
+ async function I(e) {
537
537
  try {
538
- let { stdout: t } = await ot("gh", ["api", e]);
538
+ let { stdout: t } = await st("gh", ["api", e]);
539
539
  return t;
540
540
  } catch (e) {
541
541
  if (String(e.stderr).includes("HTTP 404")) return;
542
542
  throw e;
543
543
  }
544
544
  }
545
- async function pt(e) {
545
+ async function mt(e) {
546
546
  let t = await fetch(`https://www.bestpractices.dev/projects.json?url=${encodeURIComponent(e)}`);
547
547
  if (!t.ok) throw Error(`OpenSSF Best Practices lookup failed with status ${String(t.status)}.`);
548
548
  return (await t.json()).find((t) => t.repo_url === e)?.id;
549
549
  }
550
- async function mt(e) {
550
+ async function ht(e) {
551
551
  let t = await fetch(`https://api.scorecard.dev/projects/${e}`);
552
552
  if (t.status !== 404) {
553
553
  if (!t.ok) throw Error(`OpenSSF Scorecard lookup failed with status ${String(t.status)}.`);
554
554
  return await t.json();
555
555
  }
556
556
  }
557
- function ht(e) {
558
- return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || et.has(e) || N[e] !== void 0 && t >= N[e]);
557
+ function gt(e) {
558
+ return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || tt.has(e) || et[e] !== void 0 && t >= et[e]);
559
559
  }
560
- function R(e) {
560
+ function L(e) {
561
561
  return e === !1 ? " These are handled manually." : "";
562
562
  }
563
- function z(e) {
563
+ function R(e) {
564
564
  return e === void 0 ? "❔ Unknown" : e ? "✅ On" : "❌ Off";
565
565
  }
566
- function B(e, t) {
566
+ function z(e, t) {
567
567
  return t.length === 0 ? "" : `### ${e}
568
568
 
569
569
  |Check|Status|What it does|
@@ -572,90 +572,90 @@ ${t.map((e) => `|${e.join("|")}|`).join("\n")}
572
572
 
573
573
  `;
574
574
  }
575
- function V(e, t, n, r) {
575
+ function B(e, t, n, r) {
576
576
  return `![${n}](https://img.shields.io/endpoint?url=${encodeURIComponent(`https://raw.githubusercontent.com/${e}/${t}/main/${r}`)})`;
577
577
  }
578
- function gt(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i }) {
578
+ function _t(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i }) {
579
579
  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 = [[
580
580
  "Unit tests",
581
- z(i.testsInCI),
581
+ R(i.testsInCI),
582
582
  `[Vitest](https://vitest.dev) runs the unit tests.${o(i.testsInCI)}`
583
583
  ], [
584
584
  "Property-based tests",
585
- z(i.propertyTests),
585
+ R(i.propertyTests),
586
586
  `[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)}`
587
587
  ]];
588
588
  n !== void 0 && c.push([
589
589
  "Test coverage",
590
- z(!0),
591
- `${V(e, t, "Coverage", F)} [Vitest's V8 coverage](https://vitest.dev/guide/coverage) measures the share of source lines the unit tests run. The target is ${String(P)}%.`
590
+ R(!0),
591
+ `${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)}%.`
592
592
  ]);
593
593
  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 = [[
594
594
  "Code analysis",
595
- z(i.sonarCloud),
595
+ R(i.sonarCloud),
596
596
  `${i.sonarCloud ? l : ""}[SonarCloud](https://sonarcloud.io) checks every push for bugs, code smells and vulnerabilities.`
597
597
  ], [
598
598
  "Linting",
599
- z(i.lintInCI),
599
+ R(i.lintInCI),
600
600
  `[ESLint](https://eslint.org) checks the code for errors and style problems.${o(i.lintInCI)}`
601
601
  ]];
602
602
  r !== void 0 && u.unshift([
603
603
  "Code health",
604
- z(!0),
605
- `[${V(e, t, "Fallow code health", y)}](./${s}) [Fallow](https://github.com/fallow-rs/fallow) finds unused code, duplication, complexity and dependency problems.`
604
+ R(!0),
605
+ `[${B(e, t, "Fallow code health", y)}](./${s}) [Fallow](https://github.com/fallow-rs/fallow) finds unused code, duplication, complexity and dependency problems.`
606
606
  ]);
607
607
  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 = [
608
608
  [
609
609
  "Push protection",
610
- z(i.pushProtection),
610
+ R(i.pushProtection),
611
611
  "[GitHub push protection](https://docs.github.com/en/code-security/secret-scanning/push-protection-for-repositories-and-organizations) blocks pushes that contain credentials."
612
612
  ],
613
613
  [
614
614
  "Static analysis",
615
- z(d),
615
+ R(d),
616
616
  `${d ? f : ""}[CodeQL](https://codeql.github.com) scans${m} for security vulnerabilities, ${p}, on every push and pull request to \`main\` and weekly.`
617
617
  ],
618
618
  [
619
619
  "Secret scanning",
620
- z(i.secretScanning),
620
+ R(i.secretScanning),
621
621
  "[GitHub secret scanning](https://docs.github.com/en/code-security/secret-scanning) detects credentials, such as API keys and tokens, committed to the repository."
622
622
  ]
623
623
  ], g = "[Dependabot](https://docs.github.com/en/code-security/dependabot)", _ = [
624
624
  [
625
625
  "Vulnerability audit",
626
- z(i.npmAuditInCI),
626
+ R(i.npmAuditInCI),
627
627
  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)}`
628
628
  ],
629
629
  [
630
630
  "Supply chain risk",
631
- z(i.socket),
631
+ R(i.socket),
632
632
  "[Socket](https://socket.dev) flags malicious packages, typosquatting and suspicious behaviour that may not yet have a CVE."
633
633
  ],
634
634
  [
635
635
  "Security alerts",
636
- z(i.dependabotAlerts),
636
+ R(i.dependabotAlerts),
637
637
  `${g} alerts when a dependency has a known vulnerability, using the GitHub Advisory Database.`
638
638
  ],
639
639
  [
640
640
  "Security updates",
641
- z(i.dependabotSecurityUpdates),
642
- `${g} opens pull requests that update vulnerable dependencies.${R(i.dependabotSecurityUpdates)}`
641
+ R(i.dependabotSecurityUpdates),
642
+ `${g} opens pull requests that update vulnerable dependencies.${L(i.dependabotSecurityUpdates)}`
643
643
  ],
644
644
  [
645
645
  "Version updates",
646
- z(i.dependabotVersionUpdates),
647
- `${g} opens pull requests for new dependency versions.${R(i.dependabotVersionUpdates)}`
646
+ R(i.dependabotVersionUpdates),
647
+ `${g} opens pull requests for new dependency versions.${L(i.dependabotVersionUpdates)}`
648
648
  ]
649
649
  ];
650
650
  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.
651
651
 
652
- ${B("Testing", c)}${B("Code Quality", u)}${B("Security Analysis", h)}${B("Dependencies", _)}`;
652
+ ${z("Testing", c)}${z("Code Quality", u)}${z("Security Analysis", h)}${z("Dependencies", _)}`;
653
653
  }
654
- function _t(e, t, n, r, i) {
655
- let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 && ht(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.";
654
+ function vt(e, t, n, r, i) {
655
+ let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 && gt(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.";
656
656
  return `## Quality & Security
657
657
 
658
- ${gt(e, t, n)}### OpenSSF 🚧
658
+ ${_t(e, t, n)}### OpenSSF 🚧
659
659
 
660
660
  ${l}[![OpenSSF Scorecard](https://api.scorecard.dev/projects/${o}/badge)](https://scorecard.dev/viewer/?uri=${o})
661
661
 
@@ -667,37 +667,37 @@ Please do not open public GitHub issues for security vulnerabilities. ${u}`;
667
667
  }
668
668
  //#endregion
669
669
  //#region src/actions/documentUsage.ts
670
- var vt = "<!-- USAGE_START -->", yt = "<!-- USAGE_END -->", bt = /* @__PURE__ */ new Set([
670
+ var yt = "<!-- USAGE_START -->", bt = "<!-- USAGE_END -->", xt = /* @__PURE__ */ new Set([
671
671
  "connector",
672
672
  "cookbook",
673
673
  "presenter"
674
- ]), xt = /* @__PURE__ */ new Set(["development", "eslint"]), St = "> [!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.", Ct = "This repository manages itself using the actions it implements.", wt = "This repository is managed using the common set of actions provided by [@dpuse/dpuse-development](https://github.com/dpuse/dpuse-development).";
675
- async function Tt() {
674
+ ]), St = /* @__PURE__ */ new Set(["development", "eslint"]), Ct = "> [!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.", wt = "This repository manages itself using the actions it implements.", Tt = "This repository is managed using the common set of actions provided by [@dpuse/dpuse-development](https://github.com/dpuse/dpuse-development).";
675
+ async function Et() {
676
676
  try {
677
677
  f("Document Usage"), x("1️⃣ Insert usage content into 'README.md'");
678
- let [e, t] = await Promise.all([c("package.json"), c("config.json")]), r = Et(e), i = Dt(r), a = H(e.engines?.node), s = H(e.engines?.npm), l = H(e.devDependencies?.typescript), u = Ot(_(t.id), e.name), d = `${r.replace(/\.git$/, "")}/blob/main/package.json`, p = kt(u, r, i, a, s, l, `${e.name === "@dpuse/dpuse-development" ? Ct : wt} See the \`scripts\` block in [package.json](${d}) for details.`);
679
- await n(p, vt, yt), o("Usage documented");
678
+ let [e, t] = await Promise.all([c("package.json"), c("config.json")]), r = Dt(e), i = Ot(r), a = V(e.engines?.node), s = V(e.engines?.npm), l = V(e.devDependencies?.typescript), u = kt(_(t.id), e.name), d = `${r.replace(/\.git$/, "")}/blob/main/package.json`, p = At(u, r, i, a, s, l, `${e.name === "@dpuse/dpuse-development" ? wt : Tt} See the \`scripts\` block in [package.json](${d}) for details.`);
679
+ await n(p, yt, bt), o("Usage documented");
680
680
  } catch (e) {
681
681
  console.error("❌ Error documenting usage", e), process.exit(1);
682
682
  }
683
683
  }
684
- function Et(e) {
684
+ function Dt(e) {
685
685
  let t = e.repository, n = typeof t == "string" ? t : t?.url;
686
686
  if (n == null || n === "") throw Error("package.json 'repository' field is required to document usage.");
687
687
  return n.replace(/^git\+/, "");
688
688
  }
689
- function Dt(e) {
689
+ function Ot(e) {
690
690
  return (e.split("/").at(-1) ?? "").replace(/\.git$/, "");
691
691
  }
692
- function H(e) {
692
+ function V(e) {
693
693
  if (e == null) throw Error("package.json version range is required to document usage.");
694
694
  let t = /\d+(?:\.\d+)*/.exec(e);
695
695
  if (t == null) throw Error(`Unable to parse version from '${e}'.`);
696
696
  return t[0];
697
697
  }
698
- function Ot(e, t) {
698
+ function kt(e, t) {
699
699
  let { typeId: n } = e;
700
- if (bt.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.
700
+ if (xt.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.
701
701
 
702
702
  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.`;
703
703
  if (e.publishedTo === "npm") {
@@ -708,11 +708,11 @@ You may view or clone this repository for your own purposes, such as building a
708
708
  npm install ${t}
709
709
  \`\`\`
710
710
 
711
- ${xt.has(n) ? `${St}\n\n` : ""}To work on the source instead, clone this repository.`;
711
+ ${St.has(n) ? `${Ct}\n\n` : ""}To work on the source instead, clone this repository.`;
712
712
  }
713
713
  return "You may view or clone this repository for your own purposes.";
714
714
  }
715
- function kt(e, t, n, r, i, a, o) {
715
+ function At(e, t, n, r, i, a, o) {
716
716
  return `## Usage
717
717
 
718
718
  ${e}
@@ -729,87 +729,102 @@ ${o}`;
729
729
  }
730
730
  //#endregion
731
731
  //#region src/actions/documentApiReference.ts
732
- var U = "API_REFERENCE.md";
733
- async function At() {
732
+ var H = "API_REFERENCE.md";
733
+ async function jt() {
734
734
  try {
735
735
  f("Document API Reference");
736
- let { writeAPIReference: e } = await import("./apiReference-BazeHifT.js");
737
- await e("1️⃣ ", U), o("API reference documented");
736
+ let { writeAPIReference: e } = await import("./apiReference-Fj5_02JP.js");
737
+ await e("1️⃣ ", H), o("API reference documented");
738
738
  } catch (e) {
739
739
  console.error("❌ Error documenting API reference", e), process.exit(1);
740
740
  }
741
741
  }
742
742
  //#endregion
743
743
  //#region src/actions/documentBundleSizes.ts
744
- var W = "bundle-analysis-reports/sonda/index.json", jt = "<!-- BUNDLE_START -->", Mt = "<!-- BUNDLE_END -->", G = "&nbsp;&nbsp;&nbsp;&nbsp;", K = 20, q = "█", Nt = "▒", Pt = "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.", Ft = "↳ rows are part of the row above.", Y = "(bundler output, whitespace & JSON)", It = `${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.`;
745
- async function Lt(e) {
744
+ var U = "bundle-analysis-reports/sonda/index.json", Mt = "<!-- BUNDLE_START -->", Nt = "<!-- BUNDLE_END -->", W = "&nbsp;&nbsp;&nbsp;&nbsp;", G = 20, K = "█", q = "▒", Pt = 100 / G / 2, Ft = 100 / G, It = "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.", Lt = "↳ rows are part of the row above.", Y = "(bundler output, whitespace & JSON)", Rt = `${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.`;
745
+ async function zt(e) {
746
746
  try {
747
747
  f("Document Bundle Sizes"), x("1️⃣ Read bundle analysis report");
748
- let t = await c(W);
748
+ let t = await c(U);
749
749
  x("2️⃣ Insert table into 'README.md'");
750
- let r = Rt(t, e?.moduleLevel ?? !1), i = r.includes("↳") ? `${J} ${Ft}` : J;
751
- await n(`## Bundle Analysis\n\n${Pt}\n\n${r}\n\n${i}\n\n${It}`, jt, Mt), o("Bundle sizes documented");
750
+ let r = Bt(t, e?.moduleLevel ?? !1), i = r.includes("↳") ? `${J} ${Lt}` : J;
751
+ await n(`## Bundle Analysis\n\n${It}\n\n${r}\n\n${i}\n\n${Rt}`, Mt, Nt), o("Bundle sizes documented");
752
752
  } catch (e) {
753
753
  console.error("❌ Error documenting bundle sizes", e), process.exit(1);
754
754
  }
755
755
  }
756
- function Rt(e, t) {
757
- let n = Wt(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, Z(e)]).toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), a = ["|Chunk/Module/File|Composition|", "|:------ |:-----------|"];
756
+ function Bt(e, t) {
757
+ let n = qt(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|", "|:------ |:-----------|"];
758
758
  for (let [e, o] of i) {
759
- let i = [...n.get(e) ?? /* @__PURE__ */ new Map()].toSorted(zt), s = i.reduce((e, [, t]) => e + t.sizes.uncompressed, 0), c = s > 0 && r > 0 ? ` · ${Zt(s, r)} of the build` : "";
760
- a.push(`| **${e}** | ${Jt(o)}${c} |`, ...Bt(i, s, t));
759
+ let i = [...n.get(e) ?? /* @__PURE__ */ new Map()].toSorted(Vt), s = i.reduce((e, [, t]) => e + t.sizes.uncompressed, 0), c = s > 0 && r > 0 ? ` · ${tn(s, r)} of the build` : "";
760
+ a.push(`| **${e}** | ${Zt(o)}${c} |`, ...Ht(i, s, t));
761
761
  }
762
762
  return a.join("\n");
763
763
  }
764
- function zt(e, t) {
764
+ function Vt(e, t) {
765
765
  return e[0] === Y == (t[0] === Y) ? t[1].sizes.uncompressed - e[1].sizes.uncompressed : e[0] === Y ? 1 : -1;
766
766
  }
767
- function Bt(e, t, n) {
767
+ function Ht(e, t, n) {
768
768
  let r = [];
769
769
  for (let [i, { sizes: a, files: o }] of e) {
770
770
  if (o.size === 1) {
771
- let e = Ut(o);
772
- r.push(`| ${G}${Ht(i, e)} | ${X(a.uncompressed, t)} |`);
771
+ let e = Kt(o);
772
+ r.push(`| ${W}${Gt(i, e)} | ${X(a.uncompressed, t)} |`);
773
773
  continue;
774
774
  }
775
- r.push(`| ${G}${i} | ${X(a.uncompressed, t)} |`), n || r.push(...Vt(o, t));
775
+ r.push(`| ${W}${i} | ${X(a.uncompressed, t)} |`), n || r.push(...Ut(o, t));
776
776
  }
777
777
  return r;
778
778
  }
779
- function Vt(e, t) {
780
- return [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed).map(([e, n]) => `| ${G}${G}↳ ${e} | ${X(n.uncompressed, t, Nt)} |`);
779
+ function Ut(e, t) {
780
+ let n = [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), r = Wt(n, t), i = (r > 0 ? n.slice(0, -r) : n).map(([e, n]) => `| ${W}${W}↳ ${e} | ${X(n.uncompressed, t, q)} |`);
781
+ if (r > 0) {
782
+ let e = n.slice(-r).reduce((e, [, t]) => e + t.uncompressed, 0);
783
+ i.push(`| ${W}${W}↳ ${String(r)} smaller files | ${X(e, t, q)} |`);
784
+ }
785
+ return i;
786
+ }
787
+ function Wt(e, t) {
788
+ if (t <= 0) return 0;
789
+ let n = 0, r = 0;
790
+ for (let [, i] of e.toReversed()) {
791
+ let e = i.uncompressed / t * 100 < Pt, a = (r + i.uncompressed) / t * 100 <= Ft;
792
+ if (!e || !a) break;
793
+ n++, r += i.uncompressed;
794
+ }
795
+ return n >= 2 ? n : 0;
781
796
  }
782
- function X(e, t, n = q) {
783
- return `${Yt(t > 0 ? e / t * 100 : 0, n)} · ${$(e)}`;
797
+ function X(e, t, n = K) {
798
+ return `${Qt(t > 0 ? e / t * 100 : 0, n)} · ${$(e)}`;
784
799
  }
785
- function Ht(e, t) {
800
+ function Gt(e, t) {
786
801
  return t === "" ? e : `${e} → ${t}`;
787
802
  }
788
- function Ut(e) {
803
+ function Kt(e) {
789
804
  let [t] = e.keys();
790
805
  if (t === void 0) throw Error("Expected exactly one file");
791
806
  return t;
792
807
  }
793
- function Wt(e) {
794
- let t = Gt(e.dependencies), n = /* @__PURE__ */ new Map();
808
+ function qt(e) {
809
+ let t = Jt(e.dependencies), n = /* @__PURE__ */ new Map();
795
810
  for (let r of e.resources) {
796
811
  if (r.kind !== "chunk" || !r.parent) continue;
797
- let { group: e, file: i } = Kt(r.name, t), a = Z(r), o = n.get(r.parent) ?? /* @__PURE__ */ new Map();
812
+ let { group: e, file: i } = Yt(r.name, t), a = Q(r), o = n.get(r.parent) ?? /* @__PURE__ */ new Map();
798
813
  n.set(r.parent, o);
799
814
  let s = o.get(e) ?? {
800
- sizes: Q(),
815
+ sizes: $t(),
801
816
  files: /* @__PURE__ */ new Map()
802
817
  };
803
- o.set(e, s), Xt(s.sizes, a);
804
- let c = s.files.get(i) ?? Q();
805
- s.files.set(i, c), Xt(c, a);
818
+ o.set(e, s), en(s.sizes, a);
819
+ let c = s.files.get(i) ?? $t();
820
+ s.files.set(i, c), en(c, a);
806
821
  }
807
822
  return n;
808
823
  }
809
- function Gt(e) {
824
+ function Jt(e) {
810
825
  return e.flatMap((e) => e.paths.map((t) => [t, e.name])).toSorted((e, t) => t[0].length - e[0].length);
811
826
  }
812
- function Kt(e, t) {
827
+ function Yt(e, t) {
813
828
  let n = t.find(([t]) => e === t || e.startsWith(`${t}/`));
814
829
  if (n) {
815
830
  let [t, r] = n;
@@ -824,37 +839,44 @@ function Kt(e, t) {
824
839
  } : e.startsWith("\0") ? {
825
840
  group: "(runtime)",
826
841
  file: e.slice(1)
842
+ } : e.startsWith("rust/") ? {
843
+ group: "wasm",
844
+ file: Xt(e)
827
845
  } : {
828
- group: e.startsWith("rust/") || e.includes("vite-plugin-wasm") ? "wasm" : "src",
829
- file: qt(e)
846
+ group: e.includes("vite-plugin-wasm") ? "wasm" : "src",
847
+ file: Z(e)
830
848
  };
831
849
  }
832
- function qt(e) {
833
- return e.split("/").at(-1) ?? e;
850
+ function Xt(e) {
851
+ let t = e.split("/", 2)[1] ?? "", n = Z(e);
852
+ return t !== "" && n.startsWith(t) ? `…${n.slice(t.length)}` : n;
834
853
  }
835
854
  function Z(e) {
855
+ return e.split("/").at(-1) ?? e;
856
+ }
857
+ function Q(e) {
836
858
  return {
837
859
  uncompressed: e.uncompressed,
838
860
  gzip: e.gzip ?? 0
839
861
  };
840
862
  }
841
- function Jt(e) {
863
+ function Zt(e) {
842
864
  return `${$(e.uncompressed)} · gzip ${$(e.gzip)}`;
843
865
  }
844
- function Yt(e, t = q) {
845
- let n = Math.round(e / 100 * K);
846
- return `\`${t.repeat(n)}${"░".repeat(K - n)}\` ${e.toFixed(1)}%`;
866
+ function Qt(e, t = K) {
867
+ let n = Math.round(e / 100 * G);
868
+ return `\`${t.repeat(n)}${"░".repeat(G - n)}\` ${e.toFixed(1)}%`;
847
869
  }
848
- function Q() {
870
+ function $t() {
849
871
  return {
850
872
  uncompressed: 0,
851
873
  gzip: 0
852
874
  };
853
875
  }
854
- function Xt(e, t) {
876
+ function en(e, t) {
855
877
  e.uncompressed += t.uncompressed, e.gzip += t.gzip;
856
878
  }
857
- function Zt(e, t) {
879
+ function tn(e, t) {
858
880
  return `${(e / t * 100).toFixed(1)}%`;
859
881
  }
860
882
  function $(e) {
@@ -862,15 +884,15 @@ function $(e) {
862
884
  }
863
885
  //#endregion
864
886
  //#region src/actions/documentProject.ts
865
- async function Qt(e = "MIT", t = !1) {
887
+ async function nn(e = "MIT", t = !1) {
866
888
  try {
867
889
  let n = await c("config.json"), r = _(n.id).typeId === "connector";
868
- await Ye(), r && await ke(), await Tt(), await Fe(e), await i("bundle-analysis-reports/sonda/index.json") === null ? x(`ℹ️ Bundle sizes NOT documented, as there is no '${W}' yet. Build the project first.`) : await Lt({ moduleLevel: t }), await st(), await Ae();
869
- let a = await i(U) !== null;
870
- a ? await At() : x(`ℹ️ '${U}' NOT required by this project`), await S("ℹ️ Format generated files", "prettier", [
890
+ await Ye(), r && await ke(), await Et(), 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 zt({ moduleLevel: t }), await ct(), await Ae();
891
+ let a = await i(H) !== null;
892
+ a ? await jt() : x(`ℹ️ '${H}' NOT required by this project`), await S("ℹ️ Format generated files", "prettier", [
871
893
  "--write",
872
894
  "README.md",
873
- ...a ? [U] : []
895
+ ...a ? [H] : []
874
896
  ]);
875
897
  } catch (e) {
876
898
  console.error("❌ Error documenting project", e), process.exit(1);
@@ -878,7 +900,7 @@ async function Qt(e = "MIT", t = !1) {
878
900
  }
879
901
  //#endregion
880
902
  //#region src/actions/formatCode.ts
881
- async function $t() {
903
+ async function rn() {
882
904
  try {
883
905
  f("Format Code");
884
906
  let e = [
@@ -899,7 +921,7 @@ async function $t() {
899
921
  }
900
922
  //#endregion
901
923
  //#region src/actions/lintCode.ts
902
- async function en() {
924
+ async function an() {
903
925
  try {
904
926
  f("Lint Code"), await S("1️⃣ Lint", "eslint", ["."]), o("Code linted");
905
927
  } catch (e) {
@@ -908,7 +930,7 @@ async function en() {
908
930
  }
909
931
  //#endregion
910
932
  //#region src/utilities/cloudflare.ts
911
- async function tn() {
933
+ async function on() {
912
934
  let e = await c("config.json"), t = {
913
935
  body: JSON.stringify(e),
914
936
  headers: { "Content-Type": "application/json" },
@@ -916,7 +938,7 @@ async function tn() {
916
938
  }, n = await fetch(`https://api.dpuse.app/configs/${e.id}`, t);
917
939
  if (!n.ok) throw Error(await n.text());
918
940
  }
919
- async function nn(e, t) {
941
+ async function sn(e, t) {
920
942
  async function n(e, t, r) {
921
943
  for (let i of r) {
922
944
  let r = `${e}/${i}`, a = `${t}/${i}`;
@@ -934,7 +956,7 @@ async function nn(e, t) {
934
956
  let r = await v(`${e}/${t}/`);
935
957
  await n(`${e}/${t}`, t, r);
936
958
  }
937
- async function rn(e) {
959
+ async function cn(e) {
938
960
  let t = e.id, n = {
939
961
  body: JSON.stringify(e),
940
962
  headers: { "Content-Type": "application/json" },
@@ -942,7 +964,7 @@ async function rn(e) {
942
964
  }, r = await fetch(`https://api.dpuse.app/configs/${t}`, n);
943
965
  if (!r.ok) throw Error(await r.text());
944
966
  }
945
- async function an(e, t) {
967
+ async function ln(e, t) {
946
968
  let n = `v${e.version ?? "unknown"}`;
947
969
  async function r(e, r = "") {
948
970
  let i = await v(e, { withFileTypes: !0 });
@@ -966,34 +988,34 @@ async function an(e, t) {
966
988
  }
967
989
  //#endregion
968
990
  //#region src/actions/publishProject.ts
969
- async function on() {
991
+ async function un() {
970
992
  try {
971
993
  f("Publish Project");
972
994
  let e = await c("package.json"), t = await c("config.json"), n = _(t.id);
973
- n.publishedTo === "npm" ? await S("1️⃣ Publish to npm", "npm", ["publish", "--provenance"]) : x("1️⃣ Publishing to npm NOT required"), await sn("2️⃣ ", e, t, n), o(`Project version '${e.version ?? "unknown"}' published.`);
995
+ n.publishedTo === "npm" ? await S("1️⃣ Publish to npm", "npm", ["publish", "--provenance"]) : x("1️⃣ Publishing to npm NOT required"), await dn("2️⃣ ", e, t, n), o(`Project version '${e.version ?? "unknown"}' published.`);
974
996
  } catch (e) {
975
997
  console.error("❌ Error publishing project", e), process.exit(1);
976
998
  }
977
999
  }
978
- async function sn(e, t, n, r) {
979
- if (r.typeId === "app") x(`${e} Register module`), await tn();
980
- else if (r.typeId === "engine") x(`${e} Register module`), await an(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await rn(n);
1000
+ async function dn(e, t, n, r) {
1001
+ if (r.typeId === "app") x(`${e} Register module`), await on();
1002
+ else if (r.typeId === "engine") x(`${e} Register module`), await ln(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await cn(n);
981
1003
  else if (r.uploadGroupName === void 0) x(`${e} Registration NOT required`);
982
1004
  else {
983
1005
  x(`${e} Register module`);
984
1006
  let i = n.id.split("-").slice(2).join("-");
985
- await an(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await rn(n);
1007
+ await ln(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await cn(n);
986
1008
  }
987
1009
  }
988
1010
  //#endregion
989
1011
  //#region src/actions/releaseProject.ts
990
- async function cn(e = "MIT", t = !1) {
1012
+ async function fn(e = "MIT", t = !1) {
991
1013
  try {
992
1014
  f("Release Project");
993
1015
  let n = await c("package.json"), r = await c("config.json"), i = _(r.id);
994
1016
  await b("1️⃣ ", n);
995
1017
  let a = await g("2️⃣ ", n, i);
996
- if (await D("3️⃣ ", n), x("4️⃣ Regenerate README"), await Qt(e, t), await d("5️⃣ Stage changes", "git", ["add", "."]), await d("6️⃣ Commit changes", "git", [
1018
+ if (await D("3️⃣ ", n), x("4️⃣ Regenerate README"), await nn(e, t), await d("5️⃣ Stage changes", "git", ["add", "."]), await d("6️⃣ Commit changes", "git", [
997
1019
  "commit",
998
1020
  "-m",
999
1021
  `v${n.version ?? "unknown"}`
@@ -1001,7 +1023,7 @@ async function cn(e = "MIT", t = !1) {
1001
1023
  "push",
1002
1024
  "origin",
1003
1025
  "main:main"
1004
- ]), await sn("8️⃣ ", n, a, i), i.publishedTo === "npm") {
1026
+ ]), await dn("8️⃣ ", n, a, i), i.publishedTo === "npm") {
1005
1027
  let e = `v${n.version ?? "unknown"}`;
1006
1028
  await S("9️⃣ Create GitHub release", "gh", [
1007
1029
  "release",
@@ -1020,7 +1042,7 @@ async function cn(e = "MIT", t = !1) {
1020
1042
  }
1021
1043
  //#endregion
1022
1044
  //#region src/actions/syncProjectWithGitHub.ts
1023
- async function ln() {
1045
+ async function pn() {
1024
1046
  try {
1025
1047
  f("Synchronise Project with GitHub");
1026
1048
  let e = await c("package.json"), t = await c("config.json"), n = _(t.id);
@@ -1039,12 +1061,12 @@ async function ln() {
1039
1061
  }
1040
1062
  //#endregion
1041
1063
  //#region src/actions/testProject.ts
1042
- var un = [
1064
+ var mn = [
1043
1065
  "1️⃣ ",
1044
1066
  "2️⃣ ",
1045
1067
  "3️⃣ ",
1046
1068
  "4️⃣ "
1047
- ], dn = [{
1069
+ ], hn = [{
1048
1070
  id: "unit",
1049
1071
  label: "Run unit tests",
1050
1072
  command: "vitest",
@@ -1057,13 +1079,13 @@ var un = [
1057
1079
  arguments: ["test", "--pass-with-no-tests"],
1058
1080
  configFileName: "playwright.config.ts"
1059
1081
  }];
1060
- async function fn(e = ["unit"]) {
1082
+ async function gn(e = ["unit"]) {
1061
1083
  try {
1062
1084
  f("Test Project");
1063
1085
  let t = 0;
1064
- for (let n of dn) {
1086
+ for (let n of hn) {
1065
1087
  if (!e.includes(n.id) || await i(n.configFileName) === null) continue;
1066
- let r = `${un[t] ?? ""} ${n.label}`;
1088
+ let r = `${mn[t] ?? ""} ${n.label}`;
1067
1089
  await S(r, n.command, n.arguments), t += 1;
1068
1090
  }
1069
1091
  if (t === 0) {
@@ -1076,4 +1098,4 @@ async function fn(e = ["unit"]) {
1076
1098
  }
1077
1099
  }
1078
1100
  //#endregion
1079
- export { ue as auditDependencies, de as buildProject, Ce as checkProject, Qt as documentProject, $t as formatCode, en as lintCode, on as publishProject, cn as releaseProject, ln as syncProjectWithGitHub, fn as testProject, nn as uploadDirectoryToR2 };
1101
+ export { ue as auditDependencies, de as buildProject, Ce as checkProject, nn as documentProject, rn as formatCode, an as lintCode, un as publishProject, fn as releaseProject, pn as syncProjectWithGitHub, gn as testProject, sn as uploadDirectoryToR2 };