Skip to content

Commit

Permalink
Merge branch 'master' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit0 committed Jul 25, 2022
2 parents fc31e7d + e50cd27 commit 9aa61bb
Show file tree
Hide file tree
Showing 54 changed files with 404 additions and 1,326 deletions.
2 changes: 1 addition & 1 deletion .config/typedoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"MarkedPlugin"
],
"entryPoints": ["../src"],
"entryPointStrategy": "Resolve",
"entryPointStrategy": "resolve",
"excludeExternals": true,
"excludeInternal": false,
"excludePrivate": true,
Expand Down
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,36 @@

# Unreleased

## v0.23.9 (2022-07-24)

### Bug Fixes

- TypeDoc will no longer skip entry points which have no exports, #2007.
If using `"entryPointStrategy": "expand"`, this change may result in new pages being added to your documentation.
If this is not desired, you can use the `exclude` option to filter them out.
- Fixed missing comments on callable variable-functions constructed indirectly, #2008.
- Packages mode will now respect the `--includeVersion` flag, #2010.
- Fixed multiple reflections mapping to the same file name on case insensitive file systems, #2012.

## v0.23.8 (2022-07-17)

### Features

- Added defined in links for classes, enums, #180.
- Added support for `*.ghe.com` and `*.github.us` GitHub enterprise domains for source links, #2001.
- Expose `Converter.parseRawComment` for plugins to parse additional markdown files, #2004.

### Bug Fixes

- TypeDoc will no longer emit a warning for `{@link}` containing a URL, #1980.
- `excludeNotDocumented` will no longer remove functions/methods/accessors which are documented, #1994.
- Fixed missing `sources` property on signature reflections #1996.

### Thanks!

- @cary-hu
- @chadhietala

## v0.23.7 (2022-07-09)

### Bug Fixes
Expand Down Expand Up @@ -103,6 +133,7 @@
- `{@link}` tags in comments will now be resolved as declaration references similar to TSDoc's declaration references.
For most cases, this will just work. See [the documentation](https://typedoc.org/guides/link-resolution/) for details on how link resolution works.
- TypeDoc will now produce warnings for bracketed links (`[[ target ]]`). Use `{@link target}` instead. The `{@link}` syntax will be recognized by [TypeScript 4.3](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-3.html#editor-support-for-link-tags) and later and used to provide better intellisense. TypeDoc version 0.24.0 will remove support for `[[ target ]]` style links.
Support for `` [[`links`]] `` with brackets + code ticks have been dropped.
- `extends` in typedoc.json is now resolved using NodeJS module resolution, so a local path must begin with `./`.
- In the JSON output for `DeclarationReflection`s, `getSignature` is no longer a one-tuple.
- In the JSON output for `DeclarationReflection`s, `setSignature` is no longer a one-tuple.
Expand Down
36 changes: 18 additions & 18 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,39 +34,39 @@ Here are some examples we wanted to highlight:

### Rendering

- Markdown showcase: [[`markdownShowcase`]]
- Syntax highlighting showcase: [[`syntaxHighlightingShowcase`]]
- Markdown showcase: {@link markdownShowcase | `markdownShowcase`}
- Syntax highlighting showcase: {@link syntaxHighlightingShowcase | `syntaxHighlightingShowcase` }

### Functions

- Simple functions: [[`sqrt`]] and [[`sqrtArrowFunction`]]
- A generic function: [[`concat`]]
- Functions that take an options object: [[`makeHttpCallA`]] and [[`makeHttpCallB`]]
- An overloaded function: [[`overloadedFunction`]]
- An external function exported under a different name: [[`lodashSortBy`]]
- Simple functions: {@link sqrt | `sqrt` } and {@link sqrtArrowFunction | `sqrtArrowFunction` }
- A generic function: {@link concat | `concat` }
- Functions that take an options object: {@link makeHttpCallA | `makeHttpCallA` } and {@link makeHttpCallB | `makeHttpCallB` }
- An overloaded function: {@link overloadedFunction | `overloadedFunction` }
- An external function exported under a different name: {@link lodashSortBy | `lodashSortBy` }

### Types

- Type aliases: [[`SimpleTypeAlias`]] and [[`ComplexGenericTypeAlias`]]
- Interfaces: [[`User`]] and [[`AdminUser`]]
- Type aliases: {@link SimpleTypeAlias | `SimpleTypeAlias` } and {@link ComplexGenericTypeAlias | `ComplexGenericTypeAlias` }
- Interfaces: {@link User | `User` } and {@link AdminUser | `AdminUser` }

### Classes

- A basic class: [[`Customer`]]
- A subclass: [[`DeliveryCustomer`]]
- A complex class: [[`CancellablePromise`]]
- A class that extends a built-in generic type: [[`StringArray`]]
- A basic class: {@link Customer | `Customer` }
- A subclass: {@link DeliveryCustomer | `DeliveryCustomer` }
- A complex class: {@link CancellablePromise | `CancellablePromise` }
- A class that extends a built-in generic type: {@link StringArray | `StringArray` }

### Enums

- A basic enum: [[`SimpleEnum`]]
- Using the `@enum` tag: [[`EnumLikeObject`]]
- A basic enum: {@link SimpleEnum | `SimpleEnum` }
- Using the `@enum` tag: {@link EnumLikeObject | `EnumLikeObject` }

### Variables

- [[`PI`]], [[`STRING_CONSTANT`]], and [[`ObjectConstant`]]
- {@link PI | `PI` }, {@link STRING_CONSTANT | `STRING_CONSTANT` }, and {@link ObjectConstant | `ObjectConstant` }

### React Components

- Basic React components: [[`CardA`]] and [[`CardB`]]
- A complex React component: [[`EasyFormDialog`]] and [[`EasyFormDialogProps`]]
- Basic React components: {@link CardA | `CardA` } and {@link CardB | `CardB` }
- A complex React component: {@link EasyFormDialog | `EasyFormDialog` } and {@link EasyFormDialogProps | `EasyFormDialogProps` }
4 changes: 2 additions & 2 deletions example/src/classes/CancellablePromise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const noop = () => {
};

/**
* If canceled, a [[`CancellablePromise`]] should throw an `Cancellation` object.
* If canceled, a {@link CancellablePromise | `CancellablePromise`} should throw an `Cancellation` object.
*/
class Cancellation extends Error {
constructor(message = "Promise canceled.") {
Expand Down Expand Up @@ -301,7 +301,7 @@ export class CancellablePromise<T> {
*
* @param values an array that may contain `CancellablePromise`s, promises,
* thenables, and resolved values
* @returns a [[`CancellablePromise`]], which, if canceled, will cancel each
* @returns a {@link CancellablePromise | `CancellablePromise`}, which, if canceled, will cancel each
* of the promises passed in to `CancellablePromise.all`.
*/
static all(values: readonly unknown[]): CancellablePromise<unknown> {
Expand Down
2 changes: 1 addition & 1 deletion example/src/classes/Customer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export abstract class Customer {
}

/**
* A class that extends [[`Customer`]].
* A class that extends {@link Customer | `Customer`}.
*/
export class DeliveryCustomer extends Customer {
/** A property defined on the subclass. */
Expand Down
2 changes: 1 addition & 1 deletion example/src/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function concat<T>(array1: T[], array2: T[]): T[] {
}

/**
* The options type for [[`makeHttpCallA`]].
* The options type for {@link makeHttpCallA}.
*/
export interface MakeHttpCallAOptions {
url: string;
Expand Down
4 changes: 2 additions & 2 deletions example/src/reactComponents.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ReactElement, PropsWithChildren } from "react";

/**
* The props type for [[`CardA`]].
* The props type for {@link CardA}.
*/
export interface CardAProps {
/** The theme of the card. Defaults to `primary`. */
Expand Down Expand Up @@ -81,7 +81,7 @@ export function CardB({
return <div className={`card card-${variant}`}>{children}</div>;
}

/** The props type of [[`EasyFormDialog`]]. */
/** The props type of {@link EasyFormDialog | `EasyFormDialog`}. */
export interface EasyFormDialogProps {
/** The title of the dialog. Can be a JSX element. */
title: React.ReactNode;
Expand Down
2 changes: 1 addition & 1 deletion example/src/showcase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* const x: number | string = 12
* ```
*
* See [[`syntaxHighlightingShowcase`]] for more code blocks.
* See {@link syntaxHighlightingShowcase | `syntaxHighlightingShowcase`} for more code blocks.
*
* ## A List
*
Expand Down
2 changes: 1 addition & 1 deletion example/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface User {
}

/**
* An interface that extends [[`User`]] and adds more properties.
* An interface that extends {@link User | `User`} and adds more properties.
*
* Notice how TypeDoc automatically shows the inheritance hierarchy and where
* each property was originally defined.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "typedoc",
"description": "Create api documentation for TypeScript projects.",
"version": "0.23.7",
"version": "0.23.9",
"homepage": "https://typedoc.org",
"main": "./dist/index.js",
"exports": {
Expand Down Expand Up @@ -66,7 +66,8 @@
"/tsdoc.json"
],
"scripts": {
"test": "c8 mocha -r ts-node/register --config .config/mocha.fast.json",
"test": "mocha -r ts-node/register --config .config/mocha.fast.json",
"test:cov": "c8 mocha -r ts-node/register --config .config/mocha.fast.json",
"build:c2": "node bin/typedoc --tsconfig src/test/converter2/tsconfig.json",
"test:full": "c8 mocha -r ts-node/register --config .config/mocha.full.json",
"test:visual": "node ./dist/test/capture-screenshots.js && reg-suit -c .config/regconfig.json compare",
Expand Down
11 changes: 9 additions & 2 deletions src/lib/converter/comments/discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ const wantedKinds: Record<ReflectionKind, ts.SyntaxKind[]> = {
[ReflectionKind.Function]: [
ts.SyntaxKind.FunctionDeclaration,
ts.SyntaxKind.BindingElement,
ts.SyntaxKind.VariableDeclaration,
ts.SyntaxKind.ExportAssignment,
ts.SyntaxKind.PropertyAccessExpression,
],
[ReflectionKind.Class]: [
ts.SyntaxKind.ClassDeclaration,
Expand Down Expand Up @@ -106,8 +109,12 @@ export function discoverComment(
// See the gh1770 test for an example.
if (
kind & ReflectionKind.ContainsCallSignatures &&
!(node as ts.FunctionDeclaration).body &&
node.kind !== ts.SyntaxKind.BindingElement
[
ts.SyntaxKind.FunctionDeclaration,
ts.SyntaxKind.MethodDeclaration,
ts.SyntaxKind.Constructor,
].includes(node.kind) &&
!(node as ts.FunctionDeclaration).body
) {
continue;
}
Expand Down
32 changes: 17 additions & 15 deletions src/lib/converter/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ export class Converter extends ChildableComponent<

/**
* Triggered when the converter has created a signature reflection.
* The listener will be given {@link Context}, {@link SignatureReflection} | {@link ProjectReflection} and a `ts.Node?`
* The listener will be given {@link Context}, {@link SignatureReflection} | {@link ProjectReflection} and
* `ts.SignatureDeclaration | ts.IndexSignatureDeclaration | ts.JSDocSignature | undefined`
* @event
*/
static readonly EVENT_CREATE_SIGNATURE = ConverterEvents.CREATE_SIGNATURE;
Expand Down Expand Up @@ -183,6 +184,18 @@ export class Converter extends ChildableComponent<
return convertType(context, node);
}

/**
* Parse the given file into a comment. Intended to be used with markdown files.
*/
parseRawComment(file: MinimalSourceFile) {
return parseComment(
lexCommentString(file.text),
this.config,
file,
this.application.logger
);
}

/**
* Compile the files within the given context and convert the compiler symbols to reflections.
*
Expand Down Expand Up @@ -227,15 +240,6 @@ export class Converter extends ChildableComponent<
const symbol = getSymbolForModuleLike(context, node);
let moduleContext: Context;

const allExports = getExports(context, node, symbol);

if (allExports.every((exp) => this.shouldIgnore(exp))) {
this.owner.logger.verbose(
`All members of ${entryName} are excluded, ignoring entry point.`
);
return;
}

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.
Expand Down Expand Up @@ -264,11 +268,8 @@ export class Converter extends ChildableComponent<

if (entryPoint.readmeFile) {
const readme = readFile(entryPoint.readmeFile);
const comment = parseComment(
lexCommentString(readme),
context.converter.config,
new MinimalSourceFile(readme, entryPoint.readmeFile),
context.logger
const comment = this.parseRawComment(
new MinimalSourceFile(readme, entryPoint.readmeFile)
);

if (comment.blockTags.length || comment.modifierTags.size) {
Expand All @@ -292,6 +293,7 @@ export class Converter extends ChildableComponent<
moduleContext = context.withScope(reflection);
}

const allExports = getExports(context, node, symbol);
for (const exp of allExports.filter((exp) =>
isDirectExport(context.resolveAliasedSymbol(exp), node)
)) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/converter/factories/signature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export function createSignature(
break;
}

context.trigger(ConverterEvents.CREATE_SIGNATURE, sigRef);
context.trigger(ConverterEvents.CREATE_SIGNATURE, sigRef, declaration);
}

function convertParameters(
Expand Down
Loading

0 comments on commit 9aa61bb

Please sign in to comment.