Skip to content

Commit b9f97e9

Browse files
committed
chore: add changeset
1 parent 21475cb commit b9f97e9

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

.changeset/pretty-cycles-show.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
'hot-hook': patch
3+
---
4+
5+
## Global watching and file-changed events
6+
7+
Add support for "global watching" and "file-changed" events
8+
9+
Before this commit, Hot-hook only watched files after they were imported at runtime. Now, it directly watches all project files and sends a "file-changed" event whenever a file is modified, deleted, or added. This allows "runners" to react in various ways to file changes based on their needs.
10+
11+
The option to configure which files to watch is `include`, and by default is set to `["**/*"]`, meaning all files from the `rootDirectory`.
12+
13+
The behavior will be as follows:
14+
- If the file has not yet been imported at runtime, and therefore is not part of the import graph, and it is modified, then a `hot-hook:file-changed` event will be emitted with the payload `{ path: string, action: "change" | "add" | "unlink"}`
15+
- If the file has already been imported at runtime, and it is hot reloadable, then a `hot-hook:invalidated` event will be emitted with the payload `{ path: string }`. As before.
16+
- If the file has already been imported at runtime and it is not hot reloadable, then `hot-hook:full-reload` will be emitted with the payload `{ path: string }`. As before.
17+
18+
## Environment variables configuration
19+
20+
You can now configure certain environment variables for hot-hook, which are:
21+
- `HOT_HOOK_IGNORE`: for the `ignore` option. Example: `HOT_HOOK_IGNORE=**/node_modules/**,**/dist/**`
22+
- `HOT_HOOK_INCLUDE`: for the `include` option. Example: `HOT_HOOK_INCLUDE=**/*`
23+
- `HOT_HOOK_BOUNDARIES`: for the `boundaries` option. Example: `HOT_HOOK_BOUNDARIES=./controllers/**/*.ts`
24+
- `HOT_HOOK_RESTART`: for the `restart` option. Example: `HOT_HOOK_RESTART=.env,./config/**/*.ts`

0 commit comments

Comments
 (0)