Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix incorrect module path when absoluteRuntime is specified (#11893)
* - Added failing tests for issue #11885. * - Fix issue #11885: absoluteRuntime does not work as expected with corejs3. * - Removed helper code from test output files (tests for issue #11885). * chore: add @babel/runtime-corejs3 to dev deps * chore: update test fixtures Co-authored-by: Hu谩ng J霉nli脿ng <jlhwung@gmail.com>
- Loading branch information
Showing
8 changed files
with
116 additions
and
3 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
8 changes: 8 additions & 0 deletions
8
...el-plugin-transform-runtime/test/fixtures/absoluteRuntime/true-corejs3-proposals/input.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 @@ | ||
Array.map; | ||
function* makeIterator() { | ||
yield 1; | ||
yield 2; | ||
} | ||
for (const itItem of makeIterator()) { | ||
console.log(itItem); | ||
} |
7 changes: 7 additions & 0 deletions
7
...lugin-transform-runtime/test/fixtures/absoluteRuntime/true-corejs3-proposals/options.json
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 @@ | ||
{ | ||
"presets": ["env"], | ||
"plugins": [ | ||
["transform-runtime", { "absoluteRuntime": true, "corejs": { "version": 3, "proposals": true } }], | ||
["external-helpers", { "helperVersion": "7.100.0" }] | ||
] | ||
} |
41 changes: 41 additions & 0 deletions
41
...l-plugin-transform-runtime/test/fixtures/absoluteRuntime/true-corejs3-proposals/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,41 @@ | ||
var _regeneratorRuntime = require("<CWD>/packages/babel-plugin-transform-runtime/node_modules/@babel/runtime-corejs3/regenerator"); | ||
|
||
var _mapInstanceProperty = require("<CWD>/packages/babel-plugin-transform-runtime/node_modules/@babel/runtime-corejs3/core-js/instance/map"); | ||
|
||
var _marked = /*#__PURE__*/_regeneratorRuntime.mark(makeIterator); | ||
|
||
_mapInstanceProperty(Array); | ||
|
||
function makeIterator() { | ||
return _regeneratorRuntime.wrap(function makeIterator$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
_context.next = 2; | ||
return 1; | ||
|
||
case 2: | ||
_context.next = 4; | ||
return 2; | ||
|
||
case 4: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _marked); | ||
} | ||
|
||
var _iterator = babelHelpers.createForOfIteratorHelper(makeIterator()), | ||
_step; | ||
|
||
try { | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
var itItem = _step.value; | ||
console.log(itItem); | ||
} | ||
} catch (err) { | ||
_iterator.e(err); | ||
} finally { | ||
_iterator.f(); | ||
} |
8 changes: 8 additions & 0 deletions
8
...babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/true-corejs3-stable/input.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 @@ | ||
Array.map; | ||
function* makeIterator() { | ||
yield 1; | ||
yield 2; | ||
} | ||
for (const itItem of makeIterator()) { | ||
console.log(itItem); | ||
} |
7 changes: 7 additions & 0 deletions
7
...l-plugin-transform-runtime/test/fixtures/absoluteRuntime/true-corejs3-stable/options.json
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 @@ | ||
{ | ||
"presets": ["env"], | ||
"plugins": [ | ||
["transform-runtime", { "absoluteRuntime": true, "corejs": { "version": 3, "proposals": false } }], | ||
["external-helpers", { "helperVersion": "7.100.0" }] | ||
] | ||
} |
41 changes: 41 additions & 0 deletions
41
...abel-plugin-transform-runtime/test/fixtures/absoluteRuntime/true-corejs3-stable/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,41 @@ | ||
var _regeneratorRuntime = require("<CWD>/packages/babel-plugin-transform-runtime/node_modules/@babel/runtime-corejs3/regenerator"); | ||
|
||
var _mapInstanceProperty = require("<CWD>/packages/babel-plugin-transform-runtime/node_modules/@babel/runtime-corejs3/core-js-stable/instance/map"); | ||
|
||
var _marked = /*#__PURE__*/_regeneratorRuntime.mark(makeIterator); | ||
|
||
_mapInstanceProperty(Array); | ||
|
||
function makeIterator() { | ||
return _regeneratorRuntime.wrap(function makeIterator$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
_context.next = 2; | ||
return 1; | ||
|
||
case 2: | ||
_context.next = 4; | ||
return 2; | ||
|
||
case 4: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _marked); | ||
} | ||
|
||
var _iterator = babelHelpers.createForOfIteratorHelper(makeIterator()), | ||
_step; | ||
|
||
try { | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
var itItem = _step.value; | ||
console.log(itItem); | ||
} | ||
} catch (err) { | ||
_iterator.e(err); | ||
} finally { | ||
_iterator.f(); | ||
} |