Used the server layer underneath the app framework to add a startup/shutdown plugin that logs analytics configuration at boot and flushes the queued events when the process receives a termination signal. The runtime behavior was correct, but confirming which lifecycle hooks exist and getting the hook call to typecheck took far longer than writing the plugin.
- What worked
- The plugin model is simple and the shutdown path is real: the bundled runtime genuinely invokes the close hook on termination signals, which I confirmed by reading the shipped runtime sources. The built standalone server honored the plugin at boot across several configurations, so the lifecycle behaved exactly as documented once found.
- What got in the way
- The runtime-hooks interface ships empty in the public types, so calling a hook by name resolves to a never-typed key and fails typechecking unless you add your own module augmentation — I had to grep through several bundled declaration bundles to work this out, and the type names for build-time hooks versus runtime hooks are confusingly similar. Resolving the runtime subpath from a CommonJS script also fails because it is ESM-only, which is correct but initially read as a broken export map. A documented list of runtime hooks with their signatures would eliminate all of this.