typedoc 0.26.11 → 0.27.0-beta.1
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 +154 -172
- 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 +212 -239
- package/dist/lib/converter/factories/index-signature.d.ts +3 -3
- package/dist/lib/converter/factories/index-signature.js +43 -26
- 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 +372 -2
- package/dist/lib/internationalization/locales/en.d.cts +343 -2
- package/dist/lib/internationalization/locales/jp.cjs +13 -14
- package/dist/lib/internationalization/locales/jp.d.cts +307 -1
- package/dist/lib/internationalization/locales/ko.cjs +12 -11
- package/dist/lib/internationalization/locales/ko.d.cts +221 -1
- package/dist/lib/internationalization/locales/zh.cjs +43 -19
- package/dist/lib/internationalization/locales/zh.d.cts +409 -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 +29 -16
- 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 +624 -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 +14 -0
- package/dist/lib/output/output.js +91 -0
- package/dist/lib/output/plugins/AssetsPlugin.d.ts +9 -8
- package/dist/lib/output/plugins/AssetsPlugin.js +64 -80
- package/dist/lib/output/plugins/HierarchyPlugin.d.ts +7 -0
- package/dist/lib/output/plugins/HierarchyPlugin.js +67 -0
- 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 +7 -6
- package/dist/lib/output/plugins/index.js +7 -15
- package/dist/lib/output/renderer.d.ts +14 -13
- package/dist/lib/output/renderer.js +130 -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 +48 -36
- 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 +4 -4
- package/dist/lib/output/themes/default/partials/hierarchy.js +12 -15
- 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 +222 -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 +24 -22
- 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 +32 -34
- package/dist/lib/output/themes/lib.d.ts +17 -3
- package/dist/lib/output/themes/lib.js +118 -50
- 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 -6
- package/dist/lib/utils/jsx.elements.d.ts +1 -1
- package/dist/lib/utils/jsx.elements.js +3 -4
- package/dist/lib/utils/jsx.js +82 -52
- package/dist/lib/utils/loggers.d.ts +3 -3
- package/dist/lib/utils/loggers.js +36 -46
- package/dist/lib/utils/map.js +6 -13
- package/dist/lib/utils/minimalSourceFile.js +5 -7
- package/dist/lib/utils/options/declaration.d.ts +35 -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 +44 -76
- 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 +232 -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 +7 -10
- 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 +17 -14
- package/static/main.js +4 -4
- package/static/style.css +109 -17
- 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
package/dist/lib/application.js
CHANGED
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
1
|
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
19
2
|
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
20
3
|
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
@@ -49,73 +32,48 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
49
32
|
}
|
|
50
33
|
return useValue ? value : void 0;
|
|
51
34
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const Path = __importStar(require("path"));
|
|
81
|
-
const typescript_1 = __importDefault(require("typescript"));
|
|
82
|
-
const index_1 = require("./converter/index");
|
|
83
|
-
const renderer_1 = require("./output/renderer");
|
|
84
|
-
const serialization_1 = require("./serialization");
|
|
85
|
-
const index_2 = require("./utils/index");
|
|
86
|
-
const component_1 = require("./utils/component");
|
|
87
|
-
const utils_1 = require("./utils");
|
|
88
|
-
const array_1 = require("./utils/array");
|
|
89
|
-
const assert_1 = require("assert");
|
|
90
|
-
const entry_point_1 = require("./utils/entry-point");
|
|
91
|
-
const paths_1 = require("./utils/paths");
|
|
92
|
-
const general_1 = require("./utils/general");
|
|
93
|
-
const exports_1 = require("./validation/exports");
|
|
94
|
-
const documentation_1 = require("./validation/documentation");
|
|
95
|
-
const links_1 = require("./validation/links");
|
|
96
|
-
const application_events_1 = require("./application-events");
|
|
97
|
-
const tsconfig_1 = require("./utils/tsconfig");
|
|
98
|
-
const fs_1 = require("./utils/fs");
|
|
99
|
-
const ReflectionSymbolId_1 = require("./models/reflections/ReflectionSymbolId");
|
|
100
|
-
const internationalization_1 = require("./internationalization/internationalization");
|
|
101
|
-
const highlighter_1 = require("./utils/highlighter");
|
|
102
|
-
const FileRegistry_1 = require("./models/FileRegistry");
|
|
103
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
104
|
-
const packageInfo = require("../../package.json");
|
|
35
|
+
import * as Path from "path";
|
|
36
|
+
import ts from "typescript";
|
|
37
|
+
import { Deserializer, Serializer, } from "./serialization/index.js";
|
|
38
|
+
import { Converter } from "./converter/index.js";
|
|
39
|
+
import { Renderer } from "./output/renderer.js";
|
|
40
|
+
import { Logger, ConsoleLogger, loadPlugins, writeFile, TSConfigReader, TypeDocReader, PackageJsonReader, AbstractComponent, } from "./utils/index.js";
|
|
41
|
+
import { Options, Option } from "./utils/index.js";
|
|
42
|
+
import { unique } from "./utils/array.js";
|
|
43
|
+
import { ok } from "assert";
|
|
44
|
+
import { EntryPointStrategy, getEntryPoints, getPackageDirectories, getWatchEntryPoints, inferEntryPoints, } from "./utils/entry-point.js";
|
|
45
|
+
import { nicePath } from "./utils/paths.js";
|
|
46
|
+
import { getLoadedPaths, hasBeenLoadedMultipleTimes } from "./utils/general.js";
|
|
47
|
+
import { validateExports } from "./validation/exports.js";
|
|
48
|
+
import { validateDocumentation } from "./validation/documentation.js";
|
|
49
|
+
import { validateLinks } from "./validation/links.js";
|
|
50
|
+
import { ApplicationEvents } from "./application-events.js";
|
|
51
|
+
import { findTsConfigFile } from "./utils/tsconfig.js";
|
|
52
|
+
import { deriveRootDir, glob, readFile } from "./utils/fs.js";
|
|
53
|
+
import { addInferredDeclarationMapPaths } from "./models/reflections/ReflectionSymbolId.js";
|
|
54
|
+
import { Internationalization, } from "./internationalization/internationalization.js";
|
|
55
|
+
import { loadShikiMetadata } from "./utils/highlighter.js";
|
|
56
|
+
import { ValidatingFileRegistry, FileRegistry } from "./models/FileRegistry.js";
|
|
57
|
+
import { readFileSync } from "fs";
|
|
58
|
+
import { fileURLToPath } from "url";
|
|
59
|
+
import { createRequire } from "module";
|
|
60
|
+
import { Outputs } from "./output/output.js";
|
|
61
|
+
import { validateMergeModuleWith } from "./validation/unusedMergeModuleWith.js";
|
|
62
|
+
const packageInfo = JSON.parse(readFileSync(Path.join(fileURLToPath(import.meta.url), "../../../package.json"), "utf8"));
|
|
105
63
|
const supportedVersionMajorMinor = packageInfo.peerDependencies.typescript
|
|
106
64
|
.split("||")
|
|
107
65
|
.map((version) => version.replace(/^\s*|\.x\s*$/g, ""));
|
|
108
66
|
const DETECTOR = Symbol();
|
|
109
|
-
function createAppForTesting() {
|
|
67
|
+
export function createAppForTesting() {
|
|
110
68
|
// @ts-expect-error private constructor
|
|
111
69
|
const app = new Application(DETECTOR);
|
|
112
|
-
app.files = new
|
|
70
|
+
app.files = new FileRegistry();
|
|
113
71
|
return app;
|
|
114
72
|
}
|
|
115
73
|
const DEFAULT_READERS = [
|
|
116
|
-
new
|
|
117
|
-
new
|
|
118
|
-
new
|
|
74
|
+
new TypeDocReader(),
|
|
75
|
+
new PackageJsonReader(),
|
|
76
|
+
new TSConfigReader(),
|
|
119
77
|
];
|
|
120
78
|
/**
|
|
121
79
|
* The default TypeDoc main application class.
|
|
@@ -134,14 +92,12 @@ const DEFAULT_READERS = [
|
|
|
134
92
|
*
|
|
135
93
|
* Access to an Application instance can be retrieved with {@link Application.bootstrap} or
|
|
136
94
|
* {@link Application.bootstrapWithPlugins}. It can not be constructed manually.
|
|
95
|
+
*
|
|
96
|
+
* @group Common
|
|
97
|
+
* @summary Root level class which contains most useful behavior.
|
|
137
98
|
*/
|
|
138
99
|
let Application = (() => {
|
|
139
|
-
|
|
140
|
-
let _classDecorators = [(0, component_1.Component)({ name: "application", internal: true })];
|
|
141
|
-
let _classDescriptor;
|
|
142
|
-
let _classExtraInitializers = [];
|
|
143
|
-
let _classThis;
|
|
144
|
-
let _classSuper = component_1.ChildableComponent;
|
|
100
|
+
let _classSuper = AbstractComponent;
|
|
145
101
|
let _lang_decorators;
|
|
146
102
|
let _lang_initializers = [];
|
|
147
103
|
let _lang_extraInitializers = [];
|
|
@@ -154,19 +110,86 @@ let Application = (() => {
|
|
|
154
110
|
let _entryPoints_decorators;
|
|
155
111
|
let _entryPoints_initializers = [];
|
|
156
112
|
let _entryPoints_extraInitializers = [];
|
|
157
|
-
|
|
113
|
+
return class Application extends _classSuper {
|
|
114
|
+
static {
|
|
115
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
116
|
+
_lang_decorators = [Option("lang")];
|
|
117
|
+
_skipErrorChecking_decorators = [Option("skipErrorChecking")];
|
|
118
|
+
_entryPointStrategy_decorators = [Option("entryPointStrategy")];
|
|
119
|
+
_entryPoints_decorators = [Option("entryPoints")];
|
|
120
|
+
__esDecorate(this, null, _lang_decorators, { kind: "accessor", name: "lang", static: false, private: false, access: { has: obj => "lang" in obj, get: obj => obj.lang, set: (obj, value) => { obj.lang = value; } }, metadata: _metadata }, _lang_initializers, _lang_extraInitializers);
|
|
121
|
+
__esDecorate(this, null, _skipErrorChecking_decorators, { kind: "accessor", name: "skipErrorChecking", static: false, private: false, access: { has: obj => "skipErrorChecking" in obj, get: obj => obj.skipErrorChecking, set: (obj, value) => { obj.skipErrorChecking = value; } }, metadata: _metadata }, _skipErrorChecking_initializers, _skipErrorChecking_extraInitializers);
|
|
122
|
+
__esDecorate(this, null, _entryPointStrategy_decorators, { kind: "accessor", name: "entryPointStrategy", static: false, private: false, access: { has: obj => "entryPointStrategy" in obj, get: obj => obj.entryPointStrategy, set: (obj, value) => { obj.entryPointStrategy = value; } }, metadata: _metadata }, _entryPointStrategy_initializers, _entryPointStrategy_extraInitializers);
|
|
123
|
+
__esDecorate(this, null, _entryPoints_decorators, { kind: "accessor", name: "entryPoints", static: false, private: false, access: { has: obj => "entryPoints" in obj, get: obj => obj.entryPoints, set: (obj, value) => { obj.entryPoints = value; } }, metadata: _metadata }, _entryPoints_initializers, _entryPoints_extraInitializers);
|
|
124
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The converter used to create the declaration reflections.
|
|
128
|
+
*/
|
|
129
|
+
converter;
|
|
130
|
+
outputs = new Outputs(this);
|
|
131
|
+
/**
|
|
132
|
+
* The renderer used to generate the HTML documentation output.
|
|
133
|
+
*/
|
|
134
|
+
renderer;
|
|
135
|
+
/**
|
|
136
|
+
* The serializer used to generate JSON output.
|
|
137
|
+
*/
|
|
138
|
+
serializer = new Serializer();
|
|
139
|
+
/**
|
|
140
|
+
* The deserializer used to restore previously serialized JSON output.
|
|
141
|
+
*/
|
|
142
|
+
deserializer = new Deserializer(this);
|
|
143
|
+
/**
|
|
144
|
+
* The logger that should be used to output messages.
|
|
145
|
+
*/
|
|
146
|
+
logger = new ConsoleLogger();
|
|
147
|
+
/**
|
|
148
|
+
* Internationalization module which supports translating according to
|
|
149
|
+
* the `lang` option.
|
|
150
|
+
*/
|
|
151
|
+
internationalization = new Internationalization(this);
|
|
152
|
+
/**
|
|
153
|
+
* Proxy based shortcuts for internationalization keys.
|
|
154
|
+
*/
|
|
155
|
+
i18n = this.internationalization.proxy;
|
|
156
|
+
options = new Options(this.i18n);
|
|
157
|
+
files = new ValidatingFileRegistry();
|
|
158
|
+
#lang_accessor_storage = __runInitializers(this, _lang_initializers, void 0);
|
|
158
159
|
/** @internal */
|
|
159
|
-
get lang() { return
|
|
160
|
-
set lang(value) {
|
|
160
|
+
get lang() { return this.#lang_accessor_storage; }
|
|
161
|
+
set lang(value) { this.#lang_accessor_storage = value; }
|
|
162
|
+
#skipErrorChecking_accessor_storage = (__runInitializers(this, _lang_extraInitializers), __runInitializers(this, _skipErrorChecking_initializers, void 0));
|
|
161
163
|
/** @internal */
|
|
162
|
-
get skipErrorChecking() { return
|
|
163
|
-
set skipErrorChecking(value) {
|
|
164
|
+
get skipErrorChecking() { return this.#skipErrorChecking_accessor_storage; }
|
|
165
|
+
set skipErrorChecking(value) { this.#skipErrorChecking_accessor_storage = value; }
|
|
166
|
+
#entryPointStrategy_accessor_storage = (__runInitializers(this, _skipErrorChecking_extraInitializers), __runInitializers(this, _entryPointStrategy_initializers, void 0));
|
|
164
167
|
/** @internal */
|
|
165
|
-
get entryPointStrategy() { return
|
|
166
|
-
set entryPointStrategy(value) {
|
|
168
|
+
get entryPointStrategy() { return this.#entryPointStrategy_accessor_storage; }
|
|
169
|
+
set entryPointStrategy(value) { this.#entryPointStrategy_accessor_storage = value; }
|
|
170
|
+
#entryPoints_accessor_storage = (__runInitializers(this, _entryPointStrategy_extraInitializers), __runInitializers(this, _entryPoints_initializers, void 0));
|
|
167
171
|
/** @internal */
|
|
168
|
-
get entryPoints() { return
|
|
169
|
-
set entryPoints(value) {
|
|
172
|
+
get entryPoints() { return this.#entryPoints_accessor_storage; }
|
|
173
|
+
set entryPoints(value) { this.#entryPoints_accessor_storage = value; }
|
|
174
|
+
/**
|
|
175
|
+
* The version number of TypeDoc.
|
|
176
|
+
*/
|
|
177
|
+
static VERSION = packageInfo.version;
|
|
178
|
+
/**
|
|
179
|
+
* Emitted after plugins have been loaded and options have been read, but before they have been frozen.
|
|
180
|
+
* The listener will be given an instance of {@link Application}.
|
|
181
|
+
*/
|
|
182
|
+
static EVENT_BOOTSTRAP_END = ApplicationEvents.BOOTSTRAP_END;
|
|
183
|
+
/**
|
|
184
|
+
* Emitted after a project has been deserialized from JSON.
|
|
185
|
+
* The listener will be given an instance of {@link ProjectReflection}.
|
|
186
|
+
*/
|
|
187
|
+
static EVENT_PROJECT_REVIVE = ApplicationEvents.REVIVE;
|
|
188
|
+
/**
|
|
189
|
+
* Emitted when validation is being run.
|
|
190
|
+
* The listener will be given an instance of {@link ProjectReflection}.
|
|
191
|
+
*/
|
|
192
|
+
static EVENT_VALIDATE_PROJECT = ApplicationEvents.VALIDATE_PROJECT;
|
|
170
193
|
/**
|
|
171
194
|
* Create a new TypeDoc application instance.
|
|
172
195
|
*/
|
|
@@ -175,50 +198,31 @@ let Application = (() => {
|
|
|
175
198
|
throw new Error("An application handle must be retrieved with Application.bootstrap or Application.bootstrapWithPlugins");
|
|
176
199
|
}
|
|
177
200
|
super(null); // We own ourselves
|
|
178
|
-
/**
|
|
179
|
-
* The serializer used to generate JSON output.
|
|
180
|
-
*/
|
|
181
|
-
this.serializer = new serialization_1.Serializer();
|
|
182
|
-
/**
|
|
183
|
-
* The deserializer used to restore previously serialized JSON output.
|
|
184
|
-
*/
|
|
185
|
-
this.deserializer = new serialization_1.Deserializer(this);
|
|
186
|
-
/**
|
|
187
|
-
* The logger that should be used to output messages.
|
|
188
|
-
*/
|
|
189
|
-
this.logger = new index_2.ConsoleLogger();
|
|
190
|
-
/**
|
|
191
|
-
* Internationalization module which supports translating according to
|
|
192
|
-
* the `lang` option.
|
|
193
|
-
*/
|
|
194
|
-
this.internationalization = new internationalization_1.Internationalization(this);
|
|
195
|
-
/**
|
|
196
|
-
* Proxy based shortcuts for internationalization keys.
|
|
197
|
-
*/
|
|
198
|
-
this.i18n = this.internationalization.proxy;
|
|
199
|
-
this.options = new utils_1.Options(this.i18n);
|
|
200
|
-
this.files = new FileRegistry_1.ValidatingFileRegistry();
|
|
201
|
-
_Application_lang_accessor_storage.set(this, __runInitializers(this, _lang_initializers, void 0));
|
|
202
|
-
_Application_skipErrorChecking_accessor_storage.set(this, (__runInitializers(this, _lang_extraInitializers), __runInitializers(this, _skipErrorChecking_initializers, void 0)));
|
|
203
|
-
_Application_entryPointStrategy_accessor_storage.set(this, (__runInitializers(this, _skipErrorChecking_extraInitializers), __runInitializers(this, _entryPointStrategy_initializers, void 0)));
|
|
204
|
-
_Application_entryPoints_accessor_storage.set(this, (__runInitializers(this, _entryPointStrategy_extraInitializers), __runInitializers(this, _entryPoints_initializers, void 0)));
|
|
205
201
|
__runInitializers(this, _entryPoints_extraInitializers);
|
|
206
|
-
this.converter = new
|
|
207
|
-
this.renderer = new
|
|
202
|
+
this.converter = new Converter(this);
|
|
203
|
+
this.renderer = new Renderer(this);
|
|
208
204
|
this.logger.i18n = this.i18n;
|
|
205
|
+
this.outputs.addOutput("json", async (out, project) => {
|
|
206
|
+
const ser = this.serializer.projectToObject(project, process.cwd());
|
|
207
|
+
const space = this.options.getValue("pretty") ? "\t" : "";
|
|
208
|
+
await writeFile(out, JSON.stringify(ser, null, space) + "\n");
|
|
209
|
+
});
|
|
210
|
+
this.outputs.addOutput("html", async (out, project) => {
|
|
211
|
+
await this.renderer.render(project, out);
|
|
212
|
+
});
|
|
209
213
|
}
|
|
210
214
|
/**
|
|
211
215
|
* Initialize TypeDoc, loading plugins if applicable.
|
|
212
216
|
*/
|
|
213
217
|
static async bootstrapWithPlugins(options = {}, readers = DEFAULT_READERS) {
|
|
214
|
-
await
|
|
218
|
+
await loadShikiMetadata();
|
|
215
219
|
const app = new Application(DETECTOR);
|
|
216
220
|
readers.forEach((r) => app.options.addReader(r));
|
|
217
221
|
app.options.reset();
|
|
218
222
|
app.setOptions(options, /* reportErrors */ false);
|
|
219
|
-
await app.options.read(new
|
|
223
|
+
await app.options.read(new Logger());
|
|
220
224
|
app.logger.level = app.options.getValue("logLevel");
|
|
221
|
-
await
|
|
225
|
+
await loadPlugins(app, app.options.getValue("plugin"));
|
|
222
226
|
await app._bootstrap(options);
|
|
223
227
|
return app;
|
|
224
228
|
}
|
|
@@ -235,7 +239,7 @@ let Application = (() => {
|
|
|
235
239
|
* @param readers Option readers to use to discover options from config files.
|
|
236
240
|
*/
|
|
237
241
|
static async bootstrap(options = {}, readers = DEFAULT_READERS) {
|
|
238
|
-
await
|
|
242
|
+
await loadShikiMetadata();
|
|
239
243
|
const app = new Application(DETECTOR);
|
|
240
244
|
readers.forEach((r) => app.options.addReader(r));
|
|
241
245
|
await app._bootstrap(options);
|
|
@@ -250,10 +254,10 @@ let Application = (() => {
|
|
|
250
254
|
for (const [lang, locales] of Object.entries(this.options.getValue("locales"))) {
|
|
251
255
|
this.internationalization.addTranslations(lang, locales);
|
|
252
256
|
}
|
|
253
|
-
if (
|
|
254
|
-
this.logger.warn(this.i18n.loaded_multiple_times_0(
|
|
257
|
+
if (hasBeenLoadedMultipleTimes()) {
|
|
258
|
+
this.logger.warn(this.i18n.loaded_multiple_times_0(getLoadedPaths().join("\n\t")));
|
|
255
259
|
}
|
|
256
|
-
this.trigger(
|
|
260
|
+
this.trigger(ApplicationEvents.BOOTSTRAP_END, this);
|
|
257
261
|
if (!this.internationalization.hasTranslations(this.lang)) {
|
|
258
262
|
// Not internationalized as by definition we don't know what to include here.
|
|
259
263
|
this.logger.warn(`Options specified "${this.lang}" as the language to use, but TypeDoc does not support it.`);
|
|
@@ -269,34 +273,45 @@ let Application = (() => {
|
|
|
269
273
|
this.options.setValue("useHostedBaseUrlForAbsoluteLinks", false);
|
|
270
274
|
}
|
|
271
275
|
}
|
|
276
|
+
/** @internal */
|
|
272
277
|
setOptions(options, reportErrors = true) {
|
|
278
|
+
let success = true;
|
|
273
279
|
for (const [key, val] of Object.entries(options)) {
|
|
274
280
|
try {
|
|
275
281
|
this.options.setValue(key, val);
|
|
276
282
|
}
|
|
277
283
|
catch (error) {
|
|
278
|
-
|
|
284
|
+
success = false;
|
|
285
|
+
ok(error instanceof Error);
|
|
279
286
|
if (reportErrors) {
|
|
280
287
|
this.logger.error(error.message);
|
|
281
288
|
}
|
|
282
289
|
}
|
|
283
290
|
}
|
|
291
|
+
return success;
|
|
284
292
|
}
|
|
285
293
|
/**
|
|
286
294
|
* Return the path to the TypeScript compiler.
|
|
287
295
|
*/
|
|
288
296
|
getTypeScriptPath() {
|
|
289
|
-
|
|
297
|
+
const req = createRequire(import.meta.url);
|
|
298
|
+
return nicePath(Path.dirname(req.resolve("typescript")));
|
|
290
299
|
}
|
|
291
300
|
getTypeScriptVersion() {
|
|
292
|
-
return
|
|
301
|
+
return ts.version;
|
|
302
|
+
}
|
|
303
|
+
async getEntryPoints() {
|
|
304
|
+
if (this.options.isSet("entryPoints")) {
|
|
305
|
+
return this.getDefinedEntryPoints();
|
|
306
|
+
}
|
|
307
|
+
return inferEntryPoints(this.logger, this.options);
|
|
293
308
|
}
|
|
294
309
|
/**
|
|
295
310
|
* Gets the entry points to be documented according to the current `entryPoints` and `entryPointStrategy` options.
|
|
296
311
|
* May return undefined if entry points fail to be expanded.
|
|
297
312
|
*/
|
|
298
|
-
|
|
299
|
-
return
|
|
313
|
+
getDefinedEntryPoints() {
|
|
314
|
+
return getEntryPoints(this.logger, this.options);
|
|
300
315
|
}
|
|
301
316
|
/**
|
|
302
317
|
* Run the converter for the given set of files and return the generated reflections.
|
|
@@ -309,24 +324,24 @@ let Application = (() => {
|
|
|
309
324
|
// with a few different settings.
|
|
310
325
|
this.options.freeze();
|
|
311
326
|
this.logger.verbose(`Using TypeScript ${this.getTypeScriptVersion()} from ${this.getTypeScriptPath()}`);
|
|
312
|
-
if (this.entryPointStrategy ===
|
|
327
|
+
if (this.entryPointStrategy === EntryPointStrategy.Merge) {
|
|
313
328
|
return this._merge();
|
|
314
329
|
}
|
|
315
|
-
if (this.entryPointStrategy ===
|
|
330
|
+
if (this.entryPointStrategy === EntryPointStrategy.Packages) {
|
|
316
331
|
return this._convertPackages();
|
|
317
332
|
}
|
|
318
|
-
if (!supportedVersionMajorMinor.some((version) => version ==
|
|
333
|
+
if (!supportedVersionMajorMinor.some((version) => version == ts.versionMajorMinor)) {
|
|
319
334
|
this.logger.warn(this.i18n.unsupported_ts_version_0(supportedVersionMajorMinor.join(", ")));
|
|
320
335
|
}
|
|
321
|
-
const entryPoints = this.getEntryPoints();
|
|
336
|
+
const entryPoints = await this.getEntryPoints();
|
|
322
337
|
if (!entryPoints) {
|
|
323
338
|
// Fatal error already reported.
|
|
324
339
|
return;
|
|
325
340
|
}
|
|
326
|
-
const programs =
|
|
341
|
+
const programs = unique(entryPoints.map((e) => e.program));
|
|
327
342
|
this.logger.verbose(`Converting with ${programs.length} programs ${entryPoints.length} entry points`);
|
|
328
343
|
if (this.skipErrorChecking === false) {
|
|
329
|
-
const errors = programs.flatMap((program) =>
|
|
344
|
+
const errors = programs.flatMap((program) => ts.getPreEmitDiagnostics(program));
|
|
330
345
|
if (errors.length) {
|
|
331
346
|
this.logger.diagnostics(errors);
|
|
332
347
|
return;
|
|
@@ -346,11 +361,11 @@ let Application = (() => {
|
|
|
346
361
|
convertAndWatch(success) {
|
|
347
362
|
this.options.freeze();
|
|
348
363
|
if (!this.options.getValue("preserveWatchOutput") &&
|
|
349
|
-
this.logger instanceof
|
|
350
|
-
|
|
364
|
+
this.logger instanceof ConsoleLogger) {
|
|
365
|
+
ts.sys.clearScreen?.();
|
|
351
366
|
}
|
|
352
367
|
this.logger.verbose(`Using TypeScript ${this.getTypeScriptVersion()} from ${this.getTypeScriptPath()}`);
|
|
353
|
-
if (!supportedVersionMajorMinor.some((version) => version ==
|
|
368
|
+
if (!supportedVersionMajorMinor.some((version) => version == ts.versionMajorMinor)) {
|
|
354
369
|
this.logger.warn(this.i18n.unsupported_ts_version_0(supportedVersionMajorMinor.join(", ")));
|
|
355
370
|
}
|
|
356
371
|
if (Object.keys(this.options.getCompilerOptions()).length === 0) {
|
|
@@ -363,25 +378,25 @@ let Application = (() => {
|
|
|
363
378
|
return;
|
|
364
379
|
}
|
|
365
380
|
// Support for packages mode is currently unimplemented
|
|
366
|
-
if (this.entryPointStrategy !==
|
|
367
|
-
this.entryPointStrategy !==
|
|
381
|
+
if (this.entryPointStrategy !== EntryPointStrategy.Resolve &&
|
|
382
|
+
this.entryPointStrategy !== EntryPointStrategy.Expand) {
|
|
368
383
|
this.logger.error(this.i18n.strategy_not_supported_in_watch_mode());
|
|
369
384
|
return;
|
|
370
385
|
}
|
|
371
|
-
const tsconfigFile =
|
|
386
|
+
const tsconfigFile = findTsConfigFile(this.options.getValue("tsconfig")) ??
|
|
372
387
|
"tsconfig.json";
|
|
373
388
|
// We don't want to do it the first time to preserve initial debug status messages. They'll be lost
|
|
374
389
|
// after the user saves a file, but better than nothing...
|
|
375
390
|
let firstStatusReport = true;
|
|
376
|
-
const host =
|
|
391
|
+
const host = ts.createWatchCompilerHost(tsconfigFile, {}, ts.sys, ts.createEmitAndSemanticDiagnosticsBuilderProgram, (diagnostic) => this.logger.diagnostic(diagnostic), (status, newLine, _options, errorCount) => {
|
|
377
392
|
if (!firstStatusReport &&
|
|
378
393
|
errorCount === void 0 &&
|
|
379
394
|
!this.options.getValue("preserveWatchOutput") &&
|
|
380
|
-
this.logger instanceof
|
|
381
|
-
|
|
395
|
+
this.logger instanceof ConsoleLogger) {
|
|
396
|
+
ts.sys.clearScreen?.();
|
|
382
397
|
}
|
|
383
398
|
firstStatusReport = false;
|
|
384
|
-
this.logger.info(
|
|
399
|
+
this.logger.info(ts.flattenDiagnosticMessageText(status.messageText, newLine));
|
|
385
400
|
});
|
|
386
401
|
let successFinished = true;
|
|
387
402
|
let currentProgram;
|
|
@@ -395,7 +410,7 @@ let Application = (() => {
|
|
|
395
410
|
}
|
|
396
411
|
this.logger.resetErrors();
|
|
397
412
|
this.logger.resetWarnings();
|
|
398
|
-
const entryPoints =
|
|
413
|
+
const entryPoints = getWatchEntryPoints(this.logger, this.options, currentProgram);
|
|
399
414
|
if (!entryPoints) {
|
|
400
415
|
return;
|
|
401
416
|
}
|
|
@@ -418,13 +433,13 @@ let Application = (() => {
|
|
|
418
433
|
};
|
|
419
434
|
const origAfterProgramCreate = host.afterProgramCreate;
|
|
420
435
|
host.afterProgramCreate = (program) => {
|
|
421
|
-
if (
|
|
436
|
+
if (ts.getPreEmitDiagnostics(program.getProgram()).length === 0) {
|
|
422
437
|
currentProgram = program.getProgram();
|
|
423
438
|
runSuccess();
|
|
424
439
|
}
|
|
425
440
|
origAfterProgramCreate?.(program);
|
|
426
441
|
};
|
|
427
|
-
|
|
442
|
+
ts.createWatchProgram(host);
|
|
428
443
|
}
|
|
429
444
|
validate(project) {
|
|
430
445
|
const checks = this.options.getValue("validation");
|
|
@@ -432,32 +447,35 @@ let Application = (() => {
|
|
|
432
447
|
// No point in validating exports when merging. Warnings will have already been emitted when
|
|
433
448
|
// creating the project jsons that this run merges together.
|
|
434
449
|
if (checks.notExported &&
|
|
435
|
-
this.entryPointStrategy !==
|
|
436
|
-
|
|
450
|
+
this.entryPointStrategy !== EntryPointStrategy.Merge) {
|
|
451
|
+
validateExports(project, this.logger, this.options.getValue("intentionallyNotExported"));
|
|
437
452
|
}
|
|
438
453
|
if (checks.notDocumented) {
|
|
439
|
-
|
|
454
|
+
validateDocumentation(project, this.logger, this.options.getValue("requiredToBeDocumented"));
|
|
440
455
|
}
|
|
441
456
|
if (checks.invalidLink) {
|
|
442
|
-
|
|
457
|
+
validateLinks(project, this.logger);
|
|
458
|
+
}
|
|
459
|
+
if (checks.unusedMergeModuleWith) {
|
|
460
|
+
validateMergeModuleWith(project, this.logger);
|
|
443
461
|
}
|
|
444
462
|
this.trigger(Application.EVENT_VALIDATE_PROJECT, project);
|
|
445
463
|
this.logger.verbose(`Validation took ${Date.now() - start}ms`);
|
|
446
464
|
}
|
|
465
|
+
/**
|
|
466
|
+
* Render outputs selected with options for the specified project
|
|
467
|
+
*/
|
|
468
|
+
async generateOutputs(project) {
|
|
469
|
+
await this.outputs.writeOutputs(project);
|
|
470
|
+
}
|
|
447
471
|
/**
|
|
448
472
|
* Render HTML for the given project
|
|
449
473
|
*/
|
|
450
474
|
async generateDocs(project, out) {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
this.logger.error(this.i18n.docs_could_not_be_generated());
|
|
456
|
-
}
|
|
457
|
-
else {
|
|
458
|
-
this.logger.info(this.i18n.docs_generated_at_0((0, paths_1.nicePath)(out)));
|
|
459
|
-
this.logger.verbose(`HTML rendering took ${Date.now() - start}ms`);
|
|
460
|
-
}
|
|
475
|
+
await this.outputs.writeOutput({
|
|
476
|
+
name: "html",
|
|
477
|
+
path: out,
|
|
478
|
+
}, project);
|
|
461
479
|
}
|
|
462
480
|
/**
|
|
463
481
|
* Write the reflections to a json file.
|
|
@@ -466,13 +484,10 @@ let Application = (() => {
|
|
|
466
484
|
* @returns Whether the JSON file could be written successfully.
|
|
467
485
|
*/
|
|
468
486
|
async generateJson(project, out) {
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
await (0, index_2.writeFile)(out, JSON.stringify(ser, null, space) + "\n");
|
|
474
|
-
this.logger.info(this.i18n.json_written_to_0((0, paths_1.nicePath)(out)));
|
|
475
|
-
this.logger.verbose(`JSON rendering took ${Date.now() - start}ms`);
|
|
487
|
+
await this.outputs.writeOutput({
|
|
488
|
+
name: "json",
|
|
489
|
+
path: out,
|
|
490
|
+
}, project);
|
|
476
491
|
}
|
|
477
492
|
/**
|
|
478
493
|
* Print the version number.
|
|
@@ -490,7 +505,7 @@ let Application = (() => {
|
|
|
490
505
|
this.logger.error(this.i18n.no_entry_points_for_packages());
|
|
491
506
|
return;
|
|
492
507
|
}
|
|
493
|
-
const packageDirs =
|
|
508
|
+
const packageDirs = getPackageDirectories(this.logger, this.options, this.options.getValue("entryPoints"));
|
|
494
509
|
if (packageDirs.length === 0) {
|
|
495
510
|
this.logger.error(this.i18n.failed_to_find_packages());
|
|
496
511
|
return;
|
|
@@ -501,32 +516,37 @@ let Application = (() => {
|
|
|
501
516
|
const projectsToConvert = [];
|
|
502
517
|
// Generate a json file for each package
|
|
503
518
|
for (const dir of packageDirs) {
|
|
504
|
-
this.logger.verbose(`Reading project at ${
|
|
519
|
+
this.logger.verbose(`Reading project at ${nicePath(dir)}`);
|
|
505
520
|
let opts;
|
|
506
521
|
try {
|
|
507
522
|
opts = origOptions.copyForPackage(dir);
|
|
508
523
|
}
|
|
509
524
|
catch (error) {
|
|
510
|
-
|
|
525
|
+
ok(error instanceof Error);
|
|
511
526
|
this.logger.error(error.message);
|
|
512
|
-
this.logger.info(this.i18n.previous_error_occurred_when_reading_options_for_0(
|
|
527
|
+
this.logger.info(this.i18n.previous_error_occurred_when_reading_options_for_0(nicePath(dir)));
|
|
513
528
|
continue;
|
|
514
529
|
}
|
|
515
530
|
await opts.read(this.logger, dir);
|
|
516
531
|
// Invalid links should only be reported after everything has been merged.
|
|
517
|
-
|
|
532
|
+
// Same goes for @mergeModuleWith, should only be validated after merging
|
|
533
|
+
// everything together.
|
|
534
|
+
opts.setValue("validation", {
|
|
535
|
+
invalidLink: false,
|
|
536
|
+
unusedMergeModuleWith: false,
|
|
537
|
+
});
|
|
518
538
|
if (opts.getValue("entryPointStrategy") ===
|
|
519
|
-
|
|
520
|
-
this.logger.error(this.i18n.nested_packages_unsupported_0(
|
|
539
|
+
EntryPointStrategy.Packages) {
|
|
540
|
+
this.logger.error(this.i18n.nested_packages_unsupported_0(nicePath(dir)));
|
|
521
541
|
continue;
|
|
522
542
|
}
|
|
523
|
-
|
|
543
|
+
addInferredDeclarationMapPaths(opts.getCompilerOptions(), opts.getFileNames());
|
|
524
544
|
projectsToConvert.push({ dir, options: opts });
|
|
525
545
|
}
|
|
526
546
|
for (const { dir, options } of projectsToConvert) {
|
|
527
|
-
this.logger.info(this.i18n.converting_project_at_0(
|
|
547
|
+
this.logger.info(this.i18n.converting_project_at_0(nicePath(dir)));
|
|
528
548
|
this.options = options;
|
|
529
|
-
this.files = new
|
|
549
|
+
this.files = new ValidatingFileRegistry();
|
|
530
550
|
let project = await this.convert();
|
|
531
551
|
if (project) {
|
|
532
552
|
this.validate(project);
|
|
@@ -548,8 +568,12 @@ let Application = (() => {
|
|
|
548
568
|
return;
|
|
549
569
|
}
|
|
550
570
|
this.logger.info(this.i18n.merging_converted_projects());
|
|
551
|
-
const result = this.deserializer.reviveProjects(this.options.getValue("name") || "Documentation", projects,
|
|
552
|
-
|
|
571
|
+
const result = this.deserializer.reviveProjects(this.options.getValue("name") || "Documentation", projects, {
|
|
572
|
+
projectRoot: process.cwd(),
|
|
573
|
+
registry: this.files,
|
|
574
|
+
addProjectDocuments: true,
|
|
575
|
+
});
|
|
576
|
+
this.trigger(ApplicationEvents.REVIVE, result);
|
|
553
577
|
return result;
|
|
554
578
|
}
|
|
555
579
|
_merge() {
|
|
@@ -558,83 +582,39 @@ let Application = (() => {
|
|
|
558
582
|
this.logger.error(this.i18n.no_entry_points_to_merge());
|
|
559
583
|
return;
|
|
560
584
|
}
|
|
561
|
-
const rootDir =
|
|
585
|
+
const rootDir = deriveRootDir(this.entryPoints);
|
|
562
586
|
const entryPoints = this.entryPoints.flatMap((entry) => {
|
|
563
|
-
const result =
|
|
587
|
+
const result = glob(entry, rootDir);
|
|
564
588
|
if (result.length === 0) {
|
|
565
|
-
this.logger.warn(this.i18n.entrypoint_did_not_match_files_0(
|
|
589
|
+
this.logger.warn(this.i18n.entrypoint_did_not_match_files_0(nicePath(entry)));
|
|
566
590
|
}
|
|
567
|
-
else {
|
|
568
|
-
this.logger.verbose(`Expanded ${
|
|
569
|
-
.map(
|
|
591
|
+
else if (result.length !== 1) {
|
|
592
|
+
this.logger.verbose(`Expanded ${nicePath(entry)} to:\n\t${result
|
|
593
|
+
.map(nicePath)
|
|
570
594
|
.join("\n\t")}`);
|
|
571
595
|
}
|
|
572
596
|
return result;
|
|
573
597
|
});
|
|
574
598
|
const jsonProjects = entryPoints.map((path) => {
|
|
575
599
|
try {
|
|
576
|
-
return JSON.parse(
|
|
600
|
+
return JSON.parse(readFile(path));
|
|
577
601
|
}
|
|
578
602
|
catch {
|
|
579
|
-
this.logger.error(this.i18n.failed_to_parse_json_0(
|
|
603
|
+
this.logger.error(this.i18n.failed_to_parse_json_0(nicePath(path)));
|
|
580
604
|
return null;
|
|
581
605
|
}
|
|
582
606
|
});
|
|
583
607
|
if (this.logger.hasErrors())
|
|
584
608
|
return;
|
|
585
|
-
const result = this.deserializer.reviveProjects(this.options.getValue("name"), jsonProjects,
|
|
609
|
+
const result = this.deserializer.reviveProjects(this.options.getValue("name"), jsonProjects, {
|
|
610
|
+
projectRoot: process.cwd(),
|
|
611
|
+
registry: this.files,
|
|
612
|
+
addProjectDocuments: true,
|
|
613
|
+
});
|
|
586
614
|
this.logger.verbose(`Reviving projects took ${Date.now() - start}ms`);
|
|
587
|
-
|
|
588
|
-
// it when it was created. If we revived more than one project then
|
|
589
|
-
// it's convenient to be able to add more documents now.
|
|
590
|
-
if (jsonProjects.length > 1) {
|
|
591
|
-
this.converter.addProjectDocuments(result);
|
|
592
|
-
}
|
|
593
|
-
this.trigger(application_events_1.ApplicationEvents.REVIVE, result);
|
|
615
|
+
this.trigger(ApplicationEvents.REVIVE, result);
|
|
594
616
|
return result;
|
|
595
617
|
}
|
|
596
618
|
};
|
|
597
|
-
_Application_lang_accessor_storage = new WeakMap();
|
|
598
|
-
_Application_skipErrorChecking_accessor_storage = new WeakMap();
|
|
599
|
-
_Application_entryPointStrategy_accessor_storage = new WeakMap();
|
|
600
|
-
_Application_entryPoints_accessor_storage = new WeakMap();
|
|
601
|
-
__setFunctionName(_classThis, "Application");
|
|
602
|
-
(() => {
|
|
603
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
604
|
-
_lang_decorators = [(0, utils_1.Option)("lang")];
|
|
605
|
-
_skipErrorChecking_decorators = [(0, utils_1.Option)("skipErrorChecking")];
|
|
606
|
-
_entryPointStrategy_decorators = [(0, utils_1.Option)("entryPointStrategy")];
|
|
607
|
-
_entryPoints_decorators = [(0, utils_1.Option)("entryPoints")];
|
|
608
|
-
__esDecorate(_classThis, null, _lang_decorators, { kind: "accessor", name: "lang", static: false, private: false, access: { has: obj => "lang" in obj, get: obj => obj.lang, set: (obj, value) => { obj.lang = value; } }, metadata: _metadata }, _lang_initializers, _lang_extraInitializers);
|
|
609
|
-
__esDecorate(_classThis, null, _skipErrorChecking_decorators, { kind: "accessor", name: "skipErrorChecking", static: false, private: false, access: { has: obj => "skipErrorChecking" in obj, get: obj => obj.skipErrorChecking, set: (obj, value) => { obj.skipErrorChecking = value; } }, metadata: _metadata }, _skipErrorChecking_initializers, _skipErrorChecking_extraInitializers);
|
|
610
|
-
__esDecorate(_classThis, null, _entryPointStrategy_decorators, { kind: "accessor", name: "entryPointStrategy", static: false, private: false, access: { has: obj => "entryPointStrategy" in obj, get: obj => obj.entryPointStrategy, set: (obj, value) => { obj.entryPointStrategy = value; } }, metadata: _metadata }, _entryPointStrategy_initializers, _entryPointStrategy_extraInitializers);
|
|
611
|
-
__esDecorate(_classThis, null, _entryPoints_decorators, { kind: "accessor", name: "entryPoints", static: false, private: false, access: { has: obj => "entryPoints" in obj, get: obj => obj.entryPoints, set: (obj, value) => { obj.entryPoints = value; } }, metadata: _metadata }, _entryPoints_initializers, _entryPoints_extraInitializers);
|
|
612
|
-
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
613
|
-
Application = _classThis = _classDescriptor.value;
|
|
614
|
-
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
615
|
-
})();
|
|
616
|
-
/**
|
|
617
|
-
* The version number of TypeDoc.
|
|
618
|
-
*/
|
|
619
|
-
_classThis.VERSION = packageInfo.version;
|
|
620
|
-
/**
|
|
621
|
-
* Emitted after plugins have been loaded and options have been read, but before they have been frozen.
|
|
622
|
-
* The listener will be given an instance of {@link Application}.
|
|
623
|
-
*/
|
|
624
|
-
_classThis.EVENT_BOOTSTRAP_END = application_events_1.ApplicationEvents.BOOTSTRAP_END;
|
|
625
|
-
/**
|
|
626
|
-
* Emitted after a project has been deserialized from JSON.
|
|
627
|
-
* The listener will be given an instance of {@link ProjectReflection}.
|
|
628
|
-
*/
|
|
629
|
-
_classThis.EVENT_PROJECT_REVIVE = application_events_1.ApplicationEvents.REVIVE;
|
|
630
|
-
/**
|
|
631
|
-
* Emitted when validation is being run.
|
|
632
|
-
* The listener will be given an instance of {@link ProjectReflection}.
|
|
633
|
-
*/
|
|
634
|
-
_classThis.EVENT_VALIDATE_PROJECT = application_events_1.ApplicationEvents.VALIDATE_PROJECT;
|
|
635
|
-
(() => {
|
|
636
|
-
__runInitializers(_classThis, _classExtraInitializers);
|
|
637
|
-
})();
|
|
638
|
-
return Application = _classThis;
|
|
639
619
|
})();
|
|
640
|
-
|
|
620
|
+
export { Application };
|