Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit f04465b

Browse files
committed
refactor(rollup): update to new rollup warning/error format
1 parent 5caa0a7 commit f04465b

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

src/rollup.ts

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,14 @@ let cachedBundle: RollupBundle = null;
142142
function createOnWarnFn() {
143143
const previousWarns: {[key: string]: boolean} = {};
144144

145-
return function onWarningMessage(msg: string) {
146-
if (msg in previousWarns) {
145+
return function onWarningMessage(warning: RollupWarning) {
146+
if (warning && warning.message in previousWarns) {
147147
return;
148148
}
149-
previousWarns[msg] = true;
149+
previousWarns[warning.message] = true;
150150

151-
if (!(IGNORE_WARNS.some(warnIgnore => msg.indexOf(warnIgnore) > -1))) {
152-
Logger.warn(`rollup: ${msg}`);
151+
if (!(IGNORE_WARNS.some(warnIgnore => warning.message.indexOf(warnIgnore) > -1))) {
152+
Logger.warn(`rollup: ${warning.loc.file} has issued a warning: ${warning.message}`);
153153
}
154154
};
155155
}
@@ -177,16 +177,29 @@ export interface RollupConfig {
177177
dest?: string;
178178
cache?: RollupBundle;
179179
onwarn?: Function;
180-
}
181-
180+
};
182181

183182
export interface RollupBundle {
184183
// https://github.com/rollup/rollup/wiki/JavaScript-API
185184
write?: Function;
186185
modules: RollupModule[];
187-
}
186+
};
188187

189188

190189
export interface RollupModule {
191190
id: string;
192-
}
191+
};
192+
193+
export interface RollupWarning {
194+
code: string;
195+
message: string;
196+
url: string;
197+
pos: number;
198+
loc: RollupLocationInfo;
199+
};
200+
201+
export interface RollupLocationInfo {
202+
file: string;
203+
line: number;
204+
column: number;
205+
};

0 commit comments

Comments
 (0)