Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Protect all module globals for CJS output from being redefined (#2889)
- Loading branch information
1 parent
4a70e08
commit 53cde75
Showing
12 changed files
with
120 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
description: 'prevent conflicts with cjs module globals', | ||
options: { | ||
output: { name: 'bundle' } | ||
} | ||
}; |
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,17 @@ | ||
define(['exports'], function (exports) { 'use strict'; | ||
|
||
const exports$1 = 1; | ||
const require = 2; | ||
const module = 3; | ||
const __filename = 4; | ||
const __dirname = 5; | ||
|
||
exports.__dirname = __dirname; | ||
exports.__filename = __filename; | ||
exports.exports = exports$1; | ||
exports.module = module; | ||
exports.require = require; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
}); |
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'; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
const exports$1 = 1; | ||
const require$1 = 2; | ||
const module$1 = 3; | ||
const __filename$1 = 4; | ||
const __dirname$1 = 5; | ||
|
||
exports.__dirname = __dirname$1; | ||
exports.__filename = __filename$1; | ||
exports.exports = exports$1; | ||
exports.module = module$1; | ||
exports.require = require$1; |
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 @@ | ||
const exports = 1; | ||
const require = 2; | ||
const module = 3; | ||
const __filename = 4; | ||
const __dirname = 5; | ||
|
||
export { __dirname, __filename, exports, module, require }; |
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,18 @@ | ||
var bundle = (function (exports) { | ||
'use strict'; | ||
|
||
const exports$1 = 1; | ||
const require = 2; | ||
const module = 3; | ||
const __filename = 4; | ||
const __dirname = 5; | ||
|
||
exports.__dirname = __dirname; | ||
exports.__filename = __filename; | ||
exports.exports = exports$1; | ||
exports.module = module; | ||
exports.require = require; | ||
|
||
return exports; | ||
|
||
}({})); |
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('bundle', [], function (exports) { | ||
'use strict'; | ||
return { | ||
execute: function () { | ||
|
||
const exports$1 = exports('exports', 1); | ||
const require = exports('require', 2); | ||
const module = exports('module', 3); | ||
const __filename = exports('__filename', 4); | ||
const __dirname = exports('__dirname', 5); | ||
|
||
} | ||
}; | ||
}); |
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 @@ | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(global = global || self, factory(global.bundle = {})); | ||
}(this, function (exports) { 'use strict'; | ||
|
||
const exports$1 = 1; | ||
const require = 2; | ||
const module = 3; | ||
const __filename = 4; | ||
const __dirname = 5; | ||
|
||
exports.__dirname = __dirname; | ||
exports.__filename = __filename; | ||
exports.exports = exports$1; | ||
exports.module = module; | ||
exports.require = require; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
})); |
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 @@ | ||
export const exports = 1; | ||
export const require = 2; | ||
export const module = 3; | ||
export const __filename = 4; | ||
export const __dirname = 5; |
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,3 @@ | ||
module.exports = { | ||
description: 'prevent conflicts with cjs module globals' | ||
}; |
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 @@ | ||
export const exports = 1; | ||
export const require = 2; | ||
export const module = 3; | ||
export const __filename = 4; | ||
export const __dirname = 5; |