@speclynx/apidom-parser-adapter-overlay-yaml-1 6.1.0 → 6.1.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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [6.1.1](https://github.com/speclynx/apidom/compare/v6.1.0...v6.1.1) (2026-10-29)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- serialize empty YAML mapping keys to the empty string ([#709](https://github.com/speclynx/apidom/issues/709)) ([3ecce30](https://github.com/speclynx/apidom/commit/3ecce3025b89e5bcdb1481525fe35a86685285f9)), closes [#655](https://github.com/speclynx/apidom/issues/655) [#694](https://github.com/speclynx/apidom/issues/694)
|
|
11
|
+
|
|
6
12
|
# [6.1.0](https://github.com/speclynx/apidom/compare/v6.0.6...v6.1.0) (2026-10-17)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @speclynx/apidom-parser-adapter-overlay-yaml-1
|
|
@@ -29797,11 +29797,8 @@ const resolveSpecification = specification => {
|
|
|
29797
29797
|
__webpack_require__.r(__webpack_exports__);
|
|
29798
29798
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5162);
|
|
29799
29799
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6911);
|
|
29800
|
-
/* harmony import */ var
|
|
29801
|
-
/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(977);
|
|
29800
|
+
/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(977);
|
|
29802
29801
|
|
|
29803
|
-
// an empty YAML node (YAML 1.2 §7.2) is a null parsed as an empty string with the yaml-e-node class
|
|
29804
|
-
const isEmptyNode = element => (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isStringElement)(element) && element.toValue() === '' && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.includesClasses)(element, ['yaml-e-node']);
|
|
29805
29802
|
|
|
29806
29803
|
/**
|
|
29807
29804
|
* Transforms the ApiDOM into JavaScript POJO.
|
|
@@ -29811,7 +29808,6 @@ const isEmptyNode = element => (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_M
|
|
|
29811
29808
|
*/
|
|
29812
29809
|
const serializer = element => {
|
|
29813
29810
|
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isElement)(element)) return element;
|
|
29814
|
-
if (isEmptyNode(element)) return null;
|
|
29815
29811
|
|
|
29816
29812
|
// Shortcut optimization for primitive element types
|
|
29817
29813
|
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isStringElement)(element) || (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isNumberElement)(element) || (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isBooleanElement)(element) || (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isNullElement)(element)) {
|
|
@@ -29829,8 +29825,8 @@ const serializer = element => {
|
|
|
29829
29825
|
node.forEach((value, key) => {
|
|
29830
29826
|
const k = serialize(key);
|
|
29831
29827
|
const v = serialize(value);
|
|
29832
|
-
const name = (0,
|
|
29833
|
-
if (name !== undefined) (0,
|
|
29828
|
+
const name = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_2__.toPropertyName)(k);
|
|
29829
|
+
if (name !== undefined) (0,_util_mjs__WEBPACK_IMPORTED_MODULE_2__["default"])(obj, name, v);
|
|
29834
29830
|
});
|
|
29835
29831
|
return obj;
|
|
29836
29832
|
}
|
|
@@ -29845,7 +29841,6 @@ const serializer = element => {
|
|
|
29845
29841
|
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isLinkElement)(node)) {
|
|
29846
29842
|
return (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isStringElement)(node.href) ? node.href.toValue() : '';
|
|
29847
29843
|
}
|
|
29848
|
-
if (isEmptyNode(node)) return null;
|
|
29849
29844
|
return node.toValue();
|
|
29850
29845
|
};
|
|
29851
29846
|
return serialize(element);
|
|
@@ -31873,11 +31868,10 @@ class CollectionElement extends _Element_mjs__WEBPACK_IMPORTED_MODULE_0__["defau
|
|
|
31873
31868
|
|
|
31874
31869
|
"use strict";
|
|
31875
31870
|
__webpack_require__.r(__webpack_exports__);
|
|
31876
|
-
/* empty/unused harmony star reexport */
|
|
31877
31871
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3654);
|
|
31878
31872
|
/* harmony import */ var _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1844);
|
|
31879
|
-
/* harmony import */ var
|
|
31880
|
-
/* harmony import */ var
|
|
31873
|
+
/* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6663);
|
|
31874
|
+
/* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8504);
|
|
31881
31875
|
|
|
31882
31876
|
|
|
31883
31877
|
|
|
@@ -32047,13 +32041,13 @@ class Element {
|
|
|
32047
32041
|
}
|
|
32048
32042
|
|
|
32049
32043
|
// KeyValuePair
|
|
32050
|
-
if (value instanceof
|
|
32044
|
+
if (value instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
32051
32045
|
this._content = value;
|
|
32052
32046
|
return;
|
|
32053
32047
|
}
|
|
32054
32048
|
|
|
32055
32049
|
// ObjectSlice - extract elements array
|
|
32056
|
-
if (value instanceof
|
|
32050
|
+
if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]) {
|
|
32057
32051
|
this._content = value.elements;
|
|
32058
32052
|
return;
|
|
32059
32053
|
}
|
|
@@ -32172,7 +32166,7 @@ class Element {
|
|
|
32172
32166
|
if (Array.isArray(content)) {
|
|
32173
32167
|
return content;
|
|
32174
32168
|
}
|
|
32175
|
-
if (content instanceof
|
|
32169
|
+
if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
32176
32170
|
const children = [];
|
|
32177
32171
|
if (content.key) children.push(content.key);
|
|
32178
32172
|
if (content.value) children.push(content.value);
|
|
@@ -32236,7 +32230,7 @@ class Element {
|
|
|
32236
32230
|
if (_content instanceof Element) {
|
|
32237
32231
|
return _content.toValue();
|
|
32238
32232
|
}
|
|
32239
|
-
if (_content instanceof
|
|
32233
|
+
if (_content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
32240
32234
|
return _content.toValue();
|
|
32241
32235
|
}
|
|
32242
32236
|
if (Array.isArray(_content)) {
|
|
@@ -35012,9 +35006,6 @@ class ReusableActionVisitor extends _bases_mjs__WEBPACK_IMPORTED_MODULE_2__.Base
|
|
|
35012
35006
|
|
|
35013
35007
|
"use strict";
|
|
35014
35008
|
__webpack_require__.r(__webpack_exports__);
|
|
35015
|
-
/* empty/unused harmony star reexport */
|
|
35016
|
-
/* empty/unused harmony star reexport */
|
|
35017
|
-
/* empty/unused harmony star reexport */
|
|
35018
35009
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5156);
|
|
35019
35010
|
/* harmony import */ var _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(746);
|
|
35020
35011
|
/* harmony import */ var _yaml_index_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9124);
|
|
@@ -35089,10 +35080,8 @@ const parse = async (source, {
|
|
|
35089
35080
|
|
|
35090
35081
|
"use strict";
|
|
35091
35082
|
__webpack_require__.r(__webpack_exports__);
|
|
35092
|
-
/*
|
|
35093
|
-
/*
|
|
35094
|
-
/* harmony import */ var _lexical_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7657);
|
|
35095
|
-
/* harmony import */ var _syntactic_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7919);
|
|
35083
|
+
/* harmony import */ var _lexical_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7657);
|
|
35084
|
+
/* harmony import */ var _syntactic_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7919);
|
|
35096
35085
|
|
|
35097
35086
|
|
|
35098
35087
|
|
|
@@ -35103,7 +35092,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
35103
35092
|
const detect = async source => {
|
|
35104
35093
|
let cst = null;
|
|
35105
35094
|
try {
|
|
35106
|
-
cst = await (0,
|
|
35095
|
+
cst = await (0,_lexical_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(source);
|
|
35107
35096
|
return !cst.rootNode.isError;
|
|
35108
35097
|
} catch {
|
|
35109
35098
|
return false;
|
|
@@ -35123,9 +35112,9 @@ const parse = async (source, {
|
|
|
35123
35112
|
sourceMap = false,
|
|
35124
35113
|
style = false
|
|
35125
35114
|
} = {}) => {
|
|
35126
|
-
const cst = await (0,
|
|
35115
|
+
const cst = await (0,_lexical_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(source);
|
|
35127
35116
|
try {
|
|
35128
|
-
return (0,
|
|
35117
|
+
return (0,_syntactic_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])(cst, {
|
|
35129
35118
|
sourceMap,
|
|
35130
35119
|
style
|
|
35131
35120
|
});
|
|
@@ -36031,15 +36020,19 @@ const transformCstToYamlAst = (cursor, ctx) => {
|
|
|
36031
36020
|
__webpack_require__.r(__webpack_exports__);
|
|
36032
36021
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5156);
|
|
36033
36022
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5162);
|
|
36034
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(
|
|
36035
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
|
|
36036
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(
|
|
36037
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(
|
|
36038
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(
|
|
36039
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(
|
|
36040
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(
|
|
36041
|
-
/* harmony import */ var
|
|
36042
|
-
/* harmony import */ var
|
|
36023
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5297);
|
|
36024
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8121);
|
|
36025
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8252);
|
|
36026
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7601);
|
|
36027
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(1770);
|
|
36028
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(7071);
|
|
36029
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(4660);
|
|
36030
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(94);
|
|
36031
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(4823);
|
|
36032
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(5810);
|
|
36033
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(9686);
|
|
36034
|
+
/* harmony import */ var _ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(594);
|
|
36035
|
+
/* harmony import */ var _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(1544);
|
|
36043
36036
|
|
|
36044
36037
|
|
|
36045
36038
|
// Transform context passed through transformation
|
|
@@ -36049,7 +36042,7 @@ const maybeAddSourceMap = (node, element, ctx) => {
|
|
|
36049
36042
|
if (!ctx.sourceMap) {
|
|
36050
36043
|
return;
|
|
36051
36044
|
}
|
|
36052
|
-
|
|
36045
|
+
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_11__["default"].transfer(node, element);
|
|
36053
36046
|
};
|
|
36054
36047
|
|
|
36055
36048
|
// find the first descendant matching a type path through the AST
|
|
@@ -36067,7 +36060,7 @@ const findFirst = (node, path) => {
|
|
|
36067
36060
|
// detect indent from first nested block mapping (stream > document > mapping > keyValuePair > mapping)
|
|
36068
36061
|
const detectIndent = node => {
|
|
36069
36062
|
const nested = findFirst(node, ['document', 'mapping', 'keyValuePair', 'mapping']);
|
|
36070
|
-
if (nested?.styleGroup ===
|
|
36063
|
+
if (nested?.styleGroup === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Block && typeof nested.startCharacter === 'number' && nested.startCharacter > 0) {
|
|
36071
36064
|
return nested.startCharacter;
|
|
36072
36065
|
}
|
|
36073
36066
|
return 2;
|
|
@@ -36199,7 +36192,7 @@ const buildYamlStyle = (node, ctx, extras) => {
|
|
|
36199
36192
|
// an untagged node has the non-specific tag '?' when it's a plain scalar and '!' otherwise
|
|
36200
36193
|
// (YAML 1.2 §6.9.1); an explicit '!' on any other node means the same as no tag
|
|
36201
36194
|
const tag = node.tag?.explicitName;
|
|
36202
|
-
if (tag !== undefined && tag !== (node.style ===
|
|
36195
|
+
if (tag !== undefined && tag !== (node.style === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Plain ? '?' : '!')) {
|
|
36203
36196
|
yamlStyle.tag = tag;
|
|
36204
36197
|
}
|
|
36205
36198
|
// the anchor's name, without the & indicator
|
|
@@ -36313,17 +36306,17 @@ const collectStreamComments = node => {
|
|
|
36313
36306
|
if (!root) comments.before.push(text);else if (comment.startLine === root.endLine) comments.inline.push(text);else comments.after.push(text);
|
|
36314
36307
|
};
|
|
36315
36308
|
for (const child of node.children) {
|
|
36316
|
-
if ((0,
|
|
36309
|
+
if ((0,_ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_13__.isDocument)(child)) {
|
|
36317
36310
|
if (root) break;
|
|
36318
36311
|
// comments after an explicit document start (---) or before an explicit document end (...)
|
|
36319
36312
|
// are the document's own children, around its root node
|
|
36320
36313
|
const children = child.children || [];
|
|
36321
|
-
const rootIndex = children.findIndex(c => !(0,
|
|
36314
|
+
const rootIndex = children.findIndex(c => !(0,_ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_13__.isComment)(c));
|
|
36322
36315
|
if (rootIndex === -1) break;
|
|
36323
|
-
children.slice(0, rootIndex).filter(
|
|
36316
|
+
children.slice(0, rootIndex).filter(_ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_13__.isComment).forEach(collect);
|
|
36324
36317
|
root = children[rootIndex];
|
|
36325
|
-
children.slice(rootIndex + 1).filter(
|
|
36326
|
-
} else if ((0,
|
|
36318
|
+
children.slice(rootIndex + 1).filter(_ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_13__.isComment).forEach(collect);
|
|
36319
|
+
} else if ((0,_ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_13__.isComment)(child)) {
|
|
36327
36320
|
collect(child);
|
|
36328
36321
|
}
|
|
36329
36322
|
}
|
|
@@ -36336,7 +36329,7 @@ const transformStream = (node, ctx) => {
|
|
|
36336
36329
|
if (ctx.style) {
|
|
36337
36330
|
ctx.indent = detectIndent(node);
|
|
36338
36331
|
}
|
|
36339
|
-
const element = new
|
|
36332
|
+
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_10__["default"]();
|
|
36340
36333
|
|
|
36341
36334
|
// Transform all children
|
|
36342
36335
|
const children = transformChildren(node.children || [], ctx);
|
|
@@ -36396,7 +36389,7 @@ const transformDocument = (node, ctx) => {
|
|
|
36396
36389
|
const shouldSkipVisitingMoreDocuments = ctx.processedDocumentCount >= 1;
|
|
36397
36390
|
if (shouldWarnAboutMoreDocuments) {
|
|
36398
36391
|
const message = 'Only first document within YAML stream will be used. Rest will be discarded.';
|
|
36399
|
-
const element = new
|
|
36392
|
+
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__["default"](message);
|
|
36400
36393
|
element.classes.push('warning');
|
|
36401
36394
|
maybeAddSourceMap(node, element, ctx);
|
|
36402
36395
|
ctx.annotations.push(element);
|
|
@@ -36415,7 +36408,7 @@ const transformCollection = (element, node, ctx) => {
|
|
|
36415
36408
|
const typedNode = node;
|
|
36416
36409
|
const children = node.children || [];
|
|
36417
36410
|
if (ctx.style) {
|
|
36418
|
-
if (ctx.flowCollectionPadding === null && node.styleGroup ===
|
|
36411
|
+
if (ctx.flowCollectionPadding === null && node.styleGroup === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow) {
|
|
36419
36412
|
ctx.flowCollectionPadding = detectFlowPadding(typedNode);
|
|
36420
36413
|
}
|
|
36421
36414
|
const comments = collectComments(children, typedNode.startCharacter);
|
|
@@ -36426,7 +36419,7 @@ const transformCollection = (element, node, ctx) => {
|
|
|
36426
36419
|
element.style = buildYamlStyle(node, ctx, {
|
|
36427
36420
|
comment: comments.trailing,
|
|
36428
36421
|
// a single pair written directly in a flow sequence (e.g. [a: 1])
|
|
36429
|
-
singlePair: node.style ===
|
|
36422
|
+
singlePair: node.style === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.SinglePair || undefined
|
|
36430
36423
|
});
|
|
36431
36424
|
if (comments.outOfScope.length > 0) {
|
|
36432
36425
|
ctx.promotedComments.push(...comments.outOfScope);
|
|
@@ -36439,14 +36432,14 @@ const transformCollection = (element, node, ctx) => {
|
|
|
36439
36432
|
|
|
36440
36433
|
// Mapping: Transforms to ObjectElement
|
|
36441
36434
|
const transformMapping = (node, ctx) => {
|
|
36442
|
-
const element = new
|
|
36435
|
+
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_7__["default"]();
|
|
36443
36436
|
transformCollection(element, node, ctx);
|
|
36444
36437
|
return element;
|
|
36445
36438
|
};
|
|
36446
36439
|
|
|
36447
36440
|
// KeyValuePair: Transforms to MemberElement
|
|
36448
36441
|
const transformKeyValuePair = (node, ctx) => {
|
|
36449
|
-
const element = new
|
|
36442
|
+
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_6__["default"]();
|
|
36450
36443
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36451
36444
|
const {
|
|
36452
36445
|
key,
|
|
@@ -36457,15 +36450,25 @@ const transformKeyValuePair = (node, ctx) => {
|
|
|
36457
36450
|
styleGroup,
|
|
36458
36451
|
startCharacter
|
|
36459
36452
|
} = value;
|
|
36460
|
-
if (styleGroup ===
|
|
36453
|
+
if (styleGroup === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Block) {
|
|
36461
36454
|
ctx.indentSeq = startCharacter > node.startCharacter;
|
|
36462
36455
|
}
|
|
36463
36456
|
}
|
|
36464
36457
|
|
|
36465
36458
|
// Transform key and value (these are dynamically defined properties)
|
|
36466
|
-
|
|
36459
|
+
let keyResult = transform(key, ctx);
|
|
36467
36460
|
const valueResult = transform(value, ctx);
|
|
36468
36461
|
|
|
36462
|
+
// an empty key is a null in YAML, but a JavaScript property name can't be null, so it's the empty
|
|
36463
|
+
// string it's named by, marked as an empty key
|
|
36464
|
+
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isNullElement)(keyResult) && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.includesClasses)(keyResult, ['yaml-e-node'])) {
|
|
36465
|
+
const emptyKey = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"]('', keyResult.meta, keyResult.attributes);
|
|
36466
|
+
emptyKey.classes.push('yaml-e-key');
|
|
36467
|
+
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_11__["default"].transfer(keyResult, emptyKey);
|
|
36468
|
+
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_12__["default"].transfer(keyResult, emptyKey);
|
|
36469
|
+
keyResult = emptyKey;
|
|
36470
|
+
}
|
|
36471
|
+
|
|
36469
36472
|
// @ts-ignore
|
|
36470
36473
|
element.content.key = keyResult;
|
|
36471
36474
|
// @ts-ignore
|
|
@@ -36485,19 +36488,18 @@ const transformKeyValuePair = (node, ctx) => {
|
|
|
36485
36488
|
|
|
36486
36489
|
// Sequence: Transforms to ArrayElement
|
|
36487
36490
|
const transformSequence = (node, ctx) => {
|
|
36488
|
-
const element = new
|
|
36491
|
+
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__["default"]();
|
|
36489
36492
|
transformCollection(element, node, ctx);
|
|
36490
36493
|
return element;
|
|
36491
36494
|
};
|
|
36492
36495
|
|
|
36493
36496
|
// Scalar: Converts to Element via namespace
|
|
36494
36497
|
const transformScalar = (node, ctx) => {
|
|
36495
|
-
|
|
36496
|
-
|
|
36497
|
-
// Translate style information about empty nodes; an empty node (YAML 1.2 §7.2) is a null unless
|
|
36498
|
-
// a tag other than the null tag makes it something else (e.g. !!str makes it an empty string)
|
|
36498
|
+
// an empty node (YAML 1.2 §7.2) is a null unless a tag other than the null tag makes it
|
|
36499
|
+
// something else (e.g. !!str makes it an empty string); its classes tell it from an explicit null
|
|
36499
36500
|
const tag = node.tag?.explicitName;
|
|
36500
|
-
const isEmptyNode = node.content === '' && node.style ===
|
|
36501
|
+
const isEmptyNode = node.content === '' && node.style === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Plain && [undefined, '?', '!!null', '!<tag:yaml.org,2002:null>'].includes(tag);
|
|
36502
|
+
const element = isEmptyNode ? new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]() : ctx.namespace.toElement(node.content);
|
|
36501
36503
|
if (isEmptyNode) {
|
|
36502
36504
|
element.classes.push('yaml-e-node');
|
|
36503
36505
|
element.classes.push('yaml-e-scalar');
|
|
@@ -36525,7 +36527,7 @@ const transformComment = (node, ctx) => {
|
|
|
36525
36527
|
// Only interested in stream comments before the first document
|
|
36526
36528
|
if (isStreamComment) {
|
|
36527
36529
|
// @ts-ignore
|
|
36528
|
-
const element = new
|
|
36530
|
+
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_9__["default"](node.content);
|
|
36529
36531
|
maybeAddSourceMap(node, element, ctx);
|
|
36530
36532
|
return element;
|
|
36531
36533
|
}
|
|
@@ -36536,7 +36538,7 @@ const transformComment = (node, ctx) => {
|
|
|
36536
36538
|
const transformLiteral = (node, ctx) => {
|
|
36537
36539
|
if (node.isMissing) {
|
|
36538
36540
|
const message = `(Missing ${node.value})`;
|
|
36539
|
-
const element = new
|
|
36541
|
+
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__["default"](message);
|
|
36540
36542
|
element.classes.push('warning');
|
|
36541
36543
|
maybeAddSourceMap(node, element, ctx);
|
|
36542
36544
|
ctx.annotations.push(element);
|
|
@@ -36547,7 +36549,7 @@ const transformLiteral = (node, ctx) => {
|
|
|
36547
36549
|
// Error as annotation (used by keyValuePair)
|
|
36548
36550
|
const transformErrorAsAnnotation = (node, ctx) => {
|
|
36549
36551
|
const message = node.isUnexpected ? '(Unexpected YAML syntax error)' : '(Error YAML syntax error)';
|
|
36550
|
-
const element = new
|
|
36552
|
+
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__["default"](message);
|
|
36551
36553
|
element.classes.push('error');
|
|
36552
36554
|
maybeAddSourceMap(node, element, ctx);
|
|
36553
36555
|
ctx.annotations.push(element);
|
|
@@ -36556,7 +36558,7 @@ const transformErrorAsAnnotation = (node, ctx) => {
|
|
|
36556
36558
|
// Error: Creates error annotation (adds to annotations array)
|
|
36557
36559
|
const transformError = (node, ctx) => {
|
|
36558
36560
|
const message = node.isUnexpected ? '(Unexpected YAML syntax error)' : '(Error YAML syntax error)';
|
|
36559
|
-
const element = new
|
|
36561
|
+
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__["default"](message);
|
|
36560
36562
|
element.classes.push('error');
|
|
36561
36563
|
maybeAddSourceMap(node, element, ctx);
|
|
36562
36564
|
ctx.annotations.push(element);
|
|
@@ -36566,10 +36568,10 @@ const transformError = (node, ctx) => {
|
|
|
36566
36568
|
// Error at root level: Creates ParseResultElement with error annotation
|
|
36567
36569
|
const transformRootError = (node, ctx) => {
|
|
36568
36570
|
const message = node.isUnexpected ? '(Unexpected YAML syntax error)' : '(Error YAML syntax error)';
|
|
36569
|
-
const element = new
|
|
36571
|
+
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__["default"](message);
|
|
36570
36572
|
element.classes.push('error');
|
|
36571
36573
|
maybeAddSourceMap(node, element, ctx);
|
|
36572
|
-
const parseResultElement = new
|
|
36574
|
+
const parseResultElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_10__["default"]();
|
|
36573
36575
|
parseResultElement.push(element);
|
|
36574
36576
|
return parseResultElement;
|
|
36575
36577
|
};
|
|
@@ -36596,7 +36598,7 @@ const transformYamlAstToApiDOM = (yamlAst, {
|
|
|
36596
36598
|
|
|
36597
36599
|
// Handle empty parse result
|
|
36598
36600
|
if (!rootNode) {
|
|
36599
|
-
return new
|
|
36601
|
+
return new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_10__["default"]();
|
|
36600
36602
|
}
|
|
36601
36603
|
|
|
36602
36604
|
// Handle root-level error (no valid stream, just an error node)
|
|
@@ -36606,12 +36608,12 @@ const transformYamlAstToApiDOM = (yamlAst, {
|
|
|
36606
36608
|
const result = transform(rootNode, ctx);
|
|
36607
36609
|
|
|
36608
36610
|
// Result should be a ParseResultElement from transformStream
|
|
36609
|
-
if (result instanceof
|
|
36611
|
+
if (result instanceof _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_10__["default"]) {
|
|
36610
36612
|
return result;
|
|
36611
36613
|
}
|
|
36612
36614
|
|
|
36613
36615
|
// Fallback: wrap in ParseResultElement
|
|
36614
|
-
const parseResult = new
|
|
36616
|
+
const parseResult = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_10__["default"]();
|
|
36615
36617
|
if (result !== null) {
|
|
36616
36618
|
if (Array.isArray(result)) {
|
|
36617
36619
|
result.forEach(el => parseResult.push(el));
|