@hansenexus/hud 0.5.0 → 0.5.1

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/README.md CHANGED
@@ -41,7 +41,19 @@ export default defineHud({ app: "my-app", plugins: [vitals()] });
41
41
  ```
42
42
 
43
43
  The loader, with the build gate as a literal expression around the `import()`. Next inlines both
44
- env reads, so a production build folds the ternary to `null` and emits no HUD chunk:
44
+ env reads, so a production build folds the ternary to `null` and emits no HUD chunk. That holds
45
+ only when `NEXT_PUBLIC_HUD_ENABLED` is a build-time literal: Turbopack leaves an **unset**
46
+ `NEXT_PUBLIC_*` variable as a runtime `process.env` read, the ternary does not fold, and the whole
47
+ dev HUD ships as an unreachable production chunk. Wrap the config in `withHud` (see
48
+ [Auto-config](#auto-config-hansenexushudauto)), which pins the HUD's variables to `""` when they are unset, or pin it
49
+ yourself:
50
+
51
+ ```js
52
+ // next.config.js, without withHud
53
+ export default {
54
+ env: { NEXT_PUBLIC_HUD_ENABLED: process.env.NEXT_PUBLIC_HUD_ENABLED ?? "" },
55
+ };
56
+ ```
45
57
 
46
58
  ```tsx
47
59
  // src/components/dev/hud-loader.tsx
@@ -157,6 +169,21 @@ import { withHud } from "@hansenexus/hud/next/config";
157
169
  export default withHud({ reactStrictMode: true });
158
170
  ```
159
171
 
172
+ `withHud` takes and returns the app's own config type (`NextConfig` included) and also pins
173
+ `NEXT_PUBLIC_HUD_ENABLED`, `NEXT_PUBLIC_HUD_DISABLED` and `NEXT_PUBLIC_HUD_ENV` through `env` to
174
+ their build-time value, `""` when unset; an `env` entry of the app's own wins. The entry ships as
175
+ ESM and CommonJS, so a `next.config.ts` that Next compiles to CommonJS (a package without
176
+ `"type": "module"`) loads it through `require()` too:
177
+
178
+ ```ts
179
+ // next.config.ts
180
+ import type { NextConfig } from "next";
181
+ import { withHud } from "@hansenexus/hud/next/config";
182
+
183
+ const config: NextConfig = { reactStrictMode: true };
184
+ export default withHud(config);
185
+ ```
186
+
160
187
  Without either, `@hansenexus/hud/auto` resolves to the package's stand-in: the base plugins,
161
188
  nothing dependency-driven, and a console warning once. `auto` works as the whole `plugins` value
162
189
  too (`plugins: auto()`); `defineHud` needs one of `plugins` and `auto`.
@@ -855,9 +882,10 @@ dependencies so a Node gate script can import it:
855
882
  | `HUD_REVIEW_MARKER` | `__HANSENEXUS_HUD_REVIEW__` | only where `/review` is meant to ship |
856
883
 
857
884
  CI proves both on every PR: `fixtures/next-app` mounts the dev HUD behind the loader's build gate
858
- and `<Review>` beside it, installs the packed tarball, runs `next build` and fails on any dev
859
- marker or dev-only string in `.next/static` (`bun run build && bun run --cwd fixtures/next-app
860
- gate`). `fixtures/vite-app` does the same for Vite: `hud()` in its config, the
885
+ and `<Review>` beside it, installs the packed tarball, loads `withHud` from a CommonJS config
886
+ through `require()`, runs `next build --turbopack` with `NEXT_PUBLIC_HUD_ENABLED` unset and fails
887
+ on any dev marker or dev-only string in `.next/static` (`bun run build && bun run --cwd
888
+ fixtures/next-app gate`). `fixtures/vite-app` does the same for Vite: `hud()` in its config, the
861
889
  `import.meta.env.DEV` loader gate, the packed tarball, `vite build`, no dev marker in `dist`
862
890
  (`bun run --cwd fixtures/vite-app gate`). Both fixtures define their HUD through
863
891
  `@hansenexus/hud/auto`, so the gate covers the generated module too. Either fixture's
@@ -0,0 +1,201 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let node_fs = require("node:fs");
3
+ let node_path = require("node:path");
4
+ //#region src/auto/detect.ts
5
+ /** Which package turns on which feature. */
6
+ const AUTO_RULES = {
7
+ next: "next",
8
+ convex: "convex",
9
+ reactQuery: "@tanstack/react-query",
10
+ swr: "swr",
11
+ msw: "msw",
12
+ betterAuth: "better-auth",
13
+ convexAuth: "@convex-dev/auth"
14
+ };
15
+ const AUTO_FEATURES = Object.keys(AUTO_RULES);
16
+ /** The stand-in: nothing detected, nothing configured. */
17
+ const NOTHING_DETECTED = Object.freeze({
18
+ configured: false,
19
+ next: false,
20
+ convex: false,
21
+ reactQuery: false,
22
+ swr: false,
23
+ msw: false,
24
+ betterAuth: false,
25
+ convexAuth: false
26
+ });
27
+ const SECTIONS = [
28
+ "dependencies",
29
+ "devDependencies",
30
+ "peerDependencies",
31
+ "optionalDependencies"
32
+ ];
33
+ /** Every package the manifest names, whatever the section. */
34
+ function listDependencies(pkg) {
35
+ const names = /* @__PURE__ */ new Set();
36
+ for (const section of SECTIONS) {
37
+ const entries = pkg[section];
38
+ if (typeof entries !== "object" || entries === null) continue;
39
+ for (const name of Object.keys(entries)) names.add(name);
40
+ }
41
+ return names;
42
+ }
43
+ /**
44
+ * Detection from a parsed package.json: a feature is on when its package is
45
+ * listed in any dependency section (dev dependencies count: `msw` lives there).
46
+ */
47
+ function detectHudAuto(pkg) {
48
+ const names = listDependencies(pkg);
49
+ const detected = {
50
+ ...NOTHING_DETECTED,
51
+ configured: true
52
+ };
53
+ for (const feature of AUTO_FEATURES) detected[feature] = names.has(AUTO_RULES[feature]);
54
+ return Object.freeze(detected);
55
+ }
56
+ /** Parses package.json text; a broken file detects nothing rather than crashing the dev server. */
57
+ function parsePackageJson(text) {
58
+ try {
59
+ const parsed = JSON.parse(text);
60
+ return typeof parsed === "object" && parsed !== null ? parsed : {};
61
+ } catch {
62
+ return {};
63
+ }
64
+ }
65
+ //#endregion
66
+ //#region src/auto/generate.ts
67
+ const PACKAGE = "@hansenexus/hud";
68
+ /** Which import each feature adds: `name` from `subpath`. */
69
+ const FEATURE_IMPORTS = {
70
+ configured: null,
71
+ next: ["routes", "plugins/routes"],
72
+ convex: ["inspectConvex", "plugins/inspect/convex"],
73
+ reactQuery: ["inspectReactQuery", "plugins/inspect/react-query"],
74
+ swr: ["inspectSwr", "plugins/inspect/swr"],
75
+ msw: ["data", "plugins/data"],
76
+ betterAuth: ["data", "plugins/data"],
77
+ convexAuth: ["data", "plugins/data"]
78
+ };
79
+ /** The base plugins every auto HUD carries. */
80
+ const BASE_IMPORTS = [
81
+ ["a11y", "plugins/a11y"],
82
+ ["forceState", "plugins/design"],
83
+ ["inspect", "plugins/inspect"],
84
+ ["observe", "plugins/observe"],
85
+ ["seo", "plugins/seo"],
86
+ ["vitals", "plugins/vitals"]
87
+ ];
88
+ /** The factories the generated module hands `assembleAuto`, in import order. */
89
+ function autoImports(detected) {
90
+ const imports = new Map(BASE_IMPORTS);
91
+ for (const [feature, entry] of Object.entries(FEATURE_IMPORTS)) if (entry && detected[feature]) imports.set(entry[0], entry[1]);
92
+ return imports;
93
+ }
94
+ /**
95
+ * The generated module. `source` names where detection read from, for the
96
+ * header comment. Exports match the stand-in in `src/auto/index.ts`
97
+ * (`detected`, `auto`, default), so the types in `dist/auto.d.ts` apply.
98
+ */
99
+ function generateAutoModule(detected, source = "package.json") {
100
+ const imports = [...autoImports(detected)].sort(([, a], [, b]) => a < b ? -1 : a > b ? 1 : 0).map(([name, subpath]) => `import { ${name} } from "${PACKAGE}/${subpath}";`);
101
+ const factories = [...autoImports(detected).keys()].sort().join(", ");
102
+ return [
103
+ `// Generated by ${PACKAGE} from ${source}. Do not edit: it is rewritten on every start.`,
104
+ `import { assembleAuto } from "${PACKAGE}/auto/runtime";`,
105
+ ...imports,
106
+ "",
107
+ `export const detected = Object.freeze(${JSON.stringify(detected)});`,
108
+ "",
109
+ "export function auto(options) {",
110
+ ` return assembleAuto(detected, { ${factories} }, options);`,
111
+ "}",
112
+ "",
113
+ "export default auto;",
114
+ ""
115
+ ].join("\n");
116
+ }
117
+ //#endregion
118
+ //#region src/next/config.ts
119
+ /** What the app imports; the wrapper aliases it to the generated file. */
120
+ const AUTO_ID = "@hansenexus/hud/auto";
121
+ /** Where the generated module lives, relative to the app dir. Add it to .gitignore. */
122
+ const AUTO_FILE = ".hud/auto.mjs";
123
+ /**
124
+ * The client variables the loader gate and the env ladder read. Next inlines a
125
+ * `NEXT_PUBLIC_*` read only when the variable is set at build time; Turbopack
126
+ * leaves an unset one as a runtime `process.env` lookup, so the gate
127
+ * `NODE_ENV === "development" || NEXT_PUBLIC_HUD_ENABLED === "true"` does not
128
+ * fold and the dev HUD ships as a production chunk (hud#64). `withHud` pins
129
+ * each to a build-time literal, `""` when unset.
130
+ */
131
+ const HUD_PUBLIC_ENV = [
132
+ "NEXT_PUBLIC_HUD_ENABLED",
133
+ "NEXT_PUBLIC_HUD_DISABLED",
134
+ "NEXT_PUBLIC_HUD_ENV"
135
+ ];
136
+ /** Reads, detects and writes `.hud/auto.mjs`; returns the detection and the file's absolute path. */
137
+ function writeAutoModule({ dir = process.cwd(), packageJson } = {}) {
138
+ const manifest = packageJson ?? (0, node_path.resolve)(dir, "package.json");
139
+ let text = "{}";
140
+ try {
141
+ text = (0, node_fs.readFileSync)(manifest, "utf8");
142
+ } catch {
143
+ console.warn(`hud: ${manifest} not found; @hansenexus/hud/auto enables the base plugins only`);
144
+ }
145
+ const detected = detectHudAuto(parsePackageJson(text));
146
+ const file = (0, node_path.resolve)(dir, AUTO_FILE);
147
+ const source = generateAutoModule(detected, manifest);
148
+ let current;
149
+ try {
150
+ current = (0, node_fs.readFileSync)(file, "utf8");
151
+ } catch {}
152
+ if (current !== source) {
153
+ (0, node_fs.mkdirSync)((0, node_path.dirname)(file), { recursive: true });
154
+ (0, node_fs.writeFileSync)(file, source, "utf8");
155
+ }
156
+ return {
157
+ detected,
158
+ file
159
+ };
160
+ }
161
+ function withHud(config, options = {}) {
162
+ const base = config ?? {};
163
+ const { file } = writeAutoModule(options);
164
+ const webpack = base.webpack;
165
+ const pinned = {};
166
+ for (const key of HUD_PUBLIC_ENV) pinned[key] = process.env[key] ?? "";
167
+ return {
168
+ ...base,
169
+ env: {
170
+ ...pinned,
171
+ ...base.env
172
+ },
173
+ turbopack: {
174
+ ...base.turbopack,
175
+ resolveAlias: {
176
+ ...base.turbopack?.resolveAlias,
177
+ [AUTO_ID]: `./${AUTO_FILE}`
178
+ }
179
+ },
180
+ webpack(webpackConfig, context) {
181
+ const own = webpack ? webpack.call(base, webpackConfig, context) : webpackConfig;
182
+ const resolveOptions = own.resolve ?? {};
183
+ const alias = resolveOptions.alias;
184
+ resolveOptions.alias = Array.isArray(alias) ? [...alias, {
185
+ name: AUTO_ID,
186
+ alias: file
187
+ }] : {
188
+ ...alias,
189
+ [`${AUTO_ID}$`]: file
190
+ };
191
+ own.resolve = resolveOptions;
192
+ return own;
193
+ }
194
+ };
195
+ }
196
+ //#endregion
197
+ exports.AUTO_FILE = AUTO_FILE;
198
+ exports.AUTO_ID = AUTO_ID;
199
+ exports.HUD_PUBLIC_ENV = HUD_PUBLIC_ENV;
200
+ exports.withHud = withHud;
201
+ exports.writeAutoModule = writeAutoModule;
@@ -0,0 +1,87 @@
1
+ //#region src/auto/detect.d.ts
2
+ /** What the bundler plugin found in the app's package.json. */
3
+ interface HudAutoDetected {
4
+ /**
5
+ * False in the stand-in module the package ships: no bundler plugin read the
6
+ * app's package.json, so only the base plugins are on.
7
+ */
8
+ configured: boolean;
9
+ /** `next`: the routes plugin (route index, `hud sweep`). */
10
+ next: boolean;
11
+ /** `convex`: the Convex tab of the inspect plugin. */
12
+ convex: boolean;
13
+ /** `@tanstack/react-query`: the Query tab. */
14
+ reactQuery: boolean;
15
+ /** `swr`: the SWR tab. */
16
+ swr: boolean;
17
+ /** `msw`: the data plugin (mock scenarios). */
18
+ msw: boolean;
19
+ /** `better-auth`: the data plugin (role switch). */
20
+ betterAuth: boolean;
21
+ /** `@convex-dev/auth`: the data plugin (role switch). */
22
+ convexAuth: boolean;
23
+ }
24
+ //#endregion
25
+ //#region src/next/config.d.ts
26
+ /** What the app imports; the wrapper aliases it to the generated file. */
27
+ export declare const AUTO_ID = "@hansenexus/hud/auto";
28
+ /** Where the generated module lives, relative to the app dir. Add it to .gitignore. */
29
+ export declare const AUTO_FILE = ".hud/auto.mjs";
30
+ export interface WithHudOptions {
31
+ /** The app directory. Default: `process.cwd()`, which is where Next loads next.config from. */
32
+ dir?: string;
33
+ /** The package.json detection reads. Default: `<dir>/package.json`. */
34
+ packageJson?: string;
35
+ }
36
+ interface WebpackConfigLike {
37
+ resolve?: {
38
+ alias?: Record<string, unknown> | unknown[] | undefined;
39
+ [key: string]: unknown;
40
+ };
41
+ [key: string]: unknown;
42
+ }
43
+ /**
44
+ * The slice of `NextConfig` the wrapper touches, structurally, so `next` is
45
+ * neither imported nor a peer. No index signatures: Next's own `NextConfig`
46
+ * and `TurbopackOptions` are interfaces without one (hud#66). Method syntax
47
+ * keeps Next's own `webpack` signature assignable.
48
+ */
49
+ export interface NextConfigLike {
50
+ env?: Record<string, string | undefined> | undefined;
51
+ turbopack?: {
52
+ resolveAlias?: Record<string, unknown> | undefined;
53
+ } | undefined;
54
+ webpack?(config: WebpackConfigLike, context: unknown): WebpackConfigLike;
55
+ }
56
+ /**
57
+ * The client variables the loader gate and the env ladder read. Next inlines a
58
+ * `NEXT_PUBLIC_*` read only when the variable is set at build time; Turbopack
59
+ * leaves an unset one as a runtime `process.env` lookup, so the gate
60
+ * `NODE_ENV === "development" || NEXT_PUBLIC_HUD_ENABLED === "true"` does not
61
+ * fold and the dev HUD ships as a production chunk (hud#64). `withHud` pins
62
+ * each to a build-time literal, `""` when unset.
63
+ */
64
+ export declare const HUD_PUBLIC_ENV: readonly ["NEXT_PUBLIC_HUD_ENABLED", "NEXT_PUBLIC_HUD_DISABLED", "NEXT_PUBLIC_HUD_ENV"];
65
+ /** Reads, detects and writes `.hud/auto.mjs`; returns the detection and the file's absolute path. */
66
+ export declare function writeAutoModule({ dir, packageJson }?: WithHudOptions): {
67
+ detected: HudAutoDetected;
68
+ file: string;
69
+ };
70
+ /**
71
+ * Wraps next.config: reads the app's package.json, writes `.hud/auto.mjs`
72
+ * (a module importing only the plugins the dependencies call for) and
73
+ * aliases `@hansenexus/hud/auto` to it, for Turbopack and webpack alike.
74
+ * Runs on every `next dev` and `next build`, so the file follows
75
+ * package.json; it belongs in .gitignore. It also pins the HUD's
76
+ * `NEXT_PUBLIC_*` variables (`HUD_PUBLIC_ENV`) through `env`, so the loader
77
+ * gate folds when they are unset; an app's own `env` entry wins.
78
+ *
79
+ * ```js
80
+ * // next.config.js (ESM), or next.config.ts through `require()`
81
+ * import { withHud } from "@hansenexus/hud/next/config";
82
+ * export default withHud({ reactStrictMode: true });
83
+ * ```
84
+ */
85
+ export declare function withHud(config?: undefined, options?: WithHudOptions): NextConfigLike;
86
+ export declare function withHud<C extends object>(config: C, options?: WithHudOptions): C;
87
+ //#endregion
@@ -19,17 +19,26 @@ interface WebpackConfigLike {
19
19
  }
20
20
  /**
21
21
  * The slice of `NextConfig` the wrapper touches, structurally, so `next` is
22
- * neither imported nor a peer. Method syntax keeps Next's own `webpack`
23
- * signature assignable.
22
+ * neither imported nor a peer. No index signatures: Next's own `NextConfig`
23
+ * and `TurbopackOptions` are interfaces without one (hud#66). Method syntax
24
+ * keeps Next's own `webpack` signature assignable.
24
25
  */
25
26
  export interface NextConfigLike {
27
+ env?: Record<string, string | undefined> | undefined;
26
28
  turbopack?: {
27
29
  resolveAlias?: Record<string, unknown> | undefined;
28
- [key: string]: unknown;
29
30
  } | undefined;
30
31
  webpack?(config: WebpackConfigLike, context: unknown): WebpackConfigLike;
31
- [key: string]: unknown;
32
32
  }
33
+ /**
34
+ * The client variables the loader gate and the env ladder read. Next inlines a
35
+ * `NEXT_PUBLIC_*` read only when the variable is set at build time; Turbopack
36
+ * leaves an unset one as a runtime `process.env` lookup, so the gate
37
+ * `NODE_ENV === "development" || NEXT_PUBLIC_HUD_ENABLED === "true"` does not
38
+ * fold and the dev HUD ships as a production chunk (hud#64). `withHud` pins
39
+ * each to a build-time literal, `""` when unset.
40
+ */
41
+ export declare const HUD_PUBLIC_ENV: readonly ["NEXT_PUBLIC_HUD_ENABLED", "NEXT_PUBLIC_HUD_DISABLED", "NEXT_PUBLIC_HUD_ENV"];
33
42
  /** Reads, detects and writes `.hud/auto.mjs`; returns the detection and the file's absolute path. */
34
43
  export declare function writeAutoModule({ dir, packageJson }?: WithHudOptions): {
35
44
  detected: HudAutoDetected;
@@ -40,13 +49,16 @@ export declare function writeAutoModule({ dir, packageJson }?: WithHudOptions):
40
49
  * (a module importing only the plugins the dependencies call for) and
41
50
  * aliases `@hansenexus/hud/auto` to it, for Turbopack and webpack alike.
42
51
  * Runs on every `next dev` and `next build`, so the file follows
43
- * package.json; it belongs in .gitignore.
52
+ * package.json; it belongs in .gitignore. It also pins the HUD's
53
+ * `NEXT_PUBLIC_*` variables (`HUD_PUBLIC_ENV`) through `env`, so the loader
54
+ * gate folds when they are unset; an app's own `env` entry wins.
44
55
  *
45
56
  * ```js
46
- * // next.config.js
57
+ * // next.config.js (ESM), or next.config.ts through `require()`
47
58
  * import { withHud } from "@hansenexus/hud/next/config";
48
59
  * export default withHud({ reactStrictMode: true });
49
60
  * ```
50
61
  */
51
- export declare function withHud<C extends NextConfigLike>(config?: C, options?: WithHudOptions): C;
62
+ export declare function withHud(config?: undefined, options?: WithHudOptions): NextConfigLike;
63
+ export declare function withHud<C extends object>(config: C, options?: WithHudOptions): C;
52
64
  //#endregion
@@ -7,6 +7,19 @@ import { dirname, resolve } from "node:path";
7
7
  const AUTO_ID = "@hansenexus/hud/auto";
8
8
  /** Where the generated module lives, relative to the app dir. Add it to .gitignore. */
9
9
  const AUTO_FILE = ".hud/auto.mjs";
10
+ /**
11
+ * The client variables the loader gate and the env ladder read. Next inlines a
12
+ * `NEXT_PUBLIC_*` read only when the variable is set at build time; Turbopack
13
+ * leaves an unset one as a runtime `process.env` lookup, so the gate
14
+ * `NODE_ENV === "development" || NEXT_PUBLIC_HUD_ENABLED === "true"` does not
15
+ * fold and the dev HUD ships as a production chunk (hud#64). `withHud` pins
16
+ * each to a build-time literal, `""` when unset.
17
+ */
18
+ const HUD_PUBLIC_ENV = [
19
+ "NEXT_PUBLIC_HUD_ENABLED",
20
+ "NEXT_PUBLIC_HUD_DISABLED",
21
+ "NEXT_PUBLIC_HUD_ENV"
22
+ ];
10
23
  /** Reads, detects and writes `.hud/auto.mjs`; returns the detection and the file's absolute path. */
11
24
  function writeAutoModule({ dir = process.cwd(), packageJson } = {}) {
12
25
  const manifest = packageJson ?? resolve(dir, "package.json");
@@ -32,25 +45,18 @@ function writeAutoModule({ dir = process.cwd(), packageJson } = {}) {
32
45
  file
33
46
  };
34
47
  }
35
- /**
36
- * Wraps next.config: reads the app's package.json, writes `.hud/auto.mjs`
37
- * (a module importing only the plugins the dependencies call for) and
38
- * aliases `@hansenexus/hud/auto` to it, for Turbopack and webpack alike.
39
- * Runs on every `next dev` and `next build`, so the file follows
40
- * package.json; it belongs in .gitignore.
41
- *
42
- * ```js
43
- * // next.config.js
44
- * import { withHud } from "@hansenexus/hud/next/config";
45
- * export default withHud({ reactStrictMode: true });
46
- * ```
47
- */
48
48
  function withHud(config, options = {}) {
49
49
  const base = config ?? {};
50
50
  const { file } = writeAutoModule(options);
51
51
  const webpack = base.webpack;
52
+ const pinned = {};
53
+ for (const key of HUD_PUBLIC_ENV) pinned[key] = process.env[key] ?? "";
52
54
  return {
53
55
  ...base,
56
+ env: {
57
+ ...pinned,
58
+ ...base.env
59
+ },
54
60
  turbopack: {
55
61
  ...base.turbopack,
56
62
  resolveAlias: {
@@ -75,4 +81,4 @@ function withHud(config, options = {}) {
75
81
  };
76
82
  }
77
83
  //#endregion
78
- export { AUTO_FILE, AUTO_ID, withHud, writeAutoModule };
84
+ export { AUTO_FILE, AUTO_ID, HUD_PUBLIC_ENV, withHud, writeAutoModule };
@@ -12,11 +12,23 @@ const MAX_ROWS = 100;
12
12
  function inspectReactQuery({ queryClient }) {
13
13
  const cache = queryClient.getQueryCache();
14
14
  let version = 0;
15
+ let scheduled = false;
16
+ let disposed = false;
15
17
  const listeners = /* @__PURE__ */ new Set();
16
- const unsubscribe = cache.subscribe(() => {
17
- version++;
18
- for (const listener of listeners) listener();
18
+ const unsubscribeCache = cache.subscribe(() => {
19
+ if (scheduled) return;
20
+ scheduled = true;
21
+ queueMicrotask(() => {
22
+ scheduled = false;
23
+ if (disposed) return;
24
+ version++;
25
+ for (const listener of listeners) listener();
26
+ });
19
27
  });
28
+ const unsubscribe = () => {
29
+ disposed = true;
30
+ unsubscribeCache();
31
+ };
20
32
  const subscribe = (listener) => {
21
33
  listeners.add(listener);
22
34
  return () => listeners.delete(listener);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hansenexus/hud",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Modular dev HUD for React apps: status pill, floating panels, element grabber, plugin API.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -33,8 +33,14 @@
33
33
  "import": "./dist/next.js"
34
34
  },
35
35
  "./next/config": {
36
- "types": "./dist/next/config.d.ts",
37
- "import": "./dist/next/config.js"
36
+ "import": {
37
+ "types": "./dist/next/config.d.ts",
38
+ "default": "./dist/next/config.js"
39
+ },
40
+ "require": {
41
+ "types": "./dist/next/config.d.cts",
42
+ "default": "./dist/next/config.cjs"
43
+ }
38
44
  },
39
45
  "./vite": {
40
46
  "types": "./dist/vite.d.ts",
@@ -141,6 +147,7 @@
141
147
  "convex": "^1.46.0",
142
148
  "jsdom": "^30.1.2",
143
149
  "msw": "^3.0.2",
150
+ "next": "^16.4.0",
144
151
  "playwright": "1.63.0",
145
152
  "rolldown": "^1.2.12",
146
153
  "swr": "^2.5.1",