projen 0.51.7 → 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 +42 -6
- package/API.md +10 -0
- package/changelog.md +1 -6
- 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 +1 -1
- 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.js +1 -1
- package/lib/github/task-workflow.js +1 -1
- package/lib/github/workflows.js +1 -1
- package/lib/gitlab/configuration.js +1 -1
- package/lib/gitlab/gitlab-configuration.js +1 -1
- package/lib/gitlab/nested-configuration.js +1 -1
- package/lib/gitpod.js +1 -1
- package/lib/ignore-file.js +1 -1
- package/lib/ini.js +1 -1
- package/lib/java/java-project.js +1 -1
- package/lib/java/junit.js +1 -1
- package/lib/java/maven-compile.js +1 -1
- package/lib/java/maven-packaging.js +1 -1
- package/lib/java/maven-sample.js +1 -1
- package/lib/java/pom.js +1 -1
- package/lib/java/projenrc.js +1 -1
- package/lib/javascript/bundler.js +1 -1
- package/lib/javascript/eslint.js +1 -1
- package/lib/javascript/jest.js +1 -1
- package/lib/javascript/node-package.js +1 -1
- package/lib/javascript/node-project.js +1 -1
- package/lib/javascript/npm-config.js +1 -1
- package/lib/javascript/prettier.js +1 -1
- package/lib/javascript/projenrc.js +1 -1
- package/lib/javascript/typescript-config.js +1 -1
- package/lib/javascript/upgrade-dependencies.js +2 -2
- package/lib/json.js +1 -1
- package/lib/license.js +1 -1
- package/lib/logger.js +1 -1
- package/lib/makefile.js +1 -1
- package/lib/object-file.js +1 -1
- package/lib/project-build.js +1 -1
- package/lib/project.js +1 -1
- package/lib/projects.js +1 -1
- package/lib/projenrc-json.js +1 -1
- package/lib/python/pip.js +1 -1
- package/lib/python/poetry.js +2 -2
- package/lib/python/projenrc.js +1 -1
- package/lib/python/pytest.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/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 +2 -2
- package/releasetag.txt +1 -1
- package/version.txt +1 -1
- 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,323 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Alias = require('../nodes/Alias.js');
|
|
4
|
+
var Collection = require('../nodes/Collection.js');
|
|
5
|
+
var Node = require('../nodes/Node.js');
|
|
6
|
+
var Pair = require('../nodes/Pair.js');
|
|
7
|
+
var toJS = require('../nodes/toJS.js');
|
|
8
|
+
var options = require('../options.js');
|
|
9
|
+
var Schema = require('../schema/Schema.js');
|
|
10
|
+
var stringify = require('../stringify/stringify.js');
|
|
11
|
+
var stringifyDocument = require('../stringify/stringifyDocument.js');
|
|
12
|
+
var anchors = require('./anchors.js');
|
|
13
|
+
var applyReviver = require('./applyReviver.js');
|
|
14
|
+
var createNode = require('./createNode.js');
|
|
15
|
+
var directives = require('./directives.js');
|
|
16
|
+
|
|
17
|
+
class Document {
|
|
18
|
+
constructor(value, replacer, options$1) {
|
|
19
|
+
/** A comment before this Document */
|
|
20
|
+
this.commentBefore = null;
|
|
21
|
+
/** A comment immediately after this Document */
|
|
22
|
+
this.comment = null;
|
|
23
|
+
/** Errors encountered during parsing. */
|
|
24
|
+
this.errors = [];
|
|
25
|
+
/** Warnings encountered during parsing. */
|
|
26
|
+
this.warnings = [];
|
|
27
|
+
Object.defineProperty(this, Node.NODE_TYPE, { value: Node.DOC });
|
|
28
|
+
let _replacer = null;
|
|
29
|
+
if (typeof replacer === 'function' || Array.isArray(replacer)) {
|
|
30
|
+
_replacer = replacer;
|
|
31
|
+
}
|
|
32
|
+
else if (options$1 === undefined && replacer) {
|
|
33
|
+
options$1 = replacer;
|
|
34
|
+
replacer = undefined;
|
|
35
|
+
}
|
|
36
|
+
const opt = Object.assign({}, options.defaultOptions, options$1);
|
|
37
|
+
this.options = opt;
|
|
38
|
+
let { version } = opt;
|
|
39
|
+
if (options$1 === null || options$1 === void 0 ? void 0 : options$1.directives) {
|
|
40
|
+
this.directives = options$1.directives.atDocument();
|
|
41
|
+
if (this.directives.yaml.explicit)
|
|
42
|
+
version = this.directives.yaml.version;
|
|
43
|
+
}
|
|
44
|
+
else
|
|
45
|
+
this.directives = new directives.Directives({ version });
|
|
46
|
+
this.setSchema(version, options$1);
|
|
47
|
+
if (value === undefined)
|
|
48
|
+
this.contents = null;
|
|
49
|
+
else {
|
|
50
|
+
this.contents = this.createNode(value, _replacer, options$1);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Create a deep copy of this Document and its contents.
|
|
55
|
+
*
|
|
56
|
+
* Custom Node values that inherit from `Object` still refer to their original instances.
|
|
57
|
+
*/
|
|
58
|
+
clone() {
|
|
59
|
+
const copy = Object.create(Document.prototype, {
|
|
60
|
+
[Node.NODE_TYPE]: { value: Node.DOC }
|
|
61
|
+
});
|
|
62
|
+
copy.commentBefore = this.commentBefore;
|
|
63
|
+
copy.comment = this.comment;
|
|
64
|
+
copy.errors = this.errors.slice();
|
|
65
|
+
copy.warnings = this.warnings.slice();
|
|
66
|
+
copy.options = Object.assign({}, this.options);
|
|
67
|
+
if (this.directives)
|
|
68
|
+
copy.directives = this.directives.clone();
|
|
69
|
+
copy.schema = this.schema.clone();
|
|
70
|
+
copy.contents = Node.isNode(this.contents)
|
|
71
|
+
? this.contents.clone(copy.schema)
|
|
72
|
+
: this.contents;
|
|
73
|
+
if (this.range)
|
|
74
|
+
copy.range = this.range.slice();
|
|
75
|
+
return copy;
|
|
76
|
+
}
|
|
77
|
+
/** Adds a value to the document. */
|
|
78
|
+
add(value) {
|
|
79
|
+
if (assertCollection(this.contents))
|
|
80
|
+
this.contents.add(value);
|
|
81
|
+
}
|
|
82
|
+
/** Adds a value to the document. */
|
|
83
|
+
addIn(path, value) {
|
|
84
|
+
if (assertCollection(this.contents))
|
|
85
|
+
this.contents.addIn(path, value);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
89
|
+
*
|
|
90
|
+
* If `node` already has an anchor, `name` is ignored.
|
|
91
|
+
* Otherwise, the `node.anchor` value will be set to `name`,
|
|
92
|
+
* or if an anchor with that name is already present in the document,
|
|
93
|
+
* `name` will be used as a prefix for a new unique anchor.
|
|
94
|
+
* If `name` is undefined, the generated anchor will use 'a' as a prefix.
|
|
95
|
+
*/
|
|
96
|
+
createAlias(node, name) {
|
|
97
|
+
if (!node.anchor) {
|
|
98
|
+
const prev = anchors.anchorNames(this);
|
|
99
|
+
node.anchor =
|
|
100
|
+
!name || prev.has(name) ? anchors.findNewAnchor(name || 'a', prev) : name;
|
|
101
|
+
}
|
|
102
|
+
return new Alias.Alias(node.anchor);
|
|
103
|
+
}
|
|
104
|
+
createNode(value, replacer, options) {
|
|
105
|
+
let _replacer = undefined;
|
|
106
|
+
if (typeof replacer === 'function') {
|
|
107
|
+
value = replacer.call({ '': value }, '', value);
|
|
108
|
+
_replacer = replacer;
|
|
109
|
+
}
|
|
110
|
+
else if (Array.isArray(replacer)) {
|
|
111
|
+
const keyToStr = (v) => typeof v === 'number' || v instanceof String || v instanceof Number;
|
|
112
|
+
const asStr = replacer.filter(keyToStr).map(String);
|
|
113
|
+
if (asStr.length > 0)
|
|
114
|
+
replacer = replacer.concat(asStr);
|
|
115
|
+
_replacer = replacer;
|
|
116
|
+
}
|
|
117
|
+
else if (options === undefined && replacer) {
|
|
118
|
+
options = replacer;
|
|
119
|
+
replacer = undefined;
|
|
120
|
+
}
|
|
121
|
+
const { aliasDuplicateObjects, anchorPrefix, flow, keepUndefined, onTagObj, tag } = options || {};
|
|
122
|
+
const { onAnchor, setAnchors, sourceObjects } = anchors.createNodeAnchors(this, anchorPrefix || 'a');
|
|
123
|
+
const ctx = {
|
|
124
|
+
aliasDuplicateObjects: aliasDuplicateObjects !== null && aliasDuplicateObjects !== void 0 ? aliasDuplicateObjects : true,
|
|
125
|
+
keepUndefined: keepUndefined !== null && keepUndefined !== void 0 ? keepUndefined : false,
|
|
126
|
+
onAnchor,
|
|
127
|
+
onTagObj,
|
|
128
|
+
replacer: _replacer,
|
|
129
|
+
schema: this.schema,
|
|
130
|
+
sourceObjects
|
|
131
|
+
};
|
|
132
|
+
const node = createNode.createNode(value, tag, ctx);
|
|
133
|
+
if (flow && Node.isCollection(node))
|
|
134
|
+
node.flow = true;
|
|
135
|
+
setAnchors();
|
|
136
|
+
return node;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Convert a key and a value into a `Pair` using the current schema,
|
|
140
|
+
* recursively wrapping all values as `Scalar` or `Collection` nodes.
|
|
141
|
+
*/
|
|
142
|
+
createPair(key, value, options = {}) {
|
|
143
|
+
const k = this.createNode(key, null, options);
|
|
144
|
+
const v = this.createNode(value, null, options);
|
|
145
|
+
return new Pair.Pair(k, v);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Removes a value from the document.
|
|
149
|
+
* @returns `true` if the item was found and removed.
|
|
150
|
+
*/
|
|
151
|
+
delete(key) {
|
|
152
|
+
return assertCollection(this.contents) ? this.contents.delete(key) : false;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Removes a value from the document.
|
|
156
|
+
* @returns `true` if the item was found and removed.
|
|
157
|
+
*/
|
|
158
|
+
deleteIn(path) {
|
|
159
|
+
if (Collection.isEmptyPath(path)) {
|
|
160
|
+
if (this.contents == null)
|
|
161
|
+
return false;
|
|
162
|
+
this.contents = null;
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
return assertCollection(this.contents)
|
|
166
|
+
? this.contents.deleteIn(path)
|
|
167
|
+
: false;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
171
|
+
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
172
|
+
* `true` (collections are always returned intact).
|
|
173
|
+
*/
|
|
174
|
+
get(key, keepScalar) {
|
|
175
|
+
return Node.isCollection(this.contents)
|
|
176
|
+
? this.contents.get(key, keepScalar)
|
|
177
|
+
: undefined;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Returns item at `path`, or `undefined` if not found. By default unwraps
|
|
181
|
+
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
182
|
+
* `true` (collections are always returned intact).
|
|
183
|
+
*/
|
|
184
|
+
getIn(path, keepScalar) {
|
|
185
|
+
if (Collection.isEmptyPath(path))
|
|
186
|
+
return !keepScalar && Node.isScalar(this.contents)
|
|
187
|
+
? this.contents.value
|
|
188
|
+
: this.contents;
|
|
189
|
+
return Node.isCollection(this.contents)
|
|
190
|
+
? this.contents.getIn(path, keepScalar)
|
|
191
|
+
: undefined;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Checks if the document includes a value with the key `key`.
|
|
195
|
+
*/
|
|
196
|
+
has(key) {
|
|
197
|
+
return Node.isCollection(this.contents) ? this.contents.has(key) : false;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Checks if the document includes a value at `path`.
|
|
201
|
+
*/
|
|
202
|
+
hasIn(path) {
|
|
203
|
+
if (Collection.isEmptyPath(path))
|
|
204
|
+
return this.contents !== undefined;
|
|
205
|
+
return Node.isCollection(this.contents) ? this.contents.hasIn(path) : false;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
209
|
+
* boolean to add/remove the item from the set.
|
|
210
|
+
*/
|
|
211
|
+
set(key, value) {
|
|
212
|
+
if (this.contents == null) {
|
|
213
|
+
this.contents = Collection.collectionFromPath(this.schema, [key], value);
|
|
214
|
+
}
|
|
215
|
+
else if (assertCollection(this.contents)) {
|
|
216
|
+
this.contents.set(key, value);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
221
|
+
* boolean to add/remove the item from the set.
|
|
222
|
+
*/
|
|
223
|
+
setIn(path, value) {
|
|
224
|
+
if (Collection.isEmptyPath(path))
|
|
225
|
+
this.contents = value;
|
|
226
|
+
else if (this.contents == null) {
|
|
227
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path), value);
|
|
228
|
+
}
|
|
229
|
+
else if (assertCollection(this.contents)) {
|
|
230
|
+
this.contents.setIn(path, value);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Change the YAML version and schema used by the document.
|
|
235
|
+
* A `null` version disables support for directives, explicit tags, anchors, and aliases.
|
|
236
|
+
* It also requires the `schema` option to be given as a `Schema` instance value.
|
|
237
|
+
*
|
|
238
|
+
* Overrides all previously set schema options.
|
|
239
|
+
*/
|
|
240
|
+
setSchema(version, options = {}) {
|
|
241
|
+
if (typeof version === 'number')
|
|
242
|
+
version = String(version);
|
|
243
|
+
let opt;
|
|
244
|
+
switch (version) {
|
|
245
|
+
case '1.1':
|
|
246
|
+
if (this.directives)
|
|
247
|
+
this.directives.yaml.version = '1.1';
|
|
248
|
+
else
|
|
249
|
+
this.directives = new directives.Directives({ version: '1.1' });
|
|
250
|
+
opt = { merge: true, resolveKnownTags: false, schema: 'yaml-1.1' };
|
|
251
|
+
break;
|
|
252
|
+
case '1.2':
|
|
253
|
+
if (this.directives)
|
|
254
|
+
this.directives.yaml.version = '1.2';
|
|
255
|
+
else
|
|
256
|
+
this.directives = new directives.Directives({ version: '1.2' });
|
|
257
|
+
opt = { merge: false, resolveKnownTags: true, schema: 'core' };
|
|
258
|
+
break;
|
|
259
|
+
case null:
|
|
260
|
+
if (this.directives)
|
|
261
|
+
delete this.directives;
|
|
262
|
+
opt = null;
|
|
263
|
+
break;
|
|
264
|
+
default: {
|
|
265
|
+
const sv = JSON.stringify(version);
|
|
266
|
+
throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${sv}`);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
// Not using `instanceof Schema` to allow for duck typing
|
|
270
|
+
if (options.schema instanceof Object)
|
|
271
|
+
this.schema = options.schema;
|
|
272
|
+
else if (opt)
|
|
273
|
+
this.schema = new Schema.Schema(Object.assign(opt, options));
|
|
274
|
+
else
|
|
275
|
+
throw new Error(`With a null YAML version, the { schema: Schema } option is required`);
|
|
276
|
+
}
|
|
277
|
+
// json & jsonArg are only used from toJSON()
|
|
278
|
+
toJS({ json, jsonArg, mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {
|
|
279
|
+
const ctx = {
|
|
280
|
+
anchors: new Map(),
|
|
281
|
+
doc: this,
|
|
282
|
+
keep: !json,
|
|
283
|
+
mapAsMap: mapAsMap === true,
|
|
284
|
+
mapKeyWarned: false,
|
|
285
|
+
maxAliasCount: typeof maxAliasCount === 'number' ? maxAliasCount : 100,
|
|
286
|
+
stringify: stringify.stringify
|
|
287
|
+
};
|
|
288
|
+
const res = toJS.toJS(this.contents, jsonArg || '', ctx);
|
|
289
|
+
if (typeof onAnchor === 'function')
|
|
290
|
+
for (const { count, res } of ctx.anchors.values())
|
|
291
|
+
onAnchor(res, count);
|
|
292
|
+
return typeof reviver === 'function'
|
|
293
|
+
? applyReviver.applyReviver(reviver, { '': res }, '', res)
|
|
294
|
+
: res;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* A JSON representation of the document `contents`.
|
|
298
|
+
*
|
|
299
|
+
* @param jsonArg Used by `JSON.stringify` to indicate the array index or
|
|
300
|
+
* property name.
|
|
301
|
+
*/
|
|
302
|
+
toJSON(jsonArg, onAnchor) {
|
|
303
|
+
return this.toJS({ json: true, jsonArg, mapAsMap: false, onAnchor });
|
|
304
|
+
}
|
|
305
|
+
/** A YAML representation of the document. */
|
|
306
|
+
toString(options = {}) {
|
|
307
|
+
if (this.errors.length > 0)
|
|
308
|
+
throw new Error('Document with errors cannot be stringified');
|
|
309
|
+
if ('indent' in options &&
|
|
310
|
+
(!Number.isInteger(options.indent) || Number(options.indent) <= 0)) {
|
|
311
|
+
const s = JSON.stringify(options.indent);
|
|
312
|
+
throw new Error(`"indent" option must be a positive integer, not ${s}`);
|
|
313
|
+
}
|
|
314
|
+
return stringifyDocument.stringifyDocument(this, options);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
function assertCollection(contents) {
|
|
318
|
+
if (Node.isCollection(contents))
|
|
319
|
+
return true;
|
|
320
|
+
throw new Error('Expected a YAML collection as document contents');
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
exports.Document = Document;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Node } from '../nodes/Node.js';
|
|
2
|
+
import type { Document } from './Document.js';
|
|
3
|
+
/**
|
|
4
|
+
* Verify that the input string is a valid anchor.
|
|
5
|
+
*
|
|
6
|
+
* Will throw on errors.
|
|
7
|
+
*/
|
|
8
|
+
export declare function anchorIsValid(anchor: string): true;
|
|
9
|
+
export declare function anchorNames(root: Document | Node): Set<string>;
|
|
10
|
+
/** Find a new anchor name with the given `prefix` and a one-indexed suffix. */
|
|
11
|
+
export declare function findNewAnchor(prefix: string, exclude: Set<string>): string;
|
|
12
|
+
export declare function createNodeAnchors(doc: Document, prefix: string): {
|
|
13
|
+
onAnchor(source: unknown): string;
|
|
14
|
+
/**
|
|
15
|
+
* With circular references, the source node is only resolved after all
|
|
16
|
+
* of its child nodes are. This is why anchors are set only after all of
|
|
17
|
+
* the nodes have been created.
|
|
18
|
+
*/
|
|
19
|
+
setAnchors(): void;
|
|
20
|
+
sourceObjects: Map<unknown, {
|
|
21
|
+
anchor: string | null;
|
|
22
|
+
node: Node | null;
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Node = require('../nodes/Node.js');
|
|
4
|
+
var visit = require('../visit.js');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Verify that the input string is a valid anchor.
|
|
8
|
+
*
|
|
9
|
+
* Will throw on errors.
|
|
10
|
+
*/
|
|
11
|
+
function anchorIsValid(anchor) {
|
|
12
|
+
if (/[\x00-\x19\s,[\]{}]/.test(anchor)) {
|
|
13
|
+
const sa = JSON.stringify(anchor);
|
|
14
|
+
const msg = `Anchor must not contain whitespace or control characters: ${sa}`;
|
|
15
|
+
throw new Error(msg);
|
|
16
|
+
}
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
function anchorNames(root) {
|
|
20
|
+
const anchors = new Set();
|
|
21
|
+
visit.visit(root, {
|
|
22
|
+
Value(_key, node) {
|
|
23
|
+
if (node.anchor)
|
|
24
|
+
anchors.add(node.anchor);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return anchors;
|
|
28
|
+
}
|
|
29
|
+
/** Find a new anchor name with the given `prefix` and a one-indexed suffix. */
|
|
30
|
+
function findNewAnchor(prefix, exclude) {
|
|
31
|
+
for (let i = 1; true; ++i) {
|
|
32
|
+
const name = `${prefix}${i}`;
|
|
33
|
+
if (!exclude.has(name))
|
|
34
|
+
return name;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function createNodeAnchors(doc, prefix) {
|
|
38
|
+
const aliasObjects = [];
|
|
39
|
+
const sourceObjects = new Map();
|
|
40
|
+
let prevAnchors = null;
|
|
41
|
+
return {
|
|
42
|
+
onAnchor(source) {
|
|
43
|
+
aliasObjects.push(source);
|
|
44
|
+
if (!prevAnchors)
|
|
45
|
+
prevAnchors = anchorNames(doc);
|
|
46
|
+
const anchor = findNewAnchor(prefix, prevAnchors);
|
|
47
|
+
prevAnchors.add(anchor);
|
|
48
|
+
return anchor;
|
|
49
|
+
},
|
|
50
|
+
/**
|
|
51
|
+
* With circular references, the source node is only resolved after all
|
|
52
|
+
* of its child nodes are. This is why anchors are set only after all of
|
|
53
|
+
* the nodes have been created.
|
|
54
|
+
*/
|
|
55
|
+
setAnchors() {
|
|
56
|
+
for (const source of aliasObjects) {
|
|
57
|
+
const ref = sourceObjects.get(source);
|
|
58
|
+
if (typeof ref === 'object' &&
|
|
59
|
+
ref.anchor &&
|
|
60
|
+
(Node.isScalar(ref.node) || Node.isCollection(ref.node))) {
|
|
61
|
+
ref.node.anchor = ref.anchor;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
const error = new Error('Failed to resolve repeated object (this should not happen)');
|
|
65
|
+
error.source = source;
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
sourceObjects
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
exports.anchorIsValid = anchorIsValid;
|
|
75
|
+
exports.anchorNames = anchorNames;
|
|
76
|
+
exports.createNodeAnchors = createNodeAnchors;
|
|
77
|
+
exports.findNewAnchor = findNewAnchor;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare type Reviver = (key: unknown, value: unknown) => unknown;
|
|
2
|
+
/**
|
|
3
|
+
* Applies the JSON.parse reviver algorithm as defined in the ECMA-262 spec,
|
|
4
|
+
* in section 24.5.1.1 "Runtime Semantics: InternalizeJSONProperty" of the
|
|
5
|
+
* 2021 edition: https://tc39.es/ecma262/#sec-json.parse
|
|
6
|
+
*
|
|
7
|
+
* Includes extensions for handling Map and Set objects.
|
|
8
|
+
*/
|
|
9
|
+
export declare function applyReviver(reviver: Reviver, obj: unknown, key: unknown, val: any): unknown;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Applies the JSON.parse reviver algorithm as defined in the ECMA-262 spec,
|
|
5
|
+
* in section 24.5.1.1 "Runtime Semantics: InternalizeJSONProperty" of the
|
|
6
|
+
* 2021 edition: https://tc39.es/ecma262/#sec-json.parse
|
|
7
|
+
*
|
|
8
|
+
* Includes extensions for handling Map and Set objects.
|
|
9
|
+
*/
|
|
10
|
+
function applyReviver(reviver, obj, key, val) {
|
|
11
|
+
if (val && typeof val === 'object') {
|
|
12
|
+
if (Array.isArray(val)) {
|
|
13
|
+
for (let i = 0, len = val.length; i < len; ++i) {
|
|
14
|
+
const v0 = val[i];
|
|
15
|
+
const v1 = applyReviver(reviver, val, String(i), v0);
|
|
16
|
+
if (v1 === undefined)
|
|
17
|
+
delete val[i];
|
|
18
|
+
else if (v1 !== v0)
|
|
19
|
+
val[i] = v1;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
else if (val instanceof Map) {
|
|
23
|
+
for (const k of Array.from(val.keys())) {
|
|
24
|
+
const v0 = val.get(k);
|
|
25
|
+
const v1 = applyReviver(reviver, val, k, v0);
|
|
26
|
+
if (v1 === undefined)
|
|
27
|
+
val.delete(k);
|
|
28
|
+
else if (v1 !== v0)
|
|
29
|
+
val.set(k, v1);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else if (val instanceof Set) {
|
|
33
|
+
for (const v0 of Array.from(val)) {
|
|
34
|
+
const v1 = applyReviver(reviver, val, v0, v0);
|
|
35
|
+
if (v1 === undefined)
|
|
36
|
+
val.delete(v0);
|
|
37
|
+
else if (v1 !== v0) {
|
|
38
|
+
val.delete(v0);
|
|
39
|
+
val.add(v1);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
for (const [k, v0] of Object.entries(val)) {
|
|
45
|
+
const v1 = applyReviver(reviver, val, k, v0);
|
|
46
|
+
if (v1 === undefined)
|
|
47
|
+
delete val[k];
|
|
48
|
+
else if (v1 !== v0)
|
|
49
|
+
val[k] = v1;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return reviver.call(obj, key, val);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
exports.applyReviver = applyReviver;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Node } from '../nodes/Node.js';
|
|
2
|
+
import type { Schema } from '../schema/Schema.js';
|
|
3
|
+
import type { CollectionTag, ScalarTag } from '../schema/types.js';
|
|
4
|
+
import type { Replacer } from './Document.js';
|
|
5
|
+
export interface CreateNodeContext {
|
|
6
|
+
aliasDuplicateObjects: boolean;
|
|
7
|
+
keepUndefined: boolean;
|
|
8
|
+
onAnchor(source: unknown): string;
|
|
9
|
+
onTagObj?: (tagObj: ScalarTag | CollectionTag) => void;
|
|
10
|
+
sourceObjects: Map<unknown, {
|
|
11
|
+
anchor: string | null;
|
|
12
|
+
node: Node | null;
|
|
13
|
+
}>;
|
|
14
|
+
replacer?: Replacer;
|
|
15
|
+
schema: Schema;
|
|
16
|
+
}
|
|
17
|
+
export declare function createNode(value: unknown, tagName: string | undefined, ctx: CreateNodeContext): Node;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Alias = require('../nodes/Alias.js');
|
|
4
|
+
var Node = require('../nodes/Node.js');
|
|
5
|
+
var Scalar = require('../nodes/Scalar.js');
|
|
6
|
+
|
|
7
|
+
const defaultTagPrefix = 'tag:yaml.org,2002:';
|
|
8
|
+
function findTagObject(value, tagName, tags) {
|
|
9
|
+
if (tagName) {
|
|
10
|
+
const match = tags.filter(t => t.tag === tagName);
|
|
11
|
+
const tagObj = match.find(t => !t.format) || match[0];
|
|
12
|
+
if (!tagObj)
|
|
13
|
+
throw new Error(`Tag ${tagName} not found`);
|
|
14
|
+
return tagObj;
|
|
15
|
+
}
|
|
16
|
+
return tags.find(t => t.identify && t.identify(value) && !t.format);
|
|
17
|
+
}
|
|
18
|
+
function createNode(value, tagName, ctx) {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
if (Node.isDocument(value))
|
|
21
|
+
value = value.contents;
|
|
22
|
+
if (Node.isNode(value))
|
|
23
|
+
return value;
|
|
24
|
+
if (Node.isPair(value)) {
|
|
25
|
+
const map = (_b = (_a = ctx.schema[Node.MAP]).createNode) === null || _b === void 0 ? void 0 : _b.call(_a, ctx.schema, null, ctx);
|
|
26
|
+
map.items.push(value);
|
|
27
|
+
return map;
|
|
28
|
+
}
|
|
29
|
+
if (value instanceof String ||
|
|
30
|
+
value instanceof Number ||
|
|
31
|
+
value instanceof Boolean ||
|
|
32
|
+
(typeof BigInt === 'function' && value instanceof BigInt) // not supported everywhere
|
|
33
|
+
) {
|
|
34
|
+
// https://tc39.es/ecma262/#sec-serializejsonproperty
|
|
35
|
+
value = value.valueOf();
|
|
36
|
+
}
|
|
37
|
+
const { aliasDuplicateObjects, onAnchor, onTagObj, schema, sourceObjects } = ctx;
|
|
38
|
+
// Detect duplicate references to the same object & use Alias nodes for all
|
|
39
|
+
// after first. The `ref` wrapper allows for circular references to resolve.
|
|
40
|
+
let ref = undefined;
|
|
41
|
+
if (aliasDuplicateObjects && value && typeof value === 'object') {
|
|
42
|
+
ref = sourceObjects.get(value);
|
|
43
|
+
if (ref) {
|
|
44
|
+
if (!ref.anchor)
|
|
45
|
+
ref.anchor = onAnchor(value);
|
|
46
|
+
return new Alias.Alias(ref.anchor);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
ref = { anchor: null, node: null };
|
|
50
|
+
sourceObjects.set(value, ref);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (tagName && tagName.startsWith('!!'))
|
|
54
|
+
tagName = defaultTagPrefix + tagName.slice(2);
|
|
55
|
+
let tagObj = findTagObject(value, tagName, schema.tags);
|
|
56
|
+
if (!tagObj) {
|
|
57
|
+
if (value && typeof value.toJSON === 'function')
|
|
58
|
+
value = value.toJSON();
|
|
59
|
+
if (!value || typeof value !== 'object') {
|
|
60
|
+
const node = new Scalar.Scalar(value);
|
|
61
|
+
if (ref)
|
|
62
|
+
ref.node = node;
|
|
63
|
+
return node;
|
|
64
|
+
}
|
|
65
|
+
tagObj =
|
|
66
|
+
value instanceof Map
|
|
67
|
+
? schema[Node.MAP]
|
|
68
|
+
: Symbol.iterator in Object(value)
|
|
69
|
+
? schema[Node.SEQ]
|
|
70
|
+
: schema[Node.MAP];
|
|
71
|
+
}
|
|
72
|
+
if (onTagObj) {
|
|
73
|
+
onTagObj(tagObj);
|
|
74
|
+
delete ctx.onTagObj;
|
|
75
|
+
}
|
|
76
|
+
const node = (tagObj === null || tagObj === void 0 ? void 0 : tagObj.createNode)
|
|
77
|
+
? tagObj.createNode(ctx.schema, value, ctx)
|
|
78
|
+
: new Scalar.Scalar(value);
|
|
79
|
+
if (tagName)
|
|
80
|
+
node.tag = tagName;
|
|
81
|
+
if (ref)
|
|
82
|
+
ref.node = node;
|
|
83
|
+
return node;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
exports.createNode = createNode;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Document } from './Document.js';
|
|
2
|
+
export declare class Directives {
|
|
3
|
+
static defaultYaml: Directives['yaml'];
|
|
4
|
+
static defaultTags: Directives['tags'];
|
|
5
|
+
yaml: {
|
|
6
|
+
version: '1.1' | '1.2';
|
|
7
|
+
explicit?: boolean;
|
|
8
|
+
};
|
|
9
|
+
tags: Record<string, string>;
|
|
10
|
+
/**
|
|
11
|
+
* The directives-end/doc-start marker `---`. If `null`, a marker may still be
|
|
12
|
+
* included in the document's stringified representation.
|
|
13
|
+
*/
|
|
14
|
+
marker: true | null;
|
|
15
|
+
/**
|
|
16
|
+
* Used when parsing YAML 1.1, where:
|
|
17
|
+
* > If the document specifies no directives, it is parsed using the same
|
|
18
|
+
* > settings as the previous document. If the document does specify any
|
|
19
|
+
* > directives, all directives of previous documents, if any, are ignored.
|
|
20
|
+
*/
|
|
21
|
+
private atNextDocument?;
|
|
22
|
+
constructor(yaml?: Directives['yaml'], tags?: Directives['tags']);
|
|
23
|
+
clone(): Directives;
|
|
24
|
+
/**
|
|
25
|
+
* During parsing, get a Directives instance for the current document and
|
|
26
|
+
* update the stream state according to the current version's spec.
|
|
27
|
+
*/
|
|
28
|
+
atDocument(): Directives;
|
|
29
|
+
/**
|
|
30
|
+
* @param onError - May be called even if the action was successful
|
|
31
|
+
* @returns `true` on success
|
|
32
|
+
*/
|
|
33
|
+
add(line: string, onError: (offset: number, message: string, warning?: boolean) => void): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Resolves a tag, matching handles to those defined in %TAG directives.
|
|
36
|
+
*
|
|
37
|
+
* @returns Resolved tag, which may also be the non-specific tag `'!'` or a
|
|
38
|
+
* `'!local'` tag, or `null` if unresolvable.
|
|
39
|
+
*/
|
|
40
|
+
tagName(source: string, onError: (message: string) => void): string | null;
|
|
41
|
+
/**
|
|
42
|
+
* Given a fully resolved tag, returns its printable string form,
|
|
43
|
+
* taking into account current tag prefixes and defaults.
|
|
44
|
+
*/
|
|
45
|
+
tagString(tag: string): string;
|
|
46
|
+
toString(doc?: Document): string;
|
|
47
|
+
}
|