@depup/typedoc 0.28.17-depup.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/LICENSE +201 -0
- package/README.md +34 -0
- package/bin/package.json +3 -0
- package/bin/typedoc +24 -0
- package/changes.json +22 -0
- package/dist/browser-locales/de.d.ts +2 -0
- package/dist/browser-locales/de.js +62 -0
- package/dist/browser-locales/en.d.ts +2 -0
- package/dist/browser-locales/en.js +62 -0
- package/dist/browser-locales/ja.d.ts +2 -0
- package/dist/browser-locales/ja.js +62 -0
- package/dist/browser-locales/ko.d.ts +2 -0
- package/dist/browser-locales/ko.js +62 -0
- package/dist/browser-locales/zh.d.ts +2 -0
- package/dist/browser-locales/zh.js +62 -0
- package/dist/browser-utils.d.ts +3 -0
- package/dist/browser-utils.js +3 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.js +46 -0
- package/dist/lib/application-events.d.ts +5 -0
- package/dist/lib/application-events.js +5 -0
- package/dist/lib/application.d.ts +195 -0
- package/dist/lib/application.js +715 -0
- package/dist/lib/cli.d.ts +1 -0
- package/dist/lib/cli.js +111 -0
- package/dist/lib/converter/comments/blockLexer.d.ts +4 -0
- package/dist/lib/converter/comments/blockLexer.js +391 -0
- package/dist/lib/converter/comments/declarationReferenceResolver.d.ts +3 -0
- package/dist/lib/converter/comments/declarationReferenceResolver.js +218 -0
- package/dist/lib/converter/comments/discovery.d.ts +14 -0
- package/dist/lib/converter/comments/discovery.js +563 -0
- package/dist/lib/converter/comments/index.d.ts +37 -0
- package/dist/lib/converter/comments/index.js +241 -0
- package/dist/lib/converter/comments/lexer.d.ts +17 -0
- package/dist/lib/converter/comments/lexer.js +10 -0
- package/dist/lib/converter/comments/lineLexer.d.ts +3 -0
- package/dist/lib/converter/comments/lineLexer.js +279 -0
- package/dist/lib/converter/comments/linkResolver.d.ts +20 -0
- package/dist/lib/converter/comments/linkResolver.js +186 -0
- package/dist/lib/converter/comments/parser.d.ts +18 -0
- package/dist/lib/converter/comments/parser.js +538 -0
- package/dist/lib/converter/comments/rawLexer.d.ts +8 -0
- package/dist/lib/converter/comments/rawLexer.js +218 -0
- package/dist/lib/converter/comments/tagName.d.ts +8 -0
- package/dist/lib/converter/comments/tagName.js +58 -0
- package/dist/lib/converter/comments/textParser.d.ts +33 -0
- package/dist/lib/converter/comments/textParser.js +372 -0
- package/dist/lib/converter/components.d.ts +4 -0
- package/dist/lib/converter/components.js +3 -0
- package/dist/lib/converter/context.d.ts +101 -0
- package/dist/lib/converter/context.js +311 -0
- package/dist/lib/converter/convert-expression.d.ts +9 -0
- package/dist/lib/converter/convert-expression.js +58 -0
- package/dist/lib/converter/converter-events.d.ts +13 -0
- package/dist/lib/converter/converter-events.js +13 -0
- package/dist/lib/converter/converter.d.ts +238 -0
- package/dist/lib/converter/converter.js +705 -0
- package/dist/lib/converter/factories/index-signature.d.ts +3 -0
- package/dist/lib/converter/factories/index-signature.js +50 -0
- package/dist/lib/converter/factories/signature.d.ts +14 -0
- package/dist/lib/converter/factories/signature.js +353 -0
- package/dist/lib/converter/factories/symbol-id.d.ts +3 -0
- package/dist/lib/converter/factories/symbol-id.js +47 -0
- package/dist/lib/converter/index.d.ts +5 -0
- package/dist/lib/converter/index.js +3 -0
- package/dist/lib/converter/jsdoc.d.ts +4 -0
- package/dist/lib/converter/jsdoc.js +135 -0
- package/dist/lib/converter/plugins/CategoryPlugin.d.ts +48 -0
- package/dist/lib/converter/plugins/CategoryPlugin.js +278 -0
- package/dist/lib/converter/plugins/CommentPlugin.d.ts +128 -0
- package/dist/lib/converter/plugins/CommentPlugin.js +770 -0
- package/dist/lib/converter/plugins/GroupPlugin.d.ts +48 -0
- package/dist/lib/converter/plugins/GroupPlugin.js +281 -0
- package/dist/lib/converter/plugins/ImplementsPlugin.d.ts +42 -0
- package/dist/lib/converter/plugins/ImplementsPlugin.js +438 -0
- package/dist/lib/converter/plugins/IncludePlugin.d.ts +14 -0
- package/dist/lib/converter/plugins/IncludePlugin.js +254 -0
- package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +32 -0
- package/dist/lib/converter/plugins/InheritDocPlugin.js +220 -0
- package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +13 -0
- package/dist/lib/converter/plugins/LinkResolverPlugin.js +88 -0
- package/dist/lib/converter/plugins/MergeModuleWithPlugin.d.ts +12 -0
- package/dist/lib/converter/plugins/MergeModuleWithPlugin.js +50 -0
- package/dist/lib/converter/plugins/PackagePlugin.d.ts +31 -0
- package/dist/lib/converter/plugins/PackagePlugin.js +188 -0
- package/dist/lib/converter/plugins/SourcePlugin.d.ts +36 -0
- package/dist/lib/converter/plugins/SourcePlugin.js +215 -0
- package/dist/lib/converter/plugins/TypePlugin.d.ts +16 -0
- package/dist/lib/converter/plugins/TypePlugin.js +108 -0
- package/dist/lib/converter/plugins/index.d.ts +10 -0
- package/dist/lib/converter/plugins/index.js +10 -0
- package/dist/lib/converter/symbols.d.ts +3 -0
- package/dist/lib/converter/symbols.js +861 -0
- package/dist/lib/converter/types.d.ts +10 -0
- package/dist/lib/converter/types.js +833 -0
- package/dist/lib/converter/utils/nodes.d.ts +7 -0
- package/dist/lib/converter/utils/nodes.js +26 -0
- package/dist/lib/converter/utils/reflections.d.ts +2 -0
- package/dist/lib/converter/utils/reflections.js +17 -0
- package/dist/lib/converter/utils/repository.d.ts +96 -0
- package/dist/lib/converter/utils/repository.js +295 -0
- package/dist/lib/converter/utils/symbols.d.ts +2 -0
- package/dist/lib/converter/utils/symbols.js +12 -0
- package/dist/lib/debug/index.d.ts +2 -0
- package/dist/lib/debug/index.js +2 -0
- package/dist/lib/debug/reflectionLifetimes.d.ts +3 -0
- package/dist/lib/debug/reflectionLifetimes.js +27 -0
- package/dist/lib/debug/rendererUrls.d.ts +6 -0
- package/dist/lib/debug/rendererUrls.js +68 -0
- package/dist/lib/internationalization/index.d.ts +7 -0
- package/dist/lib/internationalization/index.js +7 -0
- package/dist/lib/internationalization/internationalization.d.ts +65 -0
- package/dist/lib/internationalization/internationalization.js +64 -0
- package/dist/lib/internationalization/locale-utils.cjs +8 -0
- package/dist/lib/internationalization/locale-utils.d.cts +8 -0
- package/dist/lib/internationalization/locales/de.cjs +401 -0
- package/dist/lib/internationalization/locales/de.d.cts +368 -0
- package/dist/lib/internationalization/locales/en.cjs +411 -0
- package/dist/lib/internationalization/locales/en.d.cts +380 -0
- package/dist/lib/internationalization/locales/ja.cjs +320 -0
- package/dist/lib/internationalization/locales/ja.d.cts +307 -0
- package/dist/lib/internationalization/locales/ko.cjs +233 -0
- package/dist/lib/internationalization/locales/ko.d.cts +221 -0
- package/dist/lib/internationalization/locales/zh.cjs +488 -0
- package/dist/lib/internationalization/locales/zh.d.cts +452 -0
- package/dist/lib/internationalization/translatable.d.ts +21 -0
- package/dist/lib/internationalization/translatable.js +8 -0
- package/dist/lib/models/Comment.d.ts +241 -0
- package/dist/lib/models/Comment.js +534 -0
- package/dist/lib/models/ContainerReflection.d.ts +56 -0
- package/dist/lib/models/ContainerReflection.js +159 -0
- package/dist/lib/models/DeclarationReflection.d.ts +149 -0
- package/dist/lib/models/DeclarationReflection.js +287 -0
- package/dist/lib/models/DocumentReflection.d.ts +32 -0
- package/dist/lib/models/DocumentReflection.js +66 -0
- package/dist/lib/models/FileRegistry.d.ts +46 -0
- package/dist/lib/models/FileRegistry.js +133 -0
- package/dist/lib/models/ParameterReflection.d.ts +21 -0
- package/dist/lib/models/ParameterReflection.js +39 -0
- package/dist/lib/models/ProjectReflection.d.ts +112 -0
- package/dist/lib/models/ProjectReflection.js +417 -0
- package/dist/lib/models/ReferenceReflection.d.ts +49 -0
- package/dist/lib/models/ReferenceReflection.js +85 -0
- package/dist/lib/models/Reflection.d.ts +229 -0
- package/dist/lib/models/Reflection.js +495 -0
- package/dist/lib/models/ReflectionCategory.d.ts +31 -0
- package/dist/lib/models/ReflectionCategory.js +56 -0
- package/dist/lib/models/ReflectionGroup.d.ts +38 -0
- package/dist/lib/models/ReflectionGroup.js +72 -0
- package/dist/lib/models/ReflectionSymbolId.d.ts +63 -0
- package/dist/lib/models/ReflectionSymbolId.js +85 -0
- package/dist/lib/models/SignatureReflection.d.ts +50 -0
- package/dist/lib/models/SignatureReflection.js +96 -0
- package/dist/lib/models/SourceReference.d.ts +33 -0
- package/dist/lib/models/SourceReference.js +50 -0
- package/dist/lib/models/TypeParameterReflection.d.ts +30 -0
- package/dist/lib/models/TypeParameterReflection.js +45 -0
- package/dist/lib/models/index.d.ts +19 -0
- package/dist/lib/models/index.js +19 -0
- package/dist/lib/models/kind.d.ts +84 -0
- package/dist/lib/models/kind.js +231 -0
- package/dist/lib/models/types.d.ts +553 -0
- package/dist/lib/models/types.js +1296 -0
- package/dist/lib/models/utils.d.ts +1 -0
- package/dist/lib/models/utils.js +26 -0
- package/dist/lib/models/variant.d.ts +21 -0
- package/dist/lib/models/variant.js +1 -0
- package/dist/lib/output/components.d.ts +53 -0
- package/dist/lib/output/components.js +133 -0
- package/dist/lib/output/events.d.ts +175 -0
- package/dist/lib/output/events.js +195 -0
- package/dist/lib/output/formatter.d.ts +88 -0
- package/dist/lib/output/formatter.js +660 -0
- package/dist/lib/output/index.d.ts +9 -0
- package/dist/lib/output/index.js +7 -0
- package/dist/lib/output/output.d.ts +14 -0
- package/dist/lib/output/output.js +92 -0
- package/dist/lib/output/plugins/AssetsPlugin.d.ts +20 -0
- package/dist/lib/output/plugins/AssetsPlugin.js +160 -0
- package/dist/lib/output/plugins/HierarchyPlugin.d.ts +7 -0
- package/dist/lib/output/plugins/HierarchyPlugin.js +65 -0
- package/dist/lib/output/plugins/IconsPlugin.d.ts +12 -0
- package/dist/lib/output/plugins/IconsPlugin.js +54 -0
- package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +22 -0
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +222 -0
- package/dist/lib/output/plugins/NavigationPlugin.d.ts +7 -0
- package/dist/lib/output/plugins/NavigationPlugin.js +23 -0
- package/dist/lib/output/plugins/SitemapPlugin.d.ts +8 -0
- package/dist/lib/output/plugins/SitemapPlugin.js +82 -0
- package/dist/lib/output/plugins/index.d.ts +7 -0
- package/dist/lib/output/plugins/index.js +7 -0
- package/dist/lib/output/renderer.d.ts +227 -0
- package/dist/lib/output/renderer.js +387 -0
- package/dist/lib/output/router.d.ts +187 -0
- package/dist/lib/output/router.js +520 -0
- package/dist/lib/output/theme.d.ts +22 -0
- package/dist/lib/output/theme.js +17 -0
- package/dist/lib/output/themes/MarkedPlugin.d.ts +62 -0
- package/dist/lib/output/themes/MarkedPlugin.js +461 -0
- package/dist/lib/output/themes/default/DefaultTheme.d.ts +72 -0
- package/dist/lib/output/themes/default/DefaultTheme.js +367 -0
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +105 -0
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +151 -0
- package/dist/lib/output/themes/default/Slugger.d.ts +13 -0
- package/dist/lib/output/themes/default/Slugger.js +60 -0
- package/dist/lib/output/themes/default/layouts/default.d.ts +6 -0
- package/dist/lib/output/themes/default/layouts/default.js +89 -0
- package/dist/lib/output/themes/default/partials/anchor-icon.d.ts +5 -0
- package/dist/lib/output/themes/default/partials/anchor-icon.js +9 -0
- package/dist/lib/output/themes/default/partials/breadcrumb.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/breadcrumb.js +11 -0
- package/dist/lib/output/themes/default/partials/comment.d.ts +8 -0
- package/dist/lib/output/themes/default/partials/comment.js +80 -0
- package/dist/lib/output/themes/default/partials/footer.d.ts +3 -0
- package/dist/lib/output/themes/default/partials/footer.js +37 -0
- package/dist/lib/output/themes/default/partials/header.d.ts +5 -0
- package/dist/lib/output/themes/default/partials/header.js +39 -0
- package/dist/lib/output/themes/default/partials/hierarchy.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/hierarchy.js +32 -0
- package/dist/lib/output/themes/default/partials/icon.d.ts +20 -0
- package/dist/lib/output/themes/default/partials/icon.js +101 -0
- package/dist/lib/output/themes/default/partials/index.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/index.js +24 -0
- package/dist/lib/output/themes/default/partials/member.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/member.declaration.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/member.declaration.js +35 -0
- package/dist/lib/output/themes/default/partials/member.getterSetter.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/member.getterSetter.js +12 -0
- package/dist/lib/output/themes/default/partials/member.js +36 -0
- package/dist/lib/output/themes/default/partials/member.signature.body.d.ts +6 -0
- package/dist/lib/output/themes/default/partials/member.signature.body.js +33 -0
- package/dist/lib/output/themes/default/partials/member.signature.title.d.ts +5 -0
- package/dist/lib/output/themes/default/partials/member.signature.title.js +9 -0
- package/dist/lib/output/themes/default/partials/member.signatures.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/member.signatures.js +9 -0
- package/dist/lib/output/themes/default/partials/member.sources.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/member.sources.js +55 -0
- package/dist/lib/output/themes/default/partials/members.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/members.js +17 -0
- package/dist/lib/output/themes/default/partials/moduleReflection.d.ts +5 -0
- package/dist/lib/output/themes/default/partials/moduleReflection.js +68 -0
- package/dist/lib/output/themes/default/partials/navigation.d.ts +10 -0
- package/dist/lib/output/themes/default/partials/navigation.js +144 -0
- package/dist/lib/output/themes/default/partials/reflectionPreview.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/reflectionPreview.js +26 -0
- package/dist/lib/output/themes/default/partials/toolbar.d.ts +5 -0
- package/dist/lib/output/themes/default/partials/toolbar.js +13 -0
- package/dist/lib/output/themes/default/partials/type.d.ts +5 -0
- package/dist/lib/output/themes/default/partials/type.js +9 -0
- package/dist/lib/output/themes/default/partials/typeAndParent.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/typeAndParent.js +28 -0
- package/dist/lib/output/themes/default/partials/typeDetails.d.ts +8 -0
- package/dist/lib/output/themes/default/partials/typeDetails.js +284 -0
- package/dist/lib/output/themes/default/partials/typeParameters.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/typeParameters.js +26 -0
- package/dist/lib/output/themes/default/templates/document.d.ts +5 -0
- package/dist/lib/output/themes/default/templates/document.js +3 -0
- package/dist/lib/output/themes/default/templates/hierarchy.d.ts +5 -0
- package/dist/lib/output/themes/default/templates/hierarchy.js +31 -0
- package/dist/lib/output/themes/default/templates/index.d.ts +5 -0
- package/dist/lib/output/themes/default/templates/index.js +3 -0
- package/dist/lib/output/themes/default/templates/reflection.d.ts +5 -0
- package/dist/lib/output/themes/default/templates/reflection.js +53 -0
- package/dist/lib/output/themes/lib.d.ts +44 -0
- package/dist/lib/output/themes/lib.js +218 -0
- package/dist/lib/serialization/components.d.ts +22 -0
- package/dist/lib/serialization/components.js +1 -0
- package/dist/lib/serialization/deserializer.d.ts +70 -0
- package/dist/lib/serialization/deserializer.js +235 -0
- package/dist/lib/serialization/events.d.ts +17 -0
- package/dist/lib/serialization/events.js +18 -0
- package/dist/lib/serialization/index.d.ts +5 -0
- package/dist/lib/serialization/index.js +4 -0
- package/dist/lib/serialization/schema.d.ts +283 -0
- package/dist/lib/serialization/schema.js +32 -0
- package/dist/lib/serialization/serializer.d.ts +52 -0
- package/dist/lib/serialization/serializer.js +65 -0
- package/dist/lib/utils/ValidatingFileRegistry.d.ts +12 -0
- package/dist/lib/utils/ValidatingFileRegistry.js +52 -0
- package/dist/lib/utils/component.d.ts +38 -0
- package/dist/lib/utils/component.js +41 -0
- package/dist/lib/utils/compress.d.ts +7 -0
- package/dist/lib/utils/compress.js +13 -0
- package/dist/lib/utils/declaration-maps.d.ts +3 -0
- package/dist/lib/utils/declaration-maps.js +51 -0
- package/dist/lib/utils/entry-point.d.ts +50 -0
- package/dist/lib/utils/entry-point.js +330 -0
- package/dist/lib/utils/fs.d.ts +65 -0
- package/dist/lib/utils/fs.js +372 -0
- package/dist/lib/utils/general.d.ts +4 -0
- package/dist/lib/utils/general.js +25 -0
- package/dist/lib/utils/highlighter.d.ts +9 -0
- package/dist/lib/utils/highlighter.js +150 -0
- package/dist/lib/utils/html-entities.d.ts +8926 -0
- package/dist/lib/utils/html-entities.js +2329 -0
- package/dist/lib/utils/html.d.ts +67 -0
- package/dist/lib/utils/html.js +635 -0
- package/dist/lib/utils/index.d.ts +17 -0
- package/dist/lib/utils/index.js +15 -0
- package/dist/lib/utils/loggers.d.ts +10 -0
- package/dist/lib/utils/loggers.js +71 -0
- package/dist/lib/utils/options/declaration.d.ts +514 -0
- package/dist/lib/utils/options/declaration.js +443 -0
- package/dist/lib/utils/options/defaults.d.ts +20 -0
- package/dist/lib/utils/options/defaults.js +104 -0
- package/dist/lib/utils/options/help.d.ts +7 -0
- package/dist/lib/utils/options/help.js +63 -0
- package/dist/lib/utils/options/index.d.ts +6 -0
- package/dist/lib/utils/options/index.js +4 -0
- package/dist/lib/utils/options/options.d.ts +199 -0
- package/dist/lib/utils/options/options.js +273 -0
- package/dist/lib/utils/options/readers/arguments.d.ts +15 -0
- package/dist/lib/utils/options/readers/arguments.js +109 -0
- package/dist/lib/utils/options/readers/index.d.ts +4 -0
- package/dist/lib/utils/options/readers/index.js +4 -0
- package/dist/lib/utils/options/readers/package-json.d.ts +9 -0
- package/dist/lib/utils/options/readers/package-json.js +40 -0
- package/dist/lib/utils/options/readers/tsconfig.d.ts +14 -0
- package/dist/lib/utils/options/readers/tsconfig.js +172 -0
- package/dist/lib/utils/options/readers/typedoc.d.ts +33 -0
- package/dist/lib/utils/options/readers/typedoc.js +136 -0
- package/dist/lib/utils/options/sources/index.d.ts +1 -0
- package/dist/lib/utils/options/sources/index.js +1 -0
- package/dist/lib/utils/options/sources/typedoc.d.ts +2 -0
- package/dist/lib/utils/options/sources/typedoc.js +876 -0
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +6 -0
- package/dist/lib/utils/options/tsdoc-defaults.js +94 -0
- package/dist/lib/utils/package-manifest.d.ts +11 -0
- package/dist/lib/utils/package-manifest.js +84 -0
- package/dist/lib/utils/paths.d.ts +27 -0
- package/dist/lib/utils/paths.js +127 -0
- package/dist/lib/utils/perf.d.ts +6 -0
- package/dist/lib/utils/perf.js +86 -0
- package/dist/lib/utils/plugins.d.ts +3 -0
- package/dist/lib/utils/plugins.js +61 -0
- package/dist/lib/utils/reflections.d.ts +5 -0
- package/dist/lib/utils/reflections.js +64 -0
- package/dist/lib/utils/sort.d.ts +11 -0
- package/dist/lib/utils/sort.js +153 -0
- package/dist/lib/utils/tsconfig.d.ts +5 -0
- package/dist/lib/utils/tsconfig.js +60 -0
- package/dist/lib/utils/tsutils.d.ts +3 -0
- package/dist/lib/utils/tsutils.js +23 -0
- package/dist/lib/utils-common/array.d.ts +57 -0
- package/dist/lib/utils-common/array.js +152 -0
- package/dist/lib/utils-common/declarationReference.d.ts +42 -0
- package/dist/lib/utils-common/declarationReference.js +341 -0
- package/dist/lib/utils-common/enum.d.ts +9 -0
- package/dist/lib/utils-common/enum.js +27 -0
- package/dist/lib/utils-common/events.d.ts +29 -0
- package/dist/lib/utils-common/events.js +49 -0
- package/dist/lib/utils-common/general.d.ts +40 -0
- package/dist/lib/utils-common/general.js +22 -0
- package/dist/lib/utils-common/hooks.d.ts +51 -0
- package/dist/lib/utils-common/hooks.js +90 -0
- package/dist/lib/utils-common/i18n.d.ts +18 -0
- package/dist/lib/utils-common/i18n.js +39 -0
- package/dist/lib/utils-common/index.d.ts +16 -0
- package/dist/lib/utils-common/index.js +17 -0
- package/dist/lib/utils-common/jsx.d.ts +53 -0
- package/dist/lib/utils-common/jsx.elements.d.ts +949 -0
- package/dist/lib/utils-common/jsx.elements.js +3 -0
- package/dist/lib/utils-common/jsx.js +187 -0
- package/dist/lib/utils-common/logger.d.ts +97 -0
- package/dist/lib/utils-common/logger.js +129 -0
- package/dist/lib/utils-common/map.d.ts +23 -0
- package/dist/lib/utils-common/map.js +63 -0
- package/dist/lib/utils-common/minimalSourceFile.d.ts +12 -0
- package/dist/lib/utils-common/minimalSourceFile.js +43 -0
- package/dist/lib/utils-common/path.d.ts +42 -0
- package/dist/lib/utils-common/path.js +130 -0
- package/dist/lib/utils-common/set.d.ts +3 -0
- package/dist/lib/utils-common/set.js +23 -0
- package/dist/lib/utils-common/string.d.ts +11 -0
- package/dist/lib/utils-common/string.js +84 -0
- package/dist/lib/utils-common/validation.d.ts +33 -0
- package/dist/lib/utils-common/validation.js +50 -0
- package/dist/lib/validation/documentation.d.ts +3 -0
- package/dist/lib/validation/documentation.js +91 -0
- package/dist/lib/validation/exports.d.ts +3 -0
- package/dist/lib/validation/exports.js +65 -0
- package/dist/lib/validation/links.d.ts +3 -0
- package/dist/lib/validation/links.js +78 -0
- package/dist/lib/validation/unusedMergeModuleWith.d.ts +3 -0
- package/dist/lib/validation/unusedMergeModuleWith.js +12 -0
- package/package.json +161 -0
- package/static/main.js +58 -0
- package/static/style.css +1633 -0
- package/tsdoc.json +247 -0
- package/typedoc-config.schema.json +941 -0
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parser for declaration references, see the [TSDoc grammar](https://github.com/microsoft/tsdoc/blob/main/tsdoc/src/beta/DeclarationReference.grammarkdown)
|
|
3
|
+
* for reference. TypeDoc **does not** support the full grammar today. This is intentional, since the TSDoc
|
|
4
|
+
* specified grammar allows the user to construct nonsensical declaration references such as `abc![def!ghi]`
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
export const MeaningKeywords = [
|
|
9
|
+
"class", // SymbolFlags.Class
|
|
10
|
+
"interface", // SymbolFlags.Interface
|
|
11
|
+
"type", // SymbolFlags.TypeAlias
|
|
12
|
+
"enum", // SymbolFlags.Enum
|
|
13
|
+
"namespace", // SymbolFlags.Module
|
|
14
|
+
"function", // SymbolFlags.Function
|
|
15
|
+
"var", // SymbolFlags.Variable
|
|
16
|
+
"constructor", // SymbolFlags.Constructor
|
|
17
|
+
"member", // SymbolFlags.ClassMember | SymbolFlags.EnumMember
|
|
18
|
+
"event", //
|
|
19
|
+
"call", // SymbolFlags.Signature (for __call)
|
|
20
|
+
"new", // SymbolFlags.Signature (for __new)
|
|
21
|
+
"index", // SymbolFlags.Signature (for __index)
|
|
22
|
+
"complex", // Any complex type
|
|
23
|
+
// TypeDoc specific
|
|
24
|
+
"getter",
|
|
25
|
+
"setter",
|
|
26
|
+
];
|
|
27
|
+
export function meaningToString(meaning) {
|
|
28
|
+
let result = "";
|
|
29
|
+
if (meaning.keyword) {
|
|
30
|
+
result += meaning.keyword;
|
|
31
|
+
}
|
|
32
|
+
else if (meaning.label) {
|
|
33
|
+
result += meaning.label;
|
|
34
|
+
}
|
|
35
|
+
if (typeof meaning.index === "number") {
|
|
36
|
+
result += `(${meaning.index})`;
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
// <TAB> <VT> <FF> <SP> <NBSP> <ZWNBSP> <USP>
|
|
41
|
+
const WhiteSpace = /[\t\u2B7F\u240C \u00A0\uFEFF\p{White_Space}]/u;
|
|
42
|
+
const LineTerminator = "\r\n\u2028\u2029";
|
|
43
|
+
const Punctuators = "{}()[]!.#~:,";
|
|
44
|
+
const FutureReservedPunctuator = "{}@";
|
|
45
|
+
const NavigationPunctuator = ".#~";
|
|
46
|
+
const DecimalDigit = "0123456789";
|
|
47
|
+
const HexDigit = DecimalDigit + "abcdefABCDEF";
|
|
48
|
+
const SingleEscapeCharacter = `'"\\bfnrtv`;
|
|
49
|
+
const EscapeCharacter = SingleEscapeCharacter + DecimalDigit + "xu";
|
|
50
|
+
const UserLabelStart = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_";
|
|
51
|
+
const UserLabelCharacter = UserLabelStart + DecimalDigit;
|
|
52
|
+
const SingleEscapeChars = {
|
|
53
|
+
"'": "'",
|
|
54
|
+
'"': '"',
|
|
55
|
+
"\\": "\\",
|
|
56
|
+
b: "\b",
|
|
57
|
+
f: "\f",
|
|
58
|
+
n: "\n",
|
|
59
|
+
r: "\r",
|
|
60
|
+
t: "\t",
|
|
61
|
+
v: "\v",
|
|
62
|
+
};
|
|
63
|
+
// EscapeSequence::
|
|
64
|
+
// SingleEscapeCharacter
|
|
65
|
+
// NonEscapeCharacter
|
|
66
|
+
// `0` [lookahead != DecimalDigit]
|
|
67
|
+
// HexEscapeSequence
|
|
68
|
+
// UnicodeEscapeSequence
|
|
69
|
+
function parseEscapeSequence(source, pos, end) {
|
|
70
|
+
// SingleEscapeCharacter
|
|
71
|
+
if (SingleEscapeCharacter.includes(source[pos])) {
|
|
72
|
+
return [SingleEscapeChars[source[pos]], pos + 1];
|
|
73
|
+
}
|
|
74
|
+
// NonEscapeCharacter:: SourceCharacter but not one of EscapeCharacter or LineTerminator
|
|
75
|
+
if (!(EscapeCharacter + LineTerminator).includes(source[pos])) {
|
|
76
|
+
return [source[pos], pos + 1];
|
|
77
|
+
}
|
|
78
|
+
// `0` [lookahead != DecimalDigit]
|
|
79
|
+
if (source[pos] === "0" &&
|
|
80
|
+
pos + 1 < end &&
|
|
81
|
+
!DecimalDigit.includes(source[pos + 1])) {
|
|
82
|
+
return ["\x00", pos + 1];
|
|
83
|
+
}
|
|
84
|
+
// HexEscapeSequence:: x HexDigit HexDigit
|
|
85
|
+
if (source[pos] === "x" &&
|
|
86
|
+
pos + 2 < end &&
|
|
87
|
+
HexDigit.includes(source[pos + 1]) &&
|
|
88
|
+
HexDigit.includes(source[pos + 2])) {
|
|
89
|
+
return [
|
|
90
|
+
String.fromCharCode(parseInt(source.substring(pos + 1, pos + 3), 16)),
|
|
91
|
+
pos + 3,
|
|
92
|
+
];
|
|
93
|
+
}
|
|
94
|
+
return parseUnicodeEscapeSequence(source, pos, end);
|
|
95
|
+
}
|
|
96
|
+
// UnicodeEscapeSequence::
|
|
97
|
+
// `u` HexDigit HexDigit HexDigit HexDigit
|
|
98
|
+
// `u` `{` CodePoint `}`
|
|
99
|
+
// CodePoint:: > |HexDigits| but only if MV of |HexDigits| ≤ 0x10FFFF
|
|
100
|
+
function parseUnicodeEscapeSequence(source, pos, end) {
|
|
101
|
+
if (source[pos] !== "u" || pos + 1 >= end) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (HexDigit.includes(source[pos + 1])) {
|
|
105
|
+
if (pos + 4 >= end ||
|
|
106
|
+
!HexDigit.includes(source[pos + 2]) ||
|
|
107
|
+
!HexDigit.includes(source[pos + 3]) ||
|
|
108
|
+
!HexDigit.includes(source[pos + 4])) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
return [
|
|
112
|
+
String.fromCharCode(parseInt(source.substring(pos + 1, pos + 5), 16)),
|
|
113
|
+
pos + 5,
|
|
114
|
+
];
|
|
115
|
+
}
|
|
116
|
+
if (source[pos + 1] === "{" &&
|
|
117
|
+
pos + 2 < end &&
|
|
118
|
+
HexDigit.includes(source[pos + 2])) {
|
|
119
|
+
let lookahead = pos + 3;
|
|
120
|
+
while (lookahead < end && HexDigit.includes(source[lookahead])) {
|
|
121
|
+
lookahead++;
|
|
122
|
+
}
|
|
123
|
+
if (lookahead >= end || source[lookahead] !== "}")
|
|
124
|
+
return;
|
|
125
|
+
const codePoint = parseInt(source.substring(pos + 2, lookahead), 16);
|
|
126
|
+
if (codePoint <= 0x10ffff) {
|
|
127
|
+
return [String.fromCodePoint(codePoint), lookahead + 1];
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// String:: `"` StringCharacters? `"`
|
|
132
|
+
// StringCharacters:: StringCharacter StringCharacters?
|
|
133
|
+
// StringCharacter::
|
|
134
|
+
// SourceCharacter but not one of `"` or `\` or LineTerminator
|
|
135
|
+
// `\` EscapeSequence
|
|
136
|
+
export function parseString(source, pos, end) {
|
|
137
|
+
let result = "";
|
|
138
|
+
if (source[pos++] !== '"')
|
|
139
|
+
return;
|
|
140
|
+
while (pos < end) {
|
|
141
|
+
if (source[pos] === '"') {
|
|
142
|
+
return [result, pos + 1];
|
|
143
|
+
}
|
|
144
|
+
if (LineTerminator.includes(source[pos]))
|
|
145
|
+
return;
|
|
146
|
+
if (source[pos] === "\\") {
|
|
147
|
+
const esc = parseEscapeSequence(source, pos + 1, end);
|
|
148
|
+
if (!esc)
|
|
149
|
+
return;
|
|
150
|
+
result += esc[0];
|
|
151
|
+
pos = esc[1];
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
result += source[pos++];
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// ModuleSource:: String | ModuleSourceCharacters
|
|
158
|
+
export function parseModuleSource(source, pos, end) {
|
|
159
|
+
if (pos >= end)
|
|
160
|
+
return;
|
|
161
|
+
if (source[pos] === '"') {
|
|
162
|
+
return parseString(source, pos, end);
|
|
163
|
+
}
|
|
164
|
+
let lookahead = pos;
|
|
165
|
+
while (lookahead < end &&
|
|
166
|
+
!('"!' + LineTerminator).includes(source[lookahead])) {
|
|
167
|
+
lookahead++;
|
|
168
|
+
}
|
|
169
|
+
if (lookahead === pos)
|
|
170
|
+
return;
|
|
171
|
+
return [source.substring(pos, lookahead), lookahead];
|
|
172
|
+
}
|
|
173
|
+
// SymbolReference:
|
|
174
|
+
// ComponentPath Meaning?
|
|
175
|
+
// Meaning
|
|
176
|
+
export function parseSymbolReference(source, pos, end) {
|
|
177
|
+
const path = parseComponentPath(source, pos, end);
|
|
178
|
+
pos = path?.[1] ?? pos;
|
|
179
|
+
const meaning = parseMeaning(source, pos, end);
|
|
180
|
+
pos = meaning?.[1] ?? pos;
|
|
181
|
+
if (path || meaning) {
|
|
182
|
+
return [{ path: path?.[0], meaning: meaning?.[0] }, pos];
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// Component::
|
|
186
|
+
// String
|
|
187
|
+
// ComponentCharacters
|
|
188
|
+
// `[` DeclarationReference `]` <--- THIS ONE IS NOT IMPLEMENTED.
|
|
189
|
+
export function parseComponent(source, pos, end) {
|
|
190
|
+
if (pos < end && source[pos] === '"') {
|
|
191
|
+
return parseString(source, pos, end);
|
|
192
|
+
}
|
|
193
|
+
let lookahead = pos;
|
|
194
|
+
while (lookahead < end &&
|
|
195
|
+
!('"' +
|
|
196
|
+
Punctuators +
|
|
197
|
+
FutureReservedPunctuator +
|
|
198
|
+
LineTerminator).includes(source[lookahead]) &&
|
|
199
|
+
!WhiteSpace.test(source[lookahead])) {
|
|
200
|
+
lookahead++;
|
|
201
|
+
}
|
|
202
|
+
if (lookahead === pos)
|
|
203
|
+
return;
|
|
204
|
+
return [source.substring(pos, lookahead), lookahead];
|
|
205
|
+
}
|
|
206
|
+
// ComponentPath:
|
|
207
|
+
// Component
|
|
208
|
+
// ComponentPath `.` Component // Navigate via 'exports' of |ComponentPath|
|
|
209
|
+
// ComponentPath `#` Component // Navigate via 'members' of |ComponentPath|
|
|
210
|
+
// ComponentPath `~` Component // Navigate via 'locals' of |ComponentPath|
|
|
211
|
+
export function parseComponentPath(source, pos, end) {
|
|
212
|
+
const components = [];
|
|
213
|
+
let component = parseComponent(source, pos, end);
|
|
214
|
+
if (!component)
|
|
215
|
+
return;
|
|
216
|
+
pos = component[1];
|
|
217
|
+
components.push({ navigation: ".", path: component[0] });
|
|
218
|
+
while (pos < end && NavigationPunctuator.includes(source[pos])) {
|
|
219
|
+
const navigation = source[pos];
|
|
220
|
+
pos++;
|
|
221
|
+
component = parseComponent(source, pos, end);
|
|
222
|
+
if (!component) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
pos = component[1];
|
|
226
|
+
components.push({ navigation, path: component[0] });
|
|
227
|
+
}
|
|
228
|
+
return [components, pos];
|
|
229
|
+
}
|
|
230
|
+
// The TSDoc specification permits the first four branches of Meaning. TypeDoc adds the UserLabel
|
|
231
|
+
// branch so that the @label tag can be used with this form of declaration references.
|
|
232
|
+
// Meaning:
|
|
233
|
+
// `:` MeaningKeyword // Indicates the meaning of a symbol (i.e. ':class')
|
|
234
|
+
// `:` MeaningKeyword `(` DecimalDigits `)` // Indicates an overloaded meaning (i.e. ':function(1)')
|
|
235
|
+
// `:` `(` DecimalDigits `)` // Shorthand for an overloaded meaning (i.e. `:(1)`)
|
|
236
|
+
// `:` DecimalDigits // Shorthand for an overloaded meaning (i.e. ':1')
|
|
237
|
+
// `:` UserLabel // Indicates a user defined label via {@label CUSTOM_LABEL}
|
|
238
|
+
//
|
|
239
|
+
// UserLabel:
|
|
240
|
+
// UserLabelStart UserLabelCharacter*
|
|
241
|
+
export function parseMeaning(source, pos, end) {
|
|
242
|
+
if (source[pos++] !== ":")
|
|
243
|
+
return;
|
|
244
|
+
const keyword = MeaningKeywords.find((kw) => pos + kw.length <= end && source.startsWith(kw, pos));
|
|
245
|
+
if (keyword) {
|
|
246
|
+
pos += keyword.length;
|
|
247
|
+
}
|
|
248
|
+
if (!keyword && UserLabelStart.includes(source[pos])) {
|
|
249
|
+
let lookahead = pos + 1;
|
|
250
|
+
while (lookahead < end &&
|
|
251
|
+
UserLabelCharacter.includes(source[lookahead])) {
|
|
252
|
+
lookahead++;
|
|
253
|
+
}
|
|
254
|
+
return [{ label: source.substring(pos, lookahead) }, lookahead];
|
|
255
|
+
}
|
|
256
|
+
if (pos + 1 < end &&
|
|
257
|
+
source[pos] === "(" &&
|
|
258
|
+
DecimalDigit.includes(source[pos + 1])) {
|
|
259
|
+
let lookahead = pos + 1;
|
|
260
|
+
while (lookahead < end && DecimalDigit.includes(source[lookahead])) {
|
|
261
|
+
lookahead++;
|
|
262
|
+
}
|
|
263
|
+
if (lookahead < end && source[lookahead] === ")") {
|
|
264
|
+
return [
|
|
265
|
+
{
|
|
266
|
+
keyword,
|
|
267
|
+
index: parseInt(source.substring(pos + 1, lookahead)),
|
|
268
|
+
},
|
|
269
|
+
lookahead + 1,
|
|
270
|
+
];
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (!keyword && pos < end && DecimalDigit.includes(source[pos])) {
|
|
274
|
+
let lookahead = pos;
|
|
275
|
+
while (lookahead < end && DecimalDigit.includes(source[lookahead])) {
|
|
276
|
+
lookahead++;
|
|
277
|
+
}
|
|
278
|
+
return [
|
|
279
|
+
{
|
|
280
|
+
index: parseInt(source.substring(pos, lookahead)),
|
|
281
|
+
},
|
|
282
|
+
lookahead,
|
|
283
|
+
];
|
|
284
|
+
}
|
|
285
|
+
if (keyword) {
|
|
286
|
+
return [{ keyword }, pos];
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
// // NOTE: The following grammar is incorrect as |SymbolReference| and |ModuleSource| have an
|
|
290
|
+
// // ambiguous parse. The correct solution is to use a cover grammar to parse
|
|
291
|
+
// // |SymbolReference| until we hit a `!` and then reinterpret the grammar.
|
|
292
|
+
// DeclarationReference:
|
|
293
|
+
// [empty]
|
|
294
|
+
// SymbolReference // Shorthand reference to symbol
|
|
295
|
+
// ModuleSource `!` // Reference to a module
|
|
296
|
+
// ModuleSource `!` SymbolReference // Reference to an export of a module
|
|
297
|
+
// ModuleSource `!` `~` SymbolReference // Reference to a local of a module
|
|
298
|
+
// `!` SymbolReference // Reference to global symbol
|
|
299
|
+
export function parseDeclarationReference(source, pos, end) {
|
|
300
|
+
let moduleSource;
|
|
301
|
+
let symbolReference;
|
|
302
|
+
let resolutionStart = "local";
|
|
303
|
+
let topLevelLocalReference = false;
|
|
304
|
+
const moduleSourceOrSymbolRef = parseModuleSource(source, pos, end);
|
|
305
|
+
if (moduleSourceOrSymbolRef) {
|
|
306
|
+
if (moduleSourceOrSymbolRef[1] < end &&
|
|
307
|
+
source[moduleSourceOrSymbolRef[1]] === "!") {
|
|
308
|
+
// We had a module source!
|
|
309
|
+
pos = moduleSourceOrSymbolRef[1] + 1;
|
|
310
|
+
resolutionStart = "global";
|
|
311
|
+
moduleSource = moduleSourceOrSymbolRef[0];
|
|
312
|
+
// We might be referencing a local of a module
|
|
313
|
+
if (source[pos] === "~") {
|
|
314
|
+
topLevelLocalReference = true;
|
|
315
|
+
pos++;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
else if (source[pos] === "!") {
|
|
320
|
+
pos++;
|
|
321
|
+
resolutionStart = "global";
|
|
322
|
+
}
|
|
323
|
+
const ref = parseSymbolReference(source, pos, end);
|
|
324
|
+
if (ref) {
|
|
325
|
+
symbolReference = ref[0];
|
|
326
|
+
if (topLevelLocalReference && symbolReference.path?.length) {
|
|
327
|
+
symbolReference.path[0].navigation = "~";
|
|
328
|
+
}
|
|
329
|
+
pos = ref[1];
|
|
330
|
+
}
|
|
331
|
+
if (!moduleSource && !symbolReference)
|
|
332
|
+
return;
|
|
333
|
+
return [
|
|
334
|
+
{
|
|
335
|
+
moduleSource,
|
|
336
|
+
resolutionStart,
|
|
337
|
+
symbolReference,
|
|
338
|
+
},
|
|
339
|
+
pos,
|
|
340
|
+
];
|
|
341
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function getEnumFlags<T extends number>(flags: T): T[];
|
|
2
|
+
export declare function removeFlag<T extends number>(flag: T, remove: T & {}): T;
|
|
3
|
+
export declare function hasAllFlags(flags: number, check: number): boolean;
|
|
4
|
+
export declare function hasAnyFlag(flags: number, check: number): boolean;
|
|
5
|
+
export declare function debugFlags(Enum: object, flags: number): string[];
|
|
6
|
+
export declare function getEnumKeys(Enum: object): string[];
|
|
7
|
+
export type EnumKeys<E extends object> = {
|
|
8
|
+
[K in keyof E]: number extends E[K] ? K : never;
|
|
9
|
+
}[keyof E] & {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export function getEnumFlags(flags) {
|
|
2
|
+
const result = [];
|
|
3
|
+
for (let i = 1; i <= flags; i <<= 1) {
|
|
4
|
+
if (flags & i) {
|
|
5
|
+
result.push(i);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
return result;
|
|
9
|
+
}
|
|
10
|
+
// T & {} reduces inference priority
|
|
11
|
+
export function removeFlag(flag, remove) {
|
|
12
|
+
return (flag & ~remove);
|
|
13
|
+
}
|
|
14
|
+
export function hasAllFlags(flags, check) {
|
|
15
|
+
return (flags & check) === check;
|
|
16
|
+
}
|
|
17
|
+
export function hasAnyFlag(flags, check) {
|
|
18
|
+
return (flags & check) !== 0;
|
|
19
|
+
}
|
|
20
|
+
export function debugFlags(Enum, flags) {
|
|
21
|
+
return getEnumKeys(Enum).filter((key) => (Enum[key] & flags) === Enum[key]);
|
|
22
|
+
}
|
|
23
|
+
// Note: String enums are not handled.
|
|
24
|
+
export function getEnumKeys(Enum) {
|
|
25
|
+
const E = Enum;
|
|
26
|
+
return Object.keys(E).filter((k) => E[E[k]] === k);
|
|
27
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Intentionally very simple event emitter.
|
|
3
|
+
*
|
|
4
|
+
* @privateRemarks
|
|
5
|
+
* This is essentially a stripped down copy of EventHooks in hooks.ts.
|
|
6
|
+
*/
|
|
7
|
+
export declare class EventDispatcher<T extends Record<keyof T, unknown[]>> {
|
|
8
|
+
private _listeners;
|
|
9
|
+
/**
|
|
10
|
+
* Starts listening to an event.
|
|
11
|
+
* @param event the event to listen to.
|
|
12
|
+
* @param listener function to be called when an this event is emitted.
|
|
13
|
+
* @param priority optional priority to insert this hook with.
|
|
14
|
+
* Higher priority is placed earlier in the listener array.
|
|
15
|
+
*/
|
|
16
|
+
on<K extends keyof T>(event: K, listener: (this: undefined, ...args: T[K]) => void, priority?: number): void;
|
|
17
|
+
/**
|
|
18
|
+
* Stops listening to an event.
|
|
19
|
+
* @param event the event to stop listening to.
|
|
20
|
+
* @param listener the function to remove from the listener array.
|
|
21
|
+
*/
|
|
22
|
+
off<K extends keyof T>(event: K, listener: (this: undefined, ...args: T[K]) => void): void;
|
|
23
|
+
/**
|
|
24
|
+
* Emits an event to all currently subscribed listeners.
|
|
25
|
+
* @param event the event to emit.
|
|
26
|
+
* @param args any arguments required for the event.
|
|
27
|
+
*/
|
|
28
|
+
trigger<K extends keyof T>(event: K, ...args: T[K]): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { insertPrioritySorted } from "./array.js";
|
|
2
|
+
/**
|
|
3
|
+
* Intentionally very simple event emitter.
|
|
4
|
+
*
|
|
5
|
+
* @privateRemarks
|
|
6
|
+
* This is essentially a stripped down copy of EventHooks in hooks.ts.
|
|
7
|
+
*/
|
|
8
|
+
export class EventDispatcher {
|
|
9
|
+
// Function is *usually* not a good type to use, but here it lets us specify stricter
|
|
10
|
+
// contracts in the methods while not casting everywhere this is used.
|
|
11
|
+
_listeners = new Map();
|
|
12
|
+
/**
|
|
13
|
+
* Starts listening to an event.
|
|
14
|
+
* @param event the event to listen to.
|
|
15
|
+
* @param listener function to be called when an this event is emitted.
|
|
16
|
+
* @param priority optional priority to insert this hook with.
|
|
17
|
+
* Higher priority is placed earlier in the listener array.
|
|
18
|
+
*/
|
|
19
|
+
on(event, listener, priority = 0) {
|
|
20
|
+
const list = (this._listeners.get(event) || []).slice();
|
|
21
|
+
insertPrioritySorted(list, { listener, priority });
|
|
22
|
+
this._listeners.set(event, list);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Stops listening to an event.
|
|
26
|
+
* @param event the event to stop listening to.
|
|
27
|
+
* @param listener the function to remove from the listener array.
|
|
28
|
+
*/
|
|
29
|
+
off(event, listener) {
|
|
30
|
+
const listeners = this._listeners.get(event);
|
|
31
|
+
if (listeners) {
|
|
32
|
+
const index = listeners.findIndex((lo) => lo.listener === listener);
|
|
33
|
+
if (index > -1) {
|
|
34
|
+
listeners.splice(index, 1);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Emits an event to all currently subscribed listeners.
|
|
40
|
+
* @param event the event to emit.
|
|
41
|
+
* @param args any arguments required for the event.
|
|
42
|
+
*/
|
|
43
|
+
trigger(event, ...args) {
|
|
44
|
+
const listeners = this._listeners.get(event)?.slice() || [];
|
|
45
|
+
for (const { listener } of listeners) {
|
|
46
|
+
listener(...args);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This type provides a flag that can be used to turn off more lax overloads intended for
|
|
3
|
+
* plugin use only to catch type errors in the TypeDoc codebase. The prepublishOnly npm
|
|
4
|
+
* script will be used to switch this flag to false when publishing, then immediately back
|
|
5
|
+
* to true after a successful publish.
|
|
6
|
+
*/
|
|
7
|
+
type InternalOnly = false;
|
|
8
|
+
/**
|
|
9
|
+
* Helper type to convert `T` to `F` if compiling TypeDoc with stricter types.
|
|
10
|
+
*
|
|
11
|
+
* Can be used in overloads to map a parameter type to `never`. For example, the
|
|
12
|
+
* following function will work with any string argument, but to improve the type safety
|
|
13
|
+
* of internal code, we only ever want to pass 'a' or 'b' to it. Plugins on the other
|
|
14
|
+
* hand need to be able to pass any string to it. Overloads similar to this are used
|
|
15
|
+
* in the {@link Options} class.
|
|
16
|
+
*
|
|
17
|
+
* This is also used to prevent TypeDoc code from using deprecated methods which will
|
|
18
|
+
* be removed in a future release.
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* function over(flag: 'a' | 'b'): string
|
|
22
|
+
* // deprecated
|
|
23
|
+
* function over(flag: IfInternal<never, string>): string
|
|
24
|
+
* function over(flag: string): string { return flag }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export type IfInternal<T, F> = InternalOnly extends true ? T : F;
|
|
28
|
+
/**
|
|
29
|
+
* Helper type to convert `T` to `never` if compiling TypeDoc with stricter types.
|
|
30
|
+
*
|
|
31
|
+
* See {@link IfInternal} for the rationale.
|
|
32
|
+
*/
|
|
33
|
+
export type NeverIfInternal<T> = IfInternal<never, T>;
|
|
34
|
+
/**
|
|
35
|
+
* Utility to help type checking ensure that there is no uncovered case.
|
|
36
|
+
*/
|
|
37
|
+
export declare function assertNever(x: never): never;
|
|
38
|
+
export declare function assert(x: unknown, message?: string): asserts x;
|
|
39
|
+
export declare function NonEnumerable(_cls: unknown, context: ClassFieldDecoratorContext): void;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility to help type checking ensure that there is no uncovered case.
|
|
3
|
+
*/
|
|
4
|
+
export function assertNever(x) {
|
|
5
|
+
throw new Error(`Expected handling to cover all possible cases, but it didn't cover: ${JSON.stringify(x)}`);
|
|
6
|
+
}
|
|
7
|
+
export function assert(x, message = "Assertion failed") {
|
|
8
|
+
if (!x) {
|
|
9
|
+
// eslint-disable-next-line no-debugger
|
|
10
|
+
debugger;
|
|
11
|
+
throw new Error(message);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export function NonEnumerable(_cls, context) {
|
|
15
|
+
context.addInitializer(function () {
|
|
16
|
+
Object.defineProperty(this, context.name, {
|
|
17
|
+
enumerable: false,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
type EventHooksMomento<T extends Record<keyof T, unknown[]>, _R> = {
|
|
2
|
+
__eventHooksMomentoBrand: never;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Event emitter which allows listeners to return a value.
|
|
6
|
+
*
|
|
7
|
+
* This is beneficial for the themes since it allows plugins to modify the HTML output
|
|
8
|
+
* without doing unsafe text replacement.
|
|
9
|
+
*
|
|
10
|
+
* Very simple event emitter class which collects the return values of its listeners.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const x = new EventHooks<{ a: [string] }, string>()
|
|
15
|
+
* x.on('a', a => a.repeat(123)) // ok, returns a string
|
|
16
|
+
* x.on('b', console.log) // error, 'b' is not assignable to 'a'
|
|
17
|
+
* x.on('a' a => 1) // error, returns a number but expected a string
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare class EventHooks<T extends Record<keyof T, unknown[]>, R> {
|
|
21
|
+
private _listeners;
|
|
22
|
+
/**
|
|
23
|
+
* Starts listening to an event.
|
|
24
|
+
* @param event the event to listen to.
|
|
25
|
+
* @param listener function to be called when an this event is emitted.
|
|
26
|
+
* @param order optional order to insert this hook with.
|
|
27
|
+
*/
|
|
28
|
+
on<K extends keyof T>(event: K, listener: (...args: T[K]) => R, order?: number): void;
|
|
29
|
+
/**
|
|
30
|
+
* Listens to a single occurrence of an event.
|
|
31
|
+
* @param event the event to listen to.
|
|
32
|
+
* @param listener function to be called when an this event is emitted.
|
|
33
|
+
* @param order optional order to insert this hook with.
|
|
34
|
+
*/
|
|
35
|
+
once<K extends keyof T>(event: K, listener: (...args: T[K]) => R, order?: number): void;
|
|
36
|
+
/**
|
|
37
|
+
* Stops listening to an event.
|
|
38
|
+
* @param event the event to stop listening to.
|
|
39
|
+
* @param listener the function to remove from the listener array.
|
|
40
|
+
*/
|
|
41
|
+
off<K extends keyof T>(event: K, listener: (...args: T[K]) => R): void;
|
|
42
|
+
/**
|
|
43
|
+
* Emits an event to all currently subscribed listeners.
|
|
44
|
+
* @param event the event to emit.
|
|
45
|
+
* @param args any arguments required for the event.
|
|
46
|
+
*/
|
|
47
|
+
emit<K extends keyof T>(event: K, ...args: T[K]): R[];
|
|
48
|
+
saveMomento(): EventHooksMomento<T, R>;
|
|
49
|
+
restoreMomento(momento: EventHooksMomento<T, R>): void;
|
|
50
|
+
}
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { insertOrderSorted } from "./array.js";
|
|
2
|
+
const momentos = new WeakMap();
|
|
3
|
+
/**
|
|
4
|
+
* Event emitter which allows listeners to return a value.
|
|
5
|
+
*
|
|
6
|
+
* This is beneficial for the themes since it allows plugins to modify the HTML output
|
|
7
|
+
* without doing unsafe text replacement.
|
|
8
|
+
*
|
|
9
|
+
* Very simple event emitter class which collects the return values of its listeners.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const x = new EventHooks<{ a: [string] }, string>()
|
|
14
|
+
* x.on('a', a => a.repeat(123)) // ok, returns a string
|
|
15
|
+
* x.on('b', console.log) // error, 'b' is not assignable to 'a'
|
|
16
|
+
* x.on('a' a => 1) // error, returns a number but expected a string
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export class EventHooks {
|
|
20
|
+
// Function is *usually* not a good type to use, but here it lets us specify stricter
|
|
21
|
+
// contracts in the methods while not casting everywhere this is used.
|
|
22
|
+
_listeners = new Map();
|
|
23
|
+
/**
|
|
24
|
+
* Starts listening to an event.
|
|
25
|
+
* @param event the event to listen to.
|
|
26
|
+
* @param listener function to be called when an this event is emitted.
|
|
27
|
+
* @param order optional order to insert this hook with.
|
|
28
|
+
*/
|
|
29
|
+
on(event, listener, order = 0) {
|
|
30
|
+
const list = (this._listeners.get(event) || []).slice();
|
|
31
|
+
insertOrderSorted(list, { listener, order });
|
|
32
|
+
this._listeners.set(event, list);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Listens to a single occurrence of an event.
|
|
36
|
+
* @param event the event to listen to.
|
|
37
|
+
* @param listener function to be called when an this event is emitted.
|
|
38
|
+
* @param order optional order to insert this hook with.
|
|
39
|
+
*/
|
|
40
|
+
once(event, listener, order = 0) {
|
|
41
|
+
const list = (this._listeners.get(event) || []).slice();
|
|
42
|
+
insertOrderSorted(list, { listener, once: true, order });
|
|
43
|
+
this._listeners.set(event, list);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Stops listening to an event.
|
|
47
|
+
* @param event the event to stop listening to.
|
|
48
|
+
* @param listener the function to remove from the listener array.
|
|
49
|
+
*/
|
|
50
|
+
off(event, listener) {
|
|
51
|
+
const listeners = this._listeners.get(event);
|
|
52
|
+
if (listeners) {
|
|
53
|
+
const index = listeners.findIndex((lo) => lo.listener === listener);
|
|
54
|
+
if (index > -1) {
|
|
55
|
+
listeners.splice(index, 1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Emits an event to all currently subscribed listeners.
|
|
61
|
+
* @param event the event to emit.
|
|
62
|
+
* @param args any arguments required for the event.
|
|
63
|
+
*/
|
|
64
|
+
emit(event, ...args) {
|
|
65
|
+
const listeners = this._listeners.get(event)?.slice() || [];
|
|
66
|
+
this._listeners.set(event, listeners.filter(({ once }) => !once));
|
|
67
|
+
return listeners.map(({ listener }) => listener(...args));
|
|
68
|
+
}
|
|
69
|
+
saveMomento() {
|
|
70
|
+
const momento = {};
|
|
71
|
+
const save = new Map();
|
|
72
|
+
for (const [key, val] of this._listeners) {
|
|
73
|
+
save.set(key, [...val]);
|
|
74
|
+
}
|
|
75
|
+
momentos.set(momento, save);
|
|
76
|
+
return momento;
|
|
77
|
+
}
|
|
78
|
+
restoreMomento(momento) {
|
|
79
|
+
const saved = momentos.get(momento);
|
|
80
|
+
if (saved) {
|
|
81
|
+
this._listeners.clear();
|
|
82
|
+
for (const [key, val] of saved) {
|
|
83
|
+
this._listeners.set(key, [...val]);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
throw new Error("Momento not found.");
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { TranslationProxy } from "../internationalization/internationalization.js";
|
|
2
|
+
import type { TagString } from "./validation.js";
|
|
3
|
+
declare const TranslatedString: unique symbol;
|
|
4
|
+
export type TranslatedString = string & {
|
|
5
|
+
[TranslatedString]: true;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Set the available translations to be used by TypeDoc.
|
|
9
|
+
*/
|
|
10
|
+
export declare function setTranslations(t: Record<string, string>): void;
|
|
11
|
+
/**
|
|
12
|
+
* Add the specified translations to the current translations object
|
|
13
|
+
* Any keys already specified will overwrite current keys
|
|
14
|
+
*/
|
|
15
|
+
export declare function addTranslations(t: Record<string, string>): void;
|
|
16
|
+
export declare const i18n: TranslationProxy;
|
|
17
|
+
export declare function translateTagName(tag: TagString): TranslatedString;
|
|
18
|
+
export {};
|