| 1 | # babel-plugin-polyfill-es-shims |
| 2 | |
| 3 | ## Install |
| 4 | |
| 5 | Using npm: |
| 6 | |
| 7 | ```sh |
| 8 | npm install --save-dev babel-plugin-polyfill-es-shims |
| 9 | ``` |
| 10 | |
| 11 | or using yarn: |
| 12 | |
| 13 | ```sh |
| 14 | yarn add babel-plugin-polyfill-es-shims --dev |
| 15 | ``` |
| 16 | |
| 17 | ## Usage |
| 18 | |
| 19 | Add this plugin to your Babel configuration: |
| 20 | |
| 21 | ```json |
| 22 | { |
| 23 | "plugins": [["polyfill-es-shims", { "method": "usage-pure" }]] |
| 24 | } |
| 25 | ``` |
| 26 | |
| 27 | This package supports the `usage-pure` and `usage-global` methods. |
| 28 | |
| 29 | ## Supported polyfills |
| 30 | |
| 31 | This polyfill provider is compatible with polyfills that follow the [`es-shims-api`](https://github.com/es-shims/es-shim-api) specification. Those polyfills must live under the [`@es-shims`](https://github.com/es-shims) organization, but for historical reasons some of them are owned by different people: they are explicitly marked as such in the following tables. |
| 32 | |
| 33 | ### Proposals (Stage 3) |
| 34 | |
| 35 | | Builtin object or function | Package name | Owner | |
| 36 | | :------------------------------ | :------------------------------------------------------------------------------------------- | :---- | |
| 37 | | `Array.prototype.findLast` | [`array.prototype.findlast`](https://github.com/es-shims/Array.prototype.findLast) | |
| 38 | | `Array.prototype.findLastIndex` | [`array.prototype.findlastindex`](https://github.com/es-shims/Array.prototype.findLastIndex) | |
| 39 | | `Array.prototype.toReversed` | [`array.prototype.toreversed`](https://github.com/es-shims/Array.prototype.toReversed) | |
| 40 | | `Array.prototype.toSorted` | [`array.prototype.tosorted`](https://github.com/es-shims/Array.prototype.toSorted) | |
| 41 | | `Array.prototype.toSpliced` | [`array.prototype.tospliced`](https://github.com/es-shims/Array.prototype.toSpliced) | |
| 42 | | `Array.prototype.with` | [`array.prototype.with`](https://github.com/es-shims/Array.prototype.with) | |
| 43 | |
| 44 | ### ES2022 |
| 45 | |
| 46 | | Builtin object or function | Package name | Owner | |
| 47 | | :------------------------- | :----------------------------------------------------------------------- | :---- | |
| 48 | | `Array.prototype.at` | [`array.prototype.at`](https://github.com/es-shims/Array.prototype.at) | |
| 49 | | `Error`'s `cause` property | [`error-cause`](https://github.com/es-shims/error-cause) | |
| 50 | | `Object.hasOwn` | [`object.hasown`](https://github.com/es-shims/object.hasown) | |
| 51 | | `String.prototype.at` | [`string.prototype.at`](https://github.com/es-shims/String.prototype.at) | |
| 52 | |
| 53 | ### ES2021 |
| 54 | |
| 55 | | Builtin object or function | Package name | Owner | |
| 56 | | :----------------------------------- | :--------------------------------------------------------------------------------------- | :---- | |
| 57 | | `AggregateError` (for `Promise.any`) | [`es-aggregate-error`](https://github.com/es-shims/AggregateError) | |
| 58 | | `Promise.any` | [`promise.any`](https://github.com/es-shims/Promise.any) | |
| 59 | | `String.prototype.replaceAll` | [`string.prototype.replaceall`](https://github.com/es-shims/String.prototype.replaceAll) | |
| 60 | |
| 61 | ### ES2020 |
| 62 | |
| 63 | | Builtin object or function | Package name | Owner | |
| 64 | | :-------------------------- | :--------------------------------------------------------------------------------- | :---- | |
| 65 | | `globalThis` | [`globalthis`](https://github.com/es-shims/globalThis) | |
| 66 | | `Promise.allSettled` | [`promise.allsettled`](https://github.com/es-shims/Promise.allSettled) | |
| 67 | | `String.prototype.matchAll` | [`string.prototype.matchall`](https://github.com/ljharb/String.prototype.matchAll) | |
| 68 | |
| 69 | ### ES2019 |
| 70 | |
| 71 | | Builtin object or function | Package name | Owner | |
| 72 | | :----------------------------- | :----------------------------------------------------------------------------------------- | :---- | |
| 73 | | `Array.prototype.flat` | [`array.prototype.flat`](https://github.com/es-shims/Array.prototype.flat) | |
| 74 | | `Array.prototype.flatMap` | [`array.prototype.flatmap`](https://github.com/es-shims/Array.prototype.flatMap) | |
| 75 | | `Object.fromEntries` | [`object.fromentries`](https://github.com/es-shims/Object.fromEntries) | |
| 76 | | `String.prototype.trimStart` | [`string.prototype.trimstart`](https://github.com/es-shims/String.prototype.trimStart) | |
| 77 | | `String.prototype.trimEnd` | [`string.prototype.trimend`](https://github.com/es-shims/String.prototype.trimEnd) | |
| 78 | | `String.prototype.trimLeft` | [`string.prototype.trimleft`](https://github.com/es-shims/String.prototype.trimLeft) | |
| 79 | | `String.prototype.trimRight` | [`string.prototype.trimright`](https://github.com/es-shims/String.prototype.trimRight) | |
| 80 | | `Symbol.prototype.description` | [`symbol.prototype.description`](https://github.com/es-shims/Symbol.prototype.description) | |
| 81 | |
| 82 | ### ES2018 |
| 83 | |
| 84 | | Builtin object or function | Package name | Owner | |
| 85 | | :-------------------------- | :----------------------------------------------------------------------------------- | :---- | |
| 86 | | `Promise.prototype.finally` | [`promise.prototype.finally`](https://github.com/es-shims/Promise.prototype.finally) | |
| 87 | |
| 88 | ### ES2017 |
| 89 | |
| 90 | | Builtin object or function | Package name | Owner | |
| 91 | | :--------------------------------- | :------------------------------------------------------------------------------------------------- | :---- | |
| 92 | | `Object.values` | [`object.values`](https://github.com/es-shims/Object.values) | |
| 93 | | `Object.entries` | [`object.entries`](https://github.com/es-shims/Object.entries) | |
| 94 | | `Object.getOwnPropertyDescriptors` | [`object.getownpropertydescriptors`](https://github.com/es-shims/object.getownpropertydescriptors) | |
| 95 | | `String.prototype.padStart` | [`string.prototype.padstart`](https://github.com/es-shims/String.prototype.padStart) | |
| 96 | | `String.prototype.padEnd` | [`string.prototype.padend`](https://github.com/es-shims/String.prototype.padEnd) | |
| 97 | |
| 98 | ### ES2016 |
| 99 | |
| 100 | | Builtin object or function | Package name | Owner | |
| 101 | | :------------------------- | :------------------------------------------------------------- | :---- | |
| 102 | | `Array.prototype.includes` | [`array-includes`](https://github.com/es-shims/array-includes) | |
| 103 | |
| 104 | ### ES2015 (ES6) |
| 105 | |
| 106 | > ⚠️ This provider fully supports ES2016+ polyfills, but we are still working on ES5 and ES6 support. You can find the list of missing polyfills at [`missing-polyfills.md`](./missing-polyfills.md). |
| 107 | |
| 108 | | Builtin object or function | Package name | Owner | |
| 109 | | :------------------------------------------ | :---------------------------------------------------------------------------------------------- | :------------------------------------------------- | |
| 110 | | `Array.from` | [`array.from`](https://github.com/mathiasbynens/Array.from) | [@mathiasbynens](https://github.com/mathiasbynens) | |
| 111 | | `Array.of` | [`array.of`](https://github.com/mathiasbynens/Array.of) | [@mathiasbynens](https://github.com/mathiasbynens) | |
| 112 | | `Array.prototype.concat` (updated from ES5) | [`array.prototype.concat`](https://github.com/es-shims/Array.prototype.concat) | |
| 113 | | `Array.prototype.copyWithin` | [`array.prototype.copywithin`](https://github.com/es-shims/Array.prototype.copyWithin) | |
| 114 | | `Array.prototype.entries` | [`array.prototype.entries`](https://github.com/es-shims/Array.prototype.entries) | |
| 115 | | `Array.prototype.find` | [`array.prototype.find`](https://github.com/paulmillr/Array.prototype.find) | [@paulmillr](https://github.com/paulmillr) | |
| 116 | | `Array.prototype.findIndex` | [`array.prototype.findindex`](https://github.com/paulmillr/Array.prototype.findIndex) | [@paulmillr](https://github.com/paulmillr) | |
| 117 | | `Array.prototype.keys` | [`array.prototype.keys`](https://github.com/es-shims/Array.prototype.keys) | |
| 118 | | `Array.prototype.splice` (updated from ES5) | [`array.prototype.splice`](https://github.com/es-shims/Array.prototype.splice) | |
| 119 | | `Array.prototype.values` | [`array.prototype.values`](https://github.com/es-shims/Array.prototype.values) | |
| 120 | | `Function.prototype.name` | [`function.prototype.name`](https://github.com/es-shims/Function.prototype.name) | |
| 121 | | `Math.acosh` | [`math.acosh`](https://github.com/es-shims/Math.acosh) | |
| 122 | | `Math.atanh` | [`math.atanh`](https://github.com/es-shims/Math.atanh) | |
| 123 | | `Math.clz32` | [`math.clz32`](https://github.com/es-shims/Math.clz32) | |
| 124 | | `Math.cbrt` | [`math.cbrt`](https://github.com/es-shims/Math.cbrt) | |
| 125 | | `Math.fround` | [`math.fround`](https://github.com/es-shims/Math.fround) | |
| 126 | | `Math.imul` | [`math.log1p`](https://github.com/es-shims/Math.imul) | |
| 127 | | `Math.log10` | [`math.log1p`](https://github.com/es-shims/Math.log10) | |
| 128 | | `Math.log1p` | [`math.log1p`](https://github.com/es-shims/Math.log1p) | |
| 129 | | `Math.sign` | [`math.sign`](https://github.com/es-shims/Math.sign) | |
| 130 | | `Number.isNaN` | [`number.isnan`](https://github.com/es-shims/Number.isNaN) | |
| 131 | | `Object.assign` | [`object.assign`](https://github.com/ljharb/object.assign) | [@ljharb](https://github.com/ljharb) | |
| 132 | | `Object.getPrototypeOf` | [`object.getprototypeof`](https://github.com/es-shims/Object.getPrototypeOf) | |
| 133 | | `Object.is` | [`object-is`](https://github.com/es-shims/object-is) | |
| 134 | | `Reflect.apply` | [`reflect.apply`](https://github.com/es-shims/Reflect.apply) | |
| 135 | | `Reflect.getPrototypeOf` | [`reflect.getprototypeof`](https://github.com/es-shims/Reflect.getPrototypeOf) | |
| 136 | | `Reflect.ownKeys` | [`reflect.ownkeys`](https://github.com/es-shims/Reflect.ownKeys) | |
| 137 | | `RegExp.prototype.flags` | [`regexp.prototype.flags`](https://github.com/es-shims/RegExp.prototype.flags) | |
| 138 | | `String.fromCodePoint` | [`string.fromcodepoint`](https://github.com/mathiasbynens/String.fromCodePoint) | [@mathiasbynens](https://github.com/mathiasbynens) | |
| 139 | | `String.raw` | [`string.raw`](https://github.com/es-shims/String.raw) | |
| 140 | | `String.prototype.codePointAt` | [`string.prototype.codepointat`](https://github.com/mathiasbynens/String.prototype.codePointAt) | [@mathiasbynens](https://github.com/mathiasbynens) | |
| 141 | | `String.prototype.endsWith` | [`string.prototype.endswith`](https://github.com/mathiasbynens/String.prototype.endsWith) | [@mathiasbynens](https://github.com/mathiasbynens) | |
| 142 | | `String.prototype.includes` | [`string.prototype.includes`](https://github.com/mathiasbynens/String.prototype.includes) | [@mathiasbynens](https://github.com/mathiasbynens) | |
| 143 | | `String.prototype.repeat` | [`string.prototype.repeat`](https://github.com/mathiasbynens/String.prototype.repeat) | [@mathiasbynens](https://github.com/mathiasbynens) | |
| 144 | | `String.prototype.startWith` | [`string.prototype.startwith`](https://github.com/mathiasbynens/String.prototype.startsWith) | [@mathiasbynens](https://github.com/mathiasbynens) | |
| 145 | | Annex B `String.prototype.*` | [`es-string-html-methods`](https://github.com/es-shims/es-string-html-methods) | |
| 146 | |
| 147 | ### ES5 |
| 148 | |
| 149 | > ⚠️ This provider fully supports ES2016+ polyfills, but we are still working on ES5 and ES6 support. You can find the list of missing polyfills at [`missing-polyfills.md`](./missing-polyfills.md). |
| 150 | |
| 151 | | Builtin object or function | Package name | Owner | |
| 152 | | :------------------------------- | :--------------------------------------------------------------------------------------------- | :---- | |
| 153 | | `parseInt` | [`parseint`](https://github.com/es-shims/parseInt) | |
| 154 | | `Array.prototype.every` | [`array.prototype.every`](https://github.com/es-shims/Array.prototype.every) | |
| 155 | | `Array.prototype.indexOf` | [`array.prototype.indexof`](https://github.com/es-shims/Array.prototype.indexOf) | |
| 156 | | `Array.prototype.lastIndexOf` | [`array.prototype.lastindexof`](https://github.com/es-shims/Array.prototype.lastIndexOf) | |
| 157 | | `Array.prototype.map` | [`array.prototype.map`](https://github.com/es-shims/Array.prototype.map) | |
| 158 | | `Array.prototype.reduce` | [`array.prototype.reduce`](https://github.com/es-shims/Array.prototype.reduce) | |
| 159 | | `Array.prototype.reduceRight` | [`array.prototype.reduceright`](https://github.com/es-shims/Array.prototype.reduceRight) | |
| 160 | | `Array.prototype.some` | [`array.prototype.some`](https://github.com/es-shims/Array.prototype.some) | |
| 161 | | `Number.prototype.toExponential` | [`number.prototype.toexponential`](https://github.com/es-shims/Number.prototype.toExponential) | |
| 162 | | `Object.defineProperties` | [`object.defineproperties`](https://github.com/es-shims/Object.defineProperties) | |
| 163 | | `String.prototype.split` | [`string.prototype.split`](https://github.com/es-shims/String.prototype.split) | |
| 164 | | `String.prototype.substr` | [`string.prototype.substr`](https://github.com/es-shims/String.prototype.substr) | |
| 165 | | `String.prototype.trim` | [`string.prototype.trim`](https://github.com/es-shims/String.prototype.trim) | |