@speclynx/apidom-parser-adapter-openapi-yaml-3-0 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-0
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-0
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-0
@@ -21832,8 +21832,10 @@ class Composer {
21832
21832
  }
21833
21833
  }
21834
21834
  if (afterDoc) {
21835
- Array.prototype.push.apply(doc.errors, this.errors);
21836
- Array.prototype.push.apply(doc.warnings, this.warnings);
21835
+ for (let i = 0; i < this.errors.length; ++i)
21836
+ doc.errors.push(this.errors[i]);
21837
+ for (let i = 0; i < this.warnings.length; ++i)
21838
+ doc.warnings.push(this.warnings[i]);
21837
21839
  }
21838
21840
  else {
21839
21841
  doc.errors = this.errors;
@@ -22795,7 +22797,7 @@ function doubleQuotedValue(source, onError) {
22795
22797
  next = source[++i + 1];
22796
22798
  }
22797
22799
  else if (next === 'x' || next === 'u' || next === 'U') {
22798
- const length = { x: 2, u: 4, U: 8 }[next];
22800
+ const length = next === 'x' ? 2 : next === 'u' ? 4 : 8;
22799
22801
  res += parseCharCode(source, i + 1, length, onError);
22800
22802
  i += length;
22801
22803
  }
@@ -22865,12 +22867,14 @@ function parseCharCode(source, offset, length, onError) {
22865
22867
  const cc = source.substr(offset, length);
22866
22868
  const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
22867
22869
  const code = ok ? parseInt(cc, 16) : NaN;
22868
- if (isNaN(code)) {
22870
+ try {
22871
+ return String.fromCodePoint(code);
22872
+ }
22873
+ catch {
22869
22874
  const raw = source.substr(offset - 2, length + 2);
22870
22875
  onError(offset - 2, 'BAD_DQ_ESCAPE', `Invalid escape sequence ${raw}`);
22871
22876
  return raw;
22872
22877
  }
22873
- return String.fromCodePoint(code);
22874
22878
  }
22875
22879
 
22876
22880
 
@@ -24183,6 +24187,8 @@ class Alias extends _Node_js__WEBPACK_IMPORTED_MODULE_3__.NodeBase {
24183
24187
  * instance of the `source` anchor before this node.
24184
24188
  */
24185
24189
  resolve(doc, ctx) {
24190
+ if (ctx?.maxAliasCount === 0)
24191
+ throw new ReferenceError('Alias resolution is disabled');
24186
24192
  let nodes;
24187
24193
  if (ctx?.aliasResolveCache) {
24188
24194
  nodes = ctx.aliasResolveCache;
@@ -25937,7 +25943,7 @@ class Lexer {
25937
25943
  const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
25938
25944
  this.indentNext = this.indentValue + 1;
25939
25945
  this.indentValue += n;
25940
- return yield* this.parseBlockStart();
25946
+ return 'block-start';
25941
25947
  }
25942
25948
  return 'doc';
25943
25949
  }
@@ -26258,32 +26264,36 @@ class Lexer {
26258
26264
  return 0;
26259
26265
  }
26260
26266
  *pushIndicators() {
26261
- switch (this.charAt(0)) {
26262
- case '!':
26263
- return ((yield* this.pushTag()) +
26264
- (yield* this.pushSpaces(true)) +
26265
- (yield* this.pushIndicators()));
26266
- case '&':
26267
- return ((yield* this.pushUntil(isNotAnchorChar)) +
26268
- (yield* this.pushSpaces(true)) +
26269
- (yield* this.pushIndicators()));
26270
- case '-': // this is an error
26271
- case '?': // this is an error outside flow collections
26272
- case ':': {
26273
- const inFlow = this.flowLevel > 0;
26274
- const ch1 = this.charAt(1);
26275
- if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
26276
- if (!inFlow)
26277
- this.indentNext = this.indentValue + 1;
26278
- else if (this.flowKey)
26279
- this.flowKey = false;
26280
- return ((yield* this.pushCount(1)) +
26281
- (yield* this.pushSpaces(true)) +
26282
- (yield* this.pushIndicators()));
26267
+ let n = 0;
26268
+ loop: while (true) {
26269
+ switch (this.charAt(0)) {
26270
+ case '!':
26271
+ n += yield* this.pushTag();
26272
+ n += yield* this.pushSpaces(true);
26273
+ continue loop;
26274
+ case '&':
26275
+ n += yield* this.pushUntil(isNotAnchorChar);
26276
+ n += yield* this.pushSpaces(true);
26277
+ continue loop;
26278
+ case '-': // this is an error
26279
+ case '?': // this is an error outside flow collections
26280
+ case ':': {
26281
+ const inFlow = this.flowLevel > 0;
26282
+ const ch1 = this.charAt(1);
26283
+ if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
26284
+ if (!inFlow)
26285
+ this.indentNext = this.indentValue + 1;
26286
+ else if (this.flowKey)
26287
+ this.flowKey = false;
26288
+ n += yield* this.pushCount(1);
26289
+ n += yield* this.pushSpaces(true);
26290
+ continue loop;
26291
+ }
26283
26292
  }
26284
26293
  }
26294
+ break loop;
26285
26295
  }
26286
- return 0;
26296
+ return n;
26287
26297
  }
26288
26298
  *pushTag() {
26289
26299
  if (this.charAt(1) === '<') {
@@ -26476,6 +26486,14 @@ function getFirstKeyStartProps(prev) {
26476
26486
  }
26477
26487
  return prev.splice(i, prev.length);
26478
26488
  }
26489
+ function arrayPushArray(target, source) {
26490
+ // May exhaust call stack with large `source` array
26491
+ if (source.length < 1e5)
26492
+ Array.prototype.push.apply(target, source);
26493
+ else
26494
+ for (let i = 0; i < source.length; ++i)
26495
+ target.push(source[i]);
26496
+ }
26479
26497
  function fixFlowSeqItems(fc) {
26480
26498
  if (fc.start.type === 'flow-seq-start') {
26481
26499
  for (const it of fc.items) {
@@ -26488,12 +26506,12 @@ function fixFlowSeqItems(fc) {
26488
26506
  delete it.key;
26489
26507
  if (isFlowToken(it.value)) {
26490
26508
  if (it.value.end)
26491
- Array.prototype.push.apply(it.value.end, it.sep);
26509
+ arrayPushArray(it.value.end, it.sep);
26492
26510
  else
26493
26511
  it.value.end = it.sep;
26494
26512
  }
26495
26513
  else
26496
- Array.prototype.push.apply(it.start, it.sep);
26514
+ arrayPushArray(it.start, it.sep);
26497
26515
  delete it.sep;
26498
26516
  }
26499
26517
  }
@@ -26911,7 +26929,7 @@ class Parser {
26911
26929
  const prev = map.items[map.items.length - 2];
26912
26930
  const end = prev?.value?.end;
26913
26931
  if (Array.isArray(end)) {
26914
- Array.prototype.push.apply(end, it.start);
26932
+ arrayPushArray(end, it.start);
26915
26933
  end.push(this.sourceToken);
26916
26934
  map.items.pop();
26917
26935
  return;
@@ -27126,7 +27144,7 @@ class Parser {
27126
27144
  const prev = seq.items[seq.items.length - 2];
27127
27145
  const end = prev?.value?.end;
27128
27146
  if (Array.isArray(end)) {
27129
- Array.prototype.push.apply(end, it.start);
27147
+ arrayPushArray(end, it.start);
27130
27148
  end.push(this.sourceToken);
27131
27149
  seq.items.pop();
27132
27150
  return;
@@ -28362,18 +28380,18 @@ const isMergeKey = (ctx, key) => (merge.identify(key) ||
28362
28380
  merge.identify(key.value))) &&
28363
28381
  ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
28364
28382
  function addMergeToJSMap(ctx, map, value) {
28365
- value = ctx && (0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isAlias)(value) ? value.resolve(ctx.doc) : value;
28366
- if ((0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isSeq)(value))
28367
- for (const it of value.items)
28383
+ const source = resolveAliasValue(ctx, value);
28384
+ if ((0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isSeq)(source))
28385
+ for (const it of source.items)
28368
28386
  mergeValue(ctx, map, it);
28369
- else if (Array.isArray(value))
28370
- for (const it of value)
28387
+ else if (Array.isArray(source))
28388
+ for (const it of source)
28371
28389
  mergeValue(ctx, map, it);
28372
28390
  else
28373
- mergeValue(ctx, map, value);
28391
+ mergeValue(ctx, map, source);
28374
28392
  }
28375
28393
  function mergeValue(ctx, map, value) {
28376
- const source = ctx && (0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isAlias)(value) ? value.resolve(ctx.doc) : value;
28394
+ const source = resolveAliasValue(ctx, value);
28377
28395
  if (!(0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isMap)(source))
28378
28396
  throw new Error('Merge sources must be maps or map aliases');
28379
28397
  const srcMap = source.toJSON(null, ctx, Map);
@@ -28396,6 +28414,9 @@ function mergeValue(ctx, map, value) {
28396
28414
  }
28397
28415
  return map;
28398
28416
  }
28417
+ function resolveAliasValue(ctx, value) {
28418
+ return ctx && (0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isAlias)(value) ? value.resolve(ctx.doc, ctx) : value;
28419
+ }
28399
28420
 
28400
28421
 
28401
28422
 
@@ -29506,7 +29527,8 @@ function stringifyNumber({ format, minFractionDigits, tag, value }) {
29506
29527
  if (!format &&
29507
29528
  minFractionDigits &&
29508
29529
  (!tag || tag === 'tag:yaml.org,2002:float') &&
29509
- /^\d/.test(n)) {
29530
+ /^-?\d/.test(n) &&
29531
+ !n.includes('e')) {
29510
29532
  let i = n.indexOf('.');
29511
29533
  if (i < 0) {
29512
29534
  i = n.length;