Skip to content

Commit

Permalink
chore: use node-glob instead of native glob to support Node v20 (#3301)…
Browse files Browse the repository at this point in the history
… (CP: 24.7) (#3302)
  • Loading branch information
vaadin-bot authored Feb 28, 2025
1 parent 33314b0 commit 4364521
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
10 changes: 9 additions & 1 deletion package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"type": "module",
"engines": {
"node": ">=22.0.0",
"node": ">=20.0.0",
"npm": ">=10.5"
},
"workspaces": [
Expand Down 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
10 changes: 9 additions & 1 deletion scripts/build.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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);

Expand Down
3 changes: 2 additions & 1 deletion scripts/fast-build.ts
Original file line number Diff line number Diff line change
@@ -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';
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 4364521

Please sign in to comment.