typedoc 0.27.9 → 0.28.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/README.md +26 -26
- package/bin/package.json +1 -1
- package/dist/browser-locales/en.d.ts +2 -0
- package/dist/browser-locales/en.js +62 -0
- package/dist/browser-locales/ja.d.ts +2 -0
- package/dist/browser-locales/ja.js +62 -0
- package/dist/browser-locales/ko.d.ts +2 -0
- package/dist/browser-locales/ko.js +62 -0
- package/dist/browser-locales/zh.d.ts +2 -0
- package/dist/browser-locales/zh.js +62 -0
- package/dist/browser-utils.d.ts +3 -0
- package/dist/browser-utils.js +3 -0
- package/dist/index.d.ts +15 -9
- package/dist/index.js +13 -7
- package/dist/lib/application.d.ts +9 -10
- package/dist/lib/application.js +75 -56
- package/dist/lib/cli.js +4 -3
- package/dist/lib/converter/comments/blockLexer.js +2 -2
- package/dist/lib/converter/comments/declarationReferenceResolver.d.ts +1 -1
- package/dist/lib/converter/comments/declarationReferenceResolver.js +8 -10
- package/dist/lib/converter/comments/discovery.d.ts +1 -1
- package/dist/lib/converter/comments/discovery.js +3 -4
- package/dist/lib/converter/comments/index.d.ts +1 -1
- package/dist/lib/converter/comments/index.js +5 -7
- package/dist/lib/converter/comments/linkResolver.d.ts +1 -1
- package/dist/lib/converter/comments/linkResolver.js +10 -16
- package/dist/lib/converter/comments/parser.d.ts +2 -2
- package/dist/lib/converter/comments/parser.js +8 -8
- package/dist/lib/converter/comments/textParser.d.ts +3 -2
- package/dist/lib/converter/comments/textParser.js +1 -2
- package/dist/lib/converter/context.d.ts +13 -14
- package/dist/lib/converter/context.js +49 -13
- package/dist/lib/converter/converter.d.ts +10 -5
- package/dist/lib/converter/converter.js +59 -42
- package/dist/lib/converter/factories/index-signature.js +3 -2
- package/dist/lib/converter/factories/signature.js +5 -6
- package/dist/lib/converter/factories/symbol-id.d.ts +4 -0
- package/dist/lib/converter/factories/symbol-id.js +92 -0
- package/dist/lib/converter/factories/types.d.ts +4 -0
- package/dist/lib/converter/factories/types.js +13 -0
- package/dist/lib/converter/index.d.ts +3 -4
- package/dist/lib/converter/index.js +2 -2
- package/dist/lib/converter/jsdoc.js +5 -4
- package/dist/lib/converter/plugins/CategoryPlugin.js +4 -2
- package/dist/lib/converter/plugins/CommentPlugin.d.ts +0 -1
- package/dist/lib/converter/plugins/CommentPlugin.js +8 -6
- package/dist/lib/converter/plugins/GroupPlugin.d.ts +2 -3
- package/dist/lib/converter/plugins/GroupPlugin.js +8 -7
- package/dist/lib/converter/plugins/ImplementsPlugin.js +6 -8
- package/dist/lib/converter/plugins/IncludePlugin.d.ts +1 -1
- package/dist/lib/converter/plugins/IncludePlugin.js +19 -16
- package/dist/lib/converter/plugins/InheritDocPlugin.js +7 -9
- package/dist/lib/converter/plugins/MergeModuleWithPlugin.js +3 -2
- package/dist/lib/converter/plugins/PackagePlugin.d.ts +3 -2
- package/dist/lib/converter/plugins/PackagePlugin.js +23 -19
- package/dist/lib/converter/plugins/SourcePlugin.d.ts +2 -1
- package/dist/lib/converter/plugins/SourcePlugin.js +10 -9
- package/dist/lib/converter/plugins/TypePlugin.d.ts +1 -1
- package/dist/lib/converter/plugins/TypePlugin.js +1 -1
- package/dist/lib/converter/plugins/index.d.ts +1 -1
- package/dist/lib/converter/plugins/index.js +1 -1
- package/dist/lib/converter/symbols.js +103 -32
- package/dist/lib/converter/types.js +14 -13
- package/dist/lib/converter/utils/repository.d.ts +1 -1
- package/dist/lib/converter/utils/repository.js +2 -2
- package/dist/lib/debug/index.d.ts +2 -2
- package/dist/lib/debug/index.js +2 -2
- package/dist/lib/debug/{debugReflectionLifetimes.d.ts → reflectionLifetimes.d.ts} +2 -1
- package/dist/lib/debug/{debugReflectionLifetimes.js → reflectionLifetimes.js} +12 -4
- package/dist/lib/debug/{debugRendererUrls.d.ts → rendererUrls.d.ts} +1 -0
- package/dist/lib/debug/rendererUrls.js +68 -0
- package/dist/lib/internationalization/index.d.ts +2 -1
- package/dist/lib/internationalization/index.js +2 -1
- package/dist/lib/internationalization/internationalization.d.ts +16 -46
- package/dist/lib/internationalization/internationalization.js +44 -213
- package/dist/lib/internationalization/locales/en.cjs +9 -1
- package/dist/lib/internationalization/locales/en.d.cts +9 -1
- package/dist/lib/internationalization/locales/ja.cjs +1 -0
- package/dist/lib/internationalization/locales/zh.cjs +61 -5
- package/dist/lib/internationalization/locales/zh.d.cts +26 -2
- package/dist/lib/internationalization/translatable.d.ts +2 -1
- package/dist/lib/models/{comments/comment.d.ts → Comment.d.ts} +9 -8
- package/dist/lib/models/{comments/comment.js → Comment.js} +15 -18
- package/dist/lib/models/{reflections/container.d.ts → ContainerReflection.d.ts} +6 -6
- package/dist/lib/models/{reflections/container.js → ContainerReflection.js} +4 -5
- package/dist/lib/models/{reflections/declaration.d.ts → DeclarationReflection.d.ts} +11 -19
- package/dist/lib/models/{reflections/declaration.js → DeclarationReflection.js} +11 -29
- package/dist/lib/models/{reflections/document.d.ts → DocumentReflection.d.ts} +3 -3
- package/dist/lib/models/{reflections/document.js → DocumentReflection.js} +3 -3
- package/dist/lib/models/FileRegistry.d.ts +12 -20
- package/dist/lib/models/FileRegistry.js +8 -44
- package/dist/lib/models/{reflections/parameter.d.ts → ParameterReflection.d.ts} +4 -4
- package/dist/lib/models/{reflections/parameter.js → ParameterReflection.js} +2 -2
- package/dist/lib/models/{reflections/project.d.ts → ProjectReflection.d.ts} +12 -21
- package/dist/lib/models/{reflections/project.js → ProjectReflection.js} +16 -48
- package/dist/lib/models/{reflections/reference.d.ts → ReferenceReflection.d.ts} +3 -3
- package/dist/lib/models/{reflections/reference.js → ReferenceReflection.js} +3 -4
- package/dist/lib/models/{reflections/abstract.d.ts → Reflection.d.ts} +15 -28
- package/dist/lib/models/{reflections/abstract.js → Reflection.js} +38 -21
- package/dist/lib/models/ReflectionCategory.d.ts +2 -6
- package/dist/lib/models/ReflectionCategory.js +3 -9
- package/dist/lib/models/ReflectionGroup.d.ts +1 -5
- package/dist/lib/models/ReflectionGroup.js +2 -8
- package/dist/lib/models/{reflections/ReflectionSymbolId.d.ts → ReflectionSymbolId.d.ts} +23 -10
- package/dist/lib/models/ReflectionSymbolId.js +75 -0
- package/dist/lib/models/{reflections/signature.d.ts → SignatureReflection.d.ts} +8 -7
- package/dist/lib/models/{reflections/signature.js → SignatureReflection.js} +7 -11
- package/dist/lib/models/{sources/file.d.ts → SourceReference.d.ts} +3 -4
- package/dist/lib/models/{reflections/type-parameter.d.ts → TypeParameterReflection.d.ts} +6 -5
- package/dist/lib/models/{reflections/type-parameter.js → TypeParameterReflection.js} +4 -1
- package/dist/lib/models/index.d.ts +18 -6
- package/dist/lib/models/index.js +18 -6
- package/dist/lib/models/{reflections/kind.d.ts → kind.d.ts} +2 -8
- package/dist/lib/models/{reflections/kind.js → kind.js} +99 -30
- package/dist/lib/models/types.d.ts +8 -10
- package/dist/lib/models/types.js +11 -22
- package/dist/lib/models/{reflections/variant.d.ts → variant.d.ts} +7 -7
- package/dist/lib/output/components.d.ts +2 -2
- package/dist/lib/output/components.js +1 -1
- package/dist/lib/output/events.d.ts +10 -18
- package/dist/lib/output/events.js +10 -27
- package/dist/lib/output/formatter.d.ts +8 -5
- package/dist/lib/output/formatter.js +45 -18
- package/dist/lib/output/index.d.ts +4 -5
- package/dist/lib/output/index.js +4 -4
- package/dist/lib/output/output.js +5 -4
- package/dist/lib/output/plugins/AssetsPlugin.js +7 -6
- package/dist/lib/output/plugins/HierarchyPlugin.js +4 -3
- package/dist/lib/output/plugins/IconsPlugin.js +3 -3
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +12 -17
- package/dist/lib/output/plugins/SitemapPlugin.js +6 -7
- package/dist/lib/output/renderer.d.ts +22 -14
- package/dist/lib/output/renderer.js +76 -36
- package/dist/lib/output/router.d.ts +175 -0
- package/dist/lib/output/router.js +478 -0
- package/dist/lib/output/theme.d.ts +3 -28
- package/dist/lib/output/theme.js +2 -15
- package/dist/lib/output/themes/MarkedPlugin.d.ts +2 -2
- package/dist/lib/output/themes/MarkedPlugin.js +32 -30
- package/dist/lib/output/themes/default/DefaultTheme.d.ts +11 -40
- package/dist/lib/output/themes/default/DefaultTheme.js +207 -406
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +49 -47
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +17 -14
- package/dist/lib/output/themes/default/Slugger.js +1 -1
- package/dist/lib/output/themes/default/layouts/default.d.ts +1 -1
- package/dist/lib/output/themes/default/layouts/default.js +6 -6
- package/dist/lib/output/themes/default/partials/anchor-icon.d.ts +4 -1
- package/dist/lib/output/themes/default/partials/anchor-icon.js +12 -2
- package/dist/lib/output/themes/default/partials/breadcrumb.d.ts +2 -2
- package/dist/lib/output/themes/default/partials/breadcrumb.js +11 -5
- package/dist/lib/output/themes/default/partials/comment.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/comment.js +9 -9
- package/dist/lib/output/themes/default/partials/footer.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/footer.js +2 -2
- package/dist/lib/output/themes/default/partials/header.d.ts +2 -2
- package/dist/lib/output/themes/default/partials/header.js +4 -3
- package/dist/lib/output/themes/default/partials/hierarchy.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/hierarchy.js +10 -8
- package/dist/lib/output/themes/default/partials/icon.d.ts +2 -3
- package/dist/lib/output/themes/default/partials/icon.js +3 -3
- package/dist/lib/output/themes/default/partials/index.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/index.js +10 -18
- package/dist/lib/output/themes/default/partials/member.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.declaration.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.declaration.js +2 -2
- package/dist/lib/output/themes/default/partials/member.getterSetter.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.getterSetter.js +5 -5
- package/dist/lib/output/themes/default/partials/member.js +10 -9
- package/dist/lib/output/themes/default/partials/member.signature.body.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.signature.body.js +4 -4
- package/dist/lib/output/themes/default/partials/member.signature.title.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.signature.title.js +1 -1
- package/dist/lib/output/themes/default/partials/member.signatures.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.signatures.js +4 -4
- package/dist/lib/output/themes/default/partials/member.sources.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.sources.js +7 -7
- package/dist/lib/output/themes/default/partials/members.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/members.js +2 -2
- package/dist/lib/output/themes/default/partials/moduleReflection.d.ts +2 -2
- package/dist/lib/output/themes/default/partials/moduleReflection.js +5 -5
- package/dist/lib/output/themes/default/partials/navigation.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/navigation.js +17 -15
- package/dist/lib/output/themes/default/partials/reflectionPreview.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/reflectionPreview.js +2 -2
- package/dist/lib/output/themes/default/partials/toolbar.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/toolbar.js +10 -13
- package/dist/lib/output/themes/default/partials/type.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/type.js +1 -1
- package/dist/lib/output/themes/default/partials/typeAndParent.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/typeAndParent.js +3 -3
- package/dist/lib/output/themes/default/partials/typeDetails.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/typeDetails.js +23 -19
- package/dist/lib/output/themes/default/partials/typeParameters.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/typeParameters.js +12 -7
- package/dist/lib/output/themes/default/templates/document.d.ts +1 -1
- package/dist/lib/output/themes/default/templates/document.js +2 -2
- package/dist/lib/output/themes/default/templates/hierarchy.d.ts +1 -1
- package/dist/lib/output/themes/default/templates/hierarchy.js +4 -3
- package/dist/lib/output/themes/default/templates/index.d.ts +1 -1
- package/dist/lib/output/themes/default/templates/index.js +2 -2
- package/dist/lib/output/themes/default/templates/reflection.d.ts +1 -1
- package/dist/lib/output/themes/default/templates/reflection.js +9 -12
- package/dist/lib/output/themes/lib.d.ts +1 -1
- package/dist/lib/output/themes/lib.js +3 -3
- package/dist/lib/serialization/components.d.ts +1 -1
- package/dist/lib/serialization/deserializer.d.ts +9 -13
- package/dist/lib/serialization/deserializer.js +22 -24
- package/dist/lib/serialization/events.d.ts +1 -1
- package/dist/lib/serialization/index.d.ts +1 -1
- package/dist/lib/serialization/index.js +1 -1
- package/dist/lib/serialization/schema.d.ts +15 -10
- package/dist/lib/serialization/schema.js +1 -1
- package/dist/lib/serialization/serializer.d.ts +4 -4
- package/dist/lib/serialization/serializer.js +1 -2
- package/dist/lib/utils/ValidatingFileRegistry.d.ts +10 -0
- package/dist/lib/utils/ValidatingFileRegistry.js +34 -0
- package/dist/lib/utils/component.d.ts +1 -1
- package/dist/lib/utils/component.js +1 -1
- package/dist/lib/utils/entry-point.d.ts +3 -3
- package/dist/lib/utils/entry-point.js +29 -26
- package/dist/lib/utils/fs.d.ts +5 -13
- package/dist/lib/utils/fs.js +11 -67
- package/dist/lib/utils/general.d.ts +1 -47
- package/dist/lib/utils/general.js +4 -74
- package/dist/lib/utils/highlighter.js +1 -2
- package/dist/lib/utils/html.d.ts +0 -1
- package/dist/lib/utils/html.js +4 -13
- package/dist/lib/utils/index.d.ts +9 -17
- package/dist/lib/utils/index.js +8 -15
- package/dist/lib/utils/loggers.d.ts +5 -108
- package/dist/lib/utils/loggers.js +24 -168
- package/dist/lib/utils/options/declaration.d.ts +63 -38
- package/dist/lib/utils/options/declaration.js +124 -66
- package/dist/lib/utils/options/defaults.d.ts +1 -1
- package/dist/lib/utils/options/help.d.ts +1 -2
- package/dist/lib/utils/options/help.js +5 -5
- package/dist/lib/utils/options/index.d.ts +4 -4
- package/dist/lib/utils/options/index.js +3 -3
- package/dist/lib/utils/options/options.d.ts +3 -6
- package/dist/lib/utils/options/options.js +10 -12
- package/dist/lib/utils/options/readers/arguments.d.ts +2 -2
- package/dist/lib/utils/options/readers/arguments.js +4 -3
- package/dist/lib/utils/options/readers/package-json.d.ts +1 -1
- package/dist/lib/utils/options/readers/package-json.js +3 -2
- package/dist/lib/utils/options/readers/tsconfig.d.ts +1 -1
- package/dist/lib/utils/options/readers/tsconfig.js +27 -27
- package/dist/lib/utils/options/readers/typedoc.d.ts +1 -1
- package/dist/lib/utils/options/readers/typedoc.js +8 -9
- package/dist/lib/utils/options/sources/typedoc.js +143 -135
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +1 -1
- package/dist/lib/utils/options/tsdoc-defaults.js +3 -1
- package/dist/lib/utils/package-manifest.d.ts +3 -3
- package/dist/lib/utils/package-manifest.js +9 -8
- package/dist/lib/utils/paths.d.ts +17 -6
- package/dist/lib/utils/paths.js +94 -11
- package/dist/lib/utils/perf.d.ts +4 -1
- package/dist/lib/utils/perf.js +32 -13
- package/dist/lib/utils/plugins.js +4 -3
- package/dist/lib/utils/sort.d.ts +1 -1
- package/dist/lib/utils/sort.js +8 -3
- package/dist/lib/utils/tsconfig.d.ts +1 -1
- package/dist/lib/utils/tsconfig.js +4 -3
- package/dist/lib/utils-common/general.d.ts +40 -0
- package/dist/lib/utils-common/general.js +20 -0
- package/dist/lib/utils-common/i18n.d.ts +17 -0
- package/dist/lib/utils-common/i18n.js +39 -0
- package/dist/lib/utils-common/index.d.ts +16 -0
- package/dist/lib/utils-common/index.js +18 -0
- package/dist/lib/{utils → utils-common}/jsx.d.ts +3 -3
- package/dist/lib/{utils → utils-common}/jsx.js +1 -1
- package/dist/lib/utils-common/logger.d.ts +86 -0
- package/dist/lib/utils-common/logger.js +120 -0
- package/dist/lib/{utils → utils-common}/minimalSourceFile.d.ts +7 -2
- package/dist/lib/{utils → utils-common}/minimalSourceFile.js +3 -2
- package/dist/lib/utils-common/path.d.ts +35 -0
- package/dist/lib/utils-common/path.js +123 -0
- package/dist/lib/utils-common/string.d.ts +11 -0
- package/dist/lib/utils-common/string.js +84 -0
- package/dist/lib/validation/documentation.d.ts +2 -2
- package/dist/lib/validation/documentation.js +5 -6
- package/dist/lib/validation/exports.d.ts +1 -1
- package/dist/lib/validation/exports.js +4 -4
- package/dist/lib/validation/links.d.ts +1 -1
- package/dist/lib/validation/links.js +9 -8
- package/dist/lib/validation/unusedMergeModuleWith.d.ts +1 -1
- package/dist/lib/validation/unusedMergeModuleWith.js +3 -2
- package/package.json +57 -36
- package/static/main.js +4 -4
- package/static/style.css +232 -209
- package/tsdoc.json +8 -0
- package/dist/lib/debug/debugRendererUrls.js +0 -59
- package/dist/lib/internationalization/locales/jp.cjs +0 -3
- package/dist/lib/internationalization/locales/jp.d.cts +0 -2
- package/dist/lib/models/comments/index.d.ts +0 -2
- package/dist/lib/models/comments/index.js +0 -1
- package/dist/lib/models/reflections/ReflectionSymbolId.js +0 -133
- package/dist/lib/models/reflections/index.d.ts +0 -15
- package/dist/lib/models/reflections/index.js +0 -12
- package/dist/lib/models/sources/index.d.ts +0 -1
- package/dist/lib/models/sources/index.js +0 -1
- package/dist/lib/output/models/UrlMapping.d.ts +0 -13
- package/dist/lib/output/models/UrlMapping.js +0 -10
- /package/dist/lib/models/{sources/file.js → SourceReference.js} +0 -0
- /package/dist/lib/models/{reflections/utils.d.ts → utils.d.ts} +0 -0
- /package/dist/lib/models/{reflections/utils.js → utils.js} +0 -0
- /package/dist/lib/models/{reflections/variant.js → variant.js} +0 -0
- /package/dist/lib/{utils → utils-common}/array.d.ts +0 -0
- /package/dist/lib/{utils → utils-common}/array.js +0 -0
- /package/dist/lib/{converter/comments → utils-common}/declarationReference.d.ts +0 -0
- /package/dist/lib/{converter/comments → utils-common}/declarationReference.js +0 -0
- /package/dist/lib/{utils → utils-common}/enum.d.ts +0 -0
- /package/dist/lib/{utils → utils-common}/enum.js +0 -0
- /package/dist/lib/{utils → utils-common}/events.d.ts +0 -0
- /package/dist/lib/{utils → utils-common}/events.js +0 -0
- /package/dist/lib/{utils → utils-common}/hooks.d.ts +0 -0
- /package/dist/lib/{utils → utils-common}/hooks.js +0 -0
- /package/dist/lib/{utils → utils-common}/jsx.elements.d.ts +0 -0
- /package/dist/lib/{utils → utils-common}/jsx.elements.js +0 -0
- /package/dist/lib/{utils → utils-common}/map.d.ts +0 -0
- /package/dist/lib/{utils → utils-common}/map.js +0 -0
- /package/dist/lib/{utils → utils-common}/set.d.ts +0 -0
- /package/dist/lib/{utils → utils-common}/set.js +0 -0
- /package/dist/lib/{utils → utils-common}/validation.d.ts +0 -0
- /package/dist/lib/{utils → utils-common}/validation.js +0 -0
|
@@ -2,9 +2,9 @@ import { join, relative, resolve } from "path";
|
|
|
2
2
|
import ts from "typescript";
|
|
3
3
|
import * as FS from "fs";
|
|
4
4
|
import { expandPackages } from "./package-manifest.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { assertNever } from "
|
|
5
|
+
import { deriveRootDir, getCommonDirectory, MinimatchSet, nicePath, normalizePath } from "./paths.js";
|
|
6
|
+
import { discoverPackageJson, glob, inferPackageEntryPointPaths, isDir } from "./fs.js";
|
|
7
|
+
import { assertNever, i18n } from "#utils";
|
|
8
8
|
/**
|
|
9
9
|
* Defines how entry points are interpreted.
|
|
10
10
|
* @enum
|
|
@@ -33,7 +33,7 @@ export const EntryPointStrategy = {
|
|
|
33
33
|
export function inferEntryPoints(logger, options) {
|
|
34
34
|
const packageJson = discoverPackageJson(options.packageDir ?? process.cwd());
|
|
35
35
|
if (!packageJson) {
|
|
36
|
-
logger.warn(
|
|
36
|
+
logger.warn(i18n.no_entry_points_provided());
|
|
37
37
|
return [];
|
|
38
38
|
}
|
|
39
39
|
const pathEntries = inferPackageEntryPointPaths(packageJson.file);
|
|
@@ -63,18 +63,18 @@ export function inferEntryPoints(logger, options) {
|
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
else if (/\.[cm]?js$/.test(path)) {
|
|
66
|
-
logger.warn(
|
|
66
|
+
logger.warn(i18n.failed_to_resolve_0_to_ts_path(nicePath(path)));
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
if (entryPoints.length === 0) {
|
|
70
|
-
logger.warn(
|
|
70
|
+
logger.warn(i18n.no_entry_points_provided());
|
|
71
71
|
return [];
|
|
72
72
|
}
|
|
73
73
|
return entryPoints;
|
|
74
74
|
}
|
|
75
75
|
export function getEntryPoints(logger, options) {
|
|
76
76
|
if (!options.isSet("entryPoints")) {
|
|
77
|
-
logger.warn(
|
|
77
|
+
logger.warn(i18n.no_entry_points_provided());
|
|
78
78
|
return [];
|
|
79
79
|
}
|
|
80
80
|
const entryPoints = options.getValue("entryPoints");
|
|
@@ -101,7 +101,7 @@ export function getEntryPoints(logger, options) {
|
|
|
101
101
|
assertNever(strategy);
|
|
102
102
|
}
|
|
103
103
|
if (result.length === 0) {
|
|
104
|
-
logger.error(
|
|
104
|
+
logger.error(i18n.unable_to_find_any_entry_points());
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
107
|
return result;
|
|
@@ -122,7 +122,7 @@ export function getDocumentEntryPoints(logger, options) {
|
|
|
122
122
|
// that have at some point or another been used for markdown: https://superuser.com/a/285878
|
|
123
123
|
const supportedFileRegex = /\.(md|markdown)$/;
|
|
124
124
|
const expanded = expandInputFiles(logger, docPaths, options, supportedFileRegex);
|
|
125
|
-
const baseDir = options.getValue("basePath") ||
|
|
125
|
+
const baseDir = options.getValue("basePath") || getCommonDirectory(expanded);
|
|
126
126
|
return expanded.map((path) => {
|
|
127
127
|
return {
|
|
128
128
|
displayName: relative(baseDir, path).replace(/\.[^.]+$/, ""),
|
|
@@ -143,22 +143,22 @@ export function getWatchEntryPoints(logger, options, program) {
|
|
|
143
143
|
result = getExpandedEntryPointsForPaths(logger, expandGlobs(entryPoints, exclude, logger), options, [program]);
|
|
144
144
|
break;
|
|
145
145
|
case EntryPointStrategy.Packages:
|
|
146
|
-
logger.error(
|
|
146
|
+
logger.error(i18n.watch_does_not_support_packages_mode());
|
|
147
147
|
break;
|
|
148
148
|
case EntryPointStrategy.Merge:
|
|
149
|
-
logger.error(
|
|
149
|
+
logger.error(i18n.watch_does_not_support_merge_mode());
|
|
150
150
|
break;
|
|
151
151
|
default:
|
|
152
152
|
assertNever(strategy);
|
|
153
153
|
}
|
|
154
154
|
if (result && result.length === 0) {
|
|
155
|
-
logger.error(
|
|
155
|
+
logger.error(i18n.unable_to_find_any_entry_points());
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
158
|
return result;
|
|
159
159
|
}
|
|
160
160
|
export function getPackageDirectories(logger, options, packageGlobPaths) {
|
|
161
|
-
const exclude =
|
|
161
|
+
const exclude = new MinimatchSet(options.getValue("exclude"));
|
|
162
162
|
const rootDir = deriveRootDir(packageGlobPaths);
|
|
163
163
|
// packages arguments are workspace tree roots, or glob patterns
|
|
164
164
|
// This expands them to leave only leaf packages
|
|
@@ -172,7 +172,7 @@ function getModuleName(fileName, baseDir) {
|
|
|
172
172
|
* This is in contrast with the package-oriented `getEntryPointsForPackages`
|
|
173
173
|
*/
|
|
174
174
|
function getEntryPointsForPaths(logger, inputFiles, options, programs = getEntryPrograms(inputFiles, logger, options)) {
|
|
175
|
-
const baseDir = options.getValue("basePath") ||
|
|
175
|
+
const baseDir = options.getValue("basePath") || getCommonDirectory(inputFiles);
|
|
176
176
|
const entryPoints = [];
|
|
177
177
|
let expandSuggestion = true;
|
|
178
178
|
entryLoop: for (const fileOrDir of inputFiles.map(normalizePath)) {
|
|
@@ -193,10 +193,10 @@ function getEntryPointsForPaths(logger, inputFiles, options, programs = getEntry
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
logger.warn(
|
|
196
|
+
logger.warn(i18n.entry_point_0_not_in_program(nicePath(fileOrDir)));
|
|
197
197
|
if (expandSuggestion && isDir(fileOrDir)) {
|
|
198
198
|
expandSuggestion = false;
|
|
199
|
-
logger.info(
|
|
199
|
+
logger.info(i18n.use_expand_or_glob_for_files_in_dir());
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
return entryPoints;
|
|
@@ -208,20 +208,23 @@ export function getExpandedEntryPointsForPaths(logger, inputFiles, options, prog
|
|
|
208
208
|
: /\.([cm]ts|tsx?)$/;
|
|
209
209
|
return getEntryPointsForPaths(logger, expandInputFiles(logger, inputFiles, options, supportedFileRegex), options, programs);
|
|
210
210
|
}
|
|
211
|
-
function expandGlobs(
|
|
212
|
-
const excludePatterns =
|
|
213
|
-
const base = deriveRootDir(
|
|
214
|
-
const result =
|
|
211
|
+
function expandGlobs(globs, exclude, logger) {
|
|
212
|
+
const excludePatterns = new MinimatchSet(exclude);
|
|
213
|
+
const base = deriveRootDir(globs);
|
|
214
|
+
const result = globs.flatMap((entry) => {
|
|
215
215
|
const result = glob(entry, base, {
|
|
216
216
|
includeDirectories: true,
|
|
217
217
|
followSymlinks: true,
|
|
218
218
|
});
|
|
219
|
-
const filtered = result.filter((file) => file === entry || !matchesAny(
|
|
219
|
+
const filtered = result.filter((file) => file === entry || !excludePatterns.matchesAny(file));
|
|
220
220
|
if (result.length === 0) {
|
|
221
|
-
logger.warn(
|
|
221
|
+
logger.warn(i18n.glob_0_did_not_match_any_files(nicePath(entry)));
|
|
222
|
+
if (entry.includes("\\") && !entry.includes("/")) {
|
|
223
|
+
logger.info(i18n.glob_should_use_posix_slash());
|
|
224
|
+
}
|
|
222
225
|
}
|
|
223
226
|
else if (filtered.length === 0) {
|
|
224
|
-
logger.warn(
|
|
227
|
+
logger.warn(i18n.entry_point_0_did_not_match_any_files_after_exclude(nicePath(entry)));
|
|
225
228
|
}
|
|
226
229
|
else if (filtered.length !== 1) {
|
|
227
230
|
logger.verbose(`Expanded ${nicePath(entry)} to:\n\t${filtered
|
|
@@ -275,7 +278,7 @@ function getEntryPrograms(inputFiles, logger, options) {
|
|
|
275
278
|
*/
|
|
276
279
|
function expandInputFiles(logger, entryPoints, options, supportedFile) {
|
|
277
280
|
const files = [];
|
|
278
|
-
const exclude =
|
|
281
|
+
const exclude = new MinimatchSet(options.getValue("exclude"));
|
|
279
282
|
function add(file, entryPoint) {
|
|
280
283
|
let stats;
|
|
281
284
|
try {
|
|
@@ -295,7 +298,7 @@ function expandInputFiles(logger, entryPoints, options, supportedFile) {
|
|
|
295
298
|
});
|
|
296
299
|
}
|
|
297
300
|
else if (supportedFile.test(file)) {
|
|
298
|
-
if (!entryPoint && matchesAny(
|
|
301
|
+
if (!entryPoint && exclude.matchesAny(file)) {
|
|
299
302
|
return;
|
|
300
303
|
}
|
|
301
304
|
files.push(normalizePath(file));
|
|
@@ -304,7 +307,7 @@ function expandInputFiles(logger, entryPoints, options, supportedFile) {
|
|
|
304
307
|
entryPoints.forEach((file) => {
|
|
305
308
|
const resolved = resolve(file);
|
|
306
309
|
if (!FS.existsSync(resolved)) {
|
|
307
|
-
logger.warn(
|
|
310
|
+
logger.warn(i18n.entry_point_0_did_not_exist(file));
|
|
308
311
|
return;
|
|
309
312
|
}
|
|
310
313
|
add(resolved, true);
|
package/dist/lib/utils/fs.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
+
import { type GlobString, type NormalizedPath } from "#utils";
|
|
1
2
|
export declare function isFile(file: string): boolean;
|
|
2
3
|
export declare function isDir(path: string): boolean;
|
|
3
|
-
export declare function deriveRootDir(globPaths: string[]): string;
|
|
4
|
-
/**
|
|
5
|
-
* Get the longest directory path common to all files.
|
|
6
|
-
*/
|
|
7
|
-
export declare function getCommonDirectory(files: readonly string[]): string;
|
|
8
4
|
/**
|
|
9
5
|
* Load the given file and return its contents.
|
|
10
6
|
*
|
|
@@ -43,20 +39,16 @@ export interface DiscoverFilesController {
|
|
|
43
39
|
/** Defaults to false */
|
|
44
40
|
followSymlinks?: boolean;
|
|
45
41
|
}
|
|
46
|
-
export declare function discoverFiles(rootDir:
|
|
42
|
+
export declare function discoverFiles(rootDir: NormalizedPath, controller: DiscoverFilesController): NormalizedPath[];
|
|
47
43
|
/**
|
|
48
44
|
* Simpler version of `glob.sync` that only covers our use cases, always ignoring node_modules.
|
|
49
45
|
*/
|
|
50
|
-
export declare function glob(pattern:
|
|
46
|
+
export declare function glob(pattern: GlobString, root: NormalizedPath, options?: {
|
|
51
47
|
includeDirectories?: boolean;
|
|
52
48
|
followSymlinks?: boolean;
|
|
53
|
-
}):
|
|
49
|
+
}): NormalizedPath[];
|
|
54
50
|
export declare function hasTsExtension(path: string): boolean;
|
|
55
51
|
export declare function hasDeclarationFileExtension(path: string): boolean;
|
|
56
|
-
export declare function discoverInParentDir<T extends {}>(name: string, dir: string, read: (content: string) => T | undefined): {
|
|
57
|
-
file: string;
|
|
58
|
-
content: T;
|
|
59
|
-
} | undefined;
|
|
60
52
|
export declare function discoverInParentDirExactMatch<T extends {}>(name: string, dir: string, read: (content: string) => T | undefined, usedFile?: (path: string) => void): {
|
|
61
53
|
file: string;
|
|
62
54
|
content: T;
|
|
@@ -69,5 +61,5 @@ export declare function discoverPackageJson(dir: string, usedFile?: (path: strin
|
|
|
69
61
|
name: string;
|
|
70
62
|
};
|
|
71
63
|
} | undefined;
|
|
72
|
-
export declare function findPackageForPath(sourcePath: string): string | undefined;
|
|
64
|
+
export declare function findPackageForPath(sourcePath: string): readonly [packageName: string, packageDir: string] | undefined;
|
|
73
65
|
export declare function inferPackageEntryPointPaths(packagePath: string): [importPath: string, resolvedPath: string][];
|
package/dist/lib/utils/fs.js
CHANGED
|
@@ -2,10 +2,8 @@ import * as fs from "fs";
|
|
|
2
2
|
import { promises as fsp } from "fs";
|
|
3
3
|
import { Minimatch } from "minimatch";
|
|
4
4
|
import { dirname, join, relative, resolve } from "path";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { filterMap } from "./array.js";
|
|
8
|
-
import { escapeRegExp } from "./general.js";
|
|
5
|
+
import { escapeRegExp, Validation } from "#utils";
|
|
6
|
+
import { normalizePath } from "./paths.js";
|
|
9
7
|
import { ok } from "assert";
|
|
10
8
|
export function isFile(file) {
|
|
11
9
|
try {
|
|
@@ -23,39 +21,6 @@ export function isDir(path) {
|
|
|
23
21
|
return false;
|
|
24
22
|
}
|
|
25
23
|
}
|
|
26
|
-
export function deriveRootDir(globPaths) {
|
|
27
|
-
const normalized = globPaths.map(normalizePath);
|
|
28
|
-
const globs = createMinimatch(normalized);
|
|
29
|
-
const rootPaths = globs.flatMap((glob, i) => filterMap(glob.set, (set) => {
|
|
30
|
-
const stop = set.findIndex((part) => typeof part !== "string");
|
|
31
|
-
if (stop === -1) {
|
|
32
|
-
return normalized[i];
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
const kept = set.slice(0, stop).join("/");
|
|
36
|
-
return normalized[i].substring(0, normalized[i].indexOf(kept) + kept.length);
|
|
37
|
-
}
|
|
38
|
-
}));
|
|
39
|
-
return getCommonDirectory(rootPaths);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Get the longest directory path common to all files.
|
|
43
|
-
*/
|
|
44
|
-
export function getCommonDirectory(files) {
|
|
45
|
-
if (!files.length) {
|
|
46
|
-
return "";
|
|
47
|
-
}
|
|
48
|
-
const roots = files.map((f) => f.split(/\\|\//));
|
|
49
|
-
if (roots.length === 1) {
|
|
50
|
-
return roots[0].slice(0, -1).join("/");
|
|
51
|
-
}
|
|
52
|
-
let i = 0;
|
|
53
|
-
while (i < roots[0].length &&
|
|
54
|
-
new Set(roots.map((part) => part[i])).size === 1) {
|
|
55
|
-
i++;
|
|
56
|
-
}
|
|
57
|
-
return roots[0].slice(0, i).join("/");
|
|
58
|
-
}
|
|
59
24
|
/**
|
|
60
25
|
* Load the given file and return its contents.
|
|
61
26
|
*
|
|
@@ -171,8 +136,7 @@ export function discoverFiles(rootDir, controller) {
|
|
|
171
136
|
const childPath = [...dir, path].join("/");
|
|
172
137
|
let realpath;
|
|
173
138
|
try {
|
|
174
|
-
realpath =
|
|
175
|
-
realpathCache.get(childPath) ?? fs.realpathSync(childPath);
|
|
139
|
+
realpath = realpathCache.get(childPath) ?? fs.realpathSync(childPath);
|
|
176
140
|
realpathCache.set(childPath, realpath);
|
|
177
141
|
}
|
|
178
142
|
catch {
|
|
@@ -229,7 +193,7 @@ export function discoverFiles(rootDir, controller) {
|
|
|
229
193
|
* Simpler version of `glob.sync` that only covers our use cases, always ignoring node_modules.
|
|
230
194
|
*/
|
|
231
195
|
export function glob(pattern, root, options = {}) {
|
|
232
|
-
const mini = new Minimatch(
|
|
196
|
+
const mini = new Minimatch(pattern);
|
|
233
197
|
const shouldIncludeNodeModules = pattern.includes("node_modules");
|
|
234
198
|
const controller = {
|
|
235
199
|
matches(path) {
|
|
@@ -257,27 +221,6 @@ export function hasTsExtension(path) {
|
|
|
257
221
|
export function hasDeclarationFileExtension(path) {
|
|
258
222
|
return /\.d\.[cm]?ts$/.test(path);
|
|
259
223
|
}
|
|
260
|
-
export function discoverInParentDir(name, dir, read) {
|
|
261
|
-
if (!isDir(dir))
|
|
262
|
-
return;
|
|
263
|
-
const reachedTopDirectory = (dirName) => dirName === resolve(join(dirName, ".."));
|
|
264
|
-
while (!reachedTopDirectory(dir)) {
|
|
265
|
-
for (const file of fs.readdirSync(dir)) {
|
|
266
|
-
if (file.toLowerCase() !== name.toLowerCase())
|
|
267
|
-
continue;
|
|
268
|
-
try {
|
|
269
|
-
const content = read(readFile(join(dir, file)));
|
|
270
|
-
if (content != null) {
|
|
271
|
-
return { file: join(dir, file), content };
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
catch {
|
|
275
|
-
// Ignore, file didn't pass validation
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
dir = resolve(join(dir, ".."));
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
224
|
export function discoverInParentDirExactMatch(name, dir, read, usedFile) {
|
|
282
225
|
if (!isDir(dir))
|
|
283
226
|
return;
|
|
@@ -299,12 +242,12 @@ export function discoverInParentDirExactMatch(name, dir, read, usedFile) {
|
|
|
299
242
|
export function discoverPackageJson(dir, usedFile) {
|
|
300
243
|
return discoverInParentDirExactMatch("package.json", dir, (content) => {
|
|
301
244
|
const pkg = JSON.parse(content);
|
|
302
|
-
if (validate({ name: String, version: optional(String) }, pkg)) {
|
|
245
|
+
if (Validation.validate({ name: String, version: Validation.optional(String) }, pkg)) {
|
|
303
246
|
return pkg;
|
|
304
247
|
}
|
|
305
248
|
}, usedFile);
|
|
306
249
|
}
|
|
307
|
-
// dir -> package
|
|
250
|
+
// dir -> package info
|
|
308
251
|
const packageCache = new Map();
|
|
309
252
|
export function findPackageForPath(sourcePath) {
|
|
310
253
|
// Attempt to decide package name from path if it contains "node_modules"
|
|
@@ -316,7 +259,8 @@ export function findPackageForPath(sourcePath) {
|
|
|
316
259
|
if (sourcePath[startIndex] === "@") {
|
|
317
260
|
stopIndex = sourcePath.indexOf("/", stopIndex + 1);
|
|
318
261
|
}
|
|
319
|
-
|
|
262
|
+
const packageName = sourcePath.substring(startIndex, stopIndex);
|
|
263
|
+
return [packageName, sourcePath.substring(0, stopIndex)];
|
|
320
264
|
}
|
|
321
265
|
const dir = dirname(sourcePath);
|
|
322
266
|
const cache = packageCache.get(dir);
|
|
@@ -325,12 +269,12 @@ export function findPackageForPath(sourcePath) {
|
|
|
325
269
|
}
|
|
326
270
|
const packageJson = discoverPackageJson(dir);
|
|
327
271
|
if (packageJson) {
|
|
328
|
-
packageCache.set(dir, packageJson.content.name);
|
|
329
|
-
return packageJson.content.name;
|
|
272
|
+
packageCache.set(dir, [packageJson.content.name, dirname(packageJson.file)]);
|
|
273
|
+
return [packageJson.content.name, dirname(packageJson.file)];
|
|
330
274
|
}
|
|
331
275
|
}
|
|
332
276
|
export function inferPackageEntryPointPaths(packagePath) {
|
|
333
|
-
const packageDir = dirname(packagePath);
|
|
277
|
+
const packageDir = normalizePath(dirname(packagePath));
|
|
334
278
|
const packageJson = JSON.parse(readFile(packagePath));
|
|
335
279
|
const exports = packageJson.exports;
|
|
336
280
|
if (typeof exports === "string") {
|
|
@@ -1,50 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This type provides a flag that can be used to turn off more lax overloads intended for
|
|
3
|
-
* plugin use only to catch type errors in the TypeDoc codebase. The prepublishOnly npm
|
|
4
|
-
* script will be used to switch this flag to false when publishing, then immediately back
|
|
5
|
-
* to true after a successful publish.
|
|
6
|
-
*/
|
|
7
|
-
type InternalOnly = false;
|
|
8
|
-
/**
|
|
9
|
-
* Helper type to convert `T` to `F` if compiling TypeDoc with stricter types.
|
|
10
|
-
*
|
|
11
|
-
* Can be used in overloads to map a parameter type to `never`. For example, the
|
|
12
|
-
* following function will work with any string argument, but to improve the type safety
|
|
13
|
-
* of internal code, we only ever want to pass 'a' or 'b' to it. Plugins on the other
|
|
14
|
-
* hand need to be able to pass any string to it. Overloads similar to this are used
|
|
15
|
-
* in the {@link Options} class.
|
|
16
|
-
*
|
|
17
|
-
* This is also used to prevent TypeDoc code from using deprecated methods which will
|
|
18
|
-
* be removed in a future release.
|
|
19
|
-
*
|
|
20
|
-
* ```ts
|
|
21
|
-
* function over(flag: 'a' | 'b'): string
|
|
22
|
-
* // deprecated
|
|
23
|
-
* function over(flag: IfInternal<never, string>): string
|
|
24
|
-
* function over(flag: string): string { return flag }
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export type IfInternal<T, F> = InternalOnly extends true ? T : F;
|
|
28
|
-
/**
|
|
29
|
-
* Helper type to convert `T` to `never` if compiling TypeDoc with stricter types.
|
|
30
|
-
*
|
|
31
|
-
* See {@link IfInternal} for the rationale.
|
|
32
|
-
*/
|
|
33
|
-
export type NeverIfInternal<T> = IfInternal<never, T>;
|
|
34
|
-
/**
|
|
35
|
-
* Resolves a string type into a union of characters, `"ab"` turns into `"a" | "b"`.
|
|
36
|
-
*/
|
|
37
|
-
export type Chars<T extends string> = T extends `${infer C}${infer R}` ? C | Chars<R> : never;
|
|
38
|
-
/**
|
|
39
|
-
* Utility to help type checking ensure that there is no uncovered case.
|
|
40
|
-
*/
|
|
41
|
-
export declare function assertNever(x: never): never;
|
|
42
|
-
export declare function escapeRegExp(s: string): string;
|
|
43
|
-
export declare function editDistance(s: string, t: string): number;
|
|
44
|
-
export declare function dedent(text: string): string;
|
|
45
|
-
export declare function getSimilarValues(values: Iterable<string>, compareTo: string): string[];
|
|
46
|
-
export declare function NonEnumerable(_cls: unknown, context: ClassFieldDecoratorContext): void;
|
|
47
1
|
export declare const TYPEDOC_ROOT: string;
|
|
48
2
|
export declare function hasBeenLoadedMultipleTimes(): boolean;
|
|
49
3
|
export declare function getLoadedPaths(): string[];
|
|
50
|
-
export
|
|
4
|
+
export declare function isDebugging(): boolean;
|
|
@@ -1,79 +1,6 @@
|
|
|
1
1
|
import { dirname } from "path";
|
|
2
|
-
import * as Util from "util";
|
|
3
2
|
import url from "url";
|
|
4
|
-
import {
|
|
5
|
-
/**
|
|
6
|
-
* Utility to help type checking ensure that there is no uncovered case.
|
|
7
|
-
*/
|
|
8
|
-
export function assertNever(x) {
|
|
9
|
-
throw new Error(`Expected handling to cover all possible cases, but it didn't cover: ${Util.inspect(x)}`);
|
|
10
|
-
}
|
|
11
|
-
// From MDN
|
|
12
|
-
export function escapeRegExp(s) {
|
|
13
|
-
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
|
|
14
|
-
}
|
|
15
|
-
// Based on https://en.wikipedia.org/wiki/Levenshtein_distance#Iterative_with_two_matrix_rows
|
|
16
|
-
// Slightly modified for improved match results for options
|
|
17
|
-
export function editDistance(s, t) {
|
|
18
|
-
if (s.length < t.length)
|
|
19
|
-
return editDistance(t, s);
|
|
20
|
-
let v0 = Array.from({ length: t.length + 1 }, (_, i) => i);
|
|
21
|
-
let v1 = Array.from({ length: t.length + 1 }, () => 0);
|
|
22
|
-
for (let i = 0; i < s.length; i++) {
|
|
23
|
-
v1[0] = i + 1;
|
|
24
|
-
for (let j = 0; j < s.length; j++) {
|
|
25
|
-
const deletionCost = v0[j + 1] + 1;
|
|
26
|
-
const insertionCost = v1[j] + 1;
|
|
27
|
-
let substitutionCost;
|
|
28
|
-
if (s[i] === t[j]) {
|
|
29
|
-
substitutionCost = v0[j];
|
|
30
|
-
}
|
|
31
|
-
else if (s[i]?.toUpperCase() === t[j]?.toUpperCase()) {
|
|
32
|
-
substitutionCost = v0[j] + 1;
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
substitutionCost = v0[j] + 3;
|
|
36
|
-
}
|
|
37
|
-
v1[j + 1] = Math.min(deletionCost, insertionCost, substitutionCost);
|
|
38
|
-
}
|
|
39
|
-
[v0, v1] = [v1, v0];
|
|
40
|
-
}
|
|
41
|
-
return v0[t.length];
|
|
42
|
-
}
|
|
43
|
-
export function dedent(text) {
|
|
44
|
-
const lines = text.split(/\r?\n/);
|
|
45
|
-
while (lines.length && lines[0].search(/\S/) === -1) {
|
|
46
|
-
lines.shift();
|
|
47
|
-
}
|
|
48
|
-
while (lines.length && lines[lines.length - 1].search(/\S/) === -1) {
|
|
49
|
-
lines.pop();
|
|
50
|
-
}
|
|
51
|
-
const minIndent = lines.reduce((indent, line) => line.length ? Math.min(indent, line.search(/\S/)) : indent, Infinity);
|
|
52
|
-
return lines.map((line) => line.substring(minIndent)).join("\n");
|
|
53
|
-
}
|
|
54
|
-
export function getSimilarValues(values, compareTo) {
|
|
55
|
-
const results = new DefaultMap(() => []);
|
|
56
|
-
let lowest = Infinity;
|
|
57
|
-
for (const name of values) {
|
|
58
|
-
const distance = editDistance(compareTo, name);
|
|
59
|
-
lowest = Math.min(lowest, distance);
|
|
60
|
-
results.get(distance).push(name);
|
|
61
|
-
}
|
|
62
|
-
// Experimenting a bit, it seems an edit distance of 3 is roughly the
|
|
63
|
-
// right metric for relevant "similar" results without showing obviously wrong suggestions
|
|
64
|
-
return results
|
|
65
|
-
.get(lowest)
|
|
66
|
-
.concat(results.get(lowest + 1), results.get(lowest + 2));
|
|
67
|
-
}
|
|
68
|
-
export function NonEnumerable(_cls, context) {
|
|
69
|
-
context.addInitializer(function () {
|
|
70
|
-
Object.defineProperty(this, context.name, {
|
|
71
|
-
enumerable: false,
|
|
72
|
-
configurable: true,
|
|
73
|
-
writable: true,
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
}
|
|
3
|
+
import { url as debuggerUrl } from "inspector";
|
|
77
4
|
// transform /abs/path/to/typedoc/dist/lib/utils/general -> /abs/path/to/typedoc
|
|
78
5
|
export const TYPEDOC_ROOT = dirname(dirname(dirname(dirname(url.fileURLToPath(import.meta.url)))));
|
|
79
6
|
/**
|
|
@@ -93,3 +20,6 @@ export function hasBeenLoadedMultipleTimes() {
|
|
|
93
20
|
export function getLoadedPaths() {
|
|
94
21
|
return g[pathSymbol] || [];
|
|
95
22
|
}
|
|
23
|
+
export function isDebugging() {
|
|
24
|
+
return !!debuggerUrl();
|
|
25
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as shiki from "@gerrit0/mini-shiki";
|
|
2
|
-
import
|
|
3
|
-
import { unique } from "./array.js";
|
|
2
|
+
import { JSX, unique } from "#utils";
|
|
4
3
|
import assert from "assert";
|
|
5
4
|
const aliases = new Map();
|
|
6
5
|
for (const lang of shiki.bundledLanguagesInfo) {
|
package/dist/lib/utils/html.d.ts
CHANGED
package/dist/lib/utils/html.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { assertNever } from "
|
|
1
|
+
import { assertNever } from "#utils";
|
|
2
2
|
import { htmlEntities } from "./html-entities.js";
|
|
3
3
|
const htmlEntitiesTrie = {};
|
|
4
4
|
for (const [name, data] of Object.entries(htmlEntities)) {
|
|
@@ -9,16 +9,6 @@ for (const [name, data] of Object.entries(htmlEntities)) {
|
|
|
9
9
|
}
|
|
10
10
|
current.data = data;
|
|
11
11
|
}
|
|
12
|
-
const htmlEscapes = {
|
|
13
|
-
"&": "&",
|
|
14
|
-
"<": "<",
|
|
15
|
-
">": ">",
|
|
16
|
-
'"': """,
|
|
17
|
-
"'": "'",
|
|
18
|
-
};
|
|
19
|
-
export function escapeHtml(html) {
|
|
20
|
-
return html.replace(/[&<>'"]/g, (c) => htmlEscapes[c]);
|
|
21
|
-
}
|
|
22
12
|
/**
|
|
23
13
|
* Replaces non-[URL code points](https://url.spec.whatwg.org/#url-code-points)
|
|
24
14
|
* with an underscore. Also disallows some additional special characters which either
|
|
@@ -27,6 +17,8 @@ export function escapeHtml(html) {
|
|
|
27
17
|
* Ref: #2714
|
|
28
18
|
*/
|
|
29
19
|
export function createNormalizedUrl(url) {
|
|
20
|
+
// We are intentionally operating on code points here.
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-spread
|
|
30
22
|
const codePoints = [...url].map((c) => c.codePointAt(0));
|
|
31
23
|
for (let i = 0; i < codePoints.length; ++i) {
|
|
32
24
|
if (isalnum(codePoints[i]))
|
|
@@ -591,8 +583,7 @@ export class HtmlAttributeParser {
|
|
|
591
583
|
// If the number is a noncharacter, then this is a noncharacter-character-reference parse error.
|
|
592
584
|
// ... and do nothing, so don't bother checking.
|
|
593
585
|
// Handle replacements
|
|
594
|
-
this.characterReferenceCode =
|
|
595
|
-
characterReferenceCodePointReplacements.get(this.characterReferenceCode) ?? this.characterReferenceCode;
|
|
586
|
+
this.characterReferenceCode = characterReferenceCodePointReplacements.get(this.characterReferenceCode) ?? this.characterReferenceCode;
|
|
596
587
|
this.temporaryBuffer = [this.characterReferenceCode];
|
|
597
588
|
this.flushTemporaryBuffer();
|
|
598
589
|
}
|
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
export { filterMap, insertPrioritySorted, partition, removeIf, removeIfPresent, unique, } from "./array.js";
|
|
2
1
|
export { AbstractComponent } from "./component.js";
|
|
3
|
-
export * from "./
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export type {
|
|
8
|
-
export
|
|
9
|
-
export { ConsoleLogger, Logger, LogLevel } from "./loggers.js";
|
|
10
|
-
export { DefaultMap } from "./map.js";
|
|
11
|
-
export { ArgumentsReader, Option, CommentStyle, Options, PackageJsonReader, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, OptionDefaults, } from "./options/index.js";
|
|
12
|
-
export type { ArrayDeclarationOption, BooleanDeclarationOption, DeclarationOption, DeclarationOptionBase, DeclarationOptionToOptionType, KeyToDeclaration, MapDeclarationOption, MixedDeclarationOption, NumberDeclarationOption, FlagsDeclarationOption, ObjectDeclarationOption, OptionsReader, StringDeclarationOption, TypeDocOptionMap, TypeDocOptions, ValidationOptions, TypeDocOptionValues, ParameterTypeToOptionTypeMap, ManuallyValidatedOption, JsDocCompatibility, OutputSpecification, } from "./options/index.js";
|
|
2
|
+
export * from "./fs.js";
|
|
3
|
+
export { getLoadedPaths, hasBeenLoadedMultipleTimes, TYPEDOC_ROOT } from "./general.js";
|
|
4
|
+
export { FancyConsoleLogger } from "./loggers.js";
|
|
5
|
+
export { ArgumentsReader, CommentStyle, Option, OptionDefaults, Options, PackageJsonReader, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, } from "./options/index.js";
|
|
6
|
+
export type { ArrayDeclarationOption, BooleanDeclarationOption, DeclarationOption, DeclarationOptionBase, DeclarationOptionToOptionType, FlagsDeclarationOption, JsDocCompatibility, KeyToDeclaration, ManuallyValidatedOption, MapDeclarationOption, MixedDeclarationOption, NumberDeclarationOption, ObjectDeclarationOption, OptionsReader, OutputSpecification, ParameterTypeToOptionTypeMap, StringDeclarationOption, TypeDocOptionMap, TypeDocOptions, TypeDocOptionValues, ValidationOptions, } from "./options/index.js";
|
|
7
|
+
export * from "./paths.js";
|
|
13
8
|
export { loadPlugins } from "./plugins.js";
|
|
14
9
|
export { getSortFunction } from "./sort.js";
|
|
15
10
|
export type { SortStrategy } from "./sort.js";
|
|
16
|
-
export { EventHooks } from "./hooks.js";
|
|
17
11
|
export * from "./entry-point.js";
|
|
18
|
-
|
|
19
|
-
export
|
|
20
|
-
export { Fragment, Raw, renderElement } from "./jsx.js";
|
|
21
|
-
export * as Validation from "./validation.js";
|
|
12
|
+
export * from "./html.js";
|
|
13
|
+
export * from "./tsconfig.js";
|
|
22
14
|
export * from "./tsutils.js";
|
|
23
|
-
export
|
|
15
|
+
export * from "./ValidatingFileRegistry.js";
|
package/dist/lib/utils/index.js
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
export { filterMap, insertPrioritySorted, partition, removeIf, removeIfPresent, unique, } from "./array.js";
|
|
2
1
|
export { AbstractComponent } from "./component.js";
|
|
3
|
-
export * from "./
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export
|
|
8
|
-
export { ConsoleLogger, Logger, LogLevel } from "./loggers.js";
|
|
9
|
-
export { DefaultMap } from "./map.js";
|
|
10
|
-
export { ArgumentsReader, Option, CommentStyle, Options, PackageJsonReader, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, OptionDefaults, } from "./options/index.js";
|
|
2
|
+
export * from "./fs.js";
|
|
3
|
+
export { getLoadedPaths, hasBeenLoadedMultipleTimes, TYPEDOC_ROOT } from "./general.js";
|
|
4
|
+
export { FancyConsoleLogger } from "./loggers.js";
|
|
5
|
+
export { ArgumentsReader, CommentStyle, Option, OptionDefaults, Options, PackageJsonReader, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, } from "./options/index.js";
|
|
6
|
+
export * from "./paths.js";
|
|
11
7
|
export { loadPlugins } from "./plugins.js";
|
|
12
8
|
export { getSortFunction } from "./sort.js";
|
|
13
|
-
export { EventHooks } from "./hooks.js";
|
|
14
9
|
export * from "./entry-point.js";
|
|
15
|
-
|
|
16
|
-
export
|
|
17
|
-
export { Fragment, Raw, renderElement } from "./jsx.js";
|
|
18
|
-
export * as Validation from "./validation.js";
|
|
10
|
+
export * from "./html.js";
|
|
11
|
+
export * from "./tsconfig.js";
|
|
19
12
|
export * from "./tsutils.js";
|
|
20
|
-
export
|
|
13
|
+
export * from "./ValidatingFileRegistry.js";
|