@speclynx/apidom-parser-adapter-arazzo-yaml-1 5.0.2 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
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
|
+
# [5.1.0](https://github.com/speclynx/apidom/compare/v5.0.2...v5.1.0) (2026-08-09)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @speclynx/apidom-parser-adapter-arazzo-yaml-1
|
|
9
|
+
|
|
6
10
|
## [5.0.2](https://github.com/speclynx/apidom/compare/v5.0.1...v5.0.2) (2026-08-04)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @speclynx/apidom-parser-adapter-arazzo-yaml-1
|
|
@@ -1122,7 +1122,7 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
1122
1122
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
1123
1123
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
1124
1124
|
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
1125
|
-
|
|
1125
|
+
;
|
|
1126
1126
|
|
|
1127
1127
|
var _CompositeEvaluationRealm_brand = /*#__PURE__*/new WeakSet();
|
|
1128
1128
|
class CompositeEvaluationRealm extends _EvaluationRealm_mjs__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
@@ -10067,7 +10067,7 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
10067
10067
|
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
10068
10068
|
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
10069
10069
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
10070
|
-
|
|
10070
|
+
;
|
|
10071
10071
|
|
|
10072
10072
|
/**
|
|
10073
10073
|
* Can be used as a way to compose multiple invokers together to form polymorphic functions,
|
|
@@ -30709,7 +30709,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30709
30709
|
* @public
|
|
30710
30710
|
*/
|
|
30711
30711
|
const emptyElement = element => {
|
|
30712
|
-
const meta = !element.isMetaEmpty ? element.meta
|
|
30712
|
+
const meta = !element.isMetaEmpty ? (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(element.meta) : undefined;
|
|
30713
30713
|
const attributes = !element.isAttributesEmpty ? (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(element.attributes) : undefined;
|
|
30714
30714
|
|
|
30715
30715
|
// @ts-ignore
|
|
@@ -30725,7 +30725,7 @@ const getMergeFunction = (keyElement, options) => {
|
|
|
30725
30725
|
};
|
|
30726
30726
|
const getMetaMergeFunction = options => {
|
|
30727
30727
|
if (typeof options.customMetaMerge !== 'function') {
|
|
30728
|
-
return targetMeta =>
|
|
30728
|
+
return targetMeta => (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(targetMeta);
|
|
30729
30729
|
}
|
|
30730
30730
|
return options.customMetaMerge;
|
|
30731
30731
|
};
|
|
@@ -30800,9 +30800,9 @@ const deepmerge = (targetElement, sourceElement, options) => {
|
|
|
30800
30800
|
if (!targetElement.isMetaEmpty && !sourceElement.isMetaEmpty) {
|
|
30801
30801
|
mergedElement.meta = getMetaMergeFunction(mergedOptions)(targetElement.meta, sourceElement.meta);
|
|
30802
30802
|
} else if (!targetElement.isMetaEmpty) {
|
|
30803
|
-
mergedElement.meta = targetElement.meta
|
|
30803
|
+
mergedElement.meta = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(targetElement.meta);
|
|
30804
30804
|
} else if (!sourceElement.isMetaEmpty) {
|
|
30805
|
-
mergedElement.meta = sourceElement.meta
|
|
30805
|
+
mergedElement.meta = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(sourceElement.meta);
|
|
30806
30806
|
}
|
|
30807
30807
|
if (!targetElement.isAttributesEmpty && !sourceElement.isAttributesEmpty) {
|
|
30808
30808
|
mergedElement.attributes = getAttributesMergeFunction(mergedOptions)(targetElement.attributes, sourceElement.attributes);
|
|
@@ -31780,19 +31780,21 @@ class ShallowCloneError extends _CloneError_mjs__WEBPACK_IMPORTED_MODULE_0__["de
|
|
|
31780
31780
|
"use strict";
|
|
31781
31781
|
__webpack_require__.r(__webpack_exports__);
|
|
31782
31782
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
31783
|
-
/* harmony export */ CloneError: () => (/* reexport safe */
|
|
31784
|
-
/* harmony export */ DeepCloneError: () => (/* reexport safe */
|
|
31785
|
-
/* harmony export */ ShallowCloneError: () => (/* reexport safe */
|
|
31783
|
+
/* harmony export */ CloneError: () => (/* reexport safe */ _errors_CloneError_mjs__WEBPACK_IMPORTED_MODULE_9__["default"]),
|
|
31784
|
+
/* harmony export */ DeepCloneError: () => (/* reexport safe */ _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]),
|
|
31785
|
+
/* harmony export */ ShallowCloneError: () => (/* reexport safe */ _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_8__["default"])
|
|
31786
31786
|
/* harmony export */ });
|
|
31787
31787
|
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8138);
|
|
31788
31788
|
/* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(38504);
|
|
31789
31789
|
/* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(36663);
|
|
31790
|
-
/* harmony import */ var
|
|
31791
|
-
/* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(
|
|
31792
|
-
/* harmony import */ var
|
|
31793
|
-
/* harmony import */ var
|
|
31794
|
-
/* harmony import */ var
|
|
31795
|
-
/* harmony import */ var
|
|
31790
|
+
/* harmony import */ var _Metadata_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(51844);
|
|
31791
|
+
/* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(18252);
|
|
31792
|
+
/* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(25162);
|
|
31793
|
+
/* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(25810);
|
|
31794
|
+
/* harmony import */ var _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(95018);
|
|
31795
|
+
/* harmony import */ var _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(3686);
|
|
31796
|
+
/* harmony import */ var _errors_CloneError_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(3772);
|
|
31797
|
+
|
|
31796
31798
|
|
|
31797
31799
|
|
|
31798
31800
|
|
|
@@ -31826,7 +31828,7 @@ const cloneDeepElement = (element, options) => {
|
|
|
31826
31828
|
} = element;
|
|
31827
31829
|
if (Array.isArray(content)) {
|
|
31828
31830
|
copy.content = content.map(el => cloneDeepElement(el, passThroughOptions));
|
|
31829
|
-
} else if ((0,
|
|
31831
|
+
} else if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_5__.isElement)(content)) {
|
|
31830
31832
|
copy.content = cloneDeepElement(content, passThroughOptions);
|
|
31831
31833
|
} else if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
31832
31834
|
copy.content = cloneDeepKeyValuePair(content, passThroughOptions);
|
|
@@ -31874,7 +31876,7 @@ const cloneDeepObjectSlice = (slice, options) => {
|
|
|
31874
31876
|
};
|
|
31875
31877
|
|
|
31876
31878
|
/**
|
|
31877
|
-
* Creates a deep clone of an ApiDOM Element, KeyValuePair, or
|
|
31879
|
+
* Creates a deep clone of an ApiDOM Element, KeyValuePair, ObjectSlice, or Metadata.
|
|
31878
31880
|
* Handles cycles by memoizing visited objects.
|
|
31879
31881
|
* @public
|
|
31880
31882
|
*/
|
|
@@ -31885,10 +31887,13 @@ const cloneDeep = (value, options = {}) => {
|
|
|
31885
31887
|
if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
|
|
31886
31888
|
return cloneDeepObjectSlice(value, options);
|
|
31887
31889
|
}
|
|
31888
|
-
if (
|
|
31890
|
+
if (value instanceof _Metadata_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]) {
|
|
31891
|
+
return value.cloneDeep();
|
|
31892
|
+
}
|
|
31893
|
+
if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_5__.isElement)(value)) {
|
|
31889
31894
|
return cloneDeepElement(value, options);
|
|
31890
31895
|
}
|
|
31891
|
-
throw new
|
|
31896
|
+
throw new _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]("Value provided to cloneDeep function couldn't be cloned", {
|
|
31892
31897
|
value
|
|
31893
31898
|
});
|
|
31894
31899
|
};
|
|
@@ -31915,21 +31920,21 @@ const cloneShallowElement = element => {
|
|
|
31915
31920
|
const copy = new Ctor();
|
|
31916
31921
|
copy.element = element.element;
|
|
31917
31922
|
if (!element.isMetaEmpty) {
|
|
31918
|
-
copy.meta = element.meta
|
|
31923
|
+
copy.meta = cloneDeep(element.meta);
|
|
31919
31924
|
}
|
|
31920
31925
|
if (!element.isAttributesEmpty) {
|
|
31921
31926
|
copy.attributes = cloneDeep(element.attributes);
|
|
31922
31927
|
}
|
|
31923
|
-
if ((0,
|
|
31924
|
-
|
|
31928
|
+
if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.hasElementSourceMap)(element)) {
|
|
31929
|
+
_elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_6__["default"].transfer(element, copy);
|
|
31925
31930
|
}
|
|
31926
|
-
if ((0,
|
|
31931
|
+
if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.hasElementStyle)(element)) {
|
|
31927
31932
|
copy.style = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(element.style);
|
|
31928
31933
|
}
|
|
31929
31934
|
const {
|
|
31930
31935
|
content
|
|
31931
31936
|
} = element;
|
|
31932
|
-
if ((0,
|
|
31937
|
+
if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_5__.isElement)(content)) {
|
|
31933
31938
|
copy.content = cloneShallowElement(content);
|
|
31934
31939
|
} else if (Array.isArray(content)) {
|
|
31935
31940
|
copy.content = [...content];
|
|
@@ -31942,7 +31947,7 @@ const cloneShallowElement = element => {
|
|
|
31942
31947
|
};
|
|
31943
31948
|
|
|
31944
31949
|
/**
|
|
31945
|
-
* Creates a shallow clone of an ApiDOM Element, KeyValuePair, or
|
|
31950
|
+
* Creates a shallow clone of an ApiDOM Element, KeyValuePair, ObjectSlice, or Metadata.
|
|
31946
31951
|
* The element itself is cloned, but content references are shared.
|
|
31947
31952
|
* Meta and attributes are deep cloned to preserve semantic information.
|
|
31948
31953
|
* @public
|
|
@@ -31954,10 +31959,13 @@ const cloneShallow = value => {
|
|
|
31954
31959
|
if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
|
|
31955
31960
|
return cloneShallowObjectSlice(value);
|
|
31956
31961
|
}
|
|
31957
|
-
if (
|
|
31962
|
+
if (value instanceof _Metadata_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]) {
|
|
31963
|
+
return value.cloneShallow();
|
|
31964
|
+
}
|
|
31965
|
+
if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_5__.isElement)(value)) {
|
|
31958
31966
|
return cloneShallowElement(value);
|
|
31959
31967
|
}
|
|
31960
|
-
throw new
|
|
31968
|
+
throw new _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]("Value provided to cloneShallow function couldn't be cloned", {
|
|
31961
31969
|
value
|
|
31962
31970
|
});
|
|
31963
31971
|
};
|
|
@@ -37000,7 +37008,7 @@ class SpecificationVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_6__["de
|
|
|
37000
37008
|
if (visitor instanceof _FallbackVisitor_mjs__WEBPACK_IMPORTED_MODULE_7__["default"] && visitor?.constructor === _FallbackVisitor_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]) {
|
|
37001
37009
|
return this.consume ? element : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(element);
|
|
37002
37010
|
}
|
|
37003
|
-
(0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_5__.traverse)(element, visitor, options);
|
|
37011
|
+
;(0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_5__.traverse)(element, visitor, options);
|
|
37004
37012
|
return visitor.element;
|
|
37005
37013
|
}
|
|
37006
37014
|
}
|
|
@@ -37042,7 +37050,7 @@ class Visitor {
|
|
|
37042
37050
|
if (!from.isMetaEmpty && !to.isMetaEmpty) {
|
|
37043
37051
|
to.meta = to.meta.merge(from.meta);
|
|
37044
37052
|
} else if (!from.isMetaEmpty) {
|
|
37045
|
-
to.meta = from.meta
|
|
37053
|
+
to.meta = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(from.meta);
|
|
37046
37054
|
}
|
|
37047
37055
|
if (!from.isAttributesEmpty && !to.isAttributesEmpty) {
|
|
37048
37056
|
to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(to.attributes, from.attributes);
|
|
@@ -40907,7 +40915,7 @@ class SpecificationVisitor extends _Visitor_mjs__WEBPACK_IMPORTED_MODULE_6__["de
|
|
|
40907
40915
|
if (visitor instanceof _FallbackVisitor_mjs__WEBPACK_IMPORTED_MODULE_7__["default"] && visitor?.constructor === _FallbackVisitor_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]) {
|
|
40908
40916
|
return this.consume ? element : (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneDeep)(element);
|
|
40909
40917
|
}
|
|
40910
|
-
(0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_5__.traverse)(element, visitor, options);
|
|
40918
|
+
;(0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_5__.traverse)(element, visitor, options);
|
|
40911
40919
|
return visitor.element;
|
|
40912
40920
|
}
|
|
40913
40921
|
}
|
|
@@ -40949,7 +40957,7 @@ class Visitor {
|
|
|
40949
40957
|
if (!from.isMetaEmpty && !to.isMetaEmpty) {
|
|
40950
40958
|
to.meta = to.meta.merge(from.meta);
|
|
40951
40959
|
} else if (!from.isMetaEmpty) {
|
|
40952
|
-
to.meta = from.meta
|
|
40960
|
+
to.meta = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.cloneDeep)(from.meta);
|
|
40953
40961
|
}
|
|
40954
40962
|
if (!from.isAttributesEmpty && !to.isAttributesEmpty) {
|
|
40955
40963
|
to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(to.attributes, from.attributes);
|
|
@@ -43141,8 +43149,11 @@ const processChildren = (cursor, ctx, transformerMap) => {
|
|
|
43141
43149
|
return results;
|
|
43142
43150
|
};
|
|
43143
43151
|
|
|
43144
|
-
// strip leading '#
|
|
43145
|
-
|
|
43152
|
+
// strip leading '#' from each line of comment text; the text after '#' is kept
|
|
43153
|
+
// verbatim (including leading whitespace) so serializers can round-trip it exactly;
|
|
43154
|
+
// a bare '#' becomes a single space — the yaml library's encoding for an empty
|
|
43155
|
+
// comment, which its stringifier turns back into '#' (plain '' would be dropped)
|
|
43156
|
+
const stripCommentHash = text => text.split('\n').map(line => line === '#' ? ' ' : line.replace(/^#/, '')).join('\n');
|
|
43146
43157
|
|
|
43147
43158
|
// find the first YamlNode in a TransformResult (which may be an array from block_node)
|
|
43148
43159
|
const findYamlNode = result => {
|
|
@@ -43185,7 +43196,10 @@ const processKeyValuePairChildren = (cursor, ctx, transformerMap) => {
|
|
|
43185
43196
|
if (seenValue) {
|
|
43186
43197
|
commentsAfterValue.push(commentText);
|
|
43187
43198
|
} else if (seenKey) {
|
|
43188
|
-
commentsBetweenKeyValue.push(
|
|
43199
|
+
commentsBetweenKeyValue.push({
|
|
43200
|
+
text: commentText,
|
|
43201
|
+
startLine: info.startPosition.row
|
|
43202
|
+
});
|
|
43189
43203
|
}
|
|
43190
43204
|
continue;
|
|
43191
43205
|
}
|
|
@@ -43214,6 +43228,35 @@ const processKeyValuePairChildren = (cursor, ctx, transformerMap) => {
|
|
|
43214
43228
|
commentsAfterValue
|
|
43215
43229
|
};
|
|
43216
43230
|
};
|
|
43231
|
+
|
|
43232
|
+
// attach comments collected inside a pair: comments on the key's own line belong
|
|
43233
|
+
// after the key (`key: # comment`), the rest before the value node; comments
|
|
43234
|
+
// found after the value become the value's trailing comment
|
|
43235
|
+
const attachPairComments = ({
|
|
43236
|
+
key,
|
|
43237
|
+
value,
|
|
43238
|
+
commentsBetweenKeyValue,
|
|
43239
|
+
commentsAfterValue
|
|
43240
|
+
}) => {
|
|
43241
|
+
if (commentsBetweenKeyValue.length > 0) {
|
|
43242
|
+
const keyNode = findYamlNode(key);
|
|
43243
|
+
const valueNode = findYamlNode(value);
|
|
43244
|
+
const onKeyLine = commentsBetweenKeyValue.filter(comment => keyNode !== null && comment.startLine === keyNode.endLine);
|
|
43245
|
+
const onOwnLine = commentsBetweenKeyValue.filter(comment => !onKeyLine.includes(comment));
|
|
43246
|
+
if (onKeyLine.length > 0 && keyNode) {
|
|
43247
|
+
keyNode.comment = onKeyLine.map(comment => comment.text).join('\n');
|
|
43248
|
+
}
|
|
43249
|
+
if (onOwnLine.length > 0 && valueNode) {
|
|
43250
|
+
valueNode.commentBefore = onOwnLine.map(comment => comment.text).join('\n');
|
|
43251
|
+
}
|
|
43252
|
+
}
|
|
43253
|
+
if (commentsAfterValue.length > 0) {
|
|
43254
|
+
const valueNode = findYamlNode(value);
|
|
43255
|
+
if (valueNode) {
|
|
43256
|
+
valueNode.comment = commentsAfterValue.join('\n');
|
|
43257
|
+
}
|
|
43258
|
+
}
|
|
43259
|
+
};
|
|
43217
43260
|
const transform = (cursor, ctx, transformerMap, siblings = {}) => {
|
|
43218
43261
|
const info = getCursorInfo(cursor);
|
|
43219
43262
|
|
|
@@ -43385,13 +43428,12 @@ const createTransformers = transformerMap => ({
|
|
|
43385
43428
|
},
|
|
43386
43429
|
block_mapping_pair(cursor, ctx) {
|
|
43387
43430
|
const info = getCursorInfo(cursor);
|
|
43431
|
+
const pairResult = processKeyValuePairChildren(cursor, ctx, transformerMap);
|
|
43388
43432
|
const {
|
|
43389
43433
|
key,
|
|
43390
43434
|
value,
|
|
43391
|
-
errors
|
|
43392
|
-
|
|
43393
|
-
commentsAfterValue
|
|
43394
|
-
} = processKeyValuePairChildren(cursor, ctx, transformerMap);
|
|
43435
|
+
errors
|
|
43436
|
+
} = pairResult;
|
|
43395
43437
|
const children = [];
|
|
43396
43438
|
|
|
43397
43439
|
// Handle empty key
|
|
@@ -43437,21 +43479,7 @@ const createTransformers = transformerMap => ({
|
|
|
43437
43479
|
} else {
|
|
43438
43480
|
children.push(value);
|
|
43439
43481
|
}
|
|
43440
|
-
|
|
43441
|
-
// attach comments found between key and value to the value node
|
|
43442
|
-
if (commentsBetweenKeyValue.length > 0) {
|
|
43443
|
-
const valueNode = findYamlNode(value);
|
|
43444
|
-
if (valueNode) {
|
|
43445
|
-
valueNode.commentBefore = commentsBetweenKeyValue.join('\n');
|
|
43446
|
-
}
|
|
43447
|
-
}
|
|
43448
|
-
// attach comments found after value to the value node
|
|
43449
|
-
if (commentsAfterValue.length > 0) {
|
|
43450
|
-
const valueNode = findYamlNode(value);
|
|
43451
|
-
if (valueNode) {
|
|
43452
|
-
valueNode.comment = commentsAfterValue.join('\n');
|
|
43453
|
-
}
|
|
43454
|
-
}
|
|
43482
|
+
attachPairComments(pairResult);
|
|
43455
43483
|
children.push(...errors);
|
|
43456
43484
|
return new _ast_nodes_YamlKeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_9__["default"]({
|
|
43457
43485
|
children: children.flat().filter(c => c !== null),
|
|
@@ -43479,13 +43507,12 @@ const createTransformers = transformerMap => ({
|
|
|
43479
43507
|
},
|
|
43480
43508
|
flow_pair(cursor, ctx) {
|
|
43481
43509
|
const info = getCursorInfo(cursor);
|
|
43510
|
+
const pairResult = processKeyValuePairChildren(cursor, ctx, transformerMap);
|
|
43482
43511
|
const {
|
|
43483
43512
|
key,
|
|
43484
43513
|
value,
|
|
43485
|
-
errors
|
|
43486
|
-
|
|
43487
|
-
commentsAfterValue
|
|
43488
|
-
} = processKeyValuePairChildren(cursor, ctx, transformerMap);
|
|
43514
|
+
errors
|
|
43515
|
+
} = pairResult;
|
|
43489
43516
|
const children = [];
|
|
43490
43517
|
|
|
43491
43518
|
// Handle empty key
|
|
@@ -43531,21 +43558,7 @@ const createTransformers = transformerMap => ({
|
|
|
43531
43558
|
} else {
|
|
43532
43559
|
children.push(value);
|
|
43533
43560
|
}
|
|
43534
|
-
|
|
43535
|
-
// attach comments found between key and value to the value node
|
|
43536
|
-
if (commentsBetweenKeyValue.length > 0) {
|
|
43537
|
-
const valueNode = findYamlNode(value);
|
|
43538
|
-
if (valueNode) {
|
|
43539
|
-
valueNode.commentBefore = commentsBetweenKeyValue.join('\n');
|
|
43540
|
-
}
|
|
43541
|
-
}
|
|
43542
|
-
// attach comments found after value to the value node
|
|
43543
|
-
if (commentsAfterValue.length > 0) {
|
|
43544
|
-
const valueNode = findYamlNode(value);
|
|
43545
|
-
if (valueNode) {
|
|
43546
|
-
valueNode.comment = commentsAfterValue.join('\n');
|
|
43547
|
-
}
|
|
43548
|
-
}
|
|
43561
|
+
attachPairComments(pairResult);
|
|
43549
43562
|
children.push(...errors);
|
|
43550
43563
|
return new _ast_nodes_YamlKeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_9__["default"]({
|
|
43551
43564
|
children: children.flat().filter(c => c !== null),
|
|
@@ -43756,7 +43769,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
43756
43769
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(40094);
|
|
43757
43770
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(4823);
|
|
43758
43771
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(25810);
|
|
43759
|
-
/* harmony import */ var
|
|
43772
|
+
/* harmony import */ var _ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(90594);
|
|
43773
|
+
/* harmony import */ var _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(21544);
|
|
43774
|
+
|
|
43760
43775
|
|
|
43761
43776
|
// Transform context passed through transformation
|
|
43762
43777
|
// Node with type property and flat position properties
|
|
@@ -43783,14 +43798,17 @@ const findFirst = (node, path) => {
|
|
|
43783
43798
|
// detect indent from first nested block mapping (stream > document > mapping > keyValuePair > mapping)
|
|
43784
43799
|
const detectIndent = node => {
|
|
43785
43800
|
const nested = findFirst(node, ['document', 'mapping', 'keyValuePair', 'mapping']);
|
|
43786
|
-
if (nested?.styleGroup ===
|
|
43801
|
+
if (nested?.styleGroup === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_10__.YamlStyleGroup.Block && typeof nested.startCharacter === 'number' && nested.startCharacter > 0) {
|
|
43787
43802
|
return nested.startCharacter;
|
|
43788
43803
|
}
|
|
43789
43804
|
return 2;
|
|
43790
43805
|
};
|
|
43791
43806
|
|
|
43792
|
-
// strip leading '#' from each line of comment text; yaml library adds '#' during
|
|
43793
|
-
|
|
43807
|
+
// strip leading '#' from each line of comment text; yaml library adds '#' during
|
|
43808
|
+
// stringification; a bare '#' becomes a single space — the yaml library's encoding
|
|
43809
|
+
// for an empty comment, which its stringifier turns back into '#' (plain '' would
|
|
43810
|
+
// be dropped)
|
|
43811
|
+
const stripCommentHash = text => text.split('\n').map(line => line === '#' ? ' ' : line.replace(/^#/, '')).join('\n');
|
|
43794
43812
|
|
|
43795
43813
|
// collect comment texts from raw AST children, indexed by position relative to non-comment siblings
|
|
43796
43814
|
|
|
@@ -43860,6 +43878,7 @@ const setYamlStyleProp = (element, key, value) => {
|
|
|
43860
43878
|
yaml[key] = value;
|
|
43861
43879
|
element.style.yaml = yaml;
|
|
43862
43880
|
};
|
|
43881
|
+
const getYamlStyleProp = (element, key) => element.style?.yaml?.[key];
|
|
43863
43882
|
|
|
43864
43883
|
// apply collected comments to transformed ApiDOM elements
|
|
43865
43884
|
const applyComments = (elements, comments) => {
|
|
@@ -43990,6 +44009,17 @@ const transformChildren = (children, ctx) => {
|
|
|
43990
44009
|
return results;
|
|
43991
44010
|
};
|
|
43992
44011
|
|
|
44012
|
+
// stream comments that precede the first document, joined; null when there are none
|
|
44013
|
+
// (stream children are in source order, so everything before the document node qualifies)
|
|
44014
|
+
const collectPreDocumentComments = node => {
|
|
44015
|
+
const texts = [];
|
|
44016
|
+
for (const child of node.children) {
|
|
44017
|
+
if ((0,_ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_9__.isDocument)(child)) break;
|
|
44018
|
+
if ((0,_ast_nodes_predicates_mjs__WEBPACK_IMPORTED_MODULE_9__.isComment)(child)) texts.push(stripCommentHash(child.content));
|
|
44019
|
+
}
|
|
44020
|
+
return texts.length > 0 ? texts.join('\n') : null;
|
|
44021
|
+
};
|
|
44022
|
+
|
|
43993
44023
|
// Stream: Wraps transformed children in ParseResultElement
|
|
43994
44024
|
const transformStream = (node, ctx) => {
|
|
43995
44025
|
// detect indent from the stream structure (only needed for style preservation)
|
|
@@ -44011,6 +44041,16 @@ const transformStream = (node, ctx) => {
|
|
|
44011
44041
|
if (elements.length > 0) {
|
|
44012
44042
|
const resultElement = elements[0];
|
|
44013
44043
|
resultElement.classes.push('result');
|
|
44044
|
+
|
|
44045
|
+
// stream comments before the first document belong above the result element;
|
|
44046
|
+
// capture them as commentBefore so style round-trips can re-emit them
|
|
44047
|
+
if (ctx.style) {
|
|
44048
|
+
const preDocumentComments = collectPreDocumentComments(node);
|
|
44049
|
+
if (preDocumentComments !== null) {
|
|
44050
|
+
const existing = getYamlStyleProp(resultElement, 'commentBefore');
|
|
44051
|
+
setYamlStyleProp(resultElement, 'commentBefore', typeof existing === 'string' ? `${preDocumentComments}\n${existing}` : preDocumentComments);
|
|
44052
|
+
}
|
|
44053
|
+
}
|
|
44014
44054
|
}
|
|
44015
44055
|
|
|
44016
44056
|
// Add collected annotations
|
|
@@ -44046,7 +44086,7 @@ const transformCollection = (element, node, ctx) => {
|
|
|
44046
44086
|
const typedNode = node;
|
|
44047
44087
|
const children = node.children || [];
|
|
44048
44088
|
if (ctx.style) {
|
|
44049
|
-
if (ctx.flowCollectionPadding === null && node.styleGroup ===
|
|
44089
|
+
if (ctx.flowCollectionPadding === null && node.styleGroup === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_10__.YamlStyleGroup.Flow) {
|
|
44050
44090
|
ctx.flowCollectionPadding = detectFlowPadding(typedNode);
|
|
44051
44091
|
}
|
|
44052
44092
|
const comments = collectComments(children, typedNode.startCharacter);
|
|
@@ -44112,7 +44152,7 @@ const transformScalar = (node, ctx) => {
|
|
|
44112
44152
|
const element = ctx.namespace.toElement(node.content);
|
|
44113
44153
|
|
|
44114
44154
|
// Translate style information about empty nodes
|
|
44115
|
-
if (node.content === '' && node.style ===
|
|
44155
|
+
if (node.content === '' && node.style === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_10__.YamlStyle.Plain) {
|
|
44116
44156
|
element.classes.push('yaml-e-node');
|
|
44117
44157
|
element.classes.push('yaml-e-scalar');
|
|
44118
44158
|
}
|
|
@@ -46328,7 +46368,7 @@ const forEach = (element, options) => {
|
|
|
46328
46368
|
callback = options.callback ?? (() => {});
|
|
46329
46369
|
predicate = options.predicate ?? (() => true);
|
|
46330
46370
|
}
|
|
46331
|
-
(0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
|
|
46371
|
+
;(0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
|
|
46332
46372
|
enter(path) {
|
|
46333
46373
|
if (predicate(path)) {
|
|
46334
46374
|
callback(path);
|