Socket
Socket
Sign inDemoInstall

typedoc

Package Overview
Dependencies
Maintainers
5
Versions
309
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typedoc - npm Package Compare versions

Comparing version 0.25.0 to 0.25.1

dist/lib/converter/comments/tagName.d.ts

4

dist/index.d.ts

@@ -15,4 +15,4 @@ export { Application } from "./lib/application";

export { Renderer, DefaultTheme, DefaultThemeRenderContext, UrlMapping, Theme, PageEvent, RendererEvent, MarkdownEvent, IndexEvent, } from "./lib/output";
export type { RenderTemplate, RendererHooks } from "./lib/output";
export { ArgumentsReader, BindOption, CommentStyle, JSX, LogLevel, Logger, Options, PackageJsonReader, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, EntryPointStrategy, EventHooks, MinimalSourceFile, normalizePath, } from "./lib/utils";
export type { RenderTemplate, RendererHooks, NavigationElement, } from "./lib/output";
export { ArgumentsReader, Option, BindOption, CommentStyle, JSX, LogLevel, Logger, Options, PackageJsonReader, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, EntryPointStrategy, EventHooks, MinimalSourceFile, normalizePath, } from "./lib/utils";
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, } from "./lib/utils";

@@ -19,0 +19,0 @@ export type { EventMap, EventCallback } from "./lib/utils/events";

@@ -32,3 +32,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.TypeScript = exports.SerializeEvent = exports.Deserializer = exports.Serializer = exports.JSONOutput = exports.normalizePath = exports.MinimalSourceFile = exports.EventHooks = exports.EntryPointStrategy = exports.TypeDocReader = exports.TSConfigReader = exports.ParameterType = exports.ParameterHint = exports.PackageJsonReader = exports.Options = exports.Logger = exports.LogLevel = exports.JSX = exports.CommentStyle = exports.BindOption = exports.ArgumentsReader = exports.IndexEvent = exports.MarkdownEvent = exports.RendererEvent = exports.PageEvent = exports.Theme = exports.UrlMapping = exports.DefaultThemeRenderContext = exports.DefaultTheme = exports.Renderer = exports.Context = exports.Converter = exports.Configuration = exports.Models = exports.resetReflectionID = exports.Event = exports.EventDispatcher = exports.Application = void 0;
exports.TypeScript = exports.SerializeEvent = exports.Deserializer = exports.Serializer = exports.JSONOutput = exports.normalizePath = exports.MinimalSourceFile = exports.EventHooks = exports.EntryPointStrategy = exports.TypeDocReader = exports.TSConfigReader = exports.ParameterType = exports.ParameterHint = exports.PackageJsonReader = exports.Options = exports.Logger = exports.LogLevel = exports.JSX = exports.CommentStyle = exports.BindOption = exports.Option = exports.ArgumentsReader = exports.IndexEvent = exports.MarkdownEvent = exports.RendererEvent = exports.PageEvent = exports.Theme = exports.UrlMapping = exports.DefaultThemeRenderContext = exports.DefaultTheme = exports.Renderer = exports.Context = exports.Converter = exports.Configuration = exports.Models = exports.resetReflectionID = exports.Event = exports.EventDispatcher = exports.Application = void 0;
var application_1 = require("./lib/application");

@@ -65,2 +65,3 @@ Object.defineProperty(exports, "Application", { enumerable: true, get: function () { return application_1.Application; } });

Object.defineProperty(exports, "ArgumentsReader", { enumerable: true, get: function () { return utils_1.ArgumentsReader; } });
Object.defineProperty(exports, "Option", { enumerable: true, get: function () { return utils_1.Option; } });
Object.defineProperty(exports, "BindOption", { enumerable: true, get: function () { return utils_1.BindOption; } });

@@ -67,0 +68,0 @@ Object.defineProperty(exports, "CommentStyle", { enumerable: true, get: function () { return utils_1.CommentStyle; } });

@@ -47,7 +47,7 @@ import { Converter } from "./converter/index";

/** @internal */
readonly skipErrorChecking: boolean;
accessor skipErrorChecking: boolean;
/** @internal */
readonly entryPointStrategy: EntryPointStrategy;
accessor entryPointStrategy: EntryPointStrategy;
/** @internal */
readonly entryPoints: string[];
accessor entryPoints: string[];
/**

@@ -54,0 +54,0 @@ * The version number of TypeDoc.

@@ -18,8 +18,36 @@ "use strict";

});
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
var __importStar = (this && this.__importStar) || function (mod) {

@@ -32,6 +60,20 @@ if (mod && mod.__esModule) return mod;

};
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var Application_1;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -88,395 +130,434 @@ exports.Application = exports.createAppForTesting = void 0;

*/
let Application = Application_1 = class Application extends component_1.ChildableComponent {
/**
* Create a new TypeDoc application instance.
*/
constructor(detector) {
if (detector !== DETECTOR) {
throw new Error("An application handle must be retrieved with Application.bootstrap or Application.bootstrapWithPlugins");
}
super(null); // We own ourselves
let Application = (() => {
var _Application_skipErrorChecking_accessor_storage, _Application_entryPointStrategy_accessor_storage, _Application_entryPoints_accessor_storage;
let _classDecorators = [(0, component_1.Component)({ name: "application", internal: true })];
let _classDescriptor;
let _classExtraInitializers = [];
let _classThis;
let _classSuper = component_1.ChildableComponent;
let _instanceExtraInitializers = [];
let _skipErrorChecking_decorators;
let _skipErrorChecking_initializers = [];
let _entryPointStrategy_decorators;
let _entryPointStrategy_initializers = [];
let _entryPoints_decorators;
let _entryPoints_initializers = [];
var Application = _classThis = class extends _classSuper {
/** @internal */
get skipErrorChecking() { return __classPrivateFieldGet(this, _Application_skipErrorChecking_accessor_storage, "f"); }
set skipErrorChecking(value) { __classPrivateFieldSet(this, _Application_skipErrorChecking_accessor_storage, value, "f"); }
/** @internal */
get entryPointStrategy() { return __classPrivateFieldGet(this, _Application_entryPointStrategy_accessor_storage, "f"); }
set entryPointStrategy(value) { __classPrivateFieldSet(this, _Application_entryPointStrategy_accessor_storage, value, "f"); }
/** @internal */
get entryPoints() { return __classPrivateFieldGet(this, _Application_entryPoints_accessor_storage, "f"); }
set entryPoints(value) { __classPrivateFieldSet(this, _Application_entryPoints_accessor_storage, value, "f"); }
/**
* The serializer used to generate JSON output.
* Create a new TypeDoc application instance.
*/
this.serializer = new serialization_1.Serializer();
constructor(detector) {
if (detector !== DETECTOR) {
throw new Error("An application handle must be retrieved with Application.bootstrap or Application.bootstrapWithPlugins");
}
super(null); // We own ourselves
/**
* The converter used to create the declaration reflections.
*/
this.converter = (__runInitializers(this, _instanceExtraInitializers), void 0);
/**
* The serializer used to generate JSON output.
*/
this.serializer = new serialization_1.Serializer();
/**
* The deserializer used to restore previously serialized JSON output.
*/
this.deserializer = new serialization_1.Deserializer(this);
/**
* The logger that should be used to output messages.
*/
this.logger = new index_2.ConsoleLogger();
this.options = new utils_1.Options();
_Application_skipErrorChecking_accessor_storage.set(this, __runInitializers(this, _skipErrorChecking_initializers, void 0));
_Application_entryPointStrategy_accessor_storage.set(this, __runInitializers(this, _entryPointStrategy_initializers, void 0));
_Application_entryPoints_accessor_storage.set(this, __runInitializers(this, _entryPoints_initializers, void 0));
this.converter = this.addComponent("converter", index_1.Converter);
this.renderer = this.addComponent("renderer", renderer_1.Renderer);
}
/**
* The deserializer used to restore previously serialized JSON output.
* Initialize TypeDoc, loading plugins if applicable.
*/
this.deserializer = new serialization_1.Deserializer(this);
static async bootstrapWithPlugins(options = {}, readers = DEFAULT_READERS) {
const app = new Application(DETECTOR);
readers.forEach((r) => app.options.addReader(r));
app.options.reset();
app.setOptions(options, /* reportErrors */ false);
await app.options.read(new index_2.Logger());
app.logger.level = app.options.getValue("logLevel");
await (0, index_2.loadPlugins)(app, app.options.getValue("plugin"));
await app._bootstrap(options);
return app;
}
/**
* The logger that should be used to output messages.
* Initialize TypeDoc without loading plugins.
*
* @example
* Initialize the application with pretty-printing output disabled.
* ```ts
* const app = Application.bootstrap({ pretty: false });
* ```
*
* @param options Options to set during initialization
* @param readers Option readers to use to discover options from config files.
*/
this.logger = new index_2.ConsoleLogger();
this.options = new utils_1.Options();
this.converter = this.addComponent("converter", index_1.Converter);
this.renderer = this.addComponent("renderer", renderer_1.Renderer);
}
/**
* Initialize TypeDoc, loading plugins if applicable.
*/
static async bootstrapWithPlugins(options = {}, readers = DEFAULT_READERS) {
const app = new Application_1(DETECTOR);
readers.forEach((r) => app.options.addReader(r));
app.options.reset();
app.setOptions(options, /* reportErrors */ false);
await app.options.read(new index_2.Logger());
app.logger.level = app.options.getValue("logLevel");
await (0, index_2.loadPlugins)(app, app.options.getValue("plugin"));
await app._bootstrap(options);
return app;
}
/**
* Initialize TypeDoc without loading plugins.
*
* @example
* Initialize the application with pretty-printing output disabled.
* ```ts
* const app = Application.bootstrap({ pretty: false });
* ```
*
* @param options Options to set during initialization
* @param readers Option readers to use to discover options from config files.
*/
static async bootstrap(options = {}, readers = DEFAULT_READERS) {
const app = new Application_1(DETECTOR);
readers.forEach((r) => app.options.addReader(r));
await app._bootstrap(options);
return app;
}
async _bootstrap(options) {
this.options.reset();
this.setOptions(options, /* reportErrors */ false);
await this.options.read(this.logger);
this.setOptions(options);
this.logger.level = this.options.getValue("logLevel");
if ((0, general_1.hasBeenLoadedMultipleTimes)()) {
this.logger.warn(`TypeDoc has been loaded multiple times. This is commonly caused by plugins which have their own installation of TypeDoc. The loaded paths are:\n\t${(0, general_1.getLoadedPaths)().join("\n\t")}`);
static async bootstrap(options = {}, readers = DEFAULT_READERS) {
const app = new Application(DETECTOR);
readers.forEach((r) => app.options.addReader(r));
await app._bootstrap(options);
return app;
}
this.trigger(application_events_1.ApplicationEvents.BOOTSTRAP_END, this);
}
setOptions(options, reportErrors = true) {
for (const [key, val] of Object.entries(options)) {
try {
this.options.setValue(key, val);
async _bootstrap(options) {
this.options.reset();
this.setOptions(options, /* reportErrors */ false);
await this.options.read(this.logger);
this.setOptions(options);
this.logger.level = this.options.getValue("logLevel");
if ((0, general_1.hasBeenLoadedMultipleTimes)()) {
this.logger.warn(`TypeDoc has been loaded multiple times. This is commonly caused by plugins which have their own installation of TypeDoc. The loaded paths are:\n\t${(0, general_1.getLoadedPaths)().join("\n\t")}`);
}
catch (error) {
(0, assert_1.ok)(error instanceof Error);
if (reportErrors) {
this.logger.error(error.message);
this.trigger(application_events_1.ApplicationEvents.BOOTSTRAP_END, this);
}
setOptions(options, reportErrors = true) {
for (const [key, val] of Object.entries(options)) {
try {
this.options.setValue(key, val);
}
catch (error) {
(0, assert_1.ok)(error instanceof Error);
if (reportErrors) {
this.logger.error(error.message);
}
}
}
}
}
/**
* Return the path to the TypeScript compiler.
*/
getTypeScriptPath() {
return (0, paths_1.nicePath)(Path.dirname(require.resolve("typescript")));
}
getTypeScriptVersion() {
return typescript_1.default.version;
}
/**
* Gets the entry points to be documented according to the current `entryPoints` and `entryPointStrategy` options.
* May return undefined if entry points fail to be expanded.
*/
getEntryPoints() {
return (0, entry_point_1.getEntryPoints)(this.logger, this.options);
}
/**
* Run the converter for the given set of files and return the generated reflections.
*
* @returns An instance of ProjectReflection on success, undefined otherwise.
*/
async convert() {
const start = Date.now();
// We freeze here rather than in the Converter class since TypeDoc's tests reuse the Application
// with a few different settings.
this.options.freeze();
this.logger.verbose(`Using TypeScript ${this.getTypeScriptVersion()} from ${this.getTypeScriptPath()}`);
if (this.entryPointStrategy === entry_point_1.EntryPointStrategy.Merge) {
return this._merge();
/**
* Return the path to the TypeScript compiler.
*/
getTypeScriptPath() {
return (0, paths_1.nicePath)(Path.dirname(require.resolve("typescript")));
}
if (this.entryPointStrategy === entry_point_1.EntryPointStrategy.Packages) {
return this._convertPackages();
getTypeScriptVersion() {
return typescript_1.default.version;
}
if (!supportedVersionMajorMinor.some((version) => version == typescript_1.default.versionMajorMinor)) {
this.logger.warn(`You are running with an unsupported TypeScript version! If TypeDoc crashes, this is why. TypeDoc supports ${supportedVersionMajorMinor.join(", ")}`);
/**
* Gets the entry points to be documented according to the current `entryPoints` and `entryPointStrategy` options.
* May return undefined if entry points fail to be expanded.
*/
getEntryPoints() {
return (0, entry_point_1.getEntryPoints)(this.logger, this.options);
}
const entryPoints = this.getEntryPoints();
if (!entryPoints) {
// Fatal error already reported.
return;
}
const programs = (0, array_1.unique)(entryPoints.map((e) => e.program));
this.logger.verbose(`Converting with ${programs.length} programs ${entryPoints.length} entry points`);
if (this.skipErrorChecking === false) {
const errors = programs.flatMap((program) => typescript_1.default.getPreEmitDiagnostics(program));
if (errors.length) {
this.logger.diagnostics(errors);
/**
* Run the converter for the given set of files and return the generated reflections.
*
* @returns An instance of ProjectReflection on success, undefined otherwise.
*/
async convert() {
const start = Date.now();
// We freeze here rather than in the Converter class since TypeDoc's tests reuse the Application
// with a few different settings.
this.options.freeze();
this.logger.verbose(`Using TypeScript ${this.getTypeScriptVersion()} from ${this.getTypeScriptPath()}`);
if (this.entryPointStrategy === entry_point_1.EntryPointStrategy.Merge) {
return this._merge();
}
if (this.entryPointStrategy === entry_point_1.EntryPointStrategy.Packages) {
return this._convertPackages();
}
if (!supportedVersionMajorMinor.some((version) => version == typescript_1.default.versionMajorMinor)) {
this.logger.warn(`You are running with an unsupported TypeScript version! If TypeDoc crashes, this is why. TypeDoc supports ${supportedVersionMajorMinor.join(", ")}`);
}
const entryPoints = this.getEntryPoints();
if (!entryPoints) {
// Fatal error already reported.
return;
}
}
if (this.options.getValue("emit") === "both") {
for (const program of programs) {
program.emit();
const programs = (0, array_1.unique)(entryPoints.map((e) => e.program));
this.logger.verbose(`Converting with ${programs.length} programs ${entryPoints.length} entry points`);
if (this.skipErrorChecking === false) {
const errors = programs.flatMap((program) => typescript_1.default.getPreEmitDiagnostics(program));
if (errors.length) {
this.logger.diagnostics(errors);
return;
}
}
if (this.options.getValue("emit") === "both") {
for (const program of programs) {
program.emit();
}
}
const startConversion = Date.now();
this.logger.verbose(`Finished getting entry points in ${Date.now() - start}ms`);
const project = this.converter.convert(entryPoints);
this.logger.verbose(`Finished conversion in ${Date.now() - startConversion}ms`);
return project;
}
const startConversion = Date.now();
this.logger.verbose(`Finished getting entry points in ${Date.now() - start}ms`);
const project = this.converter.convert(entryPoints);
this.logger.verbose(`Finished conversion in ${Date.now() - startConversion}ms`);
return project;
}
convertAndWatch(success) {
this.options.freeze();
if (!this.options.getValue("preserveWatchOutput") &&
this.logger instanceof index_2.ConsoleLogger) {
typescript_1.default.sys.clearScreen?.();
}
this.logger.verbose(`Using TypeScript ${this.getTypeScriptVersion()} from ${this.getTypeScriptPath()}`);
if (!supportedVersionMajorMinor.some((version) => version == typescript_1.default.versionMajorMinor)) {
this.logger.warn(`You are running with an unsupported TypeScript version! TypeDoc supports ${supportedVersionMajorMinor.join(", ")}`);
}
if (Object.keys(this.options.getCompilerOptions()).length === 0) {
this.logger.warn(`No compiler options set. This likely means that TypeDoc did not find your tsconfig.json. Generated documentation will probably be empty.`);
}
// Doing this is considerably more complicated, we'd need to manage an array of programs, not convert until all programs
// have reported in the first time... just error out for now. I'm not convinced anyone will actually notice.
if (this.options.getFileNames().length === 0) {
this.logger.error("The provided tsconfig file looks like a solution style tsconfig, which is not supported in watch mode.");
return;
}
// Support for packages mode is currently unimplemented
if (this.entryPointStrategy !== entry_point_1.EntryPointStrategy.Resolve &&
this.entryPointStrategy !== entry_point_1.EntryPointStrategy.Expand) {
this.logger.error("entryPointStrategy must be set to either resolve or expand for watch mode.");
return;
}
const tsconfigFile = (0, tsconfig_1.findTsConfigFile)(this.options.getValue("tsconfig")) ??
"tsconfig.json";
// We don't want to do it the first time to preserve initial debug status messages. They'll be lost
// after the user saves a file, but better than nothing...
let firstStatusReport = true;
const host = typescript_1.default.createWatchCompilerHost(tsconfigFile, {}, typescript_1.default.sys, typescript_1.default.createEmitAndSemanticDiagnosticsBuilderProgram, (diagnostic) => this.logger.diagnostic(diagnostic), (status, newLine, _options, errorCount) => {
if (!firstStatusReport &&
errorCount === void 0 &&
!this.options.getValue("preserveWatchOutput") &&
convertAndWatch(success) {
this.options.freeze();
if (!this.options.getValue("preserveWatchOutput") &&
this.logger instanceof index_2.ConsoleLogger) {
typescript_1.default.sys.clearScreen?.();
}
firstStatusReport = false;
this.logger.info(typescript_1.default.flattenDiagnosticMessageText(status.messageText, newLine));
});
let successFinished = true;
let currentProgram;
const runSuccess = () => {
if (!currentProgram) {
this.logger.verbose(`Using TypeScript ${this.getTypeScriptVersion()} from ${this.getTypeScriptPath()}`);
if (!supportedVersionMajorMinor.some((version) => version == typescript_1.default.versionMajorMinor)) {
this.logger.warn(`You are running with an unsupported TypeScript version! TypeDoc supports ${supportedVersionMajorMinor.join(", ")}`);
}
if (Object.keys(this.options.getCompilerOptions()).length === 0) {
this.logger.warn(`No compiler options set. This likely means that TypeDoc did not find your tsconfig.json. Generated documentation will probably be empty.`);
}
// Doing this is considerably more complicated, we'd need to manage an array of programs, not convert until all programs
// have reported in the first time... just error out for now. I'm not convinced anyone will actually notice.
if (this.options.getFileNames().length === 0) {
this.logger.error("The provided tsconfig file looks like a solution style tsconfig, which is not supported in watch mode.");
return;
}
if (successFinished) {
if (this.options.getValue("emit") === "both") {
currentProgram.emit();
// Support for packages mode is currently unimplemented
if (this.entryPointStrategy !== entry_point_1.EntryPointStrategy.Resolve &&
this.entryPointStrategy !== entry_point_1.EntryPointStrategy.Expand) {
this.logger.error("entryPointStrategy must be set to either resolve or expand for watch mode.");
return;
}
const tsconfigFile = (0, tsconfig_1.findTsConfigFile)(this.options.getValue("tsconfig")) ??
"tsconfig.json";
// We don't want to do it the first time to preserve initial debug status messages. They'll be lost
// after the user saves a file, but better than nothing...
let firstStatusReport = true;
const host = typescript_1.default.createWatchCompilerHost(tsconfigFile, {}, typescript_1.default.sys, typescript_1.default.createEmitAndSemanticDiagnosticsBuilderProgram, (diagnostic) => this.logger.diagnostic(diagnostic), (status, newLine, _options, errorCount) => {
if (!firstStatusReport &&
errorCount === void 0 &&
!this.options.getValue("preserveWatchOutput") &&
this.logger instanceof index_2.ConsoleLogger) {
typescript_1.default.sys.clearScreen?.();
}
this.logger.resetErrors();
this.logger.resetWarnings();
const entryPoints = (0, entry_point_1.getWatchEntryPoints)(this.logger, this.options, currentProgram);
if (!entryPoints) {
firstStatusReport = false;
this.logger.info(typescript_1.default.flattenDiagnosticMessageText(status.messageText, newLine));
});
let successFinished = true;
let currentProgram;
const runSuccess = () => {
if (!currentProgram) {
return;
}
const project = this.converter.convert(entryPoints);
currentProgram = undefined;
successFinished = false;
void success(project).then(() => {
successFinished = true;
if (successFinished) {
if (this.options.getValue("emit") === "both") {
currentProgram.emit();
}
this.logger.resetErrors();
this.logger.resetWarnings();
const entryPoints = (0, entry_point_1.getWatchEntryPoints)(this.logger, this.options, currentProgram);
if (!entryPoints) {
return;
}
const project = this.converter.convert(entryPoints);
currentProgram = undefined;
successFinished = false;
void success(project).then(() => {
successFinished = true;
runSuccess();
});
}
};
const origCreateProgram = host.createProgram;
host.createProgram = (rootNames, options, host, oldProgram, configDiagnostics, references) => {
// If we always do this, we'll get a crash the second time a program is created.
if (rootNames !== undefined) {
options = this.options.fixCompilerOptions(options || {});
}
return origCreateProgram(rootNames, options, host, oldProgram, configDiagnostics, references);
};
const origAfterProgramCreate = host.afterProgramCreate;
host.afterProgramCreate = (program) => {
if (typescript_1.default.getPreEmitDiagnostics(program.getProgram()).length === 0) {
currentProgram = program.getProgram();
runSuccess();
});
}
origAfterProgramCreate?.(program);
};
typescript_1.default.createWatchProgram(host);
}
validate(project) {
const checks = this.options.getValue("validation");
const start = Date.now();
// No point in validating exports when merging. Warnings will have already been emitted when
// creating the project jsons that this run merges together.
if (checks.notExported &&
this.entryPointStrategy !== entry_point_1.EntryPointStrategy.Merge) {
(0, exports_1.validateExports)(project, this.logger, this.options.getValue("intentionallyNotExported"));
}
};
const origCreateProgram = host.createProgram;
host.createProgram = (rootNames, options, host, oldProgram, configDiagnostics, references) => {
// If we always do this, we'll get a crash the second time a program is created.
if (rootNames !== undefined) {
options = this.options.fixCompilerOptions(options || {});
if (checks.notDocumented) {
(0, documentation_1.validateDocumentation)(project, this.logger, this.options.getValue("requiredToBeDocumented"));
}
return origCreateProgram(rootNames, options, host, oldProgram, configDiagnostics, references);
};
const origAfterProgramCreate = host.afterProgramCreate;
host.afterProgramCreate = (program) => {
if (typescript_1.default.getPreEmitDiagnostics(program.getProgram()).length === 0) {
currentProgram = program.getProgram();
runSuccess();
if (checks.invalidLink) {
(0, links_1.validateLinks)(project, this.logger);
}
origAfterProgramCreate?.(program);
};
typescript_1.default.createWatchProgram(host);
}
validate(project) {
const checks = this.options.getValue("validation");
const start = Date.now();
// No point in validating exports when merging. Warnings will have already been emitted when
// creating the project jsons that this run merges together.
if (checks.notExported &&
this.entryPointStrategy !== entry_point_1.EntryPointStrategy.Merge) {
(0, exports_1.validateExports)(project, this.logger, this.options.getValue("intentionallyNotExported"));
this.trigger(Application.EVENT_VALIDATE_PROJECT, project);
this.logger.verbose(`Validation took ${Date.now() - start}ms`);
}
if (checks.notDocumented) {
(0, documentation_1.validateDocumentation)(project, this.logger, this.options.getValue("requiredToBeDocumented"));
}
if (checks.invalidLink) {
(0, links_1.validateLinks)(project, this.logger);
}
this.trigger(Application_1.EVENT_VALIDATE_PROJECT, project);
this.logger.verbose(`Validation took ${Date.now() - start}ms`);
}
/**
* Render HTML for the given project
*/
async generateDocs(project, out) {
const start = Date.now();
out = Path.resolve(out);
await this.renderer.render(project, out);
if (this.logger.hasErrors()) {
this.logger.error("Documentation could not be generated due to the errors above.");
}
else {
this.logger.info(`Documentation generated at ${(0, paths_1.nicePath)(out)}`);
this.logger.verbose(`HTML rendering took ${Date.now() - start}ms`);
}
}
/**
* Write the reflections to a json file.
*
* @param out The path and file name of the target file.
* @returns Whether the JSON file could be written successfully.
*/
async generateJson(project, out) {
const start = Date.now();
out = Path.resolve(out);
const ser = this.serializer.projectToObject(project, process.cwd());
const space = this.options.getValue("pretty") ? "\t" : "";
await (0, index_2.writeFile)(out, JSON.stringify(ser, null, space));
this.logger.info(`JSON written to ${(0, paths_1.nicePath)(out)}`);
this.logger.verbose(`JSON rendering took ${Date.now() - start}ms`);
}
/**
* Print the version number.
*/
toString() {
return [
"",
`TypeDoc ${Application_1.VERSION}`,
`Using TypeScript ${this.getTypeScriptVersion()} from ${this.getTypeScriptPath()}`,
"",
].join("\n");
}
async _convertPackages() {
if (!this.options.isSet("entryPoints")) {
this.logger.error("No entry points provided to packages mode, documentation cannot be generated.");
return;
}
const packageDirs = (0, entry_point_1.getPackageDirectories)(this.logger, this.options, this.options.getValue("entryPoints"));
if (packageDirs.length === 0) {
this.logger.error("Failed to find any packages, ensure you have provided at least one directory as an entry point containing package.json");
return;
}
const origOptions = this.options;
const projects = [];
// Generate a json file for each package
for (const dir of packageDirs) {
this.logger.info(`Converting project at ${(0, paths_1.nicePath)(dir)}`);
const opts = origOptions.copyForPackage(dir);
// Invalid links should only be reported after everything has been merged.
opts.setValue("validation", { invalidLink: false });
await opts.read(this.logger, dir);
if (opts.getValue("entryPointStrategy") ===
entry_point_1.EntryPointStrategy.Packages) {
this.logger.error(`Project at ${(0, paths_1.nicePath)(dir)} has entryPointStrategy set to packages, but nested packages are not supported.`);
continue;
/**
* Render HTML for the given project
*/
async generateDocs(project, out) {
const start = Date.now();
out = Path.resolve(out);
await this.renderer.render(project, out);
if (this.logger.hasErrors()) {
this.logger.error("Documentation could not be generated due to the errors above.");
}
this.options = opts;
const project = await this.convert();
if (project) {
this.validate(project);
projects.push(this.serializer.projectToObject(project, process.cwd()));
else {
this.logger.info(`Documentation generated at ${(0, paths_1.nicePath)(out)}`);
this.logger.verbose(`HTML rendering took ${Date.now() - start}ms`);
}
(0, abstract_1.resetReflectionID)();
}
this.options = origOptions;
this.logger.info(`Merging converted projects`);
if (projects.length !== packageDirs.length) {
this.logger.error("Failed to convert one or more packages, result will not be merged together.");
return;
/**
* Write the reflections to a json file.
*
* @param out The path and file name of the target file.
* @returns Whether the JSON file could be written successfully.
*/
async generateJson(project, out) {
const start = Date.now();
out = Path.resolve(out);
const ser = this.serializer.projectToObject(project, process.cwd());
const space = this.options.getValue("pretty") ? "\t" : "";
await (0, index_2.writeFile)(out, JSON.stringify(ser, null, space));
this.logger.info(`JSON written to ${(0, paths_1.nicePath)(out)}`);
this.logger.verbose(`JSON rendering took ${Date.now() - start}ms`);
}
const result = this.deserializer.reviveProjects(this.options.getValue("name") || "Documentation", projects);
this.trigger(application_events_1.ApplicationEvents.REVIVE, result);
return result;
}
_merge() {
const start = Date.now();
if (!this.options.isSet("entryPoints")) {
this.logger.error("No entry points provided to merge.");
return;
/**
* Print the version number.
*/
toString() {
return [
"",
`TypeDoc ${Application.VERSION}`,
`Using TypeScript ${this.getTypeScriptVersion()} from ${this.getTypeScriptPath()}`,
"",
].join("\n");
}
const rootDir = (0, fs_1.deriveRootDir)(this.entryPoints);
const entryPoints = this.entryPoints.flatMap((entry) => {
const result = (0, fs_1.glob)(entry, rootDir);
if (result.length === 0) {
this.logger.warn(`The entrypoint glob ${(0, paths_1.nicePath)(entry)} did not match any files.`);
async _convertPackages() {
if (!this.options.isSet("entryPoints")) {
this.logger.error("No entry points provided to packages mode, documentation cannot be generated.");
return;
}
else {
this.logger.verbose(`Expanded ${(0, paths_1.nicePath)(entry)} to:\n\t${result
.map(paths_1.nicePath)
.join("\n\t")}`);
const packageDirs = (0, entry_point_1.getPackageDirectories)(this.logger, this.options, this.options.getValue("entryPoints"));
if (packageDirs.length === 0) {
this.logger.error("Failed to find any packages, ensure you have provided at least one directory as an entry point containing package.json");
return;
}
const origOptions = this.options;
const projects = [];
// Generate a json file for each package
for (const dir of packageDirs) {
this.logger.info(`Converting project at ${(0, paths_1.nicePath)(dir)}`);
const opts = origOptions.copyForPackage(dir);
// Invalid links should only be reported after everything has been merged.
opts.setValue("validation", { invalidLink: false });
await opts.read(this.logger, dir);
if (opts.getValue("entryPointStrategy") ===
entry_point_1.EntryPointStrategy.Packages) {
this.logger.error(`Project at ${(0, paths_1.nicePath)(dir)} has entryPointStrategy set to packages, but nested packages are not supported.`);
continue;
}
this.options = opts;
const project = await this.convert();
if (project) {
this.validate(project);
projects.push(this.serializer.projectToObject(project, process.cwd()));
}
(0, abstract_1.resetReflectionID)();
}
this.options = origOptions;
this.logger.info(`Merging converted projects`);
if (projects.length !== packageDirs.length) {
this.logger.error("Failed to convert one or more packages, result will not be merged together.");
return;
}
const result = this.deserializer.reviveProjects(this.options.getValue("name") || "Documentation", projects);
this.trigger(application_events_1.ApplicationEvents.REVIVE, result);
return result;
});
const jsonProjects = entryPoints.map((path) => {
try {
return JSON.parse((0, fs_1.readFile)(path));
}
_merge() {
const start = Date.now();
if (!this.options.isSet("entryPoints")) {
this.logger.error("No entry points provided to merge.");
return;
}
catch {
this.logger.error(`Failed to parse file at ${(0, paths_1.nicePath)(path)} as json.`);
return null;
}
});
if (this.logger.hasErrors())
return;
const result = this.deserializer.reviveProjects(this.options.getValue("name"), jsonProjects);
this.logger.verbose(`Reviving projects took ${Date.now() - start}ms`);
this.trigger(application_events_1.ApplicationEvents.REVIVE, result);
return result;
}
};
const rootDir = (0, fs_1.deriveRootDir)(this.entryPoints);
const entryPoints = this.entryPoints.flatMap((entry) => {
const result = (0, fs_1.glob)(entry, rootDir);
if (result.length === 0) {
this.logger.warn(`The entrypoint glob ${(0, paths_1.nicePath)(entry)} did not match any files.`);
}
else {
this.logger.verbose(`Expanded ${(0, paths_1.nicePath)(entry)} to:\n\t${result
.map(paths_1.nicePath)
.join("\n\t")}`);
}
return result;
});
const jsonProjects = entryPoints.map((path) => {
try {
return JSON.parse((0, fs_1.readFile)(path));
}
catch {
this.logger.error(`Failed to parse file at ${(0, paths_1.nicePath)(path)} as json.`);
return null;
}
});
if (this.logger.hasErrors())
return;
const result = this.deserializer.reviveProjects(this.options.getValue("name"), jsonProjects);
this.logger.verbose(`Reviving projects took ${Date.now() - start}ms`);
this.trigger(application_events_1.ApplicationEvents.REVIVE, result);
return result;
}
};
_Application_skipErrorChecking_accessor_storage = new WeakMap();
_Application_entryPointStrategy_accessor_storage = new WeakMap();
_Application_entryPoints_accessor_storage = new WeakMap();
__setFunctionName(_classThis, "Application");
(() => {
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
_skipErrorChecking_decorators = [(0, utils_1.Option)("skipErrorChecking")];
_entryPointStrategy_decorators = [(0, utils_1.Option)("entryPointStrategy")];
_entryPoints_decorators = [(0, utils_1.Option)("entryPoints")];
__esDecorate(_classThis, null, _skipErrorChecking_decorators, { kind: "accessor", name: "skipErrorChecking", static: false, private: false, access: { has: obj => "skipErrorChecking" in obj, get: obj => obj.skipErrorChecking, set: (obj, value) => { obj.skipErrorChecking = value; } }, metadata: _metadata }, _skipErrorChecking_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _entryPointStrategy_decorators, { kind: "accessor", name: "entryPointStrategy", static: false, private: false, access: { has: obj => "entryPointStrategy" in obj, get: obj => obj.entryPointStrategy, set: (obj, value) => { obj.entryPointStrategy = value; } }, metadata: _metadata }, _entryPointStrategy_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _entryPoints_decorators, { kind: "accessor", name: "entryPoints", static: false, private: false, access: { has: obj => "entryPoints" in obj, get: obj => obj.entryPoints, set: (obj, value) => { obj.entryPoints = value; } }, metadata: _metadata }, _entryPoints_initializers, _instanceExtraInitializers);
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
Application = _classThis = _classDescriptor.value;
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
})();
/**
* The version number of TypeDoc.
*/
_classThis.VERSION = packageInfo.version;
/**
* Emitted after plugins have been loaded and options have been read, but before they have been frozen.
* The listener will be given an instance of {@link Application}.
*/
_classThis.EVENT_BOOTSTRAP_END = application_events_1.ApplicationEvents.BOOTSTRAP_END;
/**
* Emitted after a project has been deserialized from JSON.
* The listener will be given an instance of {@link ProjectReflection}.
*/
_classThis.EVENT_PROJECT_REVIVE = application_events_1.ApplicationEvents.REVIVE;
/**
* Emitted when validation is being run.
* The listener will be given an instance of {@link ProjectReflection}.
*/
_classThis.EVENT_VALIDATE_PROJECT = application_events_1.ApplicationEvents.VALIDATE_PROJECT;
(() => {
__runInitializers(_classThis, _classExtraInitializers);
})();
return Application = _classThis;
})();
exports.Application = Application;
/**
* The version number of TypeDoc.
*/
Application.VERSION = packageInfo.version;
/**
* Emitted after plugins have been loaded and options have been read, but before they have been frozen.
* The listener will be given an instance of {@link Application}.
*/
Application.EVENT_BOOTSTRAP_END = application_events_1.ApplicationEvents.BOOTSTRAP_END;
/**
* Emitted after a project has been deserialized from JSON.
* The listener will be given an instance of {@link ProjectReflection}.
*/
Application.EVENT_PROJECT_REVIVE = application_events_1.ApplicationEvents.REVIVE;
/**
* Emitted when validation is being run.
* The listener will be given an instance of {@link ProjectReflection}.
*/
Application.EVENT_VALIDATE_PROJECT = application_events_1.ApplicationEvents.VALIDATE_PROJECT;
__decorate([
(0, utils_1.BindOption)("skipErrorChecking")
], Application.prototype, "skipErrorChecking", void 0);
__decorate([
(0, utils_1.BindOption)("entryPointStrategy")
], Application.prototype, "entryPointStrategy", void 0);
__decorate([
(0, utils_1.BindOption)("entryPoints")
], Application.prototype, "entryPoints", void 0);
exports.Application = Application = Application_1 = __decorate([
(0, component_1.Component)({ name: "application", internal: true })
], Application);

@@ -34,2 +34,3 @@ "use strict";

ExceptionThrown: 6,
Watching: 7,
};

@@ -50,4 +51,6 @@ const td = __importStar(require("typedoc"));

const exitCode = await run(app);
app.logger.verbose(`Full run took ${Date.now() - start}ms`);
process.exit(exitCode);
if (exitCode !== ExitCodes.Watching) {
app.logger.verbose(`Full run took ${Date.now() - start}ms`);
process.exit(exitCode);
}
}

@@ -93,3 +96,3 @@ catch (error) {

});
return ExitCodes.Ok;
return ExitCodes.Watching;
}

@@ -96,0 +99,0 @@ const project = await app.convert();

@@ -9,2 +9,3 @@ "use strict";

const lexer_1 = require("./lexer");
const tagName_1 = require("./tagName");
function makeLookaheadGenerator(gen) {

@@ -82,14 +83,7 @@ let trackHistory = false;

if (first.kind === "text") {
let end = first.text.search(/\s/);
if (end === -1)
end = first.text.length;
tag.name = first.text.substring(0, end);
if (tag.name.startsWith("[") && tag.name.endsWith("]")) {
tag.name = tag.name.slice(1, tag.name.indexOf("="));
const { name, newText } = (0, tagName_1.extractTagName)(first.text);
tag.name = name;
if (newText) {
first.text = newText;
}
first.text = first.text.substring(end);
const endOfTrivia = first.text.search(/[^\-\s]/);
if (endOfTrivia !== -1) {
first.text = first.text.substring(endOfTrivia);
}
else {

@@ -96,0 +90,0 @@ // Remove this token, no real text in it.

@@ -141,5 +141,4 @@ "use strict";

addChild(reflection) {
var _a;
if (this.scope instanceof index_1.ContainerReflection) {
(_a = this.scope).children ?? (_a.children = []);
this.scope.children ??= [];
this.scope.children.push(reflection);

@@ -146,0 +145,0 @@ }

@@ -18,25 +18,25 @@ import ts from "typescript";

/** @internal */
externalPattern: string[];
accessor externalPattern: string[];
private externalPatternCache?;
private excludeCache?;
/** @internal */
excludeExternals: boolean;
accessor excludeExternals: boolean;
/** @internal */
excludeNotDocumented: boolean;
accessor excludeNotDocumented: boolean;
/** @internal */
excludePrivate: boolean;
accessor excludePrivate: boolean;
/** @internal */
excludeProtected: boolean;
accessor excludeProtected: boolean;
/** @internal */
excludeReferences: boolean;
accessor excludeReferences: boolean;
/** @internal */
commentStyle: CommentStyle;
accessor commentStyle: CommentStyle;
/** @internal */
validation: ValidationOptions;
accessor validation: ValidationOptions;
/** @internal */
externalSymbolLinkMappings: Record<string, Record<string, string>>;
accessor externalSymbolLinkMappings: Record<string, Record<string, string>>;
/** @internal */
useTsLinkResolution: boolean;
accessor useTsLinkResolution: boolean;
/** @internal */
preserveLinkText: boolean;
accessor preserveLinkText: boolean;
private _config?;

@@ -43,0 +43,0 @@ private _externalSymbolResolvers;

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var Converter_1;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -31,328 +73,411 @@ exports.Converter = void 0;

*/
let Converter = Converter_1 = class Converter extends component_1.ChildableComponent {
get config() {
return this._config || this._buildCommentParserConfig();
}
constructor(owner) {
super(owner);
this._externalSymbolResolvers = [];
this.addUnknownSymbolResolver((ref) => {
// Require global links, matching local ones will likely hide mistakes where the
// user meant to link to a local type.
if (ref.resolutionStart !== "global" || !ref.symbolReference) {
return;
let Converter = (() => {
var _Converter_externalPattern_accessor_storage, _Converter_excludeExternals_accessor_storage, _Converter_excludeNotDocumented_accessor_storage, _Converter_excludePrivate_accessor_storage, _Converter_excludeProtected_accessor_storage, _Converter_excludeReferences_accessor_storage, _Converter_commentStyle_accessor_storage, _Converter_validation_accessor_storage, _Converter_externalSymbolLinkMappings_accessor_storage, _Converter_useTsLinkResolution_accessor_storage, _Converter_preserveLinkText_accessor_storage;
let _classDecorators = [(0, component_1.Component)({
name: "converter",
internal: true,
childClass: components_1.ConverterComponent,
})];
let _classDescriptor;
let _classExtraInitializers = [];
let _classThis;
let _classSuper = component_1.ChildableComponent;
let _instanceExtraInitializers = [];
let _externalPattern_decorators;
let _externalPattern_initializers = [];
let _excludeExternals_decorators;
let _excludeExternals_initializers = [];
let _excludeNotDocumented_decorators;
let _excludeNotDocumented_initializers = [];
let _excludePrivate_decorators;
let _excludePrivate_initializers = [];
let _excludeProtected_decorators;
let _excludeProtected_initializers = [];
let _excludeReferences_decorators;
let _excludeReferences_initializers = [];
let _commentStyle_decorators;
let _commentStyle_initializers = [];
let _validation_decorators;
let _validation_initializers = [];
let _externalSymbolLinkMappings_decorators;
let _externalSymbolLinkMappings_initializers = [];
let _useTsLinkResolution_decorators;
let _useTsLinkResolution_initializers = [];
let _preserveLinkText_decorators;
let _preserveLinkText_initializers = [];
var Converter = _classThis = class extends _classSuper {
/** @internal */
get externalPattern() { return __classPrivateFieldGet(this, _Converter_externalPattern_accessor_storage, "f"); }
set externalPattern(value) { __classPrivateFieldSet(this, _Converter_externalPattern_accessor_storage, value, "f"); }
/** @internal */
get excludeExternals() { return __classPrivateFieldGet(this, _Converter_excludeExternals_accessor_storage, "f"); }
set excludeExternals(value) { __classPrivateFieldSet(this, _Converter_excludeExternals_accessor_storage, value, "f"); }
/** @internal */
get excludeNotDocumented() { return __classPrivateFieldGet(this, _Converter_excludeNotDocumented_accessor_storage, "f"); }
set excludeNotDocumented(value) { __classPrivateFieldSet(this, _Converter_excludeNotDocumented_accessor_storage, value, "f"); }
/** @internal */
get excludePrivate() { return __classPrivateFieldGet(this, _Converter_excludePrivate_accessor_storage, "f"); }
set excludePrivate(value) { __classPrivateFieldSet(this, _Converter_excludePrivate_accessor_storage, value, "f"); }
/** @internal */
get excludeProtected() { return __classPrivateFieldGet(this, _Converter_excludeProtected_accessor_storage, "f"); }
set excludeProtected(value) { __classPrivateFieldSet(this, _Converter_excludeProtected_accessor_storage, value, "f"); }
/** @internal */
get excludeReferences() { return __classPrivateFieldGet(this, _Converter_excludeReferences_accessor_storage, "f"); }
set excludeReferences(value) { __classPrivateFieldSet(this, _Converter_excludeReferences_accessor_storage, value, "f"); }
/** @internal */
get commentStyle() { return __classPrivateFieldGet(this, _Converter_commentStyle_accessor_storage, "f"); }
set commentStyle(value) { __classPrivateFieldSet(this, _Converter_commentStyle_accessor_storage, value, "f"); }
/** @internal */
get validation() { return __classPrivateFieldGet(this, _Converter_validation_accessor_storage, "f"); }
set validation(value) { __classPrivateFieldSet(this, _Converter_validation_accessor_storage, value, "f"); }
/** @internal */
get externalSymbolLinkMappings() { return __classPrivateFieldGet(this, _Converter_externalSymbolLinkMappings_accessor_storage, "f"); }
set externalSymbolLinkMappings(value) { __classPrivateFieldSet(this, _Converter_externalSymbolLinkMappings_accessor_storage, value, "f"); }
/** @internal */
get useTsLinkResolution() { return __classPrivateFieldGet(this, _Converter_useTsLinkResolution_accessor_storage, "f"); }
set useTsLinkResolution(value) { __classPrivateFieldSet(this, _Converter_useTsLinkResolution_accessor_storage, value, "f"); }
/** @internal */
get preserveLinkText() { return __classPrivateFieldGet(this, _Converter_preserveLinkText_accessor_storage, "f"); }
set preserveLinkText(value) { __classPrivateFieldSet(this, _Converter_preserveLinkText_accessor_storage, value, "f"); }
get config() {
return this._config || this._buildCommentParserConfig();
}
constructor(owner) {
super(owner);
_Converter_externalPattern_accessor_storage.set(this, (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _externalPattern_initializers, void 0)));
_Converter_excludeExternals_accessor_storage.set(this, __runInitializers(this, _excludeExternals_initializers, void 0));
_Converter_excludeNotDocumented_accessor_storage.set(this, __runInitializers(this, _excludeNotDocumented_initializers, void 0));
_Converter_excludePrivate_accessor_storage.set(this, __runInitializers(this, _excludePrivate_initializers, void 0));
_Converter_excludeProtected_accessor_storage.set(this, __runInitializers(this, _excludeProtected_initializers, void 0));
_Converter_excludeReferences_accessor_storage.set(this, __runInitializers(this, _excludeReferences_initializers, void 0));
_Converter_commentStyle_accessor_storage.set(this, __runInitializers(this, _commentStyle_initializers, void 0));
_Converter_validation_accessor_storage.set(this, __runInitializers(this, _validation_initializers, void 0));
_Converter_externalSymbolLinkMappings_accessor_storage.set(this, __runInitializers(this, _externalSymbolLinkMappings_initializers, void 0));
_Converter_useTsLinkResolution_accessor_storage.set(this, __runInitializers(this, _useTsLinkResolution_initializers, void 0));
_Converter_preserveLinkText_accessor_storage.set(this, __runInitializers(this, _preserveLinkText_initializers, void 0));
this._externalSymbolResolvers = [];
this.addUnknownSymbolResolver((ref) => {
// Require global links, matching local ones will likely hide mistakes where the
// user meant to link to a local type.
if (ref.resolutionStart !== "global" || !ref.symbolReference) {
return;
}
const modLinks = this.externalSymbolLinkMappings[ref.moduleSource ?? "global"];
if (typeof modLinks !== "object") {
return;
}
let name = "";
if (ref.symbolReference.path) {
name += ref.symbolReference.path.map((p) => p.path).join(".");
}
if (ref.symbolReference.meaning) {
name += ":" + ref.symbolReference.meaning;
}
if (typeof modLinks[name] === "string") {
return modLinks[name];
}
if (typeof modLinks["*"] === "string") {
return modLinks["*"];
}
});
}
/**
* Compile the given source files and create a project reflection for them.
*/
convert(entryPoints) {
const programs = entryPoints.map((e) => e.program);
this.externalPatternCache = void 0;
const project = new index_1.ProjectReflection(this.application.options.getValue("name"));
const context = new context_1.Context(this, programs, project);
this.trigger(Converter.EVENT_BEGIN, context);
this.compile(entryPoints, context);
this.resolve(context);
this.trigger(Converter.EVENT_END, context);
this._config = undefined;
return project;
}
/** @internal */
convertSymbol(context, symbol, exportSymbol) {
(0, symbols_1.convertSymbol)(context, symbol, exportSymbol);
}
/**
* Convert the given TypeScript type into its TypeDoc type reflection.
*
* @param context The context object describing the current state the converter is in.
* @param referenceTarget The target to be used to attempt to resolve reference types
* @returns The TypeDoc type reflection representing the given node and type.
* @internal
*/
convertType(context, node) {
return (0, types_1.convertType)(context, node);
}
/**
* Parse the given file into a comment. Intended to be used with markdown files.
*/
parseRawComment(file) {
return (0, parser_1.parseComment)((0, rawLexer_1.lexCommentString)(file.text), this.config, file, this.application.logger);
}
/**
* Adds a new resolver that the theme can use to try to figure out how to link to a symbol declared
* by a third-party library which is not included in the documentation.
*
* The resolver function will be passed a declaration reference which it can attempt to resolve. If
* resolution fails, the function should return undefined.
*
* Note: This will be used for both references to types declared in node_modules (in which case the
* reference passed will have the `moduleSource` set and the `symbolReference` will navigate via `.`)
* and user defined \{\@link\} tags which cannot be resolved. If the link being resolved is inferred
* from a type, then no `part` will be passed to the resolver function.
* @since 0.22.14
*/
addUnknownSymbolResolver(resolver) {
this._externalSymbolResolvers.push(resolver);
}
/** @internal */
resolveExternalLink(ref, refl, part, symbolId) {
for (const resolver of this._externalSymbolResolvers) {
const resolved = resolver(ref, refl, part, symbolId);
if (resolved)
return resolved;
}
const modLinks = this.externalSymbolLinkMappings[ref.moduleSource ?? "global"];
if (typeof modLinks !== "object") {
return;
}
resolveLinks(comment, owner) {
if (comment instanceof index_1.Comment) {
(0, linkResolver_1.resolveLinks)(comment, owner, (ref, part, refl, id) => this.resolveExternalLink(ref, part, refl, id), { preserveLinkText: this.preserveLinkText });
}
let name = "";
if (ref.symbolReference.path) {
name += ref.symbolReference.path.map((p) => p.path).join(".");
else {
return (0, linkResolver_1.resolvePartLinks)(owner, comment, (ref, part, refl, id) => this.resolveExternalLink(ref, part, refl, id), { preserveLinkText: this.preserveLinkText });
}
if (ref.symbolReference.meaning) {
name += ":" + ref.symbolReference.meaning;
}
/**
* Compile the files within the given context and convert the compiler symbols to reflections.
*
* @param context The context object describing the current state the converter is in.
* @returns An array containing all errors generated by the TypeScript compiler.
*/
compile(entryPoints, context) {
const entries = entryPoints.map((e) => {
return {
entryPoint: e,
context: undefined,
};
});
entries.forEach((e) => {
context.setActiveProgram(e.entryPoint.program);
e.context = this.convertExports(context, e.entryPoint, entries.length === 1);
});
for (const { entryPoint, context } of entries) {
// active program is already set on context
// if we don't have a context, then this entry point is being ignored
if (context) {
this.convertReExports(context, entryPoint.sourceFile);
}
}
if (typeof modLinks[name] === "string") {
return modLinks[name];
context.setActiveProgram(undefined);
}
convertExports(context, entryPoint, singleEntryPoint) {
const node = entryPoint.sourceFile;
const entryName = entryPoint.displayName;
const symbol = getSymbolForModuleLike(context, node);
let moduleContext;
if (singleEntryPoint) {
// Special case for when we're giving a single entry point, we don't need to
// create modules for each entry. Register the project as this module.
context.project.registerReflection(context.project, symbol);
context.project.comment = symbol
? context.getComment(symbol, context.project.kind)
: context.getFileComment(node);
context.trigger(Converter.EVENT_CREATE_DECLARATION, context.project);
moduleContext = context;
}
if (typeof modLinks["*"] === "string") {
return modLinks["*"];
else {
const reflection = context.createDeclarationReflection(index_1.ReflectionKind.Module, symbol, void 0, entryName);
if (!reflection.comment && !symbol) {
reflection.comment = context.getFileComment(node);
}
if (entryPoint.readmeFile) {
const readme = (0, utils_1.readFile)(entryPoint.readmeFile);
const comment = this.parseRawComment(new utils_1.MinimalSourceFile(readme, entryPoint.readmeFile));
if (comment.blockTags.length || comment.modifierTags.size) {
const ignored = [
...comment.blockTags.map((tag) => tag.tag),
...comment.modifierTags,
];
context.logger.warn(`Block and modifier tags will be ignored within the readme:\n\t${ignored.join("\n\t")}`);
}
reflection.readme = comment.summary;
}
reflection.packageVersion = entryPoint.version;
context.finalizeDeclarationReflection(reflection);
moduleContext = context.withScope(reflection);
}
});
}
const allExports = getExports(context, node, symbol);
for (const exp of allExports.filter((exp) => isDirectExport(context.resolveAliasedSymbol(exp), node))) {
this.convertSymbol(moduleContext, exp);
}
return moduleContext;
}
convertReExports(moduleContext, node) {
for (const exp of getExports(moduleContext, node, moduleContext.project.getSymbolFromReflection(moduleContext.scope)).filter((exp) => !isDirectExport(moduleContext.resolveAliasedSymbol(exp), node))) {
this.convertSymbol(moduleContext, exp);
}
}
/**
* Resolve the project within the given context.
*
* @param context The context object describing the current state the converter is in.
* @returns The final project reflection.
*/
resolve(context) {
this.trigger(Converter.EVENT_RESOLVE_BEGIN, context);
const project = context.project;
for (const id in project.reflections) {
this.trigger(Converter.EVENT_RESOLVE, context, project.reflections[id]);
}
this.trigger(Converter.EVENT_RESOLVE_END, context);
}
/**
* Used to determine if we should immediately bail when creating a reflection.
* Note: This should not be used for excludeNotDocumented because we don't have enough
* information at this point since comment discovery hasn't happened.
* @internal
*/
shouldIgnore(symbol) {
if (this.isExcluded(symbol)) {
return true;
}
return this.excludeExternals && this.isExternal(symbol);
}
isExcluded(symbol) {
this.excludeCache ??= (0, paths_1.createMinimatch)(this.application.options.getValue("exclude"));
const cache = this.excludeCache;
return (symbol.getDeclarations() ?? []).some((node) => (0, paths_1.matchesAny)(cache, node.getSourceFile().fileName));
}
/** @internal */
isExternal(symbol) {
this.externalPatternCache ??= (0, paths_1.createMinimatch)(this.externalPattern);
const cache = this.externalPatternCache;
return (symbol.getDeclarations() ?? []).some((node) => (0, paths_1.matchesAny)(cache, node.getSourceFile().fileName));
}
_buildCommentParserConfig() {
this._config = {
blockTags: new Set(this.application.options.getValue("blockTags")),
inlineTags: new Set(this.application.options.getValue("inlineTags")),
modifierTags: new Set(this.application.options.getValue("modifierTags")),
jsDocCompatibility: this.application.options.getValue("jsDocCompatibility"),
};
return this._config;
}
};
_Converter_externalPattern_accessor_storage = new WeakMap();
_Converter_excludeExternals_accessor_storage = new WeakMap();
_Converter_excludeNotDocumented_accessor_storage = new WeakMap();
_Converter_excludePrivate_accessor_storage = new WeakMap();
_Converter_excludeProtected_accessor_storage = new WeakMap();
_Converter_excludeReferences_accessor_storage = new WeakMap();
_Converter_commentStyle_accessor_storage = new WeakMap();
_Converter_validation_accessor_storage = new WeakMap();
_Converter_externalSymbolLinkMappings_accessor_storage = new WeakMap();
_Converter_useTsLinkResolution_accessor_storage = new WeakMap();
_Converter_preserveLinkText_accessor_storage = new WeakMap();
__setFunctionName(_classThis, "Converter");
(() => {
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
_externalPattern_decorators = [(0, utils_1.Option)("externalPattern")];
_excludeExternals_decorators = [(0, utils_1.Option)("excludeExternals")];
_excludeNotDocumented_decorators = [(0, utils_1.Option)("excludeNotDocumented")];
_excludePrivate_decorators = [(0, utils_1.Option)("excludePrivate")];
_excludeProtected_decorators = [(0, utils_1.Option)("excludeProtected")];
_excludeReferences_decorators = [(0, utils_1.Option)("excludeReferences")];
_commentStyle_decorators = [(0, utils_1.Option)("commentStyle")];
_validation_decorators = [(0, utils_1.Option)("validation")];
_externalSymbolLinkMappings_decorators = [(0, utils_1.Option)("externalSymbolLinkMappings")];
_useTsLinkResolution_decorators = [(0, utils_1.Option)("useTsLinkResolution")];
_preserveLinkText_decorators = [(0, utils_1.Option)("preserveLinkText")];
__esDecorate(_classThis, 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, _instanceExtraInitializers);
__esDecorate(_classThis, 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, _instanceExtraInitializers);
__esDecorate(_classThis, 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, _instanceExtraInitializers);
__esDecorate(_classThis, 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, _instanceExtraInitializers);
__esDecorate(_classThis, 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, _instanceExtraInitializers);
__esDecorate(_classThis, 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, _instanceExtraInitializers);
__esDecorate(_classThis, null, _commentStyle_decorators, { kind: "accessor", name: "commentStyle", static: false, private: false, access: { has: obj => "commentStyle" in obj, get: obj => obj.commentStyle, set: (obj, value) => { obj.commentStyle = value; } }, metadata: _metadata }, _commentStyle_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _validation_decorators, { kind: "accessor", name: "validation", static: false, private: false, access: { has: obj => "validation" in obj, get: obj => obj.validation, set: (obj, value) => { obj.validation = value; } }, metadata: _metadata }, _validation_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _externalSymbolLinkMappings_decorators, { kind: "accessor", name: "externalSymbolLinkMappings", static: false, private: false, access: { has: obj => "externalSymbolLinkMappings" in obj, get: obj => obj.externalSymbolLinkMappings, set: (obj, value) => { obj.externalSymbolLinkMappings = value; } }, metadata: _metadata }, _externalSymbolLinkMappings_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _useTsLinkResolution_decorators, { kind: "accessor", name: "useTsLinkResolution", static: false, private: false, access: { has: obj => "useTsLinkResolution" in obj, get: obj => obj.useTsLinkResolution, set: (obj, value) => { obj.useTsLinkResolution = value; } }, metadata: _metadata }, _useTsLinkResolution_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _preserveLinkText_decorators, { kind: "accessor", name: "preserveLinkText", static: false, private: false, access: { has: obj => "preserveLinkText" in obj, get: obj => obj.preserveLinkText, set: (obj, value) => { obj.preserveLinkText = value; } }, metadata: _metadata }, _preserveLinkText_initializers, _instanceExtraInitializers);
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
Converter = _classThis = _classDescriptor.value;
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
})();
/**
* Compile the given source files and create a project reflection for them.
* General events
*/
convert(entryPoints) {
const programs = entryPoints.map((e) => e.program);
this.externalPatternCache = void 0;
const project = new index_1.ProjectReflection(this.application.options.getValue("name"));
const context = new context_1.Context(this, programs, project);
this.trigger(Converter_1.EVENT_BEGIN, context);
this.compile(entryPoints, context);
this.resolve(context);
this.trigger(Converter_1.EVENT_END, context);
this._config = undefined;
return project;
}
/** @internal */
convertSymbol(context, symbol, exportSymbol) {
(0, symbols_1.convertSymbol)(context, symbol, exportSymbol);
}
/**
* Convert the given TypeScript type into its TypeDoc type reflection.
*
* @param context The context object describing the current state the converter is in.
* @param referenceTarget The target to be used to attempt to resolve reference types
* @returns The TypeDoc type reflection representing the given node and type.
* @internal
* Triggered when the converter begins converting a project.
* The listener will be given a {@link Context} object.
* @event
*/
convertType(context, node) {
return (0, types_1.convertType)(context, node);
}
_classThis.EVENT_BEGIN = converter_events_1.ConverterEvents.BEGIN;
/**
* Parse the given file into a comment. Intended to be used with markdown files.
* Triggered when the converter has finished converting a project.
* The listener will be given a {@link Context} object.
* @event
*/
parseRawComment(file) {
return (0, parser_1.parseComment)((0, rawLexer_1.lexCommentString)(file.text), this.config, file, this.application.logger);
}
_classThis.EVENT_END = converter_events_1.ConverterEvents.END;
/**
* Adds a new resolver that the theme can use to try to figure out how to link to a symbol declared
* by a third-party library which is not included in the documentation.
*
* The resolver function will be passed a declaration reference which it can attempt to resolve. If
* resolution fails, the function should return undefined.
*
* Note: This will be used for both references to types declared in node_modules (in which case the
* reference passed will have the `moduleSource` set and the `symbolReference` will navigate via `.`)
* and user defined \{\@link\} tags which cannot be resolved. If the link being resolved is inferred
* from a type, then no `part` will be passed to the resolver function.
* @since 0.22.14
* Factory events
*/
addUnknownSymbolResolver(resolver) {
this._externalSymbolResolvers.push(resolver);
}
/** @internal */
resolveExternalLink(ref, refl, part, symbolId) {
for (const resolver of this._externalSymbolResolvers) {
const resolved = resolver(ref, refl, part, symbolId);
if (resolved)
return resolved;
}
}
resolveLinks(comment, owner) {
if (comment instanceof index_1.Comment) {
(0, linkResolver_1.resolveLinks)(comment, owner, (ref, part, refl, id) => this.resolveExternalLink(ref, part, refl, id), { preserveLinkText: this.preserveLinkText });
}
else {
return (0, linkResolver_1.resolvePartLinks)(owner, comment, (ref, part, refl, id) => this.resolveExternalLink(ref, part, refl, id), { preserveLinkText: this.preserveLinkText });
}
}
/**
* Compile the files within the given context and convert the compiler symbols to reflections.
*
* @param context The context object describing the current state the converter is in.
* @returns An array containing all errors generated by the TypeScript compiler.
* Triggered when the converter has created a declaration reflection.
* The listener will be given {@link Context} and a {@link Models.DeclarationReflection}.
* @event
*/
compile(entryPoints, context) {
const entries = entryPoints.map((e) => {
return {
entryPoint: e,
context: undefined,
};
});
entries.forEach((e) => {
context.setActiveProgram(e.entryPoint.program);
e.context = this.convertExports(context, e.entryPoint, entries.length === 1);
});
for (const { entryPoint, context } of entries) {
// active program is already set on context
// if we don't have a context, then this entry point is being ignored
if (context) {
this.convertReExports(context, entryPoint.sourceFile);
}
}
context.setActiveProgram(undefined);
}
convertExports(context, entryPoint, singleEntryPoint) {
const node = entryPoint.sourceFile;
const entryName = entryPoint.displayName;
const symbol = getSymbolForModuleLike(context, node);
let moduleContext;
if (singleEntryPoint) {
// Special case for when we're giving a single entry point, we don't need to
// create modules for each entry. Register the project as this module.
context.project.registerReflection(context.project, symbol);
context.project.comment = symbol
? context.getComment(symbol, context.project.kind)
: context.getFileComment(node);
context.trigger(Converter_1.EVENT_CREATE_DECLARATION, context.project);
moduleContext = context;
}
else {
const reflection = context.createDeclarationReflection(index_1.ReflectionKind.Module, symbol, void 0, entryName);
if (!reflection.comment && !symbol) {
reflection.comment = context.getFileComment(node);
}
if (entryPoint.readmeFile) {
const readme = (0, utils_1.readFile)(entryPoint.readmeFile);
const comment = this.parseRawComment(new utils_1.MinimalSourceFile(readme, entryPoint.readmeFile));
if (comment.blockTags.length || comment.modifierTags.size) {
const ignored = [
...comment.blockTags.map((tag) => tag.tag),
...comment.modifierTags,
];
context.logger.warn(`Block and modifier tags will be ignored within the readme:\n\t${ignored.join("\n\t")}`);
}
reflection.readme = comment.summary;
}
reflection.packageVersion = entryPoint.version;
context.finalizeDeclarationReflection(reflection);
moduleContext = context.withScope(reflection);
}
const allExports = getExports(context, node, symbol);
for (const exp of allExports.filter((exp) => isDirectExport(context.resolveAliasedSymbol(exp), node))) {
this.convertSymbol(moduleContext, exp);
}
return moduleContext;
}
convertReExports(moduleContext, node) {
for (const exp of getExports(moduleContext, node, moduleContext.project.getSymbolFromReflection(moduleContext.scope)).filter((exp) => !isDirectExport(moduleContext.resolveAliasedSymbol(exp), node))) {
this.convertSymbol(moduleContext, exp);
}
}
_classThis.EVENT_CREATE_DECLARATION = converter_events_1.ConverterEvents.CREATE_DECLARATION;
/**
* Resolve the project within the given context.
*
* @param context The context object describing the current state the converter is in.
* @returns The final project reflection.
* Triggered when the converter has created a signature reflection.
* The listener will be given {@link Context}, {@link Models.SignatureReflection} | {@link Models.ProjectReflection} the declaration,
* `ts.SignatureDeclaration | ts.IndexSignatureDeclaration | ts.JSDocSignature | undefined`,
* and `ts.Signature | undefined`. The signature will be undefined if the created signature is an index signature.
* @event
*/
resolve(context) {
this.trigger(Converter_1.EVENT_RESOLVE_BEGIN, context);
const project = context.project;
for (const id in project.reflections) {
this.trigger(Converter_1.EVENT_RESOLVE, context, project.reflections[id]);
}
this.trigger(Converter_1.EVENT_RESOLVE_END, context);
}
_classThis.EVENT_CREATE_SIGNATURE = converter_events_1.ConverterEvents.CREATE_SIGNATURE;
/**
* Used to determine if we should immediately bail when creating a reflection.
* Note: This should not be used for excludeNotDocumented because we don't have enough
* information at this point since comment discovery hasn't happened.
* @internal
* Triggered when the converter has created a parameter reflection.
* The listener will be given {@link Context}, {@link Models.ParameterReflection} and a `ts.Node?`
* @event
*/
shouldIgnore(symbol) {
if (this.isExcluded(symbol)) {
return true;
}
return this.excludeExternals && this.isExternal(symbol);
}
isExcluded(symbol) {
this.excludeCache ?? (this.excludeCache = (0, paths_1.createMinimatch)(this.application.options.getValue("exclude")));
const cache = this.excludeCache;
return (symbol.getDeclarations() ?? []).some((node) => (0, paths_1.matchesAny)(cache, node.getSourceFile().fileName));
}
/** @internal */
isExternal(symbol) {
this.externalPatternCache ?? (this.externalPatternCache = (0, paths_1.createMinimatch)(this.externalPattern));
const cache = this.externalPatternCache;
return (symbol.getDeclarations() ?? []).some((node) => (0, paths_1.matchesAny)(cache, node.getSourceFile().fileName));
}
_buildCommentParserConfig() {
this._config = {
blockTags: new Set(this.application.options.getValue("blockTags")),
inlineTags: new Set(this.application.options.getValue("inlineTags")),
modifierTags: new Set(this.application.options.getValue("modifierTags")),
jsDocCompatibility: this.application.options.getValue("jsDocCompatibility"),
};
return this._config;
}
};
_classThis.EVENT_CREATE_PARAMETER = converter_events_1.ConverterEvents.CREATE_PARAMETER;
/**
* Triggered when the converter has created a type parameter reflection.
* The listener will be given {@link Context} and a {@link Models.TypeParameterReflection}
* @event
*/
_classThis.EVENT_CREATE_TYPE_PARAMETER = converter_events_1.ConverterEvents.CREATE_TYPE_PARAMETER;
/**
* Resolve events
*/
/**
* Triggered when the converter begins resolving a project.
* The listener will be given {@link Context}.
* @event
*/
_classThis.EVENT_RESOLVE_BEGIN = converter_events_1.ConverterEvents.RESOLVE_BEGIN;
/**
* Triggered when the converter resolves a reflection.
* The listener will be given {@link Context} and a {@link Reflection}.
* @event
*/
_classThis.EVENT_RESOLVE = converter_events_1.ConverterEvents.RESOLVE;
/**
* Triggered when the converter has finished resolving a project.
* The listener will be given {@link Context}.
* @event
*/
_classThis.EVENT_RESOLVE_END = converter_events_1.ConverterEvents.RESOLVE_END;
(() => {
__runInitializers(_classThis, _classExtraInitializers);
})();
return Converter = _classThis;
})();
exports.Converter = Converter;
/**
* General events
*/
/**
* Triggered when the converter begins converting a project.
* The listener will be given a {@link Context} object.
* @event
*/
Converter.EVENT_BEGIN = converter_events_1.ConverterEvents.BEGIN;
/**
* Triggered when the converter has finished converting a project.
* The listener will be given a {@link Context} object.
* @event
*/
Converter.EVENT_END = converter_events_1.ConverterEvents.END;
/**
* Factory events
*/
/**
* Triggered when the converter has created a declaration reflection.
* The listener will be given {@link Context} and a {@link Models.DeclarationReflection}.
* @event
*/
Converter.EVENT_CREATE_DECLARATION = converter_events_1.ConverterEvents.CREATE_DECLARATION;
/**
* Triggered when the converter has created a signature reflection.
* The listener will be given {@link Context}, {@link Models.SignatureReflection} | {@link Models.ProjectReflection} the declaration,
* `ts.SignatureDeclaration | ts.IndexSignatureDeclaration | ts.JSDocSignature | undefined`,
* and `ts.Signature | undefined`. The signature will be undefined if the created signature is an index signature.
* @event
*/
Converter.EVENT_CREATE_SIGNATURE = converter_events_1.ConverterEvents.CREATE_SIGNATURE;
/**
* Triggered when the converter has created a parameter reflection.
* The listener will be given {@link Context}, {@link Models.ParameterReflection} and a `ts.Node?`
* @event
*/
Converter.EVENT_CREATE_PARAMETER = converter_events_1.ConverterEvents.CREATE_PARAMETER;
/**
* Triggered when the converter has created a type parameter reflection.
* The listener will be given {@link Context} and a {@link Models.TypeParameterReflection}
* @event
*/
Converter.EVENT_CREATE_TYPE_PARAMETER = converter_events_1.ConverterEvents.CREATE_TYPE_PARAMETER;
/**
* Resolve events
*/
/**
* Triggered when the converter begins resolving a project.
* The listener will be given {@link Context}.
* @event
*/
Converter.EVENT_RESOLVE_BEGIN = converter_events_1.ConverterEvents.RESOLVE_BEGIN;
/**
* Triggered when the converter resolves a reflection.
* The listener will be given {@link Context} and a {@link Reflection}.
* @event
*/
Converter.EVENT_RESOLVE = converter_events_1.ConverterEvents.RESOLVE;
/**
* Triggered when the converter has finished resolving a project.
* The listener will be given {@link Context}.
* @event
*/
Converter.EVENT_RESOLVE_END = converter_events_1.ConverterEvents.RESOLVE_END;
__decorate([
(0, utils_1.BindOption)("externalPattern")
], Converter.prototype, "externalPattern", void 0);
__decorate([
(0, utils_1.BindOption)("excludeExternals")
], Converter.prototype, "excludeExternals", void 0);
__decorate([
(0, utils_1.BindOption)("excludeNotDocumented")
], Converter.prototype, "excludeNotDocumented", void 0);
__decorate([
(0, utils_1.BindOption)("excludePrivate")
], Converter.prototype, "excludePrivate", void 0);
__decorate([
(0, utils_1.BindOption)("excludeProtected")
], Converter.prototype, "excludeProtected", void 0);
__decorate([
(0, utils_1.BindOption)("excludeReferences")
], Converter.prototype, "excludeReferences", void 0);
__decorate([
(0, utils_1.BindOption)("commentStyle")
], Converter.prototype, "commentStyle", void 0);
__decorate([
(0, utils_1.BindOption)("validation")
], Converter.prototype, "validation", void 0);
__decorate([
(0, utils_1.BindOption)("externalSymbolLinkMappings")
], Converter.prototype, "externalSymbolLinkMappings", void 0);
__decorate([
(0, utils_1.BindOption)("useTsLinkResolution")
], Converter.prototype, "useTsLinkResolution", void 0);
__decorate([
(0, utils_1.BindOption)("preserveLinkText")
], Converter.prototype, "preserveLinkText", void 0);
exports.Converter = Converter = Converter_1 = __decorate([
(0, component_1.Component)({
name: "converter",
internal: true,
childClass: components_1.ConverterComponent,
})
], Converter);
function getSymbolForModuleLike(context, node) {

@@ -359,0 +484,0 @@ const symbol = context.checker.getSymbolAtLocation(node) ?? node.symbol;

@@ -15,5 +15,4 @@ "use strict";

function createSignature(context, kind, signature, symbol, declaration) {
var _a;
(0, assert_1.default)(context.scope instanceof models_1.DeclarationReflection);
declaration || (declaration = signature.getDeclaration());
declaration ||= signature.getDeclaration();
const sigRef = new models_1.SignatureReflection(kind == models_1.ReflectionKind.ConstructorSignature

@@ -67,3 +66,3 @@ ? `new ${context.scope.parent.name}`

case models_1.ReflectionKind.ConstructorSignature:
(_a = context.scope).signatures ?? (_a.signatures = []);
context.scope.signatures ??= [];
context.scope.signatures.push(sigRef);

@@ -85,3 +84,3 @@ break;

}
paramRefl.comment || (paramRefl.comment = context.getComment(param, paramRefl.kind));
paramRefl.comment ||= context.getComment(param, paramRefl.kind);
context.registerReflection(paramRefl, param);

@@ -88,0 +87,0 @@ context.trigger(converter_events_1.ConverterEvents.CREATE_PARAMETER, paramRefl);

import { DeclarationReflection } from "../../models";
import { ReflectionCategory } from "../../models";
import { ConverterComponent } from "../components";

@@ -11,6 +10,6 @@ /**

sortFunction: (reflections: DeclarationReflection[]) => void;
defaultCategory: string;
categoryOrder: string[];
categorizeByGroup: boolean;
boosts: Record<string, number>;
accessor defaultCategory: string;
accessor categoryOrder: string[];
accessor categorizeByGroup: boolean;
accessor boosts: Record<string, number>;
usedBoosts: Set<string>;

@@ -51,3 +50,3 @@ static defaultCategory: string;

*/
getReflectionCategories(reflections: DeclarationReflection[]): ReflectionCategory[];
private getReflectionCategories;
/**

@@ -62,3 +61,3 @@ * Return the category of a given reflection.

*/
getCategories(reflection: DeclarationReflection): Set<string>;
private extractCategories;
/**

@@ -71,3 +70,4 @@ * Callback used to sort categories by name.

*/
static sortCatCallback(a: ReflectionCategory, b: ReflectionCategory): number;
private static sortCatCallback;
static getCategories(reflection: DeclarationReflection): Set<string>;
}
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
var CategoryPlugin_1;
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -21,219 +63,270 @@ exports.CategoryPlugin = void 0;

*/
let CategoryPlugin = CategoryPlugin_1 = class CategoryPlugin extends components_1.ConverterComponent {
constructor() {
super(...arguments);
this.usedBoosts = new Set();
}
/**
* Create a new CategoryPlugin instance.
*/
initialize() {
this.listenTo(this.owner, {
[converter_1.Converter.EVENT_BEGIN]: this.onBegin,
[converter_1.Converter.EVENT_RESOLVE]: this.onResolve,
[converter_1.Converter.EVENT_RESOLVE_END]: this.onEndResolve,
}, undefined, -200);
}
/**
* Triggered when the converter begins converting a project.
*/
onBegin(_context) {
this.sortFunction = (0, utils_1.getSortFunction)(this.application.options);
// Set up static properties
if (this.defaultCategory) {
CategoryPlugin_1.defaultCategory = this.defaultCategory;
let CategoryPlugin = (() => {
var _CategoryPlugin_defaultCategory_accessor_storage, _CategoryPlugin_categoryOrder_accessor_storage, _CategoryPlugin_categorizeByGroup_accessor_storage, _CategoryPlugin_boosts_accessor_storage;
let _classDecorators = [(0, components_1.Component)({ name: "category" })];
let _classDescriptor;
let _classExtraInitializers = [];
let _classThis;
let _classSuper = components_1.ConverterComponent;
let _instanceExtraInitializers = [];
let _defaultCategory_decorators;
let _defaultCategory_initializers = [];
let _categoryOrder_decorators;
let _categoryOrder_initializers = [];
let _categorizeByGroup_decorators;
let _categorizeByGroup_initializers = [];
let _boosts_decorators;
let _boosts_initializers = [];
var CategoryPlugin = _classThis = class extends _classSuper {
constructor() {
super(...arguments);
this.sortFunction = (__runInitializers(this, _instanceExtraInitializers), void 0);
_CategoryPlugin_defaultCategory_accessor_storage.set(this, __runInitializers(this, _defaultCategory_initializers, void 0));
_CategoryPlugin_categoryOrder_accessor_storage.set(this, __runInitializers(this, _categoryOrder_initializers, void 0));
_CategoryPlugin_categorizeByGroup_accessor_storage.set(this, __runInitializers(this, _categorizeByGroup_initializers, void 0));
_CategoryPlugin_boosts_accessor_storage.set(this, __runInitializers(this, _boosts_initializers, void 0));
this.usedBoosts = new Set();
}
if (this.categoryOrder) {
CategoryPlugin_1.WEIGHTS = this.categoryOrder;
get defaultCategory() { return __classPrivateFieldGet(this, _CategoryPlugin_defaultCategory_accessor_storage, "f"); }
set defaultCategory(value) { __classPrivateFieldSet(this, _CategoryPlugin_defaultCategory_accessor_storage, value, "f"); }
get categoryOrder() { return __classPrivateFieldGet(this, _CategoryPlugin_categoryOrder_accessor_storage, "f"); }
set categoryOrder(value) { __classPrivateFieldSet(this, _CategoryPlugin_categoryOrder_accessor_storage, value, "f"); }
get categorizeByGroup() { return __classPrivateFieldGet(this, _CategoryPlugin_categorizeByGroup_accessor_storage, "f"); }
set categorizeByGroup(value) { __classPrivateFieldSet(this, _CategoryPlugin_categorizeByGroup_accessor_storage, value, "f"); }
get boosts() { return __classPrivateFieldGet(this, _CategoryPlugin_boosts_accessor_storage, "f"); }
set boosts(value) { __classPrivateFieldSet(this, _CategoryPlugin_boosts_accessor_storage, value, "f"); }
/**
* Create a new CategoryPlugin instance.
*/
initialize() {
this.listenTo(this.owner, {
[converter_1.Converter.EVENT_BEGIN]: this.onBegin,
[converter_1.Converter.EVENT_RESOLVE]: this.onResolve,
[converter_1.Converter.EVENT_RESOLVE_END]: this.onEndResolve,
}, undefined, -200);
}
}
/**
* Triggered when the converter resolves a reflection.
*
* @param context The context object describing the current state the converter is in.
* @param reflection The reflection that is currently resolved.
*/
onResolve(_context, reflection) {
if (reflection instanceof models_1.ContainerReflection) {
this.categorize(reflection);
/**
* Triggered when the converter begins converting a project.
*/
onBegin(_context) {
this.sortFunction = (0, utils_1.getSortFunction)(this.application.options);
// Set up static properties
if (this.defaultCategory) {
CategoryPlugin.defaultCategory = this.defaultCategory;
}
if (this.categoryOrder) {
CategoryPlugin.WEIGHTS = this.categoryOrder;
}
}
}
/**
* Triggered when the converter has finished resolving a project.
*
* @param context The context object describing the current state the converter is in.
*/
onEndResolve(context) {
const project = context.project;
this.categorize(project);
const unusedBoosts = new Set(Object.keys(this.boosts));
for (const boost of this.usedBoosts) {
unusedBoosts.delete(boost);
/**
* Triggered when the converter resolves a reflection.
*
* @param context The context object describing the current state the converter is in.
* @param reflection The reflection that is currently resolved.
*/
onResolve(_context, reflection) {
if (reflection instanceof models_1.ContainerReflection) {
this.categorize(reflection);
}
}
this.usedBoosts.clear();
if (unusedBoosts.size) {
context.logger.warn(`Not all categories specified in searchCategoryBoosts were used in the documentation.` +
` The unused categories were:\n\t${Array.from(unusedBoosts).join("\n\t")}`);
/**
* Triggered when the converter has finished resolving a project.
*
* @param context The context object describing the current state the converter is in.
*/
onEndResolve(context) {
const project = context.project;
this.categorize(project);
const unusedBoosts = new Set(Object.keys(this.boosts));
for (const boost of this.usedBoosts) {
unusedBoosts.delete(boost);
}
this.usedBoosts.clear();
if (unusedBoosts.size) {
context.logger.warn(`Not all categories specified in searchCategoryBoosts were used in the documentation.` +
` The unused categories were:\n\t${Array.from(unusedBoosts).join("\n\t")}`);
}
}
}
categorize(obj) {
if (this.categorizeByGroup) {
this.groupCategorize(obj);
categorize(obj) {
if (this.categorizeByGroup) {
this.groupCategorize(obj);
}
else {
this.lumpCategorize(obj);
}
}
else {
this.lumpCategorize(obj);
groupCategorize(obj) {
if (!obj.groups || obj.groups.length === 0) {
return;
}
obj.groups.forEach((group) => {
if (group.categories)
return;
group.categories = this.getReflectionCategories(group.children);
if (group.categories && group.categories.length > 1) {
group.categories.sort(CategoryPlugin.sortCatCallback);
}
else if (group.categories.length === 1 &&
group.categories[0].title === CategoryPlugin.defaultCategory) {
// no categories if everything is uncategorized
group.categories = undefined;
}
});
}
}
groupCategorize(obj) {
if (!obj.groups || obj.groups.length === 0) {
return;
}
obj.groups.forEach((group) => {
if (group.categories)
lumpCategorize(obj) {
if (!obj.children || obj.children.length === 0 || obj.categories) {
return;
group.categories = this.getReflectionCategories(group.children);
if (group.categories && group.categories.length > 1) {
group.categories.sort(CategoryPlugin_1.sortCatCallback);
}
else if (group.categories.length === 1 &&
group.categories[0].title === CategoryPlugin_1.defaultCategory) {
obj.categories = this.getReflectionCategories(obj.children);
if (obj.categories && obj.categories.length > 1) {
obj.categories.sort(CategoryPlugin.sortCatCallback);
}
else if (obj.categories.length === 1 &&
obj.categories[0].title === CategoryPlugin.defaultCategory) {
// no categories if everything is uncategorized
group.categories = undefined;
obj.categories = undefined;
}
});
}
lumpCategorize(obj) {
if (!obj.children || obj.children.length === 0 || obj.categories) {
return;
}
obj.categories = this.getReflectionCategories(obj.children);
if (obj.categories && obj.categories.length > 1) {
obj.categories.sort(CategoryPlugin_1.sortCatCallback);
/**
* Create a categorized representation of the given list of reflections.
*
* @param reflections The reflections that should be categorized.
* @param categorySearchBoosts A user-supplied map of category titles, for computing a
* relevance boost to be used when searching
* @returns An array containing all children of the given reflection categorized
*/
getReflectionCategories(reflections) {
const categories = new Map();
for (const child of reflections) {
const childCategories = this.extractCategories(child);
if (childCategories.size === 0) {
childCategories.add(CategoryPlugin.defaultCategory);
}
for (const childCat of childCategories) {
const category = categories.get(childCat);
if (category) {
category.children.push(child);
}
else {
const cat = new models_2.ReflectionCategory(childCat);
cat.children.push(child);
categories.set(childCat, cat);
}
}
}
for (const cat of categories.values()) {
this.sortFunction(cat.children);
}
return Array.from(categories.values());
}
else if (obj.categories.length === 1 &&
obj.categories[0].title === CategoryPlugin_1.defaultCategory) {
// no categories if everything is uncategorized
obj.categories = undefined;
}
}
/**
* Create a categorized representation of the given list of reflections.
*
* @param reflections The reflections that should be categorized.
* @param categorySearchBoosts A user-supplied map of category titles, for computing a
* relevance boost to be used when searching
* @returns An array containing all children of the given reflection categorized
*/
getReflectionCategories(reflections) {
const categories = new Map();
for (const child of reflections) {
const childCategories = this.getCategories(child);
if (childCategories.size === 0) {
childCategories.add(CategoryPlugin_1.defaultCategory);
/**
* Return the category of a given reflection.
*
* @param reflection The reflection.
* @returns The category the reflection belongs to
*
* @privateRemarks
* If you change this, also update getGroups in GroupPlugin accordingly.
*/
extractCategories(reflection) {
const categories = CategoryPlugin.getCategories(reflection);
reflection.comment?.removeTags("@category");
for (const sig of reflection.getNonIndexSignatures()) {
sig.comment?.removeTags("@category");
}
for (const childCat of childCategories) {
const category = categories.get(childCat);
if (category) {
category.children.push(child);
if (reflection.type?.type === "reflection") {
reflection.type.declaration.comment?.removeTags("@category");
for (const sig of reflection.type.declaration.getNonIndexSignatures()) {
sig.comment?.removeTags("@category");
}
else {
const cat = new models_2.ReflectionCategory(childCat);
cat.children.push(child);
categories.set(childCat, cat);
}
categories.delete("");
for (const cat of categories) {
if (cat in this.boosts) {
this.usedBoosts.add(cat);
reflection.relevanceBoost =
(reflection.relevanceBoost ?? 1) * this.boosts[cat];
}
}
return categories;
}
for (const cat of categories.values()) {
this.sortFunction(cat.children);
}
return Array.from(categories.values());
}
/**
* Return the category of a given reflection.
*
* @param reflection The reflection.
* @returns The category the reflection belongs to
*
* @privateRemarks
* If you change this, also update getGroups in GroupPlugin accordingly.
*/
getCategories(reflection) {
const categories = new Set();
function extractCategoryTags(comment) {
if (!comment)
return;
(0, utils_1.removeIf)(comment.blockTags, (tag) => {
if (tag.tag === "@category") {
categories.add(models_1.Comment.combineDisplayParts(tag.content).trim());
return true;
/**
* Callback used to sort categories by name.
*
* @param a The left reflection to sort.
* @param b The right reflection to sort.
* @returns The sorting weight.
*/
static sortCatCallback(a, b) {
let aWeight = CategoryPlugin.WEIGHTS.indexOf(a.title);
let bWeight = CategoryPlugin.WEIGHTS.indexOf(b.title);
if (aWeight === -1 || bWeight === -1) {
let asteriskIndex = CategoryPlugin.WEIGHTS.indexOf("*");
if (asteriskIndex === -1) {
asteriskIndex = CategoryPlugin.WEIGHTS.length;
}
return false;
});
}
extractCategoryTags(reflection.comment);
for (const sig of reflection.getNonIndexSignatures()) {
extractCategoryTags(sig.comment);
}
if (reflection.type?.type === "reflection") {
extractCategoryTags(reflection.type.declaration.comment);
for (const sig of reflection.type.declaration.getNonIndexSignatures()) {
extractCategoryTags(sig.comment);
if (aWeight === -1) {
aWeight = asteriskIndex;
}
if (bWeight === -1) {
bWeight = asteriskIndex;
}
}
}
categories.delete("");
for (const cat of categories) {
if (cat in this.boosts) {
this.usedBoosts.add(cat);
reflection.relevanceBoost =
(reflection.relevanceBoost ?? 1) * this.boosts[cat];
if (aWeight === bWeight) {
return a.title > b.title ? 1 : -1;
}
return aWeight - bWeight;
}
return categories;
}
/**
* Callback used to sort categories by name.
*
* @param a The left reflection to sort.
* @param b The right reflection to sort.
* @returns The sorting weight.
*/
static sortCatCallback(a, b) {
let aWeight = CategoryPlugin_1.WEIGHTS.indexOf(a.title);
let bWeight = CategoryPlugin_1.WEIGHTS.indexOf(b.title);
if (aWeight === -1 || bWeight === -1) {
let asteriskIndex = CategoryPlugin_1.WEIGHTS.indexOf("*");
if (asteriskIndex === -1) {
asteriskIndex = CategoryPlugin_1.WEIGHTS.length;
static getCategories(reflection) {
const categories = new Set();
function discoverCategories(comment) {
if (!comment)
return;
for (const tag of comment.blockTags) {
if (tag.tag === "@category") {
categories.add(models_1.Comment.combineDisplayParts(tag.content).trim());
}
}
}
if (aWeight === -1) {
aWeight = asteriskIndex;
discoverCategories(reflection.comment);
for (const sig of reflection.getNonIndexSignatures()) {
discoverCategories(sig.comment);
}
if (bWeight === -1) {
bWeight = asteriskIndex;
if (reflection.type?.type === "reflection") {
discoverCategories(reflection.type.declaration.comment);
for (const sig of reflection.type.declaration.getNonIndexSignatures()) {
discoverCategories(sig.comment);
}
}
categories.delete("");
return categories;
}
if (aWeight === bWeight) {
return a.title > b.title ? 1 : -1;
}
return aWeight - bWeight;
}
};
};
_CategoryPlugin_defaultCategory_accessor_storage = new WeakMap();
_CategoryPlugin_categoryOrder_accessor_storage = new WeakMap();
_CategoryPlugin_categorizeByGroup_accessor_storage = new WeakMap();
_CategoryPlugin_boosts_accessor_storage = new WeakMap();
__setFunctionName(_classThis, "CategoryPlugin");
(() => {
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
_defaultCategory_decorators = [(0, utils_1.Option)("defaultCategory")];
_categoryOrder_decorators = [(0, utils_1.Option)("categoryOrder")];
_categorizeByGroup_decorators = [(0, utils_1.Option)("categorizeByGroup")];
_boosts_decorators = [(0, utils_1.Option)("searchCategoryBoosts")];
__esDecorate(_classThis, null, _defaultCategory_decorators, { kind: "accessor", name: "defaultCategory", static: false, private: false, access: { has: obj => "defaultCategory" in obj, get: obj => obj.defaultCategory, set: (obj, value) => { obj.defaultCategory = value; } }, metadata: _metadata }, _defaultCategory_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _categoryOrder_decorators, { kind: "accessor", name: "categoryOrder", static: false, private: false, access: { has: obj => "categoryOrder" in obj, get: obj => obj.categoryOrder, set: (obj, value) => { obj.categoryOrder = value; } }, metadata: _metadata }, _categoryOrder_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _categorizeByGroup_decorators, { kind: "accessor", name: "categorizeByGroup", static: false, private: false, access: { has: obj => "categorizeByGroup" in obj, get: obj => obj.categorizeByGroup, set: (obj, value) => { obj.categorizeByGroup = value; } }, metadata: _metadata }, _categorizeByGroup_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _boosts_decorators, { kind: "accessor", name: "boosts", static: false, private: false, access: { has: obj => "boosts" in obj, get: obj => obj.boosts, set: (obj, value) => { obj.boosts = value; } }, metadata: _metadata }, _boosts_initializers, _instanceExtraInitializers);
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
CategoryPlugin = _classThis = _classDescriptor.value;
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
})();
// For use in static methods
_classThis.defaultCategory = "Other";
_classThis.WEIGHTS = [];
(() => {
__runInitializers(_classThis, _classExtraInitializers);
})();
return CategoryPlugin = _classThis;
})();
exports.CategoryPlugin = CategoryPlugin;
// For use in static methods
CategoryPlugin.defaultCategory = "Other";
CategoryPlugin.WEIGHTS = [];
__decorate([
(0, utils_1.BindOption)("defaultCategory")
], CategoryPlugin.prototype, "defaultCategory", void 0);
__decorate([
(0, utils_1.BindOption)("categoryOrder")
], CategoryPlugin.prototype, "categoryOrder", void 0);
__decorate([
(0, utils_1.BindOption)("categorizeByGroup")
], CategoryPlugin.prototype, "categorizeByGroup", void 0);
__decorate([
(0, utils_1.BindOption)("searchCategoryBoosts")
], CategoryPlugin.prototype, "boosts", void 0);
exports.CategoryPlugin = CategoryPlugin = CategoryPlugin_1 = __decorate([
(0, components_1.Component)({ name: "category" })
], CategoryPlugin);

@@ -59,7 +59,9 @@ import { ConverterComponent } from "../components";

export declare class CommentPlugin extends ConverterComponent {
excludeTags: `@${string}`[];
excludeInternal: boolean;
excludePrivate: boolean;
excludeProtected: boolean;
excludeNotDocumented: boolean;
accessor excludeTags: `@${string}`[];
accessor excludeInternal: boolean;
accessor excludePrivate: boolean;
accessor excludeProtected: boolean;
accessor excludeNotDocumented: boolean;
accessor excludeCategories: string[];
accessor defaultCategory: string;
private _excludeKinds;

@@ -122,2 +124,3 @@ private get excludeNotDocumentedKinds();

private isHidden;
private excludedByCategory;
}
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -14,2 +57,3 @@ exports.CommentPlugin = void 0;

const utils_1 = require("../../utils");
const CategoryPlugin_1 = require("./CategoryPlugin");
/**

@@ -92,336 +136,415 @@ * These tags are not useful to display in the generated documentation.

*/
let CommentPlugin = class CommentPlugin extends components_1.ConverterComponent {
get excludeNotDocumentedKinds() {
this._excludeKinds ?? (this._excludeKinds = this.application.options
.getValue("excludeNotDocumentedKinds")
.reduce((a, b) => a | models_1.ReflectionKind[b], 0));
return this._excludeKinds;
}
/**
* Create a new CommentPlugin instance.
*/
initialize() {
this.listenTo(this.owner, {
[converter_1.Converter.EVENT_CREATE_DECLARATION]: this.onDeclaration,
[converter_1.Converter.EVENT_CREATE_SIGNATURE]: this.onDeclaration,
[converter_1.Converter.EVENT_CREATE_TYPE_PARAMETER]: this.onCreateTypeParameter,
[converter_1.Converter.EVENT_RESOLVE_BEGIN]: this.onBeginResolve,
[converter_1.Converter.EVENT_RESOLVE]: this.onResolve,
[converter_1.Converter.EVENT_END]: () => {
this._excludeKinds = undefined;
},
});
}
/**
* Apply all comment tag modifiers to the given reflection.
*
* @param reflection The reflection the modifiers should be applied to.
* @param comment The comment that should be searched for modifiers.
*/
applyModifiers(reflection, comment) {
if (reflection.kindOf(models_1.ReflectionKind.SomeModule)) {
comment.removeModifier("@namespace");
let CommentPlugin = (() => {
var _CommentPlugin_excludeTags_accessor_storage, _CommentPlugin_excludeInternal_accessor_storage, _CommentPlugin_excludePrivate_accessor_storage, _CommentPlugin_excludeProtected_accessor_storage, _CommentPlugin_excludeNotDocumented_accessor_storage, _CommentPlugin_excludeCategories_accessor_storage, _CommentPlugin_defaultCategory_accessor_storage;
let _classDecorators = [(0, components_1.Component)({ name: "comment" })];
let _classDescriptor;
let _classExtraInitializers = [];
let _classThis;
let _classSuper = components_1.ConverterComponent;
let _instanceExtraInitializers = [];
let _excludeTags_decorators;
let _excludeTags_initializers = [];
let _excludeInternal_decorators;
let _excludeInternal_initializers = [];
let _excludePrivate_decorators;
let _excludePrivate_initializers = [];
let _excludeProtected_decorators;
let _excludeProtected_initializers = [];
let _excludeNotDocumented_decorators;
let _excludeNotDocumented_initializers = [];
let _excludeCategories_decorators;
let _excludeCategories_initializers = [];
let _defaultCategory_decorators;
let _defaultCategory_initializers = [];
var CommentPlugin = _classThis = class extends _classSuper {
constructor() {
super(...arguments);
_CommentPlugin_excludeTags_accessor_storage.set(this, (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _excludeTags_initializers, void 0)));
_CommentPlugin_excludeInternal_accessor_storage.set(this, __runInitializers(this, _excludeInternal_initializers, void 0));
_CommentPlugin_excludePrivate_accessor_storage.set(this, __runInitializers(this, _excludePrivate_initializers, void 0));
_CommentPlugin_excludeProtected_accessor_storage.set(this, __runInitializers(this, _excludeProtected_initializers, void 0));
_CommentPlugin_excludeNotDocumented_accessor_storage.set(this, __runInitializers(this, _excludeNotDocumented_initializers, void 0));
_CommentPlugin_excludeCategories_accessor_storage.set(this, __runInitializers(this, _excludeCategories_initializers, void 0));
_CommentPlugin_defaultCategory_accessor_storage.set(this, __runInitializers(this, _defaultCategory_initializers, void 0));
}
if (reflection.kindOf(models_1.ReflectionKind.Interface)) {
comment.removeModifier("@interface");
get excludeTags() { return __classPrivateFieldGet(this, _CommentPlugin_excludeTags_accessor_storage, "f"); }
set excludeTags(value) { __classPrivateFieldSet(this, _CommentPlugin_excludeTags_accessor_storage, value, "f"); }
get excludeInternal() { return __classPrivateFieldGet(this, _CommentPlugin_excludeInternal_accessor_storage, "f"); }
set excludeInternal(value) { __classPrivateFieldSet(this, _CommentPlugin_excludeInternal_accessor_storage, value, "f"); }
get excludePrivate() { return __classPrivateFieldGet(this, _CommentPlugin_excludePrivate_accessor_storage, "f"); }
set excludePrivate(value) { __classPrivateFieldSet(this, _CommentPlugin_excludePrivate_accessor_storage, value, "f"); }
get excludeProtected() { return __classPrivateFieldGet(this, _CommentPlugin_excludeProtected_accessor_storage, "f"); }
set excludeProtected(value) { __classPrivateFieldSet(this, _CommentPlugin_excludeProtected_accessor_storage, value, "f"); }
get excludeNotDocumented() { return __classPrivateFieldGet(this, _CommentPlugin_excludeNotDocumented_accessor_storage, "f"); }
set excludeNotDocumented(value) { __classPrivateFieldSet(this, _CommentPlugin_excludeNotDocumented_accessor_storage, value, "f"); }
get excludeCategories() { return __classPrivateFieldGet(this, _CommentPlugin_excludeCategories_accessor_storage, "f"); }
set excludeCategories(value) { __classPrivateFieldSet(this, _CommentPlugin_excludeCategories_accessor_storage, value, "f"); }
get defaultCategory() { return __classPrivateFieldGet(this, _CommentPlugin_defaultCategory_accessor_storage, "f"); }
set defaultCategory(value) { __classPrivateFieldSet(this, _CommentPlugin_defaultCategory_accessor_storage, value, "f"); }
get excludeNotDocumentedKinds() {
this._excludeKinds ??= this.application.options
.getValue("excludeNotDocumentedKinds")
.reduce((a, b) => a | models_1.ReflectionKind[b], 0);
return this._excludeKinds;
}
if (comment.hasModifier("@private")) {
reflection.setFlag(models_1.ReflectionFlag.Private);
if (reflection.kindOf(models_1.ReflectionKind.CallSignature)) {
reflection.parent?.setFlag(models_1.ReflectionFlag.Private);
}
comment.removeModifier("@private");
/**
* Create a new CommentPlugin instance.
*/
initialize() {
this.listenTo(this.owner, {
[converter_1.Converter.EVENT_CREATE_DECLARATION]: this.onDeclaration,
[converter_1.Converter.EVENT_CREATE_SIGNATURE]: this.onDeclaration,
[converter_1.Converter.EVENT_CREATE_TYPE_PARAMETER]: this.onCreateTypeParameter,
[converter_1.Converter.EVENT_RESOLVE_BEGIN]: this.onBeginResolve,
[converter_1.Converter.EVENT_RESOLVE]: this.onResolve,
[converter_1.Converter.EVENT_END]: () => {
this._excludeKinds = undefined;
},
});
}
if (comment.hasModifier("@protected")) {
reflection.setFlag(models_1.ReflectionFlag.Protected);
if (reflection.kindOf(models_1.ReflectionKind.CallSignature)) {
reflection.parent?.setFlag(models_1.ReflectionFlag.Protected);
/**
* Apply all comment tag modifiers to the given reflection.
*
* @param reflection The reflection the modifiers should be applied to.
* @param comment The comment that should be searched for modifiers.
*/
applyModifiers(reflection, comment) {
if (reflection.kindOf(models_1.ReflectionKind.SomeModule)) {
comment.removeModifier("@namespace");
}
comment.removeModifier("@protected");
}
if (comment.hasModifier("@public")) {
reflection.setFlag(models_1.ReflectionFlag.Public);
if (reflection.kindOf(models_1.ReflectionKind.CallSignature)) {
reflection.parent?.setFlag(models_1.ReflectionFlag.Public);
if (reflection.kindOf(models_1.ReflectionKind.Interface)) {
comment.removeModifier("@interface");
}
comment.removeModifier("@public");
}
if (comment.hasModifier("@readonly")) {
const target = reflection.kindOf(models_1.ReflectionKind.GetSignature)
? reflection.parent
: reflection;
target.setFlag(models_1.ReflectionFlag.Readonly);
comment.removeModifier("@readonly");
}
if (comment.hasModifier("@event") ||
comment.hasModifier("@eventProperty")) {
comment.blockTags.push(new models_1.CommentTag("@group", [{ kind: "text", text: "Events" }]));
comment.removeModifier("@event");
comment.removeModifier("@eventProperty");
}
if (reflection.kindOf(models_1.ReflectionKind.Module | models_1.ReflectionKind.Namespace) ||
reflection.kind === models_1.ReflectionKind.Project) {
comment.removeTags("@module");
comment.removeModifier("@packageDocumentation");
}
}
/**
* Triggered when the converter has created a type parameter reflection.
*
* @param context The context object describing the current state the converter is in.
* @param reflection The reflection that is currently processed.
*/
onCreateTypeParameter(_context, reflection) {
const comment = reflection.parent?.comment;
if (comment) {
let tag = comment.getIdentifiedTag(reflection.name, "@typeParam");
if (!tag) {
tag = comment.getIdentifiedTag(reflection.name, "@template");
if (comment.hasModifier("@private")) {
reflection.setFlag(models_1.ReflectionFlag.Private);
if (reflection.kindOf(models_1.ReflectionKind.CallSignature)) {
reflection.parent?.setFlag(models_1.ReflectionFlag.Private);
}
comment.removeModifier("@private");
}
if (!tag) {
tag = comment.getIdentifiedTag(`<${reflection.name}>`, "@param");
if (comment.hasModifier("@protected")) {
reflection.setFlag(models_1.ReflectionFlag.Protected);
if (reflection.kindOf(models_1.ReflectionKind.CallSignature)) {
reflection.parent?.setFlag(models_1.ReflectionFlag.Protected);
}
comment.removeModifier("@protected");
}
if (!tag) {
tag = comment.getIdentifiedTag(reflection.name, "@param");
if (comment.hasModifier("@public")) {
reflection.setFlag(models_1.ReflectionFlag.Public);
if (reflection.kindOf(models_1.ReflectionKind.CallSignature)) {
reflection.parent?.setFlag(models_1.ReflectionFlag.Public);
}
comment.removeModifier("@public");
}
if (tag) {
reflection.comment = new models_1.Comment(tag.content);
(0, utils_1.removeIfPresent)(comment.blockTags, tag);
if (comment.hasModifier("@readonly")) {
const target = reflection.kindOf(models_1.ReflectionKind.GetSignature)
? reflection.parent
: reflection;
target.setFlag(models_1.ReflectionFlag.Readonly);
comment.removeModifier("@readonly");
}
if (comment.hasModifier("@event") ||
comment.hasModifier("@eventProperty")) {
comment.blockTags.push(new models_1.CommentTag("@group", [{ kind: "text", text: "Events" }]));
comment.removeModifier("@event");
comment.removeModifier("@eventProperty");
}
if (reflection.kindOf(models_1.ReflectionKind.Module | models_1.ReflectionKind.Namespace) ||
reflection.kind === models_1.ReflectionKind.Project) {
comment.removeTags("@module");
comment.removeModifier("@packageDocumentation");
}
}
}
/**
* Triggered when the converter has created a declaration or signature reflection.
*
* Invokes the comment parser.
*
* @param context The context object describing the current state the converter is in.
* @param reflection The reflection that is currently processed.
* @param node The node that is currently processed if available.
*/
onDeclaration(_context, reflection) {
const comment = reflection.comment;
if (!comment)
return;
if (reflection.kindOf(models_1.ReflectionKind.Module)) {
const tag = comment.getTag("@module");
if (tag) {
// If no name is specified, this is a flag to mark a comment as a module comment
// and should not result in a reflection rename.
const newName = models_1.Comment.combineDisplayParts(tag.content).trim();
if (newName.length && !newName.includes("\n")) {
reflection.name = newName;
/**
* Triggered when the converter has created a type parameter reflection.
*
* @param context The context object describing the current state the converter is in.
* @param reflection The reflection that is currently processed.
*/
onCreateTypeParameter(_context, reflection) {
const comment = reflection.parent?.comment;
if (comment) {
let tag = comment.getIdentifiedTag(reflection.name, "@typeParam");
if (!tag) {
tag = comment.getIdentifiedTag(reflection.name, "@template");
}
(0, utils_1.removeIfPresent)(comment.blockTags, tag);
if (!tag) {
tag = comment.getIdentifiedTag(`<${reflection.name}>`, "@param");
}
if (!tag) {
tag = comment.getIdentifiedTag(reflection.name, "@param");
}
if (tag) {
reflection.comment = new models_1.Comment(tag.content);
(0, utils_1.removeIfPresent)(comment.blockTags, tag);
}
}
}
this.applyModifiers(reflection, comment);
this.removeExcludedTags(comment);
}
/**
* Triggered when the converter begins resolving a project.
*
* @param context The context object describing the current state the converter is in.
*/
onBeginResolve(context) {
const project = context.project;
const reflections = Object.values(project.reflections);
// Remove hidden reflections
const hidden = new Set();
for (const ref of reflections) {
if (ref.kindOf(models_1.ReflectionKind.Accessor) && ref.flags.isReadonly) {
const decl = ref;
if (decl.setSignature) {
hidden.add(decl.setSignature);
/**
* Triggered when the converter has created a declaration or signature reflection.
*
* Invokes the comment parser.
*
* @param context The context object describing the current state the converter is in.
* @param reflection The reflection that is currently processed.
* @param node The node that is currently processed if available.
*/
onDeclaration(_context, reflection) {
const comment = reflection.comment;
if (!comment)
return;
if (reflection.kindOf(models_1.ReflectionKind.Module)) {
const tag = comment.getTag("@module");
if (tag) {
// If no name is specified, this is a flag to mark a comment as a module comment
// and should not result in a reflection rename.
const newName = models_1.Comment.combineDisplayParts(tag.content).trim();
if (newName.length && !newName.includes("\n")) {
reflection.name = newName;
}
(0, utils_1.removeIfPresent)(comment.blockTags, tag);
}
// Clear flag set by @readonly since it shouldn't be rendered.
ref.setFlag(models_1.ReflectionFlag.Readonly, false);
}
if (this.isHidden(ref)) {
hidden.add(ref);
}
this.applyModifiers(reflection, comment);
this.removeExcludedTags(comment);
}
hidden.forEach((reflection) => project.removeReflection(reflection));
// remove functions with empty signatures after their signatures have been removed
const [allRemoved, someRemoved] = (0, utils_1.partition)((0, utils_1.unique)((0, utils_1.filterMap)(hidden, (reflection) => reflection.parent?.kindOf(models_1.ReflectionKind.SignatureContainer)
? reflection.parent
: void 0)), (method) => method.getNonIndexSignatures().length === 0);
allRemoved.forEach((reflection) => {
project.removeReflection(reflection);
});
someRemoved.forEach((reflection) => {
reflection.sources = reflection
.getNonIndexSignatures()
.flatMap((s) => s.sources ?? []);
});
}
/**
* Triggered when the converter resolves a reflection.
*
* Cleans up comment tags related to signatures like `@param` or `@returns`
* and moves their data to the corresponding parameter reflections.
*
* This hook also copies over the comment of function implementations to their
* signatures.
*
* @param context The context object describing the current state the converter is in.
* @param reflection The reflection that is currently resolved.
*/
onResolve(context, reflection) {
if (reflection.comment) {
if (reflection.comment.label &&
!/[A-Z_][A-Z0-9_]/.test(reflection.comment.label)) {
context.logger.warn(`The label "${reflection.comment.label}" for ${reflection.getFriendlyFullName()} cannot be referenced with a declaration reference. ` +
`Labels may only contain A-Z, 0-9, and _, and may not start with a number.`);
}
mergeSeeTags(reflection.comment);
movePropertyTags(reflection.comment, reflection);
}
if (!(reflection instanceof models_1.DeclarationReflection)) {
return;
}
if (reflection.type instanceof models_1.ReflectionType) {
this.moveCommentToSignatures(reflection, reflection.type.declaration.getNonIndexSignatures());
}
else {
this.moveCommentToSignatures(reflection, reflection.getNonIndexSignatures());
}
}
moveCommentToSignatures(reflection, signatures) {
if (!signatures.length) {
return;
}
const comment = reflection.kindOf(models_1.ReflectionKind.ClassOrInterface)
? undefined
: reflection.comment;
// Since this reflection has signatures, remove the comment from the parent
// reflection. This is important so that in type aliases we don't end up with
// a comment rendered twice.
if (!reflection.kindOf(models_1.ReflectionKind.ClassOrInterface)) {
delete reflection.comment;
}
for (const signature of signatures) {
const childComment = (signature.comment || (signature.comment = comment?.clone()));
if (!childComment)
continue;
signature.parameters?.forEach((parameter, index) => {
if (parameter.name === "__namedParameters") {
const commentParams = childComment.blockTags.filter((tag) => tag.tag === "@param" && !tag.name?.includes("."));
if (signature.parameters?.length === commentParams.length &&
commentParams[index].name) {
parameter.name = commentParams[index].name;
/**
* Triggered when the converter begins resolving a project.
*
* @param context The context object describing the current state the converter is in.
*/
onBeginResolve(context) {
const project = context.project;
const reflections = Object.values(project.reflections);
// Remove hidden reflections
const hidden = new Set();
for (const ref of reflections) {
if (ref.kindOf(models_1.ReflectionKind.Accessor) && ref.flags.isReadonly) {
const decl = ref;
if (decl.setSignature) {
hidden.add(decl.setSignature);
}
// Clear flag set by @readonly since it shouldn't be rendered.
ref.setFlag(models_1.ReflectionFlag.Readonly, false);
}
moveNestedParamTags(childComment, parameter);
const tag = childComment.getIdentifiedTag(parameter.name, "@param");
if (tag) {
parameter.comment = new models_1.Comment(models_1.Comment.cloneDisplayParts(tag.content));
if (this.isHidden(ref)) {
hidden.add(ref);
}
}
hidden.forEach((reflection) => project.removeReflection(reflection));
// remove functions with empty signatures after their signatures have been removed
const [allRemoved, someRemoved] = (0, utils_1.partition)((0, utils_1.unique)((0, utils_1.filterMap)(hidden, (reflection) => reflection.parent?.kindOf(models_1.ReflectionKind.SignatureContainer)
? reflection.parent
: void 0)), (method) => method.getNonIndexSignatures().length === 0);
allRemoved.forEach((reflection) => {
project.removeReflection(reflection);
});
for (const parameter of signature.typeParameters || []) {
const tag = childComment.getIdentifiedTag(parameter.name, "@typeParam") ||
childComment.getIdentifiedTag(parameter.name, "@template") ||
childComment.getIdentifiedTag(`<${parameter.name}>`, "@param");
if (tag) {
parameter.comment = new models_1.Comment(models_1.Comment.cloneDisplayParts(tag.content));
someRemoved.forEach((reflection) => {
reflection.sources = reflection
.getNonIndexSignatures()
.flatMap((s) => s.sources ?? []);
});
}
/**
* Triggered when the converter resolves a reflection.
*
* Cleans up comment tags related to signatures like `@param` or `@returns`
* and moves their data to the corresponding parameter reflections.
*
* This hook also copies over the comment of function implementations to their
* signatures.
*
* @param context The context object describing the current state the converter is in.
* @param reflection The reflection that is currently resolved.
*/
onResolve(context, reflection) {
if (reflection.comment) {
if (reflection.comment.label &&
!/[A-Z_][A-Z0-9_]/.test(reflection.comment.label)) {
context.logger.warn(`The label "${reflection.comment.label}" for ${reflection.getFriendlyFullName()} cannot be referenced with a declaration reference. ` +
`Labels may only contain A-Z, 0-9, and _, and may not start with a number.`);
}
mergeSeeTags(reflection.comment);
movePropertyTags(reflection.comment, reflection);
}
childComment?.removeTags("@param");
childComment?.removeTags("@typeParam");
childComment?.removeTags("@template");
if (!(reflection instanceof models_1.DeclarationReflection)) {
return;
}
if (reflection.type instanceof models_1.ReflectionType) {
this.moveCommentToSignatures(reflection, reflection.type.declaration.getNonIndexSignatures());
}
else {
this.moveCommentToSignatures(reflection, reflection.getNonIndexSignatures());
}
}
}
removeExcludedTags(comment) {
for (const tag of NEVER_RENDERED) {
comment.removeTags(tag);
comment.removeModifier(tag);
moveCommentToSignatures(reflection, signatures) {
if (!signatures.length) {
return;
}
const comment = reflection.kindOf(models_1.ReflectionKind.ClassOrInterface)
? undefined
: reflection.comment;
// Since this reflection has signatures, remove the comment from the parent
// reflection. This is important so that in type aliases we don't end up with
// a comment rendered twice.
if (!reflection.kindOf(models_1.ReflectionKind.ClassOrInterface)) {
delete reflection.comment;
}
for (const signature of signatures) {
const childComment = (signature.comment ||= comment?.clone());
if (!childComment)
continue;
signature.parameters?.forEach((parameter, index) => {
if (parameter.name === "__namedParameters") {
const commentParams = childComment.blockTags.filter((tag) => tag.tag === "@param" && !tag.name?.includes("."));
if (signature.parameters?.length === commentParams.length &&
commentParams[index].name) {
parameter.name = commentParams[index].name;
}
}
moveNestedParamTags(childComment, parameter);
const tag = childComment.getIdentifiedTag(parameter.name, "@param");
if (tag) {
parameter.comment = new models_1.Comment(models_1.Comment.cloneDisplayParts(tag.content));
}
});
for (const parameter of signature.typeParameters || []) {
const tag = childComment.getIdentifiedTag(parameter.name, "@typeParam") ||
childComment.getIdentifiedTag(parameter.name, "@template") ||
childComment.getIdentifiedTag(`<${parameter.name}>`, "@param");
if (tag) {
parameter.comment = new models_1.Comment(models_1.Comment.cloneDisplayParts(tag.content));
}
}
childComment?.removeTags("@param");
childComment?.removeTags("@typeParam");
childComment?.removeTags("@template");
}
}
for (const tag of this.excludeTags) {
comment.removeTags(tag);
comment.removeModifier(tag);
removeExcludedTags(comment) {
for (const tag of NEVER_RENDERED) {
comment.removeTags(tag);
comment.removeModifier(tag);
}
for (const tag of this.excludeTags) {
comment.removeTags(tag);
comment.removeModifier(tag);
}
}
}
/**
* Determines whether or not a reflection has been hidden
*
* @param reflection Reflection to check if hidden
*/
isHidden(reflection) {
const comment = reflection.comment;
if (reflection.flags.hasFlag(models_1.ReflectionFlag.Private) &&
this.excludePrivate) {
return true;
}
if (reflection.flags.hasFlag(models_1.ReflectionFlag.Protected) &&
this.excludeProtected) {
return true;
}
if (!comment) {
// We haven't moved comments from the parent for signatures without a direct
// comment, so don't exclude those due to not being documented.
if (reflection.kindOf(models_1.ReflectionKind.CallSignature |
models_1.ReflectionKind.ConstructorSignature) &&
reflection.parent?.comment) {
return false;
/**
* Determines whether or not a reflection has been hidden
*
* @param reflection Reflection to check if hidden
*/
isHidden(reflection) {
const comment = reflection.comment;
if (reflection.flags.hasFlag(models_1.ReflectionFlag.Private) &&
this.excludePrivate) {
return true;
}
if (this.excludeNotDocumented) {
// Don't let excludeNotDocumented remove parameters.
if (!(reflection instanceof models_1.DeclarationReflection) &&
!(reflection instanceof models_1.SignatureReflection)) {
if (reflection.flags.hasFlag(models_1.ReflectionFlag.Protected) &&
this.excludeProtected) {
return true;
}
if (this.excludedByCategory(reflection)) {
return true;
}
if (!comment) {
// We haven't moved comments from the parent for signatures without a direct
// comment, so don't exclude those due to not being documented.
if (reflection.kindOf(models_1.ReflectionKind.CallSignature |
models_1.ReflectionKind.ConstructorSignature) &&
reflection.parent?.comment) {
return false;
}
if (!reflection.kindOf(this.excludeNotDocumentedKinds)) {
return false;
}
// excludeNotDocumented should hide a module only if it has no visible children
if (reflection.kindOf(models_1.ReflectionKind.SomeModule)) {
if (!reflection.children) {
return true;
if (this.excludeNotDocumented) {
// Don't let excludeNotDocumented remove parameters.
if (!(reflection instanceof models_1.DeclarationReflection) &&
!(reflection instanceof models_1.SignatureReflection)) {
return false;
}
return reflection.children.every((child) => this.isHidden(child));
if (!reflection.kindOf(this.excludeNotDocumentedKinds)) {
return false;
}
// excludeNotDocumented should hide a module only if it has no visible children
if (reflection.kindOf(models_1.ReflectionKind.SomeModule)) {
if (!reflection.children) {
return true;
}
return reflection.children.every((child) => this.isHidden(child));
}
// signature containers should only be hidden if all their signatures are hidden
if (reflection.kindOf(models_1.ReflectionKind.SignatureContainer)) {
return reflection
.getAllSignatures()
.every((child) => this.isHidden(child));
}
// excludeNotDocumented should never hide parts of "type" reflections
return inTypeLiteral(reflection) === false;
}
// signature containers should only be hidden if all their signatures are hidden
if (reflection.kindOf(models_1.ReflectionKind.SignatureContainer)) {
return reflection
.getAllSignatures()
.every((child) => this.isHidden(child));
}
// excludeNotDocumented should never hide parts of "type" reflections
return inTypeLiteral(reflection) === false;
return false;
}
return false;
const isHidden = comment.hasModifier("@hidden") ||
comment.hasModifier("@ignore") ||
(comment.hasModifier("@internal") && this.excludeInternal);
if (isHidden &&
reflection.kindOf(models_1.ReflectionKind.ContainsCallSignatures)) {
return reflection
.getNonIndexSignatures()
.every((sig) => {
return !sig.comment || this.isHidden(sig);
});
}
return isHidden;
}
const isHidden = comment.hasModifier("@hidden") ||
comment.hasModifier("@ignore") ||
(comment.hasModifier("@internal") && this.excludeInternal);
if (isHidden &&
reflection.kindOf(models_1.ReflectionKind.ContainsCallSignatures)) {
return reflection
.getNonIndexSignatures()
.every((sig) => {
return !sig.comment || this.isHidden(sig);
});
excludedByCategory(reflection) {
const excludeCategories = this.excludeCategories;
let target;
if (reflection instanceof models_1.DeclarationReflection) {
target = reflection;
}
else if (reflection instanceof models_1.SignatureReflection) {
target = reflection.parent;
}
if (!target || !excludeCategories.length)
return false;
const categories = CategoryPlugin_1.CategoryPlugin.getCategories(target);
if (categories.size === 0) {
categories.add(this.defaultCategory);
}
return excludeCategories.some((cat) => categories.has(cat));
}
return isHidden;
}
};
};
_CommentPlugin_excludeTags_accessor_storage = new WeakMap();
_CommentPlugin_excludeInternal_accessor_storage = new WeakMap();
_CommentPlugin_excludePrivate_accessor_storage = new WeakMap();
_CommentPlugin_excludeProtected_accessor_storage = new WeakMap();
_CommentPlugin_excludeNotDocumented_accessor_storage = new WeakMap();
_CommentPlugin_excludeCategories_accessor_storage = new WeakMap();
_CommentPlugin_defaultCategory_accessor_storage = new WeakMap();
__setFunctionName(_classThis, "CommentPlugin");
(() => {
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
_excludeTags_decorators = [(0, utils_1.Option)("excludeTags")];
_excludeInternal_decorators = [(0, utils_1.Option)("excludeInternal")];
_excludePrivate_decorators = [(0, utils_1.Option)("excludePrivate")];
_excludeProtected_decorators = [(0, utils_1.Option)("excludeProtected")];
_excludeNotDocumented_decorators = [(0, utils_1.Option)("excludeNotDocumented")];
_excludeCategories_decorators = [(0, utils_1.Option)("excludeCategories")];
_defaultCategory_decorators = [(0, utils_1.Option)("defaultCategory")];
__esDecorate(_classThis, null, _excludeTags_decorators, { kind: "accessor", name: "excludeTags", static: false, private: false, access: { has: obj => "excludeTags" in obj, get: obj => obj.excludeTags, set: (obj, value) => { obj.excludeTags = value; } }, metadata: _metadata }, _excludeTags_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _excludeInternal_decorators, { kind: "accessor", name: "excludeInternal", static: false, private: false, access: { has: obj => "excludeInternal" in obj, get: obj => obj.excludeInternal, set: (obj, value) => { obj.excludeInternal = value; } }, metadata: _metadata }, _excludeInternal_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, 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, _instanceExtraInitializers);
__esDecorate(_classThis, 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, _instanceExtraInitializers);
__esDecorate(_classThis, 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, _instanceExtraInitializers);
__esDecorate(_classThis, null, _excludeCategories_decorators, { kind: "accessor", name: "excludeCategories", static: false, private: false, access: { has: obj => "excludeCategories" in obj, get: obj => obj.excludeCategories, set: (obj, value) => { obj.excludeCategories = value; } }, metadata: _metadata }, _excludeCategories_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _defaultCategory_decorators, { kind: "accessor", name: "defaultCategory", static: false, private: false, access: { has: obj => "defaultCategory" in obj, get: obj => obj.defaultCategory, set: (obj, value) => { obj.defaultCategory = value; } }, metadata: _metadata }, _defaultCategory_initializers, _instanceExtraInitializers);
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
CommentPlugin = _classThis = _classDescriptor.value;
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
__runInitializers(_classThis, _classExtraInitializers);
})();
return CommentPlugin = _classThis;
})();
exports.CommentPlugin = CommentPlugin;
__decorate([
(0, utils_1.BindOption)("excludeTags")
], CommentPlugin.prototype, "excludeTags", void 0);
__decorate([
(0, utils_1.BindOption)("excludeInternal")
], CommentPlugin.prototype, "excludeInternal", void 0);
__decorate([
(0, utils_1.BindOption)("excludePrivate")
], CommentPlugin.prototype, "excludePrivate", void 0);
__decorate([
(0, utils_1.BindOption)("excludeProtected")
], CommentPlugin.prototype, "excludeProtected", void 0);
__decorate([
(0, utils_1.BindOption)("excludeNotDocumented")
], CommentPlugin.prototype, "excludeNotDocumented", void 0);
exports.CommentPlugin = CommentPlugin = __decorate([
(0, components_1.Component)({ name: "comment" })
], CommentPlugin);
function inTypeLiteral(refl) {

@@ -471,2 +594,7 @@ while (refl) {

child.comment = new models_1.Comment(models_1.Comment.cloneDisplayParts(prop.content));
if (child instanceof models_1.DeclarationReflection && child.signatures) {
for (const sig of child.signatures) {
sig.comment = new models_1.Comment(models_1.Comment.cloneDisplayParts(prop.content));
}
}
}

@@ -473,0 +601,0 @@ }

@@ -11,4 +11,4 @@ import { DeclarationReflection } from "../../models/reflections/index";

sortFunction: (reflections: DeclarationReflection[]) => void;
boosts: Record<string, number>;
groupOrder: string[];
accessor boosts: Record<string, number>;
accessor groupOrder: string[];
usedBoosts: Set<string>;

@@ -38,3 +38,3 @@ static WEIGHTS: string[];

* @privateRemarks
* If you change this, also update getCategories in CategoryPlugin accordingly.
* If you change this, also update extractCategories in CategoryPlugin accordingly.
*/

@@ -41,0 +41,0 @@ getGroups(reflection: DeclarationReflection): Set<string>;

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
var GroupPlugin_1;
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -23,155 +65,183 @@ exports.GroupPlugin = void 0;

*/
let GroupPlugin = GroupPlugin_1 = class GroupPlugin extends components_1.ConverterComponent {
constructor() {
super(...arguments);
this.usedBoosts = new Set();
}
/**
* Create a new GroupPlugin instance.
*/
initialize() {
this.listenTo(this.owner, {
[converter_1.Converter.EVENT_RESOLVE_BEGIN]: () => {
this.sortFunction = (0, sort_1.getSortFunction)(this.application.options);
GroupPlugin_1.WEIGHTS = this.groupOrder;
},
[converter_1.Converter.EVENT_RESOLVE]: this.onResolve,
[converter_1.Converter.EVENT_RESOLVE_END]: this.onEndResolve,
});
}
/**
* Triggered when the converter resolves a reflection.
*
* @param context The context object describing the current state the converter is in.
* @param reflection The reflection that is currently resolved.
*/
onResolve(_context, reflection) {
if (reflection instanceof index_1.ContainerReflection) {
this.group(reflection);
let GroupPlugin = (() => {
var _GroupPlugin_boosts_accessor_storage, _GroupPlugin_groupOrder_accessor_storage;
let _classDecorators = [(0, components_1.Component)({ name: "group" })];
let _classDescriptor;
let _classExtraInitializers = [];
let _classThis;
let _classSuper = components_1.ConverterComponent;
let _instanceExtraInitializers = [];
let _boosts_decorators;
let _boosts_initializers = [];
let _groupOrder_decorators;
let _groupOrder_initializers = [];
var GroupPlugin = _classThis = class extends _classSuper {
constructor() {
super(...arguments);
this.sortFunction = (__runInitializers(this, _instanceExtraInitializers), void 0);
_GroupPlugin_boosts_accessor_storage.set(this, __runInitializers(this, _boosts_initializers, void 0));
_GroupPlugin_groupOrder_accessor_storage.set(this, __runInitializers(this, _groupOrder_initializers, void 0));
this.usedBoosts = new Set();
}
}
/**
* Triggered when the converter has finished resolving a project.
*
* @param context The context object describing the current state the converter is in.
*/
onEndResolve(context) {
this.group(context.project);
const unusedBoosts = new Set(Object.keys(this.boosts));
for (const boost of this.usedBoosts) {
unusedBoosts.delete(boost);
}
this.usedBoosts.clear();
if (unusedBoosts.size &&
this.application.options.isSet("searchGroupBoosts")) {
context.logger.warn(`Not all groups specified in searchGroupBoosts were used in the documentation.` +
` The unused groups were:\n\t${Array.from(unusedBoosts).join("\n\t")}`);
}
}
group(reflection) {
if (reflection.children &&
reflection.children.length > 0 &&
!reflection.groups) {
this.sortFunction(reflection.children);
reflection.groups = this.getReflectionGroups(reflection.children);
}
}
/**
* Extracts the groups for a given reflection.
*
* @privateRemarks
* If you change this, also update getCategories in CategoryPlugin accordingly.
*/
getGroups(reflection) {
const groups = new Set();
function extractGroupTags(comment) {
if (!comment)
return;
(0, utils_1.removeIf)(comment.blockTags, (tag) => {
if (tag.tag === "@group") {
groups.add(models_1.Comment.combineDisplayParts(tag.content).trim());
return true;
}
return false;
get boosts() { return __classPrivateFieldGet(this, _GroupPlugin_boosts_accessor_storage, "f"); }
set boosts(value) { __classPrivateFieldSet(this, _GroupPlugin_boosts_accessor_storage, value, "f"); }
get groupOrder() { return __classPrivateFieldGet(this, _GroupPlugin_groupOrder_accessor_storage, "f"); }
set groupOrder(value) { __classPrivateFieldSet(this, _GroupPlugin_groupOrder_accessor_storage, value, "f"); }
/**
* Create a new GroupPlugin instance.
*/
initialize() {
this.listenTo(this.owner, {
[converter_1.Converter.EVENT_RESOLVE_BEGIN]: () => {
this.sortFunction = (0, sort_1.getSortFunction)(this.application.options);
GroupPlugin.WEIGHTS = this.groupOrder;
},
[converter_1.Converter.EVENT_RESOLVE]: this.onResolve,
[converter_1.Converter.EVENT_RESOLVE_END]: this.onEndResolve,
});
}
extractGroupTags(reflection.comment);
for (const sig of reflection.getNonIndexSignatures()) {
extractGroupTags(sig.comment);
/**
* Triggered when the converter resolves a reflection.
*
* @param context The context object describing the current state the converter is in.
* @param reflection The reflection that is currently resolved.
*/
onResolve(_context, reflection) {
if (reflection instanceof index_1.ContainerReflection) {
this.group(reflection);
}
}
if (reflection.type?.type === "reflection") {
extractGroupTags(reflection.type.declaration.comment);
for (const sig of reflection.type.declaration.getNonIndexSignatures()) {
extractGroupTags(sig.comment);
/**
* Triggered when the converter has finished resolving a project.
*
* @param context The context object describing the current state the converter is in.
*/
onEndResolve(context) {
this.group(context.project);
const unusedBoosts = new Set(Object.keys(this.boosts));
for (const boost of this.usedBoosts) {
unusedBoosts.delete(boost);
}
this.usedBoosts.clear();
if (unusedBoosts.size &&
this.application.options.isSet("searchGroupBoosts")) {
context.logger.warn(`Not all groups specified in searchGroupBoosts were used in the documentation.` +
` The unused groups were:\n\t${Array.from(unusedBoosts).join("\n\t")}`);
}
}
groups.delete("");
if (groups.size === 0) {
groups.add(index_1.ReflectionKind.pluralString(reflection.kind));
group(reflection) {
if (reflection.children &&
reflection.children.length > 0 &&
!reflection.groups) {
this.sortFunction(reflection.children);
reflection.groups = this.getReflectionGroups(reflection.children);
}
}
for (const group of groups) {
if (group in this.boosts) {
this.usedBoosts.add(group);
reflection.relevanceBoost =
(reflection.relevanceBoost ?? 1) * this.boosts[group];
/**
* Extracts the groups for a given reflection.
*
* @privateRemarks
* If you change this, also update extractCategories in CategoryPlugin accordingly.
*/
getGroups(reflection) {
const groups = new Set();
function extractGroupTags(comment) {
if (!comment)
return;
(0, utils_1.removeIf)(comment.blockTags, (tag) => {
if (tag.tag === "@group") {
groups.add(models_1.Comment.combineDisplayParts(tag.content).trim());
return true;
}
return false;
});
}
}
return groups;
}
/**
* Create a grouped representation of the given list of reflections.
*
* Reflections are grouped by kind and sorted by weight and name.
*
* @param reflections The reflections that should be grouped.
* @returns An array containing all children of the given reflection grouped by their kind.
*/
getReflectionGroups(reflections) {
const groups = new Map();
reflections.forEach((child) => {
for (const name of this.getGroups(child)) {
let group = groups.get(name);
if (!group) {
group = new ReflectionGroup_1.ReflectionGroup(name, child);
groups.set(name, group);
extractGroupTags(reflection.comment);
for (const sig of reflection.getNonIndexSignatures()) {
extractGroupTags(sig.comment);
}
if (reflection.type?.type === "reflection") {
extractGroupTags(reflection.type.declaration.comment);
for (const sig of reflection.type.declaration.getNonIndexSignatures()) {
extractGroupTags(sig.comment);
}
group.children.push(child);
}
});
return Array.from(groups.values()).sort(GroupPlugin_1.sortGroupCallback);
}
/**
* Callback used to sort groups by name.
*/
static sortGroupCallback(a, b) {
let aWeight = GroupPlugin_1.WEIGHTS.indexOf(a.title);
let bWeight = GroupPlugin_1.WEIGHTS.indexOf(b.title);
if (aWeight === -1 || bWeight === -1) {
let asteriskIndex = GroupPlugin_1.WEIGHTS.indexOf("*");
if (asteriskIndex === -1) {
asteriskIndex = GroupPlugin_1.WEIGHTS.length;
groups.delete("");
if (groups.size === 0) {
groups.add(index_1.ReflectionKind.pluralString(reflection.kind));
}
if (aWeight === -1) {
aWeight = asteriskIndex;
for (const group of groups) {
if (group in this.boosts) {
this.usedBoosts.add(group);
reflection.relevanceBoost =
(reflection.relevanceBoost ?? 1) * this.boosts[group];
}
}
if (bWeight === -1) {
bWeight = asteriskIndex;
return groups;
}
/**
* Create a grouped representation of the given list of reflections.
*
* Reflections are grouped by kind and sorted by weight and name.
*
* @param reflections The reflections that should be grouped.
* @returns An array containing all children of the given reflection grouped by their kind.
*/
getReflectionGroups(reflections) {
const groups = new Map();
reflections.forEach((child) => {
for (const name of this.getGroups(child)) {
let group = groups.get(name);
if (!group) {
group = new ReflectionGroup_1.ReflectionGroup(name, child);
groups.set(name, group);
}
group.children.push(child);
}
});
return Array.from(groups.values()).sort(GroupPlugin.sortGroupCallback);
}
/**
* Callback used to sort groups by name.
*/
static sortGroupCallback(a, b) {
let aWeight = GroupPlugin.WEIGHTS.indexOf(a.title);
let bWeight = GroupPlugin.WEIGHTS.indexOf(b.title);
if (aWeight === -1 || bWeight === -1) {
let asteriskIndex = GroupPlugin.WEIGHTS.indexOf("*");
if (asteriskIndex === -1) {
asteriskIndex = GroupPlugin.WEIGHTS.length;
}
if (aWeight === -1) {
aWeight = asteriskIndex;
}
if (bWeight === -1) {
bWeight = asteriskIndex;
}
}
if (aWeight === bWeight) {
return a.title > b.title ? 1 : -1;
}
return aWeight - bWeight;
}
if (aWeight === bWeight) {
return a.title > b.title ? 1 : -1;
}
return aWeight - bWeight;
}
};
};
_GroupPlugin_boosts_accessor_storage = new WeakMap();
_GroupPlugin_groupOrder_accessor_storage = new WeakMap();
__setFunctionName(_classThis, "GroupPlugin");
(() => {
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
_boosts_decorators = [(0, utils_1.Option)("searchGroupBoosts")];
_groupOrder_decorators = [(0, utils_1.Option)("groupOrder")];
__esDecorate(_classThis, null, _boosts_decorators, { kind: "accessor", name: "boosts", static: false, private: false, access: { has: obj => "boosts" in obj, get: obj => obj.boosts, set: (obj, value) => { obj.boosts = value; } }, metadata: _metadata }, _boosts_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _groupOrder_decorators, { kind: "accessor", name: "groupOrder", static: false, private: false, access: { has: obj => "groupOrder" in obj, get: obj => obj.groupOrder, set: (obj, value) => { obj.groupOrder = value; } }, metadata: _metadata }, _groupOrder_initializers, _instanceExtraInitializers);
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
GroupPlugin = _classThis = _classDescriptor.value;
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
})();
_classThis.WEIGHTS = [];
(() => {
__runInitializers(_classThis, _classExtraInitializers);
})();
return GroupPlugin = _classThis;
})();
exports.GroupPlugin = GroupPlugin;
GroupPlugin.WEIGHTS = [];
__decorate([
(0, utils_1.BindOption)("searchGroupBoosts")
], GroupPlugin.prototype, "boosts", void 0);
__decorate([
(0, utils_1.BindOption)("groupOrder")
], GroupPlugin.prototype, "groupOrder", void 0);
exports.GroupPlugin = GroupPlugin = GroupPlugin_1 = __decorate([
(0, components_1.Component)({ name: "group" })
], GroupPlugin);
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -25,200 +57,207 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

*/
let ImplementsPlugin = class ImplementsPlugin extends components_1.ConverterComponent {
constructor() {
super(...arguments);
this.resolved = new WeakSet();
this.postponed = new WeakMap();
}
/**
* Create a new ImplementsPlugin instance.
*/
initialize() {
this.listenTo(this.owner, converter_1.Converter.EVENT_RESOLVE_END, this.onResolveEnd);
this.listenTo(this.owner, converter_1.Converter.EVENT_CREATE_DECLARATION, this.onDeclaration, -1000);
this.listenTo(this.owner, converter_1.Converter.EVENT_CREATE_SIGNATURE, this.onSignature, 1000);
this.listenTo(this.application, application_events_1.ApplicationEvents.REVIVE, this.resolve);
}
/**
* Mark all members of the given class to be the implementation of the matching interface member.
*/
analyzeImplements(project, classReflection, interfaceReflection) {
handleInheritedComments(classReflection, interfaceReflection);
if (!interfaceReflection.children) {
return;
let ImplementsPlugin = (() => {
let _classDecorators = [(0, components_1.Component)({ name: "implements" })];
let _classDescriptor;
let _classExtraInitializers = [];
let _classThis;
let _classSuper = components_1.ConverterComponent;
var ImplementsPlugin = _classThis = class extends _classSuper {
constructor() {
super(...arguments);
this.resolved = new WeakSet();
this.postponed = new WeakMap();
}
interfaceReflection.children.forEach((interfaceMember) => {
const classMember = findMatchingMember(interfaceMember, classReflection);
if (!classMember) {
/**
* Create a new ImplementsPlugin instance.
*/
initialize() {
this.listenTo(this.owner, converter_1.Converter.EVENT_RESOLVE_END, this.onResolveEnd);
this.listenTo(this.owner, converter_1.Converter.EVENT_CREATE_DECLARATION, this.onDeclaration, -1000);
this.listenTo(this.owner, converter_1.Converter.EVENT_CREATE_SIGNATURE, this.onSignature, 1000);
this.listenTo(this.application, application_events_1.ApplicationEvents.REVIVE, this.resolve);
}
/**
* Mark all members of the given class to be the implementation of the matching interface member.
*/
analyzeImplements(project, classReflection, interfaceReflection) {
handleInheritedComments(classReflection, interfaceReflection);
if (!interfaceReflection.children) {
return;
}
const interfaceMemberName = interfaceReflection.name + "." + interfaceMember.name;
classMember.implementationOf =
types_1.ReferenceType.createResolvedReference(interfaceMemberName, interfaceMember, project);
const intSigs = interfaceMember.signatures ||
interfaceMember.type?.visit({
reflection: (r) => r.declaration.signatures,
});
const clsSigs = classMember.signatures ||
classMember.type?.visit({
reflection: (r) => r.declaration.signatures,
});
if (intSigs && clsSigs) {
for (const [clsSig, intSig] of (0, array_1.zip)(clsSigs, intSigs)) {
if (clsSig.implementationOf) {
const target = intSig.parent.kindOf(index_1.ReflectionKind.FunctionOrMethod)
? intSig
: intSig.parent.parent;
clsSig.implementationOf =
types_1.ReferenceType.createResolvedReference(clsSig.implementationOf.name, target, project);
interfaceReflection.children.forEach((interfaceMember) => {
const classMember = findMatchingMember(interfaceMember, classReflection);
if (!classMember) {
return;
}
const interfaceMemberName = interfaceReflection.name + "." + interfaceMember.name;
classMember.implementationOf =
types_1.ReferenceType.createResolvedReference(interfaceMemberName, interfaceMember, project);
const intSigs = interfaceMember.signatures ||
interfaceMember.type?.visit({
reflection: (r) => r.declaration.signatures,
});
const clsSigs = classMember.signatures ||
classMember.type?.visit({
reflection: (r) => r.declaration.signatures,
});
if (intSigs && clsSigs) {
for (const [clsSig, intSig] of (0, array_1.zip)(clsSigs, intSigs)) {
if (clsSig.implementationOf) {
const target = intSig.parent.kindOf(index_1.ReflectionKind.FunctionOrMethod)
? intSig
: intSig.parent.parent;
clsSig.implementationOf =
types_1.ReferenceType.createResolvedReference(clsSig.implementationOf.name, target, project);
}
}
}
}
handleInheritedComments(classMember, interfaceMember);
});
}
analyzeInheritance(project, reflection) {
const extendedTypes = (0, array_1.filterMap)(reflection.extendedTypes ?? [], (type) => {
return type instanceof types_1.ReferenceType &&
type.reflection instanceof index_1.DeclarationReflection
? type
: void 0;
});
for (const parent of extendedTypes) {
handleInheritedComments(reflection, parent.reflection);
for (const parentMember of parent.reflection.children ?? []) {
const child = findMatchingMember(parentMember, reflection);
if (child) {
const key = child.overwrites
? "overwrites"
: "inheritedFrom";
for (const [childSig, parentSig] of (0, array_1.zip)(child.signatures ?? [], parentMember.signatures ?? [])) {
childSig[key] = types_1.ReferenceType.createResolvedReference(`${parent.name}.${parentMember.name}`, parentSig, project);
handleInheritedComments(classMember, interfaceMember);
});
}
analyzeInheritance(project, reflection) {
const extendedTypes = (0, array_1.filterMap)(reflection.extendedTypes ?? [], (type) => {
return type instanceof types_1.ReferenceType &&
type.reflection instanceof index_1.DeclarationReflection
? type
: void 0;
});
for (const parent of extendedTypes) {
handleInheritedComments(reflection, parent.reflection);
for (const parentMember of parent.reflection.children ?? []) {
const child = findMatchingMember(parentMember, reflection);
if (child) {
const key = child.overwrites
? "overwrites"
: "inheritedFrom";
for (const [childSig, parentSig] of (0, array_1.zip)(child.signatures ?? [], parentMember.signatures ?? [])) {
childSig[key] = types_1.ReferenceType.createResolvedReference(`${parent.name}.${parentMember.name}`, parentSig, project);
}
child[key] = types_1.ReferenceType.createResolvedReference(`${parent.name}.${parentMember.name}`, parentMember, project);
handleInheritedComments(child, parentMember);
}
child[key] = types_1.ReferenceType.createResolvedReference(`${parent.name}.${parentMember.name}`, parentMember, project);
handleInheritedComments(child, parentMember);
}
}
}
}
onResolveEnd(context) {
this.resolve(context.project);
}
resolve(project) {
for (const id in project.reflections) {
const refl = project.reflections[id];
if (refl instanceof index_1.DeclarationReflection) {
this.tryResolve(project, refl);
}
onResolveEnd(context) {
this.resolve(context.project);
}
}
tryResolve(project, reflection) {
const requirements = (0, array_1.filterMap)([
...(reflection.implementedTypes ?? []),
...(reflection.extendedTypes ?? []),
], (type) => {
return type instanceof types_1.ReferenceType ? type.reflection : void 0;
});
if (requirements.every((req) => this.resolved.has(req))) {
this.doResolve(project, reflection);
this.resolved.add(reflection);
for (const refl of this.postponed.get(reflection) ?? []) {
this.tryResolve(project, refl);
resolve(project) {
for (const id in project.reflections) {
const refl = project.reflections[id];
if (refl instanceof index_1.DeclarationReflection) {
this.tryResolve(project, refl);
}
}
this.postponed.delete(reflection);
}
else {
for (const req of requirements) {
const future = this.postponed.get(req) ?? new Set();
future.add(reflection);
this.postponed.set(req, future);
tryResolve(project, reflection) {
const requirements = (0, array_1.filterMap)([
...(reflection.implementedTypes ?? []),
...(reflection.extendedTypes ?? []),
], (type) => {
return type instanceof types_1.ReferenceType ? type.reflection : void 0;
});
if (requirements.every((req) => this.resolved.has(req))) {
this.doResolve(project, reflection);
this.resolved.add(reflection);
for (const refl of this.postponed.get(reflection) ?? []) {
this.tryResolve(project, refl);
}
this.postponed.delete(reflection);
}
}
}
doResolve(project, reflection) {
if (reflection.kindOf(index_1.ReflectionKind.Class) &&
reflection.implementedTypes) {
reflection.implementedTypes.forEach((type) => {
if (!(type instanceof types_1.ReferenceType)) {
return;
else {
for (const req of requirements) {
const future = this.postponed.get(req) ?? new Set();
future.add(reflection);
this.postponed.set(req, future);
}
if (type.reflection &&
type.reflection.kindOf(index_1.ReflectionKind.ClassOrInterface)) {
this.analyzeImplements(project, reflection, type.reflection);
}
});
}
}
if (reflection.kindOf(index_1.ReflectionKind.ClassOrInterface) &&
reflection.extendedTypes) {
this.analyzeInheritance(project, reflection);
doResolve(project, reflection) {
if (reflection.kindOf(index_1.ReflectionKind.Class) &&
reflection.implementedTypes) {
reflection.implementedTypes.forEach((type) => {
if (!(type instanceof types_1.ReferenceType)) {
return;
}
if (type.reflection &&
type.reflection.kindOf(index_1.ReflectionKind.ClassOrInterface)) {
this.analyzeImplements(project, reflection, type.reflection);
}
});
}
if (reflection.kindOf(index_1.ReflectionKind.ClassOrInterface) &&
reflection.extendedTypes) {
this.analyzeInheritance(project, reflection);
}
}
}
getExtensionInfo(context, reflection) {
if (!reflection || !reflection.kindOf(index_1.ReflectionKind.Inheritable)) {
return;
getExtensionInfo(context, reflection) {
if (!reflection || !reflection.kindOf(index_1.ReflectionKind.Inheritable)) {
return;
}
// Need this because we re-use reflections for type literals.
if (!reflection.parent?.kindOf(index_1.ReflectionKind.ClassOrInterface)) {
return;
}
const symbol = context.project.getSymbolFromReflection(reflection.parent);
if (!symbol) {
return;
}
const declaration = symbol
.getDeclarations()
?.find((n) => typescript_1.default.isClassDeclaration(n) || typescript_1.default.isInterfaceDeclaration(n));
if (!declaration) {
return;
}
return { symbol, declaration };
}
// Need this because we re-use reflections for type literals.
if (!reflection.parent?.kindOf(index_1.ReflectionKind.ClassOrInterface)) {
return;
onSignature(context, reflection) {
this.onDeclaration(context, reflection.parent);
}
const symbol = context.project.getSymbolFromReflection(reflection.parent);
if (!symbol) {
return;
}
const declaration = symbol
.getDeclarations()
?.find((n) => typescript_1.default.isClassDeclaration(n) || typescript_1.default.isInterfaceDeclaration(n));
if (!declaration) {
return;
}
return { symbol, declaration };
}
onSignature(context, reflection) {
this.onDeclaration(context, reflection.parent);
}
/**
* Responsible for setting the {@link DeclarationReflection.inheritedFrom},
* {@link DeclarationReflection.overwrites}, and {@link DeclarationReflection.implementationOf}
* properties on the provided reflection temporarily, these links will be replaced
* during the resolve step with links which actually point to the right place.
*/
onDeclaration(context, reflection) {
const info = this.getExtensionInfo(context, reflection);
if (!info) {
return;
}
if (reflection.kind === index_1.ReflectionKind.Constructor) {
const ctor = info.declaration.members.find(typescript_1.default.isConstructorDeclaration);
constructorInheritance(context, reflection, info.declaration, ctor);
return;
}
const childType = reflection.flags.isStatic
? context.checker.getTypeOfSymbolAtLocation(info.symbol, info.declaration)
: context.checker.getDeclaredTypeOfSymbol(info.symbol);
const property = findProperty(reflection, childType);
if (!property) {
// We're probably broken... but I don't think this should be fatal.
context.logger.warn(`Failed to retrieve${reflection.flags.isStatic ? " static" : ""} member "${reflection.escapedName ?? reflection.name}" of "${reflection.parent
?.name}" for inheritance analysis. Please report a bug.`);
return;
}
// Need to check both extends and implements clauses.
out: for (const clause of info.declaration.heritageClauses ?? []) {
// No point checking implemented types for static members, they won't exist.
if (reflection.flags.isStatic &&
clause.token === typescript_1.default.SyntaxKind.ImplementsKeyword) {
continue;
/**
* Responsible for setting the {@link DeclarationReflection.inheritedFrom},
* {@link DeclarationReflection.overwrites}, and {@link DeclarationReflection.implementationOf}
* properties on the provided reflection temporarily, these links will be replaced
* during the resolve step with links which actually point to the right place.
*/
onDeclaration(context, reflection) {
const info = this.getExtensionInfo(context, reflection);
if (!info) {
return;
}
for (const expr of clause.types) {
const parentType = context.checker.getTypeAtLocation(reflection.flags.isStatic ? expr.expression : expr);
const parentProperty = findProperty(reflection, parentType);
if (parentProperty) {
const isInherit = property
.getDeclarations()
?.some((d) => d.parent !== info.declaration) ??
true;
createLink(context, reflection, clause, expr, parentProperty, isInherit);
// Can't always break because we need to also set `implementationOf` if we
// inherit from a base class and also implement an interface.
if (clause.token === typescript_1.default.SyntaxKind.ImplementsKeyword) {
break out;
if (reflection.kind === index_1.ReflectionKind.Constructor) {
const ctor = info.declaration.members.find(typescript_1.default.isConstructorDeclaration);
constructorInheritance(context, reflection, info.declaration, ctor);
return;
}
const childType = reflection.flags.isStatic
? context.checker.getTypeOfSymbolAtLocation(info.symbol, info.declaration)
: context.checker.getDeclaredTypeOfSymbol(info.symbol);
const property = findProperty(reflection, childType);
if (!property) {
// We're probably broken... but I don't think this should be fatal.
context.logger.warn(`Failed to retrieve${reflection.flags.isStatic ? " static" : ""} member "${reflection.escapedName ?? reflection.name}" of "${reflection.parent
?.name}" for inheritance analysis. Please report a bug.`);
return;
}
// Need to check both extends and implements clauses.
out: for (const clause of info.declaration.heritageClauses ?? []) {
// No point checking implemented types for static members, they won't exist.
if (reflection.flags.isStatic &&
clause.token === typescript_1.default.SyntaxKind.ImplementsKeyword) {
continue;
}
for (const expr of clause.types) {
const parentType = context.checker.getTypeAtLocation(reflection.flags.isStatic ? expr.expression : expr);
const parentProperty = findProperty(reflection, parentType);
if (parentProperty) {
const isInherit = property
.getDeclarations()
?.some((d) => d.parent !== info.declaration) ??
true;
createLink(context, reflection, clause, expr, parentProperty, isInherit);
// Can't always break because we need to also set `implementationOf` if we
// inherit from a base class and also implement an interface.
if (clause.token === typescript_1.default.SyntaxKind.ImplementsKeyword) {
break out;
}
}

@@ -228,8 +267,14 @@ }

}
}
};
};
__setFunctionName(_classThis, "ImplementsPlugin");
(() => {
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
ImplementsPlugin = _classThis = _classDescriptor.value;
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
__runInitializers(_classThis, _classExtraInitializers);
})();
return ImplementsPlugin = _classThis;
})();
exports.ImplementsPlugin = ImplementsPlugin;
exports.ImplementsPlugin = ImplementsPlugin = __decorate([
(0, components_1.Component)({ name: "implements" })
], ImplementsPlugin);
function constructorInheritance(context, reflection, childDecl, constructorDecl) {

@@ -241,5 +286,5 @@ const extendsClause = childDecl.heritageClauses?.find((cl) => cl.token === typescript_1.default.SyntaxKind.ExtendsKeyword);

const key = constructorDecl ? "overwrites" : "inheritedFrom";
reflection[key] ?? (reflection[key] = types_1.ReferenceType.createBrokenReference(name, context.project));
reflection[key] ??= types_1.ReferenceType.createBrokenReference(name, context.project);
for (const sig of reflection.signatures ?? []) {
sig[key] ?? (sig[key] = types_1.ReferenceType.createBrokenReference(name, context.project));
sig[key] ??= types_1.ReferenceType.createBrokenReference(name, context.project);
}

@@ -270,10 +315,10 @@ }

if (clause.token === typescript_1.default.SyntaxKind.ImplementsKeyword) {
target.implementationOf ?? (target.implementationOf = types_1.ReferenceType.createBrokenReference(name, project));
target.implementationOf ??= types_1.ReferenceType.createBrokenReference(name, project);
return;
}
if (isOverwrite) {
target.inheritedFrom ?? (target.inheritedFrom = types_1.ReferenceType.createBrokenReference(name, project));
target.inheritedFrom ??= types_1.ReferenceType.createBrokenReference(name, project);
}
else {
target.overwrites ?? (target.overwrites = types_1.ReferenceType.createBrokenReference(name, project));
target.overwrites ??= types_1.ReferenceType.createBrokenReference(name, project);
}

@@ -280,0 +325,0 @@ }

@@ -17,3 +17,3 @@ import { ConverterComponent } from "../components";

export declare class InheritDocPlugin extends ConverterComponent {
validation: ValidationOptions;
accessor validation: ValidationOptions;
private dependencies;

@@ -20,0 +20,0 @@ /**

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -31,143 +74,163 @@ exports.InheritDocPlugin = void 0;

*/
let InheritDocPlugin = class InheritDocPlugin extends components_1.ConverterComponent {
constructor() {
super(...arguments);
// Key is depended on by Values
this.dependencies = new utils_1.DefaultMap(() => []);
}
/**
* Create a new InheritDocPlugin instance.
*/
initialize() {
this.owner.on(converter_1.Converter.EVENT_RESOLVE_END, (context) => this.processInheritDoc(context.project));
this.application.on(application_events_1.ApplicationEvents.REVIVE, this.processInheritDoc, this);
}
/**
* Traverse through reflection descendant to check for `inheritDoc` tag.
* If encountered, the parameter of the tag is used to determine a source reflection
* that will provide actual comment.
*/
processInheritDoc(project) {
for (const id in project.reflections) {
const reflection = project.reflections[id];
const source = extractInheritDocTagReference(reflection);
if (!source)
continue;
const declRef = (0, declarationReference_1.parseDeclarationReference)(source, 0, source.length);
if (!declRef || /\S/.test(source.substring(declRef[1]))) {
this.application.logger.warn(`Declaration reference in @inheritDoc for ${reflection.getFriendlyFullName()} was not fully parsed and may resolve incorrectly.`);
}
let sourceRefl = declRef && (0, declarationReferenceResolver_1.resolveDeclarationReference)(reflection, declRef[0]);
if (reflection instanceof models_1.SignatureReflection) {
// Assumes that if there are overloads, they are declared in the same order as the parent.
// TS doesn't check this, but if a user messes this up then they are almost
// guaranteed to run into bugs where they can't call a method on a child class
// but if they assign (without a type assertion) that child to a variable of the parent class
// then they can call the method.
if (sourceRefl instanceof models_1.DeclarationReflection) {
const index = reflection.parent
.getAllSignatures()
.indexOf(reflection);
sourceRefl =
sourceRefl.getAllSignatures()[index] || sourceRefl;
let InheritDocPlugin = (() => {
var _InheritDocPlugin_validation_accessor_storage;
let _classDecorators = [(0, components_1.Component)({ name: "inheritDoc" })];
let _classDescriptor;
let _classExtraInitializers = [];
let _classThis;
let _classSuper = components_1.ConverterComponent;
let _instanceExtraInitializers = [];
let _validation_decorators;
let _validation_initializers = [];
var InheritDocPlugin = _classThis = class extends _classSuper {
constructor() {
super(...arguments);
_InheritDocPlugin_validation_accessor_storage.set(this, (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _validation_initializers, void 0)));
// Key is depended on by Values
this.dependencies = new utils_1.DefaultMap(() => []);
}
get validation() { return __classPrivateFieldGet(this, _InheritDocPlugin_validation_accessor_storage, "f"); }
set validation(value) { __classPrivateFieldSet(this, _InheritDocPlugin_validation_accessor_storage, value, "f"); }
/**
* Create a new InheritDocPlugin instance.
*/
initialize() {
this.owner.on(converter_1.Converter.EVENT_RESOLVE_END, (context) => this.processInheritDoc(context.project));
this.application.on(application_events_1.ApplicationEvents.REVIVE, this.processInheritDoc, this);
}
/**
* Traverse through reflection descendant to check for `inheritDoc` tag.
* If encountered, the parameter of the tag is used to determine a source reflection
* that will provide actual comment.
*/
processInheritDoc(project) {
for (const id in project.reflections) {
const reflection = project.reflections[id];
const source = extractInheritDocTagReference(reflection);
if (!source)
continue;
const declRef = (0, declarationReference_1.parseDeclarationReference)(source, 0, source.length);
if (!declRef || /\S/.test(source.substring(declRef[1]))) {
this.application.logger.warn(`Declaration reference in @inheritDoc for ${reflection.getFriendlyFullName()} was not fully parsed and may resolve incorrectly.`);
}
let sourceRefl = declRef && (0, declarationReferenceResolver_1.resolveDeclarationReference)(reflection, declRef[0]);
if (reflection instanceof models_1.SignatureReflection) {
// Assumes that if there are overloads, they are declared in the same order as the parent.
// TS doesn't check this, but if a user messes this up then they are almost
// guaranteed to run into bugs where they can't call a method on a child class
// but if they assign (without a type assertion) that child to a variable of the parent class
// then they can call the method.
if (sourceRefl instanceof models_1.DeclarationReflection) {
const index = reflection.parent
.getAllSignatures()
.indexOf(reflection);
sourceRefl =
sourceRefl.getAllSignatures()[index] || sourceRefl;
}
}
if (sourceRefl instanceof models_1.DeclarationReflection &&
sourceRefl.kindOf(models_1.ReflectionKind.Accessor)) {
// Accessors, like functions, never have comments on their actual root reflection.
// If the user didn't specify whether to inherit from the getter or setter, then implicitly
// try to inherit from the getter, #1968.
sourceRefl = sourceRefl.getSignature || sourceRefl.setSignature;
}
if (!sourceRefl) {
if (this.validation.invalidLink) {
this.application.logger.warn(`Failed to find "${source}" to inherit the comment from in the comment for ${reflection.getFullName()}`);
}
continue;
}
this.copyComment(sourceRefl, reflection);
}
if (sourceRefl instanceof models_1.DeclarationReflection &&
sourceRefl.kindOf(models_1.ReflectionKind.Accessor)) {
// Accessors, like functions, never have comments on their actual root reflection.
// If the user didn't specify whether to inherit from the getter or setter, then implicitly
// try to inherit from the getter, #1968.
sourceRefl = sourceRefl.getSignature || sourceRefl.setSignature;
this.createCircularDependencyWarnings();
this.dependencies.clear();
}
copyComment(source, target) {
if (!target.comment)
return;
if (!source.comment &&
source instanceof models_1.DeclarationReflection &&
source.signatures) {
source = source.signatures[0];
}
if (!sourceRefl) {
if (this.validation.invalidLink) {
this.application.logger.warn(`Failed to find "${source}" to inherit the comment from in the comment for ${reflection.getFullName()}`);
}
continue;
if (!source.comment &&
source instanceof models_1.DeclarationReflection &&
source.type instanceof models_1.ReflectionType &&
source.type.declaration.signatures) {
source = source.type.declaration.signatures[0];
}
this.copyComment(sourceRefl, reflection);
if (!source.comment) {
this.application.logger.warn(`${target.getFullName()} tried to copy a comment from ${source.getFullName()} with @inheritDoc, but the source has no associated comment.`);
return;
}
// If the source also has a @inheritDoc tag, we can't do anything yet.
// We'll try again later, once we've resolved the source's @inheritDoc reference.
if (extractInheritDocTagReference(source)) {
this.dependencies.get(source).push(target);
return;
}
target.comment.removeTags("@inheritDoc");
target.comment.summary = models_1.Comment.cloneDisplayParts(source.comment.summary);
const remarks = source.comment.getTag("@remarks");
if (remarks) {
target.comment.blockTags.unshift(remarks.clone());
}
const returns = source.comment.getTag("@returns");
if (returns) {
target.comment.blockTags.push(returns.clone());
}
if (source instanceof models_1.SignatureReflection &&
target instanceof models_1.SignatureReflection) {
copySummaries(source.parameters, target.parameters);
copySummaries(source.typeParameters, target.typeParameters);
}
else if (source instanceof models_1.DeclarationReflection &&
target instanceof models_1.DeclarationReflection) {
copySummaries(source.typeParameters, target.typeParameters);
}
// Now copy the comment for anyone who depends on me.
const dependent = this.dependencies.get(target);
this.dependencies.delete(target);
for (const target2 of dependent) {
this.copyComment(target, target2);
}
}
this.createCircularDependencyWarnings();
this.dependencies.clear();
}
copyComment(source, target) {
if (!target.comment)
return;
if (!source.comment &&
source instanceof models_1.DeclarationReflection &&
source.signatures) {
source = source.signatures[0];
}
if (!source.comment &&
source instanceof models_1.DeclarationReflection &&
source.type instanceof models_1.ReflectionType &&
source.type.declaration.signatures) {
source = source.type.declaration.signatures[0];
}
if (!source.comment) {
this.application.logger.warn(`${target.getFullName()} tried to copy a comment from ${source.getFullName()} with @inheritDoc, but the source has no associated comment.`);
return;
}
// If the source also has a @inheritDoc tag, we can't do anything yet.
// We'll try again later, once we've resolved the source's @inheritDoc reference.
if (extractInheritDocTagReference(source)) {
this.dependencies.get(source).push(target);
return;
}
target.comment.removeTags("@inheritDoc");
target.comment.summary = models_1.Comment.cloneDisplayParts(source.comment.summary);
const remarks = source.comment.getTag("@remarks");
if (remarks) {
target.comment.blockTags.unshift(remarks.clone());
}
const returns = source.comment.getTag("@returns");
if (returns) {
target.comment.blockTags.push(returns.clone());
}
if (source instanceof models_1.SignatureReflection &&
target instanceof models_1.SignatureReflection) {
copySummaries(source.parameters, target.parameters);
copySummaries(source.typeParameters, target.typeParameters);
}
else if (source instanceof models_1.DeclarationReflection &&
target instanceof models_1.DeclarationReflection) {
copySummaries(source.typeParameters, target.typeParameters);
}
// Now copy the comment for anyone who depends on me.
const dependent = this.dependencies.get(target);
this.dependencies.delete(target);
for (const target2 of dependent) {
this.copyComment(target, target2);
}
}
createCircularDependencyWarnings() {
const unwarned = new Set(this.dependencies.keys());
const generateWarning = (orig) => {
const parts = [orig.name];
unwarned.delete(orig);
let work = orig;
do {
work = this.dependencies.get(work)[0];
unwarned.delete(work);
parts.push(work.name);
} while (!this.dependencies.get(work).includes(orig));
parts.push(orig.name);
this.application.logger.warn(`@inheritDoc specifies a circular inheritance chain: ${parts
.reverse()
.join(" -> ")}`);
};
for (const orig of this.dependencies.keys()) {
if (unwarned.has(orig)) {
generateWarning(orig);
createCircularDependencyWarnings() {
const unwarned = new Set(this.dependencies.keys());
const generateWarning = (orig) => {
const parts = [orig.name];
unwarned.delete(orig);
let work = orig;
do {
work = this.dependencies.get(work)[0];
unwarned.delete(work);
parts.push(work.name);
} while (!this.dependencies.get(work).includes(orig));
parts.push(orig.name);
this.application.logger.warn(`@inheritDoc specifies a circular inheritance chain: ${parts
.reverse()
.join(" -> ")}`);
};
for (const orig of this.dependencies.keys()) {
if (unwarned.has(orig)) {
generateWarning(orig);
}
}
}
}
};
};
_InheritDocPlugin_validation_accessor_storage = new WeakMap();
__setFunctionName(_classThis, "InheritDocPlugin");
(() => {
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
_validation_decorators = [(0, utils_1.Option)("validation")];
__esDecorate(_classThis, null, _validation_decorators, { kind: "accessor", name: "validation", static: false, private: false, access: { has: obj => "validation" in obj, get: obj => obj.validation, set: (obj, value) => { obj.validation = value; } }, metadata: _metadata }, _validation_initializers, _instanceExtraInitializers);
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
InheritDocPlugin = _classThis = _classDescriptor.value;
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
__runInitializers(_classThis, _classExtraInitializers);
})();
return InheritDocPlugin = _classThis;
})();
exports.InheritDocPlugin = InheritDocPlugin;
__decorate([
(0, utils_1.BindOption)("validation")
], InheritDocPlugin.prototype, "validation", void 0);
exports.InheritDocPlugin = InheritDocPlugin = __decorate([
(0, components_1.Component)({ name: "inheritDoc" })
], InheritDocPlugin);
function copySummaries(source, target) {

@@ -174,0 +237,0 @@ for (const [s, t] of (0, array_1.zip)(source || [], target || [])) {

@@ -9,3 +9,3 @@ import { ConverterComponent } from "../components";

export declare class LinkResolverPlugin extends ConverterComponent {
validation: ValidationOptions;
accessor validation: ValidationOptions;
initialize(): void;

@@ -12,0 +12,0 @@ onResolve(context: Context): void;

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -19,46 +62,69 @@ exports.LinkResolverPlugin = void 0;

*/
let LinkResolverPlugin = class LinkResolverPlugin extends components_1.ConverterComponent {
initialize() {
super.initialize();
this.owner.on(converter_events_1.ConverterEvents.RESOLVE_END, this.onResolve, this, -300);
this.application.on(application_events_1.ApplicationEvents.REVIVE, this.resolveLinks, this, -300);
}
onResolve(context) {
this.resolveLinks(context.project);
}
resolveLinks(project) {
for (const id in project.reflections) {
const reflection = project.reflections[id];
if (reflection.comment) {
this.owner.resolveLinks(reflection.comment, reflection);
}
if (reflection instanceof models_1.DeclarationReflection &&
reflection.readme) {
reflection.readme = this.owner.resolveLinks(reflection.readme, reflection);
}
let LinkResolverPlugin = (() => {
var _LinkResolverPlugin_validation_accessor_storage;
let _classDecorators = [(0, components_1.Component)({ name: "link-resolver" })];
let _classDescriptor;
let _classExtraInitializers = [];
let _classThis;
let _classSuper = components_1.ConverterComponent;
let _instanceExtraInitializers = [];
let _validation_decorators;
let _validation_initializers = [];
var LinkResolverPlugin = _classThis = class extends _classSuper {
constructor() {
super(...arguments);
_LinkResolverPlugin_validation_accessor_storage.set(this, (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _validation_initializers, void 0)));
}
if (project.readme) {
project.readme = this.owner.resolveLinks(project.readme, project);
get validation() { return __classPrivateFieldGet(this, _LinkResolverPlugin_validation_accessor_storage, "f"); }
set validation(value) { __classPrivateFieldSet(this, _LinkResolverPlugin_validation_accessor_storage, value, "f"); }
initialize() {
super.initialize();
this.owner.on(converter_events_1.ConverterEvents.RESOLVE_END, this.onResolve, this, -300);
this.application.on(application_events_1.ApplicationEvents.REVIVE, this.resolveLinks, this, -300);
}
for (const { type, owner } of (0, reflections_1.discoverAllReferenceTypes)(project, false)) {
if (!type.reflection) {
const resolveResult = this.owner.resolveExternalLink(type.toDeclarationReference(), owner, undefined, type.symbolId);
switch (typeof resolveResult) {
case "string":
type.externalUrl = resolveResult;
break;
case "object":
type.externalUrl = resolveResult.target;
break;
onResolve(context) {
this.resolveLinks(context.project);
}
resolveLinks(project) {
for (const id in project.reflections) {
const reflection = project.reflections[id];
if (reflection.comment) {
this.owner.resolveLinks(reflection.comment, reflection);
}
if (reflection instanceof models_1.DeclarationReflection &&
reflection.readme) {
reflection.readme = this.owner.resolveLinks(reflection.readme, reflection);
}
}
if (project.readme) {
project.readme = this.owner.resolveLinks(project.readme, project);
}
for (const { type, owner } of (0, reflections_1.discoverAllReferenceTypes)(project, false)) {
if (!type.reflection) {
const resolveResult = this.owner.resolveExternalLink(type.toDeclarationReference(), owner, undefined, type.symbolId);
switch (typeof resolveResult) {
case "string":
type.externalUrl = resolveResult;
break;
case "object":
type.externalUrl = resolveResult.target;
break;
}
}
}
}
}
};
};
_LinkResolverPlugin_validation_accessor_storage = new WeakMap();
__setFunctionName(_classThis, "LinkResolverPlugin");
(() => {
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
_validation_decorators = [(0, utils_1.Option)("validation")];
__esDecorate(_classThis, null, _validation_decorators, { kind: "accessor", name: "validation", static: false, private: false, access: { has: obj => "validation" in obj, get: obj => obj.validation, set: (obj, value) => { obj.validation = value; } }, metadata: _metadata }, _validation_initializers, _instanceExtraInitializers);
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
LinkResolverPlugin = _classThis = _classDescriptor.value;
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
__runInitializers(_classThis, _classExtraInitializers);
})();
return LinkResolverPlugin = _classThis;
})();
exports.LinkResolverPlugin = LinkResolverPlugin;
__decorate([
(0, utils_1.BindOption)("validation")
], LinkResolverPlugin.prototype, "validation", void 0);
exports.LinkResolverPlugin = LinkResolverPlugin = __decorate([
(0, components_1.Component)({ name: "link-resolver" })
], LinkResolverPlugin);

@@ -8,6 +8,7 @@ import { ConverterComponent } from "../components";

export declare class PackagePlugin extends ConverterComponent {
readme: string;
entryPointStrategy: EntryPointStrategy;
entryPoints: string[];
includeVersion: boolean;
accessor readme: string;
accessor stripYamlFrontmatter: boolean;
accessor entryPointStrategy: EntryPointStrategy;
accessor entryPoints: string[];
accessor includeVersion: boolean;
/**

@@ -28,4 +29,5 @@ * The file name of the found readme.md file.

private onBegin;
private processReadmeContents;
private onBeginResolve;
private addEntries;
}

@@ -18,8 +18,36 @@ "use strict";

});
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
var __importStar = (this && this.__importStar) || function (mod) {

@@ -32,2 +60,17 @@ if (mod && mod.__esModule) return mod;

};
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -48,103 +91,155 @@ exports.PackagePlugin = void 0;

*/
let PackagePlugin = class PackagePlugin extends components_1.ConverterComponent {
initialize() {
this.listenTo(this.owner, {
[converter_1.Converter.EVENT_BEGIN]: this.onBegin,
[converter_1.Converter.EVENT_RESOLVE_BEGIN]: this.onBeginResolve,
[converter_1.Converter.EVENT_END]: () => {
delete this.readmeFile;
delete this.readmeContents;
delete this.packageJson;
},
});
this.listenTo(this.application, {
[application_events_1.ApplicationEvents.REVIVE]: this.onRevive,
});
}
onRevive(project) {
this.onBegin();
this.addEntries(project);
delete this.readmeFile;
delete this.packageJson;
delete this.readmeContents;
}
onBegin() {
this.readmeFile = undefined;
this.readmeContents = undefined;
this.packageJson = undefined;
const entryFiles = this.entryPointStrategy === utils_1.EntryPointStrategy.Packages
? this.entryPoints.map((d) => (0, path_1.join)(d, "package.json"))
: this.entryPoints;
const dirName = this.application.options.packageDir ??
Path.resolve((0, fs_1.deriveRootDir)(entryFiles));
this.application.logger.verbose(`Begin readme.md/package.json search at ${(0, paths_1.nicePath)(dirName)}`);
this.packageJson = (0, fs_1.discoverPackageJson)(dirName)?.content;
// Path will be resolved already. This is kind of ugly, but...
if (this.readme.endsWith("none")) {
return; // No readme, we're done
let PackagePlugin = (() => {
var _PackagePlugin_readme_accessor_storage, _PackagePlugin_stripYamlFrontmatter_accessor_storage, _PackagePlugin_entryPointStrategy_accessor_storage, _PackagePlugin_entryPoints_accessor_storage, _PackagePlugin_includeVersion_accessor_storage;
let _classDecorators = [(0, components_1.Component)({ name: "package" })];
let _classDescriptor;
let _classExtraInitializers = [];
let _classThis;
let _classSuper = components_1.ConverterComponent;
let _instanceExtraInitializers = [];
let _readme_decorators;
let _readme_initializers = [];
let _stripYamlFrontmatter_decorators;
let _stripYamlFrontmatter_initializers = [];
let _entryPointStrategy_decorators;
let _entryPointStrategy_initializers = [];
let _entryPoints_decorators;
let _entryPoints_initializers = [];
let _includeVersion_decorators;
let _includeVersion_initializers = [];
var PackagePlugin = _classThis = class extends _classSuper {
constructor() {
super(...arguments);
_PackagePlugin_readme_accessor_storage.set(this, (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _readme_initializers, void 0)));
_PackagePlugin_stripYamlFrontmatter_accessor_storage.set(this, __runInitializers(this, _stripYamlFrontmatter_initializers, void 0));
_PackagePlugin_entryPointStrategy_accessor_storage.set(this, __runInitializers(this, _entryPointStrategy_initializers, void 0));
_PackagePlugin_entryPoints_accessor_storage.set(this, __runInitializers(this, _entryPoints_initializers, void 0));
_PackagePlugin_includeVersion_accessor_storage.set(this, __runInitializers(this, _includeVersion_initializers, void 0));
}
if (this.readme) {
// Readme path provided, read only that file.
try {
this.readmeContents = (0, utils_1.readFile)(this.readme);
this.readmeFile = this.readme;
get readme() { return __classPrivateFieldGet(this, _PackagePlugin_readme_accessor_storage, "f"); }
set readme(value) { __classPrivateFieldSet(this, _PackagePlugin_readme_accessor_storage, value, "f"); }
get stripYamlFrontmatter() { return __classPrivateFieldGet(this, _PackagePlugin_stripYamlFrontmatter_accessor_storage, "f"); }
set stripYamlFrontmatter(value) { __classPrivateFieldSet(this, _PackagePlugin_stripYamlFrontmatter_accessor_storage, value, "f"); }
get entryPointStrategy() { return __classPrivateFieldGet(this, _PackagePlugin_entryPointStrategy_accessor_storage, "f"); }
set entryPointStrategy(value) { __classPrivateFieldSet(this, _PackagePlugin_entryPointStrategy_accessor_storage, value, "f"); }
get entryPoints() { return __classPrivateFieldGet(this, _PackagePlugin_entryPoints_accessor_storage, "f"); }
set entryPoints(value) { __classPrivateFieldSet(this, _PackagePlugin_entryPoints_accessor_storage, value, "f"); }
get includeVersion() { return __classPrivateFieldGet(this, _PackagePlugin_includeVersion_accessor_storage, "f"); }
set includeVersion(value) { __classPrivateFieldSet(this, _PackagePlugin_includeVersion_accessor_storage, value, "f"); }
initialize() {
this.listenTo(this.owner, {
[converter_1.Converter.EVENT_BEGIN]: this.onBegin,
[converter_1.Converter.EVENT_RESOLVE_BEGIN]: this.onBeginResolve,
[converter_1.Converter.EVENT_END]: () => {
delete this.readmeFile;
delete this.readmeContents;
delete this.packageJson;
},
});
this.listenTo(this.application, {
[application_events_1.ApplicationEvents.REVIVE]: this.onRevive,
});
}
onRevive(project) {
this.onBegin();
this.addEntries(project);
delete this.readmeFile;
delete this.packageJson;
delete this.readmeContents;
}
onBegin() {
this.readmeFile = undefined;
this.readmeContents = undefined;
this.packageJson = undefined;
const entryFiles = this.entryPointStrategy === utils_1.EntryPointStrategy.Packages
? this.entryPoints.map((d) => (0, path_1.join)(d, "package.json"))
: this.entryPoints;
const dirName = this.application.options.packageDir ??
Path.resolve((0, fs_1.deriveRootDir)(entryFiles));
this.application.logger.verbose(`Begin readme.md/package.json search at ${(0, paths_1.nicePath)(dirName)}`);
this.packageJson = (0, fs_1.discoverPackageJson)(dirName)?.content;
// Path will be resolved already. This is kind of ugly, but...
if (this.readme.endsWith("none")) {
return; // No readme, we're done
}
catch {
this.application.logger.error(`Provided README path, ${(0, paths_1.nicePath)(this.readme)} could not be read.`);
if (this.readme) {
// Readme path provided, read only that file.
try {
this.readmeContents = this.processReadmeContents((0, utils_1.readFile)(this.readme));
this.readmeFile = this.readme;
}
catch {
this.application.logger.error(`Provided README path, ${(0, paths_1.nicePath)(this.readme)} could not be read.`);
}
}
}
else {
// No readme provided, automatically find the readme
const result = (0, fs_1.discoverInParentDir)("readme.md", dirName, (content) => content);
if (result) {
this.readmeFile = result.file;
this.readmeContents = result.content;
else {
// No readme provided, automatically find the readme
const result = (0, fs_1.discoverInParentDir)("readme.md", dirName, (content) => content);
if (result) {
this.readmeFile = result.file;
this.readmeContents = this.processReadmeContents(result.content);
}
}
}
}
onBeginResolve(context) {
this.addEntries(context.project);
}
addEntries(project) {
if (this.readmeFile && this.readmeContents) {
const comment = this.application.converter.parseRawComment(new minimalSourceFile_1.MinimalSourceFile(this.readmeContents, this.readmeFile));
if (comment.blockTags.length || comment.modifierTags.size) {
const ignored = [
...comment.blockTags.map((tag) => tag.tag),
...comment.modifierTags,
];
this.application.logger.warn(`Block and modifier tags will be ignored within the readme:\n\t${ignored.join("\n\t")}`);
processReadmeContents(contents) {
if (this.stripYamlFrontmatter) {
return contents.replace(/^\s*---\r?\n[\s\S]*?\r?\n---\s*?\r?\n\s*/, "");
}
project.readme = comment.summary;
return contents;
}
if (this.packageJson) {
project.packageName = this.packageJson.name;
if (!project.name) {
project.name = project.packageName || "Documentation";
onBeginResolve(context) {
this.addEntries(context.project);
}
addEntries(project) {
if (this.readmeFile && this.readmeContents) {
const comment = this.application.converter.parseRawComment(new minimalSourceFile_1.MinimalSourceFile(this.readmeContents, this.readmeFile));
if (comment.blockTags.length || comment.modifierTags.size) {
const ignored = [
...comment.blockTags.map((tag) => tag.tag),
...comment.modifierTags,
];
this.application.logger.warn(`Block and modifier tags will be ignored within the readme:\n\t${ignored.join("\n\t")}`);
}
project.readme = comment.summary;
}
if (this.includeVersion) {
project.packageVersion = this.packageJson.version?.replace(/^v/, "");
if (this.packageJson) {
project.packageName = this.packageJson.name;
if (!project.name) {
project.name = project.packageName || "Documentation";
}
if (this.includeVersion) {
project.packageVersion = this.packageJson.version?.replace(/^v/, "");
}
}
else if (!project.name) {
this.application.logger.warn('The --name option was not specified, and no package.json was found. Defaulting project name to "Documentation".');
project.name = "Documentation";
}
}
else if (!project.name) {
this.application.logger.warn('The --name option was not specified, and no package.json was found. Defaulting project name to "Documentation".');
project.name = "Documentation";
}
}
};
};
_PackagePlugin_readme_accessor_storage = new WeakMap();
_PackagePlugin_stripYamlFrontmatter_accessor_storage = new WeakMap();
_PackagePlugin_entryPointStrategy_accessor_storage = new WeakMap();
_PackagePlugin_entryPoints_accessor_storage = new WeakMap();
_PackagePlugin_includeVersion_accessor_storage = new WeakMap();
__setFunctionName(_classThis, "PackagePlugin");
(() => {
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
_readme_decorators = [(0, utils_1.Option)("readme")];
_stripYamlFrontmatter_decorators = [(0, utils_1.Option)("stripYamlFrontmatter")];
_entryPointStrategy_decorators = [(0, utils_1.Option)("entryPointStrategy")];
_entryPoints_decorators = [(0, utils_1.Option)("entryPoints")];
_includeVersion_decorators = [(0, utils_1.Option)("includeVersion")];
__esDecorate(_classThis, null, _readme_decorators, { kind: "accessor", name: "readme", static: false, private: false, access: { has: obj => "readme" in obj, get: obj => obj.readme, set: (obj, value) => { obj.readme = value; } }, metadata: _metadata }, _readme_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _stripYamlFrontmatter_decorators, { kind: "accessor", name: "stripYamlFrontmatter", static: false, private: false, access: { has: obj => "stripYamlFrontmatter" in obj, get: obj => obj.stripYamlFrontmatter, set: (obj, value) => { obj.stripYamlFrontmatter = value; } }, metadata: _metadata }, _stripYamlFrontmatter_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _entryPointStrategy_decorators, { kind: "accessor", name: "entryPointStrategy", static: false, private: false, access: { has: obj => "entryPointStrategy" in obj, get: obj => obj.entryPointStrategy, set: (obj, value) => { obj.entryPointStrategy = value; } }, metadata: _metadata }, _entryPointStrategy_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _entryPoints_decorators, { kind: "accessor", name: "entryPoints", static: false, private: false, access: { has: obj => "entryPoints" in obj, get: obj => obj.entryPoints, set: (obj, value) => { obj.entryPoints = value; } }, metadata: _metadata }, _entryPoints_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _includeVersion_decorators, { kind: "accessor", name: "includeVersion", static: false, private: false, access: { has: obj => "includeVersion" in obj, get: obj => obj.includeVersion, set: (obj, value) => { obj.includeVersion = value; } }, metadata: _metadata }, _includeVersion_initializers, _instanceExtraInitializers);
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
PackagePlugin = _classThis = _classDescriptor.value;
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
__runInitializers(_classThis, _classExtraInitializers);
})();
return PackagePlugin = _classThis;
})();
exports.PackagePlugin = PackagePlugin;
__decorate([
(0, utils_1.BindOption)("readme")
], PackagePlugin.prototype, "readme", void 0);
__decorate([
(0, utils_1.BindOption)("entryPointStrategy")
], PackagePlugin.prototype, "entryPointStrategy", void 0);
__decorate([
(0, utils_1.BindOption)("entryPoints")
], PackagePlugin.prototype, "entryPoints", void 0);
__decorate([
(0, utils_1.BindOption)("includeVersion")
], PackagePlugin.prototype, "includeVersion", void 0);
exports.PackagePlugin = PackagePlugin = __decorate([
(0, components_1.Component)({ name: "package" })
], PackagePlugin);

@@ -6,8 +6,8 @@ import { ConverterComponent } from "../components";

export declare class SourcePlugin extends ConverterComponent {
readonly disableSources: boolean;
readonly gitRevision: string;
readonly gitRemote: string;
readonly disableGit: boolean;
readonly sourceLinkTemplate: string;
readonly basePath: string;
accessor disableSources: boolean;
accessor gitRevision: string;
accessor gitRemote: string;
accessor disableGit: boolean;
accessor sourceLinkTemplate: string;
accessor basePath: string;
/**

@@ -14,0 +14,0 @@ * All file names to find the base path from.

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -26,159 +69,204 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

*/
let SourcePlugin = class SourcePlugin extends components_1.ConverterComponent {
constructor() {
super(...arguments);
let SourcePlugin = (() => {
var _SourcePlugin_disableSources_accessor_storage, _SourcePlugin_gitRevision_accessor_storage, _SourcePlugin_gitRemote_accessor_storage, _SourcePlugin_disableGit_accessor_storage, _SourcePlugin_sourceLinkTemplate_accessor_storage, _SourcePlugin_basePath_accessor_storage;
let _classDecorators = [(0, components_1.Component)({ name: "source" })];
let _classDescriptor;
let _classExtraInitializers = [];
let _classThis;
let _classSuper = components_1.ConverterComponent;
let _instanceExtraInitializers = [];
let _disableSources_decorators;
let _disableSources_initializers = [];
let _gitRevision_decorators;
let _gitRevision_initializers = [];
let _gitRemote_decorators;
let _gitRemote_initializers = [];
let _disableGit_decorators;
let _disableGit_initializers = [];
let _sourceLinkTemplate_decorators;
let _sourceLinkTemplate_initializers = [];
let _basePath_decorators;
let _basePath_initializers = [];
var SourcePlugin = _classThis = class extends _classSuper {
constructor() {
super(...arguments);
_SourcePlugin_disableSources_accessor_storage.set(this, (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _disableSources_initializers, void 0)));
_SourcePlugin_gitRevision_accessor_storage.set(this, __runInitializers(this, _gitRevision_initializers, void 0));
_SourcePlugin_gitRemote_accessor_storage.set(this, __runInitializers(this, _gitRemote_initializers, void 0));
_SourcePlugin_disableGit_accessor_storage.set(this, __runInitializers(this, _disableGit_initializers, void 0));
_SourcePlugin_sourceLinkTemplate_accessor_storage.set(this, __runInitializers(this, _sourceLinkTemplate_initializers, void 0));
_SourcePlugin_basePath_accessor_storage.set(this, __runInitializers(this, _basePath_initializers, void 0));
/**
* All file names to find the base path from.
*/
this.fileNames = new Set();
/**
* List of known repositories.
*/
this.repositories = {};
/**
* List of paths known to be not under git control.
*/
this.ignoredPaths = new Set();
}
get disableSources() { return __classPrivateFieldGet(this, _SourcePlugin_disableSources_accessor_storage, "f"); }
set disableSources(value) { __classPrivateFieldSet(this, _SourcePlugin_disableSources_accessor_storage, value, "f"); }
get gitRevision() { return __classPrivateFieldGet(this, _SourcePlugin_gitRevision_accessor_storage, "f"); }
set gitRevision(value) { __classPrivateFieldSet(this, _SourcePlugin_gitRevision_accessor_storage, value, "f"); }
get gitRemote() { return __classPrivateFieldGet(this, _SourcePlugin_gitRemote_accessor_storage, "f"); }
set gitRemote(value) { __classPrivateFieldSet(this, _SourcePlugin_gitRemote_accessor_storage, value, "f"); }
get disableGit() { return __classPrivateFieldGet(this, _SourcePlugin_disableGit_accessor_storage, "f"); }
set disableGit(value) { __classPrivateFieldSet(this, _SourcePlugin_disableGit_accessor_storage, value, "f"); }
get sourceLinkTemplate() { return __classPrivateFieldGet(this, _SourcePlugin_sourceLinkTemplate_accessor_storage, "f"); }
set sourceLinkTemplate(value) { __classPrivateFieldSet(this, _SourcePlugin_sourceLinkTemplate_accessor_storage, value, "f"); }
get basePath() { return __classPrivateFieldGet(this, _SourcePlugin_basePath_accessor_storage, "f"); }
set basePath(value) { __classPrivateFieldSet(this, _SourcePlugin_basePath_accessor_storage, value, "f"); }
/**
* All file names to find the base path from.
* Create a new SourceHandler instance.
*/
this.fileNames = new Set();
initialize() {
this.listenTo(this.owner, {
[converter_1.Converter.EVENT_END]: this.onEnd,
[converter_1.Converter.EVENT_CREATE_DECLARATION]: this.onDeclaration,
[converter_1.Converter.EVENT_CREATE_SIGNATURE]: this.onSignature,
[converter_1.Converter.EVENT_RESOLVE_BEGIN]: this.onBeginResolve,
});
}
onEnd() {
// Should probably clear repositories/ignoredPaths here, but these aren't likely to change between runs...
this.fileNames.clear();
}
/**
* List of known repositories.
* Triggered when the converter has created a declaration reflection.
*
* Attach the current source file to the {@link DeclarationReflection.sources} array.
*
* @param _context The context object describing the current state the converter is in.
* @param reflection The reflection that is currently processed.
*/
this.repositories = {};
/**
* List of paths known to be not under git control.
*/
this.ignoredPaths = new Set();
}
/**
* Create a new SourceHandler instance.
*/
initialize() {
this.listenTo(this.owner, {
[converter_1.Converter.EVENT_END]: this.onEnd,
[converter_1.Converter.EVENT_CREATE_DECLARATION]: this.onDeclaration,
[converter_1.Converter.EVENT_CREATE_SIGNATURE]: this.onSignature,
[converter_1.Converter.EVENT_RESOLVE_BEGIN]: this.onBeginResolve,
});
}
onEnd() {
// Should probably clear repositories/ignoredPaths here, but these aren't likely to change between runs...
this.fileNames.clear();
}
/**
* Triggered when the converter has created a declaration reflection.
*
* Attach the current source file to the {@link DeclarationReflection.sources} array.
*
* @param _context The context object describing the current state the converter is in.
* @param reflection The reflection that is currently processed.
*/
onDeclaration(_context, reflection) {
if (this.disableSources)
return;
const symbol = reflection.project.getSymbolFromReflection(reflection);
for (const node of symbol?.declarations || []) {
const sourceFile = node.getSourceFile();
onDeclaration(_context, reflection) {
if (this.disableSources)
return;
const symbol = reflection.project.getSymbolFromReflection(reflection);
for (const node of symbol?.declarations || []) {
const sourceFile = node.getSourceFile();
const fileName = base_path_1.BasePath.normalize(sourceFile.fileName);
this.fileNames.add(fileName);
let position;
if (typescript_1.default.isSourceFile(node)) {
position = { character: 0, line: 0 };
}
else {
position = typescript_1.default.getLineAndCharacterOfPosition(sourceFile, getLocationNode(node).getStart());
}
reflection.sources ||= [];
reflection.sources.push(new models_1.SourceReference(fileName, position.line + 1, position.character));
}
}
onSignature(_context, reflection, sig) {
if (this.disableSources || !sig)
return;
const sourceFile = sig.getSourceFile();
const fileName = base_path_1.BasePath.normalize(sourceFile.fileName);
this.fileNames.add(fileName);
let position;
if (typescript_1.default.isSourceFile(node)) {
position = { character: 0, line: 0 };
}
else {
position = typescript_1.default.getLineAndCharacterOfPosition(sourceFile, getLocationNode(node).getStart());
}
reflection.sources || (reflection.sources = []);
const position = typescript_1.default.getLineAndCharacterOfPosition(sourceFile, getLocationNode(sig).getStart());
reflection.sources ||= [];
reflection.sources.push(new models_1.SourceReference(fileName, position.line + 1, position.character));
}
}
onSignature(_context, reflection, sig) {
if (this.disableSources || !sig)
return;
const sourceFile = sig.getSourceFile();
const fileName = base_path_1.BasePath.normalize(sourceFile.fileName);
this.fileNames.add(fileName);
const position = typescript_1.default.getLineAndCharacterOfPosition(sourceFile, getLocationNode(sig).getStart());
reflection.sources || (reflection.sources = []);
reflection.sources.push(new models_1.SourceReference(fileName, position.line + 1, position.character));
}
/**
* Triggered when the converter begins resolving a project.
*
* @param context The context object describing the current state the converter is in.
*/
onBeginResolve(context) {
if (this.disableSources)
return;
if (this.disableGit && !this.sourceLinkTemplate) {
this.application.logger.error(`disableGit is set, but sourceLinkTemplate is not, so source links cannot be produced. Set a sourceLinkTemplate or disableSources to prevent source tracking.`);
return;
}
if (this.disableGit &&
this.sourceLinkTemplate.includes("{gitRevision}") &&
!this.gitRevision) {
this.application.logger.warn(`disableGit is set and sourceLinkTemplate contains {gitRevision}, which will be replaced with an empty string as no revision was provided.`);
}
const basePath = this.basePath || (0, utils_1.getCommonDirectory)([...this.fileNames]);
for (const id in context.project.reflections) {
const refl = context.project.reflections[id];
if (!(refl instanceof index_1.DeclarationReflection ||
refl instanceof index_1.SignatureReflection)) {
continue;
/**
* Triggered when the converter begins resolving a project.
*
* @param context The context object describing the current state the converter is in.
*/
onBeginResolve(context) {
if (this.disableSources)
return;
if (this.disableGit && !this.sourceLinkTemplate) {
this.application.logger.error(`disableGit is set, but sourceLinkTemplate is not, so source links cannot be produced. Set a sourceLinkTemplate or disableSources to prevent source tracking.`);
return;
}
for (const source of refl.sources || []) {
if (this.disableGit || (0, repository_1.gitIsInstalled)()) {
const repo = this.getRepository(basePath, source.fullFileName);
source.url = repo?.getURL(source.fullFileName, source.line);
if (this.disableGit &&
this.sourceLinkTemplate.includes("{gitRevision}") &&
!this.gitRevision) {
this.application.logger.warn(`disableGit is set and sourceLinkTemplate contains {gitRevision}, which will be replaced with an empty string as no revision was provided.`);
}
const basePath = this.basePath || (0, utils_1.getCommonDirectory)([...this.fileNames]);
for (const id in context.project.reflections) {
const refl = context.project.reflections[id];
if (!(refl instanceof index_1.DeclarationReflection ||
refl instanceof index_1.SignatureReflection)) {
continue;
}
source.fileName = (0, utils_1.normalizePath)((0, path_1.relative)(basePath, source.fullFileName));
for (const source of refl.sources || []) {
if (this.disableGit || (0, repository_1.gitIsInstalled)()) {
const repo = this.getRepository(basePath, source.fullFileName);
source.url = repo?.getURL(source.fullFileName, source.line);
}
source.fileName = (0, utils_1.normalizePath)((0, path_1.relative)(basePath, source.fullFileName));
}
}
}
}
/**
* Check whether the given file is placed inside a repository.
*
* @param fileName The name of the file a repository should be looked for.
* @returns The found repository info or undefined.
*/
getRepository(basePath, fileName) {
if (this.disableGit) {
return new repository_1.AssumedRepository(basePath, this.gitRevision, this.sourceLinkTemplate);
}
// Check for known non-repositories
const dirName = (0, path_1.dirname)(fileName);
const segments = dirName.split("/");
for (let i = segments.length; i > 0; i--) {
if (this.ignoredPaths.has(segments.slice(0, i).join("/"))) {
return;
/**
* Check whether the given file is placed inside a repository.
*
* @param fileName The name of the file a repository should be looked for.
* @returns The found repository info or undefined.
*/
getRepository(basePath, fileName) {
if (this.disableGit) {
return new repository_1.AssumedRepository(basePath, this.gitRevision, this.sourceLinkTemplate);
}
}
// Check for known repositories
for (const path of Object.keys(this.repositories)) {
if (fileName.toLowerCase().startsWith(path)) {
return this.repositories[path];
// Check for known non-repositories
const dirName = (0, path_1.dirname)(fileName);
const segments = dirName.split("/");
for (let i = segments.length; i > 0; i--) {
if (this.ignoredPaths.has(segments.slice(0, i).join("/"))) {
return;
}
}
// Check for known repositories
for (const path of Object.keys(this.repositories)) {
if (fileName.toLowerCase().startsWith(path)) {
return this.repositories[path];
}
}
// Try to create a new repository
const repository = repository_1.GitRepository.tryCreateRepository(dirName, this.sourceLinkTemplate, this.gitRevision, this.gitRemote, this.application.logger);
if (repository) {
this.repositories[repository.path.toLowerCase()] = repository;
return repository;
}
// No repository found, add path to ignored paths
this.ignoredPaths.add(dirName);
}
// Try to create a new repository
const repository = repository_1.GitRepository.tryCreateRepository(dirName, this.sourceLinkTemplate, this.gitRevision, this.gitRemote, this.application.logger);
if (repository) {
this.repositories[repository.path.toLowerCase()] = repository;
return repository;
}
// No repository found, add path to ignored paths
this.ignoredPaths.add(dirName);
}
};
};
_SourcePlugin_disableSources_accessor_storage = new WeakMap();
_SourcePlugin_gitRevision_accessor_storage = new WeakMap();
_SourcePlugin_gitRemote_accessor_storage = new WeakMap();
_SourcePlugin_disableGit_accessor_storage = new WeakMap();
_SourcePlugin_sourceLinkTemplate_accessor_storage = new WeakMap();
_SourcePlugin_basePath_accessor_storage = new WeakMap();
__setFunctionName(_classThis, "SourcePlugin");
(() => {
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
_disableSources_decorators = [(0, utils_1.Option)("disableSources")];
_gitRevision_decorators = [(0, utils_1.Option)("gitRevision")];
_gitRemote_decorators = [(0, utils_1.Option)("gitRemote")];
_disableGit_decorators = [(0, utils_1.Option)("disableGit")];
_sourceLinkTemplate_decorators = [(0, utils_1.Option)("sourceLinkTemplate")];
_basePath_decorators = [(0, utils_1.Option)("basePath")];
__esDecorate(_classThis, null, _disableSources_decorators, { kind: "accessor", name: "disableSources", static: false, private: false, access: { has: obj => "disableSources" in obj, get: obj => obj.disableSources, set: (obj, value) => { obj.disableSources = value; } }, metadata: _metadata }, _disableSources_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _gitRevision_decorators, { kind: "accessor", name: "gitRevision", static: false, private: false, access: { has: obj => "gitRevision" in obj, get: obj => obj.gitRevision, set: (obj, value) => { obj.gitRevision = value; } }, metadata: _metadata }, _gitRevision_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _gitRemote_decorators, { kind: "accessor", name: "gitRemote", static: false, private: false, access: { has: obj => "gitRemote" in obj, get: obj => obj.gitRemote, set: (obj, value) => { obj.gitRemote = value; } }, metadata: _metadata }, _gitRemote_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _disableGit_decorators, { kind: "accessor", name: "disableGit", static: false, private: false, access: { has: obj => "disableGit" in obj, get: obj => obj.disableGit, set: (obj, value) => { obj.disableGit = value; } }, metadata: _metadata }, _disableGit_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _sourceLinkTemplate_decorators, { kind: "accessor", name: "sourceLinkTemplate", static: false, private: false, access: { has: obj => "sourceLinkTemplate" in obj, get: obj => obj.sourceLinkTemplate, set: (obj, value) => { obj.sourceLinkTemplate = value; } }, metadata: _metadata }, _sourceLinkTemplate_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _basePath_decorators, { kind: "accessor", name: "basePath", static: false, private: false, access: { has: obj => "basePath" in obj, get: obj => obj.basePath, set: (obj, value) => { obj.basePath = value; } }, metadata: _metadata }, _basePath_initializers, _instanceExtraInitializers);
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
SourcePlugin = _classThis = _classDescriptor.value;
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
__runInitializers(_classThis, _classExtraInitializers);
})();
return SourcePlugin = _classThis;
})();
exports.SourcePlugin = SourcePlugin;
__decorate([
(0, utils_1.BindOption)("disableSources")
], SourcePlugin.prototype, "disableSources", void 0);
__decorate([
(0, utils_1.BindOption)("gitRevision")
], SourcePlugin.prototype, "gitRevision", void 0);
__decorate([
(0, utils_1.BindOption)("gitRemote")
], SourcePlugin.prototype, "gitRemote", void 0);
__decorate([
(0, utils_1.BindOption)("disableGit")
], SourcePlugin.prototype, "disableGit", void 0);
__decorate([
(0, utils_1.BindOption)("sourceLinkTemplate")
], SourcePlugin.prototype, "sourceLinkTemplate", void 0);
__decorate([
(0, utils_1.BindOption)("basePath")
], SourcePlugin.prototype, "basePath", void 0);
exports.SourcePlugin = SourcePlugin = __decorate([
(0, components_1.Component)({ name: "source" })
], SourcePlugin);
function getLocationNode(node) {

@@ -185,0 +273,0 @@ if ((0, nodes_1.isNamedNode)(node))

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -18,112 +50,125 @@ exports.TypePlugin = void 0;

*/
let TypePlugin = class TypePlugin extends components_1.ConverterComponent {
constructor() {
super(...arguments);
this.reflections = new Set();
}
/**
* Create a new TypeHandler instance.
*/
initialize() {
this.listenTo(this.owner, {
[converter_1.Converter.EVENT_RESOLVE]: this.onResolve,
[converter_1.Converter.EVENT_RESOLVE_END]: this.onResolveEnd,
[converter_1.Converter.EVENT_END]: () => this.reflections.clear(),
});
this.listenTo(this.application, {
[application_events_1.ApplicationEvents.REVIVE]: this.onRevive,
});
}
onRevive(project) {
for (const id in project.reflections) {
this.resolve(project, project.reflections[id],
/* create links */ false);
let TypePlugin = (() => {
let _classDecorators = [(0, components_1.Component)({ name: "type" })];
let _classDescriptor;
let _classExtraInitializers = [];
let _classThis;
let _classSuper = components_1.ConverterComponent;
var TypePlugin = _classThis = class extends _classSuper {
constructor() {
super(...arguments);
this.reflections = new Set();
}
this.finishResolve(project);
this.reflections.clear();
}
onResolve(context, reflection) {
this.resolve(context.project, reflection);
}
resolve(project, reflection, createLinks = true) {
if (!(reflection instanceof index_1.DeclarationReflection))
return;
if (reflection.kindOf(index_1.ReflectionKind.ClassOrInterface)) {
this.postpone(reflection);
walk(reflection.implementedTypes, (target) => {
this.postpone(target);
target.implementedBy || (target.implementedBy = []);
if (createLinks) {
target.implementedBy.push(types_1.ReferenceType.createResolvedReference(reflection.name, reflection, project));
}
/**
* Create a new TypeHandler instance.
*/
initialize() {
this.listenTo(this.owner, {
[converter_1.Converter.EVENT_RESOLVE]: this.onResolve,
[converter_1.Converter.EVENT_RESOLVE_END]: this.onResolveEnd,
[converter_1.Converter.EVENT_END]: () => this.reflections.clear(),
});
walk(reflection.extendedTypes, (target) => {
this.postpone(target);
target.extendedBy || (target.extendedBy = []);
if (createLinks) {
target.extendedBy.push(types_1.ReferenceType.createResolvedReference(reflection.name, reflection, project));
}
this.listenTo(this.application, {
[application_events_1.ApplicationEvents.REVIVE]: this.onRevive,
});
}
function walk(types, callback) {
if (!types) {
onRevive(project) {
for (const id in project.reflections) {
this.resolve(project, project.reflections[id],
/* create links */ false);
}
this.finishResolve(project);
this.reflections.clear();
}
onResolve(context, reflection) {
this.resolve(context.project, reflection);
}
resolve(project, reflection, createLinks = true) {
if (!(reflection instanceof index_1.DeclarationReflection))
return;
if (reflection.kindOf(index_1.ReflectionKind.ClassOrInterface)) {
this.postpone(reflection);
walk(reflection.implementedTypes, (target) => {
this.postpone(target);
target.implementedBy ||= [];
if (createLinks) {
target.implementedBy.push(types_1.ReferenceType.createResolvedReference(reflection.name, reflection, project));
}
});
walk(reflection.extendedTypes, (target) => {
this.postpone(target);
target.extendedBy ||= [];
if (createLinks) {
target.extendedBy.push(types_1.ReferenceType.createResolvedReference(reflection.name, reflection, project));
}
});
}
types.forEach((type) => {
if (!(type instanceof types_1.ReferenceType)) {
function walk(types, callback) {
if (!types) {
return;
}
if (!type.reflection ||
!(type.reflection instanceof index_1.DeclarationReflection)) {
return;
}
callback(type.reflection);
});
}
}
postpone(reflection) {
this.reflections.add(reflection);
}
onResolveEnd(context) {
this.finishResolve(context.project);
}
finishResolve(project) {
this.reflections.forEach((reflection) => {
if (reflection.implementedBy) {
reflection.implementedBy.sort((a, b) => {
if (a.name === b.name) {
return 0;
types.forEach((type) => {
if (!(type instanceof types_1.ReferenceType)) {
return;
}
return a.name > b.name ? 1 : -1;
if (!type.reflection ||
!(type.reflection instanceof index_1.DeclarationReflection)) {
return;
}
callback(type.reflection);
});
}
let root;
let hierarchy;
function push(types) {
const level = { types: types };
if (hierarchy) {
hierarchy.next = level;
hierarchy = level;
}
postpone(reflection) {
this.reflections.add(reflection);
}
onResolveEnd(context) {
this.finishResolve(context.project);
}
finishResolve(project) {
this.reflections.forEach((reflection) => {
if (reflection.implementedBy) {
reflection.implementedBy.sort((a, b) => {
if (a.name === b.name) {
return 0;
}
return a.name > b.name ? 1 : -1;
});
}
else {
root = hierarchy = level;
let root;
let hierarchy;
function push(types) {
const level = { types: types };
if (hierarchy) {
hierarchy.next = level;
hierarchy = level;
}
else {
root = hierarchy = level;
}
}
}
if (reflection.extendedTypes) {
push(reflection.extendedTypes);
}
push([
types_1.ReferenceType.createResolvedReference(reflection.name, reflection, project),
]);
hierarchy.isTarget = true;
if (reflection.extendedBy) {
push(reflection.extendedBy);
}
reflection.typeHierarchy = root;
});
}
};
if (reflection.extendedTypes) {
push(reflection.extendedTypes);
}
push([
types_1.ReferenceType.createResolvedReference(reflection.name, reflection, project),
]);
hierarchy.isTarget = true;
if (reflection.extendedBy) {
push(reflection.extendedBy);
}
reflection.typeHierarchy = root;
});
}
};
__setFunctionName(_classThis, "TypePlugin");
(() => {
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
TypePlugin = _classThis = _classDescriptor.value;
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
__runInitializers(_classThis, _classExtraInitializers);
})();
return TypePlugin = _classThis;
})();
exports.TypePlugin = TypePlugin;
exports.TypePlugin = TypePlugin = __decorate([
(0, components_1.Component)({ name: "type" })
], TypePlugin);

@@ -544,3 +544,3 @@ "use strict";

const reflectionContext = context.withScope(reflection);
reflection.signatures ?? (reflection.signatures = []);
reflection.signatures ??= [];
for (const signature of type.getCallSignatures()) {

@@ -547,0 +547,0 @@ (0, signature_1.createSignature)(reflectionContext, models_1.ReflectionKind.CallSignature, signature, symbol);

@@ -32,2 +32,3 @@ "use strict";

intersectionConverter,
intrinsicConverter,
jsDocVariadicTypeConverter,

@@ -266,2 +267,11 @@ keywordConverter,

};
const intrinsicConverter = {
kind: [typescript_1.default.SyntaxKind.IntrinsicKeyword],
convert() {
return new models_1.IntrinsicType("intrinsic");
},
convertType() {
return new models_1.IntrinsicType("intrinsic");
},
};
const jsDocVariadicTypeConverter = {

@@ -268,0 +278,0 @@ kind: [typescript_1.default.SyntaxKind.JSDocVariadicType],

@@ -16,3 +16,3 @@ "use strict";

function gitIsInstalled() {
haveGit ?? (haveGit = git("--version").status === 0);
haveGit ??= git("--version").status === 0;
return haveGit;

@@ -93,3 +93,3 @@ }

return;
gitRevision || (gitRevision = git("-C", path, "rev-parse", "--short", "HEAD").stdout.trim());
gitRevision ||= git("-C", path, "rev-parse", "--short", "HEAD").stdout.trim();
if (!gitRevision)

@@ -96,0 +96,0 @@ return; // Will only happen in a repo with no commits.

@@ -93,2 +93,5 @@ import { Comment } from "../comments/comment";

}
export type ReflectionVisitor = {
[K in keyof ReflectionVariant]?: (refl: ReflectionVariant[K]) => void;
};
/**

@@ -220,2 +223,3 @@ * Base class for all reflection classes.

abstract traverse(callback: TraverseCallback): void;
visit(visitor: ReflectionVisitor): void;
/**

@@ -222,0 +226,0 @@ * Return a string representation of this reflection.

@@ -292,3 +292,3 @@ "use strict";

}
target._aliases || (target._aliases = new Map());
target._aliases ||= new Map();
let suffix = "";

@@ -358,3 +358,12 @@ if (!target._aliases.has(upperAlias)) {

isDeprecated() {
if (this.comment?.getTag("@deprecated")) {
let signaturesDeprecated = false;
this.visit({
declaration(decl) {
if (decl.signatures &&
decl.signatures.every((sig) => sig.comment?.getTag("@deprecated"))) {
signaturesDeprecated = true;
}
},
});
if (signaturesDeprecated || this.comment?.getTag("@deprecated")) {
return true;

@@ -364,2 +373,5 @@ }

}
visit(visitor) {
visitor[this.variant]?.(this);
}
/**

@@ -366,0 +378,0 @@ * Return a string representation of this reflection.

export { Reflection, ReflectionFlag, ReflectionFlags, TraverseProperty, } from "./abstract";
export type { TraverseCallback } from "./abstract";
export type { TraverseCallback, ReflectionVisitor } from "./abstract";
export { ContainerReflection } from "./container";

@@ -4,0 +4,0 @@ export { DeclarationReflection, ConversionFlags } from "./declaration";

@@ -22,3 +22,3 @@ "use strict";

if ("name" in symbol) {
declaration ?? (declaration = symbol?.declarations?.[0]);
declaration ??= symbol?.declarations?.[0];
this.fileName = (0, paths_1.normalizePath)(declaration?.getSourceFile().fileName ?? "\0");

@@ -25,0 +25,0 @@ if (symbol.declarations?.some(typescript_1.default.isSourceFile)) {

@@ -35,2 +35,3 @@ import { Component, AbstractComponent } from "../utils/component";

protected initialize(): void;
private absoluteToRelativePathMap;
/**

@@ -37,0 +38,0 @@ * Transform the given absolute path into a relative path.

@@ -44,2 +44,3 @@ "use strict";

this.urlPrefix = /^(http|ftp)s?:\/\//;
this.absoluteToRelativePathMap = new Map();
}

@@ -55,2 +56,3 @@ /**

[events_1.PageEvent.BEGIN]: this.onBeginPage,
[events_1.RendererEvent.END]: () => this.absoluteToRelativePathMap.clear(),
});

@@ -69,3 +71,9 @@ }

else {
return Path.posix.relative(this.location, absolute) || ".";
const key = `${this.location}:${absolute}`;
let path = this.absoluteToRelativePathMap.get(key);
if (path)
return path;
path = Path.posix.relative(this.location, absolute) || ".";
this.absoluteToRelativePathMap.set(key, path);
return path;
}

@@ -72,0 +80,0 @@ }

@@ -7,3 +7,3 @@ export { PageEvent, RendererEvent, MarkdownEvent, IndexEvent } from "./events";

export { Theme } from "./theme";
export { DefaultTheme } from "./themes/default/DefaultTheme";
export { DefaultTheme, type NavigationElement, } from "./themes/default/DefaultTheme";
export { DefaultThemeRenderContext } from "./themes/default/DefaultThemeRenderContext";

@@ -8,3 +8,3 @@ import { RendererComponent } from "../components";

/** @internal */
customCss: string;
accessor customCss: string;
/**

@@ -11,0 +11,0 @@ * Create a new AssetsPlugin instance.

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -22,43 +65,67 @@ exports.AssetsPlugin = void 0;

*/
let AssetsPlugin = class AssetsPlugin extends components_1.RendererComponent {
/**
* Create a new AssetsPlugin instance.
*/
initialize() {
this.listenTo(this.owner, {
[events_1.RendererEvent.END]: this.onRenderEnd,
[events_1.RendererEvent.BEGIN]: (event) => {
const dest = (0, path_1.join)(event.outputDirectory, "assets");
if (this.customCss) {
if ((0, fs_2.existsSync)(this.customCss)) {
(0, fs_1.copySync)(this.customCss, (0, path_1.join)(dest, "custom.css"));
let AssetsPlugin = (() => {
var _AssetsPlugin_customCss_accessor_storage;
let _classDecorators = [(0, components_1.Component)({ name: "assets" })];
let _classDescriptor;
let _classExtraInitializers = [];
let _classThis;
let _classSuper = components_1.RendererComponent;
let _instanceExtraInitializers = [];
let _customCss_decorators;
let _customCss_initializers = [];
var AssetsPlugin = _classThis = class extends _classSuper {
constructor() {
super(...arguments);
_AssetsPlugin_customCss_accessor_storage.set(this, (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _customCss_initializers, void 0)));
}
/** @internal */
get customCss() { return __classPrivateFieldGet(this, _AssetsPlugin_customCss_accessor_storage, "f"); }
set customCss(value) { __classPrivateFieldSet(this, _AssetsPlugin_customCss_accessor_storage, value, "f"); }
/**
* Create a new AssetsPlugin instance.
*/
initialize() {
this.listenTo(this.owner, {
[events_1.RendererEvent.END]: this.onRenderEnd,
[events_1.RendererEvent.BEGIN]: (event) => {
const dest = (0, path_1.join)(event.outputDirectory, "assets");
if (this.customCss) {
if ((0, fs_2.existsSync)(this.customCss)) {
(0, fs_1.copySync)(this.customCss, (0, path_1.join)(dest, "custom.css"));
}
else {
this.application.logger.error(`Custom CSS file at ${this.customCss} does not exist.`);
event.preventDefault();
}
}
else {
this.application.logger.error(`Custom CSS file at ${this.customCss} does not exist.`);
event.preventDefault();
}
}
},
});
}
/**
* Triggered before the renderer starts rendering a project.
*
* @param event An event object describing the current render operation.
*/
onRenderEnd(event) {
if (this.owner.theme instanceof DefaultTheme_1.DefaultTheme) {
const src = (0, path_1.join)(__dirname, "..", "..", "..", "..", "static");
const dest = (0, path_1.join)(event.outputDirectory, "assets");
(0, fs_1.copySync)(src, dest);
(0, fs_1.writeFileSync)((0, path_1.join)(dest, "highlight.css"), (0, highlighter_1.getStyles)());
},
});
}
}
};
/**
* Triggered before the renderer starts rendering a project.
*
* @param event An event object describing the current render operation.
*/
onRenderEnd(event) {
if (this.owner.theme instanceof DefaultTheme_1.DefaultTheme) {
const src = (0, path_1.join)(__dirname, "..", "..", "..", "..", "static");
const dest = (0, path_1.join)(event.outputDirectory, "assets");
(0, fs_1.copySync)(src, dest);
(0, fs_1.writeFileSync)((0, path_1.join)(dest, "highlight.css"), (0, highlighter_1.getStyles)());
}
}
};
_AssetsPlugin_customCss_accessor_storage = new WeakMap();
__setFunctionName(_classThis, "AssetsPlugin");
(() => {
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
_customCss_decorators = [(0, utils_1.Option)("customCss")];
__esDecorate(_classThis, null, _customCss_decorators, { kind: "accessor", name: "customCss", static: false, private: false, access: { has: obj => "customCss" in obj, get: obj => obj.customCss, set: (obj, value) => { obj.customCss = value; } }, metadata: _metadata }, _customCss_initializers, _instanceExtraInitializers);
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
AssetsPlugin = _classThis = _classDescriptor.value;
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
__runInitializers(_classThis, _classExtraInitializers);
})();
return AssetsPlugin = _classThis;
})();
exports.AssetsPlugin = AssetsPlugin;
__decorate([
(0, utils_1.BindOption)("customCss")
], AssetsPlugin.prototype, "customCss", void 0);
exports.AssetsPlugin = AssetsPlugin = __decorate([
(0, components_1.Component)({ name: "assets" })
], AssetsPlugin);

@@ -0,3 +1,4 @@

export { MarkedPlugin } from "../themes/MarkedPlugin";
export { AssetsPlugin } from "./AssetsPlugin";
export { JavascriptIndexPlugin } from "./JavascriptIndexPlugin";
export { MarkedPlugin } from "../themes/MarkedPlugin";
export { NavigationPlugin } from "./NavigationPlugin";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MarkedPlugin = exports.JavascriptIndexPlugin = exports.AssetsPlugin = void 0;
exports.NavigationPlugin = exports.JavascriptIndexPlugin = exports.AssetsPlugin = exports.MarkedPlugin = void 0;
var MarkedPlugin_1 = require("../themes/MarkedPlugin");
Object.defineProperty(exports, "MarkedPlugin", { enumerable: true, get: function () { return MarkedPlugin_1.MarkedPlugin; } });
var AssetsPlugin_1 = require("./AssetsPlugin");

@@ -8,3 +10,3 @@ Object.defineProperty(exports, "AssetsPlugin", { enumerable: true, get: function () { return AssetsPlugin_1.AssetsPlugin; } });

Object.defineProperty(exports, "JavascriptIndexPlugin", { enumerable: true, get: function () { return JavascriptIndexPlugin_1.JavascriptIndexPlugin; } });
var MarkedPlugin_1 = require("../themes/MarkedPlugin");
Object.defineProperty(exports, "MarkedPlugin", { enumerable: true, get: function () { return MarkedPlugin_1.MarkedPlugin; } });
var NavigationPlugin_1 = require("./NavigationPlugin");
Object.defineProperty(exports, "NavigationPlugin", { enumerable: true, get: function () { return NavigationPlugin_1.NavigationPlugin; } });

@@ -8,3 +8,3 @@ import { RendererComponent } from "../components";

export declare class JavascriptIndexPlugin extends RendererComponent {
searchComments: boolean;
accessor searchComments: boolean;
/**

@@ -20,3 +20,4 @@ * Create a new JavascriptIndexPlugin instance.

private onRendererBegin;
private buildSearchIndex;
private getCommentSearchText;
}

@@ -18,8 +18,36 @@ "use strict";

});
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
var __importStar = (this && this.__importStar) || function (mod) {

@@ -32,2 +60,17 @@ if (mod && mod.__esModule) return mod;

};
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -42,2 +85,5 @@ exports.JavascriptIndexPlugin = void 0;

const DefaultTheme_1 = require("../themes/default/DefaultTheme");
const zlib_1 = require("zlib");
const util_1 = require("util");
const gzipP = (0, util_1.promisify)(zlib_1.gzip);
/**

@@ -48,104 +94,132 @@ * A plugin that exports an index of the project to a javascript file.

*/
let JavascriptIndexPlugin = class JavascriptIndexPlugin extends components_1.RendererComponent {
/**
* Create a new JavascriptIndexPlugin instance.
*/
initialize() {
this.listenTo(this.owner, events_1.RendererEvent.BEGIN, this.onRendererBegin);
}
/**
* Triggered after a document has been rendered, just before it is written to disc.
*
* @param event An event object describing the current render operation.
*/
onRendererBegin(event) {
if (!(this.owner.theme instanceof DefaultTheme_1.DefaultTheme)) {
return;
let JavascriptIndexPlugin = (() => {
var _JavascriptIndexPlugin_searchComments_accessor_storage;
let _classDecorators = [(0, components_1.Component)({ name: "javascript-index" })];
let _classDescriptor;
let _classExtraInitializers = [];
let _classThis;
let _classSuper = components_1.RendererComponent;
let _instanceExtraInitializers = [];
let _searchComments_decorators;
let _searchComments_initializers = [];
var JavascriptIndexPlugin = _classThis = class extends _classSuper {
constructor() {
super(...arguments);
_JavascriptIndexPlugin_searchComments_accessor_storage.set(this, (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _searchComments_initializers, void 0)));
}
if (event.isDefaultPrevented) {
return;
get searchComments() { return __classPrivateFieldGet(this, _JavascriptIndexPlugin_searchComments_accessor_storage, "f"); }
set searchComments(value) { __classPrivateFieldSet(this, _JavascriptIndexPlugin_searchComments_accessor_storage, value, "f"); }
/**
* Create a new JavascriptIndexPlugin instance.
*/
initialize() {
this.listenTo(this.owner, events_1.RendererEvent.BEGIN, this.onRendererBegin);
}
const rows = [];
const initialSearchResults = Object.values(event.project.reflections).filter((refl) => {
return (refl instanceof models_1.DeclarationReflection &&
refl.url &&
refl.name &&
!refl.flags.isExternal);
});
const indexEvent = new events_1.IndexEvent(events_1.IndexEvent.PREPARE_INDEX, initialSearchResults);
this.owner.trigger(indexEvent);
if (indexEvent.isDefaultPrevented) {
return;
/**
* Triggered after a document has been rendered, just before it is written to disc.
*
* @param event An event object describing the current render operation.
*/
onRendererBegin(event) {
if (!(this.owner.theme instanceof DefaultTheme_1.DefaultTheme)) {
return;
}
if (event.isDefaultPrevented) {
return;
}
this.owner.preRenderAsyncJobs.push((event) => this.buildSearchIndex(event));
}
const builder = new lunr_1.Builder();
builder.pipeline.add(lunr_1.trimmer);
builder.ref("id");
for (const [key, boost] of Object.entries(indexEvent.searchFieldWeights)) {
builder.field(key, { boost });
}
for (const reflection of indexEvent.searchResults) {
if (!reflection.url) {
continue;
async buildSearchIndex(event) {
const theme = this.owner.theme;
const rows = [];
const initialSearchResults = Object.values(event.project.reflections).filter((refl) => {
return (refl instanceof models_1.DeclarationReflection &&
refl.url &&
refl.name &&
!refl.flags.isExternal);
});
const indexEvent = new events_1.IndexEvent(events_1.IndexEvent.PREPARE_INDEX, initialSearchResults);
this.owner.trigger(indexEvent);
if (indexEvent.isDefaultPrevented) {
return;
}
const boost = reflection.relevanceBoost ?? 1;
if (boost <= 0) {
continue;
const builder = new lunr_1.Builder();
builder.pipeline.add(lunr_1.trimmer);
builder.ref("id");
for (const [key, boost] of Object.entries(indexEvent.searchFieldWeights)) {
builder.field(key, { boost });
}
let parent = reflection.parent;
if (parent instanceof models_1.ProjectReflection) {
parent = undefined;
for (const reflection of indexEvent.searchResults) {
if (!reflection.url) {
continue;
}
const boost = reflection.relevanceBoost ?? 1;
if (boost <= 0) {
continue;
}
let parent = reflection.parent;
if (parent instanceof models_1.ProjectReflection) {
parent = undefined;
}
const row = {
kind: reflection.kind,
name: reflection.name,
url: reflection.url,
classes: theme.getReflectionClasses(reflection),
};
if (parent) {
row.parent = parent.getFullName();
}
builder.add({
name: reflection.name,
comment: this.getCommentSearchText(reflection),
...indexEvent.searchFields[rows.length],
id: rows.length,
}, { boost });
rows.push(row);
}
const row = {
kind: reflection.kind,
name: reflection.name,
url: reflection.url,
classes: this.owner.theme.getReflectionClasses(reflection),
};
if (parent) {
row.parent = parent.getFullName();
const index = builder.build();
const jsonFileName = Path.join(event.outputDirectory, "assets", "search.js");
const jsonData = JSON.stringify({
rows,
index,
});
const data = await gzipP(Buffer.from(jsonData));
await (0, utils_1.writeFile)(jsonFileName, `window.searchData = "data:application/octet-stream;base64,${data.toString("base64")}";`);
}
getCommentSearchText(reflection) {
if (!this.searchComments)
return;
const comments = [];
if (reflection.comment)
comments.push(reflection.comment);
reflection.signatures?.forEach((s) => s.comment && comments.push(s.comment));
reflection.getSignature?.comment &&
comments.push(reflection.getSignature.comment);
reflection.setSignature?.comment &&
comments.push(reflection.setSignature.comment);
if (!comments.length) {
return;
}
builder.add({
name: reflection.name,
comment: this.getCommentSearchText(reflection),
...indexEvent.searchFields[rows.length],
id: rows.length,
}, { boost });
rows.push(row);
return comments
.flatMap((c) => {
return [...c.summary, ...c.blockTags.flatMap((t) => t.content)];
})
.map((part) => part.text)
.join("\n");
}
const index = builder.build();
const jsonFileName = Path.join(event.outputDirectory, "assets", "search.js");
const jsonData = JSON.stringify({
rows,
index,
});
(0, utils_1.writeFileSync)(jsonFileName, `window.searchData = JSON.parse(${JSON.stringify(jsonData)});`);
}
getCommentSearchText(reflection) {
if (!this.searchComments)
return;
const comments = [];
if (reflection.comment)
comments.push(reflection.comment);
reflection.signatures?.forEach((s) => s.comment && comments.push(s.comment));
reflection.getSignature?.comment &&
comments.push(reflection.getSignature.comment);
reflection.setSignature?.comment &&
comments.push(reflection.setSignature.comment);
if (!comments.length) {
return;
}
return comments
.flatMap((c) => {
return [...c.summary, ...c.blockTags.flatMap((t) => t.content)];
})
.map((part) => part.text)
.join("\n");
}
};
};
_JavascriptIndexPlugin_searchComments_accessor_storage = new WeakMap();
__setFunctionName(_classThis, "JavascriptIndexPlugin");
(() => {
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
_searchComments_decorators = [(0, utils_1.Option)("searchInComments")];
__esDecorate(_classThis, null, _searchComments_decorators, { kind: "accessor", name: "searchComments", static: false, private: false, access: { has: obj => "searchComments" in obj, get: obj => obj.searchComments, set: (obj, value) => { obj.searchComments = value; } }, metadata: _metadata }, _searchComments_initializers, _instanceExtraInitializers);
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
JavascriptIndexPlugin = _classThis = _classDescriptor.value;
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
__runInitializers(_classThis, _classExtraInitializers);
})();
return JavascriptIndexPlugin = _classThis;
})();
exports.JavascriptIndexPlugin = JavascriptIndexPlugin;
__decorate([
(0, utils_1.BindOption)("searchInComments")
], JavascriptIndexPlugin.prototype, "searchComments", void 0);
exports.JavascriptIndexPlugin = JavascriptIndexPlugin = __decorate([
(0, components_1.Component)({ name: "javascript-index" })
], JavascriptIndexPlugin);

@@ -135,17 +135,17 @@ import type { Application } from "../application";

/** @internal */
themeName: string;
accessor themeName: string;
/** @internal */
cleanOutputDir: boolean;
accessor cleanOutputDir: boolean;
/** @internal */
cname: string;
accessor cname: string;
/** @internal */
githubPages: boolean;
accessor githubPages: boolean;
/** @internal */
cacheBust: boolean;
accessor cacheBust: boolean;
/** @internal */
lightTheme: ShikiTheme;
accessor lightTheme: ShikiTheme;
/** @internal */
darkTheme: ShikiTheme;
accessor darkTheme: ShikiTheme;
/** @internal */
pretty: boolean;
accessor pretty: boolean;
renderStartTime: number;

@@ -167,2 +167,4 @@ /**

render(project: ProjectReflection, outputDirectory: string): Promise<void>;
private runPreRenderJobs;
private loadHighlighter;
/**

@@ -169,0 +171,0 @@ * Render a single page.

@@ -18,8 +18,36 @@ "use strict";

});
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
var __importStar = (this && this.__importStar) || function (mod) {

@@ -32,2 +60,17 @@ if (mod && mod.__esModule) return mod;

};
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -53,3 +96,2 @@ exports.Renderer = void 0;

const models_1 = require("../models");
const icon_1 = require("./themes/default/partials/icon");
const type_1 = require("./themes/default/partials/type");

@@ -89,226 +131,297 @@ const jsx_1 = require("../utils/jsx");

*/
let Renderer = class Renderer extends component_1.ChildableComponent {
constructor() {
super(...arguments);
this.themes = new Map([
["default", DefaultTheme_1.DefaultTheme],
]);
let Renderer = (() => {
var _Renderer_themeName_accessor_storage, _Renderer_cleanOutputDir_accessor_storage, _Renderer_cname_accessor_storage, _Renderer_githubPages_accessor_storage, _Renderer_cacheBust_accessor_storage, _Renderer_lightTheme_accessor_storage, _Renderer_darkTheme_accessor_storage, _Renderer_pretty_accessor_storage;
let _classDecorators = [(0, component_1.Component)({ name: "renderer", internal: true, childClass: components_1.RendererComponent })];
let _classDescriptor;
let _classExtraInitializers = [];
let _classThis;
let _classSuper = component_1.ChildableComponent;
let _instanceExtraInitializers = [];
let _themeName_decorators;
let _themeName_initializers = [];
let _cleanOutputDir_decorators;
let _cleanOutputDir_initializers = [];
let _cname_decorators;
let _cname_initializers = [];
let _githubPages_decorators;
let _githubPages_initializers = [];
let _cacheBust_decorators;
let _cacheBust_initializers = [];
let _lightTheme_decorators;
let _lightTheme_initializers = [];
let _darkTheme_decorators;
let _darkTheme_initializers = [];
let _pretty_decorators;
let _pretty_initializers = [];
var Renderer = _classThis = class extends _classSuper {
constructor() {
super(...arguments);
this.themes = (__runInitializers(this, _instanceExtraInitializers), new Map([
["default", DefaultTheme_1.DefaultTheme],
]));
/**
* A list of async jobs which must be completed *before* rendering output.
* They will be called after {@link RendererEvent.BEGIN} has fired, but before any files have been written.
*
* This may be used by plugins to register work that must be done to prepare output files. For example: asynchronously
* transform markdown to HTML.
*
* Note: This array is cleared after calling the contained functions on each {@link Renderer.render} call.
*/
this.preRenderAsyncJobs = [];
/**
* A list of async jobs which must be completed after rendering output files but before generation is considered successful.
* These functions will be called after all documents have been written to the filesystem.
*
* This may be used by plugins to register work that must be done to finalize output files. For example: asynchronously
* generating an image referenced in a render hook.
*
* Note: This array is cleared after calling the contained functions on each {@link Renderer.render} call.
*/
this.postRenderAsyncJobs = [];
/**
* Hooks which will be called when rendering pages.
* Note:
* - Hooks added during output will be discarded at the end of rendering.
* - Hooks added during a page render will be discarded at the end of that page's render.
*
* See {@link RendererHooks} for a description of each available hook, and when it will be called.
*/
this.hooks = new utils_1.EventHooks();
_Renderer_themeName_accessor_storage.set(this, __runInitializers(this, _themeName_initializers, void 0));
_Renderer_cleanOutputDir_accessor_storage.set(this, __runInitializers(this, _cleanOutputDir_initializers, void 0));
_Renderer_cname_accessor_storage.set(this, __runInitializers(this, _cname_initializers, void 0));
_Renderer_githubPages_accessor_storage.set(this, __runInitializers(this, _githubPages_initializers, void 0));
_Renderer_cacheBust_accessor_storage.set(this, __runInitializers(this, _cacheBust_initializers, void 0));
_Renderer_lightTheme_accessor_storage.set(this, __runInitializers(this, _lightTheme_initializers, void 0));
_Renderer_darkTheme_accessor_storage.set(this, __runInitializers(this, _darkTheme_initializers, void 0));
_Renderer_pretty_accessor_storage.set(this, __runInitializers(this, _pretty_initializers, void 0));
this.renderStartTime = -1;
}
/** @internal */
get themeName() { return __classPrivateFieldGet(this, _Renderer_themeName_accessor_storage, "f"); }
set themeName(value) { __classPrivateFieldSet(this, _Renderer_themeName_accessor_storage, value, "f"); }
/** @internal */
get cleanOutputDir() { return __classPrivateFieldGet(this, _Renderer_cleanOutputDir_accessor_storage, "f"); }
set cleanOutputDir(value) { __classPrivateFieldSet(this, _Renderer_cleanOutputDir_accessor_storage, value, "f"); }
/** @internal */
get cname() { return __classPrivateFieldGet(this, _Renderer_cname_accessor_storage, "f"); }
set cname(value) { __classPrivateFieldSet(this, _Renderer_cname_accessor_storage, value, "f"); }
/** @internal */
get githubPages() { return __classPrivateFieldGet(this, _Renderer_githubPages_accessor_storage, "f"); }
set githubPages(value) { __classPrivateFieldSet(this, _Renderer_githubPages_accessor_storage, value, "f"); }
/** @internal */
get cacheBust() { return __classPrivateFieldGet(this, _Renderer_cacheBust_accessor_storage, "f"); }
set cacheBust(value) { __classPrivateFieldSet(this, _Renderer_cacheBust_accessor_storage, value, "f"); }
/** @internal */
get lightTheme() { return __classPrivateFieldGet(this, _Renderer_lightTheme_accessor_storage, "f"); }
set lightTheme(value) { __classPrivateFieldSet(this, _Renderer_lightTheme_accessor_storage, value, "f"); }
/** @internal */
get darkTheme() { return __classPrivateFieldGet(this, _Renderer_darkTheme_accessor_storage, "f"); }
set darkTheme(value) { __classPrivateFieldSet(this, _Renderer_darkTheme_accessor_storage, value, "f"); }
/** @internal */
get pretty() { return __classPrivateFieldGet(this, _Renderer_pretty_accessor_storage, "f"); }
set pretty(value) { __classPrivateFieldSet(this, _Renderer_pretty_accessor_storage, value, "f"); }
/**
* A list of async jobs which must be completed *before* rendering output.
* They will be called after {@link RendererEvent.BEGIN} has fired, but before any files have been written.
*
* This may be used by plugins to register work that must be done to prepare output files. For example: asynchronously
* transform markdown to HTML.
*
* Note: This array is cleared after calling the contained functions on each {@link Renderer.render} call.
* Define a new theme that can be used to render output.
* This API will likely be changing at some point, to allow more easily overriding parts of the theme without
* requiring additional boilerplate.
* @param name
* @param theme
*/
this.preRenderAsyncJobs = [];
defineTheme(name, theme) {
if (this.themes.has(name)) {
throw new Error(`The theme "${name}" has already been defined.`);
}
this.themes.set(name, theme);
}
/**
* A list of async jobs which must be completed after rendering output files but before generation is considered successful.
* These functions will be called after all documents have been written to the filesystem.
* Render the given project reflection to the specified output directory.
*
* This may be used by plugins to register work that must be done to finalize output files. For example: asynchronously
* generating an image referenced in a render hook.
*
* Note: This array is cleared after calling the contained functions on each {@link Renderer.render} call.
* @param project The project that should be rendered.
* @param outputDirectory The path of the directory the documentation should be rendered to.
*/
this.postRenderAsyncJobs = [];
/**
* Hooks which will be called when rendering pages.
* Note:
* - Hooks added during output will be discarded at the end of rendering.
* - Hooks added during a page render will be discarded at the end of that page's render.
*
* See {@link RendererHooks} for a description of each available hook, and when it will be called.
*/
this.hooks = new utils_1.EventHooks();
this.renderStartTime = -1;
}
/**
* Define a new theme that can be used to render output.
* This API will likely be changing at some point, to allow more easily overriding parts of the theme without
* requiring additional boilerplate.
* @param name
* @param theme
*/
defineTheme(name, theme) {
if (this.themes.has(name)) {
throw new Error(`The theme "${name}" has already been defined.`);
}
this.themes.set(name, theme);
}
/**
* Render the given project reflection to the specified output directory.
*
* @param project The project that should be rendered.
* @param outputDirectory The path of the directory the documentation should be rendered to.
*/
async render(project, outputDirectory) {
(0, jsx_1.setRenderSettings)({ pretty: this.pretty });
const momento = this.hooks.saveMomento();
this.renderStartTime = Date.now();
await (0, highlighter_1.loadHighlighter)(this.lightTheme, this.darkTheme);
this.application.logger.verbose(`Renderer: Loading highlighter took ${Date.now() - this.renderStartTime}ms`);
if (!this.prepareTheme() ||
!(await this.prepareOutputDirectory(outputDirectory))) {
return;
}
const output = new events_1.RendererEvent(events_1.RendererEvent.BEGIN, outputDirectory, project);
output.urls = this.theme.getUrls(project);
this.trigger(output);
await Promise.all(this.preRenderAsyncJobs.map((job) => job(output)));
this.preRenderAsyncJobs = [];
if (!output.isDefaultPrevented) {
this.application.logger.verbose(`There are ${output.urls.length} pages to write.`);
output.urls.forEach((mapping) => {
(0, icon_1.clearSeenIconCache)();
this.renderDocument(...output.createPageEvent(mapping));
(0, type_1.validateStateIsClean)(mapping.url);
});
await Promise.all(this.postRenderAsyncJobs.map((job) => job(output)));
this.postRenderAsyncJobs = [];
this.trigger(events_1.RendererEvent.END, output);
}
this.theme = void 0;
this.hooks.restoreMomento(momento);
}
/**
* Render a single page.
*
* @param page An event describing the current page.
* @return TRUE if the page has been saved to disc, otherwise FALSE.
*/
renderDocument(template, page) {
const momento = this.hooks.saveMomento();
this.trigger(events_1.PageEvent.BEGIN, page);
if (page.isDefaultPrevented) {
async render(project, outputDirectory) {
(0, jsx_1.setRenderSettings)({ pretty: this.pretty });
const momento = this.hooks.saveMomento();
this.renderStartTime = Date.now();
if (!this.prepareTheme() ||
!(await this.prepareOutputDirectory(outputDirectory))) {
return;
}
const output = new events_1.RendererEvent(events_1.RendererEvent.BEGIN, outputDirectory, project);
output.urls = this.theme.getUrls(project);
this.trigger(output);
await this.runPreRenderJobs(output);
if (!output.isDefaultPrevented) {
this.application.logger.verbose(`There are ${output.urls.length} pages to write.`);
output.urls.forEach((mapping) => {
this.renderDocument(...output.createPageEvent(mapping));
(0, type_1.validateStateIsClean)(mapping.url);
});
await Promise.all(this.postRenderAsyncJobs.map((job) => job(output)));
this.postRenderAsyncJobs = [];
this.trigger(events_1.RendererEvent.END, output);
}
this.theme = void 0;
this.hooks.restoreMomento(momento);
return false;
}
if (page.model instanceof models_1.Reflection) {
page.contents = this.theme.render(page, template);
async runPreRenderJobs(output) {
const start = Date.now();
this.preRenderAsyncJobs.push(this.loadHighlighter.bind(this));
await Promise.all(this.preRenderAsyncJobs.map((job) => job(output)));
this.preRenderAsyncJobs = [];
this.application.logger.verbose(`Pre render async jobs took ${Date.now() - start}ms`);
}
else {
throw new Error("Should be unreachable");
async loadHighlighter() {
await (0, highlighter_1.loadHighlighter)(this.lightTheme, this.darkTheme);
}
this.trigger(events_1.PageEvent.END, page);
this.hooks.restoreMomento(momento);
if (page.isDefaultPrevented) {
return false;
}
try {
(0, fs_1.writeFileSync)(page.filename, page.contents);
}
catch (error) {
this.application.logger.error(`Could not write ${page.filename}`);
}
}
/**
* Ensure that a theme has been setup.
*
* If a the user has set a theme we try to find and load it. If no theme has
* been specified we load the default theme.
*
* @returns TRUE if a theme has been setup, otherwise FALSE.
*/
prepareTheme() {
if (!this.theme) {
const ctor = this.themes.get(this.themeName);
if (!ctor) {
this.application.logger.error(`The theme '${this.themeName}' is not defined. The available themes are: ${[
...this.themes.keys(),
].join(", ")}`);
/**
* Render a single page.
*
* @param page An event describing the current page.
* @return TRUE if the page has been saved to disc, otherwise FALSE.
*/
renderDocument(template, page) {
const momento = this.hooks.saveMomento();
this.trigger(events_1.PageEvent.BEGIN, page);
if (page.isDefaultPrevented) {
this.hooks.restoreMomento(momento);
return false;
}
if (page.model instanceof models_1.Reflection) {
page.contents = this.theme.render(page, template);
}
else {
this.theme = new ctor(this);
throw new Error("Should be unreachable");
}
}
return true;
}
/**
* Prepare the output directory. If the directory does not exist, it will be
* created. If the directory exists, it will be emptied.
*
* @param directory The path to the directory that should be prepared.
* @returns TRUE if the directory could be prepared, otherwise FALSE.
*/
async prepareOutputDirectory(directory) {
if (this.cleanOutputDir) {
this.trigger(events_1.PageEvent.END, page);
this.hooks.restoreMomento(momento);
if (page.isDefaultPrevented) {
return false;
}
try {
await fs.promises.rm(directory, {
recursive: true,
force: true,
});
(0, fs_1.writeFileSync)(page.filename, page.contents);
}
catch (error) {
this.application.logger.warn("Could not empty the output directory.");
return false;
this.application.logger.error(`Could not write ${page.filename}`);
}
}
try {
fs.mkdirSync(directory, { recursive: true });
/**
* Ensure that a theme has been setup.
*
* If a the user has set a theme we try to find and load it. If no theme has
* been specified we load the default theme.
*
* @returns TRUE if a theme has been setup, otherwise FALSE.
*/
prepareTheme() {
if (!this.theme) {
const ctor = this.themes.get(this.themeName);
if (!ctor) {
this.application.logger.error(`The theme '${this.themeName}' is not defined. The available themes are: ${[
...this.themes.keys(),
].join(", ")}`);
return false;
}
else {
this.theme = new ctor(this);
}
}
return true;
}
catch (error) {
this.application.logger.error(`Could not create output directory ${directory}.`);
return false;
}
if (this.githubPages) {
/**
* Prepare the output directory. If the directory does not exist, it will be
* created. If the directory exists, it will be emptied.
*
* @param directory The path to the directory that should be prepared.
* @returns TRUE if the directory could be prepared, otherwise FALSE.
*/
async prepareOutputDirectory(directory) {
if (this.cleanOutputDir) {
try {
await fs.promises.rm(directory, {
recursive: true,
force: true,
});
}
catch (error) {
this.application.logger.warn("Could not empty the output directory.");
return false;
}
}
try {
const text = "TypeDoc added this file to prevent GitHub Pages from " +
"using Jekyll. You can turn off this behavior by setting " +
"the `githubPages` option to false.";
fs.writeFileSync(path.join(directory, ".nojekyll"), text);
fs.mkdirSync(directory, { recursive: true });
}
catch (error) {
this.application.logger.warn("Could not create .nojekyll file.");
this.application.logger.error(`Could not create output directory ${directory}.`);
return false;
}
if (this.githubPages) {
try {
const text = "TypeDoc added this file to prevent GitHub Pages from " +
"using Jekyll. You can turn off this behavior by setting " +
"the `githubPages` option to false.";
fs.writeFileSync(path.join(directory, ".nojekyll"), text);
}
catch (error) {
this.application.logger.warn("Could not create .nojekyll file.");
return false;
}
}
if (this.cname) {
fs.writeFileSync(path.join(directory, "CNAME"), this.cname);
}
return true;
}
if (this.cname) {
fs.writeFileSync(path.join(directory, "CNAME"), this.cname);
}
return true;
}
};
};
_Renderer_themeName_accessor_storage = new WeakMap();
_Renderer_cleanOutputDir_accessor_storage = new WeakMap();
_Renderer_cname_accessor_storage = new WeakMap();
_Renderer_githubPages_accessor_storage = new WeakMap();
_Renderer_cacheBust_accessor_storage = new WeakMap();
_Renderer_lightTheme_accessor_storage = new WeakMap();
_Renderer_darkTheme_accessor_storage = new WeakMap();
_Renderer_pretty_accessor_storage = new WeakMap();
__setFunctionName(_classThis, "Renderer");
(() => {
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
_themeName_decorators = [(0, utils_1.Option)("theme")];
_cleanOutputDir_decorators = [(0, utils_1.Option)("cleanOutputDir")];
_cname_decorators = [(0, utils_1.Option)("cname")];
_githubPages_decorators = [(0, utils_1.Option)("githubPages")];
_cacheBust_decorators = [(0, utils_1.Option)("cacheBust")];
_lightTheme_decorators = [(0, utils_1.Option)("lightHighlightTheme")];
_darkTheme_decorators = [(0, utils_1.Option)("darkHighlightTheme")];
_pretty_decorators = [(0, utils_1.Option)("pretty")];
__esDecorate(_classThis, null, _themeName_decorators, { kind: "accessor", name: "themeName", static: false, private: false, access: { has: obj => "themeName" in obj, get: obj => obj.themeName, set: (obj, value) => { obj.themeName = value; } }, metadata: _metadata }, _themeName_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _cleanOutputDir_decorators, { kind: "accessor", name: "cleanOutputDir", static: false, private: false, access: { has: obj => "cleanOutputDir" in obj, get: obj => obj.cleanOutputDir, set: (obj, value) => { obj.cleanOutputDir = value; } }, metadata: _metadata }, _cleanOutputDir_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _cname_decorators, { kind: "accessor", name: "cname", static: false, private: false, access: { has: obj => "cname" in obj, get: obj => obj.cname, set: (obj, value) => { obj.cname = value; } }, metadata: _metadata }, _cname_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _githubPages_decorators, { kind: "accessor", name: "githubPages", static: false, private: false, access: { has: obj => "githubPages" in obj, get: obj => obj.githubPages, set: (obj, value) => { obj.githubPages = value; } }, metadata: _metadata }, _githubPages_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _cacheBust_decorators, { kind: "accessor", name: "cacheBust", static: false, private: false, access: { has: obj => "cacheBust" in obj, get: obj => obj.cacheBust, set: (obj, value) => { obj.cacheBust = value; } }, metadata: _metadata }, _cacheBust_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _lightTheme_decorators, { kind: "accessor", name: "lightTheme", static: false, private: false, access: { has: obj => "lightTheme" in obj, get: obj => obj.lightTheme, set: (obj, value) => { obj.lightTheme = value; } }, metadata: _metadata }, _lightTheme_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _darkTheme_decorators, { kind: "accessor", name: "darkTheme", static: false, private: false, access: { has: obj => "darkTheme" in obj, get: obj => obj.darkTheme, set: (obj, value) => { obj.darkTheme = value; } }, metadata: _metadata }, _darkTheme_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _pretty_decorators, { kind: "accessor", name: "pretty", static: false, private: false, access: { has: obj => "pretty" in obj, get: obj => obj.pretty, set: (obj, value) => { obj.pretty = value; } }, metadata: _metadata }, _pretty_initializers, _instanceExtraInitializers);
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
Renderer = _classThis = _classDescriptor.value;
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
})();
/** @event */
_classThis.EVENT_BEGIN_PAGE = events_1.PageEvent.BEGIN;
/** @event */
_classThis.EVENT_END_PAGE = events_1.PageEvent.END;
/** @event */
_classThis.EVENT_BEGIN = events_1.RendererEvent.BEGIN;
/** @event */
_classThis.EVENT_END = events_1.RendererEvent.END;
/** @event */
_classThis.EVENT_PREPARE_INDEX = events_1.IndexEvent.PREPARE_INDEX;
(() => {
__runInitializers(_classThis, _classExtraInitializers);
})();
return Renderer = _classThis;
})();
exports.Renderer = Renderer;
/** @event */
Renderer.EVENT_BEGIN_PAGE = events_1.PageEvent.BEGIN;
/** @event */
Renderer.EVENT_END_PAGE = events_1.PageEvent.END;
/** @event */
Renderer.EVENT_BEGIN = events_1.RendererEvent.BEGIN;
/** @event */
Renderer.EVENT_END = events_1.RendererEvent.END;
/** @event */
Renderer.EVENT_PREPARE_INDEX = events_1.IndexEvent.PREPARE_INDEX;
__decorate([
(0, utils_1.BindOption)("theme")
], Renderer.prototype, "themeName", void 0);
__decorate([
(0, utils_1.BindOption)("cleanOutputDir")
], Renderer.prototype, "cleanOutputDir", void 0);
__decorate([
(0, utils_1.BindOption)("cname")
], Renderer.prototype, "cname", void 0);
__decorate([
(0, utils_1.BindOption)("githubPages")
], Renderer.prototype, "githubPages", void 0);
__decorate([
(0, utils_1.BindOption)("cacheBust")
], Renderer.prototype, "cacheBust", void 0);
__decorate([
(0, utils_1.BindOption)("lightHighlightTheme")
], Renderer.prototype, "lightTheme", void 0);
__decorate([
(0, utils_1.BindOption)("darkHighlightTheme")
], Renderer.prototype, "darkTheme", void 0);
__decorate([
(0, utils_1.BindOption)("pretty")
], Renderer.prototype, "pretty", void 0);
exports.Renderer = Renderer = __decorate([
(0, component_1.Component)({ name: "renderer", internal: true, childClass: components_1.RendererComponent })
], Renderer);
// HACK: THIS HAS TO STAY DOWN HERE
// if you try to move it up to the top of the file, then you'll run into stuff being used before it has been defined.
require("./plugins");
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -20,15 +52,28 @@ exports.Theme = void 0;

*/
let Theme = class Theme extends components_1.RendererComponent {
/**
* Create a new BaseTheme instance.
*
* @param renderer The renderer this theme is attached to.
*/
constructor(renderer) {
super(renderer);
}
};
let Theme = (() => {
let _classDecorators = [(0, component_1.Component)({ name: "theme", internal: true })];
let _classDescriptor;
let _classExtraInitializers = [];
let _classThis;
let _classSuper = components_1.RendererComponent;
var Theme = _classThis = class extends _classSuper {
/**
* Create a new BaseTheme instance.
*
* @param renderer The renderer this theme is attached to.
*/
constructor(renderer) {
super(renderer);
}
};
__setFunctionName(_classThis, "Theme");
(() => {
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
Theme = _classThis = _classDescriptor.value;
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
__runInitializers(_classThis, _classExtraInitializers);
})();
return Theme = _classThis;
})();
exports.Theme = Theme;
exports.Theme = Theme = __decorate([
(0, component_1.Component)({ name: "theme", internal: true })
], Theme);
import { Theme } from "../../theme";
import type { Renderer } from "../../renderer";
import { Reflection, ProjectReflection, ContainerReflection, DeclarationReflection } from "../../../models";
import { Reflection, ReflectionKind, ProjectReflection, ContainerReflection, DeclarationReflection } from "../../../models";
import { RenderTemplate, UrlMapping } from "../../models/UrlMapping";

@@ -9,2 +9,9 @@ import type { PageEvent } from "../../events";

import { JSX } from "../../../utils";
export interface NavigationElement {
text: string;
path?: string;
kind?: ReflectionKind;
class?: string;
children?: NavigationElement[];
}
/**

@@ -67,3 +74,9 @@ * Default theme implementation of TypeDoc. If a theme does not provide a custom

render(page: PageEvent<Reflection>, template: RenderTemplate<PageEvent<Reflection>>): string;
private _navigationCache;
/**
* If implementing a custom theme, it is recommended to override {@link buildNavigation} instead.
*/
getNavigation(project: ProjectReflection): NavigationElement[];
buildNavigation(project: ProjectReflection): NavigationElement[];
/**
* Generate an anchor url for the given reflection and all of its children.

@@ -70,0 +83,0 @@ *

@@ -172,2 +172,70 @@ "use strict";

/**
* If implementing a custom theme, it is recommended to override {@link buildNavigation} instead.
*/
getNavigation(project) {
// This is ok because currently TypeDoc wipes out the theme after each render.
// Might need to change in the future, but it's fine for now.
if (this._navigationCache) {
return this._navigationCache;
}
return (this._navigationCache = this.buildNavigation(project));
}
buildNavigation(project) {
// eslint-disable-next-line @typescript-eslint/no-this-alias
const theme = this;
const opts = this.application.options.getValue("navigation");
if (opts.fullTree) {
this.application.logger.warn(`The navigation.fullTree option no longer has any affect and will be removed in v0.26`);
}
return getNavigationElements(project) || [];
function toNavigation(element) {
if (element instanceof models_1.ReflectionCategory || element instanceof models_1.ReflectionGroup) {
return {
text: element.title,
children: getNavigationElements(element),
};
}
return {
text: (0, lib_1.getDisplayName)(element),
path: element.url,
kind: element.kind,
class: (0, lib_1.classNames)({ deprecated: element.isDeprecated() }, theme.getReflectionClasses(element)),
children: getNavigationElements(element),
};
}
function getNavigationElements(parent) {
if (parent instanceof models_1.ReflectionCategory) {
return parent.children.map(toNavigation);
}
if (parent instanceof models_1.ReflectionGroup) {
if (shouldShowCategories(parent.owningReflection, opts) && parent.categories) {
return parent.categories.map(toNavigation);
}
return parent.children.map(toNavigation);
}
if (!parent.kindOf(models_1.ReflectionKind.SomeModule | models_1.ReflectionKind.Project)) {
return;
}
if (parent.categories && shouldShowCategories(parent, opts)) {
return parent.categories.map(toNavigation);
}
if (parent.groups && shouldShowGroups(parent, opts)) {
return parent.groups.map(toNavigation);
}
return parent.children?.map(toNavigation);
}
function shouldShowCategories(reflection, opts) {
if (opts.includeCategories) {
return !reflection.comment?.hasModifier("@hideCategories");
}
return reflection.comment?.hasModifier("@showCategories") === true;
}
function shouldShowGroups(reflection, opts) {
if (opts.includeGroups) {
return !reflection.comment?.hasModifier("@hideGroups");
}
return reflection.comment?.hasModifier("@showGroups") === true;
}
}
/**
* Generate an anchor url for the given reflection and all of its children.

@@ -174,0 +242,0 @@ *

import type { PageEvent, RendererHooks } from "../..";
import { CommentDisplayPart, DeclarationReflection, Reflection } from "../../../models";
import type { NeverIfInternal, Options } from "../../../utils";
import type { JSX, NeverIfInternal, Options } from "../../../utils";
import type { DefaultTheme } from "./DefaultTheme";
import { icons } from "./partials/icon";
export declare class DefaultThemeRenderContext {
private theme;
page: PageEvent<Reflection>;
private _iconsCache;
private _refIcons;
options: Options;
constructor(theme: DefaultTheme, page: PageEvent<Reflection>, options: Options);
icons: Record<"search" | "anchor" | import("../../../models").ReflectionKind | "checkbox" | "chevronDown" | "menu" | "chevronSmall", () => import("../../../utils/jsx.elements").JsxElement>;
hook: (name: keyof RendererHooks) => import("../../../utils/jsx.elements").JsxElement[];
iconsCache(): JSX.Element;
get icons(): Readonly<typeof icons>;
set icons(value: Readonly<typeof icons>);
hook: (name: keyof RendererHooks) => JSX.Element[];
/** Avoid this in favor of urlTo if possible */

@@ -16,41 +21,42 @@ relativeURL: (url: string, cacheBust?: boolean) => string;

markdown: (md: readonly CommentDisplayPart[] | NeverIfInternal<string | undefined>) => string;
getNavigation: () => import("./DefaultTheme").NavigationElement[];
getReflectionClasses: (refl: DeclarationReflection) => string;
reflectionTemplate: (props: PageEvent<import("../../../models").ContainerReflection>) => import("../../../utils/jsx.elements").JsxElement;
indexTemplate: (props: PageEvent<import("../../../models").ProjectReflection>) => import("../../../utils/jsx.elements").JsxElement;
defaultLayout: (template: import("../..").RenderTemplate<PageEvent<Reflection>>, props: PageEvent<Reflection>) => import("../../../utils/jsx.elements").JsxElement;
analytics: () => import("../../../utils/jsx.elements").JsxElement | undefined;
breadcrumb: (props: Reflection) => import("../../../utils/jsx.elements").JsxElement | undefined;
commentSummary: (props: Reflection) => import("../../../utils/jsx.elements").JsxElement | undefined;
commentTags: (props: Reflection) => import("../../../utils/jsx.elements").JsxElement | undefined;
reflectionFlags: (props: Reflection) => import("../../../utils/jsx.elements").JsxElement;
footer: () => import("../../../utils/jsx.elements").JsxElement | undefined;
header: (props: PageEvent<Reflection>) => import("../../../utils/jsx.elements").JsxElement;
hierarchy: (props: import("../../../models").DeclarationHierarchy | undefined) => import("../../../utils/jsx.elements").JsxElement | undefined;
index: (props: import("../../../models").ContainerReflection) => import("../../../utils/jsx.elements").JsxElement;
member: (props: DeclarationReflection) => import("../../../utils/jsx.elements").JsxElement;
memberDeclaration: (props: DeclarationReflection) => import("../../../utils/jsx.elements").JsxElement;
memberGetterSetter: (props: DeclarationReflection) => import("../../../utils/jsx.elements").JsxElement;
memberReference: (props: import("../../../models").ReferenceReflection) => import("../../../utils/jsx.elements").JsxElement;
reflectionTemplate: (props: PageEvent<import("../../../models").ContainerReflection>) => JSX.Element;
indexTemplate: (props: PageEvent<import("../../../models").ProjectReflection>) => JSX.Element;
defaultLayout: (template: import("../..").RenderTemplate<PageEvent<Reflection>>, props: PageEvent<Reflection>) => JSX.Element;
analytics: () => JSX.Element | undefined;
breadcrumb: (props: Reflection) => JSX.Element | undefined;
commentSummary: (props: Reflection) => JSX.Element | undefined;
commentTags: (props: Reflection) => JSX.Element | undefined;
reflectionFlags: (props: Reflection) => JSX.Element;
footer: () => JSX.Element | undefined;
header: (props: PageEvent<Reflection>) => JSX.Element;
hierarchy: (props: import("../../../models").DeclarationHierarchy | undefined) => JSX.Element | undefined;
index: (props: import("../../../models").ContainerReflection) => JSX.Element;
member: (props: DeclarationReflection) => JSX.Element;
memberDeclaration: (props: DeclarationReflection) => JSX.Element;
memberGetterSetter: (props: DeclarationReflection) => JSX.Element;
memberReference: (props: import("../../../models").ReferenceReflection) => JSX.Element;
memberSignatureBody: (r_0: import("../../../models").SignatureReflection, r_1?: {
hideSources?: boolean | undefined;
} | undefined) => import("../../../utils/jsx.elements").JsxElement;
} | undefined) => JSX.Element;
memberSignatureTitle: (r_0: import("../../../models").SignatureReflection, r_1?: {
hideName?: boolean | undefined;
arrowStyle?: boolean | undefined;
} | undefined) => import("../../../utils/jsx.elements").JsxElement;
memberSignatures: (props: DeclarationReflection) => import("../../../utils/jsx.elements").JsxElement;
memberSources: (props: import("../../../models").SignatureReflection | DeclarationReflection) => import("../../../utils/jsx.elements").JsxElement;
members: (props: import("../../../models").ContainerReflection) => import("../../../utils/jsx.elements").JsxElement;
membersGroup: (group: import("../../../models").ReflectionGroup) => import("../../../utils/jsx.elements").JsxElement;
sidebar: (props: PageEvent<Reflection>) => import("../../../utils/jsx.elements").JsxElement;
pageSidebar: (props: PageEvent<Reflection>) => import("../../../utils/jsx.elements").JsxElement;
sidebarLinks: () => import("../../../utils/jsx.elements").JsxElement | null;
settings: () => import("../../../utils/jsx.elements").JsxElement;
navigation: (props: PageEvent<Reflection>) => import("../../../utils/jsx.elements").JsxElement;
pageNavigation: (props: PageEvent<Reflection>) => import("../../../utils/jsx.elements").JsxElement;
parameter: (props: DeclarationReflection) => import("../../../utils/jsx.elements").JsxElement;
toolbar: (props: PageEvent<Reflection>) => import("../../../utils/jsx.elements").JsxElement;
type: (type: import("../../../models").Type | undefined) => import("../../../utils/jsx.elements").JsxElement;
typeAndParent: (props: import("../../../models").Type) => import("../../../utils/jsx.elements").JsxElement;
typeParameters: (typeParameters: import("../../../models").TypeParameterReflection[]) => import("../../../utils/jsx.elements").JsxElement;
} | undefined) => JSX.Element;
memberSignatures: (props: DeclarationReflection) => JSX.Element;
memberSources: (props: import("../../../models").SignatureReflection | DeclarationReflection) => JSX.Element;
members: (props: import("../../../models").ContainerReflection) => JSX.Element;
membersGroup: (group: import("../../../models").ReflectionGroup) => JSX.Element;
sidebar: (props: PageEvent<Reflection>) => JSX.Element;
pageSidebar: (props: PageEvent<Reflection>) => JSX.Element;
sidebarLinks: () => JSX.Element | null;
settings: () => JSX.Element;
navigation: (props: PageEvent<Reflection>) => JSX.Element;
pageNavigation: (props: PageEvent<Reflection>) => JSX.Element;
parameter: (props: DeclarationReflection) => JSX.Element;
toolbar: (props: PageEvent<Reflection>) => JSX.Element;
type: (type: import("../../../models").Type | undefined) => JSX.Element;
typeAndParent: (props: import("../../../models").Type) => JSX.Element;
typeParameters: (typeParameters: import("../../../models").TypeParameterReflection[]) => JSX.Element;
}

@@ -39,3 +39,2 @@ "use strict";

this.page = page;
this.icons = icon_1.icons;
this.hook = (name) => this.theme.owner.hooks.emit(name, this);

@@ -59,2 +58,3 @@ /** Avoid this in favor of urlTo if possible */

};
this.getNavigation = () => this.theme.getNavigation(this.page.project);
this.getReflectionClasses = (refl) => this.theme.getReflectionClasses(refl);

@@ -95,4 +95,18 @@ this.reflectionTemplate = bind(reflection_1.reflectionTemplate, this);

this.options = options;
const { refs, cache } = (0, icon_1.buildRefIcons)(icon_1.icons);
this._refIcons = refs;
this._iconsCache = cache;
}
iconsCache() {
return this._iconsCache;
}
get icons() {
return this._refIcons;
}
set icons(value) {
const { refs, cache } = (0, icon_1.buildRefIcons)(value);
this._refIcons = refs;
this._iconsCache = cache;
}
}
exports.DefaultThemeRenderContext = DefaultThemeRenderContext;

@@ -21,2 +21,3 @@ "use strict";

utils_1.JSX.createElement("script", { async: true, src: context.relativeURL("assets/search.js", true), id: "tsd-search-script" }),
utils_1.JSX.createElement("script", { async: true, src: context.relativeURL("assets/navigation.js", true), id: "tsd-nav-script" }),
context.hook("head.end")),

@@ -46,3 +47,4 @@ utils_1.JSX.createElement("body", null,

context.analytics(),
context.iconsCache(),
context.hook("body.end"))));
exports.defaultLayout = defaultLayout;

@@ -11,3 +11,3 @@ "use strict";

!!props.model.parent && utils_1.JSX.createElement("ul", { class: "tsd-breadcrumb" }, context.breadcrumb(props.model)),
utils_1.JSX.createElement(HeadingLevel, null,
utils_1.JSX.createElement(HeadingLevel, { class: (0, lib_1.classNames)({ deprecated: props.model.isDeprecated() }) },
props.model.kind !== models_1.ReflectionKind.Project && `${models_1.ReflectionKind.singularString(props.model.kind)} `,

@@ -14,0 +14,0 @@ (0, lib_1.getDisplayName)(props.model),

import { ReflectionKind } from "../../../../models";
import { JSX } from "../../../../utils";
export declare function clearSeenIconCache(): void;
export declare function buildRefIcons<T extends Record<string, () => JSX.Element>>(icons: T): {
refs: T;
cache: JSX.Element;
};
export declare const icons: Record<ReflectionKind | "chevronDown" | "checkbox" | "menu" | "search" | "chevronSmall" | "anchor", () => JSX.Element>;
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.icons = exports.clearSeenIconCache = void 0;
exports.icons = exports.buildRefIcons = void 0;
const assert_1 = __importDefault(require("assert"));
const models_1 = require("../../../../models");
const utils_1 = require("../../../../utils");
const seenIcons = new Set();
function clearSeenIconCache() {
seenIcons.clear();
}
exports.clearSeenIconCache = clearSeenIconCache;
function cachedPart(key, svgPart) {
if (seenIcons.has(key)) {
return utils_1.JSX.createElement("use", { href: `#icon-${key}` });
const kindIcon = (letterPath, color, circular = false) => (utils_1.JSX.createElement("svg", { class: "tsd-kind-icon", viewBox: "0 0 24 24" },
utils_1.JSX.createElement("rect", { fill: "var(--color-icon-background)", stroke: color, "stroke-width": "1.5", x: "1", y: "1", width: "22", height: "22", rx: circular ? "12" : "6" }),
letterPath));
function buildRefIcons(icons) {
const refs = {};
const children = [];
for (const [name, builder] of Object.entries(icons)) {
const jsx = builder.call(icons);
(0, assert_1.default)(jsx.tag === "svg", "TypeDoc's frontend assumes that icons are written as svg elements");
children.push(utils_1.JSX.createElement("g", { id: `icon-${name}` }, jsx.children));
const ref = (utils_1.JSX.createElement("svg", { ...jsx.props, id: undefined },
utils_1.JSX.createElement("use", { href: `#icon-${name}` })));
refs[name] = () => ref;
}
seenIcons.add(key);
return {
...svgPart,
props: {
...svgPart.props,
id: `icon-${key}`,
},
refs: refs,
cache: utils_1.JSX.createElement("svg", { style: "display: none" }, children),
};
}
const kindIcon = (kind, letterPath, color, circular = false) => (utils_1.JSX.createElement("svg", { class: "tsd-kind-icon", viewBox: "0 0 24 24" }, cachedPart(`${kind}`, utils_1.JSX.createElement("g", null,
utils_1.JSX.createElement("rect", { fill: "var(--color-icon-background)", stroke: color, "stroke-width": "1.5", x: "1", y: "1", width: "22", height: "22", rx: circular ? "12" : "6" }),
letterPath))));
exports.buildRefIcons = buildRefIcons;
exports.icons = {
[models_1.ReflectionKind.Accessor]: () => kindIcon(models_1.ReflectionKind.Accessor, utils_1.JSX.createElement("path", { d: "M8.85 16L11.13 7.24H12.582L14.85 16H13.758L13.182 13.672H10.53L9.954 16H8.85ZM10.746 12.76H12.954L12.282 10.06C12.154 9.548 12.054 9.12 11.982 8.776C11.91 8.432 11.866 8.208 11.85 8.104C11.834 8.208 11.79 8.432 11.718 8.776C11.646 9.12 11.546 9.544 11.418 10.048L10.746 12.76Z", fill: "var(--color-text)" }), "#FF4D4D", true),
[models_1.ReflectionKind.Accessor]: () => kindIcon(utils_1.JSX.createElement("path", { d: "M8.85 16L11.13 7.24H12.582L14.85 16H13.758L13.182 13.672H10.53L9.954 16H8.85ZM10.746 12.76H12.954L12.282 10.06C12.154 9.548 12.054 9.12 11.982 8.776C11.91 8.432 11.866 8.208 11.85 8.104C11.834 8.208 11.79 8.432 11.718 8.776C11.646 9.12 11.546 9.544 11.418 10.048L10.746 12.76Z", fill: "var(--color-text)" }), "#FF4D4D", true),
[models_1.ReflectionKind.CallSignature]() {
return this[models_1.ReflectionKind.Function]();
},
[models_1.ReflectionKind.Class]: () => kindIcon(models_1.ReflectionKind.Class, utils_1.JSX.createElement("path", { d: "M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z", fill: "var(--color-text)" }), "var(--color-ts-class)"),
[models_1.ReflectionKind.Constructor]: () => kindIcon(models_1.ReflectionKind.Constructor, utils_1.JSX.createElement("path", { d: "M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z", fill: "var(--color-text)" }), "#4D7FFF", true),
[models_1.ReflectionKind.Class]: () => kindIcon(utils_1.JSX.createElement("path", { d: "M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z", fill: "var(--color-text)" }), "var(--color-ts-class)"),
[models_1.ReflectionKind.Constructor]: () => kindIcon(utils_1.JSX.createElement("path", { d: "M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z", fill: "var(--color-text)" }), "#4D7FFF", true),
[models_1.ReflectionKind.ConstructorSignature]() {
return this[models_1.ReflectionKind.Constructor]();
},
[models_1.ReflectionKind.Enum]: () => kindIcon(models_1.ReflectionKind.Enum, utils_1.JSX.createElement("path", { d: "M9.45 16V7.24H14.49V8.224H10.518V10.936H14.07V11.908H10.518V15.016H14.49V16H9.45Z", fill: "var(--color-text)" }), "var(--color-ts-enum)"),
[models_1.ReflectionKind.Enum]: () => kindIcon(utils_1.JSX.createElement("path", { d: "M9.45 16V7.24H14.49V8.224H10.518V10.936H14.07V11.908H10.518V15.016H14.49V16H9.45Z", fill: "var(--color-text)" }), "var(--color-ts-enum)"),
[models_1.ReflectionKind.EnumMember]() {
return this[models_1.ReflectionKind.Property]();
},
[models_1.ReflectionKind.Function]: () => kindIcon(models_1.ReflectionKind.Function, utils_1.JSX.createElement("path", { d: "M9.39 16V7.24H14.55V8.224H10.446V11.128H14.238V12.112H10.47V16H9.39Z", fill: "var(--color-text)" }), "var(--color-ts-function)"),
[models_1.ReflectionKind.Function]: () => kindIcon(utils_1.JSX.createElement("path", { d: "M9.39 16V7.24H14.55V8.224H10.446V11.128H14.238V12.112H10.47V16H9.39Z", fill: "var(--color-text)" }), "var(--color-ts-function)"),
[models_1.ReflectionKind.GetSignature]() {

@@ -48,8 +51,8 @@ return this[models_1.ReflectionKind.Accessor]();

},
[models_1.ReflectionKind.Interface]: () => kindIcon(models_1.ReflectionKind.Interface, utils_1.JSX.createElement("path", { d: "M9.51 16V15.016H11.298V8.224H9.51V7.24H14.19V8.224H12.402V15.016H14.19V16H9.51Z", fill: "var(--color-text)" }), "var(--color-ts-interface)"),
[models_1.ReflectionKind.Method]: () => kindIcon(models_1.ReflectionKind.Method, utils_1.JSX.createElement("path", { d: "M9.162 16V7.24H10.578L11.514 10.072C11.602 10.328 11.674 10.584 11.73 10.84C11.794 11.088 11.842 11.28 11.874 11.416C11.906 11.28 11.954 11.088 12.018 10.84C12.082 10.584 12.154 10.324 12.234 10.06L13.122 7.24H14.538V16H13.482V12.82C13.482 12.468 13.49 12.068 13.506 11.62C13.53 11.172 13.558 10.716 13.59 10.252C13.622 9.78 13.654 9.332 13.686 8.908C13.726 8.476 13.762 8.1 13.794 7.78L12.366 12.16H11.334L9.894 7.78C9.934 8.092 9.97 8.456 10.002 8.872C10.042 9.28 10.078 9.716 10.11 10.18C10.142 10.636 10.166 11.092 10.182 11.548C10.206 12.004 10.218 12.428 10.218 12.82V16H9.162Z", fill: "var(--color-text)" }), "#FF4DB8", true),
[models_1.ReflectionKind.Interface]: () => kindIcon(utils_1.JSX.createElement("path", { d: "M9.51 16V15.016H11.298V8.224H9.51V7.24H14.19V8.224H12.402V15.016H14.19V16H9.51Z", fill: "var(--color-text)" }), "var(--color-ts-interface)"),
[models_1.ReflectionKind.Method]: () => kindIcon(utils_1.JSX.createElement("path", { d: "M9.162 16V7.24H10.578L11.514 10.072C11.602 10.328 11.674 10.584 11.73 10.84C11.794 11.088 11.842 11.28 11.874 11.416C11.906 11.28 11.954 11.088 12.018 10.84C12.082 10.584 12.154 10.324 12.234 10.06L13.122 7.24H14.538V16H13.482V12.82C13.482 12.468 13.49 12.068 13.506 11.62C13.53 11.172 13.558 10.716 13.59 10.252C13.622 9.78 13.654 9.332 13.686 8.908C13.726 8.476 13.762 8.1 13.794 7.78L12.366 12.16H11.334L9.894 7.78C9.934 8.092 9.97 8.456 10.002 8.872C10.042 9.28 10.078 9.716 10.11 10.18C10.142 10.636 10.166 11.092 10.182 11.548C10.206 12.004 10.218 12.428 10.218 12.82V16H9.162Z", fill: "var(--color-text)" }), "#FF4DB8", true),
[models_1.ReflectionKind.Module]() {
return this[models_1.ReflectionKind.Namespace]();
},
[models_1.ReflectionKind.Namespace]: () => kindIcon(models_1.ReflectionKind.Namespace, utils_1.JSX.createElement("path", { d: "M9.33 16V7.24H10.77L13.446 14.74C13.43 14.54 13.41 14.296 13.386 14.008C13.37 13.712 13.354 13.404 13.338 13.084C13.33 12.756 13.326 12.448 13.326 12.16V7.24H14.37V16H12.93L10.266 8.5C10.282 8.692 10.298 8.936 10.314 9.232C10.33 9.52 10.342 9.828 10.35 10.156C10.366 10.476 10.374 10.784 10.374 11.08V16H9.33Z", fill: "var(--color-text)" }), "var(--color-ts-namespace)"),
[models_1.ReflectionKind.Namespace]: () => kindIcon(utils_1.JSX.createElement("path", { d: "M9.33 16V7.24H10.77L13.446 14.74C13.43 14.54 13.41 14.296 13.386 14.008C13.37 13.712 13.354 13.404 13.338 13.084C13.33 12.756 13.326 12.448 13.326 12.16V7.24H14.37V16H12.93L10.266 8.5C10.282 8.692 10.298 8.936 10.314 9.232C10.33 9.52 10.342 9.828 10.35 10.156C10.366 10.476 10.374 10.784 10.374 11.08V16H9.33Z", fill: "var(--color-text)" }), "var(--color-ts-namespace)"),
[models_1.ReflectionKind.Parameter]() {

@@ -61,4 +64,4 @@ return this[models_1.ReflectionKind.Property]();

},
[models_1.ReflectionKind.Property]: () => kindIcon(models_1.ReflectionKind.Property, utils_1.JSX.createElement("path", { d: "M9.354 16V7.24H12.174C12.99 7.24 13.638 7.476 14.118 7.948C14.606 8.412 14.85 9.036 14.85 9.82C14.85 10.604 14.606 11.232 14.118 11.704C13.638 12.168 12.99 12.4 12.174 12.4H10.434V16H9.354ZM10.434 11.428H12.174C12.646 11.428 13.022 11.284 13.302 10.996C13.59 10.7 13.734 10.308 13.734 9.82C13.734 9.324 13.59 8.932 13.302 8.644C13.022 8.356 12.646 8.212 12.174 8.212H10.434V11.428Z", fill: "var(--color-text)" }), "#FF984D", true),
[models_1.ReflectionKind.Reference]: () => kindIcon(models_1.ReflectionKind.Reference, utils_1.JSX.createElement("path", { d: "M10.354 17V8.24H13.066C13.586 8.24 14.042 8.348 14.434 8.564C14.826 8.772 15.13 9.064 15.346 9.44C15.562 9.816 15.67 10.256 15.67 10.76C15.67 11.352 15.514 11.86 15.202 12.284C14.898 12.708 14.482 13 13.954 13.16L15.79 17H14.518L12.838 13.28H11.434V17H10.354ZM11.434 12.308H13.066C13.514 12.308 13.874 12.168 14.146 11.888C14.418 11.6 14.554 11.224 14.554 10.76C14.554 10.288 14.418 9.912 14.146 9.632C13.874 9.352 13.514 9.212 13.066 9.212H11.434V12.308Z", fill: "var(--color-text)" }), "#FF4D82", // extract into a CSS variable potentially?
[models_1.ReflectionKind.Property]: () => kindIcon(utils_1.JSX.createElement("path", { d: "M9.354 16V7.24H12.174C12.99 7.24 13.638 7.476 14.118 7.948C14.606 8.412 14.85 9.036 14.85 9.82C14.85 10.604 14.606 11.232 14.118 11.704C13.638 12.168 12.99 12.4 12.174 12.4H10.434V16H9.354ZM10.434 11.428H12.174C12.646 11.428 13.022 11.284 13.302 10.996C13.59 10.7 13.734 10.308 13.734 9.82C13.734 9.324 13.59 8.932 13.302 8.644C13.022 8.356 12.646 8.212 12.174 8.212H10.434V11.428Z", fill: "var(--color-text)" }), "#FF984D", true),
[models_1.ReflectionKind.Reference]: () => kindIcon(utils_1.JSX.createElement("path", { d: "M10.354 17V8.24H13.066C13.586 8.24 14.042 8.348 14.434 8.564C14.826 8.772 15.13 9.064 15.346 9.44C15.562 9.816 15.67 10.256 15.67 10.76C15.67 11.352 15.514 11.86 15.202 12.284C14.898 12.708 14.482 13 13.954 13.16L15.79 17H14.518L12.838 13.28H11.434V17H10.354ZM11.434 12.308H13.066C13.514 12.308 13.874 12.168 14.146 11.888C14.418 11.6 14.554 11.224 14.554 10.76C14.554 10.288 14.418 9.912 14.146 9.632C13.874 9.352 13.514 9.212 13.066 9.212H11.434V12.308Z", fill: "var(--color-text)" }), "#FF4D82", // extract into a CSS variable potentially?
true),

@@ -68,3 +71,3 @@ [models_1.ReflectionKind.SetSignature]() {

},
[models_1.ReflectionKind.TypeAlias]: () => kindIcon(models_1.ReflectionKind.TypeAlias, utils_1.JSX.createElement("path", { d: "M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z", fill: "var(--color-text)" }), "var(--color-ts-type-alias)"),
[models_1.ReflectionKind.TypeAlias]: () => kindIcon(utils_1.JSX.createElement("path", { d: "M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z", fill: "var(--color-text)" }), "var(--color-ts-type-alias)"),
[models_1.ReflectionKind.TypeLiteral]() {

@@ -76,4 +79,5 @@ return this[models_1.ReflectionKind.TypeAlias]();

},
[models_1.ReflectionKind.Variable]: () => kindIcon(models_1.ReflectionKind.Variable, utils_1.JSX.createElement("path", { d: "M11.106 16L8.85 7.24H9.966L11.454 13.192C11.558 13.608 11.646 13.996 11.718 14.356C11.79 14.708 11.842 14.976 11.874 15.16C11.906 14.976 11.954 14.708 12.018 14.356C12.09 13.996 12.178 13.608 12.282 13.192L13.758 7.24H14.85L12.582 16H11.106Z", fill: "var(--color-text)" }), "var(--color-ts-variable)"),
chevronDown: () => (utils_1.JSX.createElement("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none" }, cachedPart("chevronDown", utils_1.JSX.createElement("path", { d: "M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z", fill: "var(--color-text)" })))),
[models_1.ReflectionKind.Variable]: () => kindIcon(utils_1.JSX.createElement("path", { d: "M11.106 16L8.85 7.24H9.966L11.454 13.192C11.558 13.608 11.646 13.996 11.718 14.356C11.79 14.708 11.842 14.976 11.874 15.16C11.906 14.976 11.954 14.708 12.018 14.356C12.09 13.996 12.178 13.608 12.282 13.192L13.758 7.24H14.85L12.582 16H11.106Z", fill: "var(--color-text)" }), "var(--color-ts-variable)"),
chevronDown: () => (utils_1.JSX.createElement("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none" },
utils_1.JSX.createElement("path", { d: "M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z", fill: "var(--color-text)" }))),
chevronSmall: () => (utils_1.JSX.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" },

@@ -87,6 +91,7 @@ utils_1.JSX.createElement("path", { d: "M1.5 5.50969L8 11.6609L14.5 5.50969L12.5466 3.66086L8 7.96494L3.45341 3.66086L1.5 5.50969Z", fill: "var(--color-text)" }))),

utils_1.JSX.createElement("path", { d: "M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z", fill: "var(--color-text)" }))),
anchor: () => (utils_1.JSX.createElement("svg", { viewBox: "0 0 24 24" }, cachedPart("anchor", utils_1.JSX.createElement("g", { "stroke-width": "2", stroke: "currentColor", fill: "none", "stroke-linecap": "round", "stroke-linejoin": "round" },
utils_1.JSX.createElement("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
utils_1.JSX.createElement("path", { d: "M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" }),
utils_1.JSX.createElement("path", { d: "M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" }))))),
anchor: () => (utils_1.JSX.createElement("svg", { viewBox: "0 0 24 24" },
utils_1.JSX.createElement("g", { "stroke-width": "2", stroke: "currentColor", fill: "none", "stroke-linecap": "round", "stroke-linejoin": "round" },
utils_1.JSX.createElement("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
utils_1.JSX.createElement("path", { d: "M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" }),
utils_1.JSX.createElement("path", { d: "M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" })))),
};

@@ -26,3 +26,3 @@ "use strict";

context.commentSummary(item),
context.reflectionFlags(item),
context.commentTags(item),
item.type instanceof models_1.ReflectionType && context.parameter(item.type.declaration))))))),

@@ -29,0 +29,0 @@ props.type && (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,

@@ -7,2 +7,3 @@ "use strict";

const lib_1 = require("../../lib");
const MAX_EMBEDDED_NAV_SIZE = 20;
function sidebar(context, props) {

@@ -66,73 +67,39 @@ return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,

exports.settings = settings;
function shouldShowCategories(reflection, opts) {
if (opts.includeCategories) {
return !reflection.comment?.hasModifier("@hideCategories");
}
return reflection.comment?.hasModifier("@showCategories") === true;
}
function shouldShowGroups(reflection, opts) {
if (opts.includeGroups) {
return !reflection.comment?.hasModifier("@hideGroups");
}
return reflection.comment?.hasModifier("@showGroups") === true;
}
const getNavigationElements = function getNavigationElements(parent, opts) {
if (parent instanceof models_1.ReflectionCategory) {
return parent.children;
}
if (parent instanceof models_1.ReflectionGroup) {
if (shouldShowCategories(parent.owningReflection, opts) && parent.categories) {
return parent.categories;
}
return parent.children;
}
if (!parent.kindOf(models_1.ReflectionKind.SomeModule | models_1.ReflectionKind.Project)) {
return;
}
if (parent.categories && shouldShowCategories(parent, opts)) {
return parent.categories;
}
if (parent.groups && shouldShowGroups(parent, opts)) {
return parent.groups;
}
return parent.children;
};
const navigation = function navigation(context, props) {
const opts = context.options.getValue("navigation");
// Create the navigation for the current page
// Recurse to children if the parent is some kind of module
return (utils_1.JSX.createElement("nav", { class: "tsd-navigation" },
createNavElement(props.project),
utils_1.JSX.createElement("ul", { class: "tsd-small-nested-navigation" }, getNavigationElements(props.project, opts)?.map((c) => utils_1.JSX.createElement("li", null, links(c, []))))));
function links(mod, parents) {
const nameClasses = (0, lib_1.classNames)({ deprecated: mod instanceof models_1.Reflection && mod.isDeprecated() }, mod instanceof models_1.DeclarationReflection ? context.getReflectionClasses(mod) : void 0);
const children = getNavigationElements(mod, opts);
if (!children || (!opts.fullTree && mod instanceof models_1.Reflection && !inPath(mod))) {
return createNavElement(mod, nameClasses);
const nav = context.getNavigation();
let elements = 0;
function link(el, path = []) {
if (elements > MAX_EMBEDDED_NAV_SIZE) {
return utils_1.JSX.createElement(utils_1.JSX.Fragment, null);
}
const childParents = mod instanceof models_1.Reflection ? [mod.getFullName()] : [...parents, mod.title];
return (utils_1.JSX.createElement("details", { class: (0, lib_1.classNames)({ "tsd-index-accordion": true }, nameClasses), open: mod instanceof models_1.Reflection && inPath(mod), "data-key": childParents.join("$") },
utils_1.JSX.createElement("summary", { class: "tsd-accordion-summary" },
context.icons.chevronDown(),
createNavElement(mod)),
utils_1.JSX.createElement("div", { class: "tsd-accordion-details" },
utils_1.JSX.createElement("ul", { class: "tsd-nested-navigation" }, children.map((c) => (utils_1.JSX.createElement("li", null, links(c, childParents))))))));
}
function createNavElement(child, nameClasses) {
if (child instanceof models_1.Reflection) {
return (utils_1.JSX.createElement("a", { href: context.urlTo(child), class: (0, lib_1.classNames)({ current: child === props.model }, nameClasses) },
context.icons[child.kind](),
utils_1.JSX.createElement("span", null, (0, lib_1.wbr)((0, lib_1.getDisplayName)(child)))));
if (el.path) {
++elements;
return (utils_1.JSX.createElement("li", null,
utils_1.JSX.createElement("a", { href: context.relativeURL(el.path), class: (0, lib_1.classNames)({ current: props.model.url === el.path }, el.class) },
el.kind && context.icons[el.kind](),
el.text)));
}
return utils_1.JSX.createElement("span", null, child.title);
// Top level element is a group/category, recurse so that we don't have a half-broken
// navigation tree for people with JS turned off.
if (el.children) {
++elements;
const fullPath = [...path, el.text];
return (utils_1.JSX.createElement("details", { class: (0, lib_1.classNames)({ "tsd-index-accordion": true }, el.class), "data-key": fullPath.join("$") },
utils_1.JSX.createElement("summary", { class: "tsd-accordion-summary" },
context.icons.chevronDown(),
utils_1.JSX.createElement("span", null, el.text)),
utils_1.JSX.createElement("div", { class: "tsd-accordion-details" },
utils_1.JSX.createElement("ul", { class: "tsd-nested-navigation" }, el.children.map((c) => link(c, fullPath))))));
}
return (utils_1.JSX.createElement("li", null,
utils_1.JSX.createElement("span", null, el.text)));
}
function inPath(mod) {
let iter = props.model;
do {
if (iter == mod)
return true;
iter = iter.parent;
} while (iter);
return false;
}
const navEl = nav.map((el) => link(el));
return (utils_1.JSX.createElement("nav", { class: "tsd-navigation" },
utils_1.JSX.createElement("a", { href: context.urlTo(props.project), class: (0, lib_1.classNames)({ current: props.project === props.model }) },
context.icons[models_1.ReflectionKind.Project](),
utils_1.JSX.createElement("span", null, (0, lib_1.getDisplayName)(props.project))),
utils_1.JSX.createElement("ul", { class: "tsd-small-nested-navigation", id: "tsd-nav-container", "data-base": context.relativeURL("./") },
navEl,
elements < MAX_EMBEDDED_NAV_SIZE || utils_1.JSX.createElement("li", null, "Loading..."))));
};

@@ -139,0 +106,0 @@ exports.navigation = navigation;

@@ -9,6 +9,6 @@ import { ContextAwareRendererComponent } from "../components";

export declare class MarkedPlugin extends ContextAwareRendererComponent {
includeSource: string;
mediaSource: string;
lightTheme: Theme;
darkTheme: Theme;
accessor includeSource: string;
accessor mediaSource: string;
accessor lightTheme: Theme;
accessor darkTheme: Theme;
/**

@@ -15,0 +15,0 @@ * The path referenced files are located in.

@@ -18,8 +18,36 @@ "use strict";

});
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
var __importStar = (this && this.__importStar) || function (mod) {

@@ -32,2 +60,17 @@ if (mod && mod.__esModule) return mod;

};
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -47,34 +90,62 @@ exports.MarkedPlugin = void 0;

*/
let MarkedPlugin = class MarkedPlugin extends components_1.ContextAwareRendererComponent {
constructor() {
super(...arguments);
let MarkedPlugin = (() => {
var _MarkedPlugin_includeSource_accessor_storage, _MarkedPlugin_mediaSource_accessor_storage, _MarkedPlugin_lightTheme_accessor_storage, _MarkedPlugin_darkTheme_accessor_storage;
let _classDecorators = [(0, components_1.Component)({ name: "marked" })];
let _classDescriptor;
let _classExtraInitializers = [];
let _classThis;
let _classSuper = components_1.ContextAwareRendererComponent;
let _instanceExtraInitializers = [];
let _includeSource_decorators;
let _includeSource_initializers = [];
let _mediaSource_decorators;
let _mediaSource_initializers = [];
let _lightTheme_decorators;
let _lightTheme_initializers = [];
let _darkTheme_decorators;
let _darkTheme_initializers = [];
var MarkedPlugin = _classThis = class extends _classSuper {
constructor() {
super(...arguments);
_MarkedPlugin_includeSource_accessor_storage.set(this, (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _includeSource_initializers, void 0)));
_MarkedPlugin_mediaSource_accessor_storage.set(this, __runInitializers(this, _mediaSource_initializers, void 0));
_MarkedPlugin_lightTheme_accessor_storage.set(this, __runInitializers(this, _lightTheme_initializers, void 0));
_MarkedPlugin_darkTheme_accessor_storage.set(this, __runInitializers(this, _darkTheme_initializers, void 0));
/**
* The pattern used to find references in markdown.
*/
this.includePattern = /\[\[include:([^\]]+?)\]\]/g;
/**
* The pattern used to find media links.
*/
this.mediaPattern = /media:\/\/([^ ")\]}]+)/g;
}
get includeSource() { return __classPrivateFieldGet(this, _MarkedPlugin_includeSource_accessor_storage, "f"); }
set includeSource(value) { __classPrivateFieldSet(this, _MarkedPlugin_includeSource_accessor_storage, value, "f"); }
get mediaSource() { return __classPrivateFieldGet(this, _MarkedPlugin_mediaSource_accessor_storage, "f"); }
set mediaSource(value) { __classPrivateFieldSet(this, _MarkedPlugin_mediaSource_accessor_storage, value, "f"); }
get lightTheme() { return __classPrivateFieldGet(this, _MarkedPlugin_lightTheme_accessor_storage, "f"); }
set lightTheme(value) { __classPrivateFieldSet(this, _MarkedPlugin_lightTheme_accessor_storage, value, "f"); }
get darkTheme() { return __classPrivateFieldGet(this, _MarkedPlugin_darkTheme_accessor_storage, "f"); }
set darkTheme(value) { __classPrivateFieldSet(this, _MarkedPlugin_darkTheme_accessor_storage, value, "f"); }
/**
* The pattern used to find references in markdown.
* Create a new MarkedPlugin instance.
*/
this.includePattern = /\[\[include:([^\]]+?)\]\]/g;
initialize() {
super.initialize();
this.listenTo(this.owner, events_1.MarkdownEvent.PARSE, this.onParseMarkdown);
}
/**
* The pattern used to find media links.
* Highlight the syntax of the given text using HighlightJS.
*
* @param text The text that should be highlighted.
* @param lang The language that should be used to highlight the string.
* @return A html string with syntax highlighting.
*/
this.mediaPattern = /media:\/\/([^ ")\]}]+)/g;
}
/**
* Create a new MarkedPlugin instance.
*/
initialize() {
super.initialize();
this.listenTo(this.owner, events_1.MarkdownEvent.PARSE, this.onParseMarkdown);
}
/**
* Highlight the syntax of the given text using HighlightJS.
*
* @param text The text that should be highlighted.
* @param lang The language that should be used to highlight the string.
* @return A html string with syntax highlighting.
*/
getHighlighted(text, lang) {
lang = lang || "typescript";
lang = lang.toLowerCase();
if (!(0, highlighter_1.isSupportedLanguage)(lang)) {
// Extra newline because of the progress bar
this.application.logger.warn(`
getHighlighted(text, lang) {
lang = lang || "typescript";
lang = lang.toLowerCase();
if (!(0, highlighter_1.isSupportedLanguage)(lang)) {
// Extra newline because of the progress bar
this.application.logger.warn(`
Unsupported highlight language "${lang}" will not be highlighted. Run typedoc --help for a list of supported languages.

@@ -86,127 +157,134 @@ target code block :

\t${this.outputFileName}`);
return text;
return text;
}
return (0, highlighter_1.highlight)(text, lang);
}
return (0, highlighter_1.highlight)(text, lang);
}
/**
* Parse the given markdown string and return the resulting html.
*
* @param text The markdown string that should be parsed.
* @returns The resulting html string.
*/
parseMarkdown(text, page) {
if (this.includes) {
text = text.replace(this.includePattern, (_match, path) => {
path = Path.join(this.includes, path.trim());
if ((0, utils_1.isFile)(path)) {
const contents = (0, utils_1.readFile)(path);
const event = new events_1.MarkdownEvent(events_1.MarkdownEvent.INCLUDE, page, contents, contents);
this.owner.trigger(event);
return event.parsedText;
/**
* Parse the given markdown string and return the resulting html.
*
* @param text The markdown string that should be parsed.
* @returns The resulting html string.
*/
parseMarkdown(text, page) {
if (this.includes) {
text = text.replace(this.includePattern, (_match, path) => {
path = Path.join(this.includes, path.trim());
if ((0, utils_1.isFile)(path)) {
const contents = (0, utils_1.readFile)(path);
const event = new events_1.MarkdownEvent(events_1.MarkdownEvent.INCLUDE, page, contents, contents);
this.owner.trigger(event);
return event.parsedText;
}
else {
this.application.logger.warn("Could not find file to include: " + path);
return "";
}
});
}
if (this.mediaDirectory) {
text = text.replace(this.mediaPattern, (match, path) => {
const fileName = Path.join(this.mediaDirectory, path);
if ((0, utils_1.isFile)(fileName)) {
return this.getRelativeUrl("media") + "/" + path;
}
else {
this.application.logger.warn("Could not find media file: " + fileName);
return match;
}
});
}
const event = new events_1.MarkdownEvent(events_1.MarkdownEvent.PARSE, page, text, text);
this.owner.trigger(event);
return event.parsedText;
}
/**
* Triggered before the renderer starts rendering a project.
*
* @param event An event object describing the current render operation.
*/
onBeginRenderer(event) {
super.onBeginRenderer(event);
Marked.marked.setOptions(this.createMarkedOptions());
delete this.includes;
if (this.includeSource) {
if (fs.existsSync(this.includeSource) &&
fs.statSync(this.includeSource).isDirectory()) {
this.includes = this.includeSource;
}
else {
this.application.logger.warn("Could not find file to include: " + path);
return "";
this.application.logger.warn("Could not find provided includes directory: " +
this.includeSource);
}
});
}
if (this.mediaDirectory) {
text = text.replace(this.mediaPattern, (match, path) => {
const fileName = Path.join(this.mediaDirectory, path);
if ((0, utils_1.isFile)(fileName)) {
return this.getRelativeUrl("media") + "/" + path;
}
if (this.mediaSource) {
if (fs.existsSync(this.mediaSource) &&
fs.statSync(this.mediaSource).isDirectory()) {
this.mediaDirectory = Path.join(event.outputDirectory, "media");
(0, utils_1.copySync)(this.mediaSource, this.mediaDirectory);
}
else {
this.application.logger.warn("Could not find media file: " + fileName);
return match;
this.mediaDirectory = undefined;
this.application.logger.warn("Could not find provided media directory: " +
this.mediaSource);
}
});
}
const event = new events_1.MarkdownEvent(events_1.MarkdownEvent.PARSE, page, text, text);
this.owner.trigger(event);
return event.parsedText;
}
/**
* Triggered before the renderer starts rendering a project.
*
* @param event An event object describing the current render operation.
*/
onBeginRenderer(event) {
super.onBeginRenderer(event);
Marked.marked.setOptions(this.createMarkedOptions());
delete this.includes;
if (this.includeSource) {
if (fs.existsSync(this.includeSource) &&
fs.statSync(this.includeSource).isDirectory()) {
this.includes = this.includeSource;
}
else {
this.application.logger.warn("Could not find provided includes directory: " +
this.includeSource);
}
}
if (this.mediaSource) {
if (fs.existsSync(this.mediaSource) &&
fs.statSync(this.mediaSource).isDirectory()) {
this.mediaDirectory = Path.join(event.outputDirectory, "media");
(0, utils_1.copySync)(this.mediaSource, this.mediaDirectory);
/**
* Creates an object with options that are passed to the markdown parser.
*
* @returns The options object for the markdown parser.
*/
createMarkedOptions() {
const markedOptions = (this.application.options.getValue("markedOptions") ?? {});
// Set some default values if they are not specified via the TypeDoc option
markedOptions.highlight ??= (text, lang) => this.getHighlighted(text, lang);
if (!markedOptions.renderer) {
markedOptions.renderer = new Marked.Renderer();
markedOptions.renderer.heading = (text, level, _, slugger) => {
const slug = slugger.slug(text);
// Prefix the slug with an extra `md:` to prevent conflicts with TypeDoc's anchors.
this.page.pageHeadings.push({
link: `#md:${slug}`,
text: (0, html_1.getTextContent)(text),
level,
});
return `<a id="md:${slug}" class="tsd-anchor"></a><h${level}><a href="#md:${slug}">${text}</a></h${level}>`;
};
markedOptions.renderer.code = renderCode;
}
else {
this.mediaDirectory = undefined;
this.application.logger.warn("Could not find provided media directory: " +
this.mediaSource);
}
markedOptions.mangle ??= false; // See https://github.com/TypeStrong/typedoc/issues/1395
return markedOptions;
}
}
/**
* Creates an object with options that are passed to the markdown parser.
*
* @returns The options object for the markdown parser.
*/
createMarkedOptions() {
const markedOptions = (this.application.options.getValue("markedOptions") ?? {});
// Set some default values if they are not specified via the TypeDoc option
markedOptions.highlight ?? (markedOptions.highlight = (text, lang) => this.getHighlighted(text, lang));
if (!markedOptions.renderer) {
markedOptions.renderer = new Marked.Renderer();
markedOptions.renderer.heading = (text, level, _, slugger) => {
const slug = slugger.slug(text);
// Prefix the slug with an extra `md:` to prevent conflicts with TypeDoc's anchors.
this.page.pageHeadings.push({
link: `#md:${slug}`,
text: (0, html_1.getTextContent)(text),
level,
});
return `<a id="md:${slug}" class="tsd-anchor"></a><h${level}><a href="#md:${slug}">${text}</a></h${level}>`;
};
markedOptions.renderer.code = renderCode;
/**
* Triggered when {@link MarkedPlugin} parses a markdown string.
*
* @param event
*/
onParseMarkdown(event) {
event.parsedText = Marked.marked(event.parsedText);
}
markedOptions.mangle ?? (markedOptions.mangle = false); // See https://github.com/TypeStrong/typedoc/issues/1395
return markedOptions;
}
/**
* Triggered when {@link MarkedPlugin} parses a markdown string.
*
* @param event
*/
onParseMarkdown(event) {
event.parsedText = Marked.marked(event.parsedText);
}
};
};
_MarkedPlugin_includeSource_accessor_storage = new WeakMap();
_MarkedPlugin_mediaSource_accessor_storage = new WeakMap();
_MarkedPlugin_lightTheme_accessor_storage = new WeakMap();
_MarkedPlugin_darkTheme_accessor_storage = new WeakMap();
__setFunctionName(_classThis, "MarkedPlugin");
(() => {
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
_includeSource_decorators = [(0, utils_1.Option)("includes")];
_mediaSource_decorators = [(0, utils_1.Option)("media")];
_lightTheme_decorators = [(0, utils_1.Option)("lightHighlightTheme")];
_darkTheme_decorators = [(0, utils_1.Option)("darkHighlightTheme")];
__esDecorate(_classThis, null, _includeSource_decorators, { kind: "accessor", name: "includeSource", static: false, private: false, access: { has: obj => "includeSource" in obj, get: obj => obj.includeSource, set: (obj, value) => { obj.includeSource = value; } }, metadata: _metadata }, _includeSource_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _mediaSource_decorators, { kind: "accessor", name: "mediaSource", static: false, private: false, access: { has: obj => "mediaSource" in obj, get: obj => obj.mediaSource, set: (obj, value) => { obj.mediaSource = value; } }, metadata: _metadata }, _mediaSource_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _lightTheme_decorators, { kind: "accessor", name: "lightTheme", static: false, private: false, access: { has: obj => "lightTheme" in obj, get: obj => obj.lightTheme, set: (obj, value) => { obj.lightTheme = value; } }, metadata: _metadata }, _lightTheme_initializers, _instanceExtraInitializers);
__esDecorate(_classThis, null, _darkTheme_decorators, { kind: "accessor", name: "darkTheme", static: false, private: false, access: { has: obj => "darkTheme" in obj, get: obj => obj.darkTheme, set: (obj, value) => { obj.darkTheme = value; } }, metadata: _metadata }, _darkTheme_initializers, _instanceExtraInitializers);
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
MarkedPlugin = _classThis = _classDescriptor.value;
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
__runInitializers(_classThis, _classExtraInitializers);
})();
return MarkedPlugin = _classThis;
})();
exports.MarkedPlugin = MarkedPlugin;
__decorate([
(0, utils_1.BindOption)("includes")
], MarkedPlugin.prototype, "includeSource", void 0);
__decorate([
(0, utils_1.BindOption)("media")
], MarkedPlugin.prototype, "mediaSource", void 0);
__decorate([
(0, utils_1.BindOption)("lightHighlightTheme")
], MarkedPlugin.prototype, "lightTheme", void 0);
__decorate([
(0, utils_1.BindOption)("darkHighlightTheme")
], MarkedPlugin.prototype, "darkTheme", void 0);
exports.MarkedPlugin = MarkedPlugin = __decorate([
(0, components_1.Component)({ name: "marked" })
], MarkedPlugin);
// Basically a copy/paste of Marked's code, with the addition of the button

@@ -213,0 +291,0 @@ // https://github.com/markedjs/marked/blob/v4.3.0/src/Renderer.js#L15-L39

@@ -26,3 +26,3 @@ import type { Application } from "../application";

*/
export declare function Component(options: ComponentOptions): ClassDecorator;
export declare function Component(options: ComponentOptions): (target: Function, _context: unknown) => void;
export declare class ComponentEvent extends Event {

@@ -29,0 +29,0 @@ owner: ComponentHost;

@@ -10,3 +10,5 @@ "use strict";

function Component(options) {
return (target) => {
// _context is ClassDecoratorContext, but that then requires a public constructor
// which Application does not have.
return (target, _context) => {
const proto = target.prototype;

@@ -13,0 +15,0 @@ if (!(proto instanceof AbstractComponent)) {

@@ -68,2 +68,3 @@ "use strict";

const entryPoints = options.getValue("entryPoints");
const exclude = options.getValue("exclude");
// May be set explicitly to be an empty array to only include a readme for a package

@@ -78,6 +79,6 @@ // See #2264

case exports.EntryPointStrategy.Resolve:
result = getEntryPointsForPaths(logger, expandGlobs(entryPoints, logger), options);
result = getEntryPointsForPaths(logger, expandGlobs(entryPoints, exclude, logger), options);
break;
case exports.EntryPointStrategy.Expand:
result = getExpandedEntryPointsForPaths(logger, expandGlobs(entryPoints, logger), options);
result = getExpandedEntryPointsForPaths(logger, expandGlobs(entryPoints, exclude, logger), options);
break;

@@ -101,10 +102,10 @@ case exports.EntryPointStrategy.Merge:

const entryPoints = options.getValue("entryPoints");
switch (options.getValue("entryPointStrategy")) {
const exclude = options.getValue("exclude");
const strategy = options.getValue("entryPointStrategy");
switch (strategy) {
case exports.EntryPointStrategy.Resolve:
result = getEntryPointsForPaths(logger, entryPoints, options, [
program,
]);
result = getEntryPointsForPaths(logger, expandGlobs(entryPoints, exclude, logger), options, [program]);
break;
case exports.EntryPointStrategy.Expand:
result = getExpandedEntryPointsForPaths(logger, entryPoints, options, [program]);
result = getExpandedEntryPointsForPaths(logger, expandGlobs(entryPoints, exclude, logger), options, [program]);
break;

@@ -114,2 +115,7 @@ case exports.EntryPointStrategy.Packages:

break;
case exports.EntryPointStrategy.Merge:
logger.error("Watch mode does not support 'merge' style entry points.");
break;
default:
(0, general_1.assertNever)(strategy);
}

@@ -138,3 +144,3 @@ if (result && result.length === 0) {

*/
function getEntryPointsForPaths(logger, inputFiles, options, programs = getEntryPrograms(logger, options)) {
function getEntryPointsForPaths(logger, inputFiles, options, programs = getEntryPrograms(inputFiles, logger, options)) {
const baseDir = options.getValue("basePath") || (0, fs_1.deriveRootDir)(inputFiles);

@@ -167,7 +173,8 @@ const entryPoints = [];

}
function getExpandedEntryPointsForPaths(logger, inputFiles, options, programs = getEntryPrograms(logger, options)) {
function getExpandedEntryPointsForPaths(logger, inputFiles, options, programs = getEntryPrograms(inputFiles, logger, options)) {
return getEntryPointsForPaths(logger, expandInputFiles(logger, inputFiles, options), options, programs);
}
exports.getExpandedEntryPointsForPaths = getExpandedEntryPointsForPaths;
function expandGlobs(inputFiles, logger) {
function expandGlobs(inputFiles, exclude, logger) {
const excludePatterns = (0, paths_1.createMinimatch)(exclude);
const base = (0, fs_1.deriveRootDir)(inputFiles);

@@ -179,17 +186,23 @@ const result = inputFiles.flatMap((entry) => {

});
const filtered = result.filter((file) => file === entry || !(0, paths_1.matchesAny)(excludePatterns, file));
if (result.length === 0) {
logger.warn(`The entrypoint glob ${(0, paths_1.nicePath)(entry)} did not match any files.`);
}
else if (filtered.length === 0) {
logger.warn(`The entrypoint glob ${(0, paths_1.nicePath)(entry)} did not match any files after applying exclude patterns.`);
}
else {
logger.verbose(`Expanded ${(0, paths_1.nicePath)(entry)} to:\n\t${result
logger.verbose(`Expanded ${(0, paths_1.nicePath)(entry)} to:\n\t${filtered
.map(paths_1.nicePath)
.join("\n\t")}`);
}
return result;
return filtered;
});
return result;
}
function getEntryPrograms(logger, options) {
function getEntryPrograms(inputFiles, logger, options) {
const rootProgram = typescript_1.default.createProgram({
rootNames: options.getFileNames(),
rootNames: options.getFileNames().length
? options.getFileNames()
: inputFiles,
options: options.getCompilerOptions(),

@@ -196,0 +209,0 @@ projectReferences: options.getProjectReferences(),

@@ -69,3 +69,3 @@ "use strict";

if (callback) {
const handlers = (events[name] || (events[name] = []));
const handlers = (events[name] ||= []);
const context = options.context, ctx = options.ctx, listening = options.listening, priority = options.priority;

@@ -72,0 +72,0 @@ if (listening) {

@@ -45,3 +45,3 @@ "use strict";

g[loadSymbol] = (g[loadSymbol] || 0) + 1;
g[pathSymbol] || (g[pathSymbol] = []);
g[pathSymbol] ||= [];
// transform /abs/path/to/typedoc/dist/lib/utils/general -> /abs/path/to/typedoc

@@ -48,0 +48,0 @@ g[pathSymbol].push((0, path_1.dirname)((0, path_1.dirname)((0, path_1.dirname)(__dirname))));

@@ -11,3 +11,3 @@ export { filterMap, insertPrioritySorted, partition, removeIf, removeIfPresent, unique, } from "./array";

export { DefaultMap } from "./map";
export { ArgumentsReader, BindOption, CommentStyle, Options, PackageJsonReader, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, } from "./options";
export { ArgumentsReader, Option, BindOption, CommentStyle, Options, PackageJsonReader, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, } from "./options";
export type { ArrayDeclarationOption, BooleanDeclarationOption, DeclarationOption, DeclarationOptionBase, DeclarationOptionToOptionType, KeyToDeclaration, MapDeclarationOption, MixedDeclarationOption, NumberDeclarationOption, FlagsDeclarationOption, ObjectDeclarationOption, OptionsReader, StringDeclarationOption, TypeDocOptionMap, TypeDocOptions, ValidationOptions, TypeDocOptionValues, ParameterTypeToOptionTypeMap, ManuallyValidatedOption, JsDocCompatibility, } from "./options";

@@ -14,0 +14,0 @@ export { loadPlugins } from "./plugins";

@@ -29,3 +29,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.MinimalSourceFile = exports.Validation = exports.renderElement = exports.Raw = exports.Fragment = exports.JSX = exports.EventHooks = exports.getSortFunction = exports.loadPlugins = exports.TypeDocReader = exports.TSConfigReader = exports.ParameterType = exports.ParameterHint = exports.PackageJsonReader = exports.Options = exports.CommentStyle = exports.BindOption = exports.ArgumentsReader = exports.DefaultMap = exports.LogLevel = exports.Logger = exports.ConsoleLogger = exports.assertNever = exports.normalizePath = exports.discoverPackageJson = exports.discoverInParentDir = exports.writeFileSync = exports.writeFile = exports.readFile = exports.getCommonDirectory = exports.copySync = exports.copy = exports.isFile = exports.EventDispatcher = exports.Event = exports.Component = exports.ChildableComponent = exports.AbstractComponent = exports.unique = exports.removeIfPresent = exports.removeIf = exports.partition = exports.insertPrioritySorted = exports.filterMap = void 0;
exports.MinimalSourceFile = exports.Validation = exports.renderElement = exports.Raw = exports.Fragment = exports.JSX = exports.EventHooks = exports.getSortFunction = exports.loadPlugins = exports.TypeDocReader = exports.TSConfigReader = exports.ParameterType = exports.ParameterHint = exports.PackageJsonReader = exports.Options = exports.CommentStyle = exports.BindOption = exports.Option = exports.ArgumentsReader = exports.DefaultMap = exports.LogLevel = exports.Logger = exports.ConsoleLogger = exports.assertNever = exports.normalizePath = exports.discoverPackageJson = exports.discoverInParentDir = exports.writeFileSync = exports.writeFile = exports.readFile = exports.getCommonDirectory = exports.copySync = exports.copy = exports.isFile = exports.EventDispatcher = exports.Event = exports.Component = exports.ChildableComponent = exports.AbstractComponent = exports.unique = exports.removeIfPresent = exports.removeIf = exports.partition = exports.insertPrioritySorted = exports.filterMap = void 0;
var array_1 = require("./array");

@@ -68,2 +68,3 @@ Object.defineProperty(exports, "filterMap", { enumerable: true, get: function () { return array_1.filterMap; } });

Object.defineProperty(exports, "ArgumentsReader", { enumerable: true, get: function () { return options_1.ArgumentsReader; } });
Object.defineProperty(exports, "Option", { enumerable: true, get: function () { return options_1.Option; } });
Object.defineProperty(exports, "BindOption", { enumerable: true, get: function () { return options_1.BindOption; } });

@@ -70,0 +71,0 @@ Object.defineProperty(exports, "CommentStyle", { enumerable: true, get: function () { return options_1.CommentStyle; } });

@@ -80,3 +80,3 @@ "use strict";

const renderElement = function renderElement(element) {
if (!element) {
if (!element || typeof element === "boolean") {
return "";

@@ -83,0 +83,0 @@ }

@@ -74,2 +74,3 @@ import type { Theme as ShikiTheme } from "shiki";

excludeReferences: boolean;
excludeCategories: string[];
name: string;

@@ -83,2 +84,3 @@ includeVersion: boolean;

readme: string;
stripYamlFrontmatter: boolean;
out: string;

@@ -85,0 +87,0 @@ json: string;

@@ -1,2 +0,2 @@

export { Options, BindOption } from "./options";
export { Options, Option, BindOption } from "./options";
export type { OptionsReader } from "./options";

@@ -3,0 +3,0 @@ export { ArgumentsReader, PackageJsonReader, TypeDocReader, TSConfigReader, } from "./readers";

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParameterHint = exports.ParameterType = exports.EmitStrategy = exports.CommentStyle = exports.TSConfigReader = exports.TypeDocReader = exports.PackageJsonReader = exports.ArgumentsReader = exports.BindOption = exports.Options = void 0;
exports.ParameterHint = exports.ParameterType = exports.EmitStrategy = exports.CommentStyle = exports.TSConfigReader = exports.TypeDocReader = exports.PackageJsonReader = exports.ArgumentsReader = exports.BindOption = exports.Option = exports.Options = void 0;
var options_1 = require("./options");
Object.defineProperty(exports, "Options", { enumerable: true, get: function () { return options_1.Options; } });
Object.defineProperty(exports, "Option", { enumerable: true, get: function () { return options_1.Option; } });
Object.defineProperty(exports, "BindOption", { enumerable: true, get: function () { return options_1.BindOption; } });

@@ -7,0 +8,0 @@ var readers_1 = require("./readers");

@@ -189,2 +189,19 @@ import type * as ts from "typescript";

/**
* Binds an option to an accessor. Does not register the option.
*
* Note: This is a standard ES decorator. It will not work with pre-TS 5.0 experimental decorators enabled.
*/
export declare function Option<K extends keyof TypeDocOptionMap>(name: K): (_: unknown, _context: ClassAccessorDecoratorContext<{
application: Application;
} | {
options: Options;
}, TypeDocOptionValues[K]>) => {
get(this: {
application: Application;
} | {
options: Options;
}): TypeDocOptionValues[K];
set(_value: never): never;
};
/**
* Binds an option to the given property. Does not register the option.

@@ -195,2 +212,3 @@ *

* @since v0.16.3
* @deprecated Will be removed in 0.26, use {@link Option | `@Option`} instead.
*/

@@ -210,2 +228,3 @@ export declare function BindOption<K extends keyof TypeDocOptionMap>(name: K): <IK extends PropertyKey>(target: ({

* @since v0.16.3
* @deprecated Will be removed in 0.26, use {@link Option | `@Option`} instead
*

@@ -212,0 +231,0 @@ * @privateRemarks

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BindOption = exports.Options = void 0;
exports.BindOption = exports.Option = exports.Options = void 0;
const declaration_1 = require("./declaration");

@@ -238,3 +238,3 @@ const array_1 = require("../array");

lowest = Math.min(lowest, distance);
results[distance] || (results[distance] = []);
results[distance] ||= [];
results[distance].push(name);

@@ -254,2 +254,22 @@ }

exports.Options = Options;
/**
* Binds an option to an accessor. Does not register the option.
*
* Note: This is a standard ES decorator. It will not work with pre-TS 5.0 experimental decorators enabled.
*/
function Option(name) {
return (_, _context) => {
return {
get() {
const options = "options" in this ? this.options : this.application.options;
const value = options.getValue(name);
return value;
},
set(_value) {
throw new Error("Options may not be set via the Option decorator");
},
};
};
}
exports.Option = Option;
function BindOption(name) {

@@ -256,0 +276,0 @@ return function (target, key) {

@@ -16,3 +16,2 @@ "use strict";

const array_1 = require("../../array");
const entry_point_1 = require("../../entry-point");
const tsconfig_1 = require("../../tsconfig");

@@ -63,6 +62,2 @@ function isSupportForTags(obj) {

}
else if (container.getValue("entryPointStrategy") !==
entry_point_1.EntryPointStrategy.Packages) {
logger.warn("No tsconfig file found, this will prevent TypeDoc from finding your entry points.");
}
return;

@@ -181,7 +176,7 @@ }

if (from.supportForTags) {
into.supportForTags || (into.supportForTags = {});
into.supportForTags ||= {};
Object.assign(into.supportForTags, from.supportForTags);
}
if (from.tagDefinitions) {
into.tagDefinitions || (into.tagDefinitions = []);
into.tagDefinitions ||= [];
into.tagDefinitions.push(...from.tagDefinitions);

@@ -188,0 +183,0 @@ }

@@ -152,2 +152,8 @@ "use strict";

options.addDeclaration({
name: "excludeCategories",
help: "Exclude symbols within this category from the documentation.",
type: declaration_1.ParameterType.Array,
defaultValue: [],
});
options.addDeclaration({
name: "excludePrivate",

@@ -318,2 +324,7 @@ help: "Ignore private variables and methods.",

options.addDeclaration({
name: "stripYamlFrontmatter",
help: "Strip YAML frontmatter from markdown files.",
type: declaration_1.ParameterType.Boolean,
});
options.addDeclaration({
name: "cname",

@@ -320,0 +331,0 @@ help: "Set the CNAME file text, it's useful for custom domains on GitHub Pages.",

export declare function bench<T extends Function>(fn: T, name?: string): T;
export declare function Bench(): MethodDecorator;
export declare function Bench<T extends Function>(value: T, context: ClassMethodDecoratorContext): (this: any, ...args: any) => any;
export declare function measure<T>(cb: () => T): T;

@@ -43,28 +43,18 @@ "use strict";

exports.bench = bench;
function Bench() {
return function (target, key, descriptor) {
const rawMethod = descriptor.value;
const name = `${target.name ?? target.constructor.name}.${String(key)}`;
descriptor.value = bench(rawMethod, name);
function Bench(value, context) {
let runner;
return function (...args) {
if (!runner) {
const className = Object.getPrototypeOf(this).constructor.name;
runner = bench(value, `${className}.${String(context.name)}`);
}
return runner.apply(this, args);
};
}
exports.Bench = Bench;
const anon = { name: "measure()", calls: 0, time: 0 };
function measure(cb) {
if (anon.calls === 0) {
benchmarks.unshift(anon);
}
anon.calls++;
const start = perf_hooks_1.performance.now();
let result;
try {
result = cb();
}
finally {
anon.time += perf_hooks_1.performance.now() - start;
}
return result;
return bench(cb, "measure()")();
}
exports.measure = measure;
process.on("beforeExit", () => {
process.on("exit", () => {
if (!benchmarks.length)

@@ -71,0 +61,0 @@ return;

{
"name": "typedoc",
"description": "Create api documentation for TypeScript projects.",
"version": "0.25.0",
"version": "0.25.1",
"homepage": "https://typedoc.org",

@@ -6,0 +6,0 @@ "exports": {

"use strict";
"use strict";(()=>{var Se=Object.create;var re=Object.defineProperty;var we=Object.getOwnPropertyDescriptor;var Te=Object.getOwnPropertyNames;var ke=Object.getPrototypeOf,Qe=Object.prototype.hasOwnProperty;var Pe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Ie=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Te(e))!Qe.call(t,i)&&i!==r&&re(t,i,{get:()=>e[i],enumerable:!(n=we(e,i))||n.enumerable});return t};var Ce=(t,e,r)=>(r=t!=null?Se(ke(t)):{},Ie(e||!t||!t.__esModule?re(r,"default",{value:t,enumerable:!0}):r,t));var ae=Pe((se,oe)=>{(function(){var t=function(e){var r=new t.Builder;return r.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),r.searchPipeline.add(t.stemmer),e.call(r,r),r.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(r){e.console&&console.warn&&console.warn(r)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var r=Object.create(null),n=Object.keys(e),i=0;i<n.length;i++){var s=n[i],o=e[s];if(Array.isArray(o)){r[s]=o.slice();continue}if(typeof o=="string"||typeof o=="number"||typeof o=="boolean"){r[s]=o;continue}throw new TypeError("clone is not deep and does not support nested objects")}return r},t.FieldRef=function(e,r,n){this.docRef=e,this.fieldName=r,this._stringValue=n},t.FieldRef.joiner="/",t.FieldRef.fromString=function(e){var r=e.indexOf(t.FieldRef.joiner);if(r===-1)throw"malformed field ref string";var n=e.slice(0,r),i=e.slice(r+1);return new t.FieldRef(i,n,e)},t.FieldRef.prototype.toString=function(){return this._stringValue==null&&(this._stringValue=this.fieldName+t.FieldRef.joiner+this.docRef),this._stringValue};t.Set=function(e){if(this.elements=Object.create(null),e){this.length=e.length;for(var r=0;r<this.length;r++)this.elements[e[r]]=!0}else this.length=0},t.Set.complete={intersect:function(e){return e},union:function(){return this},contains:function(){return!0}},t.Set.empty={intersect:function(){return this},union:function(e){return e},contains:function(){return!1}},t.Set.prototype.contains=function(e){return!!this.elements[e]},t.Set.prototype.intersect=function(e){var r,n,i,s=[];if(e===t.Set.complete)return this;if(e===t.Set.empty)return e;this.length<e.length?(r=this,n=e):(r=e,n=this),i=Object.keys(r.elements);for(var o=0;o<i.length;o++){var a=i[o];a in n.elements&&s.push(a)}return new t.Set(s)},t.Set.prototype.union=function(e){return e===t.Set.complete?t.Set.complete:e===t.Set.empty?this:new t.Set(Object.keys(this.elements).concat(Object.keys(e.elements)))},t.idf=function(e,r){var n=0;for(var i in e)i!="_index"&&(n+=Object.keys(e[i]).length);var s=(r-n+.5)/(n+.5);return Math.log(1+Math.abs(s))},t.Token=function(e,r){this.str=e||"",this.metadata=r||{}},t.Token.prototype.toString=function(){return this.str},t.Token.prototype.update=function(e){return this.str=e(this.str,this.metadata),this},t.Token.prototype.clone=function(e){return e=e||function(r){return r},new t.Token(e(this.str,this.metadata),this.metadata)};t.tokenizer=function(e,r){if(e==null||e==null)return[];if(Array.isArray(e))return e.map(function(m){return new t.Token(t.utils.asString(m).toLowerCase(),t.utils.clone(r))});for(var n=e.toString().toLowerCase(),i=n.length,s=[],o=0,a=0;o<=i;o++){var l=n.charAt(o),u=o-a;if(l.match(t.tokenizer.separator)||o==i){if(u>0){var d=t.utils.clone(r)||{};d.position=[a,u],d.index=s.length,s.push(new t.Token(n.slice(a,o),d))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,r){r in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+r),e.label=r,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var r=e.label&&e.label in this.registeredFunctions;r||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index.
`,e)},t.Pipeline.load=function(e){var r=new t.Pipeline;return e.forEach(function(n){var i=t.Pipeline.registeredFunctions[n];if(i)r.add(i);else throw new Error("Cannot load unregistered function: "+n)}),r},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(r){t.Pipeline.warnIfFunctionNotRegistered(r),this._stack.push(r)},this)},t.Pipeline.prototype.after=function(e,r){t.Pipeline.warnIfFunctionNotRegistered(r);var n=this._stack.indexOf(e);if(n==-1)throw new Error("Cannot find existingFn");n=n+1,this._stack.splice(n,0,r)},t.Pipeline.prototype.before=function(e,r){t.Pipeline.warnIfFunctionNotRegistered(r);var n=this._stack.indexOf(e);if(n==-1)throw new Error("Cannot find existingFn");this._stack.splice(n,0,r)},t.Pipeline.prototype.remove=function(e){var r=this._stack.indexOf(e);r!=-1&&this._stack.splice(r,1)},t.Pipeline.prototype.run=function(e){for(var r=this._stack.length,n=0;n<r;n++){for(var i=this._stack[n],s=[],o=0;o<e.length;o++){var a=i(e[o],o,e);if(!(a==null||a===""))if(Array.isArray(a))for(var l=0;l<a.length;l++)s.push(a[l]);else s.push(a)}e=s}return e},t.Pipeline.prototype.runString=function(e,r){var n=new t.Token(e,r);return this.run([n]).map(function(i){return i.toString()})},t.Pipeline.prototype.reset=function(){this._stack=[]},t.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})};t.Vector=function(e){this._magnitude=0,this.elements=e||[]},t.Vector.prototype.positionForIndex=function(e){if(this.elements.length==0)return 0;for(var r=0,n=this.elements.length/2,i=n-r,s=Math.floor(i/2),o=this.elements[s*2];i>1&&(o<e&&(r=s),o>e&&(n=s),o!=e);)i=n-r,s=r+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(o<e)return(s+1)*2},t.Vector.prototype.insert=function(e,r){this.upsert(e,r,function(){throw"duplicate index"})},t.Vector.prototype.upsert=function(e,r,n){this._magnitude=0;var i=this.positionForIndex(e);this.elements[i]==e?this.elements[i+1]=n(this.elements[i+1],r):this.elements.splice(i,0,e,r)},t.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var e=0,r=this.elements.length,n=1;n<r;n+=2){var i=this.elements[n];e+=i*i}return this._magnitude=Math.sqrt(e)},t.Vector.prototype.dot=function(e){for(var r=0,n=this.elements,i=e.elements,s=n.length,o=i.length,a=0,l=0,u=0,d=0;u<s&&d<o;)a=n[u],l=i[d],a<l?u+=2:a>l?d+=2:a==l&&(r+=n[u+1]*i[d+1],u+=2,d+=2);return r},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),r=1,n=0;r<this.elements.length;r+=2,n++)e[n]=this.elements[r];return e},t.Vector.prototype.toJSON=function(){return this.elements};t.stemmer=function(){var e={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},r={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},n="[^aeiou]",i="[aeiouy]",s=n+"[^aeiouy]*",o=i+"[aeiou]*",a="^("+s+")?"+o+s,l="^("+s+")?"+o+s+"("+o+")?$",u="^("+s+")?"+o+s+o+s,d="^("+s+")?"+i,m=new RegExp(a),y=new RegExp(u),b=new RegExp(l),g=new RegExp(d),E=/^(.+?)(ss|i)es$/,f=/^(.+?)([^s])s$/,p=/^(.+?)eed$/,w=/^(.+?)(ed|ing)$/,S=/.$/,k=/(at|bl|iz)$/,_=new RegExp("([^aeiouylsz])\\1$"),B=new RegExp("^"+s+i+"[^aeiouwxy]$"),A=/^(.+?[^aeiou])y$/,j=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,q=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,V=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,$=/^(.+?)(s|t)(ion)$/,I=/^(.+?)e$/,z=/ll$/,W=new RegExp("^"+s+i+"[^aeiouwxy]$"),H=function(c){var v,C,T,h,x,O,F;if(c.length<3)return c;if(T=c.substr(0,1),T=="y"&&(c=T.toUpperCase()+c.substr(1)),h=E,x=f,h.test(c)?c=c.replace(h,"$1$2"):x.test(c)&&(c=c.replace(x,"$1$2")),h=p,x=w,h.test(c)){var L=h.exec(c);h=m,h.test(L[1])&&(h=S,c=c.replace(h,""))}else if(x.test(c)){var L=x.exec(c);v=L[1],x=g,x.test(v)&&(c=v,x=k,O=_,F=B,x.test(c)?c=c+"e":O.test(c)?(h=S,c=c.replace(h,"")):F.test(c)&&(c=c+"e"))}if(h=A,h.test(c)){var L=h.exec(c);v=L[1],c=v+"i"}if(h=j,h.test(c)){var L=h.exec(c);v=L[1],C=L[2],h=m,h.test(v)&&(c=v+e[C])}if(h=q,h.test(c)){var L=h.exec(c);v=L[1],C=L[2],h=m,h.test(v)&&(c=v+r[C])}if(h=V,x=$,h.test(c)){var L=h.exec(c);v=L[1],h=y,h.test(v)&&(c=v)}else if(x.test(c)){var L=x.exec(c);v=L[1]+L[2],x=y,x.test(v)&&(c=v)}if(h=I,h.test(c)){var L=h.exec(c);v=L[1],h=y,x=b,O=W,(h.test(v)||x.test(v)&&!O.test(v))&&(c=v)}return h=z,x=y,h.test(c)&&x.test(c)&&(h=S,c=c.replace(h,"")),T=="y"&&(c=T.toLowerCase()+c.substr(1)),c};return function(R){return R.update(H)}}(),t.Pipeline.registerFunction(t.stemmer,"stemmer");t.generateStopWordFilter=function(e){var r=e.reduce(function(n,i){return n[i]=i,n},{});return function(n){if(n&&r[n.toString()]!==n.toString())return n}},t.stopWordFilter=t.generateStopWordFilter(["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]),t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter");t.trimmer=function(e){return e.update(function(r){return r.replace(/^\W+/,"").replace(/\W+$/,"")})},t.Pipeline.registerFunction(t.trimmer,"trimmer");t.TokenSet=function(){this.final=!1,this.edges={},this.id=t.TokenSet._nextId,t.TokenSet._nextId+=1},t.TokenSet._nextId=1,t.TokenSet.fromArray=function(e){for(var r=new t.TokenSet.Builder,n=0,i=e.length;n<i;n++)r.insert(e[n]);return r.finish(),r.root},t.TokenSet.fromClause=function(e){return"editDistance"in e?t.TokenSet.fromFuzzyString(e.term,e.editDistance):t.TokenSet.fromString(e.term)},t.TokenSet.fromFuzzyString=function(e,r){for(var n=new t.TokenSet,i=[{node:n,editsRemaining:r,str:e}];i.length;){var s=i.pop();if(s.str.length>0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),m=s.str.charAt(1),y;m in s.node.edges?y=s.node.edges[m]:(y=new t.TokenSet,s.node.edges[m]=y),s.str.length==1&&(y.final=!0),i.push({node:y,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return n},t.TokenSet.fromString=function(e){for(var r=new t.TokenSet,n=r,i=0,s=e.length;i<s;i++){var o=e[i],a=i==s-1;if(o=="*")r.edges[o]=r,r.final=a;else{var l=new t.TokenSet;l.final=a,r.edges[o]=l,r=l}}return n},t.TokenSet.prototype.toArray=function(){for(var e=[],r=[{prefix:"",node:this}];r.length;){var n=r.pop(),i=Object.keys(n.node.edges),s=i.length;n.node.final&&(n.prefix.charAt(0),e.push(n.prefix));for(var o=0;o<s;o++){var a=i[o];r.push({prefix:n.prefix.concat(a),node:n.node.edges[a]})}}return e},t.TokenSet.prototype.toString=function(){if(this._str)return this._str;for(var e=this.final?"1":"0",r=Object.keys(this.edges).sort(),n=r.length,i=0;i<n;i++){var s=r[i],o=this.edges[s];e=e+s+o.id}return e},t.TokenSet.prototype.intersect=function(e){for(var r=new t.TokenSet,n=void 0,i=[{qNode:e,output:r,node:this}];i.length;){n=i.pop();for(var s=Object.keys(n.qNode.edges),o=s.length,a=Object.keys(n.node.edges),l=a.length,u=0;u<o;u++)for(var d=s[u],m=0;m<l;m++){var y=a[m];if(y==d||d=="*"){var b=n.node.edges[y],g=n.qNode.edges[d],E=b.final&&g.final,f=void 0;y in n.output.edges?(f=n.output.edges[y],f.final=f.final||E):(f=new t.TokenSet,f.final=E,n.output.edges[y]=f),i.push({qNode:g,output:f,node:b})}}}return r},t.TokenSet.Builder=function(){this.previousWord="",this.root=new t.TokenSet,this.uncheckedNodes=[],this.minimizedNodes={}},t.TokenSet.Builder.prototype.insert=function(e){var r,n=0;if(e<this.previousWord)throw new Error("Out of order word insertion");for(var i=0;i<e.length&&i<this.previousWord.length&&e[i]==this.previousWord[i];i++)n++;this.minimize(n),this.uncheckedNodes.length==0?r=this.root:r=this.uncheckedNodes[this.uncheckedNodes.length-1].child;for(var i=n;i<e.length;i++){var s=new t.TokenSet,o=e[i];r.edges[o]=s,this.uncheckedNodes.push({parent:r,char:o,child:s}),r=s}r.final=!0,this.previousWord=e},t.TokenSet.Builder.prototype.finish=function(){this.minimize(0)},t.TokenSet.Builder.prototype.minimize=function(e){for(var r=this.uncheckedNodes.length-1;r>=e;r--){var n=this.uncheckedNodes[r],i=n.child.toString();i in this.minimizedNodes?n.parent.edges[n.char]=this.minimizedNodes[i]:(n.child._str=i,this.minimizedNodes[i]=n.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(r){var n=new t.QueryParser(e,r);n.parse()})},t.Index.prototype.query=function(e){for(var r=new t.Query(this.fields),n=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l<this.fields.length;l++)i[this.fields[l]]=new t.Vector;e.call(r,r);for(var l=0;l<r.clauses.length;l++){var u=r.clauses[l],d=null,m=t.Set.empty;u.usePipeline?d=this.pipeline.runString(u.term,{fields:u.fields}):d=[u.term];for(var y=0;y<d.length;y++){var b=d[y];u.term=b;var g=t.TokenSet.fromClause(u),E=this.tokenSet.intersect(g).toArray();if(E.length===0&&u.presence===t.Query.presence.REQUIRED){for(var f=0;f<u.fields.length;f++){var p=u.fields[f];o[p]=t.Set.empty}break}for(var w=0;w<E.length;w++)for(var S=E[w],k=this.invertedIndex[S],_=k._index,f=0;f<u.fields.length;f++){var p=u.fields[f],B=k[p],A=Object.keys(B),j=S+"/"+p,q=new t.Set(A);if(u.presence==t.Query.presence.REQUIRED&&(m=m.union(q),o[p]===void 0&&(o[p]=t.Set.complete)),u.presence==t.Query.presence.PROHIBITED){a[p]===void 0&&(a[p]=t.Set.empty),a[p]=a[p].union(q);continue}if(i[p].upsert(_,u.boost,function(Ee,be){return Ee+be}),!s[j]){for(var V=0;V<A.length;V++){var $=A[V],I=new t.FieldRef($,p),z=B[$],W;(W=n[I])===void 0?n[I]=new t.MatchData(S,p,z):W.add(S,p,z)}s[j]=!0}}}if(u.presence===t.Query.presence.REQUIRED)for(var f=0;f<u.fields.length;f++){var p=u.fields[f];o[p]=o[p].intersect(m)}}for(var H=t.Set.complete,R=t.Set.empty,l=0;l<this.fields.length;l++){var p=this.fields[l];o[p]&&(H=H.intersect(o[p])),a[p]&&(R=R.union(a[p]))}var c=Object.keys(n),v=[],C=Object.create(null);if(r.isNegated()){c=Object.keys(this.fieldVectors);for(var l=0;l<c.length;l++){var I=c[l],T=t.FieldRef.fromString(I);n[I]=new t.MatchData}}for(var l=0;l<c.length;l++){var T=t.FieldRef.fromString(c[l]),h=T.docRef;if(H.contains(h)&&!R.contains(h)){var x=this.fieldVectors[T],O=i[T.fieldName].similarity(x),F;if((F=C[h])!==void 0)F.score+=O,F.matchData.combine(n[T]);else{var L={ref:h,score:O,matchData:n[T]};C[h]=L,v.push(L)}}}return v.sort(function(xe,Le){return Le.score-xe.score})},t.Index.prototype.toJSON=function(){var e=Object.keys(this.invertedIndex).sort().map(function(n){return[n,this.invertedIndex[n]]},this),r=Object.keys(this.fieldVectors).map(function(n){return[n,this.fieldVectors[n].toJSON()]},this);return{version:t.version,fields:this.fields,fieldVectors:r,invertedIndex:e,pipeline:this.pipeline.toJSON()}},t.Index.load=function(e){var r={},n={},i=e.fieldVectors,s=Object.create(null),o=e.invertedIndex,a=new t.TokenSet.Builder,l=t.Pipeline.load(e.pipeline);e.version!=t.version&&t.utils.warn("Version mismatch when loading serialised index. Current version of lunr '"+t.version+"' does not match serialized index '"+e.version+"'");for(var u=0;u<i.length;u++){var d=i[u],m=d[0],y=d[1];n[m]=new t.Vector(y)}for(var u=0;u<o.length;u++){var d=o[u],b=d[0],g=d[1];a.insert(b),s[b]=g}return a.finish(),r.fields=e.fields,r.fieldVectors=n,r.invertedIndex=s,r.tokenSet=a.root,r.pipeline=l,new t.Index(r)};t.Builder=function(){this._ref="id",this._fields=Object.create(null),this._documents=Object.create(null),this.invertedIndex=Object.create(null),this.fieldTermFrequencies={},this.fieldLengths={},this.tokenizer=t.tokenizer,this.pipeline=new t.Pipeline,this.searchPipeline=new t.Pipeline,this.documentCount=0,this._b=.75,this._k1=1.2,this.termIndex=0,this.metadataWhitelist=[]},t.Builder.prototype.ref=function(e){this._ref=e},t.Builder.prototype.field=function(e,r){if(/\//.test(e))throw new RangeError("Field '"+e+"' contains illegal character '/'");this._fields[e]=r||{}},t.Builder.prototype.b=function(e){e<0?this._b=0:e>1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,r){var n=e[this._ref],i=Object.keys(this._fields);this._documents[n]=r||{},this.documentCount+=1;for(var s=0;s<i.length;s++){var o=i[s],a=this._fields[o].extractor,l=a?a(e):e[o],u=this.tokenizer(l,{fields:[o]}),d=this.pipeline.run(u),m=new t.FieldRef(n,o),y=Object.create(null);this.fieldTermFrequencies[m]=y,this.fieldLengths[m]=0,this.fieldLengths[m]+=d.length;for(var b=0;b<d.length;b++){var g=d[b];if(y[g]==null&&(y[g]=0),y[g]+=1,this.invertedIndex[g]==null){var E=Object.create(null);E._index=this.termIndex,this.termIndex+=1;for(var f=0;f<i.length;f++)E[i[f]]=Object.create(null);this.invertedIndex[g]=E}this.invertedIndex[g][o][n]==null&&(this.invertedIndex[g][o][n]=Object.create(null));for(var p=0;p<this.metadataWhitelist.length;p++){var w=this.metadataWhitelist[p],S=g.metadata[w];this.invertedIndex[g][o][n][w]==null&&(this.invertedIndex[g][o][n][w]=[]),this.invertedIndex[g][o][n][w].push(S)}}}},t.Builder.prototype.calculateAverageFieldLengths=function(){for(var e=Object.keys(this.fieldLengths),r=e.length,n={},i={},s=0;s<r;s++){var o=t.FieldRef.fromString(e[s]),a=o.fieldName;i[a]||(i[a]=0),i[a]+=1,n[a]||(n[a]=0),n[a]+=this.fieldLengths[o]}for(var l=Object.keys(this._fields),s=0;s<l.length;s++){var u=l[s];n[u]=n[u]/i[u]}this.averageFieldLength=n},t.Builder.prototype.createFieldVectors=function(){for(var e={},r=Object.keys(this.fieldTermFrequencies),n=r.length,i=Object.create(null),s=0;s<n;s++){for(var o=t.FieldRef.fromString(r[s]),a=o.fieldName,l=this.fieldLengths[o],u=new t.Vector,d=this.fieldTermFrequencies[o],m=Object.keys(d),y=m.length,b=this._fields[a].boost||1,g=this._documents[o.docRef].boost||1,E=0;E<y;E++){var f=m[E],p=d[f],w=this.invertedIndex[f]._index,S,k,_;i[f]===void 0?(S=t.idf(this.invertedIndex[f],this.documentCount),i[f]=S):S=i[f],k=S*((this._k1+1)*p)/(this._k1*(1-this._b+this._b*(l/this.averageFieldLength[a]))+p),k*=b,k*=g,_=Math.round(k*1e3)/1e3,u.insert(w,_)}e[o]=u}this.fieldVectors=e},t.Builder.prototype.createTokenSet=function(){this.tokenSet=t.TokenSet.fromArray(Object.keys(this.invertedIndex).sort())},t.Builder.prototype.build=function(){return this.calculateAverageFieldLengths(),this.createFieldVectors(),this.createTokenSet(),new t.Index({invertedIndex:this.invertedIndex,fieldVectors:this.fieldVectors,tokenSet:this.tokenSet,fields:Object.keys(this._fields),pipeline:this.searchPipeline})},t.Builder.prototype.use=function(e){var r=Array.prototype.slice.call(arguments,1);r.unshift(this),e.apply(this,r)},t.MatchData=function(e,r,n){for(var i=Object.create(null),s=Object.keys(n||{}),o=0;o<s.length;o++){var a=s[o];i[a]=n[a].slice()}this.metadata=Object.create(null),e!==void 0&&(this.metadata[e]=Object.create(null),this.metadata[e][r]=i)},t.MatchData.prototype.combine=function(e){for(var r=Object.keys(e.metadata),n=0;n<r.length;n++){var i=r[n],s=Object.keys(e.metadata[i]);this.metadata[i]==null&&(this.metadata[i]=Object.create(null));for(var o=0;o<s.length;o++){var a=s[o],l=Object.keys(e.metadata[i][a]);this.metadata[i][a]==null&&(this.metadata[i][a]=Object.create(null));for(var u=0;u<l.length;u++){var d=l[u];this.metadata[i][a][d]==null?this.metadata[i][a][d]=e.metadata[i][a][d]:this.metadata[i][a][d]=this.metadata[i][a][d].concat(e.metadata[i][a][d])}}}},t.MatchData.prototype.add=function(e,r,n){if(!(e in this.metadata)){this.metadata[e]=Object.create(null),this.metadata[e][r]=n;return}if(!(r in this.metadata[e])){this.metadata[e][r]=n;return}for(var i=Object.keys(n),s=0;s<i.length;s++){var o=i[s];o in this.metadata[e][r]?this.metadata[e][r][o]=this.metadata[e][r][o].concat(n[o]):this.metadata[e][r][o]=n[o]}},t.Query=function(e){this.clauses=[],this.allFields=e},t.Query.wildcard=new String("*"),t.Query.wildcard.NONE=0,t.Query.wildcard.LEADING=1,t.Query.wildcard.TRAILING=2,t.Query.presence={OPTIONAL:1,REQUIRED:2,PROHIBITED:3},t.Query.prototype.clause=function(e){return"fields"in e||(e.fields=this.allFields),"boost"in e||(e.boost=1),"usePipeline"in e||(e.usePipeline=!0),"wildcard"in e||(e.wildcard=t.Query.wildcard.NONE),e.wildcard&t.Query.wildcard.LEADING&&e.term.charAt(0)!=t.Query.wildcard&&(e.term="*"+e.term),e.wildcard&t.Query.wildcard.TRAILING&&e.term.slice(-1)!=t.Query.wildcard&&(e.term=""+e.term+"*"),"presence"in e||(e.presence=t.Query.presence.OPTIONAL),this.clauses.push(e),this},t.Query.prototype.isNegated=function(){for(var e=0;e<this.clauses.length;e++)if(this.clauses[e].presence!=t.Query.presence.PROHIBITED)return!1;return!0},t.Query.prototype.term=function(e,r){if(Array.isArray(e))return e.forEach(function(i){this.term(i,t.utils.clone(r))},this),this;var n=r||{};return n.term=e.toString(),this.clause(n),this},t.QueryParseError=function(e,r,n){this.name="QueryParseError",this.message=e,this.start=r,this.end=n},t.QueryParseError.prototype=new Error,t.QueryLexer=function(e){this.lexemes=[],this.str=e,this.length=e.length,this.pos=0,this.start=0,this.escapeCharPositions=[]},t.QueryLexer.prototype.run=function(){for(var e=t.QueryLexer.lexText;e;)e=e(this)},t.QueryLexer.prototype.sliceString=function(){for(var e=[],r=this.start,n=this.pos,i=0;i<this.escapeCharPositions.length;i++)n=this.escapeCharPositions[i],e.push(this.str.slice(r,n)),r=n+1;return e.push(this.str.slice(r,this.pos)),this.escapeCharPositions.length=0,e.join("")},t.QueryLexer.prototype.emit=function(e){this.lexemes.push({type:e,str:this.sliceString(),start:this.start,end:this.pos}),this.start=this.pos},t.QueryLexer.prototype.escapeCharacter=function(){this.escapeCharPositions.push(this.pos-1),this.pos+=1},t.QueryLexer.prototype.next=function(){if(this.pos>=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,r;do e=this.next(),r=e.charCodeAt(0);while(r>47&&r<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos<this.length},t.QueryLexer.EOS="EOS",t.QueryLexer.FIELD="FIELD",t.QueryLexer.TERM="TERM",t.QueryLexer.EDIT_DISTANCE="EDIT_DISTANCE",t.QueryLexer.BOOST="BOOST",t.QueryLexer.PRESENCE="PRESENCE",t.QueryLexer.lexField=function(e){return e.backup(),e.emit(t.QueryLexer.FIELD),e.ignore(),t.QueryLexer.lexText},t.QueryLexer.lexTerm=function(e){if(e.width()>1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var r=e.next();if(r==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(r.charCodeAt(0)==92){e.escapeCharacter();continue}if(r==":")return t.QueryLexer.lexField;if(r=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(r=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(r=="+"&&e.width()===1||r=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(r.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,r){this.lexer=new t.QueryLexer(e),this.query=r,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var r=e.peekLexeme();if(r!=null)switch(r.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var n="expected either a field or a term, found "+r.type;throw r.str.length>=1&&(n+=" with value '"+r.str+"'"),new t.QueryParseError(n,r.start,r.end)}},t.QueryParser.parsePresence=function(e){var r=e.consumeLexeme();if(r!=null){switch(r.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var n="unrecognised presence operator'"+r.str+"'";throw new t.QueryParseError(n,r.start,r.end)}var i=e.peekLexeme();if(i==null){var n="expecting term or field, found nothing";throw new t.QueryParseError(n,r.start,r.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var n="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(n,i.start,i.end)}}},t.QueryParser.parseField=function(e){var r=e.consumeLexeme();if(r!=null){if(e.query.allFields.indexOf(r.str)==-1){var n=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+r.str+"', possible fields: "+n;throw new t.QueryParseError(i,r.start,r.end)}e.currentClause.fields=[r.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,r.start,r.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var r=e.consumeLexeme();if(r!=null){e.currentClause.term=r.str.toLowerCase(),r.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var n=e.peekLexeme();if(n==null){e.nextClause();return}switch(n.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+n.type+"'";throw new t.QueryParseError(i,n.start,n.end)}}},t.QueryParser.parseEditDistance=function(e){var r=e.consumeLexeme();if(r!=null){var n=parseInt(r.str,10);if(isNaN(n)){var i="edit distance must be numeric";throw new t.QueryParseError(i,r.start,r.end)}e.currentClause.editDistance=n;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var r=e.consumeLexeme();if(r!=null){var n=parseInt(r.str,10);if(isNaN(n)){var i="boost must be numeric";throw new t.QueryParseError(i,r.start,r.end)}e.currentClause.boost=n;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,r){typeof define=="function"&&define.amd?define(r):typeof se=="object"?oe.exports=r():e.lunr=r()}(this,function(){return t})})()});var ne=[];function G(t,e){ne.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureActivePageVisible(),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible())}createComponents(e){ne.forEach(r=>{e.querySelectorAll(r.selector).forEach(n=>{n.dataset.hasInstance||(new r.constructor({el:n,app:this}),n.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),r=e?.parentElement;for(;r&&!r.classList.contains(".tsd-navigation");)r instanceof HTMLDetailsElement&&(r.open=!0),r=r.parentElement;if(e){let n=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=n}}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let r=e.parentElement;for(;r&&r.tagName!=="SECTION";)r=r.parentElement;if(r&&r.offsetParent==null){this.alwaysVisibleMember=r,r.classList.add("always-visible");let n=document.createElement("p");n.classList.add("warning"),n.textContent="This member is normally hidden due to your filter settings.",r.prepend(n)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let r;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(r),r=setTimeout(()=>{e.classList.remove("visible"),r=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var ie=(t,e=100)=>{let r;return()=>{clearTimeout(r),r=setTimeout(()=>t(),e)}};var ce=Ce(ae());function de(){let t=document.getElementById("tsd-search");if(!t)return;let e=document.getElementById("tsd-search-script");t.classList.add("loading"),e&&(e.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),e.addEventListener("load",()=>{t.classList.remove("loading"),t.classList.add("ready")}),window.searchData&&t.classList.remove("loading"));let r=document.querySelector("#tsd-search input"),n=document.querySelector("#tsd-search .results");if(!r||!n)throw new Error("The input field or the result list wrapper was not found");let i=!1;n.addEventListener("mousedown",()=>i=!0),n.addEventListener("mouseup",()=>{i=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{i||(i=!1,t.classList.remove("has-focus"))});let s={base:t.dataset.base+"/"};Oe(t,n,r,s)}function Oe(t,e,r,n){r.addEventListener("input",ie(()=>{Re(t,e,r,n)},200));let i=!1;r.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Fe(e,r):s.key=="Escape"?r.blur():s.key=="ArrowUp"?ue(e,-1):s.key==="ArrowDown"?ue(e,1):i=!1}),r.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!r.matches(":focus")&&s.key==="/"&&(r.focus(),s.preventDefault())})}function _e(t,e){t.index||window.searchData&&(e.classList.remove("loading"),e.classList.add("ready"),t.data=window.searchData,t.index=ce.Index.load(window.searchData.index))}function Re(t,e,r,n){if(_e(n,t),!n.index||!n.data)return;e.textContent="";let i=r.value.trim(),s=i?n.index.search(`*${i}*`):[];for(let o=0;o<s.length;o++){let a=s[o],l=n.data.rows[Number(a.ref)],u=1;l.name.toLowerCase().startsWith(i.toLowerCase())&&(u*=1+1/(1+Math.abs(l.name.length-i.length))),a.score*=u}if(s.length===0){let o=document.createElement("li");o.classList.add("no-results");let a=document.createElement("span");a.textContent="No results found",o.appendChild(a),e.appendChild(o)}s.sort((o,a)=>a.score-o.score);for(let o=0,a=Math.min(10,s.length);o<a;o++){let l=n.data.rows[Number(s[o].ref)],u=le(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(u+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(u=`<span class="parent">${le(l.parent,i)}.</span>${u}`);let d=document.createElement("li");d.classList.value=l.classes??"";let m=document.createElement("a");m.href=n.base+l.url,m.innerHTML=u,d.append(m),e.appendChild(d)}}function ue(t,e){let r=t.querySelector(".current");if(!r)r=t.querySelector(e==1?"li:first-child":"li:last-child"),r&&r.classList.add("current");else{let n=r;if(e===1)do n=n.nextElementSibling??void 0;while(n instanceof HTMLElement&&n.offsetParent==null);else do n=n.previousElementSibling??void 0;while(n instanceof HTMLElement&&n.offsetParent==null);n&&(r.classList.remove("current"),n.classList.add("current"))}}function Fe(t,e){let r=t.querySelector(".current");if(r||(r=t.querySelector("li:first-child")),r){let n=r.querySelector("a");n&&(window.location.href=n.href),e.blur()}}function le(t,e){if(e==="")return t;let r=t.toLocaleLowerCase(),n=e.toLocaleLowerCase(),i=[],s=0,o=r.indexOf(n);for(;o!=-1;)i.push(K(t.substring(s,o)),`<b>${K(t.substring(o,o+n.length))}</b>`),s=o+n.length,o=r.indexOf(n,s);return i.push(K(t.substring(s))),i.join("")}var Me={"&":"&amp;","<":"&lt;",">":"&gt;","'":"&#039;",'"':"&quot;"};function K(t){return t.replace(/[&<>"'"]/g,e=>Me[e])}var P=class{constructor(e){this.el=e.el,this.app=e.app}};var M="mousedown",fe="mousemove",N="mouseup",J={x:0,y:0},he=!1,ee=!1,De=!1,D=!1,pe=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(pe?"is-mobile":"not-mobile");pe&&"ontouchstart"in document.documentElement&&(De=!0,M="touchstart",fe="touchmove",N="touchend");document.addEventListener(M,t=>{ee=!0,D=!1;let e=M=="touchstart"?t.targetTouches[0]:t;J.y=e.pageY||0,J.x=e.pageX||0});document.addEventListener(fe,t=>{if(ee&&!D){let e=M=="touchstart"?t.targetTouches[0]:t,r=J.x-(e.pageX||0),n=J.y-(e.pageY||0);D=Math.sqrt(r*r+n*n)>10}});document.addEventListener(N,()=>{ee=!1});document.addEventListener("click",t=>{he&&(t.preventDefault(),t.stopImmediatePropagation(),he=!1)});var X=class extends P{constructor(r){super(r);this.className=this.el.dataset.toggle||"",this.el.addEventListener(N,n=>this.onPointerUp(n)),this.el.addEventListener("click",n=>n.preventDefault()),document.addEventListener(M,n=>this.onDocumentPointerDown(n)),document.addEventListener(N,n=>this.onDocumentPointerUp(n))}setActive(r){if(this.active==r)return;this.active=r,document.documentElement.classList.toggle("has-"+this.className,r),this.el.classList.toggle("active",r);let n=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(n),setTimeout(()=>document.documentElement.classList.remove(n),500)}onPointerUp(r){D||(this.setActive(!0),r.preventDefault())}onDocumentPointerDown(r){if(this.active){if(r.target.closest(".col-sidebar, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(r){if(!D&&this.active&&r.target.closest(".col-sidebar")){let n=r.target.closest("a");if(n){let i=window.location.href;i.indexOf("#")!=-1&&(i=i.substring(0,i.indexOf("#"))),n.href.substring(0,i.length)==i&&setTimeout(()=>this.setActive(!1),250)}}}};var te;try{te=localStorage}catch{te={getItem(){return null},setItem(){}}}var Q=te;var me=document.head.appendChild(document.createElement("style"));me.dataset.for="filters";var Y=class extends P{constructor(r){super(r);this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),me.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; }
`}fromLocalStorage(){let r=Q.getItem(this.key);return r?r==="true":this.el.checked}setLocalStorage(r){Q.setItem(this.key,r.toString()),this.value=r,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),this.app.filterChanged(),document.querySelectorAll(".tsd-index-section").forEach(r=>{r.style.display="block";let n=Array.from(r.querySelectorAll(".tsd-index-link")).every(i=>i.offsetParent==null);r.style.display=n?"none":"block"})}};var Z=class extends P{constructor(r){super(r);this.summary=this.el.querySelector(".tsd-accordion-summary"),this.icon=this.summary.querySelector("svg"),this.key=`tsd-accordion-${this.summary.dataset.key??this.summary.textContent.trim().replace(/\s+/g,"-").toLowerCase()}`;let n=Q.getItem(this.key);this.el.open=n?n==="true":this.el.open,this.el.addEventListener("toggle",()=>this.update()),this.update()}update(){this.icon.style.transform=`rotate(${this.el.open?0:-90}deg)`,Q.setItem(this.key,this.el.open.toString())}};function ve(t){let e=Q.getItem("tsd-theme")||"os";t.value=e,ye(e),t.addEventListener("change",()=>{Q.setItem("tsd-theme",t.value),ye(t.value)})}function ye(t){document.documentElement.dataset.theme=t}de();G(X,"a[data-toggle]");G(Z,".tsd-index-accordion");G(Y,".tsd-filter-item input[type=checkbox]");var ge=document.getElementById("tsd-theme");ge&&ve(ge);var Ae=new U;Object.defineProperty(window,"app",{value:Ae});document.querySelectorAll("summary a").forEach(t=>{t.addEventListener("click",()=>{location.assign(t.href)})});})();
"use strict";(()=>{var Pe=Object.create;var ne=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var Me=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Fe=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Oe(e))!Re.call(t,i)&&i!==n&&ne(t,i,{get:()=>e[i],enumerable:!(r=Ie(e,i))||r.enumerable});return t};var De=(t,e,n)=>(n=t!=null?Pe(_e(t)):{},Fe(e||!t||!t.__esModule?ne(n,"default",{value:t,enumerable:!0}):n,t));var ae=Me((se,oe)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(n){e.console&&console.warn&&console.warn(n)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i<r.length;i++){var s=r[i],o=e[s];if(Array.isArray(o)){n[s]=o.slice();continue}if(typeof o=="string"||typeof o=="number"||typeof o=="boolean"){n[s]=o;continue}throw new TypeError("clone is not deep and does not support nested objects")}return n},t.FieldRef=function(e,n,r){this.docRef=e,this.fieldName=n,this._stringValue=r},t.FieldRef.joiner="/",t.FieldRef.fromString=function(e){var n=e.indexOf(t.FieldRef.joiner);if(n===-1)throw"malformed field ref string";var r=e.slice(0,n),i=e.slice(n+1);return new t.FieldRef(i,r,e)},t.FieldRef.prototype.toString=function(){return this._stringValue==null&&(this._stringValue=this.fieldName+t.FieldRef.joiner+this.docRef),this._stringValue};t.Set=function(e){if(this.elements=Object.create(null),e){this.length=e.length;for(var n=0;n<this.length;n++)this.elements[e[n]]=!0}else this.length=0},t.Set.complete={intersect:function(e){return e},union:function(){return this},contains:function(){return!0}},t.Set.empty={intersect:function(){return this},union:function(e){return e},contains:function(){return!1}},t.Set.prototype.contains=function(e){return!!this.elements[e]},t.Set.prototype.intersect=function(e){var n,r,i,s=[];if(e===t.Set.complete)return this;if(e===t.Set.empty)return e;this.length<e.length?(n=this,r=e):(n=e,r=this),i=Object.keys(n.elements);for(var o=0;o<i.length;o++){var a=i[o];a in r.elements&&s.push(a)}return new t.Set(s)},t.Set.prototype.union=function(e){return e===t.Set.complete?t.Set.complete:e===t.Set.empty?this:new t.Set(Object.keys(this.elements).concat(Object.keys(e.elements)))},t.idf=function(e,n){var r=0;for(var i in e)i!="_index"&&(r+=Object.keys(e[i]).length);var s=(n-r+.5)/(r+.5);return Math.log(1+Math.abs(s))},t.Token=function(e,n){this.str=e||"",this.metadata=n||{}},t.Token.prototype.toString=function(){return this.str},t.Token.prototype.update=function(e){return this.str=e(this.str,this.metadata),this},t.Token.prototype.clone=function(e){return e=e||function(n){return n},new t.Token(e(this.str,this.metadata),this.metadata)};t.tokenizer=function(e,n){if(e==null||e==null)return[];if(Array.isArray(e))return e.map(function(v){return new t.Token(t.utils.asString(v).toLowerCase(),t.utils.clone(n))});for(var r=e.toString().toLowerCase(),i=r.length,s=[],o=0,a=0;o<=i;o++){var l=r.charAt(o),u=o-a;if(l.match(t.tokenizer.separator)||o==i){if(u>0){var d=t.utils.clone(n)||{};d.position=[a,u],d.index=s.length,s.push(new t.Token(r.slice(a,o),d))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index.
`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r<n;r++){for(var i=this._stack[r],s=[],o=0;o<e.length;o++){var a=i(e[o],o,e);if(!(a==null||a===""))if(Array.isArray(a))for(var l=0;l<a.length;l++)s.push(a[l]);else s.push(a)}e=s}return e},t.Pipeline.prototype.runString=function(e,n){var r=new t.Token(e,n);return this.run([r]).map(function(i){return i.toString()})},t.Pipeline.prototype.reset=function(){this._stack=[]},t.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})};t.Vector=function(e){this._magnitude=0,this.elements=e||[]},t.Vector.prototype.positionForIndex=function(e){if(this.elements.length==0)return 0;for(var n=0,r=this.elements.length/2,i=r-n,s=Math.floor(i/2),o=this.elements[s*2];i>1&&(o<e&&(n=s),o>e&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(o<e)return(s+1)*2},t.Vector.prototype.insert=function(e,n){this.upsert(e,n,function(){throw"duplicate index"})},t.Vector.prototype.upsert=function(e,n,r){this._magnitude=0;var i=this.positionForIndex(e);this.elements[i]==e?this.elements[i+1]=r(this.elements[i+1],n):this.elements.splice(i,0,e,n)},t.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var e=0,n=this.elements.length,r=1;r<n;r+=2){var i=this.elements[r];e+=i*i}return this._magnitude=Math.sqrt(e)},t.Vector.prototype.dot=function(e){for(var n=0,r=this.elements,i=e.elements,s=r.length,o=i.length,a=0,l=0,u=0,d=0;u<s&&d<o;)a=r[u],l=i[d],a<l?u+=2:a>l?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n<this.elements.length;n+=2,r++)e[r]=this.elements[n];return e},t.Vector.prototype.toJSON=function(){return this.elements};t.stemmer=function(){var e={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},n={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},r="[^aeiou]",i="[aeiouy]",s=r+"[^aeiouy]*",o=i+"[aeiou]*",a="^("+s+")?"+o+s,l="^("+s+")?"+o+s+"("+o+")?$",u="^("+s+")?"+o+s+o+s,d="^("+s+")?"+i,v=new RegExp(a),f=new RegExp(u),b=new RegExp(l),g=new RegExp(d),L=/^(.+?)(ss|i)es$/,p=/^(.+?)([^s])s$/,m=/^(.+?)eed$/,S=/^(.+?)(ed|ing)$/,w=/.$/,k=/(at|bl|iz)$/,_=new RegExp("([^aeiouylsz])\\1$"),H=new RegExp("^"+s+i+"[^aeiouwxy]$"),A=/^(.+?[^aeiou])y$/,j=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,$=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,N=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,q=/^(.+?)(s|t)(ion)$/,P=/^(.+?)e$/,z=/ll$/,W=new RegExp("^"+s+i+"[^aeiouwxy]$"),V=function(c){var y,I,T,h,x,O,M;if(c.length<3)return c;if(T=c.substr(0,1),T=="y"&&(c=T.toUpperCase()+c.substr(1)),h=L,x=p,h.test(c)?c=c.replace(h,"$1$2"):x.test(c)&&(c=c.replace(x,"$1$2")),h=m,x=S,h.test(c)){var E=h.exec(c);h=v,h.test(E[1])&&(h=w,c=c.replace(h,""))}else if(x.test(c)){var E=x.exec(c);y=E[1],x=g,x.test(y)&&(c=y,x=k,O=_,M=H,x.test(c)?c=c+"e":O.test(c)?(h=w,c=c.replace(h,"")):M.test(c)&&(c=c+"e"))}if(h=A,h.test(c)){var E=h.exec(c);y=E[1],c=y+"i"}if(h=j,h.test(c)){var E=h.exec(c);y=E[1],I=E[2],h=v,h.test(y)&&(c=y+e[I])}if(h=$,h.test(c)){var E=h.exec(c);y=E[1],I=E[2],h=v,h.test(y)&&(c=y+n[I])}if(h=N,x=q,h.test(c)){var E=h.exec(c);y=E[1],h=f,h.test(y)&&(c=y)}else if(x.test(c)){var E=x.exec(c);y=E[1]+E[2],x=f,x.test(y)&&(c=y)}if(h=P,h.test(c)){var E=h.exec(c);y=E[1],h=f,x=b,O=W,(h.test(y)||x.test(y)&&!O.test(y))&&(c=y)}return h=z,x=f,h.test(c)&&x.test(c)&&(h=w,c=c.replace(h,"")),T=="y"&&(c=T.toLowerCase()+c.substr(1)),c};return function(R){return R.update(V)}}(),t.Pipeline.registerFunction(t.stemmer,"stemmer");t.generateStopWordFilter=function(e){var n=e.reduce(function(r,i){return r[i]=i,r},{});return function(r){if(r&&n[r.toString()]!==r.toString())return r}},t.stopWordFilter=t.generateStopWordFilter(["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]),t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter");t.trimmer=function(e){return e.update(function(n){return n.replace(/^\W+/,"").replace(/\W+$/,"")})},t.Pipeline.registerFunction(t.trimmer,"trimmer");t.TokenSet=function(){this.final=!1,this.edges={},this.id=t.TokenSet._nextId,t.TokenSet._nextId+=1},t.TokenSet._nextId=1,t.TokenSet.fromArray=function(e){for(var n=new t.TokenSet.Builder,r=0,i=e.length;r<i;r++)n.insert(e[r]);return n.finish(),n.root},t.TokenSet.fromClause=function(e){return"editDistance"in e?t.TokenSet.fromFuzzyString(e.term,e.editDistance):t.TokenSet.fromString(e.term)},t.TokenSet.fromFuzzyString=function(e,n){for(var r=new t.TokenSet,i=[{node:r,editsRemaining:n,str:e}];i.length;){var s=i.pop();if(s.str.length>0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),v=s.str.charAt(1),f;v in s.node.edges?f=s.node.edges[v]:(f=new t.TokenSet,s.node.edges[v]=f),s.str.length==1&&(f.final=!0),i.push({node:f,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i<s;i++){var o=e[i],a=i==s-1;if(o=="*")n.edges[o]=n,n.final=a;else{var l=new t.TokenSet;l.final=a,n.edges[o]=l,n=l}}return r},t.TokenSet.prototype.toArray=function(){for(var e=[],n=[{prefix:"",node:this}];n.length;){var r=n.pop(),i=Object.keys(r.node.edges),s=i.length;r.node.final&&(r.prefix.charAt(0),e.push(r.prefix));for(var o=0;o<s;o++){var a=i[o];n.push({prefix:r.prefix.concat(a),node:r.node.edges[a]})}}return e},t.TokenSet.prototype.toString=function(){if(this._str)return this._str;for(var e=this.final?"1":"0",n=Object.keys(this.edges).sort(),r=n.length,i=0;i<r;i++){var s=n[i],o=this.edges[s];e=e+s+o.id}return e},t.TokenSet.prototype.intersect=function(e){for(var n=new t.TokenSet,r=void 0,i=[{qNode:e,output:n,node:this}];i.length;){r=i.pop();for(var s=Object.keys(r.qNode.edges),o=s.length,a=Object.keys(r.node.edges),l=a.length,u=0;u<o;u++)for(var d=s[u],v=0;v<l;v++){var f=a[v];if(f==d||d=="*"){var b=r.node.edges[f],g=r.qNode.edges[d],L=b.final&&g.final,p=void 0;f in r.output.edges?(p=r.output.edges[f],p.final=p.final||L):(p=new t.TokenSet,p.final=L,r.output.edges[f]=p),i.push({qNode:g,output:p,node:b})}}}return n},t.TokenSet.Builder=function(){this.previousWord="",this.root=new t.TokenSet,this.uncheckedNodes=[],this.minimizedNodes={}},t.TokenSet.Builder.prototype.insert=function(e){var n,r=0;if(e<this.previousWord)throw new Error("Out of order word insertion");for(var i=0;i<e.length&&i<this.previousWord.length&&e[i]==this.previousWord[i];i++)r++;this.minimize(r),this.uncheckedNodes.length==0?n=this.root:n=this.uncheckedNodes[this.uncheckedNodes.length-1].child;for(var i=r;i<e.length;i++){var s=new t.TokenSet,o=e[i];n.edges[o]=s,this.uncheckedNodes.push({parent:n,char:o,child:s}),n=s}n.final=!0,this.previousWord=e},t.TokenSet.Builder.prototype.finish=function(){this.minimize(0)},t.TokenSet.Builder.prototype.minimize=function(e){for(var n=this.uncheckedNodes.length-1;n>=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l<this.fields.length;l++)i[this.fields[l]]=new t.Vector;e.call(n,n);for(var l=0;l<n.clauses.length;l++){var u=n.clauses[l],d=null,v=t.Set.empty;u.usePipeline?d=this.pipeline.runString(u.term,{fields:u.fields}):d=[u.term];for(var f=0;f<d.length;f++){var b=d[f];u.term=b;var g=t.TokenSet.fromClause(u),L=this.tokenSet.intersect(g).toArray();if(L.length===0&&u.presence===t.Query.presence.REQUIRED){for(var p=0;p<u.fields.length;p++){var m=u.fields[p];o[m]=t.Set.empty}break}for(var S=0;S<L.length;S++)for(var w=L[S],k=this.invertedIndex[w],_=k._index,p=0;p<u.fields.length;p++){var m=u.fields[p],H=k[m],A=Object.keys(H),j=w+"/"+m,$=new t.Set(A);if(u.presence==t.Query.presence.REQUIRED&&(v=v.union($),o[m]===void 0&&(o[m]=t.Set.complete)),u.presence==t.Query.presence.PROHIBITED){a[m]===void 0&&(a[m]=t.Set.empty),a[m]=a[m].union($);continue}if(i[m].upsert(_,u.boost,function(Qe,Ce){return Qe+Ce}),!s[j]){for(var N=0;N<A.length;N++){var q=A[N],P=new t.FieldRef(q,m),z=H[q],W;(W=r[P])===void 0?r[P]=new t.MatchData(w,m,z):W.add(w,m,z)}s[j]=!0}}}if(u.presence===t.Query.presence.REQUIRED)for(var p=0;p<u.fields.length;p++){var m=u.fields[p];o[m]=o[m].intersect(v)}}for(var V=t.Set.complete,R=t.Set.empty,l=0;l<this.fields.length;l++){var m=this.fields[l];o[m]&&(V=V.intersect(o[m])),a[m]&&(R=R.union(a[m]))}var c=Object.keys(r),y=[],I=Object.create(null);if(n.isNegated()){c=Object.keys(this.fieldVectors);for(var l=0;l<c.length;l++){var P=c[l],T=t.FieldRef.fromString(P);r[P]=new t.MatchData}}for(var l=0;l<c.length;l++){var T=t.FieldRef.fromString(c[l]),h=T.docRef;if(V.contains(h)&&!R.contains(h)){var x=this.fieldVectors[T],O=i[T.fieldName].similarity(x),M;if((M=I[h])!==void 0)M.score+=O,M.matchData.combine(r[T]);else{var E={ref:h,score:O,matchData:r[T]};I[h]=E,y.push(E)}}}return y.sort(function(Te,ke){return ke.score-Te.score})},t.Index.prototype.toJSON=function(){var e=Object.keys(this.invertedIndex).sort().map(function(r){return[r,this.invertedIndex[r]]},this),n=Object.keys(this.fieldVectors).map(function(r){return[r,this.fieldVectors[r].toJSON()]},this);return{version:t.version,fields:this.fields,fieldVectors:n,invertedIndex:e,pipeline:this.pipeline.toJSON()}},t.Index.load=function(e){var n={},r={},i=e.fieldVectors,s=Object.create(null),o=e.invertedIndex,a=new t.TokenSet.Builder,l=t.Pipeline.load(e.pipeline);e.version!=t.version&&t.utils.warn("Version mismatch when loading serialised index. Current version of lunr '"+t.version+"' does not match serialized index '"+e.version+"'");for(var u=0;u<i.length;u++){var d=i[u],v=d[0],f=d[1];r[v]=new t.Vector(f)}for(var u=0;u<o.length;u++){var d=o[u],b=d[0],g=d[1];a.insert(b),s[b]=g}return a.finish(),n.fields=e.fields,n.fieldVectors=r,n.invertedIndex=s,n.tokenSet=a.root,n.pipeline=l,new t.Index(n)};t.Builder=function(){this._ref="id",this._fields=Object.create(null),this._documents=Object.create(null),this.invertedIndex=Object.create(null),this.fieldTermFrequencies={},this.fieldLengths={},this.tokenizer=t.tokenizer,this.pipeline=new t.Pipeline,this.searchPipeline=new t.Pipeline,this.documentCount=0,this._b=.75,this._k1=1.2,this.termIndex=0,this.metadataWhitelist=[]},t.Builder.prototype.ref=function(e){this._ref=e},t.Builder.prototype.field=function(e,n){if(/\//.test(e))throw new RangeError("Field '"+e+"' contains illegal character '/'");this._fields[e]=n||{}},t.Builder.prototype.b=function(e){e<0?this._b=0:e>1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s<i.length;s++){var o=i[s],a=this._fields[o].extractor,l=a?a(e):e[o],u=this.tokenizer(l,{fields:[o]}),d=this.pipeline.run(u),v=new t.FieldRef(r,o),f=Object.create(null);this.fieldTermFrequencies[v]=f,this.fieldLengths[v]=0,this.fieldLengths[v]+=d.length;for(var b=0;b<d.length;b++){var g=d[b];if(f[g]==null&&(f[g]=0),f[g]+=1,this.invertedIndex[g]==null){var L=Object.create(null);L._index=this.termIndex,this.termIndex+=1;for(var p=0;p<i.length;p++)L[i[p]]=Object.create(null);this.invertedIndex[g]=L}this.invertedIndex[g][o][r]==null&&(this.invertedIndex[g][o][r]=Object.create(null));for(var m=0;m<this.metadataWhitelist.length;m++){var S=this.metadataWhitelist[m],w=g.metadata[S];this.invertedIndex[g][o][r][S]==null&&(this.invertedIndex[g][o][r][S]=[]),this.invertedIndex[g][o][r][S].push(w)}}}},t.Builder.prototype.calculateAverageFieldLengths=function(){for(var e=Object.keys(this.fieldLengths),n=e.length,r={},i={},s=0;s<n;s++){var o=t.FieldRef.fromString(e[s]),a=o.fieldName;i[a]||(i[a]=0),i[a]+=1,r[a]||(r[a]=0),r[a]+=this.fieldLengths[o]}for(var l=Object.keys(this._fields),s=0;s<l.length;s++){var u=l[s];r[u]=r[u]/i[u]}this.averageFieldLength=r},t.Builder.prototype.createFieldVectors=function(){for(var e={},n=Object.keys(this.fieldTermFrequencies),r=n.length,i=Object.create(null),s=0;s<r;s++){for(var o=t.FieldRef.fromString(n[s]),a=o.fieldName,l=this.fieldLengths[o],u=new t.Vector,d=this.fieldTermFrequencies[o],v=Object.keys(d),f=v.length,b=this._fields[a].boost||1,g=this._documents[o.docRef].boost||1,L=0;L<f;L++){var p=v[L],m=d[p],S=this.invertedIndex[p]._index,w,k,_;i[p]===void 0?(w=t.idf(this.invertedIndex[p],this.documentCount),i[p]=w):w=i[p],k=w*((this._k1+1)*m)/(this._k1*(1-this._b+this._b*(l/this.averageFieldLength[a]))+m),k*=b,k*=g,_=Math.round(k*1e3)/1e3,u.insert(S,_)}e[o]=u}this.fieldVectors=e},t.Builder.prototype.createTokenSet=function(){this.tokenSet=t.TokenSet.fromArray(Object.keys(this.invertedIndex).sort())},t.Builder.prototype.build=function(){return this.calculateAverageFieldLengths(),this.createFieldVectors(),this.createTokenSet(),new t.Index({invertedIndex:this.invertedIndex,fieldVectors:this.fieldVectors,tokenSet:this.tokenSet,fields:Object.keys(this._fields),pipeline:this.searchPipeline})},t.Builder.prototype.use=function(e){var n=Array.prototype.slice.call(arguments,1);n.unshift(this),e.apply(this,n)},t.MatchData=function(e,n,r){for(var i=Object.create(null),s=Object.keys(r||{}),o=0;o<s.length;o++){var a=s[o];i[a]=r[a].slice()}this.metadata=Object.create(null),e!==void 0&&(this.metadata[e]=Object.create(null),this.metadata[e][n]=i)},t.MatchData.prototype.combine=function(e){for(var n=Object.keys(e.metadata),r=0;r<n.length;r++){var i=n[r],s=Object.keys(e.metadata[i]);this.metadata[i]==null&&(this.metadata[i]=Object.create(null));for(var o=0;o<s.length;o++){var a=s[o],l=Object.keys(e.metadata[i][a]);this.metadata[i][a]==null&&(this.metadata[i][a]=Object.create(null));for(var u=0;u<l.length;u++){var d=l[u];this.metadata[i][a][d]==null?this.metadata[i][a][d]=e.metadata[i][a][d]:this.metadata[i][a][d]=this.metadata[i][a][d].concat(e.metadata[i][a][d])}}}},t.MatchData.prototype.add=function(e,n,r){if(!(e in this.metadata)){this.metadata[e]=Object.create(null),this.metadata[e][n]=r;return}if(!(n in this.metadata[e])){this.metadata[e][n]=r;return}for(var i=Object.keys(r),s=0;s<i.length;s++){var o=i[s];o in this.metadata[e][n]?this.metadata[e][n][o]=this.metadata[e][n][o].concat(r[o]):this.metadata[e][n][o]=r[o]}},t.Query=function(e){this.clauses=[],this.allFields=e},t.Query.wildcard=new String("*"),t.Query.wildcard.NONE=0,t.Query.wildcard.LEADING=1,t.Query.wildcard.TRAILING=2,t.Query.presence={OPTIONAL:1,REQUIRED:2,PROHIBITED:3},t.Query.prototype.clause=function(e){return"fields"in e||(e.fields=this.allFields),"boost"in e||(e.boost=1),"usePipeline"in e||(e.usePipeline=!0),"wildcard"in e||(e.wildcard=t.Query.wildcard.NONE),e.wildcard&t.Query.wildcard.LEADING&&e.term.charAt(0)!=t.Query.wildcard&&(e.term="*"+e.term),e.wildcard&t.Query.wildcard.TRAILING&&e.term.slice(-1)!=t.Query.wildcard&&(e.term=""+e.term+"*"),"presence"in e||(e.presence=t.Query.presence.OPTIONAL),this.clauses.push(e),this},t.Query.prototype.isNegated=function(){for(var e=0;e<this.clauses.length;e++)if(this.clauses[e].presence!=t.Query.presence.PROHIBITED)return!1;return!0},t.Query.prototype.term=function(e,n){if(Array.isArray(e))return e.forEach(function(i){this.term(i,t.utils.clone(n))},this),this;var r=n||{};return r.term=e.toString(),this.clause(r),this},t.QueryParseError=function(e,n,r){this.name="QueryParseError",this.message=e,this.start=n,this.end=r},t.QueryParseError.prototype=new Error,t.QueryLexer=function(e){this.lexemes=[],this.str=e,this.length=e.length,this.pos=0,this.start=0,this.escapeCharPositions=[]},t.QueryLexer.prototype.run=function(){for(var e=t.QueryLexer.lexText;e;)e=e(this)},t.QueryLexer.prototype.sliceString=function(){for(var e=[],n=this.start,r=this.pos,i=0;i<this.escapeCharPositions.length;i++)r=this.escapeCharPositions[i],e.push(this.str.slice(n,r)),n=r+1;return e.push(this.str.slice(n,this.pos)),this.escapeCharPositions.length=0,e.join("")},t.QueryLexer.prototype.emit=function(e){this.lexemes.push({type:e,str:this.sliceString(),start:this.start,end:this.pos}),this.start=this.pos},t.QueryLexer.prototype.escapeCharacter=function(){this.escapeCharPositions.push(this.pos-1),this.pos+=1},t.QueryLexer.prototype.next=function(){if(this.pos>=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos<this.length},t.QueryLexer.EOS="EOS",t.QueryLexer.FIELD="FIELD",t.QueryLexer.TERM="TERM",t.QueryLexer.EDIT_DISTANCE="EDIT_DISTANCE",t.QueryLexer.BOOST="BOOST",t.QueryLexer.PRESENCE="PRESENCE",t.QueryLexer.lexField=function(e){return e.backup(),e.emit(t.QueryLexer.FIELD),e.ignore(),t.QueryLexer.lexText},t.QueryLexer.lexTerm=function(e){if(e.width()>1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof se=="object"?oe.exports=n():e.lunr=n()}(this,function(){return t})})()});var re=[];function G(t,e){re.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureActivePageVisible(),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible())}createComponents(e){re.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r}}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var ie=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var de=De(ae());async function le(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=de.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function he(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{le(e,t)}),le(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");let s=!1;i.addEventListener("mousedown",()=>s=!0),i.addEventListener("mouseup",()=>{s=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{s||(s=!1,t.classList.remove("has-focus"))}),Ae(t,i,r,e)}function Ae(t,e,n,r){n.addEventListener("input",ie(()=>{Ne(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ve(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?ue(e,-1):s.key==="ArrowDown"?ue(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function Ne(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s=i?r.index.search(`*${i}*`):[];for(let o=0;o<s.length;o++){let a=s[o],l=r.data.rows[Number(a.ref)],u=1;l.name.toLowerCase().startsWith(i.toLowerCase())&&(u*=1+1/(1+Math.abs(l.name.length-i.length))),a.score*=u}if(s.length===0){let o=document.createElement("li");o.classList.add("no-results");let a=document.createElement("span");a.textContent="No results found",o.appendChild(a),e.appendChild(o)}s.sort((o,a)=>a.score-o.score);for(let o=0,a=Math.min(10,s.length);o<a;o++){let l=r.data.rows[Number(s[o].ref)],u=`<svg width="20" height="20" viewBox="0 0 24 24" fill="none" class="tsd-kind-icon"><use href="#icon-${l.kind}"></use></svg>`,d=ce(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=`<span class="parent">
${ce(l.parent,i)}.</span>${d}`);let v=document.createElement("li");v.classList.value=l.classes??"";let f=document.createElement("a");f.href=r.base+l.url,f.innerHTML=u+d,v.append(f),e.appendChild(v)}}function ue(t,e){let n=t.querySelector(".current");if(!n)n=t.querySelector(e==1?"li:first-child":"li:last-child"),n&&n.classList.add("current");else{let r=n;if(e===1)do r=r.nextElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);else do r=r.previousElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);r&&(n.classList.remove("current"),r.classList.add("current"))}}function Ve(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),e.blur()}}function ce(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(K(t.substring(s,o)),`<b>${K(t.substring(o,o+r.length))}</b>`),s=o+r.length,o=n.indexOf(r,s);return i.push(K(t.substring(s))),i.join("")}var Be={"&":"&amp;","<":"&lt;",">":"&gt;","'":"&#039;",'"':"&quot;"};function K(t){return t.replace(/[&<>"'"]/g,e=>Be[e])}var C=class{constructor(e){this.el=e.el,this.app=e.app}};var F="mousedown",pe="mousemove",B="mouseup",J={x:0,y:0},fe=!1,ee=!1,He=!1,D=!1,me=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(me?"is-mobile":"not-mobile");me&&"ontouchstart"in document.documentElement&&(He=!0,F="touchstart",pe="touchmove",B="touchend");document.addEventListener(F,t=>{ee=!0,D=!1;let e=F=="touchstart"?t.targetTouches[0]:t;J.y=e.pageY||0,J.x=e.pageX||0});document.addEventListener(pe,t=>{if(ee&&!D){let e=F=="touchstart"?t.targetTouches[0]:t,n=J.x-(e.pageX||0),r=J.y-(e.pageY||0);D=Math.sqrt(n*n+r*r)>10}});document.addEventListener(B,()=>{ee=!1});document.addEventListener("click",t=>{fe&&(t.preventDefault(),t.stopImmediatePropagation(),fe=!1)});var X=class extends C{constructor(n){super(n);this.className=this.el.dataset.toggle||"",this.el.addEventListener(B,r=>this.onPointerUp(r)),this.el.addEventListener("click",r=>r.preventDefault()),document.addEventListener(F,r=>this.onDocumentPointerDown(r)),document.addEventListener(B,r=>this.onDocumentPointerUp(r))}setActive(n){if(this.active==n)return;this.active=n,document.documentElement.classList.toggle("has-"+this.className,n),this.el.classList.toggle("active",n);let r=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(r),setTimeout(()=>document.documentElement.classList.remove(r),500)}onPointerUp(n){D||(this.setActive(!0),n.preventDefault())}onDocumentPointerDown(n){if(this.active){if(n.target.closest(".col-sidebar, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(n){if(!D&&this.active&&n.target.closest(".col-sidebar")){let r=n.target.closest("a");if(r){let i=window.location.href;i.indexOf("#")!=-1&&(i=i.substring(0,i.indexOf("#"))),r.href.substring(0,i.length)==i&&setTimeout(()=>this.setActive(!1),250)}}}};var te;try{te=localStorage}catch{te={getItem(){return null},setItem(){}}}var Q=te;var ve=document.head.appendChild(document.createElement("style"));ve.dataset.for="filters";var Y=class extends C{constructor(n){super(n);this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),ve.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; }
`}fromLocalStorage(){let n=Q.getItem(this.key);return n?n==="true":this.el.checked}setLocalStorage(n){Q.setItem(this.key,n.toString()),this.value=n,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),this.app.filterChanged(),document.querySelectorAll(".tsd-index-section").forEach(n=>{n.style.display="block";let r=Array.from(n.querySelectorAll(".tsd-index-link")).every(i=>i.offsetParent==null);n.style.display=r?"none":"block"})}};var Z=class extends C{constructor(n){super(n);this.summary=this.el.querySelector(".tsd-accordion-summary"),this.icon=this.summary.querySelector("svg"),this.key=`tsd-accordion-${this.summary.dataset.key??this.summary.textContent.trim().replace(/\s+/g,"-").toLowerCase()}`;let r=Q.getItem(this.key);this.el.open=r?r==="true":this.el.open,this.el.addEventListener("toggle",()=>this.update());let i=this.summary.querySelector("a");i&&i.addEventListener("click",()=>{location.assign(i.href)}),this.update()}update(){this.icon.style.transform=`rotate(${this.el.open?0:-90}deg)`,Q.setItem(this.key,this.el.open.toString())}};function ge(t){let e=Q.getItem("tsd-theme")||"os";t.value=e,ye(e),t.addEventListener("change",()=>{Q.setItem("tsd-theme",t.value),ye(t.value)})}function ye(t){document.documentElement.dataset.theme=t}var Le;function be(){let t=document.getElementById("tsd-nav-script");t&&(t.addEventListener("load",xe),xe())}async function xe(){let t=document.getElementById("tsd-nav-container");if(!t||!window.navigationData)return;let n=await(await fetch(window.navigationData)).arrayBuffer(),r=new Blob([n]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();Le=t.dataset.base+"/",t.innerHTML="";for(let s of i)we(s,t,[]);window.app.createComponents(t),window.app.ensureActivePageVisible()}function we(t,e,n){let r=e.appendChild(document.createElement("li"));if(t.children){let i=[...n,t.text],s=r.appendChild(document.createElement("details"));s.className=t.class?`${t.class} tsd-index-accordion`:"tsd-index-accordion",s.dataset.key=i.join("$");let o=s.appendChild(document.createElement("summary"));o.className="tsd-accordion-summary",o.innerHTML='<svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="#icon-chevronDown"></use></svg>',Ee(t,o);let a=s.appendChild(document.createElement("div"));a.className="tsd-accordion-details";let l=a.appendChild(document.createElement("ul"));l.className="tsd-nested-navigation";for(let u of t.children)we(u,l,i)}else Ee(t,r,t.class)}function Ee(t,e,n){if(t.path){let r=e.appendChild(document.createElement("a"));r.href=Le+t.path,n&&(r.className=n),location.href===r.href&&r.classList.add("current"),t.kind&&(r.innerHTML=`<svg width="20" height="20" viewBox="0 0 24 24" fill="none" class="tsd-kind-icon"><use href="#icon-${t.kind}"></use></svg>`),r.appendChild(document.createElement("span")).textContent=t.text}else e.appendChild(document.createElement("span")).textContent=t.text}G(X,"a[data-toggle]");G(Z,".tsd-index-accordion");G(Y,".tsd-filter-item input[type=checkbox]");var Se=document.getElementById("tsd-theme");Se&&ge(Se);var je=new U;Object.defineProperty(window,"app",{value:je});he();be();})();
/*! Bundled license information:

@@ -6,0 +7,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc