hazo_ui 3.1.1 → 3.1.3

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/CHANGE_LOG.md CHANGED
@@ -5,24 +5,68 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## v3.1.1 — 2026-05-30
8
+ ## v3.1.3 — 2026-05-30
9
9
 
10
- **Fix:** Bundling failure when hazo_ui is consumed by a Next.js client component.
10
+ **New:** `hazo_ui/utils` sub-export carrying pure helpers without the
11
+ `"use client"` directive.
11
12
 
12
- `src/utils/logger.ts` did `import { createLogger } from "hazo_core"` at module
13
- top-level. hazo_core's package exports route browser bundles to its
14
- `index.client.js`, which intentionally omits `createLogger` (the factory loads
15
- hazo_logs dynamically, which is Node-only). Static named-import failed bundle
16
- resolution for every downstream consumer that pulled hazo_ui into a client
17
- component, including transitively via `hazo_auth/client`.
13
+ The default `hazo_ui` bundle prepends `"use client";` so React components
14
+ hydrate correctly in Next.js consumers. As a side-effect, every export from
15
+ the bundle (including pure helpers like `cn()`) is treated by Next.js as a
16
+ client function, which forbids calling it from a Server Component:
18
17
 
19
- Switched to a namespace import + runtime feature check. When `createLogger` is
20
- present (server bundle), the structured logger is used; otherwise the existing
21
- `console_logger` fallback applies. No public API change.
18
+ ```
19
+ Error: Attempted to call cn() from the server but cn is on the client.
20
+ ```
22
21
 
23
- Discovered during the gotimer Wave 3 consumer migration. Filing this as a
24
- patch instead of a republish of 3.1.0 to preserve the published artifact's
25
- hash for downstream auditability.
22
+ The new `./utils` entry point (`src/index.utils.ts` `dist/index.utils.{js,cjs}`)
23
+ ships without the `"use client"` directive. Server Components can now import
24
+ `cn` (and any future server-safe helper added here) without violating the
25
+ client-server boundary:
26
+
27
+ ```ts
28
+ import { cn } from "hazo_ui/utils"; // SSR-safe
29
+ import { Button, cn } from "hazo_ui"; // client-only (Button is a client component)
30
+ ```
31
+
32
+ Discovered during the gotimer consumer migration when SSR pages calling
33
+ `cn()` in their JSX failed to prerender.
34
+
35
+ ### Added
36
+
37
+ - `./utils` sub-export of `hazo_ui` re-exporting `cn`.
38
+ - `src/index.utils.ts` build entry (no `"use client"` banner).
39
+
40
+ ## v3.1.2 — 2026-05-30
41
+
42
+ **Fix (supersedes 3.1.1):** Drop the hazo_core import from the logger module
43
+ entirely.
44
+
45
+ 3.1.1 switched to a namespace import + runtime `typeof` check, which works
46
+ under classic webpack and Node but fails under Turbopack — Turbopack tracks
47
+ namespace-member reads against statically-known module exports and flags any
48
+ missing property as a bundle error, even when the property is only read
49
+ defensively.
50
+
51
+ 3.1.2 removes the hazo_core reference from `src/utils/logger.ts`. The default
52
+ logger is now `console_logger`. Server-side consumers that want structured
53
+ correlation-ID-aware logs through hazo_core/hazo_logs should call
54
+ `set_logger(createLogger("hazo_ui"))` from their own server boot. The
55
+ override mechanism is unchanged.
56
+
57
+ Rationale: hazo_ui ships with a top-of-bundle `"use client"` directive, so
58
+ the bundle is bundled for the React client in every consumer. Defaulting to
59
+ a server-only structured logger was always a mismatch; the previous default
60
+ only "worked" because consumers never exercised the bundle in a Turbopack
61
+ client context until the gotimer migration.
62
+
63
+ ## v3.1.1 — 2026-05-30 (superseded by 3.1.2)
64
+
65
+ **Attempted fix:** Switched `src/utils/logger.ts` to a namespace import of
66
+ hazo_core + runtime `typeof` check on `.createLogger`. Did not resolve the
67
+ underlying defect because Turbopack's static analysis still flags the
68
+ missing property read. Retained on npm for traceability but consumers should
69
+ upgrade directly to 3.1.2.
26
70
 
27
71
  ## v3.1.0 — Wave 2 hazo_core wiring
28
72
 
package/dist/index.cjs CHANGED
@@ -4,7 +4,7 @@
4
4
  var clsx = require('clsx');
5
5
  var tailwindMerge = require('tailwind-merge');
6
6
  var React26 = require('react');
7
- var hazoCore = require('hazo_core');
7
+ var hazo_core = require('hazo_core');
8
8
  var client = require('hazo_core/client');
9
9
  var jsxRuntime = require('react/jsx-runtime');
10
10
  var reactSlot = require('@radix-ui/react-slot');
@@ -93,7 +93,6 @@ function _interopNamespace(e) {
93
93
  }
94
94
 
95
95
  var React26__namespace = /*#__PURE__*/_interopNamespace(React26);
96
- var hazoCore__namespace = /*#__PURE__*/_interopNamespace(hazoCore);
97
96
  var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive);
98
97
  var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
99
98
  var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
@@ -207,7 +206,7 @@ function HazoContextProvider({
207
206
  children
208
207
  }) {
209
208
  const id = React26__namespace.useMemo(
210
- () => correlationId ?? hazoCore.generateRequestId(),
209
+ () => correlationId ?? hazo_core.generateRequestId(),
211
210
  [correlationId]
212
211
  );
213
212
  React26__namespace.useEffect(() => {
@@ -220,33 +219,23 @@ function HazoContextProvider({
220
219
  }, [id, userId]);
221
220
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
222
221
  }
222
+
223
+ // src/utils/logger.ts
223
224
  var console_logger = {
224
225
  info: (m, d) => d ? console.log(`[hazo_ui] ${m}`, d) : console.log(`[hazo_ui] ${m}`),
225
226
  debug: (m, d) => d ? console.debug(`[hazo_ui] ${m}`, d) : console.debug(`[hazo_ui] ${m}`),
226
227
  warn: (m, d) => d ? console.warn(`[hazo_ui] ${m}`, d) : console.warn(`[hazo_ui] ${m}`),
227
228
  error: (m, d) => d ? console.error(`[hazo_ui] ${m}`, d) : console.error(`[hazo_ui] ${m}`)
228
229
  };
229
- function build_default_logger() {
230
- const factory = hazoCore__namespace.createLogger;
231
- if (typeof factory !== "function") return console_logger;
232
- try {
233
- return factory("hazo_ui");
234
- } catch {
235
- return console_logger;
236
- }
237
- }
238
- var current_logger = null;
230
+ var current_logger = console_logger;
239
231
  function set_logger(logger) {
240
- current_logger = logger ?? null;
232
+ current_logger = logger ?? console_logger;
241
233
  }
242
234
  function get_logger() {
243
- if (!current_logger) {
244
- current_logger = build_default_logger();
245
- }
246
235
  return current_logger;
247
236
  }
248
237
  function generateUUID() {
249
- return hazoCore.generateRequestId().slice(4);
238
+ return hazo_core.generateRequestId().slice(4);
250
239
  }
251
240
 
252
241
  // src/lib/hazo_ui_config.ts