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,14 @@
|
|
|
1
|
+
function debug(logLevel, ...messages) {
|
|
2
|
+
if (logLevel === 'debug')
|
|
3
|
+
console.log(...messages);
|
|
4
|
+
}
|
|
5
|
+
function warn(logLevel, warning) {
|
|
6
|
+
if (logLevel === 'debug' || logLevel === 'warn') {
|
|
7
|
+
if (typeof process !== 'undefined' && process.emitWarning)
|
|
8
|
+
process.emitWarning(warning);
|
|
9
|
+
else
|
|
10
|
+
console.warn(warning);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { debug, warn };
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/*! *****************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation.
|
|
3
|
+
|
|
4
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
+
purpose with or without fee is hereby granted.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
|
|
16
|
+
/* global Reflect, Promise */
|
|
17
|
+
var extendStatics = function (d, b) {
|
|
18
|
+
extendStatics = Object.setPrototypeOf || {
|
|
19
|
+
__proto__: []
|
|
20
|
+
} instanceof Array && function (d, b) {
|
|
21
|
+
d.__proto__ = b;
|
|
22
|
+
} || function (d, b) {
|
|
23
|
+
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return extendStatics(d, b);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
function __extends(d, b) {
|
|
30
|
+
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
31
|
+
extendStatics(d, b);
|
|
32
|
+
|
|
33
|
+
function __() {
|
|
34
|
+
this.constructor = d;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
38
|
+
}
|
|
39
|
+
function __generator(thisArg, body) {
|
|
40
|
+
var _ = {
|
|
41
|
+
label: 0,
|
|
42
|
+
sent: function () {
|
|
43
|
+
if (t[0] & 1) throw t[1];
|
|
44
|
+
return t[1];
|
|
45
|
+
},
|
|
46
|
+
trys: [],
|
|
47
|
+
ops: []
|
|
48
|
+
},
|
|
49
|
+
f,
|
|
50
|
+
y,
|
|
51
|
+
t,
|
|
52
|
+
g;
|
|
53
|
+
return g = {
|
|
54
|
+
next: verb(0),
|
|
55
|
+
"throw": verb(1),
|
|
56
|
+
"return": verb(2)
|
|
57
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
58
|
+
return this;
|
|
59
|
+
}), g;
|
|
60
|
+
|
|
61
|
+
function verb(n) {
|
|
62
|
+
return function (v) {
|
|
63
|
+
return step([n, v]);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function step(op) {
|
|
68
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
69
|
+
|
|
70
|
+
while (_) try {
|
|
71
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
72
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
73
|
+
|
|
74
|
+
switch (op[0]) {
|
|
75
|
+
case 0:
|
|
76
|
+
case 1:
|
|
77
|
+
t = op;
|
|
78
|
+
break;
|
|
79
|
+
|
|
80
|
+
case 4:
|
|
81
|
+
_.label++;
|
|
82
|
+
return {
|
|
83
|
+
value: op[1],
|
|
84
|
+
done: false
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
case 5:
|
|
88
|
+
_.label++;
|
|
89
|
+
y = op[1];
|
|
90
|
+
op = [0];
|
|
91
|
+
continue;
|
|
92
|
+
|
|
93
|
+
case 7:
|
|
94
|
+
op = _.ops.pop();
|
|
95
|
+
|
|
96
|
+
_.trys.pop();
|
|
97
|
+
|
|
98
|
+
continue;
|
|
99
|
+
|
|
100
|
+
default:
|
|
101
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
102
|
+
_ = 0;
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
107
|
+
_.label = op[1];
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
112
|
+
_.label = t[1];
|
|
113
|
+
t = op;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (t && _.label < t[2]) {
|
|
118
|
+
_.label = t[2];
|
|
119
|
+
|
|
120
|
+
_.ops.push(op);
|
|
121
|
+
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (t[2]) _.ops.pop();
|
|
126
|
+
|
|
127
|
+
_.trys.pop();
|
|
128
|
+
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
op = body.call(thisArg, _);
|
|
133
|
+
} catch (e) {
|
|
134
|
+
op = [6, e];
|
|
135
|
+
y = 0;
|
|
136
|
+
} finally {
|
|
137
|
+
f = t = 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (op[0] & 5) throw op[1];
|
|
141
|
+
return {
|
|
142
|
+
value: op[0] ? op[1] : void 0,
|
|
143
|
+
done: true
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function __values(o) {
|
|
148
|
+
var s = typeof Symbol === "function" && Symbol.iterator,
|
|
149
|
+
m = s && o[s],
|
|
150
|
+
i = 0;
|
|
151
|
+
if (m) return m.call(o);
|
|
152
|
+
if (o && typeof o.length === "number") return {
|
|
153
|
+
next: function () {
|
|
154
|
+
if (o && i >= o.length) o = void 0;
|
|
155
|
+
return {
|
|
156
|
+
value: o && o[i++],
|
|
157
|
+
done: !o
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export { __extends, __generator, __values };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { anchorIsValid } from '../doc/anchors.js';
|
|
2
|
+
import { visit } from '../visit.js';
|
|
3
|
+
import { NodeBase, ALIAS, isAlias, isCollection, isPair } from './Node.js';
|
|
4
|
+
|
|
5
|
+
class Alias extends NodeBase {
|
|
6
|
+
constructor(source) {
|
|
7
|
+
super(ALIAS);
|
|
8
|
+
this.source = source;
|
|
9
|
+
Object.defineProperty(this, 'tag', {
|
|
10
|
+
set() {
|
|
11
|
+
throw new Error('Alias nodes cannot have tags');
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Resolve the value of this alias within `doc`, finding the last
|
|
17
|
+
* instance of the `source` anchor before this node.
|
|
18
|
+
*/
|
|
19
|
+
resolve(doc) {
|
|
20
|
+
let found = undefined;
|
|
21
|
+
visit(doc, {
|
|
22
|
+
Node: (_key, node) => {
|
|
23
|
+
if (node === this)
|
|
24
|
+
return visit.BREAK;
|
|
25
|
+
if (node.anchor === this.source)
|
|
26
|
+
found = node;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return found;
|
|
30
|
+
}
|
|
31
|
+
toJSON(_arg, ctx) {
|
|
32
|
+
if (!ctx)
|
|
33
|
+
return { source: this.source };
|
|
34
|
+
const { anchors, doc, maxAliasCount } = ctx;
|
|
35
|
+
const source = this.resolve(doc);
|
|
36
|
+
if (!source) {
|
|
37
|
+
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
38
|
+
throw new ReferenceError(msg);
|
|
39
|
+
}
|
|
40
|
+
const data = anchors.get(source);
|
|
41
|
+
/* istanbul ignore if */
|
|
42
|
+
if (!data || data.res === undefined) {
|
|
43
|
+
const msg = 'This should not happen: Alias anchor was not resolved?';
|
|
44
|
+
throw new ReferenceError(msg);
|
|
45
|
+
}
|
|
46
|
+
if (maxAliasCount >= 0) {
|
|
47
|
+
data.count += 1;
|
|
48
|
+
if (data.aliasCount === 0)
|
|
49
|
+
data.aliasCount = getAliasCount(doc, source, anchors);
|
|
50
|
+
if (data.count * data.aliasCount > maxAliasCount) {
|
|
51
|
+
const msg = 'Excessive alias count indicates a resource exhaustion attack';
|
|
52
|
+
throw new ReferenceError(msg);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return data.res;
|
|
56
|
+
}
|
|
57
|
+
toString(ctx, _onComment, _onChompKeep) {
|
|
58
|
+
const src = `*${this.source}`;
|
|
59
|
+
if (ctx) {
|
|
60
|
+
anchorIsValid(this.source);
|
|
61
|
+
if (ctx.options.verifyAliasOrder && !ctx.anchors.has(this.source)) {
|
|
62
|
+
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
63
|
+
throw new Error(msg);
|
|
64
|
+
}
|
|
65
|
+
if (ctx.implicitKey)
|
|
66
|
+
return `${src} `;
|
|
67
|
+
}
|
|
68
|
+
return src;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function getAliasCount(doc, node, anchors) {
|
|
72
|
+
if (isAlias(node)) {
|
|
73
|
+
const source = node.resolve(doc);
|
|
74
|
+
const anchor = anchors && source && anchors.get(source);
|
|
75
|
+
return anchor ? anchor.count * anchor.aliasCount : 0;
|
|
76
|
+
}
|
|
77
|
+
else if (isCollection(node)) {
|
|
78
|
+
let count = 0;
|
|
79
|
+
for (const item of node.items) {
|
|
80
|
+
const c = getAliasCount(doc, item, anchors);
|
|
81
|
+
if (c > count)
|
|
82
|
+
count = c;
|
|
83
|
+
}
|
|
84
|
+
return count;
|
|
85
|
+
}
|
|
86
|
+
else if (isPair(node)) {
|
|
87
|
+
const kc = getAliasCount(doc, node.key, anchors);
|
|
88
|
+
const vc = getAliasCount(doc, node.value, anchors);
|
|
89
|
+
return Math.max(kc, vc);
|
|
90
|
+
}
|
|
91
|
+
return 1;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export { Alias };
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { createNode } from '../doc/createNode.js';
|
|
2
|
+
import { NodeBase, isNode, isPair, isCollection, isScalar } from './Node.js';
|
|
3
|
+
|
|
4
|
+
function collectionFromPath(schema, path, value) {
|
|
5
|
+
let v = value;
|
|
6
|
+
for (let i = path.length - 1; i >= 0; --i) {
|
|
7
|
+
const k = path[i];
|
|
8
|
+
if (typeof k === 'number' && Number.isInteger(k) && k >= 0) {
|
|
9
|
+
const a = [];
|
|
10
|
+
a[k] = v;
|
|
11
|
+
v = a;
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
v = new Map([[k, v]]);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return createNode(v, undefined, {
|
|
18
|
+
aliasDuplicateObjects: false,
|
|
19
|
+
keepUndefined: false,
|
|
20
|
+
onAnchor: () => {
|
|
21
|
+
throw new Error('This should not happen, please report a bug.');
|
|
22
|
+
},
|
|
23
|
+
schema,
|
|
24
|
+
sourceObjects: new Map()
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
// null, undefined, or an empty non-string iterable (e.g. [])
|
|
28
|
+
const isEmptyPath = (path) => path == null ||
|
|
29
|
+
(typeof path === 'object' && !!path[Symbol.iterator]().next().done);
|
|
30
|
+
class Collection extends NodeBase {
|
|
31
|
+
constructor(type, schema) {
|
|
32
|
+
super(type);
|
|
33
|
+
Object.defineProperty(this, 'schema', {
|
|
34
|
+
value: schema,
|
|
35
|
+
configurable: true,
|
|
36
|
+
enumerable: false,
|
|
37
|
+
writable: true
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Create a copy of this collection.
|
|
42
|
+
*
|
|
43
|
+
* @param schema - If defined, overwrites the original's schema
|
|
44
|
+
*/
|
|
45
|
+
clone(schema) {
|
|
46
|
+
const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
47
|
+
if (schema)
|
|
48
|
+
copy.schema = schema;
|
|
49
|
+
copy.items = copy.items.map(it => isNode(it) || isPair(it) ? it.clone(schema) : it);
|
|
50
|
+
if (this.range)
|
|
51
|
+
copy.range = this.range.slice();
|
|
52
|
+
return copy;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Adds a value to the collection. For `!!map` and `!!omap` the value must
|
|
56
|
+
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
57
|
+
* that already exists in the map.
|
|
58
|
+
*/
|
|
59
|
+
addIn(path, value) {
|
|
60
|
+
if (isEmptyPath(path))
|
|
61
|
+
this.add(value);
|
|
62
|
+
else {
|
|
63
|
+
const [key, ...rest] = path;
|
|
64
|
+
const node = this.get(key, true);
|
|
65
|
+
if (isCollection(node))
|
|
66
|
+
node.addIn(rest, value);
|
|
67
|
+
else if (node === undefined && this.schema)
|
|
68
|
+
this.set(key, collectionFromPath(this.schema, rest, value));
|
|
69
|
+
else
|
|
70
|
+
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Removes a value from the collection.
|
|
75
|
+
* @returns `true` if the item was found and removed.
|
|
76
|
+
*/
|
|
77
|
+
deleteIn(path) {
|
|
78
|
+
const [key, ...rest] = path;
|
|
79
|
+
if (rest.length === 0)
|
|
80
|
+
return this.delete(key);
|
|
81
|
+
const node = this.get(key, true);
|
|
82
|
+
if (isCollection(node))
|
|
83
|
+
return node.deleteIn(rest);
|
|
84
|
+
else
|
|
85
|
+
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
89
|
+
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
90
|
+
* `true` (collections are always returned intact).
|
|
91
|
+
*/
|
|
92
|
+
getIn(path, keepScalar) {
|
|
93
|
+
const [key, ...rest] = path;
|
|
94
|
+
const node = this.get(key, true);
|
|
95
|
+
if (rest.length === 0)
|
|
96
|
+
return !keepScalar && isScalar(node) ? node.value : node;
|
|
97
|
+
else
|
|
98
|
+
return isCollection(node) ? node.getIn(rest, keepScalar) : undefined;
|
|
99
|
+
}
|
|
100
|
+
hasAllNullValues(allowScalar) {
|
|
101
|
+
return this.items.every(node => {
|
|
102
|
+
if (!isPair(node))
|
|
103
|
+
return false;
|
|
104
|
+
const n = node.value;
|
|
105
|
+
return (n == null ||
|
|
106
|
+
(allowScalar &&
|
|
107
|
+
isScalar(n) &&
|
|
108
|
+
n.value == null &&
|
|
109
|
+
!n.commentBefore &&
|
|
110
|
+
!n.comment &&
|
|
111
|
+
!n.tag));
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Checks if the collection includes a value with the key `key`.
|
|
116
|
+
*/
|
|
117
|
+
hasIn(path) {
|
|
118
|
+
const [key, ...rest] = path;
|
|
119
|
+
if (rest.length === 0)
|
|
120
|
+
return this.has(key);
|
|
121
|
+
const node = this.get(key, true);
|
|
122
|
+
return isCollection(node) ? node.hasIn(rest) : false;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
126
|
+
* boolean to add/remove the item from the set.
|
|
127
|
+
*/
|
|
128
|
+
setIn(path, value) {
|
|
129
|
+
const [key, ...rest] = path;
|
|
130
|
+
if (rest.length === 0) {
|
|
131
|
+
this.set(key, value);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
const node = this.get(key, true);
|
|
135
|
+
if (isCollection(node))
|
|
136
|
+
node.setIn(rest, value);
|
|
137
|
+
else if (node === undefined && this.schema)
|
|
138
|
+
this.set(key, collectionFromPath(this.schema, rest, value));
|
|
139
|
+
else
|
|
140
|
+
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
Collection.maxFlowStringSingleLineLength = 60;
|
|
145
|
+
|
|
146
|
+
export { Collection, collectionFromPath, isEmptyPath };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const ALIAS = Symbol.for('yaml.alias');
|
|
2
|
+
const DOC = Symbol.for('yaml.document');
|
|
3
|
+
const MAP = Symbol.for('yaml.map');
|
|
4
|
+
const PAIR = Symbol.for('yaml.pair');
|
|
5
|
+
const SCALAR = Symbol.for('yaml.scalar');
|
|
6
|
+
const SEQ = Symbol.for('yaml.seq');
|
|
7
|
+
const NODE_TYPE = Symbol.for('yaml.node.type');
|
|
8
|
+
const isAlias = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === ALIAS;
|
|
9
|
+
const isDocument = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === DOC;
|
|
10
|
+
const isMap = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === MAP;
|
|
11
|
+
const isPair = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === PAIR;
|
|
12
|
+
const isScalar = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === SCALAR;
|
|
13
|
+
const isSeq = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === SEQ;
|
|
14
|
+
function isCollection(node) {
|
|
15
|
+
if (node && typeof node === 'object')
|
|
16
|
+
switch (node[NODE_TYPE]) {
|
|
17
|
+
case MAP:
|
|
18
|
+
case SEQ:
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
function isNode(node) {
|
|
24
|
+
if (node && typeof node === 'object')
|
|
25
|
+
switch (node[NODE_TYPE]) {
|
|
26
|
+
case ALIAS:
|
|
27
|
+
case MAP:
|
|
28
|
+
case SCALAR:
|
|
29
|
+
case SEQ:
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
const hasAnchor = (node) => (isScalar(node) || isCollection(node)) && !!node.anchor;
|
|
35
|
+
class NodeBase {
|
|
36
|
+
constructor(type) {
|
|
37
|
+
Object.defineProperty(this, NODE_TYPE, { value: type });
|
|
38
|
+
}
|
|
39
|
+
/** Create a copy of this node. */
|
|
40
|
+
clone() {
|
|
41
|
+
const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
42
|
+
if (this.range)
|
|
43
|
+
copy.range = this.range.slice();
|
|
44
|
+
return copy;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { ALIAS, DOC, MAP, NODE_TYPE, NodeBase, PAIR, SCALAR, SEQ, hasAnchor, isAlias, isCollection, isDocument, isMap, isNode, isPair, isScalar, isSeq };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createNode } from '../doc/createNode.js';
|
|
2
|
+
import { stringifyPair } from '../stringify/stringifyPair.js';
|
|
3
|
+
import { addPairToJSMap } from './addPairToJSMap.js';
|
|
4
|
+
import { NODE_TYPE, PAIR, isNode } from './Node.js';
|
|
5
|
+
|
|
6
|
+
function createPair(key, value, ctx) {
|
|
7
|
+
const k = createNode(key, undefined, ctx);
|
|
8
|
+
const v = createNode(value, undefined, ctx);
|
|
9
|
+
return new Pair(k, v);
|
|
10
|
+
}
|
|
11
|
+
class Pair {
|
|
12
|
+
constructor(key, value = null) {
|
|
13
|
+
Object.defineProperty(this, NODE_TYPE, { value: PAIR });
|
|
14
|
+
this.key = key;
|
|
15
|
+
this.value = value;
|
|
16
|
+
}
|
|
17
|
+
clone(schema) {
|
|
18
|
+
let { key, value } = this;
|
|
19
|
+
if (isNode(key))
|
|
20
|
+
key = key.clone(schema);
|
|
21
|
+
if (isNode(value))
|
|
22
|
+
value = value.clone(schema);
|
|
23
|
+
return new Pair(key, value);
|
|
24
|
+
}
|
|
25
|
+
toJSON(_, ctx) {
|
|
26
|
+
const pair = ctx && ctx.mapAsMap ? new Map() : {};
|
|
27
|
+
return addPairToJSMap(ctx, pair, this);
|
|
28
|
+
}
|
|
29
|
+
toString(ctx, onComment, onChompKeep) {
|
|
30
|
+
return ctx && ctx.doc
|
|
31
|
+
? stringifyPair(this, ctx, onComment, onChompKeep)
|
|
32
|
+
: JSON.stringify(this);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { Pair, createPair };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { NodeBase, SCALAR } from './Node.js';
|
|
2
|
+
import { toJS } from './toJS.js';
|
|
3
|
+
|
|
4
|
+
const isScalarValue = (value) => !value || (typeof value !== 'function' && typeof value !== 'object');
|
|
5
|
+
class Scalar extends NodeBase {
|
|
6
|
+
constructor(value) {
|
|
7
|
+
super(SCALAR);
|
|
8
|
+
this.value = value;
|
|
9
|
+
}
|
|
10
|
+
toJSON(arg, ctx) {
|
|
11
|
+
return ctx && ctx.keep ? this.value : toJS(this.value, arg, ctx);
|
|
12
|
+
}
|
|
13
|
+
toString() {
|
|
14
|
+
return String(this.value);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
Scalar.BLOCK_FOLDED = 'BLOCK_FOLDED';
|
|
18
|
+
Scalar.BLOCK_LITERAL = 'BLOCK_LITERAL';
|
|
19
|
+
Scalar.PLAIN = 'PLAIN';
|
|
20
|
+
Scalar.QUOTE_DOUBLE = 'QUOTE_DOUBLE';
|
|
21
|
+
Scalar.QUOTE_SINGLE = 'QUOTE_SINGLE';
|
|
22
|
+
|
|
23
|
+
export { Scalar, isScalarValue };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { stringifyCollection } from '../stringify/stringifyCollection.js';
|
|
2
|
+
import { addPairToJSMap } from './addPairToJSMap.js';
|
|
3
|
+
import { Collection } from './Collection.js';
|
|
4
|
+
import { isPair, isScalar, MAP } from './Node.js';
|
|
5
|
+
import { Pair } from './Pair.js';
|
|
6
|
+
import { isScalarValue } from './Scalar.js';
|
|
7
|
+
|
|
8
|
+
function findPair(items, key) {
|
|
9
|
+
const k = isScalar(key) ? key.value : key;
|
|
10
|
+
for (const it of items) {
|
|
11
|
+
if (isPair(it)) {
|
|
12
|
+
if (it.key === key || it.key === k)
|
|
13
|
+
return it;
|
|
14
|
+
if (isScalar(it.key) && it.key.value === k)
|
|
15
|
+
return it;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
class YAMLMap extends Collection {
|
|
21
|
+
constructor(schema) {
|
|
22
|
+
super(MAP, schema);
|
|
23
|
+
this.items = [];
|
|
24
|
+
}
|
|
25
|
+
static get tagName() {
|
|
26
|
+
return 'tag:yaml.org,2002:map';
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Adds a value to the collection.
|
|
30
|
+
*
|
|
31
|
+
* @param overwrite - If not set `true`, using a key that is already in the
|
|
32
|
+
* collection will throw. Otherwise, overwrites the previous value.
|
|
33
|
+
*/
|
|
34
|
+
add(pair, overwrite) {
|
|
35
|
+
let _pair;
|
|
36
|
+
if (isPair(pair))
|
|
37
|
+
_pair = pair;
|
|
38
|
+
else if (!pair || typeof pair !== 'object' || !('key' in pair)) {
|
|
39
|
+
// In TypeScript, this never happens.
|
|
40
|
+
_pair = new Pair(pair, pair.value);
|
|
41
|
+
}
|
|
42
|
+
else
|
|
43
|
+
_pair = new Pair(pair.key, pair.value);
|
|
44
|
+
const prev = findPair(this.items, _pair.key);
|
|
45
|
+
const sortEntries = this.schema && this.schema.sortMapEntries;
|
|
46
|
+
if (prev) {
|
|
47
|
+
if (!overwrite)
|
|
48
|
+
throw new Error(`Key ${_pair.key} already set`);
|
|
49
|
+
// For scalars, keep the old node & its comments and anchors
|
|
50
|
+
if (isScalar(prev.value) && isScalarValue(_pair.value))
|
|
51
|
+
prev.value.value = _pair.value;
|
|
52
|
+
else
|
|
53
|
+
prev.value = _pair.value;
|
|
54
|
+
}
|
|
55
|
+
else if (sortEntries) {
|
|
56
|
+
const i = this.items.findIndex(item => sortEntries(_pair, item) < 0);
|
|
57
|
+
if (i === -1)
|
|
58
|
+
this.items.push(_pair);
|
|
59
|
+
else
|
|
60
|
+
this.items.splice(i, 0, _pair);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
this.items.push(_pair);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
delete(key) {
|
|
67
|
+
const it = findPair(this.items, key);
|
|
68
|
+
if (!it)
|
|
69
|
+
return false;
|
|
70
|
+
const del = this.items.splice(this.items.indexOf(it), 1);
|
|
71
|
+
return del.length > 0;
|
|
72
|
+
}
|
|
73
|
+
get(key, keepScalar) {
|
|
74
|
+
const it = findPair(this.items, key);
|
|
75
|
+
const node = it && it.value;
|
|
76
|
+
return !keepScalar && isScalar(node) ? node.value : node;
|
|
77
|
+
}
|
|
78
|
+
has(key) {
|
|
79
|
+
return !!findPair(this.items, key);
|
|
80
|
+
}
|
|
81
|
+
set(key, value) {
|
|
82
|
+
this.add(new Pair(key, value), true);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @param ctx - Conversion context, originally set in Document#toJS()
|
|
86
|
+
* @param {Class} Type - If set, forces the returned collection type
|
|
87
|
+
* @returns Instance of Type, Map, or Object
|
|
88
|
+
*/
|
|
89
|
+
toJSON(_, ctx, Type) {
|
|
90
|
+
const map = Type ? new Type() : ctx && ctx.mapAsMap ? new Map() : {};
|
|
91
|
+
if (ctx && ctx.onCreate)
|
|
92
|
+
ctx.onCreate(map);
|
|
93
|
+
for (const item of this.items)
|
|
94
|
+
addPairToJSMap(ctx, map, item);
|
|
95
|
+
return map;
|
|
96
|
+
}
|
|
97
|
+
toString(ctx, onComment, onChompKeep) {
|
|
98
|
+
if (!ctx)
|
|
99
|
+
return JSON.stringify(this);
|
|
100
|
+
for (const item of this.items) {
|
|
101
|
+
if (!isPair(item))
|
|
102
|
+
throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);
|
|
103
|
+
}
|
|
104
|
+
if (!ctx.allNullValues && this.hasAllNullValues(false))
|
|
105
|
+
ctx = Object.assign({}, ctx, { allNullValues: true });
|
|
106
|
+
return stringifyCollection(this, ctx, {
|
|
107
|
+
blockItemPrefix: '',
|
|
108
|
+
flowChars: { start: '{', end: '}' },
|
|
109
|
+
itemIndent: ctx.indent || '',
|
|
110
|
+
onChompKeep,
|
|
111
|
+
onComment
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export { YAMLMap, findPair };
|