projen 0.54.56 → 0.55.0
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 +3 -3
- package/changelog.md +5 -3
- package/lib/awscdk/auto-discover.js +4 -4
- 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.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-ts.js +1 -1
- package/lib/cdk8s/cdk8s-construct.js +1 -1
- package/lib/cdk8s/integration-test.js +1 -1
- package/lib/cdktf/cdktf-construct.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.js +2 -2
- package/lib/file.js +1 -1
- package/lib/gitattributes.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-lint.js +1 -1
- package/lib/github/stale.js +1 -1
- package/lib/github/task-workflow.js +1 -1
- package/lib/github/workflows.js +1 -1
- package/lib/gitlab/configuration.js +1 -1
- 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 +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 +1 -1
- package/lib/javascript/upgrade-dependencies.js +2 -2
- 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.js +1 -1
- package/lib/projects.js +1 -1
- package/lib/projenrc-json.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/run-task.js +1813 -0
- 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.js +1 -1
- package/lib/typescript/typescript-typedoc.js +1 -1
- package/lib/typescript/typescript.js +5 -5
- package/lib/util.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/vscode/devcontainer.js +1 -1
- package/lib/vscode/launch-config.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/xmlbuilder2/node_modules/@types/node/README.md +1 -1
- package/node_modules/xmlbuilder2/node_modules/@types/node/diagnostics_channel.d.ts +18 -0
- package/node_modules/xmlbuilder2/node_modules/@types/node/package.json +2 -2
- package/node_modules/yaml/README.md +1 -1
- package/node_modules/yaml/browser/dist/compose/compose-doc.js +1 -1
- package/node_modules/yaml/browser/dist/compose/compose-scalar.js +4 -4
- package/node_modules/yaml/browser/dist/compose/composer.js +1 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +2 -2
- package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +3 -1
- package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +4 -3
- package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +2 -1
- package/node_modules/yaml/browser/dist/compose/resolve-props.js +1 -1
- package/node_modules/yaml/browser/dist/doc/Document.js +9 -5
- package/node_modules/yaml/browser/dist/doc/anchors.js +2 -2
- package/node_modules/yaml/browser/dist/doc/createNode.js +7 -4
- package/node_modules/yaml/browser/dist/nodes/Pair.js +2 -2
- package/node_modules/yaml/browser/dist/nodes/Scalar.js +1 -1
- package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +5 -4
- package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +1 -1
- package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +1 -1
- package/node_modules/yaml/browser/dist/nodes/toJS.js +3 -1
- package/node_modules/yaml/browser/dist/parse/cst-visit.js +2 -2
- package/node_modules/yaml/browser/dist/parse/lexer.js +2 -1
- package/node_modules/yaml/browser/dist/parse/parser.js +50 -14
- package/node_modules/yaml/browser/dist/public-api.js +2 -1
- package/node_modules/yaml/browser/dist/schema/Schema.js +6 -2
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +1 -1
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +2 -1
- package/node_modules/yaml/browser/dist/stringify/stringify.js +8 -8
- package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +5 -3
- package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +4 -1
- package/node_modules/yaml/browser/dist/stringify/stringifyString.js +2 -2
- package/node_modules/yaml/dist/compose/compose-doc.js +1 -1
- package/node_modules/yaml/dist/compose/compose-scalar.js +4 -4
- package/node_modules/yaml/dist/compose/composer.js +1 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.js +2 -2
- package/node_modules/yaml/dist/compose/resolve-block-scalar.js +3 -1
- package/node_modules/yaml/dist/compose/resolve-flow-collection.js +4 -3
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +2 -1
- package/node_modules/yaml/dist/compose/resolve-props.d.ts +1 -1
- package/node_modules/yaml/dist/compose/resolve-props.js +1 -1
- package/node_modules/yaml/dist/doc/Document.d.ts +1 -1
- package/node_modules/yaml/dist/doc/Document.js +9 -5
- package/node_modules/yaml/dist/doc/anchors.d.ts +2 -2
- package/node_modules/yaml/dist/doc/anchors.js +2 -2
- package/node_modules/yaml/dist/doc/createNode.d.ts +1 -1
- package/node_modules/yaml/dist/doc/createNode.js +7 -4
- package/node_modules/yaml/dist/doc/directives.d.ts +1 -1
- package/node_modules/yaml/dist/nodes/Pair.js +2 -2
- package/node_modules/yaml/dist/nodes/Scalar.js +1 -1
- package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +3 -1
- package/node_modules/yaml/dist/nodes/YAMLMap.js +5 -4
- package/node_modules/yaml/dist/nodes/YAMLSeq.js +1 -1
- package/node_modules/yaml/dist/nodes/addPairToJSMap.js +1 -1
- package/node_modules/yaml/dist/nodes/toJS.js +3 -1
- package/node_modules/yaml/dist/options.d.ts +1 -1
- package/node_modules/yaml/dist/parse/cst-visit.js +2 -2
- package/node_modules/yaml/dist/parse/lexer.js +2 -1
- package/node_modules/yaml/dist/parse/parser.js +50 -14
- package/node_modules/yaml/dist/public-api.js +2 -1
- package/node_modules/yaml/dist/schema/Schema.js +6 -2
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +1 -1
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +2 -1
- package/node_modules/yaml/dist/stringify/stringify.js +8 -8
- package/node_modules/yaml/dist/stringify/stringifyComment.js +5 -3
- package/node_modules/yaml/dist/stringify/stringifyPair.js +4 -1
- package/node_modules/yaml/dist/stringify/stringifyString.js +2 -2
- package/node_modules/yaml/dist/test-events.js +1 -1
- package/node_modules/yaml/package.json +2 -2
- package/package.json +4 -4
- package/releasetag.txt +1 -1
- package/version.txt +1 -1
|
@@ -36,6 +36,8 @@ export declare class YAMLMap<K = unknown, V = unknown> extends Collection {
|
|
|
36
36
|
* @param {Class} Type - If set, forces the returned collection type
|
|
37
37
|
* @returns Instance of Type, Map, or Object
|
|
38
38
|
*/
|
|
39
|
-
toJSON(_?: unknown, ctx?: ToJSContext, Type?:
|
|
39
|
+
toJSON<T = unknown>(_?: unknown, ctx?: ToJSContext, Type?: {
|
|
40
|
+
new (): T;
|
|
41
|
+
}): any;
|
|
40
42
|
toString(ctx?: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string;
|
|
41
43
|
}
|
|
@@ -34,6 +34,7 @@ class YAMLMap extends Collection.Collection {
|
|
|
34
34
|
* collection will throw. Otherwise, overwrites the previous value.
|
|
35
35
|
*/
|
|
36
36
|
add(pair, overwrite) {
|
|
37
|
+
var _a;
|
|
37
38
|
let _pair;
|
|
38
39
|
if (Node.isPair(pair))
|
|
39
40
|
_pair = pair;
|
|
@@ -44,7 +45,7 @@ class YAMLMap extends Collection.Collection {
|
|
|
44
45
|
else
|
|
45
46
|
_pair = new Pair.Pair(pair.key, pair.value);
|
|
46
47
|
const prev = findPair(this.items, _pair.key);
|
|
47
|
-
const sortEntries = this.schema
|
|
48
|
+
const sortEntries = (_a = this.schema) === null || _a === void 0 ? void 0 : _a.sortMapEntries;
|
|
48
49
|
if (prev) {
|
|
49
50
|
if (!overwrite)
|
|
50
51
|
throw new Error(`Key ${_pair.key} already set`);
|
|
@@ -74,7 +75,7 @@ class YAMLMap extends Collection.Collection {
|
|
|
74
75
|
}
|
|
75
76
|
get(key, keepScalar) {
|
|
76
77
|
const it = findPair(this.items, key);
|
|
77
|
-
const node = it
|
|
78
|
+
const node = it === null || it === void 0 ? void 0 : it.value;
|
|
78
79
|
return !keepScalar && Node.isScalar(node) ? node.value : node;
|
|
79
80
|
}
|
|
80
81
|
has(key) {
|
|
@@ -89,8 +90,8 @@ class YAMLMap extends Collection.Collection {
|
|
|
89
90
|
* @returns Instance of Type, Map, or Object
|
|
90
91
|
*/
|
|
91
92
|
toJSON(_, ctx, Type) {
|
|
92
|
-
const map = Type ? new Type() : ctx
|
|
93
|
-
if (ctx
|
|
93
|
+
const map = Type ? new Type() : (ctx === null || ctx === void 0 ? void 0 : ctx.mapAsMap) ? new Map() : {};
|
|
94
|
+
if (ctx === null || ctx === void 0 ? void 0 : ctx.onCreate)
|
|
94
95
|
ctx.onCreate(map);
|
|
95
96
|
for (const item of this.items)
|
|
96
97
|
addPairToJSMap.addPairToJSMap(ctx, map, item);
|
|
@@ -8,7 +8,7 @@ var toJS = require('./toJS.js');
|
|
|
8
8
|
|
|
9
9
|
const MERGE_KEY = '<<';
|
|
10
10
|
function addPairToJSMap(ctx, map, { key, value }) {
|
|
11
|
-
if (ctx
|
|
11
|
+
if ((ctx === null || ctx === void 0 ? void 0 : ctx.doc.schema.merge) && isMergeKey(key)) {
|
|
12
12
|
value = Node.isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
13
13
|
if (Node.isSeq(value))
|
|
14
14
|
for (const it of value.items)
|
|
@@ -13,9 +13,11 @@ var Node = require('./Node.js');
|
|
|
13
13
|
* stringification.
|
|
14
14
|
*/
|
|
15
15
|
function toJS(value, arg, ctx) {
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
16
17
|
if (Array.isArray(value))
|
|
17
18
|
return value.map((v, i) => toJS(v, String(i), ctx));
|
|
18
19
|
if (value && typeof value.toJSON === 'function') {
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
19
21
|
if (!ctx || !Node.hasAnchor(value))
|
|
20
22
|
return value.toJSON(arg, ctx);
|
|
21
23
|
const data = { aliasCount: 0, count: 1, res: undefined };
|
|
@@ -29,7 +31,7 @@ function toJS(value, arg, ctx) {
|
|
|
29
31
|
ctx.onCreate(res);
|
|
30
32
|
return res;
|
|
31
33
|
}
|
|
32
|
-
if (typeof value === 'bigint' && !(ctx
|
|
34
|
+
if (typeof value === 'bigint' && !(ctx === null || ctx === void 0 ? void 0 : ctx.keep))
|
|
33
35
|
return Number(value);
|
|
34
36
|
return value;
|
|
35
37
|
}
|
|
@@ -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
|
|
52
|
+
const tok = item === null || item === void 0 ? void 0 : 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
|
|
69
|
+
const coll = parent === null || parent === void 0 ? void 0 : parent[field];
|
|
70
70
|
if (coll && 'items' in coll)
|
|
71
71
|
return coll;
|
|
72
72
|
throw new Error('Parent collection not found');
|
|
@@ -150,12 +150,13 @@ class Lexer {
|
|
|
150
150
|
* @returns A generator of lexical tokens
|
|
151
151
|
*/
|
|
152
152
|
*lex(source, incomplete = false) {
|
|
153
|
+
var _a;
|
|
153
154
|
if (source) {
|
|
154
155
|
this.buffer = this.buffer ? this.buffer + source : source;
|
|
155
156
|
this.lineEndPos = null;
|
|
156
157
|
}
|
|
157
158
|
this.atEnd = !incomplete;
|
|
158
|
-
let next = this.next
|
|
159
|
+
let next = (_a = this.next) !== null && _a !== void 0 ? _a : 'stream';
|
|
159
160
|
while (next && (incomplete || this.hasChars(1)))
|
|
160
161
|
next = yield* this.parseNext(next);
|
|
161
162
|
}
|
|
@@ -35,12 +35,13 @@ function isFlowToken(token) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
function getPrevProps(parent) {
|
|
38
|
+
var _a;
|
|
38
39
|
switch (parent.type) {
|
|
39
40
|
case 'document':
|
|
40
41
|
return parent.start;
|
|
41
42
|
case 'block-map': {
|
|
42
43
|
const it = parent.items[parent.items.length - 1];
|
|
43
|
-
return it.sep
|
|
44
|
+
return (_a = it.sep) !== null && _a !== void 0 ? _a : it.start;
|
|
44
45
|
}
|
|
45
46
|
case 'block-seq':
|
|
46
47
|
return parent.items[parent.items.length - 1].start;
|
|
@@ -269,7 +270,7 @@ class Parser {
|
|
|
269
270
|
return this.stack[this.stack.length - n];
|
|
270
271
|
}
|
|
271
272
|
*pop(error) {
|
|
272
|
-
const token = error
|
|
273
|
+
const token = error !== null && error !== void 0 ? error : this.stack.pop();
|
|
273
274
|
/* istanbul ignore if should not happen */
|
|
274
275
|
if (!token) {
|
|
275
276
|
const message = 'Tried to pop an empty stack';
|
|
@@ -518,30 +519,60 @@ class Parser {
|
|
|
518
519
|
const atNextItem = !this.onKeyLine &&
|
|
519
520
|
this.indent === map.indent &&
|
|
520
521
|
(it.sep || includesNonEmpty(it.start));
|
|
522
|
+
// For empty nodes, assign newline-separated not indented empty tokens to following node
|
|
523
|
+
let start = [];
|
|
524
|
+
if (atNextItem && it.sep && !it.value) {
|
|
525
|
+
const nl = [];
|
|
526
|
+
for (let i = 0; i < it.sep.length; ++i) {
|
|
527
|
+
const st = it.sep[i];
|
|
528
|
+
switch (st.type) {
|
|
529
|
+
case 'newline':
|
|
530
|
+
nl.push(i);
|
|
531
|
+
break;
|
|
532
|
+
case 'space':
|
|
533
|
+
break;
|
|
534
|
+
case 'comment':
|
|
535
|
+
if (st.indent > map.indent)
|
|
536
|
+
nl.length = 0;
|
|
537
|
+
break;
|
|
538
|
+
default:
|
|
539
|
+
nl.length = 0;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
if (nl.length >= 2)
|
|
543
|
+
start = it.sep.splice(nl[1]);
|
|
544
|
+
}
|
|
521
545
|
switch (this.type) {
|
|
522
546
|
case 'anchor':
|
|
523
547
|
case 'tag':
|
|
524
548
|
if (atNextItem || it.value) {
|
|
525
|
-
|
|
549
|
+
start.push(this.sourceToken);
|
|
550
|
+
map.items.push({ start });
|
|
526
551
|
this.onKeyLine = true;
|
|
527
552
|
}
|
|
528
|
-
else if (it.sep)
|
|
553
|
+
else if (it.sep) {
|
|
529
554
|
it.sep.push(this.sourceToken);
|
|
530
|
-
|
|
555
|
+
}
|
|
556
|
+
else {
|
|
531
557
|
it.start.push(this.sourceToken);
|
|
558
|
+
}
|
|
532
559
|
return;
|
|
533
560
|
case 'explicit-key-ind':
|
|
534
|
-
if (!it.sep && !includesToken(it.start, 'explicit-key-ind'))
|
|
561
|
+
if (!it.sep && !includesToken(it.start, 'explicit-key-ind')) {
|
|
535
562
|
it.start.push(this.sourceToken);
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
563
|
+
}
|
|
564
|
+
else if (atNextItem || it.value) {
|
|
565
|
+
start.push(this.sourceToken);
|
|
566
|
+
map.items.push({ start });
|
|
567
|
+
}
|
|
568
|
+
else {
|
|
539
569
|
this.stack.push({
|
|
540
570
|
type: 'block-map',
|
|
541
571
|
offset: this.offset,
|
|
542
572
|
indent: this.indent,
|
|
543
573
|
items: [{ start: [this.sourceToken] }]
|
|
544
574
|
});
|
|
575
|
+
}
|
|
545
576
|
this.onKeyLine = true;
|
|
546
577
|
return;
|
|
547
578
|
case 'map-value-ind':
|
|
@@ -568,7 +599,7 @@ class Parser {
|
|
|
568
599
|
type: 'block-map',
|
|
569
600
|
offset: this.offset,
|
|
570
601
|
indent: this.indent,
|
|
571
|
-
items: [{ start
|
|
602
|
+
items: [{ start, key: null, sep: [this.sourceToken] }]
|
|
572
603
|
});
|
|
573
604
|
}
|
|
574
605
|
else if (isFlowToken(it.key) &&
|
|
@@ -586,6 +617,10 @@ class Parser {
|
|
|
586
617
|
items: [{ start, key, sep }]
|
|
587
618
|
});
|
|
588
619
|
}
|
|
620
|
+
else if (start.length > 0) {
|
|
621
|
+
// Not actually at next item
|
|
622
|
+
it.sep = it.sep.concat(start, this.sourceToken);
|
|
623
|
+
}
|
|
589
624
|
else {
|
|
590
625
|
it.sep.push(this.sourceToken);
|
|
591
626
|
}
|
|
@@ -595,7 +630,7 @@ class Parser {
|
|
|
595
630
|
Object.assign(it, { key: null, sep: [this.sourceToken] });
|
|
596
631
|
}
|
|
597
632
|
else if (it.value || atNextItem) {
|
|
598
|
-
map.items.push({ start
|
|
633
|
+
map.items.push({ start, key: null, sep: [this.sourceToken] });
|
|
599
634
|
}
|
|
600
635
|
else if (includesToken(it.sep, 'map-value-ind')) {
|
|
601
636
|
this.stack.push({
|
|
@@ -617,7 +652,7 @@ class Parser {
|
|
|
617
652
|
case 'double-quoted-scalar': {
|
|
618
653
|
const fs = this.flowScalar(this.type);
|
|
619
654
|
if (atNextItem || it.value) {
|
|
620
|
-
map.items.push({ start
|
|
655
|
+
map.items.push({ start, key: fs, sep: [] });
|
|
621
656
|
this.onKeyLine = true;
|
|
622
657
|
}
|
|
623
658
|
else if (it.sep) {
|
|
@@ -634,8 +669,9 @@ class Parser {
|
|
|
634
669
|
if (bv) {
|
|
635
670
|
if (atNextItem &&
|
|
636
671
|
bv.type !== 'block-seq' &&
|
|
637
|
-
includesToken(it.start, 'explicit-key-ind'))
|
|
638
|
-
map.items.push({ start
|
|
672
|
+
includesToken(it.start, 'explicit-key-ind')) {
|
|
673
|
+
map.items.push({ start });
|
|
674
|
+
}
|
|
639
675
|
this.stack.push(bv);
|
|
640
676
|
return;
|
|
641
677
|
}
|
|
@@ -77,6 +77,7 @@ function parse(src, reviver, options) {
|
|
|
77
77
|
return doc.toJS(Object.assign({ reviver: _reviver }, options));
|
|
78
78
|
}
|
|
79
79
|
function stringify(value, replacer, options) {
|
|
80
|
+
var _a;
|
|
80
81
|
let _replacer = null;
|
|
81
82
|
if (typeof replacer === 'function' || Array.isArray(replacer)) {
|
|
82
83
|
_replacer = replacer;
|
|
@@ -91,7 +92,7 @@ function stringify(value, replacer, options) {
|
|
|
91
92
|
options = indent < 1 ? undefined : indent > 8 ? { indent: 8 } : { indent };
|
|
92
93
|
}
|
|
93
94
|
if (value === undefined) {
|
|
94
|
-
const { keepUndefined } = options
|
|
95
|
+
const { keepUndefined } = (_a = options !== null && options !== void 0 ? options : replacer) !== null && _a !== void 0 ? _a : {};
|
|
95
96
|
if (!keepUndefined)
|
|
96
97
|
return undefined;
|
|
97
98
|
}
|
|
@@ -18,13 +18,17 @@ class Schema {
|
|
|
18
18
|
this.name = (typeof schema === 'string' && schema) || 'core';
|
|
19
19
|
this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};
|
|
20
20
|
this.tags = tags.getTags(customTags, this.name);
|
|
21
|
-
this.toStringOptions = toStringDefaults
|
|
21
|
+
this.toStringOptions = toStringDefaults !== null && toStringDefaults !== void 0 ? toStringDefaults : null;
|
|
22
22
|
Object.defineProperty(this, Node.MAP, { value: map.map });
|
|
23
23
|
Object.defineProperty(this, Node.SCALAR, { value: string.string });
|
|
24
24
|
Object.defineProperty(this, Node.SEQ, { value: seq.seq });
|
|
25
25
|
// Used by createMap()
|
|
26
26
|
this.sortMapEntries =
|
|
27
|
-
sortMapEntries ===
|
|
27
|
+
typeof sortMapEntries === 'function'
|
|
28
|
+
? sortMapEntries
|
|
29
|
+
: sortMapEntries === true
|
|
30
|
+
? sortMapEntriesByKey
|
|
31
|
+
: null;
|
|
28
32
|
}
|
|
29
33
|
clone() {
|
|
30
34
|
const copy = Object.create(Schema.prototype, Object.getOwnPropertyDescriptors(this));
|
|
@@ -24,7 +24,7 @@ class YAMLOMap extends YAMLSeq.YAMLSeq {
|
|
|
24
24
|
if (!ctx)
|
|
25
25
|
return super.toJSON(_);
|
|
26
26
|
const map = new Map();
|
|
27
|
-
if (ctx
|
|
27
|
+
if (ctx === null || ctx === void 0 ? void 0 : ctx.onCreate)
|
|
28
28
|
ctx.onCreate(map);
|
|
29
29
|
for (const pair of this.items) {
|
|
30
30
|
let key, value;
|
|
@@ -6,6 +6,7 @@ var Scalar = require('../../nodes/Scalar.js');
|
|
|
6
6
|
var YAMLSeq = require('../../nodes/YAMLSeq.js');
|
|
7
7
|
|
|
8
8
|
function resolvePairs(seq, onError) {
|
|
9
|
+
var _a;
|
|
9
10
|
if (Node.isSeq(seq)) {
|
|
10
11
|
for (let i = 0; i < seq.items.length; ++i) {
|
|
11
12
|
let item = seq.items[i];
|
|
@@ -20,7 +21,7 @@ function resolvePairs(seq, onError) {
|
|
|
20
21
|
? `${item.commentBefore}\n${pair.key.commentBefore}`
|
|
21
22
|
: item.commentBefore;
|
|
22
23
|
if (item.comment) {
|
|
23
|
-
const cn = pair.value
|
|
24
|
+
const cn = (_a = pair.value) !== null && _a !== void 0 ? _a : pair.key;
|
|
24
25
|
cn.comment = cn.comment
|
|
25
26
|
? `${item.comment}\n${cn.comment}`
|
|
26
27
|
: item.comment;
|
|
@@ -45,26 +45,26 @@ function createStringifyContext(doc, options) {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
function getTagObject(tags, item) {
|
|
48
|
+
var _a, _b, _c, _d;
|
|
48
49
|
if (item.tag) {
|
|
49
50
|
const match = tags.filter(t => t.tag === item.tag);
|
|
50
51
|
if (match.length > 0)
|
|
51
|
-
return match.find(t => t.format === item.format)
|
|
52
|
+
return (_a = match.find(t => t.format === item.format)) !== null && _a !== void 0 ? _a : match[0];
|
|
52
53
|
}
|
|
53
54
|
let tagObj = undefined;
|
|
54
55
|
let obj;
|
|
55
56
|
if (Node.isScalar(item)) {
|
|
56
57
|
obj = item.value;
|
|
57
|
-
const match = tags.filter(t => t.identify
|
|
58
|
+
const match = tags.filter(t => { var _a; return (_a = t.identify) === null || _a === void 0 ? void 0 : _a.call(t, obj); });
|
|
58
59
|
tagObj =
|
|
59
|
-
match.find(t => t.format === item.format)
|
|
60
|
+
(_b = match.find(t => t.format === item.format)) !== null && _b !== void 0 ? _b : match.find(t => !t.format);
|
|
60
61
|
}
|
|
61
62
|
else {
|
|
62
63
|
obj = item;
|
|
63
64
|
tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
|
|
64
65
|
}
|
|
65
66
|
if (!tagObj) {
|
|
66
|
-
|
|
67
|
-
const name = obj && obj.constructor ? obj.constructor.name : typeof obj;
|
|
67
|
+
const name = (_d = (_c = obj === null || obj === void 0 ? void 0 : obj.constructor) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : typeof obj;
|
|
68
68
|
throw new Error(`Tag not resolved for ${name} value`);
|
|
69
69
|
}
|
|
70
70
|
return tagObj;
|
|
@@ -79,13 +79,13 @@ function stringifyProps(node, tagObj, { anchors: anchors$1, doc }) {
|
|
|
79
79
|
anchors$1.add(anchor);
|
|
80
80
|
props.push(`&${anchor}`);
|
|
81
81
|
}
|
|
82
|
-
const tag = node.tag
|
|
82
|
+
const tag = node.tag ? node.tag : tagObj.default ? null : tagObj.tag;
|
|
83
83
|
if (tag)
|
|
84
84
|
props.push(doc.directives.tagString(tag));
|
|
85
85
|
return props.join(' ');
|
|
86
86
|
}
|
|
87
87
|
function stringify(item, ctx, onComment, onChompKeep) {
|
|
88
|
-
var _a;
|
|
88
|
+
var _a, _b;
|
|
89
89
|
if (Node.isPair(item))
|
|
90
90
|
return item.toString(ctx, onComment, onChompKeep);
|
|
91
91
|
if (Node.isAlias(item)) {
|
|
@@ -110,7 +110,7 @@ function stringify(item, ctx, onComment, onChompKeep) {
|
|
|
110
110
|
tagObj = getTagObject(ctx.doc.schema.tags, node);
|
|
111
111
|
const props = stringifyProps(node, tagObj, ctx);
|
|
112
112
|
if (props.length > 0)
|
|
113
|
-
ctx.indentAtStart = (ctx.indentAtStart
|
|
113
|
+
ctx.indentAtStart = ((_b = ctx.indentAtStart) !== null && _b !== void 0 ? _b : 0) + props.length + 1;
|
|
114
114
|
const str = typeof tagObj.stringify === 'function'
|
|
115
115
|
? tagObj.stringify(node, ctx, onComment, onChompKeep)
|
|
116
116
|
: Node.isScalar(node)
|
|
@@ -13,9 +13,11 @@ function indentComment(comment, indent) {
|
|
|
13
13
|
return comment.substring(1);
|
|
14
14
|
return indent ? comment.replace(/^(?! *$)/gm, indent) : comment;
|
|
15
15
|
}
|
|
16
|
-
const lineComment = (str, indent, comment) =>
|
|
17
|
-
?
|
|
18
|
-
:
|
|
16
|
+
const lineComment = (str, indent, comment) => str.endsWith('\n')
|
|
17
|
+
? indentComment(comment, indent)
|
|
18
|
+
: comment.includes('\n')
|
|
19
|
+
? '\n' + indentComment(comment, indent)
|
|
20
|
+
: (str.endsWith(' ') ? '' : ' ') + comment;
|
|
19
21
|
|
|
20
22
|
exports.indentComment = indentComment;
|
|
21
23
|
exports.lineComment = lineComment;
|
|
@@ -98,7 +98,10 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
|
98
98
|
const valueStr = stringify.stringify(value, ctx, () => (valueCommentDone = true), () => (chompKeep = true));
|
|
99
99
|
let ws = ' ';
|
|
100
100
|
if (vcb || keyComment) {
|
|
101
|
-
|
|
101
|
+
if (valueStr === '' && !ctx.inFlow)
|
|
102
|
+
ws = vcb === '\n' ? '\n\n' : vcb;
|
|
103
|
+
else
|
|
104
|
+
ws = `${vcb}\n${ctx.indent}`;
|
|
102
105
|
}
|
|
103
106
|
else if (!explicitKey && Node.isCollection(value)) {
|
|
104
107
|
const flow = valueStr[0] === '[' || valueStr[0] === '{';
|
|
@@ -245,14 +245,14 @@ function plainString(item, ctx, onComment, onChompKeep) {
|
|
|
245
245
|
// - '\n ', ': ' or ' \n' anywhere
|
|
246
246
|
// - '#' not preceded by a non-space char
|
|
247
247
|
// - end with ' ' or ':'
|
|
248
|
-
return implicitKey || inFlow || value.
|
|
248
|
+
return implicitKey || inFlow || !value.includes('\n')
|
|
249
249
|
? quotedString(value, ctx)
|
|
250
250
|
: blockString(item, ctx, onComment, onChompKeep);
|
|
251
251
|
}
|
|
252
252
|
if (!implicitKey &&
|
|
253
253
|
!inFlow &&
|
|
254
254
|
type !== Scalar.Scalar.PLAIN &&
|
|
255
|
-
value.
|
|
255
|
+
value.includes('\n')) {
|
|
256
256
|
// Where allowed & type not set explicitly, prefer block style for multiline strings
|
|
257
257
|
return blockString(item, ctx, onComment, onChompKeep);
|
|
258
258
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yaml",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"author": "Eemeli Aro <eemeli@gmail.com>",
|
|
6
6
|
"repository": "github:eemeli/yaml",
|
|
@@ -89,6 +89,6 @@
|
|
|
89
89
|
"typescript": "^4.3.5"
|
|
90
90
|
},
|
|
91
91
|
"engines": {
|
|
92
|
-
"node": ">=
|
|
92
|
+
"node": ">= 14"
|
|
93
93
|
}
|
|
94
94
|
}
|
package/package.json
CHANGED
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@types/glob": "^7.2.0",
|
|
54
54
|
"@types/ini": "^1.3.31",
|
|
55
55
|
"@types/jest": "^27.4.1",
|
|
56
|
-
"@types/node": "^
|
|
56
|
+
"@types/node": "^14",
|
|
57
57
|
"@types/semver": "^7.3.9",
|
|
58
58
|
"@types/yargs": "^15.0.14",
|
|
59
59
|
"@typescript-eslint/eslint-plugin": "^5",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"semver": "^7.3.7",
|
|
92
92
|
"shx": "^0.3.4",
|
|
93
93
|
"xmlbuilder2": "^2.4.1",
|
|
94
|
-
"yaml": "2.0.0
|
|
94
|
+
"yaml": "^2.0.0",
|
|
95
95
|
"yargs": "^16.2.0"
|
|
96
96
|
},
|
|
97
97
|
"bundledDependencies": [
|
|
@@ -117,11 +117,11 @@
|
|
|
117
117
|
"scaffolding"
|
|
118
118
|
],
|
|
119
119
|
"engines": {
|
|
120
|
-
"node": ">=
|
|
120
|
+
"node": ">= 14.0.0"
|
|
121
121
|
},
|
|
122
122
|
"main": "lib/index.js",
|
|
123
123
|
"license": "Apache-2.0",
|
|
124
|
-
"version": "0.
|
|
124
|
+
"version": "0.55.0",
|
|
125
125
|
"jest": {
|
|
126
126
|
"testMatch": [
|
|
127
127
|
"<rootDir>/src/**/__tests__/**/*.ts?(x)",
|
package/releasetag.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
v0.
|
|
1
|
+
v0.55.0
|
package/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.55.0
|