typedoc 0.28.0 → 0.28.2

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.
Files changed (42) hide show
  1. package/dist/lib/application.d.ts +5 -5
  2. package/dist/lib/application.js +6 -4
  3. package/dist/lib/converter/comments/index.js +6 -1
  4. package/dist/lib/converter/converter.d.ts +13 -1
  5. package/dist/lib/converter/converter.js +28 -12
  6. package/dist/lib/converter/factories/signature.d.ts +1 -0
  7. package/dist/lib/converter/factories/signature.js +28 -5
  8. package/dist/lib/converter/plugins/CategoryPlugin.js +1 -1
  9. package/dist/lib/converter/plugins/GroupPlugin.js +3 -0
  10. package/dist/lib/converter/plugins/IncludePlugin.js +2 -3
  11. package/dist/lib/converter/symbols.js +6 -2
  12. package/dist/lib/converter/types.js +23 -11
  13. package/dist/lib/internationalization/locales/zh.cjs +6 -0
  14. package/dist/lib/internationalization/locales/zh.d.cts +6 -0
  15. package/dist/lib/models/types.js +9 -9
  16. package/dist/lib/output/renderer.d.ts +5 -1
  17. package/dist/lib/output/renderer.js +9 -1
  18. package/dist/lib/output/router.js +21 -5
  19. package/dist/lib/output/themes/MarkedPlugin.js +1 -1
  20. package/dist/lib/output/themes/default/partials/index.js +5 -13
  21. package/dist/lib/output/themes/default/partials/members.js +9 -6
  22. package/dist/lib/output/themes/default/partials/moduleReflection.js +15 -8
  23. package/dist/lib/output/themes/default/partials/navigation.js +13 -5
  24. package/dist/lib/output/themes/lib.d.ts +3 -2
  25. package/dist/lib/output/themes/lib.js +22 -15
  26. package/dist/lib/serialization/deserializer.d.ts +1 -1
  27. package/dist/lib/serialization/deserializer.js +1 -1
  28. package/dist/lib/serialization/serializer.d.ts +1 -1
  29. package/dist/lib/serialization/serializer.js +1 -1
  30. package/dist/lib/utils/entry-point.d.ts +1 -1
  31. package/dist/lib/utils/entry-point.js +19 -7
  32. package/dist/lib/utils/html.js +1 -1
  33. package/dist/lib/utils/options/declaration.d.ts +4 -3
  34. package/dist/lib/utils/options/defaults.js +2 -0
  35. package/dist/lib/utils/options/options.d.ts +3 -3
  36. package/dist/lib/utils/options/options.js +1 -1
  37. package/dist/lib/utils/options/tsdoc-defaults.d.ts +1 -1
  38. package/dist/lib/utils/options/tsdoc-defaults.js +1 -0
  39. package/package.json +10 -10
  40. package/static/main.js +3 -3
  41. package/static/style.css +4 -4
  42. package/tsdoc.json +5 -0
@@ -34,7 +34,7 @@ export interface ApplicationEvents {
34
34
  * Access to an Application instance can be retrieved with {@link Application.bootstrap} or
35
35
  * {@link Application.bootstrapWithPlugins}. It can not be constructed manually.
36
36
  *
37
- * @group Common
37
+ * @group None
38
38
  * @summary Root level class which contains most useful behavior.
39
39
  */
40
40
  export declare class Application extends AbstractComponent<Application, ApplicationEvents> {
@@ -102,23 +102,23 @@ export declare class Application extends AbstractComponent<Application, Applicat
102
102
  /**
103
103
  * Initialize TypeDoc, loading plugins if applicable.
104
104
  */
105
- static bootstrapWithPlugins(options?: Partial<TypeDocOptions>, readers?: readonly OptionsReader[]): Promise<Application>;
105
+ static bootstrapWithPlugins(options?: TypeDocOptions, readers?: readonly OptionsReader[]): Promise<Application>;
106
106
  /**
107
107
  * Initialize TypeDoc without loading plugins.
108
108
  *
109
109
  * @example
110
110
  * Initialize the application with pretty-printing output disabled.
111
111
  * ```ts
112
- * const app = Application.bootstrap({ pretty: false });
112
+ * const app = await Application.bootstrap({ pretty: false });
113
113
  * ```
114
114
  *
115
115
  * @param options Options to set during initialization
116
116
  * @param readers Option readers to use to discover options from config files.
117
117
  */
118
- static bootstrap(options?: Partial<TypeDocOptions>, readers?: readonly OptionsReader[]): Promise<Application>;
118
+ static bootstrap(options?: TypeDocOptions, readers?: readonly OptionsReader[]): Promise<Application>;
119
119
  private _bootstrap;
120
120
  /** @internal */
121
- setOptions(options: Partial<TypeDocOptions>, reportErrors?: boolean): boolean;
121
+ setOptions(options: TypeDocOptions, reportErrors?: boolean): boolean;
122
122
  /**
123
123
  * Return the path to the TypeScript compiler.
124
124
  */
@@ -95,7 +95,7 @@ const DEFAULT_READERS = [
95
95
  * Access to an Application instance can be retrieved with {@link Application.bootstrap} or
96
96
  * {@link Application.bootstrapWithPlugins}. It can not be constructed manually.
97
97
  *
98
- * @group Common
98
+ * @group None
99
99
  * @summary Root level class which contains most useful behavior.
100
100
  */
101
101
  let Application = (() => {
@@ -236,7 +236,7 @@ let Application = (() => {
236
236
  * @example
237
237
  * Initialize the application with pretty-printing output disabled.
238
238
  * ```ts
239
- * const app = Application.bootstrap({ pretty: false });
239
+ * const app = await Application.bootstrap({ pretty: false });
240
240
  * ```
241
241
  *
242
242
  * @param options Options to set during initialization
@@ -673,10 +673,12 @@ let Application = (() => {
673
673
  const entryPoints = this.entryPoints.flatMap((entry) => {
674
674
  const result = glob(entry, rootDir);
675
675
  if (result.length === 0) {
676
- this.logger.warn(i18n.entrypoint_did_not_match_files_0(nicePath(entry)));
676
+ // #2918 - do not pass entry through nicePath here in case it contains
677
+ // windows path separators which should cause additional warnings.
678
+ this.logger.warn(i18n.entrypoint_did_not_match_files_0(entry));
677
679
  }
678
680
  else if (result.length !== 1) {
679
- this.logger.verbose(`Expanded ${nicePath(entry)} to:\n\t${result
681
+ this.logger.verbose(`Expanded ${entry} to:\n\t${result
680
682
  .map(nicePath)
681
683
  .join("\n\t")}`);
682
684
  }
@@ -172,7 +172,12 @@ export function getJsDocComment(declaration, config, logger, checker, files) {
172
172
  }
173
173
  const tag = comment.getIdentifiedTag(name, `@${declaration.tagName.text}`);
174
174
  if (!tag) {
175
- logger.error(i18n.failed_to_find_jsdoc_tag_for_name_0(name), declaration);
175
+ // If this is a template tag with multiple declarations, we warned already if there
176
+ // was a comment attached. If there wasn't, then don't error about failing to find
177
+ // a tag because this is unsupported.
178
+ if (!ts.isJSDocTemplateTag(declaration)) {
179
+ logger.error(i18n.failed_to_find_jsdoc_tag_for_name_0(name), declaration);
180
+ }
176
181
  }
177
182
  else {
178
183
  const result = new Comment(Comment.cloneDisplayParts(tag.content));
@@ -36,7 +36,7 @@ export interface ConverterEvents {
36
36
  /**
37
37
  * Compiles source files using TypeScript and converts compiler symbols to reflections.
38
38
  *
39
- * @group Common
39
+ * @group None
40
40
  * @summary Responsible for converting TypeScript symbols into {@link Reflection}s and {@link Type}s.
41
41
  */
42
42
  export declare class Converter extends AbstractComponent<Application, ConverterEvents> {
@@ -189,8 +189,20 @@ export declare class Converter extends AbstractComponent<Application, ConverterE
189
189
  resolveExternalLink(ref: DeclarationReference, refl: Reflection, part: CommentDisplayPart | undefined, symbolId: ReflectionSymbolId | undefined): ExternalResolveResult | string | undefined;
190
190
  resolveLinks(comment: Comment, owner: Reflection): void;
191
191
  resolveLinks(parts: readonly CommentDisplayPart[], owner: Reflection): CommentDisplayPart[];
192
+ /**
193
+ * Permit deferred conversion steps to take place. Until this is called, {@link deferConversion}
194
+ * will throw if used.
195
+ * @since 0.28.1
196
+ */
197
+ permitDeferredConversion(): void;
198
+ /**
199
+ * Finalize deferred conversion, must be called by the caller of {@link permitDeferredConversion}
200
+ * @since 0.28.1
201
+ */
202
+ finalizeDeferredConversion(): void;
192
203
  /**
193
204
  * Defer a conversion step until later. This may only be called during conversion.
205
+ * @since 0.28.0
194
206
  */
195
207
  deferConversion(cb: () => void): void;
196
208
  /**
@@ -62,7 +62,7 @@ import { MergeModuleWithPlugin } from "./plugins/MergeModuleWithPlugin.js";
62
62
  /**
63
63
  * Compiles source files using TypeScript and converts compiler symbols to reflections.
64
64
  *
65
- * @group Common
65
+ * @group None
66
66
  * @summary Responsible for converting TypeScript symbols into {@link Reflection}s and {@link Type}s.
67
67
  */
68
68
  let Converter = (() => {
@@ -372,8 +372,33 @@ let Converter = (() => {
372
372
  return resolvePartLinks(owner, comment, (ref, part, refl, id) => this.resolveExternalLink(ref, part, refl, id), { preserveLinkText: this.preserveLinkText });
373
373
  }
374
374
  }
375
+ /**
376
+ * Permit deferred conversion steps to take place. Until this is called, {@link deferConversion}
377
+ * will throw if used.
378
+ * @since 0.28.1
379
+ */
380
+ permitDeferredConversion() {
381
+ ok(!this._deferPermitted, "Attempted to allow deferred conversion when already permitted");
382
+ this._deferPermitted = true;
383
+ }
384
+ /**
385
+ * Finalize deferred conversion, must be called by the caller of {@link permitDeferredConversion}
386
+ * @since 0.28.1
387
+ */
388
+ finalizeDeferredConversion() {
389
+ this.application.logger.verbose(`Have ${this._defer.length} initial deferred tasks`);
390
+ let count = 0;
391
+ while (this._defer.length) {
392
+ ++count;
393
+ const first = this._defer.shift();
394
+ first();
395
+ }
396
+ this.application.logger.verbose(`Ran ${count} total deferred tasks`);
397
+ this._deferPermitted = false;
398
+ }
375
399
  /**
376
400
  * Defer a conversion step until later. This may only be called during conversion.
401
+ * @since 0.28.0
377
402
  */
378
403
  deferConversion(cb) {
379
404
  ok(this._deferPermitted, "Attempted to defer conversion when not permitted");
@@ -386,8 +411,7 @@ let Converter = (() => {
386
411
  * @returns An array containing all errors generated by the TypeScript compiler.
387
412
  */
388
413
  compile(entryPoints, context) {
389
- ok(!this._deferPermitted);
390
- this._deferPermitted = true;
414
+ this.permitDeferredConversion();
391
415
  let createModuleReflections = entryPoints.length > 1;
392
416
  if (!createModuleReflections) {
393
417
  const opts = this.application.options;
@@ -404,15 +428,7 @@ let Converter = (() => {
404
428
  entryContext.setActiveProgram(entry.program);
405
429
  this.convertExports(entryContext, entry, createModuleReflections);
406
430
  }
407
- this.application.logger.verbose(`Have ${this._defer.length} initial deferred tasks`);
408
- let count = 0;
409
- while (this._defer.length) {
410
- ++count;
411
- const first = this._defer.shift();
412
- first();
413
- }
414
- this.application.logger.verbose(`Ran ${count} total deferred tasks`);
415
- this._deferPermitted = false;
431
+ this.finalizeDeferredConversion();
416
432
  }
417
433
  convertExports(context, entryPoint, createModuleReflections) {
418
434
  const node = entryPoint.sourceFile;
@@ -7,6 +7,7 @@ export declare function createSignature(context: Context, kind: ReflectionKind.C
7
7
  */
8
8
  export declare function createConstructSignatureWithType(context: Context, signature: ts.Signature, classType: Reflection): void;
9
9
  export declare function convertParameterNodes(context: Context, sigRef: SignatureReflection, parameters: readonly (ts.JSDocParameterTag | ts.ParameterDeclaration)[]): ParameterReflection[];
10
+ export declare function convertTypeParameters(context: Context, parent: Reflection, parameters: readonly ts.TypeParameter[] | undefined): TypeParameterReflection[] | undefined;
10
11
  export declare function convertTypeParameterNodes(context: Context, parameters: readonly ts.TypeParameterDeclaration[] | undefined): TypeParameterReflection[] | undefined;
11
12
  export declare function createTypeParamReflection(param: ts.TypeParameterDeclaration, context: Context): TypeParameterReflection;
12
13
  export declare function convertTemplateParameterNodes(context: Context, nodes: readonly ts.JSDocTemplateTag[] | undefined): TypeParameterReflection[] | undefined;
@@ -82,8 +82,22 @@ export function createConstructSignatureWithType(context, signature, classType)
82
82
  const sigRefCtx = context.withScope(sigRef);
83
83
  if (declaration) {
84
84
  sigRef.comment = context.getSignatureComment(declaration);
85
+ if (sigRef.comment?.discoveryId === context.scope.parent?.comment?.discoveryId) {
86
+ delete sigRef.comment;
87
+ }
85
88
  }
86
- sigRef.typeParameters = convertTypeParameters(sigRefCtx, sigRef, signature.typeParameters);
89
+ const parameterSymbols = signature.thisParameter
90
+ ? [signature.thisParameter, ...signature.parameters]
91
+ : [...signature.parameters];
92
+ // Prevent a `this` parameter from appearing on constructor signature
93
+ // as TS disallows them on regular classes.
94
+ if (parameterSymbols[0]?.name === "this") {
95
+ parameterSymbols.shift();
96
+ }
97
+ sigRef.parameters = convertParameters(sigRefCtx, sigRef, parameterSymbols, declaration?.parameters);
98
+ sigRef.parameters = convertParameters(sigRefCtx, sigRef, parameterSymbols, undefined);
99
+ // Do NOT convert type parameters here, they go on the class itself in the @class case
100
+ // See #2914.
87
101
  sigRef.type = ReferenceType.createResolvedReference(context.scope.parent.name, classType, context.project);
88
102
  context.registerReflection(sigRef, undefined);
89
103
  context.scope.signatures ??= [];
@@ -203,7 +217,7 @@ function checkForDestructuredParameterDefaults(param, decl) {
203
217
  }
204
218
  }
205
219
  }
206
- function convertTypeParameters(context, parent, parameters) {
220
+ export function convertTypeParameters(context, parent, parameters) {
207
221
  return parameters?.map((param) => {
208
222
  const constraintT = param.getConstraint();
209
223
  const defaultT = param.getDefault();
@@ -236,9 +250,18 @@ export function convertTypeParameterNodes(context, parameters) {
236
250
  export function createTypeParamReflection(param, context) {
237
251
  const paramRefl = new TypeParameterReflection(param.name.text, context.scope, getVariance(param.modifiers));
238
252
  const paramScope = context.withScope(paramRefl);
239
- paramRefl.type = param.constraint
240
- ? context.converter.convertType(paramScope, param.constraint)
241
- : void 0;
253
+ if (ts.isJSDocTemplateTag(param.parent)) {
254
+ // With a @template tag, the constraint applies only to the
255
+ // first type parameter declared.
256
+ if (param.parent.typeParameters[0].name.text === param.name.text && param.parent.constraint) {
257
+ paramRefl.type = context.converter.convertType(paramScope, param.parent.constraint);
258
+ }
259
+ }
260
+ else {
261
+ paramRefl.type = param.constraint
262
+ ? context.converter.convertType(paramScope, param.constraint)
263
+ : void 0;
264
+ }
242
265
  paramRefl.default = param.default
243
266
  ? context.converter.convertType(paramScope, param.default)
244
267
  : void 0;
@@ -121,7 +121,7 @@ let CategoryPlugin = (() => {
121
121
  }
122
122
  }
123
123
  categorize(obj) {
124
- if (this.categorizeByGroup) {
124
+ if (this.categorizeByGroup && obj.groups) {
125
125
  this.groupCategorize(obj);
126
126
  }
127
127
  else {
@@ -150,6 +150,9 @@ let GroupPlugin = (() => {
150
150
  this.sortFunction(reflection.documents);
151
151
  this.sortFunction(reflection.childrenIncludingDocuments);
152
152
  }
153
+ if (reflection.comment?.hasModifier("@disableGroups")) {
154
+ return;
155
+ }
153
156
  reflection.groups = this.getReflectionGroups(reflection, reflection.childrenIncludingDocuments);
154
157
  }
155
158
  }
@@ -1,9 +1,8 @@
1
1
  import path from "path";
2
- import fs from "fs";
3
2
  import { ConverterComponent } from "../components.js";
4
3
  import { ConverterEvents } from "../converter-events.js";
5
4
  import { MinimalSourceFile } from "#utils";
6
- import { isFile } from "../../utils/fs.js";
5
+ import { isFile, readFile } from "../../utils/fs.js";
7
6
  import { dedent, escapeRegExp, i18n } from "#utils";
8
7
  import { normalizePath } from "#node-utils";
9
8
  /**
@@ -51,7 +50,7 @@ export class IncludePlugin extends ConverterComponent {
51
50
  this.logger.error(i18n.include_0_in_1_specified_2_circular_include_3(part.tag, refl.getFriendlyFullName(), part.text, included.join("\n\t")));
52
51
  }
53
52
  else if (isFile(file)) {
54
- const text = fs.readFileSync(file, "utf-8");
53
+ const text = readFile(file).replaceAll("\r\n", "\n");
55
54
  const ext = path.extname(file).substring(1);
56
55
  const includedText = regionTarget
57
56
  ? this.getRegions(refl, file, ext, part.text, text, regionTarget, part.tag, part.tag === "@includeCode")
@@ -4,7 +4,7 @@ import { DeclarationReflection, IntrinsicType, LiteralType, ReferenceReflection,
4
4
  import { getEnumFlags, hasAllFlags, hasAnyFlag, i18n, removeFlag } from "#utils";
5
5
  import { convertDefaultValue } from "./convert-expression.js";
6
6
  import { convertIndexSignatures } from "./factories/index-signature.js";
7
- import { createConstructSignatureWithType, createSignature, createTypeParamReflection } from "./factories/signature.js";
7
+ import { convertTypeParameters, createConstructSignatureWithType, createSignature, createTypeParamReflection, } from "./factories/signature.js";
8
8
  import { convertJsDocAlias, convertJsDocCallback } from "./jsdoc.js";
9
9
  import { getHeritageTypes } from "./utils/nodes.js";
10
10
  import { removeUndefined } from "./utils/reflections.js";
@@ -586,7 +586,8 @@ function convertVariable(context, symbol, exportSymbol) {
586
586
  setModifiers(symbol, declaration, reflection);
587
587
  reflection.defaultValue = convertDefaultValue(declaration);
588
588
  context.finalizeDeclarationReflection(reflection);
589
- return ts.SymbolFlags.Property;
589
+ // Exclude ValueModule to handle `module.exports = []`
590
+ return ts.SymbolFlags.Property | ts.SymbolFlags.ValueModule;
590
591
  }
591
592
  function isEnumLike(checker, type, location) {
592
593
  if (!location || !hasAllFlags(type.flags, ts.TypeFlags.Object)) {
@@ -701,6 +702,9 @@ function convertSymbolAsClass(context, symbol, exportSymbol) {
701
702
  for (const sig of ctors) {
702
703
  createConstructSignatureWithType(constructContext, sig, reflection);
703
704
  }
705
+ // Take the type parameters from the first constructor signature and use
706
+ // them as the type parameters for the class, #2914
707
+ reflection.typeParameters = convertTypeParameters(rc, reflection, ctors[0].getTypeParameters());
704
708
  const instType = ctors[0].getReturnType();
705
709
  convertSymbols(rc, instType.getProperties());
706
710
  for (const sig of instType.getCallSignatures()) {
@@ -122,7 +122,7 @@ const arrayConverter = {
122
122
  return new ArrayType(convertType(context, node.elementType));
123
123
  },
124
124
  convertType(context, type) {
125
- const params = context.checker.getTypeArguments(type);
125
+ const params = type.aliasTypeArguments || context.checker.getTypeArguments(type);
126
126
  // This is *almost* always true... except for when this type is in the constraint of a type parameter see GH#1408
127
127
  // assert(params.length === 1);
128
128
  assert(params.length > 0);
@@ -440,11 +440,7 @@ const referenceConverter = {
440
440
  // in the type we just retrieved from node.typeName.
441
441
  if (!node.typeArguments &&
442
442
  context.shouldInline(symbol, name)) {
443
- // typeLiteralConverter doesn't use the node, so we can get away with lying here.
444
- // This might not actually be safe, it appears that it is in the relatively small
445
- // amount of testing I've done with it, but I wouldn't be surprised if someone manages
446
- // to find a crash.
447
- return typeLiteralConverter.convertType(context, type, null, undefined);
443
+ return convertTypeInlined(context, type);
448
444
  }
449
445
  const ref = context.createSymbolReference(context.resolveAliasedSymbol(symbol), context, name);
450
446
  ref.typeArguments = node.typeArguments?.map((type) => convertType(context, type));
@@ -470,11 +466,7 @@ const referenceConverter = {
470
466
  name = node.typeName.right.text;
471
467
  }
472
468
  if (context.shouldInline(symbol, name)) {
473
- // typeLiteralConverter doesn't use the node, so we can get away with lying here.
474
- // This might not actually be safe, it appears that it is in the relatively small
475
- // amount of testing I've done with it, but I wouldn't be surprised if someone manages
476
- // to find a crash.
477
- return typeLiteralConverter.convertType(context, type, null, undefined);
469
+ return convertTypeInlined(context, type);
478
470
  }
479
471
  const ref = context.createSymbolReference(context.resolveAliasedSymbol(symbol), context, name);
480
472
  if (type.flags & ts.TypeFlags.Substitution) {
@@ -785,3 +777,23 @@ function normalizeUnion(types) {
785
777
  types.splice(Math.min(trueIndex, falseIndex), 1, new IntrinsicType("boolean"));
786
778
  }
787
779
  }
780
+ function convertTypeInlined(context, type) {
781
+ if (type.isUnion()) {
782
+ const types = type.types.map(type => convertType(context, type));
783
+ return new UnionType(types);
784
+ }
785
+ if (type.isIntersection()) {
786
+ const types = type.types.map(type => convertType(context, type));
787
+ return new IntersectionType(types);
788
+ }
789
+ if (type.isLiteral()) {
790
+ return new LiteralType(typeof type.value === "object"
791
+ ? BigInt(type.value.base10Value) * (type.value.negative ? -1n : 1n)
792
+ : type.value);
793
+ }
794
+ if (context.checker.isArrayType(type)) {
795
+ const elementType = convertType(context, context.checker.getTypeArguments(type)[0]);
796
+ return new ArrayType(elementType);
797
+ }
798
+ return typeLiteralConverter.convertType(context, type);
799
+ }
@@ -18,6 +18,7 @@ module.exports = localeUtils.buildIncompleteTranslation({
18
18
  no_entry_points_for_packages: "没有为包模式提供入口点,无法生成文档",
19
19
  failed_to_find_packages: "找不到任何软件包,请确保您至少提供了一个包含 package.json 的目录作为入口点",
20
20
  nested_packages_unsupported_0: "位于 {0} 的项目已将 entryPointStrategy 设置为包,但不支持嵌套包",
21
+ package_option_0_should_be_specified_at_root: "由 packageOptions 设置的选项 {0} 仅在根级别有效",
21
22
  previous_error_occurred_when_reading_options_for_0: "读取 {0} 处的包的选项时发生上一个错误",
22
23
  converting_project_at_0: "正在转换 {0} 处的项目",
23
24
  failed_to_convert_packages: "无法转换一个或多个包,结果将不会合并在一起",
@@ -435,6 +436,10 @@ module.exports = localeUtils.buildIncompleteTranslation({
435
436
  tag_type: "类型",
436
437
  tag_typedef: "类型定义",
437
438
  tag_summary: "概述",
439
+ tag_preventInline: "取消内联",
440
+ tag_inlineType: "内联类型",
441
+ tag_preventExpand: "取消扩展",
442
+ tag_expandType: "扩展类型",
438
443
  // Inline tags
439
444
  tag_link: "链接",
440
445
  tag_label: "标记",
@@ -467,6 +472,7 @@ module.exports = localeUtils.buildIncompleteTranslation({
467
472
  tag_inline: "内联",
468
473
  tag_interface: "接口",
469
474
  tag_namespace: "命名空间",
475
+ tag_function: "函数",
470
476
  tag_overload: "重载",
471
477
  tag_private: "私有成员",
472
478
  tag_protected: "受保护成员",
@@ -13,6 +13,7 @@ declare const _default: {
13
13
  no_entry_points_for_packages: string;
14
14
  failed_to_find_packages: string;
15
15
  nested_packages_unsupported_0: "位于 {0} 的项目已将 entryPointStrategy 设置为包,但不支持嵌套包";
16
+ package_option_0_should_be_specified_at_root: "由 packageOptions 设置的选项 {0} 仅在根级别有效";
16
17
  previous_error_occurred_when_reading_options_for_0: "读取 {0} 处的包的选项时发生上一个错误";
17
18
  converting_project_at_0: "正在转换 {0} 处的项目";
18
19
  failed_to_convert_packages: string;
@@ -400,6 +401,10 @@ declare const _default: {
400
401
  tag_type: string;
401
402
  tag_typedef: string;
402
403
  tag_summary: string;
404
+ tag_preventInline: string;
405
+ tag_inlineType: string;
406
+ tag_preventExpand: string;
407
+ tag_expandType: string;
403
408
  tag_link: string;
404
409
  tag_label: string;
405
410
  tag_linkcode: string;
@@ -430,6 +435,7 @@ declare const _default: {
430
435
  tag_inline: string;
431
436
  tag_interface: string;
432
437
  tag_namespace: string;
438
+ tag_function: string;
433
439
  tag_overload: string;
434
440
  tag_private: string;
435
441
  tag_protected: string;
@@ -899,17 +899,17 @@ export class ReflectionType extends Type {
899
899
  }
900
900
  getTypeString() {
901
901
  const parts = [];
902
- const sigs = this.declaration.getAllSignatures();
902
+ const sigs = this.declaration.getNonIndexSignatures();
903
903
  for (const sig of sigs) {
904
904
  parts.push(sigStr(sig, ": "));
905
905
  }
906
- if (this.declaration.children) {
907
- for (const p of this.declaration.children) {
908
- parts.push(`${p.name}${propertySep(p)} ${typeStr(p.type)}`);
909
- }
910
- return `{ ${parts.join("; ")} }`;
906
+ for (const p of this.declaration.children || []) {
907
+ parts.push(`${p.name}${propertySep(p)} ${typeStr(p.type)}`);
908
+ }
909
+ for (const s of this.declaration.indexSignatures || []) {
910
+ parts.push(sigStr(s, ": ", "[]"));
911
911
  }
912
- if (sigs.length === 1) {
912
+ if (sigs.length === 1 && parts.length === 1) {
913
913
  return sigStr(sigs[0], " => ");
914
914
  }
915
915
  if (parts.length === 0) {
@@ -1238,7 +1238,7 @@ function propertySep(refl) {
1238
1238
  function typeStr(type) {
1239
1239
  return type?.toString() ?? "any";
1240
1240
  }
1241
- function sigStr(sig, sep) {
1241
+ function sigStr(sig, sep, brackets = "()") {
1242
1242
  const params = joinArray(sig.parameters, ", ", (p) => `${p.name}${propertySep(p)} ${typeStr(p.type)}`);
1243
- return `(${params})${sep}${typeStr(sig.type)}`;
1243
+ return `${brackets[0]}${params}${brackets[1]}${sep}${typeStr(sig.type)}`;
1244
1244
  }
@@ -115,7 +115,7 @@ export interface RendererEvents {
115
115
  * an instance of {@link IndexEvent}.
116
116
  *
117
117
  * @summary Writes HTML output from TypeDoc's models
118
- * @group Common
118
+ * @group None
119
119
  */
120
120
  export declare class Renderer extends AbstractComponent<Application, RendererEvents> {
121
121
  private routers;
@@ -189,12 +189,16 @@ export declare class Renderer extends AbstractComponent<Application, RendererEve
189
189
  * @param theme
190
190
  */
191
191
  defineTheme(name: string, theme: new (renderer: Renderer) => Theme): void;
192
+ /** @internal intended for test usage only */
193
+ removeTheme(name: string): void;
192
194
  /**
193
195
  * Define a new router that can be used to determine the output structure.
194
196
  * @param name
195
197
  * @param router
196
198
  */
197
199
  defineRouter(name: string, router: new (app: Application) => Router): void;
200
+ /** @internal intended for test usage only */
201
+ removeRouter(name: string): void;
198
202
  /**
199
203
  * Render the given project reflection to the specified output directory.
200
204
  *
@@ -79,7 +79,7 @@ import { CategoryRouter, GroupRouter, KindDirRouter, KindRouter, StructureDirRou
79
79
  * an instance of {@link IndexEvent}.
80
80
  *
81
81
  * @summary Writes HTML output from TypeDoc's models
82
- * @group Common
82
+ * @group None
83
83
  */
84
84
  let Renderer = (() => {
85
85
  let _classSuper = AbstractComponent;
@@ -231,6 +231,10 @@ let Renderer = (() => {
231
231
  }
232
232
  this.themes.set(name, theme);
233
233
  }
234
+ /** @internal intended for test usage only */
235
+ removeTheme(name) {
236
+ this.themes.delete(name);
237
+ }
234
238
  /**
235
239
  * Define a new router that can be used to determine the output structure.
236
240
  * @param name
@@ -242,6 +246,10 @@ let Renderer = (() => {
242
246
  }
243
247
  this.routers.set(name, router);
244
248
  }
249
+ /** @internal intended for test usage only */
250
+ removeRouter(name) {
251
+ this.routers.delete(name);
252
+ }
245
253
  /**
246
254
  * Render the given project reflection to the specified output directory.
247
255
  *
@@ -166,6 +166,16 @@ let BaseRouter = (() => {
166
166
  // an own document.
167
167
  from = from.parent;
168
168
  }
169
+ let toPage = to;
170
+ while (!this.hasOwnDocument(toPage)) {
171
+ toPage = toPage.parent;
172
+ }
173
+ // We unfortunately have to special case ProjectReflection as it is
174
+ // the model used twice for rendering. This should be changed in a
175
+ // future version to remove this hackery.
176
+ if (from === toPage && !(to instanceof ProjectReflection)) {
177
+ return to === toPage ? "" : `#${this.getAnchor(to)}`;
178
+ }
169
179
  const fromUrl = this.getFullUrl(from);
170
180
  const toUrl = this.getFullUrl(to);
171
181
  let equal = true;
@@ -181,12 +191,14 @@ let BaseRouter = (() => {
181
191
  }
182
192
  }
183
193
  }
184
- if (equal && !(to instanceof ProjectReflection)) {
185
- if (fromUrl === toUrl) {
186
- return "";
187
- }
188
- return `#${this.getAnchor(to)}`;
194
+ // If equal is still set, we're going to a page either in
195
+ // the same directory as this page, or a lower directory,
196
+ // don't bother going up directories just to come back down.
197
+ if (equal) {
198
+ return toUrl.substring(start);
189
199
  }
200
+ // Otherwise, go up until we get to the common directory
201
+ // and then back down to the target path.
190
202
  return "../".repeat(slashes) + toUrl.substring(start);
191
203
  }
192
204
  baseRelativeUrl(from, target) {
@@ -196,6 +208,10 @@ let BaseRouter = (() => {
196
208
  if (full[i] === "/")
197
209
  ++slashes;
198
210
  }
211
+ // #2910 avoid urls like ".././"
212
+ if (target == "./" && slashes !== 0) {
213
+ return "../".repeat(slashes);
214
+ }
199
215
  return "../".repeat(slashes) + target;
200
216
  }
201
217
  getFullUrl(target) {
@@ -177,7 +177,7 @@ let MarkedPlugin = (() => {
177
177
  let url;
178
178
  let kindClass;
179
179
  if (typeof part.target === "string") {
180
- url = part.target;
180
+ url = part.target === "#" ? undefined : part.target;
181
181
  }
182
182
  else if ("id" in part.target) {
183
183
  // No point in trying to resolve a ReflectionSymbolId at this point, we've already
@@ -1,8 +1,8 @@
1
- import { classNames, renderName } from "../../lib.js";
1
+ import { classNames, getMemberSections, isNoneSection, renderName } from "../../lib.js";
2
2
  import { i18n, JSX } from "#utils";
3
- function renderCategory({ urlTo, reflectionIcon, getReflectionClasses, markdown }, item, prependName = "") {
3
+ function renderSection({ urlTo, reflectionIcon, getReflectionClasses, markdown }, item) {
4
4
  return (JSX.createElement("section", { class: "tsd-index-section" },
5
- JSX.createElement("h3", { class: "tsd-index-heading" }, prependName ? `${prependName} - ${item.title}` : item.title),
5
+ !isNoneSection(item) && JSX.createElement("h3", { class: "tsd-index-heading" }, item.title),
6
6
  item.description && (JSX.createElement("div", { class: "tsd-comment tsd-typography" },
7
7
  JSX.createElement(JSX.Raw, { html: markdown(item.description) }))),
8
8
  JSX.createElement("div", { class: "tsd-index-list" }, item.children.map((item) => (JSX.createElement(JSX.Fragment, null,
@@ -12,15 +12,7 @@ function renderCategory({ urlTo, reflectionIcon, getReflectionClasses, markdown
12
12
  "\n"))))));
13
13
  }
14
14
  export function index(context, props) {
15
- let content = [];
16
- if (props.categories?.length) {
17
- content = props.categories.map((item) => renderCategory(context, item));
18
- }
19
- else if (props.groups?.length) {
20
- content = props.groups.flatMap((item) => item.categories
21
- ? item.categories.map((item2) => renderCategory(context, item2, item.title))
22
- : renderCategory(context, item));
23
- }
15
+ const sections = getMemberSections(props);
24
16
  return (JSX.createElement(JSX.Fragment, null,
25
17
  JSX.createElement("section", { class: "tsd-panel-group tsd-index-group" },
26
18
  JSX.createElement("section", { class: "tsd-panel tsd-index-panel" },
@@ -28,5 +20,5 @@ export function index(context, props) {
28
20
  JSX.createElement("summary", { class: "tsd-accordion-summary tsd-index-summary" },
29
21
  context.icons.chevronSmall(),
30
22
  JSX.createElement("h5", { class: "tsd-index-heading uppercase" }, i18n.theme_index())),
31
- JSX.createElement("div", { class: "tsd-accordion-details" }, content))))));
23
+ JSX.createElement("div", { class: "tsd-accordion-details" }, sections.map(s => renderSection(context, s))))))));
32
24
  }