Skip to content

Commit

Permalink
chore: switch to tinyglobby to drop 21 dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Jul 24, 2024
1 parent ca2e9ea commit 8914a94
Show file tree
Hide file tree
Showing 3 changed files with 3,402 additions and 2,647 deletions.
4 changes: 2 additions & 2 deletions packages/vite-plugin-mock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@
"chokidar": "^3.5.3",
"connect": "^3.7.0",
"debug": "^4.3.4",
"fast-glob": "^3.2.12",
"path-to-regexp": "^6.2.1",
"picocolors": "^1.0.0"
"picocolors": "^1.0.0",
"tinyglobby": "^0.2.0"
},
"peerDependencies": {
"mockjs": ">=1.1.0",
Expand Down
7 changes: 4 additions & 3 deletions packages/vite-plugin-mock/src/createMockServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import fs from 'node:fs'
import chokidar from 'chokidar'
import colors from 'picocolors'
import url from 'url'
import fg from 'fast-glob'
import tg from 'tinyglobby'
import Mock from 'mockjs'
import { pathToRegexp, match } from 'path-to-regexp'
import { isArray, isFunction, sleep, isRegExp, isAbsPath } from './utils'
Expand Down Expand Up @@ -189,8 +189,9 @@ async function getMockConfig(opt: ViteMockOptions, config: ResolvedConfig) {
return ret
}

const mockFiles = fg
.sync(`**/*.{ts,mjs,js}`, {
const mockFiles = tg
.globSync({
patterns: [`**/*.{ts,mjs,js}`],
cwd: absMockPath,
})
.filter((item) => {
Expand Down
Loading

0 comments on commit 8914a94

Please sign in to comment.