@dpuse/dpuse-development 0.3.756 → 0.3.765
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
CHANGED
|
@@ -101,6 +101,10 @@ The package implements the following actions:
|
|
|
101
101
|
|
|
102
102
|
All actions are designed to be run from `package.json` scripts and assume that the project follows the standard DPUse directory structure and that it includes a `config.json` file in the root directory.
|
|
103
103
|
|
|
104
|
+
## API Reference
|
|
105
|
+
|
|
106
|
+
See [API_REFERENCE.md](./API_REFERENCE.md) for the complete API reference, including every exported action and type.
|
|
107
|
+
|
|
104
108
|
<!-- DEPENDENCY_LICENSES_START -->
|
|
105
109
|
|
|
106
110
|
## Dependency Licenses
|
|
@@ -120,18 +124,18 @@ _Note: Sonda's Vite reports currently exclude CSS files, since Vite does not gen
|
|
|
120
124
|
|
|
121
125
|
|Chunk/Module/File|Composition|
|
|
122
126
|
|:------ |:-----------|
|
|
123
|
-
| dist/dpuse-development.es.js |
|
|
124
|
-
| acorn → dist/acorn.mjs | `████████░░░░░░░░░░░░`
|
|
125
|
-
| acorn-typescript → lib/index.mjs | `███████░░░░░░░░░░░░░`
|
|
126
|
-
| src | `███░░░░░░░░░░░░░░░░░`
|
|
127
|
+
| dist/dpuse-development.es.js | 331.1 kB · gzip 85.7 kB |
|
|
128
|
+
| acorn → dist/acorn.mjs | `████████░░░░░░░░░░░░` 39.5% |
|
|
129
|
+
| acorn-typescript → lib/index.mjs | `███████░░░░░░░░░░░░░` 34.6% |
|
|
130
|
+
| src | `███░░░░░░░░░░░░░░░░░` 15.7% |
|
|
127
131
|
| documentGovernance.ts | `█░░░░░░░░░░░░░░░░░░░` 2.7% |
|
|
132
|
+
| documentApiReference.ts | `░░░░░░░░░░░░░░░░░░░░` 2.2% |
|
|
128
133
|
| documentDependencies.ts | `░░░░░░░░░░░░░░░░░░░░` 1.7% |
|
|
129
134
|
| manageProject.ts | `░░░░░░░░░░░░░░░░░░░░` 1.7% |
|
|
130
135
|
| index.ts | `░░░░░░░░░░░░░░░░░░░░` 1.6% |
|
|
131
136
|
| documentUsage.ts | `░░░░░░░░░░░░░░░░░░░░` 1.3% |
|
|
132
137
|
| documentBundleSizes.ts | `░░░░░░░░░░░░░░░░░░░░` 1.3% |
|
|
133
138
|
| checkConfigFiles.ts | `░░░░░░░░░░░░░░░░░░░░` 1.1% |
|
|
134
|
-
| documentApiReference.ts | `░░░░░░░░░░░░░░░░░░░░` 1.0% |
|
|
135
139
|
| documentActions.ts | `░░░░░░░░░░░░░░░░░░░░` 0.5% |
|
|
136
140
|
| documentOpening.ts | `░░░░░░░░░░░░░░░░░░░░` 0.5% |
|
|
137
141
|
| cloudflare.ts | `░░░░░░░░░░░░░░░░░░░░` 0.5% |
|
|
@@ -139,8 +143,8 @@ _Note: Sonda's Vite reports currently exclude CSS files, since Vite does not gen
|
|
|
139
143
|
| formatCode.ts | `░░░░░░░░░░░░░░░░░░░░` 0.1% |
|
|
140
144
|
| auditDependencies.ts | `░░░░░░░░░░░░░░░░░░░░` 0.1% |
|
|
141
145
|
| lintCode.ts | `░░░░░░░░░░░░░░░░░░░░` 0.1% |
|
|
142
|
-
| (bundler output, whitespace & JSON) | `█░░░░░░░░░░░░░░░░░░░` 6.
|
|
143
|
-
| @dpuse/dpuse-shared | `█░░░░░░░░░░░░░░░░░░░` 3.
|
|
146
|
+
| (bundler output, whitespace & JSON) | `█░░░░░░░░░░░░░░░░░░░` 6.6% |
|
|
147
|
+
| @dpuse/dpuse-shared | `█░░░░░░░░░░░░░░░░░░░` 3.4% |
|
|
144
148
|
| dist/componentConfig.schema-DT3mO5rS.js | `█░░░░░░░░░░░░░░░░░░░` 2.6% |
|
|
145
149
|
| dist/dpuse-shared-componentModuleConnector.es.js | `░░░░░░░░░░░░░░░░░░░░` 0.7% |
|
|
146
150
|
| dist/moduleConfig.schema-aYmFWSrn.js | `░░░░░░░░░░░░░░░░░░░░` 0.1% |
|
|
@@ -163,7 +167,7 @@ This section is updated each time `npm run document` is run. Settings come from
|
|
|
163
167
|
|:-|:-|:-|
|
|
164
168
|
|Unit tests|✅ On|Run in CI on every push to `main`.|
|
|
165
169
|
|Property-based tests|✅ fast-check|Fuzz testing: many random inputs per test to find edge cases, run with the unit tests.|
|
|
166
|
-
|Test coverage|✅ 99.
|
|
170
|
+
|Test coverage|✅ 99.7% of lines|Share of source lines the unit tests run. The target is 80%.|
|
|
167
171
|
|
|
168
172
|
### Code Quality
|
|
169
173
|
|
|
@@ -7078,11 +7078,11 @@ async function va(e) {
|
|
|
7078
7078
|
q(`${e} Write '${ma}'`);
|
|
7079
7079
|
let t = ya(await W("package.json"));
|
|
7080
7080
|
if (t.length === 0) throw Error("package.json 'exports' must name at least one import path with types to document the API reference.");
|
|
7081
|
-
let n = l.createProgram(t.map(({ sourcePath: e }) => e), ba()), r = n.getTypeChecker();
|
|
7081
|
+
let n = l.createProgram(t.map(({ sourcePath: e }) => e), ba()), r = n.getTypeChecker(), i = Da(n, r);
|
|
7082
7082
|
await Gn(ma, `# API Reference\n\n${ga}\n\n${t.map(({ importPath: e, sourcePath: t }) => {
|
|
7083
|
-
let
|
|
7084
|
-
if (
|
|
7085
|
-
return
|
|
7083
|
+
let a = n.getSourceFile(t);
|
|
7084
|
+
if (a === void 0) throw Error(`Unable to read '${t}', the source of '${e}'.`);
|
|
7085
|
+
return Ra(e, xa(r, a, i));
|
|
7086
7086
|
}).join("\n\n")}\n`);
|
|
7087
7087
|
}
|
|
7088
7088
|
function ya(e) {
|
|
@@ -7105,70 +7105,178 @@ function ba() {
|
|
|
7105
7105
|
let { config: t } = l.readConfigFile(e, (e) => l.sys.readFile(e));
|
|
7106
7106
|
return l.parseJsonConfigFileContent(t, l.sys, process.cwd()).options;
|
|
7107
7107
|
}
|
|
7108
|
-
function xa(e, t) {
|
|
7109
|
-
let
|
|
7110
|
-
for (let t of
|
|
7111
|
-
let
|
|
7112
|
-
|
|
7108
|
+
function xa(e, t, n) {
|
|
7109
|
+
let r = new Map(ha.map((e) => [e, []])), i = e.getSymbolAtLocation(t), a = i === void 0 ? [] : e.getExportsOfModule(i);
|
|
7110
|
+
for (let t of a) {
|
|
7111
|
+
let i = Pa(e, t), a = Sa(e, Fa(t, i), i, n);
|
|
7112
|
+
a !== void 0 && r.get(a.kind)?.push({
|
|
7113
|
+
...a,
|
|
7114
|
+
description: Ca(e, i)
|
|
7115
|
+
});
|
|
7113
7116
|
}
|
|
7114
|
-
for (let e of
|
|
7115
|
-
return
|
|
7117
|
+
for (let e of r.values()) e.sort((e, t) => e.name.localeCompare(t.name));
|
|
7118
|
+
return r;
|
|
7116
7119
|
}
|
|
7117
|
-
function Sa(e, t, n) {
|
|
7118
|
-
let [
|
|
7119
|
-
return
|
|
7120
|
+
function Sa(e, t, n, r) {
|
|
7121
|
+
let [i] = (n.flags & (l.SymbolFlags.Function | l.SymbolFlags.Variable)) === 0 ? [] : e.getSignaturesOfType(e.getTypeOfSymbol(n), l.SignatureKind.Call), a = t.endsWith("Schema");
|
|
7122
|
+
return i !== void 0 && !a ? {
|
|
7123
|
+
detail: `(${i.parameters.map((t) => Ia(e, t)).join(", ")})`,
|
|
7120
7124
|
kind: "Functions",
|
|
7121
|
-
|
|
7122
|
-
|
|
7125
|
+
name: t,
|
|
7126
|
+
origin: ""
|
|
7127
|
+
} : (n.flags & l.SymbolFlags.Class) === 0 ? a && (n.flags & l.SymbolFlags.Variable) !== 0 ? {
|
|
7128
|
+
detail: "",
|
|
7129
|
+
kind: "Schemas",
|
|
7130
|
+
name: t,
|
|
7131
|
+
origin: ""
|
|
7132
|
+
} : (n.flags & l.SymbolFlags.Variable) === 0 ? (n.flags & (l.SymbolFlags.Enum | l.SymbolFlags.Interface | l.SymbolFlags.TypeAlias)) === 0 ? void 0 : {
|
|
7133
|
+
detail: "",
|
|
7123
7134
|
kind: "Types",
|
|
7124
|
-
|
|
7135
|
+
name: t,
|
|
7136
|
+
origin: Ta(e, n, r)
|
|
7125
7137
|
} : {
|
|
7126
|
-
|
|
7127
|
-
|
|
7138
|
+
detail: `: ${wa(e, n)}`,
|
|
7139
|
+
kind: "Constants",
|
|
7140
|
+
name: t,
|
|
7141
|
+
origin: ""
|
|
7128
7142
|
} : {
|
|
7143
|
+
detail: "",
|
|
7129
7144
|
kind: "Classes",
|
|
7130
|
-
|
|
7145
|
+
name: t,
|
|
7146
|
+
origin: Ta(e, n, r)
|
|
7131
7147
|
};
|
|
7132
7148
|
}
|
|
7133
7149
|
function Ca(e, t) {
|
|
7150
|
+
let n = l.displayPartsToString(t.getDocumentationComment(e)).replaceAll(/\s+/g, " ").trim();
|
|
7151
|
+
return n === "" ? void 0 : n;
|
|
7152
|
+
}
|
|
7153
|
+
function wa(e, t) {
|
|
7154
|
+
let n = t.valueDeclaration, r = n !== void 0 && l.isVariableDeclaration(n) ? n : void 0, i = r?.initializer, a = i !== void 0 && l.isAsExpression(i) && !l.isConstTypeReference(i.type), o = r?.type ?? (a ? i.type : void 0);
|
|
7155
|
+
return o === void 0 ? e.typeToString(e.getBaseTypeOfLiteralType(e.getTypeOfSymbol(t)), n) : La(o);
|
|
7156
|
+
}
|
|
7157
|
+
function Ta(e, t, n) {
|
|
7158
|
+
let r = (t.declarations ?? []).flatMap((e) => l.isClassDeclaration(e) || l.isInterfaceDeclaration(e) ? [...e.heritageClauses ?? []] : []).map((e) => `${e.token === l.SyntaxKind.ExtendsKeyword ? "extends" : "implements"} ${e.types.map((e) => e.getText()).join(", ")}`), i = t.declarations?.find((e) => l.isTypeAliasDeclaration(e)), a = i === void 0 ? void 0 : ka(i);
|
|
7159
|
+
if (i !== void 0 && a !== void 0) {
|
|
7160
|
+
r.push(`inferred from ${a.getText()}`);
|
|
7161
|
+
let t = Aa(e, i), o = t === void 0 ? [] : Ea(e, t, i.name.text, n);
|
|
7162
|
+
o.length > 0 && r.push(`extends ${o.join(", ")}`);
|
|
7163
|
+
}
|
|
7164
|
+
return r.length === 0 ? "" : ` (${r.join(", ")})`;
|
|
7165
|
+
}
|
|
7166
|
+
function Ea(e, t, n, r) {
|
|
7167
|
+
return t.properties.flatMap((t) => {
|
|
7168
|
+
let i = l.isSpreadAssignment(t) ? Ma(e, t.expression) : void 0;
|
|
7169
|
+
if (i === void 0) return [];
|
|
7170
|
+
let a = r.get(i);
|
|
7171
|
+
return a === n ? Ea(e, i, n, r) : a === void 0 ? [] : [a];
|
|
7172
|
+
});
|
|
7173
|
+
}
|
|
7174
|
+
function Da(e, t) {
|
|
7175
|
+
let n = /* @__PURE__ */ new Map(), r = e.getSourceFiles().filter((t) => !t.isDeclarationFile && !e.isSourceFileFromExternalLibrary(t)).flatMap((e) => e.statements.filter((e) => l.isTypeAliasDeclaration(e)));
|
|
7176
|
+
for (let e of r) for (let { addedFieldCount: r, group: i } of Oa(t, e)) n.set(i, [...n.get(i) ?? [], {
|
|
7177
|
+
addedFieldCount: r,
|
|
7178
|
+
typeName: e.name.text
|
|
7179
|
+
}]);
|
|
7180
|
+
let i = /* @__PURE__ */ new Map();
|
|
7181
|
+
for (let [e, t] of n) {
|
|
7182
|
+
let n = Math.min(...t.map(({ addedFieldCount: e }) => e)), [r, ...a] = t.filter(({ addedFieldCount: e }) => e === n);
|
|
7183
|
+
r !== void 0 && a.length === 0 && i.set(e, r.typeName);
|
|
7184
|
+
}
|
|
7185
|
+
return i;
|
|
7186
|
+
}
|
|
7187
|
+
function Oa(e, t) {
|
|
7188
|
+
let n = Aa(e, t);
|
|
7189
|
+
if (n === void 0) return [];
|
|
7190
|
+
let r = l.isVariableDeclaration(n.parent) ? [{
|
|
7191
|
+
addedFieldCount: 0,
|
|
7192
|
+
group: n
|
|
7193
|
+
}] : [], i = n.properties.flatMap((t) => {
|
|
7194
|
+
let r = l.isSpreadAssignment(t) ? Ma(e, t.expression) : void 0;
|
|
7195
|
+
return r === void 0 ? [] : [{
|
|
7196
|
+
addedFieldCount: n.properties.length - 1,
|
|
7197
|
+
group: r
|
|
7198
|
+
}];
|
|
7199
|
+
});
|
|
7200
|
+
return [...r, ...i];
|
|
7201
|
+
}
|
|
7202
|
+
function ka(e) {
|
|
7203
|
+
let [t] = ja(e.type, "InferOutput") ? e.type.typeArguments ?? [] : [];
|
|
7204
|
+
if (t === void 0) return;
|
|
7205
|
+
if (l.isTypeQueryNode(t)) return t.exprName;
|
|
7206
|
+
let [n] = ja(t, "ReturnType") ? t.typeArguments ?? [] : [], [r] = n !== void 0 && l.isTypeQueryNode(n) ? n.typeArguments ?? [] : [];
|
|
7207
|
+
return r !== void 0 && l.isTypeQueryNode(r) ? r.exprName : void 0;
|
|
7208
|
+
}
|
|
7209
|
+
function Aa(e, t) {
|
|
7210
|
+
let n = ka(t), r = n === void 0 ? void 0 : Na(e, n);
|
|
7211
|
+
if (r === void 0) return;
|
|
7212
|
+
if (l.isObjectLiteralExpression(r)) return r;
|
|
7213
|
+
let [i] = l.isCallExpression(r) ? r.arguments : [];
|
|
7214
|
+
return i === void 0 ? void 0 : Ma(e, i);
|
|
7215
|
+
}
|
|
7216
|
+
function ja(e, t) {
|
|
7217
|
+
return l.isTypeReferenceNode(e) ? (l.isQualifiedName(e.typeName) ? e.typeName.right : e.typeName).text === t : !1;
|
|
7218
|
+
}
|
|
7219
|
+
function Ma(e, t) {
|
|
7220
|
+
if (l.isObjectLiteralExpression(t)) return t;
|
|
7221
|
+
let n = Na(e, t);
|
|
7222
|
+
return n !== void 0 && l.isObjectLiteralExpression(n) ? n : void 0;
|
|
7223
|
+
}
|
|
7224
|
+
function Na(e, t) {
|
|
7225
|
+
let n = e.getSymbolAtLocation(t), r = n === void 0 ? void 0 : Pa(e, n).valueDeclaration;
|
|
7226
|
+
return r !== void 0 && l.isVariableDeclaration(r) ? r.initializer : void 0;
|
|
7227
|
+
}
|
|
7228
|
+
function Pa(e, t) {
|
|
7229
|
+
return (t.flags & l.SymbolFlags.Alias) === 0 ? t : e.getAliasedSymbol(t);
|
|
7230
|
+
}
|
|
7231
|
+
function Fa(e, t) {
|
|
7134
7232
|
if (e.name !== "default") return e.name;
|
|
7135
7233
|
let n = t.declarations?.map((e) => l.getNameOfDeclaration(e)?.getText()).find((e) => e !== void 0);
|
|
7136
7234
|
return n === void 0 || n === "default" ? "default" : `default (${n})`;
|
|
7137
7235
|
}
|
|
7138
|
-
function
|
|
7139
|
-
let
|
|
7140
|
-
return `${
|
|
7236
|
+
function Ia(e, t) {
|
|
7237
|
+
let n = t.valueDeclaration, r = n !== void 0 && l.isParameter(n) ? n : void 0, i = r?.questionToken !== void 0 || r?.initializer !== void 0, a = r?.type === void 0 ? e.typeToString(e.getTypeOfSymbol(t), n) : La(r.type);
|
|
7238
|
+
return `${t.name}${i ? "?" : ""}: ${a}`;
|
|
7239
|
+
}
|
|
7240
|
+
function La(e) {
|
|
7241
|
+
return e.getText().replaceAll(/\s+/g, " ");
|
|
7141
7242
|
}
|
|
7142
|
-
function
|
|
7243
|
+
function Ra(e, t) {
|
|
7143
7244
|
let n = ha.flatMap((e) => {
|
|
7144
|
-
let n = t.get(e) ?? [], r = n.map((e) =>
|
|
7245
|
+
let n = t.get(e) ?? [], r = n.map((e) => za(e));
|
|
7145
7246
|
return n.length === 0 ? [] : [`### ${e}\n\n${r.join("\n")}`];
|
|
7146
7247
|
});
|
|
7147
7248
|
return [`## ${e}`, ...n].join("\n\n");
|
|
7148
7249
|
}
|
|
7250
|
+
function za({ description: e, detail: t, name: n, origin: r }) {
|
|
7251
|
+
let i = `- **\`${n}\`**${t === "" ? "" : `\`${t}\``}${Ba(r)}`;
|
|
7252
|
+
return e === void 0 ? i : `${i}\n > ${e}`;
|
|
7253
|
+
}
|
|
7254
|
+
function Ba(e) {
|
|
7255
|
+
return e.replaceAll(/[\\`*<]|(?<![\da-z])_|_(?![\da-z])/gi, (e) => `\\${e}`);
|
|
7256
|
+
}
|
|
7149
7257
|
//#endregion
|
|
7150
7258
|
//#region src/actions/documentOpening.ts
|
|
7151
|
-
var
|
|
7152
|
-
async function
|
|
7259
|
+
var Va = "<!-- OPENING_START -->", Ha = "<!-- OPENING_END -->";
|
|
7260
|
+
async function Ua() {
|
|
7153
7261
|
try {
|
|
7154
7262
|
G("Document Opening"), q("1️⃣ Insert opening content into 'README.md'");
|
|
7155
7263
|
let e = await W("package.json"), t = await W("config.json"), { owner: n, repo: r } = qn(e, "document opening");
|
|
7156
|
-
await Wn(
|
|
7264
|
+
await Wn(Ka(n, r, Wa(e), Ga(t), e.devDependencies?.fallow != null), Va, Ha), K("Opening documented");
|
|
7157
7265
|
} catch (e) {
|
|
7158
7266
|
console.error("❌ Error documenting opening", e), process.exit(1);
|
|
7159
7267
|
}
|
|
7160
7268
|
}
|
|
7161
|
-
function
|
|
7269
|
+
function Wa(e) {
|
|
7162
7270
|
let t = e.license;
|
|
7163
7271
|
if (t == null || t === "") throw Error("package.json 'license' field is required to document opening.");
|
|
7164
7272
|
return t;
|
|
7165
7273
|
}
|
|
7166
|
-
function
|
|
7274
|
+
function Ga(e) {
|
|
7167
7275
|
let t = e.description.en;
|
|
7168
7276
|
if (t == null || t.length === 0) throw Error("config.json 'description.en' field is required to document opening.");
|
|
7169
7277
|
return t;
|
|
7170
7278
|
}
|
|
7171
|
-
function
|
|
7279
|
+
function Ka(e, t, n, r, i) {
|
|
7172
7280
|
let a = `https://github.com/${e}/${t}`, o = n.replaceAll("-", "--"), s = encodeURIComponent(`https://raw.githubusercontent.com/${e}/${t}/main/${Nn}`);
|
|
7173
7281
|
return `[](./LICENSE)
|
|
7174
7282
|
[](${a}/releases/latest)
|
|
@@ -7196,12 +7304,12 @@ ${r}`;
|
|
|
7196
7304
|
}
|
|
7197
7305
|
//#endregion
|
|
7198
7306
|
//#region src/actions/documentUsage.ts
|
|
7199
|
-
var
|
|
7307
|
+
var qa = "<!-- USAGE_START -->", Ja = "<!-- USAGE_END -->", Ya = /* @__PURE__ */ new Set([
|
|
7200
7308
|
"connector",
|
|
7201
7309
|
"context",
|
|
7202
7310
|
"cookbook",
|
|
7203
7311
|
"presenter"
|
|
7204
|
-
]),
|
|
7312
|
+
]), Xa = [
|
|
7205
7313
|
["build", "Builds the project."],
|
|
7206
7314
|
["build:ts", "Builds the TypeScript source."],
|
|
7207
7315
|
["test", "Runs the tests."],
|
|
@@ -7220,35 +7328,35 @@ var Ma = "<!-- USAGE_START -->", Na = "<!-- USAGE_END -->", Pa = /* @__PURE__ */
|
|
|
7220
7328
|
["sync", "Bumps the version, then commits and pushes to GitHub."],
|
|
7221
7329
|
["release", "Bumps the version, commits and pushes, and creates a GitHub release."],
|
|
7222
7330
|
["publish", "Registers the released version with DPUse."]
|
|
7223
|
-
],
|
|
7224
|
-
async function
|
|
7331
|
+
], Za = /* @__PURE__ */ new Set(["development", "eslint"]), Qa = "> [!WARNING]\n> This project is currently published to npm, but 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.\n\n", $a = "Cloned or forked code is unsupported and isn't guaranteed to remain compatible with the DPUse Engine as it evolves.";
|
|
7332
|
+
async function eo() {
|
|
7225
7333
|
try {
|
|
7226
7334
|
G("Document Usage"), q("1️⃣ Insert usage content into 'README.md'");
|
|
7227
|
-
let [e, t] = await Promise.all([W("package.json"), W("config.json")]), n =
|
|
7228
|
-
await Wn(
|
|
7335
|
+
let [e, t] = await Promise.all([W("package.json"), W("config.json")]), n = to(e), r = no(n), i = ro(e.engines?.node), a = ro(e.engines?.npm), o = ro(e.devDependencies?.typescript);
|
|
7336
|
+
await Wn(so(io(Kn(t.id), e.name), n, r, i, a, o, ao(e)), qa, Ja), K("Usage documented");
|
|
7229
7337
|
} catch (e) {
|
|
7230
7338
|
console.error("❌ Error documenting usage", e), process.exit(1);
|
|
7231
7339
|
}
|
|
7232
7340
|
}
|
|
7233
|
-
function
|
|
7341
|
+
function to(e) {
|
|
7234
7342
|
let t = e.repository, n = typeof t == "string" ? t : t?.url;
|
|
7235
7343
|
if (n == null || n === "") throw Error("package.json 'repository' field is required to document usage.");
|
|
7236
7344
|
return n.replace(/^git\+/, "");
|
|
7237
7345
|
}
|
|
7238
|
-
function
|
|
7346
|
+
function no(e) {
|
|
7239
7347
|
return (e.split("/").at(-1) ?? "").replace(/\.git$/, "");
|
|
7240
7348
|
}
|
|
7241
|
-
function
|
|
7349
|
+
function ro(e) {
|
|
7242
7350
|
if (e == null) throw Error("package.json version range is required to document usage.");
|
|
7243
7351
|
let t = /\d+(?:\.\d+)*/.exec(e);
|
|
7244
7352
|
if (t == null) throw Error(`Unable to parse version from '${e}'.`);
|
|
7245
7353
|
return t[0];
|
|
7246
7354
|
}
|
|
7247
|
-
function
|
|
7355
|
+
function io(e, t) {
|
|
7248
7356
|
let { typeId: n } = e;
|
|
7249
|
-
if (
|
|
7357
|
+
if (Ya.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.
|
|
7250
7358
|
|
|
7251
|
-
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. ${
|
|
7359
|
+
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. ${$a}`;
|
|
7252
7360
|
if (e.publishedTo === "npm") {
|
|
7253
7361
|
if (t == null || t === "") throw Error("package.json 'name' field is required to document usage.");
|
|
7254
7362
|
return `This package is published to the [public npm registry](https://www.npmjs.com/package/${t}). Install it with:
|
|
@@ -7257,18 +7365,18 @@ You may view or clone this repository for your own purposes, such as building a
|
|
|
7257
7365
|
npm install ${t}
|
|
7258
7366
|
\`\`\`
|
|
7259
7367
|
|
|
7260
|
-
${
|
|
7368
|
+
${Za.has(n) ? Qa : ""}To work on the source instead, clone this repository. ${$a}`;
|
|
7261
7369
|
}
|
|
7262
|
-
return `You may view or clone this repository for your own purposes. ${
|
|
7370
|
+
return `You may view or clone this repository for your own purposes. ${$a}`;
|
|
7263
7371
|
}
|
|
7264
|
-
function
|
|
7265
|
-
let t = e.scripts ?? {}, n = e.name === "@dpuse/dpuse-development", r = new Set(Object.keys(t).filter((e) => n ? t[e]?.includes("dpuse-development.es.js") : t[e]?.includes("@dpuse/dpuse-development"))), i = (e) => r.has(e) || (t[e] ?? "").matchAll(/npm run ([\w:]+)/g).some(([, e = ""]) => r.has(e)), a =
|
|
7372
|
+
function ao(e) {
|
|
7373
|
+
let t = e.scripts ?? {}, n = e.name === "@dpuse/dpuse-development", r = new Set(Object.keys(t).filter((e) => n ? t[e]?.includes("dpuse-development.es.js") : t[e]?.includes("@dpuse/dpuse-development"))), i = (e) => r.has(e) || (t[e] ?? "").matchAll(/npm run ([\w:]+)/g).some(([, e = ""]) => r.has(e)), a = Xa.filter(([e]) => i(e)).map(([e, t]) => `|\`${oo(e)}\`|${t}|`);
|
|
7266
7374
|
return a.length === 0 ? "" : `\n\n${n ? "This repository provides these commands to every DPUse project, and uses them itself:" : "Repository tasks run through npm scripts provided by [@dpuse/dpuse-development](https://github.com/dpuse/dpuse-development):"}\n\n|Command|What it does|\n|:-|:-|\n${a.join("\n")}`;
|
|
7267
7375
|
}
|
|
7268
|
-
function
|
|
7376
|
+
function oo(e) {
|
|
7269
7377
|
return e === "test" ? "npm test" : `npm run ${e}`;
|
|
7270
7378
|
}
|
|
7271
|
-
function
|
|
7379
|
+
function so(e, t, n, r, i, a, o) {
|
|
7272
7380
|
return `## Usage
|
|
7273
7381
|
|
|
7274
7382
|
${e}
|
|
@@ -7283,7 +7391,7 @@ _Requires [Node.js](https://nodejs.org/) ${r} or later, [npm](https://www.npmjs.
|
|
|
7283
7391
|
}
|
|
7284
7392
|
//#endregion
|
|
7285
7393
|
//#region src/actions/formatCode.ts
|
|
7286
|
-
async function
|
|
7394
|
+
async function co() {
|
|
7287
7395
|
try {
|
|
7288
7396
|
G("Format Code"), await U("1️⃣ Format", "prettier", [
|
|
7289
7397
|
"--write",
|
|
@@ -7302,7 +7410,7 @@ async function qa() {
|
|
|
7302
7410
|
}
|
|
7303
7411
|
//#endregion
|
|
7304
7412
|
//#region src/actions/lintCode.ts
|
|
7305
|
-
async function
|
|
7413
|
+
async function lo() {
|
|
7306
7414
|
try {
|
|
7307
7415
|
G("Lint Code"), await U("1️⃣ Lint", "eslint", ["."]), K("Code linted");
|
|
7308
7416
|
} catch (e) {
|
|
@@ -7311,7 +7419,7 @@ async function Ja() {
|
|
|
7311
7419
|
}
|
|
7312
7420
|
//#endregion
|
|
7313
7421
|
//#region src/utilities/cloudflare.ts
|
|
7314
|
-
async function
|
|
7422
|
+
async function uo() {
|
|
7315
7423
|
let e = await W("config.json"), t = {
|
|
7316
7424
|
body: JSON.stringify(e),
|
|
7317
7425
|
headers: { "Content-Type": "application/json" },
|
|
@@ -7319,7 +7427,7 @@ async function Ya() {
|
|
|
7319
7427
|
}, n = await fetch(`https://api.dpuse.app/configs/${e.id}`, t);
|
|
7320
7428
|
if (!n.ok) throw Error(await n.text());
|
|
7321
7429
|
}
|
|
7322
|
-
async function
|
|
7430
|
+
async function fo(e, t) {
|
|
7323
7431
|
async function n(e, t, r) {
|
|
7324
7432
|
for (let i of r) {
|
|
7325
7433
|
let r = `${e}/${i}`, a = `${t}/${i}`;
|
|
@@ -7337,7 +7445,7 @@ async function Xa(e, t) {
|
|
|
7337
7445
|
let r = await Rn(`${e}/${t}/`);
|
|
7338
7446
|
await n(`${e}/${t}`, t, r);
|
|
7339
7447
|
}
|
|
7340
|
-
async function
|
|
7448
|
+
async function po(e) {
|
|
7341
7449
|
let t = e.id, n = {
|
|
7342
7450
|
body: JSON.stringify(e),
|
|
7343
7451
|
headers: { "Content-Type": "application/json" },
|
|
@@ -7345,7 +7453,7 @@ async function Za(e) {
|
|
|
7345
7453
|
}, r = await fetch(`https://api.dpuse.app/configs/${t}`, n);
|
|
7346
7454
|
if (!r.ok) throw Error(await r.text());
|
|
7347
7455
|
}
|
|
7348
|
-
async function
|
|
7456
|
+
async function mo(e, t) {
|
|
7349
7457
|
let n = `v${e.version ?? "unknown"}`;
|
|
7350
7458
|
async function r(e, r = "") {
|
|
7351
7459
|
let i = await Rn(e, { withFileTypes: !0 });
|
|
@@ -7369,24 +7477,24 @@ async function Qa(e, t) {
|
|
|
7369
7477
|
}
|
|
7370
7478
|
//#endregion
|
|
7371
7479
|
//#region node_modules/valibot/dist/index.mjs
|
|
7372
|
-
var
|
|
7480
|
+
var ho = {
|
|
7373
7481
|
lang: void 0,
|
|
7374
7482
|
message: void 0,
|
|
7375
7483
|
abortEarly: void 0,
|
|
7376
7484
|
abortPipeEarly: void 0
|
|
7377
7485
|
};
|
|
7378
7486
|
/* @__NO_SIDE_EFFECTS__ */
|
|
7379
|
-
function
|
|
7487
|
+
function go(e) {
|
|
7380
7488
|
return e ? {
|
|
7381
7489
|
lang: e?.lang ?? void 0,
|
|
7382
7490
|
message: e?.message,
|
|
7383
7491
|
abortEarly: e?.abortEarly ?? void 0,
|
|
7384
7492
|
abortPipeEarly: e?.abortPipeEarly ?? void 0
|
|
7385
|
-
} :
|
|
7493
|
+
} : ho;
|
|
7386
7494
|
}
|
|
7387
7495
|
/* @__NO_SIDE_EFFECTS__ */
|
|
7388
|
-
function
|
|
7389
|
-
let r = e["~run"]({ value: t }, /* @__PURE__ */
|
|
7496
|
+
function _o(e, t, n) {
|
|
7497
|
+
let r = e["~run"]({ value: t }, /* @__PURE__ */ go(n));
|
|
7390
7498
|
return {
|
|
7391
7499
|
typed: r.typed,
|
|
7392
7500
|
success: !r.issues,
|
|
@@ -7396,21 +7504,21 @@ function to(e, t, n) {
|
|
|
7396
7504
|
}
|
|
7397
7505
|
//#endregion
|
|
7398
7506
|
//#region node_modules/@dpuse/dpuse-shared/dist/dpuse-shared-componentModulePresenter.es.js
|
|
7399
|
-
var
|
|
7507
|
+
var vo = Vi([
|
|
7400
7508
|
"list",
|
|
7401
7509
|
"render",
|
|
7402
7510
|
"setColorMode"
|
|
7403
|
-
]),
|
|
7511
|
+
]), yo = /* @__PURE__ */ Q({
|
|
7404
7512
|
...Yi,
|
|
7405
7513
|
typeId: /* @__PURE__ */ Ni("presenter"),
|
|
7406
|
-
actionNames: /* @__PURE__ */ ji(
|
|
7514
|
+
actionNames: /* @__PURE__ */ ji(vo),
|
|
7407
7515
|
presentations: /* @__PURE__ */ ji(qi)
|
|
7408
|
-
}),
|
|
7516
|
+
}), bo = [
|
|
7409
7517
|
"1️⃣ ",
|
|
7410
7518
|
"2️⃣ ",
|
|
7411
7519
|
"3️⃣ ",
|
|
7412
7520
|
"4️⃣ "
|
|
7413
|
-
],
|
|
7521
|
+
], xo = [{
|
|
7414
7522
|
id: "unit",
|
|
7415
7523
|
label: "Run unit tests",
|
|
7416
7524
|
command: "vitest",
|
|
@@ -7423,36 +7531,36 @@ var no = Vi([
|
|
|
7423
7531
|
arguments: ["test", "--pass-with-no-tests"],
|
|
7424
7532
|
configFileName: "playwright.config.ts"
|
|
7425
7533
|
}];
|
|
7426
|
-
async function
|
|
7534
|
+
async function So() {
|
|
7427
7535
|
try {
|
|
7428
7536
|
G("Build Project"), await U("1️⃣ Bundle project", "vite", ["build"]), await Hn("API_REFERENCE.md") === null ? q(`2️⃣ '${ma}' NOT required by this project`) : await va("2️⃣ "), K("Project built");
|
|
7429
7537
|
} catch (e) {
|
|
7430
7538
|
console.error("❌ Error building project", e), process.exit(1);
|
|
7431
7539
|
}
|
|
7432
7540
|
}
|
|
7433
|
-
async function
|
|
7541
|
+
async function Co() {
|
|
7434
7542
|
try {
|
|
7435
7543
|
G("Publish Project");
|
|
7436
7544
|
let e = await W("package.json"), t = await W("config.json");
|
|
7437
|
-
await
|
|
7545
|
+
await Mo("1️⃣ ", e, t, Kn(t.id)), K(`Project version '${e.version ?? "unknown"}' published.`);
|
|
7438
7546
|
} catch (e) {
|
|
7439
7547
|
console.error("❌ Error publishing project", e), process.exit(1);
|
|
7440
7548
|
}
|
|
7441
7549
|
}
|
|
7442
|
-
async function
|
|
7550
|
+
async function wo() {
|
|
7443
7551
|
try {
|
|
7444
7552
|
G("Release Project");
|
|
7445
7553
|
let e = await W("package.json"), t = await W("config.json");
|
|
7446
|
-
await
|
|
7554
|
+
await jo("1️⃣ ", e);
|
|
7447
7555
|
let n = Kn(t.id);
|
|
7448
7556
|
switch (n.typeId) {
|
|
7449
7557
|
case "connector":
|
|
7450
|
-
t = await
|
|
7558
|
+
t = await Eo("2️⃣ ", e);
|
|
7451
7559
|
break;
|
|
7452
7560
|
case "presenter":
|
|
7453
|
-
t = await
|
|
7561
|
+
t = await Do("2️⃣ ", e);
|
|
7454
7562
|
break;
|
|
7455
|
-
default: t = await
|
|
7563
|
+
default: t = await To("2️⃣ ", e);
|
|
7456
7564
|
}
|
|
7457
7565
|
await U("3️⃣ Bundle project", "vite", ["build"]), await zn("4️⃣ Stage changes", "git", ["add", "."]), await zn("5️⃣ Commit changes", "git", [
|
|
7458
7566
|
"commit",
|
|
@@ -7462,7 +7570,7 @@ async function co() {
|
|
|
7462
7570
|
"push",
|
|
7463
7571
|
"origin",
|
|
7464
7572
|
"main:main"
|
|
7465
|
-
]), await
|
|
7573
|
+
]), await Mo("7️⃣ ", e, t, n), n.publishedTo === "npm" ? await U("8️⃣ Create GitHub release", "gh", [
|
|
7466
7574
|
"release",
|
|
7467
7575
|
"create",
|
|
7468
7576
|
`v${e.version ?? "unknown"}`,
|
|
@@ -7475,39 +7583,39 @@ async function co() {
|
|
|
7475
7583
|
console.error("❌ Error releasing project", e), process.exit(1);
|
|
7476
7584
|
}
|
|
7477
7585
|
}
|
|
7478
|
-
async function
|
|
7586
|
+
async function To(e, t) {
|
|
7479
7587
|
q(`${e} Build project configuration`);
|
|
7480
7588
|
let n = await W("config.json");
|
|
7481
7589
|
return t.name != null && (n.id = t.name.replace("@dpuse/", "")), t.version != null && (n.version = t.version), n.icon ??= await Hn("logo.svg"), n.iconDark ??= await Hn("logoDark.svg"), await Un("config.json", n), n;
|
|
7482
7590
|
}
|
|
7483
|
-
async function
|
|
7591
|
+
async function Eo(e, t) {
|
|
7484
7592
|
q(`${e} Build connector project configuration`);
|
|
7485
|
-
let [n, r] = await Promise.all([W("config.json"), Vn("src/index.ts")]), i = /* @__PURE__ */
|
|
7593
|
+
let [n, r] = await Promise.all([W("config.json"), Vn("src/index.ts")]), i = /* @__PURE__ */ _o(na, n);
|
|
7486
7594
|
if (!i.success) throw console.error("❌ Configuration is invalid:"), console.table(i.issues), Error("Configuration is invalid");
|
|
7487
7595
|
let a = Yn(r);
|
|
7488
|
-
return await
|
|
7596
|
+
return await Oo(t, n, a, oa(a));
|
|
7489
7597
|
}
|
|
7490
|
-
async function
|
|
7598
|
+
async function Do(e, t) {
|
|
7491
7599
|
q(`${e} Build presenter project configuration`);
|
|
7492
|
-
let [n, r] = await Promise.all([W("config.json"), Vn("src/index.ts")]), i = /* @__PURE__ */
|
|
7600
|
+
let [n, r] = await Promise.all([W("config.json"), Vn("src/index.ts")]), i = /* @__PURE__ */ _o(yo, n);
|
|
7493
7601
|
if (!i.success) throw console.error("❌ Configuration is invalid:"), console.table(i.issues), Error("Configuration is invalid");
|
|
7494
|
-
return await
|
|
7602
|
+
return await Oo(t, n, Yn(r));
|
|
7495
7603
|
}
|
|
7496
|
-
async function
|
|
7604
|
+
async function Oo(e, t, n, r) {
|
|
7497
7605
|
return n.length > 0 ? (console.info(`ℹ️ Implements ${String(n.length)} operations:`), console.table(n)) : console.warn("⚠️ Implements no operations"), r === "unknown" ? console.warn("⚠️ No usage identified") : r && console.info(`ℹ️ Supports '${r}' usage.`), e.name != null && (t.id = e.name.replace("@dpuse/", "").replace("@dpuse/", "")), e.version != null && (t.version = e.version), t.actionNames = n, r !== void 0 && (t.usageId = r), await Un("config.json", t), t;
|
|
7498
7606
|
}
|
|
7499
|
-
async function
|
|
7607
|
+
async function ko() {
|
|
7500
7608
|
try {
|
|
7501
7609
|
G("Synchronise Project with GitHub");
|
|
7502
7610
|
let e = await W("package.json"), t = await W("config.json");
|
|
7503
|
-
switch (await
|
|
7611
|
+
switch (await jo("1️⃣ ", e), Kn(t.id).typeId) {
|
|
7504
7612
|
case "connector":
|
|
7505
|
-
await
|
|
7613
|
+
await Eo("2️⃣ ", e);
|
|
7506
7614
|
break;
|
|
7507
7615
|
case "presenter":
|
|
7508
|
-
await
|
|
7616
|
+
await Do("2️⃣ ", e);
|
|
7509
7617
|
break;
|
|
7510
|
-
default: await
|
|
7618
|
+
default: await To("2️⃣ ", e);
|
|
7511
7619
|
}
|
|
7512
7620
|
await zn("3️⃣ Stage changes", "git", ["add", "."]), await zn("4️⃣ Commit changes", "git", [
|
|
7513
7621
|
"commit",
|
|
@@ -7522,14 +7630,14 @@ async function mo() {
|
|
|
7522
7630
|
console.error("❌ Error synchronising project with GitHub", e), process.exit(1);
|
|
7523
7631
|
}
|
|
7524
7632
|
}
|
|
7525
|
-
async function
|
|
7633
|
+
async function Ao(e = ["unit"], t = !1) {
|
|
7526
7634
|
try {
|
|
7527
7635
|
G("Test Project");
|
|
7528
7636
|
let n = 0;
|
|
7529
|
-
for (let r of
|
|
7637
|
+
for (let r of xo) {
|
|
7530
7638
|
if (!e.includes(r.id) || await Hn(r.configFileName) === null) continue;
|
|
7531
7639
|
let i = t && r.id === "unit" ? ["--coverage"] : [];
|
|
7532
|
-
await U(`${
|
|
7640
|
+
await U(`${bo[n] ?? ""} ${r.label}`, r.command, [...r.arguments, ...i]), n += 1;
|
|
7533
7641
|
}
|
|
7534
7642
|
if (n === 0) {
|
|
7535
7643
|
console.warn("\n⚠️ No tests configured for this project.\n");
|
|
@@ -7540,7 +7648,7 @@ async function ho(e = ["unit"], t = !1) {
|
|
|
7540
7648
|
console.error("❌ Error testing project", e), process.exit(1);
|
|
7541
7649
|
}
|
|
7542
7650
|
}
|
|
7543
|
-
async function
|
|
7651
|
+
async function jo(e, t, n = "./") {
|
|
7544
7652
|
if (q(`${e} Bump project version`), t.version == null) t.version = "0.0.001", console.warn(`⚠️ Project version initialised to '${t.version}'.`);
|
|
7545
7653
|
else {
|
|
7546
7654
|
let e = t.version, n = t.version.split(".");
|
|
@@ -7548,15 +7656,15 @@ async function go(e, t, n = "./") {
|
|
|
7548
7656
|
}
|
|
7549
7657
|
await Un(`${n}package.json`, t);
|
|
7550
7658
|
}
|
|
7551
|
-
async function
|
|
7552
|
-
if (r.typeId === "app") q(`${e} Register module`), await
|
|
7553
|
-
else if (r.typeId === "engine") q(`${e} Register module`), await
|
|
7659
|
+
async function Mo(e, t, n, r) {
|
|
7660
|
+
if (r.typeId === "app") q(`${e} Register module`), await uo();
|
|
7661
|
+
else if (r.typeId === "engine") q(`${e} Register module`), await mo(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await po(n);
|
|
7554
7662
|
else if (r.uploadGroupName === void 0) q(`${e} Registration NOT required`);
|
|
7555
7663
|
else {
|
|
7556
7664
|
q(`${e} Register module`);
|
|
7557
7665
|
let i = n.id.split("-").slice(2).join("-");
|
|
7558
|
-
await
|
|
7666
|
+
await mo(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await po(n);
|
|
7559
7667
|
}
|
|
7560
7668
|
}
|
|
7561
7669
|
//#endregion
|
|
7562
|
-
export { Qn as auditDependencies,
|
|
7670
|
+
export { Qn as auditDependencies, So as buildProject, tr as checkConfigFiles, lr as checkDependencies, _a as documentAPIReference, pa as documentActions, vr as documentBundleSizes, Br as documentDependencies, ci as documentGovernance, Ua as documentOpening, eo as documentUsage, co as formatCode, lo as lintCode, Co as publishProject, wo as releaseProject, ko as syncProjectWithGitHub, Ao as testProject, fo as uploadDirectoryToR2 };
|