From c860eaa176294b7ae74f6416810cdfc619fdfa2b Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Mon, 17 Feb 2025 12:06:54 -0800 Subject: [PATCH] Switch to tinyglobby 0.2.11 addressing previous performance issues Revert "fix: revert #396, move back to `fast-glob`" This reverts commit 7bc76c5f87e2ca9b52062d21fa0dd20381e378cb. --- package.json | 2 +- pnpm-lock.yaml | 38 +++++++++++++++++++++++++------------- pnpm-workspace.yaml | 3 +-- src/node/scan-dirs.ts | 5 ++--- 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 110d17f0..8f49f50a 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,6 @@ "acorn": "catalog:", "escape-string-regexp": "catalog:", "estree-walker": "catalog:", - "fast-glob": "catalog:", "local-pkg": "catalog:", "magic-string": "catalog:", "mlly": "catalog:", @@ -57,6 +56,7 @@ "pkg-types": "catalog:", "scule": "catalog:", "strip-literal": "catalog:", + "tinyglobby": "catalog:", "unplugin": "catalog:", "unplugin-utils": "catalog:" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d884837d..3d8569f6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -42,9 +42,6 @@ catalogs: estree-walker: specifier: ^3.0.3 version: 3.0.3 - fast-glob: - specifier: ^3.3.3 - version: 3.3.3 h3: specifier: ^1.15.0 version: 1.15.0 @@ -78,6 +75,9 @@ catalogs: strip-literal: specifier: ^3.0.0 version: 3.0.0 + tinyglobby: + specifier: ^0.2.11 + version: 0.2.11 typescript: specifier: ^5.7.3 version: 5.7.3 @@ -119,9 +119,6 @@ importers: estree-walker: specifier: 'catalog:' version: 3.0.3 - fast-glob: - specifier: 'catalog:' - version: 3.3.3 local-pkg: specifier: 'catalog:' version: 1.0.0 @@ -146,6 +143,9 @@ importers: strip-literal: specifier: 'catalog:' version: 3.0.0 + tinyglobby: + specifier: 'catalog:' + version: 0.2.11 unplugin: specifier: 'catalog:' version: 2.2.0 @@ -1724,6 +1724,14 @@ packages: picomatch: optional: true + fdir@6.4.3: + resolution: {integrity: sha512-PMXmW2y1hDDfTSRc9gaXIuCCRpuoz3Kaz8cUelp3smouvfT632ozg2vrT6lJsHKKOF59YLbOGfAWGUcKEfRMQw==} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + file-entry-cache@8.0.0: resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==} engines: {node: '>=16.0.0'} @@ -2919,8 +2927,8 @@ packages: tinyexec@0.3.2: resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==} - tinyglobby@0.2.10: - resolution: {integrity: sha512-Zc+8eJlFMvgatPZTl6A9L/yht8QqdmUNtURHaKZLmKBE12hNPSrqNkUp2cs3M/UKmNVVAMFQYSjYIVHDjW5zew==} + tinyglobby@0.2.11: + resolution: {integrity: sha512-32TmKeeKUahv0Go8WmQgiEp9Y21NuxjwjqiRC1nrUB51YacfSwuB44xgXD+HdIppmMRgjQNPdrHyA6vIybYZ+g==} engines: {node: '>=12.0.0'} tinypool@1.0.2: @@ -4136,7 +4144,7 @@ snapshots: prompts: 2.4.2 semver: 7.7.1 tinyexec: 0.3.2 - tinyglobby: 0.2.10 + tinyglobby: 0.2.11 transitivePeerDependencies: - magicast @@ -4866,6 +4874,10 @@ snapshots: optionalDependencies: picomatch: 4.0.2 + fdir@6.4.3(picomatch@4.0.2): + optionalDependencies: + picomatch: 4.0.2 + file-entry-cache@8.0.0: dependencies: flat-cache: 4.0.1 @@ -5572,7 +5584,7 @@ snapshots: postcss: 8.5.1 postcss-nested: 7.0.2(postcss@8.5.1) semver: 7.7.1 - tinyglobby: 0.2.10 + tinyglobby: 0.2.11 optionalDependencies: typescript: 5.7.3 vue: 3.5.13(typescript@5.7.3) @@ -6185,9 +6197,9 @@ snapshots: tinyexec@0.3.2: {} - tinyglobby@0.2.10: + tinyglobby@0.2.11: dependencies: - fdir: 6.4.2(picomatch@4.0.2) + fdir: 6.4.3(picomatch@4.0.2) picomatch: 4.0.2 tinypool@1.0.2: {} @@ -6258,7 +6270,7 @@ snapshots: rollup: 4.30.1 rollup-plugin-dts: 6.1.1(rollup@4.30.1)(typescript@5.7.3) scule: 1.3.0 - tinyglobby: 0.2.10 + tinyglobby: 0.2.11 untyped: 1.5.2 optionalDependencies: typescript: 5.7.3 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 617676d9..a48fb02b 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -13,7 +13,6 @@ catalog: escape-string-regexp: ^5.0.0 eslint: ^9.20.1 estree-walker: ^3.0.3 - fast-glob: ^3.3.3 h3: ^1.15.0 jquery: ^3.7.1 lit: ^3.2.1 @@ -26,7 +25,7 @@ catalog: pkg-types: ^1.3.1 scule: ^1.3.0 strip-literal: ^3.0.0 - tinyglobby: ^0.2.10 + tinyglobby: ^0.2.11 typescript: ^5.7.3 unbuild: ^3.3.1 unplugin: ^2.2.0 diff --git a/src/node/scan-dirs.ts b/src/node/scan-dirs.ts index 61daee28..5e9153d0 100644 --- a/src/node/scan-dirs.ts +++ b/src/node/scan-dirs.ts @@ -5,11 +5,11 @@ import { existsSync } from 'node:fs' import { readFile } from 'node:fs/promises' import process from 'node:process' import { fileURLToPath } from 'node:url' -import fg from 'fast-glob' import { findExports, findTypeExports, resolve as mllyResolve } from 'mlly' import { basename, dirname, join, normalize, parse as parsePath, resolve } from 'pathe' import pm from 'picomatch' import { camelCase } from 'scule' +import { glob } from 'tinyglobby' const FileExtensionLookup = [ 'mts', @@ -54,14 +54,13 @@ export function normalizeScanDirs(dirs: (string | ScanDir)[], options?: ScanDirE export async function scanFilesFromDir(dir: ScanDir | ScanDir[], options?: ScanDirExportsOptions) { const dirGlobs = (Array.isArray(dir) ? dir : [dir]).map(i => i.glob) - const files = (await fg( + const files = (await glob( dirGlobs, { absolute: true, cwd: options?.cwd || process.cwd(), onlyFiles: true, followSymbolicLinks: true, - unique: true, }, )) .map(i => normalize(i))