diff --git a/packages/babel-plugin-polyfill-es-shims/README.md b/packages/babel-plugin-polyfill-es-shims/README.md index e7ce5b2b..0d9897c1 100644 --- a/packages/babel-plugin-polyfill-es-shims/README.md +++ b/packages/babel-plugin-polyfill-es-shims/README.md @@ -70,6 +70,7 @@ This plugin supports the following `es-shims` polyfills. | `Object.assign` | [`object.assign`](https://github.com/ljharb/object.assign) | [@ljharb](https://github.com/ljharb) | | `Object.getPrototypeOf` | [`object.getprototypeof`](https://github.com/es-shims/Object.getPrototypeOf) | | `Object.is` | [`object-is`](https://github.com/es-shims/object-is) | +| `Reflect.apply` | [`reflect.apply`](https://github.com/es-shims/Reflect.apply) | | `Reflect.getPrototypeOf` | [`reflect.getprototypeof`](https://github.com/es-shims/Reflect.getPrototypeOf) | | `Reflect.ownKeys` | [`reflect.ownkeys`](https://github.com/es-shims/Reflect.ownKeys) | | `RegExp.prototype.flags` | [`regexp.prototype.flags`](https://github.com/es-shims/RegExp.prototype.flags) | diff --git a/packages/babel-plugin-polyfill-es-shims/data/polyfills.json b/packages/babel-plugin-polyfill-es-shims/data/polyfills.json index 897ef9fa..7548aec2 100644 --- a/packages/babel-plugin-polyfill-es-shims/data/polyfills.json +++ b/packages/babel-plugin-polyfill-es-shims/data/polyfills.json @@ -454,6 +454,17 @@ "samsung": "8", "electron": "3" }, + "Reflect.apply": { + "chrome": "49", + "opera": "36", + "edge": "12", + "firefox": "42", + "safari": "10", + "node": "6", + "ios": "10", + "samsung": "5", + "electron": "0.37" + }, "Reflect.getPrototypeOf": { "chrome": "49", "opera": "36", diff --git a/packages/babel-plugin-polyfill-es-shims/missing-polyfills.md b/packages/babel-plugin-polyfill-es-shims/missing-polyfills.md index 1f459b8e..4f03050e 100644 --- a/packages/babel-plugin-polyfill-es-shims/missing-polyfills.md +++ b/packages/babel-plugin-polyfill-es-shims/missing-polyfills.md @@ -29,7 +29,6 @@ - `Math.sinh()` - `Math.tanh()` - `Math.trunc()` -- `Reflect.apply()` - `Reflect.construct()` - `Reflect.defineProperty()` - `Reflect.deleteProperty()` diff --git a/packages/babel-plugin-polyfill-es-shims/src/mappings.js b/packages/babel-plugin-polyfill-es-shims/src/mappings.js index 1f3a6f1a..92a4e35b 100644 --- a/packages/babel-plugin-polyfill-es-shims/src/mappings.js +++ b/packages/babel-plugin-polyfill-es-shims/src/mappings.js @@ -90,6 +90,7 @@ defineStatic("Promise", "any", "2.0.1"); defineStatic("Promise", "try", "1.0.0"); defineInstance("Promise", "finally", "1.2.1", instanceofCheck("Promise")); +defineStatic("Reflect", "apply", "1.0.0"); defineStatic("Reflect", "ownKeys", "1.0.1"); defineStatic("Reflect", "getPrototypeOf", "1.0.0"); diff --git a/packages/babel-plugin-polyfill-es-shims/test/fixtures/usage-pure/static-methods/output.mjs b/packages/babel-plugin-polyfill-es-shims/test/fixtures/usage-pure/static-methods/output.mjs index 66d8edfc..024bcfb6 100644 --- a/packages/babel-plugin-polyfill-es-shims/test/fixtures/usage-pure/static-methods/output.mjs +++ b/packages/babel-plugin-polyfill-es-shims/test/fixtures/usage-pure/static-methods/output.mjs @@ -15,6 +15,7 @@ import _ObjectGetOwnPropertyDescriptors from "object.getownpropertydescriptors"; import _ObjectGetPrototypeOf from "object.getprototypeof"; import _ObjectIs from "object-is"; import _ObjectValues from "object.values"; +import _ReflectApply from "reflect.apply"; import _ReflectGetPrototypeOf from "reflect.getprototypeof"; import _ReflectOwnKeys from "reflect.ownkeys"; import _StringFromCodePoint from "string.fromcodepoint"; @@ -85,7 +86,7 @@ Object.preventExtensions; Object.seal; Object.setPrototypeOf; _ObjectValues; -Reflect.apply; +_ReflectApply; Reflect.construct; Reflect.defineMetadata; Reflect.defineProperty; diff --git a/packages/babel-plugin-polyfill-es-shims/test/fixtures/usage-pure/static-methods/stderr.txt b/packages/babel-plugin-polyfill-es-shims/test/fixtures/usage-pure/static-methods/stderr.txt index ba78e3f6..dcac97c3 100644 --- a/packages/babel-plugin-polyfill-es-shims/test/fixtures/usage-pure/static-methods/stderr.txt +++ b/packages/babel-plugin-polyfill-es-shims/test/fixtures/usage-pure/static-methods/stderr.txt @@ -1,4 +1,4 @@ Some polyfills have been added but are not present in your dependencies. Please run one of the following commands: - npm install --save array.from@^1.1.0 array.of@^1.0.0 is-nan@^1.2.1 math.acosh@^1.0.0 math.atanh@^1.0.0 math.cbrt@^1.0.0 math.clz32@^1.0.0 math.fround@^1.0.0 math.log1p@^1.0.1 math.sign@^2.0.0 object-is@^1.1.2 object.assign@^4.1.0 object.entries@^1.1.1 object.fromentries@^2.0.2 object.getownpropertydescriptors@^2.1.0 object.getprototypeof@^1.0.1 object.values@^1.1.1 reflect.getprototypeof@^1.0.0 reflect.ownkeys@^1.0.1 string.fromcodepoint@^1.0.0 string.raw@^1.0.1 - yarn add array.from@^1.1.0 array.of@^1.0.0 is-nan@^1.2.1 math.acosh@^1.0.0 math.atanh@^1.0.0 math.cbrt@^1.0.0 math.clz32@^1.0.0 math.fround@^1.0.0 math.log1p@^1.0.1 math.sign@^2.0.0 object-is@^1.1.2 object.assign@^4.1.0 object.entries@^1.1.1 object.fromentries@^2.0.2 object.getownpropertydescriptors@^2.1.0 object.getprototypeof@^1.0.1 object.values@^1.1.1 reflect.getprototypeof@^1.0.0 reflect.ownkeys@^1.0.1 string.fromcodepoint@^1.0.0 string.raw@^1.0.1 + npm install --save array.from@^1.1.0 array.of@^1.0.0 is-nan@^1.2.1 math.acosh@^1.0.0 math.atanh@^1.0.0 math.cbrt@^1.0.0 math.clz32@^1.0.0 math.fround@^1.0.0 math.log1p@^1.0.1 math.sign@^2.0.0 object-is@^1.1.2 object.assign@^4.1.0 object.entries@^1.1.1 object.fromentries@^2.0.2 object.getownpropertydescriptors@^2.1.0 object.getprototypeof@^1.0.1 object.values@^1.1.1 reflect.apply@^1.0.0 reflect.getprototypeof@^1.0.0 reflect.ownkeys@^1.0.1 string.fromcodepoint@^1.0.0 string.raw@^1.0.1 + yarn add array.from@^1.1.0 array.of@^1.0.0 is-nan@^1.2.1 math.acosh@^1.0.0 math.atanh@^1.0.0 math.cbrt@^1.0.0 math.clz32@^1.0.0 math.fround@^1.0.0 math.log1p@^1.0.1 math.sign@^2.0.0 object-is@^1.1.2 object.assign@^4.1.0 object.entries@^1.1.1 object.fromentries@^2.0.2 object.getownpropertydescriptors@^2.1.0 object.getprototypeof@^1.0.1 object.values@^1.1.1 reflect.apply@^1.0.0 reflect.getprototypeof@^1.0.0 reflect.ownkeys@^1.0.1 string.fromcodepoint@^1.0.0 string.raw@^1.0.1 diff --git a/scripts/build-es-shims-data/es-shims-features.js b/scripts/build-es-shims-data/es-shims-features.js index 155f792c..75463b7c 100644 --- a/scripts/build-es-shims-data/es-shims-features.js +++ b/scripts/build-es-shims-data/es-shims-features.js @@ -53,6 +53,7 @@ module.exports = { "Promise.any": "Promise.any", "Promise.try": [], "Promise.prototype.finally": "Promise.prototype.finally", + "Reflect.apply": "Reflect / Reflect.apply", "Reflect.getPrototypeOf": "Reflect / Reflect.getPrototypeOf", "Reflect.ownKeys": "Reflect / Reflect.ownKeys", "RegExp.prototype.flags":