Skip to content

Commit ac54bf5

Browse files
authored
chore: update deps as per npmx.dev recommendation (#1141)
* chore: update deps as per npmx.dev recommendation * fix: Add tinyglobby to replace omitted parts. * fix: Add tinyglobby to replace omitted parts.
1 parent c616e45 commit ac54bf5

File tree

7 files changed

+86
-49
lines changed

7 files changed

+86
-49
lines changed

packages/vite-plugin/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@
7878
"convert-source-map": "^1.7.0",
7979
"debug": "^4.3.3",
8080
"es-module-lexer": "^0.10.0",
81-
"fast-glob": "^3.2.11",
81+
"tinyglobby": "^0.2.15",
8282
"fs-extra": "^10.0.1",
8383
"jsesc": "^3.0.2",
8484
"magic-string": "^0.30.12",
8585
"node-html-parser": "^7.0.2",
8686
"pathe": "^2.0.1",
8787
"picocolors": "^1.1.1",
8888
"react-refresh": "^0.13.0",
89-
"rollup": "2.79.2",
89+
"rollup": "2.80.0",
9090
"rxjs": "7.5.7"
9191
},
9292
"devDependencies": {

packages/vite-plugin/src/node/files.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import fg from 'fast-glob'
1+
import { glob, GlobOptions, isDynamicPattern } from 'tinyglobby'
22
import { ManifestV3 } from './manifest'
33
import { ManifestFiles } from './types'
44
import { isString } from './helpers'
55
import { join } from 'pathe';
66

77
export async function manifestFiles(
88
manifest: ManifestV3,
9-
options: fg.Options = {},
9+
options: GlobOptions = {},
1010
): Promise<ManifestFiles> {
1111
// JSON
1212
let locales: string[] = []
1313
if (manifest.default_locale)
14-
locales = await fg('_locales/**/messages.json', options)
14+
locales = await glob('_locales/**/messages.json', options)
1515

1616
const rulesets =
1717
manifest.declarative_net_request?.rule_resources.flatMap(
@@ -46,7 +46,7 @@ export async function manifestFiles(
4646
.map(async (r) => {
4747
// don't copy node_modules, etc
4848
if (['*', '**/*'].includes(r)) return undefined
49-
if (fg.isDynamicPattern(r)) return fg(r, options)
49+
if (isDynamicPattern(r)) return glob(r, options)
5050
return r
5151
}),
5252
)
@@ -66,7 +66,7 @@ export async function manifestFiles(
6666
}
6767

6868
export async function dirFiles(dir: string): Promise<string[]> {
69-
const files = await fg(join(dir,'**','*'));
69+
const files = await glob(join(dir,'**','*'));
7070
return files
7171
}
7272

packages/vite-plugin/src/node/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Node as AcornNode } from 'acorn'
2-
import type { Options as FastGlobOptions } from 'fast-glob'
2+
import type { GlobOptions } from 'tinyglobby'
33
import type { OutputBundle, PluginContext } from 'rollup'
44
import type { HMRPayload, ResolvedConfig, Plugin as VitePlugin } from 'vite'
55
import { ManifestV3 } from './manifest'
@@ -85,7 +85,7 @@ export interface CrxOptions {
8585
hmrTimeout?: number
8686
injectCss?: boolean
8787
}
88-
fastGlobOptions?: FastGlobOptions
88+
globOptions?: GlobOptions
8989
/**
9090
* The browser that this extension is targeting, can be "firefox" or "chrome".
9191
* Default is "chrome".

packages/vite-plugin/tests/out/vite-underscore-css-filename/build.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import { build } from 'tests/runners'
22
import { testOutput } from 'tests/testOutput'
33
import { test, expect } from 'vitest'
4-
import fg from 'fast-glob'
4+
import { glob } from 'tinyglobby'
55
import { basename } from 'path'
66

77
test('build fs output', async () => {
8-
let result = await build(__dirname)
8+
const result = await build(__dirname)
99
await testOutput(result)
1010
})
1111

1212
test('no output files start with underscore (except _locales)', async () => {
1313
const result = await build(__dirname)
1414
const { outDir } = result
1515

16-
const files = await fg(`**/*`, { cwd: outDir })
16+
const files = await glob(`**/*`, { cwd: outDir })
1717

1818
// Filter out _locales which is allowed to start with underscore
1919
const invalidFiles = files.filter((file) => {

packages/vite-plugin/tests/out/vite-underscore-css-filename/serve.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { serve } from 'tests/runners'
22
import { testOutput } from 'tests/testOutput'
33
import { test, expect } from 'vitest'
4-
import fg from 'fast-glob'
4+
import { glob } from 'tinyglobby'
55
import { basename } from 'path'
66

77
test('no output files start with underscore (except _locales)', async () => {
88
const result = await serve(__dirname)
99
const { outDir } = result
1010

11-
const files = await fg(`**/*`, { cwd: outDir })
11+
const files = await glob(`**/*`, { cwd: outDir })
1212

1313
// Filter out _locales which is allowed to start with underscore
1414
const invalidFiles = files.filter((file) => {

packages/vite-plugin/tests/testOutput.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import fg from 'fast-glob'
1+
import { glob } from 'tinyglobby'
22
import fs from 'fs-extra'
33
import jsesc from 'jsesc'
44
import { join } from 'pathe'
@@ -73,7 +73,7 @@ export async function testOutput(
7373
expect(manifest).toMatchSnapshot(name)
7474
})(JSON.stringify(manifest), '_00 manifest.json')
7575

76-
const files = await fg(`**/*`, { cwd: outDir })
76+
const files = await glob(`**/*`, { cwd: outDir })
7777

7878
const scrubbedFiles = files.map(scrubHashes).sort()
7979
expect(scrubbedFiles).toMatchSnapshot('_01 output files')

0 commit comments

Comments
 (0)