@absolutejs/absolute 0.16.12 → 0.17.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.
@@ -0,0 +1 @@
1
+ export declare const info: () => void;
@@ -0,0 +1,5 @@
1
+ import type { TelemetryConfig } from '../../../types/telemetry';
2
+ export declare const getTelemetryConfig: () => TelemetryConfig | null;
3
+ export declare const isTelemetryEnabled: () => boolean;
4
+ export declare const saveTelemetryConfig: (config: TelemetryConfig) => void;
5
+ export declare const telemetry: (args: string[]) => void;
@@ -0,0 +1 @@
1
+ export declare const sendTelemetryEvent: (event: string, payload: Record<string, unknown>) => void;
@@ -2,4 +2,4 @@ import { BuildConfig } from '../../types/build';
2
2
  import type { ResolvedBuildPaths } from './configResolver';
3
3
  export declare const getWatchPaths: (config: BuildConfig, resolved?: ResolvedBuildPaths) => string[];
4
4
  export declare const shouldIgnorePath: (path: string) => boolean;
5
- export declare const detectFramework: (filePath: string, resolved?: ResolvedBuildPaths) => "react" | "vue" | "svelte" | "html" | "assets" | "htmx" | "ignored" | "angular" | "unknown";
5
+ export declare const detectFramework: (filePath: string, resolved?: ResolvedBuildPaths) => "react" | "vue" | "svelte" | "html" | "unknown" | "htmx" | "angular" | "assets" | "ignored";
@@ -2,5 +2,6 @@ export * from './build';
2
2
  export * from './cli';
3
3
  export * from './client';
4
4
  export * from './messages';
5
+ export * from './telemetry';
5
6
  export * from './tool';
6
7
  export * from './websocket';
@@ -0,0 +1,15 @@
1
+ export type TelemetryConfig = {
2
+ enabled: boolean;
3
+ anonymousId: string;
4
+ createdAt: string;
5
+ };
6
+ export type TelemetryEvent = {
7
+ event: string;
8
+ anonymousId: string;
9
+ version: string;
10
+ os: string;
11
+ arch: string;
12
+ bunVersion: string;
13
+ timestamp: string;
14
+ payload: Record<string, unknown>;
15
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Alex Kahn",
3
3
  "bin": {
4
- "absolutejs": "./dist/cli/index.js"
4
+ "absolute": "./dist/cli/index.js"
5
5
  },
6
6
  "description": "A fullstack meta-framework for building web applications with TypeScript",
7
7
  "engines": {
@@ -100,5 +100,5 @@
100
100
  "typecheck": "bun run tsc --noEmit"
101
101
  },
102
102
  "types": "./dist/src/index.d.ts",
103
- "version": "0.16.12"
103
+ "version": "0.17.0"
104
104
  }
package/types/index.ts CHANGED
@@ -2,5 +2,6 @@ export * from './build';
2
2
  export * from './cli';
3
3
  export * from './client';
4
4
  export * from './messages';
5
+ export * from './telemetry';
5
6
  export * from './tool';
6
7
  export * from './websocket';
@@ -0,0 +1,16 @@
1
+ export type TelemetryConfig = {
2
+ enabled: boolean;
3
+ anonymousId: string;
4
+ createdAt: string;
5
+ };
6
+
7
+ export type TelemetryEvent = {
8
+ event: string;
9
+ anonymousId: string;
10
+ version: string;
11
+ os: string;
12
+ arch: string;
13
+ bunVersion: string;
14
+ timestamp: string;
15
+ payload: Record<string, unknown>;
16
+ };
@@ -1,113 +0,0 @@
1
- # Fix: React HMR on macOS
2
-
3
- React HMR updates were detected and logged on macOS (`[hmr] hmr update ...`), but changes never appeared in the browser. CSS hot-swaps worked fine. HTML, Svelte, Vue, and HTMX HMR were unaffected. Two issues were identified and fixed.
4
-
5
- ## Files Changed
6
-
7
- | File | Change |
8
- |------|--------|
9
- | `src/dev/rebuildTrigger.ts` | Moved `populateAssetStore` + `cleanStaleAssets` before broadcasts |
10
- | `src/build/generateReactIndexes.ts` | Added `reactRefreshSetup` import to `_refresh.tsx` shared chunk seed |
11
-
12
- ---
13
-
14
- ## Issue 1: Asset Store Race Condition
15
-
16
- **File:** `src/dev/rebuildTrigger.ts`
17
-
18
- ### Problem
19
-
20
- After a rebuild, the server broadcast the `react-update` WebSocket message to the browser *before* `populateAssetStore()` loaded the new bundles into the in-memory asset store. The client received the message, immediately called `import()` on the new bundle URL, and hit the server — which couldn't serve the file yet.
21
-
22
- ```
23
- Build completes → broadcast (react-update) → client import() → 404/stale ← populateAssetStore (too late)
24
- ```
25
-
26
- ### Why HTML/Svelte/Vue/HTMX HMR were unaffected
27
-
28
- Those frameworks send the rendered HTML *inline* in the WebSocket message. The browser applies it via DOM manipulation — no follow-up HTTP request needed.
29
-
30
- ### Why macOS specifically
31
-
32
- macOS FSEvents and I/O scheduling produce a wider timing window between the broadcast and the `import()` arrival than Linux's inotify. On Linux the asset store was usually populated before the request landed; on macOS it consistently wasn't.
33
-
34
- ### Fix
35
-
36
- Moved both calls to *before* the first `broadcastToClients`:
37
-
38
- ```typescript
39
- // After build succeeds and manifest is validated:
40
- await populateAssetStore(state.assetStore, manifest, state.resolvedPaths.buildDir);
41
- await cleanStaleAssets(state.assetStore, manifest, state.resolvedPaths.buildDir);
42
-
43
- // Now safe to tell clients about the update:
44
- broadcastToClients(state, { ... });
45
- ```
46
-
47
- The previous comment warned this could trigger a Bun `--hot` restart before broadcasts. That concern was unfounded — `populateAssetStore` only reads files into a `Map` and does not modify source modules. The build (which writes to disk) has already finished, so any `--hot` restart is already queued regardless.
48
-
49
- ---
50
-
51
- ## Issue 2: React Fast Refresh Initialization Order
52
-
53
- **File:** `src/build/generateReactIndexes.ts`
54
-
55
- ### Problem
56
-
57
- Even with the asset store fix, `performReactRefresh()` silently did nothing. The new bundle was fetched and executed, but React Fast Refresh couldn't reach React's reconciler to swap the components.
58
-
59
- React Fast Refresh requires `react-refresh/runtime` to call `injectIntoGlobalHook(window)` **before** React initializes. This patches `window.__REACT_DEVTOOLS_GLOBAL_HOOK__` so React registers its internals with the Refresh Runtime during initialization. If React initializes first, it never connects — and `performReactRefresh()` becomes a no-op.
60
-
61
- The build produces two kinds of client entry points:
62
-
63
- - **`_refresh.tsx`** (shared chunk seed) — only imported `react` and `react-dom/client`
64
- - **Hydration indexes** (e.g., `ReactExample.tsx`) — imported `reactRefreshSetup`, then React
65
-
66
- With `splitting: true`, Bun extracts common dependencies into a shared chunk. `react` and `react-dom/client` were common to both → shared chunk. But `reactRefreshSetup` was only in the hydration indexes → stayed in the per-entry chunk.
67
-
68
- ```
69
- Shared chunk executes first:
70
- react initializes → checks __REACT_DEVTOOLS_GLOBAL_HOOK__ → not patched yet → skips
71
-
72
- Entry chunk executes second:
73
- reactRefreshSetup runs → patches the hook → too late
74
- ```
75
-
76
- ### Why CSS updates still worked
77
-
78
- CSS HMR uses `reloadReactCSS()` which swaps `<link>` stylesheet `href` attributes in the DOM. No `import()`, no React reconciler, no Fast Refresh involved.
79
-
80
- ### Why macOS was affected but Linux/Windows worked
81
-
82
- The Bun bundler's chunk splitting heuristics and module ordering within chunks can vary based on file system glob ordering. macOS (case-insensitive APFS) and Linux (case-sensitive ext4) produce different glob orders, which can affect whether `reactRefreshSetup` ends up in the shared chunk or the entry chunk. On Linux it happened to land in the shared chunk; on macOS it consistently didn't.
83
-
84
- ### Fix
85
-
86
- Added the `reactRefreshSetup` import to `_refresh.tsx` so it becomes a common dependency and lands in the shared chunk — *before* React:
87
-
88
- ```typescript
89
- // Before:
90
- import 'react';
91
- import 'react-dom/client';
92
-
93
- // After:
94
- import '...reactRefreshSetup.ts'; // patches the global hook
95
- import 'react'; // React initializes, sees the hook
96
- import 'react-dom/client';
97
- ```
98
-
99
- Since `reactRefreshSetup` is now imported by both `_refresh.tsx` and every hydration index, Bun extracts it into the shared chunk alongside React. The import order within the chunk guarantees the hook is patched before React initializes.
100
-
101
- `reactRefreshSetup` is idempotent (guarded by `if (!window.$RefreshRuntime$)`), so the additional import site is harmless. Component state is fully preserved across HMR updates via React Fast Refresh.
102
-
103
- ---
104
-
105
- ## Verified Behavior
106
-
107
- All tested on macOS after applying both fixes:
108
-
109
- - Editing a React page component (`ReactExample.tsx`) — change appears live, state preserved
110
- - Editing a shared component (`App.tsx`) — change appears live via dependency graph
111
- - Editing a CSS file (`react-example.css`) — style updates without page reload
112
- - HTML, Svelte, Vue, HTMX HMR — all continue to work as before
113
- - `bun run typecheck` — passes with no errors