projen 0.54.58 → 0.55.2

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.
Files changed (186) hide show
  1. package/.jsii +49 -19
  2. package/changelog.md +1 -1
  3. package/docs/api/API.md +14 -1
  4. package/docs/escape-hatches.md +19 -0
  5. package/lib/awscdk/auto-discover.js +4 -4
  6. package/lib/awscdk/awscdk-app-java.js +1 -1
  7. package/lib/awscdk/awscdk-app-py.js +1 -1
  8. package/lib/awscdk/awscdk-app-ts.js +1 -1
  9. package/lib/awscdk/awscdk-construct.js +2 -2
  10. package/lib/awscdk/awscdk-deps-java.js +1 -1
  11. package/lib/awscdk/awscdk-deps-js.js +1 -1
  12. package/lib/awscdk/awscdk-deps.js +1 -1
  13. package/lib/awscdk/cdk-config.js +1 -1
  14. package/lib/awscdk/cdk-tasks.js +1 -1
  15. package/lib/awscdk/integration-test.js +1 -1
  16. package/lib/awscdk/lambda-extension.js +1 -1
  17. package/lib/awscdk/lambda-function.js +2 -2
  18. package/lib/build/build-workflow.js +1 -1
  19. package/lib/cdk/auto-discover-base.js +2 -2
  20. package/lib/cdk/construct-lib.js +1 -1
  21. package/lib/cdk/integration-test-base.js +1 -1
  22. package/lib/cdk/jsii-docgen.js +1 -1
  23. package/lib/cdk/jsii-project.js +1 -1
  24. package/lib/cdk8s/auto-discover.js +2 -2
  25. package/lib/cdk8s/cdk8s-app-ts.js +1 -1
  26. package/lib/cdk8s/cdk8s-construct.js +1 -1
  27. package/lib/cdk8s/integration-test.js +1 -1
  28. package/lib/cdktf/cdktf-construct.js +1 -1
  29. package/lib/component.js +1 -1
  30. package/lib/dependencies.js +1 -1
  31. package/lib/dev-env.js +1 -1
  32. package/lib/docker-compose.js +2 -2
  33. package/lib/file.js +1 -1
  34. package/lib/gitattributes.js +1 -1
  35. package/lib/github/auto-approve.js +1 -1
  36. package/lib/github/auto-merge.js +1 -1
  37. package/lib/github/dependabot.js +1 -1
  38. package/lib/github/github-credentials.js +1 -1
  39. package/lib/github/github-project.js +1 -1
  40. package/lib/github/github.js +1 -1
  41. package/lib/github/mergify.js +1 -1
  42. package/lib/github/pr-template.js +1 -1
  43. package/lib/github/pull-request-lint.js +1 -1
  44. package/lib/github/stale.js +1 -1
  45. package/lib/github/task-workflow.js +1 -1
  46. package/lib/github/workflows.js +1 -1
  47. package/lib/gitlab/configuration.js +1 -1
  48. package/lib/gitlab/gitlab-configuration.js +1 -1
  49. package/lib/gitlab/nested-configuration.js +1 -1
  50. package/lib/gitpod.js +1 -1
  51. package/lib/ignore-file.js +1 -1
  52. package/lib/ini.js +1 -1
  53. package/lib/java/java-project.js +1 -1
  54. package/lib/java/junit.js +1 -1
  55. package/lib/java/maven-compile.js +1 -1
  56. package/lib/java/maven-packaging.js +1 -1
  57. package/lib/java/maven-sample.js +1 -1
  58. package/lib/java/pom.js +1 -1
  59. package/lib/java/projenrc.js +1 -1
  60. package/lib/javascript/bundler.js +1 -1
  61. package/lib/javascript/eslint.js +1 -1
  62. package/lib/javascript/jest.js +1 -1
  63. package/lib/javascript/node-package.js +1 -1
  64. package/lib/javascript/node-project.js +1 -1
  65. package/lib/javascript/npm-config.js +1 -1
  66. package/lib/javascript/prettier.js +1 -1
  67. package/lib/javascript/projenrc.js +1 -1
  68. package/lib/javascript/typescript-config.js +1 -1
  69. package/lib/javascript/upgrade-dependencies.js +2 -2
  70. package/lib/json.js +1 -1
  71. package/lib/license.js +1 -1
  72. package/lib/logger.js +1 -1
  73. package/lib/makefile.js +1 -1
  74. package/lib/object-file.js +1 -1
  75. package/lib/project-build.js +1 -1
  76. package/lib/project.d.ts +10 -0
  77. package/lib/project.js +28 -2
  78. package/lib/projects.js +1 -1
  79. package/lib/projenrc-json.js +1 -1
  80. package/lib/python/pip.js +1 -1
  81. package/lib/python/poetry.js +2 -2
  82. package/lib/python/projenrc.js +1 -1
  83. package/lib/python/pytest-sample.js +1 -1
  84. package/lib/python/pytest.js +1 -1
  85. package/lib/python/python-project.js +1 -1
  86. package/lib/python/python-sample.js +1 -1
  87. package/lib/python/requirements-file.js +1 -1
  88. package/lib/python/setuppy.js +1 -1
  89. package/lib/python/setuptools.js +1 -1
  90. package/lib/python/venv.js +1 -1
  91. package/lib/readme.js +1 -1
  92. package/lib/release/publisher.js +1 -1
  93. package/lib/release/release-trigger.js +1 -1
  94. package/lib/release/release.js +1 -1
  95. package/lib/sample-file.js +2 -2
  96. package/lib/semver.js +1 -1
  97. package/lib/source-code.js +1 -1
  98. package/lib/task-runtime.js +1 -1
  99. package/lib/task.js +1 -1
  100. package/lib/tasks.js +1 -1
  101. package/lib/testing.js +1 -1
  102. package/lib/textfile.js +1 -1
  103. package/lib/toml.js +1 -1
  104. package/lib/typescript/projenrc.js +1 -1
  105. package/lib/typescript/typescript-typedoc.js +1 -1
  106. package/lib/typescript/typescript.js +5 -5
  107. package/lib/util.d.ts +1 -1
  108. package/lib/version.js +1 -1
  109. package/lib/vscode/devcontainer.js +1 -1
  110. package/lib/vscode/launch-config.js +1 -1
  111. package/lib/vscode/vscode.js +1 -1
  112. package/lib/web/next.js +3 -3
  113. package/lib/web/postcss.js +1 -1
  114. package/lib/web/react.js +4 -4
  115. package/lib/web/tailwind.js +1 -1
  116. package/lib/xmlfile.js +1 -1
  117. package/lib/yaml.js +1 -1
  118. package/node_modules/yaml/README.md +1 -1
  119. package/node_modules/yaml/browser/dist/compose/compose-doc.js +1 -1
  120. package/node_modules/yaml/browser/dist/compose/compose-scalar.js +4 -4
  121. package/node_modules/yaml/browser/dist/compose/composer.js +1 -0
  122. package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +7 -6
  123. package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +3 -1
  124. package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +4 -3
  125. package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +2 -1
  126. package/node_modules/yaml/browser/dist/compose/resolve-props.js +5 -1
  127. package/node_modules/yaml/browser/dist/doc/Document.js +9 -5
  128. package/node_modules/yaml/browser/dist/doc/anchors.js +2 -2
  129. package/node_modules/yaml/browser/dist/doc/createNode.js +7 -4
  130. package/node_modules/yaml/browser/dist/nodes/Pair.js +2 -2
  131. package/node_modules/yaml/browser/dist/nodes/Scalar.js +1 -1
  132. package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +5 -4
  133. package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +1 -1
  134. package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +1 -1
  135. package/node_modules/yaml/browser/dist/nodes/toJS.js +3 -1
  136. package/node_modules/yaml/browser/dist/parse/cst-visit.js +2 -2
  137. package/node_modules/yaml/browser/dist/parse/lexer.js +2 -1
  138. package/node_modules/yaml/browser/dist/parse/parser.js +64 -26
  139. package/node_modules/yaml/browser/dist/public-api.js +2 -1
  140. package/node_modules/yaml/browser/dist/schema/Schema.js +6 -2
  141. package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +1 -1
  142. package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +2 -1
  143. package/node_modules/yaml/browser/dist/stringify/stringify.js +8 -8
  144. package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +5 -3
  145. package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +4 -1
  146. package/node_modules/yaml/browser/dist/stringify/stringifyString.js +2 -2
  147. package/node_modules/yaml/dist/compose/compose-doc.js +1 -1
  148. package/node_modules/yaml/dist/compose/compose-scalar.js +4 -4
  149. package/node_modules/yaml/dist/compose/composer.js +1 -0
  150. package/node_modules/yaml/dist/compose/resolve-block-map.js +7 -6
  151. package/node_modules/yaml/dist/compose/resolve-block-scalar.js +3 -1
  152. package/node_modules/yaml/dist/compose/resolve-flow-collection.js +4 -3
  153. package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +2 -1
  154. package/node_modules/yaml/dist/compose/resolve-props.d.ts +2 -1
  155. package/node_modules/yaml/dist/compose/resolve-props.js +5 -1
  156. package/node_modules/yaml/dist/doc/Document.d.ts +1 -1
  157. package/node_modules/yaml/dist/doc/Document.js +9 -5
  158. package/node_modules/yaml/dist/doc/anchors.d.ts +2 -2
  159. package/node_modules/yaml/dist/doc/anchors.js +2 -2
  160. package/node_modules/yaml/dist/doc/createNode.d.ts +1 -1
  161. package/node_modules/yaml/dist/doc/createNode.js +7 -4
  162. package/node_modules/yaml/dist/doc/directives.d.ts +1 -1
  163. package/node_modules/yaml/dist/nodes/Pair.js +2 -2
  164. package/node_modules/yaml/dist/nodes/Scalar.js +1 -1
  165. package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +3 -1
  166. package/node_modules/yaml/dist/nodes/YAMLMap.js +5 -4
  167. package/node_modules/yaml/dist/nodes/YAMLSeq.js +1 -1
  168. package/node_modules/yaml/dist/nodes/addPairToJSMap.js +1 -1
  169. package/node_modules/yaml/dist/nodes/toJS.js +3 -1
  170. package/node_modules/yaml/dist/options.d.ts +1 -1
  171. package/node_modules/yaml/dist/parse/cst-visit.js +2 -2
  172. package/node_modules/yaml/dist/parse/lexer.js +2 -1
  173. package/node_modules/yaml/dist/parse/parser.js +64 -26
  174. package/node_modules/yaml/dist/public-api.js +2 -1
  175. package/node_modules/yaml/dist/schema/Schema.js +6 -2
  176. package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +1 -1
  177. package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +2 -1
  178. package/node_modules/yaml/dist/stringify/stringify.js +8 -8
  179. package/node_modules/yaml/dist/stringify/stringifyComment.js +5 -3
  180. package/node_modules/yaml/dist/stringify/stringifyPair.js +4 -1
  181. package/node_modules/yaml/dist/stringify/stringifyString.js +2 -2
  182. package/node_modules/yaml/dist/test-events.js +1 -1
  183. package/node_modules/yaml/package.json +2 -2
  184. package/package.json +5 -5
  185. package/releasetag.txt +1 -1
  186. package/version.txt +1 -1
@@ -9,7 +9,7 @@ function includesToken(list, type) {
9
9
  return true;
10
10
  return false;
11
11
  }
12
- function includesNonEmpty(list) {
12
+ function findNonEmptyIndex(list) {
13
13
  for (let i = 0; i < list.length; ++i) {
14
14
  switch (list[i].type) {
15
15
  case 'space':
@@ -17,10 +17,10 @@ function includesNonEmpty(list) {
17
17
  case 'newline':
18
18
  break;
19
19
  default:
20
- return true;
20
+ return i;
21
21
  }
22
22
  }
23
- return false;
23
+ return -1;
24
24
  }
25
25
  function isFlowToken(token) {
26
26
  switch (token === null || token === void 0 ? void 0 : token.type) {
@@ -35,12 +35,13 @@ function isFlowToken(token) {
35
35
  }
36
36
  }
37
37
  function getPrevProps(parent) {
38
+ var _a;
38
39
  switch (parent.type) {
39
40
  case 'document':
40
41
  return parent.start;
41
42
  case 'block-map': {
42
43
  const it = parent.items[parent.items.length - 1];
43
- return it.sep || it.start;
44
+ return (_a = it.sep) !== null && _a !== void 0 ? _a : it.start;
44
45
  }
45
46
  case 'block-seq':
46
47
  return parent.items[parent.items.length - 1].start;
@@ -269,7 +270,7 @@ class Parser {
269
270
  return this.stack[this.stack.length - n];
270
271
  }
271
272
  *pop(error) {
272
- const token = error || this.stack.pop();
273
+ const token = error !== null && error !== void 0 ? error : this.stack.pop();
273
274
  /* istanbul ignore if should not happen */
274
275
  if (!token) {
275
276
  const message = 'Tried to pop an empty stack';
@@ -346,7 +347,7 @@ class Parser {
346
347
  !last.sep &&
347
348
  !last.value &&
348
349
  last.start.length > 0 &&
349
- !includesNonEmpty(last.start) &&
350
+ findNonEmptyIndex(last.start) === -1 &&
350
351
  (token.indent === 0 ||
351
352
  last.start.every(st => st.type !== 'comment' || st.indent < token.indent))) {
352
353
  if (top.type === 'document')
@@ -394,7 +395,7 @@ class Parser {
394
395
  return yield* this.lineEnd(doc);
395
396
  switch (this.type) {
396
397
  case 'doc-start': {
397
- if (includesNonEmpty(doc.start)) {
398
+ if (findNonEmptyIndex(doc.start) !== -1) {
398
399
  yield* this.pop();
399
400
  yield* this.step();
400
401
  }
@@ -488,17 +489,21 @@ class Parser {
488
489
  else
489
490
  map.items.push({ start: [this.sourceToken] });
490
491
  }
491
- else if (it.sep)
492
+ else if (it.sep) {
492
493
  it.sep.push(this.sourceToken);
493
- else
494
+ }
495
+ else {
494
496
  it.start.push(this.sourceToken);
497
+ }
495
498
  return;
496
499
  case 'space':
497
500
  case 'comment':
498
- if (it.value)
501
+ if (it.value) {
499
502
  map.items.push({ start: [this.sourceToken] });
500
- else if (it.sep)
503
+ }
504
+ else if (it.sep) {
501
505
  it.sep.push(this.sourceToken);
506
+ }
502
507
  else {
503
508
  if (this.atIndentedComment(it.start, map.indent)) {
504
509
  const prev = map.items[map.items.length - 2];
@@ -515,33 +520,61 @@ class Parser {
515
520
  return;
516
521
  }
517
522
  if (this.indent >= map.indent) {
518
- const atNextItem = !this.onKeyLine &&
519
- this.indent === map.indent &&
520
- (it.sep || includesNonEmpty(it.start));
523
+ const atNextItem = !this.onKeyLine && this.indent === map.indent && it.sep;
524
+ // For empty nodes, assign newline-separated not indented empty tokens to following node
525
+ let start = [];
526
+ if (atNextItem && it.sep && !it.value) {
527
+ const nl = [];
528
+ for (let i = 0; i < it.sep.length; ++i) {
529
+ const st = it.sep[i];
530
+ switch (st.type) {
531
+ case 'newline':
532
+ nl.push(i);
533
+ break;
534
+ case 'space':
535
+ break;
536
+ case 'comment':
537
+ if (st.indent > map.indent)
538
+ nl.length = 0;
539
+ break;
540
+ default:
541
+ nl.length = 0;
542
+ }
543
+ }
544
+ if (nl.length >= 2)
545
+ start = it.sep.splice(nl[1]);
546
+ }
521
547
  switch (this.type) {
522
548
  case 'anchor':
523
549
  case 'tag':
524
550
  if (atNextItem || it.value) {
525
- map.items.push({ start: [this.sourceToken] });
551
+ start.push(this.sourceToken);
552
+ map.items.push({ start });
526
553
  this.onKeyLine = true;
527
554
  }
528
- else if (it.sep)
555
+ else if (it.sep) {
529
556
  it.sep.push(this.sourceToken);
530
- else
557
+ }
558
+ else {
531
559
  it.start.push(this.sourceToken);
560
+ }
532
561
  return;
533
562
  case 'explicit-key-ind':
534
- if (!it.sep && !includesToken(it.start, 'explicit-key-ind'))
563
+ if (!it.sep && !includesToken(it.start, 'explicit-key-ind')) {
535
564
  it.start.push(this.sourceToken);
536
- else if (atNextItem || it.value)
537
- map.items.push({ start: [this.sourceToken] });
538
- else
565
+ }
566
+ else if (atNextItem || it.value) {
567
+ start.push(this.sourceToken);
568
+ map.items.push({ start });
569
+ }
570
+ else {
539
571
  this.stack.push({
540
572
  type: 'block-map',
541
573
  offset: this.offset,
542
574
  indent: this.indent,
543
575
  items: [{ start: [this.sourceToken] }]
544
576
  });
577
+ }
545
578
  this.onKeyLine = true;
546
579
  return;
547
580
  case 'map-value-ind':
@@ -568,7 +601,7 @@ class Parser {
568
601
  type: 'block-map',
569
602
  offset: this.offset,
570
603
  indent: this.indent,
571
- items: [{ start: [], key: null, sep: [this.sourceToken] }]
604
+ items: [{ start, key: null, sep: [this.sourceToken] }]
572
605
  });
573
606
  }
574
607
  else if (isFlowToken(it.key) &&
@@ -586,6 +619,10 @@ class Parser {
586
619
  items: [{ start, key, sep }]
587
620
  });
588
621
  }
622
+ else if (start.length > 0) {
623
+ // Not actually at next item
624
+ it.sep = it.sep.concat(start, this.sourceToken);
625
+ }
589
626
  else {
590
627
  it.sep.push(this.sourceToken);
591
628
  }
@@ -595,7 +632,7 @@ class Parser {
595
632
  Object.assign(it, { key: null, sep: [this.sourceToken] });
596
633
  }
597
634
  else if (it.value || atNextItem) {
598
- map.items.push({ start: [], key: null, sep: [this.sourceToken] });
635
+ map.items.push({ start, key: null, sep: [this.sourceToken] });
599
636
  }
600
637
  else if (includesToken(it.sep, 'map-value-ind')) {
601
638
  this.stack.push({
@@ -617,7 +654,7 @@ class Parser {
617
654
  case 'double-quoted-scalar': {
618
655
  const fs = this.flowScalar(this.type);
619
656
  if (atNextItem || it.value) {
620
- map.items.push({ start: [], key: fs, sep: [] });
657
+ map.items.push({ start, key: fs, sep: [] });
621
658
  this.onKeyLine = true;
622
659
  }
623
660
  else if (it.sep) {
@@ -634,8 +671,9 @@ class Parser {
634
671
  if (bv) {
635
672
  if (atNextItem &&
636
673
  bv.type !== 'block-seq' &&
637
- includesToken(it.start, 'explicit-key-ind'))
638
- map.items.push({ start: [] });
674
+ includesToken(it.start, 'explicit-key-ind')) {
675
+ map.items.push({ start });
676
+ }
639
677
  this.stack.push(bv);
640
678
  return;
641
679
  }
@@ -77,6 +77,7 @@ function parse(src, reviver, options) {
77
77
  return doc.toJS(Object.assign({ reviver: _reviver }, options));
78
78
  }
79
79
  function stringify(value, replacer, options) {
80
+ var _a;
80
81
  let _replacer = null;
81
82
  if (typeof replacer === 'function' || Array.isArray(replacer)) {
82
83
  _replacer = replacer;
@@ -91,7 +92,7 @@ function stringify(value, replacer, options) {
91
92
  options = indent < 1 ? undefined : indent > 8 ? { indent: 8 } : { indent };
92
93
  }
93
94
  if (value === undefined) {
94
- const { keepUndefined } = options || replacer || {};
95
+ const { keepUndefined } = (_a = options !== null && options !== void 0 ? options : replacer) !== null && _a !== void 0 ? _a : {};
95
96
  if (!keepUndefined)
96
97
  return undefined;
97
98
  }
@@ -18,13 +18,17 @@ class Schema {
18
18
  this.name = (typeof schema === 'string' && schema) || 'core';
19
19
  this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};
20
20
  this.tags = tags.getTags(customTags, this.name);
21
- this.toStringOptions = toStringDefaults || null;
21
+ this.toStringOptions = toStringDefaults !== null && toStringDefaults !== void 0 ? toStringDefaults : null;
22
22
  Object.defineProperty(this, Node.MAP, { value: map.map });
23
23
  Object.defineProperty(this, Node.SCALAR, { value: string.string });
24
24
  Object.defineProperty(this, Node.SEQ, { value: seq.seq });
25
25
  // Used by createMap()
26
26
  this.sortMapEntries =
27
- sortMapEntries === true ? sortMapEntriesByKey : sortMapEntries || null;
27
+ typeof sortMapEntries === 'function'
28
+ ? sortMapEntries
29
+ : sortMapEntries === true
30
+ ? sortMapEntriesByKey
31
+ : null;
28
32
  }
29
33
  clone() {
30
34
  const copy = Object.create(Schema.prototype, Object.getOwnPropertyDescriptors(this));
@@ -24,7 +24,7 @@ class YAMLOMap extends YAMLSeq.YAMLSeq {
24
24
  if (!ctx)
25
25
  return super.toJSON(_);
26
26
  const map = new Map();
27
- if (ctx && ctx.onCreate)
27
+ if (ctx === null || ctx === void 0 ? void 0 : ctx.onCreate)
28
28
  ctx.onCreate(map);
29
29
  for (const pair of this.items) {
30
30
  let key, value;
@@ -6,6 +6,7 @@ var Scalar = require('../../nodes/Scalar.js');
6
6
  var YAMLSeq = require('../../nodes/YAMLSeq.js');
7
7
 
8
8
  function resolvePairs(seq, onError) {
9
+ var _a;
9
10
  if (Node.isSeq(seq)) {
10
11
  for (let i = 0; i < seq.items.length; ++i) {
11
12
  let item = seq.items[i];
@@ -20,7 +21,7 @@ function resolvePairs(seq, onError) {
20
21
  ? `${item.commentBefore}\n${pair.key.commentBefore}`
21
22
  : item.commentBefore;
22
23
  if (item.comment) {
23
- const cn = pair.value || pair.key;
24
+ const cn = (_a = pair.value) !== null && _a !== void 0 ? _a : pair.key;
24
25
  cn.comment = cn.comment
25
26
  ? `${item.comment}\n${cn.comment}`
26
27
  : item.comment;
@@ -45,26 +45,26 @@ function createStringifyContext(doc, options) {
45
45
  };
46
46
  }
47
47
  function getTagObject(tags, item) {
48
+ var _a, _b, _c, _d;
48
49
  if (item.tag) {
49
50
  const match = tags.filter(t => t.tag === item.tag);
50
51
  if (match.length > 0)
51
- return match.find(t => t.format === item.format) || match[0];
52
+ return (_a = match.find(t => t.format === item.format)) !== null && _a !== void 0 ? _a : match[0];
52
53
  }
53
54
  let tagObj = undefined;
54
55
  let obj;
55
56
  if (Node.isScalar(item)) {
56
57
  obj = item.value;
57
- const match = tags.filter(t => t.identify && t.identify(obj));
58
+ const match = tags.filter(t => { var _a; return (_a = t.identify) === null || _a === void 0 ? void 0 : _a.call(t, obj); });
58
59
  tagObj =
59
- match.find(t => t.format === item.format) || match.find(t => !t.format);
60
+ (_b = match.find(t => t.format === item.format)) !== null && _b !== void 0 ? _b : match.find(t => !t.format);
60
61
  }
61
62
  else {
62
63
  obj = item;
63
64
  tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
64
65
  }
65
66
  if (!tagObj) {
66
- // @ts-ignore
67
- const name = obj && obj.constructor ? obj.constructor.name : typeof obj;
67
+ const name = (_d = (_c = obj === null || obj === void 0 ? void 0 : obj.constructor) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : typeof obj;
68
68
  throw new Error(`Tag not resolved for ${name} value`);
69
69
  }
70
70
  return tagObj;
@@ -79,13 +79,13 @@ function stringifyProps(node, tagObj, { anchors: anchors$1, doc }) {
79
79
  anchors$1.add(anchor);
80
80
  props.push(`&${anchor}`);
81
81
  }
82
- const tag = node.tag || (tagObj.default ? null : tagObj.tag);
82
+ const tag = node.tag ? node.tag : tagObj.default ? null : tagObj.tag;
83
83
  if (tag)
84
84
  props.push(doc.directives.tagString(tag));
85
85
  return props.join(' ');
86
86
  }
87
87
  function stringify(item, ctx, onComment, onChompKeep) {
88
- var _a;
88
+ var _a, _b;
89
89
  if (Node.isPair(item))
90
90
  return item.toString(ctx, onComment, onChompKeep);
91
91
  if (Node.isAlias(item)) {
@@ -110,7 +110,7 @@ function stringify(item, ctx, onComment, onChompKeep) {
110
110
  tagObj = getTagObject(ctx.doc.schema.tags, node);
111
111
  const props = stringifyProps(node, tagObj, ctx);
112
112
  if (props.length > 0)
113
- ctx.indentAtStart = (ctx.indentAtStart || 0) + props.length + 1;
113
+ ctx.indentAtStart = ((_b = ctx.indentAtStart) !== null && _b !== void 0 ? _b : 0) + props.length + 1;
114
114
  const str = typeof tagObj.stringify === 'function'
115
115
  ? tagObj.stringify(node, ctx, onComment, onChompKeep)
116
116
  : Node.isScalar(node)
@@ -13,9 +13,11 @@ function indentComment(comment, indent) {
13
13
  return comment.substring(1);
14
14
  return indent ? comment.replace(/^(?! *$)/gm, indent) : comment;
15
15
  }
16
- const lineComment = (str, indent, comment) => comment.includes('\n')
17
- ? '\n' + indentComment(comment, indent)
18
- : (str.endsWith(' ') ? '' : ' ') + comment;
16
+ const lineComment = (str, indent, comment) => str.endsWith('\n')
17
+ ? indentComment(comment, indent)
18
+ : comment.includes('\n')
19
+ ? '\n' + indentComment(comment, indent)
20
+ : (str.endsWith(' ') ? '' : ' ') + comment;
19
21
 
20
22
  exports.indentComment = indentComment;
21
23
  exports.lineComment = lineComment;
@@ -98,7 +98,10 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
98
98
  const valueStr = stringify.stringify(value, ctx, () => (valueCommentDone = true), () => (chompKeep = true));
99
99
  let ws = ' ';
100
100
  if (vcb || keyComment) {
101
- ws = valueStr === '' && !ctx.inFlow ? vcb : `${vcb}\n${ctx.indent}`;
101
+ if (valueStr === '' && !ctx.inFlow)
102
+ ws = vcb === '\n' ? '\n\n' : vcb;
103
+ else
104
+ ws = `${vcb}\n${ctx.indent}`;
102
105
  }
103
106
  else if (!explicitKey && Node.isCollection(value)) {
104
107
  const flow = valueStr[0] === '[' || valueStr[0] === '{';
@@ -245,14 +245,14 @@ function plainString(item, ctx, onComment, onChompKeep) {
245
245
  // - '\n ', ': ' or ' \n' anywhere
246
246
  // - '#' not preceded by a non-space char
247
247
  // - end with ' ' or ':'
248
- return implicitKey || inFlow || value.indexOf('\n') === -1
248
+ return implicitKey || inFlow || !value.includes('\n')
249
249
  ? quotedString(value, ctx)
250
250
  : blockString(item, ctx, onComment, onChompKeep);
251
251
  }
252
252
  if (!implicitKey &&
253
253
  !inFlow &&
254
254
  type !== Scalar.Scalar.PLAIN &&
255
- value.indexOf('\n') !== -1) {
255
+ value.includes('\n')) {
256
256
  // Where allowed & type not set explicitly, prefer block style for multiline strings
257
257
  return blockString(item, ctx, onComment, onChompKeep);
258
258
  }
@@ -57,7 +57,7 @@ function testEvents(src) {
57
57
  }
58
58
  }
59
59
  catch (e) {
60
- return { events, error: error || e };
60
+ return { events, error: error !== null && error !== void 0 ? error : e };
61
61
  }
62
62
  events.push('-STR');
63
63
  return { events, error };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yaml",
3
- "version": "2.0.0-11",
3
+ "version": "2.0.1",
4
4
  "license": "ISC",
5
5
  "author": "Eemeli Aro <eemeli@gmail.com>",
6
6
  "repository": "github:eemeli/yaml",
@@ -89,6 +89,6 @@
89
89
  "typescript": "^4.3.5"
90
90
  },
91
91
  "engines": {
92
- "node": ">= 12"
92
+ "node": ">= 14"
93
93
  }
94
94
  }
package/package.json CHANGED
@@ -52,8 +52,8 @@
52
52
  "@types/fs-extra": "^8",
53
53
  "@types/glob": "^7.2.0",
54
54
  "@types/ini": "^1.3.31",
55
- "@types/jest": "^27.4.1",
56
- "@types/node": "^12",
55
+ "@types/jest": "^27.5.0",
56
+ "@types/node": "^14",
57
57
  "@types/semver": "^7.3.9",
58
58
  "@types/yargs": "^15.0.14",
59
59
  "@typescript-eslint/eslint-plugin": "^5",
@@ -91,7 +91,7 @@
91
91
  "semver": "^7.3.7",
92
92
  "shx": "^0.3.4",
93
93
  "xmlbuilder2": "^2.4.1",
94
- "yaml": "2.0.0-11",
94
+ "yaml": "^2.0.1",
95
95
  "yargs": "^16.2.0"
96
96
  },
97
97
  "bundledDependencies": [
@@ -117,11 +117,11 @@
117
117
  "scaffolding"
118
118
  ],
119
119
  "engines": {
120
- "node": ">= 12.7.0"
120
+ "node": ">= 14.0.0"
121
121
  },
122
122
  "main": "lib/index.js",
123
123
  "license": "Apache-2.0",
124
- "version": "0.54.58",
124
+ "version": "0.55.2",
125
125
  "jest": {
126
126
  "testMatch": [
127
127
  "<rootDir>/src/**/__tests__/**/*.ts?(x)",
package/releasetag.txt CHANGED
@@ -1 +1 @@
1
- v0.54.58
1
+ v0.55.2
package/version.txt CHANGED
@@ -1 +1 @@
1
- 0.54.58
1
+ 0.55.2