@speclynx/apidom-parser-adapter-openapi-yaml-2 4.2.0 → 4.3.0

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,10 @@
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.3.0](https://github.com/speclynx/apidom/compare/v4.2.0...v4.3.0) (2026-04-07)
7
+
8
+ **Note:** Version bump only for package @speclynx/apidom-parser-adapter-openapi-yaml-2
9
+
6
10
  # [4.2.0](https://github.com/speclynx/apidom/compare/v4.1.0...v4.2.0) (2026-03-17)
7
11
 
8
12
  **Note:** Version bump only for package @speclynx/apidom-parser-adapter-openapi-yaml-2
@@ -21595,19 +21595,26 @@ function composeNode(ctx, token, props, onError) {
21595
21595
  case 'block-map':
21596
21596
  case 'block-seq':
21597
21597
  case 'flow-collection':
21598
- node = (0,_compose_collection_js__WEBPACK_IMPORTED_MODULE_2__.composeCollection)(CN, ctx, token, props, onError);
21599
- if (anchor)
21600
- node.anchor = anchor.source.substring(1);
21598
+ try {
21599
+ node = (0,_compose_collection_js__WEBPACK_IMPORTED_MODULE_2__.composeCollection)(CN, ctx, token, props, onError);
21600
+ if (anchor)
21601
+ node.anchor = anchor.source.substring(1);
21602
+ }
21603
+ catch (error) {
21604
+ // Almost certainly here due to a stack overflow
21605
+ const message = error instanceof Error ? error.message : String(error);
21606
+ onError(token, 'RESOURCE_EXHAUSTION', message);
21607
+ }
21601
21608
  break;
21602
21609
  default: {
21603
21610
  const message = token.type === 'error'
21604
21611
  ? token.message
21605
21612
  : `Unsupported token (type: ${token.type})`;
21606
21613
  onError(token, 'UNEXPECTED_TOKEN', message);
21607
- node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError);
21608
21614
  isSrcToken = false;
21609
21615
  }
21610
21616
  }
21617
+ node ?? (node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError));
21611
21618
  if (anchor && node.anchor === '')
21612
21619
  onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
21613
21620
  if (atKey &&
@@ -29126,6 +29133,7 @@ function createStringifyContext(doc, options) {
29126
29133
  nullStr: 'null',
29127
29134
  simpleKeys: false,
29128
29135
  singleQuote: null,
29136
+ trailingComma: false,
29129
29137
  trueStr: 'true',
29130
29138
  verifyAliasOrder: true
29131
29139
  }, doc.schema.toStringOptions, options);
@@ -29351,12 +29359,22 @@ function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
29351
29359
  if (comment)
29352
29360
  reqNewline = true;
29353
29361
  let str = (0,_stringify_js__WEBPACK_IMPORTED_MODULE_1__.stringify)(item, itemCtx, () => (comment = null));
29354
- if (i < items.length - 1)
29362
+ reqNewline || (reqNewline = lines.length > linesAtValue || str.includes('\n'));
29363
+ if (i < items.length - 1) {
29355
29364
  str += ',';
29365
+ }
29366
+ else if (ctx.options.trailingComma) {
29367
+ if (ctx.options.lineWidth > 0) {
29368
+ reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) +
29369
+ (str.length + 2) >
29370
+ ctx.options.lineWidth);
29371
+ }
29372
+ if (reqNewline) {
29373
+ str += ',';
29374
+ }
29375
+ }
29356
29376
  if (comment)
29357
29377
  str += (0,_stringifyComment_js__WEBPACK_IMPORTED_MODULE_2__.lineComment)(str, itemIndent, commentString(comment));
29358
- if (!reqNewline && (lines.length > linesAtValue || str.includes('\n')))
29359
- reqNewline = true;
29360
29378
  lines.push(str);
29361
29379
  linesAtValue = lines.length;
29362
29380
  }