-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test that rollup-plugin-commonjs works with preserveModules (#2792)
* Extend filename sanitation and test that rollup-plugin-commonjs works with preserveModules * Just adapt tests as replacing : does not work nicely on windows
- Loading branch information
1 parent
fee090c
commit 7837fc5
Showing
26 changed files
with
307 additions
and
10 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
11 changes: 11 additions & 0 deletions
11
test/chunking-form/samples/preserve-modules-commonjs/_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,11 @@ | ||
const commonjs = require('rollup-plugin-commonjs'); | ||
|
||
module.exports = { | ||
description: 'Handles output from rollup-plugin-commonjs', | ||
options: { | ||
input: 'main.js', | ||
preserveModules: true, | ||
external: ['external'], | ||
plugins: [commonjs()] | ||
} | ||
}; |
9 changes: 9 additions & 0 deletions
9
...form/samples/preserve-modules-commonjs/_expected/amd/_virtual/_commonjs-external-external
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,9 @@ | ||
define(['exports', 'external'], function (exports, external) { 'use strict'; | ||
|
||
external = external && external.hasOwnProperty('default') ? external['default'] : external; | ||
|
||
|
||
|
||
exports.default = external; | ||
|
||
}); |
7 changes: 7 additions & 0 deletions
7
test/chunking-form/samples/preserve-modules-commonjs/_expected/amd/_virtual/other.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,7 @@ | ||
define(['exports', '../other.js'], function (exports, __chunk_1) { 'use strict'; | ||
|
||
|
||
|
||
exports.default = __chunk_1.__moduleExports; | ||
|
||
}); |
14 changes: 14 additions & 0 deletions
14
test/chunking-form/samples/preserve-modules-commonjs/_expected/amd/commonjs.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,14 @@ | ||
define(['exports', 'external', './other.js', './_virtual/_commonjs-external-external', './_virtual/other.js'], function (exports, external, __chunk_1, __chunk_2, __chunk_3) { 'use strict'; | ||
|
||
external = external && external.hasOwnProperty('default') ? external['default'] : external; | ||
|
||
const { value } = __chunk_3.default; | ||
|
||
console.log(__chunk_2.default, value); | ||
|
||
var commonjs = 42; | ||
|
||
exports.__moduleExports = commonjs; | ||
exports.default = commonjs; | ||
|
||
}); |
7 changes: 7 additions & 0 deletions
7
test/chunking-form/samples/preserve-modules-commonjs/_expected/amd/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,7 @@ | ||
define(['external', './commonjs.js'], function (external, __chunk_4) { 'use strict'; | ||
|
||
external = external && external.hasOwnProperty('default') ? external['default'] : external; | ||
|
||
console.log(__chunk_4.default, external); | ||
|
||
}); |
12 changes: 12 additions & 0 deletions
12
test/chunking-form/samples/preserve-modules-commonjs/_expected/amd/other.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,12 @@ | ||
define(['exports'], function (exports) { 'use strict'; | ||
|
||
var value = 43; | ||
|
||
var other = { | ||
value: value | ||
}; | ||
|
||
exports.__moduleExports = other; | ||
exports.value = value; | ||
|
||
}); |
9 changes: 9 additions & 0 deletions
9
...form/samples/preserve-modules-commonjs/_expected/cjs/_virtual/_commonjs-external-external
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,9 @@ | ||
'use strict'; | ||
|
||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
|
||
var external = _interopDefault(require('external')); | ||
|
||
|
||
|
||
exports.default = external; |
7 changes: 7 additions & 0 deletions
7
test/chunking-form/samples/preserve-modules-commonjs/_expected/cjs/_virtual/other.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,7 @@ | ||
'use strict'; | ||
|
||
var __chunk_1 = require('../other.js'); | ||
|
||
|
||
|
||
exports.default = __chunk_1.__moduleExports; |
15 changes: 15 additions & 0 deletions
15
test/chunking-form/samples/preserve-modules-commonjs/_expected/cjs/commonjs.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,15 @@ | ||
'use strict'; | ||
|
||
require('external'); | ||
require('./other.js'); | ||
var __chunk_2 = require('./_virtual/_commonjs-external-external'); | ||
var __chunk_3 = require('./_virtual/other.js'); | ||
|
||
const { value } = __chunk_3.default; | ||
|
||
console.log(__chunk_2.default, value); | ||
|
||
var commonjs = 42; | ||
|
||
exports.__moduleExports = commonjs; | ||
exports.default = commonjs; |
8 changes: 8 additions & 0 deletions
8
test/chunking-form/samples/preserve-modules-commonjs/_expected/cjs/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,8 @@ | ||
'use strict'; | ||
|
||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
|
||
var external = _interopDefault(require('external')); | ||
var __chunk_4 = require('./commonjs.js'); | ||
|
||
console.log(__chunk_4.default, external); |
10 changes: 10 additions & 0 deletions
10
test/chunking-form/samples/preserve-modules-commonjs/_expected/cjs/other.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,10 @@ | ||
'use strict'; | ||
|
||
var value = 43; | ||
|
||
var other = { | ||
value: value | ||
}; | ||
|
||
exports.__moduleExports = other; | ||
exports.value = value; |
5 changes: 5 additions & 0 deletions
5
...-form/samples/preserve-modules-commonjs/_expected/es/_virtual/_commonjs-external-external
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 @@ | ||
import external from 'external'; | ||
|
||
|
||
|
||
export default external; |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/preserve-modules-commonjs/_expected/es/_virtual/other.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 @@ | ||
import { __moduleExports as other } from '../other.js'; | ||
|
||
|
||
|
||
export default other; |
13 changes: 13 additions & 0 deletions
13
test/chunking-form/samples/preserve-modules-commonjs/_expected/es/commonjs.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,13 @@ | ||
import 'external'; | ||
import './other.js'; | ||
import external from './_virtual/_commonjs-external-external'; | ||
import require$$0 from './_virtual/other.js'; | ||
|
||
const { value } = require$$0; | ||
|
||
console.log(external, value); | ||
|
||
var commonjs = 42; | ||
|
||
export default commonjs; | ||
export { commonjs as __moduleExports }; |
4 changes: 4 additions & 0 deletions
4
test/chunking-form/samples/preserve-modules-commonjs/_expected/es/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,4 @@ | ||
import external from 'external'; | ||
import value from './commonjs.js'; | ||
|
||
console.log(value, external); |
7 changes: 7 additions & 0 deletions
7
test/chunking-form/samples/preserve-modules-commonjs/_expected/es/other.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,7 @@ | ||
var value = 43; | ||
|
||
var other = { | ||
value: value | ||
}; | ||
|
||
export { other as __moduleExports, value }; |
14 changes: 14 additions & 0 deletions
14
...m/samples/preserve-modules-commonjs/_expected/system/_virtual/_commonjs-external-external
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,14 @@ | ||
System.register(['external'], function (exports, module) { | ||
'use strict'; | ||
var external; | ||
return { | ||
setters: [function (module) { | ||
external = module.default; | ||
}], | ||
execute: function () { | ||
|
||
exports('default', external); | ||
|
||
} | ||
}; | ||
}); |
14 changes: 14 additions & 0 deletions
14
test/chunking-form/samples/preserve-modules-commonjs/_expected/system/_virtual/other.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,14 @@ | ||
System.register(['../other.js'], function (exports, module) { | ||
'use strict'; | ||
var other; | ||
return { | ||
setters: [function (module) { | ||
other = module.__moduleExports; | ||
}], | ||
execute: function () { | ||
|
||
exports('default', other); | ||
|
||
} | ||
}; | ||
}); |
21 changes: 21 additions & 0 deletions
21
test/chunking-form/samples/preserve-modules-commonjs/_expected/system/commonjs.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,21 @@ | ||
System.register(['external', './other.js', './_virtual/_commonjs-external-external', './_virtual/other.js'], function (exports, module) { | ||
'use strict'; | ||
var external, require$$0; | ||
return { | ||
setters: [function () {}, function () {}, function (module) { | ||
external = module.default; | ||
}, function (module) { | ||
require$$0 = module.default; | ||
}], | ||
execute: function () { | ||
|
||
const { value } = require$$0; | ||
|
||
console.log(external, value); | ||
|
||
var commonjs = exports('__moduleExports', 42); | ||
exports('default', commonjs); | ||
|
||
} | ||
}; | ||
}); |
16 changes: 16 additions & 0 deletions
16
test/chunking-form/samples/preserve-modules-commonjs/_expected/system/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,16 @@ | ||
System.register(['external', './commonjs.js'], function (exports, module) { | ||
'use strict'; | ||
var external, value; | ||
return { | ||
setters: [function (module) { | ||
external = module.default; | ||
}, function (module) { | ||
value = module.default; | ||
}], | ||
execute: function () { | ||
|
||
console.log(value, external); | ||
|
||
} | ||
}; | ||
}); |
14 changes: 14 additions & 0 deletions
14
test/chunking-form/samples/preserve-modules-commonjs/_expected/system/other.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,14 @@ | ||
System.register([], function (exports, module) { | ||
'use strict'; | ||
return { | ||
execute: function () { | ||
|
||
var value = exports('value', 43); | ||
|
||
var other = exports('__moduleExports', { | ||
value: value | ||
}); | ||
|
||
} | ||
}; | ||
}); |
6 changes: 6 additions & 0 deletions
6
test/chunking-form/samples/preserve-modules-commonjs/commonjs.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,6 @@ | ||
const external = require('external'); | ||
const { value } = require('./other'); | ||
|
||
console.log(external, value); | ||
|
||
module.exports = 42; |
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,4 @@ | ||
import value from './commonjs'; | ||
import external from 'external'; | ||
|
||
console.log(value, external); |
Oops, something went wrong.