@speclynx/apidom-parser-adapter-overlay-yaml-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-overlay-yaml-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-overlay-yaml-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-overlay-yaml-1
@@ -20952,8 +20952,10 @@ class Composer {
20952
20952
  }
20953
20953
  }
20954
20954
  if (afterDoc) {
20955
- Array.prototype.push.apply(doc.errors, this.errors);
20956
- Array.prototype.push.apply(doc.warnings, this.warnings);
20955
+ for (let i = 0; i < this.errors.length; ++i)
20956
+ doc.errors.push(this.errors[i]);
20957
+ for (let i = 0; i < this.warnings.length; ++i)
20958
+ doc.warnings.push(this.warnings[i]);
20957
20959
  }
20958
20960
  else {
20959
20961
  doc.errors = this.errors;
@@ -21915,7 +21917,7 @@ function doubleQuotedValue(source, onError) {
21915
21917
  next = source[++i + 1];
21916
21918
  }
21917
21919
  else if (next === 'x' || next === 'u' || next === 'U') {
21918
- const length = { x: 2, u: 4, U: 8 }[next];
21920
+ const length = next === 'x' ? 2 : next === 'u' ? 4 : 8;
21919
21921
  res += parseCharCode(source, i + 1, length, onError);
21920
21922
  i += length;
21921
21923
  }
@@ -21985,12 +21987,14 @@ function parseCharCode(source, offset, length, onError) {
21985
21987
  const cc = source.substr(offset, length);
21986
21988
  const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
21987
21989
  const code = ok ? parseInt(cc, 16) : NaN;
21988
- if (isNaN(code)) {
21990
+ try {
21991
+ return String.fromCodePoint(code);
21992
+ }
21993
+ catch {
21989
21994
  const raw = source.substr(offset - 2, length + 2);
21990
21995
  onError(offset - 2, 'BAD_DQ_ESCAPE', `Invalid escape sequence ${raw}`);
21991
21996
  return raw;
21992
21997
  }
21993
- return String.fromCodePoint(code);
21994
21998
  }
21995
21999
 
21996
22000
 
@@ -23303,6 +23307,8 @@ class Alias extends _Node_js__WEBPACK_IMPORTED_MODULE_3__.NodeBase {
23303
23307
  * instance of the `source` anchor before this node.
23304
23308
  */
23305
23309
  resolve(doc, ctx) {
23310
+ if (ctx?.maxAliasCount === 0)
23311
+ throw new ReferenceError('Alias resolution is disabled');
23306
23312
  let nodes;
23307
23313
  if (ctx?.aliasResolveCache) {
23308
23314
  nodes = ctx.aliasResolveCache;
@@ -25057,7 +25063,7 @@ class Lexer {
25057
25063
  const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
25058
25064
  this.indentNext = this.indentValue + 1;
25059
25065
  this.indentValue += n;
25060
- return yield* this.parseBlockStart();
25066
+ return 'block-start';
25061
25067
  }
25062
25068
  return 'doc';
25063
25069
  }
@@ -25378,32 +25384,36 @@ class Lexer {
25378
25384
  return 0;
25379
25385
  }
25380
25386
  *pushIndicators() {
25381
- switch (this.charAt(0)) {
25382
- case '!':
25383
- return ((yield* this.pushTag()) +
25384
- (yield* this.pushSpaces(true)) +
25385
- (yield* this.pushIndicators()));
25386
- case '&':
25387
- return ((yield* this.pushUntil(isNotAnchorChar)) +
25388
- (yield* this.pushSpaces(true)) +
25389
- (yield* this.pushIndicators()));
25390
- case '-': // this is an error
25391
- case '?': // this is an error outside flow collections
25392
- case ':': {
25393
- const inFlow = this.flowLevel > 0;
25394
- const ch1 = this.charAt(1);
25395
- if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
25396
- if (!inFlow)
25397
- this.indentNext = this.indentValue + 1;
25398
- else if (this.flowKey)
25399
- this.flowKey = false;
25400
- return ((yield* this.pushCount(1)) +
25401
- (yield* this.pushSpaces(true)) +
25402
- (yield* this.pushIndicators()));
25387
+ let n = 0;
25388
+ loop: while (true) {
25389
+ switch (this.charAt(0)) {
25390
+ case '!':
25391
+ n += yield* this.pushTag();
25392
+ n += yield* this.pushSpaces(true);
25393
+ continue loop;
25394
+ case '&':
25395
+ n += yield* this.pushUntil(isNotAnchorChar);
25396
+ n += yield* this.pushSpaces(true);
25397
+ continue loop;
25398
+ case '-': // this is an error
25399
+ case '?': // this is an error outside flow collections
25400
+ case ':': {
25401
+ const inFlow = this.flowLevel > 0;
25402
+ const ch1 = this.charAt(1);
25403
+ if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
25404
+ if (!inFlow)
25405
+ this.indentNext = this.indentValue + 1;
25406
+ else if (this.flowKey)
25407
+ this.flowKey = false;
25408
+ n += yield* this.pushCount(1);
25409
+ n += yield* this.pushSpaces(true);
25410
+ continue loop;
25411
+ }
25403
25412
  }
25404
25413
  }
25414
+ break loop;
25405
25415
  }
25406
- return 0;
25416
+ return n;
25407
25417
  }
25408
25418
  *pushTag() {
25409
25419
  if (this.charAt(1) === '<') {
@@ -25596,6 +25606,14 @@ function getFirstKeyStartProps(prev) {
25596
25606
  }
25597
25607
  return prev.splice(i, prev.length);
25598
25608
  }
25609
+ function arrayPushArray(target, source) {
25610
+ // May exhaust call stack with large `source` array
25611
+ if (source.length < 1e5)
25612
+ Array.prototype.push.apply(target, source);
25613
+ else
25614
+ for (let i = 0; i < source.length; ++i)
25615
+ target.push(source[i]);
25616
+ }
25599
25617
  function fixFlowSeqItems(fc) {
25600
25618
  if (fc.start.type === 'flow-seq-start') {
25601
25619
  for (const it of fc.items) {
@@ -25608,12 +25626,12 @@ function fixFlowSeqItems(fc) {
25608
25626
  delete it.key;
25609
25627
  if (isFlowToken(it.value)) {
25610
25628
  if (it.value.end)
25611
- Array.prototype.push.apply(it.value.end, it.sep);
25629
+ arrayPushArray(it.value.end, it.sep);
25612
25630
  else
25613
25631
  it.value.end = it.sep;
25614
25632
  }
25615
25633
  else
25616
- Array.prototype.push.apply(it.start, it.sep);
25634
+ arrayPushArray(it.start, it.sep);
25617
25635
  delete it.sep;
25618
25636
  }
25619
25637
  }
@@ -26031,7 +26049,7 @@ class Parser {
26031
26049
  const prev = map.items[map.items.length - 2];
26032
26050
  const end = prev?.value?.end;
26033
26051
  if (Array.isArray(end)) {
26034
- Array.prototype.push.apply(end, it.start);
26052
+ arrayPushArray(end, it.start);
26035
26053
  end.push(this.sourceToken);
26036
26054
  map.items.pop();
26037
26055
  return;
@@ -26246,7 +26264,7 @@ class Parser {
26246
26264
  const prev = seq.items[seq.items.length - 2];
26247
26265
  const end = prev?.value?.end;
26248
26266
  if (Array.isArray(end)) {
26249
- Array.prototype.push.apply(end, it.start);
26267
+ arrayPushArray(end, it.start);
26250
26268
  end.push(this.sourceToken);
26251
26269
  seq.items.pop();
26252
26270
  return;
@@ -27482,18 +27500,18 @@ const isMergeKey = (ctx, key) => (merge.identify(key) ||
27482
27500
  merge.identify(key.value))) &&
27483
27501
  ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
27484
27502
  function addMergeToJSMap(ctx, map, value) {
27485
- value = ctx && (0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isAlias)(value) ? value.resolve(ctx.doc) : value;
27486
- if ((0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isSeq)(value))
27487
- for (const it of value.items)
27503
+ const source = resolveAliasValue(ctx, value);
27504
+ if ((0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isSeq)(source))
27505
+ for (const it of source.items)
27488
27506
  mergeValue(ctx, map, it);
27489
- else if (Array.isArray(value))
27490
- for (const it of value)
27507
+ else if (Array.isArray(source))
27508
+ for (const it of source)
27491
27509
  mergeValue(ctx, map, it);
27492
27510
  else
27493
- mergeValue(ctx, map, value);
27511
+ mergeValue(ctx, map, source);
27494
27512
  }
27495
27513
  function mergeValue(ctx, map, value) {
27496
- const source = ctx && (0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isAlias)(value) ? value.resolve(ctx.doc) : value;
27514
+ const source = resolveAliasValue(ctx, value);
27497
27515
  if (!(0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isMap)(source))
27498
27516
  throw new Error('Merge sources must be maps or map aliases');
27499
27517
  const srcMap = source.toJSON(null, ctx, Map);
@@ -27516,6 +27534,9 @@ function mergeValue(ctx, map, value) {
27516
27534
  }
27517
27535
  return map;
27518
27536
  }
27537
+ function resolveAliasValue(ctx, value) {
27538
+ return ctx && (0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isAlias)(value) ? value.resolve(ctx.doc, ctx) : value;
27539
+ }
27519
27540
 
27520
27541
 
27521
27542
 
@@ -28626,7 +28647,8 @@ function stringifyNumber({ format, minFractionDigits, tag, value }) {
28626
28647
  if (!format &&
28627
28648
  minFractionDigits &&
28628
28649
  (!tag || tag === 'tag:yaml.org,2002:float') &&
28629
- /^\d/.test(n)) {
28650
+ /^-?\d/.test(n) &&
28651
+ !n.includes('e')) {
28630
28652
  let i = n.indexOf('.');
28631
28653
  if (i < 0) {
28632
28654
  i = n.length;