@speclynx/apidom-core 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-core
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-core
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-core
@@ -16343,8 +16343,10 @@ class Composer {
16343
16343
  }
16344
16344
  }
16345
16345
  if (afterDoc) {
16346
- Array.prototype.push.apply(doc.errors, this.errors);
16347
- Array.prototype.push.apply(doc.warnings, this.warnings);
16346
+ for (let i = 0; i < this.errors.length; ++i)
16347
+ doc.errors.push(this.errors[i]);
16348
+ for (let i = 0; i < this.warnings.length; ++i)
16349
+ doc.warnings.push(this.warnings[i]);
16348
16350
  }
16349
16351
  else {
16350
16352
  doc.errors = this.errors;
@@ -17300,7 +17302,7 @@ function doubleQuotedValue(source, onError) {
17300
17302
  next = source[++i + 1];
17301
17303
  }
17302
17304
  else if (next === 'x' || next === 'u' || next === 'U') {
17303
- const length = { x: 2, u: 4, U: 8 }[next];
17305
+ const length = next === 'x' ? 2 : next === 'u' ? 4 : 8;
17304
17306
  res += parseCharCode(source, i + 1, length, onError);
17305
17307
  i += length;
17306
17308
  }
@@ -17370,12 +17372,14 @@ function parseCharCode(source, offset, length, onError) {
17370
17372
  const cc = source.substr(offset, length);
17371
17373
  const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
17372
17374
  const code = ok ? parseInt(cc, 16) : NaN;
17373
- if (isNaN(code)) {
17375
+ try {
17376
+ return String.fromCodePoint(code);
17377
+ }
17378
+ catch {
17374
17379
  const raw = source.substr(offset - 2, length + 2);
17375
17380
  onError(offset - 2, 'BAD_DQ_ESCAPE', `Invalid escape sequence ${raw}`);
17376
17381
  return raw;
17377
17382
  }
17378
- return String.fromCodePoint(code);
17379
17383
  }
17380
17384
 
17381
17385
 
@@ -18674,6 +18678,8 @@ class Alias extends _Node_js__WEBPACK_IMPORTED_MODULE_3__.NodeBase {
18674
18678
  * instance of the `source` anchor before this node.
18675
18679
  */
18676
18680
  resolve(doc, ctx) {
18681
+ if (ctx?.maxAliasCount === 0)
18682
+ throw new ReferenceError('Alias resolution is disabled');
18677
18683
  let nodes;
18678
18684
  if (ctx?.aliasResolveCache) {
18679
18685
  nodes = ctx.aliasResolveCache;
@@ -20414,7 +20420,7 @@ class Lexer {
20414
20420
  const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
20415
20421
  this.indentNext = this.indentValue + 1;
20416
20422
  this.indentValue += n;
20417
- return yield* this.parseBlockStart();
20423
+ return 'block-start';
20418
20424
  }
20419
20425
  return 'doc';
20420
20426
  }
@@ -20735,32 +20741,36 @@ class Lexer {
20735
20741
  return 0;
20736
20742
  }
20737
20743
  *pushIndicators() {
20738
- switch (this.charAt(0)) {
20739
- case '!':
20740
- return ((yield* this.pushTag()) +
20741
- (yield* this.pushSpaces(true)) +
20742
- (yield* this.pushIndicators()));
20743
- case '&':
20744
- return ((yield* this.pushUntil(isNotAnchorChar)) +
20745
- (yield* this.pushSpaces(true)) +
20746
- (yield* this.pushIndicators()));
20747
- case '-': // this is an error
20748
- case '?': // this is an error outside flow collections
20749
- case ':': {
20750
- const inFlow = this.flowLevel > 0;
20751
- const ch1 = this.charAt(1);
20752
- if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
20753
- if (!inFlow)
20754
- this.indentNext = this.indentValue + 1;
20755
- else if (this.flowKey)
20756
- this.flowKey = false;
20757
- return ((yield* this.pushCount(1)) +
20758
- (yield* this.pushSpaces(true)) +
20759
- (yield* this.pushIndicators()));
20744
+ let n = 0;
20745
+ loop: while (true) {
20746
+ switch (this.charAt(0)) {
20747
+ case '!':
20748
+ n += yield* this.pushTag();
20749
+ n += yield* this.pushSpaces(true);
20750
+ continue loop;
20751
+ case '&':
20752
+ n += yield* this.pushUntil(isNotAnchorChar);
20753
+ n += yield* this.pushSpaces(true);
20754
+ continue loop;
20755
+ case '-': // this is an error
20756
+ case '?': // this is an error outside flow collections
20757
+ case ':': {
20758
+ const inFlow = this.flowLevel > 0;
20759
+ const ch1 = this.charAt(1);
20760
+ if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
20761
+ if (!inFlow)
20762
+ this.indentNext = this.indentValue + 1;
20763
+ else if (this.flowKey)
20764
+ this.flowKey = false;
20765
+ n += yield* this.pushCount(1);
20766
+ n += yield* this.pushSpaces(true);
20767
+ continue loop;
20768
+ }
20760
20769
  }
20761
20770
  }
20771
+ break loop;
20762
20772
  }
20763
- return 0;
20773
+ return n;
20764
20774
  }
20765
20775
  *pushTag() {
20766
20776
  if (this.charAt(1) === '<') {
@@ -20951,6 +20961,14 @@ function getFirstKeyStartProps(prev) {
20951
20961
  }
20952
20962
  return prev.splice(i, prev.length);
20953
20963
  }
20964
+ function arrayPushArray(target, source) {
20965
+ // May exhaust call stack with large `source` array
20966
+ if (source.length < 1e5)
20967
+ Array.prototype.push.apply(target, source);
20968
+ else
20969
+ for (let i = 0; i < source.length; ++i)
20970
+ target.push(source[i]);
20971
+ }
20954
20972
  function fixFlowSeqItems(fc) {
20955
20973
  if (fc.start.type === 'flow-seq-start') {
20956
20974
  for (const it of fc.items) {
@@ -20963,12 +20981,12 @@ function fixFlowSeqItems(fc) {
20963
20981
  delete it.key;
20964
20982
  if (isFlowToken(it.value)) {
20965
20983
  if (it.value.end)
20966
- Array.prototype.push.apply(it.value.end, it.sep);
20984
+ arrayPushArray(it.value.end, it.sep);
20967
20985
  else
20968
20986
  it.value.end = it.sep;
20969
20987
  }
20970
20988
  else
20971
- Array.prototype.push.apply(it.start, it.sep);
20989
+ arrayPushArray(it.start, it.sep);
20972
20990
  delete it.sep;
20973
20991
  }
20974
20992
  }
@@ -21386,7 +21404,7 @@ class Parser {
21386
21404
  const prev = map.items[map.items.length - 2];
21387
21405
  const end = prev?.value?.end;
21388
21406
  if (Array.isArray(end)) {
21389
- Array.prototype.push.apply(end, it.start);
21407
+ arrayPushArray(end, it.start);
21390
21408
  end.push(this.sourceToken);
21391
21409
  map.items.pop();
21392
21410
  return;
@@ -21601,7 +21619,7 @@ class Parser {
21601
21619
  const prev = seq.items[seq.items.length - 2];
21602
21620
  const end = prev?.value?.end;
21603
21621
  if (Array.isArray(end)) {
21604
- Array.prototype.push.apply(end, it.start);
21622
+ arrayPushArray(end, it.start);
21605
21623
  end.push(this.sourceToken);
21606
21624
  seq.items.pop();
21607
21625
  return;
@@ -22820,18 +22838,18 @@ const isMergeKey = (ctx, key) => (merge.identify(key) ||
22820
22838
  merge.identify(key.value))) &&
22821
22839
  ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
22822
22840
  function addMergeToJSMap(ctx, map, value) {
22823
- value = ctx && (0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isAlias)(value) ? value.resolve(ctx.doc) : value;
22824
- if ((0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isSeq)(value))
22825
- for (const it of value.items)
22841
+ const source = resolveAliasValue(ctx, value);
22842
+ if ((0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isSeq)(source))
22843
+ for (const it of source.items)
22826
22844
  mergeValue(ctx, map, it);
22827
- else if (Array.isArray(value))
22828
- for (const it of value)
22845
+ else if (Array.isArray(source))
22846
+ for (const it of source)
22829
22847
  mergeValue(ctx, map, it);
22830
22848
  else
22831
- mergeValue(ctx, map, value);
22849
+ mergeValue(ctx, map, source);
22832
22850
  }
22833
22851
  function mergeValue(ctx, map, value) {
22834
- const source = ctx && (0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isAlias)(value) ? value.resolve(ctx.doc) : value;
22852
+ const source = resolveAliasValue(ctx, value);
22835
22853
  if (!(0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isMap)(source))
22836
22854
  throw new Error('Merge sources must be maps or map aliases');
22837
22855
  const srcMap = source.toJSON(null, ctx, Map);
@@ -22854,6 +22872,9 @@ function mergeValue(ctx, map, value) {
22854
22872
  }
22855
22873
  return map;
22856
22874
  }
22875
+ function resolveAliasValue(ctx, value) {
22876
+ return ctx && (0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isAlias)(value) ? value.resolve(ctx.doc, ctx) : value;
22877
+ }
22857
22878
 
22858
22879
 
22859
22880
 
@@ -23953,7 +23974,8 @@ function stringifyNumber({ format, minFractionDigits, tag, value }) {
23953
23974
  if (!format &&
23954
23975
  minFractionDigits &&
23955
23976
  (!tag || tag === 'tag:yaml.org,2002:float') &&
23956
- /^\d/.test(n)) {
23977
+ /^-?\d/.test(n) &&
23978
+ !n.includes('e')) {
23957
23979
  let i = n.indexOf('.');
23958
23980
  if (i < 0) {
23959
23981
  i = n.length;