@nebulahome/package-sdk 1.0.0 → 1.1.0
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/CHANGELOG.md +22 -0
- package/README.md +39 -9
- package/dist/chunks/host.js +21 -7
- package/dist/chunks/node-build.js +317 -7079
- package/dist/chunks/node-build2.js +2 -0
- package/dist/chunks/node-config.js +6886 -0
- package/dist/chunks/node-pack.js +3455 -0
- package/dist/chunks/node-problems.js +54 -0
- package/dist/chunks/version.js +1 -1
- package/dist/cli.js +41 -3453
- package/dist/ui.d.ts +35 -1
- package/dist/ui.js +56 -2
- package/dist/vite.d.ts +2 -2
- package/dist/vite.js +2 -1
- package/package.json +4 -4
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
//#region src/generate/problems.ts
|
|
2
|
+
/**
|
|
3
|
+
* What is wrong with a package's declaration, every problem at once and each with where it is,
|
|
4
|
+
* so an author fixes them in one pass rather than one build at a time.
|
|
5
|
+
*/
|
|
6
|
+
/** Thrown when a declaration does not hold together. */
|
|
7
|
+
var PackageConfigError = class extends Error {
|
|
8
|
+
/** Every problem, one line each: `cards[0].options.days: …`. */
|
|
9
|
+
problems;
|
|
10
|
+
/**
|
|
11
|
+
* Gathers the problems.
|
|
12
|
+
*
|
|
13
|
+
* @param problems - Each problem, with where it is.
|
|
14
|
+
*/
|
|
15
|
+
constructor(problems) {
|
|
16
|
+
super(`The package does not hold together:\n${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
17
|
+
this.name = "PackageConfigError";
|
|
18
|
+
this.problems = problems;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* A place to gather problems.
|
|
23
|
+
*
|
|
24
|
+
* @returns It.
|
|
25
|
+
*/
|
|
26
|
+
function problems() {
|
|
27
|
+
const list = [];
|
|
28
|
+
return {
|
|
29
|
+
/**
|
|
30
|
+
* Records a problem.
|
|
31
|
+
*
|
|
32
|
+
* @param path - Where in the declaration, or empty for the whole of it.
|
|
33
|
+
* @param message - What is wrong.
|
|
34
|
+
*/
|
|
35
|
+
add: (path, message) => {
|
|
36
|
+
list.push(path === "" ? message : `${path}: ${message}`);
|
|
37
|
+
},
|
|
38
|
+
list
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A path from its parts, as a declaration is written: `cards[0].options.days`.
|
|
43
|
+
*
|
|
44
|
+
* @param parts - The keys and indexes.
|
|
45
|
+
* @returns The path.
|
|
46
|
+
*/
|
|
47
|
+
function pathOf(parts) {
|
|
48
|
+
return parts.reduce((path, part) => {
|
|
49
|
+
if (typeof part === "number") return `${path}[${String(part)}]`;
|
|
50
|
+
return path === "" ? String(part) : `${path}.${String(part)}`;
|
|
51
|
+
}, "");
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { pathOf as n, problems as r, PackageConfigError as t };
|
package/dist/chunks/version.js
CHANGED