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,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,68 +32,80 @@ 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
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
65
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
66
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
67
|
-
};
|
|
68
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
69
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
70
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
71
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
72
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
73
|
-
};
|
|
74
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
75
|
-
exports.JavascriptIndexPlugin = void 0;
|
|
76
|
-
const Path = __importStar(require("path"));
|
|
77
|
-
const lunr_1 = require("lunr");
|
|
78
|
-
const models_1 = require("../../models");
|
|
79
|
-
const components_1 = require("../components");
|
|
80
|
-
const events_1 = require("../events");
|
|
81
|
-
const utils_1 = require("../../utils");
|
|
82
|
-
const DefaultTheme_1 = require("../themes/default/DefaultTheme");
|
|
83
|
-
const zlib_1 = require("zlib");
|
|
84
|
-
const util_1 = require("util");
|
|
85
|
-
const gzipP = (0, util_1.promisify)(zlib_1.gzip);
|
|
35
|
+
import * as Path from "path";
|
|
36
|
+
import lunr from "lunr";
|
|
37
|
+
import { DeclarationReflection, DocumentReflection, ProjectReflection, } from "../../models/index.js";
|
|
38
|
+
import { RendererComponent } from "../components.js";
|
|
39
|
+
import { IndexEvent, RendererEvent } from "../events.js";
|
|
40
|
+
import { Option, writeFile } from "../../utils/index.js";
|
|
41
|
+
import { DefaultTheme } from "../themes/default/DefaultTheme.js";
|
|
42
|
+
import { gzip } from "zlib";
|
|
43
|
+
import { promisify } from "util";
|
|
44
|
+
import { GroupPlugin } from "../../converter/plugins/GroupPlugin.js";
|
|
45
|
+
import { CategoryPlugin } from "../../converter/plugins/CategoryPlugin.js";
|
|
46
|
+
const gzipP = promisify(gzip);
|
|
86
47
|
/**
|
|
87
48
|
* A plugin that exports an index of the project to a javascript file.
|
|
88
49
|
*
|
|
89
50
|
* The resulting javascript file can be used to build a simple search function.
|
|
90
51
|
*/
|
|
91
52
|
let JavascriptIndexPlugin = (() => {
|
|
92
|
-
|
|
93
|
-
let _classDecorators = [(0, components_1.Component)({ name: "javascript-index" })];
|
|
94
|
-
let _classDescriptor;
|
|
95
|
-
let _classExtraInitializers = [];
|
|
96
|
-
let _classThis;
|
|
97
|
-
let _classSuper = components_1.RendererComponent;
|
|
53
|
+
let _classSuper = RendererComponent;
|
|
98
54
|
let _searchComments_decorators;
|
|
99
55
|
let _searchComments_initializers = [];
|
|
100
56
|
let _searchComments_extraInitializers = [];
|
|
101
57
|
let _searchDocuments_decorators;
|
|
102
58
|
let _searchDocuments_initializers = [];
|
|
103
59
|
let _searchDocuments_extraInitializers = [];
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
60
|
+
let _searchGroupBoosts_decorators;
|
|
61
|
+
let _searchGroupBoosts_initializers = [];
|
|
62
|
+
let _searchGroupBoosts_extraInitializers = [];
|
|
63
|
+
let _searchCategoryBoosts_decorators;
|
|
64
|
+
let _searchCategoryBoosts_initializers = [];
|
|
65
|
+
let _searchCategoryBoosts_extraInitializers = [];
|
|
66
|
+
let _groupReferencesByType_decorators;
|
|
67
|
+
let _groupReferencesByType_initializers = [];
|
|
68
|
+
let _groupReferencesByType_extraInitializers = [];
|
|
69
|
+
return class JavascriptIndexPlugin extends _classSuper {
|
|
70
|
+
static {
|
|
71
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
72
|
+
_searchComments_decorators = [Option("searchInComments")];
|
|
73
|
+
_searchDocuments_decorators = [Option("searchInDocuments")];
|
|
74
|
+
_searchGroupBoosts_decorators = [Option("searchGroupBoosts")];
|
|
75
|
+
_searchCategoryBoosts_decorators = [Option("searchCategoryBoosts")];
|
|
76
|
+
_groupReferencesByType_decorators = [Option("groupReferencesByType")];
|
|
77
|
+
__esDecorate(this, null, _searchComments_decorators, { kind: "accessor", name: "searchComments", static: false, private: false, access: { has: obj => "searchComments" in obj, get: obj => obj.searchComments, set: (obj, value) => { obj.searchComments = value; } }, metadata: _metadata }, _searchComments_initializers, _searchComments_extraInitializers);
|
|
78
|
+
__esDecorate(this, null, _searchDocuments_decorators, { kind: "accessor", name: "searchDocuments", static: false, private: false, access: { has: obj => "searchDocuments" in obj, get: obj => obj.searchDocuments, set: (obj, value) => { obj.searchDocuments = value; } }, metadata: _metadata }, _searchDocuments_initializers, _searchDocuments_extraInitializers);
|
|
79
|
+
__esDecorate(this, null, _searchGroupBoosts_decorators, { kind: "accessor", name: "searchGroupBoosts", static: false, private: false, access: { has: obj => "searchGroupBoosts" in obj, get: obj => obj.searchGroupBoosts, set: (obj, value) => { obj.searchGroupBoosts = value; } }, metadata: _metadata }, _searchGroupBoosts_initializers, _searchGroupBoosts_extraInitializers);
|
|
80
|
+
__esDecorate(this, null, _searchCategoryBoosts_decorators, { kind: "accessor", name: "searchCategoryBoosts", static: false, private: false, access: { has: obj => "searchCategoryBoosts" in obj, get: obj => obj.searchCategoryBoosts, set: (obj, value) => { obj.searchCategoryBoosts = value; } }, metadata: _metadata }, _searchCategoryBoosts_initializers, _searchCategoryBoosts_extraInitializers);
|
|
81
|
+
__esDecorate(this, null, _groupReferencesByType_decorators, { kind: "accessor", name: "groupReferencesByType", static: false, private: false, access: { has: obj => "groupReferencesByType" in obj, get: obj => obj.groupReferencesByType, set: (obj, value) => { obj.groupReferencesByType = value; } }, metadata: _metadata }, _groupReferencesByType_initializers, _groupReferencesByType_extraInitializers);
|
|
82
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
83
|
+
}
|
|
84
|
+
#searchComments_accessor_storage = __runInitializers(this, _searchComments_initializers, void 0);
|
|
85
|
+
get searchComments() { return this.#searchComments_accessor_storage; }
|
|
86
|
+
set searchComments(value) { this.#searchComments_accessor_storage = value; }
|
|
87
|
+
#searchDocuments_accessor_storage = (__runInitializers(this, _searchComments_extraInitializers), __runInitializers(this, _searchDocuments_initializers, void 0));
|
|
88
|
+
get searchDocuments() { return this.#searchDocuments_accessor_storage; }
|
|
89
|
+
set searchDocuments(value) { this.#searchDocuments_accessor_storage = value; }
|
|
90
|
+
#searchGroupBoosts_accessor_storage = (__runInitializers(this, _searchDocuments_extraInitializers), __runInitializers(this, _searchGroupBoosts_initializers, void 0));
|
|
91
|
+
get searchGroupBoosts() { return this.#searchGroupBoosts_accessor_storage; }
|
|
92
|
+
set searchGroupBoosts(value) { this.#searchGroupBoosts_accessor_storage = value; }
|
|
93
|
+
#searchCategoryBoosts_accessor_storage = (__runInitializers(this, _searchGroupBoosts_extraInitializers), __runInitializers(this, _searchCategoryBoosts_initializers, void 0));
|
|
94
|
+
get searchCategoryBoosts() { return this.#searchCategoryBoosts_accessor_storage; }
|
|
95
|
+
set searchCategoryBoosts(value) { this.#searchCategoryBoosts_accessor_storage = value; }
|
|
96
|
+
#groupReferencesByType_accessor_storage = (__runInitializers(this, _searchCategoryBoosts_extraInitializers), __runInitializers(this, _groupReferencesByType_initializers, void 0));
|
|
97
|
+
get groupReferencesByType() { return this.#groupReferencesByType_accessor_storage; }
|
|
98
|
+
set groupReferencesByType(value) { this.#groupReferencesByType_accessor_storage = value; }
|
|
99
|
+
unusedGroupBoosts = (__runInitializers(this, _groupReferencesByType_extraInitializers), new Set());
|
|
100
|
+
unusedCatBoosts = new Set();
|
|
101
|
+
constructor(owner) {
|
|
102
|
+
super(owner);
|
|
103
|
+
this.owner.on(RendererEvent.BEGIN, this.onRendererBegin.bind(this));
|
|
111
104
|
}
|
|
112
105
|
onRendererBegin(_event) {
|
|
113
|
-
|
|
106
|
+
this.unusedGroupBoosts = new Set(Object.keys(this.searchGroupBoosts));
|
|
107
|
+
this.unusedCatBoosts = new Set(Object.keys(this.searchCategoryBoosts));
|
|
108
|
+
if (!(this.owner.theme instanceof DefaultTheme)) {
|
|
114
109
|
return;
|
|
115
110
|
}
|
|
116
111
|
this.owner.preRenderAsyncJobs.push((event) => this.buildSearchIndex(event));
|
|
@@ -119,16 +114,16 @@ let JavascriptIndexPlugin = (() => {
|
|
|
119
114
|
const theme = this.owner.theme;
|
|
120
115
|
const rows = [];
|
|
121
116
|
const initialSearchResults = Object.values(event.project.reflections).filter((refl) => {
|
|
122
|
-
return ((refl instanceof
|
|
123
|
-
refl instanceof
|
|
117
|
+
return ((refl instanceof DeclarationReflection ||
|
|
118
|
+
refl instanceof DocumentReflection) &&
|
|
124
119
|
refl.url &&
|
|
125
120
|
refl.name &&
|
|
126
121
|
!refl.flags.isExternal);
|
|
127
122
|
});
|
|
128
|
-
const indexEvent = new
|
|
129
|
-
this.owner.trigger(
|
|
130
|
-
const builder = new
|
|
131
|
-
builder.pipeline.add(
|
|
123
|
+
const indexEvent = new IndexEvent(initialSearchResults);
|
|
124
|
+
this.owner.trigger(IndexEvent.PREPARE_INDEX, indexEvent);
|
|
125
|
+
const builder = new lunr.Builder();
|
|
126
|
+
builder.pipeline.add(lunr.trimmer);
|
|
132
127
|
builder.ref("id");
|
|
133
128
|
for (const [key, boost] of Object.entries(indexEvent.searchFieldWeights)) {
|
|
134
129
|
builder.field(key, { boost });
|
|
@@ -137,12 +132,12 @@ let JavascriptIndexPlugin = (() => {
|
|
|
137
132
|
if (!reflection.url) {
|
|
138
133
|
continue;
|
|
139
134
|
}
|
|
140
|
-
const boost = reflection
|
|
135
|
+
const boost = this.getBoost(reflection);
|
|
141
136
|
if (boost <= 0) {
|
|
142
137
|
continue;
|
|
143
138
|
}
|
|
144
139
|
let parent = reflection.parent;
|
|
145
|
-
if (parent instanceof
|
|
140
|
+
if (parent instanceof ProjectReflection) {
|
|
146
141
|
parent = undefined;
|
|
147
142
|
}
|
|
148
143
|
const row = {
|
|
@@ -170,7 +165,27 @@ let JavascriptIndexPlugin = (() => {
|
|
|
170
165
|
index,
|
|
171
166
|
});
|
|
172
167
|
const data = await gzipP(Buffer.from(jsonData));
|
|
173
|
-
await
|
|
168
|
+
await writeFile(jsonFileName, `window.searchData = "data:application/octet-stream;base64,${data.toString("base64")}";`);
|
|
169
|
+
if (this.unusedGroupBoosts.size &&
|
|
170
|
+
this.application.options.isSet("searchGroupBoosts")) {
|
|
171
|
+
this.application.logger.warn(this.application.i18n.not_all_search_group_boosts_used_0(Array.from(this.unusedGroupBoosts).join("\n\t")));
|
|
172
|
+
}
|
|
173
|
+
if (this.unusedCatBoosts.size &&
|
|
174
|
+
this.application.options.isSet("searchCategoryBoosts")) {
|
|
175
|
+
this.application.logger.warn(this.application.i18n.not_all_search_category_boosts_used_0(Array.from(this.unusedCatBoosts).join("\n\t")));
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
getBoost(refl) {
|
|
179
|
+
let boost = refl.relevanceBoost ?? 1;
|
|
180
|
+
for (const group of GroupPlugin.getGroups(refl, this.groupReferencesByType, this.application.internationalization)) {
|
|
181
|
+
boost *= this.searchGroupBoosts[group] ?? 1;
|
|
182
|
+
this.unusedGroupBoosts.delete(group);
|
|
183
|
+
}
|
|
184
|
+
for (const cat of CategoryPlugin.getCategories(refl)) {
|
|
185
|
+
boost *= this.searchCategoryBoosts[cat] ?? 1;
|
|
186
|
+
this.unusedCatBoosts.delete(cat);
|
|
187
|
+
}
|
|
188
|
+
return boost;
|
|
174
189
|
}
|
|
175
190
|
getCommentSearchText(reflection) {
|
|
176
191
|
if (!this.searchComments)
|
|
@@ -204,27 +219,6 @@ let JavascriptIndexPlugin = (() => {
|
|
|
204
219
|
return reflection.content.flatMap((c) => c.text).join("\n");
|
|
205
220
|
}
|
|
206
221
|
}
|
|
207
|
-
constructor() {
|
|
208
|
-
super(...arguments);
|
|
209
|
-
_JavascriptIndexPlugin_searchComments_accessor_storage.set(this, __runInitializers(this, _searchComments_initializers, void 0));
|
|
210
|
-
_JavascriptIndexPlugin_searchDocuments_accessor_storage.set(this, (__runInitializers(this, _searchComments_extraInitializers), __runInitializers(this, _searchDocuments_initializers, void 0)));
|
|
211
|
-
__runInitializers(this, _searchDocuments_extraInitializers);
|
|
212
|
-
}
|
|
213
222
|
};
|
|
214
|
-
_JavascriptIndexPlugin_searchComments_accessor_storage = new WeakMap();
|
|
215
|
-
_JavascriptIndexPlugin_searchDocuments_accessor_storage = new WeakMap();
|
|
216
|
-
__setFunctionName(_classThis, "JavascriptIndexPlugin");
|
|
217
|
-
(() => {
|
|
218
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
219
|
-
_searchComments_decorators = [(0, utils_1.Option)("searchInComments")];
|
|
220
|
-
_searchDocuments_decorators = [(0, utils_1.Option)("searchInDocuments")];
|
|
221
|
-
__esDecorate(_classThis, null, _searchComments_decorators, { kind: "accessor", name: "searchComments", static: false, private: false, access: { has: obj => "searchComments" in obj, get: obj => obj.searchComments, set: (obj, value) => { obj.searchComments = value; } }, metadata: _metadata }, _searchComments_initializers, _searchComments_extraInitializers);
|
|
222
|
-
__esDecorate(_classThis, null, _searchDocuments_decorators, { kind: "accessor", name: "searchDocuments", static: false, private: false, access: { has: obj => "searchDocuments" in obj, get: obj => obj.searchDocuments, set: (obj, value) => { obj.searchDocuments = value; } }, metadata: _metadata }, _searchDocuments_initializers, _searchDocuments_extraInitializers);
|
|
223
|
-
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
224
|
-
JavascriptIndexPlugin = _classThis = _classDescriptor.value;
|
|
225
|
-
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
226
|
-
__runInitializers(_classThis, _classExtraInitializers);
|
|
227
|
-
})();
|
|
228
|
-
return JavascriptIndexPlugin = _classThis;
|
|
229
223
|
})();
|
|
230
|
-
|
|
224
|
+
export { JavascriptIndexPlugin };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { RendererComponent } from "../components";
|
|
1
|
+
import { RendererComponent } from "../components.js";
|
|
2
|
+
import type { Renderer } from "../index.js";
|
|
2
3
|
export declare class NavigationPlugin extends RendererComponent {
|
|
3
|
-
|
|
4
|
+
constructor(owner: Renderer);
|
|
4
5
|
private onRendererBegin;
|
|
5
6
|
private buildNavigationIndex;
|
|
6
7
|
}
|
|
@@ -1,106 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import * as Path from "path";
|
|
2
|
+
import { RendererComponent } from "../components.js";
|
|
3
|
+
import { RendererEvent } from "../events.js";
|
|
4
|
+
import { writeFile } from "../../utils/index.js";
|
|
5
|
+
import { DefaultTheme } from "../themes/default/DefaultTheme.js";
|
|
6
|
+
import { gzip } from "zlib";
|
|
7
|
+
import { promisify } from "util";
|
|
8
|
+
const gzipP = promisify(gzip);
|
|
9
|
+
export class NavigationPlugin extends RendererComponent {
|
|
10
|
+
constructor(owner) {
|
|
11
|
+
super(owner);
|
|
12
|
+
this.owner.on(RendererEvent.BEGIN, this.onRendererBegin.bind(this));
|
|
7
13
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
19
|
-
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
20
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
21
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
22
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
23
|
-
var _, done = false;
|
|
24
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
25
|
-
var context = {};
|
|
26
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
27
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
28
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
29
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
30
|
-
if (kind === "accessor") {
|
|
31
|
-
if (result === void 0) continue;
|
|
32
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
33
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
34
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
35
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
36
|
-
}
|
|
37
|
-
else if (_ = accept(result)) {
|
|
38
|
-
if (kind === "field") initializers.unshift(_);
|
|
39
|
-
else descriptor[key] = _;
|
|
14
|
+
onRendererBegin(_event) {
|
|
15
|
+
if (!(this.owner.theme instanceof DefaultTheme)) {
|
|
16
|
+
return;
|
|
40
17
|
}
|
|
18
|
+
this.owner.preRenderAsyncJobs.push((event) => this.buildNavigationIndex(event));
|
|
41
19
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
48
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
20
|
+
async buildNavigationIndex(event) {
|
|
21
|
+
const navigationJs = Path.join(event.outputDirectory, "assets", "navigation.js");
|
|
22
|
+
const nav = this.owner.theme.getNavigation(event.project);
|
|
23
|
+
const gz = await gzipP(Buffer.from(JSON.stringify(nav)));
|
|
24
|
+
await writeFile(navigationJs, `window.navigationData = "data:application/octet-stream;base64,${gz.toString("base64")}"`);
|
|
49
25
|
}
|
|
50
|
-
|
|
51
|
-
};
|
|
52
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
53
|
-
if (mod && mod.__esModule) return mod;
|
|
54
|
-
var result = {};
|
|
55
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
56
|
-
__setModuleDefault(result, mod);
|
|
57
|
-
return result;
|
|
58
|
-
};
|
|
59
|
-
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
60
|
-
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
61
|
-
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
62
|
-
};
|
|
63
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64
|
-
exports.NavigationPlugin = void 0;
|
|
65
|
-
const Path = __importStar(require("path"));
|
|
66
|
-
const components_1 = require("../components");
|
|
67
|
-
const events_1 = require("../events");
|
|
68
|
-
const utils_1 = require("../../utils");
|
|
69
|
-
const DefaultTheme_1 = require("../themes/default/DefaultTheme");
|
|
70
|
-
const zlib_1 = require("zlib");
|
|
71
|
-
const util_1 = require("util");
|
|
72
|
-
const gzipP = (0, util_1.promisify)(zlib_1.gzip);
|
|
73
|
-
let NavigationPlugin = (() => {
|
|
74
|
-
let _classDecorators = [(0, components_1.Component)({ name: "navigation-tree" })];
|
|
75
|
-
let _classDescriptor;
|
|
76
|
-
let _classExtraInitializers = [];
|
|
77
|
-
let _classThis;
|
|
78
|
-
let _classSuper = components_1.RendererComponent;
|
|
79
|
-
var NavigationPlugin = _classThis = class extends _classSuper {
|
|
80
|
-
initialize() {
|
|
81
|
-
this.owner.on(events_1.RendererEvent.BEGIN, this.onRendererBegin.bind(this));
|
|
82
|
-
}
|
|
83
|
-
onRendererBegin(_event) {
|
|
84
|
-
if (!(this.owner.theme instanceof DefaultTheme_1.DefaultTheme)) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
this.owner.preRenderAsyncJobs.push((event) => this.buildNavigationIndex(event));
|
|
88
|
-
}
|
|
89
|
-
async buildNavigationIndex(event) {
|
|
90
|
-
const navigationJs = Path.join(event.outputDirectory, "assets", "navigation.js");
|
|
91
|
-
const nav = this.owner.theme.getNavigation(event.project);
|
|
92
|
-
const gz = await gzipP(Buffer.from(JSON.stringify(nav)));
|
|
93
|
-
await (0, utils_1.writeFile)(navigationJs, `window.navigationData = "data:application/octet-stream;base64,${gz.toString("base64")}"`);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
__setFunctionName(_classThis, "NavigationPlugin");
|
|
97
|
-
(() => {
|
|
98
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
99
|
-
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
100
|
-
NavigationPlugin = _classThis = _classDescriptor.value;
|
|
101
|
-
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
102
|
-
__runInitializers(_classThis, _classExtraInitializers);
|
|
103
|
-
})();
|
|
104
|
-
return NavigationPlugin = _classThis;
|
|
105
|
-
})();
|
|
106
|
-
exports.NavigationPlugin = NavigationPlugin;
|
|
26
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { RendererComponent } from "../components";
|
|
1
|
+
import { RendererComponent } from "../components.js";
|
|
2
|
+
import type { Renderer } from "../index.js";
|
|
2
3
|
export declare class SitemapPlugin extends RendererComponent {
|
|
3
4
|
private get hostedBaseUrl();
|
|
4
|
-
|
|
5
|
+
constructor(owner: Renderer);
|
|
5
6
|
private onRendererBegin;
|
|
6
7
|
private buildSitemap;
|
|
7
8
|
}
|
|
@@ -1,135 +1,75 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
-
if (kind === "accessor") {
|
|
15
|
-
if (result === void 0) continue;
|
|
16
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
-
}
|
|
21
|
-
else if (_ = accept(result)) {
|
|
22
|
-
if (kind === "field") initializers.unshift(_);
|
|
23
|
-
else descriptor[key] = _;
|
|
24
|
-
}
|
|
1
|
+
import Path from "path";
|
|
2
|
+
import { RendererComponent } from "../components.js";
|
|
3
|
+
import { RendererEvent } from "../events.js";
|
|
4
|
+
import { DefaultTheme } from "../themes/default/DefaultTheme.js";
|
|
5
|
+
import { writeFile } from "../../utils/index.js";
|
|
6
|
+
import { escapeHtml } from "../../utils/html.js";
|
|
7
|
+
import { Fragment } from "../../utils/jsx.js";
|
|
8
|
+
export class SitemapPlugin extends RendererComponent {
|
|
9
|
+
get hostedBaseUrl() {
|
|
10
|
+
const url = this.application.options.getValue("hostedBaseUrl");
|
|
11
|
+
return !url || url.endsWith("/") ? url : url + "/";
|
|
25
12
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
-
var useValue = arguments.length > 2;
|
|
31
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
13
|
+
constructor(owner) {
|
|
14
|
+
super(owner);
|
|
15
|
+
this.owner.on(RendererEvent.BEGIN, this.onRendererBegin.bind(this));
|
|
33
16
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
38
|
-
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
39
|
-
};
|
|
40
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
41
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
42
|
-
};
|
|
43
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
-
exports.SitemapPlugin = void 0;
|
|
45
|
-
const path_1 = __importDefault(require("path"));
|
|
46
|
-
const components_1 = require("../components");
|
|
47
|
-
const events_1 = require("../events");
|
|
48
|
-
const DefaultTheme_1 = require("../themes/default/DefaultTheme");
|
|
49
|
-
const utils_1 = require("../../utils");
|
|
50
|
-
const html_1 = require("../../utils/html");
|
|
51
|
-
const jsx_1 = require("../../utils/jsx");
|
|
52
|
-
let SitemapPlugin = (() => {
|
|
53
|
-
let _classDecorators = [(0, components_1.Component)({ name: "sitemap" })];
|
|
54
|
-
let _classDescriptor;
|
|
55
|
-
let _classExtraInitializers = [];
|
|
56
|
-
let _classThis;
|
|
57
|
-
let _classSuper = components_1.RendererComponent;
|
|
58
|
-
var SitemapPlugin = _classThis = class extends _classSuper {
|
|
59
|
-
get hostedBaseUrl() {
|
|
60
|
-
const url = this.application.options.getValue("hostedBaseUrl");
|
|
61
|
-
return !url || url.endsWith("/") ? url : url + "/";
|
|
62
|
-
}
|
|
63
|
-
initialize() {
|
|
64
|
-
this.owner.on(events_1.RendererEvent.BEGIN, this.onRendererBegin.bind(this));
|
|
17
|
+
onRendererBegin(_event) {
|
|
18
|
+
if (!(this.owner.theme instanceof DefaultTheme)) {
|
|
19
|
+
return;
|
|
65
20
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
if (!this.hostedBaseUrl) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
this.owner.hooks.on("head.begin", (context) => {
|
|
74
|
-
if (context.page.url === "index.html") {
|
|
75
|
-
return {
|
|
76
|
-
tag: "link",
|
|
77
|
-
props: { rel: "canonical", href: this.hostedBaseUrl },
|
|
78
|
-
children: [],
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
return { tag: jsx_1.Fragment, props: null, children: [] };
|
|
82
|
-
});
|
|
83
|
-
this.owner.preRenderAsyncJobs.push((event) => this.buildSitemap(event));
|
|
21
|
+
if (!this.hostedBaseUrl) {
|
|
22
|
+
return;
|
|
84
23
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const sitemapXml = path_1.default.join(event.outputDirectory, "sitemap.xml");
|
|
88
|
-
const lastmod = new Date(this.owner.renderStartTime).toISOString();
|
|
89
|
-
const urls = event.urls?.map((url) => {
|
|
24
|
+
this.owner.hooks.on("head.begin", (context) => {
|
|
25
|
+
if (context.page.url === "index.html") {
|
|
90
26
|
return {
|
|
91
|
-
tag: "
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
tag: "loc",
|
|
95
|
-
children: new URL(url.url, this.hostedBaseUrl).toString(),
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
tag: "lastmod",
|
|
99
|
-
children: lastmod,
|
|
100
|
-
},
|
|
101
|
-
],
|
|
27
|
+
tag: "link",
|
|
28
|
+
props: { rel: "canonical", href: this.hostedBaseUrl },
|
|
29
|
+
children: [],
|
|
102
30
|
};
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
31
|
+
}
|
|
32
|
+
return { tag: Fragment, props: null, children: [] };
|
|
33
|
+
});
|
|
34
|
+
this.owner.preRenderAsyncJobs.push((event) => this.buildSitemap(event));
|
|
35
|
+
}
|
|
36
|
+
async buildSitemap(event) {
|
|
37
|
+
// cSpell:words lastmod urlset
|
|
38
|
+
const sitemapXml = Path.join(event.outputDirectory, "sitemap.xml");
|
|
39
|
+
const lastmod = new Date(this.owner.renderStartTime).toISOString();
|
|
40
|
+
const urls = event.urls?.map((url) => {
|
|
41
|
+
return {
|
|
42
|
+
tag: "url",
|
|
43
|
+
children: [
|
|
44
|
+
{
|
|
45
|
+
tag: "loc",
|
|
46
|
+
children: new URL(url.url, this.hostedBaseUrl).toString(),
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
tag: "lastmod",
|
|
50
|
+
children: lastmod,
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
};
|
|
54
|
+
}) ?? [];
|
|
55
|
+
const sitemap = `<?xml version="1.0" encoding="UTF-8"?>\n` +
|
|
56
|
+
stringifyXml({
|
|
57
|
+
tag: "urlset",
|
|
58
|
+
attr: { xmlns: "http://www.sitemaps.org/schemas/sitemap/0.9" },
|
|
59
|
+
children: urls,
|
|
60
|
+
}) +
|
|
61
|
+
"\n";
|
|
62
|
+
await writeFile(sitemapXml, sitemap);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
125
65
|
function stringifyXml(xml, indent = 0) {
|
|
126
66
|
const parts = ["\t".repeat(indent), "<", xml.tag];
|
|
127
67
|
for (const [key, val] of Object.entries(xml.attr || {})) {
|
|
128
|
-
parts.push(" ", key, '="',
|
|
68
|
+
parts.push(" ", key, '="', escapeHtml(val), '"');
|
|
129
69
|
}
|
|
130
70
|
parts.push(">");
|
|
131
71
|
if (typeof xml.children === "string") {
|
|
132
|
-
parts.push(
|
|
72
|
+
parts.push(escapeHtml(xml.children));
|
|
133
73
|
}
|
|
134
74
|
else {
|
|
135
75
|
for (const child of xml.children) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { MarkedPlugin } from "../themes/MarkedPlugin";
|
|
2
|
-
export { AssetsPlugin } from "./AssetsPlugin";
|
|
3
|
-
export { IconsPlugin } from "./IconsPlugin";
|
|
4
|
-
export { JavascriptIndexPlugin } from "./JavascriptIndexPlugin";
|
|
5
|
-
export { NavigationPlugin } from "./NavigationPlugin";
|
|
6
|
-
export { SitemapPlugin } from "./SitemapPlugin";
|
|
1
|
+
export { MarkedPlugin } from "../themes/MarkedPlugin.js";
|
|
2
|
+
export { AssetsPlugin } from "./AssetsPlugin.js";
|
|
3
|
+
export { IconsPlugin } from "./IconsPlugin.js";
|
|
4
|
+
export { JavascriptIndexPlugin } from "./JavascriptIndexPlugin.js";
|
|
5
|
+
export { NavigationPlugin } from "./NavigationPlugin.js";
|
|
6
|
+
export { SitemapPlugin } from "./SitemapPlugin.js";
|