@absolutejs/absolute 0.18.3-beta.12 → 0.18.3-beta.14

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.
@@ -46,45 +46,6 @@ var __export = (target, all) => {
46
46
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
47
47
  var __require = import.meta.require;
48
48
 
49
- // src/react/bridgeInternals.ts
50
- var INTERNALS_KEYS, findInternals = (mod) => {
51
- for (const key of INTERNALS_KEYS) {
52
- const val = mod[key];
53
- if (val)
54
- return val;
55
- }
56
- return;
57
- }, bridgeReactInternals = async () => {
58
- const pinned = globalThis.__reactModuleRef;
59
- if (!pinned)
60
- return;
61
- const react = await import("react");
62
- if (pinned === react)
63
- return;
64
- const pinnedInternals = findInternals(pinned);
65
- const currentInternals = findInternals(react);
66
- if (!pinnedInternals || !currentInternals || pinnedInternals === currentInternals)
67
- return;
68
- for (const prop of Object.keys(pinnedInternals)) {
69
- Object.defineProperty(currentInternals, prop, {
70
- get() {
71
- return pinnedInternals[prop];
72
- },
73
- set(v) {
74
- pinnedInternals[prop] = v;
75
- },
76
- configurable: true,
77
- enumerable: true
78
- });
79
- }
80
- };
81
- var init_bridgeInternals = __esm(() => {
82
- INTERNALS_KEYS = [
83
- "__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE",
84
- "__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED"
85
- ];
86
- });
87
-
88
49
  // src/utils/ssrErrorPage.ts
89
50
  var ssrErrorPage = (framework, error) => {
90
51
  const frameworkColors = {
@@ -138,13 +99,9 @@ body{min-height:100vh;background:linear-gradient(135deg,rgba(15,23,42,0.98) 0%,r
138
99
  };
139
100
 
140
101
  // src/react/pageHandler.ts
141
- init_bridgeInternals();
142
102
  var handleReactPageRequest = async (PageComponent, index, ...props) => {
143
103
  try {
144
104
  const [maybeProps] = props;
145
- if (true) {
146
- await bridgeReactInternals();
147
- }
148
105
  const { createElement } = await import("react");
149
106
  const { renderToReadableStream } = await import("react-dom/server");
150
107
  const element = maybeProps !== undefined ? createElement(PageComponent, maybeProps) : createElement(PageComponent);
@@ -172,5 +129,5 @@ export {
172
129
  handleReactPageRequest
173
130
  };
174
131
 
175
- //# debugId=6E95DDB8920EA69F64756E2164756E21
132
+ //# debugId=B73602A258AC0EF264756E2164756E21
176
133
  //# sourceMappingURL=index.js.map
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/react/bridgeInternals.ts", "../src/utils/ssrErrorPage.ts", "../src/react/pageHandler.ts"],
3
+ "sources": ["../src/utils/ssrErrorPage.ts", "../src/react/pageHandler.ts"],
4
4
  "sourcesContent": [
5
- "/**\n * After `bun install` adds new packages, Bun's module cache can resolve\n * `react` to a new instance while `react-dom/server` still holds the original.\n * The two copies have separate shared-internals objects, so the hook dispatcher\n * set by react-dom is invisible to hooks in user components — \"Invalid hook call\".\n *\n * This bridges the new React's internals to the pinned (original) instance via\n * property descriptors so both share one dispatcher.\n *\n * React 19 renamed the internals key from\n * `__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED` to\n * `__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE`.\n * We try both so the fix works across versions.\n */\nconst INTERNALS_KEYS = [\n\t'__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE',\n\t'__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED'\n] as const;\n\nconst findInternals = (\n\tmod: Record<string, unknown>\n): Record<string, unknown> | undefined => {\n\tfor (const key of INTERNALS_KEYS) {\n\t\tconst val = mod[key] as Record<string, unknown> | undefined;\n\t\tif (val) return val;\n\t}\n\treturn undefined;\n};\n\nexport const bridgeReactInternals = async (): Promise<void> => {\n\tconst pinned = globalThis.__reactModuleRef;\n\tif (!pinned) return;\n\n\tconst react = await import('react');\n\tif (pinned === react) return;\n\n\tconst pinnedInternals = findInternals(pinned as Record<string, unknown>);\n\tconst currentInternals = findInternals(react as Record<string, unknown>);\n\n\tif (\n\t\t!pinnedInternals ||\n\t\t!currentInternals ||\n\t\tpinnedInternals === currentInternals\n\t)\n\t\treturn;\n\n\tfor (const prop of Object.keys(pinnedInternals)) {\n\t\tObject.defineProperty(currentInternals, prop, {\n\t\t\tget() {\n\t\t\t\treturn pinnedInternals[prop];\n\t\t\t},\n\t\t\tset(v: unknown) {\n\t\t\t\tpinnedInternals[prop] = v;\n\t\t\t},\n\t\t\tconfigurable: true,\n\t\t\tenumerable: true\n\t\t});\n\t}\n};\n",
6
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, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')}</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",
7
- "import type { ComponentType as ReactComponent } from 'react';\nimport { ssrErrorPage } from '../utils/ssrErrorPage';\nimport { bridgeReactInternals } from './bridgeInternals';\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\t// In dev mode, bun install can invalidate the module cache mid-flight\n\t\t// while the old server is still handling requests. Bridge React internals\n\t\t// to prevent duplicate-instance hook errors. No-op in production.\n\t\tif (process.env.NODE_ENV === 'development') {\n\t\t\tawait bridgeReactInternals();\n\t\t}\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\t// In dev mode, Bun's reactFastRefresh injects $RefreshReg$/$RefreshSig$\n\t\t// calls into component code. With code splitting, shared component chunks\n\t\t// may load before the chunk containing reactRefreshSetup.ts — causing a\n\t\t// ReferenceError. These no-op stubs ensure the globals exist before any\n\t\t// module code runs. reactRefreshSetup.ts overwrites them with the real\n\t\t// implementations once its chunk executes.\n\t\tconst refreshStubs =\n\t\t\tprocess.env.NODE_ENV === 'development'\n\t\t\t\t? 'window.$RefreshReg$=function(){};window.$RefreshSig$=function(){return function(t){return t}};'\n\t\t\t\t: '';\n\t\tconst propsScript = maybeProps\n\t\t\t? `window.__INITIAL_PROPS__=${JSON.stringify(maybeProps)}`\n\t\t\t: '';\n\n\t\tconst stream = await renderToReadableStream(element, {\n\t\t\tbootstrapModules: [index],\n\t\t\tbootstrapScriptContent: refreshStubs + propsScript || 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"
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\t// In dev mode, Bun's reactFastRefresh injects $RefreshReg$/$RefreshSig$\n\t\t// calls into component code. With code splitting, shared component chunks\n\t\t// may load before the chunk containing reactRefreshSetup.ts — causing a\n\t\t// ReferenceError. These no-op stubs ensure the globals exist before any\n\t\t// module code runs. reactRefreshSetup.ts overwrites them with the real\n\t\t// implementations once its chunk executes.\n\t\tconst refreshStubs =\n\t\t\tprocess.env.NODE_ENV === 'development'\n\t\t\t\t? 'window.$RefreshReg$=function(){};window.$RefreshSig$=function(){return function(t){return t}};'\n\t\t\t\t: '';\n\t\tconst propsScript = maybeProps\n\t\t\t? `window.__INITIAL_PROPS__=${JSON.stringify(maybeProps)}`\n\t\t\t: '';\n\n\t\tconst stream = await renderToReadableStream(element, {\n\t\t\tbootstrapModules: [index],\n\t\t\tbootstrapScriptContent: refreshStubs + propsScript || 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"
8
7
  ],
9
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAcM,gBAKA,gBAAgB,CACrB,QACyC;AAAA,EACzC,WAAW,OAAO,gB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AAO,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
+ "debugId": "B73602A258AC0EF264756E2164756E21",
11
10
  "names": []
12
11
  }
package/package.json CHANGED
@@ -151,5 +151,5 @@
151
151
  "typecheck": "bun run vue-tsc --noEmit"
152
152
  },
153
153
  "types": "./dist/src/index.d.ts",
154
- "version": "0.18.3-beta.12"
154
+ "version": "0.18.3-beta.14"
155
155
  }