@c9up/ream 0.2.23 → 0.2.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/Codemods.d.ts +1 -0
  2. package/dist/Codemods.d.ts.map +1 -1
  3. package/dist/Codemods.js +44 -0
  4. package/dist/Codemods.js.map +1 -1
  5. package/dist/Ignitor.d.ts +50 -0
  6. package/dist/Ignitor.d.ts.map +1 -1
  7. package/dist/Ignitor.js +15 -15
  8. package/dist/Ignitor.js.map +1 -1
  9. package/dist/dev/fullReload.d.ts +23 -0
  10. package/dist/dev/fullReload.d.ts.map +1 -0
  11. package/dist/dev/fullReload.js +26 -0
  12. package/dist/dev/fullReload.js.map +1 -0
  13. package/dist/dev/hmr.d.ts +52 -4
  14. package/dist/dev/hmr.d.ts.map +1 -1
  15. package/dist/dev/hmr.js +75 -9
  16. package/dist/dev/hmr.js.map +1 -1
  17. package/dist/dev/hotGlob.d.ts +35 -0
  18. package/dist/dev/hotGlob.d.ts.map +1 -0
  19. package/dist/dev/hotGlob.js +92 -0
  20. package/dist/dev/hotGlob.js.map +1 -0
  21. package/dist/dev/hotGraph.d.ts +58 -0
  22. package/dist/dev/hotGraph.d.ts.map +1 -0
  23. package/dist/dev/hotGraph.js +91 -0
  24. package/dist/dev/hotGraph.js.map +1 -0
  25. package/dist/dev/hotWatcher.d.ts +34 -0
  26. package/dist/dev/hotWatcher.d.ts.map +1 -0
  27. package/dist/dev/hotWatcher.js +72 -0
  28. package/dist/dev/hotWatcher.js.map +1 -0
  29. package/dist/env/loadEnvFiles.d.ts +13 -0
  30. package/dist/env/loadEnvFiles.d.ts.map +1 -1
  31. package/dist/env/loadEnvFiles.js +65 -13
  32. package/dist/env/loadEnvFiles.js.map +1 -1
  33. package/dist/hot.d.ts +13 -16
  34. package/dist/hot.d.ts.map +1 -1
  35. package/dist/hot.js +161 -84
  36. package/dist/hot.js.map +1 -1
  37. package/dist/index.d.ts +1 -1
  38. package/dist/index.js +1 -1
  39. package/events.darwin-arm64.node +0 -0
  40. package/events.darwin-x64.node +0 -0
  41. package/events.linux-arm64-gnu.node +0 -0
  42. package/events.linux-x64-gnu.node +0 -0
  43. package/events.win32-x64-msvc.node +0 -0
  44. package/index.darwin-arm64.node +0 -0
  45. package/index.darwin-x64.node +0 -0
  46. package/index.linux-arm64-gnu.node +0 -0
  47. package/index.linux-x64-gnu.node +0 -0
  48. package/index.win32-x64-msvc.node +0 -0
  49. package/package.json +4 -7
  50. package/scheduler.darwin-arm64.node +0 -0
  51. package/scheduler.darwin-x64.node +0 -0
  52. package/scheduler.linux-arm64-gnu.node +0 -0
  53. package/scheduler.linux-x64-gnu.node +0 -0
  54. package/scheduler.win32-x64-msvc.node +0 -0
  55. package/src/Codemods.ts +53 -0
  56. package/src/Ignitor.ts +68 -14
  57. package/src/dev/fullReload.ts +34 -0
  58. package/src/dev/hmr.ts +102 -9
  59. package/src/dev/hotGlob.ts +91 -0
  60. package/src/dev/hotGraph.ts +109 -0
  61. package/src/dev/hotWatcher.ts +89 -0
  62. package/src/env/loadEnvFiles.ts +69 -14
  63. package/src/hot.ts +169 -102
  64. package/src/index.ts +1 -1
@@ -1,41 +1,82 @@
1
1
  import { readFileSync } from 'node:fs'
2
- import { fileURLToPath } from 'node:url'
2
+ import { fileURLToPath, pathToFileURL } from 'node:url'
3
3
  import { parseEnv } from 'node:util'
4
4
  import { interpolate } from './interpolate.js'
5
5
  import { normalizeNodeEnv } from './nodeEnv.js'
6
6
 
7
7
  /**
8
- * Load `.env` files into `process.env` — the shared primitive behind both the
9
- * Ignitor (HTTP/console boot) and `Env.create()` (config/test flow), mirroring
10
- * AdonisJS which loads env in every flow.
8
+ * The `.env*` files that will be read, most-specific first.
11
9
  *
12
- * Order is most-specific-first and "already-present wins", so the shell / CI
13
- * always overrides the files. Missing files are skipped silently. Uses Node's
14
- * built-in parser — no dependency.
10
+ * Exported because `@c9up/ream/hot` has to WATCH exactly this list: nothing
11
+ * imports an env file, so hot-hook's dependency tree never sees one and an
12
+ * edit to `.env` changed nothing at all. A second copy of the list in the
13
+ * loader entry would drift from this one the first time the naming changes.
15
14
  *
16
- * @param appRoot Directory URL the `.env*` files are resolved against.
17
- * @param options.skipEnvLocal Skip `.env.local` (the test flow does, so a
18
- * developer's local overrides don't leak into tests).
15
+ * @param options.skipEnvLocal Skip `.env.local` — see {@link loadEnvFiles}.
19
16
  */
20
- export function loadEnvFiles(appRoot: URL, options: { skipEnvLocal?: boolean } = {}): void {
17
+ export function envFileNames(options: { skipEnvLocal?: boolean } = {}): string[] {
21
18
  // Normalised, so `NODE_ENV=prod` loads `.env.production` — the file the
22
19
  // deployment actually wrote — instead of looking for `.env.prod`.
23
20
  const raw = normalizeNodeEnv(process.env.NODE_ENV)
24
21
  const nodeEnv = raw === 'unknown' ? undefined : raw
25
- const files = [
22
+ return [
26
23
  nodeEnv ? `.env.${nodeEnv}.local` : null,
27
24
  options.skipEnvLocal ? null : '.env.local',
28
25
  nodeEnv ? `.env.${nodeEnv}` : null,
29
26
  '.env',
30
27
  ].filter((name): name is string => name !== null)
28
+ }
29
+
30
+ /**
31
+ * Where the `.env*` files are read from.
32
+ *
33
+ * Normally beside the application, which is what `appRoot` names. A BUILT
34
+ * application moves: `start/env.js` sits in `dist/`, so `new URL('../',
35
+ * import.meta.url)` resolves there and the files at the project root become
36
+ * invisible — `ream start` died on a `.env` it was standing next to.
37
+ *
38
+ * `ENV_PATH` is AdonisJS's own variable for this, named and shaped the same
39
+ * way: a DIRECTORY to read the files from, as in
40
+ * `ENV_PATH=/etc/secrets node server.js`. An application moving over keeps
41
+ * whatever it already sets.
42
+ *
43
+ * It is also why the ordering rule stays here rather than in the CLI: node's
44
+ * `--env-file` applies files last-wins while this loader applies them
45
+ * most-specific-first, and a second copy of that would be one to keep in step
46
+ * forever.
47
+ */
48
+ function envDirectory(appRoot: URL): URL {
49
+ const override = process.env.ENV_PATH
50
+ if (override === undefined || override.trim() === '') return appRoot
51
+ // A directory URL, so `new URL('.env', directory)` lands inside it rather
52
+ // than beside it.
53
+ return pathToFileURL(override.endsWith('/') ? override : `${override}/`)
54
+ }
31
55
 
32
- for (const name of files) {
56
+ /**
57
+ * Load `.env` files into `process.env` — the shared primitive behind both the
58
+ * Ignitor (HTTP/console boot) and `Env.create()` (config/test flow), mirroring
59
+ * AdonisJS which loads env in every flow.
60
+ *
61
+ * Order is most-specific-first and "already-present wins", so the shell / CI
62
+ * always overrides the files. Missing files are skipped silently. Uses Node's
63
+ * built-in parser — no dependency.
64
+ *
65
+ * @param appRoot Directory URL the `.env*` files are resolved against.
66
+ * @param options.skipEnvLocal Skip `.env.local` (the test flow does, so a
67
+ * developer's local overrides don't leak into tests).
68
+ */
69
+ export function loadEnvFiles(appRoot: URL, options: { skipEnvLocal?: boolean } = {}): void {
70
+ const directory = envDirectory(appRoot)
71
+ let found = false
72
+ for (const name of envFileNames(options)) {
33
73
  let contents: string
34
74
  try {
35
- contents = readFileSync(fileURLToPath(new URL(name, appRoot)), 'utf8')
75
+ contents = readFileSync(fileURLToPath(new URL(name, directory)), 'utf8')
36
76
  } catch {
37
77
  continue // file absent — nothing to load
38
78
  }
79
+ found = true
39
80
  const parsed = parseEnv(contents)
40
81
  for (const [key, value] of Object.entries(parsed)) {
41
82
  if (typeof value !== 'string' || process.env[key] !== undefined) continue
@@ -49,4 +90,18 @@ export function loadEnvFiles(appRoot: URL, options: { skipEnvLocal?: boolean } =
49
90
  })
50
91
  }
51
92
  }
93
+
94
+ // Upstream raises when `ENV_PATH` names a place with no env file in it, and
95
+ // for the reason silence would be wrong: the variable is somebody saying
96
+ // where the file IS. A typo in the path would otherwise start a server on
97
+ // whatever defaults happened to be around, which is how a deployment reads
98
+ // its staging config in production and nobody finds out until later.
99
+ //
100
+ // Without `ENV_PATH` a missing file stays silent: an application may have
101
+ // none at all, and every value may come from the environment.
102
+ if (!found && process.env.ENV_PATH !== undefined && process.env.ENV_PATH.trim() !== '') {
103
+ throw new Error(
104
+ `ENV_PATH points at ${process.env.ENV_PATH}, which holds none of ${envFileNames(options).join(', ')}`,
105
+ )
106
+ }
52
107
  }
package/src/hot.ts CHANGED
@@ -5,132 +5,199 @@
5
5
  *
6
6
  * node --import @swc-node/register/esm-register --import @c9up/ream/hot bin/server.ts
7
7
  *
8
- * It is a thin shim over `hot-hook`, which does the actual work: it registers
9
- * an ESM loader that tracks the import graph, and when a file inside a declared
10
- * boundary changes it invalidates just that module instead of the process. The
11
- * `hotHook` key in the application's `package.json` configures it, exactly as
12
- * upstream reads it.
8
+ * It replaces a module that changed instead of the process that was serving it,
9
+ * so the container, the pools and the connections survive a save.
13
10
  *
14
- * NAMED DEVIATION — why this file exists at all.
11
+ * NAMED DEVIATION — this is ream's own, where AdonisJS uses `hot-hook`.
15
12
  *
16
- * Upstream's dev server is itself a Node process: it forks the app, so the two
17
- * talk over Node's IPC channel, and `hot-hook` reports a change it cannot swap
18
- * by calling `process.send({ type: 'hot-hook:full-reload' })`. Our dev server is
19
- * a Rust binary. A process it spawns has NO IPC channel, so `process.send` is
20
- * `undefined` and that message goes nowhere: the server would keep serving the
21
- * old module and say nothing.
13
+ * Upstream ships that package in its starter kit, which means every application
14
+ * installs it, and one created before the convention existed silently loses hot
15
+ * reloading. The parts that once justified a library are now in Node:
16
+ * `module.registerHooks` gives the import graph, `fs.watch` gives the changes.
17
+ * What is left is the decision of what to invalidate, which is this file and
18
+ * its three neighbours — and no entry in anyone's `package.json`.
22
19
  *
23
- * `hot.init()` takes an `onFullReloadAsked` callback for exactly this case, and
24
- * that is the whole of the shim: turn "I cannot hot-swap this" into an exit
25
- * code the Rust parent understands and restarts on. Everything else is
26
- * upstream's behaviour, unmodified.
20
+ * The graph comes from the resolver rather than from reading files: a resolve
21
+ * hook is handed the importer and the imported, which is exactly an edge, and
22
+ * it sees a dynamic import at the moment it happens rather than guessing at it
23
+ * from the source.
27
24
  */
28
25
 
26
+ import { existsSync, writeSync } from 'node:fs'
27
+ import { readFile } from 'node:fs/promises'
28
+ import { registerHooks } from 'node:module'
29
+ import { dirname, relative, resolve as resolvePath } from 'node:path'
30
+ import { fileURLToPath, pathToFileURL } from 'node:url'
31
+ import { fullReloadNotice } from './dev/fullReload.js'
29
32
  import { hotReloadHappened } from './dev/hmr.js'
30
- import { type HotHookConfig, readHotHookConfig } from './dev/hotConfig.js'
33
+ import { readHotHookConfig } from './dev/hotConfig.js'
34
+ import { globMatcher } from './dev/hotGlob.js'
35
+ import { HotGraph } from './dev/hotGraph.js'
36
+ import { watchProject } from './dev/hotWatcher.js'
37
+ import { envFileNames } from './env/loadEnvFiles.js'
31
38
 
32
39
  /** Exit code meaning "restart me" — see `EXIT_RESTART` in the CLI's dev module. */
33
40
  const FULL_RELOAD_EXIT_CODE = 75
34
41
 
35
- interface HotHook {
36
- init(options: {
37
- rootDirectory: string
38
- root?: string
39
- boundaries?: string[]
40
- restart?: string[]
41
- ignore?: string[]
42
- throwWhenBoundariesAreNotDynamicallyImported?: boolean
43
- onFullReloadAsked?: () => void
44
- }): Promise<void>
45
- }
42
+ /** The query parameter that makes the loader fetch a module again. */
43
+ const VERSION_PARAM = 'ream_hot'
44
+
45
+ /** Directories a project keeps its own code in — the CLI watches the same list. */
46
+ const WATCH_DIRS = ['app', 'bin', 'config', 'start', 'database', 'providers', 'commands']
46
47
 
47
- const { readFile } = await import('node:fs/promises')
48
- const { dirname, resolve } = await import('node:path')
48
+ const packageJsonPath = resolvePath(process.cwd(), 'package.json')
49
+ const root = dirname(packageJsonPath)
49
50
 
50
- const packageJsonPath = resolve(process.cwd(), 'package.json')
51
- let config: HotHookConfig = {}
51
+ let config = {}
52
52
  try {
53
53
  config = readHotHookConfig(JSON.parse(await readFile(packageJsonPath, 'utf8')))
54
54
  } catch {
55
- // No package.json, or unreadable: fall through to the conventional
56
- // boundaries below rather than stopping dev over it.
55
+ // No package.json, or unreadable: a project with no boundaries declared gets
56
+ // a working server that restarts on change, which is the old behaviour.
57
57
  }
58
+ const { boundaries = [], restart = [] } = config as { boundaries?: string[]; restart?: string[] }
58
59
 
59
- // `hot-hook` is an optional peer, declared by the application because it is a
60
- // dev dependency there and has no business in a production install. Imported by
61
- // specifier built at runtime so a production bundle never resolves it.
62
- function isHotHook(value: unknown): value is HotHook {
63
- return (
64
- typeof value === 'object' && value !== null && typeof Reflect.get(value, 'init') === 'function'
65
- )
60
+ // Env files are not modules: nothing imports one, so the graph never sees them
61
+ // and an edit to `.env` did nothing at all — the values are read once, at boot.
62
+ // They always restart.
63
+ const restartFiles = new Set(
64
+ envFileNames()
65
+ .map((name) => resolvePath(root, name))
66
+ .filter((file) => existsSync(file)),
67
+ )
68
+
69
+ /**
70
+ * `metaFiles` entries that asked for a restart.
71
+ *
72
+ * Non-module files the application owns — translations, view templates — live
73
+ * in `reamrc.ts` because the BUILD has to copy them. A change to one is
74
+ * invisible to the import graph, so the only way it can do anything in
75
+ * development is by being named here.
76
+ *
77
+ * `reloadServer: false` is the interesting default, and the one upstream picks
78
+ * for translations: the entry exists so the file ships, and an edit does NOT
79
+ * restart. NAMED DEVIATION — upstream still logs such a change, because its
80
+ * watcher covers the whole project anyway. This one watches a fixed list of
81
+ * directories on purpose (`resources/` belongs to the asset watcher, and a
82
+ * stylesheet edit must not restart the server), so a `false` entry is simply
83
+ * not watched. The observable behaviour is the same: nothing happens.
84
+ */
85
+ async function readReloadPatterns(): Promise<string[]> {
86
+ try {
87
+ const rc = (await import(pathToFileURL(resolvePath(root, 'reamrc.ts')).href)) as {
88
+ default?: { metaFiles?: Array<{ pattern?: unknown; reloadServer?: unknown }> }
89
+ }
90
+ return (rc.default?.metaFiles ?? [])
91
+ .filter((entry) => entry.reloadServer === true && typeof entry.pattern === 'string')
92
+ .map((entry) => String(entry.pattern))
93
+ } catch {
94
+ // No rc file, or one that does not load. The server itself reports a broken
95
+ // rc far more clearly than the loader could, and a dev server that refuses
96
+ // to start because of a watch list helps nobody.
97
+ return []
98
+ }
66
99
  }
67
100
 
68
- // `hot-hook` belongs to the APPLICATION: it is a dev dependency there and has
69
- // no business in a production install of the framework. So it is resolved from
70
- // the project directory rather than from this file — under pnpm's strict layout
71
- // a bare `import("hot-hook")` here looks inside @c9up/ream and finds nothing.
72
- // It is the same reason upstream passes `hot-hook/register` from the app's own
73
- // cwd instead of re-exporting it from the framework.
74
- const { createRequire } = await import('node:module')
75
- const { pathToFileURL } = await import('node:url')
101
+ const reloadPatterns = await readReloadPatterns()
76
102
 
77
- let hot: HotHook | undefined
78
- try {
79
- const resolved = createRequire(packageJsonPath).resolve('hot-hook')
80
- const module: unknown = await import(pathToFileURL(resolved).href)
81
- const candidate =
82
- typeof module === 'object' && module !== null ? Reflect.get(module, 'hot') : undefined
83
- if (!isHotHook(candidate)) {
84
- throw new Error('hot-hook did not expose a `hot` object with init()')
103
+ /**
104
+ * The directory a pattern lives under — everything before its first wildcard.
105
+ *
106
+ * `resources/lang/**\/*.json` is watched as `resources/lang`. Watching the
107
+ * project root instead would pull in `node_modules` and the build output.
108
+ */
109
+ function watchRootOf(pattern: string): string {
110
+ const segments = pattern.replace(/^\.\//, '').split('/')
111
+ const fixed: string[] = []
112
+ for (const segment of segments) {
113
+ if (/[*?{[]/.test(segment)) break
114
+ fixed.push(segment)
85
115
  }
86
- hot = candidate
87
- } catch (error) {
88
- // Loud, and it names the fix. Silence here would start a perfectly healthy
89
- // server that never picks up an edit, which reads as "HMR is broken" rather
90
- // than "HMR is not installed".
91
- //
92
- // It does NOT throw: a dev server that refuses to start is worse than one
93
- // without hot reloading, and the CLI only loads this file when it has
94
- // already seen hot-hook in the project — so reaching here means it went
95
- // missing under a running session.
96
- console.error(
97
- `[ream] hot module replacement is unavailable: ${error instanceof Error ? error.message : String(error)}\n` +
98
- '[ream] Install it with: pnpm add -D hot-hook, then restart `ream dev`.\n' +
99
- '[ream] Until then the server runs, but an edit will not be picked up.',
100
- )
116
+ // A pattern that is a bare glob has no directory to narrow to.
117
+ return fixed.slice(0, -1).join('/') || fixed.join('/')
101
118
  }
102
119
 
103
- // Impersonate the IPC channel upstream's dev server provides.
104
- //
105
- // hot-hook reports BOTH of its outcomes through `process.send`: a change it
106
- // swapped in place (`hot-hook:invalidated`) and one it could not
107
- // (`hot-hook:full-reload`). Under a Node parent that function exists and both
108
- // arrive; under our Rust parent it is `undefined` and both are dropped —
109
- // `onFullReloadAsked` alone recovers only half of that, leaving a hot swap
110
- // invisible to the very process it happened in, and so to the browser.
111
- //
112
- // This is not a trick played on hot-hook: it is exactly the contract it
113
- // expects, provided by us instead of by Node.
114
- const previousSend = process.send
115
- process.send = (message: unknown, ...rest: unknown[]): boolean => {
116
- const type =
117
- typeof message === 'object' && message !== null ? Reflect.get(message, 'type') : undefined
118
- if (type === 'hot-hook:invalidated') {
119
- hotReloadHappened()
120
- }
121
- // If a real channel ever exists (embedded under a Node supervisor) it still
122
- // gets its message: this observes, it does not intercept.
123
- if (typeof previousSend === 'function') {
124
- return Reflect.apply(previousSend, process, [message, ...rest]) === true
120
+ const relativeToRoot = (file: string): string => relative(root, file).replace(/\\/g, '/')
121
+ const matchesBoundary = globMatcher(boundaries)
122
+ const matchesRestartGlob = globMatcher([...restart, ...reloadPatterns])
123
+
124
+ const graph = new HotGraph({
125
+ isBoundary: (file) => matchesBoundary(relativeToRoot(file)),
126
+ isRestart: (file) => restartFiles.has(file) || matchesRestartGlob(relativeToRoot(file)),
127
+ })
128
+
129
+ /**
130
+ * Track every edge the resolver reports, and hand back a versioned URL for a
131
+ * module that has been invalidated.
132
+ *
133
+ * The version travels in the URL because that is the only handle V8 offers: a
134
+ * module is keyed by its URL, so a different one is a different module. The
135
+ * parameter is stripped off the importer before delegating, or a relative
136
+ * specifier would be resolved against a URL that does not name a directory.
137
+ */
138
+ registerHooks({
139
+ resolve(specifier, context, nextResolve) {
140
+ let parentURL = context.parentURL
141
+ let parentPath: string | undefined
142
+ if (typeof parentURL === 'string' && parentURL.startsWith('file:')) {
143
+ const url = new URL(parentURL)
144
+ if (url.searchParams.has(VERSION_PARAM)) {
145
+ url.searchParams.delete(VERSION_PARAM)
146
+ parentURL = url.href
147
+ }
148
+ parentPath = fileURLToPath(url)
149
+ }
150
+
151
+ const result = nextResolve(specifier, { ...context, parentURL })
152
+ if (!result.url.startsWith('file:')) return result
153
+
154
+ const resolved = new URL(result.url)
155
+ resolved.searchParams.delete(VERSION_PARAM)
156
+ const file = fileURLToPath(resolved)
157
+ graph.link(file, parentPath)
158
+
159
+ const version = graph.version(file)
160
+ if (version === 0) return result
161
+ resolved.searchParams.set(VERSION_PARAM, String(version))
162
+ return { ...result, url: resolved.href }
163
+ },
164
+ })
165
+
166
+ /** Print a line that must survive the exit on the very next statement. */
167
+ function sayNow(line: string): void {
168
+ // Synchronously: a piped stdout — what `ream dev` hands this process when it
169
+ // runs an asset watcher alongside — is asynchronous, and the line would be
170
+ // dropped on the way out.
171
+ try {
172
+ writeSync(1, `${line}\n`)
173
+ } catch {
174
+ // The parent can close the pipe first on Ctrl-C. Losing the line is fine.
125
175
  }
126
- return true
127
176
  }
128
177
 
129
- await hot?.init({
130
- ...config,
131
- rootDirectory: dirname(packageJsonPath),
132
- root: config.root ? resolve(dirname(packageJsonPath), config.root) : undefined,
133
- // Exiting on a known code is how the Rust parent learns it must restart —
134
- // see `EXIT_RESTART` in the CLI's dev module.
135
- onFullReloadAsked: () => process.exit(FULL_RELOAD_EXIT_CODE),
178
+ watchProject({
179
+ root,
180
+ directories: [
181
+ ...WATCH_DIRS,
182
+ // Whatever a `reloadServer: true` entry named, and nothing else: the
183
+ // directories above are the ones the graph can reason about.
184
+ ...reloadPatterns.map(watchRootOf).filter((dir) => dir !== ''),
185
+ ],
186
+ files: [...restartFiles].map((file) => relative(root, file)),
187
+ onChange: (file) => {
188
+ const decision = graph.decide(file)
189
+ if (decision.kind === 'ignore') return
190
+ if (decision.kind === 'reload') {
191
+ sayNow(fullReloadNotice(decision.file, decision.reason, relativeToRoot))
192
+ // Exiting on a known code is how the Rust parent learns it must restart —
193
+ // see `EXIT_RESTART` in the CLI's dev module.
194
+ process.exit(FULL_RELOAD_EXIT_CODE)
195
+ }
196
+ // The router caches a promoted controller per route, and the kernel drops
197
+ // that cache when this counter moves. Without it the swap happens and the
198
+ // process keeps serving the class it promoted: a stable PID and stale
199
+ // output, which is exactly how it was first reported.
200
+ hotReloadHappened()
201
+ sayNow(`[ream] hot swap — ${relativeToRoot(file)}`)
202
+ },
136
203
  })
package/src/index.ts CHANGED
@@ -385,4 +385,4 @@ export {
385
385
  StatsTracker,
386
386
  } from './scheduler/index.js'
387
387
 
388
- export const VERSION = '0.2.23'
388
+ export const VERSION = '0.2.25'