@speclynx/apidom-parser-adapter-yaml-1-2 4.2.0 → 4.3.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.3.1](https://github.com/speclynx/apidom/compare/v4.3.0...v4.3.1) (2026-04-08)
7
+
8
+ **Note:** Version bump only for package @speclynx/apidom-parser-adapter-yaml-1-2
9
+
10
+ # [4.3.0](https://github.com/speclynx/apidom/compare/v4.2.0...v4.3.0) (2026-04-07)
11
+
12
+ **Note:** Version bump only for package @speclynx/apidom-parser-adapter-yaml-1-2
13
+
6
14
  # [4.2.0](https://github.com/speclynx/apidom/compare/v4.1.0...v4.2.0) (2026-03-17)
7
15
 
8
16
  **Note:** Version bump only for package @speclynx/apidom-parser-adapter-yaml-1-2
@@ -12274,19 +12274,26 @@ function composeNode(ctx, token, props, onError) {
12274
12274
  case 'block-map':
12275
12275
  case 'block-seq':
12276
12276
  case 'flow-collection':
12277
- node = (0,_compose_collection_js__WEBPACK_IMPORTED_MODULE_2__.composeCollection)(CN, ctx, token, props, onError);
12278
- if (anchor)
12279
- node.anchor = anchor.source.substring(1);
12277
+ try {
12278
+ node = (0,_compose_collection_js__WEBPACK_IMPORTED_MODULE_2__.composeCollection)(CN, ctx, token, props, onError);
12279
+ if (anchor)
12280
+ node.anchor = anchor.source.substring(1);
12281
+ }
12282
+ catch (error) {
12283
+ // Almost certainly here due to a stack overflow
12284
+ const message = error instanceof Error ? error.message : String(error);
12285
+ onError(token, 'RESOURCE_EXHAUSTION', message);
12286
+ }
12280
12287
  break;
12281
12288
  default: {
12282
12289
  const message = token.type === 'error'
12283
12290
  ? token.message
12284
12291
  : `Unsupported token (type: ${token.type})`;
12285
12292
  onError(token, 'UNEXPECTED_TOKEN', message);
12286
- node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError);
12287
12293
  isSrcToken = false;
12288
12294
  }
12289
12295
  }
12296
+ node ?? (node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError));
12290
12297
  if (anchor && node.anchor === '')
12291
12298
  onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
12292
12299
  if (atKey &&
@@ -19805,6 +19812,7 @@ function createStringifyContext(doc, options) {
19805
19812
  nullStr: 'null',
19806
19813
  simpleKeys: false,
19807
19814
  singleQuote: null,
19815
+ trailingComma: false,
19808
19816
  trueStr: 'true',
19809
19817
  verifyAliasOrder: true
19810
19818
  }, doc.schema.toStringOptions, options);
@@ -20030,12 +20038,22 @@ function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
20030
20038
  if (comment)
20031
20039
  reqNewline = true;
20032
20040
  let str = (0,_stringify_js__WEBPACK_IMPORTED_MODULE_1__.stringify)(item, itemCtx, () => (comment = null));
20033
- if (i < items.length - 1)
20041
+ reqNewline || (reqNewline = lines.length > linesAtValue || str.includes('\n'));
20042
+ if (i < items.length - 1) {
20034
20043
  str += ',';
20044
+ }
20045
+ else if (ctx.options.trailingComma) {
20046
+ if (ctx.options.lineWidth > 0) {
20047
+ reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) +
20048
+ (str.length + 2) >
20049
+ ctx.options.lineWidth);
20050
+ }
20051
+ if (reqNewline) {
20052
+ str += ',';
20053
+ }
20054
+ }
20035
20055
  if (comment)
20036
20056
  str += (0,_stringifyComment_js__WEBPACK_IMPORTED_MODULE_2__.lineComment)(str, itemIndent, commentString(comment));
20037
- if (!reqNewline && (lines.length > linesAtValue || str.includes('\n')))
20038
- reqNewline = true;
20039
20057
  lines.push(str);
20040
20058
  linesAtValue = lines.length;
20041
20059
  }