Socket
Socket
Sign inDemoInstall

typedoc

Package Overview
Dependencies
15
Maintainers
0
Versions
305
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.26.0 to 0.26.1

14

dist/lib/application.js

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

}
const origFiles = this.files;
const origOptions = this.options;

@@ -530,10 +531,19 @@ const projects = [];

this.options = options;
const project = await this.convert();
this.files = new FileRegistry_1.ValidatingFileRegistry();
let project = await this.convert();
if (project) {
this.validate(project);
projects.push(this.serializer.projectToObject(project, process.cwd()));
const serialized = this.serializer.projectToObject(project, process.cwd());
projects.push(serialized);
}
// When debugging memory issues, it's useful to set these
// here so that a breakpoint on resetReflectionID below
// gets the memory as it ought to be with all TS objects released.
project = undefined;
this.files = undefined;
// global.gc!();
(0, abstract_1.resetReflectionID)();
}
this.options = origOptions;
this.files = origFiles;
if (projects.length !== packageDirs.length) {

@@ -540,0 +550,0 @@ this.logger.error(this.i18n.failed_to_convert_packages());

8

dist/lib/converter/comments/parser.js

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

};
const reentry = new textParser_1.TextParserReentryState();
const content = [];

@@ -109,2 +110,3 @@ const lexer = makeLookaheadGenerator(tokens);

const next = lexer.peek();
reentry.checkState(next);
switch (next.kind) {

@@ -119,3 +121,3 @@ case lexer_1.TokenSyntaxKind.TypeAnnotation:

case lexer_1.TokenSyntaxKind.CloseBrace:
(0, textParser_1.textContent)(file.fileName, next, logger.i18n, (msg, token) => logger.warn(msg, token.pos, file), content, files, atNewLine);
(0, textParser_1.textContent)(file.fileName, next, logger.i18n, (msg, token) => logger.warn(msg, token.pos, file), content, files, atNewLine, reentry);
break;

@@ -373,4 +375,6 @@ case lexer_1.TokenSyntaxKind.Code:

let atNewLine = true;
const reentry = new textParser_1.TextParserReentryState();
loop: while (!lexer.done()) {
const next = lexer.peek();
reentry.checkState(next);
let consume = true;

@@ -383,3 +387,3 @@ switch (next.kind) {

(0, textParser_1.textContent)(comment.sourcePath, next, i18n, warning,
/*out*/ content, files, atNewLine);
/*out*/ content, files, atNewLine, reentry);
break;

@@ -386,0 +390,0 @@ case lexer_1.TokenSyntaxKind.Code:

@@ -13,5 +13,16 @@ /**

/**
* This is incredibly unfortunate. The comment lexer owns the responsibility
* for splitting up text into text/code, this is totally fine for HTML links
* but for markdown links, ``[`code`](./link)`` is valid, so we need to keep
* track of state across calls to {@link textContent}.
*/
export declare class TextParserReentryState {
withinLinkLabel: boolean;
private lastPartWasNewline;
checkState(token: Token): void;
}
/**
* Look for relative links within a piece of text and add them to the {@link FileRegistry}
* so that they can be correctly resolved during rendering.
*/
export declare function textContent(sourcePath: string, token: Token, i18n: TranslationProxy, warning: (msg: TranslatedString, token: Token) => void, outContent: CommentDisplayPart[], files: FileRegistry, atNewLine: boolean): void;
export declare function textContent(sourcePath: string, token: Token, i18n: TranslationProxy, warning: (msg: TranslatedString, token: Token) => void, outContent: CommentDisplayPart[], files: FileRegistry, atNewLine: boolean, reentry: TextParserReentryState): void;

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.TextParserReentryState = void 0;
exports.textContent = textContent;

@@ -13,6 +14,34 @@ const html_1 = require("../../utils/html");

/**
* This is incredibly unfortunate. The comment lexer owns the responsibility
* for splitting up text into text/code, this is totally fine for HTML links
* but for markdown links, ``[`code`](./link)`` is valid, so we need to keep
* track of state across calls to {@link textContent}.
*/
class TextParserReentryState {
constructor() {
this.withinLinkLabel = false;
this.lastPartWasNewline = false;
}
checkState(token) {
switch (token.kind) {
case lexer_1.TokenSyntaxKind.Code:
if (/\n\s*\n/.test(token.text)) {
this.withinLinkLabel = false;
}
break;
case lexer_1.TokenSyntaxKind.NewLine:
if (this.lastPartWasNewline) {
this.withinLinkLabel = false;
}
break;
}
this.lastPartWasNewline = token.kind === lexer_1.TokenSyntaxKind.NewLine;
}
}
exports.TextParserReentryState = TextParserReentryState;
/**
* Look for relative links within a piece of text and add them to the {@link FileRegistry}
* so that they can be correctly resolved during rendering.
*/
function textContent(sourcePath, token, i18n, warning, outContent, files, atNewLine) {
function textContent(sourcePath, token, i18n, warning, outContent, files, atNewLine, reentry) {
let lastPartEnd = 0;

@@ -22,3 +51,3 @@ const data = {

token,
pos: 0,
pos: 0, // relative to the token
i18n,

@@ -44,3 +73,4 @@ warning,

kind: lexer_1.TokenSyntaxKind.Text,
pos: ref.pos,
// ref.pos is relative to the token, but this pos is relative to the file.
pos: token.pos + ref.pos,
text: token.text.slice(ref.pos, ref.end),

@@ -51,3 +81,3 @@ });

while (data.pos < token.text.length) {
const link = checkMarkdownLink(data);
const link = checkMarkdownLink(data, reentry);
if (link) {

@@ -84,24 +114,40 @@ addRef(link);

*/
function checkMarkdownLink(data) {
function checkMarkdownLink(data, reentry) {
const { token, sourcePath, files } = data;
if (token.text[data.pos] === "[") {
const labelEnd = findLabelEnd(token.text, data.pos + 1);
if (labelEnd !== -1 &&
token.text[labelEnd] === "]" &&
token.text[labelEnd + 1] === "(") {
const link = MdHelpers.parseLinkDestination(token.text, labelEnd + 2, token.text.length);
if (link.ok) {
// Only make a relative-link display part if it's actually a relative link.
// Discard protocol:// links, unix style absolute paths, and windows style absolute paths.
if (isRelativeLink(link.str)) {
return {
pos: labelEnd + 2,
end: link.pos,
target: files.register(sourcePath, link.str),
};
}
// This was a link, skip ahead to ensure we don't happen to parse
// something else as a link within the link.
data.pos = link.pos - 1;
let searchStart;
if (reentry.withinLinkLabel) {
searchStart = data.pos;
reentry.withinLinkLabel = false;
}
else if (token.text[data.pos] === "[") {
searchStart = data.pos + 1;
}
else {
return;
}
const labelEnd = findLabelEnd(token.text, searchStart);
if (labelEnd === -1) {
// This markdown link might be split across multiple display parts
// [ `text` ](link)
// ^^ text
// ^^^^^^ code
// ^^^^^^^^ text
reentry.withinLinkLabel = true;
return;
}
if (token.text[labelEnd] === "]" && token.text[labelEnd + 1] === "(") {
const link = MdHelpers.parseLinkDestination(token.text, labelEnd + 2, token.text.length);
if (link.ok) {
// Only make a relative-link display part if it's actually a relative link.
// Discard protocol:// links, unix style absolute paths, and windows style absolute paths.
if (isRelativeLink(link.str)) {
return {
pos: labelEnd + 2,
end: link.pos,
target: files.register(sourcePath, link.str),
};
}
// This was a link, skip ahead to ensure we don't happen to parse
// something else as a link within the link.
data.pos = link.pos - 1;
}

@@ -184,3 +230,3 @@ }

function isRelativeLink(link) {
return !/^[a-z]+:\/\/|^\/|^[a-z]:\\/i.test(link);
return !/^[a-z]+:\/\/|^\/|^[a-z]:\\|^#/i.test(link);
}

@@ -192,2 +238,3 @@ function findLabelEnd(text, pos) {

case "]":
case "[":
return pos;

@@ -194,0 +241,0 @@ }

@@ -274,4 +274,3 @@ "use strict";

}
if (reflection.kindOf(models_1.ReflectionKind.Module | models_1.ReflectionKind.Namespace) ||
reflection.kind === models_1.ReflectionKind.Project) {
if (reflection.kindOf(models_1.ReflectionKind.Project | models_1.ReflectionKind.SomeModule)) {
comment.removeTags("@module");

@@ -342,2 +341,6 @@ comment.removeModifier("@packageDocumentation");

onBeginResolve(context) {
if (context.project.comment) {
this.applyModifiers(context.project, context.project.comment);
this.removeExcludedTags(context.project.comment);
}
const project = context.project;

@@ -344,0 +347,0 @@ const reflections = Object.values(project.reflections);

@@ -126,4 +126,4 @@ import type { Reflection } from "../reflections";

text: string;
target?: string | Reflection | ReflectionSymbolId | undefined;
tsLinkText?: string | undefined;
target?: Reflection | string | ReflectionSymbolId;
tsLinkText?: string;
} | {

@@ -130,0 +130,0 @@ kind: "relative-link";

import type { Deserializer, Serializer } from "../serialization";
import type { FileRegistry as JSONMediaRegistry } from "../serialization/schema";
import type { FileRegistry as JSONFileRegistry } from "../serialization/schema";
import type { Reflection } from "./reflections";

@@ -20,8 +20,13 @@ export declare class FileRegistry {

getNameToAbsoluteMap(): ReadonlyMap<string, string>;
toObject(ser: Serializer): JSONMediaRegistry;
fromObject(de: Deserializer, obj: JSONMediaRegistry): void;
toObject(ser: Serializer): JSONFileRegistry;
/**
* Revive a file registry from disc.
* Note that in the packages context this may be called multiple times on
* a single object, and should merge in files from the other registries.
*/
fromObject(de: Deserializer, obj: JSONFileRegistry): void;
}
export declare class ValidatingFileRegistry extends FileRegistry {
register(sourcePath: string, relativePath: string): number | undefined;
fromObject(de: Deserializer, obj: JSONMediaRegistry): void;
fromObject(de: Deserializer, obj: JSONFileRegistry): void;
}

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

this.nextId = 1;
// The combination of thest two make up the registry
// The combination of these two make up the registry
this.mediaToReflection = new Map();

@@ -91,2 +91,7 @@ this.mediaToPath = new Map();

}
/**
* Revive a file registry from disc.
* Note that in the packages context this may be called multiple times on
* a single object, and should merge in files from the other registries.
*/
fromObject(de, obj) {

@@ -93,0 +98,0 @@ for (const [key, val] of Object.entries(obj.entries)) {

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

this.packageVersion = obj.packageVersion;
this.project.files.fromObject(de, obj.files || {});
de.defer(() => {

@@ -134,0 +135,0 @@ for (const [id, sid] of Object.entries(obj.symbolIdMap || {})) {

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

}
this.files.fromObject(de, obj.files);
this.files.fromObject(de, obj.files || {});
de.defer(() => {

@@ -302,0 +302,0 @@ // Unnecessary conditional in release

@@ -56,8 +56,8 @@ import type { PageEvent, Renderer } from "../..";

memberSignatureBody: (props: import("../../../models").SignatureReflection, r_1?: {
hideSources?: boolean | undefined;
hideSources?: boolean;
} | undefined) => import("../../../utils/jsx.elements").JsxElement;
memberSignatureTitle: (props: import("../../../models").SignatureReflection, r_1?: {
hideName?: boolean | undefined;
arrowStyle?: boolean | undefined;
hideParamTypes?: boolean | undefined;
hideName?: boolean;
arrowStyle?: boolean;
hideParamTypes?: boolean;
} | undefined) => import("../../../utils/jsx.elements").JsxElement;

@@ -64,0 +64,0 @@ memberSignatures: (props: DeclarationReflection) => import("../../../utils/jsx.elements").JsxElement;

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

highlight: (code, lang) => {
code = (0, highlighter_1.highlight)(code, lang || "ts");
code = this.getHighlighted(code, lang || "ts");
code = code.replace(/\n$/, "") + "\n";

@@ -262,0 +262,0 @@ if (!lang) {

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

const shiki = await import("shiki");
const hl = await shiki.getHighlighter({ themes: [lightTheme, darkTheme], langs });
const hl = await shiki.createHighlighter({ themes: [lightTheme, darkTheme], langs });
highlighter = new DoubleHighlighter(hl, lightTheme, darkTheme);

@@ -139,0 +139,0 @@ }

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

while (pos >= starts[starts.length - 1]) {
const nextStart = this.text.indexOf("\n", starts[starts.length - 1] + 1);
const nextStart = this.text.indexOf("\n", starts[starts.length - 1]);
if (nextStart === -1) {

@@ -24,0 +24,0 @@ starts.push(Infinity);

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

optionSnapshots.set(key, {
values: JSON.stringify(this._values),
values: { ...this._values },
set: new Set(this._setOptions),

@@ -89,3 +89,3 @@ });

const data = optionSnapshots.get(snapshot);
this._values = JSON.parse(data.values);
this._values = { ...data.values };
this._setOptions = new Set(data.set);

@@ -181,3 +181,3 @@ }

if (declaration.type === declaration_1.ParameterType.Flags) {
Object.assign(this._values[declaration.name], converted);
this._values[declaration.name] = Object.assign({}, this._values[declaration.name], converted);
}

@@ -184,0 +184,0 @@ else {

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

let fileContent;
if (file.endsWith(".json")) {
if (file.endsWith(".json") || file.endsWith(".jsonc")) {
const readResult = typescript_1.default.readConfigFile((0, paths_1.normalizePath)(file), (path) => FS.readFileSync(path, "utf-8"));

@@ -84,0 +84,0 @@ if (readResult.error) {

export declare const tsdocBlockTags: readonly ["@defaultValue", "@deprecated", "@example", "@param", "@privateRemarks", "@remarks", "@returns", "@see", "@throws", "@typeParam"];
export declare const blockTags: readonly ["@defaultValue", "@deprecated", "@example", "@param", "@privateRemarks", "@remarks", "@returns", "@see", "@throws", "@typeParam", "@category", "@categoryDescription", "@default", "@document", "@group", "@groupDescription", "@inheritDoc", "@license", "@module", "@return", "@template", "@type", "@typedef", "@callback", "@prop", "@property", "@satisfies", "@import", "@jsx"];
export declare const blockTags: readonly ["@defaultValue", "@deprecated", "@example", "@param", "@privateRemarks", "@remarks", "@returns", "@see", "@throws", "@typeParam", "@author", "@callback", "@category", "@categoryDescription", "@default", "@document", "@group", "@groupDescription", "@import", "@inheritDoc", "@jsx", "@license", "@module", "@prop", "@property", "@return", "@satisfies", "@template", "@type", "@typedef"];
export declare const tsdocInlineTags: readonly ["@link", "@inheritDoc", "@label"];
export declare const inlineTags: readonly ["@link", "@inheritDoc", "@label", "@linkcode", "@linkplain"];
export declare const tsdocModifierTags: readonly ["@alpha", "@beta", "@eventProperty", "@experimental", "@internal", "@override", "@packageDocumentation", "@private", "@protected", "@public", "@readonly", "@sealed", "@virtual"];
export declare const modifierTags: readonly ["@alpha", "@beta", "@eventProperty", "@experimental", "@internal", "@override", "@packageDocumentation", "@private", "@protected", "@public", "@readonly", "@sealed", "@virtual", "@class", "@enum", "@event", "@hidden", "@hideCategories", "@hideGroups", "@ignore", "@interface", "@namespace", "@overload", "@showCategories", "@showGroups", "@hideconstructor"];
export declare const tsdocModifierTags: readonly ["@alpha", "@beta", "@eventProperty", "@experimental", "@internal", "@override", "@packageDocumentation", "@public", "@readonly", "@sealed", "@virtual"];
export declare const modifierTags: readonly ["@alpha", "@beta", "@eventProperty", "@experimental", "@internal", "@override", "@packageDocumentation", "@public", "@readonly", "@sealed", "@virtual", "@class", "@enum", "@event", "@hidden", "@hideCategories", "@hideconstructor", "@hideGroups", "@ignore", "@interface", "@namespace", "@overload", "@private", "@protected", "@showCategories", "@showGroups"];

@@ -19,2 +19,4 @@ "use strict";

...exports.tsdocBlockTags,
"@author",
"@callback",
"@category",

@@ -26,17 +28,14 @@ "@categoryDescription",

"@groupDescription",
"@import",
"@inheritDoc",
"@jsx",
"@license",
"@module",
"@return",
// Alias for @typeParam
"@template",
// Because TypeScript is important!
"@type",
"@typedef",
"@callback",
"@prop",
"@property",
"@return",
"@satisfies",
"@import",
"@jsx",
"@template", // Alias for @typeParam
"@type", // Because TypeScript is important!
"@typedef",
];

@@ -57,4 +56,2 @@ exports.tsdocInlineTags = ["@link", "@inheritDoc", "@label"];

"@packageDocumentation",
"@private",
"@protected",
"@public",

@@ -72,2 +69,3 @@ "@readonly",

"@hideCategories",
"@hideconstructor",
"@hideGroups",

@@ -78,5 +76,6 @@ "@ignore",

"@overload",
"@private",
"@protected",
"@showCategories",
"@showGroups",
"@hideconstructor",
];
{
"name": "typedoc",
"description": "Create api documentation for TypeScript projects.",
"version": "0.26.0",
"version": "0.26.1",
"homepage": "https://typedoc.org",

@@ -30,3 +30,3 @@ "exports": {

"minimatch": "^9.0.4",
"shiki": "^1.6.5",
"shiki": "^1.9.0",
"yaml": "^2.4.5"

@@ -48,6 +48,6 @@ },

"prettier": "3.3.2",
"puppeteer": "^22.11.0",
"puppeteer": "^22.12.0",
"ts-node": "^10.9.2",
"typescript": "5.5.0-beta",
"typescript-eslint": "^7.13.0"
"typescript": "5.5.2",
"typescript-eslint": "^7.13.1"
},

@@ -54,0 +54,0 @@ "files": [

@@ -7,2 +7,6 @@ {

{
"tagName": "@author",
"syntaxKind": "block"
},
{
"tagName": "@module",

@@ -12,2 +16,6 @@ "syntaxKind": "block"

{
"tagName": "@type",
"syntaxKind": "block"
},
{
"tagName": "@typedef",

@@ -97,3 +105,3 @@ "syntaxKind": "block"

"tagName": "@linkplain",
"syntaxKind": "block",
"syntaxKind": "inline",
"allowMultiple": true

@@ -100,0 +108,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc