Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions src/dev_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,37 +398,12 @@ export class DevServer {
displayLabel: 'add' | 'update' | 'delete'
}) {
const relativePath = string.toUnixSlash(options.filePath)
const absolutePath = join(this.cwdPath, relativePath)

if (this.#isHttpServerAlive === false) {
this.#clearScreen()
this.ui.logger.log(`${this.ui.colors.green(options.displayLabel)} ${relativePath}`)
this.#restartHTTPServer()
return
}

/**
* For add/unlink, we call the hooks directly since hot-hook ignores files
* not in its dependency tree. This ensures index files are regenerated
* for new/removed files.
*/
if (options.action === 'add') {
this.#hooks.runner('fileAdded').run(relativePath, absolutePath, this)
} else if (options.action === 'unlink') {
this.#hooks.runner('fileRemoved').run(relativePath, absolutePath, this)
}

/**
* Forward all events to hot-hook so it can:
* - Update its dependency tree (for unlink)
* - Handle HMR for change events on imported files
* - Then we wait for hot-hook to notify us back via IPC message
*/
this.#httpServer?.send({
type: 'hot-hook:file-changed',
path: absolutePath,
action: options.action,
})
}

/**
Expand Down Expand Up @@ -857,7 +832,6 @@ export class DevServer {
this.options.nodeArgs.push('--import=hot-hook/register')
this.options.env = {
...this.options.env,
HOT_HOOK_WATCH: 'false',
}
}

Expand Down
Loading