@speclynx/apidom-parser-adapter-openapi-yaml-3-1 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-3-1
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-3-1
@@ -21848,19 +21848,26 @@ function composeNode(ctx, token, props, onError) {
21848
21848
  case 'block-map':
21849
21849
  case 'block-seq':
21850
21850
  case 'flow-collection':
21851
- node = (0,_compose_collection_js__WEBPACK_IMPORTED_MODULE_2__.composeCollection)(CN, ctx, token, props, onError);
21852
- if (anchor)
21853
- node.anchor = anchor.source.substring(1);
21851
+ try {
21852
+ node = (0,_compose_collection_js__WEBPACK_IMPORTED_MODULE_2__.composeCollection)(CN, ctx, token, props, onError);
21853
+ if (anchor)
21854
+ node.anchor = anchor.source.substring(1);
21855
+ }
21856
+ catch (error) {
21857
+ // Almost certainly here due to a stack overflow
21858
+ const message = error instanceof Error ? error.message : String(error);
21859
+ onError(token, 'RESOURCE_EXHAUSTION', message);
21860
+ }
21854
21861
  break;
21855
21862
  default: {
21856
21863
  const message = token.type === 'error'
21857
21864
  ? token.message
21858
21865
  : `Unsupported token (type: ${token.type})`;
21859
21866
  onError(token, 'UNEXPECTED_TOKEN', message);
21860
- node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError);
21861
21867
  isSrcToken = false;
21862
21868
  }
21863
21869
  }
21870
+ node ?? (node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError));
21864
21871
  if (anchor && node.anchor === '')
21865
21872
  onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
21866
21873
  if (atKey &&
@@ -29379,6 +29386,7 @@ function createStringifyContext(doc, options) {
29379
29386
  nullStr: 'null',
29380
29387
  simpleKeys: false,
29381
29388
  singleQuote: null,
29389
+ trailingComma: false,
29382
29390
  trueStr: 'true',
29383
29391
  verifyAliasOrder: true
29384
29392
  }, doc.schema.toStringOptions, options);
@@ -29604,12 +29612,22 @@ function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
29604
29612
  if (comment)
29605
29613
  reqNewline = true;
29606
29614
  let str = (0,_stringify_js__WEBPACK_IMPORTED_MODULE_1__.stringify)(item, itemCtx, () => (comment = null));
29607
- if (i < items.length - 1)
29615
+ reqNewline || (reqNewline = lines.length > linesAtValue || str.includes('\n'));
29616
+ if (i < items.length - 1) {
29608
29617
  str += ',';
29618
+ }
29619
+ else if (ctx.options.trailingComma) {
29620
+ if (ctx.options.lineWidth > 0) {
29621
+ reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) +
29622
+ (str.length + 2) >
29623
+ ctx.options.lineWidth);
29624
+ }
29625
+ if (reqNewline) {
29626
+ str += ',';
29627
+ }
29628
+ }
29609
29629
  if (comment)
29610
29630
  str += (0,_stringifyComment_js__WEBPACK_IMPORTED_MODULE_2__.lineComment)(str, itemIndent, commentString(comment));
29611
- if (!reqNewline && (lines.length > linesAtValue || str.includes('\n')))
29612
- reqNewline = true;
29613
29631
  lines.push(str);
29614
29632
  linesAtValue = lines.length;
29615
29633
  }