@speclynx/apidom-parser-adapter-openapi-yaml-3-1 4.9.1 → 4.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.10.1](https://github.com/speclynx/apidom/compare/v4.10.0...v4.10.1) (2026-05-20)
7
+
8
+ **Note:** Version bump only for package @speclynx/apidom-parser-adapter-openapi-yaml-3-1
9
+
10
+ # [4.10.0](https://github.com/speclynx/apidom/compare/v4.9.1...v4.10.0) (2026-05-12)
11
+
12
+ **Note:** Version bump only for package @speclynx/apidom-parser-adapter-openapi-yaml-3-1
13
+
6
14
  ## [4.9.1](https://github.com/speclynx/apidom/compare/v4.9.0...v4.9.1) (2026-04-21)
7
15
 
8
16
  **Note:** Version bump only for package @speclynx/apidom-parser-adapter-openapi-yaml-3-1
@@ -22143,8 +22143,10 @@ class Composer {
22143
22143
  }
22144
22144
  }
22145
22145
  if (afterDoc) {
22146
- Array.prototype.push.apply(doc.errors, this.errors);
22147
- Array.prototype.push.apply(doc.warnings, this.warnings);
22146
+ for (let i = 0; i < this.errors.length; ++i)
22147
+ doc.errors.push(this.errors[i]);
22148
+ for (let i = 0; i < this.warnings.length; ++i)
22149
+ doc.warnings.push(this.warnings[i]);
22148
22150
  }
22149
22151
  else {
22150
22152
  doc.errors = this.errors;
@@ -23106,7 +23108,7 @@ function doubleQuotedValue(source, onError) {
23106
23108
  next = source[++i + 1];
23107
23109
  }
23108
23110
  else if (next === 'x' || next === 'u' || next === 'U') {
23109
- const length = { x: 2, u: 4, U: 8 }[next];
23111
+ const length = next === 'x' ? 2 : next === 'u' ? 4 : 8;
23110
23112
  res += parseCharCode(source, i + 1, length, onError);
23111
23113
  i += length;
23112
23114
  }
@@ -23176,12 +23178,14 @@ function parseCharCode(source, offset, length, onError) {
23176
23178
  const cc = source.substr(offset, length);
23177
23179
  const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
23178
23180
  const code = ok ? parseInt(cc, 16) : NaN;
23179
- if (isNaN(code)) {
23181
+ try {
23182
+ return String.fromCodePoint(code);
23183
+ }
23184
+ catch {
23180
23185
  const raw = source.substr(offset - 2, length + 2);
23181
23186
  onError(offset - 2, 'BAD_DQ_ESCAPE', `Invalid escape sequence ${raw}`);
23182
23187
  return raw;
23183
23188
  }
23184
- return String.fromCodePoint(code);
23185
23189
  }
23186
23190
 
23187
23191
 
@@ -24494,6 +24498,8 @@ class Alias extends _Node_js__WEBPACK_IMPORTED_MODULE_3__.NodeBase {
24494
24498
  * instance of the `source` anchor before this node.
24495
24499
  */
24496
24500
  resolve(doc, ctx) {
24501
+ if (ctx?.maxAliasCount === 0)
24502
+ throw new ReferenceError('Alias resolution is disabled');
24497
24503
  let nodes;
24498
24504
  if (ctx?.aliasResolveCache) {
24499
24505
  nodes = ctx.aliasResolveCache;
@@ -26248,7 +26254,7 @@ class Lexer {
26248
26254
  const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
26249
26255
  this.indentNext = this.indentValue + 1;
26250
26256
  this.indentValue += n;
26251
- return yield* this.parseBlockStart();
26257
+ return 'block-start';
26252
26258
  }
26253
26259
  return 'doc';
26254
26260
  }
@@ -26569,32 +26575,36 @@ class Lexer {
26569
26575
  return 0;
26570
26576
  }
26571
26577
  *pushIndicators() {
26572
- switch (this.charAt(0)) {
26573
- case '!':
26574
- return ((yield* this.pushTag()) +
26575
- (yield* this.pushSpaces(true)) +
26576
- (yield* this.pushIndicators()));
26577
- case '&':
26578
- return ((yield* this.pushUntil(isNotAnchorChar)) +
26579
- (yield* this.pushSpaces(true)) +
26580
- (yield* this.pushIndicators()));
26581
- case '-': // this is an error
26582
- case '?': // this is an error outside flow collections
26583
- case ':': {
26584
- const inFlow = this.flowLevel > 0;
26585
- const ch1 = this.charAt(1);
26586
- if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
26587
- if (!inFlow)
26588
- this.indentNext = this.indentValue + 1;
26589
- else if (this.flowKey)
26590
- this.flowKey = false;
26591
- return ((yield* this.pushCount(1)) +
26592
- (yield* this.pushSpaces(true)) +
26593
- (yield* this.pushIndicators()));
26578
+ let n = 0;
26579
+ loop: while (true) {
26580
+ switch (this.charAt(0)) {
26581
+ case '!':
26582
+ n += yield* this.pushTag();
26583
+ n += yield* this.pushSpaces(true);
26584
+ continue loop;
26585
+ case '&':
26586
+ n += yield* this.pushUntil(isNotAnchorChar);
26587
+ n += yield* this.pushSpaces(true);
26588
+ continue loop;
26589
+ case '-': // this is an error
26590
+ case '?': // this is an error outside flow collections
26591
+ case ':': {
26592
+ const inFlow = this.flowLevel > 0;
26593
+ const ch1 = this.charAt(1);
26594
+ if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
26595
+ if (!inFlow)
26596
+ this.indentNext = this.indentValue + 1;
26597
+ else if (this.flowKey)
26598
+ this.flowKey = false;
26599
+ n += yield* this.pushCount(1);
26600
+ n += yield* this.pushSpaces(true);
26601
+ continue loop;
26602
+ }
26594
26603
  }
26595
26604
  }
26605
+ break loop;
26596
26606
  }
26597
- return 0;
26607
+ return n;
26598
26608
  }
26599
26609
  *pushTag() {
26600
26610
  if (this.charAt(1) === '<') {
@@ -26787,6 +26797,14 @@ function getFirstKeyStartProps(prev) {
26787
26797
  }
26788
26798
  return prev.splice(i, prev.length);
26789
26799
  }
26800
+ function arrayPushArray(target, source) {
26801
+ // May exhaust call stack with large `source` array
26802
+ if (source.length < 1e5)
26803
+ Array.prototype.push.apply(target, source);
26804
+ else
26805
+ for (let i = 0; i < source.length; ++i)
26806
+ target.push(source[i]);
26807
+ }
26790
26808
  function fixFlowSeqItems(fc) {
26791
26809
  if (fc.start.type === 'flow-seq-start') {
26792
26810
  for (const it of fc.items) {
@@ -26799,12 +26817,12 @@ function fixFlowSeqItems(fc) {
26799
26817
  delete it.key;
26800
26818
  if (isFlowToken(it.value)) {
26801
26819
  if (it.value.end)
26802
- Array.prototype.push.apply(it.value.end, it.sep);
26820
+ arrayPushArray(it.value.end, it.sep);
26803
26821
  else
26804
26822
  it.value.end = it.sep;
26805
26823
  }
26806
26824
  else
26807
- Array.prototype.push.apply(it.start, it.sep);
26825
+ arrayPushArray(it.start, it.sep);
26808
26826
  delete it.sep;
26809
26827
  }
26810
26828
  }
@@ -27222,7 +27240,7 @@ class Parser {
27222
27240
  const prev = map.items[map.items.length - 2];
27223
27241
  const end = prev?.value?.end;
27224
27242
  if (Array.isArray(end)) {
27225
- Array.prototype.push.apply(end, it.start);
27243
+ arrayPushArray(end, it.start);
27226
27244
  end.push(this.sourceToken);
27227
27245
  map.items.pop();
27228
27246
  return;
@@ -27437,7 +27455,7 @@ class Parser {
27437
27455
  const prev = seq.items[seq.items.length - 2];
27438
27456
  const end = prev?.value?.end;
27439
27457
  if (Array.isArray(end)) {
27440
- Array.prototype.push.apply(end, it.start);
27458
+ arrayPushArray(end, it.start);
27441
27459
  end.push(this.sourceToken);
27442
27460
  seq.items.pop();
27443
27461
  return;
@@ -28673,18 +28691,18 @@ const isMergeKey = (ctx, key) => (merge.identify(key) ||
28673
28691
  merge.identify(key.value))) &&
28674
28692
  ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
28675
28693
  function addMergeToJSMap(ctx, map, value) {
28676
- value = ctx && (0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isAlias)(value) ? value.resolve(ctx.doc) : value;
28677
- if ((0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isSeq)(value))
28678
- for (const it of value.items)
28694
+ const source = resolveAliasValue(ctx, value);
28695
+ if ((0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isSeq)(source))
28696
+ for (const it of source.items)
28679
28697
  mergeValue(ctx, map, it);
28680
- else if (Array.isArray(value))
28681
- for (const it of value)
28698
+ else if (Array.isArray(source))
28699
+ for (const it of source)
28682
28700
  mergeValue(ctx, map, it);
28683
28701
  else
28684
- mergeValue(ctx, map, value);
28702
+ mergeValue(ctx, map, source);
28685
28703
  }
28686
28704
  function mergeValue(ctx, map, value) {
28687
- const source = ctx && (0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isAlias)(value) ? value.resolve(ctx.doc) : value;
28705
+ const source = resolveAliasValue(ctx, value);
28688
28706
  if (!(0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isMap)(source))
28689
28707
  throw new Error('Merge sources must be maps or map aliases');
28690
28708
  const srcMap = source.toJSON(null, ctx, Map);
@@ -28707,6 +28725,9 @@ function mergeValue(ctx, map, value) {
28707
28725
  }
28708
28726
  return map;
28709
28727
  }
28728
+ function resolveAliasValue(ctx, value) {
28729
+ return ctx && (0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isAlias)(value) ? value.resolve(ctx.doc, ctx) : value;
28730
+ }
28710
28731
 
28711
28732
 
28712
28733
 
@@ -29817,7 +29838,8 @@ function stringifyNumber({ format, minFractionDigits, tag, value }) {
29817
29838
  if (!format &&
29818
29839
  minFractionDigits &&
29819
29840
  (!tag || tag === 'tag:yaml.org,2002:float') &&
29820
- /^\d/.test(n)) {
29841
+ /^-?\d/.test(n) &&
29842
+ !n.includes('e')) {
29821
29843
  let i = n.indexOf('.');
29822
29844
  if (i < 0) {
29823
29845
  i = n.length;