@speclynx/apidom-parser-adapter-asyncapi-yaml-2 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-asyncapi-yaml-2
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-asyncapi-yaml-2
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-asyncapi-yaml-2
@@ -21908,8 +21908,10 @@ class Composer {
21908
21908
  }
21909
21909
  }
21910
21910
  if (afterDoc) {
21911
- Array.prototype.push.apply(doc.errors, this.errors);
21912
- Array.prototype.push.apply(doc.warnings, this.warnings);
21911
+ for (let i = 0; i < this.errors.length; ++i)
21912
+ doc.errors.push(this.errors[i]);
21913
+ for (let i = 0; i < this.warnings.length; ++i)
21914
+ doc.warnings.push(this.warnings[i]);
21913
21915
  }
21914
21916
  else {
21915
21917
  doc.errors = this.errors;
@@ -22871,7 +22873,7 @@ function doubleQuotedValue(source, onError) {
22871
22873
  next = source[++i + 1];
22872
22874
  }
22873
22875
  else if (next === 'x' || next === 'u' || next === 'U') {
22874
- const length = { x: 2, u: 4, U: 8 }[next];
22876
+ const length = next === 'x' ? 2 : next === 'u' ? 4 : 8;
22875
22877
  res += parseCharCode(source, i + 1, length, onError);
22876
22878
  i += length;
22877
22879
  }
@@ -22941,12 +22943,14 @@ function parseCharCode(source, offset, length, onError) {
22941
22943
  const cc = source.substr(offset, length);
22942
22944
  const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
22943
22945
  const code = ok ? parseInt(cc, 16) : NaN;
22944
- if (isNaN(code)) {
22946
+ try {
22947
+ return String.fromCodePoint(code);
22948
+ }
22949
+ catch {
22945
22950
  const raw = source.substr(offset - 2, length + 2);
22946
22951
  onError(offset - 2, 'BAD_DQ_ESCAPE', `Invalid escape sequence ${raw}`);
22947
22952
  return raw;
22948
22953
  }
22949
- return String.fromCodePoint(code);
22950
22954
  }
22951
22955
 
22952
22956
 
@@ -24259,6 +24263,8 @@ class Alias extends _Node_js__WEBPACK_IMPORTED_MODULE_3__.NodeBase {
24259
24263
  * instance of the `source` anchor before this node.
24260
24264
  */
24261
24265
  resolve(doc, ctx) {
24266
+ if (ctx?.maxAliasCount === 0)
24267
+ throw new ReferenceError('Alias resolution is disabled');
24262
24268
  let nodes;
24263
24269
  if (ctx?.aliasResolveCache) {
24264
24270
  nodes = ctx.aliasResolveCache;
@@ -26013,7 +26019,7 @@ class Lexer {
26013
26019
  const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
26014
26020
  this.indentNext = this.indentValue + 1;
26015
26021
  this.indentValue += n;
26016
- return yield* this.parseBlockStart();
26022
+ return 'block-start';
26017
26023
  }
26018
26024
  return 'doc';
26019
26025
  }
@@ -26334,32 +26340,36 @@ class Lexer {
26334
26340
  return 0;
26335
26341
  }
26336
26342
  *pushIndicators() {
26337
- switch (this.charAt(0)) {
26338
- case '!':
26339
- return ((yield* this.pushTag()) +
26340
- (yield* this.pushSpaces(true)) +
26341
- (yield* this.pushIndicators()));
26342
- case '&':
26343
- return ((yield* this.pushUntil(isNotAnchorChar)) +
26344
- (yield* this.pushSpaces(true)) +
26345
- (yield* this.pushIndicators()));
26346
- case '-': // this is an error
26347
- case '?': // this is an error outside flow collections
26348
- case ':': {
26349
- const inFlow = this.flowLevel > 0;
26350
- const ch1 = this.charAt(1);
26351
- if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
26352
- if (!inFlow)
26353
- this.indentNext = this.indentValue + 1;
26354
- else if (this.flowKey)
26355
- this.flowKey = false;
26356
- return ((yield* this.pushCount(1)) +
26357
- (yield* this.pushSpaces(true)) +
26358
- (yield* this.pushIndicators()));
26343
+ let n = 0;
26344
+ loop: while (true) {
26345
+ switch (this.charAt(0)) {
26346
+ case '!':
26347
+ n += yield* this.pushTag();
26348
+ n += yield* this.pushSpaces(true);
26349
+ continue loop;
26350
+ case '&':
26351
+ n += yield* this.pushUntil(isNotAnchorChar);
26352
+ n += yield* this.pushSpaces(true);
26353
+ continue loop;
26354
+ case '-': // this is an error
26355
+ case '?': // this is an error outside flow collections
26356
+ case ':': {
26357
+ const inFlow = this.flowLevel > 0;
26358
+ const ch1 = this.charAt(1);
26359
+ if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
26360
+ if (!inFlow)
26361
+ this.indentNext = this.indentValue + 1;
26362
+ else if (this.flowKey)
26363
+ this.flowKey = false;
26364
+ n += yield* this.pushCount(1);
26365
+ n += yield* this.pushSpaces(true);
26366
+ continue loop;
26367
+ }
26359
26368
  }
26360
26369
  }
26370
+ break loop;
26361
26371
  }
26362
- return 0;
26372
+ return n;
26363
26373
  }
26364
26374
  *pushTag() {
26365
26375
  if (this.charAt(1) === '<') {
@@ -26552,6 +26562,14 @@ function getFirstKeyStartProps(prev) {
26552
26562
  }
26553
26563
  return prev.splice(i, prev.length);
26554
26564
  }
26565
+ function arrayPushArray(target, source) {
26566
+ // May exhaust call stack with large `source` array
26567
+ if (source.length < 1e5)
26568
+ Array.prototype.push.apply(target, source);
26569
+ else
26570
+ for (let i = 0; i < source.length; ++i)
26571
+ target.push(source[i]);
26572
+ }
26555
26573
  function fixFlowSeqItems(fc) {
26556
26574
  if (fc.start.type === 'flow-seq-start') {
26557
26575
  for (const it of fc.items) {
@@ -26564,12 +26582,12 @@ function fixFlowSeqItems(fc) {
26564
26582
  delete it.key;
26565
26583
  if (isFlowToken(it.value)) {
26566
26584
  if (it.value.end)
26567
- Array.prototype.push.apply(it.value.end, it.sep);
26585
+ arrayPushArray(it.value.end, it.sep);
26568
26586
  else
26569
26587
  it.value.end = it.sep;
26570
26588
  }
26571
26589
  else
26572
- Array.prototype.push.apply(it.start, it.sep);
26590
+ arrayPushArray(it.start, it.sep);
26573
26591
  delete it.sep;
26574
26592
  }
26575
26593
  }
@@ -26987,7 +27005,7 @@ class Parser {
26987
27005
  const prev = map.items[map.items.length - 2];
26988
27006
  const end = prev?.value?.end;
26989
27007
  if (Array.isArray(end)) {
26990
- Array.prototype.push.apply(end, it.start);
27008
+ arrayPushArray(end, it.start);
26991
27009
  end.push(this.sourceToken);
26992
27010
  map.items.pop();
26993
27011
  return;
@@ -27202,7 +27220,7 @@ class Parser {
27202
27220
  const prev = seq.items[seq.items.length - 2];
27203
27221
  const end = prev?.value?.end;
27204
27222
  if (Array.isArray(end)) {
27205
- Array.prototype.push.apply(end, it.start);
27223
+ arrayPushArray(end, it.start);
27206
27224
  end.push(this.sourceToken);
27207
27225
  seq.items.pop();
27208
27226
  return;
@@ -28438,18 +28456,18 @@ const isMergeKey = (ctx, key) => (merge.identify(key) ||
28438
28456
  merge.identify(key.value))) &&
28439
28457
  ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
28440
28458
  function addMergeToJSMap(ctx, map, value) {
28441
- value = ctx && (0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isAlias)(value) ? value.resolve(ctx.doc) : value;
28442
- if ((0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isSeq)(value))
28443
- for (const it of value.items)
28459
+ const source = resolveAliasValue(ctx, value);
28460
+ if ((0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isSeq)(source))
28461
+ for (const it of source.items)
28444
28462
  mergeValue(ctx, map, it);
28445
- else if (Array.isArray(value))
28446
- for (const it of value)
28463
+ else if (Array.isArray(source))
28464
+ for (const it of source)
28447
28465
  mergeValue(ctx, map, it);
28448
28466
  else
28449
- mergeValue(ctx, map, value);
28467
+ mergeValue(ctx, map, source);
28450
28468
  }
28451
28469
  function mergeValue(ctx, map, value) {
28452
- const source = ctx && (0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isAlias)(value) ? value.resolve(ctx.doc) : value;
28470
+ const source = resolveAliasValue(ctx, value);
28453
28471
  if (!(0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isMap)(source))
28454
28472
  throw new Error('Merge sources must be maps or map aliases');
28455
28473
  const srcMap = source.toJSON(null, ctx, Map);
@@ -28472,6 +28490,9 @@ function mergeValue(ctx, map, value) {
28472
28490
  }
28473
28491
  return map;
28474
28492
  }
28493
+ function resolveAliasValue(ctx, value) {
28494
+ return ctx && (0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isAlias)(value) ? value.resolve(ctx.doc, ctx) : value;
28495
+ }
28475
28496
 
28476
28497
 
28477
28498
 
@@ -29582,7 +29603,8 @@ function stringifyNumber({ format, minFractionDigits, tag, value }) {
29582
29603
  if (!format &&
29583
29604
  minFractionDigits &&
29584
29605
  (!tag || tag === 'tag:yaml.org,2002:float') &&
29585
- /^\d/.test(n)) {
29606
+ /^-?\d/.test(n) &&
29607
+ !n.includes('e')) {
29586
29608
  let i = n.indexOf('.');
29587
29609
  if (i < 0) {
29588
29610
  i = n.length;