Skip to content

Commit

Permalink
cleanup(core): move esbuild to use tinyglobby
Browse files Browse the repository at this point in the history
An alternative to #28037, switches the esbuild package to use
`tinyglobby` instead of `fast-glob`.

This improves performance a fair chunk and reduces install
complexity/size.
  • Loading branch information
43081j committed Dec 30, 2024
1 parent 8a841cd commit 21be15e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/esbuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"dependencies": {
"@nx/devkit": "file:../devkit",
"@nx/js": "file:../js",
"fast-glob": "3.2.7",
"tinyglobby": "^0.2.10",
"picocolors": "^1.1.0",
"tsconfig-paths": "^4.1.2",
"tslib": "^2.3.0"
Expand Down
13 changes: 6 additions & 7 deletions packages/esbuild/src/utils/get-entry-points.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ExecutorContext, readJsonFile } from '@nx/devkit';
import * as fs from 'fs';
import * as path from 'path';
import * as glob from 'fast-glob';
import { globSync } from 'tinyglobby';

export interface GetEntryPointsOptions {
recursive?: boolean;
Expand Down Expand Up @@ -50,12 +50,11 @@ 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 ?? [],
})
.map((f) => path.join(project.data.root, f));
const projectFiles = globSync(tsconfig.include ?? [], {
cwd: project.data.root,
ignore: tsconfig.exclude ?? [],
expandDirectories: false,
}).map((f) => path.join(project.data.root, f));

projectFiles.forEach((f) => entryPoints.add(f));
options?.onProjectFilesMatched?.(projectName, projectFiles);
Expand Down
2 changes: 1 addition & 1 deletion packages/esbuild/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": []
"types": ["node"]
},
"include": ["**/*.ts"],
"exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"]
Expand Down

0 comments on commit 21be15e

Please sign in to comment.