Skip to content

Commit

Permalink
chore: replace fast-glob with tinyglobby for improved performance (#714)
Browse files Browse the repository at this point in the history
  • Loading branch information
arashsheyda authored Aug 24, 2024
1 parent b3f386a commit 550dd77
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"destr": "^2.0.3",
"error-stack-parser-es": "^0.1.5",
"execa": "^7.2.0",
"fast-glob": "^3.3.2",
"fast-npm-meta": "^0.2.2",
"flatted": "^3.3.1",
"get-port-please": "^3.1.2",
Expand All @@ -74,6 +73,7 @@
"semver": "^7.6.3",
"simple-git": "^3.25.0",
"sirv": "^2.0.4",
"tinyglobby": "^0.2.5",
"unimport": "^3.11.0",
"vite-plugin-inspect": "^0.8.7",
"vite-plugin-vue-inspector": "^5.1.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/devtools/src/server-rpc/analyze-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fsp from 'node:fs/promises'
import fs from 'node:fs'
import { startSubprocess } from '@nuxt/devtools-kit'
import { dirname, join } from 'pathe'
import fg from 'fast-glob'
import { glob } from 'tinyglobby'
import Git from 'simple-git'
import type { NuxtAnalyzeMeta } from '@nuxt/schema'
import type { AnalyzeBuildMeta, NuxtDevtoolsServerContext, ServerFunctions } from '../types'
Expand Down Expand Up @@ -46,7 +46,7 @@ export function setupAnalyzeBuildRPC({ nuxt, refresh, ensureDevAuthToken }: Nuxt
}

async function readBuildInfo() {
const files = await fg('*/meta.json', { cwd: analyzeDir, onlyFiles: true, absolute: true })
const files = await glob(['*/meta.json'], { cwd: analyzeDir, onlyFiles: true, absolute: true })
builds = await Promise.all(files.map(async (file) => {
const dir = dirname(file)
const json = JSON.parse(await fsp.readFile(file, 'utf-8')) as NuxtAnalyzeMeta
Expand Down
4 changes: 2 additions & 2 deletions packages/devtools/src/server-rpc/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import fsp from 'node:fs/promises'
import { join, resolve } from 'pathe'
import { imageMeta } from 'image-meta'
import { debounce } from 'perfect-debounce'
import fg from 'fast-glob'
import { glob } from 'tinyglobby'
import type { AssetEntry, AssetInfo, AssetType, ImageMeta, NuxtDevtoolsServerContext, ServerFunctions } from '../types'
import { defaultAllowedExtensions } from '../constant'

Expand Down Expand Up @@ -34,7 +34,7 @@ export function setupAssetsRPC({ nuxt, ensureDevAuthToken, refresh, options }: N
const dirs: { layerDir: string, files: string[] }[] = []

for (const layerDir of layerDirs) {
const files = await fg(['**/*'], {
const files = await glob(['**/*'], {
cwd: layerDir,
onlyFiles: true,
})
Expand Down
20 changes: 10 additions & 10 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 550dd77

Please sign in to comment.