@zerotal/devtools 1.5.0 → 1.6.0

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.
package/CHANGELOG.md CHANGED
@@ -8,6 +8,23 @@ follows the Zerotal monorepo's unified versioning.
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [1.5.1] — 2026-08-15
12
+
13
+ ### Fixed
14
+
15
+ - **DevTools never activated.** The panel was missing from every app, in every mode,
16
+ however the environment was configured.
17
+
18
+ `DevtoolsProvider` gated itself on `isDevSurfaceAllowed(Bun.env["APP_ENV"])`, which fails
19
+ twice over. `APP_ENV` holds the _runtime mode_ by the time a provider boots — `setAppEnv()`
20
+ replaced it — so the check was asking whether `"web"` is a development environment. And it
21
+ was the one dev gate that did not honour `ZT_DEV`, the flag the dev orchestrator sets on
22
+ the server it supervises, so `zt dev` did not rescue it either.
23
+
24
+ It asks `devSurfacesEnabled()` now, which reads the preserved deployment name and honours
25
+ `ZT_DEV`. Still fails closed: an unset, `staging` or `production` deployment does not get
26
+ the unauthenticated trace inspector.
27
+
11
28
  ## [1.5.0] — 2026-08-15
12
29
 
13
30
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerotal/devtools",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "license": "MIT",
5
5
  "maturity": "stable",
6
6
  "private": false,
@@ -30,11 +30,11 @@
30
30
  "typecheck": "tsc --noEmit"
31
31
  },
32
32
  "dependencies": {
33
- "@zerotal/core": "1.5.0"
33
+ "@zerotal/core": "1.6.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "typescript": "^5.8.0",
37
- "@zerotal/orm": "1.5.0"
37
+ "@zerotal/orm": "1.6.0"
38
38
  },
39
39
  "description": "In-browser developer tools for Zerotal — request traces, an inspector panel, and an extensible tab registry.",
40
40
  "keywords": [
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ServiceProvider,
3
- isDevSurfaceAllowed,
3
+ devSurfacesEnabled,
4
4
  type AppEnvironment,
5
5
  type HttpContext,
6
6
  } from "@zerotal/core";
@@ -71,10 +71,16 @@ export class DevtoolsProvider extends ServiceProvider {
71
71
  private _stopStream: (() => void) | null = null;
72
72
 
73
73
  override async onBooting(): Promise<void> {
74
- const env = Bun.env["APP_ENV"] ?? "";
75
- // Fail closed: only activate for explicitly non-prod envs. An unset or
76
- // `staging` APP_ENV must NOT expose the unauthenticated trace inspector.
77
- if (!isDevSurfaceAllowed(env)) return;
74
+ // Fail closed: only activate for explicitly non-prod environments. An unset or
75
+ // `staging` deployment must NOT expose the unauthenticated trace inspector.
76
+ //
77
+ // `devSurfacesEnabled()` rather than reading `APP_ENV` here, for two reasons, and
78
+ // together they meant devtools never activated at all:
79
+ // - by the time a provider boots, `setAppEnv()` has replaced `APP_ENV` with the
80
+ // runtime mode, so this was asking whether `"web"` is a development environment;
81
+ // - it is the only dev gate that did not honour `ZT_DEV`, which is what the dev
82
+ // orchestrator sets on the server it supervises — so `zt dev` did not help either.
83
+ if (!devSurfacesEnabled()) return;
78
84
  this._active = true;
79
85
 
80
86
  const config = this._config();
@@ -101,13 +107,13 @@ export class DevtoolsProvider extends ServiceProvider {
101
107
  // no package's spans ever reached the panel in a real app.
102
108
  this.app.container.value("devtools.trace", traceSink);
103
109
 
104
- this.app.useOnce(DevtoolsInjectionMiddleware as never);
110
+ this.app.useOnce(DevtoolsInjectionMiddleware);
105
111
 
106
112
  // Auto-inject the in-page panel into HTML responses via the core dev
107
113
  // injector — no `DevTools.start()` needed in the app's own bundle. Also
108
114
  // register the injector so this works under a plain `serve` (not only
109
115
  // `serve --dev-worker`, where Application.enableDevWs() already adds it).
110
- this.app.useOnce(DevReloadMiddleware as never);
116
+ this.app.useOnce(DevReloadMiddleware);
111
117
  registerDevHtmlSnippet("zerotal-devtools", (ctx: HttpContext) =>
112
118
  ctx.url.pathname.startsWith("/__zerotal")
113
119
  ? "" // don't inject the panel into the devtools' own pages