Skip to content

Commit

Permalink
fix: include globalThis when es is requested
Browse files Browse the repository at this point in the history
  • Loading branch information
wessberg committed May 5, 2022
1 parent bc953a6 commit 3c8c5d8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ And, if you request `performance.now`, `date.now` will also be included since th
- `es.collections`
- `es.typed-array`
- `es.reflect`
- `es.global-this`
- **`es2015`**
- `es`
- **`es.promise`**
Expand Down Expand Up @@ -735,7 +736,9 @@ And, if you request `performance.now`, `date.now` will also be included since th
- **`setimmediate`**
- `set-immediate`
- **`globalthis`**
- `global-this`
- `es.global-this`
- **`global-this`**
- `es.global-this`
- **`adopted-style-sheets`**
- `constructable-style-sheets`
- `systemjs`
Expand Down Expand Up @@ -770,4 +773,4 @@ And, if you request `performance.now`, `date.now` will also be included since th
- `mutation-observer`
- `resize-observer`
- `broadcast-channel`
- `proto`
- `proto`
3 changes: 2 additions & 1 deletion scripts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "@wessberg/ts-config",
"compilerOptions": {
"target": "es2017",
"module": "commonjs"
"module": "commonjs",
"resolveJsonModule": true
}
}
21 changes: 13 additions & 8 deletions src/constant/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ export const constant: IConstant = {
"es.symbol",
"es.collections",
"es.typed-array",
"es.reflect"
"es.reflect",
"es.global-this"
]
},
// es2015 is an alias for 'es'
Expand Down Expand Up @@ -2722,6 +2723,14 @@ export const constant: IConstant = {
"esnext.symbol": {
polyfills: ["es.symbol.pattern-match"]
},
"es.global-this": {
library: "core-js",
relativePaths: ["modules/es.global-this.js"],
features: ["javascript.builtins.globalThis"],

dependencies: [],
contexts: ALL_CONTEXTS
},
"dom.collections.iterable": {
polyfills: ["dom.collections.iterator", "dom.collections.for-each"]
},
Expand Down Expand Up @@ -3238,16 +3247,12 @@ export const constant: IConstant = {
contexts: ALL_CONTEXTS
},
globalthis: {
polyfills: ["global-this"]
polyfills: ["es.global-this"]
},
"global-this": {
library: "core-js",
relativePaths: ["modules/es.global-this.js"],
features: ["javascript.builtins.globalThis"],

dependencies: [],
contexts: ALL_CONTEXTS
polyfills: ["es.global-this"]
},

"adopted-style-sheets": {
polyfills: ["constructable-style-sheets"]
},
Expand Down
7 changes: 4 additions & 3 deletions src/polyfill/polyfill-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ export declare type PolyfillName =
| "requestanimationframe"
| "requestidlecallback"
| "setimmediate"
| "globalthis"
| "formdata"
| "adopted-style-sheets";
| "adopted-style-sheets"
| "global-this"
| "globalthis";

export declare type PolyfillDealiasedName =
| "es.object.assign"
Expand Down Expand Up @@ -307,6 +308,7 @@ export declare type PolyfillDealiasedName =
| "es.reflect.has-metadata"
| "es.reflect.has-own-metadata"
| "es.reflect.metadata"
| "es.global-this"
| "regenerator-runtime"
| "systemjs"
| "performance.now"
Expand Down Expand Up @@ -356,7 +358,6 @@ export declare type PolyfillDealiasedName =
| "pointer-event"
| "set-immediate"
| "web-animations"
| "global-this"
| "broadcast-channel"
| "form-data"
| "constructable-style-sheets"
Expand Down

0 comments on commit 3c8c5d8

Please sign in to comment.