projen 0.71.24 → 0.71.26

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 (243) hide show
  1. package/.jsii +3 -3
  2. package/lib/awscdk/auto-discover.js +5 -5
  3. package/lib/awscdk/awscdk-app-java.js +1 -1
  4. package/lib/awscdk/awscdk-app-py.js +1 -1
  5. package/lib/awscdk/awscdk-app-ts.js +1 -1
  6. package/lib/awscdk/awscdk-construct.js +2 -2
  7. package/lib/awscdk/awscdk-deps-java.js +1 -1
  8. package/lib/awscdk/awscdk-deps-js.js +1 -1
  9. package/lib/awscdk/awscdk-deps-py.js +1 -1
  10. package/lib/awscdk/awscdk-deps.js +1 -1
  11. package/lib/awscdk/cdk-config.js +1 -1
  12. package/lib/awscdk/cdk-tasks.js +1 -1
  13. package/lib/awscdk/integration-test.js +1 -1
  14. package/lib/awscdk/lambda-extension.js +1 -1
  15. package/lib/awscdk/lambda-function.js +2 -2
  16. package/lib/build/build-workflow.js +1 -1
  17. package/lib/cdk/auto-discover-base.js +2 -2
  18. package/lib/cdk/construct-lib.js +1 -1
  19. package/lib/cdk/integration-test-base.js +1 -1
  20. package/lib/cdk/jsii-docgen.js +1 -1
  21. package/lib/cdk/jsii-project.js +1 -1
  22. package/lib/cdk8s/auto-discover.js +2 -2
  23. package/lib/cdk8s/cdk8s-app-py.js +1 -1
  24. package/lib/cdk8s/cdk8s-app-ts.js +1 -1
  25. package/lib/cdk8s/cdk8s-construct.js +1 -1
  26. package/lib/cdk8s/cdk8s-deps-py.js +1 -1
  27. package/lib/cdk8s/cdk8s-deps.js +1 -1
  28. package/lib/cdk8s/integration-test.js +1 -1
  29. package/lib/cdktf/cdktf-construct.js +1 -1
  30. package/lib/circleci/circleci.js +1 -1
  31. package/lib/component.js +1 -1
  32. package/lib/dependencies.js +1 -1
  33. package/lib/dev-env.js +1 -1
  34. package/lib/docker-compose/docker-compose-service.js +1 -1
  35. package/lib/docker-compose/docker-compose.js +1 -1
  36. package/lib/file.js +1 -1
  37. package/lib/gitattributes.js +1 -1
  38. package/lib/github/actions-provider.js +1 -1
  39. package/lib/github/auto-approve.js +1 -1
  40. package/lib/github/auto-merge.js +1 -1
  41. package/lib/github/dependabot.js +1 -1
  42. package/lib/github/github-credentials.js +1 -1
  43. package/lib/github/github-project.js +1 -1
  44. package/lib/github/github.js +1 -1
  45. package/lib/github/mergify.js +1 -1
  46. package/lib/github/pr-template.js +1 -1
  47. package/lib/github/pull-request-lint.js +1 -1
  48. package/lib/github/stale.js +1 -1
  49. package/lib/github/task-workflow.js +1 -1
  50. package/lib/github/workflow-actions.js +1 -1
  51. package/lib/github/workflow-jobs.js +1 -1
  52. package/lib/github/workflows.js +1 -1
  53. package/lib/gitlab/configuration.js +1 -1
  54. package/lib/gitlab/gitlab-configuration.js +1 -1
  55. package/lib/gitlab/nested-configuration.js +1 -1
  56. package/lib/gitpod.js +1 -1
  57. package/lib/ignore-file.js +1 -1
  58. package/lib/ini.js +1 -1
  59. package/lib/java/java-project.js +1 -1
  60. package/lib/java/junit.js +1 -1
  61. package/lib/java/maven-compile.js +1 -1
  62. package/lib/java/maven-packaging.js +1 -1
  63. package/lib/java/maven-sample.js +1 -1
  64. package/lib/java/pom.js +1 -1
  65. package/lib/java/projenrc.js +1 -1
  66. package/lib/javascript/bundler.js +1 -1
  67. package/lib/javascript/eslint.js +1 -1
  68. package/lib/javascript/jest.js +4 -4
  69. package/lib/javascript/node-package.js +1 -1
  70. package/lib/javascript/node-project.js +1 -1
  71. package/lib/javascript/npm-config.js +1 -1
  72. package/lib/javascript/prettier.js +1 -1
  73. package/lib/javascript/projenrc.js +1 -1
  74. package/lib/javascript/typescript-config.js +1 -1
  75. package/lib/javascript/upgrade-dependencies.js +2 -2
  76. package/lib/json-patch.js +1 -1
  77. package/lib/json.js +1 -1
  78. package/lib/license.js +1 -1
  79. package/lib/logger.js +1 -1
  80. package/lib/makefile.js +1 -1
  81. package/lib/object-file.js +1 -1
  82. package/lib/project-build.js +1 -1
  83. package/lib/project.js +1 -1
  84. package/lib/projects.js +1 -1
  85. package/lib/projenrc-json.js +2 -2
  86. package/lib/projenrc.js +1 -1
  87. package/lib/python/pip.js +1 -1
  88. package/lib/python/poetry.js +2 -2
  89. package/lib/python/projenrc.js +1 -1
  90. package/lib/python/pytest-sample.js +1 -1
  91. package/lib/python/pytest.js +1 -1
  92. package/lib/python/python-project.js +1 -1
  93. package/lib/python/python-sample.js +1 -1
  94. package/lib/python/requirements-file.js +1 -1
  95. package/lib/python/setuppy.js +1 -1
  96. package/lib/python/setuptools.js +1 -1
  97. package/lib/python/venv.js +1 -1
  98. package/lib/readme.js +1 -1
  99. package/lib/release/publisher.js +1 -1
  100. package/lib/release/release-trigger.js +1 -1
  101. package/lib/release/release.js +1 -1
  102. package/lib/renovatebot.js +1 -1
  103. package/lib/run-task.js +1 -1880
  104. package/lib/sample-file.js +2 -2
  105. package/lib/semver.js +1 -1
  106. package/lib/source-code.js +1 -1
  107. package/lib/task-runtime.js +1 -1
  108. package/lib/task.js +1 -1
  109. package/lib/tasks.js +1 -1
  110. package/lib/testing.js +1 -1
  111. package/lib/textfile.js +1 -1
  112. package/lib/toml.js +1 -1
  113. package/lib/typescript/projenrc-ts.js +1 -1
  114. package/lib/typescript/projenrc.js +1 -1
  115. package/lib/typescript/typescript-typedoc.js +1 -1
  116. package/lib/typescript/typescript.js +3 -3
  117. package/lib/version.js +1 -1
  118. package/lib/vscode/devcontainer.js +1 -1
  119. package/lib/vscode/extensions.js +1 -1
  120. package/lib/vscode/launch-config.js +1 -1
  121. package/lib/vscode/settings.js +1 -1
  122. package/lib/vscode/vscode.js +1 -1
  123. package/lib/web/next.js +3 -3
  124. package/lib/web/postcss.js +1 -1
  125. package/lib/web/react.js +4 -4
  126. package/lib/web/tailwind.js +1 -1
  127. package/lib/xmlfile.js +1 -1
  128. package/lib/yaml.js +1 -1
  129. package/node_modules/xmlbuilder2/node_modules/@types/node/README.md +1 -1
  130. package/node_modules/xmlbuilder2/node_modules/@types/node/globals.d.ts +1 -1
  131. package/node_modules/xmlbuilder2/node_modules/@types/node/package.json +2 -2
  132. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/v8.d.ts +94 -0
  133. package/node_modules/xmlbuilder2/node_modules/@types/node/v8.d.ts +94 -0
  134. package/node_modules/yaml/README.md +1 -1
  135. package/node_modules/yaml/browser/dist/compose/compose-collection.js +1 -1
  136. package/node_modules/yaml/browser/dist/compose/compose-doc.js +2 -2
  137. package/node_modules/yaml/browser/dist/compose/compose-node.js +4 -2
  138. package/node_modules/yaml/browser/dist/compose/compose-scalar.js +6 -7
  139. package/node_modules/yaml/browser/dist/compose/composer.js +2 -3
  140. package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +13 -10
  141. package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +1 -1
  142. package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +5 -5
  143. package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +3 -4
  144. package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +1 -2
  145. package/node_modules/yaml/browser/dist/compose/resolve-props.js +6 -2
  146. package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +1 -1
  147. package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +1 -1
  148. package/node_modules/yaml/browser/dist/doc/Document.js +6 -6
  149. package/node_modules/yaml/browser/dist/doc/createNode.js +6 -8
  150. package/node_modules/yaml/browser/dist/errors.js +1 -1
  151. package/node_modules/yaml/browser/dist/nodes/Collection.js +2 -1
  152. package/node_modules/yaml/browser/dist/nodes/Pair.js +2 -2
  153. package/node_modules/yaml/browser/dist/nodes/Scalar.js +1 -1
  154. package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +9 -10
  155. package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +4 -12
  156. package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +1 -1
  157. package/node_modules/yaml/browser/dist/nodes/toJS.js +1 -1
  158. package/node_modules/yaml/browser/dist/parse/cst-scalar.js +1 -2
  159. package/node_modules/yaml/browser/dist/parse/cst-visit.js +2 -2
  160. package/node_modules/yaml/browser/dist/parse/lexer.js +1 -2
  161. package/node_modules/yaml/browser/dist/parse/parser.js +24 -26
  162. package/node_modules/yaml/browser/dist/public-api.js +3 -4
  163. package/node_modules/yaml/browser/dist/schema/Schema.js +1 -1
  164. package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +1 -1
  165. package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +1 -2
  166. package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +6 -1
  167. package/node_modules/yaml/browser/dist/stringify/stringify.js +8 -8
  168. package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +4 -5
  169. package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +1 -2
  170. package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +45 -20
  171. package/node_modules/yaml/browser/dist/stringify/stringifyString.js +17 -12
  172. package/node_modules/yaml/browser/dist/visit.js +5 -6
  173. package/node_modules/yaml/dist/compose/compose-collection.js +1 -1
  174. package/node_modules/yaml/dist/compose/compose-doc.js +2 -2
  175. package/node_modules/yaml/dist/compose/compose-node.d.ts +3 -2
  176. package/node_modules/yaml/dist/compose/compose-node.js +4 -2
  177. package/node_modules/yaml/dist/compose/compose-scalar.js +6 -7
  178. package/node_modules/yaml/dist/compose/composer.d.ts +2 -2
  179. package/node_modules/yaml/dist/compose/composer.js +2 -3
  180. package/node_modules/yaml/dist/compose/resolve-block-map.js +13 -10
  181. package/node_modules/yaml/dist/compose/resolve-block-scalar.js +1 -1
  182. package/node_modules/yaml/dist/compose/resolve-block-seq.js +5 -5
  183. package/node_modules/yaml/dist/compose/resolve-flow-collection.js +3 -4
  184. package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +1 -2
  185. package/node_modules/yaml/dist/compose/resolve-props.d.ts +1 -0
  186. package/node_modules/yaml/dist/compose/resolve-props.js +6 -2
  187. package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +1 -1
  188. package/node_modules/yaml/dist/compose/util-flow-indent-check.js +1 -1
  189. package/node_modules/yaml/dist/doc/Document.d.ts +11 -11
  190. package/node_modules/yaml/dist/doc/Document.js +6 -6
  191. package/node_modules/yaml/dist/doc/anchors.d.ts +1 -1
  192. package/node_modules/yaml/dist/doc/applyReviver.d.ts +1 -1
  193. package/node_modules/yaml/dist/doc/createNode.js +6 -8
  194. package/node_modules/yaml/dist/errors.d.ts +2 -2
  195. package/node_modules/yaml/dist/errors.js +1 -1
  196. package/node_modules/yaml/dist/index.d.ts +2 -0
  197. package/node_modules/yaml/dist/log.d.ts +1 -1
  198. package/node_modules/yaml/dist/nodes/Alias.d.ts +1 -1
  199. package/node_modules/yaml/dist/nodes/Collection.d.ts +2 -2
  200. package/node_modules/yaml/dist/nodes/Collection.js +2 -1
  201. package/node_modules/yaml/dist/nodes/Node.d.ts +17 -11
  202. package/node_modules/yaml/dist/nodes/Pair.d.ts +1 -1
  203. package/node_modules/yaml/dist/nodes/Pair.js +2 -2
  204. package/node_modules/yaml/dist/nodes/Scalar.js +1 -1
  205. package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +8 -4
  206. package/node_modules/yaml/dist/nodes/YAMLMap.js +9 -10
  207. package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +4 -1
  208. package/node_modules/yaml/dist/nodes/YAMLSeq.js +4 -12
  209. package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +2 -1
  210. package/node_modules/yaml/dist/nodes/addPairToJSMap.js +1 -1
  211. package/node_modules/yaml/dist/nodes/toJS.js +1 -1
  212. package/node_modules/yaml/dist/options.d.ts +15 -7
  213. package/node_modules/yaml/dist/parse/cst-scalar.js +1 -2
  214. package/node_modules/yaml/dist/parse/cst-visit.d.ts +2 -2
  215. package/node_modules/yaml/dist/parse/cst-visit.js +2 -2
  216. package/node_modules/yaml/dist/parse/cst.d.ts +3 -3
  217. package/node_modules/yaml/dist/parse/lexer.js +1 -2
  218. package/node_modules/yaml/dist/parse/parser.js +24 -26
  219. package/node_modules/yaml/dist/public-api.js +3 -4
  220. package/node_modules/yaml/dist/schema/Schema.d.ts +3 -3
  221. package/node_modules/yaml/dist/schema/Schema.js +1 -1
  222. package/node_modules/yaml/dist/schema/json-schema.d.ts +69 -0
  223. package/node_modules/yaml/dist/schema/tags.d.ts +2 -2
  224. package/node_modules/yaml/dist/schema/types.d.ts +1 -1
  225. package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +7 -3
  226. package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +1 -1
  227. package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +1 -2
  228. package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +6 -2
  229. package/node_modules/yaml/dist/schema/yaml-1.1/set.js +6 -1
  230. package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +1 -1
  231. package/node_modules/yaml/dist/stringify/stringify.d.ts +2 -1
  232. package/node_modules/yaml/dist/stringify/stringify.js +8 -8
  233. package/node_modules/yaml/dist/stringify/stringifyCollection.js +4 -5
  234. package/node_modules/yaml/dist/stringify/stringifyDocument.js +1 -2
  235. package/node_modules/yaml/dist/stringify/stringifyPair.js +45 -20
  236. package/node_modules/yaml/dist/stringify/stringifyString.d.ts +7 -1
  237. package/node_modules/yaml/dist/stringify/stringifyString.js +17 -12
  238. package/node_modules/yaml/dist/test-events.js +2 -3
  239. package/node_modules/yaml/dist/visit.d.ts +4 -4
  240. package/node_modules/yaml/dist/visit.js +5 -6
  241. package/node_modules/yaml/package.json +11 -11
  242. package/package.json +2 -2
  243. package/node_modules/yaml/dist/node_modules/tslib/tslib.es6.js +0 -76
@@ -65,19 +65,18 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
65
65
  if (keyComment)
66
66
  str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));
67
67
  }
68
- let vcb = '';
69
- let valueComment = null;
68
+ let vsb, vcb, valueComment;
70
69
  if (Node.isNode(value)) {
71
- if (value.spaceBefore)
72
- vcb = '\n';
73
- if (value.commentBefore) {
74
- const cs = commentString(value.commentBefore);
75
- vcb += `\n${stringifyComment.indentComment(cs, ctx.indent)}`;
76
- }
70
+ vsb = !!value.spaceBefore;
71
+ vcb = value.commentBefore;
77
72
  valueComment = value.comment;
78
73
  }
79
- else if (value && typeof value === 'object') {
80
- value = doc.createNode(value);
74
+ else {
75
+ vsb = false;
76
+ vcb = null;
77
+ valueComment = null;
78
+ if (value && typeof value === 'object')
79
+ value = doc.createNode(value);
81
80
  }
82
81
  ctx.implicitKey = false;
83
82
  if (!explicitKey && !keyComment && Node.isScalar(value))
@@ -92,24 +91,50 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
92
91
  !value.tag &&
93
92
  !value.anchor) {
94
93
  // If indentSeq === false, consider '- ' as part of indentation where possible
95
- ctx.indent = ctx.indent.substr(2);
94
+ ctx.indent = ctx.indent.substring(2);
96
95
  }
97
96
  let valueCommentDone = false;
98
97
  const valueStr = stringify.stringify(value, ctx, () => (valueCommentDone = true), () => (chompKeep = true));
99
98
  let ws = ' ';
100
- if (vcb || keyComment) {
101
- if (valueStr === '' && !ctx.inFlow)
102
- ws = vcb === '\n' ? '\n\n' : vcb;
103
- else
104
- ws = `${vcb}\n${ctx.indent}`;
99
+ if (keyComment || vsb || vcb) {
100
+ ws = vsb ? '\n' : '';
101
+ if (vcb) {
102
+ const cs = commentString(vcb);
103
+ ws += `\n${stringifyComment.indentComment(cs, ctx.indent)}`;
104
+ }
105
+ if (valueStr === '' && !ctx.inFlow) {
106
+ if (ws === '\n')
107
+ ws = '\n\n';
108
+ }
109
+ else {
110
+ ws += `\n${ctx.indent}`;
111
+ }
105
112
  }
106
113
  else if (!explicitKey && Node.isCollection(value)) {
107
- const flow = valueStr[0] === '[' || valueStr[0] === '{';
108
- if (!flow || valueStr.includes('\n'))
109
- ws = `\n${ctx.indent}`;
114
+ const vs0 = valueStr[0];
115
+ const nl0 = valueStr.indexOf('\n');
116
+ const hasNewline = nl0 !== -1;
117
+ const flow = ctx.inFlow ?? value.flow ?? value.items.length === 0;
118
+ if (hasNewline || !flow) {
119
+ let hasPropsLine = false;
120
+ if (hasNewline && (vs0 === '&' || vs0 === '!')) {
121
+ let sp0 = valueStr.indexOf(' ');
122
+ if (vs0 === '&' &&
123
+ sp0 !== -1 &&
124
+ sp0 < nl0 &&
125
+ valueStr[sp0 + 1] === '!') {
126
+ sp0 = valueStr.indexOf(' ', sp0 + 1);
127
+ }
128
+ if (sp0 === -1 || nl0 < sp0)
129
+ hasPropsLine = true;
130
+ }
131
+ if (!hasPropsLine)
132
+ ws = `\n${ctx.indent}`;
133
+ }
110
134
  }
111
- else if (valueStr === '' || valueStr[0] === '\n')
135
+ else if (valueStr === '' || valueStr[0] === '\n') {
112
136
  ws = '';
137
+ }
113
138
  str += ws + valueStr;
114
139
  if (ctx.inFlow) {
115
140
  if (valueCommentDone && onComment)
@@ -1,3 +1,9 @@
1
1
  import { Scalar } from '../nodes/Scalar.js';
2
2
  import type { StringifyContext } from './stringify.js';
3
- export declare function stringifyString(item: Scalar, ctx: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string;
3
+ interface StringifyScalar {
4
+ value: string;
5
+ comment?: string | null;
6
+ type?: string;
7
+ }
8
+ export declare function stringifyString(item: Scalar | StringifyScalar, ctx: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string;
9
+ export {};
@@ -3,8 +3,8 @@
3
3
  var Scalar = require('../nodes/Scalar.js');
4
4
  var foldFlowLines = require('./foldFlowLines.js');
5
5
 
6
- const getFoldOptions = (ctx) => ({
7
- indentAtStart: ctx.indentAtStart,
6
+ const getFoldOptions = (ctx, isBlock) => ({
7
+ indentAtStart: isBlock ? ctx.indent.length : ctx.indentAtStart,
8
8
  lineWidth: ctx.options.lineWidth,
9
9
  minContentWidth: ctx.options.minContentWidth
10
10
  });
@@ -117,7 +117,7 @@ function doubleQuotedString(value, ctx) {
117
117
  str = start ? str + json.slice(start) : json;
118
118
  return implicitKey
119
119
  ? str
120
- : foldFlowLines.foldFlowLines(str, indent, foldFlowLines.FOLD_QUOTED, getFoldOptions(ctx));
120
+ : foldFlowLines.foldFlowLines(str, indent, foldFlowLines.FOLD_QUOTED, getFoldOptions(ctx, false));
121
121
  }
122
122
  function singleQuotedString(value, ctx) {
123
123
  if (ctx.options.singleQuote === false ||
@@ -129,7 +129,7 @@ function singleQuotedString(value, ctx) {
129
129
  const res = "'" + value.replace(/'/g, "''").replace(/\n+/g, `$&\n${indent}`) + "'";
130
130
  return ctx.implicitKey
131
131
  ? res
132
- : foldFlowLines.foldFlowLines(res, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx));
132
+ : foldFlowLines.foldFlowLines(res, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));
133
133
  }
134
134
  function quotedString(value, ctx) {
135
135
  const { singleQuote } = ctx.options;
@@ -227,12 +227,12 @@ function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
227
227
  .replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
228
228
  // ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
229
229
  .replace(/\n+/g, `$&${indent}`);
230
- const body = foldFlowLines.foldFlowLines(`${start}${value}${end}`, indent, foldFlowLines.FOLD_BLOCK, getFoldOptions(ctx));
230
+ const body = foldFlowLines.foldFlowLines(`${start}${value}${end}`, indent, foldFlowLines.FOLD_BLOCK, getFoldOptions(ctx, true));
231
231
  return `${header}\n${indent}${body}`;
232
232
  }
233
233
  function plainString(item, ctx, onComment, onChompKeep) {
234
234
  const { type, value } = item;
235
- const { actualString, implicitKey, indent, inFlow } = ctx;
235
+ const { actualString, implicitKey, indent, indentStep, inFlow } = ctx;
236
236
  if ((implicitKey && /[\n[\]{},]/.test(value)) ||
237
237
  (inFlow && /[[\]{},]/.test(value))) {
238
238
  return quotedString(value, ctx);
@@ -256,23 +256,28 @@ function plainString(item, ctx, onComment, onChompKeep) {
256
256
  // Where allowed & type not set explicitly, prefer block style for multiline strings
257
257
  return blockString(item, ctx, onComment, onChompKeep);
258
258
  }
259
- if (indent === '' && containsDocumentMarker(value)) {
260
- ctx.forceBlockIndent = true;
261
- return blockString(item, ctx, onComment, onChompKeep);
259
+ if (containsDocumentMarker(value)) {
260
+ if (indent === '') {
261
+ ctx.forceBlockIndent = true;
262
+ return blockString(item, ctx, onComment, onChompKeep);
263
+ }
264
+ else if (implicitKey && indent === indentStep) {
265
+ return quotedString(value, ctx);
266
+ }
262
267
  }
263
268
  const str = value.replace(/\n+/g, `$&\n${indent}`);
264
269
  // Verify that output will be parsed as a string, as e.g. plain numbers and
265
270
  // booleans get parsed with those types in v1.2 (e.g. '42', 'true' & '0.9e-3'),
266
271
  // and others in v1.1.
267
272
  if (actualString) {
268
- const test = (tag) => { var _a; return tag.default && tag.tag !== 'tag:yaml.org,2002:str' && ((_a = tag.test) === null || _a === void 0 ? void 0 : _a.test(str)); };
273
+ const test = (tag) => tag.default && tag.tag !== 'tag:yaml.org,2002:str' && tag.test?.test(str);
269
274
  const { compat, tags } = ctx.doc.schema;
270
- if (tags.some(test) || (compat === null || compat === void 0 ? void 0 : compat.some(test)))
275
+ if (tags.some(test) || compat?.some(test))
271
276
  return quotedString(value, ctx);
272
277
  }
273
278
  return implicitKey
274
279
  ? str
275
- : foldFlowLines.foldFlowLines(str, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx));
280
+ : foldFlowLines.foldFlowLines(str, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));
276
281
  }
277
282
  function stringifyString(item, ctx, onComment, onChompKeep) {
278
283
  const { implicitKey, inFlow } = ctx;
@@ -25,7 +25,6 @@ function anchorExists(doc, anchor) {
25
25
  }
26
26
  // test harness for yaml-test-suite event tests
27
27
  function testEvents(src) {
28
- var _a;
29
28
  const docs = publicApi.parseAllDocuments(src);
30
29
  const errDoc = docs.find(doc => doc.errors.length > 0);
31
30
  const error = errDoc ? errDoc.errors[0].message : null;
@@ -49,7 +48,7 @@ function testEvents(src) {
49
48
  !doc.contents.tag)
50
49
  continue;
51
50
  events.push(docStart);
52
- addEvents(events, doc, (_a = error === null || error === void 0 ? void 0 : error.pos[0]) !== null && _a !== void 0 ? _a : -1, root);
51
+ addEvents(events, doc, error?.pos[0] ?? -1, root);
53
52
  let docEnd = '-DOC';
54
53
  if (doc.directives.docEnd)
55
54
  docEnd += ' ...';
@@ -57,7 +56,7 @@ function testEvents(src) {
57
56
  }
58
57
  }
59
58
  catch (e) {
60
- return { events, error: error !== null && error !== void 0 ? error : e };
59
+ return { events, error: error ?? e };
61
60
  }
62
61
  events.push('-STR');
63
62
  return { events, error };
@@ -5,8 +5,8 @@ import type { Pair } from './nodes/Pair.js';
5
5
  import type { Scalar } from './nodes/Scalar.js';
6
6
  import type { YAMLMap } from './nodes/YAMLMap.js';
7
7
  import type { YAMLSeq } from './nodes/YAMLSeq.js';
8
- export declare type visitorFn<T> = (key: number | 'key' | 'value' | null, node: T, path: readonly (Document | Node | Pair)[]) => void | symbol | number | Node | Pair;
9
- export declare type visitor = visitorFn<unknown> | {
8
+ export type visitorFn<T> = (key: number | 'key' | 'value' | null, node: T, path: readonly (Document | Node | Pair)[]) => void | symbol | number | Node | Pair;
9
+ export type visitor = visitorFn<unknown> | {
10
10
  Alias?: visitorFn<Alias>;
11
11
  Collection?: visitorFn<YAMLMap | YAMLSeq>;
12
12
  Map?: visitorFn<YAMLMap>;
@@ -16,8 +16,8 @@ export declare type visitor = visitorFn<unknown> | {
16
16
  Seq?: visitorFn<YAMLSeq>;
17
17
  Value?: visitorFn<Scalar | YAMLMap | YAMLSeq>;
18
18
  };
19
- export declare type asyncVisitorFn<T> = (key: number | 'key' | 'value' | null, node: T, path: readonly (Document | Node | Pair)[]) => void | symbol | number | Node | Pair | Promise<void | symbol | number | Node | Pair>;
20
- export declare type asyncVisitor = asyncVisitorFn<unknown> | {
19
+ export type asyncVisitorFn<T> = (key: number | 'key' | 'value' | null, node: T, path: readonly (Document | Node | Pair)[]) => void | symbol | number | Node | Pair | Promise<void | symbol | number | Node | Pair>;
20
+ export type asyncVisitor = asyncVisitorFn<unknown> | {
21
21
  Alias?: asyncVisitorFn<Alias>;
22
22
  Collection?: asyncVisitorFn<YAMLMap | YAMLSeq>;
23
23
  Map?: asyncVisitorFn<YAMLMap>;
@@ -198,19 +198,18 @@ function initVisitor(visitor) {
198
198
  return visitor;
199
199
  }
200
200
  function callVisitor(key, node, visitor, path) {
201
- var _a, _b, _c, _d, _e;
202
201
  if (typeof visitor === 'function')
203
202
  return visitor(key, node, path);
204
203
  if (Node.isMap(node))
205
- return (_a = visitor.Map) === null || _a === void 0 ? void 0 : _a.call(visitor, key, node, path);
204
+ return visitor.Map?.(key, node, path);
206
205
  if (Node.isSeq(node))
207
- return (_b = visitor.Seq) === null || _b === void 0 ? void 0 : _b.call(visitor, key, node, path);
206
+ return visitor.Seq?.(key, node, path);
208
207
  if (Node.isPair(node))
209
- return (_c = visitor.Pair) === null || _c === void 0 ? void 0 : _c.call(visitor, key, node, path);
208
+ return visitor.Pair?.(key, node, path);
210
209
  if (Node.isScalar(node))
211
- return (_d = visitor.Scalar) === null || _d === void 0 ? void 0 : _d.call(visitor, key, node, path);
210
+ return visitor.Scalar?.(key, node, path);
212
211
  if (Node.isAlias(node))
213
- return (_e = visitor.Alias) === null || _e === void 0 ? void 0 : _e.call(visitor, key, node, path);
212
+ return visitor.Alias?.(key, node, path);
214
213
  return undefined;
215
214
  }
216
215
  function replaceNode(key, path, node) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yaml",
3
- "version": "2.0.0",
3
+ "version": "2.2.2",
4
4
  "license": "ISC",
5
5
  "author": "Eemeli Aro <eemeli@gmail.com>",
6
6
  "repository": "github:eemeli/yaml",
@@ -37,8 +37,8 @@
37
37
  },
38
38
  "scripts": {
39
39
  "build": "npm run build:node && npm run build:browser",
40
- "build:browser": "rollup -c config/rollup.browser-config.js",
41
- "build:node": "rollup -c config/rollup.node-config.js",
40
+ "build:browser": "rollup -c config/rollup.browser-config.mjs",
41
+ "build:node": "rollup -c config/rollup.node-config.mjs",
42
42
  "clean": "git clean -fdxe node_modules",
43
43
  "lint": "eslint src/",
44
44
  "prettier": "prettier --write .",
@@ -69,22 +69,22 @@
69
69
  "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1",
70
70
  "@babel/plugin-transform-typescript": "^7.12.17",
71
71
  "@babel/preset-env": "^7.12.11",
72
- "@rollup/plugin-babel": "^5.2.3",
73
- "@rollup/plugin-replace": "^4.0.0",
74
- "@rollup/plugin-typescript": "^8.1.1",
75
- "@types/jest": "^27.0.1",
76
- "@types/node": "^12.20.47",
72
+ "@rollup/plugin-babel": "^6.0.3",
73
+ "@rollup/plugin-replace": "^5.0.2",
74
+ "@rollup/plugin-typescript": "^10.0.1",
75
+ "@types/jest": "^29.2.4",
76
+ "@types/node": "^14.18.35",
77
77
  "@typescript-eslint/eslint-plugin": "^5.3.1",
78
78
  "@typescript-eslint/parser": "^5.3.1",
79
- "babel-jest": "^27.0.1",
79
+ "babel-jest": "^29.0.1",
80
80
  "cross-env": "^7.0.3",
81
81
  "eslint": "^8.2.0",
82
82
  "eslint-config-prettier": "^8.1.0",
83
83
  "fast-check": "^2.12.0",
84
- "jest": "^27.0.1",
84
+ "jest": "^29.0.1",
85
85
  "jest-ts-webcompat-resolver": "^1.0.0",
86
86
  "prettier": "^2.2.1",
87
- "rollup": "^2.38.2",
87
+ "rollup": "^3.7.5",
88
88
  "tslib": "^2.1.0",
89
89
  "typescript": "^4.3.5"
90
90
  },
package/package.json CHANGED
@@ -89,7 +89,7 @@
89
89
  "semver": "^7.5.0",
90
90
  "shx": "^0.3.4",
91
91
  "xmlbuilder2": "^2.4.1",
92
- "yaml": "2.0.0",
92
+ "yaml": "^2.2.2",
93
93
  "yargs": "^16.2.0"
94
94
  },
95
95
  "bundledDependencies": [
@@ -120,7 +120,7 @@
120
120
  },
121
121
  "main": "lib/index.js",
122
122
  "license": "Apache-2.0",
123
- "version": "0.71.24",
123
+ "version": "0.71.26",
124
124
  "jest": {
125
125
  "maxWorkers": "50%",
126
126
  "testMatch": [
@@ -1,76 +0,0 @@
1
- 'use strict';
2
-
3
- /*! *****************************************************************************
4
- Copyright (c) Microsoft Corporation.
5
-
6
- Permission to use, copy, modify, and/or distribute this software for any
7
- purpose with or without fee is hereby granted.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
- PERFORMANCE OF THIS SOFTWARE.
16
- ***************************************************************************** */
17
- /* global Reflect, Promise */
18
-
19
- var extendStatics = function(d, b) {
20
- extendStatics = Object.setPrototypeOf ||
21
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
22
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
23
- return extendStatics(d, b);
24
- };
25
-
26
- function __extends(d, b) {
27
- if (typeof b !== "function" && b !== null)
28
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
29
- extendStatics(d, b);
30
- function __() { this.constructor = d; }
31
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
32
- }
33
-
34
- function __generator(thisArg, body) {
35
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
- function verb(n) { return function (v) { return step([n, v]); }; }
38
- function step(op) {
39
- if (f) throw new TypeError("Generator is already executing.");
40
- while (_) try {
41
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
42
- if (y = 0, t) op = [op[0] & 2, t.value];
43
- switch (op[0]) {
44
- case 0: case 1: t = op; break;
45
- case 4: _.label++; return { value: op[1], done: false };
46
- case 5: _.label++; y = op[1]; op = [0]; continue;
47
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
48
- default:
49
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
50
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
51
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
52
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
53
- if (t[2]) _.ops.pop();
54
- _.trys.pop(); continue;
55
- }
56
- op = body.call(thisArg, _);
57
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
- }
60
- }
61
-
62
- function __values(o) {
63
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
64
- if (m) return m.call(o);
65
- if (o && typeof o.length === "number") return {
66
- next: function () {
67
- if (o && i >= o.length) o = void 0;
68
- return { value: o && o[i++], done: !o };
69
- }
70
- };
71
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
72
- }
73
-
74
- exports.__extends = __extends;
75
- exports.__generator = __generator;
76
- exports.__values = __values;