@skmtc/core 0.49.1 → 0.50.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/esm/context/CoreContext.js +80 -3
- package/esm/context/GenerateContext.d.ts +6 -1
- package/esm/context/GenerateContext.js +149 -81
- package/esm/context/LogLinesHandler.d.ts +1 -1
- package/esm/context/LogLinesHandler.js +3 -0
- package/esm/context/ParseContext.d.ts +3 -0
- package/esm/context/ParseContext.js +36 -14
- package/esm/helpers/toCountPhrase.d.ts +11 -0
- package/esm/helpers/toCountPhrase.js +11 -0
- package/esm/types/LogLine.d.ts +40 -1
- package/esm/types/LogLine.js +25 -0
- package/package.json +1 -1
- package/script/context/CoreContext.js +80 -3
- package/script/context/GenerateContext.d.ts +6 -1
- package/script/context/GenerateContext.js +149 -81
- package/script/context/LogLinesHandler.d.ts +1 -1
- package/script/context/LogLinesHandler.js +3 -0
- package/script/context/ParseContext.d.ts +3 -0
- package/script/context/ParseContext.js +36 -14
- package/script/helpers/toCountPhrase.d.ts +11 -0
- package/script/helpers/toCountPhrase.js +15 -0
- package/script/types/LogLine.d.ts +40 -1
- package/script/types/LogLine.js +27 -1
|
@@ -13,15 +13,48 @@ import { type SerializedError } from './SerializedError.js';
|
|
|
13
13
|
export type LogLineLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
|
|
14
14
|
/** Valibot schema for {@link LogLineLevel}. */
|
|
15
15
|
export declare const logLineLevel: v.PicklistSchema<["DEBUG", "INFO", "WARN", "ERROR"], undefined>;
|
|
16
|
+
/** The fields of the parse issue a {@link LogLine} reports. */
|
|
17
|
+
export type LogLineIssue = {
|
|
18
|
+
/**
|
|
19
|
+
* The issue's type. A string, not the closed list of types: a reader on
|
|
20
|
+
* an older core must still read a line with a type added since.
|
|
21
|
+
*/
|
|
22
|
+
type: string;
|
|
23
|
+
level: 'error' | 'warning' | 'debug';
|
|
24
|
+
/** The issue's `location`, as `manifest.parseIssues` has it. */
|
|
25
|
+
location: string;
|
|
26
|
+
/** The object around the issue, as JSON. */
|
|
27
|
+
parent?: string;
|
|
28
|
+
};
|
|
29
|
+
/** Valibot schema for {@link LogLineIssue}. */
|
|
30
|
+
export declare const logLineIssue: v.ObjectSchema<{
|
|
31
|
+
readonly type: v.StringSchema<undefined>;
|
|
32
|
+
readonly level: v.PicklistSchema<["error", "warning", "debug"], undefined>;
|
|
33
|
+
readonly location: v.StringSchema<undefined>;
|
|
34
|
+
readonly parent: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
35
|
+
}, undefined>;
|
|
36
|
+
/**
|
|
37
|
+
* A log argument that gives its line an `issue` field. Parse logs one with
|
|
38
|
+
* each issue it records.
|
|
39
|
+
*/
|
|
40
|
+
export declare class LogLineIssueArg {
|
|
41
|
+
issue: LogLineIssue;
|
|
42
|
+
constructor(issue: LogLineIssue);
|
|
43
|
+
}
|
|
16
44
|
export type LogLine = {
|
|
17
45
|
/** Position of the line in the run, from 0. */
|
|
18
46
|
seq: number;
|
|
19
47
|
level: LogLineLevel;
|
|
20
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* The subject's stack trail, or the generator's on the line a generator
|
|
50
|
+
* logs after it ran. Absent outside a generator (parse, render).
|
|
51
|
+
*/
|
|
21
52
|
trail?: string;
|
|
22
53
|
message: string;
|
|
23
54
|
/** The first `Error` the line was logged with. */
|
|
24
55
|
error?: SerializedError;
|
|
56
|
+
/** The parse issue the line reports. */
|
|
57
|
+
issue?: LogLineIssue;
|
|
25
58
|
/** When the line was logged, in milliseconds since the epoch. */
|
|
26
59
|
time: number;
|
|
27
60
|
};
|
|
@@ -32,5 +65,11 @@ export declare const logLine: v.ObjectSchema<{
|
|
|
32
65
|
readonly trail: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
33
66
|
readonly message: v.StringSchema<undefined>;
|
|
34
67
|
readonly error: v.OptionalSchema<v.GenericSchema<SerializedError>, undefined>;
|
|
68
|
+
readonly issue: v.OptionalSchema<v.ObjectSchema<{
|
|
69
|
+
readonly type: v.StringSchema<undefined>;
|
|
70
|
+
readonly level: v.PicklistSchema<["error", "warning", "debug"], undefined>;
|
|
71
|
+
readonly location: v.StringSchema<undefined>;
|
|
72
|
+
readonly parent: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
73
|
+
}, undefined>, undefined>;
|
|
35
74
|
readonly time: v.NumberSchema<undefined>;
|
|
36
75
|
}, undefined>;
|
package/script/types/LogLine.js
CHANGED
|
@@ -42,13 +42,38 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
42
42
|
};
|
|
43
43
|
})();
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.logLine = exports.logLineLevel = void 0;
|
|
45
|
+
exports.logLine = exports.LogLineIssueArg = exports.logLineIssue = exports.logLineLevel = void 0;
|
|
46
46
|
const v = __importStar(require("valibot"));
|
|
47
47
|
const SerializedError_js_1 = require("./SerializedError.js");
|
|
48
48
|
/** Valibot schema for {@link LogLineLevel}. */
|
|
49
49
|
exports.logLineLevel = v.picklist(['DEBUG', 'INFO', 'WARN', 'ERROR']);
|
|
50
50
|
const _logLineLevelDriftCheck = exports.logLineLevel;
|
|
51
51
|
void _logLineLevelDriftCheck;
|
|
52
|
+
/** Valibot schema for {@link LogLineIssue}. */
|
|
53
|
+
exports.logLineIssue = v.object({
|
|
54
|
+
type: v.string(),
|
|
55
|
+
level: v.picklist(['error', 'warning', 'debug']),
|
|
56
|
+
location: v.string(),
|
|
57
|
+
parent: v.optional(v.string())
|
|
58
|
+
});
|
|
59
|
+
const _logLineIssueDriftCheck = exports.logLineIssue;
|
|
60
|
+
void _logLineIssueDriftCheck;
|
|
61
|
+
/**
|
|
62
|
+
* A log argument that gives its line an `issue` field. Parse logs one with
|
|
63
|
+
* each issue it records.
|
|
64
|
+
*/
|
|
65
|
+
class LogLineIssueArg {
|
|
66
|
+
constructor(issue) {
|
|
67
|
+
Object.defineProperty(this, "issue", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
configurable: true,
|
|
70
|
+
writable: true,
|
|
71
|
+
value: void 0
|
|
72
|
+
});
|
|
73
|
+
this.issue = issue;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.LogLineIssueArg = LogLineIssueArg;
|
|
52
77
|
/** Valibot schema for {@link LogLine}. */
|
|
53
78
|
exports.logLine = v.object({
|
|
54
79
|
seq: v.number(),
|
|
@@ -56,6 +81,7 @@ exports.logLine = v.object({
|
|
|
56
81
|
trail: v.optional(v.string()),
|
|
57
82
|
message: v.string(),
|
|
58
83
|
error: v.optional(SerializedError_js_1.serializedError),
|
|
84
|
+
issue: v.optional(exports.logLineIssue),
|
|
59
85
|
time: v.number()
|
|
60
86
|
});
|
|
61
87
|
const _logLineDriftCheck = exports.logLine;
|