Skip to content

Commit

Permalink
Update preset-env mappings (#10742)
Browse files Browse the repository at this point in the history
  • Loading branch information
existentialism authored and JLHwung committed Nov 20, 2019
1 parent fee4d93 commit 83fc3f2
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
26 changes: 25 additions & 1 deletion packages/babel-preset-env/data/corejs2-built-in-features.js
Expand Up @@ -95,7 +95,31 @@ const es = {
],
},

"es6.map": "Map",
// This is explicit to prevent Map-related proposals (like
// Map.prototype.upsert) from being included
"es6.map": {
features: [
"Map / basic functionality",
"Map / constructor arguments",
"Map / constructor requires new",
"Map / constructor accepts null",
"Map / constructor invokes set",
"Map / iterator closing",
"Map / Map.prototype.add returns this",
"Map / -0 key converts to +0",
"Map / Map.prototype.size",
"Map / Map.prototype.delete",
"Map / Map.prototype.clear",
"Map / Map.prototype.forEach",
"Map / Map.prototype.keys",
"Map / Map.prototype.values",
"Map / Map.prototype.entries",
"Map / Map.prototype[Symbol.iterator]",
"Map / Map.prototype isn't an instance",
"Map / Map iterator prototype chain",
"Map / Map[Symbol.species]",
],
},

"es6.math.acosh": "Math methods / Math.acosh",
"es6.math.asinh": "Math methods / Math.asinh",
Expand Down
3 changes: 3 additions & 0 deletions packages/babel-preset-env/data/corejs2-built-ins.json
Expand Up @@ -77,6 +77,7 @@
"safari": "12",
"node": "11",
"ios": "12",
"samsung": "10.2",
"opera": "56",
"electron": "4"
},
Expand Down Expand Up @@ -1496,6 +1497,7 @@
"safari": "12",
"node": "10",
"ios": "12",
"samsung": "9.2",
"opera": "53",
"electron": "3.1"
},
Expand All @@ -1505,6 +1507,7 @@
"safari": "12",
"node": "10",
"ios": "12",
"samsung": "9.2",
"opera": "53",
"electron": "3.1"
},
Expand Down
6 changes: 6 additions & 0 deletions packages/babel-preset-env/data/plugins.json
Expand Up @@ -3,7 +3,9 @@
"chrome": "41",
"edge": "13",
"firefox": "34",
"safari": "13",

This comment has been minimized.

Copy link
@joshgoebel

joshgoebel Nov 6, 2020

Doesn't Safari 12 support template literals just fine? https://caniuse.com/?search=template%20literal

This comment has been minimized.

Copy link
@joshgoebel

joshgoebel Nov 6, 2020

Actually it's listed as green since version 9.1, though that seems perhaps wrong?

This comment has been minimized.

Copy link
@joshgoebel

joshgoebel Nov 6, 2020

Just tested in Safari 9.1.3 and seems to work just fine?

This comment has been minimized.

Copy link
@nicolo-ribaudo

nicolo-ribaudo Nov 6, 2020

Member

IIRC, safari has some problems with caching the tagged template object. I suggest checking compat-table, which is way more accurate that caniuse.

This comment has been minimized.

Copy link
@joshgoebel

joshgoebel Nov 6, 2020

Isn鈥檛 that covered by bugfix/taggedtemplateobject (or whatever it is) though? This seems to exclusively trigger the replacing of template literals with concat. Compat table is what led me here.

This comment has been minimized.

Copy link
@joshgoebel

joshgoebel Nov 6, 2020

Oh and regarding caniuse accuracy as I said I manually checked it and Safari 9.

This comment has been minimized.

Copy link
@joshgoebel

joshgoebel Nov 6, 2020

Should I just open an issue?

This comment has been minimized.

Copy link
@nicolo-ribaudo

nicolo-ribaudo Nov 6, 2020

Member

With bugfixes Safari 9 is supported:

"transform-template-literals": {

This comment has been minimized.

Copy link
@joshgoebel

joshgoebel Nov 6, 2020

Why is that version 9 while here it's version 13?

This comment has been minimized.

Copy link
@JLHwung

JLHwung Nov 6, 2020

Contributor

When bugfixes: true is provided, preset-env will use the plugin-bugfixes.json to determine whether any plugin should be applied. It will be the new default for Babel 8.

This comment has been minimized.

Copy link
@joshgoebel

joshgoebel Nov 6, 2020

So does that make plugins deprecated then? If these values are simply incorrect should they not still be patched?

This comment has been minimized.

Copy link
@nicolo-ribaudo

nicolo-ribaudo Nov 6, 2020

Member

Those values are not incorrect: when you are not using bugfixes, we need to transpile template literals on Safari 9 because they are not fully supported.

This comment has been minimized.

Copy link
@joshgoebel

joshgoebel Nov 6, 2020

My original question was about Safari 12, not Safari 9. I see that Safari 9's support is qualified. To the best of my knowledge Safari 12 (or 12.1's) support should not be.

This comment has been minimized.

Copy link
@nicolo-ribaudo

nicolo-ribaudo Nov 6, 2020

Member

Safari 12 and 12.1 do not fully support template literals.

You can see it at https://kangax.github.io/compat-table/es6/, enabling "Show obsolete platforms" (top left) and expanding the "template literals" section.

This comment has been minimized.

Copy link
@nicolo-ribaudo

nicolo-ribaudo Nov 6, 2020

Member

i.e. This doesn't return true on Safari 12:

function strings(array) {
  return array;
}
function getStrings() {
  return strings`foo`;
}
var original = getStrings();
var newed = new getStrings();
return original === getStrings() && original === newed;
"node": "4",
"ios": "13",

This comment has been minimized.

Copy link
@joshgoebel

This comment has been minimized.

Copy link
@joshgoebel

joshgoebel Nov 6, 2020

I filed an issue with more details. #12325

"samsung": "3.4",
"opera": "28",
"electron": "0.24"
Expand Down Expand Up @@ -273,6 +275,7 @@
"safari": "11.1",
"node": "10",
"ios": "11.3",
"samsung": "9.2",
"opera": "51",
"electron": "3.1"
},
Expand All @@ -282,6 +285,7 @@
"safari": "12",
"node": "10",
"ios": "12",
"samsung": "9.2",
"opera": "53",
"electron": "3.1"
},
Expand All @@ -291,6 +295,7 @@
"safari": "11.1",
"node": "10",
"ios": "11.3",
"samsung": "9.2",
"opera": "53",
"electron": "3.1"
},
Expand All @@ -299,6 +304,7 @@
"safari": "11.1",
"node": "10",
"ios": "11.3",
"samsung": "9.2",
"opera": "51",
"electron": "3.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-preset-env/package.json
Expand Up @@ -76,7 +76,7 @@
"@babel/helper-plugin-test-runner": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"caniuse-db": "1.0.30000969",
"compat-table": "kangax/compat-table#071b478a44694cbf72a78db8ab39189c5ae31b2c",
"compat-table": "kangax/compat-table#4195aca631ad904cb0efeb62a9c2d8c8511706f8",
"electron-to-chromium": "1.3.113"
}
}

0 comments on commit 83fc3f2

Please sign in to comment.