Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(polyfills): Remove Promise.allSettled polyfill #2672

Merged
merged 3 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions modules/polyfills/src/index.browser.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
// loaders.gl, MIT License

import {allSettled} from './promise/all-settled';

if (!('allSettled' in Promise)) {
// @ts-ignore
Promise.allSettled = allSettled;
}

// eslint-disable-next-line @typescript-eslint/no-empty-function
export function installFilePolyfills() {}

Expand Down
8 changes: 1 addition & 7 deletions modules/polyfills/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* eslint-disable dot-notation */
import {isBrowser} from './utils/globals';
import {isBrowser} from './utils/is-browser';

import {TextDecoder, TextEncoder} from './lib/encoding';
import {allSettled} from './promise/all-settled';

// Node specific
import * as base64 from './node/buffer/btoa.node';
Expand Down Expand Up @@ -68,11 +67,6 @@ if (!isBrowser && !('_parseImageNode' in globalThis) && parseImageNode) {
globalThis['_imageFormatsNode'] = NODE_FORMAT_SUPPORT;
}

if (!('allSettled' in Promise)) {
// @ts-ignore
Promise.allSettled = allSettled;
}

// DEPRECATED POLYFILL:
// - Node v18+: No, not needed
// - Node v16 and lower: Yes
Expand Down
21 changes: 0 additions & 21 deletions modules/polyfills/src/promise/all-settled.ts

This file was deleted.

37 changes: 0 additions & 37 deletions modules/polyfills/src/utils/globals.ts

This file was deleted.

6 changes: 6 additions & 0 deletions modules/polyfills/src/utils/is-browser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// loaders.gl, MIT license

/* eslint-disable no-restricted-globals */
export const isBrowser: boolean =
// @ts-ignore process.browser
typeof process !== 'object' || String(process) !== '[object process]' || process.browser;
3 changes: 1 addition & 2 deletions modules/polyfills/test/images-node/images-node.spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* eslint-disable max-len */
import test from 'tape-promise/tape';
import '@loaders.gl/polyfills';
import {isBrowser} from '../../src/utils/globals';
import {fetchFile} from '@loaders.gl/core';
import {isBrowser, fetchFile} from '@loaders.gl/core';
import {parseImageNode} from '../../src/node/images/parse-image.node';

const images = [
Expand Down