/
_config.js
37 lines (36 loc) · 1008 Bytes
/
_config.js
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
const path = require('path');
const { encode } = require('sourcemap-codec');
const ID_MAIN = path.join(__dirname, 'main.js');
module.exports = {
description: 'handles when a low resolution sourcemap is used to report an error',
options: {
plugins: {
name: 'test-plugin',
transform() {
// each entry of each line consist of
// [generatedColumn, sourceIndex, sourceLine, sourceColumn];
// this mapping only maps the first line to itself
const decodedMap = [[[0], [0, 0, 0, 0], [1]]];
return { code: 'export default this', map: { mappings: encode(decodedMap), sources: [] } };
}
}
},
warnings: [
{
code: 'THIS_IS_UNDEFINED',
frame: `
1: console.log('original source');
^`,
id: ID_MAIN,
loc: {
column: 0,
file: ID_MAIN,
line: 1
},
message:
"The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten",
pos: 15,
url: 'https://rollupjs.org/guide/en/#error-this-is-undefined'
}
]
};