diff --git a/dist/rollup-plugin-typescript2.cjs.js b/dist/rollup-plugin-typescript2.cjs.js index b62fb85..b9f42b7 100644 --- a/dist/rollup-plugin-typescript2.cjs.js +++ b/dist/rollup-plugin-typescript2.cjs.js @@ -406,8 +406,16 @@ function typescript(options) { var snapshot = servicesHost.setSnapshot(id, code); var result = cache.getCompiled(id, snapshot, function () { var output = services.getEmitOutput(id); - if (output.emitSkipped) - _this.error({ message: colors.red("failed to transpile " + id) }); + if (output.emitSkipped) { + var diagnostics = cache.getDiagnostics(id, snapshot, function () { + return services + .getCompilerOptionsDiagnostics() + .concat(services.getSyntacticDiagnostics(id)) + .concat(services.getSemanticDiagnostics(id)); + }); + printDiagnostics(_this, diagnostics); + _this.error(colors.red("failed to transpile " + id)); + } var transpiled = _.find(output.outputFiles, function (entry) { return _.endsWith(entry.name, ".js"); }); var map$$1 = _.find(output.outputFiles, function (entry) { return _.endsWith(entry.name, ".map"); }); return { @@ -418,6 +426,7 @@ function typescript(options) { return result; }, outro: function () { + context.debug("outro"); cache.compileDone(); if (options.check) { cache.walkTree(function (id) { diff --git a/dist/rollup-plugin-typescript2.es.js b/dist/rollup-plugin-typescript2.es.js index 09c2b3f..0dc977c 100644 --- a/dist/rollup-plugin-typescript2.es.js +++ b/dist/rollup-plugin-typescript2.es.js @@ -411,8 +411,16 @@ function typescript(options) { var snapshot = servicesHost.setSnapshot(id, code); var result = cache.getCompiled(id, snapshot, function () { var output = services.getEmitOutput(id); - if (output.emitSkipped) - _this.error({ message: red("failed to transpile " + id) }); + if (output.emitSkipped) { + var diagnostics = cache.getDiagnostics(id, snapshot, function () { + return services + .getCompilerOptionsDiagnostics() + .concat(services.getSyntacticDiagnostics(id)) + .concat(services.getSemanticDiagnostics(id)); + }); + printDiagnostics(_this, diagnostics); + _this.error(red("failed to transpile " + id)); + } var transpiled = find(output.outputFiles, function (entry) { return endsWith(entry.name, ".js"); }); var map$$1 = find(output.outputFiles, function (entry) { return endsWith(entry.name, ".map"); }); return { @@ -423,6 +431,7 @@ function typescript(options) { return result; }, outro: function () { + context.debug("outro"); cache.compileDone(); if (options.check) { cache.walkTree(function (id) { diff --git a/src/context.ts b/src/context.ts index 3ca05be..2110cfa 100644 --- a/src/context.ts +++ b/src/context.ts @@ -1,12 +1,8 @@ -interface Message -{ - message: string; -} export interface IRollupContext { - warn(message: Message | string): void; - error(message: Message | string): void; + warn(message: string): void; + error(message: string): void; } export interface IContext diff --git a/src/index.ts b/src/index.ts index 8ff8425..b3c11db 100644 --- a/src/index.ts +++ b/src/index.ts @@ -72,7 +72,7 @@ function parseTsConfig() return configParseResult; } -function printDiagnostics(context: IContext, diagnostics: IDiagnostics[]) +function printDiagnostics(context: IContext | IRollupContext, diagnostics: IDiagnostics[]) { _.each(diagnostics, (diagnostic) => { @@ -169,7 +169,17 @@ export default function typescript (options: IOptions) const output = services.getEmitOutput(id); if (output.emitSkipped) - this.error({ message: colors.red(`failed to transpile ${id}`)}); + { + const diagnostics = cache.getDiagnostics(id, snapshot, () => + { + return services + .getCompilerOptionsDiagnostics() + .concat(services.getSyntacticDiagnostics(id)) + .concat(services.getSemanticDiagnostics(id)); + }); + printDiagnostics(this, diagnostics); + this.error(colors.red(`failed to transpile ${id}`)); + } const transpiled = _.find(output.outputFiles, (entry: ts.OutputFile) => _.endsWith(entry.name, ".js") ); const map = _.find(output.outputFiles, (entry: ts.OutputFile) => _.endsWith(entry.name, ".map") ); @@ -185,6 +195,7 @@ export default function typescript (options: IOptions) outro(): void { + context.debug("outro"); cache.compileDone(); if (options.check)