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
@@ -49,7 +49,7 @@ visit.REMOVE = REMOVE;
49
49
  visit.itemAtPath = (cst, path) => {
50
50
  let item = cst;
51
51
  for (const [field, index] of path) {
52
- const tok = item === null || item === void 0 ? void 0 : item[field];
52
+ const tok = item?.[field];
53
53
  if (tok && 'items' in tok) {
54
54
  item = tok.items[index];
55
55
  }
@@ -66,7 +66,7 @@ visit.itemAtPath = (cst, path) => {
66
66
  visit.parentCollection = (cst, path) => {
67
67
  const parent = visit.itemAtPath(cst, path.slice(0, -1));
68
68
  const field = path[path.length - 1][0];
69
- const coll = parent === null || parent === void 0 ? void 0 : parent[field];
69
+ const coll = parent?.[field];
70
70
  if (coll && 'items' in coll)
71
71
  return coll;
72
72
  throw new Error('Parent collection not found');
@@ -72,7 +72,7 @@ export interface BlockSequence {
72
72
  value?: Token;
73
73
  }>;
74
74
  }
75
- export declare type CollectionItem = {
75
+ export type CollectionItem = {
76
76
  start: SourceToken[];
77
77
  key?: Token | null;
78
78
  sep?: SourceToken[];
@@ -86,8 +86,8 @@ export interface FlowCollection {
86
86
  items: CollectionItem[];
87
87
  end: SourceToken[];
88
88
  }
89
- export declare type Token = SourceToken | ErrorToken | Directive | Document | DocumentEnd | FlowScalar | BlockScalar | BlockMap | BlockSequence | FlowCollection;
90
- export declare type TokenType = SourceToken['type'] | DocumentEnd['type'] | FlowScalar['type'];
89
+ export type Token = SourceToken | ErrorToken | Directive | Document | DocumentEnd | FlowScalar | BlockScalar | BlockMap | BlockSequence | FlowCollection;
90
+ export type TokenType = SourceToken['type'] | DocumentEnd['type'] | FlowScalar['type'];
91
91
  /** The byte order mark */
92
92
  export declare const BOM = "\uFEFF";
93
93
  /** Start of doc-mode */
@@ -150,13 +150,12 @@ class Lexer {
150
150
  * @returns A generator of lexical tokens
151
151
  */
152
152
  *lex(source, incomplete = false) {
153
- var _a;
154
153
  if (source) {
155
154
  this.buffer = this.buffer ? this.buffer + source : source;
156
155
  this.lineEndPos = null;
157
156
  }
158
157
  this.atEnd = !incomplete;
159
- let next = (_a = this.next) !== null && _a !== void 0 ? _a : 'stream';
158
+ let next = this.next ?? 'stream';
160
159
  while (next && (incomplete || this.hasChars(1)))
161
160
  next = yield* this.parseNext(next);
162
161
  }
@@ -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,13 +17,13 @@ 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
- switch (token === null || token === void 0 ? void 0 : token.type) {
26
+ switch (token?.type) {
27
27
  case 'alias':
28
28
  case 'scalar':
29
29
  case 'single-quoted-scalar':
@@ -35,13 +35,12 @@ function isFlowToken(token) {
35
35
  }
36
36
  }
37
37
  function getPrevProps(parent) {
38
- var _a;
39
38
  switch (parent.type) {
40
39
  case 'document':
41
40
  return parent.start;
42
41
  case 'block-map': {
43
42
  const it = parent.items[parent.items.length - 1];
44
- return (_a = it.sep) !== null && _a !== void 0 ? _a : it.start;
43
+ return it.sep ?? it.start;
45
44
  }
46
45
  case 'block-seq':
47
46
  return parent.items[parent.items.length - 1].start;
@@ -52,7 +51,6 @@ function getPrevProps(parent) {
52
51
  }
53
52
  /** Note: May modify input array */
54
53
  function getFirstKeyStartProps(prev) {
55
- var _a;
56
54
  if (prev.length === 0)
57
55
  return [];
58
56
  let i = prev.length;
@@ -66,7 +64,7 @@ function getFirstKeyStartProps(prev) {
66
64
  break loop;
67
65
  }
68
66
  }
69
- while (((_a = prev[++i]) === null || _a === void 0 ? void 0 : _a.type) === 'space') {
67
+ while (prev[++i]?.type === 'space') {
70
68
  /* loop */
71
69
  }
72
70
  return prev.splice(i, prev.length);
@@ -270,7 +268,7 @@ class Parser {
270
268
  return this.stack[this.stack.length - n];
271
269
  }
272
270
  *pop(error) {
273
- const token = error !== null && error !== void 0 ? error : this.stack.pop();
271
+ const token = error ?? this.stack.pop();
274
272
  /* istanbul ignore if should not happen */
275
273
  if (!token) {
276
274
  const message = 'Tried to pop an empty stack';
@@ -347,7 +345,7 @@ class Parser {
347
345
  !last.sep &&
348
346
  !last.value &&
349
347
  last.start.length > 0 &&
350
- !includesNonEmpty(last.start) &&
348
+ findNonEmptyIndex(last.start) === -1 &&
351
349
  (token.indent === 0 ||
352
350
  last.start.every(st => st.type !== 'comment' || st.indent < token.indent))) {
353
351
  if (top.type === 'document')
@@ -395,7 +393,7 @@ class Parser {
395
393
  return yield* this.lineEnd(doc);
396
394
  switch (this.type) {
397
395
  case 'doc-start': {
398
- if (includesNonEmpty(doc.start)) {
396
+ if (findNonEmptyIndex(doc.start) !== -1) {
399
397
  yield* this.pop();
400
398
  yield* this.step();
401
399
  }
@@ -475,7 +473,6 @@ class Parser {
475
473
  }
476
474
  }
477
475
  *blockMap(map) {
478
- var _a;
479
476
  const it = map.items[map.items.length - 1];
480
477
  // it.sep is true-ish if pair already has key or : separator
481
478
  switch (this.type) {
@@ -484,26 +481,30 @@ class Parser {
484
481
  if (it.value) {
485
482
  const end = 'end' in it.value ? it.value.end : undefined;
486
483
  const last = Array.isArray(end) ? end[end.length - 1] : undefined;
487
- if ((last === null || last === void 0 ? void 0 : last.type) === 'comment')
488
- end === null || end === void 0 ? void 0 : end.push(this.sourceToken);
484
+ if (last?.type === 'comment')
485
+ end?.push(this.sourceToken);
489
486
  else
490
487
  map.items.push({ start: [this.sourceToken] });
491
488
  }
492
- else if (it.sep)
489
+ else if (it.sep) {
493
490
  it.sep.push(this.sourceToken);
494
- else
491
+ }
492
+ else {
495
493
  it.start.push(this.sourceToken);
494
+ }
496
495
  return;
497
496
  case 'space':
498
497
  case 'comment':
499
- if (it.value)
498
+ if (it.value) {
500
499
  map.items.push({ start: [this.sourceToken] });
501
- else if (it.sep)
500
+ }
501
+ else if (it.sep) {
502
502
  it.sep.push(this.sourceToken);
503
+ }
503
504
  else {
504
505
  if (this.atIndentedComment(it.start, map.indent)) {
505
506
  const prev = map.items[map.items.length - 2];
506
- const end = (_a = prev === null || prev === void 0 ? void 0 : prev.value) === null || _a === void 0 ? void 0 : _a.end;
507
+ const end = prev?.value?.end;
507
508
  if (Array.isArray(end)) {
508
509
  Array.prototype.push.apply(end, it.start);
509
510
  end.push(this.sourceToken);
@@ -516,9 +517,7 @@ class Parser {
516
517
  return;
517
518
  }
518
519
  if (this.indent >= map.indent) {
519
- const atNextItem = !this.onKeyLine &&
520
- this.indent === map.indent &&
521
- (it.sep || includesNonEmpty(it.start));
520
+ const atNextItem = !this.onKeyLine && this.indent === map.indent && it.sep;
522
521
  // For empty nodes, assign newline-separated not indented empty tokens to following node
523
522
  let start = [];
524
523
  if (atNextItem && it.sep && !it.value) {
@@ -682,15 +681,14 @@ class Parser {
682
681
  yield* this.step();
683
682
  }
684
683
  *blockSequence(seq) {
685
- var _a;
686
684
  const it = seq.items[seq.items.length - 1];
687
685
  switch (this.type) {
688
686
  case 'newline':
689
687
  if (it.value) {
690
688
  const end = 'end' in it.value ? it.value.end : undefined;
691
689
  const last = Array.isArray(end) ? end[end.length - 1] : undefined;
692
- if ((last === null || last === void 0 ? void 0 : last.type) === 'comment')
693
- end === null || end === void 0 ? void 0 : end.push(this.sourceToken);
690
+ if (last?.type === 'comment')
691
+ end?.push(this.sourceToken);
694
692
  else
695
693
  seq.items.push({ start: [this.sourceToken] });
696
694
  }
@@ -704,7 +702,7 @@ class Parser {
704
702
  else {
705
703
  if (this.atIndentedComment(it.start, seq.indent)) {
706
704
  const prev = seq.items[seq.items.length - 2];
707
- const end = (_a = prev === null || prev === void 0 ? void 0 : prev.value) === null || _a === void 0 ? void 0 : _a.end;
705
+ const end = prev?.value?.end;
708
706
  if (Array.isArray(end)) {
709
707
  Array.prototype.push.apply(end, it.start);
710
708
  end.push(this.sourceToken);
@@ -23,7 +23,7 @@ function parseOptions(options) {
23
23
  */
24
24
  function parseAllDocuments(source, options = {}) {
25
25
  const { lineCounter, prettyErrors } = parseOptions(options);
26
- const parser$1 = new parser.Parser(lineCounter === null || lineCounter === void 0 ? void 0 : lineCounter.addNewLine);
26
+ const parser$1 = new parser.Parser(lineCounter?.addNewLine);
27
27
  const composer$1 = new composer.Composer(options);
28
28
  const docs = Array.from(composer$1.compose(parser$1.parse(source)));
29
29
  if (prettyErrors && lineCounter)
@@ -38,7 +38,7 @@ function parseAllDocuments(source, options = {}) {
38
38
  /** Parse an input string into a single YAML.Document */
39
39
  function parseDocument(source, options = {}) {
40
40
  const { lineCounter, prettyErrors } = parseOptions(options);
41
- const parser$1 = new parser.Parser(lineCounter === null || lineCounter === void 0 ? void 0 : lineCounter.addNewLine);
41
+ const parser$1 = new parser.Parser(lineCounter?.addNewLine);
42
42
  const composer$1 = new composer.Composer(options);
43
43
  // `doc` is always set by compose.end(true) at the very latest
44
44
  let doc = null;
@@ -77,7 +77,6 @@ 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;
81
80
  let _replacer = null;
82
81
  if (typeof replacer === 'function' || Array.isArray(replacer)) {
83
82
  _replacer = replacer;
@@ -92,7 +91,7 @@ function stringify(value, replacer, options) {
92
91
  options = indent < 1 ? undefined : indent > 8 ? { indent: 8 } : { indent };
93
92
  }
94
93
  if (value === undefined) {
95
- const { keepUndefined } = (_a = options !== null && options !== void 0 ? options : replacer) !== null && _a !== void 0 ? _a : {};
94
+ const { keepUndefined } = options ?? replacer ?? {};
96
95
  if (!keepUndefined)
97
96
  return undefined;
98
97
  }
@@ -10,9 +10,9 @@ export declare class Schema {
10
10
  sortMapEntries: ((a: Pair, b: Pair) => number) | null;
11
11
  tags: Array<CollectionTag | ScalarTag>;
12
12
  toStringOptions: Readonly<ToStringOptions> | null;
13
- [MAP]: CollectionTag;
14
- [SCALAR]: ScalarTag;
15
- [SEQ]: CollectionTag;
13
+ readonly [MAP]: CollectionTag;
14
+ readonly [SCALAR]: ScalarTag;
15
+ readonly [SEQ]: CollectionTag;
16
16
  constructor({ compat, customTags, merge, resolveKnownTags, schema, sortMapEntries, toStringDefaults }: SchemaOptions);
17
17
  clone(): Schema;
18
18
  }
@@ -18,7 +18,7 @@ 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 && toStringDefaults !== void 0 ? toStringDefaults : null;
21
+ this.toStringOptions = 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 });
@@ -0,0 +1,69 @@
1
+ type JsonSchema = boolean | ArraySchema | ObjectSchema | NumberSchema | StringSchema;
2
+ type JsonType = 'array' | 'object' | 'string' | 'number' | 'integer' | 'boolean' | 'null';
3
+ interface CommonSchema {
4
+ type?: JsonType | JsonType[];
5
+ const?: unknown;
6
+ enum?: unknown[];
7
+ format?: string;
8
+ allOf?: JsonSchema[];
9
+ anyOf?: JsonSchema[];
10
+ oneOf?: JsonSchema[];
11
+ not?: JsonSchema;
12
+ if?: JsonSchema;
13
+ then?: JsonSchema;
14
+ else?: JsonSchema;
15
+ $id?: string;
16
+ $defs?: Record<string, JsonSchema>;
17
+ $anchor?: string;
18
+ $dynamicAnchor?: string;
19
+ $ref?: string;
20
+ $dynamicRef?: string;
21
+ $schema?: string;
22
+ $vocabulary?: Record<string, boolean>;
23
+ $comment?: string;
24
+ default?: unknown;
25
+ deprecated?: boolean;
26
+ readOnly?: boolean;
27
+ writeOnly?: boolean;
28
+ title?: string;
29
+ description?: string;
30
+ examples?: unknown[];
31
+ }
32
+ interface ArraySchema extends CommonSchema {
33
+ prefixItems?: JsonSchema[];
34
+ items?: JsonSchema;
35
+ contains?: JsonSchema;
36
+ unevaluatedItems?: JsonSchema;
37
+ maxItems?: number;
38
+ minItems?: number;
39
+ uniqueItems?: boolean;
40
+ maxContains?: number;
41
+ minContains?: number;
42
+ }
43
+ interface ObjectSchema extends CommonSchema {
44
+ properties?: Record<string, JsonSchema>;
45
+ patternProperties?: Record<string, JsonSchema>;
46
+ additionalProperties?: JsonSchema;
47
+ propertyNames?: JsonSchema;
48
+ unevaluatedProperties?: JsonSchema;
49
+ maxProperties?: number;
50
+ minProperties?: number;
51
+ required?: string[];
52
+ dependentRequired?: Record<string, string[]>;
53
+ dependentSchemas?: Record<string, JsonSchema>;
54
+ }
55
+ interface StringSchema extends CommonSchema {
56
+ maxLength?: number;
57
+ minLength?: number;
58
+ patter?: string;
59
+ contentEncoding?: string;
60
+ contentMediaType?: string;
61
+ contentSchema?: JsonSchema;
62
+ }
63
+ interface NumberSchema extends CommonSchema {
64
+ multipleOf?: number;
65
+ maximum?: number;
66
+ exclusiveMaximum?: number;
67
+ minimum?: number;
68
+ exclusiveMinimum?: number;
69
+ }
@@ -25,8 +25,8 @@ declare const tagsByName: {
25
25
  test: RegExp;
26
26
  };
27
27
  };
28
- export declare type TagId = keyof typeof tagsByName;
29
- export declare type Tags = Array<ScalarTag | CollectionTag | TagId>;
28
+ export type TagId = keyof typeof tagsByName;
29
+ export type Tags = Array<ScalarTag | CollectionTag | TagId>;
30
30
  export declare const coreKnownTags: {
31
31
  'tag:yaml.org,2002:binary': ScalarTag;
32
32
  'tag:yaml.org,2002:omap': CollectionTag;
@@ -16,7 +16,7 @@ interface TagBase {
16
16
  * an explicit tag. For most cases, it's unlikely that you'll actually want to
17
17
  * use this, even if you first think you do.
18
18
  */
19
- default: boolean;
19
+ default?: boolean;
20
20
  /**
21
21
  * If a tag has multiple forms that should be parsed and/or stringified
22
22
  * differently, use `format` to identify them.
@@ -8,9 +8,13 @@ export declare class YAMLOMap extends YAMLSeq {
8
8
  key: any;
9
9
  value: any;
10
10
  }, overwrite?: boolean | undefined) => void;
11
- delete: (key: any) => boolean;
12
- get: (key: any, keepScalar?: boolean | undefined) => unknown;
13
- has: (key: any) => boolean;
11
+ delete: (key: unknown) => boolean;
12
+ get: {
13
+ (key: unknown, keepScalar: true): import("../../index.js").Scalar<any> | undefined;
14
+ (key: unknown, keepScalar?: false | undefined): any;
15
+ (key: unknown, keepScalar?: boolean | undefined): any;
16
+ };
17
+ has: (key: unknown) => boolean;
14
18
  set: (key: any, value: any) => void;
15
19
  /**
16
20
  * If `ctx` is given, the return type is actually `Map<unknown, unknown>`,
@@ -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 === null || ctx === void 0 ? void 0 : ctx.onCreate)
27
+ if (ctx?.onCreate)
28
28
  ctx.onCreate(map);
29
29
  for (const pair of this.items) {
30
30
  let key, value;
@@ -6,7 +6,6 @@ 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;
10
9
  if (Node.isSeq(seq)) {
11
10
  for (let i = 0; i < seq.items.length; ++i) {
12
11
  let item = seq.items[i];
@@ -21,7 +20,7 @@ function resolvePairs(seq, onError) {
21
20
  ? `${item.commentBefore}\n${pair.key.commentBefore}`
22
21
  : item.commentBefore;
23
22
  if (item.comment) {
24
- const cn = (_a = pair.value) !== null && _a !== void 0 ? _a : pair.key;
23
+ const cn = pair.value ?? pair.key;
25
24
  cn.comment = cn.comment
26
25
  ? `${item.comment}\n${cn.comment}`
27
26
  : item.comment;
@@ -12,9 +12,13 @@ export declare class YAMLSet<T = unknown> extends YAMLMap<T, Scalar<null> | null
12
12
  key: T;
13
13
  value: Scalar<null> | null;
14
14
  }): void;
15
- get(key?: T, keepPair?: boolean): unknown;
15
+ /**
16
+ * If `keepPair` is `true`, returns the Pair matching `key`.
17
+ * Otherwise, returns the value of that Pair's key.
18
+ */
19
+ get(key: unknown, keepPair?: boolean): any;
16
20
  set(key: T, value: boolean): void;
17
- /** Will throw; `value` must be boolean */
21
+ /** @deprecated Will throw; `value` must be boolean */
18
22
  set(key: T, value: null): void;
19
23
  toJSON(_?: unknown, ctx?: ToJSContext): any;
20
24
  toString(ctx?: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string;
@@ -13,7 +13,8 @@ class YAMLSet extends YAMLMap.YAMLMap {
13
13
  let pair;
14
14
  if (Node.isPair(key))
15
15
  pair = key;
16
- else if (typeof key === 'object' &&
16
+ else if (key &&
17
+ typeof key === 'object' &&
17
18
  'key' in key &&
18
19
  'value' in key &&
19
20
  key.value === null)
@@ -24,6 +25,10 @@ class YAMLSet extends YAMLMap.YAMLMap {
24
25
  if (!prev)
25
26
  this.items.push(pair);
26
27
  }
28
+ /**
29
+ * If `keepPair` is `true`, returns the Pair matching `key`.
30
+ * Otherwise, returns the value of that Pair's key.
31
+ */
27
32
  get(key, keepPair) {
28
33
  const pair = YAMLMap.findPair(this.items, key);
29
34
  return !keepPair && Node.isPair(pair)
@@ -5,7 +5,7 @@ export declare const FOLD_QUOTED = "quoted";
5
5
  * `'block'` prevents more-indented lines from being folded;
6
6
  * `'quoted'` allows for `\` escapes, including escaped newlines
7
7
  */
8
- export declare type FoldMode = 'flow' | 'block' | 'quoted';
8
+ export type FoldMode = 'flow' | 'block' | 'quoted';
9
9
  export interface FoldOptions {
10
10
  /**
11
11
  * Accounts for leading contents on the first line, defaulting to
@@ -1,7 +1,7 @@
1
1
  import type { Document } from '../doc/Document.js';
2
2
  import type { Alias } from '../nodes/Alias.js';
3
3
  import type { ToStringOptions } from '../options.js';
4
- export declare type StringifyContext = {
4
+ export type StringifyContext = {
5
5
  actualString?: boolean;
6
6
  allNullValues?: boolean;
7
7
  anchors: Set<string>;
@@ -13,6 +13,7 @@ export declare type StringifyContext = {
13
13
  indentAtStart?: number;
14
14
  inFlow: boolean | null;
15
15
  inStringifyKey?: boolean;
16
+ flowCollectionPadding: string;
16
17
  options: Readonly<Required<Omit<ToStringOptions, 'collectionStyle' | 'indent'>>>;
17
18
  resolvedAliases?: Set<Alias>;
18
19
  };
@@ -15,6 +15,7 @@ function createStringifyContext(doc, options) {
15
15
  doubleQuotedAsJSON: false,
16
16
  doubleQuotedMinMultiLineLength: 40,
17
17
  falseStr: 'false',
18
+ flowCollectionPadding: true,
18
19
  indentSeq: true,
19
20
  lineWidth: 80,
20
21
  minContentWidth: 20,
@@ -38,6 +39,7 @@ function createStringifyContext(doc, options) {
38
39
  return {
39
40
  anchors: new Set(),
40
41
  doc,
42
+ flowCollectionPadding: opt.flowCollectionPadding ? ' ' : '',
41
43
  indent: '',
42
44
  indentStep: typeof opt.indent === 'number' ? ' '.repeat(opt.indent) : ' ',
43
45
  inFlow,
@@ -45,26 +47,25 @@ function createStringifyContext(doc, options) {
45
47
  };
46
48
  }
47
49
  function getTagObject(tags, item) {
48
- var _a, _b, _c, _d;
49
50
  if (item.tag) {
50
51
  const match = tags.filter(t => t.tag === item.tag);
51
52
  if (match.length > 0)
52
- return (_a = match.find(t => t.format === item.format)) !== null && _a !== void 0 ? _a : match[0];
53
+ return match.find(t => t.format === item.format) ?? match[0];
53
54
  }
54
55
  let tagObj = undefined;
55
56
  let obj;
56
57
  if (Node.isScalar(item)) {
57
58
  obj = item.value;
58
- const match = tags.filter(t => { var _a; return (_a = t.identify) === null || _a === void 0 ? void 0 : _a.call(t, obj); });
59
+ const match = tags.filter(t => t.identify?.(obj));
59
60
  tagObj =
60
- (_b = match.find(t => t.format === item.format)) !== null && _b !== void 0 ? _b : match.find(t => !t.format);
61
+ match.find(t => t.format === item.format) ?? match.find(t => !t.format);
61
62
  }
62
63
  else {
63
64
  obj = item;
64
65
  tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
65
66
  }
66
67
  if (!tagObj) {
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
+ const name = obj?.constructor?.name ?? typeof obj;
68
69
  throw new Error(`Tag not resolved for ${name} value`);
69
70
  }
70
71
  return tagObj;
@@ -85,13 +86,12 @@ function stringifyProps(node, tagObj, { anchors: anchors$1, doc }) {
85
86
  return props.join(' ');
86
87
  }
87
88
  function stringify(item, ctx, onComment, onChompKeep) {
88
- var _a, _b;
89
89
  if (Node.isPair(item))
90
90
  return item.toString(ctx, onComment, onChompKeep);
91
91
  if (Node.isAlias(item)) {
92
92
  if (ctx.doc.directives)
93
93
  return item.toString(ctx);
94
- if ((_a = ctx.resolvedAliases) === null || _a === void 0 ? void 0 : _a.has(item)) {
94
+ if (ctx.resolvedAliases?.has(item)) {
95
95
  throw new TypeError(`Cannot stringify circular structure without alias nodes`);
96
96
  }
97
97
  else {
@@ -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 = ((_b = ctx.indentAtStart) !== null && _b !== void 0 ? _b : 0) + props.length + 1;
113
+ ctx.indentAtStart = (ctx.indentAtStart ?? 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)
@@ -6,8 +6,7 @@ var stringify = require('./stringify.js');
6
6
  var stringifyComment = require('./stringifyComment.js');
7
7
 
8
8
  function stringifyCollection(collection, ctx, options) {
9
- var _a;
10
- const flow = (_a = ctx.inFlow) !== null && _a !== void 0 ? _a : collection.flow;
9
+ const flow = ctx.inFlow ?? collection.flow;
11
10
  const stringify = flow ? stringifyFlowCollection : stringifyBlockCollection;
12
11
  return stringify(collection, ctx, options);
13
12
  }
@@ -63,7 +62,7 @@ function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, fl
63
62
  return str;
64
63
  }
65
64
  function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemIndent, onComment }) {
66
- const { indent, indentStep, options: { commentString } } = ctx;
65
+ const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;
67
66
  itemIndent += indentStep;
68
67
  const itemCtx = Object.assign({}, ctx, {
69
68
  indent: itemIndent,
@@ -132,11 +131,11 @@ function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemInden
132
131
  str += `\n${indent}${end}`;
133
132
  }
134
133
  else {
135
- str = `${start} ${lines.join(' ')} ${end}`;
134
+ str = `${start}${fcPadding}${lines.join(' ')}${fcPadding}${end}`;
136
135
  }
137
136
  }
138
137
  if (comment) {
139
- str += stringifyComment.lineComment(str, commentString(comment), indent);
138
+ str += stringifyComment.lineComment(str, indent, commentString(comment));
140
139
  if (onComment)
141
140
  onComment();
142
141
  }
@@ -5,7 +5,6 @@ var stringify = require('./stringify.js');
5
5
  var stringifyComment = require('./stringifyComment.js');
6
6
 
7
7
  function stringifyDocument(doc, options) {
8
- var _a;
9
8
  const lines = [];
10
9
  let hasDirectives = options.directives === true;
11
10
  if (options.directives !== false && doc.directives) {
@@ -57,7 +56,7 @@ function stringifyDocument(doc, options) {
57
56
  else {
58
57
  lines.push(stringify.stringify(doc.contents, ctx));
59
58
  }
60
- if ((_a = doc.directives) === null || _a === void 0 ? void 0 : _a.docEnd) {
59
+ if (doc.directives?.docEnd) {
61
60
  if (doc.comment) {
62
61
  const cs = commentString(doc.comment);
63
62
  if (cs.includes('\n')) {