@speclynx/apidom-parser-adapter-arazzo-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-arazzo-yaml-1
|
|
@@ -30491,11 +30491,8 @@ const resolveSpecification = specification => {
|
|
|
30491
30491
|
__webpack_require__.r(__webpack_exports__);
|
|
30492
30492
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25162);
|
|
30493
30493
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(96911);
|
|
30494
|
-
/* harmony import */ var
|
|
30495
|
-
/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(10977);
|
|
30494
|
+
/* harmony import */ var _util_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(10977);
|
|
30496
30495
|
|
|
30497
|
-
// an empty YAML node (YAML 1.2 §7.2) is a null parsed as an empty string with the yaml-e-node class
|
|
30498
|
-
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']);
|
|
30499
30496
|
|
|
30500
30497
|
/**
|
|
30501
30498
|
* Transforms the ApiDOM into JavaScript POJO.
|
|
@@ -30505,7 +30502,6 @@ const isEmptyNode = element => (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_M
|
|
|
30505
30502
|
*/
|
|
30506
30503
|
const serializer = element => {
|
|
30507
30504
|
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isElement)(element)) return element;
|
|
30508
|
-
if (isEmptyNode(element)) return null;
|
|
30509
30505
|
|
|
30510
30506
|
// Shortcut optimization for primitive element types
|
|
30511
30507
|
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)) {
|
|
@@ -30523,8 +30519,8 @@ const serializer = element => {
|
|
|
30523
30519
|
node.forEach((value, key) => {
|
|
30524
30520
|
const k = serialize(key);
|
|
30525
30521
|
const v = serialize(value);
|
|
30526
|
-
const name = (0,
|
|
30527
|
-
if (name !== undefined) (0,
|
|
30522
|
+
const name = (0,_util_mjs__WEBPACK_IMPORTED_MODULE_2__.toPropertyName)(k);
|
|
30523
|
+
if (name !== undefined) (0,_util_mjs__WEBPACK_IMPORTED_MODULE_2__["default"])(obj, name, v);
|
|
30528
30524
|
});
|
|
30529
30525
|
return obj;
|
|
30530
30526
|
}
|
|
@@ -30539,7 +30535,6 @@ const serializer = element => {
|
|
|
30539
30535
|
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isLinkElement)(node)) {
|
|
30540
30536
|
return (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isStringElement)(node.href) ? node.href.toValue() : '';
|
|
30541
30537
|
}
|
|
30542
|
-
if (isEmptyNode(node)) return null;
|
|
30543
30538
|
return node.toValue();
|
|
30544
30539
|
};
|
|
30545
30540
|
return serialize(element);
|
|
@@ -32567,11 +32562,10 @@ class CollectionElement extends _Element_mjs__WEBPACK_IMPORTED_MODULE_0__["defau
|
|
|
32567
32562
|
|
|
32568
32563
|
"use strict";
|
|
32569
32564
|
__webpack_require__.r(__webpack_exports__);
|
|
32570
|
-
/* empty/unused harmony star reexport */
|
|
32571
32565
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(53654);
|
|
32572
32566
|
/* harmony import */ var _Metadata_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(51844);
|
|
32573
|
-
/* harmony import */ var
|
|
32574
|
-
/* harmony import */ var
|
|
32567
|
+
/* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(36663);
|
|
32568
|
+
/* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(38504);
|
|
32575
32569
|
|
|
32576
32570
|
|
|
32577
32571
|
|
|
@@ -32741,13 +32735,13 @@ class Element {
|
|
|
32741
32735
|
}
|
|
32742
32736
|
|
|
32743
32737
|
// KeyValuePair
|
|
32744
|
-
if (value instanceof
|
|
32738
|
+
if (value instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
32745
32739
|
this._content = value;
|
|
32746
32740
|
return;
|
|
32747
32741
|
}
|
|
32748
32742
|
|
|
32749
32743
|
// ObjectSlice - extract elements array
|
|
32750
|
-
if (value instanceof
|
|
32744
|
+
if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]) {
|
|
32751
32745
|
this._content = value.elements;
|
|
32752
32746
|
return;
|
|
32753
32747
|
}
|
|
@@ -32866,7 +32860,7 @@ class Element {
|
|
|
32866
32860
|
if (Array.isArray(content)) {
|
|
32867
32861
|
return content;
|
|
32868
32862
|
}
|
|
32869
|
-
if (content instanceof
|
|
32863
|
+
if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
32870
32864
|
const children = [];
|
|
32871
32865
|
if (content.key) children.push(content.key);
|
|
32872
32866
|
if (content.value) children.push(content.value);
|
|
@@ -32930,7 +32924,7 @@ class Element {
|
|
|
32930
32924
|
if (_content instanceof Element) {
|
|
32931
32925
|
return _content.toValue();
|
|
32932
32926
|
}
|
|
32933
|
-
if (_content instanceof
|
|
32927
|
+
if (_content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
32934
32928
|
return _content.toValue();
|
|
32935
32929
|
}
|
|
32936
32930
|
if (Array.isArray(_content)) {
|
|
@@ -43084,9 +43078,6 @@ class LinkDescriptionVisitor extends _speclynx_apidom_ns_json_schema_draft_6__WE
|
|
|
43084
43078
|
|
|
43085
43079
|
"use strict";
|
|
43086
43080
|
__webpack_require__.r(__webpack_exports__);
|
|
43087
|
-
/* empty/unused harmony star reexport */
|
|
43088
|
-
/* empty/unused harmony star reexport */
|
|
43089
|
-
/* empty/unused harmony star reexport */
|
|
43090
43081
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(55156);
|
|
43091
43082
|
/* harmony import */ var _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(20746);
|
|
43092
43083
|
/* harmony import */ var _yaml_index_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(69124);
|
|
@@ -43161,10 +43152,8 @@ const parse = async (source, {
|
|
|
43161
43152
|
|
|
43162
43153
|
"use strict";
|
|
43163
43154
|
__webpack_require__.r(__webpack_exports__);
|
|
43164
|
-
/*
|
|
43165
|
-
/*
|
|
43166
|
-
/* harmony import */ var _lexical_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(47657);
|
|
43167
|
-
/* harmony import */ var _syntactic_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(67919);
|
|
43155
|
+
/* harmony import */ var _lexical_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(47657);
|
|
43156
|
+
/* harmony import */ var _syntactic_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67919);
|
|
43168
43157
|
|
|
43169
43158
|
|
|
43170
43159
|
|
|
@@ -43175,7 +43164,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
43175
43164
|
const detect = async source => {
|
|
43176
43165
|
let cst = null;
|
|
43177
43166
|
try {
|
|
43178
|
-
cst = await (0,
|
|
43167
|
+
cst = await (0,_lexical_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(source);
|
|
43179
43168
|
return !cst.rootNode.isError;
|
|
43180
43169
|
} catch {
|
|
43181
43170
|
return false;
|
|
@@ -43195,9 +43184,9 @@ const parse = async (source, {
|
|
|
43195
43184
|
sourceMap = false,
|
|
43196
43185
|
style = false
|
|
43197
43186
|
} = {}) => {
|
|
43198
|
-
const cst = await (0,
|
|
43187
|
+
const cst = await (0,_lexical_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(source);
|
|
43199
43188
|
try {
|
|
43200
|
-
return (0,
|
|
43189
|
+
return (0,_syntactic_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])(cst, {
|
|
43201
43190
|
sourceMap,
|
|
43202
43191
|
style
|
|
43203
43192
|
});
|
|
@@ -44103,15 +44092,19 @@ const transformCstToYamlAst = (cursor, ctx) => {
|
|
|
44103
44092
|
__webpack_require__.r(__webpack_exports__);
|
|
44104
44093
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(55156);
|
|
44105
44094
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(25162);
|
|
44106
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(
|
|
44107
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
|
|
44108
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(
|
|
44109
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(
|
|
44110
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(
|
|
44111
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(
|
|
44112
|
-
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(
|
|
44113
|
-
/* harmony import */ var
|
|
44114
|
-
/* harmony import */ var
|
|
44095
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(55297);
|
|
44096
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(28121);
|
|
44097
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(18252);
|
|
44098
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(97601);
|
|
44099
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(31770);
|
|
44100
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(97071);
|
|
44101
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(84660);
|
|
44102
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(40094);
|
|
44103
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(4823);
|
|
44104
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(25810);
|
|
44105
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(49686);
|
|
44106
|
+
/* harmony import */ var _ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(90594);
|
|
44107
|
+
/* harmony import */ var _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(21544);
|
|
44115
44108
|
|
|
44116
44109
|
|
|
44117
44110
|
// Transform context passed through transformation
|
|
@@ -44121,7 +44114,7 @@ const maybeAddSourceMap = (node, element, ctx) => {
|
|
|
44121
44114
|
if (!ctx.sourceMap) {
|
|
44122
44115
|
return;
|
|
44123
44116
|
}
|
|
44124
|
-
|
|
44117
|
+
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_11__["default"].transfer(node, element);
|
|
44125
44118
|
};
|
|
44126
44119
|
|
|
44127
44120
|
// find the first descendant matching a type path through the AST
|
|
@@ -44139,7 +44132,7 @@ const findFirst = (node, path) => {
|
|
|
44139
44132
|
// detect indent from first nested block mapping (stream > document > mapping > keyValuePair > mapping)
|
|
44140
44133
|
const detectIndent = node => {
|
|
44141
44134
|
const nested = findFirst(node, ['document', 'mapping', 'keyValuePair', 'mapping']);
|
|
44142
|
-
if (nested?.styleGroup ===
|
|
44135
|
+
if (nested?.styleGroup === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Block && typeof nested.startCharacter === 'number' && nested.startCharacter > 0) {
|
|
44143
44136
|
return nested.startCharacter;
|
|
44144
44137
|
}
|
|
44145
44138
|
return 2;
|
|
@@ -44271,7 +44264,7 @@ const buildYamlStyle = (node, ctx, extras) => {
|
|
|
44271
44264
|
// an untagged node has the non-specific tag '?' when it's a plain scalar and '!' otherwise
|
|
44272
44265
|
// (YAML 1.2 §6.9.1); an explicit '!' on any other node means the same as no tag
|
|
44273
44266
|
const tag = node.tag?.explicitName;
|
|
44274
|
-
if (tag !== undefined && tag !== (node.style ===
|
|
44267
|
+
if (tag !== undefined && tag !== (node.style === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Plain ? '?' : '!')) {
|
|
44275
44268
|
yamlStyle.tag = tag;
|
|
44276
44269
|
}
|
|
44277
44270
|
// the anchor's name, without the & indicator
|
|
@@ -44385,17 +44378,17 @@ const collectStreamComments = node => {
|
|
|
44385
44378
|
if (!root) comments.before.push(text);else if (comment.startLine === root.endLine) comments.inline.push(text);else comments.after.push(text);
|
|
44386
44379
|
};
|
|
44387
44380
|
for (const child of node.children) {
|
|
44388
|
-
if ((0,
|
|
44381
|
+
if ((0,_ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_13__.isDocument)(child)) {
|
|
44389
44382
|
if (root) break;
|
|
44390
44383
|
// comments after an explicit document start (---) or before an explicit document end (...)
|
|
44391
44384
|
// are the document's own children, around its root node
|
|
44392
44385
|
const children = child.children || [];
|
|
44393
|
-
const rootIndex = children.findIndex(c => !(0,
|
|
44386
|
+
const rootIndex = children.findIndex(c => !(0,_ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_13__.isComment)(c));
|
|
44394
44387
|
if (rootIndex === -1) break;
|
|
44395
|
-
children.slice(0, rootIndex).filter(
|
|
44388
|
+
children.slice(0, rootIndex).filter(_ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_13__.isComment).forEach(collect);
|
|
44396
44389
|
root = children[rootIndex];
|
|
44397
|
-
children.slice(rootIndex + 1).filter(
|
|
44398
|
-
} else if ((0,
|
|
44390
|
+
children.slice(rootIndex + 1).filter(_ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_13__.isComment).forEach(collect);
|
|
44391
|
+
} else if ((0,_ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_13__.isComment)(child)) {
|
|
44399
44392
|
collect(child);
|
|
44400
44393
|
}
|
|
44401
44394
|
}
|
|
@@ -44408,7 +44401,7 @@ const transformStream = (node, ctx) => {
|
|
|
44408
44401
|
if (ctx.style) {
|
|
44409
44402
|
ctx.indent = detectIndent(node);
|
|
44410
44403
|
}
|
|
44411
|
-
const element = new
|
|
44404
|
+
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_10__["default"]();
|
|
44412
44405
|
|
|
44413
44406
|
// Transform all children
|
|
44414
44407
|
const children = transformChildren(node.children || [], ctx);
|
|
@@ -44468,7 +44461,7 @@ const transformDocument = (node, ctx) => {
|
|
|
44468
44461
|
const shouldSkipVisitingMoreDocuments = ctx.processedDocumentCount >= 1;
|
|
44469
44462
|
if (shouldWarnAboutMoreDocuments) {
|
|
44470
44463
|
const message = 'Only first document within YAML stream will be used. Rest will be discarded.';
|
|
44471
|
-
const element = new
|
|
44464
|
+
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__["default"](message);
|
|
44472
44465
|
element.classes.push('warning');
|
|
44473
44466
|
maybeAddSourceMap(node, element, ctx);
|
|
44474
44467
|
ctx.annotations.push(element);
|
|
@@ -44487,7 +44480,7 @@ const transformCollection = (element, node, ctx) => {
|
|
|
44487
44480
|
const typedNode = node;
|
|
44488
44481
|
const children = node.children || [];
|
|
44489
44482
|
if (ctx.style) {
|
|
44490
|
-
if (ctx.flowCollectionPadding === null && node.styleGroup ===
|
|
44483
|
+
if (ctx.flowCollectionPadding === null && node.styleGroup === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow) {
|
|
44491
44484
|
ctx.flowCollectionPadding = detectFlowPadding(typedNode);
|
|
44492
44485
|
}
|
|
44493
44486
|
const comments = collectComments(children, typedNode.startCharacter);
|
|
@@ -44498,7 +44491,7 @@ const transformCollection = (element, node, ctx) => {
|
|
|
44498
44491
|
element.style = buildYamlStyle(node, ctx, {
|
|
44499
44492
|
comment: comments.trailing,
|
|
44500
44493
|
// a single pair written directly in a flow sequence (e.g. [a: 1])
|
|
44501
|
-
singlePair: node.style ===
|
|
44494
|
+
singlePair: node.style === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.SinglePair || undefined
|
|
44502
44495
|
});
|
|
44503
44496
|
if (comments.outOfScope.length > 0) {
|
|
44504
44497
|
ctx.promotedComments.push(...comments.outOfScope);
|
|
@@ -44511,14 +44504,14 @@ const transformCollection = (element, node, ctx) => {
|
|
|
44511
44504
|
|
|
44512
44505
|
// Mapping: Transforms to ObjectElement
|
|
44513
44506
|
const transformMapping = (node, ctx) => {
|
|
44514
|
-
const element = new
|
|
44507
|
+
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_7__["default"]();
|
|
44515
44508
|
transformCollection(element, node, ctx);
|
|
44516
44509
|
return element;
|
|
44517
44510
|
};
|
|
44518
44511
|
|
|
44519
44512
|
// KeyValuePair: Transforms to MemberElement
|
|
44520
44513
|
const transformKeyValuePair = (node, ctx) => {
|
|
44521
|
-
const element = new
|
|
44514
|
+
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_6__["default"]();
|
|
44522
44515
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44523
44516
|
const {
|
|
44524
44517
|
key,
|
|
@@ -44529,15 +44522,25 @@ const transformKeyValuePair = (node, ctx) => {
|
|
|
44529
44522
|
styleGroup,
|
|
44530
44523
|
startCharacter
|
|
44531
44524
|
} = value;
|
|
44532
|
-
if (styleGroup ===
|
|
44525
|
+
if (styleGroup === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Block) {
|
|
44533
44526
|
ctx.indentSeq = startCharacter > node.startCharacter;
|
|
44534
44527
|
}
|
|
44535
44528
|
}
|
|
44536
44529
|
|
|
44537
44530
|
// Transform key and value (these are dynamically defined properties)
|
|
44538
|
-
|
|
44531
|
+
let keyResult = transform(key, ctx);
|
|
44539
44532
|
const valueResult = transform(value, ctx);
|
|
44540
44533
|
|
|
44534
|
+
// an empty key is a null in YAML, but a JavaScript property name can't be null, so it's the empty
|
|
44535
|
+
// string it's named by, marked as an empty key
|
|
44536
|
+
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isNullElement)(keyResult) && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.includesClasses)(keyResult, ['yaml-e-node'])) {
|
|
44537
|
+
const emptyKey = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"]('', keyResult.meta, keyResult.attributes);
|
|
44538
|
+
emptyKey.classes.push('yaml-e-key');
|
|
44539
|
+
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_11__["default"].transfer(keyResult, emptyKey);
|
|
44540
|
+
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_12__["default"].transfer(keyResult, emptyKey);
|
|
44541
|
+
keyResult = emptyKey;
|
|
44542
|
+
}
|
|
44543
|
+
|
|
44541
44544
|
// @ts-ignore
|
|
44542
44545
|
element.content.key = keyResult;
|
|
44543
44546
|
// @ts-ignore
|
|
@@ -44557,19 +44560,18 @@ const transformKeyValuePair = (node, ctx) => {
|
|
|
44557
44560
|
|
|
44558
44561
|
// Sequence: Transforms to ArrayElement
|
|
44559
44562
|
const transformSequence = (node, ctx) => {
|
|
44560
|
-
const element = new
|
|
44563
|
+
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_5__["default"]();
|
|
44561
44564
|
transformCollection(element, node, ctx);
|
|
44562
44565
|
return element;
|
|
44563
44566
|
};
|
|
44564
44567
|
|
|
44565
44568
|
// Scalar: Converts to Element via namespace
|
|
44566
44569
|
const transformScalar = (node, ctx) => {
|
|
44567
|
-
|
|
44568
|
-
|
|
44569
|
-
// Translate style information about empty nodes; an empty node (YAML 1.2 §7.2) is a null unless
|
|
44570
|
-
// a tag other than the null tag makes it something else (e.g. !!str makes it an empty string)
|
|
44570
|
+
// an empty node (YAML 1.2 §7.2) is a null unless a tag other than the null tag makes it
|
|
44571
|
+
// something else (e.g. !!str makes it an empty string); its classes tell it from an explicit null
|
|
44571
44572
|
const tag = node.tag?.explicitName;
|
|
44572
|
-
const isEmptyNode = node.content === '' && node.style ===
|
|
44573
|
+
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);
|
|
44574
|
+
const element = isEmptyNode ? new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]() : ctx.namespace.toElement(node.content);
|
|
44573
44575
|
if (isEmptyNode) {
|
|
44574
44576
|
element.classes.push('yaml-e-node');
|
|
44575
44577
|
element.classes.push('yaml-e-scalar');
|
|
@@ -44597,7 +44599,7 @@ const transformComment = (node, ctx) => {
|
|
|
44597
44599
|
// Only interested in stream comments before the first document
|
|
44598
44600
|
if (isStreamComment) {
|
|
44599
44601
|
// @ts-ignore
|
|
44600
|
-
const element = new
|
|
44602
|
+
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_9__["default"](node.content);
|
|
44601
44603
|
maybeAddSourceMap(node, element, ctx);
|
|
44602
44604
|
return element;
|
|
44603
44605
|
}
|
|
@@ -44608,7 +44610,7 @@ const transformComment = (node, ctx) => {
|
|
|
44608
44610
|
const transformLiteral = (node, ctx) => {
|
|
44609
44611
|
if (node.isMissing) {
|
|
44610
44612
|
const message = `(Missing ${node.value})`;
|
|
44611
|
-
const element = new
|
|
44613
|
+
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__["default"](message);
|
|
44612
44614
|
element.classes.push('warning');
|
|
44613
44615
|
maybeAddSourceMap(node, element, ctx);
|
|
44614
44616
|
ctx.annotations.push(element);
|
|
@@ -44619,7 +44621,7 @@ const transformLiteral = (node, ctx) => {
|
|
|
44619
44621
|
// Error as annotation (used by keyValuePair)
|
|
44620
44622
|
const transformErrorAsAnnotation = (node, ctx) => {
|
|
44621
44623
|
const message = node.isUnexpected ? '(Unexpected YAML syntax error)' : '(Error YAML syntax error)';
|
|
44622
|
-
const element = new
|
|
44624
|
+
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__["default"](message);
|
|
44623
44625
|
element.classes.push('error');
|
|
44624
44626
|
maybeAddSourceMap(node, element, ctx);
|
|
44625
44627
|
ctx.annotations.push(element);
|
|
@@ -44628,7 +44630,7 @@ const transformErrorAsAnnotation = (node, ctx) => {
|
|
|
44628
44630
|
// Error: Creates error annotation (adds to annotations array)
|
|
44629
44631
|
const transformError = (node, ctx) => {
|
|
44630
44632
|
const message = node.isUnexpected ? '(Unexpected YAML syntax error)' : '(Error YAML syntax error)';
|
|
44631
|
-
const element = new
|
|
44633
|
+
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__["default"](message);
|
|
44632
44634
|
element.classes.push('error');
|
|
44633
44635
|
maybeAddSourceMap(node, element, ctx);
|
|
44634
44636
|
ctx.annotations.push(element);
|
|
@@ -44638,10 +44640,10 @@ const transformError = (node, ctx) => {
|
|
|
44638
44640
|
// Error at root level: Creates ParseResultElement with error annotation
|
|
44639
44641
|
const transformRootError = (node, ctx) => {
|
|
44640
44642
|
const message = node.isUnexpected ? '(Unexpected YAML syntax error)' : '(Error YAML syntax error)';
|
|
44641
|
-
const element = new
|
|
44643
|
+
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__["default"](message);
|
|
44642
44644
|
element.classes.push('error');
|
|
44643
44645
|
maybeAddSourceMap(node, element, ctx);
|
|
44644
|
-
const parseResultElement = new
|
|
44646
|
+
const parseResultElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_10__["default"]();
|
|
44645
44647
|
parseResultElement.push(element);
|
|
44646
44648
|
return parseResultElement;
|
|
44647
44649
|
};
|
|
@@ -44668,7 +44670,7 @@ const transformYamlAstToApiDOM = (yamlAst, {
|
|
|
44668
44670
|
|
|
44669
44671
|
// Handle empty parse result
|
|
44670
44672
|
if (!rootNode) {
|
|
44671
|
-
return new
|
|
44673
|
+
return new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_10__["default"]();
|
|
44672
44674
|
}
|
|
44673
44675
|
|
|
44674
44676
|
// Handle root-level error (no valid stream, just an error node)
|
|
@@ -44678,12 +44680,12 @@ const transformYamlAstToApiDOM = (yamlAst, {
|
|
|
44678
44680
|
const result = transform(rootNode, ctx);
|
|
44679
44681
|
|
|
44680
44682
|
// Result should be a ParseResultElement from transformStream
|
|
44681
|
-
if (result instanceof
|
|
44683
|
+
if (result instanceof _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_10__["default"]) {
|
|
44682
44684
|
return result;
|
|
44683
44685
|
}
|
|
44684
44686
|
|
|
44685
44687
|
// Fallback: wrap in ParseResultElement
|
|
44686
|
-
const parseResult = new
|
|
44688
|
+
const parseResult = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_10__["default"]();
|
|
44687
44689
|
if (result !== null) {
|
|
44688
44690
|
if (Array.isArray(result)) {
|
|
44689
44691
|
result.forEach(el => parseResult.push(el));
|