@speclynx/apidom-parser-adapter-openapi-json-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.
|
@@ -11151,6 +11151,53 @@ var both = /*#__PURE__*/(0,_internal_curry2_js__WEBPACK_IMPORTED_MODULE_0__["def
|
|
|
11151
11151
|
|
|
11152
11152
|
/***/ },
|
|
11153
11153
|
|
|
11154
|
+
/***/ 8138
|
|
11155
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
11156
|
+
|
|
11157
|
+
"use strict";
|
|
11158
|
+
__webpack_require__.r(__webpack_exports__);
|
|
11159
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
11160
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
11161
|
+
/* harmony export */ });
|
|
11162
|
+
/* harmony import */ var _internal_clone_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8575);
|
|
11163
|
+
/* harmony import */ var _internal_curry1_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8938);
|
|
11164
|
+
|
|
11165
|
+
|
|
11166
|
+
|
|
11167
|
+
/**
|
|
11168
|
+
* Creates a deep copy of the source that can be used in place of the source
|
|
11169
|
+
* object without retaining any references to it.
|
|
11170
|
+
* The source object may contain (nested) `Array`s and `Object`s,
|
|
11171
|
+
* `Number`s, `String`s, `Boolean`s and `Date`s.
|
|
11172
|
+
* `Function`s are assigned by reference rather than copied.
|
|
11173
|
+
*
|
|
11174
|
+
* Dispatches to a `clone` method if present.
|
|
11175
|
+
*
|
|
11176
|
+
* Note that if the source object has multiple nodes that share a reference,
|
|
11177
|
+
* the returned object will have the same structure, but the references will
|
|
11178
|
+
* be pointed to the location within the cloned value.
|
|
11179
|
+
*
|
|
11180
|
+
* @func
|
|
11181
|
+
* @memberOf R
|
|
11182
|
+
* @since v0.1.0
|
|
11183
|
+
* @category Object
|
|
11184
|
+
* @sig {*} -> {*}
|
|
11185
|
+
* @param {*} value The object or array to clone
|
|
11186
|
+
* @return {*} A deeply cloned copy of `val`
|
|
11187
|
+
* @example
|
|
11188
|
+
*
|
|
11189
|
+
* const objects = [{}, {}, {}];
|
|
11190
|
+
* const objectsClone = R.clone(objects);
|
|
11191
|
+
* objects === objectsClone; //=> false
|
|
11192
|
+
* objects[0] === objectsClone[0]; //=> false
|
|
11193
|
+
*/
|
|
11194
|
+
var clone = /*#__PURE__*/(0,_internal_curry1_js__WEBPACK_IMPORTED_MODULE_1__["default"])(function clone(value) {
|
|
11195
|
+
return value != null && typeof value.clone === 'function' ? value.clone() : (0,_internal_clone_js__WEBPACK_IMPORTED_MODULE_0__["default"])(value, true);
|
|
11196
|
+
});
|
|
11197
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (clone);
|
|
11198
|
+
|
|
11199
|
+
/***/ },
|
|
11200
|
+
|
|
11154
11201
|
/***/ 8199
|
|
11155
11202
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
11156
11203
|
|
|
@@ -12447,6 +12494,132 @@ function _checkForMethod(methodname, fn) {
|
|
|
12447
12494
|
|
|
12448
12495
|
/***/ },
|
|
12449
12496
|
|
|
12497
|
+
/***/ 8575
|
|
12498
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
12499
|
+
|
|
12500
|
+
"use strict";
|
|
12501
|
+
__webpack_require__.r(__webpack_exports__);
|
|
12502
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12503
|
+
/* harmony export */ "default": () => (/* binding */ _clone)
|
|
12504
|
+
/* harmony export */ });
|
|
12505
|
+
/* harmony import */ var _cloneRegExp_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1254);
|
|
12506
|
+
/* harmony import */ var _type_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(963);
|
|
12507
|
+
|
|
12508
|
+
|
|
12509
|
+
|
|
12510
|
+
/**
|
|
12511
|
+
* Copies an object.
|
|
12512
|
+
*
|
|
12513
|
+
* @private
|
|
12514
|
+
* @param {*} value The value to be copied
|
|
12515
|
+
* @param {Boolean} deep Whether or not to perform deep cloning.
|
|
12516
|
+
* @return {*} The copied value.
|
|
12517
|
+
*/
|
|
12518
|
+
function _clone(value, deep, map) {
|
|
12519
|
+
map || (map = new _ObjectMap());
|
|
12520
|
+
|
|
12521
|
+
// this avoids the slower switch with a quick if decision removing some milliseconds in each run.
|
|
12522
|
+
if (_isPrimitive(value)) {
|
|
12523
|
+
return value;
|
|
12524
|
+
}
|
|
12525
|
+
var copy = function copy(copiedValue) {
|
|
12526
|
+
// Check for circular and same references on the object graph and return its corresponding clone.
|
|
12527
|
+
var cachedCopy = map.get(value);
|
|
12528
|
+
if (cachedCopy) {
|
|
12529
|
+
return cachedCopy;
|
|
12530
|
+
}
|
|
12531
|
+
map.set(value, copiedValue);
|
|
12532
|
+
for (var key in value) {
|
|
12533
|
+
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
|
12534
|
+
copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
|
|
12535
|
+
}
|
|
12536
|
+
}
|
|
12537
|
+
return copiedValue;
|
|
12538
|
+
};
|
|
12539
|
+
switch ((0,_type_js__WEBPACK_IMPORTED_MODULE_1__["default"])(value)) {
|
|
12540
|
+
case 'Object':
|
|
12541
|
+
return copy(Object.create(Object.getPrototypeOf(value)));
|
|
12542
|
+
case 'Array':
|
|
12543
|
+
return copy(Array(value.length));
|
|
12544
|
+
case 'Date':
|
|
12545
|
+
return new Date(value.valueOf());
|
|
12546
|
+
case 'RegExp':
|
|
12547
|
+
return (0,_cloneRegExp_js__WEBPACK_IMPORTED_MODULE_0__["default"])(value);
|
|
12548
|
+
case 'Int8Array':
|
|
12549
|
+
case 'Uint8Array':
|
|
12550
|
+
case 'Uint8ClampedArray':
|
|
12551
|
+
case 'Int16Array':
|
|
12552
|
+
case 'Uint16Array':
|
|
12553
|
+
case 'Int32Array':
|
|
12554
|
+
case 'Uint32Array':
|
|
12555
|
+
case 'Float32Array':
|
|
12556
|
+
case 'Float64Array':
|
|
12557
|
+
case 'BigInt64Array':
|
|
12558
|
+
case 'BigUint64Array':
|
|
12559
|
+
return value.slice();
|
|
12560
|
+
default:
|
|
12561
|
+
return value;
|
|
12562
|
+
}
|
|
12563
|
+
}
|
|
12564
|
+
function _isPrimitive(param) {
|
|
12565
|
+
var type = typeof param;
|
|
12566
|
+
return param == null || type != 'object' && type != 'function';
|
|
12567
|
+
}
|
|
12568
|
+
var _ObjectMap = /*#__PURE__*/function () {
|
|
12569
|
+
function _ObjectMap() {
|
|
12570
|
+
this.map = {};
|
|
12571
|
+
this.length = 0;
|
|
12572
|
+
}
|
|
12573
|
+
_ObjectMap.prototype.set = function (key, value) {
|
|
12574
|
+
var hashedKey = this.hash(key);
|
|
12575
|
+
var bucket = this.map[hashedKey];
|
|
12576
|
+
if (!bucket) {
|
|
12577
|
+
this.map[hashedKey] = bucket = [];
|
|
12578
|
+
}
|
|
12579
|
+
bucket.push([key, value]);
|
|
12580
|
+
this.length += 1;
|
|
12581
|
+
};
|
|
12582
|
+
_ObjectMap.prototype.hash = function (key) {
|
|
12583
|
+
var hashedKey = [];
|
|
12584
|
+
for (var value in key) {
|
|
12585
|
+
hashedKey.push(Object.prototype.toString.call(key[value]));
|
|
12586
|
+
}
|
|
12587
|
+
return hashedKey.join();
|
|
12588
|
+
};
|
|
12589
|
+
_ObjectMap.prototype.get = function (key) {
|
|
12590
|
+
/**
|
|
12591
|
+
* 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,
|
|
12592
|
+
* on my tests this number is 180, anything above that using the hash function is faster.
|
|
12593
|
+
*/
|
|
12594
|
+
if (this.length <= 180) {
|
|
12595
|
+
for (var p in this.map) {
|
|
12596
|
+
var bucket = this.map[p];
|
|
12597
|
+
for (var i = 0; i < bucket.length; i += 1) {
|
|
12598
|
+
var element = bucket[i];
|
|
12599
|
+
if (element[0] === key) {
|
|
12600
|
+
return element[1];
|
|
12601
|
+
}
|
|
12602
|
+
}
|
|
12603
|
+
}
|
|
12604
|
+
return;
|
|
12605
|
+
}
|
|
12606
|
+
var hashedKey = this.hash(key);
|
|
12607
|
+
var bucket = this.map[hashedKey];
|
|
12608
|
+
if (!bucket) {
|
|
12609
|
+
return;
|
|
12610
|
+
}
|
|
12611
|
+
for (var i = 0; i < bucket.length; i += 1) {
|
|
12612
|
+
var element = bucket[i];
|
|
12613
|
+
if (element[0] === key) {
|
|
12614
|
+
return element[1];
|
|
12615
|
+
}
|
|
12616
|
+
}
|
|
12617
|
+
};
|
|
12618
|
+
return _ObjectMap;
|
|
12619
|
+
}();
|
|
12620
|
+
|
|
12621
|
+
/***/ },
|
|
12622
|
+
|
|
12450
12623
|
/***/ 1254
|
|
12451
12624
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
12452
12625
|
|
|
@@ -20131,6 +20304,7 @@ const predicates = {
|
|
|
20131
20304
|
isCommentElement: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isCommentElement,
|
|
20132
20305
|
isParseResultElement: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isParseResultElement,
|
|
20133
20306
|
isSourceMapElement: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isSourceMapElement,
|
|
20307
|
+
hasElementStyle: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.hasElementStyle,
|
|
20134
20308
|
hasElementSourceMap: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.hasElementSourceMap,
|
|
20135
20309
|
includesSymbols: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.includesSymbols,
|
|
20136
20310
|
includesClasses: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.includesClasses
|
|
@@ -20202,7 +20376,19 @@ const resolveSpecification = specification => {
|
|
|
20202
20376
|
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)) {
|
|
20203
20377
|
const $ref = (0,ramda__WEBPACK_IMPORTED_MODULE_2__["default"])(['$ref'], val);
|
|
20204
20378
|
const pointer = (0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_6__["default"])('#/', $ref);
|
|
20205
|
-
|
|
20379
|
+
const resolved = (0,ramda__WEBPACK_IMPORTED_MODULE_2__["default"])(pointer.split('/'), root);
|
|
20380
|
+
// merge extra properties (e.g. alias) from the $ref object into the resolved value
|
|
20381
|
+
const {
|
|
20382
|
+
$ref: _,
|
|
20383
|
+
...rest
|
|
20384
|
+
} = val;
|
|
20385
|
+
if (Object.keys(rest).length > 0 && (0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_5__["default"])(resolved)) {
|
|
20386
|
+
return {
|
|
20387
|
+
...resolved,
|
|
20388
|
+
...rest
|
|
20389
|
+
};
|
|
20390
|
+
}
|
|
20391
|
+
return resolved;
|
|
20206
20392
|
}
|
|
20207
20393
|
if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_5__["default"])(val)) {
|
|
20208
20394
|
return traverse(val, root, newPath);
|
|
@@ -20825,20 +21011,22 @@ class ShallowCloneError extends _CloneError_mjs__WEBPACK_IMPORTED_MODULE_0__["de
|
|
|
20825
21011
|
"use strict";
|
|
20826
21012
|
__webpack_require__.r(__webpack_exports__);
|
|
20827
21013
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
20828
|
-
/* harmony export */ CloneError: () => (/* reexport safe */
|
|
20829
|
-
/* harmony export */ DeepCloneError: () => (/* reexport safe */
|
|
20830
|
-
/* harmony export */ ShallowCloneError: () => (/* reexport safe */
|
|
21014
|
+
/* harmony export */ CloneError: () => (/* reexport safe */ _errors_CloneError_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]),
|
|
21015
|
+
/* harmony export */ DeepCloneError: () => (/* reexport safe */ _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]),
|
|
21016
|
+
/* harmony export */ ShallowCloneError: () => (/* reexport safe */ _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]),
|
|
20831
21017
|
/* harmony export */ cloneDeep: () => (/* binding */ cloneDeep),
|
|
20832
21018
|
/* harmony export */ cloneShallow: () => (/* binding */ cloneShallow)
|
|
20833
21019
|
/* harmony export */ });
|
|
20834
|
-
/* harmony import */ var
|
|
20835
|
-
/* harmony import */ var
|
|
20836
|
-
/* harmony import */ var
|
|
20837
|
-
/* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
|
|
20838
|
-
/* harmony import */ var
|
|
20839
|
-
/* harmony import */ var
|
|
20840
|
-
/* harmony import */ var
|
|
20841
|
-
/* harmony import */ var
|
|
21020
|
+
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8138);
|
|
21021
|
+
/* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8504);
|
|
21022
|
+
/* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6663);
|
|
21023
|
+
/* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8252);
|
|
21024
|
+
/* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5162);
|
|
21025
|
+
/* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5810);
|
|
21026
|
+
/* harmony import */ var _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5018);
|
|
21027
|
+
/* harmony import */ var _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(3686);
|
|
21028
|
+
/* harmony import */ var _errors_CloneError_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(3772);
|
|
21029
|
+
|
|
20842
21030
|
|
|
20843
21031
|
|
|
20844
21032
|
|
|
@@ -20871,9 +21059,9 @@ const cloneDeepElement = (element, options) => {
|
|
|
20871
21059
|
} = element;
|
|
20872
21060
|
if (Array.isArray(content)) {
|
|
20873
21061
|
copy.content = content.map(el => cloneDeepElement(el, passThroughOptions));
|
|
20874
|
-
} else if ((0,
|
|
21062
|
+
} else if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(content)) {
|
|
20875
21063
|
copy.content = cloneDeepElement(content, passThroughOptions);
|
|
20876
|
-
} else if (content instanceof
|
|
21064
|
+
} else if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
20877
21065
|
copy.content = cloneDeepKeyValuePair(content, passThroughOptions);
|
|
20878
21066
|
} else {
|
|
20879
21067
|
copy.content = content;
|
|
@@ -20897,7 +21085,7 @@ const cloneDeepKeyValuePair = (kvp, options) => {
|
|
|
20897
21085
|
} = kvp;
|
|
20898
21086
|
const keyCopy = key !== undefined ? cloneDeepElement(key, passThroughOptions) : undefined;
|
|
20899
21087
|
const valueCopy = value !== undefined ? cloneDeepElement(value, passThroughOptions) : undefined;
|
|
20900
|
-
const copy = new
|
|
21088
|
+
const copy = new _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"](keyCopy, valueCopy);
|
|
20901
21089
|
visited.set(kvp, copy);
|
|
20902
21090
|
return copy;
|
|
20903
21091
|
};
|
|
@@ -20913,7 +21101,7 @@ const cloneDeepObjectSlice = (slice, options) => {
|
|
|
20913
21101
|
return visited.get(slice);
|
|
20914
21102
|
}
|
|
20915
21103
|
const items = [...slice].map(element => cloneDeepElement(element, passThroughOptions));
|
|
20916
|
-
const copy = new
|
|
21104
|
+
const copy = new _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"](items);
|
|
20917
21105
|
visited.set(slice, copy);
|
|
20918
21106
|
return copy;
|
|
20919
21107
|
};
|
|
@@ -20924,16 +21112,16 @@ const cloneDeepObjectSlice = (slice, options) => {
|
|
|
20924
21112
|
* @public
|
|
20925
21113
|
*/
|
|
20926
21114
|
const cloneDeep = (value, options = {}) => {
|
|
20927
|
-
if (value instanceof
|
|
21115
|
+
if (value instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
20928
21116
|
return cloneDeepKeyValuePair(value, options);
|
|
20929
21117
|
}
|
|
20930
|
-
if (value instanceof
|
|
21118
|
+
if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
|
|
20931
21119
|
return cloneDeepObjectSlice(value, options);
|
|
20932
21120
|
}
|
|
20933
|
-
if ((0,
|
|
21121
|
+
if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(value)) {
|
|
20934
21122
|
return cloneDeepElement(value, options);
|
|
20935
21123
|
}
|
|
20936
|
-
throw new
|
|
21124
|
+
throw new _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]("Value provided to cloneDeep function couldn't be cloned", {
|
|
20937
21125
|
value
|
|
20938
21126
|
});
|
|
20939
21127
|
};
|
|
@@ -20949,11 +21137,11 @@ const cloneShallowKeyValuePair = keyValuePair => {
|
|
|
20949
21137
|
key,
|
|
20950
21138
|
value
|
|
20951
21139
|
} = keyValuePair;
|
|
20952
|
-
return new
|
|
21140
|
+
return new _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"](key, value);
|
|
20953
21141
|
};
|
|
20954
21142
|
const cloneShallowObjectSlice = objectSlice => {
|
|
20955
21143
|
const items = [...objectSlice];
|
|
20956
|
-
return new
|
|
21144
|
+
return new _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"](items);
|
|
20957
21145
|
};
|
|
20958
21146
|
const cloneShallowElement = element => {
|
|
20959
21147
|
const Ctor = element.constructor;
|
|
@@ -20965,17 +21153,20 @@ const cloneShallowElement = element => {
|
|
|
20965
21153
|
if (!element.isAttributesEmpty) {
|
|
20966
21154
|
copy.attributes = cloneDeep(element.attributes);
|
|
20967
21155
|
}
|
|
20968
|
-
if ((0,
|
|
20969
|
-
|
|
21156
|
+
if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.hasElementSourceMap)(element)) {
|
|
21157
|
+
_elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_5__["default"].transfer(element, copy);
|
|
21158
|
+
}
|
|
21159
|
+
if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.hasElementStyle)(element)) {
|
|
21160
|
+
copy.style = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(element.style);
|
|
20970
21161
|
}
|
|
20971
21162
|
const {
|
|
20972
21163
|
content
|
|
20973
21164
|
} = element;
|
|
20974
|
-
if ((0,
|
|
21165
|
+
if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(content)) {
|
|
20975
21166
|
copy.content = cloneShallowElement(content);
|
|
20976
21167
|
} else if (Array.isArray(content)) {
|
|
20977
21168
|
copy.content = [...content];
|
|
20978
|
-
} else if (content instanceof
|
|
21169
|
+
} else if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
20979
21170
|
copy.content = cloneShallowKeyValuePair(content);
|
|
20980
21171
|
} else {
|
|
20981
21172
|
copy.content = content;
|
|
@@ -20990,16 +21181,16 @@ const cloneShallowElement = element => {
|
|
|
20990
21181
|
* @public
|
|
20991
21182
|
*/
|
|
20992
21183
|
const cloneShallow = value => {
|
|
20993
|
-
if (value instanceof
|
|
21184
|
+
if (value instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
|
|
20994
21185
|
return cloneShallowKeyValuePair(value);
|
|
20995
21186
|
}
|
|
20996
|
-
if (value instanceof
|
|
21187
|
+
if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
|
|
20997
21188
|
return cloneShallowObjectSlice(value);
|
|
20998
21189
|
}
|
|
20999
|
-
if ((0,
|
|
21190
|
+
if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(value)) {
|
|
21000
21191
|
return cloneShallowElement(value);
|
|
21001
21192
|
}
|
|
21002
|
-
throw new
|
|
21193
|
+
throw new _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]("Value provided to cloneShallow function couldn't be cloned", {
|
|
21003
21194
|
value
|
|
21004
21195
|
});
|
|
21005
21196
|
};
|
|
@@ -21426,6 +21617,66 @@ function unpackSourceMap(packed) {
|
|
|
21426
21617
|
|
|
21427
21618
|
/***/ },
|
|
21428
21619
|
|
|
21620
|
+
/***/ 9686
|
|
21621
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
21622
|
+
|
|
21623
|
+
"use strict";
|
|
21624
|
+
__webpack_require__.r(__webpack_exports__);
|
|
21625
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
21626
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
21627
|
+
/* harmony export */ });
|
|
21628
|
+
/* harmony import */ var _primitives_ObjectElement_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7071);
|
|
21629
|
+
|
|
21630
|
+
/**
|
|
21631
|
+
* Shape with optional style property.
|
|
21632
|
+
* @public
|
|
21633
|
+
*/
|
|
21634
|
+
/**
|
|
21635
|
+
* StyleElement stores format-specific style information for round-trip preservation.
|
|
21636
|
+
*
|
|
21637
|
+
* The style data is stored as a plain object with format-specific namespaces
|
|
21638
|
+
* (e.g., `yaml`, `json`). This element exists only during serialization/deserialization
|
|
21639
|
+
* (refract format) - in memory, style lives directly on `element.style`.
|
|
21640
|
+
*
|
|
21641
|
+
* Follows the same pattern as SourceMapElement with __mappings__.
|
|
21642
|
+
*
|
|
21643
|
+
* @public
|
|
21644
|
+
*/
|
|
21645
|
+
class StyleElement extends _primitives_ObjectElement_mjs__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
21646
|
+
constructor(content, meta, attributes) {
|
|
21647
|
+
super(content, meta, attributes);
|
|
21648
|
+
this.element = '__styles__';
|
|
21649
|
+
}
|
|
21650
|
+
|
|
21651
|
+
/**
|
|
21652
|
+
* Transfers style property from one element to another.
|
|
21653
|
+
*/
|
|
21654
|
+
static transfer(from, to) {
|
|
21655
|
+
to.style = from.style;
|
|
21656
|
+
}
|
|
21657
|
+
|
|
21658
|
+
/**
|
|
21659
|
+
* Creates a StyleElement from an element's style property.
|
|
21660
|
+
* Returns undefined if the element has no style.
|
|
21661
|
+
*/
|
|
21662
|
+
static from(source) {
|
|
21663
|
+
if (!source.style) {
|
|
21664
|
+
return undefined;
|
|
21665
|
+
}
|
|
21666
|
+
return new StyleElement(source.style);
|
|
21667
|
+
}
|
|
21668
|
+
|
|
21669
|
+
/**
|
|
21670
|
+
* Restores the style property on the target element from this StyleElement.
|
|
21671
|
+
*/
|
|
21672
|
+
applyTo(target) {
|
|
21673
|
+
target.style = this.toValue();
|
|
21674
|
+
}
|
|
21675
|
+
}
|
|
21676
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (StyleElement);
|
|
21677
|
+
|
|
21678
|
+
/***/ },
|
|
21679
|
+
|
|
21429
21680
|
/***/ 6911
|
|
21430
21681
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
21431
21682
|
|
|
@@ -21490,6 +21741,7 @@ const isSourceMapElement = element => element instanceof _elements_SourceMap_mjs
|
|
|
21490
21741
|
__webpack_require__.r(__webpack_exports__);
|
|
21491
21742
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
21492
21743
|
/* harmony export */ hasElementSourceMap: () => (/* binding */ hasElementSourceMap),
|
|
21744
|
+
/* harmony export */ hasElementStyle: () => (/* binding */ hasElementStyle),
|
|
21493
21745
|
/* harmony export */ includesClasses: () => (/* binding */ includesClasses),
|
|
21494
21746
|
/* harmony export */ includesSymbols: () => (/* binding */ includesSymbols),
|
|
21495
21747
|
/* harmony export */ isAnnotationElement: () => (/* reexport safe */ _elements_mjs__WEBPACK_IMPORTED_MODULE_1__.isAnnotationElement),
|
|
@@ -21514,6 +21766,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
21514
21766
|
|
|
21515
21767
|
|
|
21516
21768
|
|
|
21769
|
+
/**
|
|
21770
|
+
* Checks if an element has format-specific style information.
|
|
21771
|
+
* @public
|
|
21772
|
+
*/
|
|
21773
|
+
const hasElementStyle = element => {
|
|
21774
|
+
return element.style !== undefined;
|
|
21775
|
+
};
|
|
21776
|
+
|
|
21517
21777
|
/**
|
|
21518
21778
|
* Checks if an element has complete source position information.
|
|
21519
21779
|
* Returns true only if all 6 position properties are numbers.
|
|
@@ -22055,6 +22315,12 @@ class Element {
|
|
|
22055
22315
|
*/
|
|
22056
22316
|
parent;
|
|
22057
22317
|
|
|
22318
|
+
/**
|
|
22319
|
+
* Format-specific style information for round-trip preservation.
|
|
22320
|
+
* Each format owns its own namespace (e.g., `yaml`, `json`).
|
|
22321
|
+
*/
|
|
22322
|
+
style;
|
|
22323
|
+
|
|
22058
22324
|
// ============================================================================
|
|
22059
22325
|
// Source Position (LSP-compatible, TextDocument-compatible, UTF-16 code units)
|
|
22060
22326
|
// web-tree-sitter automatically provides position data in UTF-16 code units.
|
|
@@ -22263,7 +22529,13 @@ class Element {
|
|
|
22263
22529
|
|
|
22264
22530
|
/** Unique identifier for this element. */
|
|
22265
22531
|
get id() {
|
|
22266
|
-
|
|
22532
|
+
if (this.isFrozen) {
|
|
22533
|
+
return this.getMetaProperty('id', '');
|
|
22534
|
+
}
|
|
22535
|
+
if (!this.hasMetaProperty('id')) {
|
|
22536
|
+
this.setMetaProperty('id', '');
|
|
22537
|
+
}
|
|
22538
|
+
return this.meta.get('id');
|
|
22267
22539
|
}
|
|
22268
22540
|
set id(value) {
|
|
22269
22541
|
this.setMetaProperty('id', value);
|
|
@@ -22271,7 +22543,13 @@ class Element {
|
|
|
22271
22543
|
|
|
22272
22544
|
/** CSS-like class names. */
|
|
22273
22545
|
get classes() {
|
|
22274
|
-
|
|
22546
|
+
if (this.isFrozen) {
|
|
22547
|
+
return this.getMetaProperty('classes', []);
|
|
22548
|
+
}
|
|
22549
|
+
if (!this.hasMetaProperty('classes')) {
|
|
22550
|
+
this.setMetaProperty('classes', []);
|
|
22551
|
+
}
|
|
22552
|
+
return this.meta.get('classes');
|
|
22275
22553
|
}
|
|
22276
22554
|
set classes(value) {
|
|
22277
22555
|
this.setMetaProperty('classes', value);
|
|
@@ -22279,7 +22557,13 @@ class Element {
|
|
|
22279
22557
|
|
|
22280
22558
|
/** Hyperlinks associated with this element. */
|
|
22281
22559
|
get links() {
|
|
22282
|
-
|
|
22560
|
+
if (this.isFrozen) {
|
|
22561
|
+
return this.getMetaProperty('links', []);
|
|
22562
|
+
}
|
|
22563
|
+
if (!this.hasMetaProperty('links')) {
|
|
22564
|
+
this.setMetaProperty('links', []);
|
|
22565
|
+
}
|
|
22566
|
+
return this.meta.get('links');
|
|
22283
22567
|
}
|
|
22284
22568
|
set links(value) {
|
|
22285
22569
|
this.setMetaProperty('links', value);
|
|
@@ -22430,16 +22714,26 @@ class Element {
|
|
|
22430
22714
|
}
|
|
22431
22715
|
|
|
22432
22716
|
/**
|
|
22433
|
-
* Gets a meta property
|
|
22717
|
+
* Gets a meta property.
|
|
22718
|
+
*
|
|
22719
|
+
* When the property doesn't exist:
|
|
22720
|
+
* - With defaultValue: returns a new refracted element instance (not cached)
|
|
22721
|
+
* - Without defaultValue: returns undefined
|
|
22722
|
+
*
|
|
22723
|
+
* Note: Each call with a default creates a new instance. Use setMetaProperty
|
|
22724
|
+
* first if you need reference equality across multiple accesses.
|
|
22434
22725
|
*/
|
|
22726
|
+
|
|
22435
22727
|
getMetaProperty(name, defaultValue) {
|
|
22436
|
-
if (!this.
|
|
22437
|
-
if (
|
|
22438
|
-
|
|
22728
|
+
if (!this.hasMetaProperty(name)) {
|
|
22729
|
+
if (defaultValue === undefined) {
|
|
22730
|
+
return undefined;
|
|
22731
|
+
}
|
|
22732
|
+
const element = this.refract(defaultValue);
|
|
22733
|
+
if (element && this.isFrozen) {
|
|
22439
22734
|
element.freeze();
|
|
22440
|
-
return element;
|
|
22441
22735
|
}
|
|
22442
|
-
|
|
22736
|
+
return element;
|
|
22443
22737
|
}
|
|
22444
22738
|
return this.meta.get(name);
|
|
22445
22739
|
}
|
|
@@ -22916,17 +23210,18 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
22916
23210
|
/* harmony export */ CollectionElement: () => (/* reexport safe */ _primitives_CollectionElement_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]),
|
|
22917
23211
|
/* harmony export */ CommentElement: () => (/* reexport safe */ _elements_Comment_mjs__WEBPACK_IMPORTED_MODULE_12__["default"]),
|
|
22918
23212
|
/* harmony export */ Element: () => (/* reexport safe */ _primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"]),
|
|
22919
|
-
/* harmony export */ KeyValuePair: () => (/* reexport safe */
|
|
23213
|
+
/* harmony export */ KeyValuePair: () => (/* reexport safe */ _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_17__["default"]),
|
|
22920
23214
|
/* harmony export */ LinkElement: () => (/* reexport safe */ _elements_LinkElement_mjs__WEBPACK_IMPORTED_MODULE_9__["default"]),
|
|
22921
23215
|
/* harmony export */ MemberElement: () => (/* reexport safe */ _primitives_MemberElement_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]),
|
|
22922
23216
|
/* harmony export */ NullElement: () => (/* reexport safe */ _primitives_NullElement_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]),
|
|
22923
23217
|
/* harmony export */ NumberElement: () => (/* reexport safe */ _primitives_NumberElement_mjs__WEBPACK_IMPORTED_MODULE_4__["default"]),
|
|
22924
23218
|
/* harmony export */ ObjectElement: () => (/* reexport safe */ _primitives_ObjectElement_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]),
|
|
22925
|
-
/* harmony export */ ObjectSlice: () => (/* reexport safe */
|
|
23219
|
+
/* harmony export */ ObjectSlice: () => (/* reexport safe */ _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_16__["default"]),
|
|
22926
23220
|
/* harmony export */ ParseResultElement: () => (/* reexport safe */ _elements_ParseResult_mjs__WEBPACK_IMPORTED_MODULE_13__["default"]),
|
|
22927
23221
|
/* harmony export */ RefElement: () => (/* reexport safe */ _elements_RefElement_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]),
|
|
22928
23222
|
/* harmony export */ SourceMapElement: () => (/* reexport safe */ _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_14__["default"]),
|
|
22929
23223
|
/* harmony export */ StringElement: () => (/* reexport safe */ _primitives_StringElement_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]),
|
|
23224
|
+
/* harmony export */ StyleElement: () => (/* reexport safe */ _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_15__["default"]),
|
|
22930
23225
|
/* harmony export */ refract: () => (/* binding */ refract)
|
|
22931
23226
|
/* harmony export */ });
|
|
22932
23227
|
/* harmony import */ var _primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(728);
|
|
@@ -22944,8 +23239,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
22944
23239
|
/* harmony import */ var _elements_Comment_mjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(94);
|
|
22945
23240
|
/* harmony import */ var _elements_ParseResult_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(4823);
|
|
22946
23241
|
/* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(5810);
|
|
22947
|
-
/* harmony import */ var
|
|
22948
|
-
/* harmony import */ var
|
|
23242
|
+
/* harmony import */ var _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(9686);
|
|
23243
|
+
/* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(8504);
|
|
23244
|
+
/* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(6663);
|
|
23245
|
+
|
|
22949
23246
|
|
|
22950
23247
|
|
|
22951
23248
|
|
|
@@ -23032,6 +23329,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
23032
23329
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
23033
23330
|
/* harmony export */ });
|
|
23034
23331
|
/* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5810);
|
|
23332
|
+
/* harmony import */ var _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9686);
|
|
23333
|
+
|
|
23035
23334
|
|
|
23036
23335
|
/**
|
|
23037
23336
|
* Serialized representation of an Element in JSON Refract format.
|
|
@@ -23090,6 +23389,17 @@ class JSONSerialiser {
|
|
|
23090
23389
|
payload.meta.__mappings__ = this.serialise(sourceMap);
|
|
23091
23390
|
}
|
|
23092
23391
|
}
|
|
23392
|
+
|
|
23393
|
+
// Serialize style as __styles__ in meta (skip for StyleElement itself)
|
|
23394
|
+
if (!(element instanceof _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])) {
|
|
23395
|
+
const styleElement = _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_1__["default"].from(element);
|
|
23396
|
+
if (styleElement) {
|
|
23397
|
+
if (!payload.meta) {
|
|
23398
|
+
payload.meta = {};
|
|
23399
|
+
}
|
|
23400
|
+
payload.meta.__styles__ = this.serialise(styleElement);
|
|
23401
|
+
}
|
|
23402
|
+
}
|
|
23093
23403
|
const content = this.serialiseContent(element.content);
|
|
23094
23404
|
if (content !== undefined) {
|
|
23095
23405
|
payload.content = content;
|
|
@@ -23110,15 +23420,18 @@ class JSONSerialiser {
|
|
|
23110
23420
|
element.element = value.element;
|
|
23111
23421
|
}
|
|
23112
23422
|
|
|
23113
|
-
// Extract __mappings__ without mutating input, filter remaining meta
|
|
23423
|
+
// Extract __mappings__ and __styles__ without mutating input, filter remaining meta
|
|
23114
23424
|
let mappingsDoc;
|
|
23425
|
+
let stylesDoc;
|
|
23115
23426
|
let metaToDeserialize = value.meta;
|
|
23116
|
-
if (value.meta?.__mappings__) {
|
|
23427
|
+
if (value.meta?.__mappings__ || value.meta?.__styles__) {
|
|
23117
23428
|
const {
|
|
23118
23429
|
__mappings__,
|
|
23430
|
+
__styles__,
|
|
23119
23431
|
...rest
|
|
23120
23432
|
} = value.meta;
|
|
23121
23433
|
mappingsDoc = __mappings__;
|
|
23434
|
+
stylesDoc = __styles__;
|
|
23122
23435
|
metaToDeserialize = Object.keys(rest).length > 0 ? rest : undefined;
|
|
23123
23436
|
}
|
|
23124
23437
|
if (metaToDeserialize) {
|
|
@@ -23130,6 +23443,12 @@ class JSONSerialiser {
|
|
|
23130
23443
|
const sourceMap = this.deserialise(mappingsDoc);
|
|
23131
23444
|
sourceMap.applyTo(element);
|
|
23132
23445
|
}
|
|
23446
|
+
|
|
23447
|
+
// Restore style from __styles__
|
|
23448
|
+
if (stylesDoc) {
|
|
23449
|
+
const styleElement = this.deserialise(stylesDoc);
|
|
23450
|
+
styleElement.applyTo(element);
|
|
23451
|
+
}
|
|
23133
23452
|
if (value.attributes) {
|
|
23134
23453
|
this.deserialiseObject(value.attributes, element.attributes);
|
|
23135
23454
|
}
|
|
@@ -23972,7 +24291,7 @@ const specification = {
|
|
|
23972
24291
|
fixedFields: {
|
|
23973
24292
|
// core vocabulary
|
|
23974
24293
|
id: {
|
|
23975
|
-
$
|
|
24294
|
+
$ref: '#/visitors/value',
|
|
23976
24295
|
alias: 'idField'
|
|
23977
24296
|
},
|
|
23978
24297
|
$schema: {
|
|
@@ -24254,6 +24573,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
24254
24573
|
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8400);
|
|
24255
24574
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7071);
|
|
24256
24575
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5810);
|
|
24576
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9686);
|
|
24257
24577
|
|
|
24258
24578
|
|
|
24259
24579
|
|
|
@@ -24281,6 +24601,7 @@ class Visitor {
|
|
|
24281
24601
|
to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(target, source);
|
|
24282
24602
|
}
|
|
24283
24603
|
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"].transfer(from, to);
|
|
24604
|
+
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"].transfer(from, to);
|
|
24284
24605
|
}
|
|
24285
24606
|
}
|
|
24286
24607
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Visitor);
|
|
@@ -28810,6 +29131,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
28810
29131
|
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8400);
|
|
28811
29132
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7071);
|
|
28812
29133
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5810);
|
|
29134
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9686);
|
|
28813
29135
|
|
|
28814
29136
|
|
|
28815
29137
|
|
|
@@ -28837,6 +29159,7 @@ class Visitor {
|
|
|
28837
29159
|
to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(target, source);
|
|
28838
29160
|
}
|
|
28839
29161
|
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"].transfer(from, to);
|
|
29162
|
+
_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"].transfer(from, to);
|
|
28840
29163
|
}
|
|
28841
29164
|
}
|
|
28842
29165
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Visitor);
|
|
@@ -30909,16 +31232,21 @@ const detect = async (source, {
|
|
|
30909
31232
|
*/
|
|
30910
31233
|
const parse = async (source, {
|
|
30911
31234
|
sourceMap = false,
|
|
31235
|
+
style = false,
|
|
30912
31236
|
strict = false
|
|
30913
31237
|
} = {}) => {
|
|
30914
31238
|
if (strict && sourceMap) {
|
|
30915
31239
|
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_1__["default"]('Cannot use sourceMap with strict parsing. Strict parsing does not support source maps.');
|
|
30916
31240
|
}
|
|
31241
|
+
if (strict && style) {
|
|
31242
|
+
throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_1__["default"]('Cannot use style with strict parsing. Strict parsing does not support style preservation.');
|
|
31243
|
+
}
|
|
30917
31244
|
if (strict) {
|
|
30918
31245
|
return _native_index_mjs__WEBPACK_IMPORTED_MODULE_2__.parse(source);
|
|
30919
31246
|
}
|
|
30920
31247
|
return _tree_sitter_index_mjs__WEBPACK_IMPORTED_MODULE_3__.parse(source, {
|
|
30921
|
-
sourceMap
|
|
31248
|
+
sourceMap,
|
|
31249
|
+
style
|
|
30922
31250
|
});
|
|
30923
31251
|
};
|
|
30924
31252
|
|
|
@@ -31049,12 +31377,14 @@ const detect = async source => {
|
|
|
31049
31377
|
* @public
|
|
31050
31378
|
*/
|
|
31051
31379
|
const parse = async (source, {
|
|
31052
|
-
sourceMap = false
|
|
31380
|
+
sourceMap = false,
|
|
31381
|
+
style = false
|
|
31053
31382
|
} = {}) => {
|
|
31054
31383
|
const cst = await (0,_lexical_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(source);
|
|
31055
31384
|
try {
|
|
31056
31385
|
return (0,_syntactic_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])(cst, {
|
|
31057
|
-
sourceMap
|
|
31386
|
+
sourceMap,
|
|
31387
|
+
style
|
|
31058
31388
|
});
|
|
31059
31389
|
} finally {
|
|
31060
31390
|
cst.delete();
|
|
@@ -31157,6 +31487,24 @@ const maybeAddSourceMap = (info, element, ctx) => {
|
|
|
31157
31487
|
element.endCharacter = info.endPosition.column;
|
|
31158
31488
|
element.endOffset = info.endIndex;
|
|
31159
31489
|
};
|
|
31490
|
+
|
|
31491
|
+
// build json style object for an element
|
|
31492
|
+
const buildJsonStyle = (ctx, extras) => {
|
|
31493
|
+
const jsonStyle = {
|
|
31494
|
+
indent: ctx.indent
|
|
31495
|
+
};
|
|
31496
|
+
if (extras) Object.assign(jsonStyle, extras);
|
|
31497
|
+
return {
|
|
31498
|
+
json: jsonStyle
|
|
31499
|
+
};
|
|
31500
|
+
};
|
|
31501
|
+
|
|
31502
|
+
// detect indent from an object's first pair child position
|
|
31503
|
+
// called during transformChildren when we encounter the first pair
|
|
31504
|
+
const detectIndent = (objectColumn, firstPairColumn) => {
|
|
31505
|
+
const diff = firstPairColumn - objectColumn;
|
|
31506
|
+
return diff > 0 ? diff : 2;
|
|
31507
|
+
};
|
|
31160
31508
|
const transform = (cursor, transformerMap, ctx) => {
|
|
31161
31509
|
const info = getCursorInfo(cursor);
|
|
31162
31510
|
|
|
@@ -31220,11 +31568,27 @@ const createTransformers = transformerMap => ({
|
|
|
31220
31568
|
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_7__["default"]();
|
|
31221
31569
|
maybeAddSourceMap(info, element, ctx);
|
|
31222
31570
|
|
|
31571
|
+
// Detect indent from first pair if style is enabled and not yet detected
|
|
31572
|
+
if (ctx.style && ctx.indent === 0) {
|
|
31573
|
+
if (cursor.gotoFirstChild()) {
|
|
31574
|
+
do {
|
|
31575
|
+
if (cursor.nodeType === 'pair') {
|
|
31576
|
+
ctx.indent = detectIndent(info.startPosition.column, cursor.startPosition.column);
|
|
31577
|
+
break;
|
|
31578
|
+
}
|
|
31579
|
+
} while (cursor.gotoNextSibling());
|
|
31580
|
+
cursor.gotoParent();
|
|
31581
|
+
}
|
|
31582
|
+
}
|
|
31583
|
+
|
|
31223
31584
|
// Transform children (pairs)
|
|
31224
31585
|
const children = transformChildren(cursor, transformerMap, ctx);
|
|
31225
31586
|
for (const child of children) {
|
|
31226
31587
|
element.push(child);
|
|
31227
31588
|
}
|
|
31589
|
+
if (ctx.style) {
|
|
31590
|
+
element.style = buildJsonStyle(ctx);
|
|
31591
|
+
}
|
|
31228
31592
|
return element;
|
|
31229
31593
|
},
|
|
31230
31594
|
array(cursor, ctx) {
|
|
@@ -31237,6 +31601,9 @@ const createTransformers = transformerMap => ({
|
|
|
31237
31601
|
for (const child of children) {
|
|
31238
31602
|
element.push(child);
|
|
31239
31603
|
}
|
|
31604
|
+
if (ctx.style) {
|
|
31605
|
+
element.style = buildJsonStyle(ctx);
|
|
31606
|
+
}
|
|
31240
31607
|
return element;
|
|
31241
31608
|
},
|
|
31242
31609
|
pair(cursor, ctx) {
|
|
@@ -31278,30 +31645,47 @@ const createTransformers = transformerMap => ({
|
|
|
31278
31645
|
});
|
|
31279
31646
|
}
|
|
31280
31647
|
}
|
|
31648
|
+
if (ctx.style) {
|
|
31649
|
+
element.style = buildJsonStyle(ctx);
|
|
31650
|
+
}
|
|
31281
31651
|
maybeAddSourceMap(info, element, ctx);
|
|
31282
31652
|
return element;
|
|
31283
31653
|
},
|
|
31284
31654
|
number(cursor, ctx) {
|
|
31285
31655
|
const info = getCursorInfo(cursor);
|
|
31286
31656
|
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"](Number(info.text));
|
|
31657
|
+
if (ctx.style) {
|
|
31658
|
+
element.style = buildJsonStyle(ctx, {
|
|
31659
|
+
rawContent: info.text
|
|
31660
|
+
});
|
|
31661
|
+
}
|
|
31287
31662
|
maybeAddSourceMap(info, element, ctx);
|
|
31288
31663
|
return element;
|
|
31289
31664
|
},
|
|
31290
31665
|
null(cursor, ctx) {
|
|
31291
31666
|
const info = getCursorInfo(cursor);
|
|
31292
31667
|
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__["default"]();
|
|
31668
|
+
if (ctx.style) {
|
|
31669
|
+
element.style = buildJsonStyle(ctx);
|
|
31670
|
+
}
|
|
31293
31671
|
maybeAddSourceMap(info, element, ctx);
|
|
31294
31672
|
return element;
|
|
31295
31673
|
},
|
|
31296
31674
|
true(cursor, ctx) {
|
|
31297
31675
|
const info = getCursorInfo(cursor);
|
|
31298
31676
|
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__["default"](true);
|
|
31677
|
+
if (ctx.style) {
|
|
31678
|
+
element.style = buildJsonStyle(ctx);
|
|
31679
|
+
}
|
|
31299
31680
|
maybeAddSourceMap(info, element, ctx);
|
|
31300
31681
|
return element;
|
|
31301
31682
|
},
|
|
31302
31683
|
false(cursor, ctx) {
|
|
31303
31684
|
const info = getCursorInfo(cursor);
|
|
31304
31685
|
const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__["default"](false);
|
|
31686
|
+
if (ctx.style) {
|
|
31687
|
+
element.style = buildJsonStyle(ctx);
|
|
31688
|
+
}
|
|
31305
31689
|
maybeAddSourceMap(info, element, ctx);
|
|
31306
31690
|
return element;
|
|
31307
31691
|
},
|
|
@@ -31332,11 +31716,14 @@ Object.assign(transformers, createTransformers(transformers));
|
|
|
31332
31716
|
* @public
|
|
31333
31717
|
*/
|
|
31334
31718
|
const analyze = (cst, {
|
|
31335
|
-
sourceMap = false
|
|
31719
|
+
sourceMap = false,
|
|
31720
|
+
style = false
|
|
31336
31721
|
} = {}) => {
|
|
31337
31722
|
const cursor = cst.walk();
|
|
31338
31723
|
const ctx = {
|
|
31339
31724
|
sourceMap,
|
|
31725
|
+
style,
|
|
31726
|
+
indent: 0,
|
|
31340
31727
|
annotations: []
|
|
31341
31728
|
};
|
|
31342
31729
|
const result = transform(cursor, transformers, ctx);
|