Skip to content

Commit

Permalink
refactor: upgrade chokidar to v4 (#1211)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
SuperchupuDev and github-actions[bot] authored Oct 9, 2024
1 parent 6f7455b commit ec53f28
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"dependencies": {
"bundle-require": "^5.0.0",
"cac": "^6.7.14",
"chokidar": "^3.6.0",
"chokidar": "^4.0.1",
"consola": "^3.2.3",
"debug": "^4.3.7",
"esbuild": "^0.24.0",
Expand All @@ -66,7 +66,7 @@
"source-map": "0.8.0-beta.0",
"sucrase": "^3.35.0",
"tinyexec": "^0.3.0",
"tinyglobby": "^0.2.6",
"tinyglobby": "^0.2.7",
"tree-kill": "^1.2.2"
},
"devDependencies": {
Expand Down
24 changes: 12 additions & 12 deletions pnpm-lock.yaml

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

10 changes: 4 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import fs from 'node:fs'
import { Worker } from 'node:worker_threads'
import { loadTsConfig } from 'bundle-require'
import { exec, type Result as ExecChild } from 'tinyexec'
import { glob } from 'tinyglobby'
import { glob, globSync } from 'tinyglobby'
import kill from 'tree-kill'
import { version } from '../package.json'
import { PrettyError, handleError } from './errors'
Expand Down Expand Up @@ -400,9 +400,7 @@ export async function build(_options: Options) {
typeof options.watch === 'boolean'
? '.'
: Array.isArray(options.watch)
? options.watch.filter(
(path): path is string => typeof path === 'string',
)
? options.watch.filter((path) => typeof path === 'string')
: options.watch

logger.info(
Expand All @@ -420,10 +418,10 @@ export async function build(_options: Options) {
.join(' | ')}`,
)

const watcher = watch(watchPaths, {
const watcher = watch(await glob(watchPaths), {
ignoreInitial: true,
ignorePermissionErrors: true,
ignored,
ignored: (p) => globSync(p, { ignore: ignored }).length === 0,
})
watcher.on('all', async (type, file) => {
file = slash(file)
Expand Down

0 comments on commit ec53f28

Please sign in to comment.