@absolutejs/absolute 0.19.0-beta.120 → 0.19.0-beta.122
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/.absolutejs/cert.pem +11 -0
- package/.absolutejs/key.pem +5 -0
- package/.absolutejs/prettier.cache.json +45 -27
- package/.absolutejs/tsconfig.tsbuildinfo +1 -1
- package/.claude/projects/-home-alexkahn-abs-absolutejs/memory/feedback_http2_naming.md +10 -0
- package/.claude/settings.local.json +6 -1
- package/dist/build.js +9 -2
- package/dist/build.js.map +7 -7
- package/dist/cli/index.js +3 -7
- package/dist/dev/client/reactRefreshSetup.ts +2 -3
- package/dist/index.js +261 -45
- package/dist/index.js.map +14 -13
- package/dist/react/index.js.map +2 -2
- package/dist/src/core/prepare.d.ts +2 -16
- package/dist/src/dev/http2Bridge.d.ts +3 -0
- package/dist/src/plugins/hmr.d.ts +2 -16
- package/package.json +1 -1
- package/scripts/use-combined-bun.sh +27 -0
- package/scripts/use-http2-bun.sh +26 -0
- package/types/globals.d.ts +6 -0
package/dist/react/index.js.map
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
"sources": ["../src/utils/ssrErrorPage.ts", "../src/react/pageHandler.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"export const ssrErrorPage = (framework: string, error: unknown) => {\n\tconst frameworkColors: Record<string, string> = {\n\t\tangular: '#dd0031',\n\t\thtml: '#e34c26',\n\t\thtmx: '#1a365d',\n\t\treact: '#61dafb',\n\t\tsvelte: '#ff3e00',\n\t\tvue: '#42b883'\n\t};\n\n\tconst accent = frameworkColors[framework] ?? '#94a3b8';\n\tconst label = framework.charAt(0).toUpperCase() + framework.slice(1);\n\tconst message = error instanceof Error ? error.message : String(error);\n\n\treturn `<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>SSR Error - AbsoluteJS</title>\n<style>\n*{margin:0;padding:0;box-sizing:border-box}\nbody{min-height:100vh;background:linear-gradient(135deg,rgba(15,23,42,0.98) 0%,rgba(30,41,59,0.98) 100%);color:#e2e8f0;font-family:\"JetBrains Mono\",\"Fira Code\",ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:14px;line-height:1.6;display:flex;align-items:flex-start;justify-content:center;padding:32px}\n.card{max-width:720px;width:100%;background:rgba(30,41,59,0.6);border:1px solid rgba(71,85,105,0.5);border-radius:16px;box-shadow:0 25px 50px -12px rgba(0,0,0,0.5),0 0 0 1px rgba(255,255,255,0.05);overflow:hidden}\n.header{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:20px 24px;background:rgba(15,23,42,0.5);border-bottom:1px solid rgba(71,85,105,0.4)}\n.brand{font-weight:700;font-size:20px;color:#fff;letter-spacing:-0.02em}\n.badge{padding:5px 10px;border-radius:8px;font-size:12px;font-weight:600;background:${accent};color:#fff;opacity:0.95;box-shadow:0 2px 4px rgba(0,0,0,0.2)}\n.kind{color:#94a3b8;font-size:13px;font-weight:500}\n.content{padding:24px}\n.label{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.08em;color:#94a3b8;margin-bottom:8px}\n.message{margin:0;padding:16px 20px;background:rgba(239,68,68,0.12);border:1px solid rgba(239,68,68,0.25);border-radius:10px;overflow-x:auto;white-space:pre-wrap;word-break:break-word;color:#fca5a5;font-size:13px;line-height:1.5}\n.hint{margin-top:20px;padding:12px 20px;background:rgba(71,85,105,0.3);border-radius:10px;border:1px solid rgba(71,85,105,0.4);color:#cbd5e1;font-size:13px}\n</style>\n</head>\n<body>\n<div class=\"card\">\n<div class=\"header\">\n<div style=\"display:flex;align-items:center;gap:12px\">\n<span class=\"brand\">AbsoluteJS</span>\n<span class=\"badge\">${label}</span>\n</div>\n<span class=\"kind\">Server Render Error</span>\n</div>\n<div class=\"content\">\n<div class=\"label\">What went wrong</div>\n<pre class=\"message\">${message.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')}</pre>\n<div class=\"hint\">A component threw during server-side rendering. Check the terminal for the full stack trace.</div>\n</div>\n</div>\n</body>\n</html>`;\n};\n",
|
|
6
|
-
"import type { ComponentType as ReactComponent } from 'react';\nimport { ssrErrorPage } from '../utils/ssrErrorPage';\n\nexport const handleReactPageRequest = async <\n\tProps extends Record<string, unknown> = Record<never, never>\n>(\n\tPageComponent: ReactComponent<Props>,\n\tindex: string,\n\t...props: keyof Props extends never ? [] : [props: NoInfer<Props>]\n) => {\n\ttry {\n\t\tconst [maybeProps] = props;\n\t\tconst { createElement } = await import('react');\n\t\tconst { renderToReadableStream } = await import('react-dom/server');\n\n\t\tconst element =\n\t\t\tmaybeProps !== undefined\n\t\t\t\t? createElement(PageComponent, maybeProps)\n\t\t\t\t: createElement(PageComponent);\n\n\t\tconst propsScript = maybeProps\n\t\t\t? `window.__INITIAL_PROPS__=${JSON.stringify(maybeProps)};`\n\t\t\t: '';\n\n\t\t// Buffer React Refresh registrations until the runtime loads.\n\t\t// Bun.build injects $RefreshReg$ calls in the bundle, but the\n\t\t// real runtime isn't ready yet. This buffering function captures\n\t\t// all registrations, then replays them when the runtime is set up.\n\t\tconst refreshSetup
|
|
6
|
+
"import type { ComponentType as ReactComponent } from 'react';\nimport { ssrErrorPage } from '../utils/ssrErrorPage';\n\nexport const handleReactPageRequest = async <\n\tProps extends Record<string, unknown> = Record<never, never>\n>(\n\tPageComponent: ReactComponent<Props>,\n\tindex: string,\n\t...props: keyof Props extends never ? [] : [props: NoInfer<Props>]\n) => {\n\ttry {\n\t\tconst [maybeProps] = props;\n\t\tconst { createElement } = await import('react');\n\t\tconst { renderToReadableStream } = await import('react-dom/server');\n\n\t\tconst element =\n\t\t\tmaybeProps !== undefined\n\t\t\t\t? createElement(PageComponent, maybeProps)\n\t\t\t\t: createElement(PageComponent);\n\n\t\tconst propsScript = maybeProps\n\t\t\t? `window.__INITIAL_PROPS__=${JSON.stringify(maybeProps)};`\n\t\t\t: '';\n\n\t\t// Buffer React Refresh registrations until the runtime loads.\n\t\t// Bun.build injects $RefreshReg$ calls in the bundle, but the\n\t\t// real runtime isn't ready yet. This buffering function captures\n\t\t// all registrations, then replays them when the runtime is set up.\n\t\tconst refreshSetup =\n\t\t\tprocess.env.NODE_ENV !== 'production'\n\t\t\t\t? 'window.__REFRESH_BUFFER__=[];' +\n\t\t\t\t\t'window.$RefreshReg$=function(t,i){window.__REFRESH_BUFFER__.push([t,i])};' +\n\t\t\t\t\t'window.$RefreshSig$=function(){return function(t){return t}};'\n\t\t\t\t: '';\n\n\t\tconst stream = await renderToReadableStream(element, {\n\t\t\tbootstrapModules: [index],\n\t\t\tbootstrapScriptContent: propsScript + refreshSetup || undefined,\n\t\t\tonError(error: unknown) {\n\t\t\t\tconsole.error('[SSR] React streaming error:', error);\n\t\t\t}\n\t\t});\n\n\t\treturn new Response(stream, {\n\t\t\theaders: { 'Content-Type': 'text/html' }\n\t\t});\n\t} catch (error) {\n\t\tconsole.error('[SSR] React render error:', error);\n\n\t\treturn new Response(ssrErrorPage('react', error), {\n\t\t\theaders: { 'Content-Type': 'text/html' },\n\t\t\tstatus: 500\n\t\t});\n\t}\n};\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAa,eAAe,CAAC,WAAmB,UAAmB;AAAA,EAClE,MAAM,kBAA0C;AAAA,IAC/C,SAAS;AAAA,IACT,MAAM;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,KAAK;AAAA,EACN;AAAA,EAEA,MAAM,SAAS,gBAAgB,cAAc;AAAA,EAC7C,MAAM,QAAQ,UAAU,OAAO,CAAC,EAAE,YAAY,IAAI,UAAU,MAAM,CAAC;AAAA,EACnE,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAAA,EAErE,OAAO;AAAA;AAAA;AAAA;AAA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;AAAA;AAAA,sBAahE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAMC,QAAQ,QAAQ,MAAM,OAAO,EAAE,QAAQ,MAAM,MAAM,EAAE,QAAQ,MAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC1CzF,IAAM,yBAAyB,OAGrC,eACA,UACG,UACC;AAAA,EACJ,IAAI;AAAA,IACH,OAAO,cAAc;AAAA,IACrB,QAAQ,kBAAkB,MAAa;AAAA,IACvC,QAAQ,2BAA2B,MAAa;AAAA,IAEhD,MAAM,UACL,eAAe,YACZ,cAAc,eAAe,UAAU,IACvC,cAAc,aAAa;AAAA,IAE/B,MAAM,cAAc,aACjB,4BAA4B,KAAK,UAAU,UAAU,OACrD;AAAA,IAMH,MAAM,eAEF;AAAA,IAKJ,MAAM,SAAS,MAAM,uBAAuB,SAAS;AAAA,MACpD,kBAAkB,CAAC,KAAK;AAAA,MACxB,wBAAwB,cAAc,gBAAgB;AAAA,MACtD,OAAO,CAAC,OAAgB;AAAA,QACvB,QAAQ,MAAM,gCAAgC,KAAK;AAAA;AAAA,IAErD,CAAC;AAAA,IAED,OAAO,IAAI,SAAS,QAAQ;AAAA,MAC3B,SAAS,EAAE,gBAAgB,YAAY;AAAA,IACxC,CAAC;AAAA,IACA,OAAO,OAAO;AAAA,IACf,QAAQ,MAAM,6BAA6B,KAAK;AAAA,IAEhD,OAAO,IAAI,SAAS,aAAa,SAAS,KAAK,GAAG;AAAA,MACjD,SAAS,EAAE,gBAAgB,YAAY;AAAA,MACvC,QAAQ;AAAA,IACT,CAAC;AAAA;AAAA;",
|
|
9
9
|
"debugId": "517A083C498A807964756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
|
@@ -16,18 +16,6 @@ export declare const prepare: (configOrPath?: string) => Promise<{
|
|
|
16
16
|
parser: {};
|
|
17
17
|
response: {};
|
|
18
18
|
}, {
|
|
19
|
-
hmr: {
|
|
20
|
-
subscribe: {
|
|
21
|
-
body: unknown;
|
|
22
|
-
params: {};
|
|
23
|
-
query: unknown;
|
|
24
|
-
headers: unknown;
|
|
25
|
-
response: {
|
|
26
|
-
200: Response;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
} & {
|
|
31
19
|
"hmr-status": {
|
|
32
20
|
get: {
|
|
33
21
|
body: unknown;
|
|
@@ -35,7 +23,7 @@ export declare const prepare: (configOrPath?: string) => Promise<{
|
|
|
35
23
|
query: unknown;
|
|
36
24
|
headers: unknown;
|
|
37
25
|
response: {
|
|
38
|
-
200:
|
|
26
|
+
200: {
|
|
39
27
|
connectedClients: number;
|
|
40
28
|
isRebuilding: boolean;
|
|
41
29
|
manifestKeys: string[];
|
|
@@ -57,9 +45,7 @@ export declare const prepare: (configOrPath?: string) => Promise<{
|
|
|
57
45
|
resolve: {};
|
|
58
46
|
schema: {};
|
|
59
47
|
standaloneSchema: {};
|
|
60
|
-
response: {
|
|
61
|
-
200: Response;
|
|
62
|
-
};
|
|
48
|
+
response: {};
|
|
63
49
|
}>;
|
|
64
50
|
} | {
|
|
65
51
|
absolutejs: Promise<import("elysia").default<"", {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IncomingHttpHeaders, ServerHttp2Stream } from 'node:http2';
|
|
2
|
+
import type { HMRState } from './clientManager';
|
|
3
|
+
export declare const bridgeHttp2Stream: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, fetchHandler: (request: Request) => Promise<Response> | Response, hmrState?: HMRState, manifest?: Record<string, string>) => Promise<void>;
|
|
@@ -16,18 +16,6 @@ export declare const hmr: (hmrState: HMRState, manifest: Record<string, string>,
|
|
|
16
16
|
parser: {};
|
|
17
17
|
response: {};
|
|
18
18
|
}, {
|
|
19
|
-
hmr: {
|
|
20
|
-
subscribe: {
|
|
21
|
-
body: unknown;
|
|
22
|
-
params: {};
|
|
23
|
-
query: unknown;
|
|
24
|
-
headers: unknown;
|
|
25
|
-
response: {
|
|
26
|
-
200: Response;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
} & {
|
|
31
19
|
"hmr-status": {
|
|
32
20
|
get: {
|
|
33
21
|
body: unknown;
|
|
@@ -35,7 +23,7 @@ export declare const hmr: (hmrState: HMRState, manifest: Record<string, string>,
|
|
|
35
23
|
query: unknown;
|
|
36
24
|
headers: unknown;
|
|
37
25
|
response: {
|
|
38
|
-
200:
|
|
26
|
+
200: {
|
|
39
27
|
connectedClients: number;
|
|
40
28
|
isRebuilding: boolean;
|
|
41
29
|
manifestKeys: string[];
|
|
@@ -57,7 +45,5 @@ export declare const hmr: (hmrState: HMRState, manifest: Record<string, string>,
|
|
|
57
45
|
resolve: {};
|
|
58
46
|
schema: {};
|
|
59
47
|
standaloneSchema: {};
|
|
60
|
-
response: {
|
|
61
|
-
200: Response;
|
|
62
|
-
};
|
|
48
|
+
response: {};
|
|
63
49
|
}>;
|
package/package.json
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Use the combined patched Bun with:
|
|
3
|
+
# 1. reactFastRefresh on Bun.Transpiler (PR #28312)
|
|
4
|
+
# 2. enableConnectProtocol for HTTP/2 WebSocket (RFC 8441)
|
|
5
|
+
#
|
|
6
|
+
# Usage:
|
|
7
|
+
# source scripts/use-combined-bun.sh
|
|
8
|
+
# bun run dev
|
|
9
|
+
#
|
|
10
|
+
# Or prefix any command:
|
|
11
|
+
# ./scripts/use-combined-bun.sh bun run dev
|
|
12
|
+
|
|
13
|
+
PATCHED_BUN="$HOME/alex/bun-combined-patch/build/release/bun"
|
|
14
|
+
|
|
15
|
+
if [ ! -f "$PATCHED_BUN" ]; then
|
|
16
|
+
echo "Combined patched Bun not found at $PATCHED_BUN"
|
|
17
|
+
echo "Build it: cd ~/alex/bun-combined-patch && bun run build:release"
|
|
18
|
+
exit 1
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
if [ $# -gt 0 ]; then
|
|
22
|
+
echo "Using combined patched Bun: $("$PATCHED_BUN" --version) (reactFastRefresh + enableConnectProtocol)" >&2
|
|
23
|
+
PATH="$(dirname "$PATCHED_BUN"):$PATH" exec "$@"
|
|
24
|
+
else
|
|
25
|
+
export PATH="$(dirname "$PATCHED_BUN"):$PATH"
|
|
26
|
+
echo "Using combined patched Bun: $($PATCHED_BUN --version)"
|
|
27
|
+
fi
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Use the patched Bun binary that includes enableConnectProtocol for HTTP/2 SETTINGS
|
|
3
|
+
# This enables RFC 8441 WebSocket-over-HTTP/2 (Extended CONNECT)
|
|
4
|
+
#
|
|
5
|
+
# Usage:
|
|
6
|
+
# source scripts/use-http2-bun.sh
|
|
7
|
+
# bun run dev
|
|
8
|
+
#
|
|
9
|
+
# Or prefix any command:
|
|
10
|
+
# ./scripts/use-http2-bun.sh bun run dev
|
|
11
|
+
|
|
12
|
+
PATCHED_BUN="$HOME/alex/bun-http2-patch/build/release/bun"
|
|
13
|
+
|
|
14
|
+
if [ ! -f "$PATCHED_BUN" ]; then
|
|
15
|
+
echo "Patched Bun not found at $PATCHED_BUN"
|
|
16
|
+
echo "Build it: cd ~/alex/bun-http2-patch && bun run build:release"
|
|
17
|
+
exit 1
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
if [ $# -gt 0 ]; then
|
|
21
|
+
echo "Using HTTP/2 patched Bun: $("$PATCHED_BUN" --version) (enableConnectProtocol)" >&2
|
|
22
|
+
PATH="$(dirname "$PATCHED_BUN"):$PATH" exec "$@"
|
|
23
|
+
else
|
|
24
|
+
export PATH="$(dirname "$PATCHED_BUN"):$PATH"
|
|
25
|
+
echo "Using HTTP/2 patched Bun: $($PATCHED_BUN --version)"
|
|
26
|
+
fi
|
package/types/globals.d.ts
CHANGED
|
@@ -10,6 +10,12 @@ declare global {
|
|
|
10
10
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
11
|
var __reactModuleRef: any;
|
|
12
12
|
var __depVendorPaths: Record<string, string> | undefined;
|
|
13
|
+
var __http2Config:
|
|
14
|
+
| {
|
|
15
|
+
hmrState: import('../src/dev/clientManager').HMRState;
|
|
16
|
+
manifest: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
| undefined;
|
|
13
19
|
var __hmrDevResult:
|
|
14
20
|
| {
|
|
15
21
|
hmrState: import('../src/dev/clientManager').HMRState;
|