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.
- package/.jsii +263 -220
- package/lib/awscdk/auto-discover.js +5 -5
- package/lib/awscdk/awscdk-app-java.js +1 -1
- package/lib/awscdk/awscdk-app-py.js +1 -1
- package/lib/awscdk/awscdk-app-ts.js +1 -1
- package/lib/awscdk/awscdk-construct.js +2 -2
- package/lib/awscdk/awscdk-deps-java.js +1 -1
- package/lib/awscdk/awscdk-deps-js.js +1 -1
- package/lib/awscdk/awscdk-deps-py.js +1 -1
- package/lib/awscdk/awscdk-deps.js +1 -1
- package/lib/awscdk/cdk-config.js +1 -1
- package/lib/awscdk/cdk-tasks.js +1 -1
- package/lib/awscdk/integration-test.js +1 -1
- package/lib/awscdk/lambda-extension.js +1 -1
- package/lib/awscdk/lambda-function.js +2 -2
- package/lib/build/build-workflow.js +1 -1
- package/lib/cdk/auto-discover-base.js +2 -2
- package/lib/cdk/construct-lib.js +1 -1
- package/lib/cdk/integration-test-base.js +1 -1
- package/lib/cdk/jsii-docgen.js +1 -1
- package/lib/cdk/jsii-project.js +1 -1
- package/lib/cdk8s/auto-discover.js +2 -2
- package/lib/cdk8s/cdk8s-app-py.js +1 -1
- package/lib/cdk8s/cdk8s-app-ts.js +1 -1
- package/lib/cdk8s/cdk8s-construct.js +1 -1
- package/lib/cdk8s/cdk8s-deps-py.js +1 -1
- package/lib/cdk8s/cdk8s-deps.js +1 -1
- package/lib/cdk8s/integration-test.js +1 -1
- package/lib/cdktf/cdktf-construct.js +1 -1
- package/lib/circleci/circleci.js +1 -1
- package/lib/component.js +1 -1
- package/lib/dependencies.js +1 -1
- package/lib/dev-env.js +1 -1
- package/lib/docker-compose/docker-compose-service.js +1 -1
- package/lib/docker-compose/docker-compose.js +1 -1
- package/lib/file.js +1 -1
- package/lib/gitattributes.js +1 -1
- package/lib/github/actions-provider.js +1 -1
- package/lib/github/auto-approve.js +1 -1
- package/lib/github/auto-merge.js +1 -1
- package/lib/github/dependabot.js +1 -1
- package/lib/github/github-credentials.js +1 -1
- package/lib/github/github-project.js +1 -1
- package/lib/github/github.js +1 -1
- package/lib/github/mergify.js +1 -1
- package/lib/github/pr-template.js +1 -1
- package/lib/github/pull-request-backport.js +1 -1
- package/lib/github/pull-request-lint.js +1 -1
- package/lib/github/stale.js +1 -1
- package/lib/github/task-workflow-job.js +1 -1
- package/lib/github/task-workflow.js +1 -1
- package/lib/github/workflow-actions.js +1 -1
- package/lib/github/workflow-jobs.js +1 -1
- package/lib/github/workflow-steps.js +1 -1
- package/lib/github/workflows.js +1 -1
- package/lib/gitlab/configuration-model.d.ts +2 -0
- package/lib/gitlab/configuration-model.js +1 -1
- package/lib/gitlab/configuration.d.ts +5 -1
- package/lib/gitlab/configuration.js +4 -2
- package/lib/gitlab/gitlab-configuration.js +1 -1
- package/lib/gitlab/nested-configuration.js +1 -1
- package/lib/gitpod.js +1 -1
- package/lib/ignore-file.js +1 -1
- package/lib/ini.js +1 -1
- package/lib/java/java-project.js +1 -1
- package/lib/java/junit.js +1 -1
- package/lib/java/maven-compile.js +1 -1
- package/lib/java/maven-packaging.js +1 -1
- package/lib/java/maven-sample.js +1 -1
- package/lib/java/pom.js +1 -1
- package/lib/java/projenrc.js +1 -1
- package/lib/javascript/bundler.js +1 -1
- package/lib/javascript/eslint.js +1 -1
- package/lib/javascript/jest.js +4 -4
- package/lib/javascript/license-checker.js +1 -1
- package/lib/javascript/node-package.js +1 -1
- package/lib/javascript/node-project.js +1 -1
- package/lib/javascript/npm-config.js +1 -1
- package/lib/javascript/prettier.js +1 -1
- package/lib/javascript/projenrc.js +1 -1
- package/lib/javascript/typescript-config.js +2 -2
- package/lib/javascript/upgrade-dependencies.js +2 -2
- package/lib/javascript/yarnrc.js +1 -1
- package/lib/json-patch.js +1 -1
- package/lib/json.js +1 -1
- package/lib/license.js +1 -1
- package/lib/logger.js +1 -1
- package/lib/makefile.js +1 -1
- package/lib/object-file.js +1 -1
- package/lib/project-build.js +1 -1
- package/lib/project-tree.js +1 -1
- package/lib/project.js +1 -1
- package/lib/projects.js +1 -1
- package/lib/projenrc-json.js +2 -2
- package/lib/projenrc.js +1 -1
- package/lib/python/pip.js +1 -1
- package/lib/python/poetry.js +2 -2
- package/lib/python/projenrc.js +1 -1
- package/lib/python/pytest-sample.js +1 -1
- package/lib/python/pytest.js +1 -1
- package/lib/python/python-project.js +1 -1
- package/lib/python/python-sample.js +1 -1
- package/lib/python/requirements-file.js +1 -1
- package/lib/python/setuppy.js +1 -1
- package/lib/python/setuptools.js +1 -1
- package/lib/python/venv.js +1 -1
- package/lib/readme.js +1 -1
- package/lib/release/publisher.js +1 -1
- package/lib/release/release-trigger.js +1 -1
- package/lib/release/release.js +1 -1
- package/lib/renovatebot.js +1 -1
- package/lib/sample-file.js +2 -2
- package/lib/semver.js +1 -1
- package/lib/source-code.js +1 -1
- package/lib/task-runtime.js +1 -1
- package/lib/task.js +1 -1
- package/lib/tasks.js +1 -1
- package/lib/testing.js +1 -1
- package/lib/textfile.js +1 -1
- package/lib/toml.js +1 -1
- package/lib/typescript/projenrc-ts.js +1 -1
- package/lib/typescript/projenrc.js +1 -1
- package/lib/typescript/typescript-typedoc.js +1 -1
- package/lib/typescript/typescript.js +8 -8
- package/lib/version.js +2 -2
- package/lib/vscode/devcontainer.js +1 -1
- package/lib/vscode/extensions.js +1 -1
- package/lib/vscode/launch-config.js +1 -1
- package/lib/vscode/settings.js +1 -1
- package/lib/vscode/vscode.js +1 -1
- package/lib/web/next.js +3 -3
- package/lib/web/postcss.js +1 -1
- package/lib/web/react.js +4 -4
- package/lib/web/tailwind.js +1 -1
- package/lib/xmlfile.js +1 -1
- package/lib/yaml.js +1 -1
- package/node_modules/yaml/browser/dist/compose/compose-collection.js +15 -3
- package/node_modules/yaml/browser/dist/compose/compose-node.js +1 -1
- package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +1 -1
- package/node_modules/yaml/browser/dist/compose/resolve-props.js +3 -3
- package/node_modules/yaml/browser/dist/nodes/Collection.js +0 -1
- package/node_modules/yaml/browser/dist/parse/lexer.js +2 -6
- package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +2 -0
- package/node_modules/yaml/dist/cli.d.ts +1 -2
- package/node_modules/yaml/dist/cli.mjs +8 -4
- package/node_modules/yaml/dist/compose/compose-collection.d.ts +7 -1
- package/node_modules/yaml/dist/compose/compose-collection.js +15 -3
- package/node_modules/yaml/dist/compose/compose-node.d.ts +1 -0
- package/node_modules/yaml/dist/compose/compose-node.js +1 -1
- package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +1 -2
- package/node_modules/yaml/dist/compose/resolve-block-map.js +1 -1
- package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +1 -1
- package/node_modules/yaml/dist/compose/resolve-props.d.ts +1 -1
- package/node_modules/yaml/dist/compose/resolve-props.js +3 -3
- package/node_modules/yaml/dist/nodes/Collection.d.ts +0 -1
- package/node_modules/yaml/dist/nodes/Collection.js +0 -1
- package/node_modules/yaml/dist/nodes/identity.d.ts +1 -1
- package/node_modules/yaml/dist/parse/lexer.js +2 -6
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +3 -3
- package/node_modules/yaml/dist/stringify/foldFlowLines.js +2 -0
- package/node_modules/yaml/package.json +1 -1
- 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,
|
|
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,
|
|
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.
|
|
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
|
-
|
|
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
|
};
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,
|
|
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);
|
|
@@ -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,
|
|
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
|
|
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.
|
|
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
|
|
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
|
-
|
|
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[];
|
|
@@ -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
|
|
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
|
|
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
|
|
17
|
-
(key: unknown, keepScalar?: boolean
|
|
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;
|