@rse/specbook 1.2.5 → 1.2.7
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 +21 -11
- package/dst/specbook-api.d.ts +3 -2
- package/dst/specbook-api.js +5 -5
- package/dst/specbook-cli.js +21 -13
- package/dst/specbook-cmd-export.js +2 -2
- package/dst/specbook-cmd-lint.js +30 -1
- package/dst/specbook-cmd-preview.js +5 -5
- package/dst/specbook-config.js +18 -17
- package/dst/specbook-coverage.d.ts +17 -0
- package/dst/specbook-coverage.js +106 -0
- package/dst/specbook-diagram.js +12 -2
- package/dst/specbook-export-ast.js +11 -1
- package/dst/specbook-export-html.css +65 -7
- package/dst/specbook-export-html.js +46 -3
- package/dst/specbook-export-pdf.js +2 -2
- package/dst/specbook-format-schema.d.ts +2 -0
- package/dst/specbook-format-schema.js +3 -1
- package/dst/specbook-format.md +35 -5
- package/dst/specbook-format.yaml +100 -16
- package/dst/specbook-parse-semantic.js +6 -42
- package/dst/specbook-parse.d.ts +1 -1
- package/dst/specbook-parse.js +1 -1
- package/dst/specbook-verbose.d.ts +5 -1
- package/dst/specbook-verbose.js +22 -0
- package/package.json +1 -1
package/dst/specbook-parse.js
CHANGED
|
@@ -10,7 +10,7 @@ import { ParseContext } from "./specbook-parse-common.js";
|
|
|
10
10
|
import { parseFile } from "./specbook-parse-syntax.js";
|
|
11
11
|
import { validate, validateReferences } from "./specbook-parse-semantic.js";
|
|
12
12
|
import { validateDiagrams } from "./specbook-diagram.js";
|
|
13
|
-
export { resolveArtifact } from "./specbook-parse-semantic.js";
|
|
13
|
+
export { resolveArtifact, collectSchemas } from "./specbook-parse-semantic.js";
|
|
14
14
|
/* parse a set of specification Markdown files into the specification
|
|
15
15
|
AST and optionally validate the result against a configuration */
|
|
16
16
|
export const parseSpecification = (sources, config) => {
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
export type VerboseLevel = "
|
|
1
|
+
export type VerboseLevel = "none" | "notice" | "detail" | "trace";
|
|
2
2
|
export type Verbose = (msg: string, level?: VerboseLevel) => void;
|
|
3
|
+
export declare const verbosities: readonly [0, 1, 2, 3];
|
|
4
|
+
export type Verbosity = typeof verbosities[number];
|
|
5
|
+
export declare const verbosityOf: Record<VerboseLevel, Verbosity>;
|
|
6
|
+
export declare const parseVerbosity: (value: string | number | boolean) => Verbosity;
|
|
3
7
|
export declare const literal: (value: string | number) => string;
|
|
4
8
|
export declare const renderVerbose: (msg: string, style?: (value: string) => string) => string;
|
package/dst/specbook-verbose.js
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
** Copyright (c) 2026 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
4
4
|
** Licensed under Apache 2.0 <https://spdx.org/licenses/Apache-2.0>
|
|
5
5
|
*/
|
|
6
|
+
/* the verbosity a consumer runs at, as the least one surfacing the
|
|
7
|
+
messages of each level: a message passes a consumer whose verbosity
|
|
8
|
+
is at least the one of its level */
|
|
9
|
+
export const verbosities = [0, 1, 2, 3];
|
|
10
|
+
export const verbosityOf = { none: 0, notice: 1, detail: 2, trace: 3 };
|
|
11
|
+
/* parse and validate a verbosity specification, where a bare flag (or
|
|
12
|
+
a boolean word) selects the regular processing information */
|
|
13
|
+
export const parseVerbosity = (value) => {
|
|
14
|
+
let level;
|
|
15
|
+
if (typeof value === "boolean")
|
|
16
|
+
level = value ? 1 : 0;
|
|
17
|
+
else if (typeof value === "string" && (/^(?:true|yes|on)$/i).test(value))
|
|
18
|
+
level = 1;
|
|
19
|
+
else if (typeof value === "string" && (/^(?:false|no|off)$/i).test(value))
|
|
20
|
+
level = 0;
|
|
21
|
+
else
|
|
22
|
+
level = typeof value === "string" && !(/^\d+$/).test(value) ? NaN : Number(value);
|
|
23
|
+
if (!verbosities.includes(level))
|
|
24
|
+
throw new Error(`unknown verbosity "${value}" ` +
|
|
25
|
+
`(supported: ${verbosities.join(", ")})`);
|
|
26
|
+
return level;
|
|
27
|
+
};
|
|
6
28
|
/* the sentinel characters delimiting a marked literal value, taken
|
|
7
29
|
from the Unicode private use area, so they never clash with the
|
|
8
30
|
regular content of a verbose message */
|