diff --git a/package-lock.json b/package-lock.json index 35ad9588d6..afa365e66a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,6 +34,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", @@ -77,7 +78,7 @@ "vitest": "3.0.6" }, "engines": { - "node": ">=22.0.0", + "node": ">=20.0.0", "npm": ">=10.5" } }, @@ -6568,6 +6569,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/array-from-async": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/array-from-async/-/array-from-async-3.0.0.tgz", + "integrity": "sha512-gV8/L4y2QB5JTXL9DMdtspGyed2M3V6nMnSN+nNg8ejyUlAAbKAjRS6pfWWINjU/MuFJFMGWPazHPor7hThXQw==", + "dev": true, + "license": "BSD-3-Clause" + }, "node_modules/array-includes": { "version": "3.1.8", "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.8.tgz", diff --git a/package.json b/package.json index 8964579630..e0c67d984a 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "type": "module", "engines": { - "node": ">=22.0.0", + "node": ">=20.0.0", "npm": ">=10.5" }, "workspaces": [ @@ -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", diff --git a/scripts/build.ts b/scripts/build.ts index 53600082a8..77a8019913 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -1,5 +1,6 @@ -import { mkdir, readFile, writeFile, glob } from 'node:fs/promises'; +import { mkdir, readFile, writeFile } from 'node:fs/promises'; import { fileURLToPath, pathToFileURL } from 'node:url'; +import { globIterate as glob } from 'glob'; import type { PackageJson } from 'type-fest'; import { createCompilerHost, createProgram, type ParsedCommandLine, sys } from 'typescript'; import { compileCSS, replaceCSSImports } from './utils/compileCSS.js'; @@ -8,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); diff --git a/scripts/fast-build.ts b/scripts/fast-build.ts index 9888fb7bb5..f12a43beb1 100644 --- a/scripts/fast-build.ts +++ b/scripts/fast-build.ts @@ -1,7 +1,8 @@ import type { SourceMapPayload } from 'module'; -import { mkdir, readFile, writeFile, glob } from 'node:fs/promises'; +import { mkdir, readFile, writeFile } from 'node:fs/promises'; import { basename } from 'node:path'; import { fileURLToPath, pathToFileURL } from 'node:url'; +import { globIterate as glob } from 'glob'; import { transform, type TransformOptions } from 'oxc-transform'; import type { PackageJson } from 'type-fest'; import { ScriptTarget } from 'typescript'; diff --git a/scripts/types.ts b/scripts/types.ts new file mode 100644 index 0000000000..590e1c726c --- /dev/null +++ b/scripts/types.ts @@ -0,0 +1,4 @@ +// eslint-disable-next-line import/unambiguous +declare module 'array-from-async' { + export const fromAsync: typeof Array.fromAsync; +}