rari 0.17.8 → 0.17.10
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.d.mts +0 -4
- package/dist/cli.mjs +1 -1
- package/dist/define-BIL9PMLh.mjs +1 -0
- package/dist/{define-BafO1-XT.d.mts → define-DCZgXfOp.d.mts} +0 -2
- package/dist/font/google-catalog.d.mts +15 -0
- package/dist/font/google.d.mts +1 -3
- package/dist/font/local.d.mts +2 -4
- package/dist/font.d.mts +1 -1
- package/dist/get-client-component-DVAbynLr.mjs +1 -0
- package/dist/headers.d.mts +1 -3
- package/dist/image/runtime-config.d.mts +1 -3
- package/dist/image/static.d.mts +1 -1
- package/dist/image.d.mts +1 -5
- package/dist/index.d.mts +2 -4
- package/dist/mdx/define.d.mts +1 -1
- package/dist/mdx/define.mjs +1 -1
- package/dist/mdx/registry.d.mts +1 -3
- package/dist/mdx.d.mts +1 -5
- package/dist/mdx.mjs +1 -1
- package/dist/og.d.mts +0 -2
- package/dist/platform.d.mts +1 -3
- package/dist/{preload-modules-BDQFWAlZ.mjs → preload-modules-0iyuP4Vs.mjs} +2 -2
- package/dist/proxy/RariRequest.d.mts +2 -4
- package/dist/proxy/RariResponse.d.mts +1 -1
- package/dist/proxy/executor.d.mts +1 -3
- package/dist/{react-helpers-GTRYJwF2.d.mts → react-helpers-CZtKqfS6.d.mts} +0 -2
- package/dist/{router-kf_rLP_F.mjs → router-861SNPMt.mjs} +1 -1
- package/dist/router.d.mts +0 -8
- package/dist/router.mjs +1 -1
- package/dist/runtime/AppRouterProvider.d.mts +1 -5
- package/dist/runtime/AppRouterProvider.mjs +1 -1
- package/dist/runtime/ClientRouter.d.mts +1 -3
- package/dist/runtime/ClientRouter.mjs +3 -3
- package/dist/runtime/ErrorBoundaryWrapper.d.mts +0 -2
- package/dist/runtime/ErrorBoundaryWrapper.mjs +1 -1
- package/dist/runtime/action-flight-refresh.d.mts +0 -2
- package/dist/runtime/action-revalidation-kind.d.mts +1 -3
- package/dist/runtime/call-server.d.mts +1 -3
- package/dist/runtime/entry-client.d.mts +2 -4
- package/dist/runtime/entry-client.mjs +3 -3
- package/dist/runtime/merge-flight-refresh.d.mts +2 -4
- package/dist/runtime/rsc-client-runtime.d.mts +1 -5
- package/dist/runtime/rsc-client-runtime.mjs +1 -1
- package/dist/runtime/rsc-references.d.mts +0 -2
- package/dist/{sitemap-DIL-PFSt.mjs → sitemap-ByPlT2YN.mjs} +1 -1
- package/dist/{static-modules-BnpA9S9v.d.mts → static-modules-DmO7M_cF.d.mts} +0 -4
- package/dist/{types-DAdRjhuk.d.mts → types-CSDt4P_t.d.mts} +0 -4
- package/dist/{types-C8N3Hc8I.d.mts → types-Cw2SI7r7.d.mts} +0 -2
- package/dist/{types-yeW6ju9Y.d.mts → types-DNk27dqJ.d.mts} +0 -10
- package/dist/{types-CkZPEEdi.d.mts → types-DeWes1rB.d.mts} +0 -2
- package/dist/vite.d.mts +2 -26
- package/dist/vite.mjs +77 -75
- package/package.json +13 -13
- package/dist/define-Dsj1lR4C.mjs +0 -1
- package/dist/get-client-component-D2K213pV.mjs +0 -1
package/dist/cli.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/cli/build-target.d.ts
|
|
2
1
|
type ViteAppCommand = 'build' | 'dev' | 'preview' | 'pack';
|
|
3
2
|
export declare function readDefaultPackageTarget(configSource: string, command?: ViteAppCommand): string | null;
|
|
4
3
|
export declare function readBuildOutDir(configSource: string): string | null;
|
|
@@ -8,8 +7,6 @@ export declare function resolveViteBuildPackageRoot(cwd: string, viteBin?: 'vp'
|
|
|
8
7
|
export declare function resolveConfiguredBuildOutDir(packageRoot: string): string;
|
|
9
8
|
export declare function findImageConfigPath(packageRoot: string): string | null;
|
|
10
9
|
export declare function outDirFromImageConfigPath(imageConfigPath: string, packageRoot: string): string;
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region src/cli/index.d.ts
|
|
13
10
|
type PackageManager = 'pnpm' | 'yarn' | 'bun' | 'npm';
|
|
14
11
|
declare function detectPackageManager(): PackageManager;
|
|
15
12
|
declare function isRailwayEnvironment(): boolean;
|
|
@@ -19,5 +16,4 @@ declare function getDeploymentConfig(): {
|
|
|
19
16
|
mode: string;
|
|
20
17
|
host: string;
|
|
21
18
|
};
|
|
22
|
-
//#endregion
|
|
23
19
|
export { detectPackageManager, getDeploymentConfig, isRailwayEnvironment, isRenderEnvironment };
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{b as e,d as t,x as n,y as r}from"./type-guards-BLY2PlGR.mjs";import{n as i,t as a}from"./dist-paths-C4EV064W.mjs";import{getBinaryPath as o,getInstallationInstructions as s}from"./platform.mjs";import{spawn as c}from"node:child_process";import{existsSync as l,readFileSync as u,readdirSync as d,realpathSync as f,rmSync as p}from"node:fs";import{basename as m,dirname as h,isAbsolute as g,join as _,resolve as v}from"node:path";import y from"node:process";import{fileURLToPath as b}from"node:url";import{once as ee}from"node:events";import{parseArgs as x,styleText as S}from"node:util";function C(e){console.warn(`${S(`blue`,`info`)} ${e}`)}function w(e){console.warn(`${S(`green`,`✓`)} ${e}`)}function T(e){console.error(`${S(`red`,`✗`)} ${e}`)}function E(e){console.warn(`${S(`yellow`,`⚠`)} ${e}`)}const te=[`vite.config.ts`];function D(e,t=`build`){let n=/(?:^|[,{\s])defaultPackage\s*:\s*['"]([^'"]+)['"]/.exec(e);if(n?.[1]!=null&&n[1]!==``)return n[1];let r=/(?:^|[,{\s])defaultPackage\s*:\s*\{([^}]*)\}/.exec(e);if(r?.[1]==null)return null;let i=RegExp(`(?:^|[,\\s])${t}\\s*:\\s*['"]([^'"]+)['"]`).exec(r[1])?.[1];return i!=null&&i!==``?i:null}function O(e){let t=/(?:^|[,{\s])outDir\s*:\s*['"]([^'"]+)['"]/.exec(e)?.[1];return t!=null&&t!==``?t:null}function k(e){let t=/(?:^|[,{\s])root\s*:\s*['"]([^'"]+)['"]/.exec(e)?.[1];return t!=null&&t!==``?t:null}function A(e){for(let t of te){let n=v(e,t);if(l(n))try{return u(n,`utf8`)}catch{return null}}return null}function j(e,t){return g(t)?t:v(e,t)}function M(e,t){let n=t==null?null:k(t);return n==null||n===``?e:j(e,n)}function N(e,t=`vp`,n=`build`){if(t!==`vp`)return e;let r=A(e);if(r==null)return e;let i=D(r,n);if(i==null||i===``)return e;let a=v(e,i);return l(a)?a:e}function P(e){let t=A(e),n=M(e,t),r=t==null?null:O(t);return r==null||r===``?v(n,a):j(n,r)}function ne(e){return m(e)===`client`?h(e):e}function F(e){let t=P(e),n=[_(ne(t),`server`,`image.json`),_(t,`server`,`image.json`),_(e,i,`server`,`image.json`)];for(let e of n)if(l(e))return e;let r;try{r=d(e)}catch{return null}for(let t of r){if(t===`node_modules`||t===`dist`||t.startsWith(`.`))continue;let n=_(e,t,`server`,`image.json`);if(l(n))return n}return null}function I(e,t){let n=h(e),i=h(n),a=M(t,A(t)),o=r(u(e,`utf8`))?.outDir;return typeof o==`string`&&o!==``?g(o)?o:v(a,o):_(i,`client`)}let L=null;function R(e){let t=l(e)?new Set(z(e)):/* @__PURE__ */ new Set;return t.has(`pnpm-lock.yaml`)?`pnpm`:t.has(`yarn.lock`)?`yarn`:t.has(`bun.lockb`)||t.has(`bun.lock`)?`bun`:t.has(`package-lock.json`)?`npm`:re(e)}function z(e){try{return d(e)}catch{return[]}}function re(t){try{let n=v(t,`package.json`);if(!l(n))return null;let i=r(u(n,`utf-8`));return i?e(i):null}catch{}return null}function ie(e){try{let t=v(e,`package.json`);if(!l(t))return null;let i=r(u(t,`utf-8`));return i?n(i):null}catch{}return null}function ae(e){let t=e,n=null,r=null;for(;t!==v(t,`..`)&&(n??=R(t),r??=ie(t),!(n&&r));)t=v(t,`..`);return{cwd:e,packageManager:n??`npm`,viteBin:r??`vite`}}function B(){let e=y.cwd();return L?.cwd===e||(L=ae(e)),L}function oe(){return B().packageManager}function V(){let e=B().packageManager,t=y.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`;case`npm`:return t?`npx.cmd`:`npx`;default:return t?`npx.cmd`:`npx`}}function H(e,t=y.cwd()){let n=y.platform===`win32`,r=t;for(;r!==v(r,`..`);){let t=v(r,`node_modules`,`.bin`),i=n?[v(t,`${e}.cmd`),v(t,`${e}.exe`),v(t,e)]:[v(t,e)];for(let e of i)if(l(e))return e;r=v(r,`..`)}return null}function U(e,t,n={}){let r=y.platform===`win32`;if(e===`npx`){let e=V();if(e.includes(`bun`))return c(r?`bunx.cmd`:`bunx`,t,{...n,shell:r});if(e.includes(`pnpm`))return c(e,[`exec`,...t],{...n,shell:r});if(e.includes(`yarn`)){let[i,...a]=t,o=i===`vp`?[`dlx`,`-p`,`vite-plus`,`vp`,...a]:[`dlx`,...t];return c(e,o,{...n,shell:r})}}return r&&e===`npx`?c(`npx.cmd`,t,{...n,shell:!0}):c(e,t,n)}function W(e,t,n={}){let r=H(e);if(r!=null&&r!==``){let e=y.platform===`win32`&&r.endsWith(`.cmd`);return c(r,t,e?{...n,shell:!0}:n)}return U(`npx`,[e,...t],n)}async function G(e,t={}){try{let[t]=await ee(e,`close`);return t}catch(e){if(t.tolerateErrors)return E(K(e)),1;throw e}}function K(e){if(t(e))return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function se(){let e=v(y.cwd(),`.env`);l(e)&&y.loadEnvFile(e)}function ce(e){let{values:t,positionals:n}=x({args:e,options:{help:{type:`boolean`,short:`h`,default:!1}},allowPositionals:!0,strict:!1});if(t.help===!0)return{command:`help`,args:[]};let[r=`help`,...i]=n;return{command:r,args:i}}function q(){return y.env.RAILWAY_ENVIRONMENT!=null&&y.env.RAILWAY_ENVIRONMENT!==``||y.env.RAILWAY_PROJECT_ID!=null&&y.env.RAILWAY_PROJECT_ID!==``||y.env.RAILWAY_SERVICE_ID!=null&&y.env.RAILWAY_SERVICE_ID!==``}function J(){return y.env.RENDER!=null&&y.env.RENDER!==``||y.env.RENDER_SERVICE_ID!=null&&y.env.RENDER_SERVICE_ID!==``||y.env.RENDER_SERVICE_NAME!=null&&y.env.RENDER_SERVICE_NAME!==``}function Y(){return q()||J()}function X(){return q()?`Railway`:J()?`Render`:`local`}function Z(){return{port:y.env.PORT!=null&&y.env.PORT!==``?y.env.PORT:y.env.RSC_PORT!=null&&y.env.RSC_PORT!==``?y.env.RSC_PORT:`3000`,mode:y.env.NODE_ENV!=null&&y.env.NODE_ENV!==``?y.env.NODE_ENV:`production`,host:Y()?`0.0.0.0`:`127.0.0.1`}}async function Q(){$();let e=B().viteBin;C(`Type checking...`);let t=await G(W(`tsc`,[],{stdio:`inherit`,cwd:y.cwd()}));if(t===0)w(`Type check passed`);else throw T(`Type check failed with code ${t}`),Error(`Type check failed with code ${t}`);C(`Building for production...`);let n=await G(W(e,[`build`],{stdio:`inherit`,cwd:y.cwd()}));if(n===0)w(`Build complete`);else throw T(`Build failed with code ${n}`),Error(`Build failed with code ${n}`);await le()}async function le(){let e=y.cwd(),{viteBin:t}=B(),n=N(e,t),i=F(n);if(i==null)return;let a=I(i,n),s=h(i),d=`assets`;try{let e=r(u(i,`utf-8`));e&&typeof e.assetsDir==`string`&&e.assetsDir.length>0&&(d=e.assetsDir.replaceAll(/^\/+|\/+$/g,``))}catch{}let f=v(n,`public`),p=v(a,d),m=v(s,`static-image-sources.json`);if(l(f)||l(p)||l(m))try{let e=o(),t=await G(c(e,[`optimize-images`,`--config`,i],{stdio:`inherit`,cwd:n,shell:!1}),{tolerateErrors:!0});t!==0&&E(`Image pre-optimization exited with code ${t}`)}catch(e){E(`Could not pre-optimize images: ${K(e)}`)}}async function ue(){let e=B().viteBin,t=v(y.cwd(),`dist`);if(!l(t)){C(`First run detected - building project...`);let t=await G(W(e,[`build`,`--mode`,`development`],{stdio:`inherit`,cwd:y.cwd()}));if(t===0)w(`Initial build complete`);else throw T(`Build failed with code ${t}`),Error(`Build failed with code ${t}`)}C(`Starting Vite${e===`vp`?`+`:``} dev server...`);let n=W(e,[`dev`],{stdio:`inherit`,cwd:y.cwd()}),r=()=>{C(`Shutting down dev server...`),n.kill(`SIGTERM`)};return y.on(`SIGINT`,r),y.on(`SIGTERM`,r),n.on(`error`,e=>{T(`Failed to start Vite: ${e.message}`),y.exit(1)}),n.on(`exit`,e=>{e!==0&&e!==null&&(T(`Vite exited with code ${e}`),y.exit(e))}),new Promise(()=>{})}async function de(){let e;try{e=o()}catch{T(`Failed to obtain rari binary`),T(s()),y.exit(1)}let{port:t,mode:n,host:r}=Z();if(Y()){let i=X();C(`${i} environment detected`),C(`Starting rari server for ${i} deployment...`),C(`Mode: ${n}, Host: ${r}, Port: ${t}`),C(`using binary: ${e}`)}let i=[`--mode`,n,`--port`,t,`--host`,r],a=y.platform!==`win32`&&y.stdin.isTTY,l=c(e,i,{stdio:`inherit`,cwd:y.cwd(),detached:a,env:{...y.env,RUST_LOG:y.env.RUST_LOG!=null&&y.env.RUST_LOG!==``?y.env.RUST_LOG:`error`}}),u=!1,d,f=()=>{u||(u=!0,C(`shutting down...`),l.kill(`SIGTERM`),d=setTimeout(()=>{l.kill(`SIGKILL`),y.exit(1)},5e3),d.unref())};return y.on(`SIGINT`,f),y.on(`SIGTERM`,f),y.on(`exit`,()=>{try{l.kill(`SIGKILL`)}catch{}}),l.on(`error`,e=>{T(`Failed to start rari server: ${e.message}`),e.message.includes(`ENOENT`)&&T(`Binary not found. Please ensure rari is properly installed.`),y.exit(1)}),l.on(`exit`,(e,t)=>{d&&clearTimeout(d),t!=null&&t!==``?(u&&(C(`server stopped by signal ${t}`),y.exit(0)),T(`server stopped unexpectedly by signal ${t}`),y.exit(1)):e===0?(w(`server stopped successfully`),y.exit(0)):(T(`server exited with code ${e}`),y.exit(e!=null&&e!==0?e:1))}),new Promise(()=>{})}async function fe(){C(`Setting up Railway deployment...`),Y()&&(T(`Already running in ${X()} environment. Use "rari start" instead.`),y.exit(1));let{createRailwayDeployment:e}=await import(`./railway-CE3nqaKt.mjs`);e()}async function pe(){C(`Setting up Render deployment...`),Y()&&(T(`Already running in ${X()} environment. Use "rari start" instead.`),y.exit(1));let{createRenderDeployment:e}=await import(`./render-D0eMtn5L.mjs`);e()}function $(){let e=v(y.cwd(),`dist`);l(e)?(C(`Cleaning dist folder...`),p(e,{recursive:!0,force:!0}),w(`Cleaned dist folder`)):C(`No dist folder to clean`)}function me(){console.warn(`${S(`bold`,`rari CLI`)}
|
|
2
|
+
import{b as e,d as t,x as n,y as r}from"./type-guards-BLY2PlGR.mjs";import{n as i,t as a}from"./dist-paths-C4EV064W.mjs";import{getBinaryPath as o,getInstallationInstructions as s}from"./platform.mjs";import{spawn as c}from"node:child_process";import{existsSync as l,readFileSync as u,readdirSync as d,realpathSync as f,rmSync as p}from"node:fs";import{basename as m,dirname as h,isAbsolute as g,join as _,resolve as v}from"node:path";import y from"node:process";import{fileURLToPath as b}from"node:url";import{once as ee}from"node:events";import{parseArgs as x,styleText as S}from"node:util";function C(e){console.warn(`${S(`blue`,`info`)} ${e}`)}function w(e){console.warn(`${S(`green`,`✓`)} ${e}`)}function T(e){console.error(`${S(`red`,`✗`)} ${e}`)}function E(e){console.warn(`${S(`yellow`,`⚠`)} ${e}`)}const te=[`vite.config.ts`];function D(e,t=`build`){let n=/(?:^|[,{\s])defaultPackage\s*:\s*['"]([^'"]+)['"]/.exec(e);if(n?.[1]!=null&&n[1]!==``)return n[1];let r=/(?:^|[,{\s])defaultPackage\s*:\s*\{([^}]*)\}/.exec(e);if(r?.[1]==null)return null;let i=RegExp(`(?:^|[,\\s])${t}\\s*:\\s*['"]([^'"]+)['"]`).exec(r[1])?.[1];return i!=null&&i!==``?i:null}function O(e){let t=/(?:^|[,{\s])outDir\s*:\s*['"]([^'"]+)['"]/.exec(e)?.[1];return t!=null&&t!==``?t:null}function k(e){let t=/(?:^|[,{\s])root\s*:\s*['"]([^'"]+)['"]/.exec(e)?.[1];return t!=null&&t!==``?t:null}function A(e){for(let t of te){let n=v(e,t);if(l(n))try{return u(n,`utf8`)}catch{return null}}return null}function j(e,t){return g(t)?t:v(e,t)}function M(e,t){let n=t==null?null:k(t);return n==null||n===``?e:j(e,n)}function N(e,t=`vp`,n=`build`){if(t!==`vp`)return e;let r=A(e);if(r==null)return e;let i=D(r,n);if(i==null||i===``)return e;let a=v(e,i);return l(a)?a:e}function P(e){let t=A(e),n=M(e,t),r=t==null?null:O(t);return r==null||r===``?v(n,a):j(n,r)}function ne(e){return m(e)===`client`?h(e):e}function F(e){let t=P(e),n=[_(ne(t),`server`,`image.json`),_(t,`server`,`image.json`),_(e,i,`server`,`image.json`)];for(let e of n)if(l(e))return e;let r;try{r=d(e)}catch{return null}for(let t of r){if(t===`node_modules`||t===`dist`||t.startsWith(`.`))continue;let n=_(e,t,`server`,`image.json`);if(l(n))return n}return null}function I(e,t){let n=h(e),i=h(n),a=M(t,A(t)),o=r(u(e,`utf8`))?.outDir;return typeof o==`string`&&o!==``?g(o)?o:v(a,o):_(i,`client`)}let L=null;function R(e){let t=l(e)?new Set(z(e)):/* @__PURE__ */ new Set;return t.has(`pnpm-lock.yaml`)?`pnpm`:t.has(`yarn.lock`)?`yarn`:t.has(`bun.lockb`)||t.has(`bun.lock`)?`bun`:t.has(`package-lock.json`)?`npm`:re(e)}function z(e){try{return d(e)}catch{return[]}}function re(t){try{let n=v(t,`package.json`);if(!l(n))return null;let i=r(u(n,`utf-8`));return i?e(i):null}catch{}return null}function ie(e){try{let t=v(e,`package.json`);if(!l(t))return null;let i=r(u(t,`utf-8`));return i?n(i):null}catch{}return null}function ae(e){let t=e,n=null,r=null;for(;t!==v(t,`..`)&&(n??=R(t),r??=ie(t),!(n&&r));)t=v(t,`..`);return{cwd:e,packageManager:n??`npm`,viteBin:r??`vite`}}function B(){let e=y.cwd();return L?.cwd===e||(L=ae(e)),L}function oe(){return B().packageManager}function V(){let e=B().packageManager,t=y.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`;case`npm`:return t?`npx.cmd`:`npx`;default:return t?`npx.cmd`:`npx`}}function H(e,t=y.cwd()){let n=y.platform===`win32`,r=t;for(;r!==v(r,`..`);){let t=v(r,`node_modules`,`.bin`),i=n?[v(t,`${e}.cmd`),v(t,`${e}.exe`),v(t,e)]:[v(t,e)];for(let e of i)if(l(e))return e;r=v(r,`..`)}return null}function U(e,t,n={}){let r=y.platform===`win32`;if(e===`npx`){let e=V();if(e.includes(`bun`))return c(r?`bunx.cmd`:`bunx`,t,{...n,shell:r});if(e.includes(`pnpm`))return c(e,[`exec`,...t],{...n,shell:r});if(e.includes(`yarn`)){let[i,...a]=t,o=i===`vp`?[`dlx`,`-p`,`vite-plus`,`vp`,...a]:[`dlx`,...t];return c(e,o,{...n,shell:r})}}return r&&e===`npx`?c(`npx.cmd`,t,{...n,shell:!0}):c(e,t,n)}function W(e,t,n={}){let r=H(e);if(r!=null&&r!==``){let e=y.platform===`win32`&&r.endsWith(`.cmd`);return c(r,t,e?{...n,shell:!0}:n)}return U(`npx`,[e,...t],n)}async function G(e,t={}){try{let[t]=await ee(e,`close`);return t}catch(e){if(t.tolerateErrors)return E(K(e)),1;throw e}}function K(e){if(t(e))return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function se(){let e=v(y.cwd(),`.env`);l(e)&&y.loadEnvFile(e)}function ce(e){let{values:t,positionals:n}=x({args:e,options:{help:{type:`boolean`,short:`h`,default:!1}},allowPositionals:!0,strict:!1});if(t.help===!0)return{command:`help`,args:[]};let[r=`help`,...i]=n;return{command:r,args:i}}function q(){return y.env.RAILWAY_ENVIRONMENT!=null&&y.env.RAILWAY_ENVIRONMENT!==``||y.env.RAILWAY_PROJECT_ID!=null&&y.env.RAILWAY_PROJECT_ID!==``||y.env.RAILWAY_SERVICE_ID!=null&&y.env.RAILWAY_SERVICE_ID!==``}function J(){return y.env.RENDER!=null&&y.env.RENDER!==``||y.env.RENDER_SERVICE_ID!=null&&y.env.RENDER_SERVICE_ID!==``||y.env.RENDER_SERVICE_NAME!=null&&y.env.RENDER_SERVICE_NAME!==``}function Y(){return q()||J()}function X(){return q()?`Railway`:J()?`Render`:`local`}function Z(){return{port:y.env.PORT!=null&&y.env.PORT!==``?y.env.PORT:y.env.RSC_PORT!=null&&y.env.RSC_PORT!==``?y.env.RSC_PORT:`3000`,mode:y.env.NODE_ENV!=null&&y.env.NODE_ENV!==``?y.env.NODE_ENV:`production`,host:y.env.RARI_HOST!=null&&y.env.RARI_HOST!==``?y.env.RARI_HOST:Y()?`0.0.0.0`:`127.0.0.1`}}async function Q(){$();let e=B().viteBin;C(`Type checking...`);let t=await G(W(`tsc`,[],{stdio:`inherit`,cwd:y.cwd()}));if(t===0)w(`Type check passed`);else throw T(`Type check failed with code ${t}`),Error(`Type check failed with code ${t}`);C(`Building for production...`);let n=await G(W(e,[`build`],{stdio:`inherit`,cwd:y.cwd()}));if(n===0)w(`Build complete`);else throw T(`Build failed with code ${n}`),Error(`Build failed with code ${n}`);await le()}async function le(){let e=y.cwd(),{viteBin:t}=B(),n=N(e,t),i=F(n);if(i==null)return;let a=I(i,n),s=h(i),d=`assets`;try{let e=r(u(i,`utf-8`));e&&typeof e.assetsDir==`string`&&e.assetsDir.length>0&&(d=e.assetsDir.replaceAll(/^\/+|\/+$/g,``))}catch{}let f=v(n,`public`),p=v(a,d),m=v(s,`static-image-sources.json`);if(l(f)||l(p)||l(m))try{let e=o(),t=await G(c(e,[`optimize-images`,`--config`,i],{stdio:`inherit`,cwd:n,shell:!1}),{tolerateErrors:!0});t!==0&&E(`Image pre-optimization exited with code ${t}`)}catch(e){E(`Could not pre-optimize images: ${K(e)}`)}}async function ue(){let e=B().viteBin,t=v(y.cwd(),`dist`);if(!l(t)){C(`First run detected - building project...`);let t=await G(W(e,[`build`,`--mode`,`development`],{stdio:`inherit`,cwd:y.cwd()}));if(t===0)w(`Initial build complete`);else throw T(`Build failed with code ${t}`),Error(`Build failed with code ${t}`)}C(`Starting Vite${e===`vp`?`+`:``} dev server...`);let n=W(e,[`dev`],{stdio:`inherit`,cwd:y.cwd()}),r=()=>{C(`Shutting down dev server...`),n.kill(`SIGTERM`)};return y.on(`SIGINT`,r),y.on(`SIGTERM`,r),n.on(`error`,e=>{T(`Failed to start Vite: ${e.message}`),y.exit(1)}),n.on(`exit`,e=>{e!==0&&e!==null&&(T(`Vite exited with code ${e}`),y.exit(e))}),new Promise(()=>{})}async function de(){let e;try{e=o()}catch{T(`Failed to obtain rari binary`),T(s()),y.exit(1)}let{port:t,mode:n,host:r}=Z();if(Y()){let i=X();C(`${i} environment detected`),C(`Starting rari server for ${i} deployment...`),C(`Mode: ${n}, Host: ${r}, Port: ${t}`),C(`using binary: ${e}`)}let i=[`--mode`,n,`--port`,t,`--host`,r],a=y.platform!==`win32`&&y.stdin.isTTY,l=c(e,i,{stdio:`inherit`,cwd:y.cwd(),detached:a,env:{...y.env,RUST_LOG:y.env.RUST_LOG!=null&&y.env.RUST_LOG!==``?y.env.RUST_LOG:`error`}}),u=!1,d,f=()=>{u||(u=!0,C(`shutting down...`),l.kill(`SIGTERM`),d=setTimeout(()=>{l.kill(`SIGKILL`),y.exit(1)},5e3),d.unref())};return y.on(`SIGINT`,f),y.on(`SIGTERM`,f),y.on(`exit`,()=>{try{l.kill(`SIGKILL`)}catch{}}),l.on(`error`,e=>{T(`Failed to start rari server: ${e.message}`),e.message.includes(`ENOENT`)&&T(`Binary not found. Please ensure rari is properly installed.`),y.exit(1)}),l.on(`exit`,(e,t)=>{d&&clearTimeout(d),t!=null&&t!==``?(u&&(C(`server stopped by signal ${t}`),y.exit(0)),T(`server stopped unexpectedly by signal ${t}`),y.exit(1)):e===0?(w(`server stopped successfully`),y.exit(0)):(T(`server exited with code ${e}`),y.exit(e!=null&&e!==0?e:1))}),new Promise(()=>{})}async function fe(){C(`Setting up Railway deployment...`),Y()&&(T(`Already running in ${X()} environment. Use "rari start" instead.`),y.exit(1));let{createRailwayDeployment:e}=await import(`./railway-CE3nqaKt.mjs`);e()}async function pe(){C(`Setting up Render deployment...`),Y()&&(T(`Already running in ${X()} environment. Use "rari start" instead.`),y.exit(1));let{createRenderDeployment:e}=await import(`./render-D0eMtn5L.mjs`);e()}function $(){let e=v(y.cwd(),`dist`);l(e)?(C(`Cleaning dist folder...`),p(e,{recursive:!0,force:!0}),w(`Cleaned dist folder`)):C(`No dist folder to clean`)}function me(){console.warn(`${S(`bold`,`rari CLI`)}
|
|
3
3
|
|
|
4
4
|
${S(`bold`,`Usage:`)}
|
|
5
5
|
${S(`cyan`,`rari dev`)} Start the development server with Vite
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as e}from"./type-guards-BLY2PlGR.mjs";import{t}from"./names-CLmM0CPi.mjs";import{registerClientReference as n}from"./runtime/rsc-references.mjs";import{r}from"./rari-global-5vGzhToD.mjs";import{s as i}from"./regex-constants-DzXwNGh2.mjs";function a(e,t,a=`default`){let o=`${t}#${a}`;if(typeof globalThis<`u`){let n=r(),s=t.replace(i,``).split(`/`).pop(),c=s!=null&&s!==``?s:a,l={id:a==="default"?c:a,path:t,type:`client`,component:e,registered:!0};n[o]=l,n[c]=l,n[t]=l}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,t,a)}function o(e){let t={};for(let[n,{component:r,id:i,exportName:o=`default`}]of Object.entries(e))t[n]=a(r,i,o);return t}function s(t){return e(t)&&typeof t.id==`string`&&`component`in t}function c(e){return Array.isArray(e)?[...e]:Object.entries(e).map(([e,t])=>{if(s(t))return{component:t.component,id:t.id,exportName:t.exportName,name:e,client:t.client??!0};throw Error(`[rari/mdx] Component "${e}" is missing module metadata. Pass components to defineMdxComponents({ ... }) in a file processed by the rari vite plugin.`)})}function l(e){let n=c(e);return e=>{let r={},i={},a=new Set(t(e));for(let e of n)a.has(e.name)&&(e.client===!1?r[e.name]=e.component:i[e.name]={component:e.component,id:e.id,exportName:e.exportName});return{...r,...o(i)}}}export{l as t};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ComponentType } from "react";
|
|
2
|
-
//#region src/mdx/components/define.d.ts
|
|
3
2
|
interface MdxComponentEntry {
|
|
4
3
|
readonly name: string;
|
|
5
4
|
readonly component: ComponentType<any>;
|
|
@@ -9,5 +8,4 @@ interface MdxComponentEntry {
|
|
|
9
8
|
}
|
|
10
9
|
type MdxComponentsInput = Readonly<Record<string, ComponentType<any> | MdxComponentEntry>>;
|
|
11
10
|
declare function defineMdxComponents(input: readonly MdxComponentEntry[] | MdxComponentsInput): (content: string) => Record<string, any>;
|
|
12
|
-
//#endregion
|
|
13
11
|
export { defineMdxComponents as n, MdxComponentEntry as t };
|
|
@@ -18,6 +18,7 @@ export declare const Afacad: GoogleFontFn
|
|
|
18
18
|
export declare const Afacad_Flux: GoogleFontFn
|
|
19
19
|
export declare const Agbalumo: GoogleFontFn
|
|
20
20
|
export declare const Agdasima: GoogleFontFn
|
|
21
|
+
export declare const Agrave_Pro: GoogleFontFn
|
|
21
22
|
export declare const Agu_Display: GoogleFontFn
|
|
22
23
|
export declare const Aguafina_Script: GoogleFontFn
|
|
23
24
|
export declare const Akatab: GoogleFontFn
|
|
@@ -350,6 +351,7 @@ export declare const Chokokutai: GoogleFontFn
|
|
|
350
351
|
export declare const Chonburi: GoogleFontFn
|
|
351
352
|
export declare const Cinzel: GoogleFontFn
|
|
352
353
|
export declare const Cinzel_Decorative: GoogleFontFn
|
|
354
|
+
export declare const Clarity_City: GoogleFontFn
|
|
353
355
|
export declare const Clicker_Script: GoogleFontFn
|
|
354
356
|
export declare const Climate_Crisis: GoogleFontFn
|
|
355
357
|
export declare const Coda: GoogleFontFn
|
|
@@ -520,6 +522,7 @@ export declare const Fira_Mono: GoogleFontFn
|
|
|
520
522
|
export declare const Fira_Sans: GoogleFontFn
|
|
521
523
|
export declare const Fira_Sans_Condensed: GoogleFontFn
|
|
522
524
|
export declare const Fira_Sans_Extra_Condensed: GoogleFontFn
|
|
525
|
+
export declare const Firjar: GoogleFontFn
|
|
523
526
|
export declare const Fjalla_One: GoogleFontFn
|
|
524
527
|
export declare const Fjord_One: GoogleFontFn
|
|
525
528
|
export declare const Flamenco: GoogleFontFn
|
|
@@ -712,6 +715,7 @@ export declare const Iosevka_Charon: GoogleFontFn
|
|
|
712
715
|
export declare const Iosevka_Charon_Mono: GoogleFontFn
|
|
713
716
|
export declare const Irish_Grover: GoogleFontFn
|
|
714
717
|
export declare const Island_Moments: GoogleFontFn
|
|
718
|
+
export declare const Isometra: GoogleFontFn
|
|
715
719
|
export declare const Istok_Web: GoogleFontFn
|
|
716
720
|
export declare const Italiana: GoogleFontFn
|
|
717
721
|
export declare const Italianno: GoogleFontFn
|
|
@@ -806,6 +810,7 @@ export declare const Kotta_One: GoogleFontFn
|
|
|
806
810
|
export declare const Koulen: GoogleFontFn
|
|
807
811
|
export declare const Kranky: GoogleFontFn
|
|
808
812
|
export declare const Kreon: GoogleFontFn
|
|
813
|
+
export declare const Kripa: GoogleFontFn
|
|
809
814
|
export declare const Kristi: GoogleFontFn
|
|
810
815
|
export declare const Krona_One: GoogleFontFn
|
|
811
816
|
export declare const Krub: GoogleFontFn
|
|
@@ -857,6 +862,7 @@ export declare const Libre_Barcode_39_Text: GoogleFontFn
|
|
|
857
862
|
export declare const Libre_Barcode_EAN13_Text: GoogleFontFn
|
|
858
863
|
export declare const Libre_Baskerville: GoogleFontFn
|
|
859
864
|
export declare const Libre_Bodoni: GoogleFontFn
|
|
865
|
+
export declare const Libre_Caslon_Condensed: GoogleFontFn
|
|
860
866
|
export declare const Libre_Caslon_Display: GoogleFontFn
|
|
861
867
|
export declare const Libre_Caslon_Text: GoogleFontFn
|
|
862
868
|
export declare const Libre_Franklin: GoogleFontFn
|
|
@@ -1543,6 +1549,13 @@ export declare const Red_Hat_Text: GoogleFontFn
|
|
|
1543
1549
|
export declare const Red_Rose: GoogleFontFn
|
|
1544
1550
|
export declare const Redacted: GoogleFontFn
|
|
1545
1551
|
export declare const Redacted_Script: GoogleFontFn
|
|
1552
|
+
export declare const Redaction: GoogleFontFn
|
|
1553
|
+
export declare const Redaction_10: GoogleFontFn
|
|
1554
|
+
export declare const Redaction_100: GoogleFontFn
|
|
1555
|
+
export declare const Redaction_20: GoogleFontFn
|
|
1556
|
+
export declare const Redaction_35: GoogleFontFn
|
|
1557
|
+
export declare const Redaction_50: GoogleFontFn
|
|
1558
|
+
export declare const Redaction_70: GoogleFontFn
|
|
1546
1559
|
export declare const Reddit_Mono: GoogleFontFn
|
|
1547
1560
|
export declare const Reddit_Sans: GoogleFontFn
|
|
1548
1561
|
export declare const Reddit_Sans_Condensed: GoogleFontFn
|
|
@@ -1808,6 +1821,7 @@ export declare const Tilt_Warp: GoogleFontFn
|
|
|
1808
1821
|
export declare const Timmana: GoogleFontFn
|
|
1809
1822
|
export declare const Tinos: GoogleFontFn
|
|
1810
1823
|
export declare const Tiny5: GoogleFontFn
|
|
1824
|
+
export declare const Tiny5_Duo: GoogleFontFn
|
|
1811
1825
|
export declare const Tiro_Bangla: GoogleFontFn
|
|
1812
1826
|
export declare const Tiro_Devanagari_Hindi: GoogleFontFn
|
|
1813
1827
|
export declare const Tiro_Devanagari_Marathi: GoogleFontFn
|
|
@@ -1900,6 +1914,7 @@ export declare const Wix_Madefor_Text: GoogleFontFn
|
|
|
1900
1914
|
export declare const Work_Sans: GoogleFontFn
|
|
1901
1915
|
export declare const Workbench: GoogleFontFn
|
|
1902
1916
|
export declare const Xanh_Mono: GoogleFontFn
|
|
1917
|
+
export declare const Xmind: GoogleFontFn
|
|
1903
1918
|
export declare const Yaldevi: GoogleFontFn
|
|
1904
1919
|
export declare const Yanone_Kaffeesatz: GoogleFontFn
|
|
1905
1920
|
export declare const Yantramanav: GoogleFontFn
|
package/dist/font/google.d.mts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { n as FontDisplay, r as GoogleFontOptions, t as Font } from "../types-
|
|
2
|
-
//#region src/font/google.d.ts
|
|
1
|
+
import { n as FontDisplay, r as GoogleFontOptions, t as Font } from "../types-DeWes1rB.mjs";
|
|
3
2
|
export type GoogleFontFn = (options?: GoogleFontOptions) => Font;
|
|
4
3
|
export declare function googleFont(): Font;
|
|
5
|
-
//#endregion
|
|
6
4
|
export type { Font, FontDisplay, GoogleFontOptions };
|
package/dist/font/local.d.mts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import { i as LocalFontOptions, t as Font } from "../types-
|
|
2
|
-
|
|
3
|
-
export default function localFont(_options: LocalFontOptions): Font;
|
|
4
|
-
//#endregion
|
|
1
|
+
import { i as LocalFontOptions, t as Font } from "../types-DeWes1rB.mjs";
|
|
2
|
+
export default function localFont(_options: LocalFontOptions): Font;
|
package/dist/font.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as LocalFontSrc, i as LocalFontOptions, n as FontDisplay, r as GoogleFontOptions, t as Font } from "./types-CkZPEEdi.mjs";
|
|
2
1
|
import localFont from "./font/local.mjs";
|
|
2
|
+
import { a as LocalFontSrc, i as LocalFontOptions, n as FontDisplay, r as GoogleFontOptions, t as Font } from "./types-DeWes1rB.mjs";
|
|
3
3
|
export { type Font, type FontDisplay, type GoogleFontOptions, type LocalFontOptions, type LocalFontSrc, localFont };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./path-CTEC1xmy.mjs";import{S as t,g as n,m as r,u as i}from"./type-guards-BLY2PlGR.mjs";import{n as a,r as o,t as s}from"./rari-global-5vGzhToD.mjs";import{createElement as c}from"react";function l(e){return e.startsWith(`./`)?[e,e.slice(2)]:[e,`./${e}`]}function u(t){let n=e(t),r=/* @__PURE__ */ new Set([n]),i=n.indexOf(`/src/`);i!==-1&&r.add(n.slice(i+1));let a=n.indexOf(`/components/`);return a!==-1&&r.add(n.slice(a+1)),[...r]}function d(e,t){if(t!==void 0)return t;let n=e.exportName;if(n!=null&&n!==``)return n}function f(t,n){let r=e(t),i=e(n);return!!(r===i||i.includes(`/`)&&r.endsWith(`/${i}`)||r.includes(`/`)&&i.endsWith(`/${r}`))}function p(e,t,n){for(let r of u(e))for(let e of l(r)){let r=Object.values(n).find(t=>typeof t.path!=`string`||t.path===``?!1:f(t.path,e));if(r)return{info:r,exportName:d(r,t)}}return null}function m(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.loadError=t,e.loadPromise=void 0,t}),e.loadPromise}async function h(e,t){return e.component==null?e.loadPromise?(await e.loadPromise,g(e,t)):e.loader?await m(e)==null?null:g(e,t):null:g(e,t)}function g(e,t){let i=e.component;if(i==null)return null;if(r(i))return i;if(!n(i))return null;if(t==null||t===``||t==="default")return i.default??i;if(t in i)return i[t];let a=i.default;return n(a)&&t in a?a[t]:null}function _(t){let n=e(t);return n===t?[n]:[n,t]}function v(t){let n=o(),r=a(),i=s(),c=e(t),l=y(t,n);if(l!=null)return l;let u=c.indexOf(`#`),d=u===-1?c:c.slice(0,u),f=u===-1?void 0:c.slice(u+1);return b(t,f,n)??x(t,d,f,n,r,i)??p(d,f,n)}function y(e,t){for(let n of _(e)){if(!(n in t))continue;let e=t[n],r=n.indexOf(`#`);return{info:e,exportName:d(e,r===-1?void 0:n.slice(r+1))}}return null}function b(e,t,n){for(let r of _(e)){let e=r.indexOf(`#`),i=e===-1?r:r.slice(0,e);if(i in n)return{info:n[i],exportName:d(n[i],t)}}return null}function x(t,n,r,i,a,o){let s=e(t)===t?[n]:[n,t.includes(`#`)?t.slice(0,t.indexOf(`#`)):t];for(let e of s){let t=S(e,r,i,a);if(t!=null)return t;let n=C(e,r,i,o);if(n!=null)return n}return null}function S(e,t,n,r){for(let i of l(e)){if(!(i in r))continue;let e=r[i];if(e!==``&&e in n)return{info:n[e],exportName:d(n[e],t)}}return null}function C(e,t,n,r){if(!(e in r))return null;let i=r[e];return i===``||!(i in n)?null:{info:n[i],exportName:d(n[i],t)}}function w(e){return e.component!=null||e.loader==null?e.loadPromise:e.loadError==null?e.loadPromise?e.loadPromise:m(e):Promise.reject(t(e.loadError))}function T(e,t,i){let a=d(e,i),o=g({...e,component:t},a);if(o==null)return n(t)&&(`default`in t||`__esModule`in t)?t:r(t)?{default:t,[a!=null&&a!==``?a:`default`]:t,__esModule:!0}:t;let s=a!=null&&a!==``?a:`default`;return{...n(t)?t:{},default:o,[s]:o,__esModule:!0}}function E(e,n,r,a){let o=d(e,a),s=o!=null&&o!==``?o:`default`,l=a=>{if(e.loadError!=null)throw t(e.loadError);if(e.component!=null){let t=g(e,o);if(t==null)throw Error(`[rari] Lazy component "${n}" loaded but export "${s}" is missing`);if(!i(t))throw Error(`[rari] Lazy component "${n}" export "${s}" is not a component`);return c(t,a)}throw r};return l.displayName=`Lazy(${e.displayName??e.exportName??n})`,{default:l,[s]:l,__esModule:!0}}function D(e){let t=v(e);if(!t)return import.meta.env.DEV&&console.warn(`[rari] __rari_rsc_require__: component "${e}" not found in registry`),{};let{info:n,exportName:r}=t;if(n.component!=null)return T(n,n.component,r);if(n.loader){if(n.loadError!=null)return E(n,e,Promise.resolve(),r);let t=w(n);if(t)return E(n,e,t,r)}return{}}async function O(e){let t=v(e);return t?h(t.info,t.exportName):null}function k(){if(typeof window>`u`)return;let t=t=>{let n=o(),r=e(t);return t in n?n[t]:r in n?n[r]:Object.values(n).find(e=>e.path===t||e.path===r)};Reflect.set(globalThis,`__rari_get_script_filename__`,n=>{let r=t(n)?.path??e(n),i=e(r);if(i.startsWith(`http://`)||i.startsWith(`https://`))return i;let a=i.indexOf(`/src/`);return a===-1?i.startsWith(`src/`)?`/${i}`:i.startsWith(`/`)?i:`/${i}`:i.slice(a)}),Reflect.set(globalThis,`__rari_chunk_load__`,async e=>{let n=t(e);if(n&&n.component==null&&n.loader!=null){let e=w(n);if(e)return e.then(()=>void 0)}return n?.loadPromise==null?Promise.resolve():n.loadPromise.then(()=>void 0)})}export{k as n,D as r,O as t};
|
package/dist/headers.d.mts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { i as ReadonlyHeaders, n as CookieStore, r as ReadonlyCookie, t as CookieOptions } from "./types-
|
|
2
|
-
//#region src/headers.d.ts
|
|
1
|
+
import { i as ReadonlyHeaders, n as CookieStore, r as ReadonlyCookie, t as CookieOptions } from "./types-Cw2SI7r7.mjs";
|
|
3
2
|
export declare function cookies(): Promise<CookieStore>;
|
|
4
3
|
export declare function headers(): Promise<ReadonlyHeaders>;
|
|
5
|
-
//#endregion
|
|
6
4
|
export type { CookieOptions, CookieStore, ReadonlyCookie, ReadonlyHeaders };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/image/runtime-config.d.ts
|
|
2
1
|
export declare function configureImageSizes(options: {
|
|
3
2
|
readonly deviceSizes?: readonly number[];
|
|
4
3
|
readonly imageSizes?: readonly number[];
|
|
@@ -6,5 +5,4 @@ export declare function configureImageSizes(options: {
|
|
|
6
5
|
export declare function getImageDeviceSizes(): readonly number[];
|
|
7
6
|
export declare function getImageSizes(): readonly number[];
|
|
8
7
|
export declare function getAllImageSizes(): readonly number[];
|
|
9
|
-
export declare function getMaxOptimizedWidth(): number;
|
|
10
|
-
//#endregion
|
|
8
|
+
export declare function getMaxOptimizedWidth(): number;
|
package/dist/image/static.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import "../static-modules-
|
|
1
|
+
import "../static-modules-DmO7M_cF.mjs";
|
package/dist/image.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { n as ImageProps, r as StaticImageData, t as Image$1 } from "./static-modules-
|
|
1
|
+
import { n as ImageProps, r as StaticImageData, t as Image$1 } from "./static-modules-DmO7M_cF.mjs";
|
|
2
2
|
import { configureImageSizes } from "./image/runtime-config.mjs";
|
|
3
|
-
//#region src/image/constants.d.ts
|
|
4
3
|
type ImageFormat = 'avif' | 'webp' | 'jpeg';
|
|
5
4
|
export declare const MAX_OPTIMIZED_OUTPUT_WIDTH = 3840;
|
|
6
5
|
export declare const DEFAULT_DEVICE_SIZES: number[];
|
|
@@ -10,11 +9,8 @@ export declare const DEFAULT_QUALITY_LEVELS: number[];
|
|
|
10
9
|
export declare const DEFAULT_MINIMUM_CACHE_TTL = 60;
|
|
11
10
|
export declare const BLUR_PLACEHOLDER_WIDTH = 16;
|
|
12
11
|
export declare const BLUR_PLACEHOLDER_QUALITY = 25;
|
|
13
|
-
//#endregion
|
|
14
|
-
//#region src/image/index.d.ts
|
|
15
12
|
declare const Image: typeof Image$1 & {
|
|
16
13
|
$$typeof?: symbol;
|
|
17
14
|
$$id?: string;
|
|
18
15
|
};
|
|
19
|
-
//#endregion
|
|
20
16
|
export { Image, type ImageFormat, type ImageProps, type StaticImageData, configureImageSizes };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { D as RouteContext, E as ApiRouteHandlers, O as RouteHandler, T as ApiResponse, _ as LayoutProps, a as Sitemap, c as SitemapVideo, i as RobotsRule, n as FeedEntry, o as SitemapEntry, p as ErrorProps, r as Robots, s as SitemapImage, t as Feed, x as PageProps, y as Metadata } from "./types-
|
|
2
|
-
import { c as RariURL, d as RariResponse, n as ProxyConfig, r as ProxyFunction, s as RariFetchEvent } from "./types-DAdRjhuk.mjs";
|
|
1
|
+
import { D as RouteContext, E as ApiRouteHandlers, O as RouteHandler, T as ApiResponse, _ as LayoutProps, a as Sitemap, c as SitemapVideo, i as RobotsRule, n as FeedEntry, o as SitemapEntry, p as ErrorProps, r as Robots, s as SitemapImage, t as Feed, x as PageProps, y as Metadata } from "./types-DNk27dqJ.mjs";
|
|
3
2
|
import { RariRequest } from "./proxy/RariRequest.mjs";
|
|
4
|
-
|
|
3
|
+
import { c as RariURL, d as RariResponse, n as ProxyConfig, r as ProxyFunction, s as RariFetchEvent } from "./types-CSDt4P_t.mjs";
|
|
5
4
|
export declare const NOT_FOUND_ERROR_DIGEST = "RARI_NOT_FOUND";
|
|
6
5
|
export declare function isNotFoundError(error: unknown): boolean;
|
|
7
6
|
export declare function notFound(): never;
|
|
8
|
-
//#endregion
|
|
9
7
|
export { ApiResponse, type ApiRouteHandlers, type ErrorProps, type Feed, type FeedEntry, type LayoutProps, type Metadata, type PageProps, type ProxyConfig, type ProxyFunction, type RariFetchEvent, RariRequest, RariResponse, type RariURL, type Robots, type RobotsRule, type RouteContext, type RouteHandler, type Sitemap, type SitemapEntry, type SitemapImage, type SitemapVideo };
|
package/dist/mdx/define.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as defineMdxComponents, t as MdxComponentEntry } from "../define-
|
|
1
|
+
import { n as defineMdxComponents, t as MdxComponentEntry } from "../define-DCZgXfOp.mjs";
|
|
2
2
|
export { type MdxComponentEntry, defineMdxComponents };
|
package/dist/mdx/define.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{t as defineMdxComponents}from"../define-
|
|
1
|
+
export{t as defineMdxComponents}from"../define-BIL9PMLh.mjs";
|
package/dist/mdx/registry.d.mts
CHANGED
package/dist/mdx.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { n as defineMdxComponents, t as MdxComponentEntry } from "./define-
|
|
1
|
+
import { n as defineMdxComponents, t as MdxComponentEntry } from "./define-DCZgXfOp.mjs";
|
|
2
2
|
import { ComponentType } from "react";
|
|
3
3
|
import { EvaluateOptions as EvaluateOptions$1 } from "@mdx-js/mdx";
|
|
4
|
-
//#region src/mdx/evaluate.d.ts
|
|
5
4
|
interface EvaluateOptions extends EvaluateOptions$1 {
|
|
6
5
|
components?: Record<string, any>;
|
|
7
6
|
}
|
|
@@ -11,8 +10,5 @@ interface EvaluateResult {
|
|
|
11
10
|
}>;
|
|
12
11
|
}
|
|
13
12
|
export declare function evaluate(source: string, options: EvaluateOptions): Promise<EvaluateResult>;
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region src/mdx/scan/names.d.ts
|
|
16
13
|
export declare function scanMdxComponentNames(content: string): string[];
|
|
17
|
-
//#endregion
|
|
18
14
|
export { type EvaluateOptions, type EvaluateResult, type MdxComponentEntry, defineMdxComponents };
|
package/dist/mdx.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./
|
|
1
|
+
import{t as e}from"./define-BIL9PMLh.mjs";import{t}from"./names-CLmM0CPi.mjs";import{createElement as n}from"react";import{evaluate as r}from"@mdx-js/mdx";import{getMDXComponents as i}from"rari/mdx/registry";async function a(e,t){let{components:a={},...o}=t,s=await r(e,o),c=s.default,l=i(e);function u(e){let t={...l,...a,...e.components};return n(c,{...e,components:t})}return{...s,default:u}}export{e as defineMdxComponents,a as evaluate,t as scanMdxComponentNames};
|
package/dist/og.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ReactElement } from "react";
|
|
2
|
-
//#region src/og/image-response.d.ts
|
|
3
2
|
interface ImageResponseOptions {
|
|
4
3
|
readonly width?: number;
|
|
5
4
|
readonly height?: number;
|
|
@@ -34,5 +33,4 @@ export declare class ImageResponse {
|
|
|
34
33
|
private serializeProps;
|
|
35
34
|
private serializePropValue;
|
|
36
35
|
}
|
|
37
|
-
//#endregion
|
|
38
36
|
export type { ImageResponseOptions, ImageResponseSize };
|
package/dist/platform.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{f as e}from"./type-guards-BLY2PlGR.mjs";import{o as t}from"./path-CTEC1xmy.mjs";import{t as n}from"./get-client-component-
|
|
2
|
-
`)){let e=u(r);e!=null&&(
|
|
1
|
+
import{f as e}from"./type-guards-BLY2PlGR.mjs";import{o as t}from"./path-CTEC1xmy.mjs";import{t as n}from"./get-client-component-DVAbynLr.mjs";import{Fragment as r,createElement as i,isValidElement as a}from"react";function o(e){return a(e)||e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function s(e){if(!Array.isArray(e))return e;let t=e;return t.length===1&&a(t[0])?t[0]:t.length>0&&t.every(o)?i(r,null,...t):e}async function c(e,t){let r=l(e,t);r.size!==0&&await Promise.all(Array.from(r,async e=>{try{if(await n(e)==null){console.warn(`[rari] Failed to preload component: ${e}`);return}t?.add(e)}catch(t){console.error(`[rari] Error preloading component ${e}:`,t)}}))}function l(e,t){let n=/* @__PURE__ */ new Set;for(let r of e.split(`
|
|
2
|
+
`)){let e=u(r);e!=null&&(t&&t.has(e)||n.add(e))}return n}function u(n){let r=n.trim();if(!r)return null;let i=r.indexOf(`:`);if(i===-1)return null;let a=r.substring(i+1);if(!a.startsWith(`I`))return null;try{let n=JSON.parse(a.substring(1));if(!e(n))return null;let r=n[0];if(!r.includes(`/`)&&r.startsWith(`$`))return null;let i=typeof n[2]==`string`?n[2]:void 0,o=t(r);return o.includes(`#`)?o:i!=null&&i!==``&&i!=="default"?`${o}#${i}`:o}catch{return null}}export{s as n,c as t};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { c as RariURL, l as RequestCookies } from "../types-
|
|
2
|
-
//#region src/proxy/http/request.d.ts
|
|
1
|
+
import { c as RariURL, l as RequestCookies } from "../types-CSDt4P_t.mjs";
|
|
3
2
|
export declare class RariRequest {
|
|
4
3
|
url: string;
|
|
5
4
|
method: string;
|
|
@@ -34,5 +33,4 @@ export declare class RariRequest {
|
|
|
34
33
|
readonly longitude?: string;
|
|
35
34
|
};
|
|
36
35
|
}>): RariRequest;
|
|
37
|
-
}
|
|
38
|
-
//#endregion
|
|
36
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { d as RariResponse } from "../types-
|
|
1
|
+
import { d as RariResponse } from "../types-CSDt4P_t.mjs";
|
|
2
2
|
export { RariResponse };
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function initializeProxyExecutor(proxyModulePath: string, rariRequestPath: string): Promise<boolean>;
|
|
3
|
-
//#endregion
|
|
1
|
+
export declare function initializeProxyExecutor(proxyModulePath: string, rariRequestPath: string): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./navigate-CSQP4q53.mjs";import{g as t,i as n}from"./type-guards-BLY2PlGR.mjs";import{i as r,n as i,r as a,t as o}from"./navigation-transition-store-dfNJmkIX.mjs";import{c as s}from"react/compiler-runtime";import{createContext as c,use as l,useEffect as u,useRef as d,useSyncExternalStore as f}from"react";import{jsx as p}from"react/jsx-runtime";const m=c(null);function h(){let e=l(m);if(!e)throw Error(`useRouter must be used within a RouterProvider`);return e}function g(){return h().pathname}function _(){return h().searchParams}function v(){return f(a,b,y)}function y(){return o().generation}function b(){return i().generation}function x(e){return t(e)&&typeof e.navigate==`function`}function S(t){let r=s(
|
|
1
|
+
import{n as e}from"./navigate-CSQP4q53.mjs";import{g as t,i as n}from"./type-guards-BLY2PlGR.mjs";import{i as r,n as i,r as a,t as o}from"./navigation-transition-store-dfNJmkIX.mjs";import{c as s}from"react/compiler-runtime";import{createContext as c,use as l,useEffect as u,useRef as d,useSyncExternalStore as f}from"react";import{jsx as p}from"react/jsx-runtime";const m=c(null);function h(){let e=l(m);if(!e)throw Error(`useRouter must be used within a RouterProvider`);return e}function g(){return h().pathname}function _(){return h().searchParams}function v(){return f(a,b,y)}function y(){return o().generation}function b(){return i().generation}function x(e){return t(e)&&typeof e.navigate==`function`}function S(t){let r=s(15),{children:c,initialPathname:l}=t,h;r[0]===l?h=r[1]:(h=()=>o(l),r[0]=l,r[1]=h);let g=f(a,i,h),_=d(null),v;r[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=[],r[2]=v):v=r[2],u(D,v);let y,b;r[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{let t=e();t&&(_.current=t);let r=e=>{let t=n(e,x);t&&(_.current=t.navigate)},i=()=>{_.current=null};return window.addEventListener(`rari:register-navigate`,r),window.addEventListener(`rari:deregister-navigate`,i),()=>{window.removeEventListener(`rari:register-navigate`,r),window.removeEventListener(`rari:deregister-navigate`,i)}},b=[],r[3]=y,r[4]=b):(y=r[3],b=r[4]),u(y,b);let S;r[5]===g.search?S=r[6]:(S=g.search.startsWith(`?`)?g.search.slice(1):g.search,r[5]=g.search,r[6]=S);let O;r[7]===S?O=r[8]:(O=new URLSearchParams(S),r[7]=S,r[8]=O);let k=O,A;r[9]!==k||r[10]!==g.pathname?(A={pathname:g.pathname,searchParams:k,push:async(e,t)=>{_.current?await _.current(e,t):(console.warn(`[rari] Router not ready, falling back to window.location`),window.location.href=e)},replace:async(e,t)=>{_.current?await _.current(e,{...t,replace:!0}):(console.warn(`[rari] Router not ready, falling back to window.location`),window.location.replace(e))},back:E,forward:T,refresh:w,prefetch:C},r[9]=k,r[10]=g.pathname,r[11]=A):A=r[11];let j=A,M;return r[12]!==c||r[13]!==j?(M=/* @__PURE__ */ p(m,{value:j,children:c}),r[12]=c,r[13]=j,r[14]=M):M=r[14],M}async function C(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)}}function w(){window.dispatchEvent(new CustomEvent(`rari:app-router-rerender`))}function T(){window.history.forward()}function E(){window.history.back()}function D(){r()}export{v as a,_ as i,g as n,h as r,S as t};
|
package/dist/router.d.mts
CHANGED
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
//#region src/router/navigation/types.d.ts
|
|
3
2
|
interface NavigationOptions {
|
|
4
3
|
readonly replace?: boolean;
|
|
5
4
|
readonly scroll?: boolean;
|
|
6
5
|
readonly historyKey?: string;
|
|
7
6
|
}
|
|
8
|
-
//#endregion
|
|
9
|
-
//#region src/router/navigation/navigate.d.ts
|
|
10
7
|
export declare function navigate(href: string, options?: NavigationOptions): Promise<void>;
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region src/router/navigation/router-provider.d.ts
|
|
13
8
|
interface RouterProviderProps {
|
|
14
9
|
readonly children: ReactNode;
|
|
15
10
|
readonly initialPathname: string;
|
|
16
11
|
}
|
|
17
12
|
export declare function RouterProvider({ children, initialPathname }: RouterProviderProps): import("react").JSX.Element;
|
|
18
|
-
//#endregion
|
|
19
|
-
//#region src/router/navigation/use-router.d.ts
|
|
20
13
|
interface RouterContextValue {
|
|
21
14
|
pathname: string;
|
|
22
15
|
searchParams: URLSearchParams;
|
|
@@ -31,5 +24,4 @@ export declare function useRouter(): RouterContextValue;
|
|
|
31
24
|
export declare function usePathname(): string;
|
|
32
25
|
export declare function useSearchParams(): URLSearchParams;
|
|
33
26
|
export declare function useViewTransitionKey(): number;
|
|
34
|
-
//#endregion
|
|
35
27
|
export type { NavigationOptions, RouterContextValue, RouterProviderProps };
|
package/dist/router.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./navigate-CSQP4q53.mjs";import{a as t,i as n,n as r,r as i,t as a}from"./router-
|
|
1
|
+
import{r as e}from"./navigate-CSQP4q53.mjs";import{a as t,i as n,n as r,r as i,t as a}from"./router-861SNPMt.mjs";export{a as RouterProvider,e as navigate,r as usePathname,i as useRouter,n as useSearchParams,t as useViewTransitionKey};
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { t as FlightContent } from "../react-helpers-
|
|
1
|
+
import { t as FlightContent } from "../react-helpers-CZtKqfS6.mjs";
|
|
2
2
|
import { ReactElement, ReactNode } from "react";
|
|
3
|
-
//#region src/runtime/flight/apply-flight-patch.d.ts
|
|
4
3
|
interface PendingLeafEviction {
|
|
5
4
|
readonly pathname: string;
|
|
6
5
|
readonly search: string;
|
|
7
6
|
}
|
|
8
|
-
//#endregion
|
|
9
|
-
//#region src/runtime/flight/app-router-provider.d.ts
|
|
10
7
|
interface RscPayload {
|
|
11
8
|
readonly element: FlightContent;
|
|
12
9
|
readonly flightProtocol?: string;
|
|
@@ -43,5 +40,4 @@ interface NavigationDetail {
|
|
|
43
40
|
};
|
|
44
41
|
}
|
|
45
42
|
export declare function AppRouterProvider({ children, initialPayload, onNavigate }: AppRouterProviderProps): import("react").JSX.Element;
|
|
46
|
-
//#endregion
|
|
47
43
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e,d as t,g as n,i as r,p as i,r as a,s as o}from"../type-guards-BLY2PlGR.mjs";import{i as s}from"../navigation-transition-store-dfNJmkIX.mjs";import{isLayoutReuseMarker as c,layoutPathOf as l,mergeFlightRefresh as u,unwrapFulfilledFlightNode as d}from"./merge-flight-refresh.mjs";import{a as f,i as p,n as m,r as h,t as g}from"../react-helpers-duOBWuYF.mjs";import{i as _,n as v,r as y,t as b}from"../route-cache-BfEqTT9i.mjs";import"./action-revalidation-kind.mjs";import{n as x,t as ee}from"../preload-modules-BDQFWAlZ.mjs";import{n as te,r as ne}from"../form-state-C9jn086j.mjs";import{c as S}from"react/compiler-runtime";import{Suspense as C,addTransitionType as re,cloneElement as ie,createContext as w,createElement as T,isValidElement as E,startTransition as ae,use as D,useCallback as oe,useEffect as O,useLayoutEffect as se,useRef as k,useState as A,useSyncExternalStore as j}from"react";import{jsx as M,jsxs as N}from"react/jsx-runtime";import{createFromFetch as ce,createFromReadableStream as le}from"virtual:react-flight-client";const ue={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)`},P={padding:`8px 16px`,background:`white`,color:`#dc2626`,border:`none`,borderRadius:`4px`,cursor:`pointer`,fontWeight:`bold`,fontSize:`14px`},F={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`},de={fetch:`Failed to fetch updated content from server.`,parse:`Failed to parse server response.`,stale:`Server returned stale content.`,network:`Network error occurred.`};function I(e){return de[e]}function fe(e){let t=S(27),{failure:n,maxRetries:r,onRefresh:i,onDismiss:a}=e,o,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=/* @__PURE__ */ M(`div`,{style:{marginBottom:`16px`,fontWeight:`bold`,fontSize:`16px`},children:`⚠️ HMR Update Failed`}),s={marginBottom:`12px`,opacity:.9},t[0]=o,t[1]=s):(o=t[0],s=t[1]);let c;t[2]===n.type?c=t[3]:(c=I(n.type),t[2]=n.type,t[3]=c);let l;t[4]===c?l=t[5]:(l=/* @__PURE__ */ M(`div`,{style:s,children:c}),t[4]=c,t[5]=l);let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u={marginBottom:`16px`,fontSize:`12px`,opacity:.8,fontFamily:`monospace`},t[6]=u):u=t[6];let d;t[7]===n.details?d=t[8]:(d=/* @__PURE__ */ M(`div`,{style:u,children:n.details}),t[7]=n.details,t[8]=d);let f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f={marginBottom:`12px`,fontSize:`12px`,opacity:.7},t[9]=f):f=t[9];let p;t[10]!==n.consecutiveFailures||t[11]!==r?(p=/* @__PURE__ */ N(`div`,{style:f,children:[`Consecutive failures: `,n.consecutiveFailures,` / `,r]}),t[10]=n.consecutiveFailures,t[11]=r,t[12]=p):p=t[12];let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m={display:`flex`,gap:`8px`},t[13]=m):m=t[13];let h;t[14]===i?h=t[15]:(h=/* @__PURE__ */ M(`button`,{onClick:i,type:`button`,style:P,children:`Refresh Page`}),t[14]=i,t[15]=h);let g;t[16]===a?g=t[17]:(g=/* @__PURE__ */ M(`button`,{onClick:a,type:`button`,style:F,children:`Dismiss`}),t[16]=a,t[17]=g);let _;t[18]!==h||t[19]!==g?(_=/* @__PURE__ */ N(`div`,{style:m,children:[h,g]}),t[18]=h,t[19]=g,t[20]=_):_=t[20];let v;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(v=/* @__PURE__ */ M(`div`,{style:{marginTop:`12px`,fontSize:`11px`,opacity:.6},children:`Check the console for detailed error logs.`}),t[21]=v):v=t[21];let y;return t[22]!==_||t[23]!==l||t[24]!==d||t[25]!==p?(y=/* @__PURE__ */ N(`div`,{style:ue,children:[o,l,d,p,_,v]}),t[22]=_,t[23]=l,t[24]=d,t[25]=p,t[26]=y):y=t[26],y}function L(e,t,n){y.getShell()??y.ingest(e,t,n)}function R(e){if(e.fromPathname!==`/`&&(e.fromPathname!==e.toPathname||e.fromSearch!==e.search))return{pathname:e.fromPathname,search:e.fromSearch}}function z(e){if(L(e.previousDocument,e.fromPathname,e.fromSearch),h(e.refresh)){if(!y.ingest(e.refresh,e.toPathname,e.search))return{kind:`hard-nav`}}else if(E(e.refresh)){if(!y.ingestSegment(e.refresh,e.toPathname,e.search))return{kind:`hard-nav`}}else return{kind:`hard-nav`};if(y.getShell()==null||!y.hasRoute(e.toPathname,e.search))return{kind:`hard-nav`};let t=y.readLeaf(e.toPathname,e.search),n=m(e.refresh)||t!=null&&m(t),r=t!=null&&p(t)||p(e.refresh),i=R(e);return h(e.refresh)?{kind:`merged`,element:e.refresh,maySuspend:n,hasLoadingFallback:r,pendingEvictLeaf:i}:{kind:`merged`,element:e.previousDocument,maySuspend:n,hasLoadingFallback:r,pendingEvictLeaf:i}}function B(e,t,n,r){if(h(t))return y.ingest(t,n,r);if(E(t)&&y.getShell()!=null)return y.ingestSegment(t,n,r);let i=u(e,t);return E(t)&&c(t)&&i===e||!h(i)?!1:y.ingest(i,n,r)}function V(e,t){let n=m(e),r=p(e);return h(e)?{kind:`merged`,element:e,maySuspend:n,hasLoadingFallback:r}:h(t)?{kind:`merged`,element:t,maySuspend:n,hasLoadingFallback:r}:{kind:`hard-nav`}}function pe(e){return h(e.previousDocument)&&y.getShell()==null&&!y.ingest(e.previousDocument,e.pathname,e.search)||!B(e.previousDocument,e.refresh,e.pathname,e.search)||y.getShell()==null||!y.hasRoute(e.pathname,e.search)?{kind:`hard-nav`}:V(e.refresh,e.previousDocument)}function me(e){return e.historyKey!=null&&e.historyKey!==``?[`nav`,`nav-traverse`]:e.replace===!0?[`nav`,`nav-replace`]:[`nav`,`nav-forward`]}function he(e,t){if(e==null||e.url===``)return t;try{let t=`http://localhost/`;if(typeof window<`u`)try{t=window.location.href}catch{}let n=new URL(e.url,t);return{pathname:n.pathname,search:n.search}}catch{return t}}function H(e){e!=null&&typeof window<`u`&&(e.replace===!0?window.history.replaceState(e.state,``,e.url):window.history.pushState(e.state,``,e.url))}function ge(e){let{parsedPayload:t,shouldScrollToTop:n,navigationId:r,transitionTypes:i,maySuspend:a=!1,hasLoadingFallback:o=!1,pendingHistory:s,routeLocation:c,startTransition:l=ae,currentNavigationIdRef:u,pendingScrollPayloadRef:d,setRenderKey:f,setRscPayload:p,setRouteLocation:m,setPendingLoadingLeaf:h,clearHmrError:g,pendingNavigateCommittedIdRef:_,pendingEvictLeaf:v}=e;if(u.current!==r)return;let b=a&&o;a&&H(s),b&&c!=null&&(m?.(c),h?.(c));let x=()=>{u.current===r&&(h?.(null),a||H(s),c!=null&&m?.(c),v!=null&&y.evictLeaf(v.pathname,v.search),f(e=>{let r=e+1;return d.current=n?{payload:t,commitKey:r}:null,r}),p(t),g(),_.current=r)};l(()=>{if(i!=null)for(let e of i)re(e);x()})}const _e=w(null);function U(){return D(_e)}function W(e,t,n){return n?.pathname===e&&n.search===t}function G(){return j(y.subscribe,y.getVersion,y.getVersion)}function K(e){return l(e)!=null&&!_(e)&&!c(e)}function q(e,t,n){if(e==null||e===!1||e===!0)return e;if(Array.isArray(e))return g(e).map(e=>q(e,t,n));if(!E(e))return e;if(_(e)||K(e)){let r=l(e);return r==null?null:T(Y,{key:r,layoutPath:r,pathname:t,search:n})}let r=e.props,i=r.children;if(i==null)return e;let a=q(i,t,n);if(Object.is(a,i))return e;let o=g(a),s={...r};return delete s.children,ie(e,s,...o.length===0?[null]:o)}function J({layoutPath:e,pathname:t,search:n},r,i=null){let a=y.readSegmentSnapshot(e,{pathname:t,search:n});if(a==null||E(a)&&_(a))return null;if(y.isDeepestLayout(e,t)){let{fallback:e,content:r}=f(a);return W(t,n,i)&&e!=null?e:T(C,{fallback:e},r)}return q(a,t,n)}function Y(e){let t=S(4),n=G(),r=U(),i;return t[0]!==n||t[1]!==r||t[2]!==e?(i=J(e,n,r),t[0]=n,t[1]=r,t[2]=e,t[3]=i):i=t[3],i}function ve({fallback:e=null,pathname:t,search:n},r){let i=y.getShell();if(i!=null){let e=q(i,t,n);return E(e)?e:null}return e!=null&&b(e)?null:e}function ye(e){let t=S(3),n=G(),r;return t[0]!==n||t[1]!==e?(r=ve(e,n),t[0]=n,t[1]=e,t[2]=r):r=t[2],r}function be(e,t,n){return e==null||e.commitKey!==n?{shouldScroll:!1,nextPending:null}:t===e.payload?{shouldScroll:!0,nextPending:null}:{shouldScroll:!1,nextPending:e}}function xe(e){if(e==null)return null;if(i(e)){let t=d(e);return t===e||!h(t)?null:t}return h(e)?e:null}const Se=/"timestamp":(\d+)/;function Ce(e){if(!t(e)||o(e))return!1;let n=e.message;return n===`Failed to fetch`||n.includes(`NetworkError`)||n.includes(`network error`)||n.includes(`Load failed`)}async function we(e){await new Promise(t=>{setTimeout(t,e)})}async function X(e,t,n){if(e.maySuspend!==!0||e.hasLoadingFallback!==!0)return e;if(e.bodyComplete==null){await Promise.resolve();let r=y.readLeaf(t,n);return r!=null&&!m(r)?{...e,maySuspend:!1}:e}if(await Promise.race([e.bodyComplete.then(e=>e?`body`:`failed`),we(100).then(()=>`timeout`)])===`body`)return{...e,maySuspend:!1};let r=y.readLeaf(t,n);return r!=null&&!m(r)?{...e,maySuspend:!1}:e}function Te(e){return e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`||E(e)||Array.isArray(e)}function Ee(e){return n(e)&&typeof e.from==`string`&&typeof e.to==`string`&&typeof e.navigationId==`number`&&n(e.options)}function De(e){return n(e)&&`element`in e}function Oe(e){return n(e)&&typeof e.navigationId==`number`&&typeof e.targetPath==`string`}function ke(e){if(!i(e))return e;if(n(e)&&e.status===`fulfilled`)return Te(e.value)?e.value:void 0}function Ae(e){return h(e)||E(e)&&c(e)}function je(e){let t=e.pendingHistory?.url;if(t!=null&&t!==``)try{return new URL(t,window.location.origin).search}catch{}return v().search}function Me(e,t){console.error(`[rari] AppRouter: Navigation failed:`,t),window.dispatchEvent(new CustomEvent(`rari:navigate-error`,{detail:{from:e.from,to:e.to,error:t,navigationId:e.navigationId}}))}function Ne(e){let t=e.pendingHistory?.url,n=t!=null&&t!==``?new URL(t,window.location.origin).hash.length>0:window.location.hash.length>0;return(e.options.historyKey==null||e.options.historyKey===``)&&!n&&e.options.scroll!==!1}async function Pe(e,t,n,r,i,a,o,s){let l=await Fe(e.element);if(r!==n)return{kind:`superseded`};if(!Ae(l))return{kind:`error`,error:/* @__PURE__ */ Error(`[rari] AppRouter: navigated Flight content did not resolve to an <html> document root`)};let u=xe(t);if(E(l)&&c(l)&&u==null)return{kind:`error`,error:/* @__PURE__ */ Error(`[rari] AppRouter: layout-reuse Flight marker requires a previous <html> document`)};if(u==null)return h(l)?(y.set(a,o,l),{kind:`payload`,payload:await X({...e,element:l,maySuspend:m(l),hasLoadingFallback:p(l)},a,o)}):{kind:`error`,error:/* @__PURE__ */ Error(`[rari] AppRouter: navigated Flight content did not resolve to an <html> document root`)};let d=z({previousDocument:u,refresh:l,fromPathname:i,toPathname:a,fromSearch:s,search:o});return d.kind===`hard-nav`?{kind:`hard-nav`}:{kind:`payload`,payload:await X({...e,element:d.element,maySuspend:d.maySuspend,hasLoadingFallback:d.hasLoadingFallback===!0,pendingEvictLeaf:d.pendingEvictLeaf},a,o)}}async function Fe(e){let t=x(e);for(let e=0;e<10&&i(t);e+=1)t=x(await t);if(i(t))throw Error(`[rari] AppRouter: Flight content did not resolve to a React node`);return t}function Ie({children:c,initialPayload:l,onNavigate:u}){let[d,f]=A(l),p=k(l),[m,g]=A(0),[_,S]=A(()=>v()),[C,re]=A(null),ie=k(_),w=k({x:0,y:0}),T=k(null),D=k(/* @__PURE__ */ new Map),j=k(/* @__PURE__ */ new Set),ue=k(u),P=k(0),F=k(0),de=k(/* @__PURE__ */ new Map),I=k(null),L=k(null),R=k(/* @__PURE__ */ new Map),z=k([]),B=k(null),V=k(0),[H,U]=A(null);O(()=>{ie.current=_},[_]),O(()=>{ue.current=u},[u]),se(()=>{let{shouldScroll:e,nextPending:t}=be(T.current,d,m);T.current=t,e&&window.scrollTo(0,0);let n=L.current;n!=null&&(L.current=null,window.dispatchEvent(new CustomEvent(`rari:navigate-committed`,{detail:{navigationId:n}})))},[d,m]),O(()=>{s()},[m]);let W=oe(e=>{if(e==null||i(e)||!E(e)||e.type!==`html`&&e.type!==`HTML`||b(e))return;let{pathname:t,search:n}=_;y.getShell()!=null&&y.hasRoute(t,n)||y.set(t,n,e)},[_]),G=k(W);O(()=>{G.current=W},[W]),O(()=>{p.current=d,d?.element!=null&&W(d.element)},[d,W]),O(()=>{if(d?.element!=null){let e=d.element;if(n(e)&&`status`in e&&e.status===`rejected`){let t=e.reason;t!=null&&t!==``&&console.error(`[rari] AppRouter: Flight payload rejected:`,t)}}},[d]);let K=()=>{D.current=te()},q=()=>{ne(D.current)};se(()=>{let e=I.current;e!=null&&d===e&&(I.current=null,window.scrollTo(w.current.x,w.current.y),q())},[d,m]);let J=(e,t,n,r)=>{V.current+=1;let i={timestamp:Date.now(),error:e,type:t,details:n,filePath:r,consecutiveFailures:V.current};z.current.push(i),z.current.length>10&&z.current.shift(),V.current>=2&&U(i),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`rari:hmr-failure`,{detail:i}))},Y=()=>{setTimeout(()=>{window.location.reload()},1e3)},ve=()=>{V.current>0&&(V.current=0)},xe=e=>{if(B.current==null||B.current===``)return!1;if(e===B.current)return!0;let t=Se.exec(e);if(t){let e=Number.parseInt(t[1],10);if(Date.now()-e>5e3)return!0}return!1},X=e=>{ee(e,j.current);let t=new ReadableStream({start(t){t.enqueue(new TextEncoder().encode(e)),t.close()}});return{element:le(t),flightProtocol:e}},Ae=async e=>{let t=await e;if(!t.body)throw Error(`Response has no body stream`);let n=t.clone();return{element:ce(Promise.resolve(t)),flightProtocol:``,bodyComplete:n.text().then(async e=>(await ee(e,j.current),e!==``&&(B.current=e),!0)).catch(()=>!1)}},Ie=async(t,n)=>{try{let e=await t.text();if(xe(e))return R.current.delete(n),`stale`;let r=await Fe(X(e).element);if(!h(r))throw Error(`[rari] AppRouter: refetched Flight content did not resolve to an <html> document root`);return{element:r,flightProtocol:e}}catch(t){if(o(t))throw t;let n=e(t),r=Error(`Failed to parse RSC Flight protocol: ${n.message}`,{cause:n});return J(r,`parse`,r.message,window.location.pathname),r}},Le=async(n,r,i)=>{let a=n!=null&&n!==``?n:window.location.pathname,s=P.current,c=i?.commit!==!1,l=i?.expectedRoute!=null&&i.expectedSeq!=null?`:hmr:${i.expectedRoute}:${i.expectedSeq}`:``,u=`${s}:${a}${window.location.search}:${c?`commit`:`defer`}${l}`,d=R.current.get(u);if(d)return d;let p=i?.expectedRoute,m=i?.expectedSeq,h=(async()=>{try{let e=a+window.location.search,t=await fetch(e,{headers:{Accept:`text/x-component`,"rari-navigation-id":String(P.current)},cache:`no-store`,signal:r});if(!t.ok){let n=/* @__PURE__ */ Error(`Failed to fetch RSC data: ${t.status} ${t.statusText}`);throw J(n,`fetch`,`HTTP ${t.status} when fetching ${e}`,window.location.pathname),n}let n=await Ie(t,u);if(n===`stale`)return;if(n instanceof Error)throw n;let i=p==null||m==null||de.current.get(p)===m;return P.current===s&&i&&(c&&f(n),n.flightProtocol!=null&&n.flightProtocol!==``&&(B.current=n.flightProtocol),ve()),R.current.delete(u),n}catch(n){throw R.current.delete(u),t(n)&&!o(n)&&!n.message.includes(`Failed to fetch RSC data`)&&!n.message.includes(`Failed to parse`)&&J(n,`network`,`Network error: ${n.message}`,window.location.pathname),e(n)}})();return R.current.set(u,h),h},Re=k(X),ze=k(Ae),Be=k(Le);O(()=>{Re.current=X,ze.current=Ae,Be.current=Le}),O(()=>{if(typeof window>`u`)return;let t=async e=>{if(e.rscResponsePromise){let t=await e.rscResponsePromise;if(P.current!==e.navigationId)return;let n=await ze.current(Promise.resolve(t));return P.current===e.navigationId?n:void 0}if(e.rscResponse){let t=await ze.current(Promise.resolve(e.rscResponse));return P.current===e.navigationId?t:void 0}if(e.rscFlightProtocol!=null&&e.rscFlightProtocol!==``)return Re.current(e.rscFlightProtocol);if(!e.isStreaming)return Be.current(e.to,e.abortSignal,{commit:!1})},n=async(t,n)=>{try{let e=await Pe(n,p.current?.element,t.navigationId,P.current,t.from,t.to,je(t),ie.current.search);if(e.kind===`superseded`)return null;if(e.kind===`hard-nav`){if(P.current!==t.navigationId)return null;let e=t.pendingHistory?.url!=null&&t.pendingHistory.url!==``?t.pendingHistory.url:t.to;return window.dispatchEvent(new CustomEvent(`rari:navigate-committed`,{detail:{navigationId:t.navigationId}})),window.location.assign(e),null}return e.kind===`error`?(Me(t,e.error),null):P.current===t.navigationId?e.payload:null}catch(n){return Me(t,e(n)),null}},s=(e,t)=>{let n=he(e.pendingHistory,{pathname:e.to,search:je(e)});ge({parsedPayload:t,shouldScrollToTop:Ne(e),navigationId:e.navigationId,transitionTypes:me({historyKey:e.options.historyKey,replace:e.options.replace}),maySuspend:t.maySuspend===!0,hasLoadingFallback:t.hasLoadingFallback===!0,pendingHistory:e.pendingHistory,routeLocation:n,pendingEvictLeaf:t.pendingEvictLeaf,startTransition:ae,currentNavigationIdRef:P,pendingScrollPayloadRef:T,setRenderKey:g,setRscPayload:f,setRouteLocation:S,setPendingLoadingLeaf:re,clearHmrError:()=>{U(null)},pendingNavigateCommittedIdRef:L}),t.flightProtocol!=null&&t.flightProtocol!==``&&(B.current=t.flightProtocol),ve(),ue.current&&ue.current(e)},c=async n=>{try{return{kind:`payload`,payload:await t(n)}}catch(t){return o(t)?{kind:`aborted`}:{kind:`error`,error:e(t)}}},l=async e=>{let t=r(e,Ee);if(!t||t.navigationId!==P.current)return;w.current={x:window.scrollX,y:window.scrollY},K();let i=await c(t);if(i.kind===`aborted`)return;if(i.kind===`error`){Me(t,i.error),V.current>=3&&Y();return}let a=i.payload;if(a==null&&t.isStreaming&&P.current===t.navigationId||a==null||P.current!==t.navigationId)return;let o=await n(t,a);o!=null&&s(t,o)},u=async t=>{let n;for(let e=0;e<3;e+=1)try{return await Be.current(void 0,void 0,{commit:!0,expectedRoute:t.expectedRoute,expectedSeq:t.expectedSeq})}catch(t){if(n=t,!Ce(t)||e===2)throw t;await we(150*(e+1))}throw e(n)},d=async()=>{let e=P.current,{pathname:t,search:n}=v(),r=`${t}${n}`,a=de.current,o=(a.get(r)??0)+1;a.set(r,o);let s=await u({expectedRoute:r,expectedSeq:o});if(P.current!==e)return!1;let{pathname:c,search:l}=v();if(`${c}${l}`!==r||a.get(r)!==o)return!1;let d=s?.element;return d!=null&&!i(d)&&E(d)&&(d.type===`html`||d.type===`HTML`)&&!b(d)&&y.set(t,n,d),!0},m=async()=>{w.current={x:window.scrollX,y:window.scrollY},K();try{if(!await d())return;let e=P.current,{pathname:t,search:n}=v(),r=`${t}${n}`,i={x:w.current.x,y:w.current.y};g(e=>e+1),U(null),requestAnimationFrame(()=>{if(P.current!==e)return;let{pathname:t,search:n}=v();`${t}${n}`===r&&(window.scrollTo(i.x,i.y),q())})}catch(e){console.error(`HMR refetch error:`,a(e,String(e))),V.current>=3&&Y()}},h=t=>{let n=r(t,De);if(n?.element==null||!Te(n.element)&&!i(n.element))return;let{pathname:a,search:o}=v(),s=++F.current,c=P.current,l=`${a}${o}`;w.current={x:window.scrollX,y:window.scrollY},K();try{n.revalidationKind===1?y.clear():n.revalidatedPath!=null&&n.revalidatedPath!==``?y.invalidate(n.revalidatedPath,o):y.invalidate(a,o);let t=p.current?.element,r=y.getElement(a,o)??(t!=null&&i(t)?null:t??null),u=n.element;(async()=>{try{let e=await Fe(u);if(s!==F.current||P.current!==c)return;let{pathname:t,search:n}=v();if(`${t}${n}`!==l)return;let i=pe({previousDocument:r??null,refresh:e,pathname:a,search:o});if(i.kind===`hard-nav`){window.location.reload();return}let d=i.element;if(s!==F.current||P.current!==c)return;let p=v();if(`${p.pathname}${p.search}`!==l)return;let m={element:d};I.current=m,ae(()=>{f(m),U(null)}),G.current(d),ve()}catch(t){if(s!==F.current||P.current!==c)return;let n=e(t);J(n,`parse`,`Action flight refresh failed: ${n.message}`,window.location.pathname),V.current>=3&&Y()}})()}catch(t){let n=e(t);J(n,`parse`,`Action flight refresh failed: ${n.message}`,window.location.pathname),V.current>=3&&Y()}},_=async()=>{try{if(!await d())return;g(e=>e+1),U(null)}catch(e){console.error(`RSC invalidate error:`,a(e,String(e))),V.current>=3&&Y()}},x=e=>{let t=r(e,Oe);t&&(j.current.clear(),P.current=t.navigationId,F.current+=1,T.current=null,I.current=null,re(null))},ee=async()=>{try{if(!await d())return;U(null)}catch(e){console.error(`Manifest update error:`,a(e,String(e))),V.current>=3&&Y()}},te=e=>{l(e)},ne=()=>{m()},C=()=>{_()},D=()=>{ee()};return window.addEventListener(`rari:navigation-start`,x),window.addEventListener(`rari:navigate`,te),window.addEventListener(`rari:app-router-rerender`,ne),window.addEventListener(`rari:action-flight-refresh`,h),window.addEventListener(`rari:rsc-invalidate`,C),window.addEventListener(`rari:app-router-manifest-updated`,D),()=>{window.removeEventListener(`rari:navigation-start`,x),window.removeEventListener(`rari:navigate`,te),window.removeEventListener(`rari:app-router-rerender`,ne),window.removeEventListener(`rari:action-flight-refresh`,h),window.removeEventListener(`rari:rsc-invalidate`,C),window.removeEventListener(`rari:app-router-manifest-updated`,D)}},[]),O(()=>{if(typeof window<`u`&&window.location.hash&&d){let e=window.location.hash.slice(1);requestAnimationFrame(()=>{requestAnimationFrame(()=>{let t=document.getElementById(e);t&&t.scrollIntoView({behavior:`instant`,block:`start`})})})}},[d]);let Ve=d?.element??c,He=x(Ve),[Z,Ue]=A(null),We=ke(He),Ge=i(He)&&We===void 0,Ke=We===void 0?i(He)?null:He:x(We),Q=Ke!=null&&!i(Ke)&&h(Ke)?Ke:null;Q!=null&&!Object.is(Q,Z)&&!b(Q)&&Ue(Q);let $=Ge?Z:Q,qe=$!=null&&h($)&&!b($)?$:Z!=null&&h(Z)&&!b(Z)?Z:null;if(qe==null&&!y.hasRoute(_.pathname,_.search))throw Error(`[rari] AppRouter: expected a resolved <html> document root`);return/* @__PURE__ */ N(_e,{value:C,children:[H!=null&&/* @__PURE__ */ M(fe,{failure:H,maxRetries:3,onRefresh:()=>{window.location.reload()},onDismiss:()=>{U(null)}}),/* @__PURE__ */ M(ye,{fallback:qe,pathname:_.pathname,search:_.search})]})}export{Ie as AppRouterProvider};
|
|
1
|
+
import{i as e}from"../navigation-transition-store-dfNJmkIX.mjs";import{n as t,r as n}from"../form-state-C9jn086j.mjs";import{S as r,d as i,g as a,i as o,p as s,r as c,s as l}from"../type-guards-BLY2PlGR.mjs";import"./action-revalidation-kind.mjs";import{n as u,t as d}from"../preload-modules-0iyuP4Vs.mjs";import{isLayoutReuseMarker as f,layoutPathOf as p,mergeFlightRefresh as m,unwrapFulfilledFlightNode as h}from"./merge-flight-refresh.mjs";import{a as g,i as _,n as v,r as y,t as b}from"../react-helpers-duOBWuYF.mjs";import{i as x,n as S,r as C,t as w}from"../route-cache-BfEqTT9i.mjs";import{c as ee}from"react/compiler-runtime";import{Suspense as T,addTransitionType as te,cloneElement as ne,createContext as E,createElement as D,isValidElement as O,startTransition as re,use as k,useCallback as ie,useEffect as A,useLayoutEffect as ae,useRef as j,useState as M,useSyncExternalStore as N}from"react";import{jsx as P,jsxs as F}from"react/jsx-runtime";import{createFromFetch as oe,createFromReadableStream as se}from"virtual:react-flight-client";const ce={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)`},I={padding:`8px 16px`,background:`white`,color:`#dc2626`,border:`none`,borderRadius:`4px`,cursor:`pointer`,fontWeight:`bold`,fontSize:`14px`},L={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`},le={fetch:`Failed to fetch updated content from server.`,parse:`Failed to parse server response.`,stale:`Server returned stale content.`,network:`Network error occurred.`};function R(e){return le[e]}function ue(e){let t=ee(27),{failure:n,maxRetries:r,onRefresh:i,onDismiss:a}=e,o,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=/* @__PURE__ */ P(`div`,{style:{marginBottom:`16px`,fontWeight:`bold`,fontSize:`16px`},children:`⚠️ HMR Update Failed`}),s={marginBottom:`12px`,opacity:.9},t[0]=o,t[1]=s):(o=t[0],s=t[1]);let c;t[2]===n.type?c=t[3]:(c=R(n.type),t[2]=n.type,t[3]=c);let l;t[4]===c?l=t[5]:(l=/* @__PURE__ */ P(`div`,{style:s,children:c}),t[4]=c,t[5]=l);let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u={marginBottom:`16px`,fontSize:`12px`,opacity:.8,fontFamily:`monospace`},t[6]=u):u=t[6];let d;t[7]===n.details?d=t[8]:(d=/* @__PURE__ */ P(`div`,{style:u,children:n.details}),t[7]=n.details,t[8]=d);let f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f={marginBottom:`12px`,fontSize:`12px`,opacity:.7},t[9]=f):f=t[9];let p;t[10]!==n.consecutiveFailures||t[11]!==r?(p=/* @__PURE__ */ F(`div`,{style:f,children:[`Consecutive failures: `,n.consecutiveFailures,` / `,r]}),t[10]=n.consecutiveFailures,t[11]=r,t[12]=p):p=t[12];let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m={display:`flex`,gap:`8px`},t[13]=m):m=t[13];let h;t[14]===i?h=t[15]:(h=/* @__PURE__ */ P(`button`,{onClick:i,type:`button`,style:I,children:`Refresh Page`}),t[14]=i,t[15]=h);let g;t[16]===a?g=t[17]:(g=/* @__PURE__ */ P(`button`,{onClick:a,type:`button`,style:L,children:`Dismiss`}),t[16]=a,t[17]=g);let _;t[18]!==h||t[19]!==g?(_=/* @__PURE__ */ F(`div`,{style:m,children:[h,g]}),t[18]=h,t[19]=g,t[20]=_):_=t[20];let v;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(v=/* @__PURE__ */ P(`div`,{style:{marginTop:`12px`,fontSize:`11px`,opacity:.6},children:`Check the console for detailed error logs.`}),t[21]=v):v=t[21];let y;return t[22]!==_||t[23]!==l||t[24]!==d||t[25]!==p?(y=/* @__PURE__ */ F(`div`,{style:ce,children:[o,l,d,p,_,v]}),t[22]=_,t[23]=l,t[24]=d,t[25]=p,t[26]=y):y=t[26],y}function z(e,t,n){C.getShell()??C.ingest(e,t,n)}function B(e){if(e.fromPathname!==`/`&&(e.fromPathname!==e.toPathname||e.fromSearch!==e.search))return{pathname:e.fromPathname,search:e.fromSearch}}function V(e){if(z(e.previousDocument,e.fromPathname,e.fromSearch),y(e.refresh)){if(!C.ingest(e.refresh,e.toPathname,e.search))return{kind:`hard-nav`}}else if(O(e.refresh)){if(!C.ingestSegment(e.refresh,e.toPathname,e.search))return{kind:`hard-nav`}}else return{kind:`hard-nav`};if(C.getShell()==null||!C.hasRoute(e.toPathname,e.search))return{kind:`hard-nav`};let t=C.readLeaf(e.toPathname,e.search),n=v(e.refresh)||t!=null&&v(t),r=t!=null&&_(t)||_(e.refresh),i=B(e);return y(e.refresh)?{kind:`merged`,element:e.refresh,maySuspend:n,hasLoadingFallback:r,pendingEvictLeaf:i}:{kind:`merged`,element:e.previousDocument,maySuspend:n,hasLoadingFallback:r,pendingEvictLeaf:i}}function H(e,t,n,r){if(y(t))return C.ingest(t,n,r);if(O(t)&&C.getShell()!=null)return C.ingestSegment(t,n,r);let i=m(e,t);return O(t)&&f(t)&&i===e||!y(i)?!1:C.ingest(i,n,r)}function U(e,t){let n=v(e),r=_(e);return y(e)?{kind:`merged`,element:e,maySuspend:n,hasLoadingFallback:r}:y(t)?{kind:`merged`,element:t,maySuspend:n,hasLoadingFallback:r}:{kind:`hard-nav`}}function de(e){return y(e.previousDocument)&&C.getShell()==null&&!C.ingest(e.previousDocument,e.pathname,e.search)||!H(e.previousDocument,e.refresh,e.pathname,e.search)||C.getShell()==null||!C.hasRoute(e.pathname,e.search)?{kind:`hard-nav`}:U(e.refresh,e.previousDocument)}function fe(e){return e.historyKey!=null&&e.historyKey!==``?[`nav`,`nav-traverse`]:e.replace===!0?[`nav`,`nav-replace`]:[`nav`,`nav-forward`]}function pe(e,t){if(e==null||e.url===``)return t;try{let t=`http://localhost/`;if(typeof window<`u`)try{t=window.location.href}catch{}let n=new URL(e.url,t);return{pathname:n.pathname,search:n.search}}catch{return t}}function W(e){e!=null&&typeof window<`u`&&(e.replace===!0?window.history.replaceState(e.state,``,e.url):window.history.pushState(e.state,``,e.url))}function me(e){let{parsedPayload:t,shouldScrollToTop:n,navigationId:r,transitionTypes:i,maySuspend:a=!1,hasLoadingFallback:o=!1,pendingHistory:s,routeLocation:c,startTransition:l=re,currentNavigationIdRef:u,pendingScrollPayloadRef:d,setRenderKey:f,setRscPayload:p,setRouteLocation:m,setPendingLoadingLeaf:h,clearHmrError:g,pendingNavigateCommittedIdRef:_,pendingEvictLeaf:v}=e;if(u.current!==r)return;let y=a&&o;a&&W(s),y&&c!=null&&(m?.(c),h?.(c));let b=()=>{u.current===r&&(h?.(null),a||W(s),c!=null&&m?.(c),v!=null&&C.evictLeaf(v.pathname,v.search),f(e=>{let r=e+1;return d.current=n?{payload:t,commitKey:r}:null,r}),p(t),g(),_.current=r)};l(()=>{if(i!=null)for(let e of i)te(e);b()})}const he=E(null);function G(){return k(he)}function K(e,t,n){return n?.pathname===e&&n.search===t}function ge(){return N(C.subscribe,C.getVersion,C.getVersion)}function _e(e){return p(e)!=null&&!x(e)&&!f(e)}function q(e,t,n){if(e==null||e===!1||e===!0)return e;if(Array.isArray(e))return b(e).map(e=>q(e,t,n));if(!O(e))return e;if(x(e)||_e(e)){let r=p(e);return r==null?null:D(Y,{key:r,layoutPath:r,pathname:t,search:n})}let r=e.props,i=r.children;if(i==null)return e;let a=q(i,t,n);if(Object.is(a,i))return e;let o=b(a),s={...r};return delete s.children,ne(e,s,...o.length===0?[null]:o)}function J({layoutPath:e,pathname:t,search:n},r,i=null){let a=C.readSegmentSnapshot(e,{pathname:t,search:n});if(a==null||O(a)&&x(a))return null;if(C.isDeepestLayout(e,t)){let{fallback:e,content:r}=g(a);return K(t,n,i)&&e!=null?e:D(T,{fallback:e},r)}return q(a,t,n)}function Y(e){let t=ee(4),n=ge(),r=G(),i;return t[0]!==n||t[1]!==r||t[2]!==e?(i=J(e,n,r),t[0]=n,t[1]=r,t[2]=e,t[3]=i):i=t[3],i}function ve({fallback:e=null,pathname:t,search:n},r){let i=C.getShell();if(i!=null){let e=q(i,t,n);return O(e)?e:null}return e!=null&&w(e)?null:e}function ye(e){let t=ee(3),n=ge(),r;return t[0]!==n||t[1]!==e?(r=ve(e,n),t[0]=n,t[1]=e,t[2]=r):r=t[2],r}function be(e,t,n){return e==null||e.commitKey!==n?{shouldScroll:!1,nextPending:null}:t===e.payload?{shouldScroll:!0,nextPending:null}:{shouldScroll:!1,nextPending:e}}function xe(e){if(e==null)return null;if(s(e)){let t=h(e);return t===e||!y(t)?null:t}return y(e)?e:null}const Se=/"timestamp":(\d+)/;function Ce(e){if(!i(e)||l(e))return!1;let t=e.message;return t===`Failed to fetch`||t.includes(`NetworkError`)||t.includes(`network error`)||t.includes(`Load failed`)}async function we(e){await new Promise(t=>{setTimeout(t,e)})}async function X(e,t,n){if(e.maySuspend!==!0||e.hasLoadingFallback!==!0)return e;if(e.bodyComplete==null){await Promise.resolve();let r=C.readLeaf(t,n);return r!=null&&!v(r)?{...e,maySuspend:!1}:e}if(await Promise.race([e.bodyComplete.then(e=>e?`body`:`failed`),we(100).then(()=>`timeout`)])===`body`)return{...e,maySuspend:!1};let r=C.readLeaf(t,n);return r!=null&&!v(r)?{...e,maySuspend:!1}:e}function Te(e){return e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`||O(e)||Array.isArray(e)}function Ee(e){return a(e)&&typeof e.from==`string`&&typeof e.to==`string`&&typeof e.navigationId==`number`&&a(e.options)}function De(e){return a(e)&&`element`in e}function Oe(e){return a(e)&&typeof e.navigationId==`number`&&typeof e.targetPath==`string`}function ke(e){if(!s(e))return e;if(a(e)&&e.status===`fulfilled`)return Te(e.value)?e.value:void 0}function Ae(e){return y(e)||O(e)&&f(e)}function je(e){let t=e.pendingHistory?.url;if(t!=null&&t!==``)try{return new URL(t,window.location.origin).search}catch{}return S().search}function Me(e,t){console.error(`[rari] AppRouter: Navigation failed:`,t),window.dispatchEvent(new CustomEvent(`rari:navigate-error`,{detail:{from:e.from,to:e.to,error:t,navigationId:e.navigationId}}))}function Ne(e){let t=e.pendingHistory?.url,n=t!=null&&t!==``?new URL(t,window.location.origin).hash.length>0:window.location.hash.length>0;return(e.options.historyKey==null||e.options.historyKey===``)&&!n&&e.options.scroll!==!1}async function Pe(e,t,n,r,i,a,o,s){let c=await Fe(e.element);if(r!==n)return{kind:`superseded`};if(!Ae(c))return{kind:`error`,error:/* @__PURE__ */ Error(`[rari] AppRouter: navigated Flight content did not resolve to an <html> document root`)};let l=xe(t);if(O(c)&&f(c)&&l==null)return{kind:`error`,error:/* @__PURE__ */ Error(`[rari] AppRouter: layout-reuse Flight marker requires a previous <html> document`)};if(l==null)return y(c)?(C.set(a,o,c),{kind:`payload`,payload:await X({...e,element:c,maySuspend:v(c),hasLoadingFallback:_(c)},a,o)}):{kind:`error`,error:/* @__PURE__ */ Error(`[rari] AppRouter: navigated Flight content did not resolve to an <html> document root`)};let u=V({previousDocument:l,refresh:c,fromPathname:i,toPathname:a,fromSearch:s,search:o});return u.kind===`hard-nav`?{kind:`hard-nav`}:{kind:`payload`,payload:await X({...e,element:u.element,maySuspend:u.maySuspend,hasLoadingFallback:u.hasLoadingFallback===!0,pendingEvictLeaf:u.pendingEvictLeaf},a,o)}}async function Fe(e){let t=u(e);for(let e=0;e<10&&s(t);e+=1)t=u(await t);if(s(t))throw Error(`[rari] AppRouter: Flight content did not resolve to a React node`);return t}function Ie({children:f,initialPayload:p,onNavigate:m}){let[h,g]=M(p),_=j(p),[v,b]=M(0),[x,ee]=M(()=>S()),[T,te]=M(null),ne=j(x),E=j({x:0,y:0}),D=j(null),k=j(/* @__PURE__ */ new Map),N=j(/* @__PURE__ */ new Set),ce=j(m),I=j(0),L=j(0),le=j(/* @__PURE__ */ new Map),R=j(null),z=j(null),B=j(/* @__PURE__ */ new Map),V=j([]),H=j(null),U=j(0),[W,G]=M(null);A(()=>{ne.current=x},[x]),A(()=>{ce.current=m},[m]),ae(()=>{let{shouldScroll:e,nextPending:t}=be(D.current,h,v);D.current=t,e&&window.scrollTo(0,0);let n=z.current;n!=null&&(z.current=null,window.dispatchEvent(new CustomEvent(`rari:navigate-committed`,{detail:{navigationId:n}})))},[h,v]),A(()=>{e()},[v]);let K=ie(e=>{if(e==null||s(e)||!O(e)||e.type!==`html`&&e.type!==`HTML`||w(e))return;let{pathname:t,search:n}=x;C.getShell()!=null&&C.hasRoute(t,n)||C.set(t,n,e)},[x]),ge=j(K);A(()=>{ge.current=K},[K]),A(()=>{_.current=h,h?.element!=null&&K(h.element)},[h,K]),A(()=>{if(h?.element!=null){let e=h.element;if(a(e)&&`status`in e&&e.status===`rejected`){let t=e.reason;t!=null&&t!==``&&console.error(`[rari] AppRouter: Flight payload rejected:`,t)}}},[h]);let _e=()=>{k.current=t()},q=()=>{n(k.current)};ae(()=>{let e=R.current;e!=null&&h===e&&(R.current=null,window.scrollTo(E.current.x,E.current.y),q())},[h,v]);let J=(e,t,n,r)=>{U.current+=1;let i={timestamp:Date.now(),error:e,type:t,details:n,filePath:r,consecutiveFailures:U.current};V.current.push(i),V.current.length>10&&V.current.shift(),U.current>=2&&G(i),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`rari:hmr-failure`,{detail:i}))},Y=()=>{setTimeout(()=>{window.location.reload()},1e3)},ve=()=>{U.current>0&&(U.current=0)},xe=e=>{if(H.current==null||H.current===``)return!1;if(e===H.current)return!0;let t=Se.exec(e);if(t){let e=Number.parseInt(t[1],10);if(Date.now()-e>5e3)return!0}return!1},X=e=>{d(e,N.current);let t=new ReadableStream({start(t){t.enqueue(new TextEncoder().encode(e)),t.close()}});return{element:se(t),flightProtocol:e}},Ae=async e=>{let t=await e;if(!t.body)throw Error(`Response has no body stream`);let n=t.clone();return{element:oe(Promise.resolve(t)),flightProtocol:``,bodyComplete:n.text().then(async e=>(await d(e,N.current),e!==``&&(H.current=e),!0)).catch(()=>!1)}},Ie=async(e,t)=>{try{let n=await e.text();if(xe(n))return B.current.delete(t),`stale`;let r=await Fe(X(n).element);if(!y(r))throw Error(`[rari] AppRouter: refetched Flight content did not resolve to an <html> document root`);return{element:r,flightProtocol:n}}catch(e){if(l(e))throw e;let t=r(e),n=Error(`Failed to parse RSC Flight protocol: ${t.message}`,{cause:t});return J(n,`parse`,n.message,window.location.pathname),n}},Le=async(e,t,n)=>{let a=e!=null&&e!==``?e:window.location.pathname,o=I.current,s=n?.commit!==!1,c=n?.expectedRoute!=null&&n.expectedSeq!=null?`:hmr:${n.expectedRoute}:${n.expectedSeq}`:``,u=`${o}:${a}${window.location.search}:${s?`commit`:`defer`}${c}`,d=B.current.get(u);if(d)return d;let f=n?.expectedRoute,p=n?.expectedSeq,m=(async()=>{try{let e=a+window.location.search,n=await fetch(e,{headers:{Accept:`text/x-component`,"rari-navigation-id":String(I.current)},cache:`no-store`,signal:t});if(!n.ok){let t=/* @__PURE__ */ Error(`Failed to fetch RSC data: ${n.status} ${n.statusText}`);throw J(t,`fetch`,`HTTP ${n.status} when fetching ${e}`,window.location.pathname),t}let r=await Ie(n,u);if(r===`stale`)return;if(r instanceof Error)throw r;let i=f==null||p==null||le.current.get(f)===p;return I.current===o&&i&&(s&&g(r),r.flightProtocol!=null&&r.flightProtocol!==``&&(H.current=r.flightProtocol),ve()),B.current.delete(u),r}catch(e){throw B.current.delete(u),i(e)&&!l(e)&&!e.message.includes(`Failed to fetch RSC data`)&&!e.message.includes(`Failed to parse`)&&J(e,`network`,`Network error: ${e.message}`,window.location.pathname),r(e)}})();return B.current.set(u,m),m},Re=j(X),ze=j(Ae),Be=j(Le);A(()=>{Re.current=X,ze.current=Ae,Be.current=Le}),A(()=>{if(typeof window>`u`)return;let e=async e=>{if(e.rscResponsePromise){let t=await e.rscResponsePromise;if(I.current!==e.navigationId)return;let n=await ze.current(Promise.resolve(t));return I.current===e.navigationId?n:void 0}if(e.rscResponse){let t=await ze.current(Promise.resolve(e.rscResponse));return I.current===e.navigationId?t:void 0}if(e.rscFlightProtocol!=null&&e.rscFlightProtocol!==``)return Re.current(e.rscFlightProtocol);if(!e.isStreaming)return Be.current(e.to,e.abortSignal,{commit:!1})},t=async(e,t)=>{try{let n=await Pe(t,_.current?.element,e.navigationId,I.current,e.from,e.to,je(e),ne.current.search);if(n.kind===`superseded`)return null;if(n.kind===`hard-nav`){if(I.current!==e.navigationId)return null;let t=e.pendingHistory?.url!=null&&e.pendingHistory.url!==``?e.pendingHistory.url:e.to;return window.dispatchEvent(new CustomEvent(`rari:navigate-committed`,{detail:{navigationId:e.navigationId}})),window.location.assign(t),null}return n.kind===`error`?(Me(e,n.error),null):I.current===e.navigationId?n.payload:null}catch(t){return Me(e,r(t)),null}},n=(e,t)=>{let n=pe(e.pendingHistory,{pathname:e.to,search:je(e)});me({parsedPayload:t,shouldScrollToTop:Ne(e),navigationId:e.navigationId,transitionTypes:fe({historyKey:e.options.historyKey,replace:e.options.replace}),maySuspend:t.maySuspend===!0,hasLoadingFallback:t.hasLoadingFallback===!0,pendingHistory:e.pendingHistory,routeLocation:n,pendingEvictLeaf:t.pendingEvictLeaf,startTransition:re,currentNavigationIdRef:I,pendingScrollPayloadRef:D,setRenderKey:b,setRscPayload:g,setRouteLocation:ee,setPendingLoadingLeaf:te,clearHmrError:()=>{G(null)},pendingNavigateCommittedIdRef:z}),t.flightProtocol!=null&&t.flightProtocol!==``&&(H.current=t.flightProtocol),ve(),ce.current&&ce.current(e)},i=async t=>{try{return{kind:`payload`,payload:await e(t)}}catch(e){return l(e)?{kind:`aborted`}:{kind:`error`,error:r(e)}}},a=async e=>{let r=o(e,Ee);if(!r||r.navigationId!==I.current)return;E.current={x:window.scrollX,y:window.scrollY},_e();let a=await i(r);if(a.kind===`aborted`)return;if(a.kind===`error`){Me(r,a.error),U.current>=3&&Y();return}let s=a.payload;if(s==null&&r.isStreaming&&I.current===r.navigationId||s==null||I.current!==r.navigationId)return;let c=await t(r,s);c!=null&&n(r,c)},u=async e=>{let t;for(let n=0;n<3;n+=1)try{return await Be.current(void 0,void 0,{commit:!0,expectedRoute:e.expectedRoute,expectedSeq:e.expectedSeq})}catch(e){if(t=e,!Ce(e)||n===2)throw e;await we(150*(n+1))}throw r(t)},d=async()=>{let e=I.current,{pathname:t,search:n}=S(),r=`${t}${n}`,i=le.current,a=(i.get(r)??0)+1;i.set(r,a);let o=await u({expectedRoute:r,expectedSeq:a});if(I.current!==e)return!1;let{pathname:c,search:l}=S();if(`${c}${l}`!==r||i.get(r)!==a)return!1;let d=o?.element;return d==null||s(d)||!O(d)||d.type!==`html`&&d.type!==`HTML`||w(d)||C.set(t,n,d),!0},f=async()=>{E.current={x:window.scrollX,y:window.scrollY},_e();try{if(!await d())return;let e=I.current,{pathname:t,search:n}=S(),r=`${t}${n}`,i={x:E.current.x,y:E.current.y};b(e=>e+1),G(null),requestAnimationFrame(()=>{if(I.current!==e)return;let{pathname:t,search:n}=S();`${t}${n}`===r&&(window.scrollTo(i.x,i.y),q())})}catch(e){console.error(`HMR refetch error:`,c(e,String(e))),U.current>=3&&Y()}},p=e=>{let t=o(e,De);if(t?.element==null||!Te(t.element)&&!s(t.element))return;let{pathname:n,search:i}=S(),a=++L.current,c=I.current,l=`${n}${i}`;E.current={x:window.scrollX,y:window.scrollY},_e();try{t.revalidationKind===1?C.clear():t.revalidatedPath!=null&&t.revalidatedPath!==``?C.invalidate(t.revalidatedPath,i):C.invalidate(n,i);let e=_.current?.element,o=C.getElement(n,i)??(e!=null&&s(e)?null:e??null),u=t.element;(async()=>{try{let e=await Fe(u);if(a!==L.current||I.current!==c)return;let{pathname:t,search:r}=S();if(`${t}${r}`!==l)return;let s=de({previousDocument:o??null,refresh:e,pathname:n,search:i});if(s.kind===`hard-nav`){window.location.reload();return}let d=s.element;if(a!==L.current||I.current!==c)return;let f=S();if(`${f.pathname}${f.search}`!==l)return;let p={element:d};R.current=p,re(()=>{g(p),G(null)}),ge.current(d),ve()}catch(e){if(a!==L.current||I.current!==c)return;let t=r(e);J(t,`parse`,`Action flight refresh failed: ${t.message}`,window.location.pathname),U.current>=3&&Y()}})()}catch(e){let t=r(e);J(t,`parse`,`Action flight refresh failed: ${t.message}`,window.location.pathname),U.current>=3&&Y()}},m=async()=>{try{if(!await d())return;b(e=>e+1),G(null)}catch(e){console.error(`RSC invalidate error:`,c(e,String(e))),U.current>=3&&Y()}},h=e=>{let t=o(e,Oe);t&&(N.current.clear(),I.current=t.navigationId,L.current+=1,D.current=null,R.current=null,te(null))},v=async()=>{try{if(!await d())return;G(null)}catch(e){console.error(`Manifest update error:`,c(e,String(e))),U.current>=3&&Y()}},y=e=>{a(e)},x=()=>{f()},T=()=>{m()},k=()=>{v()};return window.addEventListener(`rari:navigation-start`,h),window.addEventListener(`rari:navigate`,y),window.addEventListener(`rari:app-router-rerender`,x),window.addEventListener(`rari:action-flight-refresh`,p),window.addEventListener(`rari:rsc-invalidate`,T),window.addEventListener(`rari:app-router-manifest-updated`,k),()=>{window.removeEventListener(`rari:navigation-start`,h),window.removeEventListener(`rari:navigate`,y),window.removeEventListener(`rari:app-router-rerender`,x),window.removeEventListener(`rari:action-flight-refresh`,p),window.removeEventListener(`rari:rsc-invalidate`,T),window.removeEventListener(`rari:app-router-manifest-updated`,k)}},[]),A(()=>{if(typeof window<`u`&&window.location.hash&&h){let e=window.location.hash.slice(1);requestAnimationFrame(()=>{requestAnimationFrame(()=>{let t=document.getElementById(e);t&&t.scrollIntoView({behavior:`instant`,block:`start`})})})}},[h]);let Ve=h?.element??f,He=u(Ve),[Z,Ue]=M(null),We=ke(He),Ge=s(He)&&We===void 0,Ke=We===void 0?s(He)?null:He:u(We),Q=Ke!=null&&!s(Ke)&&y(Ke)?Ke:null;Q!=null&&!Object.is(Q,Z)&&!w(Q)&&Ue(Q);let $=Ge?Z:Q,qe=$!=null&&y($)&&!w($)?$:Z!=null&&y(Z)&&!w(Z)?Z:null;if(qe==null&&!C.hasRoute(x.pathname,x.search))throw Error(`[rari] AppRouter: expected a resolved <html> document root`);return/* @__PURE__ */ F(he,{value:T,children:[W!=null&&/* @__PURE__ */ P(ue,{failure:W,maxRetries:3,onRefresh:()=>{window.location.reload()},onDismiss:()=>{G(null)}}),/* @__PURE__ */ P(ye,{fallback:qe,pathname:x.pathname,search:x.search})]})}export{Ie as AppRouterProvider};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
//#region src/router/navigation/client-router.d.ts
|
|
3
2
|
export interface ClientRouterProps {
|
|
4
3
|
readonly children: ReactNode;
|
|
5
4
|
readonly initialRoute: string;
|
|
6
5
|
}
|
|
7
|
-
export declare function ClientRouter({ children, initialRoute }: ClientRouterProps): ReactNode;
|
|
8
|
-
//#endregion
|
|
6
|
+
export declare function ClientRouter({ children, initialRoute }: ClientRouterProps): ReactNode;
|