@ohos-ports/babel-plugin-polyfill-es-shims
v1.0.0-beta.1
Published
A Babel plugin to inject imports to es-shims polyfills (OpenHarmony port; fixes ESM entry JSON import)
Maintainers
Keywords
Readme
babel-plugin-polyfill-es-shims
Install
Using npm:
npm install --save-dev babel-plugin-polyfill-es-shimsor using yarn:
yarn add babel-plugin-polyfill-es-shims --devUsage
Add this plugin to your Babel configuration:
{
"plugins": [["polyfill-es-shims", { "method": "usage-pure" }]]
}This package supports the usage-pure and usage-global methods.
Supported polyfills
This polyfill provider is compatible with polyfills that follow the es-shims-api specification. Those polyfills must live under the @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.
ES2024
| Builtin object or function | Package name | Owner |
| :------------------------------ | :------------------------------------------------------------------------------------------- | :---- |
| String.prototype.isWellFormed | string.prototype.iswellformed |
| String.prototype.toWellFormed | string.prototype.towellformed |
ES2023
| Builtin object or function | Package name | Owner |
| :------------------------------ | :------------------------------------------------------------------------------------------- | :---- |
| Array.prototype.findLast | array.prototype.findlast |
| Array.prototype.findLastIndex | array.prototype.findlastindex |
| Array.prototype.toReversed | array.prototype.toreversed |
| Array.prototype.toSorted | array.prototype.tosorted |
| Array.prototype.toSpliced | array.prototype.tospliced |
| Array.prototype.with | array.prototype.with |
ES2022
| Builtin object or function | Package name | Owner |
| :------------------------- | :----------------------------------------------------------------------- | :---- |
| Array.prototype.at | array.prototype.at |
| Error's cause property | error-cause |
| Object.hasOwn | object.hasown |
| String.prototype.at | string.prototype.at |
ES2021
| Builtin object or function | Package name | Owner |
| :----------------------------------- | :--------------------------------------------------------------------------------------- | :---- |
| AggregateError (for Promise.any) | es-aggregate-error |
| Promise.any | promise.any |
| String.prototype.replaceAll | string.prototype.replaceall |
ES2020
| Builtin object or function | Package name | Owner |
| :-------------------------- | :--------------------------------------------------------------------------------- | :---- |
| globalThis | globalthis |
| Promise.allSettled | promise.allsettled |
| String.prototype.matchAll | string.prototype.matchall |
ES2019
| Builtin object or function | Package name | Owner |
| :----------------------------- | :----------------------------------------------------------------------------------------- | :---- |
| Array.prototype.flat | array.prototype.flat |
| Array.prototype.flatMap | array.prototype.flatmap |
| Object.fromEntries | object.fromentries |
| String.prototype.trimStart | string.prototype.trimstart |
| String.prototype.trimEnd | string.prototype.trimend |
| String.prototype.trimLeft | string.prototype.trimleft |
| String.prototype.trimRight | string.prototype.trimright |
| Symbol.prototype.description | symbol.prototype.description |
ES2018
| Builtin object or function | Package name | Owner |
| :-------------------------- | :----------------------------------------------------------------------------------- | :---- |
| Promise.prototype.finally | promise.prototype.finally |
ES2017
| Builtin object or function | Package name | Owner |
| :--------------------------------- | :------------------------------------------------------------------------------------------------- | :---- |
| Object.values | object.values |
| Object.entries | object.entries |
| Object.getOwnPropertyDescriptors | object.getownpropertydescriptors |
| String.prototype.padStart | string.prototype.padstart |
| String.prototype.padEnd | string.prototype.padend |
ES2016
| Builtin object or function | Package name | Owner |
| :------------------------- | :------------------------------------------------------------- | :---- |
| Array.prototype.includes | array-includes |
ES2015 (ES6)
⚠️ 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.
| Builtin object or function | Package name | Owner |
| :------------------------------------------ | :---------------------------------------------------------------------------------------------- | :------------------------------------------------- |
| Array.from | array.from | @mathiasbynens |
| Array.of | array.of | @mathiasbynens |
| Array.prototype.concat (updated from ES5) | array.prototype.concat |
| Array.prototype.copyWithin | array.prototype.copywithin |
| Array.prototype.entries | array.prototype.entries |
| Array.prototype.find | array.prototype.find | @paulmillr |
| Array.prototype.findIndex | array.prototype.findindex | @paulmillr |
| Array.prototype.keys | array.prototype.keys |
| Array.prototype.splice (updated from ES5) | array.prototype.splice |
| Array.prototype.values | array.prototype.values |
| Function.prototype.name | function.prototype.name |
| Math.acosh | math.acosh |
| Math.atanh | math.atanh |
| Math.clz32 | math.clz32 |
| Math.cbrt | math.cbrt |
| Math.fround | math.fround |
| Math.imul | math.log1p |
| Math.log10 | math.log1p |
| Math.log1p | math.log1p |
| Math.sign | math.sign |
| Number.isNaN | number.isnan |
| Object.assign | object.assign | @ljharb |
| Object.getPrototypeOf | object.getprototypeof |
| Object.is | object-is |
| Reflect.apply | reflect.apply |
| Reflect.getPrototypeOf | reflect.getprototypeof |
| Reflect.ownKeys | reflect.ownkeys |
| RegExp.prototype.flags | regexp.prototype.flags |
| String.fromCodePoint | string.fromcodepoint | @mathiasbynens |
| String.raw | string.raw |
| String.prototype.codePointAt | string.prototype.codepointat | @mathiasbynens |
| String.prototype.endsWith | string.prototype.endswith | @mathiasbynens |
| String.prototype.includes | string.prototype.includes | @mathiasbynens |
| String.prototype.repeat | string.prototype.repeat | @mathiasbynens |
| String.prototype.startWith | string.prototype.startwith | @mathiasbynens |
| Annex B String.prototype.* | es-string-html-methods |
ES5
⚠️ 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.
| Builtin object or function | Package name | Owner |
| :------------------------------- | :--------------------------------------------------------------------------------------------- | :---- |
| parseInt | parseint |
| Array.prototype.every | array.prototype.every |
| Array.prototype.indexOf | array.prototype.indexof |
| Array.prototype.lastIndexOf | array.prototype.lastindexof |
| Array.prototype.map | array.prototype.map |
| Array.prototype.reduce | array.prototype.reduce |
| Array.prototype.reduceRight | array.prototype.reduceright |
| Array.prototype.some | array.prototype.some |
| Number.prototype.toExponential | number.prototype.toexponential |
| Object.defineProperties | object.defineproperties |
| String.prototype.split | string.prototype.split |
| String.prototype.substr | string.prototype.substr |
| String.prototype.trim | string.prototype.trim |
