forked from matthisk/es6console
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprepack.js
More file actions
41 lines (34 loc) · 763 Bytes
/
prepack.js
File metadata and controls
41 lines (34 loc) · 763 Bytes
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
import Base from './base';
export default class Prepack extends Base {
static makeError( { lineNumber, description, column, endColumn = NaN } ) {
let l = lineNumber - 1;
return {
loc : {
line : l,
column : column,
offset : () => { return { line: l,column:endColumn}; }
},
message : description
};
}
loadCompiler() {
require.ensure(['prepack'],require => {
this.compiler = require('prepack');
this.resolveFuture();
});
}
compile( input ) {
this._checkIfCompilerIsLoaded();
let code = '',
errors = [];
try {
code = this.compiler.prepack(input).code;
} catch (e) {
// errors = [e];
}
return {
code,
errors
};
}
}