Skip to content

Commit

Permalink
cleanup(core): move esbuild to fdir/picomatch
Browse files Browse the repository at this point in the history
Migrates away from fast-glob to `fdir` and `picomatch`, a faster and
smaller combination.
  • Loading branch information
43081j committed Sep 27, 2024
1 parent 56eabff commit 726d35e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
"@types/marked": "^2.0.0",
"@types/node": "18.19.8",
"@types/npm-package-arg": "6.1.1",
"@types/picomatch": "^3.0.1",
"@types/react": "18.3.1",
"@types/react-dom": "18.3.0",
"@types/semver": "^7.5.2",
Expand Down Expand Up @@ -350,6 +351,7 @@
"core-js": "3.36.1",
"enquirer": "~2.3.6",
"fast-glob": "3.2.7",
"fdir": "^6.0.3",
"framer-motion": "^11.3.0",
"front-matter": "^4.0.2",
"glob": "7.1.4",
Expand All @@ -361,6 +363,7 @@
"next-seo": "^5.13.0",
"node-machine-id": "1.1.12",
"npm-run-path": "^4.0.1",
"picomatch": "^4.0.2",
"preact": "10.6.4",
"react": "18.3.1",
"react-copy-to-clipboard": "^5.1.0",
Expand Down
6 changes: 5 additions & 1 deletion packages/esbuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@
"requirements": {},
"migrations": "./migrations.json"
},
"devDependencies": {
"@types/picomatch": "^3.0.1"
},
"dependencies": {
"@nx/devkit": "file:../devkit",
"@nx/js": "file:../js",
"fast-glob": "3.2.7",
"fdir": "^6.0.3",
"picomatch": "^4.0.2",
"picocolors": "^1.1.0",
"tsconfig-paths": "^4.1.2",
"tslib": "^2.3.0"
Expand Down
14 changes: 8 additions & 6 deletions packages/esbuild/src/utils/get-entry-points.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ExecutorContext, readJsonFile } from '@nx/devkit';
import * as fs from 'fs';
import * as path from 'path';
import * as glob from 'fast-glob';
import { fdir } from 'fdir';
import picomatch = require('picomatch');

export interface GetEntryPointsOptions {
recursive?: boolean;
Expand Down Expand Up @@ -50,11 +51,12 @@ export function getEntryPoints(
const tsconfig = readJsonFile(
path.join(project.data.root, foundTsConfig)
);
const projectFiles = glob
.sync(tsconfig.include ?? [], {
cwd: project.data.root,
ignore: tsconfig.exclude ?? [],
})
const isExcluded = tsconfig.exclude ? picomatch(tsconfig.exclude) : null;
const projectFiles = new fdir()
.glob(...(tsconfig.include ?? []))
.exclude((path) => !isExcluded || isExcluded(path))
.crawl(project.data.root)
.sync()
.map((f) => path.join(project.data.root, f));

projectFiles.forEach((f) => entryPoints.add(f));
Expand Down
14 changes: 14 additions & 0 deletions pnpm-lock.yaml

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

0 comments on commit 726d35e

Please sign in to comment.