Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(es/preset-env): Fix default target (#6921)
**Description:** Previously the default value of `targets` was `""`, which is not deterministic. **Related issue:** - Closes #6888.
- Loading branch information
Showing
16 changed files
with
256 additions
and
37 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
crates/swc/tests/fixture/issues-1xxx/1402/case1/output/index.ts
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
var e = 1; | ||
try { | ||
throw 2; | ||
} catch { | ||
} catch (e1) { | ||
console.log(e); | ||
} |
4 changes: 2 additions & 2 deletions
4
crates/swc/tests/fixture/issues-1xxx/1448/case1/output/index.ts
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { createRequire as _createRequire } from "module"; | ||
const __require = _createRequire(import.meta.url); | ||
const F = __require("yaml"); | ||
var __require = _createRequire(import.meta.url); | ||
var F = __require("yaml"); | ||
console.log(F); |
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
135 changes: 127 additions & 8 deletions
135
crates/swc/tests/fixture/issues-1xxx/1721/case1/output/index.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 |
---|---|---|
@@ -1,10 +1,129 @@ | ||
async function* lol() { | ||
yield 1; | ||
yield 2; | ||
} | ||
async function main() { | ||
for await (const x of lol()){ | ||
console.log(x); | ||
} | ||
import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; | ||
import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; | ||
import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; | ||
import _ts_generator from "@swc/helpers/src/_ts_generator.mjs"; | ||
function lol() { | ||
return _lol.apply(this, arguments); | ||
} | ||
function _lol() { | ||
_lol = _wrap_async_generator(function() { | ||
return _ts_generator(this, function(_state) { | ||
switch(_state.label){ | ||
case 0: | ||
return [ | ||
4, | ||
1 | ||
]; | ||
case 1: | ||
_state.sent(); | ||
return [ | ||
4, | ||
2 | ||
]; | ||
case 2: | ||
_state.sent(); | ||
return [ | ||
2 | ||
]; | ||
} | ||
}); | ||
}); | ||
return _lol.apply(this, arguments); | ||
} | ||
function main() { | ||
return _main.apply(this, arguments); | ||
} | ||
function _main() { | ||
_main = _async_to_generator(function() { | ||
var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, x, err; | ||
return _ts_generator(this, function(_state) { | ||
switch(_state.label){ | ||
case 0: | ||
_iteratorAbruptCompletion = false, _didIteratorError = false; | ||
_state.label = 1; | ||
case 1: | ||
_state.trys.push([ | ||
1, | ||
6, | ||
7, | ||
12 | ||
]); | ||
_iterator = _async_iterator(lol()); | ||
_state.label = 2; | ||
case 2: | ||
return [ | ||
4, | ||
_iterator.next() | ||
]; | ||
case 3: | ||
if (!(_iteratorAbruptCompletion = !(_step = _state.sent()).done)) return [ | ||
3, | ||
5 | ||
]; | ||
_value = _step.value; | ||
x = _value; | ||
console.log(x); | ||
_state.label = 4; | ||
case 4: | ||
_iteratorAbruptCompletion = false; | ||
return [ | ||
3, | ||
2 | ||
]; | ||
case 5: | ||
return [ | ||
3, | ||
12 | ||
]; | ||
case 6: | ||
err = _state.sent(); | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
return [ | ||
3, | ||
12 | ||
]; | ||
case 7: | ||
_state.trys.push([ | ||
7, | ||
, | ||
10, | ||
11 | ||
]); | ||
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) return [ | ||
3, | ||
9 | ||
]; | ||
return [ | ||
4, | ||
_iterator["return"]() | ||
]; | ||
case 8: | ||
_state.sent(); | ||
_state.label = 9; | ||
case 9: | ||
return [ | ||
3, | ||
11 | ||
]; | ||
case 10: | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
return [ | ||
7 | ||
]; | ||
case 11: | ||
return [ | ||
7 | ||
]; | ||
case 12: | ||
return [ | ||
2 | ||
]; | ||
} | ||
}); | ||
}); | ||
return _main.apply(this, arguments); | ||
} | ||
main(); |
19 changes: 16 additions & 3 deletions
19
crates/swc/tests/fixture/issues-1xxx/1722/case1/output/index.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 |
---|---|---|
@@ -1,3 +1,16 @@ | ||
(async function main() { | ||
console.log(1); | ||
})(); | ||
import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; | ||
import _ts_generator from "@swc/helpers/src/_ts_generator.mjs"; | ||
(function() { | ||
var _main = _async_to_generator(function() { | ||
return _ts_generator(this, function(_state) { | ||
console.log(1); | ||
return [ | ||
2 | ||
]; | ||
}); | ||
}); | ||
function main() { | ||
return _main.apply(this, arguments); | ||
} | ||
return main; | ||
})()(); |
2 changes: 1 addition & 1 deletion
2
crates/swc/tests/fixture/issues-2xxx/2154/case1/output/index.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
const c = /*#__PURE__*/ React.createElement("img", { | ||
var c = /*#__PURE__*/ React.createElement("img", { | ||
alt: "caf\xe9" | ||
}).props.alt; | ||
console.log(c); |
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,14 @@ | ||
{ | ||
"jsc": { | ||
"parser": { | ||
"syntax": "ecmascript", | ||
"jsx": false | ||
}, | ||
}, | ||
"minify": false, | ||
"isModule": true, | ||
"env": { | ||
"mode": "usage", | ||
"coreJs": "3.27.2" | ||
} | ||
} |
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 @@ | ||
'test'.replaceAll('', ''); | ||
'1.2.3'.split('.').at(-1); | ||
[123].at(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,11 @@ | ||
import "core-js/modules/es.array.at.js"; | ||
import "core-js/modules/es.regexp.exec.js"; | ||
import "core-js/modules/es.string.at-alternative.js"; | ||
import "core-js/modules/es.string.replace-all.js"; | ||
import "core-js/modules/es.string.replace.js"; | ||
import "core-js/modules/es.string.split.js"; | ||
"test".replaceAll("", ""); | ||
"1.2.3".split(".").at(-1); | ||
[ | ||
123 | ||
].at(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
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
3 changes: 2 additions & 1 deletion
3
crates/swc/tests/fixture/shopify/005-no-module/output/index.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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; | ||
import React from "react"; | ||
import { useI18n } from "@shopify/react-i18n"; | ||
export function App() { | ||
const [i18n] = useI18n(); | ||
var _useI18n = _sliced_to_array(useI18n(), 1), i18n = _useI18n[0]; | ||
return /*#__PURE__*/ React.createElement("h1", null, i18n.translate("foo")); | ||
} |
Oops, something went wrong.