Skip to content

Commit

Permalink
perf(local): use tinyglobby to scan font files (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann authored Aug 7, 2024
1 parent 8d4713c commit 289ca3e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"defu": "^6.1.4",
"esbuild": "^0.23.0",
"fontaine": "^0.5.0",
"globby": "^14.0.2",
"h3": "^1.12.0",
"jiti": "^1.21.6",
"magic-regexp": "^0.8.0",
Expand All @@ -58,6 +57,7 @@
"ohash": "^1.1.3",
"pathe": "^1.1.2",
"sirv": "^2.0.4",
"tinyglobby": "^0.2.0",
"ufo": "^1.5.4",
"unplugin": "^1.11.0",
"unstorage": "^1.10.2"
Expand Down
29 changes: 25 additions & 4 deletions pnpm-lock.yaml

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

4 changes: 2 additions & 2 deletions src/providers/local.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { globby } from 'globby'
import { glob } from 'tinyglobby'
import { join, relative, resolve } from 'pathe'
import { filename } from 'pathe/utils'
import { anyOf, createRegExp, not, wordBoundary } from 'magic-regexp'
Expand All @@ -17,7 +17,7 @@ export default {
// Scan for all font files in public asset directories
nuxt.hook('nitro:init', async (nitro) => {
for (const assetsDir of nitro.options.publicAssets) {
const possibleFontFiles = await globby('**/*.{ttf,woff,woff2,eot,otf}', {
const possibleFontFiles = await glob(['**/*.{ttf,woff,woff2,eot,otf}'], {
absolute: true,
cwd: assetsDir.dir,
})
Expand Down

0 comments on commit 289ca3e

Please sign in to comment.