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