Skip to content

Commit

Permalink
- forwarding transformers afterDeclarations
Browse files Browse the repository at this point in the history
  • Loading branch information
ezolenko committed Sep 11, 2019
1 parent 1b9fa28 commit 7765355
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/host.d.ts.map

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

1 change: 1 addition & 0 deletions dist/ioptions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as tsTypes from "typescript";
export interface ICustomTransformer {
before?: tsTypes.TransformerFactory<tsTypes.SourceFile>;
after?: tsTypes.TransformerFactory<tsTypes.SourceFile>;
afterDeclarations?: tsTypes.TransformerFactory<tsTypes.Bundle | tsTypes.SourceFile>;
}
export declare type TransformerFactoryCreator = (ls: tsTypes.LanguageService) => tsTypes.CustomTransformers | ICustomTransformer;
export interface IOptions {
Expand Down
2 changes: 1 addition & 1 deletion dist/ioptions.d.ts.map

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

3 changes: 3 additions & 0 deletions dist/rollup-plugin-typescript2.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -17300,13 +17300,16 @@ class LanguageServiceHost {
const transformer = {
before: [],
after: [],
afterDeclarations: [],
};
for (const creator of this.transformers) {
const factory = creator(this.service);
if (factory.before)
transformer.before = lodash_11(transformer.before, factory.before);
if (factory.after)
transformer.after = lodash_11(transformer.after, factory.after);
if (factory.afterDeclarations)
transformer.afterDeclarations = lodash_11(transformer.afterDeclarations, factory.afterDeclarations);
}
return transformer;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/rollup-plugin-typescript2.cjs.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions dist/rollup-plugin-typescript2.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -17294,13 +17294,16 @@ class LanguageServiceHost {
const transformer = {
before: [],
after: [],
afterDeclarations: [],
};
for (const creator of this.transformers) {
const factory = creator(this.service);
if (factory.before)
transformer.before = lodash_11(transformer.before, factory.before);
if (factory.after)
transformer.after = lodash_11(transformer.after, factory.after);
if (factory.afterDeclarations)
transformer.afterDeclarations = lodash_11(transformer.afterDeclarations, factory.afterDeclarations);
}
return transformer;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/rollup-plugin-typescript2.es.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export class LanguageServiceHost implements tsTypes.LanguageServiceHost
{
before: [],
after: [],
afterDeclarations: [],
};

for (const creator of this.transformers)
Expand All @@ -137,6 +138,8 @@ export class LanguageServiceHost implements tsTypes.LanguageServiceHost
transformer.before = _.concat(transformer.before!, factory.before);
if (factory.after)
transformer.after = _.concat(transformer.after!, factory.after);
if (factory.afterDeclarations)
transformer.afterDeclarations = _.concat(transformer.afterDeclarations!, factory.afterDeclarations);
}

return transformer;
Expand Down
1 change: 1 addition & 0 deletions src/ioptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface ICustomTransformer
{
before?: tsTypes.TransformerFactory<tsTypes.SourceFile>;
after?: tsTypes.TransformerFactory<tsTypes.SourceFile>;
afterDeclarations?: tsTypes.TransformerFactory<tsTypes.Bundle | tsTypes.SourceFile>;
}

export type TransformerFactoryCreator = (ls: tsTypes.LanguageService) => tsTypes.CustomTransformers | ICustomTransformer;
Expand Down

0 comments on commit 7765355

Please sign in to comment.