rari 0.14.0 → 0.14.2
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/dist/cli.mjs +1 -1
- package/dist/client.d.mts +5 -6
- package/dist/client.mjs +1 -1
- package/dist/{get-client-component-DOUGb2xc.mjs → get-client-component-B4Y2T40R.mjs} +1 -1
- package/dist/headers.d.mts +1 -1
- package/dist/image/index.mjs +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/mdx.mjs +1 -1
- package/dist/{preload-modules-C1zd75Lc.mjs → preload-modules-xvnJ_8eh.mjs} +2 -2
- package/dist/proxy/RariRequest.d.mts +1 -1
- package/dist/proxy/RariResponse.d.mts +1 -1
- package/dist/{railway-BQNsu-l4.mjs → railway-bxKRJ0Cg.mjs} +1 -1
- package/dist/regex-constants-B4P386OY.mjs +1 -0
- package/dist/{render-DHDWCmpf.mjs → render-CXNCiz-E.mjs} +1 -1
- package/dist/router.d.mts +1 -3
- package/dist/router.mjs +1 -1
- package/dist/runtime/AppRouterProvider.d.mts +1 -2
- package/dist/runtime/AppRouterProvider.mjs +3 -3
- package/dist/runtime/ErrorBoundaryWrapper.mjs +1 -1
- package/dist/runtime/entry-client.mjs +2 -2
- package/dist/runtime/react-server-dom-shim.mjs +1 -1
- package/dist/runtime/rsc-client-runtime.d.mts +1 -1
- package/dist/runtime/rsc-client-runtime.mjs +2 -2
- package/dist/runtime/vendor/react-flight-client/ReactFlightClient.d.mts +1 -1
- package/dist/runtime/vendor/react-flight-client/ReactFlightClientConfig.d.mts +1 -1
- package/dist/runtime/vendor/react-flight-client/ReactFlightClientConfig.mjs +1 -1
- package/dist/{sitemap-generator-DXQL4RtJ.mjs → sitemap-generator-BTG9lURQ.mjs} +1 -1
- package/dist/{types-CC9LMWMo.d.mts → types-m74grfbN.d.mts} +1 -0
- package/dist/vite.d.mts +4 -4
- package/dist/vite.mjs +118 -17
- package/package.json +10 -10
- package/dist/regex-constants-CmOAY1_W.mjs +0 -1
- package/dist/rolldown-runtime-DR3Ue2cl.mjs +0 -1
- package/dist/routes-C8Txll7p.mjs +0 -1
- package/dist/server-build-JfPg3Cjl.mjs +0 -166
- /package/dist/{ReactFlightClientConfig-DdCyeIZx.d.mts → ReactFlightClientConfig-C_nD8rsi.d.mts} +0 -0
- /package/dist/{alias-resolver-D1GHg-4o.mjs → alias-resolver-BintHkb_.mjs} +0 -0
- /package/dist/{constants-B68HGlJT.mjs → constants-De7aSsCq.mjs} +0 -0
- /package/dist/{metadata-route-D0xSj7FK.d.mts → metadata-route-85WvBQcW.d.mts} +0 -0
- /package/dist/{navigate-hfIqe3MK.mjs → navigate-DuyUa6qD.mjs} +0 -0
- /package/dist/{robots-generator-Byiwomr5.mjs → robots-generator-l2O5neuR.mjs} +0 -0
- /package/dist/{runtime-client-CbbckLpl.mjs → runtime-client-DHeO6y_7.mjs} +0 -0
- /package/dist/{server-config-CGmxgSPb.d.mts → server-config-CwWYmtA0.d.mts} +0 -0
- /package/dist/{timer-utils-DnyOf3e6.mjs → timer-utils-Duul5JHq.mjs} +0 -0
- /package/dist/{types-DOgYNbON.d.mts → types-3dq9RGI5.d.mts} +0 -0
- /package/dist/{types-R2tg78dF.d.mts → types-zPQ3RHgH.d.mts} +0 -0
- /package/dist/{utils-BK4N0qFr-BCy19luN.mjs → utils-BK4N0qFr-QFbF96eD.mjs} +0 -0
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{getBinaryPath as e,getInstallationInstructions as t}from"./platform.mjs";import{spawn as n}from"node:child_process";import{existsSync as r,readFileSync as i,realpathSync as a}from"node:fs";import{resolve as o}from"node:path";import s from"node:process";import{fileURLToPath as c}from"node:url";import{styleText as l}from"node:util";function u(e){console.warn(`${l(`blue`,`info`)} ${e}`)}function d(e){console.warn(`${l(`green`,`✓`)} ${e}`)}function f(e){console.error(`${l(`red`,`✗`)} ${e}`)}function p(e){console.warn(`${l(`yellow`,`⚠`)} ${e}`)}const m=/^([^=]+)=(.*)$/;function h(e){let t=e.trim();if(!t||t.startsWith(`#`))return null;let n=t.match(m);if(!n)return null;let[,r,i]=n,a=r.trim(),o=i.trim();return(o.startsWith(`"`)&&o.endsWith(`"`)||o.startsWith(`'`)&&o.endsWith(`'`))&&(o=o.slice(1,-1)),{key:a,value:o}}function g(){let e=o(s.cwd(),`.env`);if(!r(e))return;let t=i(e,`utf-8`);for(let e of t.split(`
|
|
3
|
-
`)){let t=h(e);t&&!s.env[t.key]&&(s.env[t.key]=t.value)}}g();const[,,_,...v]=s.argv;function y(e){let t=s.cwd();for(;;){let n=e(t);if(n!==null)return n;let r=o(t,`..`);if(r===t)break;t=r}return null}function b(e){return r(o(e,`pnpm-lock.yaml`))?`pnpm`:r(o(e,`yarn.lock`))?`yarn`:r(o(e,`bun.lockb`))?`bun`:r(o(e,`package-lock.json`))?`npm`:null}function x(e){try{let t=o(e,`package.json`);if(!r(t))return null;let n=JSON.parse(i(t,`utf-8`));if(n.packageManager?.startsWith(`pnpm`))return`pnpm`;if(n.packageManager?.startsWith(`yarn`))return`yarn`;if(n.packageManager?.startsWith(`bun`))return`bun`;if(n.packageManager?.startsWith(`npm`))return`npm`}catch{}return null}function S(){return y(e=>b(e)??x(e))??`npm`}function C(){let e=S(),t=s.platform===`win32`;switch(e){case`bun`:return t?`bun.cmd`:`bun`;case`pnpm`:return t?`pnpm.cmd`:`pnpm`;case`yarn`:return t?`yarn.cmd`:`yarn`;default:return t?`npx.cmd`:`npx`}}function w(){return y(e=>{try{let t=o(e,`package.json`);if(r(t)){let e=JSON.parse(i(t,`utf-8`)),n={...e.dependencies,...e.devDependencies};if(n[`vite-plus`])return`vp`;if(n.vite)return`vite`}}catch{}return null})??`vite`}function T(e,t,r={}){let i=s.platform===`win32`;if(e===`npx`){let e=C();if(e.includes(`bun`))return n(i?`bunx.cmd`:`bunx`,t,{...r,shell:i});if(e.includes(`pnpm`))return n(e,[`exec`,...t],{...r,shell:i});if(e.includes(`yarn`)){let[a,...o]=t;return n(e,a===`vp`?[`dlx`,`-p`,`vite-plus`,`vp`,...o]:[`dlx`,...t],{...r,shell:i})}}return i&&e===`npx`?n(`npx.cmd`,t,{...r,shell:!0}):n(e,t,r)}function E(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function D(){return!!(s.env.RAILWAY_ENVIRONMENT||s.env.RAILWAY_PROJECT_ID||s.env.RAILWAY_SERVICE_ID)}function O(){return!!(s.env.RENDER||s.env.RENDER_SERVICE_ID||s.env.RENDER_SERVICE_NAME)}function k(){return D()||O()}function A(){return D()?`Railway`:O()?`Render`:`local`}function j(){return{port:s.env.PORT||s.env.RSC_PORT||`3000`,mode:s.env.NODE_ENV||`production`,host:k()?`0.0.0.0`:`127.0.0.1`}}async function M(){let{existsSync:e,rmSync:t}=await import(`node:fs`),{resolve:n}=await import(`node:path`),r=n(s.cwd(),`dist`);e(r)&&(u(`Cleaning dist folder...`),t(r,{recursive:!0,force:!0})),u(`Type checking...`);let i=T(`npx`,[`tsgo`],{stdio:`inherit`,cwd:s.cwd()});await new Promise((e,t)=>{i.on(`exit`,n=>{n===0?(d(`Type check passed`),e()):(f(`Type check failed with code ${n}`),t(Error(`Type check failed with code ${n}`)))}),i.on(`error`,t)}),u(`Building for production...`);let a=T(`npx`,[w(),`build`],{stdio:`inherit`,cwd:s.cwd()});await new Promise((e,t)=>{a.on(`exit`,n=>{n===0?(d(`Build complete`),e()):(f(`Build failed with code ${n}`),t(Error(`Build failed with code ${n}`)))}),a.on(`error`,t)}),await N()}async function N(){if(r(o(s.cwd(),`dist`,`server`,`image.json`))&&r(o(s.cwd(),`public`)))try{let t=n(e(),[`optimize-images`],{stdio:`inherit`,cwd:s.cwd(),shell:!1});await new Promise(e=>{t.on(`exit`,t=>{t===0||p(`Image pre-optimization exited with code ${t}`),e()}),t.on(`error`,t=>{p(`Image pre-optimization error: ${E(t)}`),e()})})}catch(e){p(`Could not pre-optimize images: ${E(e)}`)}}async function P(){let{existsSync:e}=await import(`node:fs`),{resolve:t}=await import(`node:path`),n=w();if(!e(t(s.cwd(),`dist`))){u(`First run detected - building project...`);let e=T(`npx`,[n,`build`,`--mode`,`development`],{stdio:`inherit`,cwd:s.cwd()});await new Promise((t,n)=>{e.on(`exit`,e=>{e===0?(d(`Initial build complete`),t()):(f(`Build failed with code ${e}`),n(Error(`Build failed with code ${e}`)))}),e.on(`error`,n)})}u(`Starting Vite${n===`vp`?`+`:``} dev server...`);let r=T(`npx`,[n,`dev`],{stdio:`inherit`,cwd:s.cwd()}),i=()=>{u(`Shutting down dev server...`),r.kill(`SIGTERM`)};return s.on(`SIGINT`,i),s.on(`SIGTERM`,i),r.on(`error`,e=>{f(`Failed to start Vite: ${e.message}`),s.exit(1)}),r.on(`exit`,e=>{e!==0&&e!==null&&(f(`Vite exited with code ${e}`),s.exit(e))}),new Promise(()=>{})}async function F(){let r;try{r=e()}catch{f(`Failed to obtain rari binary`),f(t()),s.exit(1)}let{port:i,mode:a,host:o}=j();if(k()){let e=A();u(`${e} environment detected`),u(`Starting rari server for ${e} deployment...`),u(`Mode: ${a}, Host: ${o}, Port: ${i}`),u(`using binary: ${r}`)}let c=n(r,[`--mode`,a,`--port`,i,`--host`,o],{stdio:`inherit`,cwd:s.cwd(),env:{...s.env,RUST_LOG:s.env.RUST_LOG||`error`}}),l=()=>{u(`shutting down...`),c.kill(`SIGTERM`)};return s.on(`SIGINT`,l),s.on(`SIGTERM`,l),c.on(`error`,e=>{f(`Failed to start rari server: ${e.message}`),e.message.includes(`ENOENT`)&&f(`Binary not found. Please ensure rari is properly installed.`),s.exit(1)}),c.on(`exit`,(e,t)=>{t?u(`server stopped by signal ${t}`):e===0?d(`server stopped successfully`):(f(`server exited with code ${e}`),s.exit(e||1))}),new Promise(()=>{})}async function I(){u(`Setting up Railway deployment...`),k()&&(f(`Already running in ${A()} environment. Use "rari start" instead.`),s.exit(1));let{createRailwayDeployment:e}=await import(`./railway-
|
|
3
|
+
`)){let t=h(e);t&&!s.env[t.key]&&(s.env[t.key]=t.value)}}g();const[,,_,...v]=s.argv;function y(e){let t=s.cwd();for(;;){let n=e(t);if(n!==null)return n;let r=o(t,`..`);if(r===t)break;t=r}return null}function b(e){return r(o(e,`pnpm-lock.yaml`))?`pnpm`:r(o(e,`yarn.lock`))?`yarn`:r(o(e,`bun.lockb`))?`bun`:r(o(e,`package-lock.json`))?`npm`:null}function x(e){try{let t=o(e,`package.json`);if(!r(t))return null;let n=JSON.parse(i(t,`utf-8`));if(n.packageManager?.startsWith(`pnpm`))return`pnpm`;if(n.packageManager?.startsWith(`yarn`))return`yarn`;if(n.packageManager?.startsWith(`bun`))return`bun`;if(n.packageManager?.startsWith(`npm`))return`npm`}catch{}return null}function S(){return y(e=>b(e)??x(e))??`npm`}function C(){let e=S(),t=s.platform===`win32`;switch(e){case`bun`:return t?`bun.cmd`:`bun`;case`pnpm`:return t?`pnpm.cmd`:`pnpm`;case`yarn`:return t?`yarn.cmd`:`yarn`;default:return t?`npx.cmd`:`npx`}}function w(){return y(e=>{try{let t=o(e,`package.json`);if(r(t)){let e=JSON.parse(i(t,`utf-8`)),n={...e.dependencies,...e.devDependencies};if(n[`vite-plus`])return`vp`;if(n.vite)return`vite`}}catch{}return null})??`vite`}function T(e,t,r={}){let i=s.platform===`win32`;if(e===`npx`){let e=C();if(e.includes(`bun`))return n(i?`bunx.cmd`:`bunx`,t,{...r,shell:i});if(e.includes(`pnpm`))return n(e,[`exec`,...t],{...r,shell:i});if(e.includes(`yarn`)){let[a,...o]=t;return n(e,a===`vp`?[`dlx`,`-p`,`vite-plus`,`vp`,...o]:[`dlx`,...t],{...r,shell:i})}}return i&&e===`npx`?n(`npx.cmd`,t,{...r,shell:!0}):n(e,t,r)}function E(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function D(){return!!(s.env.RAILWAY_ENVIRONMENT||s.env.RAILWAY_PROJECT_ID||s.env.RAILWAY_SERVICE_ID)}function O(){return!!(s.env.RENDER||s.env.RENDER_SERVICE_ID||s.env.RENDER_SERVICE_NAME)}function k(){return D()||O()}function A(){return D()?`Railway`:O()?`Render`:`local`}function j(){return{port:s.env.PORT||s.env.RSC_PORT||`3000`,mode:s.env.NODE_ENV||`production`,host:k()?`0.0.0.0`:`127.0.0.1`}}async function M(){let{existsSync:e,rmSync:t}=await import(`node:fs`),{resolve:n}=await import(`node:path`),r=n(s.cwd(),`dist`);e(r)&&(u(`Cleaning dist folder...`),t(r,{recursive:!0,force:!0})),u(`Type checking...`);let i=T(`npx`,[`tsgo`],{stdio:`inherit`,cwd:s.cwd()});await new Promise((e,t)=>{i.on(`exit`,n=>{n===0?(d(`Type check passed`),e()):(f(`Type check failed with code ${n}`),t(Error(`Type check failed with code ${n}`)))}),i.on(`error`,t)}),u(`Building for production...`);let a=T(`npx`,[w(),`build`],{stdio:`inherit`,cwd:s.cwd()});await new Promise((e,t)=>{a.on(`exit`,n=>{n===0?(d(`Build complete`),e()):(f(`Build failed with code ${n}`),t(Error(`Build failed with code ${n}`)))}),a.on(`error`,t)}),await N()}async function N(){if(r(o(s.cwd(),`dist`,`server`,`image.json`))&&r(o(s.cwd(),`public`)))try{let t=n(e(),[`optimize-images`],{stdio:`inherit`,cwd:s.cwd(),shell:!1});await new Promise(e=>{t.on(`exit`,t=>{t===0||p(`Image pre-optimization exited with code ${t}`),e()}),t.on(`error`,t=>{p(`Image pre-optimization error: ${E(t)}`),e()})})}catch(e){p(`Could not pre-optimize images: ${E(e)}`)}}async function P(){let{existsSync:e}=await import(`node:fs`),{resolve:t}=await import(`node:path`),n=w();if(!e(t(s.cwd(),`dist`))){u(`First run detected - building project...`);let e=T(`npx`,[n,`build`,`--mode`,`development`],{stdio:`inherit`,cwd:s.cwd()});await new Promise((t,n)=>{e.on(`exit`,e=>{e===0?(d(`Initial build complete`),t()):(f(`Build failed with code ${e}`),n(Error(`Build failed with code ${e}`)))}),e.on(`error`,n)})}u(`Starting Vite${n===`vp`?`+`:``} dev server...`);let r=T(`npx`,[n,`dev`],{stdio:`inherit`,cwd:s.cwd()}),i=()=>{u(`Shutting down dev server...`),r.kill(`SIGTERM`)};return s.on(`SIGINT`,i),s.on(`SIGTERM`,i),r.on(`error`,e=>{f(`Failed to start Vite: ${e.message}`),s.exit(1)}),r.on(`exit`,e=>{e!==0&&e!==null&&(f(`Vite exited with code ${e}`),s.exit(e))}),new Promise(()=>{})}async function F(){let r;try{r=e()}catch{f(`Failed to obtain rari binary`),f(t()),s.exit(1)}let{port:i,mode:a,host:o}=j();if(k()){let e=A();u(`${e} environment detected`),u(`Starting rari server for ${e} deployment...`),u(`Mode: ${a}, Host: ${o}, Port: ${i}`),u(`using binary: ${r}`)}let c=n(r,[`--mode`,a,`--port`,i,`--host`,o],{stdio:`inherit`,cwd:s.cwd(),env:{...s.env,RUST_LOG:s.env.RUST_LOG||`error`}}),l=()=>{u(`shutting down...`),c.kill(`SIGTERM`)};return s.on(`SIGINT`,l),s.on(`SIGTERM`,l),c.on(`error`,e=>{f(`Failed to start rari server: ${e.message}`),e.message.includes(`ENOENT`)&&f(`Binary not found. Please ensure rari is properly installed.`),s.exit(1)}),c.on(`exit`,(e,t)=>{t?u(`server stopped by signal ${t}`):e===0?d(`server stopped successfully`):(f(`server exited with code ${e}`),s.exit(e||1))}),new Promise(()=>{})}async function I(){u(`Setting up Railway deployment...`),k()&&(f(`Already running in ${A()} environment. Use "rari start" instead.`),s.exit(1));let{createRailwayDeployment:e}=await import(`./railway-bxKRJ0Cg.mjs`);await e()}async function L(){u(`Setting up Render deployment...`),k()&&(f(`Already running in ${A()} environment. Use "rari start" instead.`),s.exit(1));let{createRenderDeployment:e}=await import(`./render-CXNCiz-E.mjs`);await e()}async function R(){switch(_){case void 0:case`help`:case`--help`:case`-h`:console.warn(`${l(`bold`,`rari CLI`)}
|
|
4
4
|
|
|
5
5
|
${l(`bold`,`Usage:`)}
|
|
6
6
|
${l(`cyan`,`rari dev`)} Start the development server with Vite
|
package/dist/client.d.mts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { C as hasServerSideDataFetching, S as extractStaticParams, _ as clearPropsCache, a as DefaultLoading, b as extractServerProps, c as LoadingSpinner, d as createErrorBoundary, f as createHttpRuntimeClient, g as StaticParamsResult, h as ServerSidePropsResult, i as DefaultError, l as NotFound, m as MetadataResult, o as ErrorBoundary, p as createLoadingBoundary, r as ServerConfig, s as HttpRuntimeClient, t as ServerCSPConfig, u as RuntimeClient, v as clearPropsCacheForComponent, x as extractServerPropsWithCache, y as extractMetadata } from "./server-config-
|
|
2
|
-
import { a as ErrorProps, c as LayoutEntry, f as NotFoundEntry, h as RouteSegmentType, i as ErrorEntry, m as RouteSegment, n as AppRouteManifest, o as GenerateMetadata, r as AppRouteMatch, s as GenerateStaticParams, t as AppRouteEntry, u as LoadingEntry } from "./types-
|
|
1
|
+
import { C as hasServerSideDataFetching, S as extractStaticParams, _ as clearPropsCache, a as DefaultLoading, b as extractServerProps, c as LoadingSpinner, d as createErrorBoundary, f as createHttpRuntimeClient, g as StaticParamsResult, h as ServerSidePropsResult, i as DefaultError, l as NotFound, m as MetadataResult, o as ErrorBoundary, p as createLoadingBoundary, r as ServerConfig, s as HttpRuntimeClient, t as ServerCSPConfig, u as RuntimeClient, v as clearPropsCacheForComponent, x as extractServerPropsWithCache, y as extractMetadata } from "./server-config-CwWYmtA0.mjs";
|
|
2
|
+
import { a as ErrorProps, c as LayoutEntry, f as NotFoundEntry, h as RouteSegmentType, i as ErrorEntry, m as RouteSegment, n as AppRouteManifest, o as GenerateMetadata, r as AppRouteMatch, s as GenerateStaticParams, t as AppRouteEntry, u as LoadingEntry } from "./types-m74grfbN.mjs";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { Component, ErrorInfo, ReactNode } from "react";
|
|
5
|
-
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
5
|
|
|
7
6
|
//#region src/router/ClientRouter.d.ts
|
|
8
7
|
interface ClientRouterProps {
|
|
@@ -14,7 +13,7 @@ declare function ClientRouter({
|
|
|
14
13
|
children,
|
|
15
14
|
initialRoute,
|
|
16
15
|
staleWindowMs
|
|
17
|
-
}: ClientRouterProps):
|
|
16
|
+
}: ClientRouterProps): import("react/jsx-runtime").JSX.Element;
|
|
18
17
|
//#endregion
|
|
19
18
|
//#region src/router/LayoutErrorBoundary.d.ts
|
|
20
19
|
interface LayoutErrorBoundaryProps {
|
|
@@ -80,7 +79,7 @@ declare function NavigationErrorOverlay({
|
|
|
80
79
|
onDismiss,
|
|
81
80
|
retryCount,
|
|
82
81
|
maxRetries
|
|
83
|
-
}: NavigationErrorOverlayProps):
|
|
82
|
+
}: NavigationErrorOverlayProps): import("react/jsx-runtime").JSX.Element;
|
|
84
83
|
//#endregion
|
|
85
84
|
//#region src/router/route-info-types.d.ts
|
|
86
85
|
interface RouteInfoRequest {
|
|
@@ -140,4 +139,4 @@ declare class StatePreserver {
|
|
|
140
139
|
private restoreFocus;
|
|
141
140
|
}
|
|
142
141
|
//#endregion
|
|
143
|
-
export { type AppRouteEntry, type AppRouteManifest, type AppRouteMatch, ClientRouter, type ClientRouterProps, DefaultError, DefaultLoading, ErrorBoundary, type ErrorEntry, type ErrorProps, type GenerateMetadata, type GenerateStaticParams, HttpRuntimeClient, type LayoutEntry, LayoutErrorBoundary, type LoadingEntry, LoadingSpinner, type MetadataResult, type NavigationError, NavigationErrorHandler, type NavigationErrorHandlerOptions, NavigationErrorOverlay, type NavigationErrorOverlayProps, type NavigationErrorType, NotFound, type NotFoundEntry, type PreservedState, RouteInfoError, RouteInfoRequest, RouteInfoResponse, type RouteSegment, type RouteSegmentType, type RuntimeClient, type ScrollPosition, type ServerCSPConfig, type ServerConfig, type ServerSidePropsResult, StatePreserver, type StatePreserverConfig, type StaticParamsResult, clearPropsCache, clearPropsCacheForComponent, createErrorBoundary, createHttpRuntimeClient, createLoadingBoundary, extractMetadata, extractServerProps, extractServerPropsWithCache, extractStaticParams, hasServerSideDataFetching };
|
|
142
|
+
export { type AppRouteEntry, type AppRouteManifest, type AppRouteMatch, ClientRouter, type ClientRouterProps, DefaultError, DefaultLoading, ErrorBoundary, type ErrorEntry, type ErrorProps, type GenerateMetadata, type GenerateStaticParams, HttpRuntimeClient, type LayoutEntry, LayoutErrorBoundary, type LoadingEntry, LoadingSpinner, type MetadataResult, type NavigationError, NavigationErrorHandler, type NavigationErrorHandlerOptions, NavigationErrorOverlay, type NavigationErrorOverlayProps, type NavigationErrorType, NotFound, type NotFoundEntry, type PreservedState, type RouteInfoError, type RouteInfoRequest, type RouteInfoResponse, type RouteSegment, type RouteSegmentType, type RuntimeClient, type ScrollPosition, type ServerCSPConfig, type ServerConfig, type ServerSidePropsResult, StatePreserver, type StatePreserverConfig, type StaticParamsResult, clearPropsCache, clearPropsCacheForComponent, createErrorBoundary, createHttpRuntimeClient, createLoadingBoundary, extractMetadata, extractServerProps, extractServerPropsWithCache, extractStaticParams, hasServerSideDataFetching };
|
package/dist/client.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e,t}from"./navigate-hfIqe3MK.mjs";import{_ as n,a as r,c as i,d as a,f as o,g as s,h as c,i as l,l as u,m as d,n as f,o as p,p as m,r as h,s as g,t as _}from"./runtime-client-CbbckLpl.mjs";import{Component as v,useEffect as y,useLayoutEffect as b,useRef as x,useState as S}from"react";import{Fragment as C,jsx as w,jsxs as T}from"react/jsx-runtime";function E(e,t,n={}){let r=null,i=0,a=0,o=null,s=null,{leading:c=!1,trailing:l=!0,maxWait:u}=n;function d(t){let n=o,r=s;return o=null,s=null,a=t,e.apply(r,n)}function f(e){let n=e-i,r=e-a;return i===0||n>=t||n<0||u!==void 0&&r>=u}function p(){let e=Date.now();if(f(e))return h(e);let n=e-i,o=e-a,s=t-n,c=u===void 0?1/0:u-o;r=setTimeout(p,Math.min(s,c))}function m(e){return a=e,r=setTimeout(p,t),c?d(e):void 0}function h(e){if(r=null,l&&o)return d(e);o=null,s=null}function g(){r!==null&&clearTimeout(r),a=0,o=null,i=0,s=null,r=null}function _(){return r===null?void 0:h(Date.now())}function v(){return r!==null}function y(...e){let n=Date.now(),a=f(n);if(o=e,s=this,i=n,a){if(r===null)return m(i);if(u!==void 0)return r=setTimeout(p,t),d(i)}r===null&&(r=setTimeout(p,t))}return y.cancel=g,y.flush=_,y.pending=v,y}const D=/fetch|networkerror|load failed/i;function O(e,t){return{type:`abort`,message:`Navigation was cancelled`,originalError:e,url:t,timestamp:Date.now(),retryable:!1}}function k(e,t){return{type:`timeout`,message:`Navigation request timed out`,originalError:e,url:t,timestamp:Date.now(),retryable:!0}}function A(e,t,n){if(t===404)return{type:`not-found`,message:`Page not found`,originalError:e,statusCode:t,url:n,timestamp:Date.now(),retryable:!1};if(t>=500)return{type:`server-error`,message:`Server error: ${t}`,originalError:e,statusCode:t,url:n,timestamp:Date.now(),retryable:!0};let r=t===408||t===429;return{type:`fetch-error`,message:`HTTP error: ${t}`,originalError:e,statusCode:t,url:n,timestamp:Date.now(),retryable:r}}function j(e,t){return{type:`network-error`,message:`Network error - check your connection`,originalError:e,url:t,timestamp:Date.now(),retryable:!0}}function M(e,t){return{type:`parse-error`,message:`Failed to parse server response`,originalError:e instanceof Error?e:void 0,url:t,timestamp:Date.now(),retryable:!1}}function N(e,t){return{type:`fetch-error`,message:e instanceof Error?e.message:`Unknown error occurred`,originalError:e instanceof Error?e:void 0,url:t,timestamp:Date.now(),retryable:!1}}function P(e,t){if(e instanceof Error&&e.name===`AbortError`)return O(e,t);if(e instanceof Error&&(e.name===`TimeoutError`||e.message.includes(`timeout`)))return k(e,t);if(e instanceof Error&&`status`in e){let n=e.status;return typeof n==`number`?A(e,n,t):N(e,t)}return e instanceof TypeError&&D.test(e.message)?j(e,t):e instanceof SyntaxError||e instanceof Error&&e.message.includes(`parse`)?M(e,t):N(e,t)}var F=class{options;retryCount;constructor(e={}){this.options={timeout:e.timeout??1e4,maxRetries:e.maxRetries??3,onError:e.onError??(()=>{}),onRetry:e.onRetry??(()=>{})},this.retryCount=new Map}handleError(e,t){let n=P(e,t);return this.options.onError(n),console.error(`[rari] Navigation:`,n.type,n.message,{url:n.url,statusCode:n.statusCode,retryable:n.retryable}),n}canRetry(e,t){return e.retryable?(this.retryCount.get(t)??0)<this.options.maxRetries:!1}incrementRetry(e){let t=(this.retryCount.get(e)??0)+1;return this.retryCount.set(e,t),this.options.onRetry(t,{type:`fetch-error`,message:`Retry attempt ${t}`,url:e,timestamp:Date.now(),retryable:!0}),t}resetRetry(e){this.retryCount.delete(e)}getRetryCount(e){return this.retryCount.get(e)??0}clearRetries(){this.retryCount.clear()}};function I(e){if(!e||e===`/`)return`/`;let t=e;for(;t.endsWith(`/`)&&t.length>1;)t=t.slice(0,-1);return t.startsWith(`/`)||(t=`/${t}`),t}function L(e,t){try{return new URL(e,t||window.location.origin).origin!==(t||window.location.origin)}catch{return!1}}function R(e){try{let t=new URL(e,window.location.origin);return t.pathname+t.hash}catch{return e}}function z({error:e,onRetry:t,onReload:n,onDismiss:r,retryCount:i=0,maxRetries:a=3}){let o=e.retryable&&i<a;return w(`div`,{style:{position:`fixed`,top:0,left:0,right:0,bottom:0,background:`rgba(0, 0, 0, 0.5)`,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:1e4,padding:`20px`},onClick:e=>{e.target===e.currentTarget&&r&&r()},children:T(`div`,{style:{background:`white`,borderRadius:`8px`,padding:`24px`,maxWidth:`500px`,width:`100%`,boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`},onClick:e=>e.stopPropagation(),children:[T(`div`,{style:{display:`flex`,alignItems:`center`,gap:`12px`,marginBottom:`16px`},children:[w(`span`,{style:{fontSize:`32px`},children:(()=>{switch(e.type){case`timeout`:return`⏱️`;case`network-error`:return`📡`;case`not-found`:return`🔍`;case`server-error`:return`⚠️`;case`parse-error`:return`📄`;case`abort`:return`🚫`;default:return`❌`}})()}),w(`h2`,{style:{margin:0,fontSize:`20px`,fontWeight:`600`,color:`#1f2937`},children:`Navigation Error`})]}),w(`p`,{style:{margin:`0 0 16px 0`,fontSize:`15px`,lineHeight:`1.5`,color:`#4b5563`},children:(()=>{switch(e.type){case`timeout`:return`The page took too long to load. Please try again.`;case`network-error`:return`Unable to connect to the server. Please check your internet connection.`;case`not-found`:return`The page you're looking for doesn't exist.`;case`server-error`:return`The server encountered an error. Please try again in a moment.`;case`parse-error`:return`Unable to load the page content. Please try reloading.`;case`abort`:return`Navigation was cancelled.`;default:return e.message||`An unexpected error occurred.`}})()}),e.url&&T(`details`,{style:{marginBottom:`16px`,fontSize:`13px`,color:`#6b7280`},children:[w(`summary`,{style:{cursor:`pointer`,userSelect:`none`,marginBottom:`8px`},children:`Technical details`}),T(`div`,{style:{padding:`12px`,background:`#f9fafb`,borderRadius:`4px`,fontFamily:`monospace`,fontSize:`12px`,wordBreak:`break-all`},children:[T(`div`,{style:{marginBottom:`4px`},children:[w(`strong`,{children:`URL:`}),` `,e.url]}),e.statusCode&&T(`div`,{style:{marginBottom:`4px`},children:[w(`strong`,{children:`Status:`}),` `,e.statusCode]}),T(`div`,{style:{marginBottom:`4px`},children:[w(`strong`,{children:`Type:`}),` `,e.type]}),e.originalError&&T(`div`,{children:[w(`strong`,{children:`Error:`}),` `,e.originalError.message]})]})]}),o&&i>0&&T(`div`,{style:{marginBottom:`16px`,padding:`8px 12px`,background:`#fef3c7`,border:`1px solid #fbbf24`,borderRadius:`4px`,fontSize:`13px`,color:`#92400e`},children:[`Retry attempt`,` `,i,` `,`of`,` `,a]}),T(`div`,{style:{display:`flex`,gap:`8px`,flexWrap:`wrap`},children:[o&&t&&w(`button`,{onClick:t,type:`button`,style:{flex:1,minWidth:`120px`,padding:`10px 16px`,background:`#3b82f6`,color:`white`,border:`none`,borderRadius:`6px`,fontSize:`14px`,fontWeight:`500`,cursor:`pointer`,transition:`background 0.2s`},onMouseEnter:e=>{e.currentTarget.style.background=`#2563eb`},onMouseLeave:e=>{e.currentTarget.style.background=`#3b82f6`},children:`Try Again`}),n&&w(`button`,{onClick:n,type:`button`,style:{flex:1,minWidth:`120px`,padding:`10px 16px`,background:`#6b7280`,color:`white`,border:`none`,borderRadius:`6px`,fontSize:`14px`,fontWeight:`500`,cursor:`pointer`,transition:`background 0.2s`},onMouseEnter:e=>{e.currentTarget.style.background=`#4b5563`},onMouseLeave:e=>{e.currentTarget.style.background=`#6b7280`},children:`Reload Page`}),r&&w(`button`,{onClick:r,type:`button`,style:{flex:1,minWidth:`120px`,padding:`10px 16px`,background:`transparent`,color:`#6b7280`,border:`1px solid #d1d5db`,borderRadius:`6px`,fontSize:`14px`,fontWeight:`500`,cursor:`pointer`,transition:`all 0.2s`},onMouseEnter:e=>{e.currentTarget.style.background=`#f9fafb`,e.currentTarget.style.borderColor=`#9ca3af`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`,e.currentTarget.style.borderColor=`#d1d5db`},children:`Dismiss`})]}),w(`p`,{style:{marginTop:`16px`,marginBottom:0,fontSize:`12px`,color:`#9ca3af`,textAlign:`center`},children:`Your current page is still available below this message`})]})})}const B=new class{cache=new Map;pendingRequests=new Map;async get(e){let t=this.cache.get(e);if(t)return t;let n=this.pendingRequests.get(e);if(n)return n;let r=this.fetchRouteInfo(e);this.pendingRequests.set(e,r);try{let t=await r;return this.cache.set(e,t),t}finally{this.pendingRequests.delete(e)}}async fetchRouteInfo(e){let t=await fetch(`/_rari/route-info`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})});if(!t.ok){let e=null;try{e=await t.json()}catch{}throw e?.error?Error(e.error):Error(`Failed to fetch route info: ${t.status} ${t.statusText}`)}let n=t.clone();try{return await t.json()}catch(t){try{let e=await n.text();return JSON.parse(e)}catch(n){throw console.error(`[RouteInfo] Failed to parse response:`,{error:t,parseError:n,path:e}),Error(`Failed to parse route info response`)}}}clear(){this.cache.clear(),this.pendingRequests.clear()}invalidate(e){this.cache.delete(e)}};if(typeof window<`u`){let e=window[`~rari`]||{};window[`~rari`]||(window[`~rari`]=e),e.routeInfoCache=B}var V=class{stateHistory;routeAccessOrder;maxHistorySize;scrollableSelector;constructor(e={}){this.stateHistory=new Map,this.routeAccessOrder=[],this.maxHistorySize=e.maxHistorySize||50,this.scrollableSelector=e.scrollableSelector||`[data-scrollable], .scrollable, [style*="overflow"]`}captureState(e){let t={scrollPositions:this.captureScrollPositions(),formData:this.captureFormData(),focusedElement:this.captureFocusedElement()};return this.storeState(e,t),t}captureScrollPositions(){let e=new Map;try{e.set(`window`,{x:window.scrollX,y:window.scrollY,element:`window`}),document.querySelectorAll(this.scrollableSelector).forEach((t,n)=>{if(t instanceof HTMLElement){let r=t.id||`scrollable-${n}`;(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)&&e.set(r,{x:t.scrollLeft,y:t.scrollTop,element:r})}})}catch{}return e}captureFormData(){let e=new Map;try{document.querySelectorAll(`form`).forEach((t,n)=>{let r=t.id||t.name||`form-${n}`,i=new FormData(t);i.entries().next().done||e.set(r,i)})}catch{}return e}captureFocusedElement(){try{let e=document.activeElement;if(e&&e!==document.body){if(e.id)return`#${e.id}`;if((e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.name)return`[name="${e.name}"]`}}catch{}return null}storeState(e,t){let n=this.routeAccessOrder.indexOf(e);for(n!==-1&&this.routeAccessOrder.splice(n,1),this.routeAccessOrder.push(e),this.stateHistory.set(e,t);this.routeAccessOrder.length>this.maxHistorySize;){let e=this.routeAccessOrder.shift();e&&this.stateHistory.delete(e)}}getHistorySize(){return this.stateHistory.size}hasState(e){return this.stateHistory.has(e)}getState(e){return this.stateHistory.get(e)}clearAll(){this.stateHistory.clear(),this.routeAccessOrder=[]}clearState(e){this.stateHistory.delete(e);let t=this.routeAccessOrder.indexOf(e);t!==-1&&this.routeAccessOrder.splice(t,1)}restoreState(e){let t=this.stateHistory.get(e);if(!t)return!1;let n=!0;return this.restoreScrollPositions(t.scrollPositions)||(n=!1),this.restoreFormData(t.formData)||(n=!1),t.focusedElement&&this.restoreFocus(t.focusedElement),n}restoreScrollPositions(e){let t=!0;try{e.forEach((e,n)=>{try{if(n===`window`)window.scrollTo(e.x,e.y);else{let r=document.getElementById(n)||document.querySelector(`[data-scrollable-id="${n}"]`);r instanceof HTMLElement?(r.scrollLeft=e.x,r.scrollTop=e.y):t=!1}}catch{t=!1}})}catch(e){console.error(`[rari] Router: Failed to restore scroll positions:`,e),t=!1}return t}restoreFormData(e){let t=!0;try{e.forEach((e,n)=>{try{let r=document.getElementById(n)||document.querySelector(`form[name="${n}"]`)||document.querySelectorAll(`form`)[Number.parseInt(n.replace(`form-`,``),10)];r instanceof HTMLFormElement?e.forEach((e,n)=>{try{let t=r.elements.namedItem(n);t instanceof RadioNodeList?t.forEach(t=>{t instanceof HTMLInputElement&&(t.type===`radio`||t.type===`checkbox`?t.checked=t.value===e:t.value=e)}):(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)&&(t instanceof HTMLInputElement&&(t.type===`checkbox`||t.type===`radio`)?t.checked=t.value===e:t.value=e)}catch{t=!1}}):t=!1}catch{t=!1}})}catch(e){console.error(`[rari] Router: Failed to restore form data:`,e),t=!1}return t}restoreFocus(e){try{let t=document.querySelector(e);t instanceof HTMLElement&&requestAnimationFrame(()=>{try{t.focus()}catch{}})}catch{}}};function H(e,t){let n=document.querySelector(e);if(n)t.content&&n.setAttribute(`content`,t.content);else{n=document.createElement(`meta`);for(let[e,r]of Object.entries(t))n.setAttribute(e,r);document.head.appendChild(n)}}function U(e){let t=document.querySelector(e);t&&t.remove()}function W(e){e.title&&(document.title=e.title),e.description?H(`meta[name="description"]`,{name:`description`,content:e.description}):U(`meta[name="description"]`),e.keywords&&e.keywords.length>0?H(`meta[name="keywords"]`,{name:`keywords`,content:e.keywords.join(`, `)}):U(`meta[name="keywords"]`),e.viewport&&H(`meta[name="viewport"]`,{name:`viewport`,content:e.viewport})}function G(e){let t=document.querySelector(`link[rel="canonical"]`);if(e===void 0){t&&t.remove();return}if(t)t.setAttribute(`href`,e);else{let t=document.createElement(`link`);t.setAttribute(`rel`,`canonical`),t.setAttribute(`href`,e),document.head.appendChild(t)}}function K(e){if(e===void 0){U(`meta[name="robots"]`);return}let t=[];e.index!==void 0&&t.push(e.index?`index`:`noindex`),e.follow!==void 0&&t.push(e.follow?`follow`:`nofollow`),e.nocache&&t.push(`nocache`),t.length>0?H(`meta[name="robots"]`,{name:`robots`,content:t.join(`, `)}):U(`meta[name="robots"]`)}function q(e){if(e===void 0){U(`meta[property="og:title"]`),U(`meta[property="og:description"]`),U(`meta[property="og:url"]`),U(`meta[property="og:site_name"]`),U(`meta[property="og:type"]`),document.querySelectorAll(`meta[property="og:image"]`).forEach(e=>e.remove());return}if(e.title?H(`meta[property="og:title"]`,{property:`og:title`,content:e.title}):U(`meta[property="og:title"]`),e.description?H(`meta[property="og:description"]`,{property:`og:description`,content:e.description}):U(`meta[property="og:description"]`),e.url?H(`meta[property="og:url"]`,{property:`og:url`,content:e.url}):U(`meta[property="og:url"]`),e.siteName?H(`meta[property="og:site_name"]`,{property:`og:site_name`,content:e.siteName}):U(`meta[property="og:site_name"]`),e.type?H(`meta[property="og:type"]`,{property:`og:type`,content:e.type}):U(`meta[property="og:type"]`),e.images&&e.images.length>0){document.querySelectorAll(`meta[property="og:image"]`).forEach(e=>e.remove());for(let t of e.images){let e=document.createElement(`meta`);e.setAttribute(`property`,`og:image`),e.setAttribute(`content`,t),document.head.appendChild(e)}}else document.querySelectorAll(`meta[property="og:image"]`).forEach(e=>e.remove())}function J(e){if(e===void 0){U(`meta[name="twitter:card"]`),U(`meta[name="twitter:site"]`),U(`meta[name="twitter:creator"]`),U(`meta[name="twitter:title"]`),U(`meta[name="twitter:description"]`),document.querySelectorAll(`meta[name="twitter:image"]`).forEach(e=>e.remove());return}if(e.card?H(`meta[name="twitter:card"]`,{name:`twitter:card`,content:e.card}):U(`meta[name="twitter:card"]`),e.site?H(`meta[name="twitter:site"]`,{name:`twitter:site`,content:e.site}):U(`meta[name="twitter:site"]`),e.creator?H(`meta[name="twitter:creator"]`,{name:`twitter:creator`,content:e.creator}):U(`meta[name="twitter:creator"]`),e.title?H(`meta[name="twitter:title"]`,{name:`twitter:title`,content:e.title}):U(`meta[name="twitter:title"]`),e.description?H(`meta[name="twitter:description"]`,{name:`twitter:description`,content:e.description}):U(`meta[name="twitter:description"]`),e.images&&e.images.length>0){document.querySelectorAll(`meta[name="twitter:image"]`).forEach(e=>e.remove());for(let t of e.images){let e=document.createElement(`meta`);e.setAttribute(`name`,`twitter:image`),e.setAttribute(`content`,t),document.head.appendChild(e)}}else document.querySelectorAll(`meta[name="twitter:image"]`).forEach(e=>e.remove())}function Y(e){W(e),G(e.canonical),K(e.robots),q(e.openGraph),J(e.twitter)}function X({children:n,initialRoute:r,staleWindowMs:i=3e4}){let[a,o]=S(()=>({currentRoute:I(r),navigationId:0,error:null})),s=x(null),c=x(!0),l=x(I(r)),u=x(0),d=x(new F({timeout:1e4,maxRetries:3,onError:e=>{console.error(`[rari] Router: Navigation error:`,e)},onRetry:()=>{}})),f=x(new Map),p=x([]),m=x(new V({maxHistorySize:50})),h=x(null),g=x(i),_=()=>`${Date.now()}-${Math.random().toString(36).substring(2,9)}`,v=()=>{s.current&&=(s.current.abort(),null)},D=()=>{for(let[,e]of f.current.entries())e.abortController.abort();f.current.clear()},O=(e,t)=>{f.current.delete(e),c.current&&a.navigationId===t&&o(e=>({...e}))},k=x(null),A=(e,t)=>{if(!t)return;let n=document.getElementById(t);n&&(n.scrollIntoView({behavior:`smooth`,block:`start`}),window.history.pushState(window.history.state,``,`${e}#${t}`))},j=e=>{try{let t=e.headers.get(`x-rari-metadata`);t&&Y(JSON.parse(decodeURIComponent(t)))}catch(e){console.warn(`[rari] Router: Failed to parse x-rari-metadata header:`,e)}},M=(e,t,n,r,i,a)=>{u.current===r&&window.dispatchEvent(new CustomEvent(`rari:navigate`,{detail:{from:t,to:n,navigationId:r,options:i,abortSignal:a.signal,rscResponsePromise:e}}))},N=(e,t,n)=>{n.historyKey?requestAnimationFrame(()=>{m.current.restoreState(e)}):t&&requestAnimationFrame(()=>{let e=(n=0)=>{let r=document.getElementById(t);r?r.scrollIntoView({behavior:`smooth`,block:`start`}):n<10&&setTimeout(e,50,n+1)};e()})},P=(e,t,n,r)=>{c.current&&(l.current=e,o(t=>({...t,currentRoute:e,navigationId:r,error:null})),d.current.resetRetry(e),N(e,t,n))},H=(e,t,n,r)=>{if(e instanceof Error&&e.name===`AbortError`){O(t,n);return}let i=d.current.handleError(e,t);c.current&&(o(e=>({...e,error:i})),window.history.replaceState(window.history.state,``,r)),f.current.delete(t),window.dispatchEvent(new CustomEvent(`rari:navigate-error`,{detail:{from:r,to:t,error:i,navigationId:n}})),k.current?.()},U=async(e,t={})=>{if(!e||typeof e!=`string`)return;let[n,r]=e.includes(`#`)?e.split(`#`):[e,``],i=I(n);if(i===l.current&&!t.replace){A(i,r);return}let a=f.current.get(i);if(a)return a.promise;D(),v();let o=new AbortController;s.current=o,u.current+=1;let c=u.current;window.dispatchEvent(new CustomEvent(`rari:navigation-start`,{detail:{navigationId:c,targetPath:i}}));let d=(async()=>{let e=l.current;try{t.historyKey||m.current.captureState(e);let n=t.historyKey||_(),a=window.location.origin+i,s=r?`${i}#${r}`:i,l={route:i,navigationId:c,scrollPosition:{x:window.scrollX,y:window.scrollY},timestamp:Date.now(),key:n};t.replace?window.history.replaceState(l,``,s):window.history.pushState(l,``,s);let u=await fetch(a,{headers:{Accept:`text/x-component`},signal:o.signal}).then(e=>{if(!e.ok&&e.status!==404)throw Error(`Failed to fetch: ${e.status}`);return e});if(o.signal.aborted){O(i,c);return}let d=new URL(u.url).pathname;if(o.signal.aborted){O(i,c);return}if(d!==i){let e=r?`${d}#${r}`:d;window.history.replaceState({...l,route:d},``,e)}if(M(Promise.resolve(u),e,d,c,t,o),j(u),o.signal.aborted){O(i,c);return}P(d,r,t,c),f.current.delete(i),k.current?.()}catch(t){H(t,i,c,e)}})();return f.current.set(i,{targetPath:i,navigationId:c,promise:d,abortController:o}),d},W=async()=>{if(p.current.length===0)return;let e=p.current.at(-1);e&&(p.current=[],await U(e.path,e.options))},G=x(U);b(()=>(k.current=W,G.current=U,()=>{k.current=null,G.current=null}));let K=x(null);K.current||=E((e,t)=>{G.current?.(e,t)},50,{leading:!0,trailing:!0,maxWait:200});let q=e=>{if(e.button!==0||e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;let t=e.target;for(;t&&t.tagName!==`A`;)t=t.parentElement;if(!t||t.tagName!==`A`)return;let n=t;if(n.target&&n.target!==`_self`||n.hasAttribute(`download`))return;let r=n.getAttribute(`href`);if(!r||L(r))return;if(r.startsWith(`#`)){e.preventDefault();let t=r.slice(1),n=document.getElementById(t);n&&(n.scrollIntoView({behavior:`smooth`,block:`start`}),window.history.pushState(window.history.state,``,r));return}e.preventDefault();let i=R(r);K.current&&K.current(i,{replace:!1})},J=e=>{let t=window.location.pathname,n=e.state;G.current&&G.current(t,{replace:!0,scroll:!1,historyKey:n?.key})},X=()=>{if(a.error&&a.error.url){let e=a.error.url;d.current.incrementRetry(e),U(e,{replace:!1})}},Z=()=>{window.location.reload()},ee=()=>{o(e=>({...e,error:null}))};y(()=>{let e=window.history.state;if(!e||!e.key){let e={route:I(r),navigationId:0,scrollPosition:{x:window.scrollX,y:window.scrollY},timestamp:Date.now(),key:_()};window.history.replaceState(e,``,window.location.pathname+window.location.search+window.location.hash)}},[r]);let Q=e=>{if(e.persisted){let e=window.location.pathname;m.current.captureState(e)}},$=e=>{if(e.persisted){let e=window.location.pathname,t=window.history.state;requestAnimationFrame(()=>{m.current.restoreState(e),t?.scrollPosition&&window.scrollTo(t.scrollPosition.x,t.scrollPosition.y)})}};return y(()=>(document.addEventListener(`click`,q),window.addEventListener(`popstate`,J),window.addEventListener(`pagehide`,Q),window.addEventListener(`pageshow`,$),()=>{document.removeEventListener(`click`,q),window.removeEventListener(`popstate`,J),window.removeEventListener(`pagehide`,Q),window.removeEventListener(`pageshow`,$)}),[]),y(()=>{g.current=i;let e=()=>{document.hidden?h.current=Date.now():h.current!==null&&Date.now()-h.current>g.current&&B.clear()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[i]),y(()=>(c.current=!0,e((e,t)=>G.current?.(e,t)??Promise.resolve()),()=>{c.current=!1,t(),v(),D(),K.current?.cancel&&K.current.cancel()}),[]),T(C,{children:[n,a.error&&w(z,{error:a.error,onRetry:X,onReload:Z,onDismiss:ee,retryCount:d.current.getRetryCount(a.error.url||``),maxRetries:3})]})}var Z=class extends v{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[rari] Layout: Error in layout "${this.props.layoutPath}":`,e,t),this.props.onError&&this.props.onError(e,t),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`rari:layout-error`,{detail:{layoutPath:this.props.layoutPath,error:e,errorInfo:t,timestamp:Date.now()}}))}reset=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback(this.state.error,this.reset):T(`div`,{style:{padding:`16px`,margin:`16px 0`,background:`#fee`,border:`1px solid #fcc`,borderRadius:`4px`},children:[w(`h3`,{style:{margin:`0 0 8px 0`,color:`#c00`},children:`Layout Error`}),T(`p`,{style:{margin:`0 0 8px 0`,fontSize:`14px`},children:[`An error occurred in layout:`,` `,w(`code`,{children:this.props.layoutPath})]}),T(`details`,{style:{fontSize:`12px`,marginBottom:`8px`},children:[w(`summary`,{style:{cursor:`pointer`},children:`Error details`}),T(`pre`,{style:{marginTop:`8px`,padding:`8px`,background:`#fff`,border:`1px solid #ddd`,borderRadius:`2px`,overflow:`auto`},children:[this.state.error.message,`
|
|
1
|
+
import{i as e,t}from"./navigate-DuyUa6qD.mjs";import{_ as n,a as r,c as i,d as a,f as o,g as s,h as c,i as l,l as u,m as d,n as f,o as p,p as m,r as h,s as g,t as _}from"./runtime-client-DHeO6y_7.mjs";import{Component as v,useEffect as y,useLayoutEffect as b,useRef as x,useState as S}from"react";import{Fragment as C,jsx as w,jsxs as T}from"react/jsx-runtime";function E(e,t,n={}){let r=null,i=0,a=0,o=null,s=null,{leading:c=!1,trailing:l=!0,maxWait:u}=n;function d(t){let n=o,r=s;return o=null,s=null,a=t,e.apply(r,n)}function f(e){let n=e-i,r=e-a;return i===0||n>=t||n<0||u!==void 0&&r>=u}function p(){let e=Date.now();if(f(e))return h(e);let n=e-i,o=e-a,s=t-n,c=u===void 0?1/0:u-o;r=setTimeout(p,Math.min(s,c))}function m(e){return a=e,r=setTimeout(p,t),c?d(e):void 0}function h(e){if(r=null,l&&o)return d(e);o=null,s=null}function g(){r!==null&&clearTimeout(r),a=0,o=null,i=0,s=null,r=null}function _(){return r===null?void 0:h(Date.now())}function v(){return r!==null}function y(...e){let n=Date.now(),a=f(n);if(o=e,s=this,i=n,a){if(r===null)return m(i);if(u!==void 0)return r=setTimeout(p,t),d(i)}r===null&&(r=setTimeout(p,t))}return y.cancel=g,y.flush=_,y.pending=v,y}const D=/fetch|networkerror|load failed/i;function O(e,t){return{type:`abort`,message:`Navigation was cancelled`,originalError:e,url:t,timestamp:Date.now(),retryable:!1}}function k(e,t){return{type:`timeout`,message:`Navigation request timed out`,originalError:e,url:t,timestamp:Date.now(),retryable:!0}}function A(e,t,n){if(t===404)return{type:`not-found`,message:`Page not found`,originalError:e,statusCode:t,url:n,timestamp:Date.now(),retryable:!1};if(t>=500)return{type:`server-error`,message:`Server error: ${t}`,originalError:e,statusCode:t,url:n,timestamp:Date.now(),retryable:!0};let r=t===408||t===429;return{type:`fetch-error`,message:`HTTP error: ${t}`,originalError:e,statusCode:t,url:n,timestamp:Date.now(),retryable:r}}function j(e,t){return{type:`network-error`,message:`Network error - check your connection`,originalError:e,url:t,timestamp:Date.now(),retryable:!0}}function M(e,t){return{type:`parse-error`,message:`Failed to parse server response`,originalError:e instanceof Error?e:void 0,url:t,timestamp:Date.now(),retryable:!1}}function N(e,t){return{type:`fetch-error`,message:e instanceof Error?e.message:`Unknown error occurred`,originalError:e instanceof Error?e:void 0,url:t,timestamp:Date.now(),retryable:!1}}function P(e,t){if(e instanceof Error&&e.name===`AbortError`)return O(e,t);if(e instanceof Error&&(e.name===`TimeoutError`||e.message.includes(`timeout`)))return k(e,t);if(e instanceof Error&&`status`in e){let n=e.status;return typeof n==`number`?A(e,n,t):N(e,t)}return e instanceof TypeError&&D.test(e.message)?j(e,t):e instanceof SyntaxError||e instanceof Error&&e.message.includes(`parse`)?M(e,t):N(e,t)}var F=class{options;retryCount;constructor(e={}){this.options={timeout:e.timeout??1e4,maxRetries:e.maxRetries??3,onError:e.onError??(()=>{}),onRetry:e.onRetry??(()=>{})},this.retryCount=new Map}handleError(e,t){let n=P(e,t);return this.options.onError(n),console.error(`[rari] Navigation:`,n.type,n.message,{url:n.url,statusCode:n.statusCode,retryable:n.retryable}),n}canRetry(e,t){return e.retryable?(this.retryCount.get(t)??0)<this.options.maxRetries:!1}incrementRetry(e){let t=(this.retryCount.get(e)??0)+1;return this.retryCount.set(e,t),this.options.onRetry(t,{type:`fetch-error`,message:`Retry attempt ${t}`,url:e,timestamp:Date.now(),retryable:!0}),t}resetRetry(e){this.retryCount.delete(e)}getRetryCount(e){return this.retryCount.get(e)??0}clearRetries(){this.retryCount.clear()}};function I(e){if(!e||e===`/`)return`/`;let t=e;for(;t.endsWith(`/`)&&t.length>1;)t=t.slice(0,-1);return t.startsWith(`/`)||(t=`/${t}`),t}function L(e,t){try{return new URL(e,t||window.location.origin).origin!==(t||window.location.origin)}catch{return!1}}function R(e){try{let t=new URL(e,window.location.origin);return t.pathname+t.hash}catch{return e}}function z({error:e,onRetry:t,onReload:n,onDismiss:r,retryCount:i=0,maxRetries:a=3}){let o=e.retryable&&i<a;return w(`div`,{style:{position:`fixed`,top:0,left:0,right:0,bottom:0,background:`rgba(0, 0, 0, 0.5)`,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:1e4,padding:`20px`},onClick:e=>{e.target===e.currentTarget&&r&&r()},children:T(`div`,{style:{background:`white`,borderRadius:`8px`,padding:`24px`,maxWidth:`500px`,width:`100%`,boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`},onClick:e=>e.stopPropagation(),children:[T(`div`,{style:{display:`flex`,alignItems:`center`,gap:`12px`,marginBottom:`16px`},children:[w(`span`,{style:{fontSize:`32px`},children:(()=>{switch(e.type){case`timeout`:return`⏱️`;case`network-error`:return`📡`;case`not-found`:return`🔍`;case`server-error`:return`⚠️`;case`parse-error`:return`📄`;case`abort`:return`🚫`;default:return`❌`}})()}),w(`h2`,{style:{margin:0,fontSize:`20px`,fontWeight:`600`,color:`#1f2937`},children:`Navigation Error`})]}),w(`p`,{style:{margin:`0 0 16px 0`,fontSize:`15px`,lineHeight:`1.5`,color:`#4b5563`},children:(()=>{switch(e.type){case`timeout`:return`The page took too long to load. Please try again.`;case`network-error`:return`Unable to connect to the server. Please check your internet connection.`;case`not-found`:return`The page you're looking for doesn't exist.`;case`server-error`:return`The server encountered an error. Please try again in a moment.`;case`parse-error`:return`Unable to load the page content. Please try reloading.`;case`abort`:return`Navigation was cancelled.`;default:return e.message||`An unexpected error occurred.`}})()}),e.url&&T(`details`,{style:{marginBottom:`16px`,fontSize:`13px`,color:`#6b7280`},children:[w(`summary`,{style:{cursor:`pointer`,userSelect:`none`,marginBottom:`8px`},children:`Technical details`}),T(`div`,{style:{padding:`12px`,background:`#f9fafb`,borderRadius:`4px`,fontFamily:`monospace`,fontSize:`12px`,wordBreak:`break-all`},children:[T(`div`,{style:{marginBottom:`4px`},children:[w(`strong`,{children:`URL:`}),` `,e.url]}),e.statusCode&&T(`div`,{style:{marginBottom:`4px`},children:[w(`strong`,{children:`Status:`}),` `,e.statusCode]}),T(`div`,{style:{marginBottom:`4px`},children:[w(`strong`,{children:`Type:`}),` `,e.type]}),e.originalError&&T(`div`,{children:[w(`strong`,{children:`Error:`}),` `,e.originalError.message]})]})]}),o&&i>0&&T(`div`,{style:{marginBottom:`16px`,padding:`8px 12px`,background:`#fef3c7`,border:`1px solid #fbbf24`,borderRadius:`4px`,fontSize:`13px`,color:`#92400e`},children:[`Retry attempt`,` `,i,` `,`of`,` `,a]}),T(`div`,{style:{display:`flex`,gap:`8px`,flexWrap:`wrap`},children:[o&&t&&w(`button`,{onClick:t,type:`button`,style:{flex:1,minWidth:`120px`,padding:`10px 16px`,background:`#3b82f6`,color:`white`,border:`none`,borderRadius:`6px`,fontSize:`14px`,fontWeight:`500`,cursor:`pointer`,transition:`background 0.2s`},onMouseEnter:e=>{e.currentTarget.style.background=`#2563eb`},onMouseLeave:e=>{e.currentTarget.style.background=`#3b82f6`},children:`Try Again`}),n&&w(`button`,{onClick:n,type:`button`,style:{flex:1,minWidth:`120px`,padding:`10px 16px`,background:`#6b7280`,color:`white`,border:`none`,borderRadius:`6px`,fontSize:`14px`,fontWeight:`500`,cursor:`pointer`,transition:`background 0.2s`},onMouseEnter:e=>{e.currentTarget.style.background=`#4b5563`},onMouseLeave:e=>{e.currentTarget.style.background=`#6b7280`},children:`Reload Page`}),r&&w(`button`,{onClick:r,type:`button`,style:{flex:1,minWidth:`120px`,padding:`10px 16px`,background:`transparent`,color:`#6b7280`,border:`1px solid #d1d5db`,borderRadius:`6px`,fontSize:`14px`,fontWeight:`500`,cursor:`pointer`,transition:`all 0.2s`},onMouseEnter:e=>{e.currentTarget.style.background=`#f9fafb`,e.currentTarget.style.borderColor=`#9ca3af`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`,e.currentTarget.style.borderColor=`#d1d5db`},children:`Dismiss`})]}),w(`p`,{style:{marginTop:`16px`,marginBottom:0,fontSize:`12px`,color:`#9ca3af`,textAlign:`center`},children:`Your current page is still available below this message`})]})})}const B=new class{cache=new Map;pendingRequests=new Map;async get(e){let t=this.cache.get(e);if(t)return t;let n=this.pendingRequests.get(e);if(n)return n;let r=this.fetchRouteInfo(e);this.pendingRequests.set(e,r);try{let t=await r;return this.cache.set(e,t),t}finally{this.pendingRequests.delete(e)}}async fetchRouteInfo(e){let t=await fetch(`/_rari/route-info`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})});if(!t.ok){let e=null;try{e=await t.json()}catch{}throw e?.error?Error(e.error):Error(`Failed to fetch route info: ${t.status} ${t.statusText}`)}let n=t.clone();try{return await t.json()}catch(t){try{let e=await n.text();return JSON.parse(e)}catch(n){throw console.error(`[RouteInfo] Failed to parse response:`,{error:t,parseError:n,path:e}),Error(`Failed to parse route info response`)}}}clear(){this.cache.clear(),this.pendingRequests.clear()}invalidate(e){this.cache.delete(e)}};if(typeof window<`u`){let e=window[`~rari`]||{};window[`~rari`]||(window[`~rari`]=e),e.routeInfoCache=B}var V=class{stateHistory;routeAccessOrder;maxHistorySize;scrollableSelector;constructor(e={}){this.stateHistory=new Map,this.routeAccessOrder=[],this.maxHistorySize=e.maxHistorySize||50,this.scrollableSelector=e.scrollableSelector||`[data-scrollable], .scrollable, [style*="overflow"]`}captureState(e){let t={scrollPositions:this.captureScrollPositions(),formData:this.captureFormData(),focusedElement:this.captureFocusedElement()};return this.storeState(e,t),t}captureScrollPositions(){let e=new Map;try{e.set(`window`,{x:window.scrollX,y:window.scrollY,element:`window`}),document.querySelectorAll(this.scrollableSelector).forEach((t,n)=>{if(t instanceof HTMLElement){let r=t.id||`scrollable-${n}`;(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)&&e.set(r,{x:t.scrollLeft,y:t.scrollTop,element:r})}})}catch{}return e}captureFormData(){let e=new Map;try{document.querySelectorAll(`form`).forEach((t,n)=>{let r=t.id||t.name||`form-${n}`,i=new FormData(t);i.entries().next().done||e.set(r,i)})}catch{}return e}captureFocusedElement(){try{let e=document.activeElement;if(e&&e!==document.body){if(e.id)return`#${e.id}`;if((e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.name)return`[name="${e.name}"]`}}catch{}return null}storeState(e,t){let n=this.routeAccessOrder.indexOf(e);for(n!==-1&&this.routeAccessOrder.splice(n,1),this.routeAccessOrder.push(e),this.stateHistory.set(e,t);this.routeAccessOrder.length>this.maxHistorySize;){let e=this.routeAccessOrder.shift();e&&this.stateHistory.delete(e)}}getHistorySize(){return this.stateHistory.size}hasState(e){return this.stateHistory.has(e)}getState(e){return this.stateHistory.get(e)}clearAll(){this.stateHistory.clear(),this.routeAccessOrder=[]}clearState(e){this.stateHistory.delete(e);let t=this.routeAccessOrder.indexOf(e);t!==-1&&this.routeAccessOrder.splice(t,1)}restoreState(e){let t=this.stateHistory.get(e);if(!t)return!1;let n=!0;return this.restoreScrollPositions(t.scrollPositions)||(n=!1),this.restoreFormData(t.formData)||(n=!1),t.focusedElement&&this.restoreFocus(t.focusedElement),n}restoreScrollPositions(e){let t=!0;try{e.forEach((e,n)=>{try{if(n===`window`)window.scrollTo(e.x,e.y);else{let r=document.getElementById(n)||document.querySelector(`[data-scrollable-id="${n}"]`);r instanceof HTMLElement?(r.scrollLeft=e.x,r.scrollTop=e.y):t=!1}}catch{t=!1}})}catch(e){console.error(`[rari] Router: Failed to restore scroll positions:`,e),t=!1}return t}restoreFormData(e){let t=!0;try{e.forEach((e,n)=>{try{let r=document.getElementById(n)||document.querySelector(`form[name="${n}"]`)||document.querySelectorAll(`form`)[Number.parseInt(n.replace(`form-`,``),10)];r instanceof HTMLFormElement?e.forEach((e,n)=>{try{let t=r.elements.namedItem(n);t instanceof RadioNodeList?t.forEach(t=>{t instanceof HTMLInputElement&&(t.type===`radio`||t.type===`checkbox`?t.checked=t.value===e:t.value=e)}):(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)&&(t instanceof HTMLInputElement&&(t.type===`checkbox`||t.type===`radio`)?t.checked=t.value===e:t.value=e)}catch{t=!1}}):t=!1}catch{t=!1}})}catch(e){console.error(`[rari] Router: Failed to restore form data:`,e),t=!1}return t}restoreFocus(e){try{let t=document.querySelector(e);t instanceof HTMLElement&&requestAnimationFrame(()=>{try{t.focus()}catch{}})}catch{}}};function H(e,t){let n=document.querySelector(e);if(n)t.content&&n.setAttribute(`content`,t.content);else{n=document.createElement(`meta`);for(let[e,r]of Object.entries(t))n.setAttribute(e,r);document.head.appendChild(n)}}function U(e){let t=document.querySelector(e);t&&t.remove()}function W(e){e.title&&(document.title=e.title),e.description?H(`meta[name="description"]`,{name:`description`,content:e.description}):U(`meta[name="description"]`),e.keywords&&e.keywords.length>0?H(`meta[name="keywords"]`,{name:`keywords`,content:e.keywords.join(`, `)}):U(`meta[name="keywords"]`),e.viewport&&H(`meta[name="viewport"]`,{name:`viewport`,content:e.viewport})}function G(e){let t=document.querySelector(`link[rel="canonical"]`);if(e===void 0){t&&t.remove();return}if(t)t.setAttribute(`href`,e);else{let t=document.createElement(`link`);t.setAttribute(`rel`,`canonical`),t.setAttribute(`href`,e),document.head.appendChild(t)}}function K(e){if(e===void 0){U(`meta[name="robots"]`);return}let t=[];e.index!==void 0&&t.push(e.index?`index`:`noindex`),e.follow!==void 0&&t.push(e.follow?`follow`:`nofollow`),e.nocache&&t.push(`nocache`),t.length>0?H(`meta[name="robots"]`,{name:`robots`,content:t.join(`, `)}):U(`meta[name="robots"]`)}function q(e){if(e===void 0){U(`meta[property="og:title"]`),U(`meta[property="og:description"]`),U(`meta[property="og:url"]`),U(`meta[property="og:site_name"]`),U(`meta[property="og:type"]`),document.querySelectorAll(`meta[property="og:image"]`).forEach(e=>e.remove());return}if(e.title?H(`meta[property="og:title"]`,{property:`og:title`,content:e.title}):U(`meta[property="og:title"]`),e.description?H(`meta[property="og:description"]`,{property:`og:description`,content:e.description}):U(`meta[property="og:description"]`),e.url?H(`meta[property="og:url"]`,{property:`og:url`,content:e.url}):U(`meta[property="og:url"]`),e.siteName?H(`meta[property="og:site_name"]`,{property:`og:site_name`,content:e.siteName}):U(`meta[property="og:site_name"]`),e.type?H(`meta[property="og:type"]`,{property:`og:type`,content:e.type}):U(`meta[property="og:type"]`),e.images&&e.images.length>0){document.querySelectorAll(`meta[property="og:image"]`).forEach(e=>e.remove());for(let t of e.images){let e=document.createElement(`meta`);e.setAttribute(`property`,`og:image`),e.setAttribute(`content`,t),document.head.appendChild(e)}}else document.querySelectorAll(`meta[property="og:image"]`).forEach(e=>e.remove())}function J(e){if(e===void 0){U(`meta[name="twitter:card"]`),U(`meta[name="twitter:site"]`),U(`meta[name="twitter:creator"]`),U(`meta[name="twitter:title"]`),U(`meta[name="twitter:description"]`),document.querySelectorAll(`meta[name="twitter:image"]`).forEach(e=>e.remove());return}if(e.card?H(`meta[name="twitter:card"]`,{name:`twitter:card`,content:e.card}):U(`meta[name="twitter:card"]`),e.site?H(`meta[name="twitter:site"]`,{name:`twitter:site`,content:e.site}):U(`meta[name="twitter:site"]`),e.creator?H(`meta[name="twitter:creator"]`,{name:`twitter:creator`,content:e.creator}):U(`meta[name="twitter:creator"]`),e.title?H(`meta[name="twitter:title"]`,{name:`twitter:title`,content:e.title}):U(`meta[name="twitter:title"]`),e.description?H(`meta[name="twitter:description"]`,{name:`twitter:description`,content:e.description}):U(`meta[name="twitter:description"]`),e.images&&e.images.length>0){document.querySelectorAll(`meta[name="twitter:image"]`).forEach(e=>e.remove());for(let t of e.images){let e=document.createElement(`meta`);e.setAttribute(`name`,`twitter:image`),e.setAttribute(`content`,t),document.head.appendChild(e)}}else document.querySelectorAll(`meta[name="twitter:image"]`).forEach(e=>e.remove())}function Y(e){W(e),G(e.canonical),K(e.robots),q(e.openGraph),J(e.twitter)}function X({children:n,initialRoute:r,staleWindowMs:i=3e4}){let[a,o]=S(()=>({currentRoute:I(r),navigationId:0,error:null})),s=x(null),c=x(!0),l=x(I(r)),u=x(0),d=x(new F({timeout:1e4,maxRetries:3,onError:e=>{console.error(`[rari] Router: Navigation error:`,e)},onRetry:()=>{}})),f=x(new Map),p=x([]),m=x(new V({maxHistorySize:50})),h=x(null),g=x(i),_=()=>`${Date.now()}-${Math.random().toString(36).substring(2,9)}`,v=()=>{s.current&&=(s.current.abort(),null)},D=()=>{for(let[,e]of f.current.entries())e.abortController.abort();f.current.clear()},O=(e,t)=>{f.current.delete(e),c.current&&a.navigationId===t&&o(e=>({...e}))},k=x(null),A=(e,t)=>{if(!t)return;let n=document.getElementById(t);n&&(n.scrollIntoView({behavior:`smooth`,block:`start`}),window.history.pushState(window.history.state,``,`${e}#${t}`))},j=e=>{try{let t=e.headers.get(`x-rari-metadata`);t&&Y(JSON.parse(decodeURIComponent(t)))}catch(e){console.warn(`[rari] Router: Failed to parse x-rari-metadata header:`,e)}},M=(e,t,n,r,i,a)=>{u.current===r&&window.dispatchEvent(new CustomEvent(`rari:navigate`,{detail:{from:t,to:n,navigationId:r,options:i,abortSignal:a.signal,rscResponsePromise:e}}))},N=(e,t,n)=>{n.historyKey?requestAnimationFrame(()=>{m.current.restoreState(e)}):t&&requestAnimationFrame(()=>{let e=(n=0)=>{let r=document.getElementById(t);r?r.scrollIntoView({behavior:`smooth`,block:`start`}):n<10&&setTimeout(e,50,n+1)};e()})},P=(e,t,n,r)=>{c.current&&(l.current=e,o(t=>({...t,currentRoute:e,navigationId:r,error:null})),d.current.resetRetry(e),N(e,t,n))},H=(e,t,n,r)=>{if(e instanceof Error&&e.name===`AbortError`){O(t,n);return}let i=d.current.handleError(e,t);c.current&&(o(e=>({...e,error:i})),window.history.replaceState(window.history.state,``,r)),f.current.delete(t),window.dispatchEvent(new CustomEvent(`rari:navigate-error`,{detail:{from:r,to:t,error:i,navigationId:n}})),k.current?.()},U=async(e,t={})=>{if(!e||typeof e!=`string`)return;let[n,r]=e.includes(`#`)?e.split(`#`):[e,``],i=I(n);if(i===l.current&&!t.replace){A(i,r);return}let a=f.current.get(i);if(a)return a.promise;D(),v();let o=new AbortController;s.current=o,u.current+=1;let c=u.current;window.dispatchEvent(new CustomEvent(`rari:navigation-start`,{detail:{navigationId:c,targetPath:i}}));let d=(async()=>{let e=l.current;try{t.historyKey||m.current.captureState(e);let n=t.historyKey||_(),a=window.location.origin+i,s=r?`${i}#${r}`:i,l={route:i,navigationId:c,scrollPosition:{x:window.scrollX,y:window.scrollY},timestamp:Date.now(),key:n};t.replace?window.history.replaceState(l,``,s):window.history.pushState(l,``,s);let u=await fetch(a,{headers:{Accept:`text/x-component`},signal:o.signal}).then(e=>{if(!e.ok&&e.status!==404)throw Error(`Failed to fetch: ${e.status}`);return e});if(o.signal.aborted){O(i,c);return}let d=new URL(u.url).pathname;if(o.signal.aborted){O(i,c);return}if(d!==i){let e=r?`${d}#${r}`:d;window.history.replaceState({...l,route:d},``,e)}if(M(Promise.resolve(u),e,d,c,t,o),j(u),o.signal.aborted){O(i,c);return}P(d,r,t,c),f.current.delete(i),k.current?.()}catch(t){H(t,i,c,e)}})();return f.current.set(i,{targetPath:i,navigationId:c,promise:d,abortController:o}),d},W=async()=>{if(p.current.length===0)return;let e=p.current.at(-1);e&&(p.current=[],await U(e.path,e.options))},G=x(U);b(()=>(k.current=W,G.current=U,()=>{k.current=null,G.current=null}));let K=x(null);K.current||=E((e,t)=>{G.current?.(e,t)},50,{leading:!0,trailing:!0,maxWait:200});let q=e=>{if(e.button!==0||e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;let t=e.target;for(;t&&t.tagName!==`A`;)t=t.parentElement;if(!t||t.tagName!==`A`)return;let n=t;if(n.target&&n.target!==`_self`||n.hasAttribute(`download`))return;let r=n.getAttribute(`href`);if(!r||L(r))return;if(r.startsWith(`#`)){e.preventDefault();let t=r.slice(1),n=document.getElementById(t);n&&(n.scrollIntoView({behavior:`smooth`,block:`start`}),window.history.pushState(window.history.state,``,r));return}e.preventDefault();let i=R(r);K.current&&K.current(i,{replace:!1})},J=e=>{let t=window.location.pathname,n=e.state;G.current&&G.current(t,{replace:!0,scroll:!1,historyKey:n?.key})},X=()=>{if(a.error&&a.error.url){let e=a.error.url;d.current.incrementRetry(e),U(e,{replace:!1})}},Z=()=>{window.location.reload()},ee=()=>{o(e=>({...e,error:null}))};y(()=>{let e=window.history.state;if(!e||!e.key){let e={route:I(r),navigationId:0,scrollPosition:{x:window.scrollX,y:window.scrollY},timestamp:Date.now(),key:_()};window.history.replaceState(e,``,window.location.pathname+window.location.search+window.location.hash)}},[r]);let Q=e=>{if(e.persisted){let e=window.location.pathname;m.current.captureState(e)}},$=e=>{if(e.persisted){let e=window.location.pathname,t=window.history.state;requestAnimationFrame(()=>{m.current.restoreState(e),t?.scrollPosition&&window.scrollTo(t.scrollPosition.x,t.scrollPosition.y)})}};return y(()=>(document.addEventListener(`click`,q),window.addEventListener(`popstate`,J),window.addEventListener(`pagehide`,Q),window.addEventListener(`pageshow`,$),()=>{document.removeEventListener(`click`,q),window.removeEventListener(`popstate`,J),window.removeEventListener(`pagehide`,Q),window.removeEventListener(`pageshow`,$)}),[]),y(()=>{g.current=i;let e=()=>{document.hidden?h.current=Date.now():h.current!==null&&Date.now()-h.current>g.current&&B.clear()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[i]),y(()=>(c.current=!0,e((e,t)=>G.current?.(e,t)??Promise.resolve()),()=>{c.current=!1,t(),v(),D(),K.current?.cancel&&K.current.cancel()}),[]),T(C,{children:[n,a.error&&w(z,{error:a.error,onRetry:X,onReload:Z,onDismiss:ee,retryCount:d.current.getRetryCount(a.error.url||``),maxRetries:3})]})}var Z=class extends v{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[rari] Layout: Error in layout "${this.props.layoutPath}":`,e,t),this.props.onError&&this.props.onError(e,t),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`rari:layout-error`,{detail:{layoutPath:this.props.layoutPath,error:e,errorInfo:t,timestamp:Date.now()}}))}reset=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback(this.state.error,this.reset):T(`div`,{style:{padding:`16px`,margin:`16px 0`,background:`#fee`,border:`1px solid #fcc`,borderRadius:`4px`},children:[w(`h3`,{style:{margin:`0 0 8px 0`,color:`#c00`},children:`Layout Error`}),T(`p`,{style:{margin:`0 0 8px 0`,fontSize:`14px`},children:[`An error occurred in layout:`,` `,w(`code`,{children:this.props.layoutPath})]}),T(`details`,{style:{fontSize:`12px`,marginBottom:`8px`},children:[w(`summary`,{style:{cursor:`pointer`},children:`Error details`}),T(`pre`,{style:{marginTop:`8px`,padding:`8px`,background:`#fff`,border:`1px solid #ddd`,borderRadius:`2px`,overflow:`auto`},children:[this.state.error.message,`
|
|
2
2
|
`,this.state.error.stack]})]}),w(`button`,{onClick:this.reset,type:`button`,style:{padding:`6px 12px`,background:`#c00`,color:`white`,border:`none`,borderRadius:`4px`,cursor:`pointer`,fontSize:`14px`},children:`Try Again`})]}):this.props.children}};export{X as ClientRouter,_ as DefaultError,f as DefaultLoading,h as ErrorBoundary,l as HttpRuntimeClient,Z as LayoutErrorBoundary,r as LoadingSpinner,F as NavigationErrorHandler,z as NavigationErrorOverlay,p as NotFound,V as StatePreserver,a as clearPropsCache,o as clearPropsCacheForComponent,g as createErrorBoundary,i as createHttpRuntimeClient,u as createLoadingBoundary,m as extractMetadata,d as extractServerProps,c as extractServerPropsWithCache,s as extractStaticParams,n as hasServerSideDataFetching};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){return e.loading=!0,e.loadPromise=e.loader().then(t=>(e.component=t,e.registered=!0,e.loading=!1,t)).catch(t=>{throw console.error(`[rari] Failed to load component ${e.id}:`,t),e.loading=!1,e.loadPromise=void 0,t}),e.loadPromise}async function t(t,n){return t.component==null?t.loadPromise?(await t.loadPromise,r(t,n)):t.loader?await e(t)==null?null:r(t,n):null:r(t,n)}function n(t){return!t.loader||t.loading||t.component!=null||t.loadPromise?Promise.resolve(null):e(t)}function r(e,t){if(e.component==null)return null;let n=e.component;return!t||t
|
|
1
|
+
function e(e){return e.loading=!0,e.loadPromise=e.loader().then(t=>(e.component=t,e.registered=!0,e.loading=!1,t)).catch(t=>{throw console.error(`[rari] Failed to load component ${e.id}:`,t),e.loading=!1,e.loadPromise=void 0,t}),e.loadPromise}async function t(t,n){return t.component==null?t.loadPromise?(await t.loadPromise,r(t,n)):t.loader?await e(t)==null?null:r(t,n):null:r(t,n)}function n(t){return!t.loader||t.loading||t.component!=null||t.loadPromise?Promise.resolve(null):e(t)}function r(e,t){if(e.component==null)return null;let n=e.component;return!t||t==="default"?n.default??n:n[t]===void 0?n.default?.[t]===void 0?null:n.default[t]:n[t]}function i(e){e.loader&&!e.loading&&!e.loadPromise&&n(e).catch(()=>{})}function a(e,t){let n=e.indexOf(`#`),a=n===-1?e:e.slice(0,n),o=n===-1?void 0:e.slice(n+1),s=t[a];return s?s.component==null?(i(s),null):r(s,o):null}function o(e,t,n,a){let o=a[e];if(!o||!n[o])return null;let s=n[o];return r(s,t)??(i(s),null)}function s(e,t,n){let r=e.indexOf(`#`),i=r===-1?e:e.slice(0,r),a=r===-1?``:e.slice(r+1),s=f(i);for(let e of s){let r=o(e,a,t,n);if(r!==null)return r}return null}function c(e,t,n){let a=e.indexOf(`#`),o=a===-1?e:e.slice(0,a),s=a===-1?void 0:e.slice(a+1),c=n[o];if(!c||!t[c])return null;let l=t[c];return r(l,s)??(i(l),null)}function l(e,t){let n=t[e];if(!n)return null;let a=e.indexOf(`#`);return r(n,a===-1?void 0:e.slice(a+1))??(a===-1?null:r(n))??(i(n),null)}function u(e,t){let n=t[`~clientComponents`]||{},r=t[`~clientComponentPaths`]||{},i=t[`~clientComponentNames`]||{},o=e.replace(/\\/g,`/`),u=l(o,n)||(o===e?null:l(e,n));if(u!==null)return u;let d=a(o,n)||(o===e?null:a(e,n));if(d!==null)return d;let f=s(o,n,r)||(o===e?null:s(e,n,r));return f===null?c(o,n,i)||(o===e?null:c(e,n,i)):f}function d(e){return u(e,globalThis)}function f(e){return e.startsWith(`./`)?[e,e.slice(2)]:[e,`./${e}`]}async function p(e){let n=globalThis[`~clientComponents`]||{},r=globalThis[`~clientComponentPaths`]||{},i=globalThis[`~clientComponentNames`]||{},a=e.replace(/\\/g,`/`),o=n[a];if(o){let e=a.indexOf(`#`),n=e===-1?void 0:a.slice(e+1);return await t(o,n)}if(a!==e&&(o=n[e],o)){let n=e.indexOf(`#`),r=n===-1?void 0:e.slice(n+1);return await t(o,r)}let s=a.indexOf(`#`),c=s===-1?a:a.slice(0,s),l=s===-1?void 0:a.slice(s+1);if(o=n[c],o)return await t(o,l);if(a!==e){let r=e.indexOf(`#`);if(o=n[r===-1?e:e.slice(0,r)],o)return await t(o,l)}let u=a===e?[c]:[c,e.includes(`#`)?e.slice(0,e.indexOf(`#`)):e];for(let e of u){for(let i of f(e)){let e=r[i];if(e&&(o=n[e],o))return await t(o,l)}let a=i[e];if(a&&(o=n[a],o))return await t(o,l)}return null}export{p as n,r,d as t};
|
package/dist/headers.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as ReadonlyCookie, n as CookieStore, t as CookieOptions } from "./types-
|
|
1
|
+
import { i as ReadonlyCookie, n as CookieStore, t as CookieOptions } from "./types-zPQ3RHgH.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/headers.d.ts
|
|
4
4
|
declare function cookies(): Promise<CookieStore>;
|
package/dist/image/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,i as t,n,o as r,r as i,t as a}from"../constants-
|
|
1
|
+
import{a as e,i as t,n,o as r,r as i,t as a}from"../constants-De7aSsCq.mjs";import{useCallback as o,useEffect as s,useRef as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";function f(e,t,n,r){let i=new URLSearchParams;return i.set(`url`,e),i.set(`w`,t.toString()),i.set(`q`,n.toString()),r&&i.set(`f`,r),`/_rari/image?${i}`}function p({src:e,alt:t,width:r,height:i,quality:p=75,preload:m=!1,loading:h=`lazy`,placeholder:g=`empty`,blurDataURL:_,fill:v=!1,sizes:y,style:b,className:x,onLoad:S,onError:C,unoptimized:w=!1,loader:T,overrideSrc:E,decoding:D}){let O=typeof e==`string`?e:e.src,k=r||(typeof e==`string`?void 0:e.width),A=i||(typeof e==`string`?void 0:e.height),j=_||(typeof e==`string`?void 0:e.blurDataURL),M=E||O,N=m,P=D||(m?`sync`:`async`),[F,I]=l(!1),[L,R]=l(!1),z=c(null),B=c(S),V=c(null);s(()=>{B.current=S},[S]);let H=o(e=>{let t=e.currentTarget;t.src&&t.complete&&(g===`blur`&&I(!0),B.current&&B.current(e))},[g]),U=o(e=>{R(!0),g===`blur`&&I(!0),C&&C(e)},[g,C]);s(()=>{if(N){let e=document.createElement(`link`);return e.rel=`preload`,e.as=`image`,T?e.href=T({src:M,width:k||1920,quality:p}):w?e.href=M:e.href=f(M,k||1920,p),y&&e.setAttribute(`imagesizes`,y),document.head.appendChild(e),()=>{e.parentNode===document.head&&document.head.removeChild(e)}}},[N,M,k,p,y,T,w]),s(()=>{if(N||w||h===`eager`)return;let e=z.current;if(!e)return;let t=new IntersectionObserver(n=>{n.forEach(n=>{n.isIntersecting&&t.unobserve(e)})},{rootMargin:`50px`});return t.observe(e),()=>{t.disconnect()}},[N,w,h]);let W={...b,...v&&{position:`absolute`,inset:0,width:`100%`,height:`100%`,objectFit:`cover`},...g===`blur`&&j&&!F&&{backgroundImage:`url(${j})`,backgroundSize:`cover`,backgroundPosition:`center`,filter:`blur(20px)`,transition:`filter 0.3s ease-out`},...g===`blur`&&F&&{filter:`none`,transition:`filter 0.3s ease-out`}};if(w)return u(`img`,{ref:z,src:T?T({src:M,width:k||1920,quality:p}):M,alt:L?t:``,width:v?void 0:k,height:v?void 0:A,loading:N?`eager`:h,fetchPriority:N?`high`:`auto`,decoding:P,onLoad:H,onError:U,style:W,className:x});let G=k||1920,K=k?[k]:a,q=e=>T?K.map(e=>`${T({src:M,width:e,quality:p})} ${e}w`).join(`, `):K.map(t=>`${f(M,t,p,e)} ${t}w`).join(`, `),J=T?T({src:M,width:G,quality:p}):f(M,G,p),Y=K.length>1||K[0]!==G,X=u(`img`,{ref:z,src:J,srcSet:Y?q():void 0,sizes:Y?y:void 0,alt:L?t:``,width:v?void 0:k,height:v?void 0:A,loading:N?`eager`:h,fetchPriority:N?`high`:`auto`,decoding:P,onLoad:H,onError:U,style:W,className:x});return Y?d(`picture`,{ref:V,children:[n.includes(`avif`)&&u(`source`,{type:`image/avif`,srcSet:q(`avif`),sizes:y}),n.includes(`webp`)&&u(`source`,{type:`image/webp`,srcSet:q(`webp`),sizes:y}),X]}):X}const m=typeof window>`u`,h=p;m&&(h.$$typeof=Symbol.for(`react.client.reference`),h.$$id=`rari/image#Image`);export{a as DEFAULT_DEVICE_SIZES,n as DEFAULT_FORMATS,i as DEFAULT_IMAGE_SIZES,t as DEFAULT_MAX_CACHE_SIZE,e as DEFAULT_MINIMUM_CACHE_TTL,r as DEFAULT_QUALITY_LEVELS,h as Image};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as Metadata, l as LayoutProps, p as PageProps } from "./types-
|
|
2
|
-
import { a as SitemapImage, i as SitemapEntry, n as RobotsRule, o as SitemapVideo, r as Sitemap, t as Robots } from "./metadata-route-
|
|
3
|
-
import { c as RariURL, n as ProxyConfig, r as ProxyFunction, s as RariFetchEvent } from "./types-
|
|
1
|
+
import { d as Metadata, l as LayoutProps, p as PageProps } from "./types-m74grfbN.mjs";
|
|
2
|
+
import { a as SitemapImage, i as SitemapEntry, n as RobotsRule, o as SitemapVideo, r as Sitemap, t as Robots } from "./metadata-route-85WvBQcW.mjs";
|
|
3
|
+
import { c as RariURL, n as ProxyConfig, r as ProxyFunction, s as RariFetchEvent } from "./types-3dq9RGI5.mjs";
|
|
4
4
|
import { RariRequest } from "./proxy/RariRequest.mjs";
|
|
5
5
|
import { RariResponse } from "./proxy/RariResponse.mjs";
|
|
6
6
|
export { type LayoutProps, type Metadata, type PageProps, type ProxyConfig, type ProxyFunction, type RariFetchEvent, RariRequest, RariResponse, type RariURL, type Robots, type RobotsRule, type Sitemap, type SitemapEntry, type SitemapImage, type SitemapVideo };
|
package/dist/mdx.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as e}from"./regex-constants-B4P386OY.mjs";import{registerClientComponent as t,registerClientReference as n}from"./runtime/react-server-dom-shim.mjs";function r(r,i,a=`default`){let o=`${i}#${a}`;if(t(r,i,a),typeof globalThis<`u`){let t=globalThis;t[`~clientComponents`]||={};let n=i.replace(e,``).split(`/`).pop()||a,s={id:a==="default"?n:a,path:i,type:`client`,component:r,registered:!0};t[`~clientComponents`][o]=s,t[`~clientComponents`][n]=s,t[`~clientComponents`][i]=s}function s(){throw Error(`Attempted to call ${a}() from the server but ${a} is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.`)}return n(s,i,a)}function i(e){let t={};for(let[n,{component:i,id:a,exportName:o=`default`}]of Object.entries(e))t[n]=r(i,a,o);return t}export{r as createMDXClientReference,i as createMDXClientReferences};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./get-client-component-
|
|
2
|
-
`),i=new Set;for(let e of r){let t=e.trim();if(!t)continue;let r=t.indexOf(`:`);if(r===-1)continue;let a=t.substring(r+1);if(a.startsWith(`I{`))try{let e=a.substring(1),t=JSON.parse(e);if(typeof t==`object`&&!Array.isArray(t)&&t.id){let e=t.id.replace(/\\/g,`/`),r=t.name&&t.name
|
|
1
|
+
import{n as e}from"./get-client-component-B4Y2T40R.mjs";async function t(t,n){let r=t.split(`
|
|
2
|
+
`),i=new Set;for(let e of r){let t=e.trim();if(!t)continue;let r=t.indexOf(`:`);if(r===-1)continue;let a=t.substring(r+1);if(a.startsWith(`I{`))try{let e=a.substring(1),t=JSON.parse(e);if(typeof t==`object`&&!Array.isArray(t)&&t.id){let e=t.id.replace(/\\/g,`/`),r=t.name&&t.name!=="default"?`${e}#${t.name}`:e;(!n||!n.has(r))&&i.add(r)}}catch{}}i.size>0&&await Promise.all(Array.from(i,async t=>{try{if(!await e(t)){console.warn(`[rari] Failed to preload component: ${t}`);return}n?.add(t)}catch(e){console.error(`[rari] Error preloading component ${t}:`,e)}}))}export{t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,i as t,n,o as r,r as i,t as a}from"./utils-BK4N0qFr-
|
|
1
|
+
import{a as e,i as t,n,o as r,r as i,t as a}from"./utils-BK4N0qFr-QFbF96eD.mjs";import{existsSync as o,readFileSync as s,writeFileSync as c}from"node:fs";import{join as l}from"node:path";import u from"node:process";import{styleText as d}from"node:util";function f(){let r=u.cwd();e(`Creating Railway deployment configuration...`),t(r,{providerName:`Railway`,deployScript:`echo "Push to GitHub and connect to Railway to deploy"`,startScript:`rari start`,dependency:n()}),p(r),a(r,`Railway`,`.railway`),m(r),h()}function p(e){i(e,`railway.toml`,`[build]
|
|
2
2
|
builder = "RAILPACK"
|
|
3
3
|
|
|
4
4
|
[deploy]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=/\.(?:tsx?|jsx?)$/,t=/^[A-Z]:\\/i,n=/\\/g,r=/[/\\]/,i=/\/$/,a=/^src\//,o=/^file:\/\//,s=/^https?:\/\//,c={AMPERSAND:/&/g,LT:/</g,GT:/>/g,QUOTE:/"/g,APOS:/'/g},l=c.AMPERSAND,u=c.LT,d=c.GT,f=c.QUOTE,p=c.APOS,m=l,h=u,g=d,_=f,v=p,y=l,b=u,x=d,S=f,C=p,w=/[^\w/-]/g,T=/^\d+$/,E=/([a-z])([A-Z])/g,D=/export\s+(?:function|const|class)\s+(\w+)/,O=/\.[^.]*$/,k=/\r?\n/,A=/['"]/g;export{x as C,C as S,S as T,A as _,O as a,t as b,v as c,_ as d,s as f,i as g,r as h,D as i,g as l,T as m,E as n,o,k as p,w as r,m as s,n as t,h as u,a as v,b as w,y as x,e as y};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,i as t,n,o as r,r as i,t as a}from"./utils-BK4N0qFr-
|
|
1
|
+
import{a as e,i as t,n,o as r,r as i,t as a}from"./utils-BK4N0qFr-QFbF96eD.mjs";import{existsSync as o,readFileSync as s,writeFileSync as c}from"node:fs";import{join as l}from"node:path";import u from"node:process";import{styleText as d}from"node:util";function f(){let r=u.cwd();e(`Creating Render deployment configuration...`),t(r,{providerName:`Render`,deployScript:`echo "Push to GitHub and connect to Render to deploy"`,startScript:`rari start`,dependency:n()}),p(r),a(r,`Render`,`.render`),m(r),h()}function p(e){i(e,`render.yaml`,`services:
|
|
2
2
|
- type: web
|
|
3
3
|
name: rari-app
|
|
4
4
|
runtime: node
|
package/dist/router.d.mts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
-
|
|
3
1
|
//#region src/router/navigation-types.d.ts
|
|
4
2
|
interface NavigationOptions {
|
|
5
3
|
replace?: boolean;
|
|
@@ -30,7 +28,7 @@ interface RouterProviderProps {
|
|
|
30
28
|
declare function RouterProvider({
|
|
31
29
|
children,
|
|
32
30
|
initialPathname
|
|
33
|
-
}: RouterProviderProps):
|
|
31
|
+
}: RouterProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
34
32
|
declare function useRouter(): RouterContextValue;
|
|
35
33
|
declare function usePathname(): string;
|
|
36
34
|
declare function useParams(): Record<string, string | string[]>;
|
package/dist/router.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,r as t}from"./navigate-
|
|
1
|
+
import{n as e,r as t}from"./navigate-DuyUa6qD.mjs";import{createContext as n,use as r,useEffect as i,useMemo as a,useRef as o,useState as s}from"react";import{jsx as c}from"react/jsx-runtime";const l=n(null);function u({children:t,initialPathname:n}){let[r,u]=s(n),[d,f]=s(()=>typeof window<`u`?new URLSearchParams(window.location.search):new URLSearchParams),[p,m]=s({}),h=o(null);return i(()=>{let e=e=>{let t=e.detail;t?.to&&(u(t.to),f(new URLSearchParams(window.location.search)),m({}))};return window.addEventListener(`rari:navigate`,e),()=>{window.removeEventListener(`rari:navigate`,e)}},[]),i(()=>{let t=e();t&&(h.current=t);let n=e=>{h.current=e.detail.navigate},r=()=>{h.current=null};return window.addEventListener(`rari:register-navigate`,n),window.addEventListener(`rari:deregister-navigate`,r),()=>{window.removeEventListener(`rari:register-navigate`,n),window.removeEventListener(`rari:deregister-navigate`,r)}},[]),c(l,{value:a(()=>({pathname:r,params:p,searchParams:d,push:async(e,t)=>{h.current?await h.current(e,t):(console.warn(`[rari] Router not ready, falling back to window.location`),window.location.href=e)},replace:async(e,t)=>{h.current?await h.current(e,{...t,replace:!0}):(console.warn(`[rari] Router not ready, falling back to window.location`),window.location.replace(e))},back:()=>{window.history.back()},forward:()=>{window.history.forward()},refresh:()=>{window.dispatchEvent(new CustomEvent(`rari:app-router-rerender`))},prefetch:async e=>{try{let t=new URL(e,window.location.origin);await fetch(t.pathname+t.search,{headers:{Accept:`text/x-component`},priority:`low`})}catch(e){console.warn(`[rari] Prefetch failed:`,e)}}}),[r,p,d]),children:t})}function d(){let e=r(l);if(!e)throw Error(`useRouter must be used within a RouterProvider`);return e}function f(){return d().pathname}function p(){return d().params}function m(){return d().searchParams}export{u as RouterProvider,t as navigate,p as useParams,f as usePathname,d as useRouter,m as useSearchParams};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
2
|
|
|
4
3
|
//#region src/runtime/AppRouterProvider.d.ts
|
|
5
4
|
interface AppRouterProviderProps {
|
|
@@ -23,6 +22,6 @@ declare function AppRouterProvider({
|
|
|
23
22
|
children,
|
|
24
23
|
initialPayload,
|
|
25
24
|
onNavigate
|
|
26
|
-
}: AppRouterProviderProps):
|
|
25
|
+
}: AppRouterProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
27
26
|
//#endregion
|
|
28
27
|
export { AppRouterProvider };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use client";import{x as e,y as t}from"../regex-constants-CmOAY1_W.mjs";import{t as n}from"../preload-modules-C1zd75Lc.mjs";import*as r from"react";import{Suspense as i,useEffect as a,useRef as o,useState as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{createFromFetch as d,createFromReadableStream as f}from"virtual:react-flight-client";const ee=/"timestamp":(\d+)/,p=/^(?:-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|true|false|null)$/,m=/^[0-9a-f]+$/i,te=/^\$L?[0-9a-f]+$/i;function ne(e){return new Promise(t=>{setTimeout(t,e)})}function h(e){if(!e||e.length===0)return!1;let t=e.charAt(0),n=e.charCodeAt(0);return e.startsWith(`I[`)||e.startsWith(`I{`)||e.startsWith(`"$S`)?!1:!!(n===84||t===`[`||t===`{`||e.startsWith(`E{`)||t===`"`||p.test(e))}function re(e){return!e||e.length===0?!1:!!(e.includes(`"fallback"`)||e.includes(`$Lfallback`)||e.startsWith(`E{`))}function ie({contentRef:e,rowsDataRef:t,modulesDataRef:n,symbolsDataRef:i,suspendingPromisesRef:a,getSuspendingPromise:o,rscToReact:s}){let c=t.current,l=n.current,u=i.current,d=a.current,f=c.has(e);if(r.useEffect(()=>{f&&d.has(e)&&d.delete(e)},[e,f,d]),f)return s(c.get(e),l,void 0,u,c);throw o(e)}function g({children:p,initialPayload:g,onNavigate:_}){let[v,y]=s(g),b=s(0)[1],x=o({x:0,y:0}),S=o(new Map),C=o(null),w=o(new Set),T=o(_),E=o(0),D=o(new Map),O=o([]),k=o(null),A=o(0),[j,M]=s(null),N=o(typeof window<`u`&&window.location.hash.length>0),ae=o(0),P=o(!1),F=o(!1),I=o(!1),L=o(Promise.resolve()),oe=o(!1),se=o(!!g),R=o(null);a(()=>{T.current=_},[_]),a(()=>{if(v?.element!=null&&v.element&&typeof v.element==`object`&&`status`in v.element&&v.element.status===`rejected`){let e=v.element.reason;e&&console.error(`[rari] AppRouter: Flight payload rejected:`,e)}},[v]);let ce=()=>{if(typeof document>`u`)return;let e=document.querySelectorAll(`form`);S.current.clear(),e.forEach((e,t)=>{let n=new FormData(e);S.current.set(`form-${t}`,n)})},le=()=>{typeof document>`u`||document.querySelectorAll(`form`).forEach((e,t)=>{let n=S.current.get(`form-${t}`);n&&n.forEach((t,n)=>{let r=e.elements.namedItem(n);r&&(r.type===`checkbox`||r.type===`radio`?r.checked=t===`on`:r.value=t)})})},z=(e,t,n,r)=>{let i={timestamp:Date.now(),error:e,type:t,details:n,filePath:r};O.current.push(i),A.current+=1,O.current.length>10&&O.current.shift(),A.current>=2&&M(i),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`rari:hmr-failure`,{detail:i}))},B=()=>{setTimeout(()=>{window.location.reload()},1e3)},V=()=>{A.current>0&&(A.current=0)},ue=e=>{if(!k.current)return!1;if(e===k.current)return!0;let t=e.match(ee);if(t){let e=Number.parseInt(t[1],10);if(Date.now()-e>5e3)return!0}return!1};function de(e){let t;try{t=JSON.stringify(e)}catch{try{let n=new WeakSet;t=JSON.stringify(e,(e,t)=>{if(typeof t==`object`&&t){if(n.has(t))return`[Circular]`;n.add(t)}return t})}catch{t=`[Unstringifiable:${typeof e}:${String(e).substring(0,50)}]`}}let n=0;for(let e=0;e<t.length;e++){let r=t.charCodeAt(e);n=(n<<5)-n+r,n&=n}return Math.abs(n).toString(36)}function H(e,n,i,a,o,s){if(e==null)return null;if(typeof e==`string`&&e.startsWith(`$`)&&e.length>1&&m.test(e.substring(1))&&o&&o.has(e)){let t=s??new Set;return t.has(e)?(console.warn(`[rari] AppRouter: Circular $ reference detected:`,e),null):(t.add(e),H(o.get(e),n,i,a,o,t))}if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return e;if(Array.isArray(e)){if(e.length>=4&&e[0]===`$`){let[,s,c,l]=e,u=s;if(typeof s==`string`&&s.startsWith(`$`)&&a){let e=s.substring(1);if(t.test(e)){let e=a.get(s);e&&(e===`$Sreact.suspense`||e===`react.suspense`?u=`Suspense`:console.warn(`[rari] AppRouter: Unknown symbol:`,e))}}if(u===`Suspense`||s===`Suspense`){let e=he(l,n,i,a,o);return r.createElement(r.Suspense,c?{...e,key:c}:e)}if(typeof u==`string`&&u.startsWith(`$`)&&te.test(u)){let e=n.get(u);if(!e)return console.warn(`[rari] AppRouter: Module not found for reference:`,u,`Available modules:`,Array.from(n.keys())),null;let t=globalThis[`~clientComponents`]?.[e.id]?.component;if(!t)return console.warn(`[rari] AppRouter: Component not loaded:`,e.id),null;if(typeof t!=`function`)return null;let s=c||`fallback-${u}-${ae.current++}`,d={...l,children:l.children===void 0?void 0:H(l.children,n,i,a,o)};return r.createElement(t,{key:s,...d})}if(!u||typeof u!=`string`&&typeof u!=`function`||typeof u==`string`&&u.startsWith(`$`))return null;let d=he(l,n,i,a,o);return r.createElement(u,c?{...d,key:c}:d)}return e.map((e,t)=>{let s=H(e,n,i,a,o);if(s==null)return null;if(typeof s==`object`&&r.isValidElement(s)&&!s.key){let n=typeof e==`object`&&e?de(e):`primitive`,i=`rsc-${Array.isArray(e)&&e[0]===`$`&&e[1]?String(e[1]):`unknown`}-${n}-${t}`;return r.createElement(r.Fragment,{key:i},s)}return s}).filter(e=>e!=null)}return e}let U=o(new Set),W=o(new Map),G=o(new Map),K=o(new Map),q=o(new Map);function fe(e){if(!q.current.has(e)){let t=new Promise(()=>{});q.current.set(e,{promise:t,timestamp:Date.now()})}return q.current.get(e).promise}function pe(){q.current.clear(),U.current.clear()}function me(){let e=Date.now(),t=[];q.current.forEach((n,r)=>{e-n.timestamp>3e4&&t.push(r)}),t.forEach(e=>{q.current.delete(e),U.current.delete(e)})}function he(e,t,n,i,a){if(!e||typeof e!=`object`)return e;a&&(W.current=a),t&&(G.current=t),i&&(K.current=i);let o={};for(let s in e)if(Object.hasOwn(e,s))if(s===`children`){let c=e.children;if(typeof c==`string`&&c.startsWith(`$`)&&c.length>1&&m.test(c.substring(1)))if(a&&a.has(c)){let e=a.get(c);U.current.delete(c),o[s]=H(e,t,n,i,a)}else U.current.add(c),o[s]=r.createElement(ie,{key:`lazy-${c}`,contentRef:c,rowsDataRef:W,modulesDataRef:G,symbolsDataRef:K,suspendingPromisesRef:q,getSuspendingPromise:fe,rscToReact:H});else o[s]=c===void 0?void 0:H(c,t,n,i,a)}else s===`dangerouslySetInnerHTML`?o[s]=e[s]:o[s]=H(e[s],t,n,i,a);return o}let J=async e=>{await n(e,w.current);let t=await f(new ReadableStream({start(t){t.enqueue(new TextEncoder().encode(e)),t.close()}}));return{element:t,rawElement:t,wireFormat:e}},Y=e=>({element:d(e)}),ge=async(t,n)=>{let r=t||window.location.pathname,i=E.current,a=`${i}:${r}${window.location.search}`,o=D.current.get(a);if(o)return o;let s=(async()=>{try{let t=(import.meta.env.RARI_SERVER_URL||window.location.origin).replace(e,``)+r+window.location.search,a=await fetch(t,{headers:{Accept:`text/x-component`},cache:`no-store`,signal:n});if(!a.ok){let e=Error(`Failed to fetch RSC data: ${a.status} ${a.statusText}`);throw z(e,`fetch`,`HTTP ${a.status} when fetching ${t}`,window.location.pathname),e}let o=await a.text();if(ue(o)&&v)return v;let s;try{s=await J(o)}catch(e){let t=e instanceof Error?e:Error(String(e));throw z(t,`parse`,`Failed to parse RSC wire format: ${t.message}`,window.location.pathname),t}return E.current===i&&(y(s),k.current=o,V()),s}catch(e){throw e instanceof Error&&!e.message.includes(`Failed to fetch RSC data`)&&!e.message.includes(`Failed to parse`)&&z(e,`network`,`Network error: ${e.message}`,window.location.pathname),e}finally{D.current.delete(a)}})();return D.current.set(a,s),s},X=o(J),Z=o(Y),Q=o(ge);a(()=>{X.current=J,Z.current=Y,Q.current=ge}),a(()=>{if(typeof window>`u`)return;let e=setInterval(()=>{me()},3e4),t=async e=>{let t=e.detail;if(t.navigationId!==E.current)return;N.current=!0,t.isStreaming||(C.current=null),pe(),x.current={x:window.scrollX,y:window.scrollY},ce();let n=null,r=null;try{t.rscResponsePromise?n=Z.current(t.rscResponsePromise):t.rscResponse?n=Z.current(Promise.resolve(t.rscResponse)):t.rscWireFormat?n=await X.current(t.rscWireFormat):t.isStreaming||(n=await Q.current(t.to,t.abortSignal))}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;r=e}if(r){console.error(`[rari] AppRouter: Navigation failed:`,r),window.dispatchEvent(new CustomEvent(`rari:navigate-error`,{detail:{from:t.from,to:t.to,error:r,navigationId:t.navigationId}})),A.current>=3&&B();return}if(!n&&t.isStreaming&&E.current===t.navigationId){R.current=t;return}n&&E.current===t.navigationId&&(y(n),t.rscWireFormat&&(k.current=t.rscWireFormat),V(),b(e=>e+1),M(null),T.current&&T.current(t));let i=typeof window<`u`&&window.location.hash.length>0;!t.options?.historyKey&&!i&&requestAnimationFrame(()=>{t.options?.scroll!==!1&&window.scrollTo(0,0)})},n=async()=>{x.current={x:window.scrollX,y:window.scrollY},ce();try{await Q.current(),b(e=>e+1),M(null)}catch(e){console.error(`HMR refetch error:`,e instanceof Error?e.message:String(e)),A.current>=3&&B()}finally{requestAnimationFrame(()=>{window.scrollTo(x.current.x,x.current.y),le()})}},r=async()=>{try{await Q.current(),b(e=>e+1),M(null)}catch(e){console.error(`RSC invalidate error:`,e instanceof Error?e.message:String(e)),A.current>=3&&B()}},i=e=>{let t=e;if(C.current=[],w.current.clear(),E.current=t.detail.navigationId,typeof window<`u`){let e=window;e[`~rari`]||={},e[`~rari`].navigationId=t.detail.navigationId}P.current=!1,F.current=!1,I.current=!1,L.current=Promise.resolve(),oe.current=!0,se.current=!1,R.current=null},a=async()=>{try{await Q.current(),M(null)}catch(e){console.error(`Manifest update error:`,e instanceof Error?e.message:String(e)),A.current>=3&&B()}},o=async()=>{if(!C.current||C.current.length===0||se.current)return;let e=E.current,t=[...C.current],n=t.some(e=>{let t=e.indexOf(`:`),n=t>0?e.substring(0,t).trim():``,r=t>0?e.substring(t+1):``;return m.test(n)&&h(r)}),r=t.some(e=>{let n=e.indexOf(`:`),r=n>0?e.substring(0,n).trim():``,i=n>0?e.substring(n+1):``;return!m.test(r)||!h(i)?!1:t.some(e=>{let t=e.indexOf(`:`),n=t>0?e.substring(0,t).trim():``,i=t>0?e.substring(t+1):``;return!m.test(n)||!h(i)||re(i)?!1:RegExp(`"?\\$L?${r}"?(?![0-9a-fA-F])`).test(i)})});if(!n&&!r)return;if(!P.current&&n&&!r&&(P.current=!0,t.some(e=>e.includes(`"$Sreact.suspense"`)||e.includes(`react.suspense`)))){try{let n=t.filter(e=>{let n=e.indexOf(`:`),i=n>0?e.substring(0,n).trim():``,a=RegExp(`"\\$L?${i}"(?![0-9a-fA-F])`);return!r||!t.some(e=>a.test(e))}),i=await X.current(n.join(`
|
|
1
|
+
"use client";import{g as e,m as t}from"../regex-constants-B4P386OY.mjs";import{t as n}from"../preload-modules-xvnJ_8eh.mjs";import*as r from"react";import{Suspense as i,useEffect as a,useRef as o,useState as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{createFromFetch as d,createFromReadableStream as f}from"virtual:react-flight-client";const ee=/"timestamp":(\d+)/,p=/^(?:-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|true|false|null)$/,m=/^[0-9a-f]+$/i,te=/^\$L?[0-9a-f]+$/i;function ne(e){return new Promise(t=>{setTimeout(t,e)})}function h(e){if(!e||e.length===0)return!1;let t=e.charAt(0),n=e.charCodeAt(0);return e.startsWith(`I[`)||e.startsWith(`I{`)||e.startsWith(`"$S`)?!1:!!(n===84||t===`[`||t===`{`||e.startsWith(`E{`)||t===`"`||p.test(e))}function re(e){return!e||e.length===0?!1:!!(e.includes(`"fallback"`)||e.includes(`$Lfallback`)||e.startsWith(`E{`))}function ie({contentRef:e,rowsDataRef:t,modulesDataRef:n,symbolsDataRef:i,suspendingPromisesRef:a,getSuspendingPromise:o,rscToReact:s}){let c=t.current,l=n.current,u=i.current,d=a.current,f=c.has(e);if(r.useEffect(()=>{f&&d.has(e)&&d.delete(e)},[e,f,d]),f)return s(c.get(e),l,void 0,u,c);throw o(e)}function g({children:p,initialPayload:g,onNavigate:_}){let[v,y]=s(g),b=s(0)[1],x=o({x:0,y:0}),S=o(new Map),C=o(null),w=o(new Set),T=o(_),E=o(0),D=o(new Map),O=o([]),k=o(null),A=o(0),[j,M]=s(null),N=o(typeof window<`u`&&window.location.hash.length>0),ae=o(0),P=o(!1),F=o(!1),I=o(!1),L=o(Promise.resolve()),oe=o(!1),R=o(!!g),z=o(null);a(()=>{T.current=_},[_]),a(()=>{if(v?.element!=null&&v.element&&typeof v.element==`object`&&`status`in v.element&&v.element.status===`rejected`){let e=v.element.reason;e&&console.error(`[rari] AppRouter: Flight payload rejected:`,e)}},[v]);let se=()=>{if(typeof document>`u`)return;let e=document.querySelectorAll(`form`);S.current.clear(),e.forEach((e,t)=>{let n=new FormData(e);S.current.set(`form-${t}`,n)})},ce=()=>{typeof document>`u`||document.querySelectorAll(`form`).forEach((e,t)=>{let n=S.current.get(`form-${t}`);n&&n.forEach((t,n)=>{let r=e.elements.namedItem(n);r&&(r.type===`checkbox`||r.type===`radio`?r.checked=t===`on`:r.value=t)})})},B=(e,t,n,r)=>{let i={timestamp:Date.now(),error:e,type:t,details:n,filePath:r};O.current.push(i),A.current+=1,O.current.length>10&&O.current.shift(),A.current>=2&&M(i),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`rari:hmr-failure`,{detail:i}))},V=()=>{setTimeout(()=>{window.location.reload()},1e3)},H=()=>{A.current>0&&(A.current=0)},le=e=>{if(!k.current)return!1;if(e===k.current)return!0;let t=e.match(ee);if(t){let e=Number.parseInt(t[1],10);if(Date.now()-e>5e3)return!0}return!1};function ue(e){let t;try{t=JSON.stringify(e)}catch{try{let n=new WeakSet;t=JSON.stringify(e,(e,t)=>{if(typeof t==`object`&&t){if(n.has(t))return`[Circular]`;n.add(t)}return t})}catch{t=`[Unstringifiable:${typeof e}:${String(e).substring(0,50)}]`}}let n=0;for(let e=0;e<t.length;e++){let r=t.charCodeAt(e);n=(n<<5)-n+r,n&=n}return Math.abs(n).toString(36)}function U(e,n,i,a,o,s){if(e==null)return null;if(typeof e==`string`&&e.startsWith(`$`)&&e.length>1&&m.test(e.substring(1))&&o&&o.has(e)){let t=s??new Set;return t.has(e)?(console.warn(`[rari] AppRouter: Circular $ reference detected:`,e),null):(t.add(e),U(o.get(e),n,i,a,o,t))}if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return e;if(Array.isArray(e)){if(e.length>=4&&e[0]===`$`){let[,s,c,l]=e,u=s;if(typeof s==`string`&&s.startsWith(`$`)&&a){let e=s.substring(1);if(t.test(e)){let e=a.get(s);e&&(e===`$Sreact.suspense`||e===`react.suspense`?u=`Suspense`:console.warn(`[rari] AppRouter: Unknown symbol:`,e))}}if(u===`Suspense`||s===`Suspense`){let e=me(l,n,i,a,o);return r.createElement(r.Suspense,c?{...e,key:c}:e)}if(typeof u==`string`&&u.startsWith(`$`)&&te.test(u)){let e=n.get(u);if(!e)return console.warn(`[rari] AppRouter: Module not found for reference:`,u,`Available modules:`,Array.from(n.keys())),null;let t=globalThis[`~clientComponents`]?.[e.id]?.component;if(!t)return console.warn(`[rari] AppRouter: Component not loaded:`,e.id),null;if(typeof t!=`function`)return null;let s=c||`fallback-${u}-${ae.current++}`,d={...l,children:l.children===void 0?void 0:U(l.children,n,i,a,o)};return r.createElement(t,{key:s,...d})}if(!u||typeof u!=`string`&&typeof u!=`function`||typeof u==`string`&&u.startsWith(`$`))return null;let d=me(l,n,i,a,o);return r.createElement(u,c?{...d,key:c}:d)}return e.map((e,t)=>{let s=U(e,n,i,a,o);if(s==null)return null;if(typeof s==`object`&&r.isValidElement(s)&&!s.key){let n=typeof e==`object`&&e?ue(e):`primitive`,i=`rsc-${Array.isArray(e)&&e[0]===`$`&&e[1]?String(e[1]):`unknown`}-${n}-${t}`;return r.createElement(r.Fragment,{key:i},s)}return s}).filter(e=>e!=null)}return e}let W=o(new Set),G=o(new Map),K=o(new Map),q=o(new Map),J=o(new Map);function de(e){if(!J.current.has(e)){let t=new Promise(()=>{});J.current.set(e,{promise:t,timestamp:Date.now()})}return J.current.get(e).promise}function fe(){J.current.clear(),W.current.clear()}function pe(){let e=Date.now(),t=[];J.current.forEach((n,r)=>{e-n.timestamp>3e4&&t.push(r)}),t.forEach(e=>{J.current.delete(e),W.current.delete(e)})}function me(e,t,n,i,a){if(!e||typeof e!=`object`)return e;a&&(G.current=a),t&&(K.current=t),i&&(q.current=i);let o={};for(let s in e)if(Object.hasOwn(e,s))if(s===`children`){let c=e.children;if(typeof c==`string`&&c.startsWith(`$`)&&c.length>1&&m.test(c.substring(1)))if(a&&a.has(c)){let e=a.get(c);W.current.delete(c),o[s]=U(e,t,n,i,a)}else W.current.add(c),o[s]=r.createElement(ie,{key:`lazy-${c}`,contentRef:c,rowsDataRef:G,modulesDataRef:K,symbolsDataRef:q,suspendingPromisesRef:J,getSuspendingPromise:de,rscToReact:U});else o[s]=c===void 0?void 0:U(c,t,n,i,a)}else s===`dangerouslySetInnerHTML`?o[s]=e[s]:o[s]=U(e[s],t,n,i,a);return o}let Y=async e=>{await n(e,w.current);let t=await f(new ReadableStream({start(t){t.enqueue(new TextEncoder().encode(e)),t.close()}}));return{element:t,rawElement:t,wireFormat:e}},he=e=>({element:d(e)}),ge=async(t,n)=>{let r=t||window.location.pathname,i=E.current,a=`${i}:${r}${window.location.search}`,o=D.current.get(a);if(o)return o;let s=(async()=>{try{let t=(import.meta.env.RARI_SERVER_URL||window.location.origin).replace(e,``)+r+window.location.search,a=await fetch(t,{headers:{Accept:`text/x-component`},cache:`no-store`,signal:n});if(!a.ok){let e=Error(`Failed to fetch RSC data: ${a.status} ${a.statusText}`);throw B(e,`fetch`,`HTTP ${a.status} when fetching ${t}`,window.location.pathname),e}let o=await a.text();if(le(o)&&v)return v;let s;try{s=await Y(o)}catch(e){let t=e instanceof Error?e:Error(String(e));throw B(t,`parse`,`Failed to parse RSC wire format: ${t.message}`,window.location.pathname),t}return E.current===i&&(y(s),k.current=o,H()),s}catch(e){throw e instanceof Error&&!e.message.includes(`Failed to fetch RSC data`)&&!e.message.includes(`Failed to parse`)&&B(e,`network`,`Network error: ${e.message}`,window.location.pathname),e}finally{D.current.delete(a)}})();return D.current.set(a,s),s},X=o(Y),Z=o(he),Q=o(ge);a(()=>{X.current=Y,Z.current=he,Q.current=ge}),a(()=>{if(typeof window>`u`)return;let e=setInterval(()=>{pe()},3e4),t=async e=>{let t=e.detail;if(t.navigationId!==E.current)return;N.current=!0,t.isStreaming||(C.current=null),fe(),x.current={x:window.scrollX,y:window.scrollY},se();let n=null,i=null,a=!1;try{if(t.rscResponsePromise){let e=await t.rscResponsePromise;if(E.current!==t.navigationId)return;a=e.headers.get(`x-render-mode`)===`streaming`;let{element:r}=Z.current(Promise.resolve(e));if(a)n={element:r};else{let e=await r;if(E.current!==t.navigationId)return;n={element:e}}}else if(t.rscResponse){a=t.rscResponse.headers.get(`x-render-mode`)===`streaming`;let{element:e}=Z.current(Promise.resolve(t.rscResponse));if(a)n={element:e};else{let r=await e;if(E.current!==t.navigationId)return;n={element:r}}}else t.rscWireFormat?n=await X.current(t.rscWireFormat):t.isStreaming||(n=await Q.current(t.to,t.abortSignal))}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;i=e}if(i){console.error(`[rari] AppRouter: Navigation failed:`,i),window.dispatchEvent(new CustomEvent(`rari:navigate-error`,{detail:{from:t.from,to:t.to,error:i,navigationId:t.navigationId}})),A.current>=3&&V();return}if(!n&&t.isStreaming&&E.current===t.navigationId){z.current=t;return}n&&E.current===t.navigationId&&(a?(y(n),b(e=>e+1),M(null)):r.startTransition(()=>{y(n),b(e=>e+1),M(null)}),t.rscWireFormat&&(k.current=t.rscWireFormat),H(),T.current&&T.current(t));let o=typeof window<`u`&&window.location.hash.length>0;!t.options?.historyKey&&!o&&requestAnimationFrame(()=>{t.options?.scroll!==!1&&window.scrollTo(0,0)})},n=async()=>{x.current={x:window.scrollX,y:window.scrollY},se();try{await Q.current(),b(e=>e+1),M(null)}catch(e){console.error(`HMR refetch error:`,e instanceof Error?e.message:String(e)),A.current>=3&&V()}finally{requestAnimationFrame(()=>{window.scrollTo(x.current.x,x.current.y),ce()})}},i=async()=>{try{await Q.current(),b(e=>e+1),M(null)}catch(e){console.error(`RSC invalidate error:`,e instanceof Error?e.message:String(e)),A.current>=3&&V()}},a=e=>{let t=e;if(C.current=[],w.current.clear(),E.current=t.detail.navigationId,typeof window<`u`){let e=window;e[`~rari`]||={},e[`~rari`].navigationId=t.detail.navigationId}P.current=!1,F.current=!1,I.current=!1,L.current=Promise.resolve(),oe.current=!0,R.current=!1,z.current=null},o=async()=>{try{await Q.current(),M(null)}catch(e){console.error(`Manifest update error:`,e instanceof Error?e.message:String(e)),A.current>=3&&V()}},s=async()=>{if(!C.current||C.current.length===0||R.current)return;let e=E.current,t=[...C.current],n=t.some(e=>{let t=e.indexOf(`:`),n=t>0?e.substring(0,t).trim():``,r=t>0?e.substring(t+1):``;return m.test(n)&&h(r)}),r=t.some(e=>{let n=e.indexOf(`:`),r=n>0?e.substring(0,n).trim():``,i=n>0?e.substring(n+1):``;return!m.test(r)||!h(i)?!1:t.some(e=>{let t=e.indexOf(`:`),n=t>0?e.substring(0,t).trim():``,i=t>0?e.substring(t+1):``;return!m.test(n)||!h(i)||re(i)?!1:RegExp(`"?\\$L?${r}"?(?![0-9a-fA-F])`).test(i)})});if(!n&&!r)return;if(!P.current&&n&&!r&&(P.current=!0,t.some(e=>e.includes(`"$Sreact.suspense"`)||e.includes(`react.suspense`)))){try{let n=t.filter(e=>{let n=e.indexOf(`:`),i=n>0?e.substring(0,n).trim():``,a=RegExp(`"\\$L?${i}"(?![0-9a-fA-F])`);return!r||!t.some(e=>a.test(e))}),i=await X.current(n.join(`
|
|
2
2
|
`));E.current===e&&(y(i),b(e=>e+1))}catch(e){console.error(`[rari] Failed to parse shell payload:`,e),P.current=!1,L.current=Promise.resolve()}return}let i=t.some(e=>e.includes(`"$Sreact.suspense"`)||e.includes(`react.suspense`));if(!(!r&&i&&!I.current)&&!F.current){P.current=!0;try{let n=await X.current(t.join(`
|
|
3
3
|
`));if((i||r)&&(await ne(50),E.current===e&&!F.current)){let n=C.current?[...C.current]:t,r=await X.current(n.join(`
|
|
4
|
-
`));E.current===e&&(F.current=!0,y(r),b(e=>e+1),
|
|
5
|
-
`)),E.current!==e||F.current)return;y(n),b(e=>e+1),
|
|
4
|
+
`));E.current===e&&(F.current=!0,y(r),b(e=>e+1),z.current&&T.current&&(T.current(z.current),z.current=null),I.current&&(C.current=null))}if(E.current!==e||F.current)return;let a=C.current?[...C.current]:t;if(n=await X.current(a.join(`
|
|
5
|
+
`)),E.current!==e||F.current)return;y(n),b(e=>e+1),z.current&&T.current&&(T.current(z.current),z.current=null),I.current&&(F.current=!0,C.current=null)}catch(e){console.error(`Process rows error:`,e instanceof Error?e.message:String(e))}}},c=e=>{let t=e,n=t.detail.rscRow,r=t.detail.navigationId;if(!n||!n.trim()||!C.current)return;let i=E.current;if(!(r==null||r!==i)){if(n.trim()===`STREAM_COMPLETE`){I.current=!0,L.current=L.current.then(()=>{if(E.current===i)return s()});return}C.current.push(n),L.current=L.current.then(()=>{if(E.current===i)return s()})}};return window.addEventListener(`rari:navigation-start`,a),window.addEventListener(`rari:navigate`,t),window.addEventListener(`rari:app-router-rerender`,n),window.addEventListener(`rari:rsc-invalidate`,i),window.addEventListener(`rari:app-router-manifest-updated`,o),window.addEventListener(`rari:rsc-row`,c),()=>{clearInterval(e),fe(),window.removeEventListener(`rari:navigation-start`,a),window.removeEventListener(`rari:navigate`,t),window.removeEventListener(`rari:app-router-rerender`,n),window.removeEventListener(`rari:rsc-invalidate`,i),window.removeEventListener(`rari:app-router-manifest-updated`,o),window.removeEventListener(`rari:rsc-row`,c)}},[]),a(()=>{if(!(typeof window>`u`)&&window.location.hash&&v&&N.current){let e=window.location.hash.slice(1);requestAnimationFrame(()=>{requestAnimationFrame(()=>{let t=document.getElementById(e);t&&(t.scrollIntoView({behavior:`instant`,block:`start`}),N.current=!1)})})}},[v]);let _e=()=>{window.location.reload()},ve=()=>{M(null)},ye=e=>{if(!e||typeof e!=`object`)return null;if(e.type===`html`&&e.props?.children){let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t)if(e&&typeof e==`object`&&e.type===`body`)return e.props?.children??null}return e},$=p;if(v?.element!=null)if(v.element&&typeof v.element==`object`&&`status`in v.element){let e=v.element.status;$=e===`fulfilled`?v.element.value:e===`rejected`?p:r.use(v.element)}else $=ye(v.element)??v.element;return Array.isArray($)&&$.length===1&&r.isValidElement($[0])?$=$[0]:Array.isArray($)&&$.length>0&&$.every(e=>r.isValidElement(e)||e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`)&&($=r.createElement(r.Fragment,null,...$)),u(c,{children:[j&&u(`div`,{style:{position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,padding:`24px`,background:`rgba(220, 38, 38, 0.95)`,color:`white`,borderRadius:`8px`,fontSize:`14px`,zIndex:1e4,maxWidth:`500px`,boxShadow:`0 4px 6px rgba(0, 0, 0, 0.3)`},children:[l(`div`,{style:{marginBottom:`16px`,fontWeight:`bold`,fontSize:`16px`},children:`⚠️ HMR Update Failed`}),u(`div`,{style:{marginBottom:`12px`,opacity:.9},children:[j.type===`fetch`&&`Failed to fetch updated content from server.`,j.type===`parse`&&`Failed to parse server response.`,j.type===`stale`&&`Server returned stale content.`,j.type===`network`&&`Network error occurred.`]}),l(`div`,{style:{marginBottom:`16px`,fontSize:`12px`,opacity:.8,fontFamily:`monospace`},children:j.details}),u(`div`,{style:{marginBottom:`12px`,fontSize:`12px`,opacity:.7},children:[`Consecutive failures:`,` `,A.current,` `,`/`,` `,3]}),u(`div`,{style:{display:`flex`,gap:`8px`},children:[l(`button`,{onClick:_e,type:`button`,style:{padding:`8px 16px`,background:`white`,color:`#dc2626`,border:`none`,borderRadius:`4px`,cursor:`pointer`,fontWeight:`bold`,fontSize:`14px`},children:`Refresh Page`}),l(`button`,{onClick:ve,type:`button`,style:{padding:`8px 16px`,background:`rgba(255, 255, 255, 0.2)`,color:`white`,border:`1px solid rgba(255, 255, 255, 0.3)`,borderRadius:`4px`,cursor:`pointer`,fontSize:`14px`},children:`Dismiss`})]}),l(`div`,{style:{marginTop:`12px`,fontSize:`11px`,opacity:.6},children:`Check the console for detailed error logs.`})]}),l(i,{fallback:null,children:$})]})}export{g as AppRouterProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{t as e}from"../timer-utils-
|
|
1
|
+
"use client";import{t as e}from"../timer-utils-Duul5JHq.mjs";import{Component as t}from"react";import{jsx as n,jsxs as r}from"react/jsx-runtime";var i=class extends t{_isMounted=!1;_pendingTimer=null;constructor(e){super(e),this.state={hasError:!1,error:null,ErrorComponent:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidMount(){this._isMounted=!0}componentWillUnmount(){this._isMounted=!1,this._pendingTimer=e(this._pendingTimer)}componentDidCatch(e,t){console.error(`[rari] Error boundary caught error:`,e,t);let n=this.props.errorComponentId;if(n&&typeof window<`u`){let e=window[`~clientComponents`]?.[n];e&&(e.component&&typeof e.component==`function`?this.setState({ErrorComponent:e.component}):e.loader&&!e.loading&&(e.loading=!0,e.loader().then(t=>{let n=t.default||t;e.component=n,e.registered=!0,e.loading=!1,this.setState({ErrorComponent:n})}).catch(t=>{e.loading=!1,console.error(`[rari] Failed to load error component ${n}:`,t)})))}}reset=()=>{this._pendingTimer=e(this._pendingTimer),this._pendingTimer=setTimeout(()=>{this._isMounted&&this.setState({hasError:!1,error:null,ErrorComponent:null}),this._pendingTimer=null},50)};render(){if(this.state.hasError&&this.state.error){let{ErrorComponent:e}=this.state;return e?n(e,{error:this.state.error,reset:this.reset}):r(`div`,{style:{padding:`20px`,background:`#fee`,border:`2px solid #f00`},children:[n(`h2`,{children:`Error`}),n(`p`,{children:`Something went wrong.`})]})}return this.props.children}};export{i as ErrorBoundaryWrapper};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import"../regex-constants-
|
|
1
|
+
import"../regex-constants-B4P386OY.mjs";import{n as e,r as t,t as n}from"../get-client-component-B4Y2T40R.mjs";import{t as r}from"../preload-modules-xvnJ_8eh.mjs";import*as i from"react";import"react";import{ClientRouter as a}from"rari/client";import{RouterProvider as o}from"rari/router";import{createRoot as s}from"react-dom/client";import{AppRouterProvider as c}from"virtual:app-router-provider";import{createFromReadableStream as l}from"virtual:react-flight-client";import"virtual:rsc-integration.ts";const u=/^\$L?[0-9a-f]+$/i;function d(e,t){let n=e.get(t);if(n)return n;let r=t.startsWith(`$L`)?`$${t.slice(2)}`:`$L${t.slice(1)}`;return e.get(r)}function f(){return globalThis[`~rari`]}function p(){return globalThis}function m(){return window}f()===void 0&&(globalThis[`~rari`]={}),f().AppRouterProvider=c,f().ClientRouter=a,f().getClientComponent=n;async function h(t){try{await e(t)}catch(e){console.error(`[rari] Failed to preload component ${t}:`,e)}}
|
|
2
2
|
/*! @preserve CLIENT_COMPONENT_IMPORTS_PLACEHOLDER */
|
|
3
3
|
f().preloadClientComponent=h,p()[`~clientComponents`]===void 0&&(globalThis[`~clientComponents`]={}),p()[`~clientComponentPaths`]===void 0&&(globalThis[`~clientComponentPaths`]={});
|
|
4
4
|
/*! @preserve CLIENT_COMPONENT_REGISTRATIONS_PLACEHOLDER */
|
|
5
|
-
function g(){f().hydrateClientComponents||(f().hydrateClientComponents=function(e,n,r){let a=m()[`~rari`].boundaryModules||new Map;function o(e){if(!e)return null;if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return e;if(Array.isArray(e)){if(e.length>=4&&e[0]===`$`){let[,n,r,s]=e,c=s?{...s}:{};if(s?.children&&(c.children=o(s.children)),c[`~boundaryId`]&&delete c[`~boundaryId`],typeof n==`string`){if(n.startsWith(`$`)&&u.test(n)){let e=d(a,n);if(e){let n=`${e.id}#${e.name||`default`}`,a=n.replace(/\\/g,`/`),o=e.id.replace(/\\/g,`/`),s=null,l=!e.name||e.name
|
|
5
|
+
function g(){f().hydrateClientComponents||(f().hydrateClientComponents=function(e,n,r){let a=m()[`~rari`].boundaryModules||new Map;function o(e){if(!e)return null;if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return e;if(Array.isArray(e)){if(e.length>=4&&e[0]===`$`){let[,n,r,s]=e,c=s?{...s}:{};if(s?.children&&(c.children=o(s.children)),c[`~boundaryId`]&&delete c[`~boundaryId`],typeof n==`string`){if(n.startsWith(`$`)&&u.test(n)){let e=d(a,n);if(e){let n=`${e.id}#${e.name||`default`}`,a=n.replace(/\\/g,`/`),o=e.id.replace(/\\/g,`/`),s=null,l=!e.name||e.name==="default",u=p()[`~clientComponents`][a]||p()[`~clientComponents`][n]||l&&(p()[`~clientComponents`][o]||p()[`~clientComponents`][e.id]);return u&&(u.component?s=t(u,e.name):u.loader&&!u.loading&&(u.loading=!0,u.loadPromise=u.loader().then(e=>(u.component=e,u.registered=!0,u.loading=!1,e)).catch(t=>{throw u.loading=!1,u.loadPromise=void 0,console.error(`[rari] Failed to load component ${e.id}:`,t),t})),u.loadPromise&&!u.component)?i.createElement(i.Suspense,{fallback:null},i.createElement(b,{key:r,componentInfo:u,exportName:e.name,childProps:c})):s?i.createElement(s,r?{...c,key:r}:c):c.children||null}return c.children||null}return i.createElement(n,r?{...c,key:r}:c)}return null}return e.map((e,t)=>{let n=null;if(Array.isArray(e)&&e.length>=4&&e[0]===`$`){let t=e[2];(typeof t==`string`||typeof t==`number`)&&(n=String(t))}n||=`rsc-${t}-${typeof e==`string`?e:JSON.stringify(e).slice(0,20)}`;let r=o(e);return i.isValidElement(r)&&!r.key?i.createElement(i.Fragment,{key:n},r):r})}return e}try{let e=o(n);e&&(s(r).render(e),r.classList.add(`rari-boundary-hydrated`))}catch(e){console.error(`[rari] Failed to hydrate client components:`,e),console.error(`[rari] Error stack:`,e.stack)}})}function _(){let e=m()[`~rari`].pendingBoundaryHydrations;if(!(!e||e.size===0)){for(let[t,n]of e.entries())f().hydrateClientComponents&&f().hydrateClientComponents(t,n.content,n.element);e.clear()}}g();async function v(t){let n=[];for(let r of t){let t=e(r).catch(e=>{console.error(`[rari] Failed to preload component ${r}:`,e)});n.push(t)}n.length>0&&await Promise.all(n)}async function y(){let e=document.getElementById(`root`);if(!e){console.error(`[rari] Root element not found`);return}let t=document.getElementById(`__RARI_RSC_PAYLOAD__`),u=e.children.length>0,d=m()[`~rari`]?.streaming?.bufferedRows&&m()[`~rari`].streaming.bufferedRows.length>0;if(g(),u&&!t&&!d){let e=document.querySelectorAll(`[data-client-component]`);if(e.length>0){let t=new Set;e.forEach(e=>{let n=e.getAttribute(`data-client-component`);n&&t.add(n)}),await v(t),e.forEach(e=>{let t=e.getAttribute(`data-client-component`),r=e.getAttribute(`data-props`);if(t)try{let a=n(t);if(!a)return;let o=r?JSON.parse(r):{};requestAnimationFrame(()=>{try{document.contains(e)&&(e.replaceChildren(),s(e).render(i.createElement(a,o)))}catch(e){console.error(`[rari] Failed to hydrate client component ${t}:`,e)}})}catch(e){console.error(`[rari] Failed to hydrate client component ${t}:`,e)}})}return}if(u&&d&&!t&&document.querySelectorAll(`[data-boundary-id]`).length>0){m()[`~rari`].pendingBoundaryHydrations&&m()[`~rari`].pendingBoundaryHydrations.size>0&&_();return}try{let n;if(!t&&!d&&!u)try{let e=window.location.pathname+window.location.search,t=(import.meta.env.DEV?import.meta.env.RARI_SERVER_URL||`http://localhost:${import.meta.env.VITE_RSC_PORT||`3000`}`:window.location.origin)+e,r=await fetch(t,{headers:{Accept:`text/x-component`},cache:`no-store`});if(!r.ok&&r.status!==404)throw Error(`Failed to fetch RSC data: ${r.status}`);if(!r.body)throw Error(`RSC response has no body`);n=await l(r.body)}catch(e){if(e instanceof Promise)throw e;if(console.error(`[rari] Failed to fetch initial RSC data:`,e),e instanceof Error)console.error(`[rari] Error name:`,e.name),console.error(`[rari] Error message:`,e.message),e.stack&&console.error(`[rari] Error stack:`,e.stack);else if(typeof e==`string`)console.error(`[rari] Error details:`,e);else if(e&&typeof e==`object`)try{let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=e[n];console.error(`[rari] Error details:`,JSON.stringify(t,null,2))}catch{console.error(`[rari] Error details:`,String(e))}else console.error(`[rari] Error details:`,String(e));n=null}else if(t&&t.textContent)try{let e=t.textContent;await r(e);let i=m()[`~rari`]?.streaming?.bufferedRows&&m()[`~rari`].streaming.bufferedRows.length>0;n=m()[`~rari`]?.streaming?.complete===void 0||i?await l(new ReadableStream({start(t){t.enqueue(new TextEncoder().encode(e));let n=e=>{let n=e;n.detail?.rscRow&&t.enqueue(new TextEncoder().encode(`\n${n.detail.rscRow}`))},r=()=>{t.close(),window.removeEventListener(`rari:html-stream-row`,n),window.removeEventListener(`rari:stream-complete`,r)};if(window.addEventListener(`rari:html-stream-row`,n),window.addEventListener(`rari:stream-complete`,r),m()[`~rari`]?.streaming?.bufferedRows){let e=[...m()[`~rari`].streaming.bufferedRows];for(let n of e)t.enqueue(new TextEncoder().encode(`\n${n}`));m()[`~rari`].streaming.bufferedRows=[]}m()[`~rari`]?.streaming?.complete&&r()}})):await l(new ReadableStream({start(t){t.enqueue(new TextEncoder().encode(e)),t.close()}}))}catch(e){console.error(`[rari] Failed to parse embedded RSC payload:`,e),console.error(`[rari] Error stack:`,e instanceof Error?e.stack:`no stack`),n=null}else if(d)try{n=await l(new ReadableStream({start(e){let t=t=>{let n=t;n.detail?.rscRow&&e.enqueue(new TextEncoder().encode(`${n.detail.rscRow}\n`))},n=()=>{e.close(),window.removeEventListener(`rari:html-stream-row`,t),window.removeEventListener(`rari:stream-complete`,n)};if(window.addEventListener(`rari:html-stream-row`,t),window.addEventListener(`rari:stream-complete`,n),m()[`~rari`]?.streaming?.bufferedRows){let t=[...m()[`~rari`].streaming.bufferedRows];m()[`~rari`].streaming.bufferedRows=[];for(let n of t)e.enqueue(new TextEncoder().encode(`${n}\n`))}m()[`~rari`]?.streaming?.complete&&n()}}))}catch(e){console.error(`[rari] Failed to process streaming RSC payload:`,e),n=null}if(!n)throw Error(`No RSC data available for hydration`);let f;f=n;let p;p=i.createElement(c,{initialPayload:{element:n}},f),p=i.createElement(a,{initialRoute:window.location.pathname,children:p}),p=i.createElement(o,{initialPathname:window.location.pathname,children:p}),s(e).render(p)}catch(t){console.error(`[rari] Error rendering app:`,t),e.innerHTML=`
|
|
6
6
|
<div style="padding: 20px; background: #fee; border: 2px solid #f00; margin: 20px;">
|
|
7
7
|
<h2>Error Loading App</h2>
|
|
8
8
|
<p></p>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=new Map,t=new Map;function n(t,n,r){let i=`${n}#${r}`;return e.set(i,{id:n,exportName:r,chunks:[n],name:r,async:!1}),Object.defineProperty(t
|
|
1
|
+
const e=new Map,t=new Map;function n(t,n,r){let i=`${n}#${r}`;return e.set(i,{id:n,exportName:r,chunks:[n],name:r,async:!1}),Object.defineProperty(t,"$$typeof",{value:Symbol.for(`react.client.reference`),enumerable:!1}),Object.defineProperty(t,"$$id",{value:i,enumerable:!1}),Object.defineProperty(t,"$$async",{value:!1,enumerable:!1}),t}function r(t,n,r){let i=`${n}#${r}`;e.set(i,{id:n,exportName:r,chunks:[n],name:r,async:!1})}function i(e,n,r){let i=`${n}#${r}`;return t.set(i,{id:n,exportName:r,bound:!1}),Object.defineProperty(e,"$$typeof",{value:Symbol.for(`react.server.reference`),enumerable:!1}),Object.defineProperty(e,"$$id",{value:i,enumerable:!1}),Object.defineProperty(e,"$$bound",{value:!1,enumerable:!1}),e}function a(e){return new Proxy({},{get(t,r){function i(){throw Error(`Attempted to call ${String(r)}() from the server but ${String(r)} is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.`)}return n(i,e,String(r))}})}const o=e,s=t;export{o as CLIENT_REFERENCE_REGISTRY,s as SERVER_REFERENCE_REGISTRY,a as createClientModuleProxy,r as registerClientComponent,n as registerClientReference,i as registerServerReference};
|