Skip to content

Commit

Permalink
chore: fix Array.fromAsync polyfill (#3306)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lodin authored Feb 28, 2025
1 parent 273d81c commit 24b3623
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
10 changes: 2 additions & 8 deletions scripts/build.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import './polyfills.js';
import { mkdir, readFile, writeFile } from 'node:fs/promises';
import { isAbsolute } from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import { globIterate as glob } from 'glob';
import type { PackageJson } from 'type-fest';
Expand All @@ -8,14 +10,6 @@ import dir from './utils/dir.js';
import injectRegister from './utils/injectRegister.js';
import loadTSConfig from './utils/loadTSConfig.js';
import redirectURLPart from './utils/redirectURLPart.js';
import { isAbsolute } from 'node:path';

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
8 changes: 8 additions & 0 deletions scripts/polyfills.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if (!('fromAsync' in Array)) {
const { default: fromAsync } = await import('array-from-async');
Object.defineProperty(Array, 'fromAsync', {
value: fromAsync,
});
}

export {};

0 comments on commit 24b3623

Please sign in to comment.