projen 0.84.7 → 0.84.9

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 (162) hide show
  1. package/.jsii +263 -220
  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-backport.js +1 -1
  48. package/lib/github/pull-request-lint.js +1 -1
  49. package/lib/github/stale.js +1 -1
  50. package/lib/github/task-workflow-job.js +1 -1
  51. package/lib/github/task-workflow.js +1 -1
  52. package/lib/github/workflow-actions.js +1 -1
  53. package/lib/github/workflow-jobs.js +1 -1
  54. package/lib/github/workflow-steps.js +1 -1
  55. package/lib/github/workflows.js +1 -1
  56. package/lib/gitlab/configuration-model.d.ts +2 -0
  57. package/lib/gitlab/configuration-model.js +1 -1
  58. package/lib/gitlab/configuration.d.ts +5 -1
  59. package/lib/gitlab/configuration.js +4 -2
  60. package/lib/gitlab/gitlab-configuration.js +1 -1
  61. package/lib/gitlab/nested-configuration.js +1 -1
  62. package/lib/gitpod.js +1 -1
  63. package/lib/ignore-file.js +1 -1
  64. package/lib/ini.js +1 -1
  65. package/lib/java/java-project.js +1 -1
  66. package/lib/java/junit.js +1 -1
  67. package/lib/java/maven-compile.js +1 -1
  68. package/lib/java/maven-packaging.js +1 -1
  69. package/lib/java/maven-sample.js +1 -1
  70. package/lib/java/pom.js +1 -1
  71. package/lib/java/projenrc.js +1 -1
  72. package/lib/javascript/bundler.js +1 -1
  73. package/lib/javascript/eslint.js +1 -1
  74. package/lib/javascript/jest.js +4 -4
  75. package/lib/javascript/license-checker.js +1 -1
  76. package/lib/javascript/node-package.js +1 -1
  77. package/lib/javascript/node-project.js +1 -1
  78. package/lib/javascript/npm-config.js +1 -1
  79. package/lib/javascript/prettier.js +1 -1
  80. package/lib/javascript/projenrc.js +1 -1
  81. package/lib/javascript/typescript-config.js +2 -2
  82. package/lib/javascript/upgrade-dependencies.js +2 -2
  83. package/lib/javascript/yarnrc.js +1 -1
  84. package/lib/json-patch.js +1 -1
  85. package/lib/json.js +1 -1
  86. package/lib/license.js +1 -1
  87. package/lib/logger.js +1 -1
  88. package/lib/makefile.js +1 -1
  89. package/lib/object-file.js +1 -1
  90. package/lib/project-build.js +1 -1
  91. package/lib/project-tree.js +1 -1
  92. package/lib/project.js +1 -1
  93. package/lib/projects.js +1 -1
  94. package/lib/projenrc-json.js +2 -2
  95. package/lib/projenrc.js +1 -1
  96. package/lib/python/pip.js +1 -1
  97. package/lib/python/poetry.js +2 -2
  98. package/lib/python/projenrc.js +1 -1
  99. package/lib/python/pytest-sample.js +1 -1
  100. package/lib/python/pytest.js +1 -1
  101. package/lib/python/python-project.js +1 -1
  102. package/lib/python/python-sample.js +1 -1
  103. package/lib/python/requirements-file.js +1 -1
  104. package/lib/python/setuppy.js +1 -1
  105. package/lib/python/setuptools.js +1 -1
  106. package/lib/python/venv.js +1 -1
  107. package/lib/readme.js +1 -1
  108. package/lib/release/publisher.js +1 -1
  109. package/lib/release/release-trigger.js +1 -1
  110. package/lib/release/release.js +1 -1
  111. package/lib/renovatebot.js +1 -1
  112. package/lib/sample-file.js +2 -2
  113. package/lib/semver.js +1 -1
  114. package/lib/source-code.js +1 -1
  115. package/lib/task-runtime.js +1 -1
  116. package/lib/task.js +1 -1
  117. package/lib/tasks.js +1 -1
  118. package/lib/testing.js +1 -1
  119. package/lib/textfile.js +1 -1
  120. package/lib/toml.js +1 -1
  121. package/lib/typescript/projenrc-ts.js +1 -1
  122. package/lib/typescript/projenrc.js +1 -1
  123. package/lib/typescript/typescript-typedoc.js +1 -1
  124. package/lib/typescript/typescript.js +8 -8
  125. package/lib/version.js +2 -2
  126. package/lib/vscode/devcontainer.js +1 -1
  127. package/lib/vscode/extensions.js +1 -1
  128. package/lib/vscode/launch-config.js +1 -1
  129. package/lib/vscode/settings.js +1 -1
  130. package/lib/vscode/vscode.js +1 -1
  131. package/lib/web/next.js +3 -3
  132. package/lib/web/postcss.js +1 -1
  133. package/lib/web/react.js +4 -4
  134. package/lib/web/tailwind.js +1 -1
  135. package/lib/xmlfile.js +1 -1
  136. package/lib/yaml.js +1 -1
  137. package/node_modules/yaml/browser/dist/compose/compose-collection.js +15 -3
  138. package/node_modules/yaml/browser/dist/compose/compose-node.js +1 -1
  139. package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +1 -1
  140. package/node_modules/yaml/browser/dist/compose/resolve-props.js +3 -3
  141. package/node_modules/yaml/browser/dist/nodes/Collection.js +0 -1
  142. package/node_modules/yaml/browser/dist/parse/lexer.js +2 -6
  143. package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +2 -0
  144. package/node_modules/yaml/dist/cli.d.ts +1 -2
  145. package/node_modules/yaml/dist/cli.mjs +8 -4
  146. package/node_modules/yaml/dist/compose/compose-collection.d.ts +7 -1
  147. package/node_modules/yaml/dist/compose/compose-collection.js +15 -3
  148. package/node_modules/yaml/dist/compose/compose-node.d.ts +1 -0
  149. package/node_modules/yaml/dist/compose/compose-node.js +1 -1
  150. package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +1 -2
  151. package/node_modules/yaml/dist/compose/resolve-block-map.js +1 -1
  152. package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +1 -1
  153. package/node_modules/yaml/dist/compose/resolve-props.d.ts +1 -1
  154. package/node_modules/yaml/dist/compose/resolve-props.js +3 -3
  155. package/node_modules/yaml/dist/nodes/Collection.d.ts +0 -1
  156. package/node_modules/yaml/dist/nodes/Collection.js +0 -1
  157. package/node_modules/yaml/dist/nodes/identity.d.ts +1 -1
  158. package/node_modules/yaml/dist/parse/lexer.js +2 -6
  159. package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +3 -3
  160. package/node_modules/yaml/dist/stringify/foldFlowLines.js +2 -0
  161. package/node_modules/yaml/package.json +1 -1
  162. package/package.json +1 -1
@@ -23,10 +23,23 @@ function resolveCollection(CN, ctx, token, onError, tagName, tag) {
23
23
  coll.tag = tagName;
24
24
  return coll;
25
25
  }
26
- function composeCollection(CN, ctx, token, tagToken, onError) {
26
+ function composeCollection(CN, ctx, token, props, onError) {
27
+ const tagToken = props.tag;
27
28
  const tagName = !tagToken
28
29
  ? null
29
30
  : ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg));
31
+ if (token.type === 'block-seq') {
32
+ const { anchor, newlineAfterProp: nl } = props;
33
+ const lastProp = anchor && tagToken
34
+ ? anchor.offset > tagToken.offset
35
+ ? anchor
36
+ : tagToken
37
+ : (anchor ?? tagToken);
38
+ if (lastProp && (!nl || nl.offset < lastProp.offset)) {
39
+ const message = 'Missing newline after block sequence props';
40
+ onError(lastProp, 'MISSING_CHAR', message);
41
+ }
42
+ }
30
43
  const expType = token.type === 'block-map'
31
44
  ? 'map'
32
45
  : token.type === 'block-seq'
@@ -40,8 +53,7 @@ function composeCollection(CN, ctx, token, tagToken, onError) {
40
53
  !tagName ||
41
54
  tagName === '!' ||
42
55
  (tagName === YAMLMap.tagName && expType === 'map') ||
43
- (tagName === YAMLSeq.tagName && expType === 'seq') ||
44
- !expType) {
56
+ (tagName === YAMLSeq.tagName && expType === 'seq')) {
45
57
  return resolveCollection(CN, ctx, token, onError, tagName);
46
58
  }
47
59
  let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);
@@ -26,7 +26,7 @@ function composeNode(ctx, token, props, onError) {
26
26
  case 'block-map':
27
27
  case 'block-seq':
28
28
  case 'flow-collection':
29
- node = composeCollection(CN, ctx, token, tag, onError);
29
+ node = composeCollection(CN, ctx, token, props, onError);
30
30
  if (anchor)
31
31
  node.anchor = anchor.source.substring(1);
32
32
  break;
@@ -42,7 +42,7 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, ta
42
42
  }
43
43
  continue;
44
44
  }
45
- if (keyProps.hasNewlineAfterProp || containsNewline(key)) {
45
+ if (keyProps.newlineAfterProp || containsNewline(key)) {
46
46
  onError(key ?? start[start.length - 1], 'MULTILINE_IMPLICIT_KEY', 'Implicit keys need to be on a single line');
47
47
  }
48
48
  }
@@ -5,11 +5,11 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
5
5
  let comment = '';
6
6
  let commentSep = '';
7
7
  let hasNewline = false;
8
- let hasNewlineAfterProp = false;
9
8
  let reqSpace = false;
10
9
  let tab = null;
11
10
  let anchor = null;
12
11
  let tag = null;
12
+ let newlineAfterProp = null;
13
13
  let comma = null;
14
14
  let found = null;
15
15
  let start = null;
@@ -63,7 +63,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
63
63
  atNewline = true;
64
64
  hasNewline = true;
65
65
  if (anchor || tag)
66
- hasNewlineAfterProp = true;
66
+ newlineAfterProp = token;
67
67
  hasSpace = true;
68
68
  break;
69
69
  case 'anchor':
@@ -137,9 +137,9 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
137
137
  spaceBefore,
138
138
  comment,
139
139
  hasNewline,
140
- hasNewlineAfterProp,
141
140
  anchor,
142
141
  tag,
142
+ newlineAfterProp,
143
143
  end,
144
144
  start: start ?? end
145
145
  };
@@ -143,6 +143,5 @@ class Collection extends NodeBase {
143
143
  }
144
144
  }
145
145
  }
146
- Collection.maxFlowStringSingleLineLength = 60;
147
146
 
148
147
  export { Collection, collectionFromPath, isEmptyPath };
@@ -290,15 +290,11 @@ class Lexer {
290
290
  if (!this.atEnd && !this.hasChars(4))
291
291
  return this.setNext('line-start');
292
292
  const s = this.peek(3);
293
- if (s === '---' && isEmpty(this.charAt(3))) {
293
+ if ((s === '---' || s === '...') && isEmpty(this.charAt(3))) {
294
294
  yield* this.pushCount(3);
295
295
  this.indentValue = 0;
296
296
  this.indentNext = 0;
297
- return 'doc';
298
- }
299
- else if (s === '...' && isEmpty(this.charAt(3))) {
300
- yield* this.pushCount(3);
301
- return 'stream';
297
+ return s === '---' ? 'doc' : 'stream';
302
298
  }
303
299
  }
304
300
  this.indentValue = yield* this.pushSpaces(false);
@@ -9,6 +9,8 @@ const FOLD_QUOTED = 'quoted';
9
9
  function foldFlowLines(text, indent, mode = 'flow', { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
10
10
  if (!lineWidth || lineWidth < 0)
11
11
  return text;
12
+ if (lineWidth < minContentWidth)
13
+ minContentWidth = 0;
12
14
  const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
13
15
  if (text.length <= endStep)
14
16
  return text;
@@ -1,5 +1,4 @@
1
- /// <reference types="node" />
2
- export declare const help = "yaml: A command-line YAML processor and inspector\n\nReads stdin and writes output to stdout and errors & warnings to stderr.\n\nUsage:\n yaml Process a YAML stream, outputting it as YAML\n yaml cst Parse the CST of a YAML stream\n yaml lex Parse the lexical tokens of a YAML stream\n yaml valid Validate a YAML stream, returning 0 on success\n\nOptions:\n --help, -h Show this message.\n --json, -j Output JSON.\n\nAdditional options for bare \"yaml\" command:\n --doc, -d Output pretty-printed JS Document objects.\n --single, -1 Require the input to consist of a single YAML document.\n --strict, -s Stop on errors.\n --visit, -v Apply a visitor to each document (requires a path to import)\n --yaml 1.1 Set the YAML version. (default: 1.2)";
1
+ export declare const help = "yaml: A command-line YAML processor and inspector\n\nReads stdin and writes output to stdout and errors & warnings to stderr.\n\nUsage:\n yaml Process a YAML stream, outputting it as YAML\n yaml cst Parse the CST of a YAML stream\n yaml lex Parse the lexical tokens of a YAML stream\n yaml valid Validate a YAML stream, returning 0 on success\n\nOptions:\n --help, -h Show this message.\n --json, -j Output JSON.\n --indent 2 Output pretty-printed data, indented by the given number of spaces.\n\nAdditional options for bare \"yaml\" command:\n --doc, -d Output pretty-printed JS Document objects.\n --single, -1 Require the input to consist of a single YAML document.\n --strict, -s Stop on errors.\n --visit, -v Apply a visitor to each document (requires a path to import)\n --yaml 1.1 Set the YAML version. (default: 1.2)";
3
2
  export declare class UserError extends Error {
4
3
  static ARGS: number;
5
4
  static SINGLE: number;
@@ -22,6 +22,7 @@ Usage:
22
22
  Options:
23
23
  --help, -h Show this message.
24
24
  --json, -j Output JSON.
25
+ --indent 2 Output pretty-printed data, indented by the given number of spaces.
25
26
 
26
27
  Additional options for bare "yaml" command:
27
28
  --doc, -d Output pretty-printed JS Document objects.
@@ -46,6 +47,7 @@ async function cli(stdin, done, argv) {
46
47
  options: {
47
48
  doc: { type: 'boolean', short: 'd' },
48
49
  help: { type: 'boolean', short: 'h' },
50
+ indent: { type: 'string', short: 'i' },
49
51
  json: { type: 'boolean', short: 'j' },
50
52
  single: { type: 'boolean', short: '1' },
51
53
  strict: { type: 'boolean', short: 's' },
@@ -58,6 +60,7 @@ async function cli(stdin, done, argv) {
58
60
  return done(new UserError(UserError.ARGS, error.message));
59
61
  }
60
62
  const { positionals: [mode], values: opt } = args;
63
+ let indent = Number(opt.indent);
61
64
  stdin.setEncoding('utf-8');
62
65
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
63
66
  switch (opt.help || mode) {
@@ -82,7 +85,7 @@ async function cli(stdin, done, argv) {
82
85
  for (const tok of lexer.lex('', false))
83
86
  add(tok);
84
87
  if (opt.json)
85
- console.log(JSON.stringify(data));
88
+ console.log(JSON.stringify(data, null, indent));
86
89
  done();
87
90
  });
88
91
  break;
@@ -104,7 +107,7 @@ async function cli(stdin, done, argv) {
104
107
  for (const tok of parser.parse('', false))
105
108
  add(tok);
106
109
  if (opt.json)
107
- console.log(JSON.stringify(data));
110
+ console.log(JSON.stringify(data, null, indent));
108
111
  done();
109
112
  });
110
113
  break;
@@ -153,7 +156,8 @@ async function cli(stdin, done, argv) {
153
156
  if (reqDocEnd)
154
157
  console.log('...');
155
158
  try {
156
- const str = String(doc);
159
+ indent || (indent = 2);
160
+ const str = doc.toString({ indent });
157
161
  console.log(str.endsWith('\n') ? str.slice(0, -1) : str);
158
162
  }
159
163
  catch (error) {
@@ -181,7 +185,7 @@ async function cli(stdin, done, argv) {
181
185
  return done(new UserError(UserError.SINGLE, 'Input stream contained no documents'));
182
186
  }
183
187
  if (mode !== 'valid' && opt.json) {
184
- console.log(JSON.stringify(opt.single ? data[0] : data));
188
+ console.log(JSON.stringify(opt.single ? data[0] : data, null, indent));
185
189
  }
186
190
  done();
187
191
  });
@@ -2,4 +2,10 @@ import type { ParsedNode } from '../nodes/Node.js';
2
2
  import type { BlockMap, BlockSequence, FlowCollection, SourceToken } from '../parse/cst.js';
3
3
  import type { ComposeContext, ComposeNode } from './compose-node.js';
4
4
  import type { ComposeErrorHandler } from './composer.js';
5
- export declare function composeCollection(CN: ComposeNode, ctx: ComposeContext, token: BlockMap | BlockSequence | FlowCollection, tagToken: SourceToken | null, onError: ComposeErrorHandler): ParsedNode;
5
+ interface Props {
6
+ anchor: SourceToken | null;
7
+ tag: SourceToken | null;
8
+ newlineAfterProp: SourceToken | null;
9
+ }
10
+ export declare function composeCollection(CN: ComposeNode, ctx: ComposeContext, token: BlockMap | BlockSequence | FlowCollection, props: Props, onError: ComposeErrorHandler): ParsedNode;
11
+ export {};
@@ -25,10 +25,23 @@ function resolveCollection(CN, ctx, token, onError, tagName, tag) {
25
25
  coll.tag = tagName;
26
26
  return coll;
27
27
  }
28
- function composeCollection(CN, ctx, token, tagToken, onError) {
28
+ function composeCollection(CN, ctx, token, props, onError) {
29
+ const tagToken = props.tag;
29
30
  const tagName = !tagToken
30
31
  ? null
31
32
  : ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg));
33
+ if (token.type === 'block-seq') {
34
+ const { anchor, newlineAfterProp: nl } = props;
35
+ const lastProp = anchor && tagToken
36
+ ? anchor.offset > tagToken.offset
37
+ ? anchor
38
+ : tagToken
39
+ : (anchor ?? tagToken);
40
+ if (lastProp && (!nl || nl.offset < lastProp.offset)) {
41
+ const message = 'Missing newline after block sequence props';
42
+ onError(lastProp, 'MISSING_CHAR', message);
43
+ }
44
+ }
32
45
  const expType = token.type === 'block-map'
33
46
  ? 'map'
34
47
  : token.type === 'block-seq'
@@ -42,8 +55,7 @@ function composeCollection(CN, ctx, token, tagToken, onError) {
42
55
  !tagName ||
43
56
  tagName === '!' ||
44
57
  (tagName === YAMLMap.YAMLMap.tagName && expType === 'map') ||
45
- (tagName === YAMLSeq.YAMLSeq.tagName && expType === 'seq') ||
46
- !expType) {
58
+ (tagName === YAMLSeq.YAMLSeq.tagName && expType === 'seq')) {
47
59
  return resolveCollection(CN, ctx, token, onError, tagName);
48
60
  }
49
61
  let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);
@@ -15,6 +15,7 @@ interface Props {
15
15
  comment: string;
16
16
  anchor: SourceToken | null;
17
17
  tag: SourceToken | null;
18
+ newlineAfterProp: SourceToken | null;
18
19
  end: number;
19
20
  }
20
21
  declare const CN: {
@@ -28,7 +28,7 @@ function composeNode(ctx, token, props, onError) {
28
28
  case 'block-map':
29
29
  case 'block-seq':
30
30
  case 'flow-collection':
31
- node = composeCollection.composeCollection(CN, ctx, token, tag, onError);
31
+ node = composeCollection.composeCollection(CN, ctx, token, props, onError);
32
32
  if (anchor)
33
33
  node.anchor = anchor.source.substring(1);
34
34
  break;
@@ -1,7 +1,6 @@
1
- import type { ParsedNode } from '../nodes/Node.js';
2
1
  import { YAMLMap } from '../nodes/YAMLMap.js';
3
2
  import type { BlockMap } from '../parse/cst.js';
4
3
  import { CollectionTag } from '../schema/types.js';
5
4
  import type { ComposeContext, ComposeNode } from './compose-node.js';
6
5
  import type { ComposeErrorHandler } from './composer.js';
7
- export declare function resolveBlockMap({ composeNode, composeEmptyNode }: ComposeNode, ctx: ComposeContext, bm: BlockMap, onError: ComposeErrorHandler, tag?: CollectionTag): YAMLMap.Parsed<ParsedNode, ParsedNode | null>;
6
+ export declare function resolveBlockMap({ composeNode, composeEmptyNode }: ComposeNode, ctx: ComposeContext, bm: BlockMap, onError: ComposeErrorHandler, tag?: CollectionTag): YAMLMap.Parsed;
@@ -44,7 +44,7 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, ta
44
44
  }
45
45
  continue;
46
46
  }
47
- if (keyProps.hasNewlineAfterProp || utilContainsNewline.containsNewline(key)) {
47
+ if (keyProps.newlineAfterProp || utilContainsNewline.containsNewline(key)) {
48
48
  onError(key ?? start[start.length - 1], 'MULTILINE_IMPLICIT_KEY', 'Implicit keys need to be on a single line');
49
49
  }
50
50
  }
@@ -3,4 +3,4 @@ import type { BlockSequence } from '../parse/cst.js';
3
3
  import { CollectionTag } from '../schema/types.js';
4
4
  import type { ComposeContext, ComposeNode } from './compose-node.js';
5
5
  import type { ComposeErrorHandler } from './composer.js';
6
- export declare function resolveBlockSeq({ composeNode, composeEmptyNode }: ComposeNode, ctx: ComposeContext, bs: BlockSequence, onError: ComposeErrorHandler, tag?: CollectionTag): YAMLSeq.Parsed<import("../index.js").ParsedNode>;
6
+ export declare function resolveBlockSeq({ composeNode, composeEmptyNode }: ComposeNode, ctx: ComposeContext, bs: BlockSequence, onError: ComposeErrorHandler, tag?: CollectionTag): YAMLSeq.Parsed;
@@ -15,9 +15,9 @@ export declare function resolveProps(tokens: SourceToken[], { flow, indicator, n
15
15
  spaceBefore: boolean;
16
16
  comment: string;
17
17
  hasNewline: boolean;
18
- hasNewlineAfterProp: boolean;
19
18
  anchor: SourceToken | null;
20
19
  tag: SourceToken | null;
20
+ newlineAfterProp: SourceToken | null;
21
21
  end: number;
22
22
  start: number;
23
23
  };
@@ -7,11 +7,11 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
7
7
  let comment = '';
8
8
  let commentSep = '';
9
9
  let hasNewline = false;
10
- let hasNewlineAfterProp = false;
11
10
  let reqSpace = false;
12
11
  let tab = null;
13
12
  let anchor = null;
14
13
  let tag = null;
14
+ let newlineAfterProp = null;
15
15
  let comma = null;
16
16
  let found = null;
17
17
  let start = null;
@@ -65,7 +65,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
65
65
  atNewline = true;
66
66
  hasNewline = true;
67
67
  if (anchor || tag)
68
- hasNewlineAfterProp = true;
68
+ newlineAfterProp = token;
69
69
  hasSpace = true;
70
70
  break;
71
71
  case 'anchor':
@@ -139,9 +139,9 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
139
139
  spaceBefore,
140
140
  comment,
141
141
  hasNewline,
142
- hasNewlineAfterProp,
143
142
  anchor,
144
143
  tag,
144
+ newlineAfterProp,
145
145
  end,
146
146
  start: start ?? end
147
147
  };
@@ -4,7 +4,6 @@ import { NodeBase } from './Node.js';
4
4
  export declare function collectionFromPath(schema: Schema, path: unknown[], value: unknown): import("./Node.js").Node;
5
5
  export declare const isEmptyPath: (path: Iterable<unknown> | null | undefined) => path is null | undefined;
6
6
  export declare abstract class Collection extends NodeBase {
7
- static maxFlowStringSingleLineLength: number;
8
7
  schema: Schema | undefined;
9
8
  [NODE_TYPE]: symbol;
10
9
  items: unknown[];
@@ -145,7 +145,6 @@ class Collection extends Node.NodeBase {
145
145
  }
146
146
  }
147
147
  }
148
- Collection.maxFlowStringSingleLineLength = 60;
149
148
 
150
149
  exports.Collection = Collection;
151
150
  exports.collectionFromPath = collectionFromPath;
@@ -13,7 +13,7 @@ export declare const SCALAR: unique symbol;
13
13
  export declare const SEQ: unique symbol;
14
14
  export declare const NODE_TYPE: unique symbol;
15
15
  export declare const isAlias: (node: any) => node is Alias;
16
- export declare const isDocument: <T extends Node = Node>(node: any) => node is Document<T, true>;
16
+ export declare const isDocument: <T extends Node = Node>(node: any) => node is Document<T>;
17
17
  export declare const isMap: <K = unknown, V = unknown>(node: any) => node is YAMLMap<K, V>;
18
18
  export declare const isPair: <K = unknown, V = unknown>(node: any) => node is Pair<K, V>;
19
19
  export declare const isScalar: <T = unknown>(node: any) => node is Scalar<T>;
@@ -292,15 +292,11 @@ class Lexer {
292
292
  if (!this.atEnd && !this.hasChars(4))
293
293
  return this.setNext('line-start');
294
294
  const s = this.peek(3);
295
- if (s === '---' && isEmpty(this.charAt(3))) {
295
+ if ((s === '---' || s === '...') && isEmpty(this.charAt(3))) {
296
296
  yield* this.pushCount(3);
297
297
  this.indentValue = 0;
298
298
  this.indentNext = 0;
299
- return 'doc';
300
- }
301
- else if (s === '...' && isEmpty(this.charAt(3))) {
302
- yield* this.pushCount(3);
303
- return 'stream';
299
+ return s === '---' ? 'doc' : 'stream';
304
300
  }
305
301
  }
306
302
  this.indentValue = yield* this.pushSpaces(false);
@@ -9,12 +9,12 @@ export declare class YAMLOMap extends YAMLSeq {
9
9
  add: (pair: import("../../index.js").Pair<any, any> | {
10
10
  key: any;
11
11
  value: any;
12
- }, overwrite?: boolean | undefined) => void;
12
+ }, overwrite?: boolean) => void;
13
13
  delete: (key: unknown) => boolean;
14
14
  get: {
15
15
  (key: unknown, keepScalar: true): import("../../index.js").Scalar<any> | undefined;
16
- (key: unknown, keepScalar?: false | undefined): any;
17
- (key: unknown, keepScalar?: boolean | undefined): any;
16
+ (key: unknown, keepScalar?: false): any;
17
+ (key: unknown, keepScalar?: boolean): any;
18
18
  };
19
19
  has: (key: unknown) => boolean;
20
20
  set: (key: any, value: any) => void;
@@ -11,6 +11,8 @@ const FOLD_QUOTED = 'quoted';
11
11
  function foldFlowLines(text, indent, mode = 'flow', { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
12
12
  if (!lineWidth || lineWidth < 0)
13
13
  return text;
14
+ if (lineWidth < minContentWidth)
15
+ minContentWidth = 0;
14
16
  const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
15
17
  if (text.length <= endStep)
16
18
  return text;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yaml",
3
- "version": "2.4.5",
3
+ "version": "2.5.0",
4
4
  "license": "ISC",
5
5
  "author": "Eemeli Aro <eemeli@gmail.com>",
6
6
  "repository": "github:eemeli/yaml",
package/package.json CHANGED
@@ -130,7 +130,7 @@
130
130
  "publishConfig": {
131
131
  "access": "public"
132
132
  },
133
- "version": "0.84.7",
133
+ "version": "0.84.9",
134
134
  "jest": {
135
135
  "coverageProvider": "v8",
136
136
  "coverageReporters": [