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
cecfc4d
commit 3481b81
Showing
18 changed files
with
134 additions
and
57 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
11 changes: 11 additions & 0 deletions
11
test/form/samples/reexport-external-default-as-name-and-name/_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 @@ | ||
module.exports = { | ||
description: 're-exports a named external export as default', | ||
expectedWarnings: ['MIXED_EXPORTS'], | ||
options: { | ||
external: ['external'], | ||
output: { | ||
globals: { external: 'external' }, | ||
name: 'bundle' | ||
} | ||
} | ||
}; |
11 changes: 11 additions & 0 deletions
11
test/form/samples/reexport-external-default-as-name-and-name/_expected/amd.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 @@ | ||
define(['exports', 'external'], function (exports, external) { 'use strict'; | ||
|
||
var external__default = 'default' in external ? external['default'] : external; | ||
|
||
console.log(external.value); | ||
|
||
exports.reexported = external__default; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
}); |
12 changes: 12 additions & 0 deletions
12
test/form/samples/reexport-external-default-as-name-and-name/_expected/cjs.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 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
|
||
var external = require('external'); | ||
var external__default = _interopDefault(external); | ||
|
||
console.log(external.value); | ||
|
||
exports.reexported = external__default; |
4 changes: 4 additions & 0 deletions
4
test/form/samples/reexport-external-default-as-name-and-name/_expected/es.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 { value } from 'external'; | ||
export { default as reexported } from 'external'; | ||
|
||
console.log(value); |
12 changes: 12 additions & 0 deletions
12
test/form/samples/reexport-external-default-as-name-and-name/_expected/iife.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 @@ | ||
var bundle = (function (exports, external) { | ||
'use strict'; | ||
|
||
var external__default = 'default' in external ? external['default'] : external; | ||
|
||
console.log(external.value); | ||
|
||
exports.reexported = external__default; | ||
|
||
return exports; | ||
|
||
}({}, external)); |
15 changes: 15 additions & 0 deletions
15
test/form/samples/reexport-external-default-as-name-and-name/_expected/system.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 @@ | ||
System.register('bundle', ['external'], function (exports) { | ||
'use strict'; | ||
var value; | ||
return { | ||
setters: [function (module) { | ||
value = module.value; | ||
exports('reexported', module.default); | ||
}], | ||
execute: function () { | ||
|
||
console.log(value); | ||
|
||
} | ||
}; | ||
}); |
15 changes: 15 additions & 0 deletions
15
test/form/samples/reexport-external-default-as-name-and-name/_expected/umd.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 @@ | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('external')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'external'], factory) : | ||
(global = global || self, factory(global.bundle = {}, global.external)); | ||
}(this, function (exports, external) { 'use strict'; | ||
|
||
var external__default = 'default' in external ? external['default'] : external; | ||
|
||
console.log(external.value); | ||
|
||
exports.reexported = external__default; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
})); |
3 changes: 3 additions & 0 deletions
3
test/form/samples/reexport-external-default-as-name-and-name/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,3 @@ | ||
export { default as reexported } from 'external'; | ||
import {value} from 'external'; | ||
console.log(value); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
define(['external'], function (external) { 'use strict'; | ||
define(['external1', 'external2'], function (external1, external2) { 'use strict'; | ||
|
||
external = external && external.hasOwnProperty('default') ? external['default'] : external; | ||
external2 = external2 && external2.hasOwnProperty('default') ? external2['default'] : external2; | ||
|
||
console.log(external1.foo); | ||
|
||
|
||
return external; | ||
return external2; | ||
|
||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
export { default } from 'external'; | ||
import { foo } from 'external1'; | ||
export { default } from 'external2'; | ||
|
||
console.log(foo); |
10 changes: 5 additions & 5 deletions
10
test/form/samples/reexport-external-default/_expected/iife.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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
var bundle = (function (external) { | ||
var bundle = (function (external1, external2) { | ||
'use strict'; | ||
|
||
external = external && external.hasOwnProperty('default') ? external['default'] : external; | ||
external2 = external2 && external2.hasOwnProperty('default') ? external2['default'] : external2; | ||
|
||
console.log(external1.foo); | ||
|
||
return external2; | ||
|
||
return external; | ||
|
||
}(external)); | ||
}(external1, external2)); |
7 changes: 5 additions & 2 deletions
7
test/form/samples/reexport-external-default/_expected/system.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
14 changes: 7 additions & 7 deletions
14
test/form/samples/reexport-external-default/_expected/umd.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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('external')) : | ||
typeof define === 'function' && define.amd ? define(['external'], factory) : | ||
(global = global || self, global.bundle = factory(global.external)); | ||
}(this, function (external) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('external1'), require('external2')) : | ||
typeof define === 'function' && define.amd ? define(['external1', 'external2'], factory) : | ||
(global = global || self, global.bundle = factory(global.external1, global.external2)); | ||
}(this, function (external1, external2) { 'use strict'; | ||
|
||
external = external && external.hasOwnProperty('default') ? external['default'] : external; | ||
external2 = external2 && external2.hasOwnProperty('default') ? external2['default'] : external2; | ||
|
||
console.log(external1.foo); | ||
|
||
|
||
return external; | ||
return external2; | ||
|
||
})); |
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,3 @@ | ||
export { default } from 'external'; | ||
import { foo } from 'external1'; | ||
export { default } from 'external2'; | ||
console.log(foo); |