typedoc 0.27.6 → 0.27.7
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/typedoc +21 -2
- package/dist/index.d.ts +1 -1
- package/dist/lib/application.d.ts +30 -1
- package/dist/lib/application.js +96 -20
- package/dist/lib/cli.js +4 -4
- package/dist/lib/converter/converter.d.ts +2 -3
- package/dist/lib/converter/converter.js +15 -20
- package/dist/lib/converter/factories/signature.js +16 -4
- package/dist/lib/converter/plugins/IncludePlugin.d.ts +2 -0
- package/dist/lib/converter/plugins/IncludePlugin.js +177 -4
- package/dist/lib/converter/plugins/PackagePlugin.js +2 -0
- package/dist/lib/converter/symbols.js +21 -7
- package/dist/lib/converter/types.d.ts +2 -2
- package/dist/lib/converter/types.js +21 -18
- package/dist/lib/internationalization/internationalization.js +3 -1
- package/dist/lib/internationalization/locales/en.cjs +14 -0
- package/dist/lib/internationalization/locales/en.d.cts +13 -0
- package/dist/lib/internationalization/locales/ja.cjs +321 -0
- package/dist/lib/internationalization/locales/ja.d.cts +308 -0
- package/dist/lib/internationalization/locales/jp.cjs +2 -320
- package/dist/lib/internationalization/locales/jp.d.cts +2 -308
- package/dist/lib/internationalization/locales/zh.cjs +6 -3
- package/dist/lib/internationalization/locales/zh.d.cts +5 -2
- package/dist/lib/internationalization/translatable.d.ts +2 -1
- package/dist/lib/output/index.d.ts +1 -0
- package/dist/lib/output/plugins/AssetsPlugin.d.ts +1 -7
- package/dist/lib/output/plugins/AssetsPlugin.js +18 -7
- package/dist/lib/output/themes/default/DefaultTheme.d.ts +3 -39
- package/dist/lib/output/themes/default/DefaultTheme.js +19 -10
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +12 -12
- package/dist/lib/output/themes/default/partials/icon.d.ts +17 -2
- package/dist/lib/output/themes/default/partials/icon.js +77 -79
- package/dist/lib/output/themes/default/partials/member.getterSetter.js +6 -6
- package/dist/lib/output/themes/default/partials/member.signatures.js +3 -3
- package/dist/lib/output/themes/default/templates/reflection.js +2 -2
- package/dist/lib/utils/fs.d.ts +2 -2
- package/dist/lib/utils/fs.js +4 -3
- package/dist/lib/utils/general.d.ts +1 -0
- package/dist/lib/utils/general.js +11 -0
- package/dist/lib/utils/options/options.d.ts +3 -2
- package/dist/lib/utils/options/options.js +2 -2
- package/dist/lib/utils/options/readers/package-json.d.ts +1 -1
- package/dist/lib/utils/options/readers/package-json.js +2 -2
- package/dist/lib/utils/options/readers/tsconfig.d.ts +1 -1
- package/dist/lib/utils/options/readers/tsconfig.js +2 -2
- package/dist/lib/utils/options/readers/typedoc.d.ts +1 -1
- package/dist/lib/utils/options/readers/typedoc.js +4 -4
- package/dist/lib/utils/tsconfig.d.ts +1 -1
- package/dist/lib/utils/tsconfig.js +2 -2
- package/package.json +1 -1
- package/static/main.js +3 -3
- package/static/style.css +5 -4
package/bin/typedoc
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
//@ts-check
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const { fork } = require("child_process");
|
|
5
|
+
|
|
6
|
+
function main() {
|
|
7
|
+
fork(__dirname + "/../dist/lib/cli.js", process.argv.slice(2), {
|
|
8
|
+
stdio: "inherit",
|
|
9
|
+
}).on("exit", (code) => {
|
|
10
|
+
// Watch restart required? Fork a new child
|
|
11
|
+
if (code === 7) {
|
|
12
|
+
// Set an environment variable to ensure we continue watching
|
|
13
|
+
// Otherwise, the watch might stop unexpectedly if the watch
|
|
14
|
+
// option was set in a config file originally, and change to false
|
|
15
|
+
// later, causing a restart
|
|
16
|
+
process.env["TYPEDOC_FORCE_WATCH"] = "1";
|
|
17
|
+
main();
|
|
18
|
+
} else {
|
|
19
|
+
process.exit(code || 0);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
main();
|
package/dist/index.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export * as Configuration from "./lib/utils/options/index.js";
|
|
|
32
32
|
export * from "./lib/models/index.js";
|
|
33
33
|
export { Converter, Context, type CommentParserConfig, type DeclarationReference, type SymbolReference, type ComponentPath, type Meaning, type MeaningKeyword, type ExternalResolveResult, type ExternalSymbolResolver, type ConverterEvents, } from "./lib/converter/index.js";
|
|
34
34
|
export { Renderer, DefaultTheme, DefaultThemeRenderContext, Slugger, UrlMapping, Theme, PageEvent, RendererEvent, MarkdownEvent, IndexEvent, } from "./lib/output/index.js";
|
|
35
|
-
export type { RenderTemplate, RendererHooks, NavigationElement, RendererEvents, PageHeading, } from "./lib/output/index.js";
|
|
35
|
+
export type { RenderTemplate, RendererHooks, NavigationElement, RendererEvents, PageHeading, Icons, } from "./lib/output/index.js";
|
|
36
36
|
export { Outputs } from "./lib/output/output.js";
|
|
37
37
|
export { ArgumentsReader, Option, CommentStyle, JSX, LogLevel, Logger, Options, OptionDefaults, PackageJsonReader, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, EntryPointStrategy, EventHooks, MinimalSourceFile, normalizePath, } from "./lib/utils/index.js";
|
|
38
38
|
export type { OptionsReader, TypeDocOptions, TypeDocOptionMap, ValidationOptions, TypeDocOptionValues, KeyToDeclaration, DeclarationOption, DeclarationOptionBase, StringDeclarationOption, NumberDeclarationOption, BooleanDeclarationOption, ArrayDeclarationOption, MixedDeclarationOption, ObjectDeclarationOption, MapDeclarationOption, FlagsDeclarationOption, DeclarationOptionToOptionType, SortStrategy, ParameterTypeToOptionTypeMap, DocumentationEntryPoint, ManuallyValidatedOption, EnumKeys, JsDocCompatibility, OutputSpecification, } from "./lib/utils/index.js";
|
|
@@ -137,7 +137,36 @@ export declare class Application extends AbstractComponent<Application, Applicat
|
|
|
137
137
|
* @returns An instance of ProjectReflection on success, undefined otherwise.
|
|
138
138
|
*/
|
|
139
139
|
convert(): Promise<ProjectReflection | undefined>;
|
|
140
|
-
|
|
140
|
+
private watchers;
|
|
141
|
+
private _watchFile?;
|
|
142
|
+
private criticalFiles;
|
|
143
|
+
private clearWatches;
|
|
144
|
+
private watchConfigFile;
|
|
145
|
+
/**
|
|
146
|
+
* Register that the current build depends on a file, so that in watch mode
|
|
147
|
+
* the build will be repeated. Has no effect if a watch build is not
|
|
148
|
+
* running, or if the file has already been registered.
|
|
149
|
+
*
|
|
150
|
+
* @param path The file to watch. It does not need to exist, and you should
|
|
151
|
+
* in fact register files you look for, but which do not exist, so that if
|
|
152
|
+
* they are created the build will re-run. (e.g. if you look through a list
|
|
153
|
+
* of 5 possibilities and find the third, you should register the first 3.)
|
|
154
|
+
*
|
|
155
|
+
* @param shouldRestart Should the build be completely restarted? (This is
|
|
156
|
+
* normally only used for configuration files -- i.e. files whose contents
|
|
157
|
+
* determine how conversion, rendering, or compiling will be done, as
|
|
158
|
+
* opposed to files that are only read *during* the conversion or
|
|
159
|
+
* rendering.)
|
|
160
|
+
*/
|
|
161
|
+
watchFile(path: string, shouldRestart?: boolean): void;
|
|
162
|
+
/**
|
|
163
|
+
* Run a convert / watch process.
|
|
164
|
+
*
|
|
165
|
+
* @param success Callback to run after each convert, receiving the project
|
|
166
|
+
* @returns True if the watch process should be restarted due to a
|
|
167
|
+
* configuration change, false for an options error
|
|
168
|
+
*/
|
|
169
|
+
convertAndWatch(success: (project: ProjectReflection) => Promise<void>): Promise<boolean>;
|
|
141
170
|
validate(project: ProjectReflection): void;
|
|
142
171
|
/**
|
|
143
172
|
* Render outputs selected with options for the specified project
|
package/dist/lib/application.js
CHANGED
|
@@ -197,7 +197,6 @@ let Application = (() => {
|
|
|
197
197
|
throw new Error("An application handle must be retrieved with Application.bootstrap or Application.bootstrapWithPlugins");
|
|
198
198
|
}
|
|
199
199
|
super(null); // We own ourselves
|
|
200
|
-
__runInitializers(this, _entryPoints_extraInitializers);
|
|
201
200
|
this.converter = new Converter(this);
|
|
202
201
|
this.renderer = new Renderer(this);
|
|
203
202
|
this.logger.i18n = this.i18n;
|
|
@@ -218,7 +217,7 @@ let Application = (() => {
|
|
|
218
217
|
readers.forEach((r) => app.options.addReader(r));
|
|
219
218
|
app.options.reset();
|
|
220
219
|
app.setOptions(options, /* reportErrors */ false);
|
|
221
|
-
await app.options.read(new Logger());
|
|
220
|
+
await app.options.read(new Logger(), undefined, (path) => app.watchConfigFile(path));
|
|
222
221
|
app.logger.level = app.options.getValue("logLevel");
|
|
223
222
|
await loadPlugins(app, app.options.getValue("plugin"));
|
|
224
223
|
await app._bootstrap(options);
|
|
@@ -245,7 +244,7 @@ let Application = (() => {
|
|
|
245
244
|
async _bootstrap(options) {
|
|
246
245
|
this.options.reset();
|
|
247
246
|
this.setOptions(options, /* reportErrors */ false);
|
|
248
|
-
await this.options.read(this.logger);
|
|
247
|
+
await this.options.read(this.logger, undefined, (path) => this.watchConfigFile(path));
|
|
249
248
|
this.setOptions(options);
|
|
250
249
|
this.logger.level = this.options.getValue("logLevel");
|
|
251
250
|
for (const [lang, locales] of Object.entries(this.options.getValue("locales"))) {
|
|
@@ -257,13 +256,18 @@ let Application = (() => {
|
|
|
257
256
|
this.trigger(ApplicationEvents.BOOTSTRAP_END, this);
|
|
258
257
|
if (!this.internationalization.hasTranslations(this.lang)) {
|
|
259
258
|
// Not internationalized as by definition we don't know what to include here.
|
|
260
|
-
this.logger.warn(`Options specified "${this.lang}" as the language to use, but TypeDoc
|
|
261
|
-
this.logger.info(("The
|
|
259
|
+
this.logger.warn(`Options specified "${this.lang}" as the language to use, but TypeDoc cannot provide translations for it.`);
|
|
260
|
+
this.logger.info(("The languages that translations are available for are:\n\t" +
|
|
262
261
|
this.internationalization
|
|
263
262
|
.getSupportedLanguages()
|
|
264
263
|
.join("\n\t")));
|
|
265
264
|
this.logger.info("You can define/override local locales with the `locales` option, or contribute them to TypeDoc!");
|
|
266
265
|
}
|
|
266
|
+
else if (this.lang === "jp") {
|
|
267
|
+
this.logger.warn(
|
|
268
|
+
// Only Japanese see this. Meaning: "jp" is going to be removed in the future. Please designate "ja" instead.
|
|
269
|
+
"「jp」は将来削除されます。代わりに「ja」を指定してください。");
|
|
270
|
+
}
|
|
267
271
|
if (this.options.getValue("useHostedBaseUrlForAbsoluteLinks") &&
|
|
268
272
|
!this.options.getValue("hostedBaseUrl")) {
|
|
269
273
|
this.logger.warn(this.i18n.useHostedBaseUrlForAbsoluteLinks_requires_hostedBaseUrl());
|
|
@@ -352,7 +356,43 @@ let Application = (() => {
|
|
|
352
356
|
this.logger.verbose(`Finished conversion in ${Date.now() - startConversion}ms`);
|
|
353
357
|
return project;
|
|
354
358
|
}
|
|
355
|
-
|
|
359
|
+
watchers = (__runInitializers(this, _entryPoints_extraInitializers), new Map());
|
|
360
|
+
_watchFile;
|
|
361
|
+
criticalFiles = new Set();
|
|
362
|
+
clearWatches() {
|
|
363
|
+
this.watchers.forEach((w) => w.close());
|
|
364
|
+
this.watchers.clear();
|
|
365
|
+
}
|
|
366
|
+
watchConfigFile(path) {
|
|
367
|
+
this.criticalFiles.add(path);
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Register that the current build depends on a file, so that in watch mode
|
|
371
|
+
* the build will be repeated. Has no effect if a watch build is not
|
|
372
|
+
* running, or if the file has already been registered.
|
|
373
|
+
*
|
|
374
|
+
* @param path The file to watch. It does not need to exist, and you should
|
|
375
|
+
* in fact register files you look for, but which do not exist, so that if
|
|
376
|
+
* they are created the build will re-run. (e.g. if you look through a list
|
|
377
|
+
* of 5 possibilities and find the third, you should register the first 3.)
|
|
378
|
+
*
|
|
379
|
+
* @param shouldRestart Should the build be completely restarted? (This is
|
|
380
|
+
* normally only used for configuration files -- i.e. files whose contents
|
|
381
|
+
* determine how conversion, rendering, or compiling will be done, as
|
|
382
|
+
* opposed to files that are only read *during* the conversion or
|
|
383
|
+
* rendering.)
|
|
384
|
+
*/
|
|
385
|
+
watchFile(path, shouldRestart = false) {
|
|
386
|
+
this._watchFile?.(path, shouldRestart);
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Run a convert / watch process.
|
|
390
|
+
*
|
|
391
|
+
* @param success Callback to run after each convert, receiving the project
|
|
392
|
+
* @returns True if the watch process should be restarted due to a
|
|
393
|
+
* configuration change, false for an options error
|
|
394
|
+
*/
|
|
395
|
+
async convertAndWatch(success) {
|
|
356
396
|
if (!this.options.getValue("preserveWatchOutput") &&
|
|
357
397
|
this.logger instanceof ConsoleLogger) {
|
|
358
398
|
ts.sys.clearScreen?.();
|
|
@@ -368,20 +408,20 @@ let Application = (() => {
|
|
|
368
408
|
// have reported in the first time... just error out for now. I'm not convinced anyone will actually notice.
|
|
369
409
|
if (this.options.getFileNames().length === 0) {
|
|
370
410
|
this.logger.error(this.i18n.solution_not_supported_in_watch_mode());
|
|
371
|
-
return;
|
|
411
|
+
return false;
|
|
372
412
|
}
|
|
373
413
|
// Support for packages mode is currently unimplemented
|
|
374
414
|
if (this.entryPointStrategy !== EntryPointStrategy.Resolve &&
|
|
375
415
|
this.entryPointStrategy !== EntryPointStrategy.Expand) {
|
|
376
416
|
this.logger.error(this.i18n.strategy_not_supported_in_watch_mode());
|
|
377
|
-
return;
|
|
417
|
+
return false;
|
|
378
418
|
}
|
|
379
419
|
const tsconfigFile = findTsConfigFile(this.options.getValue("tsconfig")) ??
|
|
380
420
|
"tsconfig.json";
|
|
381
421
|
// We don't want to do it the first time to preserve initial debug status messages. They'll be lost
|
|
382
422
|
// after the user saves a file, but better than nothing...
|
|
383
423
|
let firstStatusReport = true;
|
|
384
|
-
const host = ts.createWatchCompilerHost(tsconfigFile, {}, ts.sys, ts.createEmitAndSemanticDiagnosticsBuilderProgram, (diagnostic) => this.logger.diagnostic(diagnostic), (status, newLine, _options, errorCount) => {
|
|
424
|
+
const host = ts.createWatchCompilerHost(tsconfigFile, this.options.fixCompilerOptions({}), ts.sys, ts.createEmitAndSemanticDiagnosticsBuilderProgram, (diagnostic) => this.logger.diagnostic(diagnostic), (status, newLine, _options, errorCount) => {
|
|
385
425
|
if (!firstStatusReport &&
|
|
386
426
|
errorCount === void 0 &&
|
|
387
427
|
!this.options.getValue("preserveWatchOutput") &&
|
|
@@ -393,20 +433,59 @@ let Application = (() => {
|
|
|
393
433
|
});
|
|
394
434
|
let successFinished = true;
|
|
395
435
|
let currentProgram;
|
|
436
|
+
let lastProgram = currentProgram;
|
|
437
|
+
let restarting = false;
|
|
438
|
+
this._watchFile = (path, shouldRestart = false) => {
|
|
439
|
+
this.logger.verbose(`Watching ${nicePath(path)}, shouldRestart=${shouldRestart}`);
|
|
440
|
+
if (this.watchers.has(path))
|
|
441
|
+
return;
|
|
442
|
+
this.watchers.set(path, host.watchFile(path, (file) => {
|
|
443
|
+
if (shouldRestart) {
|
|
444
|
+
restartMain(file);
|
|
445
|
+
}
|
|
446
|
+
else if (!currentProgram) {
|
|
447
|
+
currentProgram = lastProgram;
|
|
448
|
+
this.logger.info(this.i18n.file_0_changed_rebuilding(nicePath(file)));
|
|
449
|
+
}
|
|
450
|
+
if (successFinished)
|
|
451
|
+
runSuccess();
|
|
452
|
+
}, 2000));
|
|
453
|
+
};
|
|
454
|
+
/** resolver for the returned promise */
|
|
455
|
+
let exitWatch;
|
|
456
|
+
const restartMain = (file) => {
|
|
457
|
+
if (restarting)
|
|
458
|
+
return;
|
|
459
|
+
this.logger.info(this.i18n.file_0_changed_restarting(nicePath(file)));
|
|
460
|
+
restarting = true;
|
|
461
|
+
currentProgram = undefined;
|
|
462
|
+
this.clearWatches();
|
|
463
|
+
tsWatcher.close();
|
|
464
|
+
};
|
|
396
465
|
const runSuccess = () => {
|
|
466
|
+
if (restarting && successFinished) {
|
|
467
|
+
successFinished = false;
|
|
468
|
+
exitWatch(true);
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
397
471
|
if (!currentProgram) {
|
|
398
472
|
return;
|
|
399
473
|
}
|
|
400
474
|
if (successFinished) {
|
|
401
|
-
if (this.options.getValue("emit") === "both"
|
|
475
|
+
if (this.options.getValue("emit") === "both" &&
|
|
476
|
+
currentProgram !== lastProgram) {
|
|
402
477
|
currentProgram.emit();
|
|
403
478
|
}
|
|
479
|
+
// Save for possible re-run due to non-.ts file change
|
|
480
|
+
lastProgram = currentProgram;
|
|
404
481
|
this.logger.resetErrors();
|
|
405
482
|
this.logger.resetWarnings();
|
|
406
483
|
const entryPoints = getWatchEntryPoints(this.logger, this.options, currentProgram);
|
|
407
484
|
if (!entryPoints) {
|
|
408
485
|
return;
|
|
409
486
|
}
|
|
487
|
+
this.clearWatches();
|
|
488
|
+
this.criticalFiles.forEach((path) => this.watchFile(path, true));
|
|
410
489
|
const project = this.converter.convert(entryPoints);
|
|
411
490
|
currentProgram = undefined;
|
|
412
491
|
successFinished = false;
|
|
@@ -416,23 +495,20 @@ let Application = (() => {
|
|
|
416
495
|
});
|
|
417
496
|
}
|
|
418
497
|
};
|
|
419
|
-
const origCreateProgram = host.createProgram;
|
|
420
|
-
host.createProgram = (rootNames, options, host, oldProgram, configDiagnostics, references) => {
|
|
421
|
-
// If we always do this, we'll get a crash the second time a program is created.
|
|
422
|
-
if (rootNames !== undefined) {
|
|
423
|
-
options = this.options.fixCompilerOptions(options || {});
|
|
424
|
-
}
|
|
425
|
-
return origCreateProgram(rootNames, options, host, oldProgram, configDiagnostics, references);
|
|
426
|
-
};
|
|
427
498
|
const origAfterProgramCreate = host.afterProgramCreate;
|
|
428
499
|
host.afterProgramCreate = (program) => {
|
|
429
|
-
if (
|
|
500
|
+
if (!restarting &&
|
|
501
|
+
ts.getPreEmitDiagnostics(program.getProgram()).length === 0) {
|
|
430
502
|
currentProgram = program.getProgram();
|
|
431
503
|
runSuccess();
|
|
432
504
|
}
|
|
433
505
|
origAfterProgramCreate?.(program);
|
|
434
506
|
};
|
|
435
|
-
ts.createWatchProgram(host);
|
|
507
|
+
const tsWatcher = ts.createWatchProgram(host);
|
|
508
|
+
// Don't return to caller until the watch needs to restart
|
|
509
|
+
return await new Promise((res) => {
|
|
510
|
+
exitWatch = res;
|
|
511
|
+
});
|
|
436
512
|
}
|
|
437
513
|
validate(project) {
|
|
438
514
|
const checks = this.options.getValue("validation");
|
package/dist/lib/cli.js
CHANGED
|
@@ -25,8 +25,8 @@ async function main() {
|
|
|
25
25
|
if (exitCode !== ExitCodes.Watching) {
|
|
26
26
|
app.logger.verbose(`Full run took ${Date.now() - start}ms`);
|
|
27
27
|
logRunSummary(app.logger);
|
|
28
|
-
process.exit(exitCode);
|
|
29
28
|
}
|
|
29
|
+
process.exit(exitCode);
|
|
30
30
|
}
|
|
31
31
|
catch (error) {
|
|
32
32
|
console.error("TypeDoc exiting with unexpected error:");
|
|
@@ -57,12 +57,12 @@ async function run(app) {
|
|
|
57
57
|
app.logger.hasWarnings()) {
|
|
58
58
|
return ExitCodes.OptionError;
|
|
59
59
|
}
|
|
60
|
-
if (app.options.getValue("watch")) {
|
|
61
|
-
app.convertAndWatch(async (project) => {
|
|
60
|
+
if (app.options.getValue("watch") || process.env["TYPEDOC_FORCE_WATCH"]) {
|
|
61
|
+
const continueWatching = await app.convertAndWatch(async (project) => {
|
|
62
62
|
app.validate(project);
|
|
63
63
|
await app.generateOutputs(project);
|
|
64
64
|
});
|
|
65
|
-
return ExitCodes.Watching;
|
|
65
|
+
return continueWatching ? ExitCodes.Watching : ExitCodes.OptionError;
|
|
66
66
|
}
|
|
67
67
|
const project = await app.convert();
|
|
68
68
|
if (!project) {
|
|
@@ -47,8 +47,6 @@ export declare class Converter extends AbstractComponent<Application, ConverterE
|
|
|
47
47
|
/** @internal */
|
|
48
48
|
accessor excludeExternals: boolean;
|
|
49
49
|
/** @internal */
|
|
50
|
-
accessor excludeNotDocumented: boolean;
|
|
51
|
-
/** @internal */
|
|
52
50
|
accessor excludePrivate: boolean;
|
|
53
51
|
/** @internal */
|
|
54
52
|
accessor excludeProtected: boolean;
|
|
@@ -163,7 +161,8 @@ export declare class Converter extends AbstractComponent<Application, ConverterE
|
|
|
163
161
|
* @returns The TypeDoc type reflection representing the given node and type.
|
|
164
162
|
* @internal
|
|
165
163
|
*/
|
|
166
|
-
convertType(context: Context, node: ts.TypeNode |
|
|
164
|
+
convertType(context: Context, node: ts.TypeNode | undefined): SomeType;
|
|
165
|
+
convertType(context: Context, type: ts.Type, node?: ts.TypeNode): SomeType;
|
|
167
166
|
/**
|
|
168
167
|
* Parse the given file into a comment. Intended to be used with markdown files.
|
|
169
168
|
*/
|
|
@@ -72,9 +72,6 @@ let Converter = (() => {
|
|
|
72
72
|
let _excludeExternals_decorators;
|
|
73
73
|
let _excludeExternals_initializers = [];
|
|
74
74
|
let _excludeExternals_extraInitializers = [];
|
|
75
|
-
let _excludeNotDocumented_decorators;
|
|
76
|
-
let _excludeNotDocumented_initializers = [];
|
|
77
|
-
let _excludeNotDocumented_extraInitializers = [];
|
|
78
75
|
let _excludePrivate_decorators;
|
|
79
76
|
let _excludePrivate_initializers = [];
|
|
80
77
|
let _excludePrivate_extraInitializers = [];
|
|
@@ -104,7 +101,6 @@ let Converter = (() => {
|
|
|
104
101
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
105
102
|
_externalPattern_decorators = [Option("externalPattern")];
|
|
106
103
|
_excludeExternals_decorators = [Option("excludeExternals")];
|
|
107
|
-
_excludeNotDocumented_decorators = [Option("excludeNotDocumented")];
|
|
108
104
|
_excludePrivate_decorators = [Option("excludePrivate")];
|
|
109
105
|
_excludeProtected_decorators = [Option("excludeProtected")];
|
|
110
106
|
_excludeReferences_decorators = [Option("excludeReferences")];
|
|
@@ -115,7 +111,6 @@ let Converter = (() => {
|
|
|
115
111
|
_maxTypeConversionDepth_decorators = [Option("maxTypeConversionDepth")];
|
|
116
112
|
__esDecorate(this, null, _externalPattern_decorators, { kind: "accessor", name: "externalPattern", static: false, private: false, access: { has: obj => "externalPattern" in obj, get: obj => obj.externalPattern, set: (obj, value) => { obj.externalPattern = value; } }, metadata: _metadata }, _externalPattern_initializers, _externalPattern_extraInitializers);
|
|
117
113
|
__esDecorate(this, null, _excludeExternals_decorators, { kind: "accessor", name: "excludeExternals", static: false, private: false, access: { has: obj => "excludeExternals" in obj, get: obj => obj.excludeExternals, set: (obj, value) => { obj.excludeExternals = value; } }, metadata: _metadata }, _excludeExternals_initializers, _excludeExternals_extraInitializers);
|
|
118
|
-
__esDecorate(this, null, _excludeNotDocumented_decorators, { kind: "accessor", name: "excludeNotDocumented", static: false, private: false, access: { has: obj => "excludeNotDocumented" in obj, get: obj => obj.excludeNotDocumented, set: (obj, value) => { obj.excludeNotDocumented = value; } }, metadata: _metadata }, _excludeNotDocumented_initializers, _excludeNotDocumented_extraInitializers);
|
|
119
114
|
__esDecorate(this, null, _excludePrivate_decorators, { kind: "accessor", name: "excludePrivate", static: false, private: false, access: { has: obj => "excludePrivate" in obj, get: obj => obj.excludePrivate, set: (obj, value) => { obj.excludePrivate = value; } }, metadata: _metadata }, _excludePrivate_initializers, _excludePrivate_extraInitializers);
|
|
120
115
|
__esDecorate(this, null, _excludeProtected_decorators, { kind: "accessor", name: "excludeProtected", static: false, private: false, access: { has: obj => "excludeProtected" in obj, get: obj => obj.excludeProtected, set: (obj, value) => { obj.excludeProtected = value; } }, metadata: _metadata }, _excludeProtected_initializers, _excludeProtected_extraInitializers);
|
|
121
116
|
__esDecorate(this, null, _excludeReferences_decorators, { kind: "accessor", name: "excludeReferences", static: false, private: false, access: { has: obj => "excludeReferences" in obj, get: obj => obj.excludeReferences, set: (obj, value) => { obj.excludeReferences = value; } }, metadata: _metadata }, _excludeReferences_initializers, _excludeReferences_extraInitializers);
|
|
@@ -136,11 +131,7 @@ let Converter = (() => {
|
|
|
136
131
|
/** @internal */
|
|
137
132
|
get excludeExternals() { return this.#excludeExternals_accessor_storage; }
|
|
138
133
|
set excludeExternals(value) { this.#excludeExternals_accessor_storage = value; }
|
|
139
|
-
#
|
|
140
|
-
/** @internal */
|
|
141
|
-
get excludeNotDocumented() { return this.#excludeNotDocumented_accessor_storage; }
|
|
142
|
-
set excludeNotDocumented(value) { this.#excludeNotDocumented_accessor_storage = value; }
|
|
143
|
-
#excludePrivate_accessor_storage = (__runInitializers(this, _excludeNotDocumented_extraInitializers), __runInitializers(this, _excludePrivate_initializers, void 0));
|
|
134
|
+
#excludePrivate_accessor_storage = (__runInitializers(this, _excludeExternals_extraInitializers), __runInitializers(this, _excludePrivate_initializers, void 0));
|
|
144
135
|
/** @internal */
|
|
145
136
|
get excludePrivate() { return this.#excludePrivate_accessor_storage; }
|
|
146
137
|
set excludePrivate(value) { this.#excludePrivate_accessor_storage = value; }
|
|
@@ -334,15 +325,8 @@ let Converter = (() => {
|
|
|
334
325
|
convertSymbol(context, symbol, exportSymbol) {
|
|
335
326
|
convertSymbol(context, symbol, exportSymbol);
|
|
336
327
|
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
*
|
|
340
|
-
* @param context The context object describing the current state the converter is in.
|
|
341
|
-
* @returns The TypeDoc type reflection representing the given node and type.
|
|
342
|
-
* @internal
|
|
343
|
-
*/
|
|
344
|
-
convertType(context, node) {
|
|
345
|
-
return convertType(context, node);
|
|
328
|
+
convertType(context, typeOrNode, maybeNode) {
|
|
329
|
+
return convertType(context, typeOrNode, maybeNode);
|
|
346
330
|
}
|
|
347
331
|
/**
|
|
348
332
|
* Parse the given file into a comment. Intended to be used with markdown files.
|
|
@@ -487,7 +471,17 @@ let Converter = (() => {
|
|
|
487
471
|
isExternal(symbol) {
|
|
488
472
|
this.externalPatternCache ??= createMinimatch(this.externalPattern);
|
|
489
473
|
const cache = this.externalPatternCache;
|
|
490
|
-
|
|
474
|
+
const declarations = symbol.getDeclarations();
|
|
475
|
+
// `undefined` has no declarations, if someone does `export default undefined`
|
|
476
|
+
// the symbol ends up as having no declarations (the export symbol does, but
|
|
477
|
+
// not the source symbol)
|
|
478
|
+
if (!declarations?.length) {
|
|
479
|
+
return false;
|
|
480
|
+
}
|
|
481
|
+
// If there are any non-external declarations, treat it as non-external
|
|
482
|
+
// This is possible with declaration merging against external namespaces
|
|
483
|
+
// (e.g. merging with HTMLElementTagNameMap)
|
|
484
|
+
return declarations.every((node) => matchesAny(cache, node.getSourceFile().fileName));
|
|
491
485
|
}
|
|
492
486
|
processDocumentTags(reflection, parent) {
|
|
493
487
|
let relativeTo = reflection.comment?.sourcePath;
|
|
@@ -515,6 +509,7 @@ let Converter = (() => {
|
|
|
515
509
|
const children = frontmatter["children"];
|
|
516
510
|
delete frontmatter["children"];
|
|
517
511
|
const docRefl = new DocumentReflection(displayName, parent, content, frontmatter);
|
|
512
|
+
this.application.watchFile(file.fileName);
|
|
518
513
|
parent.addChild(docRefl);
|
|
519
514
|
parent.project.registerReflection(docRefl, undefined, file.fileName);
|
|
520
515
|
this.trigger(ConverterEvents.CREATE_DOCUMENT, undefined, docRefl);
|
|
@@ -50,9 +50,11 @@ export function createSignature(context, kind, signature, symbol, declaration) {
|
|
|
50
50
|
sigRef.type = new IntrinsicType("this");
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
let typeNode = declaration?.type;
|
|
54
|
+
if (typeNode && ts.isJSDocReturnTag(typeNode)) {
|
|
55
|
+
typeNode = typeNode.typeExpression?.type;
|
|
56
|
+
}
|
|
57
|
+
sigRef.type = context.converter.convertType(sigRefCtx, signature.getReturnType(), typeNode);
|
|
56
58
|
}
|
|
57
59
|
context.registerReflection(sigRef, undefined);
|
|
58
60
|
switch (kind) {
|
|
@@ -106,8 +108,15 @@ function convertParameters(context, sigRef, parameters, parameterNodes) {
|
|
|
106
108
|
context.registerReflection(paramRefl, param);
|
|
107
109
|
context.converter.trigger(ConverterEvents.CREATE_PARAMETER, context, paramRefl);
|
|
108
110
|
let type;
|
|
111
|
+
let typeNode;
|
|
109
112
|
if (declaration) {
|
|
110
113
|
type = context.checker.getTypeOfSymbolAtLocation(param, declaration);
|
|
114
|
+
if (ts.isParameter(declaration)) {
|
|
115
|
+
typeNode = declaration.type;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
typeNode = declaration.typeExpression?.type;
|
|
119
|
+
}
|
|
111
120
|
}
|
|
112
121
|
else {
|
|
113
122
|
type = param.type;
|
|
@@ -117,8 +126,11 @@ function convertParameters(context, sigRef, parameters, parameterNodes) {
|
|
|
117
126
|
declaration.type?.kind === ts.SyntaxKind.ThisType) {
|
|
118
127
|
paramRefl.type = new IntrinsicType("this");
|
|
119
128
|
}
|
|
129
|
+
else if (!type) {
|
|
130
|
+
paramRefl.type = new IntrinsicType("any");
|
|
131
|
+
}
|
|
120
132
|
else {
|
|
121
|
-
paramRefl.type = context.converter.convertType(context.withScope(paramRefl), type);
|
|
133
|
+
paramRefl.type = context.converter.convertType(context.withScope(paramRefl), type, typeNode);
|
|
122
134
|
}
|
|
123
135
|
let isOptional = false;
|
|
124
136
|
if (declaration) {
|
|
@@ -9,4 +9,6 @@ export declare class IncludePlugin extends ConverterComponent {
|
|
|
9
9
|
constructor(owner: Converter);
|
|
10
10
|
private onCreate;
|
|
11
11
|
checkIncludeTagsParts(refl: Reflection, relative: string, parts: CommentDisplayPart[], included?: string[]): void;
|
|
12
|
+
getRegions(refl: Reflection, file: string, ext: string, textPart: string, text: string, regionTargets: string, tag: string, ignoreIndent: boolean): string;
|
|
13
|
+
getLines(refl: Reflection, file: string, textPart: string, text: string, requestedLines: string, tag: string): string;
|
|
12
14
|
}
|