@speclynx/apidom-parser-adapter-openapi-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-openapi-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-openapi-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-openapi-yaml-2
@@ -21890,8 +21890,10 @@ class Composer {
21890
21890
  }
21891
21891
  }
21892
21892
  if (afterDoc) {
21893
- Array.prototype.push.apply(doc.errors, this.errors);
21894
- Array.prototype.push.apply(doc.warnings, this.warnings);
21893
+ for (let i = 0; i < this.errors.length; ++i)
21894
+ doc.errors.push(this.errors[i]);
21895
+ for (let i = 0; i < this.warnings.length; ++i)
21896
+ doc.warnings.push(this.warnings[i]);
21895
21897
  }
21896
21898
  else {
21897
21899
  doc.errors = this.errors;
@@ -22853,7 +22855,7 @@ function doubleQuotedValue(source, onError) {
22853
22855
  next = source[++i + 1];
22854
22856
  }
22855
22857
  else if (next === 'x' || next === 'u' || next === 'U') {
22856
- const length = { x: 2, u: 4, U: 8 }[next];
22858
+ const length = next === 'x' ? 2 : next === 'u' ? 4 : 8;
22857
22859
  res += parseCharCode(source, i + 1, length, onError);
22858
22860
  i += length;
22859
22861
  }
@@ -22923,12 +22925,14 @@ function parseCharCode(source, offset, length, onError) {
22923
22925
  const cc = source.substr(offset, length);
22924
22926
  const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
22925
22927
  const code = ok ? parseInt(cc, 16) : NaN;
22926
- if (isNaN(code)) {
22928
+ try {
22929
+ return String.fromCodePoint(code);
22930
+ }
22931
+ catch {
22927
22932
  const raw = source.substr(offset - 2, length + 2);
22928
22933
  onError(offset - 2, 'BAD_DQ_ESCAPE', `Invalid escape sequence ${raw}`);
22929
22934
  return raw;
22930
22935
  }
22931
- return String.fromCodePoint(code);
22932
22936
  }
22933
22937
 
22934
22938
 
@@ -24241,6 +24245,8 @@ class Alias extends _Node_js__WEBPACK_IMPORTED_MODULE_3__.NodeBase {
24241
24245
  * instance of the `source` anchor before this node.
24242
24246
  */
24243
24247
  resolve(doc, ctx) {
24248
+ if (ctx?.maxAliasCount === 0)
24249
+ throw new ReferenceError('Alias resolution is disabled');
24244
24250
  let nodes;
24245
24251
  if (ctx?.aliasResolveCache) {
24246
24252
  nodes = ctx.aliasResolveCache;
@@ -25995,7 +26001,7 @@ class Lexer {
25995
26001
  const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
25996
26002
  this.indentNext = this.indentValue + 1;
25997
26003
  this.indentValue += n;
25998
- return yield* this.parseBlockStart();
26004
+ return 'block-start';
25999
26005
  }
26000
26006
  return 'doc';
26001
26007
  }
@@ -26316,32 +26322,36 @@ class Lexer {
26316
26322
  return 0;
26317
26323
  }
26318
26324
  *pushIndicators() {
26319
- switch (this.charAt(0)) {
26320
- case '!':
26321
- return ((yield* this.pushTag()) +
26322
- (yield* this.pushSpaces(true)) +
26323
- (yield* this.pushIndicators()));
26324
- case '&':
26325
- return ((yield* this.pushUntil(isNotAnchorChar)) +
26326
- (yield* this.pushSpaces(true)) +
26327
- (yield* this.pushIndicators()));
26328
- case '-': // this is an error
26329
- case '?': // this is an error outside flow collections
26330
- case ':': {
26331
- const inFlow = this.flowLevel > 0;
26332
- const ch1 = this.charAt(1);
26333
- if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
26334
- if (!inFlow)
26335
- this.indentNext = this.indentValue + 1;
26336
- else if (this.flowKey)
26337
- this.flowKey = false;
26338
- return ((yield* this.pushCount(1)) +
26339
- (yield* this.pushSpaces(true)) +
26340
- (yield* this.pushIndicators()));
26325
+ let n = 0;
26326
+ loop: while (true) {
26327
+ switch (this.charAt(0)) {
26328
+ case '!':
26329
+ n += yield* this.pushTag();
26330
+ n += yield* this.pushSpaces(true);
26331
+ continue loop;
26332
+ case '&':
26333
+ n += yield* this.pushUntil(isNotAnchorChar);
26334
+ n += yield* this.pushSpaces(true);
26335
+ continue loop;
26336
+ case '-': // this is an error
26337
+ case '?': // this is an error outside flow collections
26338
+ case ':': {
26339
+ const inFlow = this.flowLevel > 0;
26340
+ const ch1 = this.charAt(1);
26341
+ if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
26342
+ if (!inFlow)
26343
+ this.indentNext = this.indentValue + 1;
26344
+ else if (this.flowKey)
26345
+ this.flowKey = false;
26346
+ n += yield* this.pushCount(1);
26347
+ n += yield* this.pushSpaces(true);
26348
+ continue loop;
26349
+ }
26341
26350
  }
26342
26351
  }
26352
+ break loop;
26343
26353
  }
26344
- return 0;
26354
+ return n;
26345
26355
  }
26346
26356
  *pushTag() {
26347
26357
  if (this.charAt(1) === '<') {
@@ -26534,6 +26544,14 @@ function getFirstKeyStartProps(prev) {
26534
26544
  }
26535
26545
  return prev.splice(i, prev.length);
26536
26546
  }
26547
+ function arrayPushArray(target, source) {
26548
+ // May exhaust call stack with large `source` array
26549
+ if (source.length < 1e5)
26550
+ Array.prototype.push.apply(target, source);
26551
+ else
26552
+ for (let i = 0; i < source.length; ++i)
26553
+ target.push(source[i]);
26554
+ }
26537
26555
  function fixFlowSeqItems(fc) {
26538
26556
  if (fc.start.type === 'flow-seq-start') {
26539
26557
  for (const it of fc.items) {
@@ -26546,12 +26564,12 @@ function fixFlowSeqItems(fc) {
26546
26564
  delete it.key;
26547
26565
  if (isFlowToken(it.value)) {
26548
26566
  if (it.value.end)
26549
- Array.prototype.push.apply(it.value.end, it.sep);
26567
+ arrayPushArray(it.value.end, it.sep);
26550
26568
  else
26551
26569
  it.value.end = it.sep;
26552
26570
  }
26553
26571
  else
26554
- Array.prototype.push.apply(it.start, it.sep);
26572
+ arrayPushArray(it.start, it.sep);
26555
26573
  delete it.sep;
26556
26574
  }
26557
26575
  }
@@ -26969,7 +26987,7 @@ class Parser {
26969
26987
  const prev = map.items[map.items.length - 2];
26970
26988
  const end = prev?.value?.end;
26971
26989
  if (Array.isArray(end)) {
26972
- Array.prototype.push.apply(end, it.start);
26990
+ arrayPushArray(end, it.start);
26973
26991
  end.push(this.sourceToken);
26974
26992
  map.items.pop();
26975
26993
  return;
@@ -27184,7 +27202,7 @@ class Parser {
27184
27202
  const prev = seq.items[seq.items.length - 2];
27185
27203
  const end = prev?.value?.end;
27186
27204
  if (Array.isArray(end)) {
27187
- Array.prototype.push.apply(end, it.start);
27205
+ arrayPushArray(end, it.start);
27188
27206
  end.push(this.sourceToken);
27189
27207
  seq.items.pop();
27190
27208
  return;
@@ -28420,18 +28438,18 @@ const isMergeKey = (ctx, key) => (merge.identify(key) ||
28420
28438
  merge.identify(key.value))) &&
28421
28439
  ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
28422
28440
  function addMergeToJSMap(ctx, map, value) {
28423
- value = ctx && (0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isAlias)(value) ? value.resolve(ctx.doc) : value;
28424
- if ((0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isSeq)(value))
28425
- for (const it of value.items)
28441
+ const source = resolveAliasValue(ctx, value);
28442
+ if ((0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isSeq)(source))
28443
+ for (const it of source.items)
28426
28444
  mergeValue(ctx, map, it);
28427
- else if (Array.isArray(value))
28428
- for (const it of value)
28445
+ else if (Array.isArray(source))
28446
+ for (const it of source)
28429
28447
  mergeValue(ctx, map, it);
28430
28448
  else
28431
- mergeValue(ctx, map, value);
28449
+ mergeValue(ctx, map, source);
28432
28450
  }
28433
28451
  function mergeValue(ctx, map, value) {
28434
- const source = ctx && (0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isAlias)(value) ? value.resolve(ctx.doc) : value;
28452
+ const source = resolveAliasValue(ctx, value);
28435
28453
  if (!(0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isMap)(source))
28436
28454
  throw new Error('Merge sources must be maps or map aliases');
28437
28455
  const srcMap = source.toJSON(null, ctx, Map);
@@ -28454,6 +28472,9 @@ function mergeValue(ctx, map, value) {
28454
28472
  }
28455
28473
  return map;
28456
28474
  }
28475
+ function resolveAliasValue(ctx, value) {
28476
+ return ctx && (0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isAlias)(value) ? value.resolve(ctx.doc, ctx) : value;
28477
+ }
28457
28478
 
28458
28479
 
28459
28480
 
@@ -29564,7 +29585,8 @@ function stringifyNumber({ format, minFractionDigits, tag, value }) {
29564
29585
  if (!format &&
29565
29586
  minFractionDigits &&
29566
29587
  (!tag || tag === 'tag:yaml.org,2002:float') &&
29567
- /^\d/.test(n)) {
29588
+ /^-?\d/.test(n) &&
29589
+ !n.includes('e')) {
29568
29590
  let i = n.indexOf('.');
29569
29591
  if (i < 0) {
29570
29592
  i = n.length;