@speclynx/apidom-parser-adapter-json-schema-yaml-2020-12 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-json-schema-yaml-2020-12
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-json-schema-yaml-2020-12
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-json-schema-yaml-2020-12
@@ -21704,8 +21704,10 @@ class Composer {
21704
21704
  }
21705
21705
  }
21706
21706
  if (afterDoc) {
21707
- Array.prototype.push.apply(doc.errors, this.errors);
21708
- Array.prototype.push.apply(doc.warnings, this.warnings);
21707
+ for (let i = 0; i < this.errors.length; ++i)
21708
+ doc.errors.push(this.errors[i]);
21709
+ for (let i = 0; i < this.warnings.length; ++i)
21710
+ doc.warnings.push(this.warnings[i]);
21709
21711
  }
21710
21712
  else {
21711
21713
  doc.errors = this.errors;
@@ -22667,7 +22669,7 @@ function doubleQuotedValue(source, onError) {
22667
22669
  next = source[++i + 1];
22668
22670
  }
22669
22671
  else if (next === 'x' || next === 'u' || next === 'U') {
22670
- const length = { x: 2, u: 4, U: 8 }[next];
22672
+ const length = next === 'x' ? 2 : next === 'u' ? 4 : 8;
22671
22673
  res += parseCharCode(source, i + 1, length, onError);
22672
22674
  i += length;
22673
22675
  }
@@ -22737,12 +22739,14 @@ function parseCharCode(source, offset, length, onError) {
22737
22739
  const cc = source.substr(offset, length);
22738
22740
  const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
22739
22741
  const code = ok ? parseInt(cc, 16) : NaN;
22740
- if (isNaN(code)) {
22742
+ try {
22743
+ return String.fromCodePoint(code);
22744
+ }
22745
+ catch {
22741
22746
  const raw = source.substr(offset - 2, length + 2);
22742
22747
  onError(offset - 2, 'BAD_DQ_ESCAPE', `Invalid escape sequence ${raw}`);
22743
22748
  return raw;
22744
22749
  }
22745
- return String.fromCodePoint(code);
22746
22750
  }
22747
22751
 
22748
22752
 
@@ -24055,6 +24059,8 @@ class Alias extends _Node_js__WEBPACK_IMPORTED_MODULE_3__.NodeBase {
24055
24059
  * instance of the `source` anchor before this node.
24056
24060
  */
24057
24061
  resolve(doc, ctx) {
24062
+ if (ctx?.maxAliasCount === 0)
24063
+ throw new ReferenceError('Alias resolution is disabled');
24058
24064
  let nodes;
24059
24065
  if (ctx?.aliasResolveCache) {
24060
24066
  nodes = ctx.aliasResolveCache;
@@ -25809,7 +25815,7 @@ class Lexer {
25809
25815
  const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
25810
25816
  this.indentNext = this.indentValue + 1;
25811
25817
  this.indentValue += n;
25812
- return yield* this.parseBlockStart();
25818
+ return 'block-start';
25813
25819
  }
25814
25820
  return 'doc';
25815
25821
  }
@@ -26130,32 +26136,36 @@ class Lexer {
26130
26136
  return 0;
26131
26137
  }
26132
26138
  *pushIndicators() {
26133
- switch (this.charAt(0)) {
26134
- case '!':
26135
- return ((yield* this.pushTag()) +
26136
- (yield* this.pushSpaces(true)) +
26137
- (yield* this.pushIndicators()));
26138
- case '&':
26139
- return ((yield* this.pushUntil(isNotAnchorChar)) +
26140
- (yield* this.pushSpaces(true)) +
26141
- (yield* this.pushIndicators()));
26142
- case '-': // this is an error
26143
- case '?': // this is an error outside flow collections
26144
- case ':': {
26145
- const inFlow = this.flowLevel > 0;
26146
- const ch1 = this.charAt(1);
26147
- if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
26148
- if (!inFlow)
26149
- this.indentNext = this.indentValue + 1;
26150
- else if (this.flowKey)
26151
- this.flowKey = false;
26152
- return ((yield* this.pushCount(1)) +
26153
- (yield* this.pushSpaces(true)) +
26154
- (yield* this.pushIndicators()));
26139
+ let n = 0;
26140
+ loop: while (true) {
26141
+ switch (this.charAt(0)) {
26142
+ case '!':
26143
+ n += yield* this.pushTag();
26144
+ n += yield* this.pushSpaces(true);
26145
+ continue loop;
26146
+ case '&':
26147
+ n += yield* this.pushUntil(isNotAnchorChar);
26148
+ n += yield* this.pushSpaces(true);
26149
+ continue loop;
26150
+ case '-': // this is an error
26151
+ case '?': // this is an error outside flow collections
26152
+ case ':': {
26153
+ const inFlow = this.flowLevel > 0;
26154
+ const ch1 = this.charAt(1);
26155
+ if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
26156
+ if (!inFlow)
26157
+ this.indentNext = this.indentValue + 1;
26158
+ else if (this.flowKey)
26159
+ this.flowKey = false;
26160
+ n += yield* this.pushCount(1);
26161
+ n += yield* this.pushSpaces(true);
26162
+ continue loop;
26163
+ }
26155
26164
  }
26156
26165
  }
26166
+ break loop;
26157
26167
  }
26158
- return 0;
26168
+ return n;
26159
26169
  }
26160
26170
  *pushTag() {
26161
26171
  if (this.charAt(1) === '<') {
@@ -26348,6 +26358,14 @@ function getFirstKeyStartProps(prev) {
26348
26358
  }
26349
26359
  return prev.splice(i, prev.length);
26350
26360
  }
26361
+ function arrayPushArray(target, source) {
26362
+ // May exhaust call stack with large `source` array
26363
+ if (source.length < 1e5)
26364
+ Array.prototype.push.apply(target, source);
26365
+ else
26366
+ for (let i = 0; i < source.length; ++i)
26367
+ target.push(source[i]);
26368
+ }
26351
26369
  function fixFlowSeqItems(fc) {
26352
26370
  if (fc.start.type === 'flow-seq-start') {
26353
26371
  for (const it of fc.items) {
@@ -26360,12 +26378,12 @@ function fixFlowSeqItems(fc) {
26360
26378
  delete it.key;
26361
26379
  if (isFlowToken(it.value)) {
26362
26380
  if (it.value.end)
26363
- Array.prototype.push.apply(it.value.end, it.sep);
26381
+ arrayPushArray(it.value.end, it.sep);
26364
26382
  else
26365
26383
  it.value.end = it.sep;
26366
26384
  }
26367
26385
  else
26368
- Array.prototype.push.apply(it.start, it.sep);
26386
+ arrayPushArray(it.start, it.sep);
26369
26387
  delete it.sep;
26370
26388
  }
26371
26389
  }
@@ -26783,7 +26801,7 @@ class Parser {
26783
26801
  const prev = map.items[map.items.length - 2];
26784
26802
  const end = prev?.value?.end;
26785
26803
  if (Array.isArray(end)) {
26786
- Array.prototype.push.apply(end, it.start);
26804
+ arrayPushArray(end, it.start);
26787
26805
  end.push(this.sourceToken);
26788
26806
  map.items.pop();
26789
26807
  return;
@@ -26998,7 +27016,7 @@ class Parser {
26998
27016
  const prev = seq.items[seq.items.length - 2];
26999
27017
  const end = prev?.value?.end;
27000
27018
  if (Array.isArray(end)) {
27001
- Array.prototype.push.apply(end, it.start);
27019
+ arrayPushArray(end, it.start);
27002
27020
  end.push(this.sourceToken);
27003
27021
  seq.items.pop();
27004
27022
  return;
@@ -28234,18 +28252,18 @@ const isMergeKey = (ctx, key) => (merge.identify(key) ||
28234
28252
  merge.identify(key.value))) &&
28235
28253
  ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
28236
28254
  function addMergeToJSMap(ctx, map, value) {
28237
- value = ctx && (0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isAlias)(value) ? value.resolve(ctx.doc) : value;
28238
- if ((0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isSeq)(value))
28239
- for (const it of value.items)
28255
+ const source = resolveAliasValue(ctx, value);
28256
+ if ((0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isSeq)(source))
28257
+ for (const it of source.items)
28240
28258
  mergeValue(ctx, map, it);
28241
- else if (Array.isArray(value))
28242
- for (const it of value)
28259
+ else if (Array.isArray(source))
28260
+ for (const it of source)
28243
28261
  mergeValue(ctx, map, it);
28244
28262
  else
28245
- mergeValue(ctx, map, value);
28263
+ mergeValue(ctx, map, source);
28246
28264
  }
28247
28265
  function mergeValue(ctx, map, value) {
28248
- const source = ctx && (0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isAlias)(value) ? value.resolve(ctx.doc) : value;
28266
+ const source = resolveAliasValue(ctx, value);
28249
28267
  if (!(0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isMap)(source))
28250
28268
  throw new Error('Merge sources must be maps or map aliases');
28251
28269
  const srcMap = source.toJSON(null, ctx, Map);
@@ -28268,6 +28286,9 @@ function mergeValue(ctx, map, value) {
28268
28286
  }
28269
28287
  return map;
28270
28288
  }
28289
+ function resolveAliasValue(ctx, value) {
28290
+ return ctx && (0,_nodes_identity_js__WEBPACK_IMPORTED_MODULE_0__.isAlias)(value) ? value.resolve(ctx.doc, ctx) : value;
28291
+ }
28271
28292
 
28272
28293
 
28273
28294
 
@@ -29378,7 +29399,8 @@ function stringifyNumber({ format, minFractionDigits, tag, value }) {
29378
29399
  if (!format &&
29379
29400
  minFractionDigits &&
29380
29401
  (!tag || tag === 'tag:yaml.org,2002:float') &&
29381
- /^\d/.test(n)) {
29402
+ /^-?\d/.test(n) &&
29403
+ !n.includes('e')) {
29382
29404
  let i = n.indexOf('.');
29383
29405
  if (i < 0) {
29384
29406
  i = n.length;