File size: 1,218 Bytes
e4a10af |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class Context {
constructor(options) {
this.options = options;
if (options.resolvePath)
this.resolvePath = options.resolvePath.bind(options);
}
static from(contextOrOptions) {
if (contextOrOptions instanceof Context)
return contextOrOptions;
else
return new Context(contextOrOptions);
}
resolvePath(path) {
return path;
}
nonFatalError(error, errorBuffer) {
const reporter = this.options.onNonFatalError;
if (reporter) {
if (errorBuffer)
errorBuffer.catching(() => reporter(error));
else
reporter(error);
}
else
throw error;
}
warning(error, errorBuffer) {
const reporter = this.options.onNonFatalError;
if (reporter) {
if (errorBuffer)
errorBuffer.catching(() => reporter(error));
else
reporter(error);
}
}
get canWarn() {
return !!this.options.onNonFatalError;
}
}
exports.default = Context;
//# sourceMappingURL=Context.js.map |