@dsillman2000/yaml-reference-ts 1.3.5 → 1.4.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.
package/README.md CHANGED
@@ -40,6 +40,14 @@ database: !reference
40
40
 
41
41
  # Inline mapping syntax
42
42
  settings: !reference {path: ./settings/production.yaml}
43
+
44
+ # Extract a specific anchor from the referenced file
45
+ db_host: !reference {path: ./config/database.yaml, anchor: host}
46
+
47
+ # Block style with anchor
48
+ db_config: !reference
49
+ path: ./config/database.yaml
50
+ anchor: cfg
43
51
  ```
44
52
 
45
53
  ### Multiple File Reference
@@ -51,6 +59,9 @@ configs: !reference-all
51
59
 
52
60
  # Inline mapping syntax
53
61
  files: !reference-all {glob: ./data/*.yaml}
62
+
63
+ # Extract a specific anchor from each matched file
64
+ ports: !reference-all {glob: ./services/*.yaml, anchor: port}
54
65
  ```
55
66
 
56
67
  ### Sequence Flattening
@@ -84,7 +95,7 @@ merged: !merge
84
95
  - {override: true}
85
96
  ```
86
97
 
87
- **Note**: For `!reference` and `!reference-all` tags, only mapping syntax is supported. Be sure to conform to the API (`!reference {path: <path>}` or `!reference-all {glob: <glob>}`). For `!flatten` and `!merge` tags, only sequence syntax is supported.
98
+ **Note**: For `!reference` and `!reference-all` tags, only mapping syntax is supported. Be sure to conform to the API (`!reference {path: <path>, anchor: <anchor>}` or `!reference-all {glob: <glob>, anchor: <anchor>}`, where `anchor` is optional). For `!flatten` and `!merge` tags, only sequence syntax is supported.
88
99
 
89
100
  **Deterministic Ordering**: The `!reference-all` tag resolves files in alphabetical order to ensure consistent, predictable results across different systems and runs.
90
101
 
@@ -110,24 +121,26 @@ async function loadConfig() {
110
121
  #### `loadYamlWithReferences(filePath: string, allowPaths?: string[]): Promise<any>`
111
122
  Loads a YAML file and resolves all `!reference`, `!reference-all`, `!flatten`, and `!merge` tags, returning the fully resolved object. The optional `allowPaths` parameter restricts which directories can be referenced (see Path Restrictions section).
112
123
 
113
- #### `parseYamlWithReferences(content: string, filePath: string): Promise<any>`
114
- Parses YAML content with custom tags, setting `_location` on Reference and parsing Flatten objects.
124
+ #### `parseYamlWithReferences(filePath: string, options?: ParseOptions): Promise<any>`
125
+ Parses a YAML file with custom tags, setting `location` on Reference and ReferenceAll instances. The optional `options.extractAnchor` specifies a YAML anchor name to extract from the document instead of returning the whole file.
115
126
 
116
127
  #### `loadYamlWithReferencesSync(filePath: string, allowPaths?: string[]): any`
117
128
  Loads a YAML file and resolves all `!reference`, `!reference-all`, `!flatten`, and `!merge` tags, returning the fully resolved object synchronously. The optional `allowPaths` parameter restricts which directories can be referenced (see Path Restrictions section).
118
129
 
119
- #### `parseYamlWithReferencesSync(content: string, filePath: string): any`
120
- Parses YAML content with custom tags, setting `_location` on Reference and parsing Flatten objects synchronously.
130
+ #### `parseYamlWithReferencesSync(filePath: string, options?: ParseOptions): any`
131
+ Parses a YAML file with custom tags, setting `location` on Reference and ReferenceAll instances synchronously. The optional `options.extractAnchor` specifies a YAML anchor name to extract from the document instead of returning the whole file.
121
132
 
122
133
  #### `Reference` Class
123
134
  Represents a `!reference` tag with properties:
124
- - `_location`: Absolute path to the file containing the reference
135
+ - `location`: Absolute path to the file containing the reference
125
136
  - `path`: Relative path to the referenced YAML file
137
+ - `anchor` (optional): Name of an anchor defined in the target file to extract instead of the whole document. Raises an error if the anchor does not exist.
126
138
 
127
139
  #### `ReferenceAll` Class
128
140
  Represents a `!reference-all` tag with properties:
129
- - `_location`: Absolute path to the file containing the reference
141
+ - `location`: Absolute path to the file containing the reference
130
142
  - `glob`: Glob pattern to match YAML files
143
+ - `anchor` (optional): Name of an anchor defined in each matched file to extract instead of the whole document. Raises an error if the anchor does not exist in any matched file.
131
144
 
132
145
  #### `Flatten` Class
133
146
  Represents a `!flatten` tag with properties:
@@ -260,23 +273,27 @@ const resolved = await loadYamlWithReferences('./config/main.yaml', [
260
273
 
261
274
  ### For `!reference` tags:
262
275
  1. The `path` property is parsed from the YAML mapping (must be a relative path)
263
- 2. `_location` is automatically set to the absolute path of the containing file
264
- 3. The referenced YAML file is read and parsed relative to `_location`
265
- 4. The target path is checked against allowed paths (see Path Restrictions)
266
- 5. Any references within the referenced file are recursively resolved
267
- 6. The `Reference` object is replaced with the resolved content
276
+ 2. The optional `anchor` property specifies a YAML anchor (`&name`) to extract from the target file
277
+ 3. `location` is automatically set to the absolute path of the containing file
278
+ 4. The referenced YAML file is read and parsed relative to `location`
279
+ 5. The target path is checked against allowed paths (see Path Restrictions)
280
+ 6. If `anchor` is specified, only the value attached to that anchor is extracted (after resolving aliases and tags like `!merge` within the target file). An error is raised if the anchor does not exist.
281
+ 7. Any references within the resolved content are recursively resolved
282
+ 8. The `Reference` object is replaced with the resolved content
268
283
 
269
284
  ### For `!reference-all` tags:
270
285
  1. The `glob` property is parsed from the YAML mapping (must be a relative glob pattern)
271
- 2. `_location` is automatically set to the absolute path of the containing file
272
- 3. The glob pattern is evaluated relative to `_location`
273
- 4. Matching files are filtered based on allowed paths (see Path Restrictions)
274
- 5. For each matching YAML file:
286
+ 2. The optional `anchor` property specifies a YAML anchor (`&name`) to extract from each matched file
287
+ 3. `location` is automatically set to the absolute path of the containing file
288
+ 4. The glob pattern is evaluated relative to `location`
289
+ 5. Matching files are filtered based on allowed paths (see Path Restrictions)
290
+ 6. For each matching YAML file:
275
291
  - The file is read and parsed
292
+ - If `anchor` is specified, only the value attached to that anchor is extracted. An error is raised if the anchor does not exist in any matched file.
276
293
  - Any references are recursively resolved
277
- 6. The `ReferenceAll` object is replaced with an array of resolved contents
278
- 7. Files are sorted and resolved in deterministic alphabetical order for consistent results across systems
279
- 8. If no files match, an error is thrown
294
+ 7. The `ReferenceAll` object is replaced with an array of resolved contents
295
+ 8. Files are sorted and resolved in deterministic alphabetical order for consistent results across systems
296
+ 9. If no files match, an error is thrown
280
297
 
281
298
  ### For `!flatten` tags:
282
299
  1. The sequence is parsed from the YAML (must be a sequence/array)
@@ -312,6 +329,7 @@ The library throws descriptive errors for:
312
329
  - Missing required properties (`path` for `!reference`, `glob` for `!reference-all`)
313
330
  - Absolute paths in `!reference` or `!reference-all` tags (only relative paths are allowed)
314
331
  - References to files outside allowed paths
332
+ - Non-existent `anchor` in a referenced file (or in any file matched by `!reference-all`)
315
333
  - `!flatten` tag applied to non-sequence values
316
334
  - `!merge` tag applied to a sequence of values that are not mappings
317
335
 
package/dist/Flatten.d.ts CHANGED
@@ -27,4 +27,13 @@ export declare class FlattenNode extends YAMLSeq {
27
27
  tag: string;
28
28
  toJSON(_: unknown, ctx: ToJSContext): unknown[];
29
29
  }
30
+ export declare const FlattenTags: ({
31
+ identify: (value: unknown) => value is FlattenNode;
32
+ tag: string;
33
+ collection: "seq";
34
+ nodeClass: typeof FlattenNode;
35
+ } | {
36
+ tag: string;
37
+ resolve: (_: unknown, onError: (message: string) => void) => void;
38
+ })[];
30
39
  //# sourceMappingURL=Flatten.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Flatten.d.ts","sourceRoot":"","sources":["../src/Flatten.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;;GAIG;AACH,qBAAa,OAAO;IAClB;;;OAGG;IACH,QAAQ,EAAE,OAAO,EAAE,CAAC;IAEpB;;;OAGG;gBACS,QAAQ,EAAE,OAAO,EAAE;IAI/B;;OAEG;IACH,QAAQ,IAAI,MAAM;CAUnB;AAED,eAAO,MAAM,iBAAiB,eAAsB,CAAC;AAErD,eAAO,MAAM,qBAAqB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAM,EAErE,CAAC;AAEF,qBAAa,WAAY,SAAQ,OAAO;IACtC,GAAG,SAAc;IACjB,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,WAAW;CAKpC"}
1
+ {"version":3,"file":"Flatten.d.ts","sourceRoot":"","sources":["../src/Flatten.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;;GAIG;AACH,qBAAa,OAAO;IAClB;;;OAGG;IACH,QAAQ,EAAE,OAAO,EAAE,CAAC;IAEpB;;;OAGG;gBACS,QAAQ,EAAE,OAAO,EAAE;IAI/B;;OAEG;IACH,QAAQ,IAAI,MAAM;CAUnB;AAED,eAAO,MAAM,iBAAiB,eAAsB,CAAC;AAErD,eAAO,MAAM,qBAAqB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAM,EAErE,CAAC;AAEF,qBAAa,WAAY,SAAQ,OAAO;IACtC,GAAG,SAAc;IACjB,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,WAAW;CAKpC;AAkCD,eAAO,MAAM,WAAW;sBA5BJ,OAAO;;;;;;iBAuBZ,OAAO,WAAW,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI;IASzD,CAAC"}
package/dist/Flatten.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FlattenNode = exports.isResolvedFlattenNode = exports.FLATTEN_NODE_FLAG = exports.Flatten = void 0;
3
+ exports.FlattenTags = exports.FlattenNode = exports.isResolvedFlattenNode = exports.FLATTEN_NODE_FLAG = exports.Flatten = void 0;
4
4
  const yaml_1 = require("yaml");
5
5
  /**
6
6
  * Flatten class representing a !flatten tag in YAML
@@ -46,4 +46,38 @@ class FlattenNode extends yaml_1.YAMLSeq {
46
46
  }
47
47
  }
48
48
  exports.FlattenNode = FlattenNode;
49
+ /**
50
+ * Custom tag for !flatten
51
+ */
52
+ const flattenTag = {
53
+ identify: (value) => value instanceof FlattenNode,
54
+ tag: "!flatten",
55
+ collection: "seq",
56
+ nodeClass: FlattenNode,
57
+ };
58
+ /**
59
+ * Dummy illegal flag when flatten is used on a mapping.
60
+ */
61
+ const illegalFlattenOnMapping = {
62
+ identify: (value) => value instanceof Flatten,
63
+ tag: "!flatten",
64
+ collection: "map",
65
+ resolve: (_, onError) => {
66
+ return onError("!flatten tag cannot be used on a mapping");
67
+ },
68
+ };
69
+ /**
70
+ * Dummy illegal flag when flatten is used on a scalar.
71
+ */
72
+ const illegalFlattenOnScalar = {
73
+ tag: "!flatten",
74
+ resolve: (_, onError) => {
75
+ return onError("!flatten tag cannot be used on a scalar");
76
+ },
77
+ };
78
+ exports.FlattenTags = [
79
+ flattenTag,
80
+ illegalFlattenOnMapping,
81
+ illegalFlattenOnScalar,
82
+ ];
49
83
  //# sourceMappingURL=Flatten.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Flatten.js","sourceRoot":"","sources":["../src/Flatten.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAG/B;;;;GAIG;AACH,MAAa,OAAO;IAOlB;;;OAGG;IACH,YAAY,QAAmB;QAC7B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO,uBAAuB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,CAAC,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;CACF;AA5BD,0BA4BC;AAEY,QAAA,iBAAiB,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AAE9C,MAAM,qBAAqB,GAAG,CAAC,KAAc,EAAqB,EAAE;IACzE,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,yBAAiB,IAAI,KAAK,CAAC;AAC5D,CAAC,CAAC;AAFW,QAAA,qBAAqB,yBAEhC;AAEF,MAAa,WAAY,SAAQ,cAAO;IAAxC;;QACE,QAAG,GAAG,UAAU,CAAC;IAMnB,CAAC;IALC,M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AAC,EAAE,IAAI,EAAE,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAPD,kCAOC;AAED;;GAEG;AACH,MAAM,UAAU,GAAG;IACjB,QAAQ,EAAE,CAAC,KAAc,EAAE,EAAE,CAAC,KAAK,YAAY,WAAW;IAC1D,GAAG,EAAE,UAAU;IACf,UAAU,EAAE,KAAc;IAC1B,SAAS,EAAE,WAAW;CACvB,CAAC;AAEF;;GAEG;AACH,MAAM,uBAAuB,GAAG;IAC9B,QAAQ,EAAE,CAAC,KAAc,EAAE,EAAE,CAAC,KAAK,YAAY,OAAO;IACtD,GAAG,EAAE,UAAU;IACf,UAAU,EAAE,KAAc;IAC1B,OAAO,EAAE,CAAC,CAAU,EAAE,OAAkC,EAAE,EAAE;QAC1D,OAAO,OAAO,CAAC,0CAA0C,CAAC,CAAC;IAC7D,CAAC;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,sBAAsB,GAAG;IAC7B,GAAG,EAAE,UAAU;IACf,OAAO,EAAE,CAAC,CAAU,EAAE,OAAkC,EAAE,EAAE;QAC1D,OAAO,OAAO,CAAC,yCAAyC,CAAC,CAAC;IAC5D,CAAC;CACF,CAAC;AAEW,QAAA,WAAW,GAAG;IACzB,UAAU;IACV,uBAAuB;IACvB,sBAAsB;CACvB,CAAC"}
package/dist/Merge.d.ts CHANGED
@@ -28,4 +28,13 @@ export declare class MergeNode extends YAMLSeq {
28
28
  tag: string;
29
29
  toJSON(_: unknown, ctx: ToJSContext): unknown[];
30
30
  }
31
+ export declare const MergeTags: ({
32
+ identify: (value: unknown) => value is MergeNode;
33
+ tag: string;
34
+ collection: "seq";
35
+ nodeClass: typeof MergeNode;
36
+ } | {
37
+ tag: string;
38
+ resolve: (_: unknown, onError: (message: string) => void) => void;
39
+ })[];
31
40
  //# sourceMappingURL=Merge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Merge.d.ts","sourceRoot":"","sources":["../src/Merge.ts"],"names":[],"mappings":"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dist/Merge.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MergeNode = exports.isResolvedMergeNode = exports.MERGE_NODE_FLAG = exports.Merge = void 0;
3
+ exports.MergeTags = exports.MergeNode = exports.isResolvedMergeNode = exports.MERGE_NODE_FLAG = exports.Merge = void 0;
4
4
  const yaml_1 = require("yaml");
5
5
  /**
6
6
  * Merge class representing a !merge tag in YAML
@@ -47,4 +47,38 @@ class MergeNode extends yaml_1.YAMLSeq {
47
47
  }
48
48
  }
49
49
  exports.MergeNode = MergeNode;
50
+ /**
51
+ * Custom tag for !merge
52
+ */
53
+ const mergeTag = {
54
+ identify: (value) => value instanceof MergeNode,
55
+ tag: "!merge",
56
+ collection: "seq",
57
+ nodeClass: MergeNode,
58
+ };
59
+ /**
60
+ * Dummy illegal flag when merge is used on a mapping.
61
+ */
62
+ const illegalMergeOnMapping = {
63
+ identify: (value) => value instanceof Merge,
64
+ tag: "!merge",
65
+ collection: "map",
66
+ resolve: (_, onError) => {
67
+ return onError("!merge tag cannot be used on a mapping");
68
+ },
69
+ };
70
+ /**
71
+ * Dummy illegal flag when merge is used on a scalar.
72
+ */
73
+ const illegalMergeOnScalar = {
74
+ tag: "!merge",
75
+ resolve: (_, onError) => {
76
+ return onError("!merge tag cannot be used on a scalar");
77
+ },
78
+ };
79
+ exports.MergeTags = [
80
+ mergeTag,
81
+ illegalMergeOnMapping,
82
+ illegalMergeOnScalar,
83
+ ];
50
84
  //# sourceMappingURL=Merge.js.map
package/dist/Merge.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Merge.js","sourceRoot":"","sources":["../src/Merge.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAG/B;;;;;GAKG;AACH,MAAa,KAAK;IAOhB;;;OAGG;IACH,YAAY,QAAmB;QAC7B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,QAAQ;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C1D,OAAO,OAAO,CAAC,uCAAuC,CAAC,CAAC;IAC1D,CAAC;CACF,CAAC;AAEW,QAAA,SAAS,GAAG;IACvB,QAAQ;IACR,qBAAqB;IACrB,oBAAoB;CACrB,CAAC"}
@@ -9,7 +9,14 @@ export declare class Reference {
9
9
  * Absolute path to the YAML file where this !reference tag was found
10
10
  * This is automatically set by the library during parsing
11
11
  */
12
- _location: string;
12
+ location: string;
13
+ /**
14
+ * Anchor to import from the referenced YAML file
15
+ * Optional, provided by the user in the YAML document
16
+ * If not provided, the entire YAML file will be imported
17
+ * If provided, only the specified anchor will be imported from the referenced file
18
+ */
19
+ anchor?: string;
13
20
  /**
14
21
  * Relative path to another YAML file
15
22
  * Required, explicitly provided by the user in the YAML document
@@ -18,9 +25,13 @@ export declare class Reference {
18
25
  /**
19
26
  * Creates a new Reference instance
20
27
  * @param path - Relative path to another YAML file
21
- * @param location - Absolute path to the file containing this reference (optional, will be set later)
28
+ * @param options.location - Absolute path to the file containing this reference (optional, will be set later)
29
+ * @param options.anchor - Anchor to import from the referenced YAML file (optional)
22
30
  */
23
- constructor(path: string, location?: string);
31
+ constructor(path: string, options?: {
32
+ location?: string;
33
+ anchor?: string;
34
+ });
24
35
  /**
25
36
  * Returns a string representation of the Reference
26
37
  */
@@ -34,4 +45,13 @@ export declare class ReferenceNode extends YAMLMap {
34
45
  tag: string;
35
46
  toJSON(_: unknown, ctx: ToJSContext): Record<string, unknown>;
36
47
  }
48
+ export declare const referenceTags: ({
49
+ identify: (value: unknown) => value is ReferenceNode;
50
+ tag: string;
51
+ collection: "map";
52
+ nodeClass: typeof ReferenceNode;
53
+ } | {
54
+ tag: string;
55
+ resolve: (_: unknown, onError: (message: string) => void) => void;
56
+ })[];
37
57
  //# sourceMappingURL=Reference.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Reference.d.ts","sourceRoot":"","sources":["../src/Reference.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CA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AAA;CAIzB,CAAC;AAEF,qBAAa,aAAc,SAAQ,OAAO;IACxC,GAAG,SAAgB;IACnB,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,WAAW;CA0BpC;AAkCD,eAAO,MAAM,aAAa;sBA5BN,OAAO;;;;;;iBAuBZ,OAAO,WAAW,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI;IASzD,CAAC"}
package/dist/Reference.js CHANGED
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.ReferenceNode = exports.isResolvedReferenceNode = exports.REFERENCE_NODE_FLAG = exports.Reference = void 0;
36
+ exports.referenceTags = exports.ReferenceNode = exports.isResolvedReferenceNode = exports.REFERENCE_NODE_FLAG = exports.Reference = void 0;
37
37
  const pathModule = __importStar(require("path"));
38
38
  const yaml_1 = require("yaml");
39
39
  /**
@@ -44,9 +44,10 @@ class Reference {
44
44
  /**
45
45
  * Creates a new Reference instance
46
46
  * @param path - Relative path to another YAML file
47
- * @param location - Absolute path to the file containing this reference (optional, will be set later)
47
+ * @param options.location - Absolute path to the file containing this reference (optional, will be set later)
48
+ * @param options.anchor - Anchor to import from the referenced YAML file (optional)
48
49
  */
49
- constructor(path, location) {
50
+ constructor(path, options) {
50
51
  // Ensure path is not empty
51
52
  if (!path || path.length === 0) {
52
53
  throw new Error("Reference path must not be empty");
@@ -56,13 +57,14 @@ class Reference {
56
57
  throw new Error(`Reference path must be relative, not absolute: "${path}"`);
57
58
  }
58
59
  this.path = path;
59
- this._location = location || "";
60
+ this.location = options?.location || "";
61
+ this.anchor = options?.anchor ?? undefined;
60
62
  }
61
63
  /**
62
64
  * Returns a string representation of the Reference
63
65
  */
64
66
  toString() {
65
- return `Reference { path: "${this.path}", _location: "${this._location}" }`;
67
+ return `Reference { path: "${this.path}", location: "${this.location}", anchor: "${this.anchor}" }`;
66
68
  }
67
69
  /**
68
70
  * Custom inspection method for Node.js console
@@ -92,9 +94,52 @@ class ReferenceNode extends yaml_1.YAMLMap {
92
94
  if (typeof pathValue !== "string") {
93
95
  throw new Error('!reference "path" property must be a string');
94
96
  }
97
+ // Coerce anchor to string if present (e.g. anchor: 1 is valid YAML
98
+ // but parsed as a number)
99
+ if ("anchor" in value && value.anchor !== undefined) {
100
+ if (typeof value.anchor === "object") {
101
+ throw new Error('!reference "anchor" property must be a scalar value');
102
+ }
103
+ const anchorVal = value.anchor;
104
+ value.anchor = String(anchorVal);
105
+ }
95
106
  Object.assign(value, { [exports.REFERENCE_NODE_FLAG]: true });
96
107
  return value;
97
108
  }
98
109
  }
99
110
  exports.ReferenceNode = ReferenceNode;
111
+ /**
112
+ * Custom tag for !reference
113
+ */
114
+ const referenceTag = {
115
+ identify: (value) => value instanceof ReferenceNode,
116
+ tag: "!reference",
117
+ collection: "map",
118
+ nodeClass: ReferenceNode,
119
+ };
120
+ /**
121
+ * Dummy illegal flag when !reference is used on a sequence.
122
+ */
123
+ const illegalReferenceOnSequence = {
124
+ identify: (value) => value instanceof ReferenceNode,
125
+ tag: "!reference",
126
+ collection: "seq",
127
+ resolve: (_, onError) => {
128
+ return onError("!reference tag cannot be used on a sequence");
129
+ },
130
+ };
131
+ /**
132
+ * Dummy illegal flag when !reference is used on a scalar.
133
+ */
134
+ const illegalReferenceOnScalar = {
135
+ tag: "!reference",
136
+ resolve: (_, onError) => {
137
+ return onError("!reference tag cannot be used on a scalar");
138
+ },
139
+ };
140
+ exports.referenceTags = [
141
+ referenceTag,
142
+ illegalReferenceOnSequence,
143
+ illegalReferenceOnScalar,
144
+ ];
100
145
  //# sourceMappingURL=Reference.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Reference.js","sourceRoot":"","sources":["../src/Reference.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AACnC,+BAA+B;AAG/B;;;GAGG;AACH,MAAa,SAAS;IAapB;;;;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AG,KAAK,CAAC,MAAmC,CAAC;YAC5D,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;QACnC,CAAC;QAED,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,2BAAmB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AA5BD,sCA4BC;AAED;;GAEG;AACH,MAAM,YAAY,GAAG;IACnB,QAAQ,EAAE,CAAC,KAAc,EAAE,EAAE,CAAC,KAAK,YAAY,aAAa;IAC5D,GAAG,EAAE,YAAY;IACjB,UAAU,EAAE,KAAc;IAC1B,SAAS,EAAE,aAAa;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,0BAA0B,GAAG;IACjC,QAAQ,EAAE,CAAC,KAAc,EAAE,EAAE,CAAC,KAAK,YAAY,aAAa;IAC5D,GAAG,EAAE,YAAY;IACjB,UAAU,EAAE,KAAc;IAC1B,OAAO,EAAE,CAAC,CAAU,EAAE,OAAkC,EAAE,EAAE;QAC1D,OAAO,OAAO,CAAC,6CAA6C,CAAC,CAAC;IAChE,CAAC;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,wBAAwB,GAAG;IAC/B,GAAG,EAAE,YAAY;IACjB,OAAO,EAAE,CAAC,CAAU,EAAE,OAAkC,EAAE,EAAE;QAC1D,OAAO,OAAO,CAAC,2CAA2C,CAAC,CAAC;IAC9D,CAAC;CACF,CAAC;AAEW,QAAA,aAAa,GAAG;IAC3B,YAAY;IACZ,0BAA0B;IAC1B,wBAAwB;CACzB,CAAC"}
@@ -9,7 +9,14 @@ export declare class ReferenceAll {
9
9
  * Absolute path to the YAML file where this !reference-all tag was found
10
10
  * This is automatically set by the library during parsing
11
11
  */
12
- _location: string;
12
+ location: string;
13
+ /**
14
+ * Anchor to import from the referenced YAML file
15
+ * Optional, provided by the user in the YAML document
16
+ * If not provided, the entire YAML file will be imported
17
+ * If provided, only the specified anchor will be imported from the referenced file
18
+ */
19
+ anchor?: string;
13
20
  /**
14
21
  * Glob pattern to match YAML files
15
22
  * Required, explicitly provided by the user in the YAML document
@@ -18,9 +25,13 @@ export declare class ReferenceAll {
18
25
  /**
19
26
  * Creates a new ReferenceAll instance
20
27
  * @param glob - Glob pattern to match YAML files
21
- * @param location - Absolute path to the file containing this reference (optional, will be set later)
28
+ * @param options.location - Absolute path to the file containing this reference (optional, will be set later)
29
+ * @param options.anchor - Anchor to import from the referenced YAML file (optional)
22
30
  */
23
- constructor(glob: string, location?: string);
31
+ constructor(glob: string, options?: {
32
+ location?: string;
33
+ anchor?: string;
34
+ });
24
35
  /**
25
36
  * Returns a string representation of the ReferenceAll
26
37
  */
@@ -34,4 +45,13 @@ export declare class ReferenceAllNode extends YAMLMap {
34
45
  tag: string;
35
46
  toJSON(_: unknown, ctx: ToJSContext): Record<string, unknown>;
36
47
  }
48
+ export declare const ReferenceAllTags: ({
49
+ identify: (value: unknown) => value is ReferenceAllNode;
50
+ tag: string;
51
+ collection: "map";
52
+ nodeClass: typeof ReferenceAllNode;
53
+ } | {
54
+ tag: string;
55
+ resolve: (_: unknown, onError: (message: string) => void) => void;
56
+ })[];
37
57
  //# sourceMappingURL=ReferenceAll.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReferenceAll.d.ts","sourceRoot":"","sources":["../src/ReferenceAll.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;GAGG;AACH,qBAAa,YAAY;IACvB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;OAIG;gBACS,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAiB3C;;OAEG;IACH,QAAQ,IAAI,MAAM;CAUnB;AAED,eAAO,MAAM,uBAAuB,eAA2B,CAAC;AAEhE,eAAO,MAAM,0BAA0B,GACrC,OAAO,OAAO,KACb,KAAK,IAAI;IAAE,IAAI,EAAE,MAAM,CAAA;CAMzB,CAAC;AAEF,qBAAa,gBAAiB,SAAQ,OAAO;IAC3C,GAAG,SAAoB;IACvB,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,WAAW;CAgBpC"}
1
+ {"version":3,"file":"ReferenceAll.d.ts","sourceRoot":"","sources":["../src/ReferenceAll.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;GAGG;AACH,qBAAa,YAAY;IACvB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;OAKG;gBACS,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;IAkB1E;;OAEG;IACH,QAAQ,IAAI,MAAM;CAUnB;AAED,eAAO,MAAM,uBAAuB,eAA2B,CAAC;AAEhE,eAAO,MAAM,0BAA0B,GACrC,OAAO,OAAO,KACb,KAAK,IAAI;IAAE,IAAI,EAAE,MAAM,CAAA;CAMzB,CAAC;AAEF,qBAAa,gBAAiB,SAAQ,OAAO;IAC3C,GAAG,SAAoB;IACvB,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,WAAW;CA4BpC;AAkCD,eAAO,MAAM,gBAAgB;sBA5BT,OAAO;;;;;;iBAuBZ,OAAO,WAAW,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI;IASzD,CAAC"}
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.ReferenceAllNode = exports.isResolvedReferenceAllNode = exports.REFERENCE_ALL_NODE_FLAG = exports.ReferenceAll = void 0;
36
+ exports.ReferenceAllTags = exports.ReferenceAllNode = exports.isResolvedReferenceAllNode = exports.REFERENCE_ALL_NODE_FLAG = exports.ReferenceAll = void 0;
37
37
  const pathModule = __importStar(require("path"));
38
38
  const yaml_1 = require("yaml");
39
39
  /**
@@ -44,9 +44,10 @@ class ReferenceAll {
44
44
  /**
45
45
  * Creates a new ReferenceAll instance
46
46
  * @param glob - Glob pattern to match YAML files
47
- * @param location - Absolute path to the file containing this reference (optional, will be set later)
47
+ * @param options.location - Absolute path to the file containing this reference (optional, will be set later)
48
+ * @param options.anchor - Anchor to import from the referenced YAML file (optional)
48
49
  */
49
- constructor(glob, location) {
50
+ constructor(glob, options) {
50
51
  // Ensure glob is not empty
51
52
  if (!glob || glob.length === 0) {
52
53
  throw new Error("ReferenceAll glob must not be empty");
@@ -56,13 +57,14 @@ class ReferenceAll {
56
57
  throw new Error(`ReferenceAll glob must be relative, not absolute: "${glob}"`);
57
58
  }
58
59
  this.glob = glob;
59
- this._location = location || "";
60
+ this.location = options?.location || "";
61
+ this.anchor = options?.anchor ?? undefined;
60
62
  }
61
63
  /**
62
64
  * Returns a string representation of the ReferenceAll
63
65
  */
64
66
  toString() {
65
- return `ReferenceAll { glob: "${this.glob}", _location: "${this._location}" }`;
67
+ return `ReferenceAll { glob: "${this.glob}", location: "${this.location}", anchor: "${this.anchor}" }`;
66
68
  }
67
69
  /**
68
70
  * Custom inspection method for Node.js console
@@ -94,9 +96,52 @@ class ReferenceAllNode extends yaml_1.YAMLMap {
94
96
  if (typeof globValue !== "string") {
95
97
  throw new Error('!reference-all "glob" property must be a string');
96
98
  }
99
+ // Coerce anchor to string if present (e.g. anchor: 1 is valid YAML
100
+ // but parsed as a number)
101
+ if ("anchor" in value && value.anchor !== undefined) {
102
+ if (typeof value.anchor === "object") {
103
+ throw new Error('!reference-all "anchor" property must be a scalar value');
104
+ }
105
+ const anchorVal = value.anchor;
106
+ value.anchor = String(anchorVal);
107
+ }
97
108
  Object.assign(value, { [exports.REFERENCE_ALL_NODE_FLAG]: true });
98
109
  return value;
99
110
  }
100
111
  }
101
112
  exports.ReferenceAllNode = ReferenceAllNode;
113
+ /**
114
+ * Custom tag for !reference
115
+ */
116
+ const referenceAllTag = {
117
+ identify: (value) => value instanceof ReferenceAllNode,
118
+ tag: "!reference-all",
119
+ collection: "map",
120
+ nodeClass: ReferenceAllNode,
121
+ };
122
+ /**
123
+ * Dummy illegal flag when !reference-all is used on a sequence.
124
+ */
125
+ const illegalReferenceAllOnSequence = {
126
+ identify: (value) => value instanceof ReferenceAllNode,
127
+ tag: "!reference-all",
128
+ collection: "seq",
129
+ resolve: (_, onError) => {
130
+ return onError("!reference-all tag cannot be used on a sequence");
131
+ },
132
+ };
133
+ /**
134
+ * Dummy illegal flag when !reference-all is used on a scalar.
135
+ */
136
+ const illegalReferenceAllOnScalar = {
137
+ tag: "!reference-all",
138
+ resolve: (_, onError) => {
139
+ return onError("!reference-all tag cannot be used on a scalar");
140
+ },
141
+ };
142
+ exports.ReferenceAllTags = [
143
+ referenceAllTag,
144
+ illegalReferenceAllOnSequence,
145
+ illegalReferenceAllOnScalar,
146
+ ];
102
147
  //# sourceMappingURL=ReferenceAll.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReferenceAll.js","sourceRoot":"","sources":["../src/ReferenceAll.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AACnC,+BAA+B;AAG/B;;;GAGG;AACH,MAAa,YAAY;IAavB;;;;OAIG;IACH,YAAY,IAAY,EAAE,QAAiB;QACzC,2BAA2B;QAC3B,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,qCAA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E,EAAE,CAAC,+BAAuB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1D,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AA9BD,4CA8BC;AAED;;GAEG;AACH,MAAM,eAAe,GAAG;IACtB,QAAQ,EAAE,CAAC,KAAc,EAAE,EAAE,CAAC,KAAK,YAAY,gBAAgB;IAC/D,GAAG,EAAE,gBAAgB;IACrB,UAAU,EAAE,KAAc;IAC1B,SAAS,EAAE,gBAAgB;CAC5B,CAAC;AAEF;;GAEG;AACH,MAAM,6BAA6B,GAAG;IACpC,QAAQ,EAAE,CAAC,KAAc,EAAE,EAAE,CAAC,KAAK,YAAY,gBAAgB;IAC/D,GAAG,EAAE,gBAAgB;IACrB,UAAU,EAAE,KAAc;IAC1B,OAAO,EAAE,CAAC,CAAU,EAAE,OAAkC,EAAE,EAAE;QAC1D,OAAO,OAAO,CAAC,iDAAiD,CAAC,CAAC;IACpE,CAAC;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,2BAA2B,GAAG;IAClC,GAAG,EAAE,gBAAgB;IACrB,OAAO,EAAE,CAAC,CAAU,EAAE,OAAkC,EAAE,EAAE;QAC1D,OAAO,OAAO,CAAC,+CAA+C,CAAC,CAAC;IAClE,CAAC;CACF,CAAC;AAEW,QAAA,gBAAgB,GAAG;IAC9B,eAAe;IACf,6BAA6B;IAC7B,2BAA2B;CAC5B,CAAC"}
package/dist/parser.d.ts CHANGED
@@ -2,16 +2,25 @@
2
2
  * Parser module for handling YAML with custom !reference and !reference-all tags
3
3
  * Uses the eemeli/yaml package to parse YAML with custom tags
4
4
  */
5
+ export interface ParseOptions {
6
+ extractAnchor?: string;
7
+ }
5
8
  /**
6
9
  * Parse YAML content with custom !reference and !reference-all tags
7
- * @param filePath - Path to the YAML file to be parsed (used for setting _location)
10
+ * @param filePath - Path to the YAML file to be parsed (used for setting
11
+ * location)
12
+ * @param options - Optional parsing options (e.g. extractAnchor to specify an
13
+ * anchor to extract as root)
8
14
  * @returns Parsed object with Reference and ReferenceAll instances
9
15
  */
10
- export declare function parseYamlWithReferencesSync(filePath: string): unknown;
16
+ export declare function parseYamlWithReferencesSync(filePath: string, options?: ParseOptions): unknown;
11
17
  /**
12
18
  * Parse YAML content with custom !reference and !reference-all tags (async).
13
- * @param filePath - Path to the YAML file to be parsed (used for setting _location)
19
+ * @param filePath - Path to the YAML file to be parsed (used for setting
20
+ * location)
21
+ * @param options - Optional parsing options (e.g. extractAnchor to specify an
22
+ * anchor to extract as root)
14
23
  * @returns Parsed object with Reference and ReferenceAll instances
15
24
  */
16
- export declare function parseYamlWithReferences(filePath: string): Promise<unknown>;
25
+ export declare function parseYamlWithReferences(filePath: string, options?: ParseOptions): Promise<unknown>;
17
26
  //# sourceMappingURL=parser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAyFH;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAkBrE;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC,CAkBlB"}
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAuBH,MAAM,WAAW,YAAY;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAuDD;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAaT;AAED;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,OAAO,CAAC,CAalB"}
package/dist/parser.js CHANGED
@@ -47,88 +47,67 @@ const Merge_1 = require("./Merge");
47
47
  const path = __importStar(require("path"));
48
48
  const fs = __importStar(require("fs/promises"));
49
49
  const fsSync = __importStar(require("fs"));
50
- /**
51
- * Custom tag for !reference
52
- */
53
- const referenceTag = {
54
- identify: (value) => value instanceof Reference_1.ReferenceNode,
55
- tag: "!reference",
56
- collection: "map",
57
- nodeClass: Reference_1.ReferenceNode,
58
- };
59
- /**
60
- * Custom tag for !reference-all
61
- */
62
- const referenceAllTag = {
63
- identify: (value) => value instanceof ReferenceAll_1.ReferenceAllNode,
64
- tag: "!reference-all",
65
- collection: "map",
66
- nodeClass: ReferenceAll_1.ReferenceAllNode,
67
- };
68
- /**
69
- * Custom tag for !merge
70
- */
71
- const mergeTag = {
72
- identify: (value) => value instanceof Merge_1.MergeNode,
73
- tag: "!merge",
74
- collection: "seq",
75
- nodeClass: Merge_1.MergeNode,
76
- };
77
- /**
78
- * Dummy illegal flag when merge is used on a mapping.
79
- */
80
- const illegalMergeOnMapping = {
81
- identify: (value) => value instanceof Merge_1.Merge,
82
- tag: "!merge",
83
- collection: "map",
84
- resolve: (_, onError) => {
85
- return onError("!merge tag cannot be used on a mapping");
86
- },
87
- };
88
- /**
89
- * Custom tag for !flatten
90
- */
91
- const flattenTag = {
92
- identify: (value) => value instanceof Flatten_1.FlattenNode,
93
- tag: "!flatten",
94
- collection: "seq",
95
- nodeClass: Flatten_1.FlattenNode,
96
- };
97
- /**
98
- * Dummy illegal flag when flatten is used on a mapping.
99
- */
100
- const illegalFlattenOnMapping = {
101
- identify: (value) => value instanceof Flatten_1.Flatten,
102
- tag: "!flatten",
103
- collection: "map",
104
- resolve: (_, onError) => {
105
- return onError("!flatten tag cannot be used on a mapping");
106
- },
107
- };
108
50
  // Custom tags array for parsing
109
51
  const customTags = [
110
- referenceTag,
111
- referenceAllTag,
112
- flattenTag,
113
- illegalFlattenOnMapping,
114
- mergeTag,
115
- illegalMergeOnMapping,
52
+ ...Reference_1.referenceTags,
53
+ ...ReferenceAll_1.ReferenceAllTags,
54
+ ...Flatten_1.FlattenTags,
55
+ ...Merge_1.MergeTags,
116
56
  ];
57
+ function extractAnchorFromDocument(doc, anchor) {
58
+ const anchors = new Map();
59
+ (0, yaml_1.visit)(doc, {
60
+ // record all anchors in the map
61
+ Node(_, node) {
62
+ if (node.anchor) {
63
+ anchors.set(node.anchor, node);
64
+ }
65
+ },
66
+ // Replace all aliases with their corresponding anchor(s)
67
+ // Note: YAML forbids forward-referencing aliases, so we can be sure that
68
+ // the anchor will have been visited before any alias that references it
69
+ Alias(_, node) {
70
+ if (!anchors.has(node.source)) {
71
+ throw new Error(`Anchor "${node.source}" not found in the YAML document`);
72
+ }
73
+ // Note: this node will get re-visited by the main visitor, so we don't
74
+ // need to recursively resolve nested aliases here
75
+ return anchors.get(node.source);
76
+ },
77
+ });
78
+ if (!anchors.has(anchor)) {
79
+ throw new Error(`Anchor "${anchor}" not found in the YAML document`);
80
+ }
81
+ return anchors.get(anchor);
82
+ }
83
+ function parseYamlWithReferencesFromString(content, filePath, options) {
84
+ const doc = (0, yaml_1.parseDocument)(content, { customTags });
85
+ if (doc.errors.length > 0) {
86
+ throw doc.errors[0];
87
+ }
88
+ if (!doc.contents) {
89
+ return null;
90
+ }
91
+ let root = doc.contents;
92
+ if (options?.extractAnchor !== undefined) {
93
+ root = extractAnchorFromDocument(doc, options.extractAnchor);
94
+ }
95
+ const parsed = root.toJS(doc);
96
+ return processParsedDocument(parsed, filePath);
97
+ }
117
98
  /**
118
99
  * Parse YAML content with custom !reference and !reference-all tags
119
- * @param filePath - Path to the YAML file to be parsed (used for setting _location)
100
+ * @param filePath - Path to the YAML file to be parsed (used for setting
101
+ * location)
102
+ * @param options - Optional parsing options (e.g. extractAnchor to specify an
103
+ * anchor to extract as root)
120
104
  * @returns Parsed object with Reference and ReferenceAll instances
121
105
  */
122
- function parseYamlWithReferencesSync(filePath) {
106
+ function parseYamlWithReferencesSync(filePath, options) {
123
107
  try {
124
108
  const absolutePath = path.resolve(filePath);
125
109
  const content = fsSync.readFileSync(absolutePath, "utf8");
126
- const doc = (0, yaml_1.parseDocument)(content, { customTags });
127
- if (doc.errors.length > 0) {
128
- throw doc.errors[0];
129
- }
130
- const parsed = doc.toJS();
131
- return processParsedDocument(parsed, filePath);
110
+ return parseYamlWithReferencesFromString(content, absolutePath, options);
132
111
  }
133
112
  catch (error) {
134
113
  // Re-throw the error with context about which file failed to parse
@@ -137,19 +116,17 @@ function parseYamlWithReferencesSync(filePath) {
137
116
  }
138
117
  /**
139
118
  * Parse YAML content with custom !reference and !reference-all tags (async).
140
- * @param filePath - Path to the YAML file to be parsed (used for setting _location)
119
+ * @param filePath - Path to the YAML file to be parsed (used for setting
120
+ * location)
121
+ * @param options - Optional parsing options (e.g. extractAnchor to specify an
122
+ * anchor to extract as root)
141
123
  * @returns Parsed object with Reference and ReferenceAll instances
142
124
  */
143
- async function parseYamlWithReferences(filePath) {
125
+ async function parseYamlWithReferences(filePath, options) {
144
126
  try {
145
127
  const absolutePath = path.resolve(filePath);
146
128
  const content = await fs.readFile(absolutePath, "utf8");
147
- const doc = (0, yaml_1.parseDocument)(content, { customTags });
148
- if (doc.errors.length > 0) {
149
- throw doc.errors[0];
150
- }
151
- const parsed = doc.toJS();
152
- return processParsedDocument(parsed, filePath);
129
+ return parseYamlWithReferencesFromString(content, absolutePath, options);
153
130
  }
154
131
  catch (error) {
155
132
  // Re-throw the error with context about which file failed to parse
@@ -168,17 +145,29 @@ async function parseYamlWithReferences(filePath) {
168
145
  * custom nodes) so that they are present on the final JS objects we get here.
169
146
  *
170
147
  * @param obj - The parsed YAML document (or sub-object) to process
171
- * @param filePath - The file path to set as _location on Reference and
148
+ * @param filePath - The file path to set as location on Reference and
172
149
  * ReferenceAll instances
173
150
  * @returns The processed object with Reference, ReferenceAll, Flatten, and
174
151
  * Merge instances
175
152
  */
176
153
  function processParsedDocument(obj, filePath) {
177
154
  if ((0, Reference_1.isResolvedReferenceNode)(obj)) {
178
- return new Reference_1.Reference(obj.path, filePath);
155
+ const anchor = "anchor" in obj && typeof obj.anchor === "string"
156
+ ? obj.anchor
157
+ : undefined;
158
+ return new Reference_1.Reference(obj.path, {
159
+ location: filePath,
160
+ anchor,
161
+ });
179
162
  }
180
163
  if ((0, ReferenceAll_1.isResolvedReferenceAllNode)(obj)) {
181
- return new ReferenceAll_1.ReferenceAll(obj.glob, filePath);
164
+ const anchor = "anchor" in obj && typeof obj.anchor === "string"
165
+ ? obj.anchor
166
+ : undefined;
167
+ return new ReferenceAll_1.ReferenceAll(obj.glob, {
168
+ location: filePath,
169
+ anchor,
170
+ });
182
171
  }
183
172
  if ((0, Flatten_1.isResolvedFlattenNode)(obj)) {
184
173
  const processed = obj.map((item) => processParsedDocument(item, filePath));
@@ -1 +1 @@
1
- {"version":3,"file":"parser.js","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8FH,kEAkBC;AAOD,0DAoBC;AAzID,+BAA2C;AAC3C,2CAAgF;AAChF,iDAIwB;AACxB,uCAAwE;AACxE,mCAAgE;AAChE,2CAA6B;AAC7B,gDAAkC;AAClC,2CAA6B;AAE7B;;GAEG;AACH,MAAM,YAAY,GAAG;IACnB,QAAQ,EAAE,CAAC,KAAc,EAAE,EAAE,CAAC,KAAK,YAAY,yBAAa;IAC5D,GAAG,EAAE,YAAY;IACjB,UAAU,EAAE,KAAc;IAC1B,SAAS,EAAE,yBAAa;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,eAAe,GAAG;IACtB,QAAQ,EAAE,CAAC,KAAc,EAAE,EAAE,CAAC,KAAK,YAAY,+BAAgB;IAC/D,GAAG,EAAE,gBAAgB;IACrB,UAAU,EAAE,KAAc;IAC1B,SAAS,EAAE,+BAAgB;CAC5B,CAAC;AAEF;;GAEG;AACH,MAAM,QAAQ,GAAG;IACf,QAAQ,EAAE,CAAC,KAAc,EAAE,EAAE,CAAC,KAAK,YAAY,iBAAS;IACxD,GAAG,EAAE,QAAQ;IACb,U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AAC;YAC/C,MAAM,CAAC,GAAG,CAAC,GAAG,qBAAqB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACvD,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
package/dist/resolver.js CHANGED
@@ -298,17 +298,17 @@ function _recursivelyResolveReferencesSync(obj, visitedPaths = new Set(), allowP
298
298
  * @throws Error if circular reference is detected, or if a reference cannot be resolved
299
299
  */
300
300
  async function resolveReference(ref, visitedPaths, allowPaths) {
301
- if (!ref._location) {
302
- throw new Error(`Reference missing _location: ${ref.toString()}`);
301
+ if (!ref.location) {
302
+ throw new Error(`Reference missing location: ${ref.toString()}`);
303
303
  }
304
- const refDir = path.dirname(ref._location);
304
+ const refDir = path.dirname(ref.location);
305
305
  const targetPath = path.resolve(refDir, ref.path);
306
306
  let realTargetPath;
307
307
  try {
308
308
  realTargetPath = await fs.realpath(targetPath);
309
309
  }
310
310
  catch {
311
- throw new Error(`Referenced file not found: ${targetPath} (from ${ref._location})`);
311
+ throw new Error(`Referenced file not found: ${targetPath} (from ${ref.location})`);
312
312
  }
313
313
  // Check if path is allowed
314
314
  if (allowPaths && allowPaths.length > 0) {
@@ -324,7 +324,9 @@ async function resolveReference(ref, visitedPaths, allowPaths) {
324
324
  throw new Error(`Circular reference detected: ${realTargetPath} (visited: ${Array.from(visitedPaths).join(" -> ")})`);
325
325
  }
326
326
  visitedPaths.add(realTargetPath);
327
- const parsed = await (0, parser_1.parseYamlWithReferences)(realTargetPath);
327
+ const parsed = await (0, parser_1.parseYamlWithReferences)(realTargetPath, {
328
+ extractAnchor: ref.anchor,
329
+ });
328
330
  const resolved = await _recursivelyResolveReferences(parsed, visitedPaths, allowPaths);
329
331
  visitedPaths.delete(realTargetPath);
330
332
  return resolved;
@@ -338,17 +340,17 @@ async function resolveReference(ref, visitedPaths, allowPaths) {
338
340
  * @throws Error if circular reference is detected, or if a reference cannot be resolved
339
341
  */
340
342
  function resolveReferenceSync(ref, visitedPaths, allowPaths) {
341
- if (!ref._location) {
342
- throw new Error(`Reference missing _location: ${ref.toString()}`);
343
+ if (!ref.location) {
344
+ throw new Error(`Reference missing location: ${ref.toString()}`);
343
345
  }
344
- const refDir = path.dirname(ref._location);
346
+ const refDir = path.dirname(ref.location);
345
347
  const targetPath = path.resolve(refDir, ref.path);
346
348
  let realTargetPath;
347
349
  try {
348
350
  realTargetPath = fsSync.realpathSync(targetPath);
349
351
  }
350
352
  catch {
351
- throw new Error(`Referenced file not found: ${targetPath} (from ${ref._location})`);
353
+ throw new Error(`Referenced file not found: ${targetPath} (from ${ref.location})`);
352
354
  }
353
355
  // Check if path is allowed
354
356
  if (allowPaths && allowPaths.length > 0) {
@@ -364,7 +366,9 @@ function resolveReferenceSync(ref, visitedPaths, allowPaths) {
364
366
  throw new Error(`Circular reference detected: ${realTargetPath} (visited: ${Array.from(visitedPaths).join(" -> ")})`);
365
367
  }
366
368
  visitedPaths.add(realTargetPath);
367
- const parsed = (0, parser_1.parseYamlWithReferencesSync)(realTargetPath);
369
+ const parsed = (0, parser_1.parseYamlWithReferencesSync)(realTargetPath, {
370
+ extractAnchor: ref.anchor,
371
+ });
368
372
  const resolved = _recursivelyResolveReferencesSync(parsed, visitedPaths, allowPaths);
369
373
  visitedPaths.delete(realTargetPath);
370
374
  return resolved;
@@ -375,13 +379,13 @@ function resolveReferenceSync(ref, visitedPaths, allowPaths) {
375
379
  * @param visitedPaths Set of visited paths to detect circular references
376
380
  * @param allowPaths Optional list of allowed paths for references
377
381
  * @returns Resolved array of objects. Will not contain any references.
378
- * @throws Error if the ReferenceAll object is missing _location or if the glob pattern is invalid.
382
+ * @throws Error if the ReferenceAll object is missing location or if the glob pattern is invalid.
379
383
  */
380
384
  async function resolveReferenceAll(refAll, visitedPaths, allowPaths) {
381
- if (!refAll._location) {
382
- throw new Error(`ReferenceAll missing _location: ${refAll.toString()}`);
385
+ if (!refAll.location) {
386
+ throw new Error(`ReferenceAll missing location: ${refAll.toString()}`);
383
387
  }
384
- const refDir = path.dirname(refAll._location);
388
+ const refDir = path.dirname(refAll.location);
385
389
  const globPattern = path.resolve(refDir, refAll.glob);
386
390
  // Find files matching the glob pattern
387
391
  let matchingFiles;
@@ -389,7 +393,7 @@ async function resolveReferenceAll(refAll, visitedPaths, allowPaths) {
389
393
  matchingFiles = await (0, glob_1.glob)(globPattern, { absolute: true });
390
394
  }
391
395
  catch {
392
- throw new Error(`Invalid glob pattern: ${globPattern} (from ${refAll._location})`);
396
+ throw new Error(`Invalid glob pattern: ${globPattern} (from ${refAll.location})`);
393
397
  }
394
398
  // Filter to only include YAML files
395
399
  matchingFiles = matchingFiles.filter((file) => file.endsWith(".yaml") || file.endsWith(".yml"));
@@ -410,7 +414,7 @@ async function resolveReferenceAll(refAll, visitedPaths, allowPaths) {
410
414
  });
411
415
  }
412
416
  if (filteredFiles.length === 0) {
413
- throw new Error(`No YAML files found matching glob pattern: ${globPattern} (from ${refAll._location})`);
417
+ return [];
414
418
  }
415
419
  // Sort files alphabetically for consistent ordering
416
420
  filteredFiles.sort();
@@ -422,7 +426,9 @@ async function resolveReferenceAll(refAll, visitedPaths, allowPaths) {
422
426
  }
423
427
  visitedPaths.add(filePath);
424
428
  try {
425
- const parsed = await (0, parser_1.parseYamlWithReferences)(filePath);
429
+ const parsed = await (0, parser_1.parseYamlWithReferences)(filePath, {
430
+ extractAnchor: refAll.anchor,
431
+ });
426
432
  const resolved = await _recursivelyResolveReferences(parsed, visitedPaths, allowPaths);
427
433
  resolvedContents.push(resolved);
428
434
  }
@@ -440,13 +446,13 @@ async function resolveReferenceAll(refAll, visitedPaths, allowPaths) {
440
446
  * @param visitedPaths Set of visited paths to detect circular references
441
447
  * @param allowPaths Optional list of allowed paths for references
442
448
  * @returns Resolved array of objects. Will not contain any references.
443
- * @throws Error if the ReferenceAll object is missing _location or if the glob pattern is invalid.
449
+ * @throws Error if the ReferenceAll object is missing location or if the glob pattern is invalid.
444
450
  */
445
451
  function resolveReferenceAllSync(refAll, visitedPaths, allowPaths) {
446
- if (!refAll._location) {
447
- throw new Error(`ReferenceAll missing _location: ${refAll.toString()}`);
452
+ if (!refAll.location) {
453
+ throw new Error(`ReferenceAll missing location: ${refAll.toString()}`);
448
454
  }
449
- const refDir = path.dirname(refAll._location);
455
+ const refDir = path.dirname(refAll.location);
450
456
  const globPattern = path.resolve(refDir, refAll.glob);
451
457
  // Find files matching the glob pattern
452
458
  let matchingFiles;
@@ -454,7 +460,7 @@ function resolveReferenceAllSync(refAll, visitedPaths, allowPaths) {
454
460
  matchingFiles = (0, glob_1.globSync)(globPattern, { absolute: true });
455
461
  }
456
462
  catch {
457
- throw new Error(`Invalid glob pattern: ${globPattern} (from ${refAll._location})`);
463
+ throw new Error(`Invalid glob pattern: ${globPattern} (from ${refAll.location})`);
458
464
  }
459
465
  // Filter to only include YAML files
460
466
  matchingFiles = matchingFiles.filter((file) => file.endsWith(".yaml") || file.endsWith(".yml"));
@@ -477,7 +483,7 @@ function resolveReferenceAllSync(refAll, visitedPaths, allowPaths) {
477
483
  });
478
484
  }
479
485
  if (filteredFiles.length === 0) {
480
- throw new Error(`No YAML files found matching glob pattern: ${globPattern} (from ${refAll._location})`);
486
+ return [];
481
487
  }
482
488
  // Sort files alphabetically for consistent ordering
483
489
  filteredFiles.sort();
@@ -489,7 +495,9 @@ function resolveReferenceAllSync(refAll, visitedPaths, allowPaths) {
489
495
  }
490
496
  visitedPaths.add(filePath);
491
497
  try {
492
- const parsed = (0, parser_1.parseYamlWithReferencesSync)(filePath);
498
+ const parsed = (0, parser_1.parseYamlWithReferencesSync)(filePath, {
499
+ extractAnchor: refAll.anchor,
500
+ });
493
501
  const resolved = _recursivelyResolveReferencesSync(parsed, visitedPaths, allowPaths);
494
502
  resolvedContents.push(resolved);
495
503
  }
@@ -1 +1 @@
1
- {"version":3,"file":"resolver.js","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;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;QAED,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAE3B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAA,oCAA2B,EAAC,QAAQ,EAAE;gBACnD,aAAa,EAAE,MAAM,CAAC,MAAM;aAC7B,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAG,iCAAiC,CAChD,MAAM,EACN,YAAY,EACZ,UAAU,CACX,CAAC;YACF,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC9B,MAAM,KAAK,CAAC;QACd,CAAC;QAED,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsillman2000/yaml-reference-ts",
3
- "version": "1.3.5",
3
+ "version": "1.4.1",
4
4
  "description": "A Node.js TypeScript library for resolving YAML documents containing !reference and !reference-all tags",
5
5
  "repository": {
6
6
  "type": "git",