@intentset/core 0.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/dist/artifact.d.ts +28 -0
- package/dist/artifact.d.ts.map +1 -0
- package/dist/artifact.js +621 -0
- package/dist/artifact.js.map +1 -0
- package/dist/carrier.d.ts +21 -0
- package/dist/carrier.d.ts.map +1 -0
- package/dist/carrier.js +70 -0
- package/dist/carrier.js.map +1 -0
- package/dist/config.d.ts +17 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +74 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +28 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +223 -0
- package/dist/context.js.map +1 -0
- package/dist/diagnostics.d.ts +37 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +22 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/export.d.ts +23 -0
- package/dist/export.d.ts.map +1 -0
- package/dist/export.js +144 -0
- package/dist/export.js.map +1 -0
- package/dist/graph.d.ts +17 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +51 -0
- package/dist/graph.js.map +1 -0
- package/dist/hash.d.ts +16 -0
- package/dist/hash.d.ts.map +1 -0
- package/dist/hash.js +55 -0
- package/dist/hash.js.map +1 -0
- package/dist/impact.d.ts +6 -0
- package/dist/impact.d.ts.map +1 -0
- package/dist/impact.js +89 -0
- package/dist/impact.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/registries.d.ts +19 -0
- package/dist/registries.d.ts.map +1 -0
- package/dist/registries.js +137 -0
- package/dist/registries.js.map +1 -0
- package/dist/report.d.ts +34 -0
- package/dist/report.d.ts.map +1 -0
- package/dist/report.js +58 -0
- package/dist/report.js.map +1 -0
- package/dist/types.d.ts +266 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +90 -0
- package/dist/types.js.map +1 -0
- package/dist/validate.d.ts +6 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +573 -0
- package/dist/validate.js.map +1 -0
- package/dist/yaml.d.ts +48 -0
- package/dist/yaml.d.ts.map +1 -0
- package/dist/yaml.js +413 -0
- package/dist/yaml.js.map +1 -0
- package/package.json +36 -0
- package/src/artifact.ts +835 -0
- package/src/carrier.ts +81 -0
- package/src/config.ts +96 -0
- package/src/context.ts +240 -0
- package/src/diagnostics.ts +60 -0
- package/src/export.ts +173 -0
- package/src/graph.ts +49 -0
- package/src/hash.ts +53 -0
- package/src/impact.ts +90 -0
- package/src/index.ts +14 -0
- package/src/registries.ts +171 -0
- package/src/report.ts +84 -0
- package/src/types.ts +357 -0
- package/src/validate.ts +655 -0
- package/src/yaml.ts +406 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml.d.ts","sourceRoot":"","sources":["../src/yaml.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAE7G,6FAA6F;AAC7F,MAAM,MAAM,UAAU,GAClB;IAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAE,GAC3E;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAElE,eAAO,MAAM,cAAc,QAAa,CAAC;AACzC,eAAO,MAAM,cAAc,OAAO,CAAC;AACnC,eAAO,MAAM,cAAc,KAAK,CAAC;AAgBjC,qGAAqG;AACrG,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAIlD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAU1D;AAED,yFAAyF;AACzF,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAEzD"}
|
package/dist/yaml.js
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The strict frontmatter reader (Core §3, ADR 0001).
|
|
3
|
+
*
|
|
4
|
+
* It reads the subset the carrier uses: block mappings, block and flow
|
|
5
|
+
* sequences, plain and quoted scalars, integers, finite floats, booleans,
|
|
6
|
+
* null, and comments. Everything outside that subset is an error with a line
|
|
7
|
+
* number: duplicate keys, anchors, aliases, tags, merge keys, flow mappings
|
|
8
|
+
* (the empty `{}` excepted, so an empty `layers` can be written), block
|
|
9
|
+
* scalars, multi-document markers, directives, tabs as indentation, nesting
|
|
10
|
+
* deeper than 16, more than 4096 lines, more than 256 KiB. Values are
|
|
11
|
+
* JSON-compatible and quote-aware: `'0.1'` is a string, `0.1` is a number.
|
|
12
|
+
*/
|
|
13
|
+
export const YAML_MAX_BYTES = 256 * 1024;
|
|
14
|
+
export const YAML_MAX_LINES = 4096;
|
|
15
|
+
export const YAML_MAX_DEPTH = 16;
|
|
16
|
+
class YamlFailure extends Error {
|
|
17
|
+
line;
|
|
18
|
+
constructor(message, line) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.line = line;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/** Core §3 and ADR 0001: the strict reader. Returns the mapping or the first error with its line. */
|
|
24
|
+
export function parseYaml(text) {
|
|
25
|
+
const detail = parseYamlDetailed(text);
|
|
26
|
+
if (detail.error)
|
|
27
|
+
return { value: null, error: detail.error };
|
|
28
|
+
return { value: detail.value, error: null };
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Core §3 and ADR 0001, with positions: the same reader, also returning the
|
|
32
|
+
* 1-based line of every key and sequence item by JSON pointer, which is what
|
|
33
|
+
* lets a diagnostic about `/intentset/links/governedBy/1` point at its line.
|
|
34
|
+
*/
|
|
35
|
+
export function parseYamlDetailed(text) {
|
|
36
|
+
const lines = new Map();
|
|
37
|
+
try {
|
|
38
|
+
const value = new Parser(text, lines).document();
|
|
39
|
+
return { value, lines, error: null };
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
if (error instanceof YamlFailure)
|
|
43
|
+
return { value: null, lines, error: { message: error.message, line: error.line } };
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** ADR 0004: RFC 6901 escaping of one reference token, for diagnostic field pointers. */
|
|
48
|
+
export function pointerToken(key) {
|
|
49
|
+
return String(key).replace(/~/g, "~0").replace(/\//g, "~1");
|
|
50
|
+
}
|
|
51
|
+
const INT = /^[-+]?(?:0|[1-9][0-9]*)$/;
|
|
52
|
+
const FLOAT = /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)(?:[eE][-+]?[0-9]+)?$/;
|
|
53
|
+
const NON_FINITE = /^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/;
|
|
54
|
+
const ESCAPES = {
|
|
55
|
+
"0": "\0",
|
|
56
|
+
a: "\x07",
|
|
57
|
+
b: "\b",
|
|
58
|
+
t: "\t",
|
|
59
|
+
n: "\n",
|
|
60
|
+
v: "\v",
|
|
61
|
+
f: "\f",
|
|
62
|
+
r: "\r",
|
|
63
|
+
e: "\x1b",
|
|
64
|
+
" ": " ",
|
|
65
|
+
'"': '"',
|
|
66
|
+
"/": "/",
|
|
67
|
+
"\\": "\\",
|
|
68
|
+
N: "\u0085",
|
|
69
|
+
_: " ",
|
|
70
|
+
L: "
",
|
|
71
|
+
P: "
",
|
|
72
|
+
};
|
|
73
|
+
class Parser {
|
|
74
|
+
lines = [];
|
|
75
|
+
positions;
|
|
76
|
+
constructor(text, positions) {
|
|
77
|
+
this.positions = positions;
|
|
78
|
+
if (Buffer.byteLength(text, "utf8") > YAML_MAX_BYTES) {
|
|
79
|
+
throw new YamlFailure(`The frontmatter is larger than ${YAML_MAX_BYTES / 1024} KiB.`, 1);
|
|
80
|
+
}
|
|
81
|
+
const raw = text.split(/\r?\n/);
|
|
82
|
+
if (raw.length > YAML_MAX_LINES) {
|
|
83
|
+
throw new YamlFailure(`The frontmatter has more than ${YAML_MAX_LINES} lines.`, YAML_MAX_LINES + 1);
|
|
84
|
+
}
|
|
85
|
+
for (let i = 0; i < raw.length; i++) {
|
|
86
|
+
const line = i + 1;
|
|
87
|
+
const whole = raw[i];
|
|
88
|
+
if (/^\s*$/.test(whole))
|
|
89
|
+
continue;
|
|
90
|
+
const leading = /^[ \t]*/.exec(whole)?.[0] ?? "";
|
|
91
|
+
if (leading.includes("\t"))
|
|
92
|
+
throw new YamlFailure("A tab is used as indentation; indent with spaces.", line);
|
|
93
|
+
const content = whole.slice(leading.length).replace(/\s+$/, "");
|
|
94
|
+
if (content.startsWith("#"))
|
|
95
|
+
continue;
|
|
96
|
+
if (leading.length === 0) {
|
|
97
|
+
if (content === "---" || content.startsWith("--- ") || content === "...") {
|
|
98
|
+
throw new YamlFailure("A document marker appears inside the frontmatter; one document only.", line);
|
|
99
|
+
}
|
|
100
|
+
if (content.startsWith("%"))
|
|
101
|
+
throw new YamlFailure("YAML directives are not accepted.", line);
|
|
102
|
+
}
|
|
103
|
+
this.lines.push({ indent: leading.length, text: content, line });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
document() {
|
|
107
|
+
if (this.lines.length === 0)
|
|
108
|
+
return {};
|
|
109
|
+
const first = this.lines[0];
|
|
110
|
+
if (isSequenceItem(first.text)) {
|
|
111
|
+
throw new YamlFailure("The frontmatter must be a mapping, not a sequence.", first.line);
|
|
112
|
+
}
|
|
113
|
+
const { value, next } = this.block(0, first.indent, 1, "");
|
|
114
|
+
if (next < this.lines.length) {
|
|
115
|
+
throw new YamlFailure("Unexpected content after the frontmatter mapping.", this.lines[next].line);
|
|
116
|
+
}
|
|
117
|
+
if (!isMapping(value))
|
|
118
|
+
throw new YamlFailure("The frontmatter must be a mapping.", first.line);
|
|
119
|
+
return value;
|
|
120
|
+
}
|
|
121
|
+
block(i, indent, depth, pointer) {
|
|
122
|
+
if (depth > YAML_MAX_DEPTH) {
|
|
123
|
+
throw new YamlFailure(`Nesting is deeper than ${YAML_MAX_DEPTH} levels.`, this.lines[i].line);
|
|
124
|
+
}
|
|
125
|
+
if (isSequenceItem(this.lines[i].text))
|
|
126
|
+
return this.sequence(i, indent, depth, pointer);
|
|
127
|
+
return this.mapping(i, indent, depth, pointer);
|
|
128
|
+
}
|
|
129
|
+
mapping(start, indent, depth, pointer) {
|
|
130
|
+
const result = {};
|
|
131
|
+
let i = start;
|
|
132
|
+
while (i < this.lines.length && this.lines[i].indent === indent) {
|
|
133
|
+
const current = this.lines[i];
|
|
134
|
+
if (isSequenceItem(current.text)) {
|
|
135
|
+
throw new YamlFailure("A sequence item appears where a mapping key was expected.", current.line);
|
|
136
|
+
}
|
|
137
|
+
const split = this.splitKey(current);
|
|
138
|
+
if (split === null)
|
|
139
|
+
throw new YamlFailure("Expected `key: value`.", current.line);
|
|
140
|
+
const { key, rest } = split;
|
|
141
|
+
if (key === "<<")
|
|
142
|
+
throw new YamlFailure("Merge keys (`<<`) are not accepted.", current.line);
|
|
143
|
+
if (Object.hasOwn(result, key))
|
|
144
|
+
throw new YamlFailure(`Duplicate key \`${key}\`.`, current.line);
|
|
145
|
+
const childPointer = `${pointer}/${pointerToken(key)}`;
|
|
146
|
+
this.positions.set(childPointer, current.line);
|
|
147
|
+
let value;
|
|
148
|
+
if (rest !== "") {
|
|
149
|
+
value = this.inline(rest, current.line, depth, childPointer);
|
|
150
|
+
i++;
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
i++;
|
|
154
|
+
const next = this.lines[i];
|
|
155
|
+
if (next !== undefined && next.indent > indent) {
|
|
156
|
+
({ value, next: i } = this.block(i, next.indent, depth + 1, childPointer));
|
|
157
|
+
}
|
|
158
|
+
else if (next !== undefined && next.indent === indent && isSequenceItem(next.text)) {
|
|
159
|
+
({ value, next: i } = this.sequence(i, indent, depth + 1, childPointer));
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
value = null;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
result[key] = value;
|
|
166
|
+
}
|
|
167
|
+
this.checkDedent(i, indent);
|
|
168
|
+
return { value: result, next: i };
|
|
169
|
+
}
|
|
170
|
+
sequence(start, indent, depth, pointer) {
|
|
171
|
+
if (depth > YAML_MAX_DEPTH) {
|
|
172
|
+
throw new YamlFailure(`Nesting is deeper than ${YAML_MAX_DEPTH} levels.`, this.lines[start].line);
|
|
173
|
+
}
|
|
174
|
+
const items = [];
|
|
175
|
+
let i = start;
|
|
176
|
+
while (i < this.lines.length && this.lines[i].indent === indent && isSequenceItem(this.lines[i].text)) {
|
|
177
|
+
const current = this.lines[i];
|
|
178
|
+
const itemPointer = `${pointer}/${items.length}`;
|
|
179
|
+
this.positions.set(itemPointer, current.line);
|
|
180
|
+
const match = /^-(?: +(.*))?$/.exec(current.text);
|
|
181
|
+
const rest = match?.[1] ?? "";
|
|
182
|
+
const restIndent = indent + (current.text.length - rest.length);
|
|
183
|
+
let value;
|
|
184
|
+
if (rest === "" || rest.startsWith("#")) {
|
|
185
|
+
i++;
|
|
186
|
+
const next = this.lines[i];
|
|
187
|
+
if (next !== undefined && next.indent > indent) {
|
|
188
|
+
({ value, next: i } = this.block(i, next.indent, depth + 1, itemPointer));
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
value = null;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
else if (isSequenceItem(rest) || this.splitKey({ ...current, text: rest }) !== null) {
|
|
195
|
+
this.lines[i] = { indent: restIndent, text: rest, line: current.line };
|
|
196
|
+
({ value, next: i } = this.block(i, restIndent, depth + 1, itemPointer));
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
value = this.inline(rest, current.line, depth, itemPointer);
|
|
200
|
+
i++;
|
|
201
|
+
}
|
|
202
|
+
items.push(value);
|
|
203
|
+
}
|
|
204
|
+
this.checkDedent(i, indent);
|
|
205
|
+
return { value: items, next: i };
|
|
206
|
+
}
|
|
207
|
+
checkDedent(i, indent) {
|
|
208
|
+
const line = this.lines[i];
|
|
209
|
+
if (line !== undefined && line.indent > indent) {
|
|
210
|
+
throw new YamlFailure("Unexpected indentation; multi-line plain scalars are not accepted.", line.line);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/** `key: rest` or `key:`; null when the line is not a mapping entry. */
|
|
214
|
+
splitKey(line) {
|
|
215
|
+
const text = line.text;
|
|
216
|
+
if (text.startsWith("? "))
|
|
217
|
+
throw new YamlFailure("Complex keys (`? `) are not accepted.", line.line);
|
|
218
|
+
if (text.startsWith('"') || text.startsWith("'")) {
|
|
219
|
+
const quoted = this.quoted(text, 0, line.line);
|
|
220
|
+
const after = text.slice(quoted.end);
|
|
221
|
+
const m = /^\s*:(?:\s+(.*))?$/.exec(after);
|
|
222
|
+
if (m === null)
|
|
223
|
+
return null;
|
|
224
|
+
return { key: quoted.value, rest: stripComment(m[1]) };
|
|
225
|
+
}
|
|
226
|
+
const m = /^(.*?):(?:\s+(.*))?$/.exec(text);
|
|
227
|
+
if (m === null)
|
|
228
|
+
return null;
|
|
229
|
+
const key = m[1].trim();
|
|
230
|
+
if (key === "")
|
|
231
|
+
throw new YamlFailure("Empty mapping key.", line.line);
|
|
232
|
+
if (/^[[{]/.test(key)) {
|
|
233
|
+
throw new YamlFailure("A flow collection cannot be a mapping key.", line.line);
|
|
234
|
+
}
|
|
235
|
+
if (/^[&*!]/.test(key))
|
|
236
|
+
this.rejectIndicator(key, line.line);
|
|
237
|
+
if (/ #/.test(key))
|
|
238
|
+
return null;
|
|
239
|
+
return { key, rest: stripComment(m[2]) };
|
|
240
|
+
}
|
|
241
|
+
rejectIndicator(text, line) {
|
|
242
|
+
const c = text[0];
|
|
243
|
+
if (c === "&")
|
|
244
|
+
throw new YamlFailure("Anchors (`&`) are not accepted.", line);
|
|
245
|
+
if (c === "*")
|
|
246
|
+
throw new YamlFailure("Aliases (`*`) are not accepted.", line);
|
|
247
|
+
if (c === "!")
|
|
248
|
+
throw new YamlFailure("Tags (`!`) are not accepted.", line);
|
|
249
|
+
if (c === "|" || c === ">")
|
|
250
|
+
throw new YamlFailure("Block scalars (`|`, `>`) are not accepted.", line);
|
|
251
|
+
if (c === "{")
|
|
252
|
+
throw new YamlFailure("Flow mappings (`{ }`) are not accepted; write a block mapping.", line);
|
|
253
|
+
if (c === "@" || c === "`")
|
|
254
|
+
throw new YamlFailure(`The character \`${c}\` cannot start a scalar.`, line);
|
|
255
|
+
if (c === "%")
|
|
256
|
+
throw new YamlFailure("YAML directives are not accepted.", line);
|
|
257
|
+
throw new YamlFailure(`Unexpected \`${c}\`.`, line);
|
|
258
|
+
}
|
|
259
|
+
/** A value on one line: quoted or plain scalar, flow sequence, or a rejected form. */
|
|
260
|
+
inline(raw, line, depth, pointer) {
|
|
261
|
+
const text = raw.trim();
|
|
262
|
+
const c = text[0];
|
|
263
|
+
if (c === "{" && text.replace(/\s*#.*$/, "") === "{}")
|
|
264
|
+
return {};
|
|
265
|
+
if ("&*!|>{@`%".includes(c))
|
|
266
|
+
this.rejectIndicator(text, line);
|
|
267
|
+
if (c === "[") {
|
|
268
|
+
const { value, end } = this.flowSequence(text, 0, line, depth + 1, pointer);
|
|
269
|
+
this.expectTail(text, end, line);
|
|
270
|
+
return value;
|
|
271
|
+
}
|
|
272
|
+
if (c === '"' || c === "'") {
|
|
273
|
+
const { value, end } = this.quoted(text, 0, line);
|
|
274
|
+
this.expectTail(text, end, line);
|
|
275
|
+
return value;
|
|
276
|
+
}
|
|
277
|
+
return this.plain(text, line);
|
|
278
|
+
}
|
|
279
|
+
expectTail(text, from, line) {
|
|
280
|
+
const tail = text.slice(from);
|
|
281
|
+
if (!/^\s*(?:#.*)?$/.test(tail)) {
|
|
282
|
+
throw new YamlFailure("Unexpected content after a scalar; a value is one scalar or one flow sequence.", line);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
plain(raw, line) {
|
|
286
|
+
const commentAt = raw.search(/\s#/);
|
|
287
|
+
const text = (commentAt === -1 ? raw : raw.slice(0, commentAt)).trim();
|
|
288
|
+
if (/:\s|:$/.test(text)) {
|
|
289
|
+
throw new YamlFailure("A plain scalar cannot contain `: `; quote the value.", line);
|
|
290
|
+
}
|
|
291
|
+
if (text === "" || text === "~" || text === "null" || text === "Null" || text === "NULL")
|
|
292
|
+
return null;
|
|
293
|
+
if (text === "true" || text === "True" || text === "TRUE")
|
|
294
|
+
return true;
|
|
295
|
+
if (text === "false" || text === "False" || text === "FALSE")
|
|
296
|
+
return false;
|
|
297
|
+
if (NON_FINITE.test(text))
|
|
298
|
+
throw new YamlFailure("Non-finite numbers are not accepted.", line);
|
|
299
|
+
if (INT.test(text) || FLOAT.test(text))
|
|
300
|
+
return Number(text);
|
|
301
|
+
return text;
|
|
302
|
+
}
|
|
303
|
+
quoted(text, start, line) {
|
|
304
|
+
const quote = text[start];
|
|
305
|
+
let out = "";
|
|
306
|
+
let i = start + 1;
|
|
307
|
+
while (i < text.length) {
|
|
308
|
+
const c = text[i];
|
|
309
|
+
if (quote === "'") {
|
|
310
|
+
if (c === "'") {
|
|
311
|
+
if (text[i + 1] === "'") {
|
|
312
|
+
out += "'";
|
|
313
|
+
i += 2;
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
return { value: out, end: i + 1 };
|
|
317
|
+
}
|
|
318
|
+
out += c;
|
|
319
|
+
i++;
|
|
320
|
+
continue;
|
|
321
|
+
}
|
|
322
|
+
if (c === '"')
|
|
323
|
+
return { value: out, end: i + 1 };
|
|
324
|
+
if (c === "\\") {
|
|
325
|
+
const e = text[i + 1];
|
|
326
|
+
if (e === undefined)
|
|
327
|
+
break;
|
|
328
|
+
if (e in ESCAPES) {
|
|
329
|
+
out += ESCAPES[e];
|
|
330
|
+
i += 2;
|
|
331
|
+
continue;
|
|
332
|
+
}
|
|
333
|
+
const width = e === "x" ? 2 : e === "u" ? 4 : e === "U" ? 8 : 0;
|
|
334
|
+
if (width === 0)
|
|
335
|
+
throw new YamlFailure(`Unknown escape \`\\${e}\`.`, line);
|
|
336
|
+
const hex = text.slice(i + 2, i + 2 + width);
|
|
337
|
+
if (!new RegExp(`^[0-9a-fA-F]{${width}}$`).test(hex)) {
|
|
338
|
+
throw new YamlFailure(`Malformed escape \`\\${e}${hex}\`.`, line);
|
|
339
|
+
}
|
|
340
|
+
out += String.fromCodePoint(Number.parseInt(hex, 16));
|
|
341
|
+
i += 2 + width;
|
|
342
|
+
continue;
|
|
343
|
+
}
|
|
344
|
+
out += c;
|
|
345
|
+
i++;
|
|
346
|
+
}
|
|
347
|
+
throw new YamlFailure("Unterminated quoted scalar.", line);
|
|
348
|
+
}
|
|
349
|
+
flowSequence(text, start, line, depth, pointer) {
|
|
350
|
+
if (depth > YAML_MAX_DEPTH)
|
|
351
|
+
throw new YamlFailure(`Nesting is deeper than ${YAML_MAX_DEPTH} levels.`, line);
|
|
352
|
+
const items = [];
|
|
353
|
+
let i = start + 1;
|
|
354
|
+
let expectItem = true;
|
|
355
|
+
for (;;) {
|
|
356
|
+
while (text[i] === " ")
|
|
357
|
+
i++;
|
|
358
|
+
const c = text[i];
|
|
359
|
+
if (c === undefined)
|
|
360
|
+
throw new YamlFailure("Unterminated flow sequence; close it on the same line.", line);
|
|
361
|
+
if (c === "]")
|
|
362
|
+
return { value: items, end: i + 1 };
|
|
363
|
+
if (!expectItem)
|
|
364
|
+
throw new YamlFailure("Expected `,` or `]` in a flow sequence.", line);
|
|
365
|
+
const itemPointer = `${pointer}/${items.length}`;
|
|
366
|
+
this.positions.set(itemPointer, line);
|
|
367
|
+
let value;
|
|
368
|
+
if (c === "[") {
|
|
369
|
+
({ value, end: i } = this.flowSequence(text, i, line, depth + 1, itemPointer));
|
|
370
|
+
}
|
|
371
|
+
else if (c === '"' || c === "'") {
|
|
372
|
+
({ value, end: i } = this.quoted(text, i, line));
|
|
373
|
+
}
|
|
374
|
+
else if (c === ",") {
|
|
375
|
+
throw new YamlFailure("Empty item in a flow sequence.", line);
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
if ("&*!|>{@`%".includes(c))
|
|
379
|
+
this.rejectIndicator(text.slice(i), line);
|
|
380
|
+
let j = i;
|
|
381
|
+
while (j < text.length && text[j] !== "," && text[j] !== "]")
|
|
382
|
+
j++;
|
|
383
|
+
const scalar = text.slice(i, j).trim();
|
|
384
|
+
if (scalar.includes("#"))
|
|
385
|
+
throw new YamlFailure("A comment cannot appear inside a flow sequence.", line);
|
|
386
|
+
value = this.plain(scalar, line);
|
|
387
|
+
i = j;
|
|
388
|
+
}
|
|
389
|
+
items.push(value);
|
|
390
|
+
while (text[i] === " ")
|
|
391
|
+
i++;
|
|
392
|
+
if (text[i] === ",") {
|
|
393
|
+
i++;
|
|
394
|
+
expectItem = true;
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
expectItem = false;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
/** The rest of a `key:` line with a trailing comment-only remainder read as empty. */
|
|
403
|
+
function stripComment(rest) {
|
|
404
|
+
const text = (rest ?? "").trim();
|
|
405
|
+
return text.startsWith("#") ? "" : text;
|
|
406
|
+
}
|
|
407
|
+
function isSequenceItem(text) {
|
|
408
|
+
return text === "-" || text.startsWith("- ");
|
|
409
|
+
}
|
|
410
|
+
function isMapping(value) {
|
|
411
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
412
|
+
}
|
|
413
|
+
//# sourceMappingURL=yaml.js.map
|
package/dist/yaml.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml.js","sourceRoot":"","sources":["../src/yaml.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAeH,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,GAAG,IAAI,CAAC;AACzC,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC;AACnC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AAQjC,MAAM,WAAY,SAAQ,KAAK;IAC7B,IAAI,CAAS;IACb,YAAY,OAAe,EAAE,IAAY;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,qGAAqG;AACrG,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,MAAM,CAAC,KAAK;QAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;IAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC9C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IACxC,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC;QACjD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACvC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAA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Y;IAClC,OAAO,IAAI,KAAK,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAC/C,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@intentset/core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Intentset core: the frontmatter carrier, typed graph, validator, impact traversal and export. No dependencies.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=22.18"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/intentset/intentset.git",
|
|
13
|
+
"directory": "packages/core"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://intentset.org/",
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"intentset",
|
|
21
|
+
"requirements",
|
|
22
|
+
"traceability",
|
|
23
|
+
"product-model"
|
|
24
|
+
],
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"src"
|
|
28
|
+
],
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"intentset-source": "./src/index.ts",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"default": "./dist/index.js"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|