diff --git a/packages/js/package.json b/packages/js/package.json index d35a9818a31451..84e15fef86f18c 100644 --- a/packages/js/package.json +++ b/packages/js/package.json @@ -49,7 +49,6 @@ "columnify": "^1.6.0", "detect-port": "^1.5.1", "enquirer": "~2.3.6", - "fast-glob": "3.2.7", "ignore": "^5.0.4", "js-tokens": "^4.0.0", "jsonc-parser": "3.2.0", @@ -59,6 +58,7 @@ "ora": "5.3.0", "semver": "^7.5.3", "source-map-support": "0.5.19", + "tinyglobby": "0.2.10", "ts-node": "10.9.1", "tsconfig-paths": "^4.1.2", "tslib": "^2.3.0" diff --git a/packages/js/src/executors/swc/swc.impl.ts b/packages/js/src/executors/swc/swc.impl.ts index 7062498090107e..3f96d743a81685 100644 --- a/packages/js/src/executors/swc/swc.impl.ts +++ b/packages/js/src/executors/swc/swc.impl.ts @@ -1,5 +1,5 @@ import { ExecutorContext, output, readJsonFile } from '@nx/devkit'; -import { sync as globSync } from 'fast-glob'; +import { globSync } from 'tinyglobby'; import { rmSync } from 'node:fs'; import { dirname, join, normalize, relative, resolve } from 'path'; import { copyAssets } from '../../utils/assets'; @@ -254,6 +254,7 @@ function createEntryPoints( if (!options.additionalEntryPoints?.length) return []; return globSync(options.additionalEntryPoints, { cwd: context.root, + expandDirectories: false, }); } diff --git a/packages/js/src/utils/assets/assets.ts b/packages/js/src/utils/assets/assets.ts index 2bf9650101dc87..3a634b7a495c28 100644 --- a/packages/js/src/utils/assets/assets.ts +++ b/packages/js/src/utils/assets/assets.ts @@ -1,4 +1,4 @@ -import * as fastGlob from 'fast-glob'; +import { globSync } from 'tinyglobby'; import { basename, join } from 'path'; export type FileInputOutput = { @@ -24,10 +24,11 @@ export function assetGlobsToFiles( ignore: string[] = [], dot: boolean = false ) => { - return fastGlob.sync(pattern, { + return globSync(pattern, { cwd: input, onlyFiles: true, dot, + expandDirectories: false, ignore, }); }; diff --git a/packages/js/src/utils/assets/copy-assets-handler.ts b/packages/js/src/utils/assets/copy-assets-handler.ts index 1a1545cbf2bc6c..96a455000676ed 100644 --- a/packages/js/src/utils/assets/copy-assets-handler.ts +++ b/packages/js/src/utils/assets/copy-assets-handler.ts @@ -10,7 +10,7 @@ import { import * as pathPosix from 'node:path/posix'; import * as path from 'node:path'; import ignore from 'ignore'; -import * as fg from 'fast-glob'; +import { globSync } from 'tinyglobby'; import { AssetGlob } from './assets'; import { logger } from '@nx/devkit'; import { ChangedFile, daemonClient } from 'nx/src/daemon/client/client'; @@ -115,7 +115,7 @@ export class CopyAssetsHandler { this.assetGlobs.map(async (ag) => { const pattern = this.normalizeAssetPattern(ag); - // fast-glob only supports Unix paths + // globbing only supports Unix paths const files = await fg(pattern.replace(/\\/g, '/'), { cwd: this.rootDir, dot: true, // enable hidden files @@ -130,10 +130,11 @@ export class CopyAssetsHandler { this.assetGlobs.forEach((ag) => { const pattern = this.normalizeAssetPattern(ag); - // fast-glob only supports Unix paths - const files = fg.sync(pattern.replace(/\\/g, '/'), { + // globbing only supports Unix paths + const files = globSync(pattern.replace(/\\/g, '/'), { cwd: this.rootDir, dot: true, // enable hidden files + expandDirectories: false, }); this.callback(this.filesToEvent(files, ag)); diff --git a/packages/js/src/utils/package-json/create-entry-points.ts b/packages/js/src/utils/package-json/create-entry-points.ts index 6f907aa92760db..dfc76d3e2ad3a2 100644 --- a/packages/js/src/utils/package-json/create-entry-points.ts +++ b/packages/js/src/utils/package-json/create-entry-points.ts @@ -1,4 +1,4 @@ -import { sync as globSync } from 'fast-glob'; +import { globSync } from 'tinyglobby'; import { logger } from '@nx/devkit'; export function createEntryPoints( @@ -13,7 +13,10 @@ export function createEntryPoints( // Performance impact should be negligible since there shouldn't be that many entry points. // Benchmarks show only 1-3% difference in execution time. for (const pattern of additionalEntryPoints) { - const matched = globSync([pattern], { cwd: root }); + const matched = globSync([pattern], { + cwd: root, + expandDirectories: false + }); if (!matched.length) logger.warn(`The pattern ${pattern} did not match any files.`); files.push(...matched);