Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a3b89e5
commit 786909a
Showing
25 changed files
with
170 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
test/form/samples/custom-module-context-function/_expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
global.prop = 'foo'; | ||
|
||
undefined.prop = 'bar'; | ||
|
||
window.prop = 'main'; |
7 changes: 0 additions & 7 deletions
7
test/form/samples/custom-module-context-function/_expected/amd.js
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
test/form/samples/custom-module-context-function/_expected/cjs.js
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
test/form/samples/custom-module-context-function/_expected/es.js
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
test/form/samples/custom-module-context-function/_expected/iife.js
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
test/form/samples/custom-module-context-function/_expected/system.js
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
test/form/samples/custom-module-context-function/_expected/umd.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
this.prop = 'bar'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
this.prop = 'nope'; | ||
this.prop = 'foo'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
import './foo.js'; | ||
this.prop = '???'; | ||
import './bar.js'; | ||
this.prop = 'main'; |
28 changes: 28 additions & 0 deletions
28
test/form/samples/side-effects-internal-modules/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const assert = require('assert'); | ||
const VIRTUAL_ID = '\0virtual'; | ||
|
||
module.exports = { | ||
description: 'does not pass internal modules to moduleSideEffects', | ||
expectedWarnings: ['EMPTY_BUNDLE'], | ||
options: { | ||
treeshake: { | ||
moduleSideEffects: id => { | ||
assert.notStrictEqual(id, VIRTUAL_ID); | ||
return false; | ||
} | ||
}, | ||
plugins: { | ||
name: 'test-plugin', | ||
resolveId(id) { | ||
if (id === 'virtual') { | ||
return VIRTUAL_ID; | ||
} | ||
}, | ||
load(id) { | ||
if (id === VIRTUAL_ID) { | ||
return "console.log('effect')"; | ||
} | ||
} | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
console.log('effect'); | ||
|
||
console.log('main'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import 'virtual'; | ||
console.log('main'); |
45 changes: 45 additions & 0 deletions
45
test/function/samples/cannot-resolve-sourcemap-warning/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const path = require('path'); | ||
const ID_MAIN = path.join(__dirname, 'main.js'); | ||
|
||
module.exports = { | ||
description: 'handles when a sourcemap cannot be resolved in a warning', | ||
options: { | ||
plugins: { | ||
name: 'test-plugin', | ||
transform() { | ||
return { code: 'export default this', map: { mappings: 'X' } }; | ||
} | ||
} | ||
}, | ||
warnings: [ | ||
{ | ||
code: 'SOURCEMAP_ERROR', | ||
id: ID_MAIN, | ||
loc: { | ||
column: 15, | ||
file: ID_MAIN, | ||
line: 1 | ||
}, | ||
message: | ||
"Error when using sourcemap for reporting an error: Can't resolve original location of error.", | ||
pos: 15 | ||
}, | ||
{ | ||
code: 'THIS_IS_UNDEFINED', | ||
frame: ` | ||
1: export default this | ||
^ | ||
`, | ||
id: ID_MAIN, | ||
loc: { | ||
column: 15, | ||
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' | ||
} | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
throw new Error('Not executed'); |
25 changes: 25 additions & 0 deletions
25
test/function/samples/emit-file/chunk-filename-not-available-buildEnd/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
let chunkId; | ||
|
||
module.exports = { | ||
description: 'Throws when accessing the filename before it has been generated in buildEnd', | ||
options: { | ||
input: 'main.js', | ||
plugins: { | ||
name: 'test-plugin', | ||
buildStart() { | ||
chunkId = this.emitFile({ type: 'chunk', id: 'chunk.js' }); | ||
}, | ||
buildEnd() { | ||
this.getFileName(chunkId); | ||
} | ||
} | ||
}, | ||
error: { | ||
code: 'PLUGIN_ERROR', | ||
hook: 'buildEnd', | ||
message: | ||
'Plugin error - Unable to get file name for chunk "chunk.js". Ensure that generate is called first.', | ||
plugin: 'test-plugin', | ||
pluginCode: 'CHUNK_NOT_GENERATED' | ||
} | ||
}; |
1 change: 1 addition & 0 deletions
1
test/function/samples/emit-file/chunk-filename-not-available-buildEnd/chunk.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('chunk'); |
1 change: 1 addition & 0 deletions
1
test/function/samples/emit-file/chunk-filename-not-available-buildEnd/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('main'); |
25 changes: 25 additions & 0 deletions
25
test/function/samples/emit-file/chunk-filename-not-available-renderStart/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
let chunkId; | ||
|
||
module.exports = { | ||
description: 'Throws when accessing the filename before it has been generated in renderStart', | ||
options: { | ||
input: 'main.js', | ||
plugins: { | ||
name: 'test-plugin', | ||
buildStart() { | ||
chunkId = this.emitFile({ type: 'chunk', id: 'chunk.js' }); | ||
}, | ||
renderStart() { | ||
this.getFileName(chunkId); | ||
} | ||
} | ||
}, | ||
generateError: { | ||
code: 'PLUGIN_ERROR', | ||
hook: 'renderStart', | ||
message: | ||
'Plugin error - Unable to get file name for chunk "chunk.js". Ensure that generate is called first.', | ||
plugin: 'test-plugin', | ||
pluginCode: 'CHUNK_NOT_GENERATED' | ||
} | ||
}; |
1 change: 1 addition & 0 deletions
1
test/function/samples/emit-file/chunk-filename-not-available-renderStart/chunk.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('chunk'); |
1 change: 1 addition & 0 deletions
1
test/function/samples/emit-file/chunk-filename-not-available-renderStart/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('main'); |