Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle
__proto__
exports name in CJS/AMD/UMD (#16015)
Co-authored-by: Nicol貌 Ribaudo <hello@nicr.dev>
- Loading branch information
1 parent
a345a10
commit 418dd21
Showing
9 changed files
with
101 additions
and
2 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
7 changes: 7 additions & 0 deletions
7
packages/babel-plugin-transform-modules-amd/test/fixtures/amd/export-named-6/input.mjs
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 @@ | ||
export const __proto__ = null; | ||
export const a = 1; | ||
export const _ = 2; | ||
|
||
import { __proto__ as p } from "./input.js"; | ||
|
||
console.log(p); |
16 changes: 16 additions & 0 deletions
16
packages/babel-plugin-transform-modules-amd/test/fixtures/amd/export-named-6/output.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 @@ | ||
define(["exports", "./input.js"], function (_exports, _input) { | ||
"use strict"; | ||
|
||
Object.defineProperty(_exports, "__esModule", { | ||
value: true | ||
}); | ||
_exports.a = Object.defineProperty(_exports, "__proto__", { | ||
enumerable: true, | ||
value: void 0, | ||
writable: true | ||
})["__proto__"] = _exports._ = void 0; | ||
const __proto__ = _exports.__proto__ = null; | ||
const a = _exports.a = 1; | ||
const _ = _exports._ = 2; | ||
console.log(_input.__proto__); | ||
}); |
1 change: 1 addition & 0 deletions
1
...ges/babel-plugin-transform-modules-commonjs/test/fixtures/interop/export-from-9/input.mjs
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 { __proto__ } from "xyz"; |
12 changes: 12 additions & 0 deletions
12
...ges/babel-plugin-transform-modules-commonjs/test/fixtures/interop/export-from-9/output.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 | ||
}); | ||
Object.defineProperty(exports, "__proto__", { | ||
enumerable: true, | ||
get: function () { | ||
return _xyz.__proto__; | ||
} | ||
}); | ||
var _xyz = require("xyz"); |
7 changes: 7 additions & 0 deletions
7
...es/babel-plugin-transform-modules-commonjs/test/fixtures/interop/export-named-6/input.mjs
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 @@ | ||
export const __proto__ = null; | ||
export const a = 1; | ||
export const _ = 2; | ||
|
||
import { __proto__ as p } from "./input.js"; | ||
|
||
console.log(p); |
15 changes: 15 additions & 0 deletions
15
...es/babel-plugin-transform-modules-commonjs/test/fixtures/interop/export-named-6/output.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"; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.a = Object.defineProperty(exports, "__proto__", { | ||
enumerable: true, | ||
value: void 0, | ||
writable: true | ||
})["__proto__"] = exports._ = void 0; | ||
var _input = require("./input.js"); | ||
const __proto__ = exports.__proto__ = null; | ||
const a = exports.a = 1; | ||
const _ = exports._ = 2; | ||
console.log(_input.__proto__); |
7 changes: 7 additions & 0 deletions
7
packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-6/input.mjs
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 @@ | ||
export const __proto__ = null; | ||
export const a = 1; | ||
export const _ = 2; | ||
|
||
import { __proto__ as p } from "./input.js"; | ||
|
||
console.log(p); |
28 changes: 28 additions & 0 deletions
28
packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-6/output.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 @@ | ||
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(["exports", "./input.js"], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(exports, require("./input.js")); | ||
} else { | ||
var mod = { | ||
exports: {} | ||
}; | ||
factory(mod.exports, global.input); | ||
global.input = mod.exports; | ||
} | ||
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _input) { | ||
"use strict"; | ||
|
||
Object.defineProperty(_exports, "__esModule", { | ||
value: true | ||
}); | ||
_exports.a = Object.defineProperty(_exports, "__proto__", { | ||
enumerable: true, | ||
value: void 0, | ||
writable: true | ||
})["__proto__"] = _exports._ = void 0; | ||
const __proto__ = _exports.__proto__ = null; | ||
const a = _exports.a = 1; | ||
const _ = _exports._ = 2; | ||
console.log(_input.__proto__); | ||
}); |