projen 0.98.32 → 0.98.34
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 +1906 -626
- package/lib/ai-instructions.js +2 -2
- package/lib/awscdk/auto-discover.js +5 -5
- package/lib/awscdk/awscdk-app-java.js +1 -1
- package/lib/awscdk/awscdk-app-py.js +1 -1
- package/lib/awscdk/awscdk-app-ts.js +1 -1
- package/lib/awscdk/awscdk-construct.js +2 -2
- package/lib/awscdk/awscdk-deps-java.js +1 -1
- package/lib/awscdk/awscdk-deps-js.js +1 -1
- package/lib/awscdk/awscdk-deps-py.js +1 -1
- package/lib/awscdk/awscdk-deps.js +1 -1
- package/lib/awscdk/cdk-config.js +4 -4
- package/lib/awscdk/cdk-tasks.js +1 -1
- package/lib/awscdk/integration-test.js +1 -1
- package/lib/awscdk/internal.d.ts +1 -2
- package/lib/awscdk/lambda-extension.js +1 -1
- package/lib/awscdk/lambda-function.js +2 -2
- package/lib/awscdk/private/feature-flags-v2.const.d.ts +2 -3
- package/lib/awscdk/private/feature-flags-v2.const.js +4 -5
- package/lib/build/build-workflow.js +6 -7
- package/lib/cdk/auto-discover-base.js +2 -2
- package/lib/cdk/construct-lib.js +1 -1
- package/lib/cdk/integration-test-base.js +1 -1
- package/lib/cdk/jsii-docgen.js +1 -1
- package/lib/cdk/jsii-project.js +1 -1
- package/lib/cdk8s/auto-discover.js +2 -2
- package/lib/cdk8s/cdk8s-app-py.js +1 -1
- package/lib/cdk8s/cdk8s-app-ts.js +1 -1
- package/lib/cdk8s/cdk8s-construct.js +1 -1
- package/lib/cdk8s/cdk8s-deps-py.js +1 -1
- package/lib/cdk8s/cdk8s-deps.js +1 -1
- package/lib/cdk8s/integration-test.js +1 -1
- package/lib/cdktf/cdktf-construct.js +1 -1
- package/lib/circleci/circleci.js +1 -1
- package/lib/cli/index.js +6 -3
- package/lib/component.js +1 -1
- package/lib/dependencies.js +1 -1
- package/lib/dev-env.js +1 -1
- package/lib/docker-compose/docker-compose-service.js +1 -1
- package/lib/docker-compose/docker-compose.js +1 -1
- package/lib/file.js +1 -1
- package/lib/gitattributes.js +1 -1
- package/lib/github/actions-provider.js +1 -1
- package/lib/github/auto-approve.js +1 -1
- package/lib/github/auto-merge.js +1 -1
- package/lib/github/auto-queue.js +1 -1
- package/lib/github/dependabot.js +1 -1
- package/lib/github/github-credentials.js +1 -1
- package/lib/github/github-project.js +1 -1
- package/lib/github/github.js +1 -1
- package/lib/github/merge-queue.js +1 -1
- package/lib/github/mergify.js +1 -1
- package/lib/github/pr-template.js +1 -1
- package/lib/github/private/util.d.ts +14 -0
- package/lib/github/private/util.js +20 -1
- package/lib/github/pull-request-backport.js +1 -1
- package/lib/github/pull-request-lint.js +1 -1
- package/lib/github/stale.js +1 -1
- package/lib/github/task-workflow-job.js +1 -1
- package/lib/github/task-workflow.js +1 -1
- package/lib/github/workflow-actions.js +1 -1
- package/lib/github/workflow-jobs.js +1 -1
- package/lib/github/workflow-steps.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 +2 -2
- package/lib/java/projenrc.js +1 -1
- package/lib/javascript/biome/biome-config.d.ts +126 -50
- package/lib/javascript/biome/biome-config.js +74 -39
- package/lib/javascript/biome/biome.js +1 -1
- package/lib/javascript/bundler.js +1 -1
- package/lib/javascript/eslint.js +1 -1
- package/lib/javascript/jest.js +4 -4
- package/lib/javascript/license-checker.js +1 -1
- package/lib/javascript/node-package.js +1 -1
- package/lib/javascript/node-project.d.ts +2 -2
- package/lib/javascript/node-project.js +3 -3
- package/lib/javascript/npm-config.js +1 -1
- package/lib/javascript/prettier.js +1 -1
- package/lib/javascript/projenrc.js +1 -1
- package/lib/javascript/typescript-config.js +2 -2
- package/lib/javascript/upgrade-dependencies.js +17 -9
- package/lib/javascript/yarnrc.js +1 -1
- package/lib/json-patch.js +1 -1
- package/lib/json.js +1 -1
- package/lib/license.js +1 -1
- package/lib/logger.js +1 -1
- package/lib/makefile.js +1 -1
- package/lib/object-file.js +1 -1
- package/lib/project-build.js +1 -1
- package/lib/project-tree.js +1 -1
- package/lib/project.js +1 -1
- package/lib/projects.js +1 -1
- package/lib/projenrc-json.js +2 -2
- package/lib/projenrc.js +1 -1
- package/lib/python/pip.js +1 -1
- package/lib/python/poetry.js +2 -2
- package/lib/python/projenrc.js +1 -1
- package/lib/python/pyproject-toml-file.js +1 -1
- package/lib/python/pytest-sample.js +1 -1
- package/lib/python/pytest.js +1 -1
- package/lib/python/python-project.js +1 -1
- package/lib/python/python-sample.js +1 -1
- package/lib/python/requirements-file.js +1 -1
- package/lib/python/setuppy.js +1 -1
- package/lib/python/setuptools.js +1 -1
- package/lib/python/uv-config.d.ts +437 -21
- package/lib/python/uv-config.js +437 -2
- package/lib/python/uv.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 +15 -18
- package/lib/renovatebot.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-ts.js +1 -1
- package/lib/typescript/projenrc.js +1 -1
- package/lib/typescript/typescript-typedoc.js +1 -1
- package/lib/typescript/typescript.js +6 -6
- package/lib/version.js +2 -2
- package/lib/vscode/devcontainer.js +1 -1
- package/lib/vscode/extensions.js +1 -1
- package/lib/vscode/launch-config.js +1 -1
- package/lib/vscode/settings.js +1 -1
- package/lib/vscode/vscode.js +1 -1
- package/lib/web/next.js +3 -3
- package/lib/web/postcss.js +1 -1
- package/lib/web/react.js +4 -4
- package/lib/web/tailwind.js +1 -1
- package/lib/xmlfile.js +1 -1
- package/lib/yaml.js +1 -1
- package/node_modules/@oozcitak/dom/README.md +2 -4
- package/node_modules/@oozcitak/dom/lib/algorithm/AbortAlgorithm.js +7 -29
- package/node_modules/@oozcitak/dom/lib/algorithm/AbortAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/AttrAlgorithm.js +3 -3
- package/node_modules/@oozcitak/dom/lib/algorithm/AttrAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/BoundaryPointAlgorithm.js +14 -14
- package/node_modules/@oozcitak/dom/lib/algorithm/BoundaryPointAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/CharacterDataAlgorithm.js +40 -62
- package/node_modules/@oozcitak/dom/lib/algorithm/CharacterDataAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/CreateAlgorithm.js +53 -54
- package/node_modules/@oozcitak/dom/lib/algorithm/CreateAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/CustomElementAlgorithm.js +14 -14
- package/node_modules/@oozcitak/dom/lib/algorithm/CustomElementAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/DOMAlgorithm.js +29 -51
- package/node_modules/@oozcitak/dom/lib/algorithm/DOMAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/DOMTokenListAlgorithm.js +11 -11
- package/node_modules/@oozcitak/dom/lib/algorithm/DOMTokenListAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/DocumentAlgorithm.js +25 -63
- package/node_modules/@oozcitak/dom/lib/algorithm/DocumentAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/ElementAlgorithm.js +79 -85
- package/node_modules/@oozcitak/dom/lib/algorithm/ElementAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/EventAlgorithm.d.ts +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/EventAlgorithm.js +96 -153
- package/node_modules/@oozcitak/dom/lib/algorithm/EventAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/EventTargetAlgorithm.js +15 -37
- package/node_modules/@oozcitak/dom/lib/algorithm/EventTargetAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/MutationAlgorithm.js +229 -404
- package/node_modules/@oozcitak/dom/lib/algorithm/MutationAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/MutationObserverAlgorithm.js +47 -109
- package/node_modules/@oozcitak/dom/lib/algorithm/MutationObserverAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/NamespaceAlgorithm.d.ts +5 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/NamespaceAlgorithm.js +19 -19
- package/node_modules/@oozcitak/dom/lib/algorithm/NamespaceAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/NodeAlgorithm.js +69 -124
- package/node_modules/@oozcitak/dom/lib/algorithm/NodeAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/NodeIteratorAlgorithm.js +11 -11
- package/node_modules/@oozcitak/dom/lib/algorithm/NodeIteratorAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/OrderedSetAlgorithm.js +20 -72
- package/node_modules/@oozcitak/dom/lib/algorithm/OrderedSetAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/ParentNodeAlgorithm.js +12 -34
- package/node_modules/@oozcitak/dom/lib/algorithm/ParentNodeAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/RangeAlgorithm.js +183 -289
- package/node_modules/@oozcitak/dom/lib/algorithm/RangeAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/SelectorsAlgorithm.js +2 -2
- package/node_modules/@oozcitak/dom/lib/algorithm/SelectorsAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/ShadowTreeAlgorithm.js +65 -140
- package/node_modules/@oozcitak/dom/lib/algorithm/ShadowTreeAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/TextAlgorithm.js +63 -89
- package/node_modules/@oozcitak/dom/lib/algorithm/TextAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/TraversalAlgorithm.js +6 -6
- package/node_modules/@oozcitak/dom/lib/algorithm/TraversalAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/TreeAlgorithm.js +141 -208
- package/node_modules/@oozcitak/dom/lib/algorithm/TreeAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/TreeWalkerAlgorithm.js +13 -13
- package/node_modules/@oozcitak/dom/lib/algorithm/TreeWalkerAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/WebIDLAlgorithm.js +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/WebIDLAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/XMLAlgorithm.js +16 -16
- package/node_modules/@oozcitak/dom/lib/algorithm/XMLAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/index.js +42 -31
- package/node_modules/@oozcitak/dom/lib/algorithm/index.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/AbortControllerImpl.js +12 -15
- package/node_modules/@oozcitak/dom/lib/dom/AbortControllerImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/AbortSignalImpl.js +20 -43
- package/node_modules/@oozcitak/dom/lib/dom/AbortSignalImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/AbstractRangeImpl.js +20 -62
- package/node_modules/@oozcitak/dom/lib/dom/AbstractRangeImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/AttrImpl.js +53 -92
- package/node_modules/@oozcitak/dom/lib/dom/AttrImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/CDATASectionImpl.js +13 -27
- package/node_modules/@oozcitak/dom/lib/dom/CDATASectionImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/CharacterDataImpl.js +40 -88
- package/node_modules/@oozcitak/dom/lib/dom/CharacterDataImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/ChildNodeImpl.js +41 -55
- package/node_modules/@oozcitak/dom/lib/dom/ChildNodeImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/CommentImpl.js +13 -28
- package/node_modules/@oozcitak/dom/lib/dom/CommentImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/CustomEventImpl.js +14 -36
- package/node_modules/@oozcitak/dom/lib/dom/CustomEventImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/DOMException.js +114 -204
- package/node_modules/@oozcitak/dom/lib/dom/DOMException.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/DOMImpl.js +51 -68
- package/node_modules/@oozcitak/dom/lib/dom/DOMImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/DOMImplementationImpl.js +32 -31
- package/node_modules/@oozcitak/dom/lib/dom/DOMImplementationImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/DOMTokenListImpl.js +105 -163
- package/node_modules/@oozcitak/dom/lib/dom/DOMTokenListImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/DocumentFragmentImpl.d.ts +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/DocumentFragmentImpl.js +30 -73
- package/node_modules/@oozcitak/dom/lib/dom/DocumentFragmentImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/DocumentImpl.d.ts +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/DocumentImpl.js +198 -330
- package/node_modules/@oozcitak/dom/lib/dom/DocumentImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/DocumentOrShadowRootImpl.js +3 -5
- package/node_modules/@oozcitak/dom/lib/dom/DocumentOrShadowRootImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/DocumentTypeImpl.js +29 -75
- package/node_modules/@oozcitak/dom/lib/dom/DocumentTypeImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/ElementImpl.d.ts +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/ElementImpl.js +234 -393
- package/node_modules/@oozcitak/dom/lib/dom/ElementImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/EventImpl.js +89 -137
- package/node_modules/@oozcitak/dom/lib/dom/EventImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/EventTargetImpl.js +32 -57
- package/node_modules/@oozcitak/dom/lib/dom/EventTargetImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/HTMLCollectionImpl.js +58 -64
- package/node_modules/@oozcitak/dom/lib/dom/HTMLCollectionImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/MutationObserverImpl.js +36 -88
- package/node_modules/@oozcitak/dom/lib/dom/MutationObserverImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/MutationRecordImpl.js +33 -60
- package/node_modules/@oozcitak/dom/lib/dom/MutationRecordImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/NamedNodeMapImpl.js +33 -47
- package/node_modules/@oozcitak/dom/lib/dom/NamedNodeMapImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/NodeFilterImpl.js +58 -42
- package/node_modules/@oozcitak/dom/lib/dom/NodeFilterImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/NodeImpl.d.ts +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/NodeImpl.js +375 -471
- package/node_modules/@oozcitak/dom/lib/dom/NodeImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/NodeIteratorImpl.js +29 -49
- package/node_modules/@oozcitak/dom/lib/dom/NodeIteratorImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/NodeListImpl.js +69 -97
- package/node_modules/@oozcitak/dom/lib/dom/NodeListImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/NodeListStaticImpl.js +66 -93
- package/node_modules/@oozcitak/dom/lib/dom/NodeListStaticImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/NonDocumentTypeChildNodeImpl.js +33 -43
- package/node_modules/@oozcitak/dom/lib/dom/NonDocumentTypeChildNodeImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/NonElementParentNodeImpl.js +9 -11
- package/node_modules/@oozcitak/dom/lib/dom/NonElementParentNodeImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/ParentNodeImpl.js +73 -121
- package/node_modules/@oozcitak/dom/lib/dom/ParentNodeImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/ProcessingInstructionImpl.js +19 -36
- package/node_modules/@oozcitak/dom/lib/dom/ProcessingInstructionImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/RangeImpl.js +174 -241
- package/node_modules/@oozcitak/dom/lib/dom/RangeImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/ShadowRootImpl.js +22 -43
- package/node_modules/@oozcitak/dom/lib/dom/ShadowRootImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/SlotableImpl.js +13 -25
- package/node_modules/@oozcitak/dom/lib/dom/SlotableImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/StaticRangeImpl.js +12 -25
- package/node_modules/@oozcitak/dom/lib/dom/StaticRangeImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/TextImpl.js +34 -80
- package/node_modules/@oozcitak/dom/lib/dom/TextImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/TraverserImpl.js +15 -23
- package/node_modules/@oozcitak/dom/lib/dom/TraverserImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/TreeWalkerImpl.js +46 -64
- package/node_modules/@oozcitak/dom/lib/dom/TreeWalkerImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/WindowImpl.js +21 -42
- package/node_modules/@oozcitak/dom/lib/dom/WindowImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/XMLDocumentImpl.js +6 -20
- package/node_modules/@oozcitak/dom/lib/dom/XMLDocumentImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/index.js +92 -91
- package/node_modules/@oozcitak/dom/lib/dom/index.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/dom/interfaces.d.ts +28 -25
- package/node_modules/@oozcitak/dom/lib/dom/interfaces.js +9 -7
- package/node_modules/@oozcitak/dom/lib/dom/interfaces.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/index.js +5 -4
- package/node_modules/@oozcitak/dom/lib/index.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/parser/DOMParserImpl.js +13 -15
- package/node_modules/@oozcitak/dom/lib/parser/DOMParserImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/parser/XMLParserImpl.js +78 -128
- package/node_modules/@oozcitak/dom/lib/parser/XMLParserImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/parser/XMLStringLexer.js +107 -123
- package/node_modules/@oozcitak/dom/lib/parser/XMLStringLexer.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/parser/index.js +2 -1
- package/node_modules/@oozcitak/dom/lib/parser/index.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/parser/interfaces.d.ts +2 -2
- package/node_modules/@oozcitak/dom/lib/parser/interfaces.js +2 -1
- package/node_modules/@oozcitak/dom/lib/parser/interfaces.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/serializer/LocalNameSet.js +10 -12
- package/node_modules/@oozcitak/dom/lib/serializer/LocalNameSet.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/serializer/NamespacePrefixMap.js +23 -25
- package/node_modules/@oozcitak/dom/lib/serializer/NamespacePrefixMap.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl.js +405 -517
- package/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/serializer/index.js +2 -1
- package/node_modules/@oozcitak/dom/lib/serializer/index.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/util/Cast.js +6 -8
- package/node_modules/@oozcitak/dom/lib/util/Cast.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/util/EmptySet.d.ts +13 -5
- package/node_modules/@oozcitak/dom/lib/util/EmptySet.js +33 -46
- package/node_modules/@oozcitak/dom/lib/util/EmptySet.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/util/Guard.js +47 -49
- package/node_modules/@oozcitak/dom/lib/util/Guard.js.map +1 -1
- package/node_modules/@oozcitak/dom/lib/util/index.js +4 -3
- package/node_modules/@oozcitak/dom/lib/util/index.js.map +1 -1
- package/node_modules/@oozcitak/dom/package.json +14 -41
- package/node_modules/@oozcitak/infra/LICENSE +21 -21
- package/node_modules/@oozcitak/infra/README.md +11 -13
- package/node_modules/@oozcitak/infra/lib/Base64.js +3 -3
- package/node_modules/@oozcitak/infra/lib/Base64.js.map +1 -1
- package/node_modules/@oozcitak/infra/lib/Byte.js +1 -1
- package/node_modules/@oozcitak/infra/lib/Byte.js.map +1 -1
- package/node_modules/@oozcitak/infra/lib/ByteSequence.js +19 -39
- package/node_modules/@oozcitak/infra/lib/ByteSequence.js.map +1 -1
- package/node_modules/@oozcitak/infra/lib/CodePoints.js +1 -0
- package/node_modules/@oozcitak/infra/lib/CodePoints.js.map +1 -1
- package/node_modules/@oozcitak/infra/lib/JSON.d.ts +1 -1
- package/node_modules/@oozcitak/infra/lib/JSON.js +18 -40
- package/node_modules/@oozcitak/infra/lib/JSON.js.map +1 -1
- package/node_modules/@oozcitak/infra/lib/List.d.ts +4 -4
- package/node_modules/@oozcitak/infra/lib/List.js +49 -173
- package/node_modules/@oozcitak/infra/lib/List.js.map +1 -1
- package/node_modules/@oozcitak/infra/lib/Map.d.ts +1 -1
- package/node_modules/@oozcitak/infra/lib/Map.js +43 -177
- package/node_modules/@oozcitak/infra/lib/Map.js.map +1 -1
- package/node_modules/@oozcitak/infra/lib/Namespace.js +1 -0
- package/node_modules/@oozcitak/infra/lib/Namespace.js.map +1 -1
- package/node_modules/@oozcitak/infra/lib/Queue.d.ts +1 -1
- package/node_modules/@oozcitak/infra/lib/Queue.js +2 -2
- package/node_modules/@oozcitak/infra/lib/Queue.js.map +1 -1
- package/node_modules/@oozcitak/infra/lib/Set.d.ts +1 -1
- package/node_modules/@oozcitak/infra/lib/Set.js +76 -254
- package/node_modules/@oozcitak/infra/lib/Set.js.map +1 -1
- package/node_modules/@oozcitak/infra/lib/Stack.d.ts +1 -1
- package/node_modules/@oozcitak/infra/lib/Stack.js +2 -2
- package/node_modules/@oozcitak/infra/lib/Stack.js.map +1 -1
- package/node_modules/@oozcitak/infra/lib/String.d.ts +2 -2
- package/node_modules/@oozcitak/infra/lib/String.js +75 -131
- package/node_modules/@oozcitak/infra/lib/String.js.map +1 -1
- package/node_modules/@oozcitak/infra/lib/index.js +46 -19
- package/node_modules/@oozcitak/infra/lib/index.js.map +1 -1
- package/node_modules/@oozcitak/infra/package.json +41 -54
- package/node_modules/@oozcitak/url/LICENSE +21 -21
- package/node_modules/@oozcitak/url/README.md +25 -27
- package/node_modules/@oozcitak/url/lib/URLAlgorithm.d.ts +3 -3
- package/node_modules/@oozcitak/url/lib/URLAlgorithm.js +287 -460
- package/node_modules/@oozcitak/url/lib/URLAlgorithm.js.map +1 -1
- package/node_modules/@oozcitak/url/lib/URLImpl.js +285 -331
- package/node_modules/@oozcitak/url/lib/URLImpl.js.map +1 -1
- package/node_modules/@oozcitak/url/lib/URLSearchParamsImpl.d.ts +1 -1
- package/node_modules/@oozcitak/url/lib/URLSearchParamsImpl.js +71 -190
- package/node_modules/@oozcitak/url/lib/URLSearchParamsImpl.js.map +1 -1
- package/node_modules/@oozcitak/url/lib/index.js +3 -2
- package/node_modules/@oozcitak/url/lib/index.js.map +1 -1
- package/node_modules/@oozcitak/url/lib/interfaces.d.ts +2 -2
- package/node_modules/@oozcitak/url/lib/interfaces.js +2 -1
- package/node_modules/@oozcitak/url/lib/interfaces.js.map +1 -1
- package/node_modules/@oozcitak/url/package.json +42 -55
- package/node_modules/@oozcitak/util/LICENSE +21 -21
- package/node_modules/@oozcitak/util/README.md +8 -10
- package/node_modules/@oozcitak/util/lib/CompareCache.js +12 -12
- package/node_modules/@oozcitak/util/lib/CompareCache.js.map +1 -1
- package/node_modules/@oozcitak/util/lib/FixedSizeSet.d.ts +6 -6
- package/node_modules/@oozcitak/util/lib/FixedSizeSet.js +42 -117
- package/node_modules/@oozcitak/util/lib/FixedSizeSet.js.map +1 -1
- package/node_modules/@oozcitak/util/lib/Lazy.js +17 -19
- package/node_modules/@oozcitak/util/lib/Lazy.js.map +1 -1
- package/node_modules/@oozcitak/util/lib/ObjectCache.d.ts +4 -4
- package/node_modules/@oozcitak/util/lib/ObjectCache.js +44 -118
- package/node_modules/@oozcitak/util/lib/ObjectCache.js.map +1 -1
- package/node_modules/@oozcitak/util/lib/StringWalker.js +41 -47
- package/node_modules/@oozcitak/util/lib/StringWalker.js.map +1 -1
- package/node_modules/@oozcitak/util/lib/index.d.ts +23 -25
- package/node_modules/@oozcitak/util/lib/index.js +62 -88
- package/node_modules/@oozcitak/util/lib/index.js.map +1 -1
- package/node_modules/@oozcitak/util/package.json +37 -50
- package/node_modules/argparse/LICENSE +254 -0
- package/node_modules/argparse/README.md +84 -0
- package/node_modules/argparse/argparse.js +3707 -0
- package/node_modules/argparse/lib/sub.js +67 -0
- package/node_modules/argparse/lib/textwrap.js +440 -0
- package/node_modules/argparse/package.json +31 -0
- package/node_modules/{xmlbuilder2/node_modules/js-yaml → js-yaml}/README.md +36 -88
- package/node_modules/{xmlbuilder2/node_modules/js-yaml → js-yaml}/bin/js-yaml.js +17 -23
- package/node_modules/js-yaml/dist/js-yaml.js +3880 -0
- package/node_modules/js-yaml/dist/js-yaml.min.js +2 -0
- package/node_modules/{xmlbuilder2/node_modules/js-yaml/dist/js-yaml.js → js-yaml/dist/js-yaml.mjs} +2926 -3075
- package/node_modules/js-yaml/index.js +47 -0
- package/node_modules/{xmlbuilder2/node_modules/js-yaml/lib/js-yaml → js-yaml/lib}/dumper.js +205 -90
- package/node_modules/{xmlbuilder2/node_modules/js-yaml/lib/js-yaml → js-yaml/lib}/exception.js +22 -10
- package/node_modules/{xmlbuilder2/node_modules/js-yaml/lib/js-yaml → js-yaml/lib}/loader.js +149 -76
- package/node_modules/{xmlbuilder2/node_modules/js-yaml/lib/js-yaml → js-yaml/lib}/schema/core.js +1 -8
- package/node_modules/{xmlbuilder2/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js → js-yaml/lib/schema/default.js} +1 -7
- package/node_modules/{xmlbuilder2/node_modules/js-yaml/lib/js-yaml → js-yaml/lib}/schema/json.js +1 -7
- package/node_modules/js-yaml/lib/schema.js +121 -0
- package/node_modules/js-yaml/lib/snippet.js +101 -0
- package/node_modules/{xmlbuilder2/node_modules/js-yaml/lib/js-yaml → js-yaml/lib}/type/binary.js +4 -17
- package/node_modules/{xmlbuilder2/node_modules/js-yaml/lib/js-yaml → js-yaml/lib}/type/float.js +2 -21
- package/node_modules/{xmlbuilder2/node_modules/js-yaml/lib/js-yaml → js-yaml/lib}/type/int.js +18 -35
- package/node_modules/{xmlbuilder2/node_modules/js-yaml/lib/js-yaml → js-yaml/lib}/type/null.js +2 -1
- package/node_modules/{xmlbuilder2/node_modules/js-yaml/lib/js-yaml → js-yaml/lib}/type.js +14 -9
- package/node_modules/js-yaml/package.json +66 -0
- package/node_modules/xmlbuilder2/README.md +8 -7
- package/node_modules/xmlbuilder2/lib/builder/BuilderFunctions.js +36 -37
- package/node_modules/xmlbuilder2/lib/builder/BuilderFunctions.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/builder/BuilderFunctionsCB.js +3 -3
- package/node_modules/xmlbuilder2/lib/builder/BuilderFunctionsCB.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/builder/XMLBuilderCBImpl.d.ts +0 -1
- package/node_modules/xmlbuilder2/lib/builder/XMLBuilderCBImpl.js +235 -333
- package/node_modules/xmlbuilder2/lib/builder/XMLBuilderCBImpl.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/builder/XMLBuilderImpl.js +271 -371
- package/node_modules/xmlbuilder2/lib/builder/XMLBuilderImpl.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/builder/dom.js +13 -13
- package/node_modules/xmlbuilder2/lib/builder/dom.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/builder/index.js +9 -8
- package/node_modules/xmlbuilder2/lib/builder/index.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/constants.js +1 -0
- package/node_modules/xmlbuilder2/lib/constants.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/index.js +7 -6
- package/node_modules/xmlbuilder2/lib/index.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/interfaces.d.ts +25 -24
- package/node_modules/xmlbuilder2/lib/interfaces.js +1 -0
- package/node_modules/xmlbuilder2/lib/interfaces.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/readers/BaseReader.js +53 -56
- package/node_modules/xmlbuilder2/lib/readers/BaseReader.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/readers/JSONReader.js +7 -24
- package/node_modules/xmlbuilder2/lib/readers/JSONReader.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/readers/ObjectReader.js +59 -77
- package/node_modules/xmlbuilder2/lib/readers/ObjectReader.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/readers/XMLReader.js +61 -126
- package/node_modules/xmlbuilder2/lib/readers/XMLReader.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/readers/YAMLReader.js +9 -26
- package/node_modules/xmlbuilder2/lib/readers/YAMLReader.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/readers/index.js +5 -4
- package/node_modules/xmlbuilder2/lib/readers/index.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/writers/BaseCBWriter.d.ts +1 -0
- package/node_modules/xmlbuilder2/lib/writers/BaseCBWriter.js +14 -8
- package/node_modules/xmlbuilder2/lib/writers/BaseCBWriter.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/writers/BaseWriter.js +474 -609
- package/node_modules/xmlbuilder2/lib/writers/BaseWriter.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/writers/JSONCBWriter.js +48 -64
- package/node_modules/xmlbuilder2/lib/writers/JSONCBWriter.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/writers/JSONWriter.js +54 -95
- package/node_modules/xmlbuilder2/lib/writers/JSONWriter.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/writers/MapWriter.js +21 -36
- package/node_modules/xmlbuilder2/lib/writers/MapWriter.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/writers/ObjectWriter.js +131 -166
- package/node_modules/xmlbuilder2/lib/writers/ObjectWriter.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/writers/XMLCBWriter.d.ts +1 -1
- package/node_modules/xmlbuilder2/lib/writers/XMLCBWriter.js +42 -56
- package/node_modules/xmlbuilder2/lib/writers/XMLCBWriter.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/writers/XMLWriter.js +48 -62
- package/node_modules/xmlbuilder2/lib/writers/XMLWriter.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/writers/YAMLCBWriter.js +43 -59
- package/node_modules/xmlbuilder2/lib/writers/YAMLCBWriter.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/writers/YAMLWriter.js +49 -89
- package/node_modules/xmlbuilder2/lib/writers/YAMLWriter.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/writers/index.js +6 -5
- package/node_modules/xmlbuilder2/lib/writers/index.js.map +1 -1
- package/node_modules/xmlbuilder2/lib/xmlbuilder2.min.js +2 -8
- package/node_modules/xmlbuilder2/lib/xmlbuilder2.min.js.LICENSE.txt +10 -0
- package/node_modules/xmlbuilder2/package.json +34 -52
- package/package.json +8 -13
- package/node_modules/sprintf-js/.npmignore +0 -1
- package/node_modules/sprintf-js/LICENSE +0 -24
- package/node_modules/sprintf-js/README.md +0 -88
- package/node_modules/sprintf-js/bower.json +0 -14
- package/node_modules/sprintf-js/demo/angular.html +0 -20
- package/node_modules/sprintf-js/dist/angular-sprintf.min.js +0 -4
- package/node_modules/sprintf-js/dist/angular-sprintf.min.js.map +0 -1
- package/node_modules/sprintf-js/dist/angular-sprintf.min.map +0 -1
- package/node_modules/sprintf-js/dist/sprintf.min.js +0 -4
- package/node_modules/sprintf-js/dist/sprintf.min.js.map +0 -1
- package/node_modules/sprintf-js/dist/sprintf.min.map +0 -1
- package/node_modules/sprintf-js/gruntfile.js +0 -36
- package/node_modules/sprintf-js/package.json +0 -22
- package/node_modules/sprintf-js/src/angular-sprintf.js +0 -18
- package/node_modules/sprintf-js/src/sprintf.js +0 -208
- package/node_modules/sprintf-js/test/test.js +0 -82
- package/node_modules/xmlbuilder2/node_modules/argparse/LICENSE +0 -21
- package/node_modules/xmlbuilder2/node_modules/argparse/README.md +0 -257
- package/node_modules/xmlbuilder2/node_modules/argparse/index.js +0 -3
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action/append/constant.js +0 -47
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action/append.js +0 -53
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action/count.js +0 -40
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action/help.js +0 -47
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action/store/constant.js +0 -43
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action/store/false.js +0 -27
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action/store/true.js +0 -26
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action/store.js +0 -50
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action/subparsers.js +0 -149
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action/version.js +0 -47
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action.js +0 -146
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action_container.js +0 -482
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/argparse.js +0 -14
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/argument/error.js +0 -50
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/argument/exclusive.js +0 -54
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/argument/group.js +0 -75
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/argument_parser.js +0 -1161
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/const.js +0 -21
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/help/added_formatters.js +0 -87
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/help/formatter.js +0 -795
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/namespace.js +0 -76
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/utils.js +0 -57
- package/node_modules/xmlbuilder2/node_modules/argparse/package.json +0 -34
- package/node_modules/xmlbuilder2/node_modules/js-yaml/dist/js-yaml.min.js +0 -1
- package/node_modules/xmlbuilder2/node_modules/js-yaml/index.js +0 -7
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/mark.js +0 -76
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/schema/default_full.js +0 -25
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/schema.js +0 -108
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/type/js/function.js +0 -93
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js +0 -60
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js +0 -28
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml.js +0 -39
- package/node_modules/xmlbuilder2/node_modules/js-yaml/package.json +0 -49
- /package/node_modules/{xmlbuilder2/node_modules/js-yaml → js-yaml}/LICENSE +0 -0
- /package/node_modules/{xmlbuilder2/node_modules/js-yaml/lib/js-yaml → js-yaml/lib}/common.js +0 -0
- /package/node_modules/{xmlbuilder2/node_modules/js-yaml/lib/js-yaml → js-yaml/lib}/schema/failsafe.js +0 -0
- /package/node_modules/{xmlbuilder2/node_modules/js-yaml/lib/js-yaml → js-yaml/lib}/type/bool.js +0 -0
- /package/node_modules/{xmlbuilder2/node_modules/js-yaml/lib/js-yaml → js-yaml/lib}/type/map.js +0 -0
- /package/node_modules/{xmlbuilder2/node_modules/js-yaml/lib/js-yaml → js-yaml/lib}/type/merge.js +0 -0
- /package/node_modules/{xmlbuilder2/node_modules/js-yaml/lib/js-yaml → js-yaml/lib}/type/omap.js +0 -0
- /package/node_modules/{xmlbuilder2/node_modules/js-yaml/lib/js-yaml → js-yaml/lib}/type/pairs.js +0 -0
- /package/node_modules/{xmlbuilder2/node_modules/js-yaml/lib/js-yaml → js-yaml/lib}/type/seq.js +0 -0
- /package/node_modules/{xmlbuilder2/node_modules/js-yaml/lib/js-yaml → js-yaml/lib}/type/set.js +0 -0
- /package/node_modules/{xmlbuilder2/node_modules/js-yaml/lib/js-yaml → js-yaml/lib}/type/str.js +0 -0
- /package/node_modules/{xmlbuilder2/node_modules/js-yaml/lib/js-yaml → js-yaml/lib}/type/timestamp.js +0 -0
- /package/node_modules/xmlbuilder2/{LICENSE → LICENSE.txt} +0 -0
|
@@ -1,56 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __values = (this && this.__values) || function(o) {
|
|
3
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
4
|
-
if (m) return m.call(o);
|
|
5
|
-
if (o && typeof o.length === "number") return {
|
|
6
|
-
next: function () {
|
|
7
|
-
if (o && i >= o.length) o = void 0;
|
|
8
|
-
return { value: o && o[i++], done: !o };
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
12
|
-
};
|
|
13
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
14
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
-
if (!m) return o;
|
|
16
|
-
var i = m.call(o), r, ar = [], e;
|
|
17
|
-
try {
|
|
18
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
19
|
-
}
|
|
20
|
-
catch (error) { e = { error: error }; }
|
|
21
|
-
finally {
|
|
22
|
-
try {
|
|
23
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24
|
-
}
|
|
25
|
-
finally { if (e) throw e.error; }
|
|
26
|
-
}
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
var __spread = (this && this.__spread) || function () {
|
|
30
|
-
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
|
31
|
-
return ar;
|
|
32
|
-
};
|
|
33
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
3
|
+
exports.BaseWriter = void 0;
|
|
4
|
+
const interfaces_1 = require("@oozcitak/dom/lib/dom/interfaces");
|
|
5
|
+
const LocalNameSet_1 = require("@oozcitak/dom/lib/serializer/LocalNameSet");
|
|
6
|
+
const NamespacePrefixMap_1 = require("@oozcitak/dom/lib/serializer/NamespacePrefixMap");
|
|
7
|
+
const infra_1 = require("@oozcitak/infra");
|
|
8
|
+
const algorithm_1 = require("@oozcitak/dom/lib/algorithm");
|
|
9
|
+
const constants_1 = require("../constants");
|
|
40
10
|
/**
|
|
41
11
|
* Pre-serializes XML nodes.
|
|
42
12
|
*/
|
|
43
|
-
|
|
13
|
+
class BaseWriter {
|
|
14
|
+
static _VoidElementNames = new Set(['area', 'base', 'basefont',
|
|
15
|
+
'bgsound', 'br', 'col', 'embed', 'frame', 'hr', 'img', 'input', 'keygen',
|
|
16
|
+
'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']);
|
|
17
|
+
_builderOptions;
|
|
18
|
+
_writerOptions;
|
|
44
19
|
/**
|
|
45
20
|
* Initializes a new instance of `BaseWriter`.
|
|
46
21
|
*
|
|
47
22
|
* @param builderOptions - XML builder options
|
|
48
23
|
*/
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Gets the current depth of the XML tree.
|
|
52
|
-
*/
|
|
53
|
-
this.level = 0;
|
|
24
|
+
constructor(builderOptions) {
|
|
54
25
|
this._builderOptions = builderOptions;
|
|
55
26
|
}
|
|
56
27
|
/**
|
|
@@ -60,7 +31,7 @@ var BaseWriter = /** @class */ (function () {
|
|
|
60
31
|
* @param encoding - encoding declaration
|
|
61
32
|
* @param standalone - standalone document declaration
|
|
62
33
|
*/
|
|
63
|
-
|
|
34
|
+
declaration(version, encoding, standalone) { }
|
|
64
35
|
/**
|
|
65
36
|
* Used by derived classes to serialize a DocType node.
|
|
66
37
|
*
|
|
@@ -68,39 +39,39 @@ var BaseWriter = /** @class */ (function () {
|
|
|
68
39
|
* @param publicId - public identifier
|
|
69
40
|
* @param systemId - system identifier
|
|
70
41
|
*/
|
|
71
|
-
|
|
42
|
+
docType(name, publicId, systemId) { }
|
|
72
43
|
/**
|
|
73
44
|
* Used by derived classes to serialize a comment node.
|
|
74
45
|
*
|
|
75
46
|
* @param data - node data
|
|
76
47
|
*/
|
|
77
|
-
|
|
48
|
+
comment(data) { }
|
|
78
49
|
/**
|
|
79
50
|
* Used by derived classes to serialize a text node.
|
|
80
51
|
*
|
|
81
52
|
* @param data - node data
|
|
82
53
|
*/
|
|
83
|
-
|
|
54
|
+
text(data) { }
|
|
84
55
|
/**
|
|
85
56
|
* Used by derived classes to serialize a processing instruction node.
|
|
86
57
|
*
|
|
87
58
|
* @param target - instruction target
|
|
88
59
|
* @param data - node data
|
|
89
60
|
*/
|
|
90
|
-
|
|
61
|
+
instruction(target, data) { }
|
|
91
62
|
/**
|
|
92
63
|
* Used by derived classes to serialize a CData section node.
|
|
93
64
|
*
|
|
94
65
|
* @param data - node data
|
|
95
66
|
*/
|
|
96
|
-
|
|
67
|
+
cdata(data) { }
|
|
97
68
|
/**
|
|
98
69
|
* Used by derived classes to serialize the beginning of the opening tag of an
|
|
99
70
|
* element node.
|
|
100
71
|
*
|
|
101
72
|
* @param name - node name
|
|
102
73
|
*/
|
|
103
|
-
|
|
74
|
+
openTagBegin(name) { }
|
|
104
75
|
/**
|
|
105
76
|
* Used by derived classes to serialize the ending of the opening tag of an
|
|
106
77
|
* element node.
|
|
@@ -109,55 +80,52 @@ var BaseWriter = /** @class */ (function () {
|
|
|
109
80
|
* @param selfClosing - whether the element node is self closing
|
|
110
81
|
* @param voidElement - whether the element node is a HTML void element
|
|
111
82
|
*/
|
|
112
|
-
|
|
83
|
+
openTagEnd(name, selfClosing, voidElement) { }
|
|
113
84
|
/**
|
|
114
85
|
* Used by derived classes to serialize the closing tag of an element node.
|
|
115
86
|
*
|
|
116
87
|
* @param name - node name
|
|
117
88
|
*/
|
|
118
|
-
|
|
89
|
+
closeTag(name) { }
|
|
119
90
|
/**
|
|
120
91
|
* Used by derived classes to serialize attributes or namespace declarations.
|
|
121
92
|
*
|
|
122
93
|
* @param attributes - attribute array
|
|
123
94
|
*/
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
for (var attributes_1 = __values(attributes), attributes_1_1 = attributes_1.next(); !attributes_1_1.done; attributes_1_1 = attributes_1.next()) {
|
|
128
|
-
var attr = attributes_1_1.value;
|
|
129
|
-
this.attribute(attr[1] === null ? attr[2] : attr[1] + ':' + attr[2], attr[3]);
|
|
130
|
-
}
|
|
95
|
+
attributes(attributes) {
|
|
96
|
+
for (const attr of attributes) {
|
|
97
|
+
this.attribute(attr[1] === null ? attr[2] : attr[1] + ':' + attr[2], attr[3]);
|
|
131
98
|
}
|
|
132
|
-
|
|
133
|
-
finally {
|
|
134
|
-
try {
|
|
135
|
-
if (attributes_1_1 && !attributes_1_1.done && (_a = attributes_1.return)) _a.call(attributes_1);
|
|
136
|
-
}
|
|
137
|
-
finally { if (e_1) throw e_1.error; }
|
|
138
|
-
}
|
|
139
|
-
};
|
|
99
|
+
}
|
|
140
100
|
/**
|
|
141
101
|
* Used by derived classes to serialize an attribute or namespace declaration.
|
|
142
102
|
*
|
|
143
103
|
* @param name - node name
|
|
144
104
|
* @param value - node value
|
|
145
105
|
*/
|
|
146
|
-
|
|
106
|
+
attribute(name, value) { }
|
|
147
107
|
/**
|
|
148
108
|
* Used by derived classes to perform any pre-processing steps before starting
|
|
149
109
|
* serializing an element node.
|
|
150
110
|
*
|
|
151
111
|
* @param name - node name
|
|
152
112
|
*/
|
|
153
|
-
|
|
113
|
+
beginElement(name) { }
|
|
154
114
|
/**
|
|
155
115
|
* Used by derived classes to perform any post-processing steps after
|
|
156
116
|
* completing serializing an element node.
|
|
157
117
|
*
|
|
158
118
|
* @param name - node name
|
|
159
119
|
*/
|
|
160
|
-
|
|
120
|
+
endElement(name) { }
|
|
121
|
+
/**
|
|
122
|
+
* Gets the current depth of the XML tree.
|
|
123
|
+
*/
|
|
124
|
+
level = 0;
|
|
125
|
+
/**
|
|
126
|
+
* Gets the current XML node.
|
|
127
|
+
*/
|
|
128
|
+
currentNode;
|
|
161
129
|
/**
|
|
162
130
|
* Produces an XML serialization of the given node. The pre-serializer inserts
|
|
163
131
|
* namespace declarations where necessary and produces qualified names for
|
|
@@ -166,8 +134,8 @@ var BaseWriter = /** @class */ (function () {
|
|
|
166
134
|
* @param node - node to serialize
|
|
167
135
|
* @param requireWellFormed - whether to check conformance
|
|
168
136
|
*/
|
|
169
|
-
|
|
170
|
-
|
|
137
|
+
serializeNode(node, requireWellFormed) {
|
|
138
|
+
const hasNamespaces = (node._nodeDocument !== undefined && node._nodeDocument._hasNamespaces);
|
|
171
139
|
this.level = 0;
|
|
172
140
|
this.currentNode = node;
|
|
173
141
|
if (hasNamespaces) {
|
|
@@ -187,10 +155,10 @@ var BaseWriter = /** @class */ (function () {
|
|
|
187
155
|
* serialize a node's namespaceURI (or the namespaceURI of one of node's
|
|
188
156
|
* attributes). See the generate a prefix algorithm.
|
|
189
157
|
*/
|
|
190
|
-
|
|
191
|
-
|
|
158
|
+
let namespace = null;
|
|
159
|
+
const prefixMap = new NamespacePrefixMap_1.NamespacePrefixMap();
|
|
192
160
|
prefixMap.set("xml", infra_1.namespace.XML);
|
|
193
|
-
|
|
161
|
+
const prefixIndex = { value: 1 };
|
|
194
162
|
/**
|
|
195
163
|
* 5. Return the result of running the XML serialization algorithm on node
|
|
196
164
|
* passing the context namespace namespace, namespace prefix map prefix map,
|
|
@@ -204,7 +172,7 @@ var BaseWriter = /** @class */ (function () {
|
|
|
204
172
|
else {
|
|
205
173
|
this._serializeNode(node, requireWellFormed);
|
|
206
174
|
}
|
|
207
|
-
}
|
|
175
|
+
}
|
|
208
176
|
/**
|
|
209
177
|
* Produces an XML serialization of a node.
|
|
210
178
|
*
|
|
@@ -214,7 +182,7 @@ var BaseWriter = /** @class */ (function () {
|
|
|
214
182
|
* @param prefixIndex - generated namespace prefix index
|
|
215
183
|
* @param requireWellFormed - whether to check conformance
|
|
216
184
|
*/
|
|
217
|
-
|
|
185
|
+
_serializeNodeNS(node, namespace, prefixMap, prefixIndex, requireWellFormed) {
|
|
218
186
|
this.currentNode = node;
|
|
219
187
|
switch (node.nodeType) {
|
|
220
188
|
case interfaces_1.NodeType.Element:
|
|
@@ -242,16 +210,16 @@ var BaseWriter = /** @class */ (function () {
|
|
|
242
210
|
this._serializeCData(node, requireWellFormed);
|
|
243
211
|
break;
|
|
244
212
|
default:
|
|
245
|
-
throw new Error(
|
|
213
|
+
throw new Error(`Unknown node type: ${node.nodeType}`);
|
|
246
214
|
}
|
|
247
|
-
}
|
|
215
|
+
}
|
|
248
216
|
/**
|
|
249
217
|
* Produces an XML serialization of a node.
|
|
250
218
|
*
|
|
251
219
|
* @param node - node to serialize
|
|
252
220
|
* @param requireWellFormed - whether to check conformance
|
|
253
221
|
*/
|
|
254
|
-
|
|
222
|
+
_serializeNode(node, requireWellFormed) {
|
|
255
223
|
this.currentNode = node;
|
|
256
224
|
switch (node.nodeType) {
|
|
257
225
|
case interfaces_1.NodeType.Element:
|
|
@@ -279,9 +247,9 @@ var BaseWriter = /** @class */ (function () {
|
|
|
279
247
|
this._serializeCData(node, requireWellFormed);
|
|
280
248
|
break;
|
|
281
249
|
default:
|
|
282
|
-
throw new Error(
|
|
250
|
+
throw new Error(`Unknown node type: ${node.nodeType}`);
|
|
283
251
|
}
|
|
284
|
-
}
|
|
252
|
+
}
|
|
285
253
|
/**
|
|
286
254
|
* Produces an XML serialization of an element node.
|
|
287
255
|
*
|
|
@@ -291,9 +259,8 @@ var BaseWriter = /** @class */ (function () {
|
|
|
291
259
|
* @param prefixIndex - generated namespace prefix index
|
|
292
260
|
* @param requireWellFormed - whether to check conformance
|
|
293
261
|
*/
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
var attributes = [];
|
|
262
|
+
_serializeElementNS(node, namespace, prefixMap, prefixIndex, requireWellFormed) {
|
|
263
|
+
const attributes = [];
|
|
297
264
|
/**
|
|
298
265
|
* From: https://w3c.github.io/DOM-Parsing/#xml-serializing-an-element-node
|
|
299
266
|
*
|
|
@@ -303,7 +270,7 @@ var BaseWriter = /** @class */ (function () {
|
|
|
303
270
|
* serialization of this node would not be a well-formed element.
|
|
304
271
|
*/
|
|
305
272
|
if (requireWellFormed && (node.localName.indexOf(":") !== -1 ||
|
|
306
|
-
!algorithm_1.xml_isName(node.localName))) {
|
|
273
|
+
!(0, algorithm_1.xml_isName)(node.localName))) {
|
|
307
274
|
throw new Error("Node local name contains invalid characters (well-formed required).");
|
|
308
275
|
}
|
|
309
276
|
/**
|
|
@@ -336,14 +303,14 @@ var BaseWriter = /** @class */ (function () {
|
|
|
336
303
|
* 9. Let inherited ns be a copy of namespace.
|
|
337
304
|
* 10. Let ns be the value of node's namespaceURI attribute.
|
|
338
305
|
*/
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
306
|
+
let qualifiedName = '';
|
|
307
|
+
let skipEndTag = false;
|
|
308
|
+
let ignoreNamespaceDefinitionAttribute = false;
|
|
309
|
+
let map = prefixMap.copy();
|
|
310
|
+
let localPrefixesMap = {};
|
|
311
|
+
let localDefaultNamespace = this._recordNamespaceInformation(node, map, localPrefixesMap);
|
|
312
|
+
let inheritedNS = namespace;
|
|
313
|
+
let ns = node.namespaceURI;
|
|
347
314
|
/** 11. If inherited ns is equal to ns, then: */
|
|
348
315
|
if (inheritedNS === ns) {
|
|
349
316
|
/**
|
|
@@ -380,14 +347,14 @@ var BaseWriter = /** @class */ (function () {
|
|
|
380
347
|
* prefix string prefix from map given namespace ns. The above may return
|
|
381
348
|
* null if no namespace key ns exists in map.
|
|
382
349
|
*/
|
|
383
|
-
|
|
350
|
+
let prefix = node.prefix;
|
|
384
351
|
/**
|
|
385
352
|
* We don't need to run "retrieving a preferred prefix string" algorithm if
|
|
386
353
|
* the element has no prefix and its namespace matches to the default
|
|
387
354
|
* namespace.
|
|
388
355
|
* See: https://github.com/web-platform-tests/wpt/pull/16703
|
|
389
356
|
*/
|
|
390
|
-
|
|
357
|
+
let candidatePrefix = null;
|
|
391
358
|
if (prefix !== null || ns !== localDefaultNamespace) {
|
|
392
359
|
candidatePrefix = map.get(prefix, ns);
|
|
393
360
|
}
|
|
@@ -564,7 +531,7 @@ var BaseWriter = /** @class */ (function () {
|
|
|
564
531
|
* attributes given map, prefix index, local prefixes map, ignore namespace
|
|
565
532
|
* definition attribute flag, and require well-formed flag.
|
|
566
533
|
*/
|
|
567
|
-
attributes.push
|
|
534
|
+
attributes.push(...this._serializeAttributesNS(node, map, prefixIndex, localPrefixesMap, ignoreNamespaceDefinitionAttribute, requireWellFormed));
|
|
568
535
|
this.attributes(attributes);
|
|
569
536
|
/**
|
|
570
537
|
* 14. If ns is the HTML namespace, and the node's list of children is
|
|
@@ -581,7 +548,7 @@ var BaseWriter = /** @class */ (function () {
|
|
|
581
548
|
* tag flag to true.
|
|
582
549
|
* 16. Append ">" (U+003E GREATER-THAN SIGN) to markup.
|
|
583
550
|
*/
|
|
584
|
-
|
|
551
|
+
const isHTML = (ns === infra_1.namespace.HTML);
|
|
585
552
|
if (isHTML && node.childNodes.length === 0 &&
|
|
586
553
|
BaseWriter._VoidElementNames.has(node.localName)) {
|
|
587
554
|
this.openTagEnd(qualifiedName, true, true);
|
|
@@ -621,20 +588,10 @@ var BaseWriter = /** @class */ (function () {
|
|
|
621
588
|
// TODO: serialize template contents
|
|
622
589
|
}
|
|
623
590
|
else {
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
this._serializeNodeNS(childNode, inheritedNS, map, prefixIndex, requireWellFormed);
|
|
629
|
-
this.level--;
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
633
|
-
finally {
|
|
634
|
-
try {
|
|
635
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
636
|
-
}
|
|
637
|
-
finally { if (e_2) throw e_2.error; }
|
|
591
|
+
for (const childNode of node.childNodes) {
|
|
592
|
+
this.level++;
|
|
593
|
+
this._serializeNodeNS(childNode, inheritedNS, map, prefixIndex, requireWellFormed);
|
|
594
|
+
this.level--;
|
|
638
595
|
}
|
|
639
596
|
}
|
|
640
597
|
/**
|
|
@@ -646,15 +603,14 @@ var BaseWriter = /** @class */ (function () {
|
|
|
646
603
|
*/
|
|
647
604
|
this.closeTag(qualifiedName);
|
|
648
605
|
this.endElement(qualifiedName);
|
|
649
|
-
}
|
|
606
|
+
}
|
|
650
607
|
/**
|
|
651
608
|
* Produces an XML serialization of an element node.
|
|
652
609
|
*
|
|
653
610
|
* @param node - node to serialize
|
|
654
611
|
* @param requireWellFormed - whether to check conformance
|
|
655
612
|
*/
|
|
656
|
-
|
|
657
|
-
var e_3, _a;
|
|
613
|
+
_serializeElement(node, requireWellFormed) {
|
|
658
614
|
/**
|
|
659
615
|
* From: https://w3c.github.io/DOM-Parsing/#xml-serializing-an-element-node
|
|
660
616
|
*
|
|
@@ -664,7 +620,7 @@ var BaseWriter = /** @class */ (function () {
|
|
|
664
620
|
* serialization of this node would not be a well-formed element.
|
|
665
621
|
*/
|
|
666
622
|
if (requireWellFormed && (node.localName.indexOf(":") !== -1 ||
|
|
667
|
-
!algorithm_1.xml_isName(node.localName))) {
|
|
623
|
+
!(0, algorithm_1.xml_isName)(node.localName))) {
|
|
668
624
|
throw new Error("Node local name contains invalid characters (well-formed required).");
|
|
669
625
|
}
|
|
670
626
|
/**
|
|
@@ -697,7 +653,7 @@ var BaseWriter = /** @class */ (function () {
|
|
|
697
653
|
* 9. Let inherited ns be a copy of namespace.
|
|
698
654
|
* 10. Let ns be the value of node's namespaceURI attribute.
|
|
699
655
|
*/
|
|
700
|
-
|
|
656
|
+
let skipEndTag = false;
|
|
701
657
|
/** 11. If inherited ns is equal to ns, then: */
|
|
702
658
|
/**
|
|
703
659
|
* 11.1. If local default namespace is not null, then set ignore
|
|
@@ -709,7 +665,7 @@ var BaseWriter = /** @class */ (function () {
|
|
|
709
665
|
* 11.3. Otherwise, append to qualified name the value of node's
|
|
710
666
|
* localName. The node's prefix if it exists, is dropped.
|
|
711
667
|
*/
|
|
712
|
-
|
|
668
|
+
const qualifiedName = node.localName;
|
|
713
669
|
/** 11.4. Append the value of qualified name to markup. */
|
|
714
670
|
this.beginElement(qualifiedName);
|
|
715
671
|
this.openTagBegin(qualifiedName);
|
|
@@ -718,7 +674,7 @@ var BaseWriter = /** @class */ (function () {
|
|
|
718
674
|
* attributes given map, prefix index, local prefixes map, ignore namespace
|
|
719
675
|
* definition attribute flag, and require well-formed flag.
|
|
720
676
|
*/
|
|
721
|
-
|
|
677
|
+
const attributes = this._serializeAttributes(node, requireWellFormed);
|
|
722
678
|
this.attributes(attributes);
|
|
723
679
|
/**
|
|
724
680
|
* 14. If ns is the HTML namespace, and the node's list of children is
|
|
@@ -749,35 +705,25 @@ var BaseWriter = /** @class */ (function () {
|
|
|
749
705
|
*/
|
|
750
706
|
if (skipEndTag)
|
|
751
707
|
return;
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
this._serializeNode(childNode, requireWellFormed);
|
|
772
|
-
this.level--;
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
776
|
-
finally {
|
|
777
|
-
try {
|
|
778
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
779
|
-
}
|
|
780
|
-
finally { if (e_3) throw e_3.error; }
|
|
708
|
+
/**
|
|
709
|
+
* 18. If ns is the HTML namespace, and the node's localName matches the
|
|
710
|
+
* string "template", then this is a template element. Append to markup the
|
|
711
|
+
* result of XML serializing a DocumentFragment node given the template
|
|
712
|
+
* element's template contents (a DocumentFragment), providing inherited
|
|
713
|
+
* ns, map, prefix index, and the require well-formed flag.
|
|
714
|
+
*
|
|
715
|
+
* _Note:_ This allows template content to round-trip, given the rules for
|
|
716
|
+
* parsing XHTML documents.
|
|
717
|
+
*
|
|
718
|
+
* 19. Otherwise, append to markup the result of running the XML
|
|
719
|
+
* serialization algorithm on each of node's children, in tree order,
|
|
720
|
+
* providing inherited ns, map, prefix index, and the require well-formed
|
|
721
|
+
* flag.
|
|
722
|
+
*/
|
|
723
|
+
for (const childNode of node._children) {
|
|
724
|
+
this.level++;
|
|
725
|
+
this._serializeNode(childNode, requireWellFormed);
|
|
726
|
+
this.level--;
|
|
781
727
|
}
|
|
782
728
|
/**
|
|
783
729
|
* 20. Append the following to markup, in the order listed:
|
|
@@ -788,7 +734,7 @@ var BaseWriter = /** @class */ (function () {
|
|
|
788
734
|
*/
|
|
789
735
|
this.closeTag(qualifiedName);
|
|
790
736
|
this.endElement(qualifiedName);
|
|
791
|
-
}
|
|
737
|
+
}
|
|
792
738
|
/**
|
|
793
739
|
* Produces an XML serialization of a document node.
|
|
794
740
|
*
|
|
@@ -798,8 +744,7 @@ var BaseWriter = /** @class */ (function () {
|
|
|
798
744
|
* @param prefixIndex - generated namespace prefix index
|
|
799
745
|
* @param requireWellFormed - whether to check conformance
|
|
800
746
|
*/
|
|
801
|
-
|
|
802
|
-
var e_4, _a;
|
|
747
|
+
_serializeDocumentNS(node, namespace, prefixMap, prefixIndex, requireWellFormed) {
|
|
803
748
|
/**
|
|
804
749
|
* If the require well-formed flag is set (its value is true), and this node
|
|
805
750
|
* has no documentElement (the documentElement attribute's value is null),
|
|
@@ -809,42 +754,31 @@ var BaseWriter = /** @class */ (function () {
|
|
|
809
754
|
if (requireWellFormed && node.documentElement === null) {
|
|
810
755
|
throw new Error("Missing document element (well-formed required).");
|
|
811
756
|
}
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
var childNode = _c.value;
|
|
829
|
-
this._serializeNodeNS(childNode, namespace, prefixMap, prefixIndex, requireWellFormed);
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
833
|
-
finally {
|
|
834
|
-
try {
|
|
835
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
836
|
-
}
|
|
837
|
-
finally { if (e_4) throw e_4.error; }
|
|
757
|
+
/**
|
|
758
|
+
* Otherwise, run the following steps:
|
|
759
|
+
* 1. Let serialized document be an empty string.
|
|
760
|
+
* 2. For each child child of node, in tree order, run the XML
|
|
761
|
+
* serialization algorithm on the child passing along the provided
|
|
762
|
+
* arguments, and append the result to serialized document.
|
|
763
|
+
*
|
|
764
|
+
* _Note:_ This will serialize any number of ProcessingInstruction and
|
|
765
|
+
* Comment nodes both before and after the Document's documentElement node,
|
|
766
|
+
* including at most one DocumentType node. (Text nodes are not allowed as
|
|
767
|
+
* children of the Document.)
|
|
768
|
+
*
|
|
769
|
+
* 3. Return the value of serialized document.
|
|
770
|
+
*/
|
|
771
|
+
for (const childNode of node.childNodes) {
|
|
772
|
+
this._serializeNodeNS(childNode, namespace, prefixMap, prefixIndex, requireWellFormed);
|
|
838
773
|
}
|
|
839
|
-
}
|
|
774
|
+
}
|
|
840
775
|
/**
|
|
841
776
|
* Produces an XML serialization of a document node.
|
|
842
777
|
*
|
|
843
778
|
* @param node - node to serialize
|
|
844
779
|
* @param requireWellFormed - whether to check conformance
|
|
845
780
|
*/
|
|
846
|
-
|
|
847
|
-
var e_5, _a;
|
|
781
|
+
_serializeDocument(node, requireWellFormed) {
|
|
848
782
|
/**
|
|
849
783
|
* If the require well-formed flag is set (its value is true), and this node
|
|
850
784
|
* has no documentElement (the documentElement attribute's value is null),
|
|
@@ -854,41 +788,31 @@ var BaseWriter = /** @class */ (function () {
|
|
|
854
788
|
if (requireWellFormed && node.documentElement === null) {
|
|
855
789
|
throw new Error("Missing document element (well-formed required).");
|
|
856
790
|
}
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
var childNode = _c.value;
|
|
874
|
-
this._serializeNode(childNode, requireWellFormed);
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
878
|
-
finally {
|
|
879
|
-
try {
|
|
880
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
881
|
-
}
|
|
882
|
-
finally { if (e_5) throw e_5.error; }
|
|
791
|
+
/**
|
|
792
|
+
* Otherwise, run the following steps:
|
|
793
|
+
* 1. Let serialized document be an empty string.
|
|
794
|
+
* 2. For each child child of node, in tree order, run the XML
|
|
795
|
+
* serialization algorithm on the child passing along the provided
|
|
796
|
+
* arguments, and append the result to serialized document.
|
|
797
|
+
*
|
|
798
|
+
* _Note:_ This will serialize any number of ProcessingInstruction and
|
|
799
|
+
* Comment nodes both before and after the Document's documentElement node,
|
|
800
|
+
* including at most one DocumentType node. (Text nodes are not allowed as
|
|
801
|
+
* children of the Document.)
|
|
802
|
+
*
|
|
803
|
+
* 3. Return the value of serialized document.
|
|
804
|
+
*/
|
|
805
|
+
for (const childNode of node._children) {
|
|
806
|
+
this._serializeNode(childNode, requireWellFormed);
|
|
883
807
|
}
|
|
884
|
-
}
|
|
808
|
+
}
|
|
885
809
|
/**
|
|
886
810
|
* Produces an XML serialization of a comment node.
|
|
887
811
|
*
|
|
888
812
|
* @param node - node to serialize
|
|
889
813
|
* @param requireWellFormed - whether to check conformance
|
|
890
814
|
*/
|
|
891
|
-
|
|
815
|
+
_serializeComment(node, requireWellFormed) {
|
|
892
816
|
/**
|
|
893
817
|
* If the require well-formed flag is set (its value is true), and node's
|
|
894
818
|
* data contains characters that are not matched by the XML Char production
|
|
@@ -896,7 +820,7 @@ var BaseWriter = /** @class */ (function () {
|
|
|
896
820
|
* ends with a "-" (U+002D HYPHEN-MINUS) character, then throw an exception;
|
|
897
821
|
* the serialization of this node's data would not be well-formed.
|
|
898
822
|
*/
|
|
899
|
-
if (requireWellFormed && (!algorithm_1.xml_isLegalChar(node.data) ||
|
|
823
|
+
if (requireWellFormed && (!(0, algorithm_1.xml_isLegalChar)(node.data) ||
|
|
900
824
|
node.data.indexOf("--") !== -1 || node.data.endsWith("-"))) {
|
|
901
825
|
throw new Error("Comment data contains invalid characters (well-formed required).");
|
|
902
826
|
}
|
|
@@ -904,7 +828,7 @@ var BaseWriter = /** @class */ (function () {
|
|
|
904
828
|
* Otherwise, return the concatenation of "<!--", node's data, and "-->".
|
|
905
829
|
*/
|
|
906
830
|
this.comment(node.data);
|
|
907
|
-
}
|
|
831
|
+
}
|
|
908
832
|
/**
|
|
909
833
|
* Produces an XML serialization of a text node.
|
|
910
834
|
*
|
|
@@ -912,14 +836,14 @@ var BaseWriter = /** @class */ (function () {
|
|
|
912
836
|
* @param requireWellFormed - whether to check conformance
|
|
913
837
|
* @param level - current depth of the XML tree
|
|
914
838
|
*/
|
|
915
|
-
|
|
839
|
+
_serializeText(node, requireWellFormed) {
|
|
916
840
|
/**
|
|
917
841
|
* 1. If the require well-formed flag is set (its value is true), and
|
|
918
842
|
* node's data contains characters that are not matched by the XML Char
|
|
919
843
|
* production, then throw an exception; the serialization of this node's
|
|
920
844
|
* data would not be well-formed.
|
|
921
845
|
*/
|
|
922
|
-
if (requireWellFormed && !algorithm_1.xml_isLegalChar(node.data)) {
|
|
846
|
+
if (requireWellFormed && !(0, algorithm_1.xml_isLegalChar)(node.data)) {
|
|
923
847
|
throw new Error("Text data contains invalid characters (well-formed required).");
|
|
924
848
|
}
|
|
925
849
|
/**
|
|
@@ -929,11 +853,11 @@ var BaseWriter = /** @class */ (function () {
|
|
|
929
853
|
* 5. Replace any occurrences of ">" in markup by ">".
|
|
930
854
|
* 6. Return the value of markup.
|
|
931
855
|
*/
|
|
932
|
-
|
|
856
|
+
const markup = node.data.replace(constants_1.nonEntityAmpersandRegex, '&')
|
|
933
857
|
.replace(/</g, '<')
|
|
934
858
|
.replace(/>/g, '>');
|
|
935
859
|
this.text(markup);
|
|
936
|
-
}
|
|
860
|
+
}
|
|
937
861
|
/**
|
|
938
862
|
* Produces an XML serialization of a document fragment node.
|
|
939
863
|
*
|
|
@@ -943,72 +867,50 @@ var BaseWriter = /** @class */ (function () {
|
|
|
943
867
|
* @param prefixIndex - generated namespace prefix index
|
|
944
868
|
* @param requireWellFormed - whether to check conformance
|
|
945
869
|
*/
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
for (var _b = __values(node.childNodes), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
957
|
-
var childNode = _c.value;
|
|
958
|
-
this._serializeNodeNS(childNode, namespace, prefixMap, prefixIndex, requireWellFormed);
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
962
|
-
finally {
|
|
963
|
-
try {
|
|
964
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
965
|
-
}
|
|
966
|
-
finally { if (e_6) throw e_6.error; }
|
|
870
|
+
_serializeDocumentFragmentNS(node, namespace, prefixMap, prefixIndex, requireWellFormed) {
|
|
871
|
+
/**
|
|
872
|
+
* 1. Let markup the empty string.
|
|
873
|
+
* 2. For each child child of node, in tree order, run the XML serialization
|
|
874
|
+
* algorithm on the child given namespace, prefix map, a reference to prefix
|
|
875
|
+
* index, and flag require well-formed. Concatenate the result to markup.
|
|
876
|
+
* 3. Return the value of markup.
|
|
877
|
+
*/
|
|
878
|
+
for (const childNode of node.childNodes) {
|
|
879
|
+
this._serializeNodeNS(childNode, namespace, prefixMap, prefixIndex, requireWellFormed);
|
|
967
880
|
}
|
|
968
|
-
}
|
|
881
|
+
}
|
|
969
882
|
/**
|
|
970
883
|
* Produces an XML serialization of a document fragment node.
|
|
971
884
|
*
|
|
972
885
|
* @param node - node to serialize
|
|
973
886
|
* @param requireWellFormed - whether to check conformance
|
|
974
887
|
*/
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
for (var _b = __values(node._children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
986
|
-
var childNode = _c.value;
|
|
987
|
-
this._serializeNode(childNode, requireWellFormed);
|
|
988
|
-
}
|
|
989
|
-
}
|
|
990
|
-
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
991
|
-
finally {
|
|
992
|
-
try {
|
|
993
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
994
|
-
}
|
|
995
|
-
finally { if (e_7) throw e_7.error; }
|
|
888
|
+
_serializeDocumentFragment(node, requireWellFormed) {
|
|
889
|
+
/**
|
|
890
|
+
* 1. Let markup the empty string.
|
|
891
|
+
* 2. For each child child of node, in tree order, run the XML serialization
|
|
892
|
+
* algorithm on the child given namespace, prefix map, a reference to prefix
|
|
893
|
+
* index, and flag require well-formed. Concatenate the result to markup.
|
|
894
|
+
* 3. Return the value of markup.
|
|
895
|
+
*/
|
|
896
|
+
for (const childNode of node._children) {
|
|
897
|
+
this._serializeNode(childNode, requireWellFormed);
|
|
996
898
|
}
|
|
997
|
-
}
|
|
899
|
+
}
|
|
998
900
|
/**
|
|
999
901
|
* Produces an XML serialization of a document type node.
|
|
1000
902
|
*
|
|
1001
903
|
* @param node - node to serialize
|
|
1002
904
|
* @param requireWellFormed - whether to check conformance
|
|
1003
905
|
*/
|
|
1004
|
-
|
|
906
|
+
_serializeDocumentType(node, requireWellFormed) {
|
|
1005
907
|
/**
|
|
1006
908
|
* 1. If the require well-formed flag is true and the node's publicId
|
|
1007
909
|
* attribute contains characters that are not matched by the XML PubidChar
|
|
1008
910
|
* production, then throw an exception; the serialization of this node
|
|
1009
911
|
* would not be a well-formed document type declaration.
|
|
1010
912
|
*/
|
|
1011
|
-
if (requireWellFormed && !algorithm_1.xml_isPubidChar(node.publicId)) {
|
|
913
|
+
if (requireWellFormed && !(0, algorithm_1.xml_isPubidChar)(node.publicId)) {
|
|
1012
914
|
throw new Error("DocType public identifier does not match PubidChar construct (well-formed required).");
|
|
1013
915
|
}
|
|
1014
916
|
/**
|
|
@@ -1019,7 +921,7 @@ var BaseWriter = /** @class */ (function () {
|
|
|
1019
921
|
* of this node would not be a well-formed document type declaration.
|
|
1020
922
|
*/
|
|
1021
923
|
if (requireWellFormed &&
|
|
1022
|
-
(!algorithm_1.xml_isLegalChar(node.systemId) ||
|
|
924
|
+
(!(0, algorithm_1.xml_isLegalChar)(node.systemId) ||
|
|
1023
925
|
(node.systemId.indexOf('"') !== -1 && node.systemId.indexOf("'") !== -1))) {
|
|
1024
926
|
throw new Error("DocType system identifier contains invalid characters (well-formed required).");
|
|
1025
927
|
}
|
|
@@ -1052,14 +954,14 @@ var BaseWriter = /** @class */ (function () {
|
|
|
1052
954
|
* 11. Return the value of markup.
|
|
1053
955
|
*/
|
|
1054
956
|
this.docType(node.name, node.publicId, node.systemId);
|
|
1055
|
-
}
|
|
957
|
+
}
|
|
1056
958
|
/**
|
|
1057
959
|
* Produces an XML serialization of a processing instruction node.
|
|
1058
960
|
*
|
|
1059
961
|
* @param node - node to serialize
|
|
1060
962
|
* @param requireWellFormed - whether to check conformance
|
|
1061
963
|
*/
|
|
1062
|
-
|
|
964
|
+
_serializeProcessingInstruction(node, requireWellFormed) {
|
|
1063
965
|
/**
|
|
1064
966
|
* 1. If the require well-formed flag is set (its value is true), and node's
|
|
1065
967
|
* target contains a ":" (U+003A COLON) character or is an ASCII
|
|
@@ -1076,7 +978,7 @@ var BaseWriter = /** @class */ (function () {
|
|
|
1076
978
|
* U+003E GREATER-THAN SIGN), then throw an exception; the serialization of
|
|
1077
979
|
* this node's data would not be well-formed.
|
|
1078
980
|
*/
|
|
1079
|
-
if (requireWellFormed && (!algorithm_1.xml_isLegalChar(node.data) ||
|
|
981
|
+
if (requireWellFormed && (!(0, algorithm_1.xml_isLegalChar)(node.data) ||
|
|
1080
982
|
node.data.indexOf("?>") !== -1)) {
|
|
1081
983
|
throw new Error("Processing instruction data contains invalid characters (well-formed required).");
|
|
1082
984
|
}
|
|
@@ -1090,19 +992,19 @@ var BaseWriter = /** @class */ (function () {
|
|
|
1090
992
|
* 4. Return the value of markup.
|
|
1091
993
|
*/
|
|
1092
994
|
this.instruction(node.target, node.data);
|
|
1093
|
-
}
|
|
995
|
+
}
|
|
1094
996
|
/**
|
|
1095
997
|
* Produces an XML serialization of a CDATA node.
|
|
1096
998
|
*
|
|
1097
999
|
* @param node - node to serialize
|
|
1098
1000
|
* @param requireWellFormed - whether to check conformance
|
|
1099
1001
|
*/
|
|
1100
|
-
|
|
1002
|
+
_serializeCData(node, requireWellFormed) {
|
|
1101
1003
|
if (requireWellFormed && (node.data.indexOf("]]>") !== -1)) {
|
|
1102
1004
|
throw new Error("CDATA contains invalid characters (well-formed required).");
|
|
1103
1005
|
}
|
|
1104
1006
|
this.cdata(node.data);
|
|
1105
|
-
}
|
|
1007
|
+
}
|
|
1106
1008
|
/**
|
|
1107
1009
|
* Produces an XML serialization of the attributes of an element node.
|
|
1108
1010
|
*
|
|
@@ -1114,8 +1016,7 @@ var BaseWriter = /** @class */ (function () {
|
|
|
1114
1016
|
* attributes
|
|
1115
1017
|
* @param requireWellFormed - whether to check conformance
|
|
1116
1018
|
*/
|
|
1117
|
-
|
|
1118
|
-
var e_8, _a;
|
|
1019
|
+
_serializeAttributesNS(node, map, prefixIndex, localPrefixesMap, ignoreNamespaceDefinitionAttribute, requireWellFormed) {
|
|
1119
1020
|
/**
|
|
1120
1021
|
* 1. Let result be the empty string.
|
|
1121
1022
|
* 2. Let localname set be a new empty namespace localname set. This
|
|
@@ -1126,209 +1027,198 @@ var BaseWriter = /** @class */ (function () {
|
|
|
1126
1027
|
* This can occur when two otherwise identical attributes on the same
|
|
1127
1028
|
* element differ only by their prefix values.
|
|
1128
1029
|
*/
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1030
|
+
const result = [];
|
|
1031
|
+
const localNameSet = requireWellFormed ? new LocalNameSet_1.LocalNameSet() : undefined;
|
|
1032
|
+
/**
|
|
1033
|
+
* 3. Loop: For each attribute attr in element's attributes, in the order
|
|
1034
|
+
* they are specified in the element's attribute list:
|
|
1035
|
+
*/
|
|
1036
|
+
for (const attr of node.attributes) {
|
|
1037
|
+
// Optimize common case
|
|
1038
|
+
if (!requireWellFormed && !ignoreNamespaceDefinitionAttribute && attr.namespaceURI === null) {
|
|
1039
|
+
result.push([null, null, attr.localName,
|
|
1040
|
+
this._serializeAttributeValue(attr.value, requireWellFormed)]);
|
|
1041
|
+
continue;
|
|
1042
|
+
}
|
|
1132
1043
|
/**
|
|
1133
|
-
* 3.
|
|
1134
|
-
*
|
|
1044
|
+
* 3.1. If the require well-formed flag is set (its value is true), and the
|
|
1045
|
+
* localname set contains a tuple whose values match those of a new tuple
|
|
1046
|
+
* consisting of attr's namespaceURI attribute and localName attribute,
|
|
1047
|
+
* then throw an exception; the serialization of this attr would fail to
|
|
1048
|
+
* produce a well-formed element serialization.
|
|
1135
1049
|
*/
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1050
|
+
if (requireWellFormed && localNameSet && localNameSet.has(attr.namespaceURI, attr.localName)) {
|
|
1051
|
+
throw new Error("Element contains duplicate attributes (well-formed required).");
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* 3.2. Create a new tuple consisting of attr's namespaceURI attribute and
|
|
1055
|
+
* localName attribute, and add it to the localname set.
|
|
1056
|
+
* 3.3. Let attribute namespace be the value of attr's namespaceURI value.
|
|
1057
|
+
* 3.4. Let candidate prefix be null.
|
|
1058
|
+
*/
|
|
1059
|
+
if (requireWellFormed && localNameSet)
|
|
1060
|
+
localNameSet.set(attr.namespaceURI, attr.localName);
|
|
1061
|
+
let attributeNamespace = attr.namespaceURI;
|
|
1062
|
+
let candidatePrefix = null;
|
|
1063
|
+
/** 3.5. If attribute namespace is not null, then run these sub-steps: */
|
|
1064
|
+
if (attributeNamespace !== null) {
|
|
1144
1065
|
/**
|
|
1145
|
-
* 3.1.
|
|
1146
|
-
*
|
|
1147
|
-
*
|
|
1148
|
-
* then throw an exception; the serialization of this attr would fail to
|
|
1149
|
-
* produce a well-formed element serialization.
|
|
1066
|
+
* 3.5.1. Let candidate prefix be the result of retrieving a preferred
|
|
1067
|
+
* prefix string from map given namespace attribute namespace with
|
|
1068
|
+
* preferred prefix being attr's prefix value.
|
|
1150
1069
|
*/
|
|
1151
|
-
|
|
1152
|
-
throw new Error("Element contains duplicate attributes (well-formed required).");
|
|
1153
|
-
}
|
|
1070
|
+
candidatePrefix = map.get(attr.prefix, attributeNamespace);
|
|
1154
1071
|
/**
|
|
1155
|
-
* 3.2.
|
|
1156
|
-
*
|
|
1157
|
-
* 3.3. Let attribute namespace be the value of attr's namespaceURI value.
|
|
1158
|
-
* 3.4. Let candidate prefix be null.
|
|
1072
|
+
* 3.5.2. If the value of attribute namespace is the XMLNS namespace,
|
|
1073
|
+
* then run these steps:
|
|
1159
1074
|
*/
|
|
1160
|
-
if (
|
|
1161
|
-
localNameSet.set(attr.namespaceURI, attr.localName);
|
|
1162
|
-
var attributeNamespace = attr.namespaceURI;
|
|
1163
|
-
var candidatePrefix = null;
|
|
1164
|
-
/** 3.5. If attribute namespace is not null, then run these sub-steps: */
|
|
1165
|
-
if (attributeNamespace !== null) {
|
|
1075
|
+
if (attributeNamespace === infra_1.namespace.XMLNS) {
|
|
1166
1076
|
/**
|
|
1167
|
-
* 3.5.1.
|
|
1168
|
-
*
|
|
1169
|
-
*
|
|
1077
|
+
* 3.5.2.1. If any of the following are true, then stop running these
|
|
1078
|
+
* steps and goto Loop to visit the next attribute:
|
|
1079
|
+
* - the attr's value is the XML namespace;
|
|
1080
|
+
* _Note:_ The XML namespace cannot be redeclared and survive
|
|
1081
|
+
* round-tripping (unless it defines the prefix "xml"). To avoid this
|
|
1082
|
+
* problem, this algorithm always prefixes elements in the XML
|
|
1083
|
+
* namespace with "xml" and drops any related definitions as seen
|
|
1084
|
+
* in the above condition.
|
|
1085
|
+
* - the attr's prefix is null and the ignore namespace definition
|
|
1086
|
+
* attribute flag is true (the Element's default namespace attribute
|
|
1087
|
+
* should be skipped);
|
|
1088
|
+
* - the attr's prefix is not null and either
|
|
1089
|
+
* * the attr's localName is not a key contained in the local
|
|
1090
|
+
* prefixes map, or
|
|
1091
|
+
* * the attr's localName is present in the local prefixes map but
|
|
1092
|
+
* the value of the key does not match attr's value
|
|
1093
|
+
* and furthermore that the attr's localName (as the prefix to find)
|
|
1094
|
+
* is found in the namespace prefix map given the namespace consisting
|
|
1095
|
+
* of the attr's value (the current namespace prefix definition was
|
|
1096
|
+
* exactly defined previously--on an ancestor element not the current
|
|
1097
|
+
* element whose attributes are being processed).
|
|
1170
1098
|
*/
|
|
1171
|
-
|
|
1099
|
+
if (attr.value === infra_1.namespace.XML ||
|
|
1100
|
+
(attr.prefix === null && ignoreNamespaceDefinitionAttribute) ||
|
|
1101
|
+
(attr.prefix !== null && (!(attr.localName in localPrefixesMap) ||
|
|
1102
|
+
localPrefixesMap[attr.localName] !== attr.value) &&
|
|
1103
|
+
map.has(attr.localName, attr.value)))
|
|
1104
|
+
continue;
|
|
1172
1105
|
/**
|
|
1173
|
-
* 3.5.2. If the
|
|
1174
|
-
*
|
|
1106
|
+
* 3.5.2.2. If the require well-formed flag is set (its value is true),
|
|
1107
|
+
* and the value of attr's value attribute matches the XMLNS
|
|
1108
|
+
* namespace, then throw an exception; the serialization of this
|
|
1109
|
+
* attribute would produce invalid XML because the XMLNS namespace
|
|
1110
|
+
* is reserved and cannot be applied as an element's namespace via
|
|
1111
|
+
* XML parsing.
|
|
1112
|
+
*
|
|
1113
|
+
* _Note:_ DOM APIs do allow creation of elements in the XMLNS
|
|
1114
|
+
* namespace but with strict qualifications.
|
|
1175
1115
|
*/
|
|
1176
|
-
if (
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
* and the value of attr's value attribute matches the XMLNS
|
|
1209
|
-
* namespace, then throw an exception; the serialization of this
|
|
1210
|
-
* attribute would produce invalid XML because the XMLNS namespace
|
|
1211
|
-
* is reserved and cannot be applied as an element's namespace via
|
|
1212
|
-
* XML parsing.
|
|
1213
|
-
*
|
|
1214
|
-
* _Note:_ DOM APIs do allow creation of elements in the XMLNS
|
|
1215
|
-
* namespace but with strict qualifications.
|
|
1216
|
-
*/
|
|
1217
|
-
if (requireWellFormed && attr.value === infra_1.namespace.XMLNS) {
|
|
1218
|
-
throw new Error("XMLNS namespace is reserved (well-formed required).");
|
|
1219
|
-
}
|
|
1220
|
-
/**
|
|
1221
|
-
* 3.5.2.3. If the require well-formed flag is set (its value is true),
|
|
1222
|
-
* and the value of attr's value attribute is the empty string, then
|
|
1223
|
-
* throw an exception; namespace prefix declarations cannot be used
|
|
1224
|
-
* to undeclare a namespace (use a default namespace declaration
|
|
1225
|
-
* instead).
|
|
1226
|
-
*/
|
|
1227
|
-
if (requireWellFormed && attr.value === '') {
|
|
1228
|
-
throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).");
|
|
1229
|
-
}
|
|
1230
|
-
/**
|
|
1231
|
-
* 3.5.2.4. the attr's prefix matches the string "xmlns", then let
|
|
1232
|
-
* candidate prefix be the string "xmlns".
|
|
1233
|
-
*/
|
|
1234
|
-
if (attr.prefix === 'xmlns')
|
|
1235
|
-
candidatePrefix = 'xmlns';
|
|
1116
|
+
if (requireWellFormed && attr.value === infra_1.namespace.XMLNS) {
|
|
1117
|
+
throw new Error("XMLNS namespace is reserved (well-formed required).");
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1120
|
+
* 3.5.2.3. If the require well-formed flag is set (its value is true),
|
|
1121
|
+
* and the value of attr's value attribute is the empty string, then
|
|
1122
|
+
* throw an exception; namespace prefix declarations cannot be used
|
|
1123
|
+
* to undeclare a namespace (use a default namespace declaration
|
|
1124
|
+
* instead).
|
|
1125
|
+
*/
|
|
1126
|
+
if (requireWellFormed && attr.value === '') {
|
|
1127
|
+
throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).");
|
|
1128
|
+
}
|
|
1129
|
+
/**
|
|
1130
|
+
* 3.5.2.4. the attr's prefix matches the string "xmlns", then let
|
|
1131
|
+
* candidate prefix be the string "xmlns".
|
|
1132
|
+
*/
|
|
1133
|
+
if (attr.prefix === 'xmlns')
|
|
1134
|
+
candidatePrefix = 'xmlns';
|
|
1135
|
+
/**
|
|
1136
|
+
* 3.5.3. Otherwise, the attribute namespace is not the XMLNS namespace.
|
|
1137
|
+
* Run these steps:
|
|
1138
|
+
*
|
|
1139
|
+
* _Note:_ The (candidatePrefix === null) check is not in the spec.
|
|
1140
|
+
* We deviate from the spec here. Otherwise a prefix is generated for
|
|
1141
|
+
* all attributes with namespaces.
|
|
1142
|
+
*/
|
|
1143
|
+
}
|
|
1144
|
+
else if (candidatePrefix === null) {
|
|
1145
|
+
if (attr.prefix !== null &&
|
|
1146
|
+
(!map.hasPrefix(attr.prefix) ||
|
|
1147
|
+
map.has(attr.prefix, attributeNamespace))) {
|
|
1236
1148
|
/**
|
|
1237
|
-
*
|
|
1238
|
-
*
|
|
1239
|
-
*
|
|
1240
|
-
*
|
|
1241
|
-
* We deviate from the spec here. Otherwise a prefix is generated for
|
|
1242
|
-
* all attributes with namespaces.
|
|
1149
|
+
* Check if we can use the attribute's own prefix.
|
|
1150
|
+
* We deviate from the spec here.
|
|
1151
|
+
* TODO: This is not an efficient way of searching for prefixes.
|
|
1152
|
+
* Follow developments to the spec.
|
|
1243
1153
|
*/
|
|
1154
|
+
candidatePrefix = attr.prefix;
|
|
1244
1155
|
}
|
|
1245
|
-
else
|
|
1246
|
-
if (attr.prefix !== null &&
|
|
1247
|
-
(!map.hasPrefix(attr.prefix) ||
|
|
1248
|
-
map.has(attr.prefix, attributeNamespace))) {
|
|
1249
|
-
/**
|
|
1250
|
-
* Check if we can use the attribute's own prefix.
|
|
1251
|
-
* We deviate from the spec here.
|
|
1252
|
-
* TODO: This is not an efficient way of searching for prefixes.
|
|
1253
|
-
* Follow developments to the spec.
|
|
1254
|
-
*/
|
|
1255
|
-
candidatePrefix = attr.prefix;
|
|
1256
|
-
}
|
|
1257
|
-
else {
|
|
1258
|
-
/**
|
|
1259
|
-
* 3.5.3.1. Let candidate prefix be the result of generating a prefix
|
|
1260
|
-
* providing map, attribute namespace, and prefix index as input.
|
|
1261
|
-
*/
|
|
1262
|
-
candidatePrefix = this._generatePrefix(attributeNamespace, map, prefixIndex);
|
|
1263
|
-
}
|
|
1156
|
+
else {
|
|
1264
1157
|
/**
|
|
1265
|
-
* 3.5.3.
|
|
1266
|
-
*
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
* 3.5.3.2.4. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
|
|
1270
|
-
* 3.5.3.2.5. The result of serializing an attribute value given
|
|
1271
|
-
* attribute namespace and the require well-formed flag as input;
|
|
1272
|
-
* 3.5.3.2.6. """ (U+0022 QUOTATION MARK).
|
|
1273
|
-
*/
|
|
1274
|
-
result.push([null, "xmlns", candidatePrefix,
|
|
1275
|
-
this._serializeAttributeValue(attributeNamespace, requireWellFormed)]);
|
|
1158
|
+
* 3.5.3.1. Let candidate prefix be the result of generating a prefix
|
|
1159
|
+
* providing map, attribute namespace, and prefix index as input.
|
|
1160
|
+
*/
|
|
1161
|
+
candidatePrefix = this._generatePrefix(attributeNamespace, map, prefixIndex);
|
|
1276
1162
|
}
|
|
1163
|
+
/**
|
|
1164
|
+
* 3.5.3.2. Append the following to result, in the order listed:
|
|
1165
|
+
* 3.5.3.2.1. " " (U+0020 SPACE);
|
|
1166
|
+
* 3.5.3.2.2. The string "xmlns:";
|
|
1167
|
+
* 3.5.3.2.3. The value of candidate prefix;
|
|
1168
|
+
* 3.5.3.2.4. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
|
|
1169
|
+
* 3.5.3.2.5. The result of serializing an attribute value given
|
|
1170
|
+
* attribute namespace and the require well-formed flag as input;
|
|
1171
|
+
* 3.5.3.2.6. """ (U+0022 QUOTATION MARK).
|
|
1172
|
+
*/
|
|
1173
|
+
result.push([null, "xmlns", candidatePrefix,
|
|
1174
|
+
this._serializeAttributeValue(attributeNamespace, requireWellFormed)]);
|
|
1277
1175
|
}
|
|
1278
|
-
/**
|
|
1279
|
-
* 3.6. Append a " " (U+0020 SPACE) to result.
|
|
1280
|
-
* 3.7. If candidate prefix is not null, then append to result the
|
|
1281
|
-
* concatenation of candidate prefix with ":" (U+003A COLON).
|
|
1282
|
-
*/
|
|
1283
|
-
var attrName = '';
|
|
1284
|
-
if (candidatePrefix !== null) {
|
|
1285
|
-
attrName = candidatePrefix;
|
|
1286
|
-
}
|
|
1287
|
-
/**
|
|
1288
|
-
* 3.8. If the require well-formed flag is set (its value is true), and
|
|
1289
|
-
* this attr's localName attribute contains the character
|
|
1290
|
-
* ":" (U+003A COLON) or does not match the XML Name production or
|
|
1291
|
-
* equals "xmlns" and attribute namespace is null, then throw an
|
|
1292
|
-
* exception; the serialization of this attr would not be a
|
|
1293
|
-
* well-formed attribute.
|
|
1294
|
-
*/
|
|
1295
|
-
if (requireWellFormed && (attr.localName.indexOf(":") !== -1 ||
|
|
1296
|
-
!algorithm_1.xml_isName(attr.localName) ||
|
|
1297
|
-
(attr.localName === "xmlns" && attributeNamespace === null))) {
|
|
1298
|
-
throw new Error("Attribute local name contains invalid characters (well-formed required).");
|
|
1299
|
-
}
|
|
1300
|
-
/**
|
|
1301
|
-
* 3.9. Append the following strings to result, in the order listed:
|
|
1302
|
-
* 3.9.1. The value of attr's localName;
|
|
1303
|
-
* 3.9.2. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
|
|
1304
|
-
* 3.9.3. The result of serializing an attribute value given attr's value
|
|
1305
|
-
* attribute and the require well-formed flag as input;
|
|
1306
|
-
* 3.9.4. """ (U+0022 QUOTATION MARK).
|
|
1307
|
-
*/
|
|
1308
|
-
result.push([attributeNamespace, candidatePrefix, attr.localName,
|
|
1309
|
-
this._serializeAttributeValue(attr.value, requireWellFormed)]);
|
|
1310
1176
|
}
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1177
|
+
/**
|
|
1178
|
+
* 3.6. Append a " " (U+0020 SPACE) to result.
|
|
1179
|
+
* 3.7. If candidate prefix is not null, then append to result the
|
|
1180
|
+
* concatenation of candidate prefix with ":" (U+003A COLON).
|
|
1181
|
+
*/
|
|
1182
|
+
let attrName = '';
|
|
1183
|
+
if (candidatePrefix !== null) {
|
|
1184
|
+
attrName = candidatePrefix;
|
|
1316
1185
|
}
|
|
1317
|
-
|
|
1186
|
+
/**
|
|
1187
|
+
* 3.8. If the require well-formed flag is set (its value is true), and
|
|
1188
|
+
* this attr's localName attribute contains the character
|
|
1189
|
+
* ":" (U+003A COLON) or does not match the XML Name production or
|
|
1190
|
+
* equals "xmlns" and attribute namespace is null, then throw an
|
|
1191
|
+
* exception; the serialization of this attr would not be a
|
|
1192
|
+
* well-formed attribute.
|
|
1193
|
+
*/
|
|
1194
|
+
if (requireWellFormed && (attr.localName.indexOf(":") !== -1 ||
|
|
1195
|
+
!(0, algorithm_1.xml_isName)(attr.localName) ||
|
|
1196
|
+
(attr.localName === "xmlns" && attributeNamespace === null))) {
|
|
1197
|
+
throw new Error("Attribute local name contains invalid characters (well-formed required).");
|
|
1198
|
+
}
|
|
1199
|
+
/**
|
|
1200
|
+
* 3.9. Append the following strings to result, in the order listed:
|
|
1201
|
+
* 3.9.1. The value of attr's localName;
|
|
1202
|
+
* 3.9.2. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
|
|
1203
|
+
* 3.9.3. The result of serializing an attribute value given attr's value
|
|
1204
|
+
* attribute and the require well-formed flag as input;
|
|
1205
|
+
* 3.9.4. """ (U+0022 QUOTATION MARK).
|
|
1206
|
+
*/
|
|
1207
|
+
result.push([attributeNamespace, candidatePrefix, attr.localName,
|
|
1208
|
+
this._serializeAttributeValue(attr.value, requireWellFormed)]);
|
|
1318
1209
|
}
|
|
1319
1210
|
/**
|
|
1320
1211
|
* 4. Return the value of result.
|
|
1321
1212
|
*/
|
|
1322
1213
|
return result;
|
|
1323
|
-
}
|
|
1214
|
+
}
|
|
1324
1215
|
/**
|
|
1325
1216
|
* Produces an XML serialization of the attributes of an element node.
|
|
1326
1217
|
*
|
|
1327
1218
|
* @param node - node to serialize
|
|
1328
1219
|
* @param requireWellFormed - whether to check conformance
|
|
1329
1220
|
*/
|
|
1330
|
-
|
|
1331
|
-
var e_9, _a;
|
|
1221
|
+
_serializeAttributes(node, requireWellFormed) {
|
|
1332
1222
|
/**
|
|
1333
1223
|
* 1. Let result be the empty string.
|
|
1334
1224
|
* 2. Let localname set be a new empty namespace localname set. This
|
|
@@ -1339,82 +1229,72 @@ var BaseWriter = /** @class */ (function () {
|
|
|
1339
1229
|
* This can occur when two otherwise identical attributes on the same
|
|
1340
1230
|
* element differ only by their prefix values.
|
|
1341
1231
|
*/
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
// Optimize common case
|
|
1352
|
-
if (!requireWellFormed) {
|
|
1353
|
-
result.push([null, null, attr.localName,
|
|
1354
|
-
this._serializeAttributeValue(attr.value, requireWellFormed)]);
|
|
1355
|
-
continue;
|
|
1356
|
-
}
|
|
1357
|
-
/**
|
|
1358
|
-
* 3.1. If the require well-formed flag is set (its value is true), and the
|
|
1359
|
-
* localname set contains a tuple whose values match those of a new tuple
|
|
1360
|
-
* consisting of attr's namespaceURI attribute and localName attribute,
|
|
1361
|
-
* then throw an exception; the serialization of this attr would fail to
|
|
1362
|
-
* produce a well-formed element serialization.
|
|
1363
|
-
*/
|
|
1364
|
-
if (requireWellFormed && localNameSet && (attr.localName in localNameSet)) {
|
|
1365
|
-
throw new Error("Element contains duplicate attributes (well-formed required).");
|
|
1366
|
-
}
|
|
1367
|
-
/**
|
|
1368
|
-
* 3.2. Create a new tuple consisting of attr's namespaceURI attribute and
|
|
1369
|
-
* localName attribute, and add it to the localname set.
|
|
1370
|
-
* 3.3. Let attribute namespace be the value of attr's namespaceURI value.
|
|
1371
|
-
* 3.4. Let candidate prefix be null.
|
|
1372
|
-
*/
|
|
1373
|
-
/* istanbul ignore else */
|
|
1374
|
-
if (requireWellFormed && localNameSet)
|
|
1375
|
-
localNameSet[attr.localName] = true;
|
|
1376
|
-
/** 3.5. If attribute namespace is not null, then run these sub-steps: */
|
|
1377
|
-
/**
|
|
1378
|
-
* 3.6. Append a " " (U+0020 SPACE) to result.
|
|
1379
|
-
* 3.7. If candidate prefix is not null, then append to result the
|
|
1380
|
-
* concatenation of candidate prefix with ":" (U+003A COLON).
|
|
1381
|
-
*/
|
|
1382
|
-
/**
|
|
1383
|
-
* 3.8. If the require well-formed flag is set (its value is true), and
|
|
1384
|
-
* this attr's localName attribute contains the character
|
|
1385
|
-
* ":" (U+003A COLON) or does not match the XML Name production or
|
|
1386
|
-
* equals "xmlns" and attribute namespace is null, then throw an
|
|
1387
|
-
* exception; the serialization of this attr would not be a
|
|
1388
|
-
* well-formed attribute.
|
|
1389
|
-
*/
|
|
1390
|
-
if (requireWellFormed && (attr.localName.indexOf(":") !== -1 ||
|
|
1391
|
-
!algorithm_1.xml_isName(attr.localName))) {
|
|
1392
|
-
throw new Error("Attribute local name contains invalid characters (well-formed required).");
|
|
1393
|
-
}
|
|
1394
|
-
/**
|
|
1395
|
-
* 3.9. Append the following strings to result, in the order listed:
|
|
1396
|
-
* 3.9.1. The value of attr's localName;
|
|
1397
|
-
* 3.9.2. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
|
|
1398
|
-
* 3.9.3. The result of serializing an attribute value given attr's value
|
|
1399
|
-
* attribute and the require well-formed flag as input;
|
|
1400
|
-
* 3.9.4. """ (U+0022 QUOTATION MARK).
|
|
1401
|
-
*/
|
|
1232
|
+
const result = [];
|
|
1233
|
+
const localNameSet = requireWellFormed ? {} : undefined;
|
|
1234
|
+
/**
|
|
1235
|
+
* 3. Loop: For each attribute attr in element's attributes, in the order
|
|
1236
|
+
* they are specified in the element's attribute list:
|
|
1237
|
+
*/
|
|
1238
|
+
for (const attr of node.attributes) {
|
|
1239
|
+
// Optimize common case
|
|
1240
|
+
if (!requireWellFormed) {
|
|
1402
1241
|
result.push([null, null, attr.localName,
|
|
1403
1242
|
this._serializeAttributeValue(attr.value, requireWellFormed)]);
|
|
1243
|
+
continue;
|
|
1404
1244
|
}
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1245
|
+
/**
|
|
1246
|
+
* 3.1. If the require well-formed flag is set (its value is true), and the
|
|
1247
|
+
* localname set contains a tuple whose values match those of a new tuple
|
|
1248
|
+
* consisting of attr's namespaceURI attribute and localName attribute,
|
|
1249
|
+
* then throw an exception; the serialization of this attr would fail to
|
|
1250
|
+
* produce a well-formed element serialization.
|
|
1251
|
+
*/
|
|
1252
|
+
if (requireWellFormed && localNameSet && (attr.localName in localNameSet)) {
|
|
1253
|
+
throw new Error("Element contains duplicate attributes (well-formed required).");
|
|
1254
|
+
}
|
|
1255
|
+
/**
|
|
1256
|
+
* 3.2. Create a new tuple consisting of attr's namespaceURI attribute and
|
|
1257
|
+
* localName attribute, and add it to the localname set.
|
|
1258
|
+
* 3.3. Let attribute namespace be the value of attr's namespaceURI value.
|
|
1259
|
+
* 3.4. Let candidate prefix be null.
|
|
1260
|
+
*/
|
|
1261
|
+
/* istanbul ignore else */
|
|
1262
|
+
if (requireWellFormed && localNameSet)
|
|
1263
|
+
localNameSet[attr.localName] = true;
|
|
1264
|
+
/** 3.5. If attribute namespace is not null, then run these sub-steps: */
|
|
1265
|
+
/**
|
|
1266
|
+
* 3.6. Append a " " (U+0020 SPACE) to result.
|
|
1267
|
+
* 3.7. If candidate prefix is not null, then append to result the
|
|
1268
|
+
* concatenation of candidate prefix with ":" (U+003A COLON).
|
|
1269
|
+
*/
|
|
1270
|
+
/**
|
|
1271
|
+
* 3.8. If the require well-formed flag is set (its value is true), and
|
|
1272
|
+
* this attr's localName attribute contains the character
|
|
1273
|
+
* ":" (U+003A COLON) or does not match the XML Name production or
|
|
1274
|
+
* equals "xmlns" and attribute namespace is null, then throw an
|
|
1275
|
+
* exception; the serialization of this attr would not be a
|
|
1276
|
+
* well-formed attribute.
|
|
1277
|
+
*/
|
|
1278
|
+
if (requireWellFormed && (attr.localName.indexOf(":") !== -1 ||
|
|
1279
|
+
!(0, algorithm_1.xml_isName)(attr.localName))) {
|
|
1280
|
+
throw new Error("Attribute local name contains invalid characters (well-formed required).");
|
|
1410
1281
|
}
|
|
1411
|
-
|
|
1282
|
+
/**
|
|
1283
|
+
* 3.9. Append the following strings to result, in the order listed:
|
|
1284
|
+
* 3.9.1. The value of attr's localName;
|
|
1285
|
+
* 3.9.2. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
|
|
1286
|
+
* 3.9.3. The result of serializing an attribute value given attr's value
|
|
1287
|
+
* attribute and the require well-formed flag as input;
|
|
1288
|
+
* 3.9.4. """ (U+0022 QUOTATION MARK).
|
|
1289
|
+
*/
|
|
1290
|
+
result.push([null, null, attr.localName,
|
|
1291
|
+
this._serializeAttributeValue(attr.value, requireWellFormed)]);
|
|
1412
1292
|
}
|
|
1413
1293
|
/**
|
|
1414
1294
|
* 4. Return the value of result.
|
|
1415
1295
|
*/
|
|
1416
1296
|
return result;
|
|
1417
|
-
}
|
|
1297
|
+
}
|
|
1418
1298
|
/**
|
|
1419
1299
|
* Records namespace information for the given element and returns the
|
|
1420
1300
|
* default namespace attribute value.
|
|
@@ -1423,109 +1303,98 @@ var BaseWriter = /** @class */ (function () {
|
|
|
1423
1303
|
* @param map - namespace prefix map
|
|
1424
1304
|
* @param localPrefixesMap - local prefixes map
|
|
1425
1305
|
*/
|
|
1426
|
-
|
|
1427
|
-
var e_10, _a;
|
|
1306
|
+
_recordNamespaceInformation(node, map, localPrefixesMap) {
|
|
1428
1307
|
/**
|
|
1429
1308
|
* 1. Let default namespace attr value be null.
|
|
1430
1309
|
*/
|
|
1431
|
-
|
|
1432
|
-
|
|
1310
|
+
let defaultNamespaceAttrValue = null;
|
|
1311
|
+
/**
|
|
1312
|
+
* 2. Main: For each attribute attr in element's attributes, in the order
|
|
1313
|
+
* they are specified in the element's attribute list:
|
|
1314
|
+
*/
|
|
1315
|
+
for (const attr of node.attributes) {
|
|
1433
1316
|
/**
|
|
1434
|
-
*
|
|
1435
|
-
*
|
|
1317
|
+
* _Note:_ The following conditional steps find namespace prefixes. Only
|
|
1318
|
+
* attributes in the XMLNS namespace are considered (e.g., attributes made
|
|
1319
|
+
* to look like namespace declarations via
|
|
1320
|
+
* setAttribute("xmlns:pretend-prefix", "pretend-namespace") are not
|
|
1321
|
+
* included).
|
|
1436
1322
|
*/
|
|
1437
|
-
|
|
1438
|
-
|
|
1323
|
+
/** 2.1. Let attribute namespace be the value of attr's namespaceURI value. */
|
|
1324
|
+
let attributeNamespace = attr.namespaceURI;
|
|
1325
|
+
/** 2.2. Let attribute prefix be the value of attr's prefix. */
|
|
1326
|
+
let attributePrefix = attr.prefix;
|
|
1327
|
+
/** 2.3. If the attribute namespace is the XMLNS namespace, then: */
|
|
1328
|
+
if (attributeNamespace === infra_1.namespace.XMLNS) {
|
|
1439
1329
|
/**
|
|
1440
|
-
*
|
|
1441
|
-
*
|
|
1442
|
-
* to
|
|
1443
|
-
*
|
|
1444
|
-
* included).
|
|
1330
|
+
* 2.3.1. If attribute prefix is null, then attr is a default namespace
|
|
1331
|
+
* declaration. Set the default namespace attr value to attr's value and
|
|
1332
|
+
* stop running these steps, returning to Main to visit the next
|
|
1333
|
+
* attribute.
|
|
1445
1334
|
*/
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
var attributePrefix = attr.prefix;
|
|
1450
|
-
/** 2.3. If the attribute namespace is the XMLNS namespace, then: */
|
|
1451
|
-
if (attributeNamespace === infra_1.namespace.XMLNS) {
|
|
1335
|
+
if (attributePrefix === null) {
|
|
1336
|
+
defaultNamespaceAttrValue = attr.value;
|
|
1337
|
+
continue;
|
|
1452
1338
|
/**
|
|
1453
|
-
* 2.3.
|
|
1454
|
-
*
|
|
1455
|
-
|
|
1339
|
+
* 2.3.2. Otherwise, the attribute prefix is not null and attr is a
|
|
1340
|
+
* namespace prefix definition. Run the following steps:
|
|
1341
|
+
*/
|
|
1342
|
+
}
|
|
1343
|
+
else {
|
|
1344
|
+
/** 2.3.2.1. Let prefix definition be the value of attr's localName. */
|
|
1345
|
+
let prefixDefinition = attr.localName;
|
|
1346
|
+
/** 2.3.2.2. Let namespace definition be the value of attr's value. */
|
|
1347
|
+
let namespaceDefinition = attr.value;
|
|
1348
|
+
/**
|
|
1349
|
+
* 2.3.2.3. If namespace definition is the XML namespace, then stop
|
|
1350
|
+
* running these steps, and return to Main to visit the next
|
|
1456
1351
|
* attribute.
|
|
1352
|
+
*
|
|
1353
|
+
* _Note:_ XML namespace definitions in prefixes are completely
|
|
1354
|
+
* ignored (in order to avoid unnecessary work when there might be
|
|
1355
|
+
* prefix conflicts). XML namespaced elements are always handled
|
|
1356
|
+
* uniformly by prefixing (and overriding if necessary) the element's
|
|
1357
|
+
* localname with the reserved "xml" prefix.
|
|
1457
1358
|
*/
|
|
1458
|
-
if (
|
|
1459
|
-
defaultNamespaceAttrValue = attr.value;
|
|
1359
|
+
if (namespaceDefinition === infra_1.namespace.XML) {
|
|
1460
1360
|
continue;
|
|
1461
|
-
/**
|
|
1462
|
-
* 2.3.2. Otherwise, the attribute prefix is not null and attr is a
|
|
1463
|
-
* namespace prefix definition. Run the following steps:
|
|
1464
|
-
*/
|
|
1465
1361
|
}
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
* 2.3.2.4. If namespace definition is the empty string (the
|
|
1487
|
-
* declarative form of having no namespace), then let namespace
|
|
1488
|
-
* definition be null instead.
|
|
1489
|
-
*/
|
|
1490
|
-
if (namespaceDefinition === '') {
|
|
1491
|
-
namespaceDefinition = null;
|
|
1492
|
-
}
|
|
1493
|
-
/**
|
|
1494
|
-
* 2.3.2.5. If prefix definition is found in map given the namespace
|
|
1495
|
-
* namespace definition, then stop running these steps, and return to
|
|
1496
|
-
* Main to visit the next attribute.
|
|
1497
|
-
*
|
|
1498
|
-
* _Note:_ This step avoids adding duplicate prefix definitions for
|
|
1499
|
-
* the same namespace in the map. This has the side-effect of avoiding
|
|
1500
|
-
* later serialization of duplicate namespace prefix declarations in
|
|
1501
|
-
* any descendant nodes.
|
|
1502
|
-
*/
|
|
1503
|
-
if (map.has(prefixDefinition, namespaceDefinition)) {
|
|
1504
|
-
continue;
|
|
1505
|
-
}
|
|
1506
|
-
/**
|
|
1507
|
-
* 2.3.2.6. Add the prefix prefix definition to map given namespace
|
|
1508
|
-
* namespace definition.
|
|
1509
|
-
*/
|
|
1510
|
-
map.set(prefixDefinition, namespaceDefinition);
|
|
1511
|
-
/**
|
|
1512
|
-
* 2.3.2.7. Add the value of prefix definition as a new key to the
|
|
1513
|
-
* local prefixes map, with the namespace definition as the key's
|
|
1514
|
-
* value replacing the value of null with the empty string if
|
|
1515
|
-
* applicable.
|
|
1516
|
-
*/
|
|
1517
|
-
localPrefixesMap[prefixDefinition] = namespaceDefinition || '';
|
|
1362
|
+
/**
|
|
1363
|
+
* 2.3.2.4. If namespace definition is the empty string (the
|
|
1364
|
+
* declarative form of having no namespace), then let namespace
|
|
1365
|
+
* definition be null instead.
|
|
1366
|
+
*/
|
|
1367
|
+
if (namespaceDefinition === '') {
|
|
1368
|
+
namespaceDefinition = null;
|
|
1369
|
+
}
|
|
1370
|
+
/**
|
|
1371
|
+
* 2.3.2.5. If prefix definition is found in map given the namespace
|
|
1372
|
+
* namespace definition, then stop running these steps, and return to
|
|
1373
|
+
* Main to visit the next attribute.
|
|
1374
|
+
*
|
|
1375
|
+
* _Note:_ This step avoids adding duplicate prefix definitions for
|
|
1376
|
+
* the same namespace in the map. This has the side-effect of avoiding
|
|
1377
|
+
* later serialization of duplicate namespace prefix declarations in
|
|
1378
|
+
* any descendant nodes.
|
|
1379
|
+
*/
|
|
1380
|
+
if (map.has(prefixDefinition, namespaceDefinition)) {
|
|
1381
|
+
continue;
|
|
1518
1382
|
}
|
|
1383
|
+
/**
|
|
1384
|
+
* 2.3.2.6. Add the prefix prefix definition to map given namespace
|
|
1385
|
+
* namespace definition.
|
|
1386
|
+
*/
|
|
1387
|
+
map.set(prefixDefinition, namespaceDefinition);
|
|
1388
|
+
/**
|
|
1389
|
+
* 2.3.2.7. Add the value of prefix definition as a new key to the
|
|
1390
|
+
* local prefixes map, with the namespace definition as the key's
|
|
1391
|
+
* value replacing the value of null with the empty string if
|
|
1392
|
+
* applicable.
|
|
1393
|
+
*/
|
|
1394
|
+
localPrefixesMap[prefixDefinition] = namespaceDefinition || '';
|
|
1519
1395
|
}
|
|
1520
1396
|
}
|
|
1521
1397
|
}
|
|
1522
|
-
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
1523
|
-
finally {
|
|
1524
|
-
try {
|
|
1525
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1526
|
-
}
|
|
1527
|
-
finally { if (e_10) throw e_10.error; }
|
|
1528
|
-
}
|
|
1529
1398
|
/**
|
|
1530
1399
|
* 3. Return the value of default namespace attr value.
|
|
1531
1400
|
*
|
|
@@ -1533,7 +1402,7 @@ var BaseWriter = /** @class */ (function () {
|
|
|
1533
1402
|
* converted to null.
|
|
1534
1403
|
*/
|
|
1535
1404
|
return defaultNamespaceAttrValue;
|
|
1536
|
-
}
|
|
1405
|
+
}
|
|
1537
1406
|
/**
|
|
1538
1407
|
* Generates a new prefix for the given namespace.
|
|
1539
1408
|
*
|
|
@@ -1541,7 +1410,7 @@ var BaseWriter = /** @class */ (function () {
|
|
|
1541
1410
|
* @param prefixMap - namespace prefix map
|
|
1542
1411
|
* @param prefixIndex - generated namespace prefix index
|
|
1543
1412
|
*/
|
|
1544
|
-
|
|
1413
|
+
_generatePrefix(newNamespace, prefixMap, prefixIndex) {
|
|
1545
1414
|
/**
|
|
1546
1415
|
* 1. Let generated prefix be the concatenation of the string "ns" and the
|
|
1547
1416
|
* current numerical value of prefix index.
|
|
@@ -1549,18 +1418,18 @@ var BaseWriter = /** @class */ (function () {
|
|
|
1549
1418
|
* 3. Add to map the generated prefix given the new namespace namespace.
|
|
1550
1419
|
* 4. Return the value of generated prefix.
|
|
1551
1420
|
*/
|
|
1552
|
-
|
|
1421
|
+
const generatedPrefix = "ns" + prefixIndex.value.toString();
|
|
1553
1422
|
prefixIndex.value++;
|
|
1554
1423
|
prefixMap.set(generatedPrefix, newNamespace);
|
|
1555
1424
|
return generatedPrefix;
|
|
1556
|
-
}
|
|
1425
|
+
}
|
|
1557
1426
|
/**
|
|
1558
1427
|
* Produces an XML serialization of an attribute value.
|
|
1559
1428
|
*
|
|
1560
1429
|
* @param value - attribute value
|
|
1561
1430
|
* @param requireWellFormed - whether to check conformance
|
|
1562
1431
|
*/
|
|
1563
|
-
|
|
1432
|
+
_serializeAttributeValue(value, requireWellFormed) {
|
|
1564
1433
|
/**
|
|
1565
1434
|
* From: https://w3c.github.io/DOM-Parsing/#dfn-serializing-an-attribute-value
|
|
1566
1435
|
*
|
|
@@ -1569,7 +1438,7 @@ var BaseWriter = /** @class */ (function () {
|
|
|
1569
1438
|
* production, then throw an exception; the serialization of this attribute
|
|
1570
1439
|
* value would fail to produce a well-formed element serialization.
|
|
1571
1440
|
*/
|
|
1572
|
-
if (requireWellFormed && value !== null && !algorithm_1.xml_isLegalChar(value)) {
|
|
1441
|
+
if (requireWellFormed && value !== null && !(0, algorithm_1.xml_isLegalChar)(value)) {
|
|
1573
1442
|
throw new Error("Invalid characters in attribute value.");
|
|
1574
1443
|
}
|
|
1575
1444
|
/**
|
|
@@ -1593,11 +1462,7 @@ var BaseWriter = /** @class */ (function () {
|
|
|
1593
1462
|
.replace(/</g, '<')
|
|
1594
1463
|
.replace(/>/g, '>')
|
|
1595
1464
|
.replace(/"/g, '"');
|
|
1596
|
-
}
|
|
1597
|
-
|
|
1598
|
-
'bgsound', 'br', 'col', 'embed', 'frame', 'hr', 'img', 'input', 'keygen',
|
|
1599
|
-
'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']);
|
|
1600
|
-
return BaseWriter;
|
|
1601
|
-
}());
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1602
1467
|
exports.BaseWriter = BaseWriter;
|
|
1603
1468
|
//# sourceMappingURL=BaseWriter.js.map
|