projen 0.71.67 → 0.71.69
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 +24 -6
- package/docs/api/API.md +2 -0
- 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-lint.js +1 -1
- package/lib/github/stale.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/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 +4 -4
- 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/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.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/run-task.js +1889 -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-ts.js +1 -1
- package/lib/typescript/projenrc.d.ts +8 -0
- package/lib/typescript/projenrc.js +14 -5
- package/lib/typescript/typescript-typedoc.js +1 -1
- package/lib/typescript/typescript.js +3 -3
- package/lib/version.js +1 -1
- 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/README.md +4 -0
- package/node_modules/yaml/browser/dist/compose/compose-collection.js +46 -29
- package/node_modules/yaml/browser/dist/compose/compose-doc.js +1 -0
- package/node_modules/yaml/browser/dist/compose/compose-scalar.js +1 -1
- package/node_modules/yaml/browser/dist/compose/composer.js +1 -1
- package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +3 -2
- package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +3 -2
- package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +4 -5
- package/node_modules/yaml/browser/dist/compose/util-map-includes.js +1 -1
- package/node_modules/yaml/browser/dist/doc/Document.js +12 -10
- package/node_modules/yaml/browser/dist/doc/anchors.js +1 -1
- package/node_modules/yaml/browser/dist/doc/createNode.js +6 -2
- package/node_modules/yaml/browser/dist/doc/directives.js +1 -1
- package/node_modules/yaml/browser/dist/index.js +1 -1
- package/node_modules/yaml/browser/dist/node_modules/tslib/tslib.es6.js +6 -149
- package/node_modules/yaml/browser/dist/nodes/Alias.js +9 -2
- package/node_modules/yaml/browser/dist/nodes/Collection.js +2 -1
- package/node_modules/yaml/browser/dist/nodes/Node.js +25 -35
- package/node_modules/yaml/browser/dist/nodes/Pair.js +1 -1
- package/node_modules/yaml/browser/dist/nodes/Scalar.js +2 -1
- package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +30 -2
- package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +17 -1
- package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +1 -1
- package/node_modules/yaml/browser/dist/nodes/identity.js +36 -0
- package/node_modules/yaml/browser/dist/nodes/toJS.js +1 -1
- package/node_modules/yaml/browser/dist/schema/Schema.js +1 -1
- package/node_modules/yaml/browser/dist/schema/common/map.js +3 -28
- package/node_modules/yaml/browser/dist/schema/common/seq.js +3 -19
- package/node_modules/yaml/browser/dist/schema/tags.js +1 -1
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +9 -8
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +1 -1
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +14 -13
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +1 -1
- package/node_modules/yaml/browser/dist/stringify/stringify.js +1 -1
- package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +1 -1
- package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +1 -1
- package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +1 -1
- package/node_modules/yaml/browser/dist/stringify/stringifyString.js +10 -1
- package/node_modules/yaml/browser/dist/util.js +2 -0
- package/node_modules/yaml/browser/dist/visit.js +1 -1
- package/node_modules/yaml/dist/compose/compose-collection.d.ts +1 -1
- package/node_modules/yaml/dist/compose/compose-collection.js +47 -30
- package/node_modules/yaml/dist/compose/compose-doc.d.ts +2 -1
- package/node_modules/yaml/dist/compose/compose-doc.js +1 -0
- package/node_modules/yaml/dist/compose/compose-scalar.js +7 -7
- package/node_modules/yaml/dist/compose/composer.d.ts +5 -5
- package/node_modules/yaml/dist/compose/composer.js +3 -3
- package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +2 -1
- package/node_modules/yaml/dist/compose/resolve-block-map.js +3 -2
- package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +2 -1
- package/node_modules/yaml/dist/compose/resolve-block-seq.js +3 -2
- package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +2 -1
- package/node_modules/yaml/dist/compose/resolve-flow-collection.js +5 -6
- package/node_modules/yaml/dist/compose/util-map-includes.d.ts +3 -3
- package/node_modules/yaml/dist/compose/util-map-includes.js +3 -3
- package/node_modules/yaml/dist/doc/Document.d.ts +11 -9
- package/node_modules/yaml/dist/doc/Document.js +22 -20
- package/node_modules/yaml/dist/doc/anchors.d.ts +4 -4
- 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 +13 -9
- package/node_modules/yaml/dist/doc/directives.js +3 -3
- package/node_modules/yaml/dist/errors.d.ts +1 -1
- package/node_modules/yaml/dist/index.d.ts +2 -1
- package/node_modules/yaml/dist/index.js +9 -9
- package/node_modules/yaml/dist/nodes/Alias.d.ts +1 -1
- package/node_modules/yaml/dist/nodes/Alias.js +12 -5
- package/node_modules/yaml/dist/nodes/Collection.d.ts +3 -2
- package/node_modules/yaml/dist/nodes/Collection.js +10 -9
- package/node_modules/yaml/dist/nodes/Node.d.ts +5 -18
- package/node_modules/yaml/dist/nodes/Node.js +25 -51
- package/node_modules/yaml/dist/nodes/Pair.d.ts +2 -2
- package/node_modules/yaml/dist/nodes/Pair.js +4 -4
- package/node_modules/yaml/dist/nodes/Scalar.js +2 -1
- package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +7 -1
- package/node_modules/yaml/dist/nodes/YAMLMap.js +37 -9
- package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +3 -1
- package/node_modules/yaml/dist/nodes/YAMLSeq.js +21 -5
- package/node_modules/yaml/dist/nodes/addPairToJSMap.js +7 -7
- package/node_modules/yaml/dist/nodes/identity.d.ts +23 -0
- package/node_modules/yaml/dist/nodes/identity.js +53 -0
- package/node_modules/yaml/dist/nodes/toJS.d.ts +2 -5
- package/node_modules/yaml/dist/nodes/toJS.js +2 -2
- package/node_modules/yaml/dist/public-api.d.ts +3 -3
- package/node_modules/yaml/dist/schema/Schema.d.ts +1 -1
- package/node_modules/yaml/dist/schema/Schema.js +4 -4
- package/node_modules/yaml/dist/schema/common/map.js +4 -29
- package/node_modules/yaml/dist/schema/common/seq.js +4 -20
- package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -1
- package/node_modules/yaml/dist/schema/json/schema.d.ts +1 -1
- package/node_modules/yaml/dist/schema/tags.d.ts +1 -1
- package/node_modules/yaml/dist/schema/types.d.ts +11 -3
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +4 -1
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +11 -10
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +1 -1
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +5 -5
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -1
- package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +3 -1
- package/node_modules/yaml/dist/schema/yaml-1.1/set.js +17 -16
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +1 -1
- package/node_modules/yaml/dist/stringify/stringify.js +8 -8
- package/node_modules/yaml/dist/stringify/stringifyCollection.js +8 -8
- package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +4 -3
- package/node_modules/yaml/dist/stringify/stringifyDocument.js +2 -2
- package/node_modules/yaml/dist/stringify/stringifyPair.js +9 -9
- package/node_modules/yaml/dist/stringify/stringifyString.js +10 -1
- package/node_modules/yaml/dist/test-events.js +8 -8
- package/node_modules/yaml/dist/util.d.ts +4 -1
- package/node_modules/yaml/dist/util.js +4 -0
- package/node_modules/yaml/dist/visit.js +18 -18
- package/node_modules/yaml/package.json +8 -6
- package/package.json +3 -3
- package/node_modules/yaml/util.d.ts +0 -3
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var identity = require('../nodes/identity.js');
|
|
4
4
|
var Scalar = require('../nodes/Scalar.js');
|
|
5
5
|
var stringify = require('./stringify.js');
|
|
6
6
|
var stringifyComment = require('./stringifyComment.js');
|
|
7
7
|
|
|
8
8
|
function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
9
9
|
const { allNullValues, doc, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;
|
|
10
|
-
let keyComment = (
|
|
10
|
+
let keyComment = (identity.isNode(key) && key.comment) || null;
|
|
11
11
|
if (simpleKeys) {
|
|
12
12
|
if (keyComment) {
|
|
13
13
|
throw new Error('With simple keys, key nodes cannot have comments');
|
|
14
14
|
}
|
|
15
|
-
if (
|
|
15
|
+
if (identity.isCollection(key)) {
|
|
16
16
|
const msg = 'With simple keys, collection cannot be used as a key value';
|
|
17
17
|
throw new Error(msg);
|
|
18
18
|
}
|
|
@@ -20,8 +20,8 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
|
20
20
|
let explicitKey = !simpleKeys &&
|
|
21
21
|
(!key ||
|
|
22
22
|
(keyComment && value == null && !ctx.inFlow) ||
|
|
23
|
-
|
|
24
|
-
(
|
|
23
|
+
identity.isCollection(key) ||
|
|
24
|
+
(identity.isScalar(key)
|
|
25
25
|
? key.type === Scalar.Scalar.BLOCK_FOLDED || key.type === Scalar.Scalar.BLOCK_LITERAL
|
|
26
26
|
: typeof key === 'object'));
|
|
27
27
|
ctx = Object.assign({}, ctx, {
|
|
@@ -66,7 +66,7 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
|
66
66
|
str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));
|
|
67
67
|
}
|
|
68
68
|
let vsb, vcb, valueComment;
|
|
69
|
-
if (
|
|
69
|
+
if (identity.isNode(value)) {
|
|
70
70
|
vsb = !!value.spaceBefore;
|
|
71
71
|
vcb = value.commentBefore;
|
|
72
72
|
valueComment = value.comment;
|
|
@@ -79,14 +79,14 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
|
79
79
|
value = doc.createNode(value);
|
|
80
80
|
}
|
|
81
81
|
ctx.implicitKey = false;
|
|
82
|
-
if (!explicitKey && !keyComment &&
|
|
82
|
+
if (!explicitKey && !keyComment && identity.isScalar(value))
|
|
83
83
|
ctx.indentAtStart = str.length + 1;
|
|
84
84
|
chompKeep = false;
|
|
85
85
|
if (!indentSeq &&
|
|
86
86
|
indentStep.length >= 2 &&
|
|
87
87
|
!ctx.inFlow &&
|
|
88
88
|
!explicitKey &&
|
|
89
|
-
|
|
89
|
+
identity.isSeq(value) &&
|
|
90
90
|
!value.flow &&
|
|
91
91
|
!value.tag &&
|
|
92
92
|
!value.anchor) {
|
|
@@ -110,7 +110,7 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
|
110
110
|
ws += `\n${ctx.indent}`;
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
else if (!explicitKey &&
|
|
113
|
+
else if (!explicitKey && identity.isCollection(value)) {
|
|
114
114
|
const vs0 = valueStr[0];
|
|
115
115
|
const nl0 = valueStr.indexOf('\n');
|
|
116
116
|
const hasNewline = nl0 !== -1;
|
|
@@ -148,6 +148,15 @@ function quotedString(value, ctx) {
|
|
|
148
148
|
}
|
|
149
149
|
return qs(value, ctx);
|
|
150
150
|
}
|
|
151
|
+
// The negative lookbehind avoids a polynomial search,
|
|
152
|
+
// but isn't supported yet on Safari: https://caniuse.com/js-regexp-lookbehind
|
|
153
|
+
let blockEndNewlines;
|
|
154
|
+
try {
|
|
155
|
+
blockEndNewlines = new RegExp('(^|(?<!\n))\n+(?!\n|$)', 'g');
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
blockEndNewlines = /\n+(?!\n|$)/g;
|
|
159
|
+
}
|
|
151
160
|
function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
|
|
152
161
|
const { blockQuote, commentString, lineWidth } = ctx.options;
|
|
153
162
|
// 1. Block can't end in whitespace unless the last line is non-empty.
|
|
@@ -191,7 +200,7 @@ function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
|
|
|
191
200
|
value = value.slice(0, -end.length);
|
|
192
201
|
if (end[end.length - 1] === '\n')
|
|
193
202
|
end = end.slice(0, -1);
|
|
194
|
-
end = end.replace(
|
|
203
|
+
end = end.replace(blockEndNewlines, `$&${indent}`);
|
|
195
204
|
}
|
|
196
205
|
// determine indent indicator from whitespace at value start
|
|
197
206
|
let startWithSpace = false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var identity = require('./nodes/identity.js');
|
|
4
4
|
var publicApi = require('./public-api.js');
|
|
5
5
|
var visit = require('./visit.js');
|
|
6
6
|
|
|
@@ -66,10 +66,10 @@ function addEvents(events, doc, errPos, node) {
|
|
|
66
66
|
events.push('=VAL :');
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
if (errPos !== -1 &&
|
|
69
|
+
if (errPos !== -1 && identity.isNode(node) && node.range[0] >= errPos)
|
|
70
70
|
throw new Error();
|
|
71
71
|
let props = '';
|
|
72
|
-
let anchor =
|
|
72
|
+
let anchor = identity.isScalar(node) || identity.isCollection(node) ? node.anchor : undefined;
|
|
73
73
|
if (anchor) {
|
|
74
74
|
if (/\d$/.test(anchor)) {
|
|
75
75
|
const alt = anchor.replace(/\d$/, '');
|
|
@@ -78,9 +78,9 @@ function addEvents(events, doc, errPos, node) {
|
|
|
78
78
|
}
|
|
79
79
|
props = ` &${anchor}`;
|
|
80
80
|
}
|
|
81
|
-
if (
|
|
81
|
+
if (identity.isNode(node) && node.tag)
|
|
82
82
|
props += ` <${node.tag}>`;
|
|
83
|
-
if (
|
|
83
|
+
if (identity.isMap(node)) {
|
|
84
84
|
const ev = node.flow ? '+MAP {}' : '+MAP';
|
|
85
85
|
events.push(`${ev}${props}`);
|
|
86
86
|
node.items.forEach(({ key, value }) => {
|
|
@@ -89,7 +89,7 @@ function addEvents(events, doc, errPos, node) {
|
|
|
89
89
|
});
|
|
90
90
|
events.push('-MAP');
|
|
91
91
|
}
|
|
92
|
-
else if (
|
|
92
|
+
else if (identity.isSeq(node)) {
|
|
93
93
|
const ev = node.flow ? '+SEQ []' : '+SEQ';
|
|
94
94
|
events.push(`${ev}${props}`);
|
|
95
95
|
node.items.forEach(item => {
|
|
@@ -97,13 +97,13 @@ function addEvents(events, doc, errPos, node) {
|
|
|
97
97
|
});
|
|
98
98
|
events.push('-SEQ');
|
|
99
99
|
}
|
|
100
|
-
else if (
|
|
100
|
+
else if (identity.isPair(node)) {
|
|
101
101
|
events.push(`+MAP${props}`);
|
|
102
102
|
addEvents(events, doc, errPos, node.key);
|
|
103
103
|
addEvents(events, doc, errPos, node.value);
|
|
104
104
|
events.push('-MAP');
|
|
105
105
|
}
|
|
106
|
-
else if (
|
|
106
|
+
else if (identity.isAlias(node)) {
|
|
107
107
|
let alias = node.source;
|
|
108
108
|
if (alias && /\d$/.test(alias)) {
|
|
109
109
|
const alt = alias.replace(/\d$/, '');
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
export { createNode, CreateNodeContext } from './doc/createNode.js';
|
|
1
2
|
export { debug, LogLevelId, warn } from './log.js';
|
|
3
|
+
export { createPair } from './nodes/Pair.js';
|
|
2
4
|
export { findPair } from './nodes/YAMLMap.js';
|
|
3
5
|
export { toJS, ToJSContext } from './nodes/toJS.js';
|
|
4
6
|
export { map as mapTag } from './schema/common/map.js';
|
|
5
7
|
export { seq as seqTag } from './schema/common/seq.js';
|
|
6
8
|
export { string as stringTag } from './schema/common/string.js';
|
|
7
|
-
export { foldFlowLines } from './stringify/foldFlowLines';
|
|
9
|
+
export { foldFlowLines, FoldOptions } from './stringify/foldFlowLines';
|
|
10
|
+
export { StringifyContext } from './stringify/stringify.js';
|
|
8
11
|
export { stringifyNumber } from './stringify/stringifyNumber.js';
|
|
9
12
|
export { stringifyString } from './stringify/stringifyString.js';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var createNode = require('./doc/createNode.js');
|
|
3
4
|
var log = require('./log.js');
|
|
5
|
+
var Pair = require('./nodes/Pair.js');
|
|
4
6
|
var YAMLMap = require('./nodes/YAMLMap.js');
|
|
5
7
|
var toJS = require('./nodes/toJS.js');
|
|
6
8
|
var map = require('./schema/common/map.js');
|
|
@@ -12,8 +14,10 @@ var stringifyString = require('./stringify/stringifyString.js');
|
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
|
|
17
|
+
exports.createNode = createNode.createNode;
|
|
15
18
|
exports.debug = log.debug;
|
|
16
19
|
exports.warn = log.warn;
|
|
20
|
+
exports.createPair = Pair.createPair;
|
|
17
21
|
exports.findPair = YAMLMap.findPair;
|
|
18
22
|
exports.toJS = toJS.toJS;
|
|
19
23
|
exports.mapTag = map.map;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var identity = require('./nodes/identity.js');
|
|
4
4
|
|
|
5
5
|
const BREAK = Symbol('break visit');
|
|
6
6
|
const SKIP = Symbol('skip children');
|
|
@@ -37,7 +37,7 @@ const REMOVE = Symbol('remove node');
|
|
|
37
37
|
*/
|
|
38
38
|
function visit(node, visitor) {
|
|
39
39
|
const visitor_ = initVisitor(visitor);
|
|
40
|
-
if (
|
|
40
|
+
if (identity.isDocument(node)) {
|
|
41
41
|
const cd = visit_(null, node.contents, visitor_, Object.freeze([node]));
|
|
42
42
|
if (cd === REMOVE)
|
|
43
43
|
node.contents = null;
|
|
@@ -56,12 +56,12 @@ visit.SKIP = SKIP;
|
|
|
56
56
|
visit.REMOVE = REMOVE;
|
|
57
57
|
function visit_(key, node, visitor, path) {
|
|
58
58
|
const ctrl = callVisitor(key, node, visitor, path);
|
|
59
|
-
if (
|
|
59
|
+
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
60
60
|
replaceNode(key, path, ctrl);
|
|
61
61
|
return visit_(key, ctrl, visitor, path);
|
|
62
62
|
}
|
|
63
63
|
if (typeof ctrl !== 'symbol') {
|
|
64
|
-
if (
|
|
64
|
+
if (identity.isCollection(node)) {
|
|
65
65
|
path = Object.freeze(path.concat(node));
|
|
66
66
|
for (let i = 0; i < node.items.length; ++i) {
|
|
67
67
|
const ci = visit_(i, node.items[i], visitor, path);
|
|
@@ -75,7 +75,7 @@ function visit_(key, node, visitor, path) {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
else if (
|
|
78
|
+
else if (identity.isPair(node)) {
|
|
79
79
|
path = Object.freeze(path.concat(node));
|
|
80
80
|
const ck = visit_('key', node.key, visitor, path);
|
|
81
81
|
if (ck === BREAK)
|
|
@@ -124,7 +124,7 @@ function visit_(key, node, visitor, path) {
|
|
|
124
124
|
*/
|
|
125
125
|
async function visitAsync(node, visitor) {
|
|
126
126
|
const visitor_ = initVisitor(visitor);
|
|
127
|
-
if (
|
|
127
|
+
if (identity.isDocument(node)) {
|
|
128
128
|
const cd = await visitAsync_(null, node.contents, visitor_, Object.freeze([node]));
|
|
129
129
|
if (cd === REMOVE)
|
|
130
130
|
node.contents = null;
|
|
@@ -143,12 +143,12 @@ visitAsync.SKIP = SKIP;
|
|
|
143
143
|
visitAsync.REMOVE = REMOVE;
|
|
144
144
|
async function visitAsync_(key, node, visitor, path) {
|
|
145
145
|
const ctrl = await callVisitor(key, node, visitor, path);
|
|
146
|
-
if (
|
|
146
|
+
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
147
147
|
replaceNode(key, path, ctrl);
|
|
148
148
|
return visitAsync_(key, ctrl, visitor, path);
|
|
149
149
|
}
|
|
150
150
|
if (typeof ctrl !== 'symbol') {
|
|
151
|
-
if (
|
|
151
|
+
if (identity.isCollection(node)) {
|
|
152
152
|
path = Object.freeze(path.concat(node));
|
|
153
153
|
for (let i = 0; i < node.items.length; ++i) {
|
|
154
154
|
const ci = await visitAsync_(i, node.items[i], visitor, path);
|
|
@@ -162,7 +162,7 @@ async function visitAsync_(key, node, visitor, path) {
|
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
else if (
|
|
165
|
+
else if (identity.isPair(node)) {
|
|
166
166
|
path = Object.freeze(path.concat(node));
|
|
167
167
|
const ck = await visitAsync_('key', node.key, visitor, path);
|
|
168
168
|
if (ck === BREAK)
|
|
@@ -200,34 +200,34 @@ function initVisitor(visitor) {
|
|
|
200
200
|
function callVisitor(key, node, visitor, path) {
|
|
201
201
|
if (typeof visitor === 'function')
|
|
202
202
|
return visitor(key, node, path);
|
|
203
|
-
if (
|
|
203
|
+
if (identity.isMap(node))
|
|
204
204
|
return visitor.Map?.(key, node, path);
|
|
205
|
-
if (
|
|
205
|
+
if (identity.isSeq(node))
|
|
206
206
|
return visitor.Seq?.(key, node, path);
|
|
207
|
-
if (
|
|
207
|
+
if (identity.isPair(node))
|
|
208
208
|
return visitor.Pair?.(key, node, path);
|
|
209
|
-
if (
|
|
209
|
+
if (identity.isScalar(node))
|
|
210
210
|
return visitor.Scalar?.(key, node, path);
|
|
211
|
-
if (
|
|
211
|
+
if (identity.isAlias(node))
|
|
212
212
|
return visitor.Alias?.(key, node, path);
|
|
213
213
|
return undefined;
|
|
214
214
|
}
|
|
215
215
|
function replaceNode(key, path, node) {
|
|
216
216
|
const parent = path[path.length - 1];
|
|
217
|
-
if (
|
|
217
|
+
if (identity.isCollection(parent)) {
|
|
218
218
|
parent.items[key] = node;
|
|
219
219
|
}
|
|
220
|
-
else if (
|
|
220
|
+
else if (identity.isPair(parent)) {
|
|
221
221
|
if (key === 'key')
|
|
222
222
|
parent.key = node;
|
|
223
223
|
else
|
|
224
224
|
parent.value = node;
|
|
225
225
|
}
|
|
226
|
-
else if (
|
|
226
|
+
else if (identity.isDocument(parent)) {
|
|
227
227
|
parent.contents = node;
|
|
228
228
|
}
|
|
229
229
|
else {
|
|
230
|
-
const pt =
|
|
230
|
+
const pt = identity.isAlias(parent) ? 'alias' : 'scalar';
|
|
231
231
|
throw new Error(`Cannot replace node with ${pt} parent`);
|
|
232
232
|
}
|
|
233
233
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yaml",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"author": "Eemeli Aro <eemeli@gmail.com>",
|
|
6
6
|
"repository": "github:eemeli/yaml",
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
"files": [
|
|
15
15
|
"browser/",
|
|
16
16
|
"dist/",
|
|
17
|
-
"util.d.ts",
|
|
18
17
|
"util.js"
|
|
19
18
|
],
|
|
20
19
|
"type": "commonjs",
|
|
@@ -26,11 +25,13 @@
|
|
|
26
25
|
},
|
|
27
26
|
"exports": {
|
|
28
27
|
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
29
|
"node": "./dist/index.js",
|
|
30
30
|
"default": "./browser/index.js"
|
|
31
31
|
},
|
|
32
32
|
"./package.json": "./package.json",
|
|
33
33
|
"./util": {
|
|
34
|
+
"types": "./dist/util.d.ts",
|
|
34
35
|
"node": "./dist/util.js",
|
|
35
36
|
"default": "./browser/dist/util.js"
|
|
36
37
|
}
|
|
@@ -49,7 +50,7 @@
|
|
|
49
50
|
"test:browsers": "cd playground && npm test",
|
|
50
51
|
"test:dist": "npm run build:node && jest --config config/jest.config.js",
|
|
51
52
|
"test:dist:types": "tsc --allowJs --moduleResolution node --noEmit --target es5 dist/index.js",
|
|
52
|
-
"test:types": "tsc --noEmit",
|
|
53
|
+
"test:types": "tsc --noEmit && tsc --noEmit -p tests/tsconfig.json",
|
|
53
54
|
"docs:install": "cd docs-slate && bundle install",
|
|
54
55
|
"docs:deploy": "cd docs-slate && ./deploy.sh",
|
|
55
56
|
"docs": "cd docs-slate && bundle exec middleman server",
|
|
@@ -71,7 +72,7 @@
|
|
|
71
72
|
"@babel/preset-env": "^7.12.11",
|
|
72
73
|
"@rollup/plugin-babel": "^6.0.3",
|
|
73
74
|
"@rollup/plugin-replace": "^5.0.2",
|
|
74
|
-
"@rollup/plugin-typescript": "^
|
|
75
|
+
"@rollup/plugin-typescript": "^11.0.0",
|
|
75
76
|
"@types/jest": "^29.2.4",
|
|
76
77
|
"@types/node": "^14.18.35",
|
|
77
78
|
"@typescript-eslint/eslint-plugin": "^5.3.1",
|
|
@@ -86,9 +87,10 @@
|
|
|
86
87
|
"prettier": "^2.2.1",
|
|
87
88
|
"rollup": "^3.7.5",
|
|
88
89
|
"tslib": "^2.1.0",
|
|
89
|
-
"typescript": "^
|
|
90
|
+
"typescript": "^5.0.3"
|
|
90
91
|
},
|
|
91
92
|
"engines": {
|
|
92
|
-
"node": ">= 14"
|
|
93
|
+
"node": ">= 14",
|
|
94
|
+
"npm": ">= 7"
|
|
93
95
|
}
|
|
94
96
|
}
|
package/package.json
CHANGED
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"jest": "^29",
|
|
68
68
|
"jest-junit": "^15",
|
|
69
69
|
"jsii": "5.x",
|
|
70
|
-
"jsii-diff": "^1.
|
|
70
|
+
"jsii-diff": "^1.82.0",
|
|
71
71
|
"jsii-docgen": "^1.8.110",
|
|
72
|
-
"jsii-pacmak": "^1.
|
|
72
|
+
"jsii-pacmak": "^1.82.0",
|
|
73
73
|
"markmac": "^0.1.146",
|
|
74
74
|
"npm-check-updates": "^16",
|
|
75
75
|
"prettier": "^2.8.8",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
},
|
|
121
121
|
"main": "lib/index.js",
|
|
122
122
|
"license": "Apache-2.0",
|
|
123
|
-
"version": "0.71.
|
|
123
|
+
"version": "0.71.69",
|
|
124
124
|
"jest": {
|
|
125
125
|
"maxWorkers": "50%",
|
|
126
126
|
"testMatch": [
|