projen 0.51.4 → 0.51.8
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 +69 -9
- package/API.md +12 -1
- package/changelog.md +1 -1
- package/lib/awscdk/auto-discover.js +1 -1
- package/lib/awscdk/awscdk-app-java.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 +9 -2
- package/lib/awscdk/lambda-function.js +2 -2
- package/lib/build/build-workflow.js +1 -1
- package/lib/cdk/construct-lib.js +1 -1
- package/lib/cdk/jsii-docgen.js +1 -1
- package/lib/cdk/jsii-project.js +1 -1
- package/lib/cdk8s/cdk8s-app-ts.js +1 -1
- package/lib/cdk8s/cdk8s-construct.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-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-util.js +12 -7
- package/lib/github/stale.d.ts +10 -1
- package/lib/github/stale.js +10 -2
- 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.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/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 +3 -3
- 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.d.ts +13 -0
- package/lib/yaml.js +8 -3
- package/node_modules/{fs-extra/node_modules/universalify → universalify}/LICENSE +0 -0
- package/node_modules/{fs-extra/node_modules/universalify → universalify}/README.md +0 -0
- package/node_modules/{fs-extra/node_modules/universalify → universalify}/index.js +0 -0
- package/node_modules/{fs-extra/node_modules/universalify → universalify}/package.json +0 -0
- package/node_modules/yaml/LICENSE +1 -1
- package/node_modules/yaml/README.md +57 -41
- package/node_modules/yaml/browser/dist/compose/compose-collection.js +59 -0
- package/node_modules/yaml/browser/dist/compose/compose-doc.js +40 -0
- package/node_modules/yaml/browser/dist/compose/compose-node.js +81 -0
- package/node_modules/yaml/browser/dist/compose/compose-scalar.js +81 -0
- package/node_modules/yaml/browser/dist/compose/composer.js +219 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +107 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +185 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +45 -0
- package/node_modules/yaml/browser/dist/compose/resolve-end.js +37 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +200 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +223 -0
- package/node_modules/yaml/browser/dist/compose/resolve-props.js +128 -0
- package/node_modules/yaml/browser/dist/compose/util-contains-newline.js +34 -0
- package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +27 -0
- package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +15 -0
- package/node_modules/yaml/browser/dist/compose/util-map-includes.js +17 -0
- package/node_modules/yaml/browser/dist/doc/Document.js +321 -0
- package/node_modules/yaml/browser/dist/doc/anchors.js +72 -0
- package/node_modules/yaml/browser/dist/doc/applyReviver.js +54 -0
- package/node_modules/yaml/browser/dist/doc/createNode.js +84 -0
- package/node_modules/yaml/browser/dist/doc/directives.js +166 -0
- package/node_modules/yaml/browser/dist/errors.js +57 -0
- package/node_modules/yaml/browser/dist/index.js +18 -1002
- package/node_modules/yaml/browser/dist/log.js +14 -0
- package/node_modules/yaml/browser/dist/node_modules/tslib/tslib.es6.js +164 -0
- package/node_modules/yaml/browser/dist/nodes/Alias.js +94 -0
- package/node_modules/yaml/browser/dist/nodes/Collection.js +146 -0
- package/node_modules/yaml/browser/dist/nodes/Node.js +48 -0
- package/node_modules/yaml/browser/dist/nodes/Pair.js +36 -0
- package/node_modules/yaml/browser/dist/nodes/Scalar.js +23 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +116 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +105 -0
- package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +104 -0
- package/node_modules/yaml/browser/dist/nodes/toJS.js +35 -0
- package/node_modules/yaml/browser/dist/options.js +18 -0
- package/node_modules/yaml/browser/dist/parse/cst-scalar.js +215 -0
- package/node_modules/yaml/browser/dist/parse/cst-stringify.js +61 -0
- package/node_modules/yaml/browser/dist/parse/cst-visit.js +97 -0
- package/node_modules/yaml/browser/dist/parse/cst.js +98 -0
- package/node_modules/yaml/browser/dist/parse/lexer.js +692 -0
- package/node_modules/yaml/browser/dist/parse/line-counter.js +39 -0
- package/node_modules/yaml/browser/dist/parse/parser.js +882 -0
- package/node_modules/yaml/browser/dist/public-api.js +99 -0
- package/node_modules/yaml/browser/dist/schema/Schema.js +34 -0
- package/node_modules/yaml/browser/dist/schema/common/map.js +42 -0
- package/node_modules/yaml/browser/dist/schema/common/null.js +13 -0
- package/node_modules/yaml/browser/dist/schema/common/seq.js +33 -0
- package/node_modules/yaml/browser/dist/schema/common/string.js +14 -0
- package/node_modules/yaml/browser/dist/schema/core/bool.js +19 -0
- package/node_modules/yaml/browser/dist/schema/core/float.js +43 -0
- package/node_modules/yaml/browser/dist/schema/core/int.js +38 -0
- package/node_modules/yaml/browser/dist/schema/core/schema.js +23 -0
- package/node_modules/yaml/browser/dist/schema/json/schema.js +62 -0
- package/node_modules/yaml/browser/dist/schema/tags.js +83 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +66 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +26 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +46 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +71 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +73 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +77 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +37 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +87 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +101 -0
- package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +135 -0
- package/node_modules/yaml/browser/dist/stringify/stringify.js +124 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +152 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +18 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +68 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +24 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +122 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyString.js +314 -0
- package/node_modules/yaml/browser/dist/util.js +9 -2
- package/node_modules/yaml/browser/dist/visit.js +146 -0
- package/node_modules/yaml/browser/index.js +5 -1
- package/node_modules/yaml/browser/package.json +3 -0
- package/node_modules/yaml/dist/compose/compose-collection.d.ts +5 -0
- package/node_modules/yaml/dist/compose/compose-collection.js +61 -0
- package/node_modules/yaml/dist/compose/compose-doc.d.ts +6 -0
- package/node_modules/yaml/dist/compose/compose-doc.js +42 -0
- package/node_modules/yaml/dist/compose/compose-node.d.ts +26 -0
- package/node_modules/yaml/dist/compose/compose-node.js +84 -0
- package/node_modules/yaml/dist/compose/compose-scalar.d.ts +5 -0
- package/node_modules/yaml/dist/compose/compose-scalar.js +83 -0
- package/node_modules/yaml/dist/compose/composer.d.ts +62 -0
- package/node_modules/yaml/dist/compose/composer.js +223 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.js +109 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +10 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.js +187 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +5 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.js +47 -0
- package/node_modules/yaml/dist/compose/resolve-end.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-end.js +39 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.js +202 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +10 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +225 -0
- package/node_modules/yaml/dist/compose/resolve-props.d.ts +21 -0
- package/node_modules/yaml/dist/compose/resolve-props.js +130 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +29 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +3 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
- package/node_modules/yaml/dist/compose/util-map-includes.d.ts +4 -0
- package/node_modules/yaml/dist/compose/util-map-includes.js +19 -0
- package/node_modules/yaml/dist/doc/Document.d.ts +139 -0
- package/node_modules/yaml/dist/doc/Document.js +323 -0
- package/node_modules/yaml/dist/doc/anchors.d.ts +24 -0
- package/node_modules/yaml/dist/doc/anchors.js +77 -0
- package/node_modules/yaml/dist/doc/applyReviver.d.ts +9 -0
- package/node_modules/yaml/dist/doc/applyReviver.js +56 -0
- package/node_modules/yaml/dist/doc/createNode.d.ts +17 -0
- package/node_modules/yaml/dist/doc/createNode.js +86 -0
- package/node_modules/yaml/dist/doc/directives.d.ts +47 -0
- package/node_modules/yaml/dist/doc/directives.js +168 -0
- package/node_modules/yaml/dist/errors.d.ts +21 -0
- package/node_modules/yaml/dist/errors.js +62 -0
- package/node_modules/yaml/dist/index.d.ts +19 -0
- package/node_modules/yaml/dist/index.js +49 -77
- package/node_modules/yaml/dist/log.d.ts +3 -0
- package/node_modules/yaml/dist/log.js +17 -0
- package/node_modules/yaml/dist/node_modules/tslib/tslib.es6.js +76 -0
- package/node_modules/yaml/dist/nodes/Alias.d.ts +28 -0
- package/node_modules/yaml/dist/nodes/Alias.js +96 -0
- package/node_modules/yaml/dist/nodes/Collection.d.ts +73 -0
- package/node_modules/yaml/dist/nodes/Collection.js +150 -0
- package/node_modules/yaml/dist/nodes/Node.d.ts +53 -0
- package/node_modules/yaml/dist/nodes/Node.js +66 -0
- package/node_modules/yaml/dist/nodes/Pair.d.ts +21 -0
- package/node_modules/yaml/dist/nodes/Pair.js +39 -0
- package/node_modules/yaml/dist/nodes/Scalar.d.ts +42 -0
- package/node_modules/yaml/dist/nodes/Scalar.js +26 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +41 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.js +119 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +55 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.js +107 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +3 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.js +106 -0
- package/node_modules/yaml/dist/nodes/toJS.d.ts +30 -0
- package/node_modules/yaml/dist/nodes/toJS.js +37 -0
- package/node_modules/yaml/dist/options.d.ts +338 -0
- package/node_modules/yaml/dist/options.js +20 -0
- package/node_modules/yaml/dist/parse/cst-scalar.d.ts +64 -0
- package/node_modules/yaml/dist/parse/cst-scalar.js +219 -0
- package/node_modules/yaml/dist/parse/cst-stringify.d.ts +8 -0
- package/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
- package/node_modules/yaml/dist/parse/cst-visit.d.ts +39 -0
- package/node_modules/yaml/dist/parse/cst-visit.js +99 -0
- package/node_modules/yaml/dist/parse/cst.d.ts +106 -0
- package/node_modules/yaml/dist/parse/cst.js +112 -0
- package/node_modules/yaml/dist/parse/lexer.d.ts +87 -0
- package/node_modules/yaml/dist/parse/lexer.js +694 -0
- package/node_modules/yaml/dist/parse/line-counter.d.ts +22 -0
- package/node_modules/yaml/dist/parse/line-counter.js +41 -0
- package/node_modules/yaml/dist/parse/parser.d.ts +84 -0
- package/node_modules/yaml/dist/parse/parser.js +886 -0
- package/node_modules/yaml/dist/public-api.d.ts +43 -0
- package/node_modules/yaml/dist/public-api.js +104 -0
- package/node_modules/yaml/dist/schema/Schema.d.ts +18 -0
- package/node_modules/yaml/dist/schema/Schema.js +36 -0
- package/node_modules/yaml/dist/schema/common/map.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/map.js +44 -0
- package/node_modules/yaml/dist/schema/common/null.d.ts +4 -0
- package/node_modules/yaml/dist/schema/common/null.js +15 -0
- package/node_modules/yaml/dist/schema/common/seq.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/seq.js +35 -0
- package/node_modules/yaml/dist/schema/common/string.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/string.js +16 -0
- package/node_modules/yaml/dist/schema/core/bool.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/bool.js +21 -0
- package/node_modules/yaml/dist/schema/core/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/float.js +47 -0
- package/node_modules/yaml/dist/schema/core/int.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/int.js +42 -0
- package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/core/schema.js +25 -0
- package/node_modules/yaml/dist/schema/json/schema.d.ts +2 -0
- package/node_modules/yaml/dist/schema/json/schema.js +64 -0
- package/node_modules/yaml/dist/schema/tags.d.ts +40 -0
- package/node_modules/yaml/dist/schema/tags.js +86 -0
- package/node_modules/yaml/dist/schema/types.d.ts +82 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +2 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +68 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +7 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +5 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +21 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +76 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +10 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +81 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +39 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +22 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.js +90 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +6 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +34 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.js +140 -0
- package/node_modules/yaml/dist/stringify/stringify.d.ts +20 -0
- package/node_modules/yaml/dist/stringify/stringify.js +127 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +17 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.js +154 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +10 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.js +22 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +3 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.js +70 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +2 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.js +26 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +3 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.js +124 -0
- package/node_modules/yaml/dist/stringify/stringifyString.d.ts +3 -0
- package/node_modules/yaml/dist/stringify/stringifyString.js +316 -0
- package/node_modules/yaml/dist/test-events.d.ts +4 -0
- package/node_modules/yaml/dist/test-events.js +126 -152
- package/node_modules/yaml/dist/util.d.ts +9 -0
- package/node_modules/yaml/dist/util.js +19 -14
- package/node_modules/yaml/dist/visit.d.ts +63 -0
- package/node_modules/yaml/dist/visit.js +148 -0
- package/node_modules/yaml/package.json +43 -55
- package/node_modules/yaml/util.d.ts +3 -86
- package/node_modules/yaml/util.js +2 -16
- package/package.json +3 -3
- package/releasetag.txt +1 -1
- package/version.txt +1 -1
- package/node_modules/jsonfile/node_modules/universalify/LICENSE +0 -20
- package/node_modules/jsonfile/node_modules/universalify/README.md +0 -76
- package/node_modules/jsonfile/node_modules/universalify/index.js +0 -24
- package/node_modules/jsonfile/node_modules/universalify/package.json +0 -34
- package/node_modules/yaml/browser/dist/PlainValue-b8036b75.js +0 -1275
- package/node_modules/yaml/browser/dist/Schema-e94716c8.js +0 -682
- package/node_modules/yaml/browser/dist/legacy-exports.js +0 -3
- package/node_modules/yaml/browser/dist/package.json +0 -1
- package/node_modules/yaml/browser/dist/parse-cst.js +0 -1904
- package/node_modules/yaml/browser/dist/resolveSeq-492ab440.js +0 -2419
- package/node_modules/yaml/browser/dist/types.js +0 -4
- package/node_modules/yaml/browser/dist/warnings-df54cb69.js +0 -499
- package/node_modules/yaml/browser/map.js +0 -2
- package/node_modules/yaml/browser/pair.js +0 -2
- package/node_modules/yaml/browser/parse-cst.js +0 -1
- package/node_modules/yaml/browser/scalar.js +0 -2
- package/node_modules/yaml/browser/schema.js +0 -9
- package/node_modules/yaml/browser/seq.js +0 -2
- package/node_modules/yaml/browser/types/binary.js +0 -8
- package/node_modules/yaml/browser/types/omap.js +0 -3
- package/node_modules/yaml/browser/types/pairs.js +0 -3
- package/node_modules/yaml/browser/types/set.js +0 -3
- package/node_modules/yaml/browser/types/timestamp.js +0 -10
- package/node_modules/yaml/browser/types.js +0 -1
- package/node_modules/yaml/browser/util.js +0 -1
- package/node_modules/yaml/dist/Document-9b4560a1.js +0 -757
- package/node_modules/yaml/dist/PlainValue-ec8e588e.js +0 -876
- package/node_modules/yaml/dist/Schema-88e323a7.js +0 -525
- package/node_modules/yaml/dist/legacy-exports.js +0 -16
- package/node_modules/yaml/dist/parse-cst.js +0 -1753
- package/node_modules/yaml/dist/resolveSeq-d03cb037.js +0 -2161
- package/node_modules/yaml/dist/types.js +0 -23
- package/node_modules/yaml/dist/warnings-1000a372.js +0 -416
- package/node_modules/yaml/index.d.ts +0 -372
- package/node_modules/yaml/index.js +0 -1
- package/node_modules/yaml/map.js +0 -2
- package/node_modules/yaml/pair.js +0 -2
- package/node_modules/yaml/parse-cst.d.ts +0 -191
- package/node_modules/yaml/parse-cst.js +0 -1
- package/node_modules/yaml/scalar.js +0 -2
- package/node_modules/yaml/schema.js +0 -9
- package/node_modules/yaml/seq.js +0 -2
- package/node_modules/yaml/types/binary.js +0 -8
- package/node_modules/yaml/types/omap.js +0 -3
- package/node_modules/yaml/types/pairs.js +0 -3
- package/node_modules/yaml/types/set.js +0 -3
- package/node_modules/yaml/types/timestamp.js +0 -10
- package/node_modules/yaml/types.d.ts +0 -407
- package/node_modules/yaml/types.js +0 -17
- package/node_modules/yaml/types.mjs +0 -17
- package/node_modules/yaml/util.mjs +0 -18
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { Scalar } from '../nodes/Scalar.js';
|
|
2
|
+
import { foldFlowLines, FOLD_QUOTED, FOLD_FLOW, FOLD_BLOCK } from './foldFlowLines.js';
|
|
3
|
+
|
|
4
|
+
const getFoldOptions = (ctx) => ({
|
|
5
|
+
indentAtStart: ctx.indentAtStart,
|
|
6
|
+
lineWidth: ctx.options.lineWidth,
|
|
7
|
+
minContentWidth: ctx.options.minContentWidth
|
|
8
|
+
});
|
|
9
|
+
// Also checks for lines starting with %, as parsing the output as YAML 1.1 will
|
|
10
|
+
// presume that's starting a new document.
|
|
11
|
+
const containsDocumentMarker = (str) => /^(%|---|\.\.\.)/m.test(str);
|
|
12
|
+
function lineLengthOverLimit(str, lineWidth, indentLength) {
|
|
13
|
+
if (!lineWidth || lineWidth < 0)
|
|
14
|
+
return false;
|
|
15
|
+
const limit = lineWidth - indentLength;
|
|
16
|
+
const strLen = str.length;
|
|
17
|
+
if (strLen <= limit)
|
|
18
|
+
return false;
|
|
19
|
+
for (let i = 0, start = 0; i < strLen; ++i) {
|
|
20
|
+
if (str[i] === '\n') {
|
|
21
|
+
if (i - start > limit)
|
|
22
|
+
return true;
|
|
23
|
+
start = i + 1;
|
|
24
|
+
if (strLen - start <= limit)
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
function doubleQuotedString(value, ctx) {
|
|
31
|
+
const json = JSON.stringify(value);
|
|
32
|
+
if (ctx.options.doubleQuotedAsJSON)
|
|
33
|
+
return json;
|
|
34
|
+
const { implicitKey } = ctx;
|
|
35
|
+
const minMultiLineLength = ctx.options.doubleQuotedMinMultiLineLength;
|
|
36
|
+
const indent = ctx.indent || (containsDocumentMarker(value) ? ' ' : '');
|
|
37
|
+
let str = '';
|
|
38
|
+
let start = 0;
|
|
39
|
+
for (let i = 0, ch = json[i]; ch; ch = json[++i]) {
|
|
40
|
+
if (ch === ' ' && json[i + 1] === '\\' && json[i + 2] === 'n') {
|
|
41
|
+
// space before newline needs to be escaped to not be folded
|
|
42
|
+
str += json.slice(start, i) + '\\ ';
|
|
43
|
+
i += 1;
|
|
44
|
+
start = i;
|
|
45
|
+
ch = '\\';
|
|
46
|
+
}
|
|
47
|
+
if (ch === '\\')
|
|
48
|
+
switch (json[i + 1]) {
|
|
49
|
+
case 'u':
|
|
50
|
+
{
|
|
51
|
+
str += json.slice(start, i);
|
|
52
|
+
const code = json.substr(i + 2, 4);
|
|
53
|
+
switch (code) {
|
|
54
|
+
case '0000':
|
|
55
|
+
str += '\\0';
|
|
56
|
+
break;
|
|
57
|
+
case '0007':
|
|
58
|
+
str += '\\a';
|
|
59
|
+
break;
|
|
60
|
+
case '000b':
|
|
61
|
+
str += '\\v';
|
|
62
|
+
break;
|
|
63
|
+
case '001b':
|
|
64
|
+
str += '\\e';
|
|
65
|
+
break;
|
|
66
|
+
case '0085':
|
|
67
|
+
str += '\\N';
|
|
68
|
+
break;
|
|
69
|
+
case '00a0':
|
|
70
|
+
str += '\\_';
|
|
71
|
+
break;
|
|
72
|
+
case '2028':
|
|
73
|
+
str += '\\L';
|
|
74
|
+
break;
|
|
75
|
+
case '2029':
|
|
76
|
+
str += '\\P';
|
|
77
|
+
break;
|
|
78
|
+
default:
|
|
79
|
+
if (code.substr(0, 2) === '00')
|
|
80
|
+
str += '\\x' + code.substr(2);
|
|
81
|
+
else
|
|
82
|
+
str += json.substr(i, 6);
|
|
83
|
+
}
|
|
84
|
+
i += 5;
|
|
85
|
+
start = i + 1;
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
case 'n':
|
|
89
|
+
if (implicitKey ||
|
|
90
|
+
json[i + 2] === '"' ||
|
|
91
|
+
json.length < minMultiLineLength) {
|
|
92
|
+
i += 1;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
// folding will eat first newline
|
|
96
|
+
str += json.slice(start, i) + '\n\n';
|
|
97
|
+
while (json[i + 2] === '\\' &&
|
|
98
|
+
json[i + 3] === 'n' &&
|
|
99
|
+
json[i + 4] !== '"') {
|
|
100
|
+
str += '\n';
|
|
101
|
+
i += 2;
|
|
102
|
+
}
|
|
103
|
+
str += indent;
|
|
104
|
+
// space after newline needs to be escaped to not be folded
|
|
105
|
+
if (json[i + 2] === ' ')
|
|
106
|
+
str += '\\';
|
|
107
|
+
i += 1;
|
|
108
|
+
start = i + 1;
|
|
109
|
+
}
|
|
110
|
+
break;
|
|
111
|
+
default:
|
|
112
|
+
i += 1;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
str = start ? str + json.slice(start) : json;
|
|
116
|
+
return implicitKey
|
|
117
|
+
? str
|
|
118
|
+
: foldFlowLines(str, indent, FOLD_QUOTED, getFoldOptions(ctx));
|
|
119
|
+
}
|
|
120
|
+
function singleQuotedString(value, ctx) {
|
|
121
|
+
if (ctx.options.singleQuote === false ||
|
|
122
|
+
(ctx.implicitKey && value.includes('\n')) ||
|
|
123
|
+
/[ \t]\n|\n[ \t]/.test(value) // single quoted string can't have leading or trailing whitespace around newline
|
|
124
|
+
)
|
|
125
|
+
return doubleQuotedString(value, ctx);
|
|
126
|
+
const indent = ctx.indent || (containsDocumentMarker(value) ? ' ' : '');
|
|
127
|
+
const res = "'" + value.replace(/'/g, "''").replace(/\n+/g, `$&\n${indent}`) + "'";
|
|
128
|
+
return ctx.implicitKey
|
|
129
|
+
? res
|
|
130
|
+
: foldFlowLines(res, indent, FOLD_FLOW, getFoldOptions(ctx));
|
|
131
|
+
}
|
|
132
|
+
function quotedString(value, ctx) {
|
|
133
|
+
const { singleQuote } = ctx.options;
|
|
134
|
+
let qs;
|
|
135
|
+
if (singleQuote === false)
|
|
136
|
+
qs = doubleQuotedString;
|
|
137
|
+
else {
|
|
138
|
+
const hasDouble = value.includes('"');
|
|
139
|
+
const hasSingle = value.includes("'");
|
|
140
|
+
if (hasDouble && !hasSingle)
|
|
141
|
+
qs = singleQuotedString;
|
|
142
|
+
else if (hasSingle && !hasDouble)
|
|
143
|
+
qs = doubleQuotedString;
|
|
144
|
+
else
|
|
145
|
+
qs = singleQuote ? singleQuotedString : doubleQuotedString;
|
|
146
|
+
}
|
|
147
|
+
return qs(value, ctx);
|
|
148
|
+
}
|
|
149
|
+
function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
|
|
150
|
+
const { blockQuote, commentString, lineWidth } = ctx.options;
|
|
151
|
+
// 1. Block can't end in whitespace unless the last line is non-empty.
|
|
152
|
+
// 2. Strings consisting of only whitespace are best rendered explicitly.
|
|
153
|
+
if (!blockQuote || /\n[\t ]+$/.test(value) || /^\s*$/.test(value)) {
|
|
154
|
+
return quotedString(value, ctx);
|
|
155
|
+
}
|
|
156
|
+
const indent = ctx.indent ||
|
|
157
|
+
(ctx.forceBlockIndent || containsDocumentMarker(value) ? ' ' : '');
|
|
158
|
+
const literal = blockQuote === 'literal'
|
|
159
|
+
? true
|
|
160
|
+
: blockQuote === 'folded' || type === Scalar.BLOCK_FOLDED
|
|
161
|
+
? false
|
|
162
|
+
: type === Scalar.BLOCK_LITERAL
|
|
163
|
+
? true
|
|
164
|
+
: !lineLengthOverLimit(value, lineWidth, indent.length);
|
|
165
|
+
if (!value)
|
|
166
|
+
return literal ? '|\n' : '>\n';
|
|
167
|
+
// determine chomping from whitespace at value end
|
|
168
|
+
let chomp;
|
|
169
|
+
let endStart;
|
|
170
|
+
for (endStart = value.length; endStart > 0; --endStart) {
|
|
171
|
+
const ch = value[endStart - 1];
|
|
172
|
+
if (ch !== '\n' && ch !== '\t' && ch !== ' ')
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
let end = value.substring(endStart);
|
|
176
|
+
const endNlPos = end.indexOf('\n');
|
|
177
|
+
if (endNlPos === -1) {
|
|
178
|
+
chomp = '-'; // strip
|
|
179
|
+
}
|
|
180
|
+
else if (value === end || endNlPos !== end.length - 1) {
|
|
181
|
+
chomp = '+'; // keep
|
|
182
|
+
if (onChompKeep)
|
|
183
|
+
onChompKeep();
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
chomp = ''; // clip
|
|
187
|
+
}
|
|
188
|
+
if (end) {
|
|
189
|
+
value = value.slice(0, -end.length);
|
|
190
|
+
if (end[end.length - 1] === '\n')
|
|
191
|
+
end = end.slice(0, -1);
|
|
192
|
+
end = end.replace(/\n+(?!\n|$)/g, `$&${indent}`);
|
|
193
|
+
}
|
|
194
|
+
// determine indent indicator from whitespace at value start
|
|
195
|
+
let startWithSpace = false;
|
|
196
|
+
let startEnd;
|
|
197
|
+
let startNlPos = -1;
|
|
198
|
+
for (startEnd = 0; startEnd < value.length; ++startEnd) {
|
|
199
|
+
const ch = value[startEnd];
|
|
200
|
+
if (ch === ' ')
|
|
201
|
+
startWithSpace = true;
|
|
202
|
+
else if (ch === '\n')
|
|
203
|
+
startNlPos = startEnd;
|
|
204
|
+
else
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
let start = value.substring(0, startNlPos < startEnd ? startNlPos + 1 : startEnd);
|
|
208
|
+
if (start) {
|
|
209
|
+
value = value.substring(start.length);
|
|
210
|
+
start = start.replace(/\n+/g, `$&${indent}`);
|
|
211
|
+
}
|
|
212
|
+
const indentSize = indent ? '2' : '1'; // root is at -1
|
|
213
|
+
let header = (literal ? '|' : '>') + (startWithSpace ? indentSize : '') + chomp;
|
|
214
|
+
if (comment) {
|
|
215
|
+
header += ' ' + commentString(comment.replace(/ ?[\r\n]+/g, ' '));
|
|
216
|
+
if (onComment)
|
|
217
|
+
onComment();
|
|
218
|
+
}
|
|
219
|
+
if (literal) {
|
|
220
|
+
value = value.replace(/\n+/g, `$&${indent}`);
|
|
221
|
+
return `${header}\n${indent}${start}${value}${end}`;
|
|
222
|
+
}
|
|
223
|
+
value = value
|
|
224
|
+
.replace(/\n+/g, '\n$&')
|
|
225
|
+
.replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
|
|
226
|
+
// ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
|
|
227
|
+
.replace(/\n+/g, `$&${indent}`);
|
|
228
|
+
const body = foldFlowLines(`${start}${value}${end}`, indent, FOLD_BLOCK, getFoldOptions(ctx));
|
|
229
|
+
return `${header}\n${indent}${body}`;
|
|
230
|
+
}
|
|
231
|
+
function plainString(item, ctx, onComment, onChompKeep) {
|
|
232
|
+
const { type, value } = item;
|
|
233
|
+
const { actualString, implicitKey, indent, inFlow } = ctx;
|
|
234
|
+
if ((implicitKey && /[\n[\]{},]/.test(value)) ||
|
|
235
|
+
(inFlow && /[[\]{},]/.test(value))) {
|
|
236
|
+
return quotedString(value, ctx);
|
|
237
|
+
}
|
|
238
|
+
if (!value ||
|
|
239
|
+
/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
|
|
240
|
+
// not allowed:
|
|
241
|
+
// - empty string, '-' or '?'
|
|
242
|
+
// - start with an indicator character (except [?:-]) or /[?-] /
|
|
243
|
+
// - '\n ', ': ' or ' \n' anywhere
|
|
244
|
+
// - '#' not preceded by a non-space char
|
|
245
|
+
// - end with ' ' or ':'
|
|
246
|
+
return implicitKey || inFlow || value.indexOf('\n') === -1
|
|
247
|
+
? quotedString(value, ctx)
|
|
248
|
+
: blockString(item, ctx, onComment, onChompKeep);
|
|
249
|
+
}
|
|
250
|
+
if (!implicitKey &&
|
|
251
|
+
!inFlow &&
|
|
252
|
+
type !== Scalar.PLAIN &&
|
|
253
|
+
value.indexOf('\n') !== -1) {
|
|
254
|
+
// Where allowed & type not set explicitly, prefer block style for multiline strings
|
|
255
|
+
return blockString(item, ctx, onComment, onChompKeep);
|
|
256
|
+
}
|
|
257
|
+
if (indent === '' && containsDocumentMarker(value)) {
|
|
258
|
+
ctx.forceBlockIndent = true;
|
|
259
|
+
return blockString(item, ctx, onComment, onChompKeep);
|
|
260
|
+
}
|
|
261
|
+
const str = value.replace(/\n+/g, `$&\n${indent}`);
|
|
262
|
+
// Verify that output will be parsed as a string, as e.g. plain numbers and
|
|
263
|
+
// booleans get parsed with those types in v1.2 (e.g. '42', 'true' & '0.9e-3'),
|
|
264
|
+
// and others in v1.1.
|
|
265
|
+
if (actualString) {
|
|
266
|
+
const test = (tag) => { var _a; return tag.default && tag.tag !== 'tag:yaml.org,2002:str' && ((_a = tag.test) === null || _a === void 0 ? void 0 : _a.test(str)); };
|
|
267
|
+
const { compat, tags } = ctx.doc.schema;
|
|
268
|
+
if (tags.some(test) || (compat === null || compat === void 0 ? void 0 : compat.some(test)))
|
|
269
|
+
return quotedString(value, ctx);
|
|
270
|
+
}
|
|
271
|
+
return implicitKey
|
|
272
|
+
? str
|
|
273
|
+
: foldFlowLines(str, indent, FOLD_FLOW, getFoldOptions(ctx));
|
|
274
|
+
}
|
|
275
|
+
function stringifyString(item, ctx, onComment, onChompKeep) {
|
|
276
|
+
const { implicitKey, inFlow } = ctx;
|
|
277
|
+
const ss = typeof item.value === 'string'
|
|
278
|
+
? item
|
|
279
|
+
: Object.assign({}, item, { value: String(item.value) });
|
|
280
|
+
let { type } = item;
|
|
281
|
+
if (type !== Scalar.QUOTE_DOUBLE) {
|
|
282
|
+
// force double quotes on control characters & unpaired surrogates
|
|
283
|
+
if (/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(ss.value))
|
|
284
|
+
type = Scalar.QUOTE_DOUBLE;
|
|
285
|
+
}
|
|
286
|
+
const _stringify = (_type) => {
|
|
287
|
+
switch (_type) {
|
|
288
|
+
case Scalar.BLOCK_FOLDED:
|
|
289
|
+
case Scalar.BLOCK_LITERAL:
|
|
290
|
+
return implicitKey || inFlow
|
|
291
|
+
? quotedString(ss.value, ctx) // blocks are not valid inside flow containers
|
|
292
|
+
: blockString(ss, ctx, onComment, onChompKeep);
|
|
293
|
+
case Scalar.QUOTE_DOUBLE:
|
|
294
|
+
return doubleQuotedString(ss.value, ctx);
|
|
295
|
+
case Scalar.QUOTE_SINGLE:
|
|
296
|
+
return singleQuotedString(ss.value, ctx);
|
|
297
|
+
case Scalar.PLAIN:
|
|
298
|
+
return plainString(ss, ctx, onComment, onChompKeep);
|
|
299
|
+
default:
|
|
300
|
+
return null;
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
let res = _stringify(type);
|
|
304
|
+
if (res === null) {
|
|
305
|
+
const { defaultKeyType, defaultStringType } = ctx.options;
|
|
306
|
+
const t = (implicitKey && defaultKeyType) || defaultStringType;
|
|
307
|
+
res = _stringify(t);
|
|
308
|
+
if (res === null)
|
|
309
|
+
throw new Error(`Unsupported default string type ${t}`);
|
|
310
|
+
}
|
|
311
|
+
return res;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export { stringifyString };
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { debug, warn } from './log.js';
|
|
2
|
+
export { findPair } from './nodes/YAMLMap.js';
|
|
3
|
+
export { toJS } from './nodes/toJS.js';
|
|
4
|
+
export { map as mapTag } from './schema/common/map.js';
|
|
5
|
+
export { seq as seqTag } from './schema/common/seq.js';
|
|
6
|
+
export { string as stringTag } from './schema/common/string.js';
|
|
7
|
+
export { foldFlowLines } from './stringify/foldFlowLines.js';
|
|
8
|
+
export { stringifyNumber } from './stringify/stringifyNumber.js';
|
|
9
|
+
export { stringifyString } from './stringify/stringifyString.js';
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { isDocument, isMap, isSeq, isPair, isScalar, isAlias, isNode, isCollection } from './nodes/Node.js';
|
|
2
|
+
|
|
3
|
+
const BREAK = Symbol('break visit');
|
|
4
|
+
const SKIP = Symbol('skip children');
|
|
5
|
+
const REMOVE = Symbol('remove node');
|
|
6
|
+
/**
|
|
7
|
+
* Apply a visitor to an AST node or document.
|
|
8
|
+
*
|
|
9
|
+
* Walks through the tree (depth-first) starting from `node`, calling a
|
|
10
|
+
* `visitor` function with three arguments:
|
|
11
|
+
* - `key`: For sequence values and map `Pair`, the node's index in the
|
|
12
|
+
* collection. Within a `Pair`, `'key'` or `'value'`, correspondingly.
|
|
13
|
+
* `null` for the root node.
|
|
14
|
+
* - `node`: The current node.
|
|
15
|
+
* - `path`: The ancestry of the current node.
|
|
16
|
+
*
|
|
17
|
+
* The return value of the visitor may be used to control the traversal:
|
|
18
|
+
* - `undefined` (default): Do nothing and continue
|
|
19
|
+
* - `visit.SKIP`: Do not visit the children of this node, continue with next
|
|
20
|
+
* sibling
|
|
21
|
+
* - `visit.BREAK`: Terminate traversal completely
|
|
22
|
+
* - `visit.REMOVE`: Remove the current node, then continue with the next one
|
|
23
|
+
* - `Node`: Replace the current node, then continue by visiting it
|
|
24
|
+
* - `number`: While iterating the items of a sequence or map, set the index
|
|
25
|
+
* of the next step. This is useful especially if the index of the current
|
|
26
|
+
* node has changed.
|
|
27
|
+
*
|
|
28
|
+
* If `visitor` is a single function, it will be called with all values
|
|
29
|
+
* encountered in the tree, including e.g. `null` values. Alternatively,
|
|
30
|
+
* separate visitor functions may be defined for each `Map`, `Pair`, `Seq`,
|
|
31
|
+
* `Alias` and `Scalar` node. To define the same visitor function for more than
|
|
32
|
+
* one node type, use the `Collection` (map and seq), `Value` (map, seq & scalar)
|
|
33
|
+
* and `Node` (alias, map, seq & scalar) targets. Of all these, only the most
|
|
34
|
+
* specific defined one will be used for each node.
|
|
35
|
+
*/
|
|
36
|
+
function visit(node, visitor) {
|
|
37
|
+
if (typeof visitor === 'object' &&
|
|
38
|
+
(visitor.Collection || visitor.Node || visitor.Value)) {
|
|
39
|
+
visitor = Object.assign({
|
|
40
|
+
Alias: visitor.Node,
|
|
41
|
+
Map: visitor.Node,
|
|
42
|
+
Scalar: visitor.Node,
|
|
43
|
+
Seq: visitor.Node
|
|
44
|
+
}, visitor.Value && {
|
|
45
|
+
Map: visitor.Value,
|
|
46
|
+
Scalar: visitor.Value,
|
|
47
|
+
Seq: visitor.Value
|
|
48
|
+
}, visitor.Collection && {
|
|
49
|
+
Map: visitor.Collection,
|
|
50
|
+
Seq: visitor.Collection
|
|
51
|
+
}, visitor);
|
|
52
|
+
}
|
|
53
|
+
if (isDocument(node)) {
|
|
54
|
+
const cd = _visit(null, node.contents, visitor, Object.freeze([node]));
|
|
55
|
+
if (cd === REMOVE)
|
|
56
|
+
node.contents = null;
|
|
57
|
+
}
|
|
58
|
+
else
|
|
59
|
+
_visit(null, node, visitor, Object.freeze([]));
|
|
60
|
+
}
|
|
61
|
+
// Without the `as symbol` casts, TS declares these in the `visit`
|
|
62
|
+
// namespace using `var`, but then complains about that because
|
|
63
|
+
// `unique symbol` must be `const`.
|
|
64
|
+
/** Terminate visit traversal completely */
|
|
65
|
+
visit.BREAK = BREAK;
|
|
66
|
+
/** Do not visit the children of the current node */
|
|
67
|
+
visit.SKIP = SKIP;
|
|
68
|
+
/** Remove the current node */
|
|
69
|
+
visit.REMOVE = REMOVE;
|
|
70
|
+
function _visit(key, node, visitor, path) {
|
|
71
|
+
let ctrl = undefined;
|
|
72
|
+
if (typeof visitor === 'function')
|
|
73
|
+
ctrl = visitor(key, node, path);
|
|
74
|
+
else if (isMap(node)) {
|
|
75
|
+
if (visitor.Map)
|
|
76
|
+
ctrl = visitor.Map(key, node, path);
|
|
77
|
+
}
|
|
78
|
+
else if (isSeq(node)) {
|
|
79
|
+
if (visitor.Seq)
|
|
80
|
+
ctrl = visitor.Seq(key, node, path);
|
|
81
|
+
}
|
|
82
|
+
else if (isPair(node)) {
|
|
83
|
+
if (visitor.Pair)
|
|
84
|
+
ctrl = visitor.Pair(key, node, path);
|
|
85
|
+
}
|
|
86
|
+
else if (isScalar(node)) {
|
|
87
|
+
if (visitor.Scalar)
|
|
88
|
+
ctrl = visitor.Scalar(key, node, path);
|
|
89
|
+
}
|
|
90
|
+
else if (isAlias(node)) {
|
|
91
|
+
if (visitor.Alias)
|
|
92
|
+
ctrl = visitor.Alias(key, node, path);
|
|
93
|
+
}
|
|
94
|
+
if (isNode(ctrl) || isPair(ctrl)) {
|
|
95
|
+
const parent = path[path.length - 1];
|
|
96
|
+
if (isCollection(parent)) {
|
|
97
|
+
parent.items[key] = ctrl;
|
|
98
|
+
}
|
|
99
|
+
else if (isPair(parent)) {
|
|
100
|
+
if (key === 'key')
|
|
101
|
+
parent.key = ctrl;
|
|
102
|
+
else
|
|
103
|
+
parent.value = ctrl;
|
|
104
|
+
}
|
|
105
|
+
else if (isDocument(parent)) {
|
|
106
|
+
parent.contents = ctrl;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
const pt = isAlias(parent) ? 'alias' : 'scalar';
|
|
110
|
+
throw new Error(`Cannot replace node with ${pt} parent`);
|
|
111
|
+
}
|
|
112
|
+
return _visit(key, ctrl, visitor, path);
|
|
113
|
+
}
|
|
114
|
+
if (typeof ctrl !== 'symbol') {
|
|
115
|
+
if (isCollection(node)) {
|
|
116
|
+
path = Object.freeze(path.concat(node));
|
|
117
|
+
for (let i = 0; i < node.items.length; ++i) {
|
|
118
|
+
const ci = _visit(i, node.items[i], visitor, path);
|
|
119
|
+
if (typeof ci === 'number')
|
|
120
|
+
i = ci - 1;
|
|
121
|
+
else if (ci === BREAK)
|
|
122
|
+
return BREAK;
|
|
123
|
+
else if (ci === REMOVE) {
|
|
124
|
+
node.items.splice(i, 1);
|
|
125
|
+
i -= 1;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else if (isPair(node)) {
|
|
130
|
+
path = Object.freeze(path.concat(node));
|
|
131
|
+
const ck = _visit('key', node.key, visitor, path);
|
|
132
|
+
if (ck === BREAK)
|
|
133
|
+
return BREAK;
|
|
134
|
+
else if (ck === REMOVE)
|
|
135
|
+
node.key = null;
|
|
136
|
+
const cv = _visit('value', node.value, visitor, path);
|
|
137
|
+
if (cv === BREAK)
|
|
138
|
+
return BREAK;
|
|
139
|
+
else if (cv === REMOVE)
|
|
140
|
+
node.value = null;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return ctrl;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export { visit };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ParsedNode } from '../nodes/Node.js';
|
|
2
|
+
import type { BlockMap, BlockSequence, FlowCollection, SourceToken } from '../parse/cst.js';
|
|
3
|
+
import type { ComposeContext, ComposeNode } from './compose-node.js';
|
|
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;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Node = require('../nodes/Node.js');
|
|
4
|
+
var Scalar = require('../nodes/Scalar.js');
|
|
5
|
+
var resolveBlockMap = require('./resolve-block-map.js');
|
|
6
|
+
var resolveBlockSeq = require('./resolve-block-seq.js');
|
|
7
|
+
var resolveFlowCollection = require('./resolve-flow-collection.js');
|
|
8
|
+
|
|
9
|
+
function composeCollection(CN, ctx, token, tagToken, onError) {
|
|
10
|
+
let coll;
|
|
11
|
+
switch (token.type) {
|
|
12
|
+
case 'block-map': {
|
|
13
|
+
coll = resolveBlockMap.resolveBlockMap(CN, ctx, token, onError);
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
case 'block-seq': {
|
|
17
|
+
coll = resolveBlockSeq.resolveBlockSeq(CN, ctx, token, onError);
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
case 'flow-collection': {
|
|
21
|
+
coll = resolveFlowCollection.resolveFlowCollection(CN, ctx, token, onError);
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (!tagToken)
|
|
26
|
+
return coll;
|
|
27
|
+
const tagName = ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg));
|
|
28
|
+
if (!tagName)
|
|
29
|
+
return coll;
|
|
30
|
+
// Cast needed due to: https://github.com/Microsoft/TypeScript/issues/3841
|
|
31
|
+
const Coll = coll.constructor;
|
|
32
|
+
if (tagName === '!' || tagName === Coll.tagName) {
|
|
33
|
+
coll.tag = Coll.tagName;
|
|
34
|
+
return coll;
|
|
35
|
+
}
|
|
36
|
+
const expType = Node.isMap(coll) ? 'map' : 'seq';
|
|
37
|
+
let tag = ctx.schema.tags.find(t => t.collection === expType && t.tag === tagName);
|
|
38
|
+
if (!tag) {
|
|
39
|
+
const kt = ctx.schema.knownTags[tagName];
|
|
40
|
+
if (kt && kt.collection === expType) {
|
|
41
|
+
ctx.schema.tags.push(Object.assign({}, kt, { default: false }));
|
|
42
|
+
tag = kt;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);
|
|
46
|
+
coll.tag = tagName;
|
|
47
|
+
return coll;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const res = tag.resolve(coll, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg), ctx.options);
|
|
51
|
+
const node = Node.isNode(res)
|
|
52
|
+
? res
|
|
53
|
+
: new Scalar.Scalar(res);
|
|
54
|
+
node.range = coll.range;
|
|
55
|
+
node.tag = tagName;
|
|
56
|
+
if (tag === null || tag === void 0 ? void 0 : tag.format)
|
|
57
|
+
node.format = tag.format;
|
|
58
|
+
return node;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
exports.composeCollection = composeCollection;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Directives } from '../doc/directives.js';
|
|
2
|
+
import { Document } from '../doc/Document.js';
|
|
3
|
+
import type { DocumentOptions, ParseOptions, SchemaOptions } from '../options.js';
|
|
4
|
+
import type * as CST from '../parse/cst.js';
|
|
5
|
+
import type { ComposeErrorHandler } from './composer.js';
|
|
6
|
+
export declare function composeDoc(options: ParseOptions & DocumentOptions & SchemaOptions, directives: Directives, { offset, start, value, end }: CST.Document, onError: ComposeErrorHandler): Document.Parsed<import("../index.js").ParsedNode>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Document = require('../doc/Document.js');
|
|
4
|
+
var composeNode = require('./compose-node.js');
|
|
5
|
+
var resolveEnd = require('./resolve-end.js');
|
|
6
|
+
var resolveProps = require('./resolve-props.js');
|
|
7
|
+
|
|
8
|
+
function composeDoc(options, directives, { offset, start, value, end }, onError) {
|
|
9
|
+
const opts = Object.assign({ directives }, options);
|
|
10
|
+
const doc = new Document.Document(undefined, opts);
|
|
11
|
+
const ctx = {
|
|
12
|
+
atRoot: true,
|
|
13
|
+
directives: doc.directives,
|
|
14
|
+
options: doc.options,
|
|
15
|
+
schema: doc.schema
|
|
16
|
+
};
|
|
17
|
+
const props = resolveProps.resolveProps(start, {
|
|
18
|
+
indicator: 'doc-start',
|
|
19
|
+
next: value || (end === null || end === void 0 ? void 0 : end[0]),
|
|
20
|
+
offset,
|
|
21
|
+
onError,
|
|
22
|
+
startOnNewline: true
|
|
23
|
+
});
|
|
24
|
+
if (props.found) {
|
|
25
|
+
doc.directives.marker = true;
|
|
26
|
+
if (value &&
|
|
27
|
+
(value.type === 'block-map' || value.type === 'block-seq') &&
|
|
28
|
+
!props.hasNewline)
|
|
29
|
+
onError(props.end, 'MISSING_CHAR', 'Block collection cannot start on same line with directives-end marker');
|
|
30
|
+
}
|
|
31
|
+
doc.contents = value
|
|
32
|
+
? composeNode.composeNode(ctx, value, props, onError)
|
|
33
|
+
: composeNode.composeEmptyNode(ctx, props.end, start, null, props, onError);
|
|
34
|
+
const contentEnd = doc.contents.range[2];
|
|
35
|
+
const re = resolveEnd.resolveEnd(end, contentEnd, false, onError);
|
|
36
|
+
if (re.comment)
|
|
37
|
+
doc.comment = re.comment;
|
|
38
|
+
doc.range = [offset, contentEnd, re.offset];
|
|
39
|
+
return doc;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
exports.composeDoc = composeDoc;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Directives } from '../doc/directives.js';
|
|
2
|
+
import type { ParsedNode } from '../nodes/Node.js';
|
|
3
|
+
import type { ParseOptions } from '../options.js';
|
|
4
|
+
import type { SourceToken, Token } from '../parse/cst.js';
|
|
5
|
+
import type { Schema } from '../schema/Schema.js';
|
|
6
|
+
import type { ComposeErrorHandler } from './composer.js';
|
|
7
|
+
export interface ComposeContext {
|
|
8
|
+
atRoot: boolean;
|
|
9
|
+
directives: Directives;
|
|
10
|
+
options: Readonly<Required<Omit<ParseOptions, 'lineCounter'>>>;
|
|
11
|
+
schema: Readonly<Schema>;
|
|
12
|
+
}
|
|
13
|
+
interface Props {
|
|
14
|
+
spaceBefore: boolean;
|
|
15
|
+
comment: string;
|
|
16
|
+
anchor: SourceToken | null;
|
|
17
|
+
tag: SourceToken | null;
|
|
18
|
+
}
|
|
19
|
+
declare const CN: {
|
|
20
|
+
composeNode: typeof composeNode;
|
|
21
|
+
composeEmptyNode: typeof composeEmptyNode;
|
|
22
|
+
};
|
|
23
|
+
export declare type ComposeNode = typeof CN;
|
|
24
|
+
export declare function composeNode(ctx: ComposeContext, token: Token, props: Props, onError: ComposeErrorHandler): ParsedNode;
|
|
25
|
+
export declare function composeEmptyNode(ctx: ComposeContext, offset: number, before: Token[] | undefined, pos: number | null, { spaceBefore, comment, anchor, tag }: Props, onError: ComposeErrorHandler): import("../index.js").Scalar.Parsed;
|
|
26
|
+
export {};
|