@speclynx/apidom-parser-adapter-openapi-yaml-2 2.10.3 → 2.12.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.
|
@@ -11953,6 +11953,53 @@ var both = /*#__PURE__*/(0,_internal_curry2_js__WEBPACK_IMPORTED_MODULE_0__["def
|
|
|
11953
11953
|
|
|
11954
11954
|
/***/ },
|
|
11955
11955
|
|
|
11956
|
+
/***/ 8138
|
|
11957
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
11958
|
+
|
|
11959
|
+
"use strict";
|
|
11960
|
+
__webpack_require__.r(__webpack_exports__);
|
|
11961
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
11962
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
11963
|
+
/* harmony export */ });
|
|
11964
|
+
/* harmony import */ var _internal_clone_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8575);
|
|
11965
|
+
/* harmony import */ var _internal_curry1_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(18938);
|
|
11966
|
+
|
|
11967
|
+
|
|
11968
|
+
|
|
11969
|
+
/**
|
|
11970
|
+
* Creates a deep copy of the source that can be used in place of the source
|
|
11971
|
+
* object without retaining any references to it.
|
|
11972
|
+
* The source object may contain (nested) `Array`s and `Object`s,
|
|
11973
|
+
* `Number`s, `String`s, `Boolean`s and `Date`s.
|
|
11974
|
+
* `Function`s are assigned by reference rather than copied.
|
|
11975
|
+
*
|
|
11976
|
+
* Dispatches to a `clone` method if present.
|
|
11977
|
+
*
|
|
11978
|
+
* Note that if the source object has multiple nodes that share a reference,
|
|
11979
|
+
* the returned object will have the same structure, but the references will
|
|
11980
|
+
* be pointed to the location within the cloned value.
|
|
11981
|
+
*
|
|
11982
|
+
* @func
|
|
11983
|
+
* @memberOf R
|
|
11984
|
+
* @since v0.1.0
|
|
11985
|
+
* @category Object
|
|
11986
|
+
* @sig {*} -> {*}
|
|
11987
|
+
* @param {*} value The object or array to clone
|
|
11988
|
+
* @return {*} A deeply cloned copy of `val`
|
|
11989
|
+
* @example
|
|
11990
|
+
*
|
|
11991
|
+
* const objects = [{}, {}, {}];
|
|
11992
|
+
* const objectsClone = R.clone(objects);
|
|
11993
|
+
* objects === objectsClone; //=> false
|
|
11994
|
+
* objects[0] === objectsClone[0]; //=> false
|
|
11995
|
+
*/
|
|
11996
|
+
var clone = /*#__PURE__*/(0,_internal_curry1_js__WEBPACK_IMPORTED_MODULE_1__["default"])(function clone(value) {
|
|
11997
|
+
return value != null && typeof value.clone === 'function' ? value.clone() : (0,_internal_clone_js__WEBPACK_IMPORTED_MODULE_0__["default"])(value, true);
|
|
11998
|
+
});
|
|
11999
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (clone);
|
|
12000
|
+
|
|
12001
|
+
/***/ },
|
|
12002
|
+
|
|
11956
12003
|
/***/ 68199
|
|
11957
12004
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
11958
12005
|
|
|
@@ -13506,6 +13553,132 @@ function _checkForMethod(methodname, fn) {
|
|
|
13506
13553
|
|
|
13507
13554
|
/***/ },
|
|
13508
13555
|
|
|
13556
|
+
/***/ 8575
|
|
13557
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
13558
|
+
|
|
13559
|
+
"use strict";
|
|
13560
|
+
__webpack_require__.r(__webpack_exports__);
|
|
13561
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
13562
|
+
/* harmony export */ "default": () => (/* binding */ _clone)
|
|
13563
|
+
/* harmony export */ });
|
|
13564
|
+
/* harmony import */ var _cloneRegExp_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31254);
|
|
13565
|
+
/* harmony import */ var _type_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(60963);
|
|
13566
|
+
|
|
13567
|
+
|
|
13568
|
+
|
|
13569
|
+
/**
|
|
13570
|
+
* Copies an object.
|
|
13571
|
+
*
|
|
13572
|
+
* @private
|
|
13573
|
+
* @param {*} value The value to be copied
|
|
13574
|
+
* @param {Boolean} deep Whether or not to perform deep cloning.
|
|
13575
|
+
* @return {*} The copied value.
|
|
13576
|
+
*/
|
|
13577
|
+
function _clone(value, deep, map) {
|
|
13578
|
+
map || (map = new _ObjectMap());
|
|
13579
|
+
|
|
13580
|
+
// this avoids the slower switch with a quick if decision removing some milliseconds in each run.
|
|
13581
|
+
if (_isPrimitive(value)) {
|
|
13582
|
+
return value;
|
|
13583
|
+
}
|
|
13584
|
+
var copy = function copy(copiedValue) {
|
|
13585
|
+
// Check for circular and same references on the object graph and return its corresponding clone.
|
|
13586
|
+
var cachedCopy = map.get(value);
|
|
13587
|
+
if (cachedCopy) {
|
|
13588
|
+
return cachedCopy;
|
|
13589
|
+
}
|
|
13590
|
+
map.set(value, copiedValue);
|
|
13591
|
+
for (var key in value) {
|
|
13592
|
+
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
|
13593
|
+
copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
|
|
13594
|
+
}
|
|
13595
|
+
}
|
|
13596
|
+
return copiedValue;
|
|
13597
|
+
};
|
|
13598
|
+
switch ((0,_type_js__WEBPACK_IMPORTED_MODULE_1__["default"])(value)) {
|
|
13599
|
+
case 'Object':
|
|
13600
|
+
return copy(Object.create(Object.getPrototypeOf(value)));
|
|
13601
|
+
case 'Array':
|
|
13602
|
+
return copy(Array(value.length));
|
|
13603
|
+
case 'Date':
|
|
13604
|
+
return new Date(value.valueOf());
|
|
13605
|
+
case 'RegExp':
|
|
13606
|
+
return (0,_cloneRegExp_js__WEBPACK_IMPORTED_MODULE_0__["default"])(value);
|
|
13607
|
+
case 'Int8Array':
|
|
13608
|
+
case 'Uint8Array':
|
|
13609
|
+
case 'Uint8ClampedArray':
|
|
13610
|
+
case 'Int16Array':
|
|
13611
|
+
case 'Uint16Array':
|
|
13612
|
+
case 'Int32Array':
|
|
13613
|
+
case 'Uint32Array':
|
|
13614
|
+
case 'Float32Array':
|
|
13615
|
+
case 'Float64Array':
|
|
13616
|
+
case 'BigInt64Array':
|
|
13617
|
+
case 'BigUint64Array':
|
|
13618
|
+
return value.slice();
|
|
13619
|
+
default:
|
|
13620
|
+
return value;
|
|
13621
|
+
}
|
|
13622
|
+
}
|
|
13623
|
+
function _isPrimitive(param) {
|
|
13624
|
+
var type = typeof param;
|
|
13625
|
+
return param == null || type != 'object' && type != 'function';
|
|
13626
|
+
}
|
|
13627
|
+
var _ObjectMap = /*#__PURE__*/function () {
|
|
13628
|
+
function _ObjectMap() {
|
|
13629
|
+
this.map = {};
|
|
13630
|
+
this.length = 0;
|
|
13631
|
+
}
|
|
13632
|
+
_ObjectMap.prototype.set = function (key, value) {
|
|
13633
|
+
var hashedKey = this.hash(key);
|
|
13634
|
+
var bucket = this.map[hashedKey];
|
|
13635
|
+
if (!bucket) {
|
|
13636
|
+
this.map[hashedKey] = bucket = [];
|
|
13637
|
+
}
|
|
13638
|
+
bucket.push([key, value]);
|
|
13639
|
+
this.length += 1;
|
|
13640
|
+
};
|
|
13641
|
+
_ObjectMap.prototype.hash = function (key) {
|
|
13642
|
+
var hashedKey = [];
|
|
13643
|
+
for (var value in key) {
|
|
13644
|
+
hashedKey.push(Object.prototype.toString.call(key[value]));
|
|
13645
|
+
}
|
|
13646
|
+
return hashedKey.join();
|
|
13647
|
+
};
|
|
13648
|
+
_ObjectMap.prototype.get = function (key) {
|
|
13649
|
+
/**
|
|
13650
|
+
* depending on the number of objects to be cloned is faster to just iterate over the items in the map just because the hash function is so costly,
|
|
13651
|
+
* on my tests this number is 180, anything above that using the hash function is faster.
|
|
13652
|
+
*/
|
|
13653
|
+
if (this.length <= 180) {
|
|
13654
|
+
for (var p in this.map) {
|
|
13655
|
+
var bucket = this.map[p];
|
|
13656
|
+
for (var i = 0; i < bucket.length; i += 1) {
|
|
13657
|
+
var element = bucket[i];
|
|
13658
|
+
if (element[0] === key) {
|
|
13659
|
+
return element[1];
|
|
13660
|
+
}
|
|
13661
|
+
}
|
|
13662
|
+
}
|
|
13663
|
+
return;
|
|
13664
|
+
}
|
|
13665
|
+
var hashedKey = this.hash(key);
|
|
13666
|
+
var bucket = this.map[hashedKey];
|
|
13667
|
+
if (!bucket) {
|
|
13668
|
+
return;
|
|
13669
|
+
}
|
|
13670
|
+
for (var i = 0; i < bucket.length; i += 1) {
|
|
13671
|
+
var element = bucket[i];
|
|
13672
|
+
if (element[0] === key) {
|
|
13673
|
+
return element[1];
|
|
13674
|
+
}
|
|
13675
|
+
}
|
|
13676
|
+
};
|
|
13677
|
+
return _ObjectMap;
|
|
13678
|
+
}();
|
|
13679
|
+
|
|
13680
|
+
/***/ },
|
|
13681
|
+
|
|
13509
13682
|
/***/ 31254
|
|
13510
13683
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
13511
13684
|
|
|
@@ -30508,6 +30681,7 @@ const predicates = {
|
|
|
30508
30681
|
isCommentElement: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isCommentElement,
|
|
30509
30682
|
isParseResultElement: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isParseResultElement,
|
|
30510
30683
|
isSourceMapElement: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isSourceMapElement,
|
|
30684
|
+
hasElementStyle: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.hasElementStyle,
|
|
30511
30685
|
hasElementSourceMap: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.hasElementSourceMap,
|
|
30512
30686
|
includesSymbols: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.includesSymbols,
|
|
30513
30687
|
includesClasses: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.includesClasses
|
|
@@ -30579,7 +30753,19 @@ const resolveSpecification = specification => {
|
|
|
30579
30753
|
if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_5__["default"])(val) && (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])('$ref', val) && (0,ramda__WEBPACK_IMPORTED_MODULE_3__["default"])(ramda_adjunct__WEBPACK_IMPORTED_MODULE_4__["default"], '$ref', val)) {
|
|
30580
30754
|
const $ref = (0,ramda__WEBPACK_IMPORTED_MODULE_2__["default"])(['$ref'], val);
|
|
30581
30755
|
const pointer = (0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_6__["default"])('#/', $ref);
|
|
30582
|
-
|
|
30756
|
+
const resolved = (0,ramda__WEBPACK_IMPORTED_MODULE_2__["default"])(pointer.split('/'), root);
|
|
30757
|
+
// merge extra properties (e.g. alias) from the $ref object into the resolved value
|
|
30758
|
+
const {
|
|
30759
|
+
$ref: _,
|
|
30760
|
+
...rest
|
|
30761
|
+
} = val;
|
|
30762
|
+
if (Object.keys(rest).length > 0 && (0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_5__["default"])(resolved)) {
|
|
30763
|
+
return {
|
|
30764
|
+
...resolved,
|
|
30765
|
+
...rest
|
|
30766
|
+
};
|
|
30767
|
+
}
|
|
30768
|
+
return resolved;
|
|
30583
30769
|
}
|
|
30584
30770
|
if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_5__["default"])(val)) {
|
|
30585
30771
|
return traverse(val, root, newPath);
|
|
@@ -31202,20 +31388,22 @@ class ShallowCloneError extends _CloneError_mjs__WEBPACK_IMPORTED_MODULE_0__["de
|
|
|
31202
31388
|
"use strict";
|
|
31203
31389
|
__webpack_require__.r(__webpack_exports__);
|
|
31204
31390
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
31205
|
-
/* harmony export */ CloneError: () => (/* reexport safe */
|
|
31206
|
-
/* harmony export */ DeepCloneError: () => (/* reexport safe */
|
|
31207
|
-
/* harmony export */ ShallowCloneError: () => (/* reexport safe */
|
|
31391
|
+
/* harmony export */ CloneError: () => (/* reexport safe */ _errors_CloneError_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]),
|
|
31392
|
+
/* harmony export */ DeepCloneError: () => (/* reexport safe */ _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]),
|
|
31393
|
+
/* harmony export */ ShallowCloneError: () => (/* reexport safe */ _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]),
|
|
31208
31394
|
/* harmony export */ cloneDeep: () => (/* binding */ cloneDeep),
|
|
31209
31395
|
/* harmony export */ cloneShallow: () => (/* binding */ cloneShallow)
|
|
31210
31396
|
/* harmony export */ });
|
|
31211
|
-
/* harmony import */ var
|
|
31212
|
-
/* harmony import */ var
|
|
31213
|
-
/* harmony import */ var
|
|
31214
|
-
/* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
|
|
31215
|
-
/* harmony import */ var
|
|
31216
|
-
/* harmony import */ var
|
|
31217
|
-
/* harmony import */ var
|
|
31218
|
-
/* harmony import */ var
|
|
31397
|
+
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8138);
|
|
31398
|
+
/* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(38504);
|
|
31399
|
+
/* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(36663);
|
|
31400
|
+
/* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(18252);
|
|
31401
|
+
/* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(25162);
|
|
31402
|
+
/* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(25810);
|
|
31403
|
+
/* harmony import */ var _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(95018);
|
|
31404
|
+
/* harmony import */ var _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(3686);
|
|
31405
|
+
/* harmony import */ var _errors_CloneError_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(3772);
|
|
31406
|
+
|
|
31219
31407
|
|
|
31220
31408
|
|
|
31221
31409
|
|
|
@@ -31248,9 +31436,9 @@ const cloneDeepElement = (element, options) => {
|
|
|
31248
31436
|
} = element;
|
|
31249
31437
|
if (Array.isArray(content)) {
|
|
31250
31438
|
copy.content = content.map(el => cloneDeepElement(el, passThroughOptions));
|
|
31251
|
-
} else if ((0,
|
|
31439
|
+
} else if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(content)) {
|
|
31252
31440
|
copy.content = cloneDeepElement(content, passThroughOptions);
|
|
31253
|
-
} else if (content instanceof
|
|
31441
|
+
} else if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
31254
31442
|
copy.content = cloneDeepKeyValuePair(content, passThroughOptions);
|
|
31255
31443
|
} else {
|
|
31256
31444
|
copy.content = content;
|
|
@@ -31274,7 +31462,7 @@ const cloneDeepKeyValuePair = (kvp, options) => {
|
|
|
31274
31462
|
} = kvp;
|
|
31275
31463
|
const keyCopy = key !== undefined ? cloneDeepElement(key, passThroughOptions) : undefined;
|
|
31276
31464
|
const valueCopy = value !== undefined ? cloneDeepElement(value, passThroughOptions) : undefined;
|
|
31277
|
-
const copy = new
|
|
31465
|
+
const copy = new _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"](keyCopy, valueCopy);
|
|
31278
31466
|
visited.set(kvp, copy);
|
|
31279
31467
|
return copy;
|
|
31280
31468
|
};
|
|
@@ -31290,7 +31478,7 @@ const cloneDeepObjectSlice = (slice, options) => {
|
|
|
31290
31478
|
return visited.get(slice);
|
|
31291
31479
|
}
|
|
31292
31480
|
const items = [...slice].map(element => cloneDeepElement(element, passThroughOptions));
|
|
31293
|
-
const copy = new
|
|
31481
|
+
const copy = new _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"](items);
|
|
31294
31482
|
visited.set(slice, copy);
|
|
31295
31483
|
return copy;
|
|
31296
31484
|
};
|
|
@@ -31301,16 +31489,16 @@ const cloneDeepObjectSlice = (slice, options) => {
|
|
|
31301
31489
|
* @public
|
|
31302
31490
|
*/
|
|
31303
31491
|
const cloneDeep = (value, options = {}) => {
|
|
31304
|
-
if (value instanceof
|
|
31492
|
+
if (value instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
31305
31493
|
return cloneDeepKeyValuePair(value, options);
|
|
31306
31494
|
}
|
|
31307
|
-
if (value instanceof
|
|
31495
|
+
if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
|
|
31308
31496
|
return cloneDeepObjectSlice(value, options);
|
|
31309
31497
|
}
|
|
31310
|
-
if ((0,
|
|
31498
|
+
if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(value)) {
|
|
31311
31499
|
return cloneDeepElement(value, options);
|
|
31312
31500
|
}
|
|
31313
|
-
throw new
|
|
31501
|
+
throw new _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]("Value provided to cloneDeep function couldn't be cloned", {
|
|
31314
31502
|
value
|
|
31315
31503
|
});
|
|
31316
31504
|
};
|
|
@@ -31326,11 +31514,11 @@ const cloneShallowKeyValuePair = keyValuePair => {
|
|
|
31326
31514
|
key,
|
|
31327
31515
|
value
|
|
31328
31516
|
} = keyValuePair;
|
|
31329
|
-
return new
|
|
31517
|
+
return new _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"](key, value);
|
|
31330
31518
|
};
|
|
31331
31519
|
const cloneShallowObjectSlice = objectSlice => {
|
|
31332
31520
|
const items = [...objectSlice];
|
|
31333
|
-
return new
|
|
31521
|
+
return new _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"](items);
|
|
31334
31522
|
};
|
|
31335
31523
|
const cloneShallowElement = element => {
|
|
31336
31524
|
const Ctor = element.constructor;
|
|
@@ -31342,17 +31530,20 @@ const cloneShallowElement = element => {
|
|
|
31342
31530
|
if (!element.isAttributesEmpty) {
|
|
31343
31531
|
copy.attributes = cloneDeep(element.attributes);
|
|
31344
31532
|
}
|
|
31345
|
-
if ((0,
|
|
31346
|
-
|
|
31533
|
+
if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.hasElementSourceMap)(element)) {
|
|
31534
|
+
_elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_5__["default"].transfer(element, copy);
|
|
31535
|
+
}
|
|
31536
|
+
if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.hasElementStyle)(element)) {
|
|
31537
|
+
copy.style = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(element.style);
|
|
31347
31538
|
}
|
|
31348
31539
|
const {
|
|
31349
31540
|
content
|
|
31350
31541
|
} = element;
|
|
31351
|
-
if ((0,
|
|
31542
|
+
if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(content)) {
|
|
31352
31543
|
copy.content = cloneShallowElement(content);
|
|
31353
31544
|
} else if (Array.isArray(content)) {
|
|
31354
31545
|
copy.content = [...content];
|
|
31355
|
-
} else if (content instanceof
|
|
31546
|
+
} else if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
31356
31547
|
copy.content = cloneShallowKeyValuePair(content);
|
|
31357
31548
|
} else {
|
|
31358
31549
|
copy.content = content;
|
|
@@ -31367,16 +31558,16 @@ const cloneShallowElement = element => {
|
|
|
31367
31558
|
* @public
|
|
31368
31559
|
*/
|
|
31369
31560
|
const cloneShallow = value => {
|
|
31370
|
-
if (value instanceof
|
|
31561
|
+
if (value instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
31371
31562
|
return cloneShallowKeyValuePair(value);
|
|
31372
31563
|
}
|
|
31373
|
-
if (value instanceof
|
|
31564
|
+
if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
|
|
31374
31565
|
return cloneShallowObjectSlice(value);
|
|
31375
31566
|
}
|
|
31376
|
-
if ((0,
|
|
31567
|
+
if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(value)) {
|
|
31377
31568
|
return cloneShallowElement(value);
|
|
31378
31569
|
}
|
|
31379
|
-
throw new
|
|
31570
|
+
throw new _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]("Value provided to cloneShallow function couldn't be cloned", {
|
|
31380
31571
|
value
|
|
31381
31572
|
});
|
|
31382
31573
|
};
|
|
@@ -31803,6 +31994,66 @@ function unpackSourceMap(packed) {
|
|
|
31803
31994
|
|
|
31804
31995
|
/***/ },
|
|
31805
31996
|
|
|
31997
|
+
/***/ 49686
|
|
31998
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
31999
|
+
|
|
32000
|
+
"use strict";
|
|
32001
|
+
__webpack_require__.r(__webpack_exports__);
|
|
32002
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
32003
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
32004
|
+
/* harmony export */ });
|
|
32005
|
+
/* harmony import */ var _primitives_ObjectElement_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(97071);
|
|
32006
|
+
|
|
32007
|
+
/**
|
|
32008
|
+
* Shape with optional style property.
|
|
32009
|
+
* @public
|
|
32010
|
+
*/
|
|
32011
|
+
/**
|
|
32012
|
+
* StyleElement stores format-specific style information for round-trip preservation.
|
|
32013
|
+
*
|
|
32014
|
+
* The style data is stored as a plain object with format-specific namespaces
|
|
32015
|
+
* (e.g., `yaml`, `json`). This element exists only during serialization/deserialization
|
|
32016
|
+
* (refract format) - in memory, style lives directly on `element.style`.
|
|
32017
|
+
*
|
|
32018
|
+
* Follows the same pattern as SourceMapElement with __mappings__.
|
|
32019
|
+
*
|
|
32020
|
+
* @public
|
|
32021
|
+
*/
|
|
32022
|
+
class StyleElement extends _primitives_ObjectElement_mjs__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
32023
|
+
constructor(content, meta, attributes) {
|
|
32024
|
+
super(content, meta, attributes);
|
|
32025
|
+
this.element = '__styles__';
|
|
32026
|
+
}
|
|
32027
|
+
|
|
32028
|
+
/**
|
|
32029
|
+
* Transfers style property from one element to another.
|
|
32030
|
+
*/
|
|
32031
|
+
static transfer(from, to) {
|
|
32032
|
+
to.style = from.style;
|
|
32033
|
+
}
|
|
32034
|
+
|
|
32035
|
+
/**
|
|
32036
|
+
* Creates a StyleElement from an element's style property.
|
|
32037
|
+
* Returns undefined if the element has no style.
|
|
32038
|
+
*/
|
|
32039
|
+
static from(source) {
|
|
32040
|
+
if (!source.style) {
|
|
32041
|
+
return undefined;
|
|
32042
|
+
}
|
|
32043
|
+
return new StyleElement(source.style);
|
|
32044
|
+
}
|
|
32045
|
+
|
|
32046
|
+
/**
|
|
32047
|
+
* Restores the style property on the target element from this StyleElement.
|
|
32048
|
+
*/
|
|
32049
|
+
applyTo(target) {
|
|
32050
|
+
target.style = this.toValue();
|
|
32051
|
+
}
|
|
32052
|
+
}
|
|
32053
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (StyleElement);
|
|
32054
|
+
|
|
32055
|
+
/***/ },
|
|
32056
|
+
|
|
31806
32057
|
/***/ 96911
|
|
31807
32058
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
31808
32059
|
|
|
@@ -31867,6 +32118,7 @@ const isSourceMapElement = element => element instanceof _elements_SourceMap_mjs
|
|
|
31867
32118
|
__webpack_require__.r(__webpack_exports__);
|
|
31868
32119
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
31869
32120
|
/* harmony export */ hasElementSourceMap: () => (/* binding */ hasElementSourceMap),
|
|
32121
|
+
/* harmony export */ hasElementStyle: () => (/* binding */ hasElementStyle),
|
|
31870
32122
|
/* harmony export */ includesClasses: () => (/* binding */ includesClasses),
|
|
31871
32123
|
/* harmony export */ includesSymbols: () => (/* binding */ includesSymbols),
|
|
31872
32124
|
/* harmony export */ isAnnotationElement: () => (/* reexport safe */ _elements_mjs__WEBPACK_IMPORTED_MODULE_1__.isAnnotationElement),
|
|
@@ -31891,6 +32143,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
31891
32143
|
|
|
31892
32144
|
|
|
31893
32145
|
|
|
32146
|
+
/**
|
|
32147
|
+
* Checks if an element has format-specific style information.
|
|
32148
|
+
* @public
|
|
32149
|
+
*/
|
|
32150
|
+
const hasElementStyle = element => {
|
|
32151
|
+
return element.style !== undefined;
|
|
32152
|
+
};
|
|
32153
|
+
|
|
31894
32154
|
/**
|
|
31895
32155
|
* Checks if an element has complete source position information.
|
|
31896
32156
|
* Returns true only if all 6 position properties are numbers.
|
|
@@ -32432,6 +32692,12 @@ class Element {
|
|
|
32432
32692
|
*/
|
|
32433
32693
|
parent;
|
|
32434
32694
|
|
|
32695
|
+
/**
|
|
32696
|
+
* Format-specific style information for round-trip preservation.
|
|
32697
|
+
* Each format owns its own namespace (e.g., `yaml`, `json`).
|
|
32698
|
+
*/
|
|
32699
|
+
style;
|
|
32700
|
+
|
|
32435
32701
|
// ============================================================================
|
|
32436
32702
|
// Source Position (LSP-compatible, TextDocument-compatible, UTF-16 code units)
|
|
32437
32703
|
// web-tree-sitter automatically provides position data in UTF-16 code units.
|
|
@@ -32640,7 +32906,13 @@ class Element {
|
|
|
32640
32906
|
|
|
32641
32907
|
/** Unique identifier for this element. */
|
|
32642
32908
|
get id() {
|
|
32643
|
-
|
|
32909
|
+
if (this.isFrozen) {
|
|
32910
|
+
return this.getMetaProperty('id', '');
|
|
32911
|
+
}
|
|
32912
|
+
if (!this.hasMetaProperty('id')) {
|
|
32913
|
+
this.setMetaProperty('id', '');
|
|
32914
|
+
}
|
|
32915
|
+
return this.meta.get('id');
|
|
32644
32916
|
}
|
|
32645
32917
|
set id(value) {
|
|
32646
32918
|
this.setMetaProperty('id', value);
|
|
@@ -32648,7 +32920,13 @@ class Element {
|
|
|
32648
32920
|
|
|
32649
32921
|
/** CSS-like class names. */
|
|
32650
32922
|
get classes() {
|
|
32651
|
-
|
|
32923
|
+
if (this.isFrozen) {
|
|
32924
|
+
return this.getMetaProperty('classes', []);
|
|
32925
|
+
}
|
|
32926
|
+
if (!this.hasMetaProperty('classes')) {
|
|
32927
|
+
this.setMetaProperty('classes', []);
|
|
32928
|
+
}
|
|
32929
|
+
return this.meta.get('classes');
|
|
32652
32930
|
}
|
|
32653
32931
|
set classes(value) {
|
|
32654
32932
|
this.setMetaProperty('classes', value);
|
|
@@ -32656,7 +32934,13 @@ class Element {
|
|
|
32656
32934
|
|
|
32657
32935
|
/** Hyperlinks associated with this element. */
|
|
32658
32936
|
get links() {
|
|
32659
|
-
|
|
32937
|
+
if (this.isFrozen) {
|
|
32938
|
+
return this.getMetaProperty('links', []);
|
|
32939
|
+
}
|
|
32940
|
+
if (!this.hasMetaProperty('links')) {
|
|
32941
|
+
this.setMetaProperty('links', []);
|
|
32942
|
+
}
|
|
32943
|
+
return this.meta.get('links');
|
|
32660
32944
|
}
|
|
32661
32945
|
set links(value) {
|
|
32662
32946
|
this.setMetaProperty('links', value);
|
|
@@ -32807,16 +33091,26 @@ class Element {
|
|
|
32807
33091
|
}
|
|
32808
33092
|
|
|
32809
33093
|
/**
|
|
32810
|
-
* Gets a meta property
|
|
33094
|
+
* Gets a meta property.
|
|
33095
|
+
*
|
|
33096
|
+
* When the property doesn't exist:
|
|
33097
|
+
* - With defaultValue: returns a new refracted element instance (not cached)
|
|
33098
|
+
* - Without defaultValue: returns undefined
|
|
33099
|
+
*
|
|
33100
|
+
* Note: Each call with a default creates a new instance. Use setMetaProperty
|
|
33101
|
+
* first if you need reference equality across multiple accesses.
|
|
32811
33102
|
*/
|
|
33103
|
+
|
|
32812
33104
|
getMetaProperty(name, defaultValue) {
|
|
32813
|
-
if (!this.
|
|
32814
|
-
if (
|
|
32815
|
-
|
|
33105
|
+
if (!this.hasMetaProperty(name)) {
|
|
33106
|
+
if (defaultValue === undefined) {
|
|
33107
|
+
return undefined;
|
|
33108
|
+
}
|
|
33109
|
+
const element = this.refract(defaultValue);
|
|
33110
|
+
if (element && this.isFrozen) {
|
|
32816
33111
|
element.freeze();
|
|
32817
|
-
return element;
|
|
32818
33112
|
}
|
|
32819
|
-
|
|
33113
|
+
return element;
|
|
32820
33114
|
}
|
|
32821
33115
|
return this.meta.get(name);
|
|
32822
33116
|
}
|
|
@@ -33293,17 +33587,18 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
33293
33587
|
/* harmony export */ CollectionElement: () => (/* reexport safe */ _primitives_CollectionElement_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]),
|
|
33294
33588
|
/* harmony export */ CommentElement: () => (/* reexport safe */ _elements_Comment_mjs__WEBPACK_IMPORTED_MODULE_12__["default"]),
|
|
33295
33589
|
/* harmony export */ Element: () => (/* reexport safe */ _primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"]),
|
|
33296
|
-
/* harmony export */ KeyValuePair: () => (/* reexport safe */
|
|
33590
|
+
/* harmony export */ KeyValuePair: () => (/* reexport safe */ _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_17__["default"]),
|
|
33297
33591
|
/* harmony export */ LinkElement: () => (/* reexport safe */ _elements_LinkElement_mjs__WEBPACK_IMPORTED_MODULE_9__["default"]),
|
|
33298
33592
|
/* harmony export */ MemberElement: () => (/* reexport safe */ _primitives_MemberElement_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]),
|
|
33299
33593
|
/* harmony export */ NullElement: () => (/* reexport safe */ _primitives_NullElement_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]),
|
|
33300
33594
|
/* harmony export */ NumberElement: () => (/* reexport safe */ _primitives_NumberElement_mjs__WEBPACK_IMPORTED_MODULE_4__["default"]),
|
|
33301
33595
|
/* harmony export */ ObjectElement: () => (/* reexport safe */ _primitives_ObjectElement_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]),
|
|
33302
|
-
/* harmony export */ ObjectSlice: () => (/* reexport safe */
|
|
33596
|
+
/* harmony export */ ObjectSlice: () => (/* reexport safe */ _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_16__["default"]),
|
|
33303
33597
|
/* harmony export */ ParseResultElement: () => (/* reexport safe */ _elements_ParseResult_mjs__WEBPACK_IMPORTED_MODULE_13__["default"]),
|
|
33304
33598
|
/* harmony export */ RefElement: () => (/* reexport safe */ _elements_RefElement_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]),
|
|
33305
33599
|
/* harmony export */ SourceMapElement: () => (/* reexport safe */ _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_14__["default"]),
|
|
33306
33600
|
/* harmony export */ StringElement: () => (/* reexport safe */ _primitives_StringElement_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]),
|
|
33601
|
+
/* harmony export */ StyleElement: () => (/* reexport safe */ _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_15__["default"]),
|
|
33307
33602
|
/* harmony export */ refract: () => (/* binding */ refract)
|
|
33308
33603
|
/* harmony export */ });
|
|
33309
33604
|
/* harmony import */ var _primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(60728);
|
|
@@ -33321,8 +33616,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
33321
33616
|
/* harmony import */ var _elements_Comment_mjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(40094);
|
|
33322
33617
|
/* harmony import */ var _elements_ParseResult_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(4823);
|
|
33323
33618
|
/* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(25810);
|
|
33324
|
-
/* harmony import */ var
|
|
33325
|
-
/* harmony import */ var
|
|
33619
|
+
/* harmony import */ var _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(49686);
|
|
33620
|
+
/* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(38504);
|
|
33621
|
+
/* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(36663);
|
|
33622
|
+
|
|
33326
33623
|
|
|
33327
33624
|
|
|
33328
33625
|
|
|
@@ -33409,6 +33706,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
33409
33706
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
33410
33707
|
/* harmony export */ });
|
|
33411
33708
|
/* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25810);
|
|
33709
|
+
/* harmony import */ var _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(49686);
|
|
33710
|
+
|
|
33412
33711
|
|
|
33413
33712
|
/**
|
|
33414
33713
|
* Serialized representation of an Element in JSON Refract format.
|
|
@@ -33467,6 +33766,17 @@ class JSONSerialiser {
|
|
|
33467
33766
|
payload.meta.__mappings__ = this.serialise(sourceMap);
|
|
33468
33767
|
}
|
|
33469
33768
|
}
|
|
33769
|
+
|
|
33770
|
+
// Serialize style as __styles__ in meta (skip for StyleElement itself)
|
|
33771
|
+
if (!(element instanceof _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])) {
|
|
33772
|
+
const styleElement = _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_1__["default"].from(element);
|
|
33773
|
+
if (styleElement) {
|
|
33774
|
+
if (!payload.meta) {
|
|
33775
|
+
payload.meta = {};
|
|
33776
|
+
}
|
|
33777
|
+
payload.meta.__styles__ = this.serialise(styleElement);
|
|
33778
|
+
}
|
|
33779
|
+
}
|
|
33470
33780
|
const content = this.serialiseContent(element.content);
|
|
33471
33781
|
if (content !== undefined) {
|
|
33472
33782
|
payload.content = content;
|
|
@@ -33487,15 +33797,18 @@ class JSONSerialiser {
|
|
|
33487
33797
|
element.element = value.element;
|
|
33488
33798
|
}
|
|
33489
33799
|
|
|
33490
|
-
// Extract __mappings__ without mutating input, filter remaining meta
|
|
33800
|
+
// Extract __mappings__ and __styles__ without mutating input, filter remaining meta
|
|
33491
33801
|
let mappingsDoc;
|
|
33802
|
+
let stylesDoc;
|
|
33492
33803
|
let metaToDeserialize = value.meta;
|
|
33493
|
-
if (value.meta?.__mappings__) {
|
|
33804
|
+
if (value.meta?.__mappings__ || value.meta?.__styles__) {
|
|
33494
33805
|
const {
|
|
33495
33806
|
__mappings__,
|
|
33807
|
+
__styles__,
|
|
33496
33808
|
...rest
|
|
33497
33809
|
} = value.meta;
|
|
33498
33810
|
mappingsDoc = __mappings__;
|
|
33811
|
+
stylesDoc = __styles__;
|
|
33499
33812
|
metaToDeserialize = Object.keys(rest).length > 0 ? rest : undefined;
|
|
33500
33813
|
}
|
|
33501
33814
|
if (metaToDeserialize) {
|
|
@@ -33507,6 +33820,12 @@ class JSONSerialiser {
|
|
|
33507
33820
|
const sourceMap = this.deserialise(mappingsDoc);
|
|
33508
33821
|
sourceMap.applyTo(element);
|
|
33509
33822
|
}
|
|
33823
|
+
|
|
33824
|
+
// Restore style from __styles__
|
|
33825
|
+
if (stylesDoc) {
|
|
33826
|
+
const styleElement = this.deserialise(stylesDoc);
|
|
33827
|
+
styleElement.applyTo(element);
|
|
33828
|
+
}
|
|
33510
33829
|
if (value.attributes) {
|
|
33511
33830
|
this.deserialiseObject(value.attributes, element.attributes);
|
|
33512
33831
|
}
|
|
@@ -34349,7 +34668,7 @@ const specification = {
|
|
|
34349
34668
|
fixedFields: {
|
|
34350
34669
|
// core vocabulary
|
|
34351
34670
|
id: {
|
|
34352
|
-
$
|
|
34671
|
+
$ref: '#/visitors/value',
|
|
34353
34672
|
alias: 'idField'
|
|
34354
34673
|
},
|
|
34355
34674
|
$schema: {
|
|
@@ -34631,6 +34950,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
34631
34950
|
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28400);
|
|
34632
34951
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(97071);
|
|
34633
34952
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25810);
|
|
34953
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(49686);
|
|
34634
34954
|
|
|
34635
34955
|
|
|
34636
34956
|
|
|
@@ -34658,6 +34978,7 @@ class Visitor {
|
|
|
34658
34978
|
to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(target, source);
|
|
34659
34979
|
}
|
|
34660
34980
|
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"].transfer(from, to);
|
|
34981
|
+
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"].transfer(from, to);
|
|
34661
34982
|
}
|
|
34662
34983
|
}
|
|
34663
34984
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Visitor);
|
|
@@ -39187,6 +39508,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
39187
39508
|
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28400);
|
|
39188
39509
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(97071);
|
|
39189
39510
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25810);
|
|
39511
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(49686);
|
|
39190
39512
|
|
|
39191
39513
|
|
|
39192
39514
|
|
|
@@ -39214,6 +39536,7 @@ class Visitor {
|
|
|
39214
39536
|
to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(target, source);
|
|
39215
39537
|
}
|
|
39216
39538
|
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"].transfer(from, to);
|
|
39539
|
+
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"].transfer(from, to);
|
|
39217
39540
|
}
|
|
39218
39541
|
}
|
|
39219
39542
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Visitor);
|
|
@@ -41280,16 +41603,21 @@ const detect = async (source, {
|
|
|
41280
41603
|
*/
|
|
41281
41604
|
const parse = async (source, {
|
|
41282
41605
|
sourceMap = false,
|
|
41606
|
+
style = false,
|
|
41283
41607
|
strict = false
|
|
41284
41608
|
} = {}) => {
|
|
41285
41609
|
if (strict && sourceMap) {
|
|
41286
41610
|
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_1__["default"]('Cannot use sourceMap with strict parsing. Strict parsing does not support source maps.');
|
|
41287
41611
|
}
|
|
41612
|
+
if (strict && style) {
|
|
41613
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_1__["default"]('Cannot use style with strict parsing. Strict parsing does not support style preservation.');
|
|
41614
|
+
}
|
|
41288
41615
|
if (strict) {
|
|
41289
41616
|
return _yaml_index_mjs__WEBPACK_IMPORTED_MODULE_2__.parse(source);
|
|
41290
41617
|
}
|
|
41291
41618
|
return _tree_sitter_index_mjs__WEBPACK_IMPORTED_MODULE_3__.parse(source, {
|
|
41292
|
-
sourceMap
|
|
41619
|
+
sourceMap,
|
|
41620
|
+
style
|
|
41293
41621
|
});
|
|
41294
41622
|
};
|
|
41295
41623
|
|
|
@@ -41364,12 +41692,14 @@ const detect = async source => {
|
|
|
41364
41692
|
* @public
|
|
41365
41693
|
*/
|
|
41366
41694
|
const parse = async (source, {
|
|
41367
|
-
sourceMap = false
|
|
41695
|
+
sourceMap = false,
|
|
41696
|
+
style = false
|
|
41368
41697
|
} = {}) => {
|
|
41369
41698
|
const cst = await (0,_lexical_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(source);
|
|
41370
41699
|
try {
|
|
41371
41700
|
return (0,_syntactic_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])(cst, {
|
|
41372
|
-
sourceMap
|
|
41701
|
+
sourceMap,
|
|
41702
|
+
style
|
|
41373
41703
|
});
|
|
41374
41704
|
} finally {
|
|
41375
41705
|
cst.delete();
|
|
@@ -41443,18 +41773,20 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
41443
41773
|
/* harmony import */ var _ast_Error_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33240);
|
|
41444
41774
|
/* harmony import */ var _ast_Literal_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(86951);
|
|
41445
41775
|
/* harmony import */ var _ast_ParseResult_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(88912);
|
|
41446
|
-
/* harmony import */ var
|
|
41447
|
-
/* harmony import */ var
|
|
41448
|
-
/* harmony import */ var
|
|
41449
|
-
/* harmony import */ var
|
|
41450
|
-
/* harmony import */ var
|
|
41451
|
-
/* harmony import */ var
|
|
41452
|
-
/* harmony import */ var
|
|
41453
|
-
/* harmony import */ var
|
|
41454
|
-
/* harmony import */ var
|
|
41455
|
-
/* harmony import */ var
|
|
41456
|
-
/* harmony import */ var
|
|
41457
|
-
/* harmony import */ var
|
|
41776
|
+
/* harmony import */ var _ast_nodes_YamlNode_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6821);
|
|
41777
|
+
/* harmony import */ var _ast_nodes_YamlAlias_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(15103);
|
|
41778
|
+
/* harmony import */ var _ast_nodes_YamlAnchor_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(2838);
|
|
41779
|
+
/* harmony import */ var _ast_nodes_YamlComment_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(14120);
|
|
41780
|
+
/* harmony import */ var _ast_nodes_YamlDirective_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(22532);
|
|
41781
|
+
/* harmony import */ var _ast_nodes_YamlDocument_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(17374);
|
|
41782
|
+
/* harmony import */ var _ast_nodes_YamlKeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(39113);
|
|
41783
|
+
/* harmony import */ var _ast_nodes_YamlMapping_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(17373);
|
|
41784
|
+
/* harmony import */ var _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(20301);
|
|
41785
|
+
/* harmony import */ var _ast_nodes_YamlSequence_mjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(46794);
|
|
41786
|
+
/* harmony import */ var _ast_nodes_YamlStream_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(74213);
|
|
41787
|
+
/* harmony import */ var _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(48139);
|
|
41788
|
+
/* harmony import */ var _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(21544);
|
|
41789
|
+
|
|
41458
41790
|
|
|
41459
41791
|
|
|
41460
41792
|
|
|
@@ -41494,16 +41826,16 @@ const toPositionProps = info => ({
|
|
|
41494
41826
|
endOffset: info.endIndex
|
|
41495
41827
|
});
|
|
41496
41828
|
const toYamlAnchor = info => {
|
|
41497
|
-
return new
|
|
41829
|
+
return new _ast_nodes_YamlAnchor_mjs__WEBPACK_IMPORTED_MODULE_5__["default"]({
|
|
41498
41830
|
name: info.text,
|
|
41499
41831
|
...toPositionProps(info)
|
|
41500
41832
|
});
|
|
41501
41833
|
};
|
|
41502
41834
|
const toYamlTag = (info, tagInfo) => {
|
|
41503
41835
|
const explicitName = tagInfo?.text || (info.type === 'plain_scalar' ? '?' : '!');
|
|
41504
|
-
const kind = info.type.endsWith('mapping') ?
|
|
41836
|
+
const kind = info.type.endsWith('mapping') ? _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlNodeKind.Mapping : info.type.endsWith('sequence') ? _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlNodeKind.Sequence : _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlNodeKind.Scalar;
|
|
41505
41837
|
const positionProps = tagInfo ? toPositionProps(tagInfo) : undefined;
|
|
41506
|
-
return new
|
|
41838
|
+
return new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__["default"]({
|
|
41507
41839
|
explicitName,
|
|
41508
41840
|
kind,
|
|
41509
41841
|
...positionProps
|
|
@@ -41551,12 +41883,29 @@ const processChildren = (cursor, ctx, transformerMap) => {
|
|
|
41551
41883
|
return results;
|
|
41552
41884
|
};
|
|
41553
41885
|
|
|
41886
|
+
// strip leading '# ' (or bare '#') from comment text, keeping only the content
|
|
41887
|
+
const stripCommentHash = text => text.split('\n').map(line => line.replace(/^#\s?/, '')).join('\n');
|
|
41888
|
+
|
|
41889
|
+
// find the first YamlNode in a TransformResult (which may be an array from block_node)
|
|
41890
|
+
const findYamlNode = result => {
|
|
41891
|
+
if (result instanceof _ast_nodes_YamlNode_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]) return result;
|
|
41892
|
+
if (Array.isArray(result)) {
|
|
41893
|
+
for (const item of result.flat()) {
|
|
41894
|
+
if (item instanceof _ast_nodes_YamlNode_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]) return item;
|
|
41895
|
+
}
|
|
41896
|
+
}
|
|
41897
|
+
return null;
|
|
41898
|
+
};
|
|
41554
41899
|
// Helper to process key-value pair children
|
|
41555
41900
|
const processKeyValuePairChildren = (cursor, ctx, transformerMap) => {
|
|
41556
41901
|
let key = null;
|
|
41557
41902
|
let value = null;
|
|
41558
41903
|
const errors = [];
|
|
41904
|
+
const commentsBetweenKeyValue = [];
|
|
41905
|
+
const commentsAfterValue = [];
|
|
41559
41906
|
let siblings = {};
|
|
41907
|
+
let seenKey = false;
|
|
41908
|
+
let seenValue = false;
|
|
41560
41909
|
if (cursor.gotoFirstChild()) {
|
|
41561
41910
|
do {
|
|
41562
41911
|
const info = getCursorInfo(cursor);
|
|
@@ -41571,12 +41920,25 @@ const processKeyValuePairChildren = (cursor, ctx, transformerMap) => {
|
|
|
41571
41920
|
siblings.anchor = info;
|
|
41572
41921
|
continue;
|
|
41573
41922
|
}
|
|
41923
|
+
|
|
41924
|
+
// collect comment nodes (extras placed by tree-sitter between key/value)
|
|
41925
|
+
if (info.type === 'comment') {
|
|
41926
|
+
const commentText = stripCommentHash(info.text);
|
|
41927
|
+
if (seenValue) {
|
|
41928
|
+
commentsAfterValue.push(commentText);
|
|
41929
|
+
} else if (seenKey) {
|
|
41930
|
+
commentsBetweenKeyValue.push(commentText);
|
|
41931
|
+
}
|
|
41932
|
+
continue;
|
|
41933
|
+
}
|
|
41574
41934
|
if (fieldName === 'key') {
|
|
41575
41935
|
key = transform(cursor, ctx, transformerMap, siblings);
|
|
41576
41936
|
siblings = {};
|
|
41937
|
+
seenKey = true;
|
|
41577
41938
|
} else if (fieldName === 'value') {
|
|
41578
41939
|
value = transform(cursor, ctx, transformerMap, siblings);
|
|
41579
41940
|
siblings = {};
|
|
41941
|
+
seenValue = true;
|
|
41580
41942
|
} else if (info.type === 'ERROR') {
|
|
41581
41943
|
const errorResult = transform(cursor, ctx, transformerMap, siblings);
|
|
41582
41944
|
if (errorResult !== null) {
|
|
@@ -41589,7 +41951,9 @@ const processKeyValuePairChildren = (cursor, ctx, transformerMap) => {
|
|
|
41589
41951
|
return {
|
|
41590
41952
|
key,
|
|
41591
41953
|
value,
|
|
41592
|
-
errors
|
|
41954
|
+
errors,
|
|
41955
|
+
commentsBetweenKeyValue,
|
|
41956
|
+
commentsAfterValue
|
|
41593
41957
|
};
|
|
41594
41958
|
};
|
|
41595
41959
|
const transform = (cursor, ctx, transformerMap, siblings = {}) => {
|
|
@@ -41618,7 +41982,7 @@ const createTransformers = transformerMap => ({
|
|
|
41618
41982
|
stream(cursor, ctx) {
|
|
41619
41983
|
const info = getCursorInfo(cursor);
|
|
41620
41984
|
const children = processChildren(cursor, ctx, transformerMap);
|
|
41621
|
-
const stream = new
|
|
41985
|
+
const stream = new _ast_nodes_YamlStream_mjs__WEBPACK_IMPORTED_MODULE_13__["default"]({
|
|
41622
41986
|
children: children.filter(c => c !== null),
|
|
41623
41987
|
...toPositionProps(info),
|
|
41624
41988
|
isMissing: info.isMissing
|
|
@@ -41641,7 +42005,7 @@ const createTransformers = transformerMap => ({
|
|
|
41641
42005
|
} while (cursor.gotoNextSibling());
|
|
41642
42006
|
cursor.gotoParent();
|
|
41643
42007
|
}
|
|
41644
|
-
return new
|
|
42008
|
+
return new _ast_nodes_YamlDirective_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]({
|
|
41645
42009
|
...toPositionProps(info),
|
|
41646
42010
|
name: '%YAML',
|
|
41647
42011
|
parameters: {
|
|
@@ -41660,7 +42024,7 @@ const createTransformers = transformerMap => ({
|
|
|
41660
42024
|
} while (cursor.gotoNextSibling());
|
|
41661
42025
|
cursor.gotoParent();
|
|
41662
42026
|
}
|
|
41663
|
-
const tagDirective = new
|
|
42027
|
+
const tagDirective = new _ast_nodes_YamlDirective_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]({
|
|
41664
42028
|
...toPositionProps(info),
|
|
41665
42029
|
name: '%TAG',
|
|
41666
42030
|
parameters: {
|
|
@@ -41682,7 +42046,7 @@ const createTransformers = transformerMap => ({
|
|
|
41682
42046
|
} while (cursor.gotoNextSibling());
|
|
41683
42047
|
cursor.gotoParent();
|
|
41684
42048
|
}
|
|
41685
|
-
return new
|
|
42049
|
+
return new _ast_nodes_YamlDirective_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]({
|
|
41686
42050
|
...toPositionProps(info),
|
|
41687
42051
|
name: children[0],
|
|
41688
42052
|
parameters: {
|
|
@@ -41694,7 +42058,7 @@ const createTransformers = transformerMap => ({
|
|
|
41694
42058
|
document(cursor, ctx) {
|
|
41695
42059
|
const info = getCursorInfo(cursor);
|
|
41696
42060
|
const children = processChildren(cursor, ctx, transformerMap);
|
|
41697
|
-
return new
|
|
42061
|
+
return new _ast_nodes_YamlDocument_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]({
|
|
41698
42062
|
children: children.flat().filter(c => c !== null),
|
|
41699
42063
|
...toPositionProps(info),
|
|
41700
42064
|
isMissing: info.isMissing
|
|
@@ -41726,7 +42090,7 @@ const createTransformers = transformerMap => ({
|
|
|
41726
42090
|
|
|
41727
42091
|
// No kind node - create empty scalar
|
|
41728
42092
|
if (lastChildInfo) {
|
|
41729
|
-
const emptyScalarNode = new
|
|
42093
|
+
const emptyScalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
|
|
41730
42094
|
content: '',
|
|
41731
42095
|
anchor: siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined,
|
|
41732
42096
|
tag: toYamlTag(lastChildInfo, siblings.tag),
|
|
@@ -41736,8 +42100,8 @@ const createTransformers = transformerMap => ({
|
|
|
41736
42100
|
endLine: lastChildInfo.endPosition.row,
|
|
41737
42101
|
endCharacter: lastChildInfo.endPosition.column,
|
|
41738
42102
|
endOffset: lastChildInfo.endIndex,
|
|
41739
|
-
styleGroup:
|
|
41740
|
-
style:
|
|
42103
|
+
styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
|
|
42104
|
+
style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Plain
|
|
41741
42105
|
});
|
|
41742
42106
|
registerAnchor(emptyScalarNode, ctx);
|
|
41743
42107
|
return emptyScalarNode;
|
|
@@ -41749,13 +42113,13 @@ const createTransformers = transformerMap => ({
|
|
|
41749
42113
|
const tag = toYamlTag(info, siblings.tag);
|
|
41750
42114
|
const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
|
|
41751
42115
|
const children = processChildren(cursor, ctx, transformerMap);
|
|
41752
|
-
const mappingNode = new
|
|
42116
|
+
const mappingNode = new _ast_nodes_YamlMapping_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
|
|
41753
42117
|
children: children.filter(c => c !== null),
|
|
41754
42118
|
...toPositionProps(info),
|
|
41755
42119
|
anchor,
|
|
41756
42120
|
tag,
|
|
41757
|
-
styleGroup:
|
|
41758
|
-
style:
|
|
42121
|
+
styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Block,
|
|
42122
|
+
style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.NextLine,
|
|
41759
42123
|
isMissing: info.isMissing
|
|
41760
42124
|
});
|
|
41761
42125
|
registerAnchor(mappingNode, ctx);
|
|
@@ -41766,13 +42130,15 @@ const createTransformers = transformerMap => ({
|
|
|
41766
42130
|
const {
|
|
41767
42131
|
key,
|
|
41768
42132
|
value,
|
|
41769
|
-
errors
|
|
42133
|
+
errors,
|
|
42134
|
+
commentsBetweenKeyValue,
|
|
42135
|
+
commentsAfterValue
|
|
41770
42136
|
} = processKeyValuePairChildren(cursor, ctx, transformerMap);
|
|
41771
42137
|
const children = [];
|
|
41772
42138
|
|
|
41773
42139
|
// Handle empty key
|
|
41774
42140
|
if (key === null) {
|
|
41775
|
-
const emptyKey = new
|
|
42141
|
+
const emptyKey = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
|
|
41776
42142
|
content: '',
|
|
41777
42143
|
startLine: info.startPosition.row,
|
|
41778
42144
|
startCharacter: info.startPosition.column,
|
|
@@ -41780,12 +42146,12 @@ const createTransformers = transformerMap => ({
|
|
|
41780
42146
|
endLine: info.startPosition.row,
|
|
41781
42147
|
endCharacter: info.startPosition.column,
|
|
41782
42148
|
endOffset: info.startIndex,
|
|
41783
|
-
tag: new
|
|
42149
|
+
tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__["default"]({
|
|
41784
42150
|
explicitName: '?',
|
|
41785
|
-
kind:
|
|
42151
|
+
kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlNodeKind.Scalar
|
|
41786
42152
|
}),
|
|
41787
|
-
styleGroup:
|
|
41788
|
-
style:
|
|
42153
|
+
styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
|
|
42154
|
+
style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Plain
|
|
41789
42155
|
});
|
|
41790
42156
|
children.push(emptyKey);
|
|
41791
42157
|
} else {
|
|
@@ -41794,7 +42160,7 @@ const createTransformers = transformerMap => ({
|
|
|
41794
42160
|
|
|
41795
42161
|
// Handle empty value
|
|
41796
42162
|
if (value === null) {
|
|
41797
|
-
const emptyValue = new
|
|
42163
|
+
const emptyValue = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
|
|
41798
42164
|
content: '',
|
|
41799
42165
|
startLine: info.endPosition.row,
|
|
41800
42166
|
startCharacter: info.endPosition.column,
|
|
@@ -41802,22 +42168,37 @@ const createTransformers = transformerMap => ({
|
|
|
41802
42168
|
endLine: info.endPosition.row,
|
|
41803
42169
|
endCharacter: info.endPosition.column,
|
|
41804
42170
|
endOffset: info.endIndex,
|
|
41805
|
-
tag: new
|
|
42171
|
+
tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__["default"]({
|
|
41806
42172
|
explicitName: '?',
|
|
41807
|
-
kind:
|
|
42173
|
+
kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlNodeKind.Scalar
|
|
41808
42174
|
}),
|
|
41809
|
-
styleGroup:
|
|
41810
|
-
style:
|
|
42175
|
+
styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
|
|
42176
|
+
style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Plain
|
|
41811
42177
|
});
|
|
41812
42178
|
children.push(emptyValue);
|
|
41813
42179
|
} else {
|
|
41814
42180
|
children.push(value);
|
|
41815
42181
|
}
|
|
42182
|
+
|
|
42183
|
+
// attach comments found between key and value to the value node
|
|
42184
|
+
if (commentsBetweenKeyValue.length > 0) {
|
|
42185
|
+
const valueNode = findYamlNode(value);
|
|
42186
|
+
if (valueNode) {
|
|
42187
|
+
valueNode.commentBefore = commentsBetweenKeyValue.join('\n');
|
|
42188
|
+
}
|
|
42189
|
+
}
|
|
42190
|
+
// attach comments found after value to the value node
|
|
42191
|
+
if (commentsAfterValue.length > 0) {
|
|
42192
|
+
const valueNode = findYamlNode(value);
|
|
42193
|
+
if (valueNode) {
|
|
42194
|
+
valueNode.comment = commentsAfterValue.join('\n');
|
|
42195
|
+
}
|
|
42196
|
+
}
|
|
41816
42197
|
children.push(...errors);
|
|
41817
|
-
return new
|
|
42198
|
+
return new _ast_nodes_YamlKeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_9__["default"]({
|
|
41818
42199
|
children: children.flat().filter(c => c !== null),
|
|
41819
42200
|
...toPositionProps(info),
|
|
41820
|
-
styleGroup:
|
|
42201
|
+
styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Block,
|
|
41821
42202
|
isMissing: info.isMissing
|
|
41822
42203
|
});
|
|
41823
42204
|
},
|
|
@@ -41826,13 +42207,13 @@ const createTransformers = transformerMap => ({
|
|
|
41826
42207
|
const tag = toYamlTag(info, siblings.tag);
|
|
41827
42208
|
const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
|
|
41828
42209
|
const children = processChildren(cursor, ctx, transformerMap);
|
|
41829
|
-
const mappingNode = new
|
|
42210
|
+
const mappingNode = new _ast_nodes_YamlMapping_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
|
|
41830
42211
|
children: children.flat().filter(c => c !== null),
|
|
41831
42212
|
...toPositionProps(info),
|
|
41832
42213
|
anchor,
|
|
41833
42214
|
tag,
|
|
41834
|
-
styleGroup:
|
|
41835
|
-
style:
|
|
42215
|
+
styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
|
|
42216
|
+
style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Explicit,
|
|
41836
42217
|
isMissing: info.isMissing
|
|
41837
42218
|
});
|
|
41838
42219
|
registerAnchor(mappingNode, ctx);
|
|
@@ -41843,13 +42224,15 @@ const createTransformers = transformerMap => ({
|
|
|
41843
42224
|
const {
|
|
41844
42225
|
key,
|
|
41845
42226
|
value,
|
|
41846
|
-
errors
|
|
42227
|
+
errors,
|
|
42228
|
+
commentsBetweenKeyValue,
|
|
42229
|
+
commentsAfterValue
|
|
41847
42230
|
} = processKeyValuePairChildren(cursor, ctx, transformerMap);
|
|
41848
42231
|
const children = [];
|
|
41849
42232
|
|
|
41850
42233
|
// Handle empty key
|
|
41851
42234
|
if (key === null) {
|
|
41852
|
-
const emptyKey = new
|
|
42235
|
+
const emptyKey = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
|
|
41853
42236
|
content: '',
|
|
41854
42237
|
startLine: info.startPosition.row,
|
|
41855
42238
|
startCharacter: info.startPosition.column,
|
|
@@ -41857,12 +42240,12 @@ const createTransformers = transformerMap => ({
|
|
|
41857
42240
|
endLine: info.startPosition.row,
|
|
41858
42241
|
endCharacter: info.startPosition.column,
|
|
41859
42242
|
endOffset: info.startIndex,
|
|
41860
|
-
tag: new
|
|
42243
|
+
tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__["default"]({
|
|
41861
42244
|
explicitName: '?',
|
|
41862
|
-
kind:
|
|
42245
|
+
kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlNodeKind.Scalar
|
|
41863
42246
|
}),
|
|
41864
|
-
styleGroup:
|
|
41865
|
-
style:
|
|
42247
|
+
styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
|
|
42248
|
+
style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Plain
|
|
41866
42249
|
});
|
|
41867
42250
|
children.push(emptyKey);
|
|
41868
42251
|
} else {
|
|
@@ -41871,7 +42254,7 @@ const createTransformers = transformerMap => ({
|
|
|
41871
42254
|
|
|
41872
42255
|
// Handle empty value
|
|
41873
42256
|
if (value === null) {
|
|
41874
|
-
const emptyValue = new
|
|
42257
|
+
const emptyValue = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
|
|
41875
42258
|
content: '',
|
|
41876
42259
|
startLine: info.endPosition.row,
|
|
41877
42260
|
startCharacter: info.endPosition.column,
|
|
@@ -41879,22 +42262,37 @@ const createTransformers = transformerMap => ({
|
|
|
41879
42262
|
endLine: info.endPosition.row,
|
|
41880
42263
|
endCharacter: info.endPosition.column,
|
|
41881
42264
|
endOffset: info.endIndex,
|
|
41882
|
-
tag: new
|
|
42265
|
+
tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__["default"]({
|
|
41883
42266
|
explicitName: '?',
|
|
41884
|
-
kind:
|
|
42267
|
+
kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlNodeKind.Scalar
|
|
41885
42268
|
}),
|
|
41886
|
-
styleGroup:
|
|
41887
|
-
style:
|
|
42269
|
+
styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
|
|
42270
|
+
style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Plain
|
|
41888
42271
|
});
|
|
41889
42272
|
children.push(emptyValue);
|
|
41890
42273
|
} else {
|
|
41891
42274
|
children.push(value);
|
|
41892
42275
|
}
|
|
42276
|
+
|
|
42277
|
+
// attach comments found between key and value to the value node
|
|
42278
|
+
if (commentsBetweenKeyValue.length > 0) {
|
|
42279
|
+
const valueNode = findYamlNode(value);
|
|
42280
|
+
if (valueNode) {
|
|
42281
|
+
valueNode.commentBefore = commentsBetweenKeyValue.join('\n');
|
|
42282
|
+
}
|
|
42283
|
+
}
|
|
42284
|
+
// attach comments found after value to the value node
|
|
42285
|
+
if (commentsAfterValue.length > 0) {
|
|
42286
|
+
const valueNode = findYamlNode(value);
|
|
42287
|
+
if (valueNode) {
|
|
42288
|
+
valueNode.comment = commentsAfterValue.join('\n');
|
|
42289
|
+
}
|
|
42290
|
+
}
|
|
41893
42291
|
children.push(...errors);
|
|
41894
|
-
return new
|
|
42292
|
+
return new _ast_nodes_YamlKeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_9__["default"]({
|
|
41895
42293
|
children: children.flat().filter(c => c !== null),
|
|
41896
42294
|
...toPositionProps(info),
|
|
41897
|
-
styleGroup:
|
|
42295
|
+
styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
|
|
41898
42296
|
isMissing: info.isMissing
|
|
41899
42297
|
});
|
|
41900
42298
|
},
|
|
@@ -41903,13 +42301,13 @@ const createTransformers = transformerMap => ({
|
|
|
41903
42301
|
const tag = toYamlTag(info, siblings.tag);
|
|
41904
42302
|
const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
|
|
41905
42303
|
const children = processChildren(cursor, ctx, transformerMap);
|
|
41906
|
-
const sequenceNode = new
|
|
42304
|
+
const sequenceNode = new _ast_nodes_YamlSequence_mjs__WEBPACK_IMPORTED_MODULE_12__["default"]({
|
|
41907
42305
|
children: children.flat(Infinity).filter(c => c !== null),
|
|
41908
42306
|
...toPositionProps(info),
|
|
41909
42307
|
anchor,
|
|
41910
42308
|
tag,
|
|
41911
|
-
styleGroup:
|
|
41912
|
-
style:
|
|
42309
|
+
styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Block,
|
|
42310
|
+
style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.NextLine
|
|
41913
42311
|
});
|
|
41914
42312
|
registerAnchor(sequenceNode, ctx);
|
|
41915
42313
|
return ctx.schema.resolve(sequenceNode);
|
|
@@ -41920,11 +42318,11 @@ const createTransformers = transformerMap => ({
|
|
|
41920
42318
|
|
|
41921
42319
|
// If only one child (the "-" literal), create empty node
|
|
41922
42320
|
if (children.length === 0) {
|
|
41923
|
-
const emptyScalarNode = new
|
|
42321
|
+
const emptyScalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
|
|
41924
42322
|
content: '',
|
|
41925
|
-
tag: new
|
|
42323
|
+
tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__["default"]({
|
|
41926
42324
|
explicitName: '?',
|
|
41927
|
-
kind:
|
|
42325
|
+
kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlNodeKind.Scalar
|
|
41928
42326
|
}),
|
|
41929
42327
|
startLine: info.endPosition.row,
|
|
41930
42328
|
startCharacter: info.endPosition.column,
|
|
@@ -41932,8 +42330,8 @@ const createTransformers = transformerMap => ({
|
|
|
41932
42330
|
endLine: info.endPosition.row,
|
|
41933
42331
|
endCharacter: info.endPosition.column,
|
|
41934
42332
|
endOffset: info.endIndex,
|
|
41935
|
-
styleGroup:
|
|
41936
|
-
style:
|
|
42333
|
+
styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
|
|
42334
|
+
style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Plain
|
|
41937
42335
|
});
|
|
41938
42336
|
return [emptyScalarNode];
|
|
41939
42337
|
}
|
|
@@ -41944,13 +42342,13 @@ const createTransformers = transformerMap => ({
|
|
|
41944
42342
|
const tag = toYamlTag(info, siblings.tag);
|
|
41945
42343
|
const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
|
|
41946
42344
|
const children = processChildren(cursor, ctx, transformerMap);
|
|
41947
|
-
const sequenceNode = new
|
|
42345
|
+
const sequenceNode = new _ast_nodes_YamlSequence_mjs__WEBPACK_IMPORTED_MODULE_12__["default"]({
|
|
41948
42346
|
children: children.flat().filter(c => c !== null),
|
|
41949
42347
|
...toPositionProps(info),
|
|
41950
42348
|
anchor,
|
|
41951
42349
|
tag,
|
|
41952
|
-
styleGroup:
|
|
41953
|
-
style:
|
|
42350
|
+
styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
|
|
42351
|
+
style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Explicit
|
|
41954
42352
|
});
|
|
41955
42353
|
registerAnchor(sequenceNode, ctx);
|
|
41956
42354
|
return ctx.schema.resolve(sequenceNode);
|
|
@@ -41959,14 +42357,15 @@ const createTransformers = transformerMap => ({
|
|
|
41959
42357
|
const info = getCursorInfo(cursor);
|
|
41960
42358
|
const tag = toYamlTag(info, siblings.tag);
|
|
41961
42359
|
const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
|
|
41962
|
-
const scalarNode = new
|
|
42360
|
+
const scalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
|
|
41963
42361
|
content: info.text,
|
|
41964
42362
|
anchor,
|
|
41965
42363
|
tag,
|
|
41966
42364
|
...toPositionProps(info),
|
|
41967
|
-
styleGroup:
|
|
41968
|
-
style:
|
|
42365
|
+
styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
|
|
42366
|
+
style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Plain
|
|
41969
42367
|
});
|
|
42368
|
+
scalarNode.rawContent = info.text;
|
|
41970
42369
|
registerAnchor(scalarNode, ctx);
|
|
41971
42370
|
return ctx.schema.resolve(scalarNode);
|
|
41972
42371
|
},
|
|
@@ -41974,14 +42373,15 @@ const createTransformers = transformerMap => ({
|
|
|
41974
42373
|
const info = getCursorInfo(cursor);
|
|
41975
42374
|
const tag = toYamlTag(info, siblings.tag);
|
|
41976
42375
|
const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
|
|
41977
|
-
const scalarNode = new
|
|
42376
|
+
const scalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
|
|
41978
42377
|
content: info.text,
|
|
41979
42378
|
anchor,
|
|
41980
42379
|
tag,
|
|
41981
42380
|
...toPositionProps(info),
|
|
41982
|
-
styleGroup:
|
|
41983
|
-
style:
|
|
42381
|
+
styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
|
|
42382
|
+
style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.SingleQuoted
|
|
41984
42383
|
});
|
|
42384
|
+
scalarNode.rawContent = info.text;
|
|
41985
42385
|
registerAnchor(scalarNode, ctx);
|
|
41986
42386
|
return ctx.schema.resolve(scalarNode);
|
|
41987
42387
|
},
|
|
@@ -41989,14 +42389,15 @@ const createTransformers = transformerMap => ({
|
|
|
41989
42389
|
const info = getCursorInfo(cursor);
|
|
41990
42390
|
const tag = toYamlTag(info, siblings.tag);
|
|
41991
42391
|
const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
|
|
41992
|
-
const scalarNode = new
|
|
42392
|
+
const scalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
|
|
41993
42393
|
content: info.text,
|
|
41994
42394
|
anchor,
|
|
41995
42395
|
tag,
|
|
41996
42396
|
...toPositionProps(info),
|
|
41997
|
-
styleGroup:
|
|
41998
|
-
style:
|
|
42397
|
+
styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
|
|
42398
|
+
style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.DoubleQuoted
|
|
41999
42399
|
});
|
|
42400
|
+
scalarNode.rawContent = info.text;
|
|
42000
42401
|
registerAnchor(scalarNode, ctx);
|
|
42001
42402
|
return ctx.schema.resolve(scalarNode);
|
|
42002
42403
|
},
|
|
@@ -42004,27 +42405,29 @@ const createTransformers = transformerMap => ({
|
|
|
42004
42405
|
const info = getCursorInfo(cursor);
|
|
42005
42406
|
const tag = toYamlTag(info, siblings.tag);
|
|
42006
42407
|
const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
|
|
42007
|
-
const style = info.text.startsWith('|') ?
|
|
42008
|
-
const scalarNode = new
|
|
42408
|
+
const style = info.text.startsWith('|') ? _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Literal : info.text.startsWith('>') ? _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Folded : _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Plain;
|
|
42409
|
+
const scalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
|
|
42009
42410
|
content: info.text,
|
|
42010
42411
|
anchor,
|
|
42011
42412
|
tag,
|
|
42012
42413
|
...toPositionProps(info),
|
|
42013
|
-
styleGroup:
|
|
42414
|
+
styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Block,
|
|
42014
42415
|
style
|
|
42015
42416
|
});
|
|
42417
|
+
scalarNode.rawContent = info.text;
|
|
42016
42418
|
registerAnchor(scalarNode, ctx);
|
|
42017
42419
|
return ctx.schema.resolve(scalarNode);
|
|
42018
42420
|
},
|
|
42019
42421
|
comment(cursor) {
|
|
42020
42422
|
const info = getCursorInfo(cursor);
|
|
42021
|
-
return new
|
|
42022
|
-
content: info.text
|
|
42423
|
+
return new _ast_nodes_YamlComment_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]({
|
|
42424
|
+
content: info.text,
|
|
42425
|
+
...toPositionProps(info)
|
|
42023
42426
|
});
|
|
42024
42427
|
},
|
|
42025
42428
|
alias(cursor, ctx) {
|
|
42026
42429
|
const info = getCursorInfo(cursor);
|
|
42027
|
-
const alias = new
|
|
42430
|
+
const alias = new _ast_nodes_YamlAlias_mjs__WEBPACK_IMPORTED_MODULE_4__["default"]({
|
|
42028
42431
|
content: info.text
|
|
42029
42432
|
});
|
|
42030
42433
|
return ctx.referenceManager.resolveAlias(alias);
|
|
@@ -42106,6 +42509,147 @@ const maybeAddSourceMap = (node, element, ctx) => {
|
|
|
42106
42509
|
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__["default"].transfer(node, element);
|
|
42107
42510
|
};
|
|
42108
42511
|
|
|
42512
|
+
// find the first descendant matching a type path through the AST
|
|
42513
|
+
const findFirst = (node, path) => {
|
|
42514
|
+
if (path.length === 0) return node;
|
|
42515
|
+
const [type, ...rest] = path;
|
|
42516
|
+
for (const child of node.children || []) {
|
|
42517
|
+
if (child.type !== type) continue;
|
|
42518
|
+
const found = findFirst(child, rest);
|
|
42519
|
+
if (found) return found;
|
|
42520
|
+
}
|
|
42521
|
+
return undefined;
|
|
42522
|
+
};
|
|
42523
|
+
|
|
42524
|
+
// detect indent from first nested block mapping (stream > document > mapping > keyValuePair > mapping)
|
|
42525
|
+
const detectIndent = node => {
|
|
42526
|
+
const nested = findFirst(node, ['document', 'mapping', 'keyValuePair', 'mapping']);
|
|
42527
|
+
if (nested?.styleGroup === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_9__.YamlStyleGroup.Block && typeof nested.startCharacter === 'number' && nested.startCharacter > 0) {
|
|
42528
|
+
return nested.startCharacter;
|
|
42529
|
+
}
|
|
42530
|
+
return 2;
|
|
42531
|
+
};
|
|
42532
|
+
|
|
42533
|
+
// strip leading '#' from each line of comment text; yaml library adds '#' during stringification
|
|
42534
|
+
const stripCommentHash = text => text.split('\n').map(line => line.replace(/^#/, '')).join('\n');
|
|
42535
|
+
|
|
42536
|
+
// collect comment texts from raw AST children, indexed by position relative to non-comment siblings
|
|
42537
|
+
|
|
42538
|
+
// is the comment on the same line as the previous non-comment sibling?
|
|
42539
|
+
const isInlineComment = (child, lastEndLine, pending) => {
|
|
42540
|
+
return pending.length === 0 && lastEndLine !== undefined && child.startLine === lastEndLine;
|
|
42541
|
+
};
|
|
42542
|
+
|
|
42543
|
+
/**
|
|
42544
|
+
* @param children - raw AST children of a mapping/sequence
|
|
42545
|
+
* @param containerStartCol - the start column of the container node;
|
|
42546
|
+
* trailing comments whose startCharacter is less than this are out-of-scope
|
|
42547
|
+
* (tree-sitter may place them inside a nested block they don't belong to)
|
|
42548
|
+
*/
|
|
42549
|
+
const collectComments = (children, containerStartCol) => {
|
|
42550
|
+
const before = new Map();
|
|
42551
|
+
const after = new Map();
|
|
42552
|
+
const pending = [];
|
|
42553
|
+
let lastNonCommentEndLine;
|
|
42554
|
+
let elementIdx = 0;
|
|
42555
|
+
for (const child of children) {
|
|
42556
|
+
if (child?.type === 'comment') {
|
|
42557
|
+
const text = stripCommentHash(child.content || '');
|
|
42558
|
+
if (elementIdx > 0 && isInlineComment(child, lastNonCommentEndLine, pending)) {
|
|
42559
|
+
after.set(elementIdx - 1, text);
|
|
42560
|
+
} else {
|
|
42561
|
+
pending.push({
|
|
42562
|
+
text,
|
|
42563
|
+
startLine: child.startLine,
|
|
42564
|
+
startCharacter: child.startCharacter
|
|
42565
|
+
});
|
|
42566
|
+
}
|
|
42567
|
+
continue;
|
|
42568
|
+
}
|
|
42569
|
+
|
|
42570
|
+
// non-comment node: attach any pending comments as commentBefore
|
|
42571
|
+
if (pending.length > 0) {
|
|
42572
|
+
before.set(elementIdx, pending.map(c => c.text).join('\n'));
|
|
42573
|
+
pending.length = 0;
|
|
42574
|
+
}
|
|
42575
|
+
lastNonCommentEndLine = child.endLine;
|
|
42576
|
+
elementIdx++;
|
|
42577
|
+
}
|
|
42578
|
+
|
|
42579
|
+
// remaining pending comments are trailing — split into in-scope and out-of-scope
|
|
42580
|
+
let trailing = null;
|
|
42581
|
+
const outOfScope = [];
|
|
42582
|
+
for (const c of pending) {
|
|
42583
|
+
if (containerStartCol !== undefined && c.startCharacter !== undefined && c.startCharacter < containerStartCol) {
|
|
42584
|
+
outOfScope.push(c.text);
|
|
42585
|
+
} else {
|
|
42586
|
+
trailing = trailing ? `${trailing}\n${c.text}` : c.text;
|
|
42587
|
+
}
|
|
42588
|
+
}
|
|
42589
|
+
return {
|
|
42590
|
+
before,
|
|
42591
|
+
after,
|
|
42592
|
+
trailing,
|
|
42593
|
+
outOfScope
|
|
42594
|
+
};
|
|
42595
|
+
};
|
|
42596
|
+
|
|
42597
|
+
// set a yaml style property on an element, initializing style.yaml if needed
|
|
42598
|
+
const setYamlStyleProp = (element, key, value) => {
|
|
42599
|
+
if (!element.style) element.style = {};
|
|
42600
|
+
const yaml = element.style.yaml ?? {};
|
|
42601
|
+
yaml[key] = value;
|
|
42602
|
+
element.style.yaml = yaml;
|
|
42603
|
+
};
|
|
42604
|
+
|
|
42605
|
+
// apply collected comments to transformed ApiDOM elements
|
|
42606
|
+
const applyComments = (elements, comments) => {
|
|
42607
|
+
comments.before.forEach((text, idx) => {
|
|
42608
|
+
if (elements[idx]) setYamlStyleProp(elements[idx], 'commentBefore', text);
|
|
42609
|
+
});
|
|
42610
|
+
comments.after.forEach((text, idx) => {
|
|
42611
|
+
if (elements[idx]) setYamlStyleProp(elements[idx], 'comment', text);
|
|
42612
|
+
});
|
|
42613
|
+
};
|
|
42614
|
+
|
|
42615
|
+
// detect flow collection padding from node positions
|
|
42616
|
+
// gap of 1 between container start and first child start → no padding: [x
|
|
42617
|
+
// gap of 2+ → padding: [ x
|
|
42618
|
+
// gap of 1 between container start and first child start → no padding: {x
|
|
42619
|
+
// gap of 2+ → padding: { x
|
|
42620
|
+
const detectFlowPadding = node => {
|
|
42621
|
+
const firstChild = (node.children || [])[0];
|
|
42622
|
+
if (firstChild && typeof node.startCharacter === 'number' && typeof firstChild.startCharacter === 'number') {
|
|
42623
|
+
return firstChild.startCharacter - node.startCharacter > 1;
|
|
42624
|
+
}
|
|
42625
|
+
return true;
|
|
42626
|
+
};
|
|
42627
|
+
|
|
42628
|
+
// build yaml style object for an element
|
|
42629
|
+
const buildYamlStyle = (node, ctx, extras) => {
|
|
42630
|
+
const yamlStyle = {
|
|
42631
|
+
styleGroup: node.styleGroup,
|
|
42632
|
+
indent: ctx.indent
|
|
42633
|
+
};
|
|
42634
|
+
if (ctx.flowCollectionPadding !== null) {
|
|
42635
|
+
yamlStyle.flowCollectionPadding = ctx.flowCollectionPadding;
|
|
42636
|
+
}
|
|
42637
|
+
if (node.comment) {
|
|
42638
|
+
yamlStyle.comment = node.comment;
|
|
42639
|
+
}
|
|
42640
|
+
if (node.commentBefore) {
|
|
42641
|
+
yamlStyle.commentBefore = node.commentBefore;
|
|
42642
|
+
}
|
|
42643
|
+
if (extras) {
|
|
42644
|
+
for (const [key, value] of Object.entries(extras)) {
|
|
42645
|
+
if (value !== undefined) yamlStyle[key] = value;
|
|
42646
|
+
}
|
|
42647
|
+
}
|
|
42648
|
+
return {
|
|
42649
|
+
yaml: yamlStyle
|
|
42650
|
+
};
|
|
42651
|
+
};
|
|
42652
|
+
|
|
42109
42653
|
// Transform a single node based on its type
|
|
42110
42654
|
const transform = (node, ctx) => {
|
|
42111
42655
|
if (node === null || node === undefined) {
|
|
@@ -42141,22 +42685,58 @@ const transform = (node, ctx) => {
|
|
|
42141
42685
|
// Transform children array and flatten results
|
|
42142
42686
|
const transformChildren = (children, ctx) => {
|
|
42143
42687
|
const results = [];
|
|
42688
|
+
let pendingPromoted = [];
|
|
42144
42689
|
for (const child of children) {
|
|
42145
42690
|
const result = transform(child, ctx);
|
|
42146
42691
|
if (result === null) {
|
|
42692
|
+
// collect any promoted comments generated during this null transform
|
|
42693
|
+
if (ctx.style && ctx.promotedComments.length > 0) {
|
|
42694
|
+
pendingPromoted.push(...ctx.promotedComments);
|
|
42695
|
+
ctx.promotedComments = [];
|
|
42696
|
+
}
|
|
42147
42697
|
continue;
|
|
42148
42698
|
}
|
|
42699
|
+
|
|
42700
|
+
// apply promoted comments from PREVIOUS children as commentBefore on this element
|
|
42701
|
+
if (ctx.style && pendingPromoted.length > 0) {
|
|
42702
|
+
const target = Array.isArray(result) ? result[0] : result;
|
|
42703
|
+
if (target) {
|
|
42704
|
+
if (!target.style) target.style = {};
|
|
42705
|
+
const yaml = target.style.yaml ?? {};
|
|
42706
|
+
const existing = yaml.commentBefore;
|
|
42707
|
+
const promoted = pendingPromoted.join('\n');
|
|
42708
|
+
yaml.commentBefore = existing ? `${promoted}\n${existing}` : promoted;
|
|
42709
|
+
target.style.yaml = yaml;
|
|
42710
|
+
}
|
|
42711
|
+
pendingPromoted = [];
|
|
42712
|
+
}
|
|
42713
|
+
|
|
42714
|
+
// collect any promoted comments generated by this child's transform
|
|
42715
|
+
// (these will be applied to the NEXT sibling)
|
|
42716
|
+
if (ctx.style && ctx.promotedComments.length > 0) {
|
|
42717
|
+
pendingPromoted.push(...ctx.promotedComments);
|
|
42718
|
+
ctx.promotedComments = [];
|
|
42719
|
+
}
|
|
42149
42720
|
if (Array.isArray(result)) {
|
|
42150
42721
|
results.push(...result);
|
|
42151
42722
|
} else {
|
|
42152
42723
|
results.push(result);
|
|
42153
42724
|
}
|
|
42154
42725
|
}
|
|
42726
|
+
|
|
42727
|
+
// if promoted comments remain after all children, propagate up to parent scope
|
|
42728
|
+
if (pendingPromoted.length > 0) {
|
|
42729
|
+
ctx.promotedComments.push(...pendingPromoted);
|
|
42730
|
+
}
|
|
42155
42731
|
return results;
|
|
42156
42732
|
};
|
|
42157
42733
|
|
|
42158
42734
|
// Stream: Wraps transformed children in ParseResultElement
|
|
42159
42735
|
const transformStream = (node, ctx) => {
|
|
42736
|
+
// detect indent from the stream structure (only needed for style preservation)
|
|
42737
|
+
if (ctx.style) {
|
|
42738
|
+
ctx.indent = detectIndent(node);
|
|
42739
|
+
}
|
|
42160
42740
|
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_7__["default"]();
|
|
42161
42741
|
|
|
42162
42742
|
// Transform all children
|
|
@@ -42202,12 +42782,35 @@ const transformDocument = (node, ctx) => {
|
|
|
42202
42782
|
return transformChildren(node.children || [], ctx);
|
|
42203
42783
|
};
|
|
42204
42784
|
|
|
42785
|
+
// shared logic for transformMapping and transformSequence
|
|
42786
|
+
const transformCollection = (element, node, ctx) => {
|
|
42787
|
+
const typedNode = node;
|
|
42788
|
+
const children = node.children || [];
|
|
42789
|
+
if (ctx.style) {
|
|
42790
|
+
if (ctx.flowCollectionPadding === null && node.styleGroup === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_9__.YamlStyleGroup.Flow) {
|
|
42791
|
+
ctx.flowCollectionPadding = detectFlowPadding(typedNode);
|
|
42792
|
+
}
|
|
42793
|
+
const comments = collectComments(children, typedNode.startCharacter);
|
|
42794
|
+
const childElements = transformChildren(children, ctx);
|
|
42795
|
+
// bypass content setter to avoid re-refracting already-transformed elements
|
|
42796
|
+
element._content = childElements; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
42797
|
+
applyComments(childElements, comments);
|
|
42798
|
+
element.style = buildYamlStyle(node, ctx, {
|
|
42799
|
+
comment: comments.trailing
|
|
42800
|
+
});
|
|
42801
|
+
if (comments.outOfScope.length > 0) {
|
|
42802
|
+
ctx.promotedComments.push(...comments.outOfScope);
|
|
42803
|
+
}
|
|
42804
|
+
} else {
|
|
42805
|
+
element._content = transformChildren(children, ctx); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
42806
|
+
}
|
|
42807
|
+
maybeAddSourceMap(typedNode, element, ctx);
|
|
42808
|
+
};
|
|
42809
|
+
|
|
42205
42810
|
// Mapping: Transforms to ObjectElement
|
|
42206
42811
|
const transformMapping = (node, ctx) => {
|
|
42207
42812
|
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__["default"]();
|
|
42208
|
-
|
|
42209
|
-
element._content = transformChildren(node.children || [], ctx);
|
|
42210
|
-
maybeAddSourceMap(node, element, ctx);
|
|
42813
|
+
transformCollection(element, node, ctx);
|
|
42211
42814
|
return element;
|
|
42212
42815
|
};
|
|
42213
42816
|
|
|
@@ -42241,9 +42844,7 @@ const transformKeyValuePair = (node, ctx) => {
|
|
|
42241
42844
|
// Sequence: Transforms to ArrayElement
|
|
42242
42845
|
const transformSequence = (node, ctx) => {
|
|
42243
42846
|
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]();
|
|
42244
|
-
|
|
42245
|
-
element._content = transformChildren(node.children || [], ctx);
|
|
42246
|
-
maybeAddSourceMap(node, element, ctx);
|
|
42847
|
+
transformCollection(element, node, ctx);
|
|
42247
42848
|
return element;
|
|
42248
42849
|
};
|
|
42249
42850
|
|
|
@@ -42256,6 +42857,15 @@ const transformScalar = (node, ctx) => {
|
|
|
42256
42857
|
element.classes.push('yaml-e-node');
|
|
42257
42858
|
element.classes.push('yaml-e-scalar');
|
|
42258
42859
|
}
|
|
42860
|
+
if (ctx.style) {
|
|
42861
|
+
const extras = {
|
|
42862
|
+
scalarStyle: node.style
|
|
42863
|
+
};
|
|
42864
|
+
if (node.rawContent !== undefined) {
|
|
42865
|
+
extras.rawContent = node.rawContent;
|
|
42866
|
+
}
|
|
42867
|
+
element.style = buildYamlStyle(node, ctx, extras);
|
|
42868
|
+
}
|
|
42259
42869
|
maybeAddSourceMap(node, element, ctx);
|
|
42260
42870
|
return element;
|
|
42261
42871
|
};
|
|
@@ -42320,13 +42930,18 @@ const transformRootError = (node, ctx) => {
|
|
|
42320
42930
|
* @public
|
|
42321
42931
|
*/
|
|
42322
42932
|
const transformYamlAstToApiDOM = (yamlAst, {
|
|
42323
|
-
sourceMap = false
|
|
42933
|
+
sourceMap = false,
|
|
42934
|
+
style = false
|
|
42324
42935
|
} = {}) => {
|
|
42325
42936
|
const ctx = {
|
|
42326
42937
|
sourceMap,
|
|
42938
|
+
style,
|
|
42327
42939
|
namespace: new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__["default"](),
|
|
42328
42940
|
annotations: [],
|
|
42329
|
-
processedDocumentCount: 0
|
|
42941
|
+
processedDocumentCount: 0,
|
|
42942
|
+
indent: 2,
|
|
42943
|
+
flowCollectionPadding: null,
|
|
42944
|
+
promotedComments: []
|
|
42330
42945
|
};
|
|
42331
42946
|
const rootNode = yamlAst.rootNode;
|
|
42332
42947
|
|
|
@@ -42925,6 +43540,8 @@ class YamlNode extends _Node_mjs__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
42925
43540
|
tag;
|
|
42926
43541
|
style;
|
|
42927
43542
|
styleGroup;
|
|
43543
|
+
comment;
|
|
43544
|
+
commentBefore;
|
|
42928
43545
|
constructor({
|
|
42929
43546
|
anchor,
|
|
42930
43547
|
tag,
|
|
@@ -42964,6 +43581,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
42964
43581
|
class YamlScalar extends _YamlNode_mjs__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
42965
43582
|
static type = 'scalar';
|
|
42966
43583
|
content;
|
|
43584
|
+
rawContent;
|
|
42967
43585
|
constructor({
|
|
42968
43586
|
content,
|
|
42969
43587
|
...rest
|
|
@@ -43761,7 +44379,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
43761
44379
|
* @public
|
|
43762
44380
|
*/
|
|
43763
44381
|
const analyze = (cst, {
|
|
43764
|
-
sourceMap = false
|
|
44382
|
+
sourceMap = false,
|
|
44383
|
+
style = false
|
|
43765
44384
|
} = {}) => {
|
|
43766
44385
|
const cursor = cst.walk();
|
|
43767
44386
|
const schema = new _ast_schemas_json_index_mjs__WEBPACK_IMPORTED_MODULE_0__["default"]();
|
|
@@ -43776,7 +44395,8 @@ const analyze = (cst, {
|
|
|
43776
44395
|
|
|
43777
44396
|
// Pass 2: YAML AST -> ApiDOM (direct transformation)
|
|
43778
44397
|
return (0,_YamlAstTransformer_mjs__WEBPACK_IMPORTED_MODULE_3__.transformYamlAstToApiDOM)(yamlAst, {
|
|
43779
|
-
sourceMap
|
|
44398
|
+
sourceMap,
|
|
44399
|
+
style
|
|
43780
44400
|
});
|
|
43781
44401
|
};
|
|
43782
44402
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (analyze);
|