Skip to content

Commit a0faec0

Browse files
Add basic decorator support, see #97
1 parent 89f6dd4 commit a0faec0

File tree

5 files changed

+454
-55
lines changed

5 files changed

+454
-55
lines changed

bin/typedoc.d.ts

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,6 +1337,24 @@ declare module td.models {
13371337
interface ITraverseCallback {
13381338
(reflection: Reflection, property: TraverseProperty): void;
13391339
}
1340+
/**
1341+
* Defines the usage of a decorator.
1342+
*/
1343+
interface IDecorator {
1344+
/**
1345+
* The name of the decorator being applied.
1346+
*/
1347+
name: string;
1348+
/**
1349+
* The type declaring the decorator.
1350+
* Usually a ReferenceType instance pointing to the decorator function.
1351+
*/
1352+
type?: Type;
1353+
/**
1354+
* A named map of arguments the decorator is applied with.
1355+
*/
1356+
arguments?: any;
1357+
}
13401358
/**
13411359
* Base class for all reflection classes.
13421360
*
@@ -1382,6 +1400,14 @@ declare module td.models {
13821400
* A list of all source files that contributed to this reflection.
13831401
*/
13841402
sources: ISourceReference[];
1403+
/**
1404+
* A list of all decorators attached to this reflection.
1405+
*/
1406+
decorators: IDecorator[];
1407+
/**
1408+
* A list of all types that are decorated by this reflection.
1409+
*/
1410+
decorates: Type[];
13851411
/**
13861412
* The url of this reflection in the generated documentation.
13871413
*/
@@ -1632,6 +1658,49 @@ declare module td.converter {
16321658
static parseComment(text: string, comment?: models.Comment): models.Comment;
16331659
}
16341660
}
1661+
declare module td.converter {
1662+
/**
1663+
* A plugin that detects decorators.
1664+
*/
1665+
class DecoratorPlugin extends ConverterPlugin {
1666+
private usages;
1667+
/**
1668+
* Create a new ImplementsPlugin instance.
1669+
*
1670+
* @param converter The converter this plugin should be attached to.
1671+
*/
1672+
constructor(converter: Converter);
1673+
/**
1674+
* Create an object describing the arguments a decorator is set with.
1675+
*
1676+
* @param args The arguments resolved from the decorator's call expression.
1677+
* @param signature The signature definition of the decorator being used.
1678+
* @returns An object describing the decorator parameters,
1679+
*/
1680+
private extractArguments(args, signature);
1681+
/**
1682+
* Triggered when the converter begins converting a project.
1683+
*
1684+
* @param context The context object describing the current state the converter is in.
1685+
*/
1686+
private onBegin(context);
1687+
/**
1688+
* Triggered when the converter has created a declaration or signature reflection.
1689+
*
1690+
* @param context The context object describing the current state the converter is in.
1691+
* @param reflection The reflection that is currently processed.
1692+
* @param node The node that is currently processed if available.
1693+
*/
1694+
private onDeclaration(context, reflection, node?);
1695+
/**
1696+
* Triggered when the converter resolves a reflection.
1697+
*
1698+
* @param context The context object describing the current state the converter is in.
1699+
* @param reflection The reflection that is currently resolved.
1700+
*/
1701+
private onBeginResolve(context);
1702+
}
1703+
}
16351704
declare module td.converter {
16361705
/**
16371706
* A handler that moves comments with dot syntax to their target.

0 commit comments

Comments
 (0)