rari 0.8.0 → 0.8.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/RariRequest-B7W8PASA.mjs +1 -0
- package/dist/RariRequest-Db4obWIC.mjs +1 -0
- package/dist/cli.mjs +3 -3
- package/dist/client.d.mts +2 -2
- package/dist/client.mjs +2 -2
- package/dist/image/index.mjs +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +1 -1
- package/dist/platform.mjs +1 -1
- package/dist/proxy/runtime-executor.mjs +1 -1
- package/dist/railway-Bmni6Ev-.mjs +102 -0
- package/dist/render-DiRZ0pBT.mjs +108 -0
- package/dist/{robots-generator-AcmtuCNy.mjs → robots-generator-mLxJHgg8.mjs} +1 -1
- package/dist/routes-9ltViohI.mjs +1 -0
- package/dist/server-build-NpmaSiRi.mjs +1 -0
- package/dist/{server-build-DzXrtj9Z.mjs → server-build-YlAAZIGW.mjs} +6 -6
- package/dist/{runtime-client-B_mktvP9.d.mts → server-config-DPOhoy43.d.mts} +103 -16
- package/dist/{sitemap-generator-BrVMQEl6.mjs → sitemap-generator-CJKAJrNw.mjs} +1 -1
- package/dist/utils-BmuB-L9i.mjs +1 -0
- package/dist/vite-BBcW4h-2.mjs +71 -0
- package/dist/{vite-CSUUcRB_.d.mts → vite-C-viRQS3.d.mts} +29 -41
- package/dist/vite.d.mts +3 -3
- package/dist/vite.mjs +1 -1
- package/package.json +10 -10
- package/src/cli.ts +141 -16
- package/src/client.ts +8 -1
- package/src/deployment/railway.ts +14 -21
- package/src/deployment/render.ts +14 -21
- package/src/deployment/utils.ts +26 -0
- package/src/image/Image.tsx +12 -8
- package/src/index.ts +1 -0
- package/src/logger.ts +17 -0
- package/src/platform.ts +3 -2
- package/src/proxy/RariRequest.ts +2 -2
- package/src/proxy/RariResponse.ts +2 -2
- package/src/proxy/execute-proxy.ts +2 -4
- package/src/proxy/executor.ts +1 -2
- package/src/proxy/matcher.ts +1 -2
- package/src/proxy/runtime-executor.ts +3 -6
- package/src/proxy/types.ts +14 -20
- package/src/proxy/vite-plugin.ts +2 -4
- package/src/router/ClientRouter.tsx +11 -12
- package/src/router/NavigationErrorOverlay.tsx +1 -2
- package/src/router/StatePreserver.ts +5 -9
- package/src/router/navigation-error-handler.ts +1 -2
- package/src/router/navigation-utils.ts +3 -1
- package/src/router/props-extractor.ts +7 -9
- package/src/router/robots-generator.ts +6 -11
- package/src/router/sitemap-generator.ts +3 -5
- package/src/router/types.ts +57 -13
- package/src/router/vite-plugin.ts +4 -5
- package/src/runtime/AppRouterProvider.tsx +6 -11
- package/src/runtime/actions.ts +4 -8
- package/src/runtime/entry-client.js +22 -35
- package/src/runtime/mdx-client-components.ts +1 -2
- package/src/runtime/react-server-dom-rari-client.js +6 -11
- package/src/runtime/rsc-client-runtime.js +22 -35
- package/src/runtime-client.ts +2 -4
- package/src/types/server-config.ts +26 -0
- package/src/vite/hmr-coordinator.ts +7 -11
- package/src/vite/image-scanner.ts +187 -0
- package/src/vite/index.ts +82 -97
- package/src/vite/server-build.ts +75 -97
- package/src/vite.ts +10 -1
- package/dist/RariRequest-Bd8ha4ba.mjs +0 -1
- package/dist/RariRequest-CW-JhbGM.mjs +0 -1
- package/dist/chunk-TmZEKRxo.mjs +0 -1
- package/dist/railway-BkeFMLcc.mjs +0 -102
- package/dist/render-B2YpwDlB.mjs +0 -108
- package/dist/routes-VWQ7KgNh.mjs +0 -1
- package/dist/server-build-Dn38sarn.mjs +0 -1
- package/dist/vite-4UHctC2X.mjs +0 -72
- /package/dist/{constants-CD3aqqK8.mjs → constants-DZAg-dr0.mjs} +0 -0
- /package/dist/{routes-Bq7zysPc.mjs → routes-KDxjyeNA.mjs} +0 -0
- /package/dist/{runtime-client-B15ZQXrE.mjs → runtime-client-Jllyf7Ly.mjs} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=class{cookies;pendingDeletes;pendingSets;constructor(e){this.cookies=new Map,this.pendingDeletes=new Set,this.pendingSets=new Map,e&&this.parseCookieHeader(e)}parseCookieHeader(e){let t=e.split(`;`).map(e=>e.trim());for(let e of t){let[t,...n]=e.split(`=`);if(t){let e=n.join(`=`);this.cookies.set(t,{name:t,value:e})}}}get(e){if(this.pendingDeletes.has(e))return;let t=this.pendingSets.get(e);return t?{name:t.name,value:t.value,path:t.options?.path}:this.cookies.get(e)}getAll(){let e=[];return this.cookies.forEach(t=>{this.pendingDeletes.has(t.name)||e.push(t)}),this.pendingSets.forEach(t=>{e.push({name:t.name,value:t.value,path:t.options?.path})}),e}has(e){return this.pendingDeletes.has(e)?!1:this.pendingSets.has(e)||this.cookies.has(e)}delete(e){this.pendingDeletes.add(e),this.pendingSets.delete(e)}set(e,t,n){if(typeof e==`string`)this.pendingSets.set(e,{name:e,value:t,options:n}),this.pendingDeletes.delete(e);else{let{name:t,value:n,...r}=e;this.pendingSets.set(t,{name:t,value:n,options:r}),this.pendingDeletes.delete(t)}}getPendingChanges(){return{deletes:[...this.pendingDeletes],sets:[...this.pendingSets.values()]}}},t=class{url;constructor(e){this.url=typeof e==`string`?new URL(e):e}get href(){return this.url.href}get origin(){return this.url.origin}get protocol(){return this.url.protocol}get hostname(){return this.url.hostname}get port(){return this.url.port}get pathname(){return this.url.pathname}set pathname(e){this.url.pathname=e}get search(){return this.url.search}set search(e){this.url.search=e}get searchParams(){return this.url.searchParams}get hash(){return this.url.hash}set hash(e){this.url.hash=e}toString(){return this.url.toString()}},n=class n{url;method;headers;cookies;rariUrl;ip;geo;constructor(n,r){n instanceof Request?(this.url=n.url,this.method=n.method,this.headers=new Headers(n.headers)):(this.url=typeof n==`string`?n:n.toString(),this.method=r?.method||`GET`,this.headers=new Headers(r?.headers)),this.rariUrl=new t(this.url),this.cookies=new e(this.headers.get(`cookie`)||void 0),this.ip=r?.ip,this.geo=r?.geo}static fromRequest(e,t){return new n(e,t)}};export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./RariRequest-B7W8PASA.mjs";export{e as RariRequest};
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{getBinaryPath as e,getInstallationInstructions as t}from"./platform.mjs";import{existsSync as n,readFileSync as r}from"node:fs";import{resolve as i}from"node:path";import a from"node:process";import{spawn as o}from"node:child_process";const s=!
|
|
3
|
-
`)){let t=e.trim();if(!t||t.startsWith(`#`))continue;let n=t.match(/^([^=]+)=(.*)$/);if(n){let[,e,t]=n,r=e.trim(),i=t.trim();(i.startsWith(`"`)&&i.endsWith(`"`)||i.startsWith(`'`)&&i.endsWith(`'`))&&(i=i.slice(1,-1)),a.env[r]||(a.env[r]=i)}}}}
|
|
2
|
+
import{getBinaryPath as e,getInstallationInstructions as t}from"./platform.mjs";import{existsSync as n,readFileSync as r}from"node:fs";import{resolve as i}from"node:path";import a from"node:process";import{spawn as o}from"node:child_process";const s=!a.env.NO_COLOR&&!a.argv.includes(`--no-color`)&&(a.env.FORCE_COLOR||a.argv.includes(`--color`)||a.platform===`win32`||a.stdout?.isTTY&&a.env.TERM!==`dumb`||a.env.CI);function c(e,t,n=e){return r=>{let i=String(r),a=i.indexOf(t,e.length);return~a?e+l(i,t,n,a)+t:e+i+t}}function l(e,t,n,r){let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)}const u=s?c:()=>String;var d={isColorSupported:s,black:u(`\x1B[30m`,`\x1B[39m`),red:u(`\x1B[31m`,`\x1B[39m`),green:u(`\x1B[32m`,`\x1B[39m`),yellow:u(`\x1B[33m`,`\x1B[39m`),blue:u(`\x1B[34m`,`\x1B[39m`),cyan:u(`\x1B[36m`,`\x1B[39m`),gray:u(`\x1B[90m`,`\x1B[39m`),bold:u(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),bgCyan:u(`\x1B[46m`,`\x1B[49m`)};function f(e){console.warn(`${d.blue(`info`)} ${e}`)}function p(e){console.warn(`${d.green(`✓`)} ${e}`)}function m(e){console.error(`${d.red(`✗`)} ${e}`)}function h(e){console.warn(`${d.yellow(`⚠`)} ${e}`)}function g(){let e=i(a.cwd(),`.env`);if(n(e)){let t=r(e,`utf-8`);for(let e of t.split(`
|
|
3
|
+
`)){let t=e.trim();if(!t||t.startsWith(`#`))continue;let n=t.match(/^([^=]+)=(.*)$/);if(n){let[,e,t]=n,r=e.trim(),i=t.trim();(i.startsWith(`"`)&&i.endsWith(`"`)||i.startsWith(`'`)&&i.endsWith(`'`))&&(i=i.slice(1,-1)),a.env[r]||(a.env[r]=i)}}}}g();const[,,_,...v]=a.argv;function y(){let e=a.cwd(),t=i(`/`),o=0;for(;e!==t&&o<20;){if(o++,n(i(e,`pnpm-lock.yaml`)))return`pnpm`;if(n(i(e,`yarn.lock`)))return`yarn`;if(n(i(e,`bun.lockb`)))return`bun`;if(n(i(e,`package-lock.json`)))return`npm`;try{let t=i(e,`package.json`);if(n(t)){let e=JSON.parse(r(t,`utf-8`));if(e.packageManager?.startsWith(`pnpm`))return`pnpm`;if(e.packageManager?.startsWith(`yarn`))return`yarn`;if(e.packageManager?.startsWith(`bun`))return`bun`;if(e.packageManager?.startsWith(`npm`))return`npm`}}catch{}let t=i(e,`..`);if(t===e)break;e=t}return`npm`}function b(){let e=y(),t=a.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 x(e,t,n={}){if(e===`npx`){let e=b();if(e.includes(`bun`))return o(e,[`x`,...t],n);if(e.includes(`pnpm`))return o(e,[`exec`,...t],n);if(e.includes(`yarn`))return o(e,[`dlx`,...t],n)}return a.platform===`win32`&&e===`npx`?o(`npx.cmd`,t,n):o(e,t,n)}function S(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function C(){return!!(a.env.RAILWAY_ENVIRONMENT||a.env.RAILWAY_PROJECT_ID||a.env.RAILWAY_SERVICE_ID)}function w(){return!!(a.env.RENDER||a.env.RENDER_SERVICE_ID||a.env.RENDER_SERVICE_NAME)}function T(){return C()||w()}function E(){return C()?`Railway`:w()?`Render`:`local`}function D(){return{port:a.env.PORT||a.env.RSC_PORT||`3000`,mode:a.env.NODE_ENV||`production`,host:T()?`0.0.0.0`:`127.0.0.1`}}async function O(){let{existsSync:e,rmSync:t}=await import(`node:fs`),{resolve:n}=await import(`node:path`),r=n(a.cwd(),`dist`);e(r)&&(f(`Cleaning dist folder...`),t(r,{recursive:!0,force:!0})),f(`Type checking...`);let i=x(`npx`,[`tsgo`],{stdio:`inherit`,cwd:a.cwd()});await new Promise((e,t)=>{i.on(`exit`,n=>{n===0?(p(`Type check passed`),e()):(m(`Type check failed with code ${n}`),t(Error(`Type check failed with code ${n}`)))}),i.on(`error`,t)}),f(`Building for production...`);let o=x(`npx`,[`vite`,`build`],{stdio:`inherit`,cwd:a.cwd()});await new Promise((e,t)=>{o.on(`exit`,n=>{n===0?(p(`Build complete`),e()):(m(`Build failed with code ${n}`),t(Error(`Build failed with code ${n}`)))}),o.on(`error`,t)}),await k()}async function k(){if(n(i(a.cwd(),`dist`,`server`,`image.json`))&&n(i(a.cwd(),`public`)))try{let t=o(e(),[`optimize-images`],{stdio:`inherit`,cwd:a.cwd(),shell:!1});await new Promise(e=>{t.on(`exit`,t=>{t===0||h(`Image pre-optimization exited with code ${t}`),e()}),t.on(`error`,t=>{h(`Image pre-optimization error: ${S(t)}`),e()})})}catch(e){h(`Could not pre-optimize images: ${S(e)}`)}}async function A(){let{existsSync:e}=await import(`node:fs`),{resolve:t}=await import(`node:path`);if(!e(t(a.cwd(),`dist`))){f(`First run detected - building project...`);let e=x(`npx`,[`vite`,`build`,`--mode`,`development`],{stdio:`inherit`,cwd:a.cwd()});await new Promise((t,n)=>{e.on(`exit`,e=>{e===0?(p(`Initial build complete`),t()):(m(`Build failed with code ${e}`),n(Error(`Build failed with code ${e}`)))}),e.on(`error`,n)})}f(`Starting Vite dev server...`);let n=x(`npx`,[`vite`],{stdio:`inherit`,cwd:a.cwd()}),r=()=>{f(`Shutting down dev server...`),n.kill(`SIGTERM`)};return a.on(`SIGINT`,r),a.on(`SIGTERM`,r),n.on(`error`,e=>{m(`Failed to start Vite: ${e.message}`),a.exit(1)}),n.on(`exit`,e=>{e!==0&&e!==null&&(m(`Vite exited with code ${e}`),a.exit(e))}),new Promise(()=>{})}async function j(){let n;try{n=e()}catch{m(`Failed to obtain rari binary`),m(t()),a.exit(1)}let{port:r,mode:i,host:s}=D();if(T()){let e=E();f(`${e} environment detected`),f(`Starting rari server for ${e} deployment...`),f(`Mode: ${i}, Host: ${s}, Port: ${r}`),f(`using binary: ${n}`)}let c=o(n,[`--mode`,i,`--port`,r,`--host`,s],{stdio:`inherit`,cwd:a.cwd(),env:{...a.env,RUST_LOG:a.env.RUST_LOG||`error`}}),l=()=>{f(`shutting down...`),c.kill(`SIGTERM`)};return a.on(`SIGINT`,l),a.on(`SIGTERM`,l),c.on(`error`,e=>{m(`Failed to start rari server: ${e.message}`),e.message.includes(`ENOENT`)&&m(`Binary not found. Please ensure rari is properly installed.`),a.exit(1)}),c.on(`exit`,(e,t)=>{t?f(`server stopped by signal ${t}`):e===0?p(`server stopped successfully`):(m(`server exited with code ${e}`),a.exit(e||1))}),new Promise(()=>{})}async function M(){f(`Setting up Railway deployment...`),T()&&(m(`Already running in ${E()} environment. Use "rari start" instead.`),a.exit(1));let{createRailwayDeployment:e}=await import(`./railway-Bmni6Ev-.mjs`);await e()}async function N(){f(`Setting up Render deployment...`),T()&&(m(`Already running in ${E()} environment. Use "rari start" instead.`),a.exit(1));let{createRenderDeployment:e}=await import(`./render-DiRZ0pBT.mjs`);await e()}async function P(){switch(_){case void 0:case`help`:case`--help`:case`-h`:console.warn(`${d.bold(`rari CLI`)}
|
|
4
4
|
|
|
5
5
|
${d.bold(`Usage:`)}
|
|
6
6
|
${d.cyan(`rari dev`)} Start the development server with Vite
|
|
@@ -63,4 +63,4 @@ ${d.bold(`Notes:`)}
|
|
|
63
63
|
- Platform deployment is automatically detected and configured
|
|
64
64
|
- Use Ctrl+C to stop the server gracefully
|
|
65
65
|
|
|
66
|
-
`);break;case`dev`:await
|
|
66
|
+
`);break;case`dev`:await A();break;case`build`:await O();break;case`start`:await j();break;case`deploy`:v[0]===`railway`?await M():v[0]===`render`?await N():(m(`Unknown deployment target. Available: railway, render`),a.exit(1));break;default:console.error(`${d.bold(`Unknown command:`)} ${_}`),console.warn(`Run "${d.cyan(`rari help`)}" for available commands`),a.exit(1)}}a.argv[1]&&(import.meta.url===`file://${a.argv[1]}`||import.meta.url.endsWith(`/dist/cli.mjs`)&&a.argv[1].includes(`cli.mjs`))&&P().catch(e=>{m(`CLI Error: ${e.message}`),console.error(e),a.exit(1)});export{d as a,h as i,f as n,p as r,m as t};
|
package/dist/client.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as MetadataResult, E as NotFoundEntry, F as extractMetadata, I as extractServerProps, L as extractServerPropsWithCache, M as StaticParamsResult, N as clearPropsCache, O as RouteSegment, P as clearPropsCacheForComponent, R as extractStaticParams, S as LayoutEntry, _ as AppRouteMatch, a as DefaultError, b as GenerateMetadata, c as HttpRuntimeClient, d as RuntimeClient, f as createErrorBoundary, g as AppRouteManifest, h as AppRouteEntry, i as ServerSpamBlockerConfig, j as ServerSidePropsResult, k as RouteSegmentType, l as LoadingSpinner, m as createLoadingBoundary, n as ServerConfig, o as DefaultLoading, p as createHttpRuntimeClient, r as ServerRateLimitConfig, s as ErrorBoundary, t as ServerCSPConfig, u as NotFound, v as ErrorEntry, w as LoadingEntry, x as GenerateStaticParams, y as ErrorProps, z as hasServerSideDataFetching } from "./server-config-DPOhoy43.mjs";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { Component, ErrorInfo, ReactNode } from "react";
|
|
4
4
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
@@ -132,4 +132,4 @@ declare class StatePreserver {
|
|
|
132
132
|
private restoreFocus;
|
|
133
133
|
}
|
|
134
134
|
//#endregion
|
|
135
|
-
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
|
|
135
|
+
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 ServerRateLimitConfig, type ServerSidePropsResult, type ServerSpamBlockerConfig, StatePreserver, type StatePreserverConfig, type StaticParamsResult, clearPropsCache, clearPropsCacheForComponent, createErrorBoundary, createHttpRuntimeClient, createLoadingBoundary, extractMetadata, extractServerProps, extractServerPropsWithCache, extractStaticParams, hasServerSideDataFetching };
|
package/dist/client.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,s as p,t as m,u as h}from"./runtime-client-B15ZQXrE.mjs";import{Component as g,useEffect as _,useRef as v,useState as y}from"react";import{Fragment as b,jsx as x,jsxs as S}from"react/jsx-runtime";function C(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,l=Math.min(s,c);r=setTimeout(p,l)}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}function w(e,t){if(e instanceof Error&&e.name===`AbortError`)return{type:`abort`,message:`Navigation was cancelled`,originalError:e,url:t,timestamp:Date.now(),retryable:!1};if(e instanceof Error&&e.message.includes(`timeout`))return{type:`timeout`,message:`Navigation request timed out`,originalError:e,url:t,timestamp:Date.now(),retryable:!0};if(e instanceof Error&&`status`in e){let n=e.status;return n===404?{type:`not-found`,message:`Page not found`,originalError:e,statusCode:n,url:t,timestamp:Date.now(),retryable:!1}:n>=500?{type:`server-error`,message:`Server error: ${n}`,originalError:e,statusCode:n,url:t,timestamp:Date.now(),retryable:!0}:{type:`fetch-error`,message:`HTTP error: ${n}`,originalError:e,statusCode:n,url:t,timestamp:Date.now(),retryable:n>=500}}return e instanceof TypeError&&e.message.includes(`fetch`)?{type:`network-error`,message:`Network error - check your connection`,originalError:e,url:t,timestamp:Date.now(),retryable:!0}:e instanceof SyntaxError||e instanceof Error&&e.message.includes(`parse`)?{type:`parse-error`,message:`Failed to parse server response`,originalError:e instanceof Error?e:void 0,url:t,timestamp:Date.now(),retryable:!1}:{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}}var T=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=w(e,t);return this.options.onError(n),console.error(`[rari] Navigation:`,n.type,n.message,{url:n.url,statusCode:n.statusCode,retryable:n.retryable}),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`rari:navigation-error`,{detail:n})),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 E(e){if(!e||e===`/`)return`/`;let t=e.replace(/\/+$/,``);return t.startsWith(`/`)||(t=`/${t}`),t}function D(e,t){try{return new URL(e,t||window.location.origin).origin!==(t||window.location.origin)}catch{return!1}}function O(e){try{let t=new URL(e,window.location.origin);return t.pathname+t.hash}catch{return e}}function k({error:e,onRetry:t,onReload:n,onDismiss:r,retryCount:i=0,maxRetries:a=3}){let o=e.retryable&&i<a;return x(`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:S(`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:[S(`div`,{style:{display:`flex`,alignItems:`center`,gap:`12px`,marginBottom:`16px`},children:[x(`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`❌`}})()}),x(`h2`,{style:{margin:0,fontSize:`20px`,fontWeight:`600`,color:`#1f2937`},children:`Navigation Error`})]}),x(`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&&S(`details`,{style:{marginBottom:`16px`,fontSize:`13px`,color:`#6b7280`},children:[x(`summary`,{style:{cursor:`pointer`,userSelect:`none`,marginBottom:`8px`},children:`Technical details`}),S(`div`,{style:{padding:`12px`,background:`#f9fafb`,borderRadius:`4px`,fontFamily:`monospace`,fontSize:`12px`,wordBreak:`break-all`},children:[S(`div`,{style:{marginBottom:`4px`},children:[x(`strong`,{children:`URL:`}),` `,e.url]}),e.statusCode&&S(`div`,{style:{marginBottom:`4px`},children:[x(`strong`,{children:`Status:`}),` `,e.statusCode]}),S(`div`,{style:{marginBottom:`4px`},children:[x(`strong`,{children:`Type:`}),` `,e.type]}),e.originalError&&S(`div`,{children:[x(`strong`,{children:`Error:`}),` `,e.originalError.message]})]})]}),o&&i>0&&S(`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]}),S(`div`,{style:{display:`flex`,gap:`8px`,flexWrap:`wrap`},children:[o&&t&&x(`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&&x(`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&&x(`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`})]}),x(`p`,{style:{marginTop:`16px`,marginBottom:0,fontSize:`12px`,color:`#9ca3af`,textAlign:`center`},children:`Your current page is still available below this message`})]})})}const A=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={path:e},n=await fetch(`/_rari/route-info`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json();throw Error(e.error||`Failed to fetch route info`)}return n.json()}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=A}var j=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);Array.from(i.entries()).length>0&&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 M(e){e.title&&(document.title=e.title);let t=(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)}};if(e.description&&t(`meta[name="description"]`,{name:`description`,content:e.description}),e.keywords&&e.keywords.length>0&&t(`meta[name="keywords"]`,{name:`keywords`,content:e.keywords.join(`, `)}),e.viewport&&t(`meta[name="viewport"]`,{name:`viewport`,content:e.viewport}),e.canonical){let t=document.querySelector(`link[rel="canonical"]`);t||(t=document.createElement(`link`),t.setAttribute(`rel`,`canonical`),document.head.appendChild(t)),t.setAttribute(`href`,e.canonical)}if(e.robots){let n=[];e.robots.index!==void 0&&n.push(e.robots.index?`index`:`noindex`),e.robots.follow!==void 0&&n.push(e.robots.follow?`follow`:`nofollow`),e.robots.nocache&&n.push(`nocache`),n.length>0&&t(`meta[name="robots"]`,{name:`robots`,content:n.join(`, `)})}if(e.openGraph){let n=e.openGraph;if(n.title&&t(`meta[property="og:title"]`,{property:`og:title`,content:n.title}),n.description&&t(`meta[property="og:description"]`,{property:`og:description`,content:n.description}),n.url&&t(`meta[property="og:url"]`,{property:`og:url`,content:n.url}),n.siteName&&t(`meta[property="og:site_name"]`,{property:`og:site_name`,content:n.siteName}),n.type&&t(`meta[property="og:type"]`,{property:`og:type`,content:n.type}),n.images&&n.images.length>0){document.querySelectorAll(`meta[property="og:image"]`).forEach(e=>e.remove());for(let e of n.images){let t=document.createElement(`meta`);t.setAttribute(`property`,`og:image`),t.setAttribute(`content`,e),document.head.appendChild(t)}}}if(e.twitter){let n=e.twitter;if(n.card&&t(`meta[name="twitter:card"]`,{name:`twitter:card`,content:n.card}),n.site&&t(`meta[name="twitter:site"]`,{name:`twitter:site`,content:n.site}),n.creator&&t(`meta[name="twitter:creator"]`,{name:`twitter:creator`,content:n.creator}),n.title&&t(`meta[name="twitter:title"]`,{name:`twitter:title`,content:n.title}),n.description&&t(`meta[name="twitter:description"]`,{name:`twitter:description`,content:n.description}),n.images&&n.images.length>0){document.querySelectorAll(`meta[name="twitter:image"]`).forEach(e=>e.remove());for(let e of n.images){let t=document.createElement(`meta`);t.setAttribute(`name`,`twitter:image`),t.setAttribute(`content`,e),document.head.appendChild(t)}}}}function N({children:e,initialRoute:t}){let[n,r]=y(()=>({currentRoute:E(t),navigationId:0,error:null})),i=v(null),a=v(!0),o=v(E(t)),s=v(new T({timeout:1e4,maxRetries:3,onError:e=>{console.error(`[rari] Router: Navigation error:`,e)},onRetry:()=>{}})),c=v(new Map),l=v([]),u=v(new j({maxHistorySize:50})),d=()=>`${Date.now()}-${Math.random().toString(36).substring(2,9)}`,f=()=>{i.current&&=(i.current.abort(),null)},p=()=>{for(let[,e]of c.current.entries())e.abortController.abort();c.current.clear()},m=(e,t)=>{c.current.delete(e),a.current&&n.navigationId===t&&r(e=>({...e}))},h=async e=>A.get(e),g=v(null),w=async(e,t={})=>{if(!e||typeof e!=`string`){console.error(`[rari] Router: Invalid navigation target:`,e);return}let[l,_]=e.includes(`#`)?e.split(`#`):[e,``],v=E(l);if(v===o.current&&!t.replace){if(_){let e=document.getElementById(_);e&&(e.scrollIntoView({behavior:`smooth`,block:`start`}),window.history.pushState(window.history.state,``,`${v}#${_}`))}return}let y=c.current.get(v);if(y)return y.promise;let b=await h(v);p(),f();let x=new AbortController;i.current=x;let S=n.navigationId+1,C=(async()=>{let e=o.current;try{t.historyKey||u.current.captureState(e);let n=t.historyKey||d(),i={route:v,navigationId:S,scrollPosition:{x:window.scrollX,y:window.scrollY},timestamp:Date.now(),key:n},l=_?`${v}#${_}`:v;t.replace?window.history.replaceState(i,``,l):window.history.pushState(i,``,l);let f=window.location.origin+v,p=await fetch(f,{headers:{Accept:`text/x-component`},signal:x.signal});if(!p.ok)throw Error(`Failed to fetch: ${p.status}`);let h=new URL(p.url).pathname,y=h===v?v:h;if(h!==v){let e=_?`${h}#${_}`:h;window.history.replaceState({route:h,navigationId:S,scrollPosition:{x:window.scrollX,y:window.scrollY},timestamp:Date.now(),key:t.historyKey||d()},``,e)}if(x.signal.aborted){m(y,S);return}try{let e=p.headers.get(`x-rari-metadata`);if(e){let t=decodeURIComponent(e);M(JSON.parse(t))}}catch{}if(p.headers.get(`x-render-mode`)===`streaming`&&p.body){let n=p.body.getReader(),r=new TextDecoder,i=``;try{for(;;){let{done:e,value:t}=await n.read();if(e)break;if(x.signal.aborted){await n.cancel(),m(y,S);return}i+=r.decode(t,{stream:!0});let a=i.split(`
|
|
2
|
-
`);i=a.pop()||``;for(let e of a)e.trim()&&window.dispatchEvent(new CustomEvent(`rari:rsc-row`,{detail:{rscRow:e}}))}i.trim()&&window.dispatchEvent(new CustomEvent(`rari:rsc-row`,{detail:{rscRow:i}})),window.dispatchEvent(new CustomEvent(`rari:navigate`,{detail:{from:e,to:y,navigationId:S,options:t,routeInfo:b,abortSignal:x.signal,isStreaming:!0}}))}catch(e){throw console.error(`[rari] Router: Streaming error:`,e),e}}else{let n=await p.text();window.dispatchEvent(new CustomEvent(`rari:navigate`,{detail:{from:e,to:y,navigationId:S,options:t,routeInfo:b,abortSignal:x.signal,rscWireFormat:n}}))}if(x.signal.aborted){m(y,S);return}a.current&&(o.current=y,r(e=>({...e,currentRoute:y,error:null})),s.current.resetRetry(y),t.historyKey?requestAnimationFrame(()=>{u.current.restoreState(y)}):_&&requestAnimationFrame(()=>{let e=(t=0)=>{let n=document.getElementById(_);n?n.scrollIntoView({behavior:`smooth`,block:`start`}):t<10&&setTimeout(
|
|
1
|
+
import{a as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,s as p,t as m,u as h}from"./runtime-client-Jllyf7Ly.mjs";import{Component as g,useEffect as _,useRef as v,useState as y}from"react";import{Fragment as b,jsx as x,jsxs as S}from"react/jsx-runtime";function C(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,l=Math.min(s,c);r=setTimeout(p,l)}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}function w(e,t){if(e instanceof Error&&e.name===`AbortError`)return{type:`abort`,message:`Navigation was cancelled`,originalError:e,url:t,timestamp:Date.now(),retryable:!1};if(e instanceof Error&&e.message.includes(`timeout`))return{type:`timeout`,message:`Navigation request timed out`,originalError:e,url:t,timestamp:Date.now(),retryable:!0};if(e instanceof Error&&`status`in e){let n=e.status;return n===404?{type:`not-found`,message:`Page not found`,originalError:e,statusCode:n,url:t,timestamp:Date.now(),retryable:!1}:n>=500?{type:`server-error`,message:`Server error: ${n}`,originalError:e,statusCode:n,url:t,timestamp:Date.now(),retryable:!0}:{type:`fetch-error`,message:`HTTP error: ${n}`,originalError:e,statusCode:n,url:t,timestamp:Date.now(),retryable:n>=500}}return e instanceof TypeError&&e.message.includes(`fetch`)?{type:`network-error`,message:`Network error - check your connection`,originalError:e,url:t,timestamp:Date.now(),retryable:!0}:e instanceof SyntaxError||e instanceof Error&&e.message.includes(`parse`)?{type:`parse-error`,message:`Failed to parse server response`,originalError:e instanceof Error?e:void 0,url:t,timestamp:Date.now(),retryable:!1}:{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}}var T=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=w(e,t);return this.options.onError(n),console.error(`[rari] Navigation:`,n.type,n.message,{url:n.url,statusCode:n.statusCode,retryable:n.retryable}),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`rari:navigation-error`,{detail:n})),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 E(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 D(e,t){try{return new URL(e,t||window.location.origin).origin!==(t||window.location.origin)}catch{return!1}}function O(e){try{let t=new URL(e,window.location.origin);return t.pathname+t.hash}catch{return e}}function k({error:e,onRetry:t,onReload:n,onDismiss:r,retryCount:i=0,maxRetries:a=3}){let o=e.retryable&&i<a;return x(`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:S(`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:[S(`div`,{style:{display:`flex`,alignItems:`center`,gap:`12px`,marginBottom:`16px`},children:[x(`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`❌`}})()}),x(`h2`,{style:{margin:0,fontSize:`20px`,fontWeight:`600`,color:`#1f2937`},children:`Navigation Error`})]}),x(`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&&S(`details`,{style:{marginBottom:`16px`,fontSize:`13px`,color:`#6b7280`},children:[x(`summary`,{style:{cursor:`pointer`,userSelect:`none`,marginBottom:`8px`},children:`Technical details`}),S(`div`,{style:{padding:`12px`,background:`#f9fafb`,borderRadius:`4px`,fontFamily:`monospace`,fontSize:`12px`,wordBreak:`break-all`},children:[S(`div`,{style:{marginBottom:`4px`},children:[x(`strong`,{children:`URL:`}),` `,e.url]}),e.statusCode&&S(`div`,{style:{marginBottom:`4px`},children:[x(`strong`,{children:`Status:`}),` `,e.statusCode]}),S(`div`,{style:{marginBottom:`4px`},children:[x(`strong`,{children:`Type:`}),` `,e.type]}),e.originalError&&S(`div`,{children:[x(`strong`,{children:`Error:`}),` `,e.originalError.message]})]})]}),o&&i>0&&S(`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]}),S(`div`,{style:{display:`flex`,gap:`8px`,flexWrap:`wrap`},children:[o&&t&&x(`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&&x(`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&&x(`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`})]}),x(`p`,{style:{marginTop:`16px`,marginBottom:0,fontSize:`12px`,color:`#9ca3af`,textAlign:`center`},children:`Your current page is still available below this message`})]})})}const A=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={path:e},n=await fetch(`/_rari/route-info`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json();throw Error(e.error||`Failed to fetch route info`)}return n.json()}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=A}var j=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 M(e){e.title&&(document.title=e.title);let t=(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)}};if(e.description&&t(`meta[name="description"]`,{name:`description`,content:e.description}),e.keywords&&e.keywords.length>0&&t(`meta[name="keywords"]`,{name:`keywords`,content:e.keywords.join(`, `)}),e.viewport&&t(`meta[name="viewport"]`,{name:`viewport`,content:e.viewport}),e.canonical){let t=document.querySelector(`link[rel="canonical"]`);t||(t=document.createElement(`link`),t.setAttribute(`rel`,`canonical`),document.head.appendChild(t)),t.setAttribute(`href`,e.canonical)}if(e.robots){let n=[];e.robots.index!==void 0&&n.push(e.robots.index?`index`:`noindex`),e.robots.follow!==void 0&&n.push(e.robots.follow?`follow`:`nofollow`),e.robots.nocache&&n.push(`nocache`),n.length>0&&t(`meta[name="robots"]`,{name:`robots`,content:n.join(`, `)})}if(e.openGraph){let n=e.openGraph;if(n.title&&t(`meta[property="og:title"]`,{property:`og:title`,content:n.title}),n.description&&t(`meta[property="og:description"]`,{property:`og:description`,content:n.description}),n.url&&t(`meta[property="og:url"]`,{property:`og:url`,content:n.url}),n.siteName&&t(`meta[property="og:site_name"]`,{property:`og:site_name`,content:n.siteName}),n.type&&t(`meta[property="og:type"]`,{property:`og:type`,content:n.type}),n.images&&n.images.length>0){document.querySelectorAll(`meta[property="og:image"]`).forEach(e=>e.remove());for(let e of n.images){let t=document.createElement(`meta`);t.setAttribute(`property`,`og:image`),t.setAttribute(`content`,e),document.head.appendChild(t)}}}if(e.twitter){let n=e.twitter;if(n.card&&t(`meta[name="twitter:card"]`,{name:`twitter:card`,content:n.card}),n.site&&t(`meta[name="twitter:site"]`,{name:`twitter:site`,content:n.site}),n.creator&&t(`meta[name="twitter:creator"]`,{name:`twitter:creator`,content:n.creator}),n.title&&t(`meta[name="twitter:title"]`,{name:`twitter:title`,content:n.title}),n.description&&t(`meta[name="twitter:description"]`,{name:`twitter:description`,content:n.description}),n.images&&n.images.length>0){document.querySelectorAll(`meta[name="twitter:image"]`).forEach(e=>e.remove());for(let e of n.images){let t=document.createElement(`meta`);t.setAttribute(`name`,`twitter:image`),t.setAttribute(`content`,e),document.head.appendChild(t)}}}}function N({children:e,initialRoute:t}){let[n,r]=y(()=>({currentRoute:E(t),navigationId:0,error:null})),i=v(null),a=v(!0),o=v(E(t)),s=v(new T({timeout:1e4,maxRetries:3,onError:e=>{console.error(`[rari] Router: Navigation error:`,e)},onRetry:()=>{}})),c=v(new Map),l=v([]),u=v(new j({maxHistorySize:50})),d=()=>`${Date.now()}-${Math.random().toString(36).substring(2,9)}`,f=()=>{i.current&&=(i.current.abort(),null)},p=()=>{for(let[,e]of c.current.entries())e.abortController.abort();c.current.clear()},m=(e,t)=>{c.current.delete(e),a.current&&n.navigationId===t&&r(e=>({...e}))},h=async e=>A.get(e),g=v(null),w=async(e,t={})=>{if(!e||typeof e!=`string`){console.error(`[rari] Router: Invalid navigation target:`,e);return}let[l,_]=e.includes(`#`)?e.split(`#`):[e,``],v=E(l);if(v===o.current&&!t.replace){if(_){let e=document.getElementById(_);e&&(e.scrollIntoView({behavior:`smooth`,block:`start`}),window.history.pushState(window.history.state,``,`${v}#${_}`))}return}let y=c.current.get(v);if(y)return y.promise;let b=await h(v);p(),f();let x=new AbortController;i.current=x;let S=n.navigationId+1,C=(async()=>{let e=o.current;try{t.historyKey||u.current.captureState(e);let n=t.historyKey||d(),i={route:v,navigationId:S,scrollPosition:{x:window.scrollX,y:window.scrollY},timestamp:Date.now(),key:n},l=_?`${v}#${_}`:v;t.replace?window.history.replaceState(i,``,l):window.history.pushState(i,``,l);let f=window.location.origin+v,p=await fetch(f,{headers:{Accept:`text/x-component`},signal:x.signal});if(!p.ok)throw Error(`Failed to fetch: ${p.status}`);let h=new URL(p.url).pathname,y=h===v?v:h;if(h!==v){let e=_?`${h}#${_}`:h;window.history.replaceState({route:h,navigationId:S,scrollPosition:{x:window.scrollX,y:window.scrollY},timestamp:Date.now(),key:t.historyKey||d()},``,e)}if(x.signal.aborted){m(y,S);return}try{let e=p.headers.get(`x-rari-metadata`);if(e){let t=decodeURIComponent(e);M(JSON.parse(t))}}catch{}if(p.headers.get(`x-render-mode`)===`streaming`&&p.body){let n=p.body.getReader(),r=new TextDecoder,i=``;try{for(;;){let{done:e,value:t}=await n.read();if(e)break;if(x.signal.aborted){await n.cancel(),m(y,S);return}i+=r.decode(t,{stream:!0});let a=i.split(`
|
|
2
|
+
`);i=a.pop()||``;for(let e of a)e.trim()&&window.dispatchEvent(new CustomEvent(`rari:rsc-row`,{detail:{rscRow:e}}))}i.trim()&&window.dispatchEvent(new CustomEvent(`rari:rsc-row`,{detail:{rscRow:i}})),window.dispatchEvent(new CustomEvent(`rari:navigate`,{detail:{from:e,to:y,navigationId:S,options:t,routeInfo:b,abortSignal:x.signal,isStreaming:!0}}))}catch(e){throw console.error(`[rari] Router: Streaming error:`,e),e}}else{let n=await p.text();window.dispatchEvent(new CustomEvent(`rari:navigate`,{detail:{from:e,to:y,navigationId:S,options:t,routeInfo:b,abortSignal:x.signal,rscWireFormat:n}}))}if(x.signal.aborted){m(y,S);return}a.current&&(o.current=y,r(e=>({...e,currentRoute:y,error:null})),s.current.resetRetry(y),t.historyKey?requestAnimationFrame(()=>{u.current.restoreState(y)}):_&&requestAnimationFrame(()=>{let e=(t=0)=>{let n=document.getElementById(_);n?n.scrollIntoView({behavior:`smooth`,block:`start`}):t<10&&setTimeout(e,50,t+1)};e()})),c.current.delete(v),g.current?.()}catch(t){if(t instanceof Error&&t.name===`AbortError`){m(v,S);return}let n=s.current.handleError(t,v);a.current&&r(e=>({...e,error:n})),c.current.delete(v),window.dispatchEvent(new CustomEvent(`rari:navigate-error`,{detail:{from:e,to:v,error:n,navigationId:S}})),g.current?.()}})();return c.current.set(v,{targetPath:v,navigationId:S,promise:C,abortController:x}),C};g.current=async()=>{if(l.current.length===0)return;let e=l.current.at(-1);e&&(l.current=[],await w(e.path,e.options))};let N=v(null);N.current||=C((e,t)=>{w(e,t)},50,{leading:!1,trailing:!0,maxWait:200});let P=N.current,F=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&&!D(r)){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(),P(O(r),{replace:!1})}},I=e=>{let t=window.location.pathname,n=e.state;w(t,{replace:!0,scroll:!1,historyKey:n?.key})},L=()=>{if(n.error&&n.error.url){let e=n.error.url;s.current.incrementRetry(e),w(e,{replace:!1})}},R=()=>{window.location.reload()},z=()=>{r(e=>({...e,error:null}))};_(()=>{let e=window.history.state;if(!e||!e.key){let e={route:n.currentRoute,navigationId:n.navigationId,scrollPosition:{x:window.scrollX,y:window.scrollY},timestamp:Date.now(),key:d()};window.history.replaceState(e,``,window.location.pathname+window.location.search)}},[]);let B=e=>{if(e.persisted){let e=window.location.pathname;u.current.captureState(e)}},V=e=>{if(e.persisted){let e=window.location.pathname,t=window.history.state;requestAnimationFrame(()=>{u.current.restoreState(e),t?.scrollPosition&&window.scrollTo(t.scrollPosition.x,t.scrollPosition.y)})}};return _(()=>(document.addEventListener(`click`,F),window.addEventListener(`popstate`,I),window.addEventListener(`pagehide`,B),window.addEventListener(`pageshow`,V),()=>{document.removeEventListener(`click`,F),window.removeEventListener(`popstate`,I),window.removeEventListener(`pagehide`,B),window.removeEventListener(`pageshow`,V),a.current=!1,f(),p(),P.cancel&&P.cancel()}),[]),S(b,{children:[e,n.error&&x(k,{error:n.error,onRetry:L,onReload:R,onDismiss:z,retryCount:s.current.getRetryCount(n.error.url||``),maxRetries:3})]})}var P=class extends g{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):S(`div`,{style:{padding:`16px`,margin:`16px 0`,background:`#fee`,border:`1px solid #fcc`,borderRadius:`4px`},children:[x(`h3`,{style:{margin:`0 0 8px 0`,color:`#c00`},children:`Layout Error`}),S(`p`,{style:{margin:`0 0 8px 0`,fontSize:`14px`},children:[`An error occurred in layout:`,` `,x(`code`,{children:this.props.layoutPath})]}),S(`details`,{style:{fontSize:`12px`,marginBottom:`8px`},children:[x(`summary`,{style:{cursor:`pointer`},children:`Error details`}),S(`pre`,{style:{marginTop:`8px`,padding:`8px`,background:`#fff`,border:`1px solid #ddd`,borderRadius:`2px`,overflow:`auto`},children:[this.state.error.message,`
|
|
3
3
|
`,this.state.error.stack]})]}),x(`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{N as ClientRouter,m as DefaultError,l as DefaultLoading,f as ErrorBoundary,o as HttpRuntimeClient,P as LayoutErrorBoundary,e as LoadingSpinner,T as NavigationErrorHandler,k as NavigationErrorOverlay,u as NotFound,j as StatePreserver,h as clearPropsCache,n as clearPropsCacheForComponent,p as createErrorBoundary,t as createHttpRuntimeClient,s as createLoadingBoundary,r as extractMetadata,d as extractServerProps,c as extractServerPropsWithCache,a as extractStaticParams,i as hasServerSideDataFetching};
|
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-DZAg-dr0.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`,e.href=T?T({src:M,width:k||1920,quality:p}):w?M:f(M,k||1920,p),y&&e.setAttribute(`imagesizes`,y),document.head.appendChild(e),()=>{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}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,p as Image};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { A as SitemapImage, C as ApiRouteHandlers, D as RobotsRule, E as Robots, O as Sitemap, S as ApiResponse, T as RouteHandler, _ as ProxyResult, a as rari, b as RequestCookies, c as ProxyPluginOptions, d as RariRequest, f as CookieOptions, g as ProxyModule, h as ProxyMatcher, i as defineRariOptions, j as SitemapVideo, k as SitemapEntry, l as rariProxy, m as ProxyFunction, n as Response, o as rariRouter, p as ProxyConfig, r as defineRariConfig, s as generateAppRouteManifest, t as Request, u as RariResponse, v as RariFetchEvent, w as RouteContext, x as ResponseCookies, y as RariURL } from "./vite-
|
|
3
|
-
export { ApiResponse, ApiRouteHandlers, AppRouteEntry, AppRouteManifest, AppRouteMatch, CookieOptions, ErrorEntry, ErrorProps, GenerateMetadata, GenerateStaticParams, HttpRuntimeClient, LayoutEntry, LayoutProps, LoadingEntry, MetadataResult, NotFoundEntry, PageProps, ProxyConfig, ProxyFunction, ProxyMatcher, ProxyModule, ProxyPluginOptions, ProxyResult, RariFetchEvent, RariRequest, RariResponse, RariURL, Request, RequestCookies, Response, ResponseCookies, type Robots, type RobotsRule, RouteContext, RouteHandler, RouteSegment, RouteSegmentType, RuntimeClient,
|
|
1
|
+
import { A as MetadataResult, C as LayoutProps, D as PageProps, E as NotFoundEntry, F as extractMetadata, I as extractServerProps, L as extractServerPropsWithCache, M as StaticParamsResult, N as clearPropsCache, O as RouteSegment, P as clearPropsCacheForComponent, R as extractStaticParams, S as LayoutEntry, T as Metadata, _ as AppRouteMatch, b as GenerateMetadata, c as HttpRuntimeClient, d as RuntimeClient, g as AppRouteManifest, h as AppRouteEntry, i as ServerSpamBlockerConfig, j as ServerSidePropsResult, k as RouteSegmentType, n as ServerConfig, p as createHttpRuntimeClient, r as ServerRateLimitConfig, t as ServerCSPConfig, v as ErrorEntry, w as LoadingEntry, x as GenerateStaticParams, y as ErrorProps, z as hasServerSideDataFetching } from "./server-config-DPOhoy43.mjs";
|
|
2
|
+
import { A as SitemapImage, C as ApiRouteHandlers, D as RobotsRule, E as Robots, O as Sitemap, S as ApiResponse, T as RouteHandler, _ as ProxyResult, a as rari, b as RequestCookies, c as ProxyPluginOptions, d as RariRequest, f as CookieOptions, g as ProxyModule, h as ProxyMatcher, i as defineRariOptions, j as SitemapVideo, k as SitemapEntry, l as rariProxy, m as ProxyFunction, n as Response, o as rariRouter, p as ProxyConfig, r as defineRariConfig, s as generateAppRouteManifest, t as Request, u as RariResponse, v as RariFetchEvent, w as RouteContext, x as ResponseCookies, y as RariURL } from "./vite-C-viRQS3.mjs";
|
|
3
|
+
export { ApiResponse, ApiRouteHandlers, AppRouteEntry, AppRouteManifest, AppRouteMatch, CookieOptions, ErrorEntry, ErrorProps, GenerateMetadata, GenerateStaticParams, HttpRuntimeClient, LayoutEntry, LayoutProps, LoadingEntry, type Metadata, MetadataResult, NotFoundEntry, PageProps, ProxyConfig, ProxyFunction, ProxyMatcher, ProxyModule, ProxyPluginOptions, ProxyResult, RariFetchEvent, RariRequest, RariResponse, RariURL, Request, RequestCookies, Response, ResponseCookies, type Robots, type RobotsRule, RouteContext, RouteHandler, RouteSegment, RouteSegmentType, RuntimeClient, ServerCSPConfig, ServerConfig, ServerRateLimitConfig, ServerSidePropsResult, ServerSpamBlockerConfig, type Sitemap, type SitemapEntry, type SitemapImage, type SitemapVideo, StaticParamsResult, clearPropsCache, clearPropsCacheForComponent, createHttpRuntimeClient, defineRariConfig, defineRariOptions, extractMetadata, extractServerProps, extractServerPropsWithCache, extractStaticParams, generateAppRouteManifest, hasServerSideDataFetching, rari, rariProxy, rariRouter };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./vite-
|
|
1
|
+
import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./vite-BBcW4h-2.mjs";import{t as s}from"./RariRequest-B7W8PASA.mjs";import{c,d as l,f as u,g as d,h as f,i as p,m,p as h,u as g}from"./runtime-client-Jllyf7Ly.mjs";import{t as _}from"./routes-KDxjyeNA.mjs";import"./constants-DZAg-dr0.mjs";import"./server-build-YlAAZIGW.mjs";export{a as ApiResponse,p as HttpRuntimeClient,s as RariRequest,r as RariResponse,g as clearPropsCache,l as clearPropsCacheForComponent,c as createHttpRuntimeClient,o as defineRariConfig,n as defineRariOptions,u as extractMetadata,h as extractServerProps,m as extractServerPropsWithCache,f as extractStaticParams,_ as generateAppRouteManifest,d as hasServerSideDataFetching,i as rari,e as rariProxy,t as rariRouter};
|
package/dist/platform.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{existsSync as e}from"node:fs";import{join as t}from"node:path";import n from"node:process";import{fileURLToPath as r}from"node:url";const i={"linux-x64":`rari-linux-x64`,"linux-arm64":`rari-linux-arm64`,"darwin-x64":`rari-darwin-x64`,"darwin-arm64":`rari-darwin-arm64`,"win32-x64":`rari-win32-x64`};function a(){let e=n.platform,t=n.arch,r;switch(e){case`darwin`:r=`darwin`;break;case`linux`:r=`linux`;break;case`win32`:r=`win32`;break;default:throw Error(`Unsupported platform: ${e}. rari supports Linux, macOS, and Windows.`)}let a;switch(t){case`x64`:a=`x64`;break;case`arm64`:a=`arm64`;break;default:throw Error(`Unsupported architecture: ${t}. rari supports x64 and ARM64.`)}let o=i[`${r}-${a}`];if(!o)throw Error(`Unsupported platform combination: ${r}-${a}. Supported platforms: ${Object.keys(i).join(`, `)}`);return{platform:r,arch:a,packageName:o,binaryName:r===`win32`?`rari.exe`:`rari`}}function o(){let{packageName:i,binaryName:o}=a();try{let r=n.cwd(),a=null;for(;r!==`/`&&r!==``;){if(e(t(r,`packages`))){a=r;break}r=t(r,`..`)}if(a){let n=t(t(a,`packages`,i),`bin`,o);if(e(n))return n}}catch{}try{let n=import.meta.resolve(`${i}/package.json`),a=t(r(new URL(`.`,n)),`bin`,o);if(e(a))return a;throw Error(`Binary not found at ${a}`)}catch{throw Error(`Failed to locate rari binary for ${i}. Please ensure the platform package is installed: npm install ${i}`)}}function s(){let{packageName:e}=a();return`
|
|
2
2
|
To install rari for your platform, run:
|
|
3
3
|
|
|
4
4
|
npm install ${e}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
async function e(e){try{let t=await import(e);if(!t||!t.proxy)return console.error(`[rari] Proxy: proxy function not found in module`),!1;let{RariRequest:n}=await import(`../RariRequest-
|
|
1
|
+
async function e(e){try{let t=await import(e);if(!t||!t.proxy)return console.error(`[rari] Proxy: proxy function not found in module`),!1;let{RariRequest:n}=await import(`../RariRequest-Db4obWIC.mjs`);return globalThis.__rariExecuteProxy=async function(e){try{let r=new n(e.url,{method:e.method,headers:new Headers(e.headers)}),i=[],a=await t.proxy(r,{waitUntil:e=>{i.push(e)}});if(i.length>0&&Promise.allSettled(i).catch(e=>{console.error(`[rari] Proxy: waitUntil promise failed:`,e)}),!a)return{continue:!0};let o=a.headers?.get?.(`x-rari-proxy-continue`),s=a.headers?.get?.(`x-rari-proxy-rewrite`);if(s)return{continue:!1,rewrite:s};let c=a.headers?.get?.(`location`);if(c&&a.status>=300&&a.status<400)return{continue:!1,redirect:{destination:c,permanent:a.status===301||a.status===308}};if(o===`true`){let e={},t={};return a.headers?.forEach&&a.headers.forEach((n,r)=>{if(r.startsWith(`x-rari-proxy-request-`)){let t=r.replace(`x-rari-proxy-request-`,``);e[t]=n}else r.startsWith(`x-rari-proxy-`)||(t[r]=n)}),{continue:!0,requestHeaders:Object.keys(e).length>0?e:void 0,responseHeaders:Object.keys(t).length>0?t:void 0}}if(a.status){let e={};a.headers?.forEach&&a.headers.forEach((t,n)=>{e[n]=t});let t;try{a.text&&typeof a.text==`function`?t=await a.text():a.body&&(t=String(a.body))}catch{}return{continue:!1,response:{status:a.status,headers:e,body:t}}}return{continue:!0}}catch(e){return console.error(`[rari] Proxy: Proxy execution error:`,e),{continue:!0}}},!0}catch(e){return console.error(`[rari] Proxy: Failed to initialize proxy executor:`,e),!1}}export{e as initializeProxyExecutor};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import{a as e,i as t,n,r,t as i}from"./cli.mjs";import{t as a}from"./utils-BmuB-L9i.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";async function d(){let d=u.cwd();n(`Creating Railway deployment configuration...`);let f=l(d,`package.json`);o(f)||(i(`No package.json found. Please run this command from your project root.`),u.exit(1));try{let e=JSON.parse(s(f,`utf-8`));e.scripts=e.scripts||{},e.scripts.start&&e.scripts.start!==`rari start`&&(t(`Existing start script found: "${e.scripts.start}"`),t(`Backing up to start:original and replacing with "rari start"`),e.scripts[`start:original`]=e.scripts.start),e.scripts.start=`rari start`,e.scripts[`start:local`]=`rari start`,e.scripts[`deploy:railway`]=`echo "Push to GitHub and connect to Railway to deploy"`,e.engines=e.engines||{},e.engines.node?a(e.engines.node)||(t(`Current engines.node value "${e.engines.node}" may not meet the required minimum of >=22.0.0`),t(`Updating to >=22.0.0 for Railway deployment compatibility`),e.engines.node=`>=22.0.0`):e.engines.node=`>=22.0.0`,(!e.dependencies||!e.dependencies.rari)&&(n(`Adding rari dependency...`),e.dependencies=e.dependencies||{},e.dependencies.rari=`^0.1.0`),c(f,`${JSON.stringify(e,null,2)}\n`),r(`Updated package.json for Railway deployment`)}catch(e){i(`Failed to update package.json: ${e instanceof Error?e.message:`Unknown error`}`),u.exit(1)}let p=l(d,`railway.toml`);if(o(p)){t(`railway.toml already exists, backing up to railway.toml.backup`);let e=s(p,`utf-8`);c(l(d,`railway.toml.backup`),e)}c(p,`[build]
|
|
2
|
+
builder = "RAILPACK"
|
|
3
|
+
|
|
4
|
+
[deploy]
|
|
5
|
+
startCommand = "npm start"
|
|
6
|
+
healthcheckPath = "/"
|
|
7
|
+
healthcheckTimeout = 300
|
|
8
|
+
restartPolicyType = "ON_FAILURE"
|
|
9
|
+
restartPolicyMaxRetries = 3
|
|
10
|
+
`),r(`Created railway.toml configuration`);let m=l(d,`.gitignore`),h=[``,`# Railway`,`.railway/`,``].join(`
|
|
11
|
+
`);if(o(m)){let e=s(m,`utf-8`);e.includes(`.railway/`)||(c(m,e+h),r(`Updated .gitignore with Railway entries`))}else c(m,`# Dependencies
|
|
12
|
+
node_modules/
|
|
13
|
+
.pnpm-store/
|
|
14
|
+
|
|
15
|
+
# Build outputs
|
|
16
|
+
dist/
|
|
17
|
+
|
|
18
|
+
# Environment variables
|
|
19
|
+
.env
|
|
20
|
+
.env.local
|
|
21
|
+
.env.production
|
|
22
|
+
|
|
23
|
+
# Railway
|
|
24
|
+
.railway/
|
|
25
|
+
|
|
26
|
+
# Logs
|
|
27
|
+
*.log
|
|
28
|
+
npm-debug.log*
|
|
29
|
+
pnpm-debug.log*
|
|
30
|
+
|
|
31
|
+
# OS files
|
|
32
|
+
.DS_Store
|
|
33
|
+
Thumbs.db
|
|
34
|
+
|
|
35
|
+
# IDE files
|
|
36
|
+
.vscode/
|
|
37
|
+
.idea/
|
|
38
|
+
*.swp
|
|
39
|
+
*.swo
|
|
40
|
+
*~
|
|
41
|
+
|
|
42
|
+
# Temporary files
|
|
43
|
+
.tmp/
|
|
44
|
+
tmp/
|
|
45
|
+
`),r(`Created .gitignore with Railway entries`);let g=l(d,`README.md`),_=`
|
|
46
|
+
## 🚂 Deploy to Railway
|
|
47
|
+
|
|
48
|
+
This rari application is configured for Railway deployment.
|
|
49
|
+
|
|
50
|
+
### Quick Deploy
|
|
51
|
+
|
|
52
|
+
1. **Push to GitHub**:
|
|
53
|
+
\`\`\`bash
|
|
54
|
+
git add .
|
|
55
|
+
git commit -m "Add Railway deployment"
|
|
56
|
+
git push origin main
|
|
57
|
+
\`\`\`
|
|
58
|
+
|
|
59
|
+
2. **Deploy to Railway**:
|
|
60
|
+
- Go to [railway.app](https://railway.app)
|
|
61
|
+
- Create new project → "Deploy from GitHub repo"
|
|
62
|
+
- Select your repository
|
|
63
|
+
- Click "Deploy Now"
|
|
64
|
+
|
|
65
|
+
3. **Generate Domain**:
|
|
66
|
+
- In Railway dashboard → Settings → Networking
|
|
67
|
+
- Click "Generate Domain"
|
|
68
|
+
- Your app will be live! 🎉
|
|
69
|
+
|
|
70
|
+
### Local Development
|
|
71
|
+
|
|
72
|
+
\`\`\`bash
|
|
73
|
+
# Development server
|
|
74
|
+
npm run start:local
|
|
75
|
+
|
|
76
|
+
# Production simulation
|
|
77
|
+
npm start
|
|
78
|
+
\`\`\`
|
|
79
|
+
|
|
80
|
+
### Environment Variables
|
|
81
|
+
|
|
82
|
+
Railway automatically provides:
|
|
83
|
+
- \`PORT\` - Server port (Railway assigns this)
|
|
84
|
+
- \`NODE_ENV=production\` - Production mode
|
|
85
|
+
|
|
86
|
+
Optional variables you can set:
|
|
87
|
+
- \`RUST_LOG=debug\` - Rust logging level
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
`;if(o(g)){let e=s(g,`utf-8`);e.includes(`Deploy to Railway`)||(c(g,e+_),r(`Updated README.md with Railway deployment instructions`))}else c(g,`# My rari App
|
|
91
|
+
|
|
92
|
+
A high-performance React Server Components application powered by rari.
|
|
93
|
+
${_}
|
|
94
|
+
## Getting Started
|
|
95
|
+
|
|
96
|
+
\`\`\`bash
|
|
97
|
+
npm install
|
|
98
|
+
npm start
|
|
99
|
+
\`\`\`
|
|
100
|
+
|
|
101
|
+
Visit [http://localhost:3000](http://localhost:3000) to see your app.
|
|
102
|
+
`),r(`Created README.md with Railway deployment instructions`);console.warn(``),r(`Railway deployment setup complete! 🎉`),console.warn(``),n(`Next steps:`),console.warn(` 1. ${e.cyan(`git add .`)}`),console.warn(` 2. ${e.cyan(`git commit -m "Add Railway deployment"`)}`),console.warn(` 3. ${e.cyan(`git push origin main`)}`),console.warn(` 4. Go to ${e.cyan(`https://railway.app`)} and deploy from GitHub`),console.warn(``),n(`Your rari app will automatically:`),console.warn(` ✅ Detect Railway environment`),console.warn(` ✅ Bind to 0.0.0.0 (Railway requirement)`),console.warn(` ✅ Use Railway's PORT environment variable`),console.warn(` ✅ Run in production mode`),console.warn(` ✅ Download platform-specific rari binary`),console.warn(``),r(`Ready for deployment! 🚀`)}export{d as createRailwayDeployment};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import{a as e,i as t,n,r,t as i}from"./cli.mjs";import{t as a}from"./utils-BmuB-L9i.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";async function d(){let d=u.cwd();n(`Creating Render deployment configuration...`);let f=l(d,`package.json`);o(f)||(i(`No package.json found. Please run this command from your project root.`),u.exit(1));try{let e=JSON.parse(s(f,`utf-8`));e.scripts=e.scripts||{},e.scripts.start&&e.scripts.start!==`rari start`&&(t(`Existing start script found: "${e.scripts.start}"`),t(`Backing up to start:original and replacing with "rari start"`),e.scripts[`start:original`]=e.scripts.start),e.scripts.start=`rari start`,e.scripts[`start:local`]=`rari start`,e.scripts[`deploy:render`]=`echo "Push to GitHub and connect to Render to deploy"`,e.engines=e.engines||{},e.engines.node?a(e.engines.node)||(t(`Current engines.node value "${e.engines.node}" may not meet the required minimum of >=22.0.0`),t(`Updating to >=22.0.0 for Render deployment compatibility`),e.engines.node=`>=22.0.0`):e.engines.node=`>=22.0.0`,(!e.dependencies||!e.dependencies.rari)&&(n(`Adding rari dependency...`),e.dependencies=e.dependencies||{},e.dependencies.rari=`^0.1.0`),c(f,`${JSON.stringify(e,null,2)}\n`),r(`Updated package.json for Render deployment`)}catch(e){i(`Failed to update package.json: ${e instanceof Error?e.message:`Unknown error`}`),u.exit(1)}let p=l(d,`render.yaml`);if(o(p)){t(`render.yaml already exists, backing up to render.yaml.backup`);let e=s(p,`utf-8`);c(l(d,`render.yaml.backup`),e)}c(p,`services:
|
|
2
|
+
- type: web
|
|
3
|
+
name: rari-app
|
|
4
|
+
runtime: node
|
|
5
|
+
env: node
|
|
6
|
+
plan: free
|
|
7
|
+
buildCommand: npm install
|
|
8
|
+
startCommand: npm start
|
|
9
|
+
healthCheckPath: /
|
|
10
|
+
envVars:
|
|
11
|
+
- key: NODE_ENV
|
|
12
|
+
value: production
|
|
13
|
+
- key: RUST_LOG
|
|
14
|
+
value: info
|
|
15
|
+
`),r(`Created render.yaml configuration`);let m=l(d,`.gitignore`),h=[``,`# Render`,`.render/`,``].join(`
|
|
16
|
+
`);if(o(m)){let e=s(m,`utf-8`);e.includes(`.render/`)||(c(m,e+h),r(`Updated .gitignore with Render entries`))}else c(m,`# Dependencies
|
|
17
|
+
node_modules/
|
|
18
|
+
.pnpm-store/
|
|
19
|
+
|
|
20
|
+
# Build outputs
|
|
21
|
+
dist/
|
|
22
|
+
|
|
23
|
+
# Environment variables
|
|
24
|
+
.env
|
|
25
|
+
.env.local
|
|
26
|
+
.env.production
|
|
27
|
+
|
|
28
|
+
# Render
|
|
29
|
+
.render/
|
|
30
|
+
|
|
31
|
+
# Logs
|
|
32
|
+
*.log
|
|
33
|
+
npm-debug.log*
|
|
34
|
+
pnpm-debug.log*
|
|
35
|
+
|
|
36
|
+
# OS files
|
|
37
|
+
.DS_Store
|
|
38
|
+
Thumbs.db
|
|
39
|
+
|
|
40
|
+
# IDE files
|
|
41
|
+
.vscode/
|
|
42
|
+
.idea/
|
|
43
|
+
*.swp
|
|
44
|
+
*.swo
|
|
45
|
+
*~
|
|
46
|
+
|
|
47
|
+
# Temporary files
|
|
48
|
+
.tmp/
|
|
49
|
+
tmp/
|
|
50
|
+
`),r(`Created .gitignore with Render entries`);let g=l(d,`README.md`),_=`
|
|
51
|
+
## 🎨 Deploy to Render
|
|
52
|
+
|
|
53
|
+
This rari application is configured for Render deployment.
|
|
54
|
+
|
|
55
|
+
### Quick Deploy
|
|
56
|
+
|
|
57
|
+
1. **Push to GitHub**:
|
|
58
|
+
\`\`\`bash
|
|
59
|
+
git add .
|
|
60
|
+
git commit -m "Add Render deployment"
|
|
61
|
+
git push origin main
|
|
62
|
+
\`\`\`
|
|
63
|
+
|
|
64
|
+
2. **Deploy to Render**:
|
|
65
|
+
- Go to [render.com](https://render.com)
|
|
66
|
+
- Create new "Web Service"
|
|
67
|
+
- Connect your GitHub repository
|
|
68
|
+
- Render will auto-detect Node.js and use the configuration from \`render.yaml\`
|
|
69
|
+
- Click "Create Web Service"
|
|
70
|
+
|
|
71
|
+
3. **Your app will be live!** 🎉
|
|
72
|
+
- Render provides a \`.onrender.com\` URL
|
|
73
|
+
- Optional: Add custom domain in Render dashboard
|
|
74
|
+
|
|
75
|
+
### Local Development
|
|
76
|
+
|
|
77
|
+
\`\`\`bash
|
|
78
|
+
# Development server
|
|
79
|
+
npm run start:local
|
|
80
|
+
|
|
81
|
+
# Production simulation
|
|
82
|
+
npm start
|
|
83
|
+
\`\`\`
|
|
84
|
+
|
|
85
|
+
### Environment Variables
|
|
86
|
+
|
|
87
|
+
Render automatically provides:
|
|
88
|
+
- \`PORT\` - Server port (Render assigns this)
|
|
89
|
+
- \`NODE_ENV=production\` - Production mode (from render.yaml)
|
|
90
|
+
- \`RUST_LOG=info\` - Rust logging level (from render.yaml)
|
|
91
|
+
|
|
92
|
+
Optional variables you can add in Render dashboard:
|
|
93
|
+
- \`RUST_LOG=debug\` - Enhanced logging
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
`;if(o(g)){let e=s(g,`utf-8`);e.includes(`Deploy to Render`)||(c(g,e+_),r(`Updated README.md with Render deployment instructions`))}else c(g,`# My rari App
|
|
97
|
+
|
|
98
|
+
A high-performance React Server Components application powered by rari.
|
|
99
|
+
${_}
|
|
100
|
+
## Getting Started
|
|
101
|
+
|
|
102
|
+
\`\`\`bash
|
|
103
|
+
npm install
|
|
104
|
+
npm start
|
|
105
|
+
\`\`\`
|
|
106
|
+
|
|
107
|
+
Visit [http://localhost:3000](http://localhost:3000) to see your app.
|
|
108
|
+
`),r(`Created README.md with Render deployment instructions`);console.warn(``),r(`Render deployment setup complete! 🎉`),console.warn(``),n(`Next steps:`),console.warn(` 1. ${e.cyan(`git add .`)}`),console.warn(` 2. ${e.cyan(`git commit -m "Add Render deployment"`)}`),console.warn(` 3. ${e.cyan(`git push origin main`)}`),console.warn(` 4. Go to ${e.cyan(`https://render.com`)} and create a Web Service`),console.warn(``),n(`Your rari app will automatically:`),console.warn(` ✅ Detect Render environment`),console.warn(` ✅ Bind to 0.0.0.0 (Render requirement)`),console.warn(` ✅ Use Render's PORT environment variable`),console.warn(` ✅ Run in production mode`),console.warn(` ✅ Download platform-specific rari binary`),console.warn(``),r(`Ready for deployment! 🚀`)}export{d as createRenderDeployment};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{promises as e}from"node:fs";import t from"node:path";function n(e){let t=[],n=Array.isArray(e.rules)?e.rules:[e.rules];for(let e of n){let n=Array.isArray(e.userAgent)?e.userAgent:e.userAgent?[e.userAgent]:[`*`];for(let r of n){if(t.push(`User-Agent: ${r}`),e.allow){let n=Array.isArray(e.allow)?e.allow:[e.allow];for(let e of n)t.push(`Allow: ${e}`)}if(e.disallow){let n=Array.isArray(e.disallow)?e.disallow:[e.disallow];for(let e of n)t.push(`Disallow: ${e}`)}e.crawlDelay!==void 0&&t.push(`Crawl-delay: ${e.crawlDelay}`),t.push(``)}}if(e.host&&(t.push(`Host: ${e.host}`),t.push(``)),e.sitemap){let n=Array.isArray(e.sitemap)?e.sitemap:[e.sitemap];for(let e of n)t.push(`Sitemap: ${e}`)}return t.join(`
|
|
2
|
-
`)}async function r(n,r=[`.ts`,`.tsx`,`.js`,`.jsx`]){let i=t.join(n,`robots.txt`);try{return await e.access(i),{type:`static`,path:i}}catch{}for(let i of r){let r=t.join(n,`robots${i}`);try{return await e.access(r),{type:`dynamic`,path:r}}catch{}}return null}async function i(i){let{appDir:a,outDir:o,extensions:s}=i,c=await r(a,s);if(!c)return!1;let l=t.join(o,`robots.txt`);if(c.type===`static`)return await e.copyFile(c.path,l),!0;try{let r=await(await import(`esbuild`)).build({entryPoints:[c.path],bundle:!0,platform:`node`,format:`esm`,write:!1,external:[`rari`],target:`
|
|
2
|
+
`)}async function r(n,r=[`.ts`,`.tsx`,`.js`,`.jsx`]){let i=t.join(n,`robots.txt`);try{return await e.access(i),{type:`static`,path:i}}catch{}for(let i of r){let r=t.join(n,`robots${i}`);try{return await e.access(r),{type:`dynamic`,path:r}}catch{}}return null}async function i(i){let{appDir:a,outDir:o,extensions:s}=i,c=await r(a,s);if(!c)return!1;let l=t.join(o,`robots.txt`);if(c.type===`static`)return await e.copyFile(c.path,l),!0;try{let r=await(await import(`esbuild`)).build({entryPoints:[c.path],bundle:!0,platform:`node`,format:`esm`,write:!1,external:[`rari`],target:`node22`});if(r.outputFiles&&r.outputFiles.length>0){let i=r.outputFiles[0].text,a=t.join(o,`_robots_temp.mjs`);await e.writeFile(a,i);try{let t=await import(`file://${a}`),r=n(typeof t.default==`function`?t.default():t.default);return await e.writeFile(l,r),await e.unlink(a),!0}catch(t){console.error(`[rari] Failed to execute robots file:`,t);try{await e.unlink(a)}catch{}return!1}}}catch(e){return console.error(`[rari] Failed to build robots file:`,e),!1}return!1}export{i as generateRobotsFile};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./routes-KDxjyeNA.mjs";export{e as generateAppRouteManifest};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,r as t,t as n}from"./server-build-YlAAZIGW.mjs";export{n as ServerComponentBuilder,t as scanDirectory};
|