@absolutejs/absolute 0.13.11 → 0.15.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/.claude/settings.local.json +7 -1
- package/CLAUDE.md +65 -56
- package/LICENSE +80 -24
- package/README.md +163 -163
- package/THIRD_PARTY_NOTICES.md +61 -0
- package/dist/cli/index.js +24 -8
- package/dist/index.js +3013 -480
- package/dist/index.js.map +56 -26
- package/dist/{build → src/build}/compileSvelte.d.ts +2 -1
- package/dist/src/build/compileVue.d.ts +33 -0
- package/dist/src/build/generateReactIndexes.d.ts +1 -0
- package/dist/src/build/htmlScriptHMRPlugin.d.ts +13 -0
- package/dist/src/build/wrapHTMLScript.d.ts +24 -0
- package/dist/src/core/build.d.ts +2 -0
- package/dist/src/core/devBuild.d.ts +6 -0
- package/dist/{core → src/core}/index.d.ts +2 -1
- package/dist/src/core/lookup.d.ts +3 -0
- package/dist/{core → src/core}/pageHandlers.d.ts +4 -4
- package/dist/src/dev/assetStore.d.ts +12 -0
- package/dist/src/dev/buildHMRClient.d.ts +1 -0
- package/dist/src/dev/clientManager.d.ts +26 -0
- package/dist/src/dev/configResolver.d.ts +13 -0
- package/dist/src/dev/dependencyGraph.d.ts +13 -0
- package/dist/src/dev/fileHashTracker.d.ts +2 -0
- package/dist/src/dev/fileWatcher.d.ts +3 -0
- package/dist/src/dev/moduleMapper.d.ts +21 -0
- package/dist/src/dev/moduleVersionTracker.d.ts +7 -0
- package/dist/src/dev/pathUtils.d.ts +5 -0
- package/dist/src/dev/reactComponentClassifier.d.ts +2 -0
- package/dist/src/dev/rebuildTrigger.d.ts +10 -0
- package/dist/src/dev/simpleHTMLHMR.d.ts +4 -0
- package/dist/src/dev/simpleHTMXHMR.d.ts +4 -0
- package/dist/src/dev/simpleSvelteHMR.d.ts +1 -0
- package/dist/src/dev/simpleVueHMR.d.ts +1 -0
- package/dist/src/dev/webSocket.d.ts +9 -0
- package/dist/{index.d.ts → src/index.d.ts} +1 -0
- package/dist/src/plugins/hmr.d.ts +62 -0
- package/dist/{plugins → src/plugins}/index.d.ts +2 -1
- package/dist/{plugins → src/plugins}/networking.d.ts +3 -0
- package/dist/{svelte → src/svelte}/renderToReadableStream.d.ts +3 -1
- package/dist/src/utils/getRegisterClientScript.d.ts +10 -0
- package/dist/{utils → src/utils}/index.d.ts +2 -0
- package/dist/src/utils/logger.d.ts +45 -0
- package/dist/src/utils/networking.d.ts +2 -0
- package/dist/src/utils/normalizePath.d.ts +9 -0
- package/dist/src/utils/registerClientScript.d.ts +51 -0
- package/dist/{types.d.ts → types/build.d.ts} +7 -0
- package/dist/types/client.d.ts +104 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/messages.d.ts +138 -0
- package/dist/types/websocket.d.ts +6 -0
- package/eslint.config.mjs +238 -234
- package/package.json +17 -12
- package/tsconfig.build.json +20 -20
- package/types/build.ts +46 -0
- package/types/client.ts +109 -0
- package/types/index.ts +4 -0
- package/types/messages.ts +205 -0
- package/types/websocket.ts +12 -0
- package/types/window-globals.ts +53 -0
- package/dist/build/compileVue.d.ts +0 -5
- package/dist/build/generateReactIndexes.d.ts +0 -1
- package/dist/core/build.d.ts +0 -2
- package/dist/core/lookup.d.ts +0 -1
- package/dist/utils/networking.d.ts +0 -1
- /package/dist/{build → src/build}/generateManifest.d.ts +0 -0
- /package/dist/{build → src/build}/outputLogs.d.ts +0 -0
- /package/dist/{build → src/build}/scanEntryPoints.d.ts +0 -0
- /package/dist/{build → src/build}/updateAssetPaths.d.ts +0 -0
- /package/dist/{cli → src/cli}/index.d.ts +0 -0
- /package/dist/{constants.d.ts → src/constants.d.ts} +0 -0
- /package/dist/{plugins → src/plugins}/pageRouter.d.ts +0 -0
- /package/dist/{svelte → src/svelte}/renderToPipeableStream.d.ts +0 -0
- /package/dist/{svelte → src/svelte}/renderToString.d.ts +0 -0
- /package/dist/{utils → src/utils}/cleanup.d.ts +0 -0
- /package/dist/{utils → src/utils}/commonAncestor.d.ts +0 -0
- /package/dist/{utils → src/utils}/escapeScriptContent.d.ts +0 -0
- /package/dist/{utils → src/utils}/generateHeadElement.d.ts +0 -0
- /package/dist/{utils → src/utils}/getDurationString.d.ts +0 -0
- /package/dist/{utils → src/utils}/getEnv.d.ts +0 -0
- /package/dist/{utils → src/utils}/stringModifiers.d.ts +0 -0
- /package/dist/{utils → src/utils}/validateSafePath.d.ts +0 -0
package/types/client.ts
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/* Client-side HMR type definitions */
|
|
2
|
+
|
|
3
|
+
export interface ErrorOverlayOptions {
|
|
4
|
+
column?: number;
|
|
5
|
+
file?: string;
|
|
6
|
+
framework?: string;
|
|
7
|
+
line?: number;
|
|
8
|
+
lineText?: string;
|
|
9
|
+
message?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface DOMStateEntry {
|
|
13
|
+
checked?: boolean;
|
|
14
|
+
id?: string;
|
|
15
|
+
idx: number;
|
|
16
|
+
name?: string;
|
|
17
|
+
open?: boolean;
|
|
18
|
+
selEnd?: number;
|
|
19
|
+
selStart?: number;
|
|
20
|
+
selected?: boolean;
|
|
21
|
+
tag: string;
|
|
22
|
+
text?: string;
|
|
23
|
+
type?: string;
|
|
24
|
+
value?: string;
|
|
25
|
+
values?: string[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface DOMStateSnapshot {
|
|
29
|
+
activeKey: string | null;
|
|
30
|
+
items: DOMStateEntry[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface SavedComponentState {
|
|
34
|
+
count: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface SavedState {
|
|
38
|
+
componentState: SavedComponentState;
|
|
39
|
+
forms: Record<string, Record<string, boolean | string>>;
|
|
40
|
+
scroll: { window: { x: number; y: number } };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface ScriptInfo {
|
|
44
|
+
src: string;
|
|
45
|
+
type: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface CSSUpdateResult {
|
|
49
|
+
linksToActivate: HTMLLinkElement[];
|
|
50
|
+
linksToRemove: HTMLLinkElement[];
|
|
51
|
+
linksToWaitFor: Promise<void>[];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* Shared mutable state for the HMR client */
|
|
55
|
+
export const hmrState = {
|
|
56
|
+
isConnected: false,
|
|
57
|
+
isFirstHMRUpdate: true,
|
|
58
|
+
isHMRUpdating: false,
|
|
59
|
+
pingInterval: null as ReturnType<typeof setInterval> | null,
|
|
60
|
+
reconnectTimeout: null as ReturnType<typeof setTimeout> | null
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/* Window interface extensions for HMR globals */
|
|
64
|
+
declare global {
|
|
65
|
+
interface Window {
|
|
66
|
+
$RefreshReg$?: (type: unknown, id: string) => void;
|
|
67
|
+
$RefreshRuntime$?: {
|
|
68
|
+
createSignatureFunctionForTransform: () => (
|
|
69
|
+
type: unknown
|
|
70
|
+
) => unknown;
|
|
71
|
+
injectIntoGlobalHook: (win: Window) => void;
|
|
72
|
+
performReactRefresh: () => void;
|
|
73
|
+
register: (type: unknown, id: string) => void;
|
|
74
|
+
};
|
|
75
|
+
$RefreshSig$?: () => (type: unknown) => unknown;
|
|
76
|
+
__HMR_DOM_STATE__?: { count?: number; [key: string]: unknown };
|
|
77
|
+
__HMR_FRAMEWORK__?: string;
|
|
78
|
+
__HMR_MANIFEST__?: Record<string, string>;
|
|
79
|
+
__HMR_MODULE_UPDATES__?: Array<unknown>;
|
|
80
|
+
__HMR_MODULE_VERSIONS__?: Record<string, number>;
|
|
81
|
+
__HMR_PRESERVED_STATE__?: Record<string, unknown>;
|
|
82
|
+
__HMR_SERVER_VERSIONS__?: Record<string, number>;
|
|
83
|
+
__HMR_UPDATE_COUNT__?: number;
|
|
84
|
+
__HMR_WS__?: WebSocket;
|
|
85
|
+
__INITIAL_PROPS__?: Record<string, unknown>;
|
|
86
|
+
__REACT_ROOT__?: { render: (element: unknown) => void };
|
|
87
|
+
__SVELTE_COMPONENT__?: Record<string, unknown>;
|
|
88
|
+
__SVELTE_UNMOUNT__?: () => void;
|
|
89
|
+
__VUE_APP__?:
|
|
90
|
+
| ({
|
|
91
|
+
unmount: () => void;
|
|
92
|
+
_instance?: {
|
|
93
|
+
setupState?: Record<string, unknown>;
|
|
94
|
+
subTree?: {
|
|
95
|
+
children?: unknown[];
|
|
96
|
+
component?: {
|
|
97
|
+
setupState?: Record<string, unknown>;
|
|
98
|
+
subTree?: unknown;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
} & Record<string, unknown>)
|
|
103
|
+
| null;
|
|
104
|
+
__VUE_HMR_COMPONENTS__?: Record<string, unknown>;
|
|
105
|
+
htmx?: { process: (element: HTMLElement | Document) => void };
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export {};
|
package/types/index.ts
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/* HMR message types for client-server communication */
|
|
2
|
+
|
|
3
|
+
/* Client-to-server message types */
|
|
4
|
+
export type PingMessage = {
|
|
5
|
+
type: 'ping';
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type ReadyMessage = {
|
|
9
|
+
type: 'ready';
|
|
10
|
+
framework?: string | null;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type RequestRebuildMessage = {
|
|
14
|
+
type: 'request-rebuild';
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type HydrationErrorMessage = {
|
|
18
|
+
type: 'hydration-error';
|
|
19
|
+
data?: {
|
|
20
|
+
componentName?: string;
|
|
21
|
+
componentPath?: string;
|
|
22
|
+
error?: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type HMRClientMessage =
|
|
27
|
+
| PingMessage
|
|
28
|
+
| ReadyMessage
|
|
29
|
+
| RequestRebuildMessage
|
|
30
|
+
| HydrationErrorMessage;
|
|
31
|
+
|
|
32
|
+
/* Server-to-client message types */
|
|
33
|
+
export type ManifestMessage = {
|
|
34
|
+
type: 'manifest';
|
|
35
|
+
data: {
|
|
36
|
+
manifest: Record<string, string>;
|
|
37
|
+
serverVersions?: Record<string, number>;
|
|
38
|
+
};
|
|
39
|
+
timestamp: number;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type RebuildStartMessage = {
|
|
43
|
+
type: 'rebuild-start';
|
|
44
|
+
data: {
|
|
45
|
+
affectedFrameworks: string[];
|
|
46
|
+
};
|
|
47
|
+
timestamp: number;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type RebuildCompleteMessage = {
|
|
51
|
+
type: 'rebuild-complete';
|
|
52
|
+
data: {
|
|
53
|
+
affectedFrameworks: string[];
|
|
54
|
+
manifest: Record<string, string>;
|
|
55
|
+
};
|
|
56
|
+
timestamp: number;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export type FrameworkUpdateMessage = {
|
|
60
|
+
type: 'framework-update';
|
|
61
|
+
data: {
|
|
62
|
+
framework: string;
|
|
63
|
+
manifest?: Record<string, string>;
|
|
64
|
+
};
|
|
65
|
+
timestamp: number;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export type ModuleUpdateMessage = {
|
|
69
|
+
type: 'module-update';
|
|
70
|
+
data: {
|
|
71
|
+
framework: string;
|
|
72
|
+
manifest?: Record<string, string>;
|
|
73
|
+
modules?: Array<{
|
|
74
|
+
sourceFile: string;
|
|
75
|
+
moduleKeys: string[];
|
|
76
|
+
modulePaths: Record<string, string>;
|
|
77
|
+
componentType?: 'client' | 'server';
|
|
78
|
+
version?: number;
|
|
79
|
+
}>;
|
|
80
|
+
moduleVersions?: Record<string, number>;
|
|
81
|
+
serverVersions?: Record<string, number>;
|
|
82
|
+
};
|
|
83
|
+
timestamp: number;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export type ReactUpdateMessage = {
|
|
87
|
+
type: 'react-update';
|
|
88
|
+
data: {
|
|
89
|
+
sourceFile: string;
|
|
90
|
+
html?: string;
|
|
91
|
+
manifest?: Record<string, string>;
|
|
92
|
+
};
|
|
93
|
+
timestamp: number;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export type HTMLUpdateMessage = {
|
|
97
|
+
type: 'html-update';
|
|
98
|
+
data: {
|
|
99
|
+
sourceFile: string;
|
|
100
|
+
html?: string;
|
|
101
|
+
};
|
|
102
|
+
timestamp: number;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export type HTMXUpdateMessage = {
|
|
106
|
+
type: 'htmx-update';
|
|
107
|
+
data: {
|
|
108
|
+
sourceFile: string;
|
|
109
|
+
html?: string;
|
|
110
|
+
};
|
|
111
|
+
timestamp: number;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export type SvelteUpdateMessage = {
|
|
115
|
+
type: 'svelte-update';
|
|
116
|
+
data: {
|
|
117
|
+
sourceFile: string;
|
|
118
|
+
html?: string;
|
|
119
|
+
manifest?: Record<string, string>;
|
|
120
|
+
cssUrl?: string;
|
|
121
|
+
cssBaseName?: string;
|
|
122
|
+
updateType?: string;
|
|
123
|
+
};
|
|
124
|
+
timestamp: number;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export type VueUpdateMessage = {
|
|
128
|
+
type: 'vue-update';
|
|
129
|
+
data: {
|
|
130
|
+
sourceFile: string;
|
|
131
|
+
html?: string;
|
|
132
|
+
manifest?: Record<string, string>;
|
|
133
|
+
// Native Vue HMR fields
|
|
134
|
+
hmrId?: string;
|
|
135
|
+
changeType?: 'style-only' | 'template-only' | 'script' | 'full';
|
|
136
|
+
componentPath?: string;
|
|
137
|
+
cssUrl?: string;
|
|
138
|
+
cssBaseName?: string;
|
|
139
|
+
updateType?: 'css-only' | 'full';
|
|
140
|
+
};
|
|
141
|
+
timestamp: number;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export type RebuildErrorMessage = {
|
|
145
|
+
type: 'rebuild-error';
|
|
146
|
+
data: {
|
|
147
|
+
affectedFrameworks: string[];
|
|
148
|
+
error: string;
|
|
149
|
+
};
|
|
150
|
+
timestamp: number;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export type PongMessage = {
|
|
154
|
+
type: 'pong';
|
|
155
|
+
timestamp: number;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export type ConnectedMessage = {
|
|
159
|
+
type: 'connected';
|
|
160
|
+
message?: string;
|
|
161
|
+
timestamp: number;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export type HMRServerMessage =
|
|
165
|
+
| ManifestMessage
|
|
166
|
+
| RebuildStartMessage
|
|
167
|
+
| RebuildCompleteMessage
|
|
168
|
+
| FrameworkUpdateMessage
|
|
169
|
+
| ModuleUpdateMessage
|
|
170
|
+
| ReactUpdateMessage
|
|
171
|
+
| HTMLUpdateMessage
|
|
172
|
+
| HTMXUpdateMessage
|
|
173
|
+
| SvelteUpdateMessage
|
|
174
|
+
| VueUpdateMessage
|
|
175
|
+
| RebuildErrorMessage
|
|
176
|
+
| PongMessage
|
|
177
|
+
| ConnectedMessage;
|
|
178
|
+
|
|
179
|
+
/* Type guard for client messages */
|
|
180
|
+
export const isValidHMRClientMessage = (
|
|
181
|
+
data: unknown
|
|
182
|
+
): data is HMRClientMessage => {
|
|
183
|
+
if (!data || typeof data !== 'object') {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const message = data as Record<string, unknown>;
|
|
188
|
+
|
|
189
|
+
if (!('type' in message) || typeof message.type !== 'string') {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
switch (message.type) {
|
|
194
|
+
case 'ping':
|
|
195
|
+
return true;
|
|
196
|
+
case 'ready':
|
|
197
|
+
return true;
|
|
198
|
+
case 'request-rebuild':
|
|
199
|
+
return true;
|
|
200
|
+
case 'hydration-error':
|
|
201
|
+
return true;
|
|
202
|
+
default:
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* WebSocket types for HMR */
|
|
2
|
+
|
|
3
|
+
/* WebSocket ready state constant */
|
|
4
|
+
export const WS_READY_STATE_OPEN = 1;
|
|
5
|
+
|
|
6
|
+
/* Minimal WebSocket interface for HMR clients
|
|
7
|
+
Compatible with Elysia's WebSocket implementation */
|
|
8
|
+
export interface HMRWebSocket {
|
|
9
|
+
send(data: string): void;
|
|
10
|
+
close(code?: number, reason?: string): void;
|
|
11
|
+
readyState: number;
|
|
12
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/* Extend Window interface with HMR-specific globals */
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
/* Framework for current page, set at build time in index files */
|
|
5
|
+
__HMR_FRAMEWORK__?: string;
|
|
6
|
+
|
|
7
|
+
/* HMR manifest - maps component names to built file paths */
|
|
8
|
+
__HMR_MANIFEST__?: Record<string, string>;
|
|
9
|
+
|
|
10
|
+
/* Array of pending HMR module updates */
|
|
11
|
+
__HMR_MODULE_UPDATES__?: Array<unknown>;
|
|
12
|
+
|
|
13
|
+
/* Client-side module versions - tracks what version the client has loaded */
|
|
14
|
+
__HMR_MODULE_VERSIONS__?: Record<string, number>;
|
|
15
|
+
|
|
16
|
+
/* Server-side module versions - tracks what version the server has */
|
|
17
|
+
__HMR_SERVER_VERSIONS__?: Record<string, number>;
|
|
18
|
+
|
|
19
|
+
/* React root instance for HMR re-rendering */
|
|
20
|
+
__REACT_ROOT__?: {
|
|
21
|
+
render: (element: unknown) => void;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/* Initial props passed to React component */
|
|
25
|
+
__INITIAL_PROPS__?: Record<string, unknown>;
|
|
26
|
+
|
|
27
|
+
/* Preserved state across HMR updates */
|
|
28
|
+
__HMR_PRESERVED_STATE__?: Record<string, unknown>;
|
|
29
|
+
|
|
30
|
+
/* Update counter for debugging */
|
|
31
|
+
__HMR_UPDATE_COUNT__?: number;
|
|
32
|
+
|
|
33
|
+
/* Svelte component instance */
|
|
34
|
+
__SVELTE_COMPONENT__?: Record<string, unknown>;
|
|
35
|
+
|
|
36
|
+
/* Svelte unmount function (closure over current runtime + component) */
|
|
37
|
+
__SVELTE_UNMOUNT__?: () => void;
|
|
38
|
+
|
|
39
|
+
/* WebSocket instance for HMR */
|
|
40
|
+
__HMR_WS__?: WebSocket;
|
|
41
|
+
|
|
42
|
+
/* HTMX global (if HTMX is loaded) */
|
|
43
|
+
htmx?: {
|
|
44
|
+
process: (element: HTMLElement | Document) => void;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/* DOM state preserved during HTML/HTMX HMR updates */
|
|
48
|
+
__HMR_DOM_STATE__?: { count?: number; [key: string]: unknown };
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* Export empty object to make this a module */
|
|
53
|
+
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const generateReactIndexFiles: (reactPagesDirectory: string, reactIndexesDirectory: string) => Promise<void>;
|
package/dist/core/build.d.ts
DELETED
package/dist/core/lookup.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const asset: (manifest: Record<string, string>, name: string) => string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getLocalIPAddress: () => string;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|