@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,50 @@
|
|
|
1
|
+
import assert from "assert";
|
|
2
|
+
import { DeclarationReflection, ParameterReflection, ReflectionFlag, ReflectionKind, SignatureReflection, UnionType, } from "../../models/index.js";
|
|
3
|
+
import { ConverterEvents } from "../converter-events.js";
|
|
4
|
+
export function convertIndexSignatures(context, type) {
|
|
5
|
+
assert(context.scope instanceof DeclarationReflection);
|
|
6
|
+
// Each declaration should have one SignatureReflection
|
|
7
|
+
// If we don't have a declaration, the index signature was inferred by TS
|
|
8
|
+
// and we should make a separate SignatureReflection for each index signature.
|
|
9
|
+
const seenByDeclaration = new Map();
|
|
10
|
+
const createdSignatures = [];
|
|
11
|
+
for (const indexInfo of context.checker.getIndexInfosOfType(type)) {
|
|
12
|
+
// Check if we've already created an index signature for this type
|
|
13
|
+
if (indexInfo.declaration &&
|
|
14
|
+
seenByDeclaration.has(indexInfo.declaration)) {
|
|
15
|
+
const createdSig = seenByDeclaration.get(indexInfo.declaration);
|
|
16
|
+
if (createdSig.parameters[0].type?.type !== "union") {
|
|
17
|
+
createdSig.parameters[0].type = new UnionType([
|
|
18
|
+
createdSig.parameters[0].type,
|
|
19
|
+
]);
|
|
20
|
+
}
|
|
21
|
+
createdSig.parameters[0].type.types.push(context.converter.convertType(context.withScope(createdSig), indexInfo.keyType));
|
|
22
|
+
// No need to update the return type as it will be the same for all members.
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
// Otherwise create a new one
|
|
26
|
+
const index = new SignatureReflection("__index", ReflectionKind.IndexSignature, context.scope);
|
|
27
|
+
const ic = context.withScope(index);
|
|
28
|
+
if (indexInfo.isReadonly) {
|
|
29
|
+
index.setFlag(ReflectionFlag.Readonly);
|
|
30
|
+
}
|
|
31
|
+
createdSignatures.push([indexInfo.declaration, index]);
|
|
32
|
+
if (indexInfo.declaration) {
|
|
33
|
+
seenByDeclaration.set(indexInfo.declaration, index);
|
|
34
|
+
index.comment = context.getNodeComment(indexInfo.declaration,
|
|
35
|
+
/* moduleComment */ false);
|
|
36
|
+
}
|
|
37
|
+
index.parameters = [
|
|
38
|
+
new ParameterReflection(indexInfo.declaration?.parameters[0].name.getText() ?? "key", ReflectionKind.Parameter, index),
|
|
39
|
+
];
|
|
40
|
+
index.parameters[0].type = context.converter.convertType(ic.withScope(index.parameters[0]), indexInfo.keyType);
|
|
41
|
+
index.type = context.converter.convertType(ic, indexInfo.type);
|
|
42
|
+
context.registerReflection(index, indexInfo.declaration?.symbol);
|
|
43
|
+
context.scope.indexSignatures ||= [];
|
|
44
|
+
context.scope.indexSignatures.push(index);
|
|
45
|
+
}
|
|
46
|
+
// Now that we've created everything, trigger events for them.
|
|
47
|
+
for (const [declaration, index] of createdSignatures) {
|
|
48
|
+
context.converter.trigger(ConverterEvents.CREATE_SIGNATURE, context, index, declaration);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { ParameterReflection, type Reflection, ReflectionKind, SignatureReflection, TypeParameterReflection } from "../../models/index.js";
|
|
3
|
+
import type { Context } from "../context.js";
|
|
4
|
+
export declare function convertConstructSignatures(context: Context, symbol: ts.Symbol): void;
|
|
5
|
+
export declare function createSignature(context: Context, kind: ReflectionKind.CallSignature | ReflectionKind.ConstructorSignature | ReflectionKind.GetSignature | ReflectionKind.SetSignature, signature: ts.Signature, symbol: ts.Symbol | undefined, declaration?: ts.SignatureDeclaration | ts.JSDocSignature): void;
|
|
6
|
+
/**
|
|
7
|
+
* Special cased constructor factory for functions tagged with `@class`
|
|
8
|
+
*/
|
|
9
|
+
export declare function createConstructSignatureWithType(context: Context, signature: ts.Signature, classType: Reflection): void;
|
|
10
|
+
export declare function convertParameterNodes(context: Context, sigRef: SignatureReflection, parameters: readonly (ts.JSDocParameterTag | ts.ParameterDeclaration)[]): ParameterReflection[];
|
|
11
|
+
export declare function convertTypeParameters(context: Context, parent: Reflection, parameters: readonly ts.TypeParameter[] | undefined): TypeParameterReflection[] | undefined;
|
|
12
|
+
export declare function convertTypeParameterNodes(context: Context, parameters: readonly ts.TypeParameterDeclaration[] | undefined): TypeParameterReflection[] | undefined;
|
|
13
|
+
export declare function createTypeParamReflection(param: ts.TypeParameterDeclaration, context: Context): TypeParameterReflection;
|
|
14
|
+
export declare function convertTemplateParameterNodes(context: Context, nodes: readonly ts.JSDocTemplateTag[] | undefined): TypeParameterReflection[] | undefined;
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import assert from "assert";
|
|
3
|
+
import { DeclarationReflection, IntrinsicType, ParameterReflection, PredicateType, ReferenceType, ReflectionFlag, ReflectionKind, SignatureReflection, TypeParameterReflection, VarianceModifier, } from "../../models/index.js";
|
|
4
|
+
import { ConverterEvents } from "../converter-events.js";
|
|
5
|
+
import { convertDefaultValue } from "../convert-expression.js";
|
|
6
|
+
import { removeUndefined } from "../utils/reflections.js";
|
|
7
|
+
export function convertConstructSignatures(context, symbol) {
|
|
8
|
+
const type = context.checker.getDeclaredTypeOfSymbol(symbol);
|
|
9
|
+
// These get added as a "constructor" member of this interface. This is a problem... but nobody
|
|
10
|
+
// has complained yet. We really ought to have a constructSignatures property on the reflection instead.
|
|
11
|
+
const constructSignatures = context.checker.getSignaturesOfType(type, ts.SignatureKind.Construct);
|
|
12
|
+
if (constructSignatures.length) {
|
|
13
|
+
const constructMember = new DeclarationReflection("constructor", ReflectionKind.Constructor, context.scope);
|
|
14
|
+
context.postReflectionCreation(constructMember, symbol, void 0);
|
|
15
|
+
context.finalizeDeclarationReflection(constructMember);
|
|
16
|
+
const constructContext = context.withScope(constructMember);
|
|
17
|
+
constructSignatures.forEach((sig) => createSignature(constructContext, ReflectionKind.ConstructorSignature, sig, symbol));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export function createSignature(context, kind, signature, symbol, declaration) {
|
|
21
|
+
assert(context.scope instanceof DeclarationReflection);
|
|
22
|
+
declaration ||= signature.getDeclaration();
|
|
23
|
+
const sigRef = new SignatureReflection(kind == ReflectionKind.ConstructorSignature
|
|
24
|
+
? context.scope.parent.name
|
|
25
|
+
: context.scope.name, kind, context.scope);
|
|
26
|
+
// This feels awful, but we need some way to tell if callable signatures on classes
|
|
27
|
+
// are "static" (e.g. `Foo()`) or not (e.g. `(new Foo())()`)
|
|
28
|
+
if (context.shouldBeStatic) {
|
|
29
|
+
sigRef.setFlag(ReflectionFlag.Static);
|
|
30
|
+
}
|
|
31
|
+
if (symbol && declaration) {
|
|
32
|
+
context.project.registerSymbolId(sigRef, context.createSymbolId(symbol, declaration));
|
|
33
|
+
}
|
|
34
|
+
let parentReflection = context.scope;
|
|
35
|
+
if (parentReflection.kindOf(ReflectionKind.TypeLiteral) &&
|
|
36
|
+
parentReflection.parent instanceof DeclarationReflection) {
|
|
37
|
+
parentReflection = parentReflection.parent;
|
|
38
|
+
}
|
|
39
|
+
if (declaration) {
|
|
40
|
+
const sigComment = context.getSignatureComment(declaration);
|
|
41
|
+
if (parentReflection.comment?.discoveryId !== sigComment?.discoveryId) {
|
|
42
|
+
sigRef.comment = sigComment;
|
|
43
|
+
if (parentReflection.kindOf(ReflectionKind.MayContainDocuments)) {
|
|
44
|
+
context.converter.processDocumentTags(sigRef, parentReflection);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const sigRefCtx = context.withScope(sigRef);
|
|
49
|
+
sigRef.typeParameters = convertTypeParameters(sigRefCtx, sigRef, signature.typeParameters);
|
|
50
|
+
const parameterSymbols = signature.thisParameter
|
|
51
|
+
? [signature.thisParameter, ...signature.parameters]
|
|
52
|
+
: signature.parameters;
|
|
53
|
+
sigRef.parameters = convertParameters(sigRefCtx, sigRef, parameterSymbols, declaration?.parameters);
|
|
54
|
+
const predicate = context.checker.getTypePredicateOfSignature(signature);
|
|
55
|
+
if (predicate) {
|
|
56
|
+
sigRef.type = convertPredicate(predicate, sigRefCtx);
|
|
57
|
+
}
|
|
58
|
+
else if (kind == ReflectionKind.SetSignature) {
|
|
59
|
+
sigRef.type = new IntrinsicType("void");
|
|
60
|
+
}
|
|
61
|
+
else if (declaration?.type?.kind === ts.SyntaxKind.ThisType) {
|
|
62
|
+
sigRef.type = new IntrinsicType("this");
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
let typeNode = declaration?.type;
|
|
66
|
+
if (typeNode && ts.isJSDocReturnTag(typeNode)) {
|
|
67
|
+
typeNode = typeNode.typeExpression?.type;
|
|
68
|
+
}
|
|
69
|
+
sigRef.type = context.converter.convertType(sigRefCtx, signature.getReturnType(), typeNode);
|
|
70
|
+
}
|
|
71
|
+
context.registerReflection(sigRef, undefined);
|
|
72
|
+
switch (kind) {
|
|
73
|
+
case ReflectionKind.GetSignature:
|
|
74
|
+
context.scope.getSignature = sigRef;
|
|
75
|
+
break;
|
|
76
|
+
case ReflectionKind.SetSignature:
|
|
77
|
+
context.scope.setSignature = sigRef;
|
|
78
|
+
break;
|
|
79
|
+
case ReflectionKind.CallSignature:
|
|
80
|
+
case ReflectionKind.ConstructorSignature:
|
|
81
|
+
context.scope.signatures ??= [];
|
|
82
|
+
context.scope.signatures.push(sigRef);
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
context.converter.trigger(ConverterEvents.CREATE_SIGNATURE, context, sigRef, declaration, signature);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Special cased constructor factory for functions tagged with `@class`
|
|
89
|
+
*/
|
|
90
|
+
export function createConstructSignatureWithType(context, signature, classType) {
|
|
91
|
+
assert(context.scope instanceof DeclarationReflection);
|
|
92
|
+
const declaration = signature.getDeclaration();
|
|
93
|
+
const sigRef = new SignatureReflection(context.scope.parent.name, ReflectionKind.ConstructorSignature, context.scope);
|
|
94
|
+
const sigRefCtx = context.withScope(sigRef);
|
|
95
|
+
if (declaration) {
|
|
96
|
+
sigRef.comment = context.getSignatureComment(declaration);
|
|
97
|
+
if (sigRef.comment?.discoveryId === context.scope.parent?.comment?.discoveryId) {
|
|
98
|
+
delete sigRef.comment;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const parameterSymbols = signature.thisParameter
|
|
102
|
+
? [signature.thisParameter, ...signature.parameters]
|
|
103
|
+
: [...signature.parameters];
|
|
104
|
+
// Prevent a `this` parameter from appearing on constructor signature
|
|
105
|
+
// as TS disallows them on regular classes.
|
|
106
|
+
if (parameterSymbols[0]?.name === "this") {
|
|
107
|
+
parameterSymbols.shift();
|
|
108
|
+
}
|
|
109
|
+
sigRef.parameters = convertParameters(sigRefCtx, sigRef, parameterSymbols, declaration?.parameters);
|
|
110
|
+
sigRef.parameters = convertParameters(sigRefCtx, sigRef, parameterSymbols, undefined);
|
|
111
|
+
// Do NOT convert type parameters here, they go on the class itself in the @class case
|
|
112
|
+
// See #2914.
|
|
113
|
+
sigRef.type = ReferenceType.createResolvedReference(context.scope.parent.name, classType, context.project);
|
|
114
|
+
context.registerReflection(sigRef, undefined);
|
|
115
|
+
context.scope.signatures ??= [];
|
|
116
|
+
context.scope.signatures.push(sigRef);
|
|
117
|
+
context.converter.trigger(ConverterEvents.CREATE_SIGNATURE, context, sigRef, declaration, signature);
|
|
118
|
+
}
|
|
119
|
+
function convertParameters(context, sigRef, parameters, parameterNodes) {
|
|
120
|
+
// #2698 if `satisfies` is used to imply a this parameter, we might have
|
|
121
|
+
// more parameters than parameter nodes and need to shift the parameterNode
|
|
122
|
+
// access index. Very ugly, but it does the job.
|
|
123
|
+
const parameterNodeOffset = parameterNodes?.length !== parameters.length ? -1 : 0;
|
|
124
|
+
return parameters.map((param, i) => {
|
|
125
|
+
const declaration = param.valueDeclaration;
|
|
126
|
+
assert(!declaration ||
|
|
127
|
+
ts.isParameter(declaration) ||
|
|
128
|
+
ts.isJSDocParameterTag(declaration));
|
|
129
|
+
const paramRefl = new ParameterReflection(/^__\d+$/.test(param.name) ? "__namedParameters" : param.name, ReflectionKind.Parameter, sigRef);
|
|
130
|
+
if (declaration && ts.isJSDocParameterTag(declaration)) {
|
|
131
|
+
paramRefl.comment = context.getJsDocComment(declaration);
|
|
132
|
+
}
|
|
133
|
+
paramRefl.comment ||= context.getComment(param, paramRefl.kind);
|
|
134
|
+
context.registerReflection(paramRefl, param);
|
|
135
|
+
context.converter.trigger(ConverterEvents.CREATE_PARAMETER, context, paramRefl);
|
|
136
|
+
let type;
|
|
137
|
+
let typeNode;
|
|
138
|
+
if (declaration) {
|
|
139
|
+
type = context.checker.getTypeOfSymbolAtLocation(param, declaration);
|
|
140
|
+
if (ts.isParameter(declaration)) {
|
|
141
|
+
typeNode = declaration.type;
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
typeNode = declaration.typeExpression?.type;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
type = context.checker.getTypeOfSymbol(param);
|
|
149
|
+
}
|
|
150
|
+
if (declaration &&
|
|
151
|
+
ts.isParameter(declaration) &&
|
|
152
|
+
declaration.type?.kind === ts.SyntaxKind.ThisType) {
|
|
153
|
+
paramRefl.type = new IntrinsicType("this");
|
|
154
|
+
}
|
|
155
|
+
else if (!type) {
|
|
156
|
+
paramRefl.type = new IntrinsicType("any");
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
paramRefl.type = context.converter.convertType(context.withScope(paramRefl), type, typeNode);
|
|
160
|
+
}
|
|
161
|
+
let isOptional = false;
|
|
162
|
+
if (declaration) {
|
|
163
|
+
isOptional = ts.isParameter(declaration)
|
|
164
|
+
? !!declaration.questionToken ||
|
|
165
|
+
ts
|
|
166
|
+
.getJSDocParameterTags(declaration)
|
|
167
|
+
.some((tag) => tag.isBracketed)
|
|
168
|
+
: declaration.isBracketed;
|
|
169
|
+
}
|
|
170
|
+
if (isOptional) {
|
|
171
|
+
paramRefl.type = removeUndefined(paramRefl.type);
|
|
172
|
+
}
|
|
173
|
+
paramRefl.defaultValue = convertDefaultValue(parameterNodes?.[i + parameterNodeOffset]);
|
|
174
|
+
paramRefl.setFlag(ReflectionFlag.Optional, isOptional);
|
|
175
|
+
// If we have no declaration, then this is an implicitly defined parameter in JS land
|
|
176
|
+
// because the method body uses `arguments`... which is always a rest argument,
|
|
177
|
+
// unless it is a this parameter defined with @this in JSDoc.
|
|
178
|
+
let isRest = param.name !== "this";
|
|
179
|
+
if (declaration) {
|
|
180
|
+
isRest = ts.isParameter(declaration)
|
|
181
|
+
? !!declaration.dotDotDotToken
|
|
182
|
+
: !!declaration.typeExpression &&
|
|
183
|
+
ts.isJSDocVariadicType(declaration.typeExpression.type);
|
|
184
|
+
}
|
|
185
|
+
paramRefl.setFlag(ReflectionFlag.Rest, isRest);
|
|
186
|
+
checkForDestructuredParameterDefaults(paramRefl, parameterNodes?.[i + parameterNodeOffset]);
|
|
187
|
+
return paramRefl;
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
export function convertParameterNodes(context, sigRef, parameters) {
|
|
191
|
+
return parameters.map((param) => {
|
|
192
|
+
const paramRefl = new ParameterReflection(/__\d+/.test(param.name.getText())
|
|
193
|
+
? "__namedParameters"
|
|
194
|
+
: param.name.getText(), ReflectionKind.Parameter, sigRef);
|
|
195
|
+
if (ts.isJSDocParameterTag(param)) {
|
|
196
|
+
paramRefl.comment = context.getJsDocComment(param);
|
|
197
|
+
}
|
|
198
|
+
context.registerReflection(paramRefl, context.getSymbolAtLocation(param));
|
|
199
|
+
context.converter.trigger(ConverterEvents.CREATE_PARAMETER, context, paramRefl);
|
|
200
|
+
paramRefl.type = context.converter.convertType(context.withScope(paramRefl), ts.isParameter(param) ? param.type : param.typeExpression?.type);
|
|
201
|
+
const isOptional = ts.isParameter(param)
|
|
202
|
+
? !!param.questionToken
|
|
203
|
+
: param.isBracketed;
|
|
204
|
+
if (isOptional) {
|
|
205
|
+
paramRefl.type = removeUndefined(paramRefl.type);
|
|
206
|
+
}
|
|
207
|
+
paramRefl.defaultValue = convertDefaultValue(param);
|
|
208
|
+
paramRefl.setFlag(ReflectionFlag.Optional, isOptional);
|
|
209
|
+
paramRefl.setFlag(ReflectionFlag.Rest, ts.isParameter(param)
|
|
210
|
+
? !!param.dotDotDotToken
|
|
211
|
+
: !!param.typeExpression &&
|
|
212
|
+
ts.isJSDocVariadicType(param.typeExpression.type));
|
|
213
|
+
checkForDestructuredParameterDefaults(paramRefl, param);
|
|
214
|
+
return paramRefl;
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
function checkForDestructuredParameterDefaults(param, decl) {
|
|
218
|
+
if (!decl || !ts.isParameter(decl))
|
|
219
|
+
return;
|
|
220
|
+
if (param.name !== "__namedParameters")
|
|
221
|
+
return;
|
|
222
|
+
if (!ts.isObjectBindingPattern(decl.name))
|
|
223
|
+
return;
|
|
224
|
+
if (param.type?.type !== "reflection")
|
|
225
|
+
return;
|
|
226
|
+
for (const child of param.type.declaration.children || []) {
|
|
227
|
+
const tsChild = decl.name.elements.find((el) => (el.propertyName || el.name).getText() === child.name);
|
|
228
|
+
if (tsChild) {
|
|
229
|
+
child.defaultValue = convertDefaultValue(tsChild);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
export function convertTypeParameters(context, parent, parameters) {
|
|
234
|
+
return parameters?.map((param) => {
|
|
235
|
+
const constraintT = param.getConstraint();
|
|
236
|
+
const defaultT = param.getDefault();
|
|
237
|
+
// There's no way to determine directly from a ts.TypeParameter what it's variance modifiers are
|
|
238
|
+
// so unfortunately we have to go back to the node for this...
|
|
239
|
+
const declaration = param
|
|
240
|
+
.getSymbol()
|
|
241
|
+
?.declarations?.find(ts.isTypeParameterDeclaration);
|
|
242
|
+
const variance = getVariance(declaration?.modifiers);
|
|
243
|
+
const paramRefl = new TypeParameterReflection(param.symbol.name, parent, variance);
|
|
244
|
+
const paramCtx = context.withScope(paramRefl);
|
|
245
|
+
paramRefl.type = constraintT
|
|
246
|
+
? context.converter.convertType(paramCtx, constraintT)
|
|
247
|
+
: void 0;
|
|
248
|
+
paramRefl.default = defaultT
|
|
249
|
+
? context.converter.convertType(paramCtx, defaultT)
|
|
250
|
+
: void 0;
|
|
251
|
+
// No way to determine this from the type parameter itself, need to go back to the declaration
|
|
252
|
+
if (declaration?.modifiers?.some((m) => m.kind === ts.SyntaxKind.ConstKeyword)) {
|
|
253
|
+
paramRefl.flags.setFlag(ReflectionFlag.Const, true);
|
|
254
|
+
}
|
|
255
|
+
context.registerReflection(paramRefl, param.getSymbol());
|
|
256
|
+
context.converter.trigger(ConverterEvents.CREATE_TYPE_PARAMETER, context, paramRefl);
|
|
257
|
+
return paramRefl;
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
export function convertTypeParameterNodes(context, parameters) {
|
|
261
|
+
return parameters?.map((param) => createTypeParamReflection(param, context));
|
|
262
|
+
}
|
|
263
|
+
export function createTypeParamReflection(param, context) {
|
|
264
|
+
const paramRefl = new TypeParameterReflection(param.name.text, context.scope, getVariance(param.modifiers));
|
|
265
|
+
const paramScope = context.withScope(paramRefl);
|
|
266
|
+
if (ts.isJSDocTemplateTag(param.parent)) {
|
|
267
|
+
// With a @template tag, the constraint applies only to the
|
|
268
|
+
// first type parameter declared.
|
|
269
|
+
if (param.parent.typeParameters[0].name.text === param.name.text && param.parent.constraint) {
|
|
270
|
+
paramRefl.type = context.converter.convertType(paramScope, param.parent.constraint);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
paramRefl.type = param.constraint
|
|
275
|
+
? context.converter.convertType(paramScope, param.constraint)
|
|
276
|
+
: void 0;
|
|
277
|
+
}
|
|
278
|
+
paramRefl.default = param.default
|
|
279
|
+
? context.converter.convertType(paramScope, param.default)
|
|
280
|
+
: void 0;
|
|
281
|
+
if (param.modifiers?.some((m) => m.kind === ts.SyntaxKind.ConstKeyword)) {
|
|
282
|
+
paramRefl.flags.setFlag(ReflectionFlag.Const, true);
|
|
283
|
+
}
|
|
284
|
+
context.registerReflection(paramRefl, param.symbol);
|
|
285
|
+
if (ts.isJSDocTemplateTag(param.parent)) {
|
|
286
|
+
paramRefl.comment = context.getJsDocComment(param.parent);
|
|
287
|
+
}
|
|
288
|
+
context.converter.trigger(ConverterEvents.CREATE_TYPE_PARAMETER, context, paramRefl, param);
|
|
289
|
+
return paramRefl;
|
|
290
|
+
}
|
|
291
|
+
export function convertTemplateParameterNodes(context, nodes) {
|
|
292
|
+
return nodes?.flatMap((node) => {
|
|
293
|
+
return node.typeParameters.map((param, index) => {
|
|
294
|
+
const paramRefl = new TypeParameterReflection(param.name.text, context.scope, getVariance(param.modifiers));
|
|
295
|
+
const paramScope = context.withScope(paramRefl);
|
|
296
|
+
paramRefl.type = index || !node.constraint
|
|
297
|
+
? void 0
|
|
298
|
+
: context.converter.convertType(paramScope, node.constraint.type);
|
|
299
|
+
paramRefl.default = param.default
|
|
300
|
+
? context.converter.convertType(paramScope, param.default)
|
|
301
|
+
: void 0;
|
|
302
|
+
if (param.modifiers?.some((m) => m.kind === ts.SyntaxKind.ConstKeyword)) {
|
|
303
|
+
paramRefl.flags.setFlag(ReflectionFlag.Const, true);
|
|
304
|
+
}
|
|
305
|
+
context.registerReflection(paramRefl, param.symbol);
|
|
306
|
+
if (ts.isJSDocTemplateTag(param.parent)) {
|
|
307
|
+
paramRefl.comment = context.getJsDocComment(param.parent);
|
|
308
|
+
}
|
|
309
|
+
context.converter.trigger(ConverterEvents.CREATE_TYPE_PARAMETER, context, paramRefl, param);
|
|
310
|
+
return paramRefl;
|
|
311
|
+
});
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
function getVariance(modifiers) {
|
|
315
|
+
const hasIn = modifiers?.some((mod) => mod.kind === ts.SyntaxKind.InKeyword);
|
|
316
|
+
const hasOut = modifiers?.some((mod) => mod.kind === ts.SyntaxKind.OutKeyword);
|
|
317
|
+
if (hasIn && hasOut) {
|
|
318
|
+
return VarianceModifier.inOut;
|
|
319
|
+
}
|
|
320
|
+
if (hasIn) {
|
|
321
|
+
return VarianceModifier.in;
|
|
322
|
+
}
|
|
323
|
+
if (hasOut) {
|
|
324
|
+
return VarianceModifier.out;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
function convertPredicate(predicate, context) {
|
|
328
|
+
let name;
|
|
329
|
+
switch (predicate.kind) {
|
|
330
|
+
case ts.TypePredicateKind.This:
|
|
331
|
+
case ts.TypePredicateKind.AssertsThis:
|
|
332
|
+
name = "this";
|
|
333
|
+
break;
|
|
334
|
+
case ts.TypePredicateKind.Identifier:
|
|
335
|
+
case ts.TypePredicateKind.AssertsIdentifier:
|
|
336
|
+
name = predicate.parameterName;
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
339
|
+
let asserts;
|
|
340
|
+
switch (predicate.kind) {
|
|
341
|
+
case ts.TypePredicateKind.This:
|
|
342
|
+
case ts.TypePredicateKind.Identifier:
|
|
343
|
+
asserts = false;
|
|
344
|
+
break;
|
|
345
|
+
case ts.TypePredicateKind.AssertsThis:
|
|
346
|
+
case ts.TypePredicateKind.AssertsIdentifier:
|
|
347
|
+
asserts = true;
|
|
348
|
+
break;
|
|
349
|
+
}
|
|
350
|
+
return new PredicateType(name, asserts, predicate.type
|
|
351
|
+
? context.converter.convertType(context, predicate.type)
|
|
352
|
+
: void 0);
|
|
353
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ReflectionSymbolId } from "#models";
|
|
2
|
+
import { findPackageForPath, getQualifiedName, normalizePath, resolveDeclarationMaps } from "#node-utils";
|
|
3
|
+
import {} from "#utils";
|
|
4
|
+
import { relative } from "node:path";
|
|
5
|
+
import ts from "typescript";
|
|
6
|
+
let transientCount = 0;
|
|
7
|
+
const transientIds = new WeakMap();
|
|
8
|
+
// Don't use this directly, use Context.createSymbolId instead.
|
|
9
|
+
export function createSymbolIdImpl(symbol, declaration) {
|
|
10
|
+
declaration ??= symbol.declarations?.[0];
|
|
11
|
+
const tsSource = declaration?.getSourceFile().fileName ?? "";
|
|
12
|
+
const sourceFileName = resolveDeclarationMaps(tsSource);
|
|
13
|
+
let packageName;
|
|
14
|
+
let packagePath;
|
|
15
|
+
const packageInfo = findPackageForPath(tsSource);
|
|
16
|
+
if (packageInfo) {
|
|
17
|
+
let packageDir;
|
|
18
|
+
[packageName, packageDir] = packageInfo;
|
|
19
|
+
packagePath = normalizePath(relative(packageDir, sourceFileName));
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
packageName = ReflectionSymbolId.UNKNOWN_PACKAGE;
|
|
23
|
+
packagePath = normalizePath(sourceFileName);
|
|
24
|
+
}
|
|
25
|
+
let qualifiedName;
|
|
26
|
+
if (symbol.declarations?.some(ts.isSourceFile)) {
|
|
27
|
+
qualifiedName = "";
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
qualifiedName = getQualifiedName(symbol, symbol.name);
|
|
31
|
+
}
|
|
32
|
+
const pos = declaration?.getStart() ?? Infinity;
|
|
33
|
+
let transientId = NaN;
|
|
34
|
+
if (symbol.flags & ts.SymbolFlags.Transient) {
|
|
35
|
+
transientId = transientIds.get(symbol) ?? ++transientCount;
|
|
36
|
+
transientIds.set(symbol, transientId);
|
|
37
|
+
}
|
|
38
|
+
const id = new ReflectionSymbolId({
|
|
39
|
+
packageName,
|
|
40
|
+
packagePath,
|
|
41
|
+
qualifiedName,
|
|
42
|
+
});
|
|
43
|
+
id.pos = pos;
|
|
44
|
+
id.transientId = transientId;
|
|
45
|
+
id.fileName = normalizePath(sourceFileName);
|
|
46
|
+
return id;
|
|
47
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { CommentParserConfig } from "./comments/index.js";
|
|
2
|
+
export type { ExternalResolveResult, ExternalSymbolResolver } from "./comments/linkResolver.js";
|
|
3
|
+
export { Context } from "./context.js";
|
|
4
|
+
export { convertDefaultValue, convertExpression } from "./convert-expression.js";
|
|
5
|
+
export { Converter, type ConverterEvents } from "./converter.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import type { Context } from "./context.js";
|
|
3
|
+
export declare function convertJsDocAlias(context: Context, symbol: ts.Symbol, declaration: ts.JSDocTypedefTag | ts.JSDocEnumTag, exportSymbol?: ts.Symbol): undefined;
|
|
4
|
+
export declare function convertJsDocCallback(context: Context, symbol: ts.Symbol, declaration: ts.JSDocCallbackTag, exportSymbol?: ts.Symbol): void;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// Converter functions for JSDoc defined types
|
|
2
|
+
// @typedef
|
|
3
|
+
// @callback
|
|
4
|
+
import { ok } from "assert";
|
|
5
|
+
import ts from "typescript";
|
|
6
|
+
import { DeclarationReflection, IntrinsicType, ReflectionKind, ReflectionType, SignatureReflection, } from "../models/index.js";
|
|
7
|
+
import { ConverterEvents } from "./converter-events.js";
|
|
8
|
+
import { convertConstructSignatures, convertParameterNodes, convertTemplateParameterNodes, createSignature, } from "./factories/signature.js";
|
|
9
|
+
import { i18n } from "#utils";
|
|
10
|
+
import { convertIndexSignatures } from "./factories/index-signature.js";
|
|
11
|
+
// This is almost convertTypeAliasAsInterface, but unfortunately needs to be separate
|
|
12
|
+
// due to type parameters being different in JSDoc comments
|
|
13
|
+
function convertJsDocAliasAsInterface(context, symbol, exportSymbol, declaration) {
|
|
14
|
+
const reflection = context.createDeclarationReflection(ReflectionKind.Interface, symbol, exportSymbol);
|
|
15
|
+
context.finalizeDeclarationReflection(reflection);
|
|
16
|
+
const rc = context.withScope(reflection);
|
|
17
|
+
const type = context.checker.getTypeAtLocation(declaration);
|
|
18
|
+
if (type.getFlags() & ts.TypeFlags.Union) {
|
|
19
|
+
context.logger.warn(i18n.converting_union_as_interface(), declaration);
|
|
20
|
+
}
|
|
21
|
+
// Interfaces have properties
|
|
22
|
+
for (const prop of type.getProperties()) {
|
|
23
|
+
context.converter.convertSymbol(rc, prop);
|
|
24
|
+
}
|
|
25
|
+
// And type parameters
|
|
26
|
+
convertTemplateParameters(rc, declaration.parent);
|
|
27
|
+
// And maybe call signatures
|
|
28
|
+
context.checker
|
|
29
|
+
.getSignaturesOfType(type, ts.SignatureKind.Call)
|
|
30
|
+
.forEach((sig) => createSignature(rc, ReflectionKind.CallSignature, sig, symbol));
|
|
31
|
+
// And maybe constructor signatures
|
|
32
|
+
convertConstructSignatures(rc, symbol);
|
|
33
|
+
// And finally, index signatures
|
|
34
|
+
convertIndexSignatures(rc, type);
|
|
35
|
+
}
|
|
36
|
+
export function convertJsDocAlias(context, symbol, declaration, exportSymbol) {
|
|
37
|
+
if (declaration.typeExpression &&
|
|
38
|
+
ts.isJSDocTypeLiteral(declaration.typeExpression)) {
|
|
39
|
+
convertJsDocInterface(context, declaration, symbol, exportSymbol);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const comment = context.getJsDocComment(declaration);
|
|
43
|
+
if (comment?.hasModifier("@interface")) {
|
|
44
|
+
return convertJsDocAliasAsInterface(context, symbol, exportSymbol, declaration);
|
|
45
|
+
}
|
|
46
|
+
// If the typedef tag is just referring to another type-space symbol, with no type parameters
|
|
47
|
+
// or appropriate forwarding type parameters, then we treat it as a re-export instead of creating
|
|
48
|
+
// a type alias with an import type.
|
|
49
|
+
const aliasedSymbol = getTypedefReExportTarget(context, declaration);
|
|
50
|
+
if (aliasedSymbol) {
|
|
51
|
+
context.converter.convertSymbol(context, aliasedSymbol, exportSymbol ?? symbol);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const reflection = context.createDeclarationReflection(ReflectionKind.TypeAlias, symbol, exportSymbol);
|
|
55
|
+
reflection.comment = comment;
|
|
56
|
+
reflection.type = context.converter.convertType(context.withScope(reflection), declaration.typeExpression?.type);
|
|
57
|
+
convertTemplateParameters(context.withScope(reflection), declaration.parent);
|
|
58
|
+
context.finalizeDeclarationReflection(reflection);
|
|
59
|
+
}
|
|
60
|
+
export function convertJsDocCallback(context, symbol, declaration, exportSymbol) {
|
|
61
|
+
const alias = context.createDeclarationReflection(ReflectionKind.TypeAlias, symbol, exportSymbol);
|
|
62
|
+
alias.comment = context.getJsDocComment(declaration);
|
|
63
|
+
context.finalizeDeclarationReflection(alias);
|
|
64
|
+
const ac = context.withScope(alias);
|
|
65
|
+
alias.type = convertJsDocSignature(ac, declaration.typeExpression);
|
|
66
|
+
convertTemplateParameters(ac, declaration.parent);
|
|
67
|
+
}
|
|
68
|
+
function convertJsDocInterface(context, declaration, symbol, exportSymbol) {
|
|
69
|
+
const reflection = context.createDeclarationReflection(ReflectionKind.Interface, symbol, exportSymbol);
|
|
70
|
+
reflection.comment = context.getJsDocComment(declaration);
|
|
71
|
+
context.finalizeDeclarationReflection(reflection);
|
|
72
|
+
const rc = context.withScope(reflection);
|
|
73
|
+
const type = context.checker.getDeclaredTypeOfSymbol(symbol);
|
|
74
|
+
for (const s of type.getProperties()) {
|
|
75
|
+
context.converter.convertSymbol(rc, s);
|
|
76
|
+
}
|
|
77
|
+
convertTemplateParameters(rc, declaration.parent);
|
|
78
|
+
}
|
|
79
|
+
function convertJsDocSignature(context, node) {
|
|
80
|
+
const symbol = context.getSymbolAtLocation(node) ?? node.symbol;
|
|
81
|
+
const type = context.getTypeAtLocation(node);
|
|
82
|
+
if (!symbol || !type) {
|
|
83
|
+
return new IntrinsicType("Function");
|
|
84
|
+
}
|
|
85
|
+
const reflection = new DeclarationReflection("__type", ReflectionKind.TypeLiteral, context.scope);
|
|
86
|
+
const rc = context.withScope(reflection);
|
|
87
|
+
context.registerReflection(reflection, symbol);
|
|
88
|
+
context.converter.trigger(ConverterEvents.CREATE_DECLARATION, context, reflection);
|
|
89
|
+
const signature = new SignatureReflection("__type", ReflectionKind.CallSignature, reflection);
|
|
90
|
+
context.project.registerSymbolId(signature, context.createSymbolId(symbol, node));
|
|
91
|
+
context.registerReflection(signature, void 0);
|
|
92
|
+
const signatureCtx = rc.withScope(signature);
|
|
93
|
+
reflection.signatures = [signature];
|
|
94
|
+
signature.type = context.converter.convertType(signatureCtx, node.type?.typeExpression?.type);
|
|
95
|
+
signature.parameters = convertParameterNodes(signatureCtx, signature, node.parameters);
|
|
96
|
+
signature.typeParameters = convertTemplateParameterNodes(context.withScope(reflection), node.typeParameters);
|
|
97
|
+
return new ReflectionType(reflection);
|
|
98
|
+
}
|
|
99
|
+
function convertTemplateParameters(context, node) {
|
|
100
|
+
ok(context.scope instanceof DeclarationReflection);
|
|
101
|
+
context.scope.typeParameters = convertTemplateParameterNodes(context, node.tags?.filter(ts.isJSDocTemplateTag));
|
|
102
|
+
}
|
|
103
|
+
function getTypedefReExportTarget(context, declaration) {
|
|
104
|
+
const typeExpression = declaration.typeExpression;
|
|
105
|
+
if (!ts.isJSDocTypedefTag(declaration) ||
|
|
106
|
+
!typeExpression ||
|
|
107
|
+
ts.isJSDocTypeLiteral(typeExpression) ||
|
|
108
|
+
!ts.isImportTypeNode(typeExpression.type) ||
|
|
109
|
+
!typeExpression.type.qualifier ||
|
|
110
|
+
!ts.isIdentifier(typeExpression.type.qualifier)) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const targetSymbol = context.expectSymbolAtLocation(typeExpression.type.qualifier);
|
|
114
|
+
const decl = targetSymbol.declarations?.[0];
|
|
115
|
+
if (!decl ||
|
|
116
|
+
!(ts.isTypeAliasDeclaration(decl) ||
|
|
117
|
+
ts.isInterfaceDeclaration(decl) ||
|
|
118
|
+
ts.isJSDocTypedefTag(decl) ||
|
|
119
|
+
ts.isJSDocCallbackTag(decl))) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const targetParams = ts.getEffectiveTypeParameterDeclarations(decl);
|
|
123
|
+
const localParams = ts.getEffectiveTypeParameterDeclarations(declaration);
|
|
124
|
+
const localArgs = typeExpression.type.typeArguments || [];
|
|
125
|
+
// If we have type parameters, ensure they are forwarding parameters with no transformations.
|
|
126
|
+
// This doesn't check constraints since they aren't checked in JSDoc types.
|
|
127
|
+
if (targetParams.length !== localParams.length ||
|
|
128
|
+
localArgs.some((arg, i) => !ts.isTypeReferenceNode(arg) ||
|
|
129
|
+
!ts.isIdentifier(arg.typeName) ||
|
|
130
|
+
arg.typeArguments ||
|
|
131
|
+
localParams[i]?.name.text !== arg.typeName.text)) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
return targetSymbol;
|
|
135
|
+
}
|