@nebulahome/package-sdk 1.0.0 → 1.0.1

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.
@@ -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 };
@@ -7,6 +7,6 @@
7
7
  * the two are compared before a package is installed or started (PACKAGES_DOCS.md 11).
8
8
  */
9
9
  /** The SDK's own version, `1.0.0`. */
10
- const SDK_VERSION = "1.0.0";
10
+ const SDK_VERSION = "1.0.1";
11
11
  //#endregion
12
12
  export { SDK_VERSION as t };