Skip to content

Commit

Permalink
chore: tweak types
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Dec 20, 2024
1 parent f285485 commit 1089317
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/vite/src/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export { perEnvironmentPlugin } from './plugin'
export { perEnvironmentState } from './environment'
export { createServer } from './server'
export { preview } from './preview'
export { build, createBuilder, type RollupWatcher } from './build'
export { build, createBuilder } from './build'

export { optimizeDeps } from './optimizer'
export { createIdResolver } from './idResolver'
Expand Down
26 changes: 22 additions & 4 deletions playground/vitestSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
Logger,
PluginOption,
ResolvedConfig,
RollupWatcher,
Rollup,
UserConfig,
ViteDevServer,
} from 'vite'
Expand All @@ -25,6 +25,27 @@ import type { RollupError, RollupWatcherEvent } from 'rollup'
import type { RunnerTestFile } from 'vitest'
import { beforeAll, inject } from 'vitest'

type RollupWatcher = Rollup.RolldownWatcher
type RollupWatcherEvent =
| {
code: 'START'
}
| {
code: 'BUNDLE_START'
}
| {
code: 'BUNDLE_END'
duration: number
output: readonly string[]
}
| {
code: 'END'
}
| {
code: 'ERROR'
error: Error
}

// #region env

export const workspaceRoot = path.resolve(__dirname, '../')
Expand Down Expand Up @@ -316,9 +337,6 @@ export async function notifyRebuildComplete(
await new Promise<void>((resolve) => {
resolveFn = resolve
})
// During tests we edit the files too fast and sometimes chokidar
// misses change events, so wait 100ms for consistency
await new Promise<void>((resolve) => setTimeout(resolve, 100))
return watcher // watcher.off('event', callback)
}

Expand Down

0 comments on commit 1089317

Please sign in to comment.