Skip to content

Commit

Permalink
chore: add polyfill for Array.fromAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
Lodin committed Feb 28, 2025
1 parent c7e605f commit bd1e116
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"@vitest/browser": "3.0.6",
"@vitest/coverage-v8": "3.0.6",
"@vitest/ui": "3.0.6",
"array-from-async": "3.0.0",
"c8": "10.1.3",
"chai": "5.2.0",
"chai-as-promised": "8.0.1",
Expand Down
7 changes: 7 additions & 0 deletions scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ import injectRegister from './utils/injectRegister.js';
import loadTSConfig from './utils/loadTSConfig.js';
import redirectURLPart from './utils/redirectURLPart.js';

if (!('fromAsync' in Array)) {
const { fromAsync } = await import('array-from-async');
Object.defineProperty(Array, 'fromAsync', {
value: fromAsync,
});
}

const cwd = pathToFileURL(dir(process.cwd()));
const sourceDir = new URL('src/', cwd);

Expand Down
4 changes: 4 additions & 0 deletions scripts/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// eslint-disable-next-line import/unambiguous
declare module 'array-from-async' {
export const fromAsync: typeof Array.fromAsync;
}

0 comments on commit bd1e116

Please sign in to comment.