mirror of
https://github.com/ezolenko/rollup-plugin-typescript2.git
synced 2025-12-08 19:06:16 +00:00
- better errors when noEmitOnError set to true
This commit is contained in:
parent
32287495d4
commit
045b172275
13
dist/rollup-plugin-typescript2.cjs.js
vendored
13
dist/rollup-plugin-typescript2.cjs.js
vendored
@ -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) {
|
||||
|
||||
13
dist/rollup-plugin-typescript2.es.js
vendored
13
dist/rollup-plugin-typescript2.es.js
vendored
@ -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) {
|
||||
|
||||
@ -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
|
||||
|
||||
15
src/index.ts
15
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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user