@speclynx/apidom-reference 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.
Files changed (33) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +4 -2
  3. package/dist/apidom-reference.browser.js +871 -166
  4. package/dist/apidom-reference.browser.min.js +1 -1
  5. package/package.json +25 -25
  6. package/src/parse/parsers/Parser.cjs +7 -0
  7. package/src/parse/parsers/Parser.mjs +7 -0
  8. package/src/parse/parsers/arazzo-json-1/index.cjs +1 -1
  9. package/src/parse/parsers/arazzo-json-1/index.mjs +1 -1
  10. package/src/parse/parsers/arazzo-yaml-1/index.cjs +1 -1
  11. package/src/parse/parsers/arazzo-yaml-1/index.mjs +1 -1
  12. package/src/parse/parsers/asyncapi-json-2/index.cjs +1 -1
  13. package/src/parse/parsers/asyncapi-json-2/index.mjs +1 -1
  14. package/src/parse/parsers/asyncapi-yaml-2/index.cjs +1 -1
  15. package/src/parse/parsers/asyncapi-yaml-2/index.mjs +1 -1
  16. package/src/parse/parsers/json/index.cjs +1 -1
  17. package/src/parse/parsers/json/index.mjs +1 -1
  18. package/src/parse/parsers/openapi-json-2/index.cjs +1 -1
  19. package/src/parse/parsers/openapi-json-2/index.mjs +1 -1
  20. package/src/parse/parsers/openapi-json-3-0/index.cjs +1 -1
  21. package/src/parse/parsers/openapi-json-3-0/index.mjs +1 -1
  22. package/src/parse/parsers/openapi-json-3-1/index.cjs +1 -1
  23. package/src/parse/parsers/openapi-json-3-1/index.mjs +1 -1
  24. package/src/parse/parsers/openapi-yaml-2/index.cjs +1 -1
  25. package/src/parse/parsers/openapi-yaml-2/index.mjs +1 -1
  26. package/src/parse/parsers/openapi-yaml-3-0/index.cjs +1 -1
  27. package/src/parse/parsers/openapi-yaml-3-0/index.mjs +1 -1
  28. package/src/parse/parsers/openapi-yaml-3-1/index.cjs +1 -1
  29. package/src/parse/parsers/openapi-yaml-3-1/index.mjs +1 -1
  30. package/src/parse/parsers/yaml-1-2/index.cjs +1 -0
  31. package/src/parse/parsers/yaml-1-2/index.mjs +1 -0
  32. package/types/apidom-reference.d.ts +6 -1
  33. package/types/parse/parsers/Parser.d.ts +6 -1
@@ -5654,6 +5654,11 @@ class Parser {
5654
5654
  */
5655
5655
  sourceMap;
5656
5656
 
5657
+ /**
5658
+ * Whether to capture format-specific style information for round-trip preservation.
5659
+ */
5660
+ style;
5661
+
5657
5662
  /**
5658
5663
  * Whether to use strict parsing (native JSON.parse/YAML instead of tree-sitter).
5659
5664
  */
@@ -5672,6 +5677,7 @@ class Parser {
5672
5677
  name,
5673
5678
  allowEmpty = true,
5674
5679
  sourceMap = false,
5680
+ style = false,
5675
5681
  strict = true,
5676
5682
  fileExtensions = [],
5677
5683
  mediaTypes = []
@@ -5679,6 +5685,7 @@ class Parser {
5679
5685
  this.name = name;
5680
5686
  this.allowEmpty = allowEmpty;
5681
5687
  this.sourceMap = sourceMap;
5688
+ this.style = style;
5682
5689
  this.strict = strict;
5683
5690
  this.fileExtensions = fileExtensions;
5684
5691
  this.mediaTypes = mediaTypes;
@@ -5826,7 +5833,7 @@ class ArazzoJSON1Parser extends _Parser_ts__WEBPACK_IMPORTED_MODULE_4__["default
5826
5833
  async parse(file, options) {
5827
5834
  const source = file.toString();
5828
5835
  try {
5829
- const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'strict', 'refractorOpts'], this);
5836
+ const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'style', 'strict', 'refractorOpts'], this);
5830
5837
  const parseResult = await (0,_speclynx_apidom_parser_adapter_arazzo_json_1__WEBPACK_IMPORTED_MODULE_1__.parse)(source, parserOpts);
5831
5838
  const shouldParseSourceDescriptions = options?.parse?.parserOpts?.[this.name]?.sourceDescriptions ?? options?.parse?.parserOpts?.sourceDescriptions;
5832
5839
  if (shouldParseSourceDescriptions) {
@@ -6142,7 +6149,7 @@ class ArazzoYAML1Parser extends _Parser_ts__WEBPACK_IMPORTED_MODULE_4__["default
6142
6149
  async parse(file, options) {
6143
6150
  const source = file.toString();
6144
6151
  try {
6145
- const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'strict', 'refractorOpts'], this);
6152
+ const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'style', 'strict', 'refractorOpts'], this);
6146
6153
  const parseResult = await (0,_speclynx_apidom_parser_adapter_arazzo_yaml_1__WEBPACK_IMPORTED_MODULE_1__.parse)(source, parserOpts);
6147
6154
  const shouldParseSourceDescriptions = options?.parse?.parserOpts?.[this.name]?.sourceDescriptions ?? options?.parse?.parserOpts?.sourceDescriptions;
6148
6155
  if (shouldParseSourceDescriptions) {
@@ -6234,7 +6241,7 @@ class AsyncAPIJSON2Parser extends _Parser_ts__WEBPACK_IMPORTED_MODULE_4__["defau
6234
6241
  async parse(file) {
6235
6242
  const source = file.toString();
6236
6243
  try {
6237
- const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'strict', 'refractorOpts'], this);
6244
+ const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'style', 'strict', 'refractorOpts'], this);
6238
6245
  return await (0,_speclynx_apidom_parser_adapter_asyncapi_json_2__WEBPACK_IMPORTED_MODULE_1__.parse)(source, parserOpts);
6239
6246
  } catch (error) {
6240
6247
  throw new _errors_ParserError_ts__WEBPACK_IMPORTED_MODULE_3__["default"](`Error parsing "${file.uri}"`, {
@@ -6300,7 +6307,7 @@ class AsyncAPIYAML2Parser extends _Parser_ts__WEBPACK_IMPORTED_MODULE_4__["defau
6300
6307
  async parse(file) {
6301
6308
  const source = file.toString();
6302
6309
  try {
6303
- const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'strict', 'refractorOpts'], this);
6310
+ const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'style', 'strict', 'refractorOpts'], this);
6304
6311
  return await (0,_speclynx_apidom_parser_adapter_asyncapi_yaml_2__WEBPACK_IMPORTED_MODULE_1__.parse)(source, parserOpts);
6305
6312
  } catch (error) {
6306
6313
  throw new _errors_ParserError_ts__WEBPACK_IMPORTED_MODULE_3__["default"](`Error parsing "${file.uri}"`, {
@@ -6432,7 +6439,7 @@ class JSONParser extends _Parser_ts__WEBPACK_IMPORTED_MODULE_4__["default"] {
6432
6439
  async parse(file) {
6433
6440
  const source = file.toString();
6434
6441
  try {
6435
- const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'strict'], this);
6442
+ const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'style', 'strict'], this);
6436
6443
  return await (0,_speclynx_apidom_parser_adapter_json__WEBPACK_IMPORTED_MODULE_1__.parse)(source, parserOpts);
6437
6444
  } catch (error) {
6438
6445
  throw new _errors_ParserError_ts__WEBPACK_IMPORTED_MODULE_3__["default"](`Error parsing "${file.uri}"`, {
@@ -6498,7 +6505,7 @@ class OpenAPIJSON2Parser extends _Parser_ts__WEBPACK_IMPORTED_MODULE_4__["defaul
6498
6505
  async parse(file) {
6499
6506
  const source = file.toString();
6500
6507
  try {
6501
- const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'strict', 'refractorOpts'], this);
6508
+ const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'style', 'strict', 'refractorOpts'], this);
6502
6509
  return await (0,_speclynx_apidom_parser_adapter_openapi_json_2__WEBPACK_IMPORTED_MODULE_1__.parse)(source, parserOpts);
6503
6510
  } catch (error) {
6504
6511
  throw new _errors_ParserError_ts__WEBPACK_IMPORTED_MODULE_3__["default"](`Error parsing "${file.uri}"`, {
@@ -6564,7 +6571,7 @@ class OpenAPIJSON3_0Parser extends _Parser_ts__WEBPACK_IMPORTED_MODULE_4__["defa
6564
6571
  async parse(file) {
6565
6572
  const source = file.toString();
6566
6573
  try {
6567
- const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'strict', 'refractorOpts'], this);
6574
+ const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'style', 'strict', 'refractorOpts'], this);
6568
6575
  return await (0,_speclynx_apidom_parser_adapter_openapi_json_3_0__WEBPACK_IMPORTED_MODULE_1__.parse)(source, parserOpts);
6569
6576
  } catch (error) {
6570
6577
  throw new _errors_ParserError_ts__WEBPACK_IMPORTED_MODULE_3__["default"](`Error parsing "${file.uri}"`, {
@@ -6630,7 +6637,7 @@ class OpenAPIJSON3_1Parser extends _Parser_ts__WEBPACK_IMPORTED_MODULE_4__["defa
6630
6637
  async parse(file) {
6631
6638
  const source = file.toString();
6632
6639
  try {
6633
- const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'strict', 'refractorOpts'], this);
6640
+ const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'style', 'strict', 'refractorOpts'], this);
6634
6641
  return await (0,_speclynx_apidom_parser_adapter_openapi_json_3_1__WEBPACK_IMPORTED_MODULE_1__.parse)(source, parserOpts);
6635
6642
  } catch (error) {
6636
6643
  throw new _errors_ParserError_ts__WEBPACK_IMPORTED_MODULE_3__["default"](`Error parsing "${file.uri}"`, {
@@ -6696,7 +6703,7 @@ class OpenAPIYAML2Parser extends _Parser_ts__WEBPACK_IMPORTED_MODULE_4__["defaul
6696
6703
  async parse(file) {
6697
6704
  const source = file.toString();
6698
6705
  try {
6699
- const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'strict', 'refractorOpts'], this);
6706
+ const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'style', 'strict', 'refractorOpts'], this);
6700
6707
  return await (0,_speclynx_apidom_parser_adapter_openapi_yaml_2__WEBPACK_IMPORTED_MODULE_1__.parse)(source, parserOpts);
6701
6708
  } catch (error) {
6702
6709
  throw new _errors_ParserError_ts__WEBPACK_IMPORTED_MODULE_3__["default"](`Error parsing "${file.uri}"`, {
@@ -6762,7 +6769,7 @@ class OpenAPIYAML3_0Parser extends _Parser_ts__WEBPACK_IMPORTED_MODULE_4__["defa
6762
6769
  async parse(file) {
6763
6770
  const source = file.toString();
6764
6771
  try {
6765
- const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'strict', 'refractorOpts'], this);
6772
+ const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'style', 'strict', 'refractorOpts'], this);
6766
6773
  return await (0,_speclynx_apidom_parser_adapter_openapi_yaml_3_0__WEBPACK_IMPORTED_MODULE_1__.parse)(source, parserOpts);
6767
6774
  } catch (error) {
6768
6775
  throw new _errors_ParserError_ts__WEBPACK_IMPORTED_MODULE_3__["default"](`Error parsing "${file.uri}"`, {
@@ -6828,7 +6835,7 @@ class OpenAPIYAML3_1Parser extends _Parser_ts__WEBPACK_IMPORTED_MODULE_4__["defa
6828
6835
  async parse(file) {
6829
6836
  const source = file.toString();
6830
6837
  try {
6831
- const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'strict', 'refractorOpts'], this);
6838
+ const parserOpts = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['sourceMap', 'style', 'strict', 'refractorOpts'], this);
6832
6839
  return await (0,_speclynx_apidom_parser_adapter_openapi_yaml_3_1__WEBPACK_IMPORTED_MODULE_1__.parse)(source, parserOpts);
6833
6840
  } catch (error) {
6834
6841
  throw new _errors_ParserError_ts__WEBPACK_IMPORTED_MODULE_3__["default"](`Error parsing "${file.uri}"`, {
@@ -6894,6 +6901,7 @@ class YAML1Parser extends _Parser_ts__WEBPACK_IMPORTED_MODULE_3__["default"] {
6894
6901
  try {
6895
6902
  return await (0,_speclynx_apidom_parser_adapter_yaml_1_2__WEBPACK_IMPORTED_MODULE_0__.parse)(source, {
6896
6903
  sourceMap: this.sourceMap,
6904
+ style: this.style,
6897
6905
  strict: this.strict
6898
6906
  });
6899
6907
  } catch (error) {
@@ -27815,6 +27823,53 @@ var both = /*#__PURE__*/(0,_internal_curry2_js__WEBPACK_IMPORTED_MODULE_0__["def
27815
27823
 
27816
27824
  /***/ },
27817
27825
 
27826
+ /***/ 8138
27827
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
27828
+
27829
+ "use strict";
27830
+ __webpack_require__.r(__webpack_exports__);
27831
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
27832
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
27833
+ /* harmony export */ });
27834
+ /* harmony import */ var _internal_clone_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8575);
27835
+ /* harmony import */ var _internal_curry1_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(18938);
27836
+
27837
+
27838
+
27839
+ /**
27840
+ * Creates a deep copy of the source that can be used in place of the source
27841
+ * object without retaining any references to it.
27842
+ * The source object may contain (nested) `Array`s and `Object`s,
27843
+ * `Number`s, `String`s, `Boolean`s and `Date`s.
27844
+ * `Function`s are assigned by reference rather than copied.
27845
+ *
27846
+ * Dispatches to a `clone` method if present.
27847
+ *
27848
+ * Note that if the source object has multiple nodes that share a reference,
27849
+ * the returned object will have the same structure, but the references will
27850
+ * be pointed to the location within the cloned value.
27851
+ *
27852
+ * @func
27853
+ * @memberOf R
27854
+ * @since v0.1.0
27855
+ * @category Object
27856
+ * @sig {*} -> {*}
27857
+ * @param {*} value The object or array to clone
27858
+ * @return {*} A deeply cloned copy of `val`
27859
+ * @example
27860
+ *
27861
+ * const objects = [{}, {}, {}];
27862
+ * const objectsClone = R.clone(objects);
27863
+ * objects === objectsClone; //=> false
27864
+ * objects[0] === objectsClone[0]; //=> false
27865
+ */
27866
+ var clone = /*#__PURE__*/(0,_internal_curry1_js__WEBPACK_IMPORTED_MODULE_1__["default"])(function clone(value) {
27867
+ return value != null && typeof value.clone === 'function' ? value.clone() : (0,_internal_clone_js__WEBPACK_IMPORTED_MODULE_0__["default"])(value, true);
27868
+ });
27869
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (clone);
27870
+
27871
+ /***/ },
27872
+
27818
27873
  /***/ 68199
27819
27874
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
27820
27875
 
@@ -29541,6 +29596,132 @@ function _checkForMethod(methodname, fn) {
29541
29596
 
29542
29597
  /***/ },
29543
29598
 
29599
+ /***/ 8575
29600
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
29601
+
29602
+ "use strict";
29603
+ __webpack_require__.r(__webpack_exports__);
29604
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
29605
+ /* harmony export */ "default": () => (/* binding */ _clone)
29606
+ /* harmony export */ });
29607
+ /* harmony import */ var _cloneRegExp_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31254);
29608
+ /* harmony import */ var _type_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(60963);
29609
+
29610
+
29611
+
29612
+ /**
29613
+ * Copies an object.
29614
+ *
29615
+ * @private
29616
+ * @param {*} value The value to be copied
29617
+ * @param {Boolean} deep Whether or not to perform deep cloning.
29618
+ * @return {*} The copied value.
29619
+ */
29620
+ function _clone(value, deep, map) {
29621
+ map || (map = new _ObjectMap());
29622
+
29623
+ // this avoids the slower switch with a quick if decision removing some milliseconds in each run.
29624
+ if (_isPrimitive(value)) {
29625
+ return value;
29626
+ }
29627
+ var copy = function copy(copiedValue) {
29628
+ // Check for circular and same references on the object graph and return its corresponding clone.
29629
+ var cachedCopy = map.get(value);
29630
+ if (cachedCopy) {
29631
+ return cachedCopy;
29632
+ }
29633
+ map.set(value, copiedValue);
29634
+ for (var key in value) {
29635
+ if (Object.prototype.hasOwnProperty.call(value, key)) {
29636
+ copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
29637
+ }
29638
+ }
29639
+ return copiedValue;
29640
+ };
29641
+ switch ((0,_type_js__WEBPACK_IMPORTED_MODULE_1__["default"])(value)) {
29642
+ case 'Object':
29643
+ return copy(Object.create(Object.getPrototypeOf(value)));
29644
+ case 'Array':
29645
+ return copy(Array(value.length));
29646
+ case 'Date':
29647
+ return new Date(value.valueOf());
29648
+ case 'RegExp':
29649
+ return (0,_cloneRegExp_js__WEBPACK_IMPORTED_MODULE_0__["default"])(value);
29650
+ case 'Int8Array':
29651
+ case 'Uint8Array':
29652
+ case 'Uint8ClampedArray':
29653
+ case 'Int16Array':
29654
+ case 'Uint16Array':
29655
+ case 'Int32Array':
29656
+ case 'Uint32Array':
29657
+ case 'Float32Array':
29658
+ case 'Float64Array':
29659
+ case 'BigInt64Array':
29660
+ case 'BigUint64Array':
29661
+ return value.slice();
29662
+ default:
29663
+ return value;
29664
+ }
29665
+ }
29666
+ function _isPrimitive(param) {
29667
+ var type = typeof param;
29668
+ return param == null || type != 'object' && type != 'function';
29669
+ }
29670
+ var _ObjectMap = /*#__PURE__*/function () {
29671
+ function _ObjectMap() {
29672
+ this.map = {};
29673
+ this.length = 0;
29674
+ }
29675
+ _ObjectMap.prototype.set = function (key, value) {
29676
+ var hashedKey = this.hash(key);
29677
+ var bucket = this.map[hashedKey];
29678
+ if (!bucket) {
29679
+ this.map[hashedKey] = bucket = [];
29680
+ }
29681
+ bucket.push([key, value]);
29682
+ this.length += 1;
29683
+ };
29684
+ _ObjectMap.prototype.hash = function (key) {
29685
+ var hashedKey = [];
29686
+ for (var value in key) {
29687
+ hashedKey.push(Object.prototype.toString.call(key[value]));
29688
+ }
29689
+ return hashedKey.join();
29690
+ };
29691
+ _ObjectMap.prototype.get = function (key) {
29692
+ /**
29693
+ * 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,
29694
+ * on my tests this number is 180, anything above that using the hash function is faster.
29695
+ */
29696
+ if (this.length <= 180) {
29697
+ for (var p in this.map) {
29698
+ var bucket = this.map[p];
29699
+ for (var i = 0; i < bucket.length; i += 1) {
29700
+ var element = bucket[i];
29701
+ if (element[0] === key) {
29702
+ return element[1];
29703
+ }
29704
+ }
29705
+ }
29706
+ return;
29707
+ }
29708
+ var hashedKey = this.hash(key);
29709
+ var bucket = this.map[hashedKey];
29710
+ if (!bucket) {
29711
+ return;
29712
+ }
29713
+ for (var i = 0; i < bucket.length; i += 1) {
29714
+ var element = bucket[i];
29715
+ if (element[0] === key) {
29716
+ return element[1];
29717
+ }
29718
+ }
29719
+ };
29720
+ return _ObjectMap;
29721
+ }();
29722
+
29723
+ /***/ },
29724
+
29544
29725
  /***/ 31254
29545
29726
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
29546
29727
 
@@ -46730,6 +46911,10 @@ __webpack_require__.r(__webpack_exports__);
46730
46911
  * @public
46731
46912
  */
46732
46913
 
46914
+ /**
46915
+ * @public
46916
+ */
46917
+
46733
46918
  /**
46734
46919
  * Returns the fixed fields for an Element class or instance.
46735
46920
  *
@@ -47177,6 +47362,7 @@ const predicates = {
47177
47362
  isCommentElement: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isCommentElement,
47178
47363
  isParseResultElement: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isParseResultElement,
47179
47364
  isSourceMapElement: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isSourceMapElement,
47365
+ hasElementStyle: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.hasElementStyle,
47180
47366
  hasElementSourceMap: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.hasElementSourceMap,
47181
47367
  includesSymbols: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.includesSymbols,
47182
47368
  includesClasses: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.includesClasses
@@ -47248,7 +47434,19 @@ const resolveSpecification = specification => {
47248
47434
  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)) {
47249
47435
  const $ref = (0,ramda__WEBPACK_IMPORTED_MODULE_2__["default"])(['$ref'], val);
47250
47436
  const pointer = (0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_6__["default"])('#/', $ref);
47251
- return (0,ramda__WEBPACK_IMPORTED_MODULE_2__["default"])(pointer.split('/'), root);
47437
+ const resolved = (0,ramda__WEBPACK_IMPORTED_MODULE_2__["default"])(pointer.split('/'), root);
47438
+ // merge extra properties (e.g. alias) from the $ref object into the resolved value
47439
+ const {
47440
+ $ref: _,
47441
+ ...rest
47442
+ } = val;
47443
+ if (Object.keys(rest).length > 0 && (0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_5__["default"])(resolved)) {
47444
+ return {
47445
+ ...resolved,
47446
+ ...rest
47447
+ };
47448
+ }
47449
+ return resolved;
47252
47450
  }
47253
47451
  if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_5__["default"])(val)) {
47254
47452
  return traverse(val, root, newPath);
@@ -47871,20 +48069,22 @@ class ShallowCloneError extends _CloneError_mjs__WEBPACK_IMPORTED_MODULE_0__["de
47871
48069
  "use strict";
47872
48070
  __webpack_require__.r(__webpack_exports__);
47873
48071
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
47874
- /* harmony export */ CloneError: () => (/* reexport safe */ _errors_CloneError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]),
47875
- /* harmony export */ DeepCloneError: () => (/* reexport safe */ _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_5__["default"]),
47876
- /* harmony export */ ShallowCloneError: () => (/* reexport safe */ _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]),
48072
+ /* harmony export */ CloneError: () => (/* reexport safe */ _errors_CloneError_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]),
48073
+ /* harmony export */ DeepCloneError: () => (/* reexport safe */ _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]),
48074
+ /* harmony export */ ShallowCloneError: () => (/* reexport safe */ _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]),
47877
48075
  /* harmony export */ cloneDeep: () => (/* binding */ cloneDeep),
47878
48076
  /* harmony export */ cloneShallow: () => (/* binding */ cloneShallow)
47879
48077
  /* harmony export */ });
47880
- /* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(38504);
47881
- /* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(36663);
47882
- /* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(18252);
47883
- /* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(25162);
47884
- /* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(25810);
47885
- /* harmony import */ var _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(95018);
47886
- /* harmony import */ var _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(3686);
47887
- /* harmony import */ var _errors_CloneError_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(3772);
48078
+ /* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8138);
48079
+ /* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(38504);
48080
+ /* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(36663);
48081
+ /* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(18252);
48082
+ /* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(25162);
48083
+ /* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(25810);
48084
+ /* harmony import */ var _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(95018);
48085
+ /* harmony import */ var _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(3686);
48086
+ /* harmony import */ var _errors_CloneError_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(3772);
48087
+
47888
48088
 
47889
48089
 
47890
48090
 
@@ -47917,9 +48117,9 @@ const cloneDeepElement = (element, options) => {
47917
48117
  } = element;
47918
48118
  if (Array.isArray(content)) {
47919
48119
  copy.content = content.map(el => cloneDeepElement(el, passThroughOptions));
47920
- } else if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.isElement)(content)) {
48120
+ } else if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(content)) {
47921
48121
  copy.content = cloneDeepElement(content, passThroughOptions);
47922
- } else if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
48122
+ } else if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
47923
48123
  copy.content = cloneDeepKeyValuePair(content, passThroughOptions);
47924
48124
  } else {
47925
48125
  copy.content = content;
@@ -47943,7 +48143,7 @@ const cloneDeepKeyValuePair = (kvp, options) => {
47943
48143
  } = kvp;
47944
48144
  const keyCopy = key !== undefined ? cloneDeepElement(key, passThroughOptions) : undefined;
47945
48145
  const valueCopy = value !== undefined ? cloneDeepElement(value, passThroughOptions) : undefined;
47946
- const copy = new _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_1__["default"](keyCopy, valueCopy);
48146
+ const copy = new _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"](keyCopy, valueCopy);
47947
48147
  visited.set(kvp, copy);
47948
48148
  return copy;
47949
48149
  };
@@ -47959,7 +48159,7 @@ const cloneDeepObjectSlice = (slice, options) => {
47959
48159
  return visited.get(slice);
47960
48160
  }
47961
48161
  const items = [...slice].map(element => cloneDeepElement(element, passThroughOptions));
47962
- const copy = new _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_0__["default"](items);
48162
+ const copy = new _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"](items);
47963
48163
  visited.set(slice, copy);
47964
48164
  return copy;
47965
48165
  };
@@ -47970,16 +48170,16 @@ const cloneDeepObjectSlice = (slice, options) => {
47970
48170
  * @public
47971
48171
  */
47972
48172
  const cloneDeep = (value, options = {}) => {
47973
- if (value instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
48173
+ if (value instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
47974
48174
  return cloneDeepKeyValuePair(value, options);
47975
48175
  }
47976
- if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_0__["default"]) {
48176
+ if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
47977
48177
  return cloneDeepObjectSlice(value, options);
47978
48178
  }
47979
- if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.isElement)(value)) {
48179
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(value)) {
47980
48180
  return cloneDeepElement(value, options);
47981
48181
  }
47982
- throw new _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_5__["default"]("Value provided to cloneDeep function couldn't be cloned", {
48182
+ throw new _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]("Value provided to cloneDeep function couldn't be cloned", {
47983
48183
  value
47984
48184
  });
47985
48185
  };
@@ -47995,11 +48195,11 @@ const cloneShallowKeyValuePair = keyValuePair => {
47995
48195
  key,
47996
48196
  value
47997
48197
  } = keyValuePair;
47998
- return new _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_1__["default"](key, value);
48198
+ return new _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"](key, value);
47999
48199
  };
48000
48200
  const cloneShallowObjectSlice = objectSlice => {
48001
48201
  const items = [...objectSlice];
48002
- return new _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_0__["default"](items);
48202
+ return new _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"](items);
48003
48203
  };
48004
48204
  const cloneShallowElement = element => {
48005
48205
  const Ctor = element.constructor;
@@ -48011,17 +48211,20 @@ const cloneShallowElement = element => {
48011
48211
  if (!element.isAttributesEmpty) {
48012
48212
  copy.attributes = cloneDeep(element.attributes);
48013
48213
  }
48014
- if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_2__.hasElementSourceMap)(element)) {
48015
- _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_4__["default"].transfer(element, copy);
48214
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.hasElementSourceMap)(element)) {
48215
+ _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_5__["default"].transfer(element, copy);
48216
+ }
48217
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.hasElementStyle)(element)) {
48218
+ copy.style = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(element.style);
48016
48219
  }
48017
48220
  const {
48018
48221
  content
48019
48222
  } = element;
48020
- if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.isElement)(content)) {
48223
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(content)) {
48021
48224
  copy.content = cloneShallowElement(content);
48022
48225
  } else if (Array.isArray(content)) {
48023
48226
  copy.content = [...content];
48024
- } else if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
48227
+ } else if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
48025
48228
  copy.content = cloneShallowKeyValuePair(content);
48026
48229
  } else {
48027
48230
  copy.content = content;
@@ -48036,16 +48239,16 @@ const cloneShallowElement = element => {
48036
48239
  * @public
48037
48240
  */
48038
48241
  const cloneShallow = value => {
48039
- if (value instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
48242
+ if (value instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
48040
48243
  return cloneShallowKeyValuePair(value);
48041
48244
  }
48042
- if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_0__["default"]) {
48245
+ if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
48043
48246
  return cloneShallowObjectSlice(value);
48044
48247
  }
48045
- if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.isElement)(value)) {
48248
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(value)) {
48046
48249
  return cloneShallowElement(value);
48047
48250
  }
48048
- throw new _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]("Value provided to cloneShallow function couldn't be cloned", {
48251
+ throw new _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]("Value provided to cloneShallow function couldn't be cloned", {
48049
48252
  value
48050
48253
  });
48051
48254
  };
@@ -48472,6 +48675,66 @@ function unpackSourceMap(packed) {
48472
48675
 
48473
48676
  /***/ },
48474
48677
 
48678
+ /***/ 49686
48679
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
48680
+
48681
+ "use strict";
48682
+ __webpack_require__.r(__webpack_exports__);
48683
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
48684
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
48685
+ /* harmony export */ });
48686
+ /* harmony import */ var _primitives_ObjectElement_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(97071);
48687
+
48688
+ /**
48689
+ * Shape with optional style property.
48690
+ * @public
48691
+ */
48692
+ /**
48693
+ * StyleElement stores format-specific style information for round-trip preservation.
48694
+ *
48695
+ * The style data is stored as a plain object with format-specific namespaces
48696
+ * (e.g., `yaml`, `json`). This element exists only during serialization/deserialization
48697
+ * (refract format) - in memory, style lives directly on `element.style`.
48698
+ *
48699
+ * Follows the same pattern as SourceMapElement with __mappings__.
48700
+ *
48701
+ * @public
48702
+ */
48703
+ class StyleElement extends _primitives_ObjectElement_mjs__WEBPACK_IMPORTED_MODULE_0__["default"] {
48704
+ constructor(content, meta, attributes) {
48705
+ super(content, meta, attributes);
48706
+ this.element = '__styles__';
48707
+ }
48708
+
48709
+ /**
48710
+ * Transfers style property from one element to another.
48711
+ */
48712
+ static transfer(from, to) {
48713
+ to.style = from.style;
48714
+ }
48715
+
48716
+ /**
48717
+ * Creates a StyleElement from an element's style property.
48718
+ * Returns undefined if the element has no style.
48719
+ */
48720
+ static from(source) {
48721
+ if (!source.style) {
48722
+ return undefined;
48723
+ }
48724
+ return new StyleElement(source.style);
48725
+ }
48726
+
48727
+ /**
48728
+ * Restores the style property on the target element from this StyleElement.
48729
+ */
48730
+ applyTo(target) {
48731
+ target.style = this.toValue();
48732
+ }
48733
+ }
48734
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (StyleElement);
48735
+
48736
+ /***/ },
48737
+
48475
48738
  /***/ 96911
48476
48739
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
48477
48740
 
@@ -48536,6 +48799,7 @@ const isSourceMapElement = element => element instanceof _elements_SourceMap_mjs
48536
48799
  __webpack_require__.r(__webpack_exports__);
48537
48800
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
48538
48801
  /* harmony export */ hasElementSourceMap: () => (/* binding */ hasElementSourceMap),
48802
+ /* harmony export */ hasElementStyle: () => (/* binding */ hasElementStyle),
48539
48803
  /* harmony export */ includesClasses: () => (/* binding */ includesClasses),
48540
48804
  /* harmony export */ includesSymbols: () => (/* binding */ includesSymbols),
48541
48805
  /* harmony export */ isAnnotationElement: () => (/* reexport safe */ _elements_mjs__WEBPACK_IMPORTED_MODULE_1__.isAnnotationElement),
@@ -48560,6 +48824,14 @@ __webpack_require__.r(__webpack_exports__);
48560
48824
 
48561
48825
 
48562
48826
 
48827
+ /**
48828
+ * Checks if an element has format-specific style information.
48829
+ * @public
48830
+ */
48831
+ const hasElementStyle = element => {
48832
+ return element.style !== undefined;
48833
+ };
48834
+
48563
48835
  /**
48564
48836
  * Checks if an element has complete source position information.
48565
48837
  * Returns true only if all 6 position properties are numbers.
@@ -49101,6 +49373,12 @@ class Element {
49101
49373
  */
49102
49374
  parent;
49103
49375
 
49376
+ /**
49377
+ * Format-specific style information for round-trip preservation.
49378
+ * Each format owns its own namespace (e.g., `yaml`, `json`).
49379
+ */
49380
+ style;
49381
+
49104
49382
  // ============================================================================
49105
49383
  // Source Position (LSP-compatible, TextDocument-compatible, UTF-16 code units)
49106
49384
  // web-tree-sitter automatically provides position data in UTF-16 code units.
@@ -49309,7 +49587,13 @@ class Element {
49309
49587
 
49310
49588
  /** Unique identifier for this element. */
49311
49589
  get id() {
49312
- return this.getMetaProperty('id', '');
49590
+ if (this.isFrozen) {
49591
+ return this.getMetaProperty('id', '');
49592
+ }
49593
+ if (!this.hasMetaProperty('id')) {
49594
+ this.setMetaProperty('id', '');
49595
+ }
49596
+ return this.meta.get('id');
49313
49597
  }
49314
49598
  set id(value) {
49315
49599
  this.setMetaProperty('id', value);
@@ -49317,7 +49601,13 @@ class Element {
49317
49601
 
49318
49602
  /** CSS-like class names. */
49319
49603
  get classes() {
49320
- return this.getMetaProperty('classes', []);
49604
+ if (this.isFrozen) {
49605
+ return this.getMetaProperty('classes', []);
49606
+ }
49607
+ if (!this.hasMetaProperty('classes')) {
49608
+ this.setMetaProperty('classes', []);
49609
+ }
49610
+ return this.meta.get('classes');
49321
49611
  }
49322
49612
  set classes(value) {
49323
49613
  this.setMetaProperty('classes', value);
@@ -49325,7 +49615,13 @@ class Element {
49325
49615
 
49326
49616
  /** Hyperlinks associated with this element. */
49327
49617
  get links() {
49328
- return this.getMetaProperty('links', []);
49618
+ if (this.isFrozen) {
49619
+ return this.getMetaProperty('links', []);
49620
+ }
49621
+ if (!this.hasMetaProperty('links')) {
49622
+ this.setMetaProperty('links', []);
49623
+ }
49624
+ return this.meta.get('links');
49329
49625
  }
49330
49626
  set links(value) {
49331
49627
  this.setMetaProperty('links', value);
@@ -49476,16 +49772,26 @@ class Element {
49476
49772
  }
49477
49773
 
49478
49774
  /**
49479
- * Gets a meta property, creating it with default value if not present.
49775
+ * Gets a meta property.
49776
+ *
49777
+ * When the property doesn't exist:
49778
+ * - With defaultValue: returns a new refracted element instance (not cached)
49779
+ * - Without defaultValue: returns undefined
49780
+ *
49781
+ * Note: Each call with a default creates a new instance. Use setMetaProperty
49782
+ * first if you need reference equality across multiple accesses.
49480
49783
  */
49784
+
49481
49785
  getMetaProperty(name, defaultValue) {
49482
- if (!this.meta.hasKey(name)) {
49483
- if (this.isFrozen) {
49484
- const element = this.refract(defaultValue);
49786
+ if (!this.hasMetaProperty(name)) {
49787
+ if (defaultValue === undefined) {
49788
+ return undefined;
49789
+ }
49790
+ const element = this.refract(defaultValue);
49791
+ if (element && this.isFrozen) {
49485
49792
  element.freeze();
49486
- return element;
49487
49793
  }
49488
- this.meta.set(name, defaultValue);
49794
+ return element;
49489
49795
  }
49490
49796
  return this.meta.get(name);
49491
49797
  }
@@ -49962,17 +50268,18 @@ __webpack_require__.r(__webpack_exports__);
49962
50268
  /* harmony export */ CollectionElement: () => (/* reexport safe */ _primitives_CollectionElement_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]),
49963
50269
  /* harmony export */ CommentElement: () => (/* reexport safe */ _elements_Comment_mjs__WEBPACK_IMPORTED_MODULE_12__["default"]),
49964
50270
  /* harmony export */ Element: () => (/* reexport safe */ _primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__["default"]),
49965
- /* harmony export */ KeyValuePair: () => (/* reexport safe */ _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_16__["default"]),
50271
+ /* harmony export */ KeyValuePair: () => (/* reexport safe */ _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_17__["default"]),
49966
50272
  /* harmony export */ LinkElement: () => (/* reexport safe */ _elements_LinkElement_mjs__WEBPACK_IMPORTED_MODULE_9__["default"]),
49967
50273
  /* harmony export */ MemberElement: () => (/* reexport safe */ _primitives_MemberElement_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]),
49968
50274
  /* harmony export */ NullElement: () => (/* reexport safe */ _primitives_NullElement_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]),
49969
50275
  /* harmony export */ NumberElement: () => (/* reexport safe */ _primitives_NumberElement_mjs__WEBPACK_IMPORTED_MODULE_4__["default"]),
49970
50276
  /* harmony export */ ObjectElement: () => (/* reexport safe */ _primitives_ObjectElement_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]),
49971
- /* harmony export */ ObjectSlice: () => (/* reexport safe */ _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_15__["default"]),
50277
+ /* harmony export */ ObjectSlice: () => (/* reexport safe */ _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_16__["default"]),
49972
50278
  /* harmony export */ ParseResultElement: () => (/* reexport safe */ _elements_ParseResult_mjs__WEBPACK_IMPORTED_MODULE_13__["default"]),
49973
50279
  /* harmony export */ RefElement: () => (/* reexport safe */ _elements_RefElement_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]),
49974
50280
  /* harmony export */ SourceMapElement: () => (/* reexport safe */ _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_14__["default"]),
49975
50281
  /* harmony export */ StringElement: () => (/* reexport safe */ _primitives_StringElement_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]),
50282
+ /* harmony export */ StyleElement: () => (/* reexport safe */ _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_15__["default"]),
49976
50283
  /* harmony export */ refract: () => (/* binding */ refract)
49977
50284
  /* harmony export */ });
49978
50285
  /* harmony import */ var _primitives_Element_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(60728);
@@ -49990,8 +50297,10 @@ __webpack_require__.r(__webpack_exports__);
49990
50297
  /* harmony import */ var _elements_Comment_mjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(40094);
49991
50298
  /* harmony import */ var _elements_ParseResult_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(4823);
49992
50299
  /* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(25810);
49993
- /* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(38504);
49994
- /* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(36663);
50300
+ /* harmony import */ var _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(49686);
50301
+ /* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(38504);
50302
+ /* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(36663);
50303
+
49995
50304
 
49996
50305
 
49997
50306
 
@@ -50078,6 +50387,8 @@ __webpack_require__.r(__webpack_exports__);
50078
50387
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
50079
50388
  /* harmony export */ });
50080
50389
  /* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25810);
50390
+ /* harmony import */ var _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(49686);
50391
+
50081
50392
 
50082
50393
  /**
50083
50394
  * Serialized representation of an Element in JSON Refract format.
@@ -50136,6 +50447,17 @@ class JSONSerialiser {
50136
50447
  payload.meta.__mappings__ = this.serialise(sourceMap);
50137
50448
  }
50138
50449
  }
50450
+
50451
+ // Serialize style as __styles__ in meta (skip for StyleElement itself)
50452
+ if (!(element instanceof _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])) {
50453
+ const styleElement = _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_1__["default"].from(element);
50454
+ if (styleElement) {
50455
+ if (!payload.meta) {
50456
+ payload.meta = {};
50457
+ }
50458
+ payload.meta.__styles__ = this.serialise(styleElement);
50459
+ }
50460
+ }
50139
50461
  const content = this.serialiseContent(element.content);
50140
50462
  if (content !== undefined) {
50141
50463
  payload.content = content;
@@ -50156,15 +50478,18 @@ class JSONSerialiser {
50156
50478
  element.element = value.element;
50157
50479
  }
50158
50480
 
50159
- // Extract __mappings__ without mutating input, filter remaining meta
50481
+ // Extract __mappings__ and __styles__ without mutating input, filter remaining meta
50160
50482
  let mappingsDoc;
50483
+ let stylesDoc;
50161
50484
  let metaToDeserialize = value.meta;
50162
- if (value.meta?.__mappings__) {
50485
+ if (value.meta?.__mappings__ || value.meta?.__styles__) {
50163
50486
  const {
50164
50487
  __mappings__,
50488
+ __styles__,
50165
50489
  ...rest
50166
50490
  } = value.meta;
50167
50491
  mappingsDoc = __mappings__;
50492
+ stylesDoc = __styles__;
50168
50493
  metaToDeserialize = Object.keys(rest).length > 0 ? rest : undefined;
50169
50494
  }
50170
50495
  if (metaToDeserialize) {
@@ -50176,6 +50501,12 @@ class JSONSerialiser {
50176
50501
  const sourceMap = this.deserialise(mappingsDoc);
50177
50502
  sourceMap.applyTo(element);
50178
50503
  }
50504
+
50505
+ // Restore style from __styles__
50506
+ if (stylesDoc) {
50507
+ const styleElement = this.deserialise(stylesDoc);
50508
+ styleElement.applyTo(element);
50509
+ }
50179
50510
  if (value.attributes) {
50180
50511
  this.deserialiseObject(value.attributes, element.attributes);
50181
50512
  }
@@ -52997,6 +53328,7 @@ __webpack_require__.r(__webpack_exports__);
52997
53328
  /* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28400);
52998
53329
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(97071);
52999
53330
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25810);
53331
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(49686);
53000
53332
 
53001
53333
 
53002
53334
 
@@ -53024,6 +53356,7 @@ class Visitor {
53024
53356
  to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(target, source);
53025
53357
  }
53026
53358
  _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"].transfer(from, to);
53359
+ _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"].transfer(from, to);
53027
53360
  }
53028
53361
  }
53029
53362
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Visitor);
@@ -63373,7 +63706,7 @@ const specification = {
63373
63706
  $ref: '#/visitors/value'
63374
63707
  },
63375
63708
  attributes: {
63376
- $visitor: _visitors_FallbackVisitor_mjs__WEBPACK_IMPORTED_MODULE_1__["default"],
63709
+ $ref: '#/visitors/value',
63377
63710
  alias: 'attributesField'
63378
63711
  },
63379
63712
  orderingKey: {
@@ -63663,6 +63996,7 @@ __webpack_require__.r(__webpack_exports__);
63663
63996
  /* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28400);
63664
63997
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(97071);
63665
63998
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25810);
63999
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(49686);
63666
64000
 
63667
64001
 
63668
64002
 
@@ -63690,6 +64024,7 @@ class Visitor {
63690
64024
  to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(target, source);
63691
64025
  }
63692
64026
  _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"].transfer(from, to);
64027
+ _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"].transfer(from, to);
63693
64028
  }
63694
64029
  }
63695
64030
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Visitor);
@@ -71417,7 +71752,7 @@ const specification = {
71417
71752
  fixedFields: {
71418
71753
  // core vocabulary
71419
71754
  id: {
71420
- $visitor: _visitors_FallbackVisitor_mjs__WEBPACK_IMPORTED_MODULE_0__["default"],
71755
+ $ref: '#/visitors/value',
71421
71756
  alias: 'idField'
71422
71757
  },
71423
71758
  $schema: {
@@ -71699,6 +72034,7 @@ __webpack_require__.r(__webpack_exports__);
71699
72034
  /* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28400);
71700
72035
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(97071);
71701
72036
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25810);
72037
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(49686);
71702
72038
 
71703
72039
 
71704
72040
 
@@ -71726,6 +72062,7 @@ class Visitor {
71726
72062
  to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(target, source);
71727
72063
  }
71728
72064
  _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"].transfer(from, to);
72065
+ _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"].transfer(from, to);
71729
72066
  }
71730
72067
  }
71731
72068
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Visitor);
@@ -77128,6 +77465,7 @@ __webpack_require__.r(__webpack_exports__);
77128
77465
  /* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28400);
77129
77466
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(97071);
77130
77467
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25810);
77468
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(49686);
77131
77469
 
77132
77470
 
77133
77471
 
@@ -77155,6 +77493,7 @@ class Visitor {
77155
77493
  to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(target, source);
77156
77494
  }
77157
77495
  _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"].transfer(from, to);
77496
+ _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"].transfer(from, to);
77158
77497
  }
77159
77498
  }
77160
77499
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Visitor);
@@ -79373,10 +79712,10 @@ class Encoding extends _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__["
79373
79712
  set headers(headers) {
79374
79713
  this.set('headers', headers);
79375
79714
  }
79376
- get style() {
79715
+ get styleField() {
79377
79716
  return this.get('style');
79378
79717
  }
79379
- set style(style) {
79718
+ set styleField(style) {
79380
79719
  this.set('style', style);
79381
79720
  }
79382
79721
  get explode() {
@@ -79523,10 +79862,10 @@ class Header extends _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__["de
79523
79862
  set allowEmptyValue(allowEmptyValue) {
79524
79863
  this.set('allowEmptyValue', allowEmptyValue);
79525
79864
  }
79526
- get style() {
79865
+ get styleField() {
79527
79866
  return this.get('style');
79528
79867
  }
79529
- set style(style) {
79868
+ set styleField(style) {
79530
79869
  this.set('style', style);
79531
79870
  }
79532
79871
  get explode() {
@@ -80142,10 +80481,10 @@ class Parameter extends _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__[
80142
80481
  set allowEmptyValue(allowEmptyValue) {
80143
80482
  this.set('allowEmptyValue', allowEmptyValue);
80144
80483
  }
80145
- get style() {
80484
+ get styleField() {
80146
80485
  return this.get('style');
80147
80486
  }
80148
- set style(style) {
80487
+ set styleField(style) {
80149
80488
  this.set('style', style);
80150
80489
  }
80151
80490
  get explode() {
@@ -83013,7 +83352,8 @@ const specification = {
83013
83352
  $ref: '#/visitors/value'
83014
83353
  },
83015
83354
  style: {
83016
- $ref: '#/visitors/value'
83355
+ $ref: '#/visitors/value',
83356
+ alias: 'styleField'
83017
83357
  },
83018
83358
  explode: {
83019
83359
  $ref: '#/visitors/value'
@@ -83069,7 +83409,8 @@ const specification = {
83069
83409
  },
83070
83410
  headers: _visitors_open_api_3_0_encoding_HeadersVisitor_mjs__WEBPACK_IMPORTED_MODULE_60__["default"],
83071
83411
  style: {
83072
- $ref: '#/visitors/value'
83412
+ $ref: '#/visitors/value',
83413
+ alias: 'styleField'
83073
83414
  },
83074
83415
  explode: {
83075
83416
  $ref: '#/visitors/value'
@@ -83159,7 +83500,8 @@ const specification = {
83159
83500
  $ref: '#/visitors/value'
83160
83501
  },
83161
83502
  style: {
83162
- $ref: '#/visitors/value'
83503
+ $ref: '#/visitors/value',
83504
+ alias: 'styleField'
83163
83505
  },
83164
83506
  explode: {
83165
83507
  $ref: '#/visitors/value'
@@ -83581,6 +83923,7 @@ __webpack_require__.r(__webpack_exports__);
83581
83923
  /* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28400);
83582
83924
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(97071);
83583
83925
  /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25810);
83926
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(49686);
83584
83927
 
83585
83928
 
83586
83929
 
@@ -83608,6 +83951,7 @@ class Visitor {
83608
83951
  to.attributes = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(target, source);
83609
83952
  }
83610
83953
  _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"].transfer(from, to);
83954
+ _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"].transfer(from, to);
83611
83955
  }
83612
83956
  }
83613
83957
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Visitor);
@@ -91350,16 +91694,21 @@ const detect = async (source, {
91350
91694
  */
91351
91695
  const parse = async (source, {
91352
91696
  sourceMap = false,
91697
+ style = false,
91353
91698
  strict = false
91354
91699
  } = {}) => {
91355
91700
  if (strict && sourceMap) {
91356
91701
  throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_1__["default"]('Cannot use sourceMap with strict parsing. Strict parsing does not support source maps.');
91357
91702
  }
91703
+ if (strict && style) {
91704
+ throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_1__["default"]('Cannot use style with strict parsing. Strict parsing does not support style preservation.');
91705
+ }
91358
91706
  if (strict) {
91359
91707
  return _native_index_mjs__WEBPACK_IMPORTED_MODULE_2__.parse(source);
91360
91708
  }
91361
91709
  return _tree_sitter_index_mjs__WEBPACK_IMPORTED_MODULE_3__.parse(source, {
91362
- sourceMap
91710
+ sourceMap,
91711
+ style
91363
91712
  });
91364
91713
  };
91365
91714
 
@@ -91490,12 +91839,14 @@ const detect = async source => {
91490
91839
  * @public
91491
91840
  */
91492
91841
  const parse = async (source, {
91493
- sourceMap = false
91842
+ sourceMap = false,
91843
+ style = false
91494
91844
  } = {}) => {
91495
91845
  const cst = await (0,_lexical_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(source);
91496
91846
  try {
91497
91847
  return (0,_syntactic_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])(cst, {
91498
- sourceMap
91848
+ sourceMap,
91849
+ style
91499
91850
  });
91500
91851
  } finally {
91501
91852
  cst.delete();
@@ -91598,6 +91949,24 @@ const maybeAddSourceMap = (info, element, ctx) => {
91598
91949
  element.endCharacter = info.endPosition.column;
91599
91950
  element.endOffset = info.endIndex;
91600
91951
  };
91952
+
91953
+ // build json style object for an element
91954
+ const buildJsonStyle = (ctx, extras) => {
91955
+ const jsonStyle = {
91956
+ indent: ctx.indent
91957
+ };
91958
+ if (extras) Object.assign(jsonStyle, extras);
91959
+ return {
91960
+ json: jsonStyle
91961
+ };
91962
+ };
91963
+
91964
+ // detect indent from an object's first pair child position
91965
+ // called during transformChildren when we encounter the first pair
91966
+ const detectIndent = (objectColumn, firstPairColumn) => {
91967
+ const diff = firstPairColumn - objectColumn;
91968
+ return diff > 0 ? diff : 2;
91969
+ };
91601
91970
  const transform = (cursor, transformerMap, ctx) => {
91602
91971
  const info = getCursorInfo(cursor);
91603
91972
 
@@ -91661,11 +92030,27 @@ const createTransformers = transformerMap => ({
91661
92030
  const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_7__["default"]();
91662
92031
  maybeAddSourceMap(info, element, ctx);
91663
92032
 
92033
+ // Detect indent from first pair if style is enabled and not yet detected
92034
+ if (ctx.style && ctx.indent === 0) {
92035
+ if (cursor.gotoFirstChild()) {
92036
+ do {
92037
+ if (cursor.nodeType === 'pair') {
92038
+ ctx.indent = detectIndent(info.startPosition.column, cursor.startPosition.column);
92039
+ break;
92040
+ }
92041
+ } while (cursor.gotoNextSibling());
92042
+ cursor.gotoParent();
92043
+ }
92044
+ }
92045
+
91664
92046
  // Transform children (pairs)
91665
92047
  const children = transformChildren(cursor, transformerMap, ctx);
91666
92048
  for (const child of children) {
91667
92049
  element.push(child);
91668
92050
  }
92051
+ if (ctx.style) {
92052
+ element.style = buildJsonStyle(ctx);
92053
+ }
91669
92054
  return element;
91670
92055
  },
91671
92056
  array(cursor, ctx) {
@@ -91678,6 +92063,9 @@ const createTransformers = transformerMap => ({
91678
92063
  for (const child of children) {
91679
92064
  element.push(child);
91680
92065
  }
92066
+ if (ctx.style) {
92067
+ element.style = buildJsonStyle(ctx);
92068
+ }
91681
92069
  return element;
91682
92070
  },
91683
92071
  pair(cursor, ctx) {
@@ -91719,30 +92107,47 @@ const createTransformers = transformerMap => ({
91719
92107
  });
91720
92108
  }
91721
92109
  }
92110
+ if (ctx.style) {
92111
+ element.style = buildJsonStyle(ctx);
92112
+ }
91722
92113
  maybeAddSourceMap(info, element, ctx);
91723
92114
  return element;
91724
92115
  },
91725
92116
  number(cursor, ctx) {
91726
92117
  const info = getCursorInfo(cursor);
91727
92118
  const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__["default"](Number(info.text));
92119
+ if (ctx.style) {
92120
+ element.style = buildJsonStyle(ctx, {
92121
+ rawContent: info.text
92122
+ });
92123
+ }
91728
92124
  maybeAddSourceMap(info, element, ctx);
91729
92125
  return element;
91730
92126
  },
91731
92127
  null(cursor, ctx) {
91732
92128
  const info = getCursorInfo(cursor);
91733
92129
  const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__["default"]();
92130
+ if (ctx.style) {
92131
+ element.style = buildJsonStyle(ctx);
92132
+ }
91734
92133
  maybeAddSourceMap(info, element, ctx);
91735
92134
  return element;
91736
92135
  },
91737
92136
  true(cursor, ctx) {
91738
92137
  const info = getCursorInfo(cursor);
91739
92138
  const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__["default"](true);
92139
+ if (ctx.style) {
92140
+ element.style = buildJsonStyle(ctx);
92141
+ }
91740
92142
  maybeAddSourceMap(info, element, ctx);
91741
92143
  return element;
91742
92144
  },
91743
92145
  false(cursor, ctx) {
91744
92146
  const info = getCursorInfo(cursor);
91745
92147
  const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__["default"](false);
92148
+ if (ctx.style) {
92149
+ element.style = buildJsonStyle(ctx);
92150
+ }
91746
92151
  maybeAddSourceMap(info, element, ctx);
91747
92152
  return element;
91748
92153
  },
@@ -91773,11 +92178,14 @@ Object.assign(transformers, createTransformers(transformers));
91773
92178
  * @public
91774
92179
  */
91775
92180
  const analyze = (cst, {
91776
- sourceMap = false
92181
+ sourceMap = false,
92182
+ style = false
91777
92183
  } = {}) => {
91778
92184
  const cursor = cst.walk();
91779
92185
  const ctx = {
91780
92186
  sourceMap,
92187
+ style,
92188
+ indent: 0,
91781
92189
  annotations: []
91782
92190
  };
91783
92191
  const result = transform(cursor, transformers, ctx);
@@ -92359,16 +92767,21 @@ const detect = async (source, {
92359
92767
  */
92360
92768
  const parse = async (source, {
92361
92769
  sourceMap = false,
92770
+ style = false,
92362
92771
  strict = false
92363
92772
  } = {}) => {
92364
92773
  if (strict && sourceMap) {
92365
92774
  throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_1__["default"]('Cannot use sourceMap with strict parsing. Strict parsing does not support source maps.');
92366
92775
  }
92776
+ if (strict && style) {
92777
+ throw new _speclynx_apidom_error__WEBPACK_IMPORTED_MODULE_1__["default"]('Cannot use style with strict parsing. Strict parsing does not support style preservation.');
92778
+ }
92367
92779
  if (strict) {
92368
92780
  return _yaml_index_mjs__WEBPACK_IMPORTED_MODULE_2__.parse(source);
92369
92781
  }
92370
92782
  return _tree_sitter_index_mjs__WEBPACK_IMPORTED_MODULE_3__.parse(source, {
92371
- sourceMap
92783
+ sourceMap,
92784
+ style
92372
92785
  });
92373
92786
  };
92374
92787
 
@@ -92443,12 +92856,14 @@ const detect = async source => {
92443
92856
  * @public
92444
92857
  */
92445
92858
  const parse = async (source, {
92446
- sourceMap = false
92859
+ sourceMap = false,
92860
+ style = false
92447
92861
  } = {}) => {
92448
92862
  const cst = await (0,_lexical_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(source);
92449
92863
  try {
92450
92864
  return (0,_syntactic_analysis_index_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])(cst, {
92451
- sourceMap
92865
+ sourceMap,
92866
+ style
92452
92867
  });
92453
92868
  } finally {
92454
92869
  cst.delete();
@@ -92522,18 +92937,20 @@ __webpack_require__.r(__webpack_exports__);
92522
92937
  /* harmony import */ var _ast_Error_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33240);
92523
92938
  /* harmony import */ var _ast_Literal_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(86951);
92524
92939
  /* harmony import */ var _ast_ParseResult_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(88912);
92525
- /* harmony import */ var _ast_nodes_YamlAlias_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(15103);
92526
- /* harmony import */ var _ast_nodes_YamlAnchor_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2838);
92527
- /* harmony import */ var _ast_nodes_YamlComment_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(14120);
92528
- /* harmony import */ var _ast_nodes_YamlDirective_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(22532);
92529
- /* harmony import */ var _ast_nodes_YamlDocument_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(17374);
92530
- /* harmony import */ var _ast_nodes_YamlKeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(39113);
92531
- /* harmony import */ var _ast_nodes_YamlMapping_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(17373);
92532
- /* harmony import */ var _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(20301);
92533
- /* harmony import */ var _ast_nodes_YamlSequence_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(46794);
92534
- /* harmony import */ var _ast_nodes_YamlStream_mjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(74213);
92535
- /* harmony import */ var _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(48139);
92536
- /* harmony import */ var _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(21544);
92940
+ /* harmony import */ var _ast_nodes_YamlNode_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6821);
92941
+ /* harmony import */ var _ast_nodes_YamlAlias_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(15103);
92942
+ /* harmony import */ var _ast_nodes_YamlAnchor_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(2838);
92943
+ /* harmony import */ var _ast_nodes_YamlComment_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(14120);
92944
+ /* harmony import */ var _ast_nodes_YamlDirective_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(22532);
92945
+ /* harmony import */ var _ast_nodes_YamlDocument_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(17374);
92946
+ /* harmony import */ var _ast_nodes_YamlKeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(39113);
92947
+ /* harmony import */ var _ast_nodes_YamlMapping_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(17373);
92948
+ /* harmony import */ var _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(20301);
92949
+ /* harmony import */ var _ast_nodes_YamlSequence_mjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(46794);
92950
+ /* harmony import */ var _ast_nodes_YamlStream_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(74213);
92951
+ /* harmony import */ var _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(48139);
92952
+ /* harmony import */ var _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(21544);
92953
+
92537
92954
 
92538
92955
 
92539
92956
 
@@ -92573,16 +92990,16 @@ const toPositionProps = info => ({
92573
92990
  endOffset: info.endIndex
92574
92991
  });
92575
92992
  const toYamlAnchor = info => {
92576
- return new _ast_nodes_YamlAnchor_mjs__WEBPACK_IMPORTED_MODULE_4__["default"]({
92993
+ return new _ast_nodes_YamlAnchor_mjs__WEBPACK_IMPORTED_MODULE_5__["default"]({
92577
92994
  name: info.text,
92578
92995
  ...toPositionProps(info)
92579
92996
  });
92580
92997
  };
92581
92998
  const toYamlTag = (info, tagInfo) => {
92582
92999
  const explicitName = tagInfo?.text || (info.type === 'plain_scalar' ? '?' : '!');
92583
- const kind = info.type.endsWith('mapping') ? _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__.YamlNodeKind.Mapping : info.type.endsWith('sequence') ? _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__.YamlNodeKind.Sequence : _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__.YamlNodeKind.Scalar;
93000
+ 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;
92584
93001
  const positionProps = tagInfo ? toPositionProps(tagInfo) : undefined;
92585
- return new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__["default"]({
93002
+ return new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__["default"]({
92586
93003
  explicitName,
92587
93004
  kind,
92588
93005
  ...positionProps
@@ -92630,12 +93047,29 @@ const processChildren = (cursor, ctx, transformerMap) => {
92630
93047
  return results;
92631
93048
  };
92632
93049
 
93050
+ // strip leading '# ' (or bare '#') from comment text, keeping only the content
93051
+ const stripCommentHash = text => text.split('\n').map(line => line.replace(/^#\s?/, '')).join('\n');
93052
+
93053
+ // find the first YamlNode in a TransformResult (which may be an array from block_node)
93054
+ const findYamlNode = result => {
93055
+ if (result instanceof _ast_nodes_YamlNode_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]) return result;
93056
+ if (Array.isArray(result)) {
93057
+ for (const item of result.flat()) {
93058
+ if (item instanceof _ast_nodes_YamlNode_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]) return item;
93059
+ }
93060
+ }
93061
+ return null;
93062
+ };
92633
93063
  // Helper to process key-value pair children
92634
93064
  const processKeyValuePairChildren = (cursor, ctx, transformerMap) => {
92635
93065
  let key = null;
92636
93066
  let value = null;
92637
93067
  const errors = [];
93068
+ const commentsBetweenKeyValue = [];
93069
+ const commentsAfterValue = [];
92638
93070
  let siblings = {};
93071
+ let seenKey = false;
93072
+ let seenValue = false;
92639
93073
  if (cursor.gotoFirstChild()) {
92640
93074
  do {
92641
93075
  const info = getCursorInfo(cursor);
@@ -92650,12 +93084,25 @@ const processKeyValuePairChildren = (cursor, ctx, transformerMap) => {
92650
93084
  siblings.anchor = info;
92651
93085
  continue;
92652
93086
  }
93087
+
93088
+ // collect comment nodes (extras placed by tree-sitter between key/value)
93089
+ if (info.type === 'comment') {
93090
+ const commentText = stripCommentHash(info.text);
93091
+ if (seenValue) {
93092
+ commentsAfterValue.push(commentText);
93093
+ } else if (seenKey) {
93094
+ commentsBetweenKeyValue.push(commentText);
93095
+ }
93096
+ continue;
93097
+ }
92653
93098
  if (fieldName === 'key') {
92654
93099
  key = transform(cursor, ctx, transformerMap, siblings);
92655
93100
  siblings = {};
93101
+ seenKey = true;
92656
93102
  } else if (fieldName === 'value') {
92657
93103
  value = transform(cursor, ctx, transformerMap, siblings);
92658
93104
  siblings = {};
93105
+ seenValue = true;
92659
93106
  } else if (info.type === 'ERROR') {
92660
93107
  const errorResult = transform(cursor, ctx, transformerMap, siblings);
92661
93108
  if (errorResult !== null) {
@@ -92668,7 +93115,9 @@ const processKeyValuePairChildren = (cursor, ctx, transformerMap) => {
92668
93115
  return {
92669
93116
  key,
92670
93117
  value,
92671
- errors
93118
+ errors,
93119
+ commentsBetweenKeyValue,
93120
+ commentsAfterValue
92672
93121
  };
92673
93122
  };
92674
93123
  const transform = (cursor, ctx, transformerMap, siblings = {}) => {
@@ -92697,7 +93146,7 @@ const createTransformers = transformerMap => ({
92697
93146
  stream(cursor, ctx) {
92698
93147
  const info = getCursorInfo(cursor);
92699
93148
  const children = processChildren(cursor, ctx, transformerMap);
92700
- const stream = new _ast_nodes_YamlStream_mjs__WEBPACK_IMPORTED_MODULE_12__["default"]({
93149
+ const stream = new _ast_nodes_YamlStream_mjs__WEBPACK_IMPORTED_MODULE_13__["default"]({
92701
93150
  children: children.filter(c => c !== null),
92702
93151
  ...toPositionProps(info),
92703
93152
  isMissing: info.isMissing
@@ -92720,7 +93169,7 @@ const createTransformers = transformerMap => ({
92720
93169
  } while (cursor.gotoNextSibling());
92721
93170
  cursor.gotoParent();
92722
93171
  }
92723
- return new _ast_nodes_YamlDirective_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]({
93172
+ return new _ast_nodes_YamlDirective_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]({
92724
93173
  ...toPositionProps(info),
92725
93174
  name: '%YAML',
92726
93175
  parameters: {
@@ -92739,7 +93188,7 @@ const createTransformers = transformerMap => ({
92739
93188
  } while (cursor.gotoNextSibling());
92740
93189
  cursor.gotoParent();
92741
93190
  }
92742
- const tagDirective = new _ast_nodes_YamlDirective_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]({
93191
+ const tagDirective = new _ast_nodes_YamlDirective_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]({
92743
93192
  ...toPositionProps(info),
92744
93193
  name: '%TAG',
92745
93194
  parameters: {
@@ -92761,7 +93210,7 @@ const createTransformers = transformerMap => ({
92761
93210
  } while (cursor.gotoNextSibling());
92762
93211
  cursor.gotoParent();
92763
93212
  }
92764
- return new _ast_nodes_YamlDirective_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]({
93213
+ return new _ast_nodes_YamlDirective_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]({
92765
93214
  ...toPositionProps(info),
92766
93215
  name: children[0],
92767
93216
  parameters: {
@@ -92773,7 +93222,7 @@ const createTransformers = transformerMap => ({
92773
93222
  document(cursor, ctx) {
92774
93223
  const info = getCursorInfo(cursor);
92775
93224
  const children = processChildren(cursor, ctx, transformerMap);
92776
- return new _ast_nodes_YamlDocument_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]({
93225
+ return new _ast_nodes_YamlDocument_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]({
92777
93226
  children: children.flat().filter(c => c !== null),
92778
93227
  ...toPositionProps(info),
92779
93228
  isMissing: info.isMissing
@@ -92805,7 +93254,7 @@ const createTransformers = transformerMap => ({
92805
93254
 
92806
93255
  // No kind node - create empty scalar
92807
93256
  if (lastChildInfo) {
92808
- const emptyScalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
93257
+ const emptyScalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
92809
93258
  content: '',
92810
93259
  anchor: siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined,
92811
93260
  tag: toYamlTag(lastChildInfo, siblings.tag),
@@ -92815,8 +93264,8 @@ const createTransformers = transformerMap => ({
92815
93264
  endLine: lastChildInfo.endPosition.row,
92816
93265
  endCharacter: lastChildInfo.endPosition.column,
92817
93266
  endOffset: lastChildInfo.endIndex,
92818
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
92819
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Plain
93267
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
93268
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Plain
92820
93269
  });
92821
93270
  registerAnchor(emptyScalarNode, ctx);
92822
93271
  return emptyScalarNode;
@@ -92828,13 +93277,13 @@ const createTransformers = transformerMap => ({
92828
93277
  const tag = toYamlTag(info, siblings.tag);
92829
93278
  const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
92830
93279
  const children = processChildren(cursor, ctx, transformerMap);
92831
- const mappingNode = new _ast_nodes_YamlMapping_mjs__WEBPACK_IMPORTED_MODULE_9__["default"]({
93280
+ const mappingNode = new _ast_nodes_YamlMapping_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
92832
93281
  children: children.filter(c => c !== null),
92833
93282
  ...toPositionProps(info),
92834
93283
  anchor,
92835
93284
  tag,
92836
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Block,
92837
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.NextLine,
93285
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Block,
93286
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.NextLine,
92838
93287
  isMissing: info.isMissing
92839
93288
  });
92840
93289
  registerAnchor(mappingNode, ctx);
@@ -92845,13 +93294,15 @@ const createTransformers = transformerMap => ({
92845
93294
  const {
92846
93295
  key,
92847
93296
  value,
92848
- errors
93297
+ errors,
93298
+ commentsBetweenKeyValue,
93299
+ commentsAfterValue
92849
93300
  } = processKeyValuePairChildren(cursor, ctx, transformerMap);
92850
93301
  const children = [];
92851
93302
 
92852
93303
  // Handle empty key
92853
93304
  if (key === null) {
92854
- const emptyKey = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
93305
+ const emptyKey = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
92855
93306
  content: '',
92856
93307
  startLine: info.startPosition.row,
92857
93308
  startCharacter: info.startPosition.column,
@@ -92859,12 +93310,12 @@ const createTransformers = transformerMap => ({
92859
93310
  endLine: info.startPosition.row,
92860
93311
  endCharacter: info.startPosition.column,
92861
93312
  endOffset: info.startIndex,
92862
- tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__["default"]({
93313
+ tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__["default"]({
92863
93314
  explicitName: '?',
92864
- kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__.YamlNodeKind.Scalar
93315
+ kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlNodeKind.Scalar
92865
93316
  }),
92866
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
92867
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Plain
93317
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
93318
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Plain
92868
93319
  });
92869
93320
  children.push(emptyKey);
92870
93321
  } else {
@@ -92873,7 +93324,7 @@ const createTransformers = transformerMap => ({
92873
93324
 
92874
93325
  // Handle empty value
92875
93326
  if (value === null) {
92876
- const emptyValue = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
93327
+ const emptyValue = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
92877
93328
  content: '',
92878
93329
  startLine: info.endPosition.row,
92879
93330
  startCharacter: info.endPosition.column,
@@ -92881,22 +93332,37 @@ const createTransformers = transformerMap => ({
92881
93332
  endLine: info.endPosition.row,
92882
93333
  endCharacter: info.endPosition.column,
92883
93334
  endOffset: info.endIndex,
92884
- tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__["default"]({
93335
+ tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__["default"]({
92885
93336
  explicitName: '?',
92886
- kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__.YamlNodeKind.Scalar
93337
+ kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlNodeKind.Scalar
92887
93338
  }),
92888
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
92889
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Plain
93339
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
93340
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Plain
92890
93341
  });
92891
93342
  children.push(emptyValue);
92892
93343
  } else {
92893
93344
  children.push(value);
92894
93345
  }
93346
+
93347
+ // attach comments found between key and value to the value node
93348
+ if (commentsBetweenKeyValue.length > 0) {
93349
+ const valueNode = findYamlNode(value);
93350
+ if (valueNode) {
93351
+ valueNode.commentBefore = commentsBetweenKeyValue.join('\n');
93352
+ }
93353
+ }
93354
+ // attach comments found after value to the value node
93355
+ if (commentsAfterValue.length > 0) {
93356
+ const valueNode = findYamlNode(value);
93357
+ if (valueNode) {
93358
+ valueNode.comment = commentsAfterValue.join('\n');
93359
+ }
93360
+ }
92895
93361
  children.push(...errors);
92896
- return new _ast_nodes_YamlKeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]({
93362
+ return new _ast_nodes_YamlKeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_9__["default"]({
92897
93363
  children: children.flat().filter(c => c !== null),
92898
93364
  ...toPositionProps(info),
92899
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Block,
93365
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Block,
92900
93366
  isMissing: info.isMissing
92901
93367
  });
92902
93368
  },
@@ -92905,13 +93371,13 @@ const createTransformers = transformerMap => ({
92905
93371
  const tag = toYamlTag(info, siblings.tag);
92906
93372
  const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
92907
93373
  const children = processChildren(cursor, ctx, transformerMap);
92908
- const mappingNode = new _ast_nodes_YamlMapping_mjs__WEBPACK_IMPORTED_MODULE_9__["default"]({
93374
+ const mappingNode = new _ast_nodes_YamlMapping_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
92909
93375
  children: children.flat().filter(c => c !== null),
92910
93376
  ...toPositionProps(info),
92911
93377
  anchor,
92912
93378
  tag,
92913
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
92914
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Explicit,
93379
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
93380
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Explicit,
92915
93381
  isMissing: info.isMissing
92916
93382
  });
92917
93383
  registerAnchor(mappingNode, ctx);
@@ -92922,13 +93388,15 @@ const createTransformers = transformerMap => ({
92922
93388
  const {
92923
93389
  key,
92924
93390
  value,
92925
- errors
93391
+ errors,
93392
+ commentsBetweenKeyValue,
93393
+ commentsAfterValue
92926
93394
  } = processKeyValuePairChildren(cursor, ctx, transformerMap);
92927
93395
  const children = [];
92928
93396
 
92929
93397
  // Handle empty key
92930
93398
  if (key === null) {
92931
- const emptyKey = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
93399
+ const emptyKey = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
92932
93400
  content: '',
92933
93401
  startLine: info.startPosition.row,
92934
93402
  startCharacter: info.startPosition.column,
@@ -92936,12 +93404,12 @@ const createTransformers = transformerMap => ({
92936
93404
  endLine: info.startPosition.row,
92937
93405
  endCharacter: info.startPosition.column,
92938
93406
  endOffset: info.startIndex,
92939
- tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__["default"]({
93407
+ tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__["default"]({
92940
93408
  explicitName: '?',
92941
- kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__.YamlNodeKind.Scalar
93409
+ kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlNodeKind.Scalar
92942
93410
  }),
92943
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
92944
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Plain
93411
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
93412
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Plain
92945
93413
  });
92946
93414
  children.push(emptyKey);
92947
93415
  } else {
@@ -92950,7 +93418,7 @@ const createTransformers = transformerMap => ({
92950
93418
 
92951
93419
  // Handle empty value
92952
93420
  if (value === null) {
92953
- const emptyValue = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
93421
+ const emptyValue = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
92954
93422
  content: '',
92955
93423
  startLine: info.endPosition.row,
92956
93424
  startCharacter: info.endPosition.column,
@@ -92958,22 +93426,37 @@ const createTransformers = transformerMap => ({
92958
93426
  endLine: info.endPosition.row,
92959
93427
  endCharacter: info.endPosition.column,
92960
93428
  endOffset: info.endIndex,
92961
- tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__["default"]({
93429
+ tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__["default"]({
92962
93430
  explicitName: '?',
92963
- kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__.YamlNodeKind.Scalar
93431
+ kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlNodeKind.Scalar
92964
93432
  }),
92965
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
92966
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Plain
93433
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
93434
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Plain
92967
93435
  });
92968
93436
  children.push(emptyValue);
92969
93437
  } else {
92970
93438
  children.push(value);
92971
93439
  }
93440
+
93441
+ // attach comments found between key and value to the value node
93442
+ if (commentsBetweenKeyValue.length > 0) {
93443
+ const valueNode = findYamlNode(value);
93444
+ if (valueNode) {
93445
+ valueNode.commentBefore = commentsBetweenKeyValue.join('\n');
93446
+ }
93447
+ }
93448
+ // attach comments found after value to the value node
93449
+ if (commentsAfterValue.length > 0) {
93450
+ const valueNode = findYamlNode(value);
93451
+ if (valueNode) {
93452
+ valueNode.comment = commentsAfterValue.join('\n');
93453
+ }
93454
+ }
92972
93455
  children.push(...errors);
92973
- return new _ast_nodes_YamlKeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]({
93456
+ return new _ast_nodes_YamlKeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_9__["default"]({
92974
93457
  children: children.flat().filter(c => c !== null),
92975
93458
  ...toPositionProps(info),
92976
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
93459
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
92977
93460
  isMissing: info.isMissing
92978
93461
  });
92979
93462
  },
@@ -92982,13 +93465,13 @@ const createTransformers = transformerMap => ({
92982
93465
  const tag = toYamlTag(info, siblings.tag);
92983
93466
  const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
92984
93467
  const children = processChildren(cursor, ctx, transformerMap);
92985
- const sequenceNode = new _ast_nodes_YamlSequence_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
93468
+ const sequenceNode = new _ast_nodes_YamlSequence_mjs__WEBPACK_IMPORTED_MODULE_12__["default"]({
92986
93469
  children: children.flat(Infinity).filter(c => c !== null),
92987
93470
  ...toPositionProps(info),
92988
93471
  anchor,
92989
93472
  tag,
92990
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Block,
92991
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.NextLine
93473
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Block,
93474
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.NextLine
92992
93475
  });
92993
93476
  registerAnchor(sequenceNode, ctx);
92994
93477
  return ctx.schema.resolve(sequenceNode);
@@ -92999,11 +93482,11 @@ const createTransformers = transformerMap => ({
92999
93482
 
93000
93483
  // If only one child (the "-" literal), create empty node
93001
93484
  if (children.length === 0) {
93002
- const emptyScalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
93485
+ const emptyScalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
93003
93486
  content: '',
93004
- tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__["default"]({
93487
+ tag: new _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__["default"]({
93005
93488
  explicitName: '?',
93006
- kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_13__.YamlNodeKind.Scalar
93489
+ kind: _ast_nodes_YamlTag_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlNodeKind.Scalar
93007
93490
  }),
93008
93491
  startLine: info.endPosition.row,
93009
93492
  startCharacter: info.endPosition.column,
@@ -93011,8 +93494,8 @@ const createTransformers = transformerMap => ({
93011
93494
  endLine: info.endPosition.row,
93012
93495
  endCharacter: info.endPosition.column,
93013
93496
  endOffset: info.endIndex,
93014
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
93015
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Plain
93497
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
93498
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Plain
93016
93499
  });
93017
93500
  return [emptyScalarNode];
93018
93501
  }
@@ -93023,13 +93506,13 @@ const createTransformers = transformerMap => ({
93023
93506
  const tag = toYamlTag(info, siblings.tag);
93024
93507
  const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
93025
93508
  const children = processChildren(cursor, ctx, transformerMap);
93026
- const sequenceNode = new _ast_nodes_YamlSequence_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
93509
+ const sequenceNode = new _ast_nodes_YamlSequence_mjs__WEBPACK_IMPORTED_MODULE_12__["default"]({
93027
93510
  children: children.flat().filter(c => c !== null),
93028
93511
  ...toPositionProps(info),
93029
93512
  anchor,
93030
93513
  tag,
93031
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
93032
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Explicit
93514
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
93515
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Explicit
93033
93516
  });
93034
93517
  registerAnchor(sequenceNode, ctx);
93035
93518
  return ctx.schema.resolve(sequenceNode);
@@ -93038,14 +93521,15 @@ const createTransformers = transformerMap => ({
93038
93521
  const info = getCursorInfo(cursor);
93039
93522
  const tag = toYamlTag(info, siblings.tag);
93040
93523
  const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
93041
- const scalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
93524
+ const scalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
93042
93525
  content: info.text,
93043
93526
  anchor,
93044
93527
  tag,
93045
93528
  ...toPositionProps(info),
93046
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
93047
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Plain
93529
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
93530
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.Plain
93048
93531
  });
93532
+ scalarNode.rawContent = info.text;
93049
93533
  registerAnchor(scalarNode, ctx);
93050
93534
  return ctx.schema.resolve(scalarNode);
93051
93535
  },
@@ -93053,14 +93537,15 @@ const createTransformers = transformerMap => ({
93053
93537
  const info = getCursorInfo(cursor);
93054
93538
  const tag = toYamlTag(info, siblings.tag);
93055
93539
  const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
93056
- const scalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
93540
+ const scalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
93057
93541
  content: info.text,
93058
93542
  anchor,
93059
93543
  tag,
93060
93544
  ...toPositionProps(info),
93061
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
93062
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.SingleQuoted
93545
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
93546
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.SingleQuoted
93063
93547
  });
93548
+ scalarNode.rawContent = info.text;
93064
93549
  registerAnchor(scalarNode, ctx);
93065
93550
  return ctx.schema.resolve(scalarNode);
93066
93551
  },
@@ -93068,14 +93553,15 @@ const createTransformers = transformerMap => ({
93068
93553
  const info = getCursorInfo(cursor);
93069
93554
  const tag = toYamlTag(info, siblings.tag);
93070
93555
  const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
93071
- const scalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
93556
+ const scalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
93072
93557
  content: info.text,
93073
93558
  anchor,
93074
93559
  tag,
93075
93560
  ...toPositionProps(info),
93076
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Flow,
93077
- style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.DoubleQuoted
93561
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Flow,
93562
+ style: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyle.DoubleQuoted
93078
93563
  });
93564
+ scalarNode.rawContent = info.text;
93079
93565
  registerAnchor(scalarNode, ctx);
93080
93566
  return ctx.schema.resolve(scalarNode);
93081
93567
  },
@@ -93083,27 +93569,29 @@ const createTransformers = transformerMap => ({
93083
93569
  const info = getCursorInfo(cursor);
93084
93570
  const tag = toYamlTag(info, siblings.tag);
93085
93571
  const anchor = siblings.anchor ? toYamlAnchor(siblings.anchor) : undefined;
93086
- const style = info.text.startsWith('|') ? _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Literal : info.text.startsWith('>') ? _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Folded : _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyle.Plain;
93087
- const scalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_10__["default"]({
93572
+ 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;
93573
+ const scalarNode = new _ast_nodes_YamlScalar_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]({
93088
93574
  content: info.text,
93089
93575
  anchor,
93090
93576
  tag,
93091
93577
  ...toPositionProps(info),
93092
- styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_14__.YamlStyleGroup.Block,
93578
+ styleGroup: _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_15__.YamlStyleGroup.Block,
93093
93579
  style
93094
93580
  });
93581
+ scalarNode.rawContent = info.text;
93095
93582
  registerAnchor(scalarNode, ctx);
93096
93583
  return ctx.schema.resolve(scalarNode);
93097
93584
  },
93098
93585
  comment(cursor) {
93099
93586
  const info = getCursorInfo(cursor);
93100
- return new _ast_nodes_YamlComment_mjs__WEBPACK_IMPORTED_MODULE_5__["default"]({
93101
- content: info.text
93587
+ return new _ast_nodes_YamlComment_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]({
93588
+ content: info.text,
93589
+ ...toPositionProps(info)
93102
93590
  });
93103
93591
  },
93104
93592
  alias(cursor, ctx) {
93105
93593
  const info = getCursorInfo(cursor);
93106
- const alias = new _ast_nodes_YamlAlias_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]({
93594
+ const alias = new _ast_nodes_YamlAlias_mjs__WEBPACK_IMPORTED_MODULE_4__["default"]({
93107
93595
  content: info.text
93108
93596
  });
93109
93597
  return ctx.referenceManager.resolveAlias(alias);
@@ -93185,6 +93673,147 @@ const maybeAddSourceMap = (node, element, ctx) => {
93185
93673
  _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_8__["default"].transfer(node, element);
93186
93674
  };
93187
93675
 
93676
+ // find the first descendant matching a type path through the AST
93677
+ const findFirst = (node, path) => {
93678
+ if (path.length === 0) return node;
93679
+ const [type, ...rest] = path;
93680
+ for (const child of node.children || []) {
93681
+ if (child.type !== type) continue;
93682
+ const found = findFirst(child, rest);
93683
+ if (found) return found;
93684
+ }
93685
+ return undefined;
93686
+ };
93687
+
93688
+ // detect indent from first nested block mapping (stream > document > mapping > keyValuePair > mapping)
93689
+ const detectIndent = node => {
93690
+ const nested = findFirst(node, ['document', 'mapping', 'keyValuePair', 'mapping']);
93691
+ if (nested?.styleGroup === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_9__.YamlStyleGroup.Block && typeof nested.startCharacter === 'number' && nested.startCharacter > 0) {
93692
+ return nested.startCharacter;
93693
+ }
93694
+ return 2;
93695
+ };
93696
+
93697
+ // strip leading '#' from each line of comment text; yaml library adds '#' during stringification
93698
+ const stripCommentHash = text => text.split('\n').map(line => line.replace(/^#/, '')).join('\n');
93699
+
93700
+ // collect comment texts from raw AST children, indexed by position relative to non-comment siblings
93701
+
93702
+ // is the comment on the same line as the previous non-comment sibling?
93703
+ const isInlineComment = (child, lastEndLine, pending) => {
93704
+ return pending.length === 0 && lastEndLine !== undefined && child.startLine === lastEndLine;
93705
+ };
93706
+
93707
+ /**
93708
+ * @param children - raw AST children of a mapping/sequence
93709
+ * @param containerStartCol - the start column of the container node;
93710
+ * trailing comments whose startCharacter is less than this are out-of-scope
93711
+ * (tree-sitter may place them inside a nested block they don't belong to)
93712
+ */
93713
+ const collectComments = (children, containerStartCol) => {
93714
+ const before = new Map();
93715
+ const after = new Map();
93716
+ const pending = [];
93717
+ let lastNonCommentEndLine;
93718
+ let elementIdx = 0;
93719
+ for (const child of children) {
93720
+ if (child?.type === 'comment') {
93721
+ const text = stripCommentHash(child.content || '');
93722
+ if (elementIdx > 0 && isInlineComment(child, lastNonCommentEndLine, pending)) {
93723
+ after.set(elementIdx - 1, text);
93724
+ } else {
93725
+ pending.push({
93726
+ text,
93727
+ startLine: child.startLine,
93728
+ startCharacter: child.startCharacter
93729
+ });
93730
+ }
93731
+ continue;
93732
+ }
93733
+
93734
+ // non-comment node: attach any pending comments as commentBefore
93735
+ if (pending.length > 0) {
93736
+ before.set(elementIdx, pending.map(c => c.text).join('\n'));
93737
+ pending.length = 0;
93738
+ }
93739
+ lastNonCommentEndLine = child.endLine;
93740
+ elementIdx++;
93741
+ }
93742
+
93743
+ // remaining pending comments are trailing — split into in-scope and out-of-scope
93744
+ let trailing = null;
93745
+ const outOfScope = [];
93746
+ for (const c of pending) {
93747
+ if (containerStartCol !== undefined && c.startCharacter !== undefined && c.startCharacter < containerStartCol) {
93748
+ outOfScope.push(c.text);
93749
+ } else {
93750
+ trailing = trailing ? `${trailing}\n${c.text}` : c.text;
93751
+ }
93752
+ }
93753
+ return {
93754
+ before,
93755
+ after,
93756
+ trailing,
93757
+ outOfScope
93758
+ };
93759
+ };
93760
+
93761
+ // set a yaml style property on an element, initializing style.yaml if needed
93762
+ const setYamlStyleProp = (element, key, value) => {
93763
+ if (!element.style) element.style = {};
93764
+ const yaml = element.style.yaml ?? {};
93765
+ yaml[key] = value;
93766
+ element.style.yaml = yaml;
93767
+ };
93768
+
93769
+ // apply collected comments to transformed ApiDOM elements
93770
+ const applyComments = (elements, comments) => {
93771
+ comments.before.forEach((text, idx) => {
93772
+ if (elements[idx]) setYamlStyleProp(elements[idx], 'commentBefore', text);
93773
+ });
93774
+ comments.after.forEach((text, idx) => {
93775
+ if (elements[idx]) setYamlStyleProp(elements[idx], 'comment', text);
93776
+ });
93777
+ };
93778
+
93779
+ // detect flow collection padding from node positions
93780
+ // gap of 1 between container start and first child start → no padding: [x
93781
+ // gap of 2+ → padding: [ x
93782
+ // gap of 1 between container start and first child start → no padding: {x
93783
+ // gap of 2+ → padding: { x
93784
+ const detectFlowPadding = node => {
93785
+ const firstChild = (node.children || [])[0];
93786
+ if (firstChild && typeof node.startCharacter === 'number' && typeof firstChild.startCharacter === 'number') {
93787
+ return firstChild.startCharacter - node.startCharacter > 1;
93788
+ }
93789
+ return true;
93790
+ };
93791
+
93792
+ // build yaml style object for an element
93793
+ const buildYamlStyle = (node, ctx, extras) => {
93794
+ const yamlStyle = {
93795
+ styleGroup: node.styleGroup,
93796
+ indent: ctx.indent
93797
+ };
93798
+ if (ctx.flowCollectionPadding !== null) {
93799
+ yamlStyle.flowCollectionPadding = ctx.flowCollectionPadding;
93800
+ }
93801
+ if (node.comment) {
93802
+ yamlStyle.comment = node.comment;
93803
+ }
93804
+ if (node.commentBefore) {
93805
+ yamlStyle.commentBefore = node.commentBefore;
93806
+ }
93807
+ if (extras) {
93808
+ for (const [key, value] of Object.entries(extras)) {
93809
+ if (value !== undefined) yamlStyle[key] = value;
93810
+ }
93811
+ }
93812
+ return {
93813
+ yaml: yamlStyle
93814
+ };
93815
+ };
93816
+
93188
93817
  // Transform a single node based on its type
93189
93818
  const transform = (node, ctx) => {
93190
93819
  if (node === null || node === undefined) {
@@ -93220,22 +93849,58 @@ const transform = (node, ctx) => {
93220
93849
  // Transform children array and flatten results
93221
93850
  const transformChildren = (children, ctx) => {
93222
93851
  const results = [];
93852
+ let pendingPromoted = [];
93223
93853
  for (const child of children) {
93224
93854
  const result = transform(child, ctx);
93225
93855
  if (result === null) {
93856
+ // collect any promoted comments generated during this null transform
93857
+ if (ctx.style && ctx.promotedComments.length > 0) {
93858
+ pendingPromoted.push(...ctx.promotedComments);
93859
+ ctx.promotedComments = [];
93860
+ }
93226
93861
  continue;
93227
93862
  }
93863
+
93864
+ // apply promoted comments from PREVIOUS children as commentBefore on this element
93865
+ if (ctx.style && pendingPromoted.length > 0) {
93866
+ const target = Array.isArray(result) ? result[0] : result;
93867
+ if (target) {
93868
+ if (!target.style) target.style = {};
93869
+ const yaml = target.style.yaml ?? {};
93870
+ const existing = yaml.commentBefore;
93871
+ const promoted = pendingPromoted.join('\n');
93872
+ yaml.commentBefore = existing ? `${promoted}\n${existing}` : promoted;
93873
+ target.style.yaml = yaml;
93874
+ }
93875
+ pendingPromoted = [];
93876
+ }
93877
+
93878
+ // collect any promoted comments generated by this child's transform
93879
+ // (these will be applied to the NEXT sibling)
93880
+ if (ctx.style && ctx.promotedComments.length > 0) {
93881
+ pendingPromoted.push(...ctx.promotedComments);
93882
+ ctx.promotedComments = [];
93883
+ }
93228
93884
  if (Array.isArray(result)) {
93229
93885
  results.push(...result);
93230
93886
  } else {
93231
93887
  results.push(result);
93232
93888
  }
93233
93889
  }
93890
+
93891
+ // if promoted comments remain after all children, propagate up to parent scope
93892
+ if (pendingPromoted.length > 0) {
93893
+ ctx.promotedComments.push(...pendingPromoted);
93894
+ }
93234
93895
  return results;
93235
93896
  };
93236
93897
 
93237
93898
  // Stream: Wraps transformed children in ParseResultElement
93238
93899
  const transformStream = (node, ctx) => {
93900
+ // detect indent from the stream structure (only needed for style preservation)
93901
+ if (ctx.style) {
93902
+ ctx.indent = detectIndent(node);
93903
+ }
93239
93904
  const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_7__["default"]();
93240
93905
 
93241
93906
  // Transform all children
@@ -93281,12 +93946,35 @@ const transformDocument = (node, ctx) => {
93281
93946
  return transformChildren(node.children || [], ctx);
93282
93947
  };
93283
93948
 
93949
+ // shared logic for transformMapping and transformSequence
93950
+ const transformCollection = (element, node, ctx) => {
93951
+ const typedNode = node;
93952
+ const children = node.children || [];
93953
+ if (ctx.style) {
93954
+ if (ctx.flowCollectionPadding === null && node.styleGroup === _ast_nodes_YamlStyle_mjs__WEBPACK_IMPORTED_MODULE_9__.YamlStyleGroup.Flow) {
93955
+ ctx.flowCollectionPadding = detectFlowPadding(typedNode);
93956
+ }
93957
+ const comments = collectComments(children, typedNode.startCharacter);
93958
+ const childElements = transformChildren(children, ctx);
93959
+ // bypass content setter to avoid re-refracting already-transformed elements
93960
+ element._content = childElements; // eslint-disable-line @typescript-eslint/no-explicit-any
93961
+ applyComments(childElements, comments);
93962
+ element.style = buildYamlStyle(node, ctx, {
93963
+ comment: comments.trailing
93964
+ });
93965
+ if (comments.outOfScope.length > 0) {
93966
+ ctx.promotedComments.push(...comments.outOfScope);
93967
+ }
93968
+ } else {
93969
+ element._content = transformChildren(children, ctx); // eslint-disable-line @typescript-eslint/no-explicit-any
93970
+ }
93971
+ maybeAddSourceMap(typedNode, element, ctx);
93972
+ };
93973
+
93284
93974
  // Mapping: Transforms to ObjectElement
93285
93975
  const transformMapping = (node, ctx) => {
93286
93976
  const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__["default"]();
93287
- // @ts-ignore
93288
- element._content = transformChildren(node.children || [], ctx);
93289
- maybeAddSourceMap(node, element, ctx);
93977
+ transformCollection(element, node, ctx);
93290
93978
  return element;
93291
93979
  };
93292
93980
 
@@ -93320,9 +94008,7 @@ const transformKeyValuePair = (node, ctx) => {
93320
94008
  // Sequence: Transforms to ArrayElement
93321
94009
  const transformSequence = (node, ctx) => {
93322
94010
  const element = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__["default"]();
93323
- // @ts-ignore
93324
- element._content = transformChildren(node.children || [], ctx);
93325
- maybeAddSourceMap(node, element, ctx);
94011
+ transformCollection(element, node, ctx);
93326
94012
  return element;
93327
94013
  };
93328
94014
 
@@ -93335,6 +94021,15 @@ const transformScalar = (node, ctx) => {
93335
94021
  element.classes.push('yaml-e-node');
93336
94022
  element.classes.push('yaml-e-scalar');
93337
94023
  }
94024
+ if (ctx.style) {
94025
+ const extras = {
94026
+ scalarStyle: node.style
94027
+ };
94028
+ if (node.rawContent !== undefined) {
94029
+ extras.rawContent = node.rawContent;
94030
+ }
94031
+ element.style = buildYamlStyle(node, ctx, extras);
94032
+ }
93338
94033
  maybeAddSourceMap(node, element, ctx);
93339
94034
  return element;
93340
94035
  };
@@ -93399,13 +94094,18 @@ const transformRootError = (node, ctx) => {
93399
94094
  * @public
93400
94095
  */
93401
94096
  const transformYamlAstToApiDOM = (yamlAst, {
93402
- sourceMap = false
94097
+ sourceMap = false,
94098
+ style = false
93403
94099
  } = {}) => {
93404
94100
  const ctx = {
93405
94101
  sourceMap,
94102
+ style,
93406
94103
  namespace: new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__["default"](),
93407
94104
  annotations: [],
93408
- processedDocumentCount: 0
94105
+ processedDocumentCount: 0,
94106
+ indent: 2,
94107
+ flowCollectionPadding: null,
94108
+ promotedComments: []
93409
94109
  };
93410
94110
  const rootNode = yamlAst.rootNode;
93411
94111
 
@@ -94004,6 +94704,8 @@ class YamlNode extends _Node_mjs__WEBPACK_IMPORTED_MODULE_0__["default"] {
94004
94704
  tag;
94005
94705
  style;
94006
94706
  styleGroup;
94707
+ comment;
94708
+ commentBefore;
94007
94709
  constructor({
94008
94710
  anchor,
94009
94711
  tag,
@@ -94043,6 +94745,7 @@ __webpack_require__.r(__webpack_exports__);
94043
94745
  class YamlScalar extends _YamlNode_mjs__WEBPACK_IMPORTED_MODULE_0__["default"] {
94044
94746
  static type = 'scalar';
94045
94747
  content;
94748
+ rawContent;
94046
94749
  constructor({
94047
94750
  content,
94048
94751
  ...rest
@@ -94840,7 +95543,8 @@ __webpack_require__.r(__webpack_exports__);
94840
95543
  * @public
94841
95544
  */
94842
95545
  const analyze = (cst, {
94843
- sourceMap = false
95546
+ sourceMap = false,
95547
+ style = false
94844
95548
  } = {}) => {
94845
95549
  const cursor = cst.walk();
94846
95550
  const schema = new _ast_schemas_json_index_mjs__WEBPACK_IMPORTED_MODULE_0__["default"]();
@@ -94855,7 +95559,8 @@ const analyze = (cst, {
94855
95559
 
94856
95560
  // Pass 2: YAML AST -> ApiDOM (direct transformation)
94857
95561
  return (0,_YamlAstTransformer_mjs__WEBPACK_IMPORTED_MODULE_3__.transformYamlAstToApiDOM)(yamlAst, {
94858
- sourceMap
95562
+ sourceMap,
95563
+ style
94859
95564
  });
94860
95565
  };
94861
95566
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (analyze);