-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid conflicts with local variables named Symbol, Object, Promise (#…
- Loading branch information
1 parent
f3b1c81
commit a14cbb1
Showing
9 changed files
with
73 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const assert = require('assert'); | ||
|
||
module.exports = { | ||
description: 'avoids name conflicts with local variables named Object', | ||
options: { | ||
external: 'external', | ||
output: { exports: 'named' } | ||
}, | ||
context: { | ||
require() { | ||
return { foo: 'foo' }; | ||
} | ||
}, | ||
exports(exports) { | ||
assert.strictEqual(exports.Object, null); | ||
assert.strictEqual(exports.default, 'bar'); | ||
assert.strictEqual(exports.foo.foo, 'foo'); | ||
assert.strictEqual(exports.foo.default.foo, '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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * as foo from 'external'; | ||
export const Object = null; | ||
export default '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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const assert = require('assert'); | ||
|
||
module.exports = { | ||
description: 'avoids name conflicts with local variables named Promise', | ||
async exports(exports) { | ||
assert.strictEqual(exports.Promise, 'bar'); | ||
assert.strictEqual((await exports.promised).Promise, '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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export const Promise = '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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const Promise = 'bar'; | ||
export const promised = import('./dep'); |
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 @@ | ||
const assert = require('assert'); | ||
|
||
module.exports = { | ||
description: 'avoids name conflicts with local variables named Symbol', | ||
options: { | ||
output: { | ||
namespaceToStringTag: true | ||
} | ||
}, | ||
exports(exports) { | ||
assert.strictEqual(exports.Symbol, null); | ||
assert.strictEqual(exports.toString(), '[object Module]'); | ||
} | ||
}; |
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 @@ | ||
export const Symbol = null; |