typedoc 0.26.10 → 0.27.0-beta.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/bin/package.json +3 -0
- package/bin/typedoc +1 -1
- package/dist/index.d.ts +23 -13
- package/dist/index.js +22 -81
- package/dist/lib/application-events.js +1 -4
- package/dist/lib/application.d.ts +26 -16
- package/dist/lib/application.js +222 -242
- package/dist/lib/cli.js +3 -40
- package/dist/lib/converter/comments/blockLexer.d.ts +1 -1
- package/dist/lib/converter/comments/blockLexer.js +24 -30
- package/dist/lib/converter/comments/declarationReference.js +10 -21
- package/dist/lib/converter/comments/declarationReferenceResolver.d.ts +2 -2
- package/dist/lib/converter/comments/declarationReferenceResolver.js +40 -36
- package/dist/lib/converter/comments/discovery.d.ts +4 -4
- package/dist/lib/converter/comments/discovery.js +172 -148
- package/dist/lib/converter/comments/index.d.ts +4 -4
- package/dist/lib/converter/comments/index.js +39 -50
- package/dist/lib/converter/comments/lexer.d.ts +1 -1
- package/dist/lib/converter/comments/lexer.js +2 -5
- package/dist/lib/converter/comments/lineLexer.d.ts +1 -1
- package/dist/lib/converter/comments/lineLexer.js +12 -15
- package/dist/lib/converter/comments/linkResolver.d.ts +2 -2
- package/dist/lib/converter/comments/linkResolver.js +14 -21
- package/dist/lib/converter/comments/parser.d.ts +6 -6
- package/dist/lib/converter/comments/parser.js +69 -96
- package/dist/lib/converter/comments/rawLexer.d.ts +1 -1
- package/dist/lib/converter/comments/rawLexer.js +13 -16
- package/dist/lib/converter/comments/tagName.js +1 -4
- package/dist/lib/converter/comments/textParser.d.ts +4 -4
- package/dist/lib/converter/comments/textParser.js +28 -30
- package/dist/lib/converter/components.d.ts +2 -3
- package/dist/lib/converter/components.js +2 -7
- package/dist/lib/converter/context.d.ts +9 -9
- package/dist/lib/converter/context.js +54 -44
- package/dist/lib/converter/convert-expression.js +16 -23
- package/dist/lib/converter/converter-events.d.ts +1 -0
- package/dist/lib/converter/converter-events.js +2 -4
- package/dist/lib/converter/converter.d.ts +16 -13
- package/dist/lib/converter/converter.js +210 -238
- package/dist/lib/converter/factories/index-signature.d.ts +1 -1
- package/dist/lib/converter/factories/index-signature.js +11 -17
- package/dist/lib/converter/factories/signature.d.ts +2 -2
- package/dist/lib/converter/factories/signature.js +95 -106
- package/dist/lib/converter/index.d.ts +6 -7
- package/dist/lib/converter/index.js +3 -11
- package/dist/lib/converter/jsdoc.d.ts +1 -1
- package/dist/lib/converter/jsdoc.js +34 -41
- package/dist/lib/converter/plugins/CategoryPlugin.d.ts +6 -21
- package/dist/lib/converter/plugins/CategoryPlugin.js +57 -139
- package/dist/lib/converter/plugins/CommentPlugin.d.ts +3 -5
- package/dist/lib/converter/plugins/CommentPlugin.js +153 -163
- package/dist/lib/converter/plugins/GroupPlugin.d.ts +10 -9
- package/dist/lib/converter/plugins/GroupPlugin.js +87 -124
- package/dist/lib/converter/plugins/ImplementsPlugin.d.ts +3 -5
- package/dist/lib/converter/plugins/ImplementsPlugin.js +255 -321
- package/dist/lib/converter/plugins/IncludePlugin.d.ts +11 -0
- package/dist/lib/converter/plugins/IncludePlugin.js +72 -0
- package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +4 -3
- package/dist/lib/converter/plugins/InheritDocPlugin.js +41 -72
- package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +5 -5
- package/dist/lib/converter/plugins/LinkResolverPlugin.js +37 -58
- package/dist/lib/converter/plugins/MergeModuleWithPlugin.d.ts +12 -0
- package/dist/lib/converter/plugins/MergeModuleWithPlugin.js +49 -0
- package/dist/lib/converter/plugins/PackagePlugin.d.ts +4 -3
- package/dist/lib/converter/plugins/PackagePlugin.js +62 -111
- package/dist/lib/converter/plugins/SourcePlugin.d.ts +3 -5
- package/dist/lib/converter/plugins/SourcePlugin.js +69 -110
- package/dist/lib/converter/plugins/TypePlugin.d.ts +4 -6
- package/dist/lib/converter/plugins/TypePlugin.js +95 -158
- package/dist/lib/converter/plugins/index.d.ts +10 -9
- package/dist/lib/converter/plugins/index.js +10 -21
- package/dist/lib/converter/symbols.d.ts +1 -1
- package/dist/lib/converter/symbols.js +234 -227
- package/dist/lib/converter/types.d.ts +2 -2
- package/dist/lib/converter/types.js +252 -237
- package/dist/lib/converter/utils/nodes.js +5 -13
- package/dist/lib/converter/utils/reflections.d.ts +1 -1
- package/dist/lib/converter/utils/reflections.js +4 -7
- package/dist/lib/converter/utils/repository.d.ts +1 -1
- package/dist/lib/converter/utils/repository.js +103 -97
- package/dist/lib/converter/utils/symbols.js +3 -9
- package/dist/lib/internationalization/index.d.ts +3 -4
- package/dist/lib/internationalization/index.js +3 -8
- package/dist/lib/internationalization/internationalization.d.ts +5 -4
- package/dist/lib/internationalization/internationalization.js +97 -103
- package/dist/lib/internationalization/locale-utils.cjs +8 -0
- package/dist/lib/internationalization/locale-utils.d.cts +8 -0
- package/dist/lib/internationalization/locales/en.cjs +366 -2
- package/dist/lib/internationalization/locales/en.d.cts +339 -2
- package/dist/lib/internationalization/locales/jp.cjs +8 -11
- package/dist/lib/internationalization/locales/jp.d.cts +310 -1
- package/dist/lib/internationalization/locales/ko.cjs +7 -9
- package/dist/lib/internationalization/locales/ko.d.cts +223 -1
- package/dist/lib/internationalization/locales/zh.cjs +7 -10
- package/dist/lib/internationalization/locales/zh.d.cts +381 -1
- package/dist/lib/internationalization/translatable.d.ts +4 -327
- package/dist/lib/internationalization/translatable.js +2 -360
- package/dist/lib/models/FileRegistry.d.ts +20 -9
- package/dist/lib/models/FileRegistry.js +54 -45
- package/dist/lib/models/ReflectionCategory.d.ts +2 -2
- package/dist/lib/models/ReflectionCategory.js +16 -12
- package/dist/lib/models/ReflectionGroup.d.ts +3 -3
- package/dist/lib/models/ReflectionGroup.js +23 -14
- package/dist/lib/models/comments/comment.d.ts +23 -37
- package/dist/lib/models/comments/comment.js +388 -325
- package/dist/lib/models/comments/index.d.ts +2 -2
- package/dist/lib/models/comments/index.js +1 -6
- package/dist/lib/models/index.d.ts +7 -7
- package/dist/lib/models/index.js +7 -23
- package/dist/lib/models/reflections/ReflectionSymbolId.d.ts +2 -2
- package/dist/lib/models/reflections/ReflectionSymbolId.js +42 -34
- package/dist/lib/models/reflections/abstract.d.ts +17 -20
- package/dist/lib/models/reflections/abstract.js +249 -256
- package/dist/lib/models/reflections/container.d.ts +7 -7
- package/dist/lib/models/reflections/container.js +43 -16
- package/dist/lib/models/reflections/declaration.d.ts +15 -12
- package/dist/lib/models/reflections/declaration.js +150 -29
- package/dist/lib/models/reflections/document.d.ts +3 -3
- package/dist/lib/models/reflections/document.js +26 -13
- package/dist/lib/models/reflections/index.d.ts +15 -15
- package/dist/lib/models/reflections/index.js +12 -31
- package/dist/lib/models/reflections/kind.d.ts +1 -1
- package/dist/lib/models/reflections/kind.js +3 -6
- package/dist/lib/models/reflections/parameter.d.ts +5 -4
- package/dist/lib/models/reflections/parameter.js +11 -13
- package/dist/lib/models/reflections/project.d.ts +14 -9
- package/dist/lib/models/reflections/project.js +104 -56
- package/dist/lib/models/reflections/reference.d.ts +3 -3
- package/dist/lib/models/reflections/reference.js +6 -9
- package/dist/lib/models/reflections/signature.d.ts +8 -8
- package/dist/lib/models/reflections/signature.js +35 -14
- package/dist/lib/models/reflections/type-parameter.d.ts +5 -5
- package/dist/lib/models/reflections/type-parameter.js +9 -10
- package/dist/lib/models/reflections/utils.js +1 -4
- package/dist/lib/models/reflections/variant.d.ts +8 -7
- package/dist/lib/models/reflections/variant.js +1 -2
- package/dist/lib/models/sources/file.d.ts +2 -2
- package/dist/lib/models/sources/file.js +22 -5
- package/dist/lib/models/sources/index.d.ts +1 -1
- package/dist/lib/models/sources/index.js +1 -5
- package/dist/lib/models/types.d.ts +26 -13
- package/dist/lib/models/types.js +236 -151
- package/dist/lib/output/components.d.ts +5 -11
- package/dist/lib/output/components.js +84 -125
- package/dist/lib/output/events.d.ts +3 -3
- package/dist/lib/output/events.js +128 -94
- package/dist/lib/output/formatter.d.ts +84 -0
- package/dist/lib/output/formatter.js +619 -0
- package/dist/lib/output/index.d.ts +9 -8
- package/dist/lib/output/index.js +7 -19
- package/dist/lib/output/models/UrlMapping.d.ts +2 -2
- package/dist/lib/output/models/UrlMapping.js +4 -5
- package/dist/lib/output/output.d.ts +13 -0
- package/dist/lib/output/output.js +72 -0
- package/dist/lib/output/plugins/AssetsPlugin.d.ts +7 -8
- package/dist/lib/output/plugins/AssetsPlugin.js +62 -80
- package/dist/lib/output/plugins/IconsPlugin.d.ts +3 -2
- package/dist/lib/output/plugins/IconsPlugin.js +28 -84
- package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +9 -2
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +90 -96
- package/dist/lib/output/plugins/NavigationPlugin.d.ts +3 -2
- package/dist/lib/output/plugins/NavigationPlugin.js +22 -102
- package/dist/lib/output/plugins/SitemapPlugin.d.ts +3 -2
- package/dist/lib/output/plugins/SitemapPlugin.js +60 -120
- package/dist/lib/output/plugins/index.d.ts +6 -6
- package/dist/lib/output/plugins/index.js +6 -15
- package/dist/lib/output/renderer.d.ts +14 -13
- package/dist/lib/output/renderer.js +129 -185
- package/dist/lib/output/theme.d.ts +9 -5
- package/dist/lib/output/theme.js +14 -62
- package/dist/lib/output/themes/MarkedPlugin.d.ts +8 -9
- package/dist/lib/output/themes/MarkedPlugin.js +152 -117
- package/dist/lib/output/themes/default/DefaultTheme.d.ts +17 -29
- package/dist/lib/output/themes/default/DefaultTheme.js +334 -310
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +63 -48
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +119 -95
- package/dist/lib/output/themes/default/Slugger.d.ts +13 -0
- package/dist/lib/output/themes/default/Slugger.js +46 -0
- package/dist/lib/output/themes/default/layouts/default.d.ts +5 -5
- package/dist/lib/output/themes/default/layouts/default.js +67 -34
- package/dist/lib/output/themes/default/partials/anchor-icon.d.ts +2 -2
- package/dist/lib/output/themes/default/partials/anchor-icon.js +4 -7
- package/dist/lib/output/themes/default/partials/breadcrumb.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/breadcrumb.js +4 -8
- package/dist/lib/output/themes/default/partials/comment.d.ts +6 -4
- package/dist/lib/output/themes/default/partials/comment.js +52 -29
- package/dist/lib/output/themes/default/partials/footer.d.ts +2 -2
- package/dist/lib/output/themes/default/partials/footer.js +11 -14
- package/dist/lib/output/themes/default/partials/header.d.ts +4 -4
- package/dist/lib/output/themes/default/partials/header.js +9 -13
- package/dist/lib/output/themes/default/partials/hierarchy.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/hierarchy.js +9 -12
- package/dist/lib/output/themes/default/partials/icon.d.ts +4 -4
- package/dist/lib/output/themes/default/partials/icon.js +78 -73
- package/dist/lib/output/themes/default/partials/index.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/index.js +19 -22
- package/dist/lib/output/themes/default/partials/member.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.declaration.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.declaration.js +18 -61
- package/dist/lib/output/themes/default/partials/member.getterSetter.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.getterSetter.js +10 -26
- package/dist/lib/output/themes/default/partials/member.js +19 -24
- package/dist/lib/output/themes/default/partials/member.signature.body.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.signature.body.js +17 -21
- package/dist/lib/output/themes/default/partials/member.signature.title.d.ts +4 -7
- package/dist/lib/output/themes/default/partials/member.signature.title.js +8 -35
- package/dist/lib/output/themes/default/partials/member.signatures.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.signatures.js +9 -13
- package/dist/lib/output/themes/default/partials/member.sources.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.sources.js +13 -17
- package/dist/lib/output/themes/default/partials/members.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/members.js +10 -42
- package/dist/lib/output/themes/default/partials/moduleReflection.d.ts +5 -0
- package/dist/lib/output/themes/default/partials/moduleReflection.js +62 -0
- package/dist/lib/output/themes/default/partials/navigation.d.ts +4 -4
- package/dist/lib/output/themes/default/partials/navigation.js +51 -62
- package/dist/lib/output/themes/default/partials/reflectionPreview.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/reflectionPreview.js +12 -15
- package/dist/lib/output/themes/default/partials/toolbar.d.ts +4 -4
- package/dist/lib/output/themes/default/partials/toolbar.js +16 -20
- package/dist/lib/output/themes/default/partials/type.d.ts +4 -6
- package/dist/lib/output/themes/default/partials/type.js +8 -388
- package/dist/lib/output/themes/default/partials/typeAndParent.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/typeAndParent.js +11 -15
- package/dist/lib/output/themes/default/partials/typeDetails.d.ts +8 -0
- package/dist/lib/output/themes/default/partials/typeDetails.js +221 -0
- package/dist/lib/output/themes/default/partials/typeParameters.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/typeParameters.js +14 -17
- package/dist/lib/output/themes/default/templates/document.d.ts +4 -4
- package/dist/lib/output/themes/default/templates/document.js +3 -7
- package/dist/lib/output/themes/default/templates/hierarchy.d.ts +4 -4
- package/dist/lib/output/themes/default/templates/hierarchy.js +10 -13
- package/dist/lib/output/themes/default/templates/index.d.ts +4 -4
- package/dist/lib/output/themes/default/templates/index.js +3 -7
- package/dist/lib/output/themes/default/templates/reflection.d.ts +4 -4
- package/dist/lib/output/themes/default/templates/reflection.js +31 -34
- package/dist/lib/output/themes/lib.d.ts +17 -3
- package/dist/lib/output/themes/lib.js +110 -49
- package/dist/lib/serialization/components.d.ts +2 -5
- package/dist/lib/serialization/components.js +1 -2
- package/dist/lib/serialization/deserializer.d.ts +21 -7
- package/dist/lib/serialization/deserializer.js +138 -123
- package/dist/lib/serialization/events.d.ts +2 -2
- package/dist/lib/serialization/events.js +6 -5
- package/dist/lib/serialization/index.d.ts +5 -5
- package/dist/lib/serialization/index.js +4 -33
- package/dist/lib/serialization/schema.d.ts +8 -2
- package/dist/lib/serialization/schema.js +2 -2
- package/dist/lib/serialization/serializer.d.ts +11 -5
- package/dist/lib/serialization/serializer.js +32 -25
- package/dist/lib/utils/array.d.ts +3 -0
- package/dist/lib/utils/array.js +26 -27
- package/dist/lib/utils/component.d.ts +2 -44
- package/dist/lib/utils/component.js +10 -102
- package/dist/lib/utils/entry-point.d.ts +3 -4
- package/dist/lib/utils/entry-point.js +114 -85
- package/dist/lib/utils/enum.js +6 -14
- package/dist/lib/utils/events.js +6 -12
- package/dist/lib/utils/fs.js +50 -91
- package/dist/lib/utils/general.d.ts +2 -1
- package/dist/lib/utils/general.js +50 -40
- package/dist/lib/utils/highlighter.js +30 -57
- package/dist/lib/utils/hooks.js +7 -13
- 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 +8 -0
- package/dist/lib/utils/html.js +81 -34
- package/dist/lib/utils/index.d.ts +22 -22
- package/dist/lib/utils/index.js +20 -91
- package/dist/lib/utils/jsx.d.ts +12 -5
- package/dist/lib/utils/jsx.elements.js +1 -4
- package/dist/lib/utils/jsx.js +53 -20
- package/dist/lib/utils/loggers.d.ts +3 -3
- package/dist/lib/utils/loggers.js +36 -46
- package/dist/lib/utils/map.d.ts +1 -1
- package/dist/lib/utils/map.js +6 -13
- package/dist/lib/utils/minimalSourceFile.js +5 -7
- package/dist/lib/utils/options/declaration.d.ts +33 -7
- package/dist/lib/utils/options/declaration.js +20 -22
- package/dist/lib/utils/options/defaults.d.ts +3 -2
- package/dist/lib/utils/options/defaults.js +18 -38
- package/dist/lib/utils/options/help.d.ts +2 -2
- package/dist/lib/utils/options/help.js +7 -10
- package/dist/lib/utils/options/index.d.ts +6 -6
- package/dist/lib/utils/options/index.js +4 -18
- package/dist/lib/utils/options/options.d.ts +8 -5
- package/dist/lib/utils/options/options.js +47 -71
- package/dist/lib/utils/options/readers/arguments.d.ts +2 -2
- package/dist/lib/utils/options/readers/arguments.js +15 -17
- package/dist/lib/utils/options/readers/index.d.ts +4 -4
- package/dist/lib/utils/options/readers/index.js +4 -11
- package/dist/lib/utils/options/readers/package-json.d.ts +3 -3
- package/dist/lib/utils/options/readers/package-json.js +15 -21
- package/dist/lib/utils/options/readers/tsconfig.d.ts +2 -2
- package/dist/lib/utils/options/readers/tsconfig.js +54 -63
- package/dist/lib/utils/options/readers/typedoc.d.ts +3 -3
- package/dist/lib/utils/options/readers/typedoc.js +47 -90
- package/dist/lib/utils/options/sources/index.d.ts +1 -1
- package/dist/lib/utils/options/sources/index.js +1 -5
- package/dist/lib/utils/options/sources/typedoc.d.ts +1 -1
- package/dist/lib/utils/options/sources/typedoc.js +220 -196
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +3 -3
- package/dist/lib/utils/options/tsdoc-defaults.js +16 -12
- package/dist/lib/utils/package-manifest.d.ts +1 -1
- package/dist/lib/utils/package-manifest.js +15 -19
- package/dist/lib/utils/paths.js +9 -15
- package/dist/lib/utils/perf.js +6 -11
- package/dist/lib/utils/plugins.d.ts +1 -1
- package/dist/lib/utils/plugins.js +16 -17
- package/dist/lib/utils/reflections.d.ts +1 -1
- package/dist/lib/utils/reflections.js +9 -12
- package/dist/lib/utils/set.js +2 -6
- package/dist/lib/utils/sort.d.ts +3 -3
- package/dist/lib/utils/sort.js +20 -24
- package/dist/lib/utils/tsconfig.d.ts +1 -1
- package/dist/lib/utils/tsconfig.js +13 -21
- package/dist/lib/utils/tsutils.d.ts +1 -1
- package/dist/lib/utils/tsutils.js +3 -30
- package/dist/lib/utils/validation.js +6 -12
- package/dist/lib/validation/documentation.d.ts +2 -2
- package/dist/lib/validation/documentation.js +26 -29
- package/dist/lib/validation/exports.d.ts +2 -2
- package/dist/lib/validation/exports.js +9 -11
- package/dist/lib/validation/links.d.ts +2 -2
- package/dist/lib/validation/links.js +4 -7
- package/dist/lib/validation/unusedMergeModuleWith.d.ts +3 -0
- package/dist/lib/validation/unusedMergeModuleWith.js +11 -0
- package/package.json +14 -11
- package/static/main.js +4 -4
- package/static/style.css +91 -2
- package/tsdoc.json +30 -0
- package/dist/lib/output/themes/default/partials/member.reference.d.ts +0 -4
- package/dist/lib/output/themes/default/partials/member.reference.js +0 -30
- package/dist/lib/output/themes/default/partials/parameter.d.ts +0 -4
- package/dist/lib/output/themes/default/partials/parameter.js +0 -79
- package/dist/lib/utils/html-entities.json +0 -2326
|
@@ -1,39 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.getDisplayName = getDisplayName;
|
|
5
|
-
exports.toStyleClass = toStyleClass;
|
|
6
|
-
exports.getKindClass = getKindClass;
|
|
7
|
-
exports.wbr = wbr;
|
|
8
|
-
exports.join = join;
|
|
9
|
-
exports.classNames = classNames;
|
|
10
|
-
exports.hasTypeParameters = hasTypeParameters;
|
|
11
|
-
exports.renderTypeParametersSignature = renderTypeParametersSignature;
|
|
12
|
-
exports.renderName = renderName;
|
|
13
|
-
exports.getHierarchyRoots = getHierarchyRoots;
|
|
14
|
-
const models_1 = require("../../models");
|
|
15
|
-
const utils_1 = require("../../utils");
|
|
16
|
-
function stringify(data) {
|
|
1
|
+
import { DeclarationReflection, ProjectReflection, ReferenceReflection, ReflectionKind, SignatureReflection, } from "../../models/index.js";
|
|
2
|
+
import { DefaultMap, filterMap, JSX } from "../../utils/index.js";
|
|
3
|
+
export function stringify(data) {
|
|
17
4
|
if (typeof data === "bigint") {
|
|
18
5
|
return data.toString() + "n";
|
|
19
6
|
}
|
|
20
7
|
return JSON.stringify(data);
|
|
21
8
|
}
|
|
22
|
-
function getDisplayName(refl) {
|
|
9
|
+
export function getDisplayName(refl) {
|
|
23
10
|
let version = "";
|
|
24
|
-
if ((refl instanceof
|
|
11
|
+
if ((refl instanceof DeclarationReflection || refl instanceof ProjectReflection) && refl.packageVersion) {
|
|
25
12
|
version = ` - v${refl.packageVersion}`;
|
|
26
13
|
}
|
|
27
14
|
return `${refl.name}${version}`;
|
|
28
15
|
}
|
|
29
|
-
function toStyleClass(str) {
|
|
16
|
+
export function toStyleClass(str) {
|
|
30
17
|
return str.replace(/(\w)([A-Z])/g, (_m, m1, m2) => m1 + "-" + m2).toLowerCase();
|
|
31
18
|
}
|
|
32
|
-
function getKindClass(refl) {
|
|
33
|
-
if (refl instanceof
|
|
19
|
+
export function getKindClass(refl) {
|
|
20
|
+
if (refl instanceof ReferenceReflection) {
|
|
34
21
|
return getKindClass(refl.getTargetReflectionDeep());
|
|
35
22
|
}
|
|
36
|
-
return
|
|
23
|
+
return ReflectionKind.classString(refl.kind);
|
|
37
24
|
}
|
|
38
25
|
/**
|
|
39
26
|
* Insert word break tags ``<wbr>`` into the given string.
|
|
@@ -43,20 +30,20 @@ function getKindClass(refl) {
|
|
|
43
30
|
* @param str The string that should be split.
|
|
44
31
|
* @return The original string containing ``<wbr>`` tags where possible.
|
|
45
32
|
*/
|
|
46
|
-
function wbr(str) {
|
|
33
|
+
export function wbr(str) {
|
|
47
34
|
// TODO surely there is a better way to do this, but I'm tired.
|
|
48
35
|
const ret = [];
|
|
49
36
|
const re = /[\s\S]*?(?:[^_-][_-](?=[^_-])|[^A-Z](?=[A-Z][^A-Z]))/g;
|
|
50
37
|
let match;
|
|
51
38
|
let i = 0;
|
|
52
39
|
while ((match = re.exec(str))) {
|
|
53
|
-
ret.push(match[0],
|
|
40
|
+
ret.push(match[0], JSX.createElement("wbr", null));
|
|
54
41
|
i += match[0].length;
|
|
55
42
|
}
|
|
56
43
|
ret.push(str.slice(i));
|
|
57
44
|
return ret;
|
|
58
45
|
}
|
|
59
|
-
function join(joiner, list, cb) {
|
|
46
|
+
export function join(joiner, list, cb) {
|
|
60
47
|
const result = [];
|
|
61
48
|
for (const item of list) {
|
|
62
49
|
if (result.length > 0) {
|
|
@@ -64,9 +51,9 @@ function join(joiner, list, cb) {
|
|
|
64
51
|
}
|
|
65
52
|
result.push(cb(item));
|
|
66
53
|
}
|
|
67
|
-
return
|
|
54
|
+
return JSX.createElement(JSX.Fragment, null, result);
|
|
68
55
|
}
|
|
69
|
-
function classNames(names, extraCss) {
|
|
56
|
+
export function classNames(names, extraCss) {
|
|
70
57
|
const css = Object.keys(names)
|
|
71
58
|
.filter((key) => names[key])
|
|
72
59
|
.concat(extraCss || "")
|
|
@@ -75,48 +62,48 @@ function classNames(names, extraCss) {
|
|
|
75
62
|
.replace(/\s+/g, " ");
|
|
76
63
|
return css.length ? css : undefined;
|
|
77
64
|
}
|
|
78
|
-
function hasTypeParameters(reflection) {
|
|
79
|
-
return ((reflection instanceof
|
|
65
|
+
export function hasTypeParameters(reflection) {
|
|
66
|
+
return ((reflection instanceof DeclarationReflection || reflection instanceof SignatureReflection) &&
|
|
80
67
|
reflection.typeParameters != null &&
|
|
81
68
|
reflection.typeParameters.length > 0);
|
|
82
69
|
}
|
|
83
|
-
function renderTypeParametersSignature(context, typeParameters) {
|
|
70
|
+
export function renderTypeParametersSignature(context, typeParameters) {
|
|
84
71
|
if (!typeParameters || typeParameters.length === 0)
|
|
85
|
-
return
|
|
86
|
-
const hideParamTypes = context.options.getValue("
|
|
72
|
+
return JSX.createElement(JSX.Fragment, null);
|
|
73
|
+
const hideParamTypes = false; // context.options.getValue("hideTypesInSignatureTitle");
|
|
87
74
|
if (hideParamTypes) {
|
|
88
|
-
return (
|
|
89
|
-
|
|
90
|
-
join(
|
|
91
|
-
item.flags.isConst &&
|
|
75
|
+
return (JSX.createElement(JSX.Fragment, null,
|
|
76
|
+
JSX.createElement("span", { class: "tsd-signature-symbol" }, "<"),
|
|
77
|
+
join(JSX.createElement("span", { class: "tsd-signature-symbol" }, ", "), typeParameters, (item) => (JSX.createElement(JSX.Fragment, null,
|
|
78
|
+
item.flags.isConst && JSX.createElement("span", { class: "tsd-signature-keyword" }, "const "),
|
|
92
79
|
item.varianceModifier ? `${item.varianceModifier} ` : "",
|
|
93
|
-
|
|
94
|
-
|
|
80
|
+
JSX.createElement("a", { class: "tsd-signature-type tsd-kind-type-parameter", href: context.urlTo(item) }, item.name)))),
|
|
81
|
+
JSX.createElement("span", { class: "tsd-signature-symbol" }, ">")));
|
|
95
82
|
}
|
|
96
|
-
return (
|
|
97
|
-
|
|
98
|
-
join(
|
|
83
|
+
return (JSX.createElement(JSX.Fragment, null,
|
|
84
|
+
JSX.createElement("span", { class: "tsd-signature-symbol" }, "<"),
|
|
85
|
+
join(JSX.createElement("span", { class: "tsd-signature-symbol" }, ", "), typeParameters, (item) => (JSX.createElement(JSX.Fragment, null,
|
|
99
86
|
item.flags.isConst && "const ",
|
|
100
87
|
item.varianceModifier ? `${item.varianceModifier} ` : "",
|
|
101
|
-
|
|
102
|
-
!!item.type && (
|
|
103
|
-
|
|
88
|
+
JSX.createElement("span", { class: "tsd-signature-type tsd-kind-type-parameter" }, item.name),
|
|
89
|
+
!!item.type && (JSX.createElement(JSX.Fragment, null,
|
|
90
|
+
JSX.createElement("span", { class: "tsd-signature-keyword" }, " extends "),
|
|
104
91
|
context.type(item.type)))))),
|
|
105
|
-
|
|
92
|
+
JSX.createElement("span", { class: "tsd-signature-symbol" }, ">")));
|
|
106
93
|
}
|
|
107
94
|
/**
|
|
108
95
|
* Renders the reflection name with an additional `?` if optional.
|
|
109
96
|
*/
|
|
110
|
-
function renderName(refl) {
|
|
97
|
+
export function renderName(refl) {
|
|
111
98
|
if (refl.flags.isOptional) {
|
|
112
|
-
return
|
|
99
|
+
return JSX.createElement(JSX.Fragment, null,
|
|
113
100
|
wbr(refl.name),
|
|
114
101
|
"?");
|
|
115
102
|
}
|
|
116
103
|
return wbr(refl.name);
|
|
117
104
|
}
|
|
118
|
-
function getHierarchyRoots(project) {
|
|
119
|
-
const allClasses = project.getReflectionsByKind(
|
|
105
|
+
export function getHierarchyRoots(project) {
|
|
106
|
+
const allClasses = project.getReflectionsByKind(ReflectionKind.ClassOrInterface);
|
|
120
107
|
const roots = allClasses.filter((refl) => {
|
|
121
108
|
// If nobody extends this class, there's no possible hierarchy to display.
|
|
122
109
|
if (!refl.implementedBy && !refl.extendedBy) {
|
|
@@ -137,3 +124,77 @@ function getHierarchyRoots(project) {
|
|
|
137
124
|
});
|
|
138
125
|
return roots.sort((a, b) => a.name.localeCompare(b.name));
|
|
139
126
|
}
|
|
127
|
+
export function getMemberSections(parent, childFilter = () => true) {
|
|
128
|
+
if (parent.categories?.length) {
|
|
129
|
+
return filterMap(parent.categories, (cat) => {
|
|
130
|
+
const children = cat.children.filter(childFilter);
|
|
131
|
+
if (!children.length)
|
|
132
|
+
return;
|
|
133
|
+
return {
|
|
134
|
+
title: cat.title,
|
|
135
|
+
children,
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
if (parent.groups?.length) {
|
|
140
|
+
return parent.groups.flatMap((group) => {
|
|
141
|
+
if (group.categories?.length) {
|
|
142
|
+
return filterMap(group.categories, (cat) => {
|
|
143
|
+
const children = cat.children.filter(childFilter);
|
|
144
|
+
if (!children.length)
|
|
145
|
+
return;
|
|
146
|
+
return {
|
|
147
|
+
title: `${group.title} - ${cat.title}`,
|
|
148
|
+
children,
|
|
149
|
+
};
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
const children = group.children.filter(childFilter);
|
|
153
|
+
if (!children.length)
|
|
154
|
+
return [];
|
|
155
|
+
return {
|
|
156
|
+
title: group.title,
|
|
157
|
+
children,
|
|
158
|
+
};
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
return [];
|
|
162
|
+
}
|
|
163
|
+
const nameCollisionCache = new WeakMap();
|
|
164
|
+
function getNameCollisionCount(project, name) {
|
|
165
|
+
let collisions = nameCollisionCache.get(project);
|
|
166
|
+
if (collisions === undefined) {
|
|
167
|
+
collisions = new DefaultMap(() => 0);
|
|
168
|
+
for (const reflection of project.getReflectionsByKind(ReflectionKind.SomeExport)) {
|
|
169
|
+
collisions.set(reflection.name, collisions.get(reflection.name) + 1);
|
|
170
|
+
}
|
|
171
|
+
nameCollisionCache.set(project, collisions);
|
|
172
|
+
}
|
|
173
|
+
return collisions.get(name);
|
|
174
|
+
}
|
|
175
|
+
function getNamespacedPath(reflection) {
|
|
176
|
+
const path = [reflection];
|
|
177
|
+
let parent = reflection.parent;
|
|
178
|
+
while (parent?.kindOf(ReflectionKind.Namespace)) {
|
|
179
|
+
path.unshift(parent);
|
|
180
|
+
parent = parent.parent;
|
|
181
|
+
}
|
|
182
|
+
return path;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Returns a (hopefully) globally unique path for the given reflection.
|
|
186
|
+
*
|
|
187
|
+
* This only works for exportable symbols, so e.g. methods are not affected by this.
|
|
188
|
+
*
|
|
189
|
+
* If the given reflection has a globally unique name already, then it will be returned as is. If the name is
|
|
190
|
+
* ambiguous (i.e. there are two classes with the same name in different namespaces), then the namespaces path of the
|
|
191
|
+
* reflection will be returned.
|
|
192
|
+
*/
|
|
193
|
+
export function getUniquePath(reflection) {
|
|
194
|
+
if (reflection.kindOf(ReflectionKind.SomeExport)) {
|
|
195
|
+
if (getNameCollisionCount(reflection.project, reflection.name) >= 2) {
|
|
196
|
+
return getNamespacedPath(reflection);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return [reflection];
|
|
200
|
+
}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import type { Serializer } from "./serializer";
|
|
2
|
-
import type { ModelToObject } from "./schema";
|
|
1
|
+
import type { Serializer } from "./serializer.js";
|
|
2
|
+
import type { ModelToObject } from "./schema.js";
|
|
3
3
|
/**
|
|
4
4
|
* Represents Serializer plugin component.
|
|
5
5
|
*
|
|
6
6
|
* Like {@link Converter} plugins each {@link Serializer} plugin defines a predicate that instructs if an
|
|
7
7
|
* object can be serialized by it. This is done dynamically at runtime via a `supports` method.
|
|
8
|
-
*
|
|
9
|
-
* Additionally, each {@link Serializer} plugin must define a predicate that instructs the group
|
|
10
|
-
* it belongs to.
|
|
11
8
|
*/
|
|
12
9
|
export interface SerializerComponent<T extends object> {
|
|
13
10
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Application } from "../application";
|
|
2
|
-
import { ProjectReflection, type ReflectionVariant, type TypeKindMap } from "../models/index";
|
|
3
|
-
import type { Logger } from "../utils/loggers";
|
|
4
|
-
import type { JSONOutput } from "./index";
|
|
5
|
-
import type { FileRegistry } from "../models/FileRegistry";
|
|
1
|
+
import type { Application } from "../application.js";
|
|
2
|
+
import { ProjectReflection, type ReflectionVariant, type TypeKindMap } from "../models/index.js";
|
|
3
|
+
import type { Logger } from "../utils/loggers.js";
|
|
4
|
+
import type { JSONOutput } from "./index.js";
|
|
5
|
+
import type { FileRegistry } from "../models/FileRegistry.js";
|
|
6
6
|
export interface DeserializerComponent {
|
|
7
7
|
priority: number;
|
|
8
8
|
supports(model: unknown, obj: unknown): boolean;
|
|
@@ -11,6 +11,12 @@ export interface DeserializerComponent {
|
|
|
11
11
|
export interface Deserializable<T> {
|
|
12
12
|
fromObject(d: Deserializer, o: T): void;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Deserializes TypeDoc's JSON output back to {@link Reflection} instances.
|
|
16
|
+
*
|
|
17
|
+
* @group Common
|
|
18
|
+
* @summary Deserializes TypeDoc's JSON output
|
|
19
|
+
*/
|
|
14
20
|
export declare class Deserializer {
|
|
15
21
|
readonly application: Application;
|
|
16
22
|
private deferred;
|
|
@@ -37,8 +43,16 @@ export declare class Deserializer {
|
|
|
37
43
|
* This is generally not appropriate for merging multiple projects since projects may
|
|
38
44
|
* contain reflections in their root, not inside a module.
|
|
39
45
|
*/
|
|
40
|
-
reviveProject(
|
|
41
|
-
|
|
46
|
+
reviveProject(name: string, projectObj: JSONOutput.ProjectReflection, options: {
|
|
47
|
+
projectRoot: string;
|
|
48
|
+
registry: FileRegistry;
|
|
49
|
+
addProjectDocuments?: boolean;
|
|
50
|
+
}): ProjectReflection;
|
|
51
|
+
reviveProjects(name: string, projects: readonly JSONOutput.ProjectReflection[], options: {
|
|
52
|
+
projectRoot: string;
|
|
53
|
+
registry: FileRegistry;
|
|
54
|
+
addProjectDocuments?: boolean;
|
|
55
|
+
}): ProjectReflection;
|
|
42
56
|
revive<T, U extends Deserializable<T>>(source: NonNullable<T>, creator: (obj: T) => U): U;
|
|
43
57
|
revive<T, U extends Deserializable<T>>(source: T | undefined, creator: (obj: T) => U): U | undefined;
|
|
44
58
|
reviveMany<T, U extends Deserializable<T>>(sourceArray: T[], creator: (obj: T) => U): U[];
|
|
@@ -1,125 +1,137 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { ok } from "assert";
|
|
2
|
+
import { ArrayType, ConditionalType, DeclarationReflection, DocumentReflection, IndexedAccessType, InferredType, IntersectionType, IntrinsicType, LiteralType, MappedType, NamedTupleMember, OptionalType, ParameterReflection, PredicateType, ProjectReflection, QueryType, ReferenceReflection, ReferenceType, Reflection, ReflectionKind, ReflectionType, RestType, SignatureReflection, TemplateLiteralType, TupleType, TypeOperatorType, TypeParameterReflection, UnionType, UnknownType, } from "../models/index.js";
|
|
3
|
+
import { insertPrioritySorted } from "../utils/array.js";
|
|
4
|
+
/**
|
|
5
|
+
* Deserializes TypeDoc's JSON output back to {@link Reflection} instances.
|
|
6
|
+
*
|
|
7
|
+
* @group Common
|
|
8
|
+
* @summary Deserializes TypeDoc's JSON output
|
|
9
|
+
*/
|
|
10
|
+
export class Deserializer {
|
|
11
|
+
application;
|
|
12
|
+
deferred = [];
|
|
13
|
+
deserializers = [];
|
|
14
|
+
activeReflection = [];
|
|
8
15
|
constructor(application) {
|
|
9
16
|
this.application = application;
|
|
10
|
-
this.deferred = [];
|
|
11
|
-
this.deserializers = [];
|
|
12
|
-
this.activeReflection = [];
|
|
13
|
-
this.reflectionBuilders = {
|
|
14
|
-
declaration(parent, obj) {
|
|
15
|
-
return new index_1.DeclarationReflection(obj.name, obj.kind, parent);
|
|
16
|
-
},
|
|
17
|
-
document(parent, obj) {
|
|
18
|
-
return new index_1.DocumentReflection(obj.name, parent, [], {});
|
|
19
|
-
},
|
|
20
|
-
param(parent, obj) {
|
|
21
|
-
return new index_1.ParameterReflection(obj.name, obj.kind, parent);
|
|
22
|
-
},
|
|
23
|
-
project() {
|
|
24
|
-
throw new Error("Not supported, use Deserializer.reviveProject(s) instead.");
|
|
25
|
-
},
|
|
26
|
-
reference(parent, obj) {
|
|
27
|
-
// Ugly, but we don't have a reference yet!
|
|
28
|
-
return new index_1.ReferenceReflection(obj.name,
|
|
29
|
-
/* target */ parent, parent);
|
|
30
|
-
},
|
|
31
|
-
signature(parent, obj) {
|
|
32
|
-
return new index_1.SignatureReflection(obj.name, obj.kind, parent);
|
|
33
|
-
},
|
|
34
|
-
typeParam(parent, obj) {
|
|
35
|
-
return new index_1.TypeParameterReflection(obj.name, parent, void 0);
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
this.typeBuilders = {
|
|
39
|
-
array(obj, de) {
|
|
40
|
-
return new index_1.ArrayType(de.reviveType(obj.elementType));
|
|
41
|
-
},
|
|
42
|
-
conditional(obj, de) {
|
|
43
|
-
return new index_1.ConditionalType(de.reviveType(obj.checkType), de.reviveType(obj.extendsType), de.reviveType(obj.trueType), de.reviveType(obj.falseType));
|
|
44
|
-
},
|
|
45
|
-
indexedAccess(obj, de) {
|
|
46
|
-
return new index_1.IndexedAccessType(de.reviveType(obj.objectType), de.reviveType(obj.indexType));
|
|
47
|
-
},
|
|
48
|
-
inferred(obj, de) {
|
|
49
|
-
return new index_1.InferredType(obj.name, de.reviveType(obj.constraint));
|
|
50
|
-
},
|
|
51
|
-
intersection(obj, de) {
|
|
52
|
-
return new index_1.IntersectionType(obj.types.map((t) => de.reviveType(t)));
|
|
53
|
-
},
|
|
54
|
-
intrinsic(obj) {
|
|
55
|
-
return new index_1.IntrinsicType(obj.name);
|
|
56
|
-
},
|
|
57
|
-
literal(obj) {
|
|
58
|
-
if (obj.value && typeof obj.value === "object") {
|
|
59
|
-
return new index_1.LiteralType(BigInt(`${obj.value.negative ? "-" : ""}${obj.value.value}`));
|
|
60
|
-
}
|
|
61
|
-
return new index_1.LiteralType(obj.value);
|
|
62
|
-
},
|
|
63
|
-
mapped(obj, de) {
|
|
64
|
-
return new index_1.MappedType(obj.parameter, de.reviveType(obj.parameterType), de.reviveType(obj.templateType), obj.readonlyModifier, obj.optionalModifier, de.reviveType(obj.nameType));
|
|
65
|
-
},
|
|
66
|
-
optional(obj, de) {
|
|
67
|
-
return new index_1.OptionalType(de.reviveType(obj.elementType));
|
|
68
|
-
},
|
|
69
|
-
predicate(obj, de) {
|
|
70
|
-
return new index_1.PredicateType(obj.name, obj.asserts, de.reviveType(obj.targetType));
|
|
71
|
-
},
|
|
72
|
-
query(obj, de) {
|
|
73
|
-
return new index_1.QueryType(de.reviveType(obj.queryType));
|
|
74
|
-
},
|
|
75
|
-
reference(obj) {
|
|
76
|
-
// Correct reference will be restored in fromObject
|
|
77
|
-
return index_1.ReferenceType.createResolvedReference(obj.name, -2, null);
|
|
78
|
-
},
|
|
79
|
-
reflection(obj, de) {
|
|
80
|
-
return new index_1.ReflectionType(de.revive(obj.declaration, (o) => de.constructReflection(o)));
|
|
81
|
-
},
|
|
82
|
-
rest(obj, de) {
|
|
83
|
-
return new index_1.RestType(de.reviveType(obj.elementType));
|
|
84
|
-
},
|
|
85
|
-
templateLiteral(obj, de) {
|
|
86
|
-
return new index_1.TemplateLiteralType(obj.head, obj.tail.map(([t, s]) => [de.reviveType(t), s]));
|
|
87
|
-
},
|
|
88
|
-
tuple(obj, de) {
|
|
89
|
-
return new index_1.TupleType(obj.elements?.map((t) => de.reviveType(t)) || []);
|
|
90
|
-
},
|
|
91
|
-
namedTupleMember(obj, de) {
|
|
92
|
-
return new index_1.NamedTupleMember(obj.name, obj.isOptional, de.reviveType(obj.element));
|
|
93
|
-
},
|
|
94
|
-
typeOperator(obj, de) {
|
|
95
|
-
return new index_1.TypeOperatorType(de.reviveType(obj.target), obj.operator);
|
|
96
|
-
},
|
|
97
|
-
union(obj, de) {
|
|
98
|
-
return new index_1.UnionType(obj.types.map((t) => de.reviveType(t)));
|
|
99
|
-
},
|
|
100
|
-
unknown(obj) {
|
|
101
|
-
return new index_1.UnknownType(obj.name);
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
this.oldIdToNewId = {};
|
|
105
|
-
this.oldFileIdToNewFileId = {};
|
|
106
17
|
}
|
|
107
18
|
get logger() {
|
|
108
19
|
return this.application.logger;
|
|
109
20
|
}
|
|
21
|
+
reflectionBuilders = {
|
|
22
|
+
declaration(parent, obj) {
|
|
23
|
+
return new DeclarationReflection(obj.name, obj.kind, parent);
|
|
24
|
+
},
|
|
25
|
+
document(parent, obj) {
|
|
26
|
+
return new DocumentReflection(obj.name, parent, [], {});
|
|
27
|
+
},
|
|
28
|
+
param(parent, obj) {
|
|
29
|
+
return new ParameterReflection(obj.name, obj.kind, parent);
|
|
30
|
+
},
|
|
31
|
+
project() {
|
|
32
|
+
throw new Error("Not supported, use Deserializer.reviveProject(s) instead.");
|
|
33
|
+
},
|
|
34
|
+
reference(parent, obj) {
|
|
35
|
+
// Ugly, but we don't have a reference yet!
|
|
36
|
+
return new ReferenceReflection(obj.name,
|
|
37
|
+
/* target */ parent, parent);
|
|
38
|
+
},
|
|
39
|
+
signature(parent, obj) {
|
|
40
|
+
return new SignatureReflection(obj.name, obj.kind, parent);
|
|
41
|
+
},
|
|
42
|
+
typeParam(parent, obj) {
|
|
43
|
+
return new TypeParameterReflection(obj.name, parent, void 0);
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
typeBuilders = {
|
|
47
|
+
array(obj, de) {
|
|
48
|
+
return new ArrayType(de.reviveType(obj.elementType));
|
|
49
|
+
},
|
|
50
|
+
conditional(obj, de) {
|
|
51
|
+
return new ConditionalType(de.reviveType(obj.checkType), de.reviveType(obj.extendsType), de.reviveType(obj.trueType), de.reviveType(obj.falseType));
|
|
52
|
+
},
|
|
53
|
+
indexedAccess(obj, de) {
|
|
54
|
+
return new IndexedAccessType(de.reviveType(obj.objectType), de.reviveType(obj.indexType));
|
|
55
|
+
},
|
|
56
|
+
inferred(obj, de) {
|
|
57
|
+
return new InferredType(obj.name, de.reviveType(obj.constraint));
|
|
58
|
+
},
|
|
59
|
+
intersection(obj, de) {
|
|
60
|
+
return new IntersectionType(obj.types.map((t) => de.reviveType(t)));
|
|
61
|
+
},
|
|
62
|
+
intrinsic(obj) {
|
|
63
|
+
return new IntrinsicType(obj.name);
|
|
64
|
+
},
|
|
65
|
+
literal(obj) {
|
|
66
|
+
if (obj.value && typeof obj.value === "object") {
|
|
67
|
+
return new LiteralType(BigInt(`${obj.value.negative ? "-" : ""}${obj.value.value}`));
|
|
68
|
+
}
|
|
69
|
+
return new LiteralType(obj.value);
|
|
70
|
+
},
|
|
71
|
+
mapped(obj, de) {
|
|
72
|
+
return new MappedType(obj.parameter, de.reviveType(obj.parameterType), de.reviveType(obj.templateType), obj.readonlyModifier, obj.optionalModifier, de.reviveType(obj.nameType));
|
|
73
|
+
},
|
|
74
|
+
optional(obj, de) {
|
|
75
|
+
return new OptionalType(de.reviveType(obj.elementType));
|
|
76
|
+
},
|
|
77
|
+
predicate(obj, de) {
|
|
78
|
+
return new PredicateType(obj.name, obj.asserts, de.reviveType(obj.targetType));
|
|
79
|
+
},
|
|
80
|
+
query(obj, de) {
|
|
81
|
+
return new QueryType(de.reviveType(obj.queryType));
|
|
82
|
+
},
|
|
83
|
+
reference(obj) {
|
|
84
|
+
// Correct reference will be restored in fromObject
|
|
85
|
+
return ReferenceType.createResolvedReference(obj.name, -2, null);
|
|
86
|
+
},
|
|
87
|
+
reflection(obj, de) {
|
|
88
|
+
return new ReflectionType(de.revive(obj.declaration, (o) => de.constructReflection(o)));
|
|
89
|
+
},
|
|
90
|
+
rest(obj, de) {
|
|
91
|
+
return new RestType(de.reviveType(obj.elementType));
|
|
92
|
+
},
|
|
93
|
+
templateLiteral(obj, de) {
|
|
94
|
+
return new TemplateLiteralType(obj.head, obj.tail.map(([t, s]) => [de.reviveType(t), s]));
|
|
95
|
+
},
|
|
96
|
+
tuple(obj, de) {
|
|
97
|
+
return new TupleType(obj.elements?.map((t) => de.reviveType(t)) || []);
|
|
98
|
+
},
|
|
99
|
+
namedTupleMember(obj, de) {
|
|
100
|
+
return new NamedTupleMember(obj.name, obj.isOptional, de.reviveType(obj.element));
|
|
101
|
+
},
|
|
102
|
+
typeOperator(obj, de) {
|
|
103
|
+
return new TypeOperatorType(de.reviveType(obj.target), obj.operator);
|
|
104
|
+
},
|
|
105
|
+
union(obj, de) {
|
|
106
|
+
return new UnionType(obj.types.map((t) => de.reviveType(t)));
|
|
107
|
+
},
|
|
108
|
+
unknown(obj) {
|
|
109
|
+
return new UnknownType(obj.name);
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Only set when deserializing.
|
|
114
|
+
*/
|
|
115
|
+
projectRoot;
|
|
116
|
+
oldIdToNewId = {};
|
|
117
|
+
oldFileIdToNewFileId = {};
|
|
118
|
+
project;
|
|
110
119
|
addDeserializer(de) {
|
|
111
|
-
|
|
120
|
+
insertPrioritySorted(this.deserializers, de);
|
|
112
121
|
}
|
|
113
122
|
/**
|
|
114
123
|
* Revive a single project into the structure it was originally created with.
|
|
115
124
|
* This is generally not appropriate for merging multiple projects since projects may
|
|
116
125
|
* contain reflections in their root, not inside a module.
|
|
117
126
|
*/
|
|
118
|
-
reviveProject(
|
|
119
|
-
|
|
120
|
-
const project = new
|
|
127
|
+
reviveProject(name, projectObj, options) {
|
|
128
|
+
ok(this.deferred.length === 0, "Deserializer.defer was called when not deserializing");
|
|
129
|
+
const project = new ProjectReflection(name || projectObj.name, options.registry);
|
|
130
|
+
if (options.addProjectDocuments) {
|
|
131
|
+
this.application.converter.addProjectDocuments(project);
|
|
132
|
+
}
|
|
121
133
|
this.project = project;
|
|
122
|
-
this.projectRoot = projectRoot;
|
|
134
|
+
this.projectRoot = options.projectRoot;
|
|
123
135
|
this.oldIdToNewId = { [projectObj.id]: project.id };
|
|
124
136
|
this.oldFileIdToNewFileId = {};
|
|
125
137
|
this.fromObject(project, projectObj);
|
|
@@ -128,24 +140,28 @@ class Deserializer {
|
|
|
128
140
|
for (const def of deferred) {
|
|
129
141
|
def(project);
|
|
130
142
|
}
|
|
131
|
-
|
|
132
|
-
|
|
143
|
+
ok(this.deferred.length === 0, "Work may not be double deferred when deserializing.");
|
|
144
|
+
ok(this.activeReflection.length === 0, "Imbalanced reflection deserialization");
|
|
133
145
|
this.project = undefined;
|
|
134
146
|
this.projectRoot = undefined;
|
|
135
147
|
this.oldIdToNewId = {};
|
|
136
148
|
this.oldFileIdToNewFileId = {};
|
|
137
149
|
return project;
|
|
138
150
|
}
|
|
139
|
-
reviveProjects(name, projects,
|
|
140
|
-
if (projects.length === 1
|
|
141
|
-
|
|
151
|
+
reviveProjects(name, projects, options) {
|
|
152
|
+
if (projects.length === 1 &&
|
|
153
|
+
!this.application.options.getValue("alwaysCreateEntryPointModule")) {
|
|
154
|
+
return this.reviveProject(name, projects[0], options);
|
|
155
|
+
}
|
|
156
|
+
const project = new ProjectReflection(name, options.registry);
|
|
157
|
+
if (options.addProjectDocuments) {
|
|
158
|
+
this.application.converter.addProjectDocuments(project);
|
|
142
159
|
}
|
|
143
|
-
const project = new index_1.ProjectReflection(name, registry);
|
|
144
160
|
this.project = project;
|
|
145
|
-
this.projectRoot = projectRoot;
|
|
161
|
+
this.projectRoot = options.projectRoot;
|
|
146
162
|
for (const proj of projects) {
|
|
147
|
-
|
|
148
|
-
const projModule = new
|
|
163
|
+
ok(this.deferred.length === 0, "Deserializer.defer was called when not deserializing");
|
|
164
|
+
const projModule = new DeclarationReflection(proj.name, ReflectionKind.Module, project);
|
|
149
165
|
project.registerReflection(projModule, undefined, undefined);
|
|
150
166
|
project.addChild(projModule);
|
|
151
167
|
this.oldIdToNewId = { [proj.id]: projModule.id };
|
|
@@ -156,8 +172,8 @@ class Deserializer {
|
|
|
156
172
|
for (const def of deferred) {
|
|
157
173
|
def(project);
|
|
158
174
|
}
|
|
159
|
-
|
|
160
|
-
|
|
175
|
+
ok(this.deferred.length === 0, "Work may not be double deferred when deserializing.");
|
|
176
|
+
ok(this.activeReflection.length === 0, "Imbalanced reflection deserialization");
|
|
161
177
|
}
|
|
162
178
|
this.oldIdToNewId = {};
|
|
163
179
|
this.oldFileIdToNewFileId = {};
|
|
@@ -185,7 +201,7 @@ class Deserializer {
|
|
|
185
201
|
return this.revive(obj, (o) => this.constructType(o));
|
|
186
202
|
}
|
|
187
203
|
constructReflection(obj) {
|
|
188
|
-
|
|
204
|
+
ok(this.activeReflection.length > 0);
|
|
189
205
|
const result = this.reflectionBuilders[obj.variant](this.activeReflection[this.activeReflection.length - 1], obj);
|
|
190
206
|
this.oldIdToNewId[obj.id] = result.id;
|
|
191
207
|
this.project.registerReflection(result, undefined, undefined);
|
|
@@ -196,7 +212,7 @@ class Deserializer {
|
|
|
196
212
|
return result;
|
|
197
213
|
}
|
|
198
214
|
fromObject(receiver, obj) {
|
|
199
|
-
if (receiver instanceof
|
|
215
|
+
if (receiver instanceof Reflection) {
|
|
200
216
|
this.activeReflection.push(receiver);
|
|
201
217
|
}
|
|
202
218
|
receiver.fromObject(this, obj);
|
|
@@ -205,7 +221,7 @@ class Deserializer {
|
|
|
205
221
|
de.fromObject(receiver, obj);
|
|
206
222
|
}
|
|
207
223
|
}
|
|
208
|
-
if (receiver instanceof
|
|
224
|
+
if (receiver instanceof Reflection) {
|
|
209
225
|
this.activeReflection.pop();
|
|
210
226
|
}
|
|
211
227
|
}
|
|
@@ -219,4 +235,3 @@ class Deserializer {
|
|
|
219
235
|
this.deferred.push(cb);
|
|
220
236
|
}
|
|
221
237
|
}
|
|
222
|
-
exports.Deserializer = Deserializer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ProjectReflection } from "../models";
|
|
2
|
-
import type { ProjectReflection as JSONProjectReflection } from "./schema";
|
|
1
|
+
import type { ProjectReflection } from "../models/index.js";
|
|
2
|
+
import type { ProjectReflection as JSONProjectReflection } from "./schema.js";
|
|
3
3
|
/**
|
|
4
4
|
* An event emitted by the {@link Serializer} class at the very beginning and
|
|
5
5
|
* ending of the a project serialization process.
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SerializeEvent = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* An event emitted by the {@link Serializer} class at the very beginning and
|
|
6
3
|
* ending of the a project serialization process.
|
|
@@ -8,10 +5,14 @@ exports.SerializeEvent = void 0;
|
|
|
8
5
|
* @see {@link Serializer.EVENT_BEGIN}
|
|
9
6
|
* @see {@link Serializer.EVENT_END}
|
|
10
7
|
*/
|
|
11
|
-
class SerializeEvent {
|
|
8
|
+
export class SerializeEvent {
|
|
9
|
+
/**
|
|
10
|
+
* The project the renderer is currently processing.
|
|
11
|
+
*/
|
|
12
|
+
project;
|
|
13
|
+
output;
|
|
12
14
|
constructor(project, output) {
|
|
13
15
|
this.project = project;
|
|
14
16
|
this.output = output;
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
|
-
exports.SerializeEvent = SerializeEvent;
|