Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit ac65012

Browse files
committed
Add es2015-es2020 polyfills
1 parent f6f2032 commit ac65012

File tree

7 files changed

+54
-6
lines changed

7 files changed

+54
-6
lines changed

bundler/polyfills/es2015/fetch.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

bundler/polyfills/es2015/mod.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
import './fetch.ts'
1+
import nameShim from 'https://esm.sh/function.prototype.name/shim'
2+
3+
import '../es2016/mod.ts'
4+
5+
nameShim()

bundler/polyfills/es2016/mod.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Array#includes is stage 4, in ES7/ES2016
2+
import includesShim from 'https://esm.sh/array-includes/shim'
3+
4+
import '../es2017/mod.ts'
5+
6+
includesShim()
7+
8+

bundler/polyfills/es2017/mod.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Object.values/Object.entries are stage 4, in ES2017
2+
import valuesShim from 'https://esm.sh/object.values/shim'
3+
import entriesShim from 'https://esm.sh/object.entries/shim'
4+
5+
// String#padStart/String#padEnd are stage 4, in ES2017
6+
import padstartShim from 'https://esm.sh/string.prototype.padstart/shim'
7+
import padendShim from 'https://esm.sh/string.prototype.padend/shim'
8+
9+
// Object.getOwnPropertyDescriptors is stage 4, in ES2017
10+
import getownpropertydescriptorsShim from 'https://esm.sh/object.getownpropertydescriptors/shim'
11+
12+
import '../es2018/mod.ts'
13+
14+
valuesShim()
15+
entriesShim()
16+
padstartShim()
17+
padendShim()
18+
getownpropertydescriptorsShim()

bundler/polyfills/es2018/mod.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import finallyShim from 'https://esm.sh/promise.prototype.finally/shim'
2+
import '../es2019/mod.ts'
3+
4+
if (typeof Promise === 'function') {
5+
finallyShim()
6+
}

bundler/polyfills/es2019/mod.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import flatShim from 'https://esm.sh/array.prototype.flat/shim'
2+
import flatmapShim from 'https://esm.sh/array.prototype.flatmap/shim'
3+
import descriptionShim from 'https://esm.sh/symbol.prototype.description/shim'
4+
import fromentriesShim from 'https://esm.sh/object.fromentries/shim'
5+
import '../es2020/mod.ts'
6+
7+
flatShim()
8+
flatmapShim()
9+
descriptionShim()
10+
fromentriesShim()

bundler/polyfills/es2020/mod.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import matchallShim from 'https://esm.sh/string.prototype.matchall/shim'
2+
import globalthisShim from 'https://esm.sh/globalthis/shim'
3+
import allsettledShim from 'https://esm.sh/promise.allsettled/shim'
4+
5+
matchallShim()
6+
globalthisShim()
7+
allsettledShim()

0 commit comments

Comments
 (0)