@metaobjectsdev/metadata 0.7.0-rc.1 → 0.7.0-rc.2
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/core/parser-yaml.d.ts.map +1 -1
- package/dist/core/parser-yaml.js +24 -8
- package/dist/core/parser-yaml.js.map +1 -1
- package/dist/core/yaml-desugar.d.ts.map +1 -1
- package/dist/core/yaml-desugar.js +54 -5
- package/dist/core/yaml-desugar.js.map +1 -1
- package/dist/core/yaml-positions-walker.d.ts +21 -0
- package/dist/core/yaml-positions-walker.d.ts.map +1 -0
- package/dist/core/yaml-positions-walker.js +75 -0
- package/dist/core/yaml-positions-walker.js.map +1 -0
- package/dist/core/yaml-positions.d.ts +19 -0
- package/dist/core/yaml-positions.d.ts.map +1 -0
- package/dist/core/yaml-positions.js +60 -0
- package/dist/core/yaml-positions.js.map +1 -0
- package/dist/errors.d.ts +4 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +13 -0
- package/dist/errors.js.map +1 -1
- package/dist/loader/meta-data-loader.d.ts.map +1 -1
- package/dist/loader/meta-data-loader.js +26 -6
- package/dist/loader/meta-data-loader.js.map +1 -1
- package/dist/loader/validation-passes.d.ts.map +1 -1
- package/dist/loader/validation-passes.js +81 -17
- package/dist/loader/validation-passes.js.map +1 -1
- package/dist/parser-core.d.ts +16 -1
- package/dist/parser-core.d.ts.map +1 -1
- package/dist/parser-core.js +266 -8
- package/dist/parser-core.js.map +1 -1
- package/dist/source.d.ts +29 -1
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +25 -0
- package/dist/source.js.map +1 -1
- package/package.json +1 -1
- package/src/core/parser-yaml.ts +24 -8
- package/src/core/yaml-desugar.ts +58 -4
- package/src/core/yaml-positions-walker.ts +101 -0
- package/src/core/yaml-positions.ts +80 -0
- package/src/errors.ts +15 -0
- package/src/loader/meta-data-loader.ts +26 -6
- package/src/loader/validation-passes.ts +83 -20
- package/src/parser-core.ts +306 -10
- package/src/source.ts +40 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser-yaml.d.ts","sourceRoot":"","sources":["../../src/core/parser-yaml.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parser-yaml.d.ts","sourceRoot":"","sources":["../../src/core/parser-yaml.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAqBnE,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,WAAW,CAoD1E"}
|
package/dist/core/parser-yaml.js
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
// Authoring YAML parser.
|
|
2
2
|
//
|
|
3
|
-
// parseYaml is a front-end:
|
|
4
|
-
// (parser-core.ts). The desugar applies the four authoring-sugar
|
|
5
|
-
// resulting typed tree is identical to the one the equivalent
|
|
6
|
-
// produces.
|
|
7
|
-
|
|
3
|
+
// parseYaml is a front-end: parseYamlWithPositions → desugar → the shared
|
|
4
|
+
// buildTree (parser-core.ts). The desugar applies the four authoring-sugar
|
|
5
|
+
// rules so the resulting typed tree is identical to the one the equivalent
|
|
6
|
+
// canonical JSON produces.
|
|
7
|
+
//
|
|
8
|
+
// FR5b: the parse phase now preserves YAML source positions through the
|
|
9
|
+
// pipeline. parseYamlWithPositions attaches a Symbol-keyed position-by-key
|
|
10
|
+
// map onto every mapping object; desugar shallow-copies that property; and
|
|
11
|
+
// buildTree's `format: "yaml"` mode reads the position when stamping
|
|
12
|
+
// `node.source.yamlPosition` (see parser-core.ts).
|
|
8
13
|
import { ParseError } from "../errors.js";
|
|
9
14
|
import { buildTree } from "../parser-core.js";
|
|
10
15
|
import { desugar } from "./yaml-desugar.js";
|
|
16
|
+
import { parseYamlWithPositions } from "./yaml-positions-walker.js";
|
|
11
17
|
/** FR5a / ADR-0009 — build a YAML-source envelope rooted at "$".
|
|
12
|
-
* yamlPosition
|
|
18
|
+
* yamlPosition on the envelope is left undefined here; envelopes for
|
|
19
|
+
* THROWN parser errors carry positions only when the parse phase pushed
|
|
20
|
+
* the path into the live parser-core builder (see populateNodeSource in
|
|
21
|
+
* parser-core.ts). Errors raised before buildTree (e.g. yaml syntax
|
|
22
|
+
* failures, an empty desugar result) lack a node — `yamlPosition` is
|
|
23
|
+
* intentionally omitted, per the spec's "skip on desugar-synthesized
|
|
24
|
+
* nodes" decision. */
|
|
13
25
|
function yamlSource(sourceName) {
|
|
14
26
|
return {
|
|
15
27
|
format: "yaml",
|
|
@@ -24,7 +36,7 @@ export function parseYaml(content, opts) {
|
|
|
24
36
|
// The loader's per-source try/catch collects the throw into LoadResult.errors.
|
|
25
37
|
let parsed;
|
|
26
38
|
try {
|
|
27
|
-
parsed =
|
|
39
|
+
parsed = parseYamlWithPositions(normalizedContent).value;
|
|
28
40
|
}
|
|
29
41
|
catch (err) {
|
|
30
42
|
throw new ParseError(`Invalid YAML: ${err.message}`, { code: "ERR_MALFORMED_YAML", source: yamlSource(opts.sourceName) });
|
|
@@ -37,7 +49,10 @@ export function parseYaml(content, opts) {
|
|
|
37
49
|
const first = desugarErrors[0];
|
|
38
50
|
throw new ParseError(first.message, { code: first.code ?? "ERR_MALFORMED_YAML", source: yamlSource(opts.sourceName) });
|
|
39
51
|
}
|
|
40
|
-
|
|
52
|
+
// FR5b — buildTree needs to know the source-format discriminant so
|
|
53
|
+
// populateNodeSource emits `format: "yaml"` envelopes (with the
|
|
54
|
+
// optional yamlPosition) instead of the default `format: "json"`.
|
|
55
|
+
const result = buildTree(canonical, { ...opts, sourceFormat: "yaml" });
|
|
41
56
|
// Merge collected desugar errors ahead of buildTree's own collected errors.
|
|
42
57
|
// Each CollectedError carries its own stable code when set (e.g.
|
|
43
58
|
// ERR_YAML_COERCION from the D2 type-coercion guard); the malformed-document
|
|
@@ -50,6 +65,7 @@ export function parseYaml(content, opts) {
|
|
|
50
65
|
root: result.root,
|
|
51
66
|
warnings: result.warnings,
|
|
52
67
|
errors: [...desugarParseErrors, ...result.errors],
|
|
68
|
+
envelopeWarnings: result.envelopeWarnings,
|
|
53
69
|
};
|
|
54
70
|
}
|
|
55
71
|
//# sourceMappingURL=parser-yaml.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser-yaml.js","sourceRoot":"","sources":["../../src/core/parser-yaml.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"parser-yaml.js","sourceRoot":"","sources":["../../src/core/parser-yaml.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,2EAA2E;AAC3E,2BAA2B;AAC3B,EAAE;AACF,wEAAwE;AACxE,2EAA2E;AAC3E,2EAA2E;AAC3E,qEAAqE;AACrE,mDAAmD;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG9C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE;;;;;;;uBAOuB;AACvB,SAAS,UAAU,CAAC,UAA8B;IAChD,OAAO;QACL,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,CAAC,UAAU,IAAI,WAAW,CAAC;QAClC,QAAQ,EAAE,GAAG;KACd,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAAe,EAAE,IAAkB;IAC3D,0DAA0D;IAC1D,MAAM,iBAAiB,GACrB,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAEhE,wEAAwE;IACxE,+EAA+E;IAC/E,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QAC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IACF,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,MAAM,EAAE,CAAC,GAAG,kBAAkB,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC;QACjD,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;KAC1C,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yaml-desugar.d.ts","sourceRoot":"","sources":["../../src/core/yaml-desugar.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,gBAAgB,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"yaml-desugar.d.ts","sourceRoot":"","sources":["../../src/core/yaml-desugar.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,gBAAgB,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AA0B9C,6EAA6E;AAC7E,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,uFAAuF;IACvF,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,iDAAiD;IACjD,MAAM,EAAE,cAAc,EAAE,CAAC;CAC1B;AAED,+EAA+E;AAC/E,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,GAAG,aAAa,CAI7E"}
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
// CollectedError entries (a string message + optional stable error code) and a
|
|
29
29
|
// safe placeholder is substituted so buildTree does not double-report.
|
|
30
30
|
import { ATTR_PREFIX, RESERVED_KEYS, RESERVED_KEY_CHILDREN, RESERVED_KEY_NAME, RESERVED_KEY_IS_ARRAY, TYPE_SUBTYPE_SEPARATOR, } from "../shared/structural.js";
|
|
31
|
+
import { getPositionMap, setPositionMap, } from "./yaml-positions.js";
|
|
31
32
|
import { ATTR_SUBTYPE_STRING, ATTR_SUBTYPE_CLASS, ATTR_SUBTYPE_INT, ATTR_SUBTYPE_LONG, ATTR_SUBTYPE_DOUBLE, ATTR_SUBTYPE_BOOLEAN, ATTR_SUBTYPE_STRINGARRAY, } from "./attr/attr-constants.js";
|
|
32
33
|
const ARRAY_SUFFIX = "[]";
|
|
33
34
|
/** Desugar a parsed-YAML authoring document into a canonical-shaped object. */
|
|
@@ -53,6 +54,10 @@ function desugarNode(input, registry, errors, path) {
|
|
|
53
54
|
}
|
|
54
55
|
const rawKey = entries[0];
|
|
55
56
|
const rawBody = input[rawKey];
|
|
57
|
+
// FR5b — capture the wrapper-level position-by-key map BEFORE re-keying.
|
|
58
|
+
// The author's raw key (with `[]` suffix and possibly omitted subType) is
|
|
59
|
+
// the lookup key; the desugar's canonical key is what we emit.
|
|
60
|
+
const wrapperPositions = getPositionMap(input);
|
|
56
61
|
// Rule 4: a trailing "[]" on the key → isArray.
|
|
57
62
|
let key = rawKey;
|
|
58
63
|
let isArray = false;
|
|
@@ -63,7 +68,10 @@ function desugarNode(input, registry, errors, path) {
|
|
|
63
68
|
// Rule 1: a bare `type` key → the type's registry default subType.
|
|
64
69
|
const canonicalKey = resolveKey(key, registry, errors, path);
|
|
65
70
|
// Rule 2: a scalar body → { name: <scalar> }.
|
|
66
|
-
|
|
71
|
+
// FR5b — propagate the wrapper-key's position into the synthesized body
|
|
72
|
+
// when the input body was a scalar (no body-side positions to inherit).
|
|
73
|
+
const wrapperKeyPos = wrapperPositions?.[rawKey];
|
|
74
|
+
const body = desugarBody(rawBody, registry, canonicalKey, errors, path, wrapperKeyPos);
|
|
67
75
|
// Rule 4 (cont.): stamp isArray onto the canonical body.
|
|
68
76
|
if (isArray)
|
|
69
77
|
body[RESERVED_KEY_IS_ARRAY] = true;
|
|
@@ -81,7 +89,15 @@ function desugarNode(input, registry, errors, path) {
|
|
|
81
89
|
body[RESERVED_KEY_CHILDREN] = children;
|
|
82
90
|
}
|
|
83
91
|
// A non-array `children` value is left untouched — buildTree reports it.
|
|
84
|
-
|
|
92
|
+
// FR5b — emit a wrapper-level position-by-key map for the canonical wrapper
|
|
93
|
+
// so buildTree's per-child iteration can read the position via the same
|
|
94
|
+
// lookup it uses for JSON input. The single key transformation is
|
|
95
|
+
// rawKey → canonicalKey (Rule 1 fuses the subType, Rule 4 strips `[]`).
|
|
96
|
+
const outWrapper = { [canonicalKey]: body };
|
|
97
|
+
if (wrapperKeyPos !== undefined) {
|
|
98
|
+
setPositionMap(outWrapper, { [canonicalKey]: wrapperKeyPos });
|
|
99
|
+
}
|
|
100
|
+
return outWrapper;
|
|
85
101
|
}
|
|
86
102
|
// Rule 1 — resolve a possibly-bare key to a fused `type.subType` token.
|
|
87
103
|
function resolveKey(key, registry, errors, path) {
|
|
@@ -106,14 +122,28 @@ function resolveKey(key, registry, errors, path) {
|
|
|
106
122
|
// (type, subType) declares with a typed `valueType`, if the raw JS value's
|
|
107
123
|
// type was silently coerced by YAML 1.2 to something incompatible (e.g. a
|
|
108
124
|
// `boolean` for a `string`-declared attr), an ERR_YAML_COERCION is collected.
|
|
109
|
-
function desugarBody(rawBody, registry, canonicalKey, errors, path
|
|
125
|
+
function desugarBody(rawBody, registry, canonicalKey, errors, path,
|
|
126
|
+
/** FR5b — position of the WRAPPER key (the `field.string:` line). Used to
|
|
127
|
+
* back-fill `yamlPosition` on synthesized bodies (Rule 2's scalar lift) +
|
|
128
|
+
* empty bodies; for mapping bodies we use the body's own position-by-key
|
|
129
|
+
* map. */
|
|
130
|
+
wrapperKeyPos) {
|
|
110
131
|
if (typeof rawBody === "string" ||
|
|
111
132
|
typeof rawBody === "number" ||
|
|
112
133
|
typeof rawBody === "boolean") {
|
|
113
|
-
|
|
134
|
+
// FR5b — the synthesized `{ name: rawBody }` has no YAML-side
|
|
135
|
+
// counterpart; we attribute the `name` slot to the wrapper-key's
|
|
136
|
+
// position (the only YAML position that meaningfully belongs to this
|
|
137
|
+
// synthesis).
|
|
138
|
+
const out = { [RESERVED_KEY_NAME]: rawBody };
|
|
139
|
+
if (wrapperKeyPos !== undefined) {
|
|
140
|
+
setPositionMap(out, { [RESERVED_KEY_NAME]: wrapperKeyPos });
|
|
141
|
+
}
|
|
142
|
+
return out;
|
|
114
143
|
}
|
|
115
144
|
if (rawBody === null || rawBody === undefined) {
|
|
116
145
|
// An empty body (`field.string:` with nothing after) → an empty node.
|
|
146
|
+
// No body keys to position; the wrapper carries the node's position.
|
|
117
147
|
return {};
|
|
118
148
|
}
|
|
119
149
|
if (Array.isArray(rawBody)) {
|
|
@@ -127,10 +157,21 @@ function desugarBody(rawBody, registry, canonicalKey, errors, path) {
|
|
|
127
157
|
// Rule D2 (type-coercion guard).
|
|
128
158
|
const src = rawBody;
|
|
129
159
|
const out = {};
|
|
160
|
+
// FR5b — translate the body's position-by-key map across the sigil-free
|
|
161
|
+
// rewrite. A bare `filterable` key in the source maps to `@filterable` in
|
|
162
|
+
// the canonical body; the YAML position belongs to BOTH names (the YAML
|
|
163
|
+
// author only wrote one). We re-key the position map to match the canonical
|
|
164
|
+
// body's keys so buildTree's per-attr inspection (FR5b follow-ups, e.g.
|
|
165
|
+
// ERR_BAD_ATTR_VALUE) can find the position via the canonical key.
|
|
166
|
+
const srcPositions = getPositionMap(src);
|
|
167
|
+
const outPositions = {};
|
|
168
|
+
let hasOutPositions = false;
|
|
130
169
|
const schemaIndex = attrSchemaIndex(registry, canonicalKey);
|
|
131
170
|
for (const key of Object.keys(src)) {
|
|
171
|
+
let outKey;
|
|
132
172
|
if (RESERVED_KEYS.has(key) || key.startsWith(ATTR_PREFIX)) {
|
|
133
173
|
out[key] = src[key];
|
|
174
|
+
outKey = key;
|
|
134
175
|
// D2 also applies to author-written @-keys (the awkward form).
|
|
135
176
|
const attrName = key.startsWith(ATTR_PREFIX) ? key.slice(ATTR_PREFIX.length) : "";
|
|
136
177
|
if (attrName !== "" && !RESERVED_KEYS.has(attrName)) {
|
|
@@ -138,10 +179,18 @@ function desugarBody(rawBody, registry, canonicalKey, errors, path) {
|
|
|
138
179
|
}
|
|
139
180
|
}
|
|
140
181
|
else {
|
|
141
|
-
|
|
182
|
+
outKey = `${ATTR_PREFIX}${key}`;
|
|
183
|
+
out[outKey] = src[key];
|
|
142
184
|
checkCoercion(key, src[key], schemaIndex, errors, path);
|
|
143
185
|
}
|
|
186
|
+
const pos = srcPositions?.[key];
|
|
187
|
+
if (pos !== undefined) {
|
|
188
|
+
outPositions[outKey] = pos;
|
|
189
|
+
hasOutPositions = true;
|
|
190
|
+
}
|
|
144
191
|
}
|
|
192
|
+
if (hasOutPositions)
|
|
193
|
+
setPositionMap(out, outPositions);
|
|
145
194
|
return out;
|
|
146
195
|
}
|
|
147
196
|
// ---------------------------------------------------------------------------
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yaml-desugar.js","sourceRoot":"","sources":["../../src/core/yaml-desugar.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,EAAE;AACF,0EAA0E;AAC1E,+EAA+E;AAC/E,+CAA+C;AAC/C,+EAA+E;AAC/E,iCAAiC;AACjC,sEAAsE;AACtE,4EAA4E;AAC5E,yEAAyE;AACzE,mEAAmE;AACnE,gFAAgF;AAChF,2EAA2E;AAC3E,yEAAyE;AACzE,2EAA2E;AAC3E,0EAA0E;AAC1E,iEAAiE;AACjE,EAAE;AACF,+EAA+E;AAC/E,6EAA6E;AAC7E,4EAA4E;AAC5E,uEAAuE;AACvE,8EAA8E;AAC9E,+EAA+E;AAC/E,4EAA4E;AAC5E,EAAE;AACF,wEAAwE;AACxE,+EAA+E;AAC/E,uEAAuE;AAIvE,OAAO,EACL,WAAW,EACX,aAAa,EACb,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,yBA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AACH,CAAC;AAED,6EAA6E;AAC7E,4EAA4E;AAC5E,oEAAoE;AACpE,SAAS,YAAY,CACnB,QAAgB,EAChB,GAAY,EACZ,QAAgB,EAChB,MAAwB,EACxB,IAAY;IAEZ,MAAM,UAAU,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IACxC,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IACjC,MAAM,CAAC,IAAI,CAAC;QACV,OAAO,EACL,eAAe,QAAQ,QAAQ,IAAI,cAAc,QAAQ,YAAY,UAAU,KAAK,OAAO,KAAK;YAChG,kEAAkE;YAClE,KAAK,QAAQ,MAAM,OAAO,YAAY,QAAQ,KAAK,OAAO,IAAI;QAChE,IAAI,EAAE,mBAAmB;KAC1B,CAAC,CAAC;AACL,CAAC;AAED,SAAS,eAAe,CAAC,GAAY;IACnC,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IAChC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,OAAO,CAAC;IACvC,OAAO,OAAO,GAAG,CAAC;AACpB,CAAC;AAED,SAAS,WAAW,CAAC,GAAY;IAC/B,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IAChC,IAAI,OAAO,GAAG,KAAK,SAAS;QAAE,OAAO,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAC5D,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IAChD,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,GAAG,CAAC;IACxC,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LineCounter } from "yaml";
|
|
2
|
+
/** Result of parsing YAML text with positions retained. */
|
|
3
|
+
export interface YamlParseResult {
|
|
4
|
+
/** The JS object (same shape as `yaml.parse(text)` returns), with
|
|
5
|
+
* position-by-key maps attached to every mapping. */
|
|
6
|
+
value: unknown;
|
|
7
|
+
/** The yaml library's LineCounter — exposed for callers that need to map
|
|
8
|
+
* additional ranges (e.g. surfacing errors raised by the YAML library
|
|
9
|
+
* itself). */
|
|
10
|
+
lineCounter: LineCounter;
|
|
11
|
+
}
|
|
12
|
+
/** Parse YAML text and return a JS object with positions attached.
|
|
13
|
+
*
|
|
14
|
+
* Mirrors the contract of `yaml.parse(text)` for the shapes the metaobjects
|
|
15
|
+
* authoring grammar uses (mappings, sequences, scalars). Aliases and tags
|
|
16
|
+
* are deferred via the underlying parseDocument call — i.e. they resolve as
|
|
17
|
+
* the library normally would.
|
|
18
|
+
*
|
|
19
|
+
* Throws on YAML syntax errors (same behavior as `yaml.parse`). */
|
|
20
|
+
export declare function parseYamlWithPositions(text: string): YamlParseResult;
|
|
21
|
+
//# sourceMappingURL=yaml-positions-walker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml-positions-walker.d.ts","sourceRoot":"","sources":["../../src/core/yaml-positions-walker.ts"],"names":[],"mappings":"AAOA,OAAO,EAML,WAAW,EAEZ,MAAM,MAAM,CAAC;AAOd,2DAA2D;AAC3D,MAAM,WAAW,eAAe;IAC9B;0DACsD;IACtD,KAAK,EAAE,OAAO,CAAC;IACf;;mBAEe;IACf,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED;;;;;;;oEAOoE;AACpE,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAUpE"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// FR5b — YAML AST → JS walker that preserves source positions.
|
|
2
|
+
//
|
|
3
|
+
// This module is the only place inside @metaobjectsdev/metadata that
|
|
4
|
+
// imports the `yaml` package. It lives in core/ alongside parser-yaml.ts,
|
|
5
|
+
// and is reached only via that parser — never via src/index.ts. The
|
|
6
|
+
// browser-safety test guards this invariant.
|
|
7
|
+
import { parseDocument, isAlias, isMap, isScalar, isSeq, LineCounter, } from "yaml";
|
|
8
|
+
import { setPositionMap, } from "./yaml-positions.js";
|
|
9
|
+
/** Parse YAML text and return a JS object with positions attached.
|
|
10
|
+
*
|
|
11
|
+
* Mirrors the contract of `yaml.parse(text)` for the shapes the metaobjects
|
|
12
|
+
* authoring grammar uses (mappings, sequences, scalars). Aliases and tags
|
|
13
|
+
* are deferred via the underlying parseDocument call — i.e. they resolve as
|
|
14
|
+
* the library normally would.
|
|
15
|
+
*
|
|
16
|
+
* Throws on YAML syntax errors (same behavior as `yaml.parse`). */
|
|
17
|
+
export function parseYamlWithPositions(text) {
|
|
18
|
+
const lineCounter = new LineCounter();
|
|
19
|
+
const doc = parseDocument(text, { lineCounter });
|
|
20
|
+
// Surface YAML syntax errors as a throw, matching `yaml.parse` behavior.
|
|
21
|
+
// (parseDocument collects them rather than throwing.)
|
|
22
|
+
if (doc.errors.length > 0) {
|
|
23
|
+
throw doc.errors[0];
|
|
24
|
+
}
|
|
25
|
+
const value = yamlNodeToJs(doc.contents, lineCounter, doc);
|
|
26
|
+
return { value, lineCounter };
|
|
27
|
+
}
|
|
28
|
+
// Walk a yaml AST node into a JS structure. For each YAMLMap, attach a
|
|
29
|
+
// position-by-key map onto the resulting JS object — the position of each
|
|
30
|
+
// key is the (line, col) of the KEY token in the YAML source.
|
|
31
|
+
function yamlNodeToJs(node, lineCounter, doc) {
|
|
32
|
+
if (node === null || node === undefined)
|
|
33
|
+
return null;
|
|
34
|
+
if (isScalar(node)) {
|
|
35
|
+
// Honour the library's default scalar typing (numbers / booleans /
|
|
36
|
+
// strings / null all come through Scalar.value).
|
|
37
|
+
return node.value;
|
|
38
|
+
}
|
|
39
|
+
if (isAlias(node)) {
|
|
40
|
+
// Resolve an anchor alias (e.g. `*col` after `&col sku_code`) to its
|
|
41
|
+
// target value — same behaviour as the library's toJS().
|
|
42
|
+
const target = node.resolve(doc);
|
|
43
|
+
return yamlNodeToJs(target, lineCounter, doc);
|
|
44
|
+
}
|
|
45
|
+
if (isMap(node)) {
|
|
46
|
+
const out = {};
|
|
47
|
+
const positions = {};
|
|
48
|
+
let hasAnyPosition = false;
|
|
49
|
+
for (const pair of node.items) {
|
|
50
|
+
// Only string-keyed entries are valid in metaobjects authoring; ignore
|
|
51
|
+
// exotic keys (numeric / complex) — they'd already break the desugar.
|
|
52
|
+
if (!isScalar(pair.key))
|
|
53
|
+
continue;
|
|
54
|
+
const keyText = String(pair.key.value);
|
|
55
|
+
const valueJs = yamlNodeToJs(pair.value, lineCounter, doc);
|
|
56
|
+
out[keyText] = valueJs;
|
|
57
|
+
const keyRange = pair.key.range;
|
|
58
|
+
if (keyRange !== null && keyRange !== undefined) {
|
|
59
|
+
const pos = lineCounter.linePos(keyRange[0]);
|
|
60
|
+
positions[keyText] = { line: pos.line, col: pos.col };
|
|
61
|
+
hasAnyPosition = true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (hasAnyPosition)
|
|
65
|
+
setPositionMap(out, positions);
|
|
66
|
+
return out;
|
|
67
|
+
}
|
|
68
|
+
if (isSeq(node)) {
|
|
69
|
+
return node.items.map((item) => yamlNodeToJs(item, lineCounter, doc));
|
|
70
|
+
}
|
|
71
|
+
// Tags / unsupported — fall back to null. The metaobjects authoring
|
|
72
|
+
// grammar does not use them.
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=yaml-positions-walker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml-positions-walker.js","sourceRoot":"","sources":["../../src/core/yaml-positions-walker.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,EAAE;AACF,qEAAqE;AACrE,0EAA0E;AAC1E,oEAAoE;AACpE,6CAA6C;AAE7C,OAAO,EACL,aAAa,EACb,OAAO,EACP,KAAK,EACL,QAAQ,EACR,KAAK,EACL,WAAW,GAEZ,MAAM,MAAM,CAAC;AAEd,OAAO,E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;
|
|
3
|
+
/** A YAML source position — 1-indexed line and column. */
|
|
4
|
+
export interface YamlPosition {
|
|
5
|
+
readonly line: number;
|
|
6
|
+
readonly col: number;
|
|
7
|
+
}
|
|
8
|
+
/** The position-by-key map attached to a mapping object. */
|
|
9
|
+
export type PositionMap = Record<string, YamlPosition>;
|
|
10
|
+
/** Read the position-by-key map from a JS object, if present.
|
|
11
|
+
* Returns undefined for primitives, arrays, null, and untagged objects. */
|
|
12
|
+
export declare function getPositionMap(obj: unknown): PositionMap | undefined;
|
|
13
|
+
/** Read the position for a specific key on a mapping object. */
|
|
14
|
+
export declare function getYamlPosition(obj: unknown, key: string): YamlPosition | undefined;
|
|
15
|
+
/** Attach (or replace) the position-by-key map on a mapping object. The map
|
|
16
|
+
* property is non-enumerable so JSON.stringify and `for (const k in obj)`
|
|
17
|
+
* loops do not see it. */
|
|
18
|
+
export declare function setPositionMap(obj: Record<string, unknown>, positions: PositionMap): void;
|
|
19
|
+
//# sourceMappingURL=yaml-positions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml-positions.d.ts","sourceRoot":"","sources":["../../src/core/yaml-positions.ts"],"names":[],"mappings":"AAkCA,oEAAoE;AACpE,eAAO,MAAM,oBAAoB,eAEhC,CAAC;AAEF,0DAA0D;AAC1D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,4DAA4D;AAC5D,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAEvD;4EAC4E;AAC5E,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,WAAW,GAAG,SAAS,CAKpE;AAED,gEAAgE;AAChE,wBAAgB,eAAe,CAC7B,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,MAAM,GACV,YAAY,GAAG,SAAS,CAG1B;AAED;;2BAE2B;AAC3B,wBAAgB,cAAc,CAC5B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,SAAS,EAAE,WAAW,GACrB,IAAI,CAON"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// FR5b — YAML authoring source-position carrier (per ADR-0009).
|
|
2
|
+
//
|
|
3
|
+
// This module is split into two layers so the browser bundle (which
|
|
4
|
+
// imports from src/index.ts) stays free of the Node-only `yaml` package:
|
|
5
|
+
//
|
|
6
|
+
// - yaml-positions.ts (this file) — pure types + Symbol + accessors. NO
|
|
7
|
+
// `yaml` import. Imported by parser-core.ts so the source-on-node
|
|
8
|
+
// stamper can read positions when stamping `format: "yaml"` envelopes.
|
|
9
|
+
// - yaml-positions-walker.ts — depends on `yaml`. Imported only by
|
|
10
|
+
// parser-yaml.ts (and parser-yaml itself only ships server-side).
|
|
11
|
+
//
|
|
12
|
+
// Source-map carrier (per the FR5b spec's "open question" §2): a
|
|
13
|
+
// Symbol-keyed, non-enumerable property on the wrapper-mapping object. The
|
|
14
|
+
// symbol is the well-known cross-port key
|
|
15
|
+
// `Symbol.for("@metaobjectsdev/yamlPositionByKey")`, so any plugin that
|
|
16
|
+
// touches the canonical JS can read positions if it knows to look. The
|
|
17
|
+
// map's keys are the wrapper's own keys (e.g. "object.entity" for a
|
|
18
|
+
// wrapper `{ "object.entity": { ... } }` or "name" / "package" /
|
|
19
|
+
// "children" for the body keys of a node).
|
|
20
|
+
//
|
|
21
|
+
// Rationale for "symbol-keyed property" over a parallel sourcemap / wrapper
|
|
22
|
+
// type:
|
|
23
|
+
// - Invisible to JSON.stringify and Object.keys (non-enumerable).
|
|
24
|
+
// - No parallel data structure to keep in sync — the position rides with
|
|
25
|
+
// the node it describes.
|
|
26
|
+
// - No wrapper type — desugar still operates on plain JS objects, so the
|
|
27
|
+
// existing Rule 1–5 logic does not need a rewrite.
|
|
28
|
+
//
|
|
29
|
+
// On desugar-synthesized nodes (Rule 2's scalar-body lift): the synthesized
|
|
30
|
+
// body `{ name: rawScalar }` inherits the wrapper key's position from the
|
|
31
|
+
// parent's position map. On any other synthesis (Rule 4's isArray stamping,
|
|
32
|
+
// for example), the position survives because we shallow-copy via the
|
|
33
|
+
// existing desugar path.
|
|
34
|
+
/** Cross-port well-known symbol key for the position-by-key map. */
|
|
35
|
+
export const YAML_POSITION_BY_KEY = Symbol.for("@metaobjectsdev/yamlPositionByKey");
|
|
36
|
+
/** Read the position-by-key map from a JS object, if present.
|
|
37
|
+
* Returns undefined for primitives, arrays, null, and untagged objects. */
|
|
38
|
+
export function getPositionMap(obj) {
|
|
39
|
+
if (obj === null || typeof obj !== "object" || Array.isArray(obj)) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
return obj[YAML_POSITION_BY_KEY];
|
|
43
|
+
}
|
|
44
|
+
/** Read the position for a specific key on a mapping object. */
|
|
45
|
+
export function getYamlPosition(obj, key) {
|
|
46
|
+
const map = getPositionMap(obj);
|
|
47
|
+
return map?.[key];
|
|
48
|
+
}
|
|
49
|
+
/** Attach (or replace) the position-by-key map on a mapping object. The map
|
|
50
|
+
* property is non-enumerable so JSON.stringify and `for (const k in obj)`
|
|
51
|
+
* loops do not see it. */
|
|
52
|
+
export function setPositionMap(obj, positions) {
|
|
53
|
+
Object.defineProperty(obj, YAML_POSITION_BY_KEY, {
|
|
54
|
+
value: positions,
|
|
55
|
+
enumerable: false,
|
|
56
|
+
writable: true,
|
|
57
|
+
configurable: true,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=yaml-positions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml-positions.js","sourceRoot":"","sources":["../../src/core/yaml-positions.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,EAAE;AACF,oEAAoE;AACpE,yEAAyE;AACzE,EAAE;AACF,0EAA0E;AAC1E,sEAAsE;AACtE,2EAA2E;AAC3E,qEAAqE;AACrE,sE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2
2
|
/** Stable, language-neutral error codes — mirrors fixtures/conformance/ERROR-CODES.json. */
|
|
3
|
-
export declare const ERROR_CODES: readonly ["ERR_TOP_LEVEL_NOT_OBJECT", "ERR_UNKNOWN_TYPE", "ERR_UNKNOWN_SUBTYPE", "ERR_MISSING_SUBTYPE", "ERR_DUPLICATE_NAME", "ERR_UNRESOLVED_SUPER", "ERR_INVALID_SUBTYPE_CHILD", "ERR_UNKNOWN_ATTR", "ERR_BAD_ATTR_VALUE", "ERR_BAD_DEFAULT_SORT_FIELD", "ERR_PROVIDER_DEPENDENCY_CYCLE", "ERR_PROVIDER_DUPLICATE_ID", "ERR_PROVIDER_MISSING_DEPENDENCY", "ERR_PROVIDER_ATTR_CONFLICT", "ERR_MALFORMED_JSON", "ERR_MISSING_REQUIRED_ATTR", "ERR_SUBTYPE_RULE_VIOLATION", "ERR_OVERLAY_NO_TARGET", "ERR_MALFORMED_YAML", "ERR_INVALID_ORIGIN", "ERR_INVALID_TEMPLATE", "ERR_VAR_NOT_ON_PAYLOAD", "ERR_PARTIAL_UNRESOLVED", "ERR_REQUIRED_SLOT_UNUSED", "ERR_OUTPUT_TAG_MISSING", "ERR_BAD_ATTR_FILTER", "ERR_STORAGE_FLATTENED_ARRAY", "ERR_STORAGE_WITHOUT_OBJECT_REF", "ERR_RESERVED_ATTR", "ERR_SOURCE_NO_PRIMARY", "ERR_SOURCE_MULTIPLE_PRIMARY", "ERR_YAML_COERCION", "ERR_UNKNOWN"];
|
|
3
|
+
export declare const ERROR_CODES: readonly ["ERR_TOP_LEVEL_NOT_OBJECT", "ERR_UNKNOWN_TYPE", "ERR_UNKNOWN_SUBTYPE", "ERR_MISSING_SUBTYPE", "ERR_DUPLICATE_NAME", "ERR_UNRESOLVED_SUPER", "ERR_INVALID_SUBTYPE_CHILD", "ERR_UNKNOWN_ATTR", "ERR_BAD_ATTR_VALUE", "ERR_BAD_DEFAULT_SORT_FIELD", "ERR_PROVIDER_DEPENDENCY_CYCLE", "ERR_PROVIDER_DUPLICATE_ID", "ERR_PROVIDER_MISSING_DEPENDENCY", "ERR_PROVIDER_ATTR_CONFLICT", "ERR_MALFORMED_JSON", "ERR_MISSING_REQUIRED_ATTR", "ERR_SUBTYPE_RULE_VIOLATION", "ERR_OVERLAY_NO_TARGET", "ERR_MALFORMED_YAML", "ERR_INVALID_ORIGIN", "ERR_INVALID_TEMPLATE", "ERR_VAR_NOT_ON_PAYLOAD", "ERR_PARTIAL_UNRESOLVED", "ERR_REQUIRED_SLOT_UNUSED", "ERR_OUTPUT_TAG_MISSING", "ERR_BAD_ATTR_FILTER", "ERR_STORAGE_FLATTENED_ARRAY", "ERR_STORAGE_WITHOUT_OBJECT_REF", "ERR_RESERVED_ATTR", "ERR_SOURCE_NO_PRIMARY", "ERR_SOURCE_MULTIPLE_PRIMARY", "ERR_YAML_COERCION", "ERR_MERGE_CONFLICT", "ERR_UNKNOWN"];
|
|
4
|
+
/** Warning codes — same envelope shape as errors but advisory. */
|
|
5
|
+
export declare const WARNING_CODES: readonly ["WARN_DUPLICATE_DECLARATION", "WARN_LEGACY"];
|
|
6
|
+
export type WarningCode = (typeof WARNING_CODES)[number];
|
|
4
7
|
export type ErrorCode = (typeof ERROR_CODES)[number];
|
|
5
8
|
/**
|
|
6
9
|
* Loader error carrying the ADR-0009 LoaderError envelope.
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEzE,4FAA4F;AAc5F,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEzE,4FAA4F;AAc5F,eAAO,MAAM,WAAW,k3BAwCd,CAAC;AAEX,kEAAkE;AAClE,eAAO,MAAM,aAAa,wDAQhB,CAAC;AACX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD;;;;;;;;;;;;;;GAcG;AACH,qBAAa,UAAW,SAAQ,KAAM,YAAW,WAAW;IAC1D,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC;gBAG1B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS,CAAC;QAChB,MAAM,EAAE,WAAW,CAAC;QACpB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,WAAW,CAAC;KACpB;CAiBJ;AAED;;;;;GAKG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;gBAEzB,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,SAAS,CAAA;KAAE;CAKzD"}
|
package/dist/errors.js
CHANGED
|
@@ -49,8 +49,21 @@ export const ERROR_CODES = [
|
|
|
49
49
|
// ADR-0006 D2 — YAML type-coercion guard. Emitted by every port's YAML
|
|
50
50
|
// loader when a coerced scalar mismatches the schema-declared type.
|
|
51
51
|
"ERR_YAML_COERCION",
|
|
52
|
+
// FR5c — multi-file overlay merge produced a conflicting attribute value:
|
|
53
|
+
// two contributors set the same @attr to different non-empty values.
|
|
54
|
+
"ERR_MERGE_CONFLICT",
|
|
52
55
|
"ERR_UNKNOWN",
|
|
53
56
|
];
|
|
57
|
+
/** Warning codes — same envelope shape as errors but advisory. */
|
|
58
|
+
export const WARNING_CODES = [
|
|
59
|
+
// FR5c — two contributors declared the same node identically (no semantic
|
|
60
|
+
// change). Emitted at the overlay-merge boundary.
|
|
61
|
+
"WARN_DUPLICATE_DECLARATION",
|
|
62
|
+
// Pre-FR5c legacy: parser/validator messages still surface as plain
|
|
63
|
+
// strings; wrapped at the loader boundary into the envelope shape with
|
|
64
|
+
// this code. Retired as those sites are migrated to envelopes.
|
|
65
|
+
"WARN_LEGACY",
|
|
66
|
+
];
|
|
54
67
|
/**
|
|
55
68
|
* Loader error carrying the ADR-0009 LoaderError envelope.
|
|
56
69
|
*
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAI/C,4FAA4F;AAC5F,kFAAkF;AAClF,yDAAyD;AACzD,4FAA4F;AAC5F,gGAAgG;AAChG,2EAA2E;AAC3E,0FAA0F;AAC1F,EAAE;AACF,oFAAoF;AACpF,uFAAuF;AACvF,mFAAmF;AACnF,uFAAuF;AACvF,uFAAuF;AACvF,0BAA0B;AAC1B,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,0BAA0B;IAC1B,kBAAkB;IAClB,qBAAqB;IACrB,qBAAqB;IACrB,oBAAoB;IACpB,sBAAsB;IACtB,2BAA2B;IAC3B,kBAAkB;IAClB,oBAAoB;IACpB,4BAA4B;IAC5B,+BAA+B;IAC/B,2BAA2B;IAC3B,iCAAiC;IACjC,4BAA4B;IAC5B,oBAAoB;IACpB,2BAA2B;IAC3B,4BAA4B;IAC5B,uBAAuB;IACvB,oBAAoB;IACpB,oBAAoB;IACpB,sBAAsB;IACtB,wBAAwB;IACxB,wBAAwB;IACxB,0BAA0B;IAC1B,wBAAwB;IACxB,qBAAqB;IACrB,6BAA6B;IAC7B,gCAAgC;IAChC,qFAAqF;IACrF,mBAAmB;IACnB,uBAAuB;IACvB,6BAA6B;IAC7B,uEAAuE;IACvE,oEAAoE;IACpE,mBAAmB;IACnB,aAAa;CACL,CAAC;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAI/C,4FAA4F;AAC5F,kFAAkF;AAClF,yDAAyD;AACzD,4FAA4F;AAC5F,gGAAgG;AAChG,2EAA2E;AAC3E,0FAA0F;AAC1F,EAAE;AACF,oFAAoF;AACpF,uFAAuF;AACvF,mFAAmF;AACnF,uFAAuF;AACvF,uFAAuF;AACvF,0BAA0B;AAC1B,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,0BAA0B;IAC1B,kBAAkB;IAClB,qBAAqB;IACrB,qBAAqB;IACrB,oBAAoB;IACpB,sBAAsB;IACtB,2BAA2B;IAC3B,kBAAkB;IAClB,oBAAoB;IACpB,4BAA4B;IAC5B,+BAA+B;IAC/B,2BAA2B;IAC3B,iCAAiC;IACjC,4BAA4B;IAC5B,oBAAoB;IACpB,2BAA2B;IAC3B,4BAA4B;IAC5B,uBAAuB;IACvB,oBAAoB;IACpB,oBAAoB;IACpB,sBAAsB;IACtB,wBAAwB;IACxB,wBAAwB;IACxB,0BAA0B;IAC1B,wBAAwB;IACxB,qBAAqB;IACrB,6BAA6B;IAC7B,gCAAgC;IAChC,qFAAqF;IACrF,mBAAmB;IACnB,uBAAuB;IACvB,6BAA6B;IAC7B,uEAAuE;IACvE,oEAAoE;IACpE,mBAAmB;IACnB,0EAA0E;IAC1E,qEAAqE;IACrE,oBAAoB;IACpB,aAAa;CACL,CAAC;AAEX,kEAAkE;AAClE,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,0EAA0E;IAC1E,kDAAkD;IAClD,4BAA4B;IAC5B,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CAAC;IA0BtB;;;;OAIG;WACU,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAM9E,0DAA0D;WAC7C,UAAU,CACrB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,cAAc,EACtB,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,UAAU,CAAC;IAQtB,6BAA6B;IAC7B,IAAI,KAAK,IAAI,YAAY,CAExB;IAED;;;;;;;OAOG;IACH,IAAI,QAAQ,IAAI,YAAY,CAE3B;IAED;;;;OAIG;IACH,IAAI,IAAI,IAAI,QAAQ,CAGnB;IAED;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;IAa1B;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAK9C;;;OAGG;IACH,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAKnE;;;OAGG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,EAAE;IASxC;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,WAAW,CACnB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,cAAc,EACtB,SAAS,EAAE,YAAY,GACtB,WAAW;IAuBd,OAAO,CAAC,MAAM,CAAC,WAAW,CAEZ;mBAEO,iBAAiB;IAUtC;;;;;;;;;;OAUG;IACG,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;CAuK3D"}
|
|
@@ -12,7 +12,7 @@ import { coreProviders } from "../core-types.js";
|
|
|
12
12
|
import { composeRegistry } from "../provider.js";
|
|
13
13
|
import { TYPE_METADATA, SUBTYPE_ROOT } from "../shared/base-types.js";
|
|
14
14
|
import { ParseError } from "../errors.js";
|
|
15
|
-
import { codeSource } from "../source.js";
|
|
15
|
+
import { codeSource, resolvedSource } from "../source.js";
|
|
16
16
|
import { parseJson } from "../parser-json.js";
|
|
17
17
|
import { validateDataGridSortFields, validateFilterableHasIndex, validateOriginPaths, validateDataGridFilterValues, validateFieldObjectStorage, validateTemplatePayloadRefs } from "./validation-passes.js";
|
|
18
18
|
import { validateSourceRoles } from "../persistence/source/validate-source-roles.js";
|
|
@@ -225,6 +225,11 @@ export class MetaDataLoader {
|
|
|
225
225
|
this._state = "loading";
|
|
226
226
|
const warnings = [];
|
|
227
227
|
const errors = [];
|
|
228
|
+
// FR5c — envelope-shaped warnings (WARN_DUPLICATE_DECLARATION et al.)
|
|
229
|
+
// surface here untouched. Distinct from the legacy `warnings: string[]`
|
|
230
|
+
// channel: those are wrapped in a WARN_LEGACY envelope at the boundary,
|
|
231
|
+
// while these already carry their own code + source.
|
|
232
|
+
const envelopeWarnings = [];
|
|
228
233
|
// Pre-load the YAML parser via dynamic import if any source declares
|
|
229
234
|
// YAML format. This keeps `parseSource` synchronous and the package root
|
|
230
235
|
// (src/index.ts) browser-safe — yaml is never statically imported from a
|
|
@@ -262,6 +267,10 @@ export class MetaDataLoader {
|
|
|
262
267
|
const parseResult = this.parseSource(content, source, parseOpts);
|
|
263
268
|
warnings.push(...parseResult.warnings);
|
|
264
269
|
errors.push(...parseResult.errors);
|
|
270
|
+
// FR5c — collect envelope-shaped warnings (already carry code +
|
|
271
|
+
// source). The legacy `warnings` channel still flows into the
|
|
272
|
+
// WARN_LEGACY-wrapping path below for unchanged behavior.
|
|
273
|
+
envelopeWarnings.push(...parseResult.envelopeWarnings);
|
|
265
274
|
root = parseResult.root;
|
|
266
275
|
}
|
|
267
276
|
catch (err) {
|
|
@@ -276,7 +285,14 @@ export class MetaDataLoader {
|
|
|
276
285
|
if (root !== undefined) {
|
|
277
286
|
const failures = resolveDeferredSupers(root);
|
|
278
287
|
for (const failure of failures) {
|
|
279
|
-
|
|
288
|
+
// FR5d — emit format=resolved with referrer + target. The referrer's
|
|
289
|
+
// parse-time source supplies files + jsonPath (the location of the
|
|
290
|
+
// broken `extends:` on disk); referrer = the declaring node's FQN;
|
|
291
|
+
// target = the unresolved supertype ref.
|
|
292
|
+
errors.push(new ParseError(`the SuperClass '${failure.ref}' does not exist (referenced by ${failure.nodeFqn})`, {
|
|
293
|
+
code: "ERR_UNRESOLVED_SUPER",
|
|
294
|
+
source: resolvedSource(failure.source, failure.nodeFqn, failure.ref),
|
|
295
|
+
}));
|
|
280
296
|
}
|
|
281
297
|
// Third pass: subtype rule validation (entity should have primary identity,
|
|
282
298
|
// value must not have one).
|
|
@@ -328,14 +344,18 @@ export class MetaDataLoader {
|
|
|
328
344
|
// LoaderWarning envelopes at the loader boundary. The parser/validator
|
|
329
345
|
// surface keeps its `string[]` shape internally (parser-core is shared
|
|
330
346
|
// with parseJson() / parseYaml() callers who consume string warnings
|
|
331
|
-
// directly). FR5c
|
|
332
|
-
//
|
|
333
|
-
const
|
|
347
|
+
// directly). FR5c-onward sites emit proper envelopes via parseResult.
|
|
348
|
+
// envelopeWarnings (collected above) — those surface unchanged.
|
|
349
|
+
const wrappedLegacy = warnings.map((msg) => ({
|
|
334
350
|
code: "WARN_LEGACY",
|
|
335
351
|
message: msg,
|
|
336
352
|
source: codeSource("MetaDataLoader"),
|
|
337
353
|
}));
|
|
338
|
-
return {
|
|
354
|
+
return {
|
|
355
|
+
root,
|
|
356
|
+
warnings: [...envelopeWarnings, ...wrappedLegacy],
|
|
357
|
+
errors,
|
|
358
|
+
};
|
|
339
359
|
}
|
|
340
360
|
}
|
|
341
361
|
//# sourceMappingURL=meta-data-loader.js.map
|