Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: replace backslashes with forward slashes from resolved pa… (#11366)
* fix: replace backslashes with forward slashes from resolved path for windows environments * add test for resolveAbsoluteRuntime under windows
- Loading branch information
1 parent
ce6cc4e
commit fbcb251
Showing
5 changed files
with
92 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
9 changes: 9 additions & 0 deletions
9
packages/babel-plugin-transform-runtime/test/fixtures/windows/absoluteRuntime/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,9 @@ | ||
async function test () { | ||
console.log('test') | ||
} | ||
|
||
async function main () { | ||
console.log(await test()) | ||
} | ||
|
||
main() |
23 changes: 23 additions & 0 deletions
23
packages/babel-plugin-transform-runtime/test/fixtures/windows/absoluteRuntime/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,23 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"corejs": 3, | ||
"useBuiltIns": "entry" | ||
} | ||
] | ||
], | ||
"plugins": [ | ||
[ | ||
"transform-runtime", | ||
{ | ||
"regenerator": false, | ||
"corejs": false, | ||
"helpers": true, | ||
"useESModules": true, | ||
"absoluteRuntime": true | ||
} | ||
] | ||
] | ||
} |
54 changes: 54 additions & 0 deletions
54
packages/babel-plugin-transform-runtime/test/fixtures/windows/absoluteRuntime/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,54 @@ | ||
var _asyncToGenerator = require("<CWD>/packages/babel-plugin-transform-runtime/node_modules/@babel/runtime/helpers/asyncToGenerator"); | ||
|
||
function test() { | ||
return _test.apply(this, arguments); | ||
} | ||
|
||
function _test() { | ||
_test = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
console.log('test'); | ||
|
||
case 1: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee); | ||
})); | ||
return _test.apply(this, arguments); | ||
} | ||
|
||
function main() { | ||
return _main.apply(this, arguments); | ||
} | ||
|
||
function _main() { | ||
_main = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { | ||
return regeneratorRuntime.wrap(function _callee2$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
_context2.t0 = console; | ||
_context2.next = 3; | ||
return test(); | ||
|
||
case 3: | ||
_context2.t1 = _context2.sent; | ||
|
||
_context2.t0.log.call(_context2.t0, _context2.t1); | ||
|
||
case 5: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
} | ||
}, _callee2); | ||
})); | ||
return _main.apply(this, arguments); | ||
} | ||
|
||
main(); |
3 changes: 3 additions & 0 deletions
3
packages/babel-plugin-transform-runtime/test/fixtures/windows/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,3 @@ | ||
{ | ||
"os": ["win32"] | ||
} |