Skip to content

Commit 4fe2e83

Browse files
[es-shims] Add Reflect.apply polyfill (#65)
1 parent a7e5c26 commit 4fe2e83

File tree

7 files changed

+18
-4
lines changed

7 files changed

+18
-4
lines changed

packages/babel-plugin-polyfill-es-shims/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ This plugin supports the following `es-shims` polyfills.
7070
| `Object.assign` | [`object.assign`](https://github.com/ljharb/object.assign) | [@ljharb](https://github.com/ljharb) |
7171
| `Object.getPrototypeOf` | [`object.getprototypeof`](https://github.com/es-shims/Object.getPrototypeOf) |
7272
| `Object.is` | [`object-is`](https://github.com/es-shims/object-is) |
73+
| `Reflect.apply` | [`reflect.apply`](https://github.com/es-shims/Reflect.apply) |
7374
| `Reflect.getPrototypeOf` | [`reflect.getprototypeof`](https://github.com/es-shims/Reflect.getPrototypeOf) |
7475
| `Reflect.ownKeys` | [`reflect.ownkeys`](https://github.com/es-shims/Reflect.ownKeys) |
7576
| `RegExp.prototype.flags` | [`regexp.prototype.flags`](https://github.com/es-shims/RegExp.prototype.flags) |

packages/babel-plugin-polyfill-es-shims/data/polyfills.json

+11
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,17 @@
454454
"samsung": "8",
455455
"electron": "3"
456456
},
457+
"Reflect.apply": {
458+
"chrome": "49",
459+
"opera": "36",
460+
"edge": "12",
461+
"firefox": "42",
462+
"safari": "10",
463+
"node": "6",
464+
"ios": "10",
465+
"samsung": "5",
466+
"electron": "0.37"
467+
},
457468
"Reflect.getPrototypeOf": {
458469
"chrome": "49",
459470
"opera": "36",

packages/babel-plugin-polyfill-es-shims/missing-polyfills.md

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
- `Math.sinh()`
3030
- `Math.tanh()`
3131
- `Math.trunc()`
32-
- `Reflect.apply()`
3332
- `Reflect.construct()`
3433
- `Reflect.defineProperty()`
3534
- `Reflect.deleteProperty()`

packages/babel-plugin-polyfill-es-shims/src/mappings.js

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ defineStatic("Promise", "any", "2.0.1");
9090
defineStatic("Promise", "try", "1.0.0");
9191
defineInstance("Promise", "finally", "1.2.1", instanceofCheck("Promise"));
9292

93+
defineStatic("Reflect", "apply", "1.0.0");
9394
defineStatic("Reflect", "ownKeys", "1.0.1");
9495
defineStatic("Reflect", "getPrototypeOf", "1.0.0");
9596

packages/babel-plugin-polyfill-es-shims/test/fixtures/usage-pure/static-methods/output.mjs

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import _ObjectGetOwnPropertyDescriptors from "object.getownpropertydescriptors";
1515
import _ObjectGetPrototypeOf from "object.getprototypeof";
1616
import _ObjectIs from "object-is";
1717
import _ObjectValues from "object.values";
18+
import _ReflectApply from "reflect.apply";
1819
import _ReflectGetPrototypeOf from "reflect.getprototypeof";
1920
import _ReflectOwnKeys from "reflect.ownkeys";
2021
import _StringFromCodePoint from "string.fromcodepoint";
@@ -85,7 +86,7 @@ Object.preventExtensions;
8586
Object.seal;
8687
Object.setPrototypeOf;
8788
_ObjectValues;
88-
Reflect.apply;
89+
_ReflectApply;
8990
Reflect.construct;
9091
Reflect.defineMetadata;
9192
Reflect.defineProperty;
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Some polyfills have been added but are not present in your dependencies.
22
Please run one of the following commands:
3-
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
4-
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
3+
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
4+
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

scripts/build-es-shims-data/es-shims-features.js

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ module.exports = {
5353
"Promise.any": "Promise.any",
5454
"Promise.try": [],
5555
"Promise.prototype.finally": "Promise.prototype.finally",
56+
"Reflect.apply": "Reflect / Reflect.apply",
5657
"Reflect.getPrototypeOf": "Reflect / Reflect.getPrototypeOf",
5758
"Reflect.ownKeys": "Reflect / Reflect.ownKeys",
5859
"RegExp.prototype.flags":

0 commit comments

Comments
 (0)