@apify/docusaurus-plugin-typedoc-api 4.2.10 → 4.2.11-0
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/lib/_virtual/_commonjsHelpers.js +44 -0
- package/lib/_virtual/_commonjsHelpers.js.map +1 -0
- package/lib/node_modules/boolbase/index.js +18 -0
- package/lib/node_modules/boolbase/index.js.map +1 -0
- package/lib/node_modules/cheerio/lib/esm/api/attributes.js +568 -0
- package/lib/node_modules/cheerio/lib/esm/api/attributes.js.map +1 -0
- package/lib/node_modules/cheerio/lib/esm/api/css.js +113 -0
- package/lib/node_modules/cheerio/lib/esm/api/css.js.map +1 -0
- package/lib/node_modules/cheerio/lib/esm/api/forms.js +92 -0
- package/lib/node_modules/cheerio/lib/esm/api/forms.js.map +1 -0
- package/lib/node_modules/cheerio/lib/esm/api/manipulation.js +807 -0
- package/lib/node_modules/cheerio/lib/esm/api/manipulation.js.map +1 -0
- package/lib/node_modules/cheerio/lib/esm/api/traversing.js +842 -0
- package/lib/node_modules/cheerio/lib/esm/api/traversing.js.map +1 -0
- package/lib/node_modules/cheerio/lib/esm/cheerio.js +41 -0
- package/lib/node_modules/cheerio/lib/esm/cheerio.js.map +1 -0
- package/lib/node_modules/cheerio/lib/esm/index.js +112 -0
- package/lib/node_modules/cheerio/lib/esm/index.js.map +1 -0
- package/lib/node_modules/cheerio/lib/esm/load.js +110 -0
- package/lib/node_modules/cheerio/lib/esm/load.js.map +1 -0
- package/lib/node_modules/cheerio/lib/esm/options.js +32 -0
- package/lib/node_modules/cheerio/lib/esm/options.js.map +1 -0
- package/lib/node_modules/cheerio/lib/esm/parse.js +78 -0
- package/lib/node_modules/cheerio/lib/esm/parse.js.map +1 -0
- package/lib/node_modules/cheerio/lib/esm/parsers/parse5-adapter.js +57 -0
- package/lib/node_modules/cheerio/lib/esm/parsers/parse5-adapter.js.map +1 -0
- package/lib/node_modules/cheerio/lib/esm/static.js +191 -0
- package/lib/node_modules/cheerio/lib/esm/static.js.map +1 -0
- package/lib/node_modules/cheerio/lib/esm/utils.js +105 -0
- package/lib/node_modules/cheerio/lib/esm/utils.js.map +1 -0
- package/lib/node_modules/cheerio/node_modules/htmlparser2/lib/esm/Parser.js +381 -0
- package/lib/node_modules/cheerio/node_modules/htmlparser2/lib/esm/Parser.js.map +1 -0
- package/lib/node_modules/cheerio/node_modules/htmlparser2/lib/esm/Tokenizer.js +888 -0
- package/lib/node_modules/cheerio/node_modules/htmlparser2/lib/esm/Tokenizer.js.map +1 -0
- package/lib/node_modules/cheerio/node_modules/htmlparser2/lib/esm/index.js +69 -0
- package/lib/node_modules/cheerio/node_modules/htmlparser2/lib/esm/index.js.map +1 -0
- package/lib/node_modules/cheerio-select/lib/esm/helpers.js +22 -0
- package/lib/node_modules/cheerio-select/lib/esm/helpers.js.map +1 -0
- package/lib/node_modules/cheerio-select/lib/esm/index.js +252 -0
- package/lib/node_modules/cheerio-select/lib/esm/index.js.map +1 -0
- package/lib/node_modules/cheerio-select/lib/esm/positionals.js +37 -0
- package/lib/node_modules/cheerio-select/lib/esm/positionals.js.map +1 -0
- package/lib/node_modules/css-select/lib/esm/attributes.js +155 -0
- package/lib/node_modules/css-select/lib/esm/attributes.js.map +1 -0
- package/lib/node_modules/css-select/lib/esm/compile.js +118 -0
- package/lib/node_modules/css-select/lib/esm/compile.js.map +1 -0
- package/lib/node_modules/css-select/lib/esm/general.js +155 -0
- package/lib/node_modules/css-select/lib/esm/general.js.map +1 -0
- package/lib/node_modules/css-select/lib/esm/index.js +115 -0
- package/lib/node_modules/css-select/lib/esm/index.js.map +1 -0
- package/lib/node_modules/css-select/lib/esm/pseudo-selectors/aliases.js +38 -0
- package/lib/node_modules/css-select/lib/esm/pseudo-selectors/aliases.js.map +1 -0
- package/lib/node_modules/css-select/lib/esm/pseudo-selectors/filters.js +151 -0
- package/lib/node_modules/css-select/lib/esm/pseudo-selectors/filters.js.map +1 -0
- package/lib/node_modules/css-select/lib/esm/pseudo-selectors/index.js +47 -0
- package/lib/node_modules/css-select/lib/esm/pseudo-selectors/index.js.map +1 -0
- package/lib/node_modules/css-select/lib/esm/pseudo-selectors/pseudos.js +88 -0
- package/lib/node_modules/css-select/lib/esm/pseudo-selectors/pseudos.js.map +1 -0
- package/lib/node_modules/css-select/lib/esm/pseudo-selectors/subselects.js +85 -0
- package/lib/node_modules/css-select/lib/esm/pseudo-selectors/subselects.js.map +1 -0
- package/lib/node_modules/css-select/lib/esm/sort.js +70 -0
- package/lib/node_modules/css-select/lib/esm/sort.js.map +1 -0
- package/lib/node_modules/css-what/lib/es/index.js +18 -0
- package/lib/node_modules/css-what/lib/es/index.js.map +1 -0
- package/lib/node_modules/css-what/lib/es/parse.js +397 -0
- package/lib/node_modules/css-what/lib/es/parse.js.map +1 -0
- package/lib/node_modules/css-what/lib/es/stringify.js +95 -0
- package/lib/node_modules/css-what/lib/es/stringify.js.map +1 -0
- package/lib/node_modules/css-what/lib/es/types.js +43 -0
- package/lib/node_modules/css-what/lib/es/types.js.map +1 -0
- package/lib/node_modules/dom-serializer/lib/esm/foreignNames.js +7 -0
- package/lib/node_modules/dom-serializer/lib/esm/foreignNames.js.map +1 -0
- package/lib/node_modules/dom-serializer/lib/esm/index.js +146 -0
- package/lib/node_modules/dom-serializer/lib/esm/index.js.map +1 -0
- package/lib/node_modules/domelementtype/lib/esm/index.js +62 -0
- package/lib/node_modules/domelementtype/lib/esm/index.js.map +1 -0
- package/lib/node_modules/domhandler/lib/esm/index.js +166 -0
- package/lib/node_modules/domhandler/lib/esm/index.js.map +1 -0
- package/lib/node_modules/domhandler/lib/esm/node.js +352 -0
- package/lib/node_modules/domhandler/lib/esm/node.js.map +1 -0
- package/lib/node_modules/domutils/lib/esm/feeds.js +176 -0
- package/lib/node_modules/domutils/lib/esm/feeds.js.map +1 -0
- package/lib/node_modules/domutils/lib/esm/helpers.js +142 -0
- package/lib/node_modules/domutils/lib/esm/helpers.js.map +1 -0
- package/lib/node_modules/domutils/lib/esm/index.js +56 -0
- package/lib/node_modules/domutils/lib/esm/index.js.map +1 -0
- package/lib/node_modules/domutils/lib/esm/legacy.js +144 -0
- package/lib/node_modules/domutils/lib/esm/legacy.js.map +1 -0
- package/lib/node_modules/domutils/lib/esm/manipulation.js +137 -0
- package/lib/node_modules/domutils/lib/esm/manipulation.js.map +1 -0
- package/lib/node_modules/domutils/lib/esm/querying.js +149 -0
- package/lib/node_modules/domutils/lib/esm/querying.js.map +1 -0
- package/lib/node_modules/domutils/lib/esm/stringify.js +80 -0
- package/lib/node_modules/domutils/lib/esm/stringify.js.map +1 -0
- package/lib/node_modules/domutils/lib/esm/traversal.js +128 -0
- package/lib/node_modules/domutils/lib/esm/traversal.js.map +1 -0
- package/lib/node_modules/entities/lib/esm/decode.js +495 -0
- package/lib/node_modules/entities/lib/esm/decode.js.map +1 -0
- package/lib/node_modules/entities/lib/esm/decode_codepoint.js +52 -0
- package/lib/node_modules/entities/lib/esm/decode_codepoint.js.map +1 -0
- package/lib/node_modules/entities/lib/esm/encode.js +68 -0
- package/lib/node_modules/entities/lib/esm/encode.js.map +1 -0
- package/lib/node_modules/entities/lib/esm/escape.js +103 -0
- package/lib/node_modules/entities/lib/esm/escape.js.map +1 -0
- package/lib/node_modules/entities/lib/esm/generated/decode-data-html.js +8 -0
- package/lib/node_modules/entities/lib/esm/generated/decode-data-html.js.map +1 -0
- package/lib/node_modules/entities/lib/esm/generated/decode-data-xml.js +8 -0
- package/lib/node_modules/entities/lib/esm/generated/decode-data-xml.js.map +1 -0
- package/lib/node_modules/entities/lib/esm/generated/encode-html.js +264 -0
- package/lib/node_modules/entities/lib/esm/generated/encode-html.js.map +1 -0
- package/lib/node_modules/entities/lib/esm/index.js +122 -0
- package/lib/node_modules/entities/lib/esm/index.js.map +1 -0
- package/lib/node_modules/nth-check/lib/esm/compile.js +111 -0
- package/lib/node_modules/nth-check/lib/esm/compile.js.map +1 -0
- package/lib/node_modules/nth-check/lib/esm/index.js +73 -0
- package/lib/node_modules/nth-check/lib/esm/index.js.map +1 -0
- package/lib/node_modules/nth-check/lib/esm/parse.js +71 -0
- package/lib/node_modules/nth-check/lib/esm/parse.js.map +1 -0
- package/lib/node_modules/parse5/dist/common/doctype.js +49 -0
- package/lib/node_modules/parse5/dist/common/doctype.js.map +1 -0
- package/lib/node_modules/parse5/dist/common/error-codes.js +66 -0
- package/lib/node_modules/parse5/dist/common/error-codes.js.map +1 -0
- package/lib/node_modules/parse5/dist/common/foreign-content.js +134 -0
- package/lib/node_modules/parse5/dist/common/foreign-content.js.map +1 -0
- package/lib/node_modules/parse5/dist/common/html.js +316 -0
- package/lib/node_modules/parse5/dist/common/html.js.map +1 -0
- package/lib/node_modules/parse5/dist/common/token.js +24 -0
- package/lib/node_modules/parse5/dist/common/token.js.map +1 -0
- package/lib/node_modules/parse5/dist/common/unicode.js +72 -0
- package/lib/node_modules/parse5/dist/common/unicode.js.map +1 -0
- package/lib/node_modules/parse5/dist/index.js +58 -0
- package/lib/node_modules/parse5/dist/index.js.map +1 -0
- package/lib/node_modules/parse5/dist/parser/formatting-element-list.js +115 -0
- package/lib/node_modules/parse5/dist/parser/formatting-element-list.js.map +1 -0
- package/lib/node_modules/parse5/dist/parser/index.js +3387 -0
- package/lib/node_modules/parse5/dist/parser/index.js.map +1 -0
- package/lib/node_modules/parse5/dist/parser/open-element-stack.js +286 -0
- package/lib/node_modules/parse5/dist/parser/open-element-stack.js.map +1 -0
- package/lib/node_modules/parse5/dist/serializer/index.js +160 -0
- package/lib/node_modules/parse5/dist/serializer/index.js.map +1 -0
- package/lib/node_modules/parse5/dist/tokenizer/index.js +3142 -0
- package/lib/node_modules/parse5/dist/tokenizer/index.js.map +1 -0
- package/lib/node_modules/parse5/dist/tokenizer/preprocessor.js +195 -0
- package/lib/node_modules/parse5/dist/tokenizer/preprocessor.js.map +1 -0
- package/lib/node_modules/parse5/dist/tree-adapters/default.js +180 -0
- package/lib/node_modules/parse5/dist/tree-adapters/default.js.map +1 -0
- package/lib/node_modules/parse5-htmlparser2-tree-adapter/dist/index.js +218 -0
- package/lib/node_modules/parse5-htmlparser2-tree-adapter/dist/index.js.map +1 -0
- package/lib/packages/plugin/src/components/AnchorLink.js.map +1 -0
- package/lib/packages/plugin/src/components/ApiChangelog.js.map +1 -0
- package/lib/packages/plugin/src/components/ApiDataContext.js.map +1 -0
- package/lib/packages/plugin/src/components/ApiIndex.js.map +1 -0
- package/lib/{components → packages/plugin/src/components}/ApiItem.js +97 -2
- package/lib/packages/plugin/src/components/ApiItem.js.map +1 -0
- package/lib/packages/plugin/src/components/ApiItemLayout.js.map +1 -0
- package/lib/packages/plugin/src/components/ApiOptionsLayout.js.map +1 -0
- package/lib/{components → packages/plugin/src/components}/ApiPage.js +0 -3
- package/lib/packages/plugin/src/components/ApiPage.js.map +1 -0
- package/lib/packages/plugin/src/components/Breadcrumb.js.map +1 -0
- package/lib/packages/plugin/src/components/Comment.js.map +1 -0
- package/lib/packages/plugin/src/components/CommentBadges.js.map +1 -0
- package/lib/packages/plugin/src/components/DefaultValue.js.map +1 -0
- package/lib/packages/plugin/src/components/Flags.js.map +1 -0
- package/lib/packages/plugin/src/components/Footer.js.map +1 -0
- package/lib/packages/plugin/src/components/Hierarchy.js.map +1 -0
- package/lib/packages/plugin/src/components/Icon.js.map +1 -0
- package/lib/packages/plugin/src/components/Index.js.map +1 -0
- package/lib/{components → packages/plugin/src/components}/Markdown.js +0 -2
- package/lib/packages/plugin/src/components/Markdown.js.map +1 -0
- package/lib/packages/plugin/src/components/Member.js.map +1 -0
- package/lib/packages/plugin/src/components/MemberDeclaration.js.map +1 -0
- package/lib/{components → packages/plugin/src/components}/MemberGetterSetter.js +0 -1
- package/lib/packages/plugin/src/components/MemberGetterSetter.js.map +1 -0
- package/lib/packages/plugin/src/components/MemberReference.js.map +1 -0
- package/lib/{components → packages/plugin/src/components}/MemberSignatureBody.js +2 -7
- package/lib/packages/plugin/src/components/MemberSignatureBody.js.map +1 -0
- package/lib/packages/plugin/src/components/MemberSignatureTitle.js.map +1 -0
- package/lib/packages/plugin/src/components/MemberSignatures.js.map +1 -0
- package/lib/packages/plugin/src/components/MemberSources.js.map +1 -0
- package/lib/packages/plugin/src/components/Members.js.map +1 -0
- package/lib/packages/plugin/src/components/MembersGroup.js.map +1 -0
- package/lib/packages/plugin/src/components/Parameter.js.map +1 -0
- package/lib/{components → packages/plugin/src/components}/Reflection.js +0 -1
- package/lib/packages/plugin/src/components/Reflection.js.map +1 -0
- package/lib/{components → packages/plugin/src/components}/SourceLink.js +5 -1
- package/lib/packages/plugin/src/components/SourceLink.js.map +1 -0
- package/lib/{components → packages/plugin/src/components}/Type.js +2 -3
- package/lib/packages/plugin/src/components/Type.js.map +1 -0
- package/lib/packages/plugin/src/components/TypeAndParent.js.map +1 -0
- package/lib/packages/plugin/src/components/TypeParameters.js.map +1 -0
- package/lib/packages/plugin/src/components/TypeParametersGeneric.js.map +1 -0
- package/lib/packages/plugin/src/components/VersionBanner.js.map +1 -0
- package/lib/packages/plugin/src/hooks/useBreadcrumbs.js.map +1 -0
- package/lib/packages/plugin/src/hooks/useGitRefName.js.map +1 -0
- package/lib/packages/plugin/src/hooks/useMinimalLayout.js.map +1 -0
- package/lib/packages/plugin/src/hooks/useReflection.js.map +1 -0
- package/lib/packages/plugin/src/hooks/useReflectionMap.js.map +1 -0
- package/lib/{index.js → packages/plugin/src/index.js} +23 -10
- package/lib/packages/plugin/src/index.js.map +1 -0
- package/lib/packages/plugin/src/markdownLoader.js.map +1 -0
- package/lib/{plugin → packages/plugin/src/plugin}/data.js +1 -9
- package/lib/packages/plugin/src/plugin/data.js.map +1 -0
- package/lib/packages/plugin/src/plugin/python/consts.js +47 -0
- package/lib/packages/plugin/src/plugin/python/consts.js.map +1 -0
- package/lib/packages/plugin/src/plugin/python/index.js +36 -0
- package/lib/packages/plugin/src/plugin/python/index.js.map +1 -0
- package/lib/packages/plugin/src/plugin/python/inheritance.js +71 -0
- package/lib/packages/plugin/src/plugin/python/inheritance.js.map +1 -0
- package/lib/packages/plugin/src/plugin/python/packageVersions.js +46 -0
- package/lib/packages/plugin/src/plugin/python/packageVersions.js.map +1 -0
- package/lib/packages/plugin/src/plugin/python/transformation.js +359 -0
- package/lib/packages/plugin/src/plugin/python/transformation.js.map +1 -0
- package/lib/packages/plugin/src/plugin/python/type-parsing/index.js +79 -0
- package/lib/packages/plugin/src/plugin/python/type-parsing/index.js.map +1 -0
- package/lib/packages/plugin/src/plugin/python/types.js +2 -0
- package/lib/packages/plugin/src/plugin/python/types.js.map +1 -0
- package/lib/packages/plugin/src/plugin/python/utils.js +106 -0
- package/lib/packages/plugin/src/plugin/python/utils.js.map +1 -0
- package/lib/packages/plugin/src/plugin/sidebar.js.map +1 -0
- package/lib/{plugin → packages/plugin/src/plugin}/structure/0.23.js +0 -2
- package/lib/packages/plugin/src/plugin/structure/0.23.js.map +1 -0
- package/lib/packages/plugin/src/plugin/url.js.map +1 -0
- package/lib/packages/plugin/src/plugin/version.js.map +1 -0
- package/lib/packages/plugin/src/types.js +2 -0
- package/lib/packages/plugin/src/types.js.map +1 -0
- package/lib/packages/plugin/src/utils/helpers.js.map +1 -0
- package/lib/packages/plugin/src/utils/hierarchy.js.map +1 -0
- package/lib/{utils → packages/plugin/src/utils}/icons.js +1 -2
- package/lib/packages/plugin/src/utils/icons.js.map +1 -0
- package/lib/packages/plugin/src/utils/links.js.map +1 -0
- package/lib/packages/plugin/src/utils/markdown.js.map +1 -0
- package/lib/packages/plugin/src/utils/reexports.js +96 -0
- package/lib/packages/plugin/src/utils/reexports.js.map +1 -0
- package/lib/packages/plugin/src/utils/visibility.js.map +1 -0
- package/package.json +3 -2
- package/src/components/ApiItem.tsx +103 -9
- package/src/components/ApiItemLayout.tsx +4 -2
- package/src/components/ApiOptionsLayout.tsx +18 -16
- package/src/components/ApiPage.tsx +0 -2
- package/src/components/DefaultValue.tsx +0 -1
- package/src/components/Flags.tsx +1 -1
- package/src/components/Markdown.tsx +0 -1
- package/src/components/Member.tsx +19 -17
- package/src/components/MemberGetterSetter.tsx +0 -1
- package/src/components/MemberSignatureBody.tsx +42 -38
- package/src/components/MemberSignatureTitle.tsx +18 -15
- package/src/components/Reflection.tsx +1 -1
- package/src/components/SourceLink.tsx +6 -8
- package/src/components/Type.tsx +6 -14
- package/src/components/VersionBanner.tsx +5 -1
- package/src/index.ts +39 -9
- package/src/plugin/data.ts +6 -12
- package/src/plugin/python/consts.ts +50 -0
- package/src/plugin/python/docspec-gen/__init__.py +0 -0
- package/src/plugin/python/docspec-gen/generate_ast.py +73 -0
- package/src/plugin/python/docspec-gen/google_docstring_processor.py +185 -0
- package/src/plugin/python/index.ts +47 -0
- package/src/plugin/python/inheritance.ts +80 -0
- package/src/plugin/python/packageVersions.ts +43 -0
- package/src/plugin/python/transformation.ts +444 -0
- package/src/plugin/python/type-parsing/index.ts +88 -0
- package/src/plugin/python/type-parsing/parse_types.py +82 -0
- package/src/plugin/python/types.ts +83 -0
- package/src/plugin/python/utils.ts +123 -0
- package/src/plugin/structure/0.23.ts +0 -2
- package/src/plugin/version.ts +2 -2
- package/src/types.ts +9 -0
- package/src/utils/icons.ts +4 -3
- package/src/utils/reexports.ts +105 -0
- package/lib/components/AnchorLink.js.map +0 -1
- package/lib/components/ApiChangelog.js.map +0 -1
- package/lib/components/ApiDataContext.js.map +0 -1
- package/lib/components/ApiIndex.js.map +0 -1
- package/lib/components/ApiItem.js.map +0 -1
- package/lib/components/ApiItemLayout.js.map +0 -1
- package/lib/components/ApiOptionsLayout.js.map +0 -1
- package/lib/components/ApiPage.js.map +0 -1
- package/lib/components/Breadcrumb.js.map +0 -1
- package/lib/components/Comment.js.map +0 -1
- package/lib/components/CommentBadges.js.map +0 -1
- package/lib/components/DefaultValue.js.map +0 -1
- package/lib/components/Flags.js.map +0 -1
- package/lib/components/Footer.js.map +0 -1
- package/lib/components/Hierarchy.js.map +0 -1
- package/lib/components/Icon.js.map +0 -1
- package/lib/components/Index.js.map +0 -1
- package/lib/components/Markdown.js.map +0 -1
- package/lib/components/Member.js.map +0 -1
- package/lib/components/MemberDeclaration.js.map +0 -1
- package/lib/components/MemberGetterSetter.js.map +0 -1
- package/lib/components/MemberReference.js.map +0 -1
- package/lib/components/MemberSignatureBody.js.map +0 -1
- package/lib/components/MemberSignatureTitle.js.map +0 -1
- package/lib/components/MemberSignatures.js.map +0 -1
- package/lib/components/MemberSources.js.map +0 -1
- package/lib/components/Members.js.map +0 -1
- package/lib/components/MembersGroup.js.map +0 -1
- package/lib/components/Parameter.js.map +0 -1
- package/lib/components/Reflection.js.map +0 -1
- package/lib/components/SourceLink.js.map +0 -1
- package/lib/components/Type.js.map +0 -1
- package/lib/components/TypeAndParent.js.map +0 -1
- package/lib/components/TypeParameters.js.map +0 -1
- package/lib/components/TypeParametersGeneric.js.map +0 -1
- package/lib/components/VersionBanner.js.map +0 -1
- package/lib/hooks/useBreadcrumbs.js.map +0 -1
- package/lib/hooks/useGitRefName.js.map +0 -1
- package/lib/hooks/useMinimalLayout.js.map +0 -1
- package/lib/hooks/useReflection.js.map +0 -1
- package/lib/hooks/useReflectionMap.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/markdownLoader.js.map +0 -1
- package/lib/plugin/data.js.map +0 -1
- package/lib/plugin/sidebar.js.map +0 -1
- package/lib/plugin/structure/0.23.js.map +0 -1
- package/lib/plugin/url.js.map +0 -1
- package/lib/plugin/version.js.map +0 -1
- package/lib/utils/helpers.js.map +0 -1
- package/lib/utils/hierarchy.js.map +0 -1
- package/lib/utils/icons.js.map +0 -1
- package/lib/utils/links.js.map +0 -1
- package/lib/utils/markdown.js.map +0 -1
- package/lib/utils/visibility.js.map +0 -1
- /package/lib/{types.js → node_modules/cheerio/lib/esm/types.js} +0 -0
- /package/lib/{types.js.map → node_modules/cheerio/lib/esm/types.js.map} +0 -0
- /package/lib/{components → packages/plugin/src/components}/AnchorLink.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/ApiChangelog.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/ApiDataContext.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/ApiIndex.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/ApiItemLayout.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/ApiOptionsLayout.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/Breadcrumb.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/Comment.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/CommentBadges.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/DefaultValue.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/Flags.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/Footer.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/Hierarchy.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/Icon.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/Index.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/Member.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/MemberDeclaration.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/MemberReference.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/MemberSignatureTitle.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/MemberSignatures.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/MemberSources.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/Members.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/MembersGroup.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/Parameter.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/TypeAndParent.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/TypeParameters.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/TypeParametersGeneric.js +0 -0
- /package/lib/{components → packages/plugin/src/components}/VersionBanner.js +0 -0
- /package/lib/{hooks → packages/plugin/src/hooks}/useBreadcrumbs.js +0 -0
- /package/lib/{hooks → packages/plugin/src/hooks}/useGitRefName.js +0 -0
- /package/lib/{hooks → packages/plugin/src/hooks}/useMinimalLayout.js +0 -0
- /package/lib/{hooks → packages/plugin/src/hooks}/useReflection.js +0 -0
- /package/lib/{hooks → packages/plugin/src/hooks}/useReflectionMap.js +0 -0
- /package/lib/{markdownLoader.js → packages/plugin/src/markdownLoader.js} +0 -0
- /package/lib/{plugin → packages/plugin/src/plugin}/sidebar.js +0 -0
- /package/lib/{plugin → packages/plugin/src/plugin}/url.js +0 -0
- /package/lib/{plugin → packages/plugin/src/plugin}/version.js +0 -0
- /package/lib/{utils → packages/plugin/src/utils}/helpers.js +0 -0
- /package/lib/{utils → packages/plugin/src/utils}/hierarchy.js +0 -0
- /package/lib/{utils → packages/plugin/src/utils}/links.js +0 -0
- /package/lib/{utils → packages/plugin/src/utils}/markdown.js +0 -0
- /package/lib/{utils → packages/plugin/src/utils}/visibility.js +0 -0
|
@@ -0,0 +1,888 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
const decode = require('../../../../../entities/lib/esm/decode.js');
|
|
7
|
+
const decodeDataXml = require('../../../../../entities/lib/esm/generated/decode-data-xml.js');
|
|
8
|
+
const decodeDataHtml = require('../../../../../entities/lib/esm/generated/decode-data-html.js');
|
|
9
|
+
const decode_codepoint = require('../../../../../entities/lib/esm/decode_codepoint.js');
|
|
10
|
+
var CharCodes;
|
|
11
|
+
(function (CharCodes) {
|
|
12
|
+
CharCodes[CharCodes["Tab"] = 9] = "Tab";
|
|
13
|
+
CharCodes[CharCodes["NewLine"] = 10] = "NewLine";
|
|
14
|
+
CharCodes[CharCodes["FormFeed"] = 12] = "FormFeed";
|
|
15
|
+
CharCodes[CharCodes["CarriageReturn"] = 13] = "CarriageReturn";
|
|
16
|
+
CharCodes[CharCodes["Space"] = 32] = "Space";
|
|
17
|
+
CharCodes[CharCodes["ExclamationMark"] = 33] = "ExclamationMark";
|
|
18
|
+
CharCodes[CharCodes["Number"] = 35] = "Number";
|
|
19
|
+
CharCodes[CharCodes["Amp"] = 38] = "Amp";
|
|
20
|
+
CharCodes[CharCodes["SingleQuote"] = 39] = "SingleQuote";
|
|
21
|
+
CharCodes[CharCodes["DoubleQuote"] = 34] = "DoubleQuote";
|
|
22
|
+
CharCodes[CharCodes["Dash"] = 45] = "Dash";
|
|
23
|
+
CharCodes[CharCodes["Slash"] = 47] = "Slash";
|
|
24
|
+
CharCodes[CharCodes["Zero"] = 48] = "Zero";
|
|
25
|
+
CharCodes[CharCodes["Nine"] = 57] = "Nine";
|
|
26
|
+
CharCodes[CharCodes["Semi"] = 59] = "Semi";
|
|
27
|
+
CharCodes[CharCodes["Lt"] = 60] = "Lt";
|
|
28
|
+
CharCodes[CharCodes["Eq"] = 61] = "Eq";
|
|
29
|
+
CharCodes[CharCodes["Gt"] = 62] = "Gt";
|
|
30
|
+
CharCodes[CharCodes["Questionmark"] = 63] = "Questionmark";
|
|
31
|
+
CharCodes[CharCodes["UpperA"] = 65] = "UpperA";
|
|
32
|
+
CharCodes[CharCodes["LowerA"] = 97] = "LowerA";
|
|
33
|
+
CharCodes[CharCodes["UpperF"] = 70] = "UpperF";
|
|
34
|
+
CharCodes[CharCodes["LowerF"] = 102] = "LowerF";
|
|
35
|
+
CharCodes[CharCodes["UpperZ"] = 90] = "UpperZ";
|
|
36
|
+
CharCodes[CharCodes["LowerZ"] = 122] = "LowerZ";
|
|
37
|
+
CharCodes[CharCodes["LowerX"] = 120] = "LowerX";
|
|
38
|
+
CharCodes[CharCodes["OpeningSquareBracket"] = 91] = "OpeningSquareBracket";
|
|
39
|
+
})(CharCodes || (CharCodes = {}));
|
|
40
|
+
/** All the states the tokenizer can be in. */
|
|
41
|
+
var State;
|
|
42
|
+
(function (State) {
|
|
43
|
+
State[State["Text"] = 1] = "Text";
|
|
44
|
+
State[State["BeforeTagName"] = 2] = "BeforeTagName";
|
|
45
|
+
State[State["InTagName"] = 3] = "InTagName";
|
|
46
|
+
State[State["InSelfClosingTag"] = 4] = "InSelfClosingTag";
|
|
47
|
+
State[State["BeforeClosingTagName"] = 5] = "BeforeClosingTagName";
|
|
48
|
+
State[State["InClosingTagName"] = 6] = "InClosingTagName";
|
|
49
|
+
State[State["AfterClosingTagName"] = 7] = "AfterClosingTagName";
|
|
50
|
+
// Attributes
|
|
51
|
+
State[State["BeforeAttributeName"] = 8] = "BeforeAttributeName";
|
|
52
|
+
State[State["InAttributeName"] = 9] = "InAttributeName";
|
|
53
|
+
State[State["AfterAttributeName"] = 10] = "AfterAttributeName";
|
|
54
|
+
State[State["BeforeAttributeValue"] = 11] = "BeforeAttributeValue";
|
|
55
|
+
State[State["InAttributeValueDq"] = 12] = "InAttributeValueDq";
|
|
56
|
+
State[State["InAttributeValueSq"] = 13] = "InAttributeValueSq";
|
|
57
|
+
State[State["InAttributeValueNq"] = 14] = "InAttributeValueNq";
|
|
58
|
+
// Declarations
|
|
59
|
+
State[State["BeforeDeclaration"] = 15] = "BeforeDeclaration";
|
|
60
|
+
State[State["InDeclaration"] = 16] = "InDeclaration";
|
|
61
|
+
// Processing instructions
|
|
62
|
+
State[State["InProcessingInstruction"] = 17] = "InProcessingInstruction";
|
|
63
|
+
// Comments & CDATA
|
|
64
|
+
State[State["BeforeComment"] = 18] = "BeforeComment";
|
|
65
|
+
State[State["CDATASequence"] = 19] = "CDATASequence";
|
|
66
|
+
State[State["InSpecialComment"] = 20] = "InSpecialComment";
|
|
67
|
+
State[State["InCommentLike"] = 21] = "InCommentLike";
|
|
68
|
+
// Special tags
|
|
69
|
+
State[State["BeforeSpecialS"] = 22] = "BeforeSpecialS";
|
|
70
|
+
State[State["SpecialStartSequence"] = 23] = "SpecialStartSequence";
|
|
71
|
+
State[State["InSpecialTag"] = 24] = "InSpecialTag";
|
|
72
|
+
State[State["BeforeEntity"] = 25] = "BeforeEntity";
|
|
73
|
+
State[State["BeforeNumericEntity"] = 26] = "BeforeNumericEntity";
|
|
74
|
+
State[State["InNamedEntity"] = 27] = "InNamedEntity";
|
|
75
|
+
State[State["InNumericEntity"] = 28] = "InNumericEntity";
|
|
76
|
+
State[State["InHexEntity"] = 29] = "InHexEntity";
|
|
77
|
+
})(State || (State = {}));
|
|
78
|
+
function isWhitespace(c) {
|
|
79
|
+
return c === CharCodes.Space || c === CharCodes.NewLine || c === CharCodes.Tab || c === CharCodes.FormFeed || c === CharCodes.CarriageReturn;
|
|
80
|
+
}
|
|
81
|
+
function isEndOfTagSection(c) {
|
|
82
|
+
return c === CharCodes.Slash || c === CharCodes.Gt || isWhitespace(c);
|
|
83
|
+
}
|
|
84
|
+
function isNumber(c) {
|
|
85
|
+
return c >= CharCodes.Zero && c <= CharCodes.Nine;
|
|
86
|
+
}
|
|
87
|
+
function isASCIIAlpha(c) {
|
|
88
|
+
return c >= CharCodes.LowerA && c <= CharCodes.LowerZ || c >= CharCodes.UpperA && c <= CharCodes.UpperZ;
|
|
89
|
+
}
|
|
90
|
+
function isHexDigit(c) {
|
|
91
|
+
return c >= CharCodes.UpperA && c <= CharCodes.UpperF || c >= CharCodes.LowerA && c <= CharCodes.LowerF;
|
|
92
|
+
}
|
|
93
|
+
exports.QuoteType = void 0;
|
|
94
|
+
(function (QuoteType) {
|
|
95
|
+
QuoteType[QuoteType["NoValue"] = 0] = "NoValue";
|
|
96
|
+
QuoteType[QuoteType["Unquoted"] = 1] = "Unquoted";
|
|
97
|
+
QuoteType[QuoteType["Single"] = 2] = "Single";
|
|
98
|
+
QuoteType[QuoteType["Double"] = 3] = "Double";
|
|
99
|
+
})(exports.QuoteType || (exports.QuoteType = {}));
|
|
100
|
+
/**
|
|
101
|
+
* Sequences used to match longer strings.
|
|
102
|
+
*
|
|
103
|
+
* We don't have `Script`, `Style`, or `Title` here. Instead, we re-use the *End
|
|
104
|
+
* sequences with an increased offset.
|
|
105
|
+
*/
|
|
106
|
+
const Sequences = {
|
|
107
|
+
Cdata: new Uint8Array([0x43, 0x44, 0x41, 0x54, 0x41, 0x5b]),
|
|
108
|
+
CdataEnd: new Uint8Array([0x5d, 0x5d, 0x3e]),
|
|
109
|
+
CommentEnd: new Uint8Array([0x2d, 0x2d, 0x3e]),
|
|
110
|
+
ScriptEnd: new Uint8Array([0x3c, 0x2f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74]),
|
|
111
|
+
StyleEnd: new Uint8Array([0x3c, 0x2f, 0x73, 0x74, 0x79, 0x6c, 0x65]),
|
|
112
|
+
TitleEnd: new Uint8Array([0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65]) // `</title`
|
|
113
|
+
};
|
|
114
|
+
class Tokenizer {
|
|
115
|
+
constructor({
|
|
116
|
+
xmlMode = false,
|
|
117
|
+
decodeEntities = true
|
|
118
|
+
}, cbs) {
|
|
119
|
+
this.cbs = cbs;
|
|
120
|
+
/** The current state the tokenizer is in. */
|
|
121
|
+
this.state = State.Text;
|
|
122
|
+
/** The read buffer. */
|
|
123
|
+
this.buffer = "";
|
|
124
|
+
/** The beginning of the section that is currently being read. */
|
|
125
|
+
this.sectionStart = 0;
|
|
126
|
+
/** The index within the buffer that we are currently looking at. */
|
|
127
|
+
this.index = 0;
|
|
128
|
+
/** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
|
|
129
|
+
this.baseState = State.Text;
|
|
130
|
+
/** For special parsing behavior inside of script and style tags. */
|
|
131
|
+
this.isSpecial = false;
|
|
132
|
+
/** Indicates whether the tokenizer has been paused. */
|
|
133
|
+
this.running = true;
|
|
134
|
+
/** The offset of the current buffer. */
|
|
135
|
+
this.offset = 0;
|
|
136
|
+
this.currentSequence = undefined;
|
|
137
|
+
this.sequenceIndex = 0;
|
|
138
|
+
this.trieIndex = 0;
|
|
139
|
+
this.trieCurrent = 0;
|
|
140
|
+
/** For named entities, the index of the value. For numeric entities, the code point. */
|
|
141
|
+
this.entityResult = 0;
|
|
142
|
+
this.entityExcess = 0;
|
|
143
|
+
this.xmlMode = xmlMode;
|
|
144
|
+
this.decodeEntities = decodeEntities;
|
|
145
|
+
this.entityTrie = xmlMode ? decodeDataXml : decodeDataHtml;
|
|
146
|
+
}
|
|
147
|
+
reset() {
|
|
148
|
+
this.state = State.Text;
|
|
149
|
+
this.buffer = "";
|
|
150
|
+
this.sectionStart = 0;
|
|
151
|
+
this.index = 0;
|
|
152
|
+
this.baseState = State.Text;
|
|
153
|
+
this.currentSequence = undefined;
|
|
154
|
+
this.running = true;
|
|
155
|
+
this.offset = 0;
|
|
156
|
+
}
|
|
157
|
+
write(chunk) {
|
|
158
|
+
this.offset += this.buffer.length;
|
|
159
|
+
this.buffer = chunk;
|
|
160
|
+
this.parse();
|
|
161
|
+
}
|
|
162
|
+
end() {
|
|
163
|
+
if (this.running) this.finish();
|
|
164
|
+
}
|
|
165
|
+
pause() {
|
|
166
|
+
this.running = false;
|
|
167
|
+
}
|
|
168
|
+
resume() {
|
|
169
|
+
this.running = true;
|
|
170
|
+
if (this.index < this.buffer.length + this.offset) {
|
|
171
|
+
this.parse();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The current index within all of the written data.
|
|
176
|
+
*/
|
|
177
|
+
getIndex() {
|
|
178
|
+
return this.index;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* The start of the current section.
|
|
182
|
+
*/
|
|
183
|
+
getSectionStart() {
|
|
184
|
+
return this.sectionStart;
|
|
185
|
+
}
|
|
186
|
+
stateText(c) {
|
|
187
|
+
if (c === CharCodes.Lt || !this.decodeEntities && this.fastForwardTo(CharCodes.Lt)) {
|
|
188
|
+
if (this.index > this.sectionStart) {
|
|
189
|
+
this.cbs.ontext(this.sectionStart, this.index);
|
|
190
|
+
}
|
|
191
|
+
this.state = State.BeforeTagName;
|
|
192
|
+
this.sectionStart = this.index;
|
|
193
|
+
} else if (this.decodeEntities && c === CharCodes.Amp) {
|
|
194
|
+
this.state = State.BeforeEntity;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
stateSpecialStartSequence(c) {
|
|
198
|
+
const isEnd = this.sequenceIndex === this.currentSequence.length;
|
|
199
|
+
const isMatch = isEnd ?
|
|
200
|
+
// If we are at the end of the sequence, make sure the tag name has ended
|
|
201
|
+
isEndOfTagSection(c) :
|
|
202
|
+
// Otherwise, do a case-insensitive comparison
|
|
203
|
+
(c | 0x20) === this.currentSequence[this.sequenceIndex];
|
|
204
|
+
if (!isMatch) {
|
|
205
|
+
this.isSpecial = false;
|
|
206
|
+
} else if (!isEnd) {
|
|
207
|
+
this.sequenceIndex++;
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
this.sequenceIndex = 0;
|
|
211
|
+
this.state = State.InTagName;
|
|
212
|
+
this.stateInTagName(c);
|
|
213
|
+
}
|
|
214
|
+
/** Look for an end tag. For <title> tags, also decode entities. */
|
|
215
|
+
stateInSpecialTag(c) {
|
|
216
|
+
if (this.sequenceIndex === this.currentSequence.length) {
|
|
217
|
+
if (c === CharCodes.Gt || isWhitespace(c)) {
|
|
218
|
+
const endOfText = this.index - this.currentSequence.length;
|
|
219
|
+
if (this.sectionStart < endOfText) {
|
|
220
|
+
// Spoof the index so that reported locations match up.
|
|
221
|
+
const actualIndex = this.index;
|
|
222
|
+
this.index = endOfText;
|
|
223
|
+
this.cbs.ontext(this.sectionStart, endOfText);
|
|
224
|
+
this.index = actualIndex;
|
|
225
|
+
}
|
|
226
|
+
this.isSpecial = false;
|
|
227
|
+
this.sectionStart = endOfText + 2; // Skip over the `</`
|
|
228
|
+
this.stateInClosingTagName(c);
|
|
229
|
+
return; // We are done; skip the rest of the function.
|
|
230
|
+
}
|
|
231
|
+
this.sequenceIndex = 0;
|
|
232
|
+
}
|
|
233
|
+
if ((c | 0x20) === this.currentSequence[this.sequenceIndex]) {
|
|
234
|
+
this.sequenceIndex += 1;
|
|
235
|
+
} else if (this.sequenceIndex === 0) {
|
|
236
|
+
if (this.currentSequence === Sequences.TitleEnd) {
|
|
237
|
+
// We have to parse entities in <title> tags.
|
|
238
|
+
if (this.decodeEntities && c === CharCodes.Amp) {
|
|
239
|
+
this.state = State.BeforeEntity;
|
|
240
|
+
}
|
|
241
|
+
} else if (this.fastForwardTo(CharCodes.Lt)) {
|
|
242
|
+
// Outside of <title> tags, we can fast-forward.
|
|
243
|
+
this.sequenceIndex = 1;
|
|
244
|
+
}
|
|
245
|
+
} else {
|
|
246
|
+
// If we see a `<`, set the sequence index to 1; useful for eg. `<</script>`.
|
|
247
|
+
this.sequenceIndex = Number(c === CharCodes.Lt);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
stateCDATASequence(c) {
|
|
251
|
+
if (c === Sequences.Cdata[this.sequenceIndex]) {
|
|
252
|
+
if (++this.sequenceIndex === Sequences.Cdata.length) {
|
|
253
|
+
this.state = State.InCommentLike;
|
|
254
|
+
this.currentSequence = Sequences.CdataEnd;
|
|
255
|
+
this.sequenceIndex = 0;
|
|
256
|
+
this.sectionStart = this.index + 1;
|
|
257
|
+
}
|
|
258
|
+
} else {
|
|
259
|
+
this.sequenceIndex = 0;
|
|
260
|
+
this.state = State.InDeclaration;
|
|
261
|
+
this.stateInDeclaration(c); // Reconsume the character
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* When we wait for one specific character, we can speed things up
|
|
266
|
+
* by skipping through the buffer until we find it.
|
|
267
|
+
*
|
|
268
|
+
* @returns Whether the character was found.
|
|
269
|
+
*/
|
|
270
|
+
fastForwardTo(c) {
|
|
271
|
+
while (++this.index < this.buffer.length + this.offset) {
|
|
272
|
+
if (this.buffer.charCodeAt(this.index - this.offset) === c) {
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
/*
|
|
277
|
+
* We increment the index at the end of the `parse` loop,
|
|
278
|
+
* so set it to `buffer.length - 1` here.
|
|
279
|
+
*
|
|
280
|
+
* TODO: Refactor `parse` to increment index before calling states.
|
|
281
|
+
*/
|
|
282
|
+
this.index = this.buffer.length + this.offset - 1;
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Comments and CDATA end with `-->` and `]]>`.
|
|
287
|
+
*
|
|
288
|
+
* Their common qualities are:
|
|
289
|
+
* - Their end sequences have a distinct character they start with.
|
|
290
|
+
* - That character is then repeated, so we have to check multiple repeats.
|
|
291
|
+
* - All characters but the start character of the sequence can be skipped.
|
|
292
|
+
*/
|
|
293
|
+
stateInCommentLike(c) {
|
|
294
|
+
if (c === this.currentSequence[this.sequenceIndex]) {
|
|
295
|
+
if (++this.sequenceIndex === this.currentSequence.length) {
|
|
296
|
+
if (this.currentSequence === Sequences.CdataEnd) {
|
|
297
|
+
this.cbs.oncdata(this.sectionStart, this.index, 2);
|
|
298
|
+
} else {
|
|
299
|
+
this.cbs.oncomment(this.sectionStart, this.index, 2);
|
|
300
|
+
}
|
|
301
|
+
this.sequenceIndex = 0;
|
|
302
|
+
this.sectionStart = this.index + 1;
|
|
303
|
+
this.state = State.Text;
|
|
304
|
+
}
|
|
305
|
+
} else if (this.sequenceIndex === 0) {
|
|
306
|
+
// Fast-forward to the first character of the sequence
|
|
307
|
+
if (this.fastForwardTo(this.currentSequence[0])) {
|
|
308
|
+
this.sequenceIndex = 1;
|
|
309
|
+
}
|
|
310
|
+
} else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
|
|
311
|
+
// Allow long sequences, eg. --->, ]]]>
|
|
312
|
+
this.sequenceIndex = 0;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a tag name.
|
|
317
|
+
*
|
|
318
|
+
* XML allows a lot more characters here (@see https://www.w3.org/TR/REC-xml/#NT-NameStartChar).
|
|
319
|
+
* We allow anything that wouldn't end the tag.
|
|
320
|
+
*/
|
|
321
|
+
isTagStartChar(c) {
|
|
322
|
+
return this.xmlMode ? !isEndOfTagSection(c) : isASCIIAlpha(c);
|
|
323
|
+
}
|
|
324
|
+
startSpecial(sequence, offset) {
|
|
325
|
+
this.isSpecial = true;
|
|
326
|
+
this.currentSequence = sequence;
|
|
327
|
+
this.sequenceIndex = offset;
|
|
328
|
+
this.state = State.SpecialStartSequence;
|
|
329
|
+
}
|
|
330
|
+
stateBeforeTagName(c) {
|
|
331
|
+
if (c === CharCodes.ExclamationMark) {
|
|
332
|
+
this.state = State.BeforeDeclaration;
|
|
333
|
+
this.sectionStart = this.index + 1;
|
|
334
|
+
} else if (c === CharCodes.Questionmark) {
|
|
335
|
+
this.state = State.InProcessingInstruction;
|
|
336
|
+
this.sectionStart = this.index + 1;
|
|
337
|
+
} else if (this.isTagStartChar(c)) {
|
|
338
|
+
const lower = c | 0x20;
|
|
339
|
+
this.sectionStart = this.index;
|
|
340
|
+
if (!this.xmlMode && lower === Sequences.TitleEnd[2]) {
|
|
341
|
+
this.startSpecial(Sequences.TitleEnd, 3);
|
|
342
|
+
} else {
|
|
343
|
+
this.state = !this.xmlMode && lower === Sequences.ScriptEnd[2] ? State.BeforeSpecialS : State.InTagName;
|
|
344
|
+
}
|
|
345
|
+
} else if (c === CharCodes.Slash) {
|
|
346
|
+
this.state = State.BeforeClosingTagName;
|
|
347
|
+
} else {
|
|
348
|
+
this.state = State.Text;
|
|
349
|
+
this.stateText(c);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
stateInTagName(c) {
|
|
353
|
+
if (isEndOfTagSection(c)) {
|
|
354
|
+
this.cbs.onopentagname(this.sectionStart, this.index);
|
|
355
|
+
this.sectionStart = -1;
|
|
356
|
+
this.state = State.BeforeAttributeName;
|
|
357
|
+
this.stateBeforeAttributeName(c);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
stateBeforeClosingTagName(c) {
|
|
361
|
+
if (isWhitespace(c)) {
|
|
362
|
+
// Ignore
|
|
363
|
+
} else if (c === CharCodes.Gt) {
|
|
364
|
+
this.state = State.Text;
|
|
365
|
+
} else {
|
|
366
|
+
this.state = this.isTagStartChar(c) ? State.InClosingTagName : State.InSpecialComment;
|
|
367
|
+
this.sectionStart = this.index;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
stateInClosingTagName(c) {
|
|
371
|
+
if (c === CharCodes.Gt || isWhitespace(c)) {
|
|
372
|
+
this.cbs.onclosetag(this.sectionStart, this.index);
|
|
373
|
+
this.sectionStart = -1;
|
|
374
|
+
this.state = State.AfterClosingTagName;
|
|
375
|
+
this.stateAfterClosingTagName(c);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
stateAfterClosingTagName(c) {
|
|
379
|
+
// Skip everything until ">"
|
|
380
|
+
if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
|
|
381
|
+
this.state = State.Text;
|
|
382
|
+
this.baseState = State.Text;
|
|
383
|
+
this.sectionStart = this.index + 1;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
stateBeforeAttributeName(c) {
|
|
387
|
+
if (c === CharCodes.Gt) {
|
|
388
|
+
this.cbs.onopentagend(this.index);
|
|
389
|
+
if (this.isSpecial) {
|
|
390
|
+
this.state = State.InSpecialTag;
|
|
391
|
+
this.sequenceIndex = 0;
|
|
392
|
+
} else {
|
|
393
|
+
this.state = State.Text;
|
|
394
|
+
}
|
|
395
|
+
this.baseState = this.state;
|
|
396
|
+
this.sectionStart = this.index + 1;
|
|
397
|
+
} else if (c === CharCodes.Slash) {
|
|
398
|
+
this.state = State.InSelfClosingTag;
|
|
399
|
+
} else if (!isWhitespace(c)) {
|
|
400
|
+
this.state = State.InAttributeName;
|
|
401
|
+
this.sectionStart = this.index;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
stateInSelfClosingTag(c) {
|
|
405
|
+
if (c === CharCodes.Gt) {
|
|
406
|
+
this.cbs.onselfclosingtag(this.index);
|
|
407
|
+
this.state = State.Text;
|
|
408
|
+
this.baseState = State.Text;
|
|
409
|
+
this.sectionStart = this.index + 1;
|
|
410
|
+
this.isSpecial = false; // Reset special state, in case of self-closing special tags
|
|
411
|
+
} else if (!isWhitespace(c)) {
|
|
412
|
+
this.state = State.BeforeAttributeName;
|
|
413
|
+
this.stateBeforeAttributeName(c);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
stateInAttributeName(c) {
|
|
417
|
+
if (c === CharCodes.Eq || isEndOfTagSection(c)) {
|
|
418
|
+
this.cbs.onattribname(this.sectionStart, this.index);
|
|
419
|
+
this.sectionStart = -1;
|
|
420
|
+
this.state = State.AfterAttributeName;
|
|
421
|
+
this.stateAfterAttributeName(c);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
stateAfterAttributeName(c) {
|
|
425
|
+
if (c === CharCodes.Eq) {
|
|
426
|
+
this.state = State.BeforeAttributeValue;
|
|
427
|
+
} else if (c === CharCodes.Slash || c === CharCodes.Gt) {
|
|
428
|
+
this.cbs.onattribend(exports.QuoteType.NoValue, this.index);
|
|
429
|
+
this.state = State.BeforeAttributeName;
|
|
430
|
+
this.stateBeforeAttributeName(c);
|
|
431
|
+
} else if (!isWhitespace(c)) {
|
|
432
|
+
this.cbs.onattribend(exports.QuoteType.NoValue, this.index);
|
|
433
|
+
this.state = State.InAttributeName;
|
|
434
|
+
this.sectionStart = this.index;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
stateBeforeAttributeValue(c) {
|
|
438
|
+
if (c === CharCodes.DoubleQuote) {
|
|
439
|
+
this.state = State.InAttributeValueDq;
|
|
440
|
+
this.sectionStart = this.index + 1;
|
|
441
|
+
} else if (c === CharCodes.SingleQuote) {
|
|
442
|
+
this.state = State.InAttributeValueSq;
|
|
443
|
+
this.sectionStart = this.index + 1;
|
|
444
|
+
} else if (!isWhitespace(c)) {
|
|
445
|
+
this.sectionStart = this.index;
|
|
446
|
+
this.state = State.InAttributeValueNq;
|
|
447
|
+
this.stateInAttributeValueNoQuotes(c); // Reconsume token
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
handleInAttributeValue(c, quote) {
|
|
451
|
+
if (c === quote || !this.decodeEntities && this.fastForwardTo(quote)) {
|
|
452
|
+
this.cbs.onattribdata(this.sectionStart, this.index);
|
|
453
|
+
this.sectionStart = -1;
|
|
454
|
+
this.cbs.onattribend(quote === CharCodes.DoubleQuote ? exports.QuoteType.Double : exports.QuoteType.Single, this.index);
|
|
455
|
+
this.state = State.BeforeAttributeName;
|
|
456
|
+
} else if (this.decodeEntities && c === CharCodes.Amp) {
|
|
457
|
+
this.baseState = this.state;
|
|
458
|
+
this.state = State.BeforeEntity;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
stateInAttributeValueDoubleQuotes(c) {
|
|
462
|
+
this.handleInAttributeValue(c, CharCodes.DoubleQuote);
|
|
463
|
+
}
|
|
464
|
+
stateInAttributeValueSingleQuotes(c) {
|
|
465
|
+
this.handleInAttributeValue(c, CharCodes.SingleQuote);
|
|
466
|
+
}
|
|
467
|
+
stateInAttributeValueNoQuotes(c) {
|
|
468
|
+
if (isWhitespace(c) || c === CharCodes.Gt) {
|
|
469
|
+
this.cbs.onattribdata(this.sectionStart, this.index);
|
|
470
|
+
this.sectionStart = -1;
|
|
471
|
+
this.cbs.onattribend(exports.QuoteType.Unquoted, this.index);
|
|
472
|
+
this.state = State.BeforeAttributeName;
|
|
473
|
+
this.stateBeforeAttributeName(c);
|
|
474
|
+
} else if (this.decodeEntities && c === CharCodes.Amp) {
|
|
475
|
+
this.baseState = this.state;
|
|
476
|
+
this.state = State.BeforeEntity;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
stateBeforeDeclaration(c) {
|
|
480
|
+
if (c === CharCodes.OpeningSquareBracket) {
|
|
481
|
+
this.state = State.CDATASequence;
|
|
482
|
+
this.sequenceIndex = 0;
|
|
483
|
+
} else {
|
|
484
|
+
this.state = c === CharCodes.Dash ? State.BeforeComment : State.InDeclaration;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
stateInDeclaration(c) {
|
|
488
|
+
if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
|
|
489
|
+
this.cbs.ondeclaration(this.sectionStart, this.index);
|
|
490
|
+
this.state = State.Text;
|
|
491
|
+
this.sectionStart = this.index + 1;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
stateInProcessingInstruction(c) {
|
|
495
|
+
if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
|
|
496
|
+
this.cbs.onprocessinginstruction(this.sectionStart, this.index);
|
|
497
|
+
this.state = State.Text;
|
|
498
|
+
this.sectionStart = this.index + 1;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
stateBeforeComment(c) {
|
|
502
|
+
if (c === CharCodes.Dash) {
|
|
503
|
+
this.state = State.InCommentLike;
|
|
504
|
+
this.currentSequence = Sequences.CommentEnd;
|
|
505
|
+
// Allow short comments (eg. <!-->)
|
|
506
|
+
this.sequenceIndex = 2;
|
|
507
|
+
this.sectionStart = this.index + 1;
|
|
508
|
+
} else {
|
|
509
|
+
this.state = State.InDeclaration;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
stateInSpecialComment(c) {
|
|
513
|
+
if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
|
|
514
|
+
this.cbs.oncomment(this.sectionStart, this.index, 0);
|
|
515
|
+
this.state = State.Text;
|
|
516
|
+
this.sectionStart = this.index + 1;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
stateBeforeSpecialS(c) {
|
|
520
|
+
const lower = c | 0x20;
|
|
521
|
+
if (lower === Sequences.ScriptEnd[3]) {
|
|
522
|
+
this.startSpecial(Sequences.ScriptEnd, 4);
|
|
523
|
+
} else if (lower === Sequences.StyleEnd[3]) {
|
|
524
|
+
this.startSpecial(Sequences.StyleEnd, 4);
|
|
525
|
+
} else {
|
|
526
|
+
this.state = State.InTagName;
|
|
527
|
+
this.stateInTagName(c); // Consume the token again
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
stateBeforeEntity(c) {
|
|
531
|
+
// Start excess with 1 to include the '&'
|
|
532
|
+
this.entityExcess = 1;
|
|
533
|
+
this.entityResult = 0;
|
|
534
|
+
if (c === CharCodes.Number) {
|
|
535
|
+
this.state = State.BeforeNumericEntity;
|
|
536
|
+
} else if (c === CharCodes.Amp) {
|
|
537
|
+
// We have two `&` characters in a row. Stay in the current state.
|
|
538
|
+
} else {
|
|
539
|
+
this.trieIndex = 0;
|
|
540
|
+
this.trieCurrent = this.entityTrie[0];
|
|
541
|
+
this.state = State.InNamedEntity;
|
|
542
|
+
this.stateInNamedEntity(c);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
stateInNamedEntity(c) {
|
|
546
|
+
this.entityExcess += 1;
|
|
547
|
+
this.trieIndex = decode.determineBranch(this.entityTrie, this.trieCurrent, this.trieIndex + 1, c);
|
|
548
|
+
if (this.trieIndex < 0) {
|
|
549
|
+
this.emitNamedEntity();
|
|
550
|
+
this.index--;
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
this.trieCurrent = this.entityTrie[this.trieIndex];
|
|
554
|
+
const masked = this.trieCurrent & decode.BinTrieFlags.VALUE_LENGTH;
|
|
555
|
+
// If the branch is a value, store it and continue
|
|
556
|
+
if (masked) {
|
|
557
|
+
// The mask is the number of bytes of the value, including the current byte.
|
|
558
|
+
const valueLength = (masked >> 14) - 1;
|
|
559
|
+
// If we have a legacy entity while parsing strictly, just skip the number of bytes
|
|
560
|
+
if (!this.allowLegacyEntity() && c !== CharCodes.Semi) {
|
|
561
|
+
this.trieIndex += valueLength;
|
|
562
|
+
} else {
|
|
563
|
+
// Add 1 as we have already incremented the excess
|
|
564
|
+
const entityStart = this.index - this.entityExcess + 1;
|
|
565
|
+
if (entityStart > this.sectionStart) {
|
|
566
|
+
this.emitPartial(this.sectionStart, entityStart);
|
|
567
|
+
}
|
|
568
|
+
// If this is a surrogate pair, consume the next two bytes
|
|
569
|
+
this.entityResult = this.trieIndex;
|
|
570
|
+
this.trieIndex += valueLength;
|
|
571
|
+
this.entityExcess = 0;
|
|
572
|
+
this.sectionStart = this.index + 1;
|
|
573
|
+
if (valueLength === 0) {
|
|
574
|
+
this.emitNamedEntity();
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
emitNamedEntity() {
|
|
580
|
+
this.state = this.baseState;
|
|
581
|
+
if (this.entityResult === 0) {
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
const valueLength = (this.entityTrie[this.entityResult] & decode.BinTrieFlags.VALUE_LENGTH) >> 14;
|
|
585
|
+
switch (valueLength) {
|
|
586
|
+
case 1:
|
|
587
|
+
{
|
|
588
|
+
this.emitCodePoint(this.entityTrie[this.entityResult] & ~decode.BinTrieFlags.VALUE_LENGTH);
|
|
589
|
+
break;
|
|
590
|
+
}
|
|
591
|
+
case 2:
|
|
592
|
+
{
|
|
593
|
+
this.emitCodePoint(this.entityTrie[this.entityResult + 1]);
|
|
594
|
+
break;
|
|
595
|
+
}
|
|
596
|
+
case 3:
|
|
597
|
+
{
|
|
598
|
+
this.emitCodePoint(this.entityTrie[this.entityResult + 1]);
|
|
599
|
+
this.emitCodePoint(this.entityTrie[this.entityResult + 2]);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
stateBeforeNumericEntity(c) {
|
|
604
|
+
if ((c | 0x20) === CharCodes.LowerX) {
|
|
605
|
+
this.entityExcess++;
|
|
606
|
+
this.state = State.InHexEntity;
|
|
607
|
+
} else {
|
|
608
|
+
this.state = State.InNumericEntity;
|
|
609
|
+
this.stateInNumericEntity(c);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
emitNumericEntity(strict) {
|
|
613
|
+
const entityStart = this.index - this.entityExcess - 1;
|
|
614
|
+
const numberStart = entityStart + 2 + Number(this.state === State.InHexEntity);
|
|
615
|
+
if (numberStart !== this.index) {
|
|
616
|
+
// Emit leading data if any
|
|
617
|
+
if (entityStart > this.sectionStart) {
|
|
618
|
+
this.emitPartial(this.sectionStart, entityStart);
|
|
619
|
+
}
|
|
620
|
+
this.sectionStart = this.index + Number(strict);
|
|
621
|
+
this.emitCodePoint(decode_codepoint.replaceCodePoint(this.entityResult));
|
|
622
|
+
}
|
|
623
|
+
this.state = this.baseState;
|
|
624
|
+
}
|
|
625
|
+
stateInNumericEntity(c) {
|
|
626
|
+
if (c === CharCodes.Semi) {
|
|
627
|
+
this.emitNumericEntity(true);
|
|
628
|
+
} else if (isNumber(c)) {
|
|
629
|
+
this.entityResult = this.entityResult * 10 + (c - CharCodes.Zero);
|
|
630
|
+
this.entityExcess++;
|
|
631
|
+
} else {
|
|
632
|
+
if (this.allowLegacyEntity()) {
|
|
633
|
+
this.emitNumericEntity(false);
|
|
634
|
+
} else {
|
|
635
|
+
this.state = this.baseState;
|
|
636
|
+
}
|
|
637
|
+
this.index--;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
stateInHexEntity(c) {
|
|
641
|
+
if (c === CharCodes.Semi) {
|
|
642
|
+
this.emitNumericEntity(true);
|
|
643
|
+
} else if (isNumber(c)) {
|
|
644
|
+
this.entityResult = this.entityResult * 16 + (c - CharCodes.Zero);
|
|
645
|
+
this.entityExcess++;
|
|
646
|
+
} else if (isHexDigit(c)) {
|
|
647
|
+
this.entityResult = this.entityResult * 16 + ((c | 0x20) - CharCodes.LowerA + 10);
|
|
648
|
+
this.entityExcess++;
|
|
649
|
+
} else {
|
|
650
|
+
if (this.allowLegacyEntity()) {
|
|
651
|
+
this.emitNumericEntity(false);
|
|
652
|
+
} else {
|
|
653
|
+
this.state = this.baseState;
|
|
654
|
+
}
|
|
655
|
+
this.index--;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
allowLegacyEntity() {
|
|
659
|
+
return !this.xmlMode && (this.baseState === State.Text || this.baseState === State.InSpecialTag);
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* Remove data that has already been consumed from the buffer.
|
|
663
|
+
*/
|
|
664
|
+
cleanup() {
|
|
665
|
+
// If we are inside of text or attributes, emit what we already have.
|
|
666
|
+
if (this.running && this.sectionStart !== this.index) {
|
|
667
|
+
if (this.state === State.Text || this.state === State.InSpecialTag && this.sequenceIndex === 0) {
|
|
668
|
+
this.cbs.ontext(this.sectionStart, this.index);
|
|
669
|
+
this.sectionStart = this.index;
|
|
670
|
+
} else if (this.state === State.InAttributeValueDq || this.state === State.InAttributeValueSq || this.state === State.InAttributeValueNq) {
|
|
671
|
+
this.cbs.onattribdata(this.sectionStart, this.index);
|
|
672
|
+
this.sectionStart = this.index;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
shouldContinue() {
|
|
677
|
+
return this.index < this.buffer.length + this.offset && this.running;
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Iterates through the buffer, calling the function corresponding to the current state.
|
|
681
|
+
*
|
|
682
|
+
* States that are more likely to be hit are higher up, as a performance improvement.
|
|
683
|
+
*/
|
|
684
|
+
parse() {
|
|
685
|
+
while (this.shouldContinue()) {
|
|
686
|
+
const c = this.buffer.charCodeAt(this.index - this.offset);
|
|
687
|
+
switch (this.state) {
|
|
688
|
+
case State.Text:
|
|
689
|
+
{
|
|
690
|
+
this.stateText(c);
|
|
691
|
+
break;
|
|
692
|
+
}
|
|
693
|
+
case State.SpecialStartSequence:
|
|
694
|
+
{
|
|
695
|
+
this.stateSpecialStartSequence(c);
|
|
696
|
+
break;
|
|
697
|
+
}
|
|
698
|
+
case State.InSpecialTag:
|
|
699
|
+
{
|
|
700
|
+
this.stateInSpecialTag(c);
|
|
701
|
+
break;
|
|
702
|
+
}
|
|
703
|
+
case State.CDATASequence:
|
|
704
|
+
{
|
|
705
|
+
this.stateCDATASequence(c);
|
|
706
|
+
break;
|
|
707
|
+
}
|
|
708
|
+
case State.InAttributeValueDq:
|
|
709
|
+
{
|
|
710
|
+
this.stateInAttributeValueDoubleQuotes(c);
|
|
711
|
+
break;
|
|
712
|
+
}
|
|
713
|
+
case State.InAttributeName:
|
|
714
|
+
{
|
|
715
|
+
this.stateInAttributeName(c);
|
|
716
|
+
break;
|
|
717
|
+
}
|
|
718
|
+
case State.InCommentLike:
|
|
719
|
+
{
|
|
720
|
+
this.stateInCommentLike(c);
|
|
721
|
+
break;
|
|
722
|
+
}
|
|
723
|
+
case State.InSpecialComment:
|
|
724
|
+
{
|
|
725
|
+
this.stateInSpecialComment(c);
|
|
726
|
+
break;
|
|
727
|
+
}
|
|
728
|
+
case State.BeforeAttributeName:
|
|
729
|
+
{
|
|
730
|
+
this.stateBeforeAttributeName(c);
|
|
731
|
+
break;
|
|
732
|
+
}
|
|
733
|
+
case State.InTagName:
|
|
734
|
+
{
|
|
735
|
+
this.stateInTagName(c);
|
|
736
|
+
break;
|
|
737
|
+
}
|
|
738
|
+
case State.InClosingTagName:
|
|
739
|
+
{
|
|
740
|
+
this.stateInClosingTagName(c);
|
|
741
|
+
break;
|
|
742
|
+
}
|
|
743
|
+
case State.BeforeTagName:
|
|
744
|
+
{
|
|
745
|
+
this.stateBeforeTagName(c);
|
|
746
|
+
break;
|
|
747
|
+
}
|
|
748
|
+
case State.AfterAttributeName:
|
|
749
|
+
{
|
|
750
|
+
this.stateAfterAttributeName(c);
|
|
751
|
+
break;
|
|
752
|
+
}
|
|
753
|
+
case State.InAttributeValueSq:
|
|
754
|
+
{
|
|
755
|
+
this.stateInAttributeValueSingleQuotes(c);
|
|
756
|
+
break;
|
|
757
|
+
}
|
|
758
|
+
case State.BeforeAttributeValue:
|
|
759
|
+
{
|
|
760
|
+
this.stateBeforeAttributeValue(c);
|
|
761
|
+
break;
|
|
762
|
+
}
|
|
763
|
+
case State.BeforeClosingTagName:
|
|
764
|
+
{
|
|
765
|
+
this.stateBeforeClosingTagName(c);
|
|
766
|
+
break;
|
|
767
|
+
}
|
|
768
|
+
case State.AfterClosingTagName:
|
|
769
|
+
{
|
|
770
|
+
this.stateAfterClosingTagName(c);
|
|
771
|
+
break;
|
|
772
|
+
}
|
|
773
|
+
case State.BeforeSpecialS:
|
|
774
|
+
{
|
|
775
|
+
this.stateBeforeSpecialS(c);
|
|
776
|
+
break;
|
|
777
|
+
}
|
|
778
|
+
case State.InAttributeValueNq:
|
|
779
|
+
{
|
|
780
|
+
this.stateInAttributeValueNoQuotes(c);
|
|
781
|
+
break;
|
|
782
|
+
}
|
|
783
|
+
case State.InSelfClosingTag:
|
|
784
|
+
{
|
|
785
|
+
this.stateInSelfClosingTag(c);
|
|
786
|
+
break;
|
|
787
|
+
}
|
|
788
|
+
case State.InDeclaration:
|
|
789
|
+
{
|
|
790
|
+
this.stateInDeclaration(c);
|
|
791
|
+
break;
|
|
792
|
+
}
|
|
793
|
+
case State.BeforeDeclaration:
|
|
794
|
+
{
|
|
795
|
+
this.stateBeforeDeclaration(c);
|
|
796
|
+
break;
|
|
797
|
+
}
|
|
798
|
+
case State.BeforeComment:
|
|
799
|
+
{
|
|
800
|
+
this.stateBeforeComment(c);
|
|
801
|
+
break;
|
|
802
|
+
}
|
|
803
|
+
case State.InProcessingInstruction:
|
|
804
|
+
{
|
|
805
|
+
this.stateInProcessingInstruction(c);
|
|
806
|
+
break;
|
|
807
|
+
}
|
|
808
|
+
case State.InNamedEntity:
|
|
809
|
+
{
|
|
810
|
+
this.stateInNamedEntity(c);
|
|
811
|
+
break;
|
|
812
|
+
}
|
|
813
|
+
case State.BeforeEntity:
|
|
814
|
+
{
|
|
815
|
+
this.stateBeforeEntity(c);
|
|
816
|
+
break;
|
|
817
|
+
}
|
|
818
|
+
case State.InHexEntity:
|
|
819
|
+
{
|
|
820
|
+
this.stateInHexEntity(c);
|
|
821
|
+
break;
|
|
822
|
+
}
|
|
823
|
+
case State.InNumericEntity:
|
|
824
|
+
{
|
|
825
|
+
this.stateInNumericEntity(c);
|
|
826
|
+
break;
|
|
827
|
+
}
|
|
828
|
+
default:
|
|
829
|
+
{
|
|
830
|
+
// `this._state === State.BeforeNumericEntity`
|
|
831
|
+
this.stateBeforeNumericEntity(c);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
this.index++;
|
|
835
|
+
}
|
|
836
|
+
this.cleanup();
|
|
837
|
+
}
|
|
838
|
+
finish() {
|
|
839
|
+
if (this.state === State.InNamedEntity) {
|
|
840
|
+
this.emitNamedEntity();
|
|
841
|
+
}
|
|
842
|
+
// If there is remaining data, emit it in a reasonable way
|
|
843
|
+
if (this.sectionStart < this.index) {
|
|
844
|
+
this.handleTrailingData();
|
|
845
|
+
}
|
|
846
|
+
this.cbs.onend();
|
|
847
|
+
}
|
|
848
|
+
/** Handle any trailing data. */
|
|
849
|
+
handleTrailingData() {
|
|
850
|
+
const endIndex = this.buffer.length + this.offset;
|
|
851
|
+
if (this.state === State.InCommentLike) {
|
|
852
|
+
if (this.currentSequence === Sequences.CdataEnd) {
|
|
853
|
+
this.cbs.oncdata(this.sectionStart, endIndex, 0);
|
|
854
|
+
} else {
|
|
855
|
+
this.cbs.oncomment(this.sectionStart, endIndex, 0);
|
|
856
|
+
}
|
|
857
|
+
} else if (this.state === State.InNumericEntity && this.allowLegacyEntity()) {
|
|
858
|
+
this.emitNumericEntity(false);
|
|
859
|
+
// All trailing data will have been consumed
|
|
860
|
+
} else if (this.state === State.InHexEntity && this.allowLegacyEntity()) {
|
|
861
|
+
this.emitNumericEntity(false);
|
|
862
|
+
// All trailing data will have been consumed
|
|
863
|
+
} else if (this.state === State.InTagName || this.state === State.BeforeAttributeName || this.state === State.BeforeAttributeValue || this.state === State.AfterAttributeName || this.state === State.InAttributeName || this.state === State.InAttributeValueSq || this.state === State.InAttributeValueDq || this.state === State.InAttributeValueNq || this.state === State.InClosingTagName) {
|
|
864
|
+
/*
|
|
865
|
+
* If we are currently in an opening or closing tag, us not calling the
|
|
866
|
+
* respective callback signals that the tag should be ignored.
|
|
867
|
+
*/
|
|
868
|
+
} else {
|
|
869
|
+
this.cbs.ontext(this.sectionStart, endIndex);
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
emitPartial(start, endIndex) {
|
|
873
|
+
if (this.baseState !== State.Text && this.baseState !== State.InSpecialTag) {
|
|
874
|
+
this.cbs.onattribdata(start, endIndex);
|
|
875
|
+
} else {
|
|
876
|
+
this.cbs.ontext(start, endIndex);
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
emitCodePoint(cp) {
|
|
880
|
+
if (this.baseState !== State.Text && this.baseState !== State.InSpecialTag) {
|
|
881
|
+
this.cbs.onattribentity(cp);
|
|
882
|
+
} else {
|
|
883
|
+
this.cbs.ontextentity(cp);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
exports.default = Tokenizer;
|
|
888
|
+
//# sourceMappingURL=Tokenizer.js.map
|