rari 0.15.3 → 0.15.5

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.
Files changed (77) hide show
  1. package/dist/alias-resolver-Cigam7Y7.mjs +1 -0
  2. package/dist/cli.mjs +39 -39
  3. package/dist/define-BafO1-XT.d.mts +13 -0
  4. package/dist/define-CzFpVAjt.mjs +1 -0
  5. package/dist/feed-Ixvy9L12.mjs +3 -0
  6. package/dist/get-client-component-CLpyIcLJ.mjs +1 -0
  7. package/dist/headers.d.mts +1 -36
  8. package/dist/headers.mjs +1 -1
  9. package/dist/image.d.mts +38 -34
  10. package/dist/image.mjs +1 -1
  11. package/dist/index.d.mts +3 -4
  12. package/dist/mdx/define.d.mts +1 -1
  13. package/dist/mdx/define.mjs +1 -1
  14. package/dist/mdx.d.mts +5 -19
  15. package/dist/mdx.mjs +1 -1
  16. package/dist/og.d.mts +18 -8
  17. package/dist/og.mjs +1 -1
  18. package/dist/platform.mjs +2 -2
  19. package/dist/preload-modules-QmSvKk0Q.mjs +2 -0
  20. package/dist/proxy/RariRequest.d.mts +10 -11
  21. package/dist/proxy/RariRequest.mjs +1 -1
  22. package/dist/proxy/RariResponse.d.mts +1 -16
  23. package/dist/proxy/RariResponse.mjs +1 -1
  24. package/dist/proxy/runtime-executor.d.mts +1 -27
  25. package/dist/proxy/runtime-executor.mjs +1 -1
  26. package/dist/{railway-fmDbDigI.mjs → railway-HYTbx27C.mjs} +1 -1
  27. package/dist/rari-global-5vGzhToD.mjs +1 -0
  28. package/dist/{render-2I7-kFd_.mjs → render-CG5rxWXV.mjs} +1 -1
  29. package/dist/robots-BGCTYwKN.mjs +2 -0
  30. package/dist/router-D6mkoDqJ.mjs +1 -0
  31. package/dist/router.d.mts +8 -10
  32. package/dist/router.mjs +1 -1
  33. package/dist/runtime/AppRouterProvider.d.mts +25 -19
  34. package/dist/runtime/AppRouterProvider.mjs +1 -1
  35. package/dist/runtime/ErrorBoundaryWrapper.d.mts +2 -3
  36. package/dist/runtime/ErrorBoundaryWrapper.mjs +1 -1
  37. package/dist/runtime/LoadingErrorBoundary.d.mts +0 -1
  38. package/dist/runtime/action-flight-refresh.d.mts +2 -4
  39. package/dist/runtime/action-flight-refresh.mjs +1 -1
  40. package/dist/runtime/action-revalidation-kind.mjs +1 -1
  41. package/dist/runtime/call-server.d.mts +1 -1
  42. package/dist/runtime/call-server.mjs +1 -1
  43. package/dist/runtime/entry-client.d.mts +2 -0
  44. package/dist/runtime/entry-client.mjs +3 -3
  45. package/dist/runtime/flight-route-cache.d.mts +0 -1
  46. package/dist/runtime/flight-route-cache.mjs +1 -1
  47. package/dist/runtime/flight-router-state.d.mts +3 -3
  48. package/dist/runtime/merge-flight-refresh.d.mts +0 -1
  49. package/dist/runtime/merge-flight-refresh.mjs +1 -1
  50. package/dist/runtime/rsc-client-runtime.d.mts +8 -1
  51. package/dist/runtime/rsc-client-runtime.mjs +1 -1
  52. package/dist/runtime/rsc-references.d.mts +1 -1
  53. package/dist/runtime/rsc-references.mjs +1 -1
  54. package/dist/sitemap-1n5BIACA.mjs +7 -0
  55. package/dist/type-guards-CTkEL8zw.mjs +1 -0
  56. package/dist/types-BYob0lqv.d.mts +185 -0
  57. package/dist/types-DAdRjhuk.d.mts +130 -0
  58. package/dist/{types-DlF9FHQc.d.mts → types-DCEyvFz7.d.mts} +22 -19
  59. package/dist/types-_vPM8QuJ.d.mts +125 -0
  60. package/dist/utils-C-LVG9QI-D-IHIad5.mjs +37 -0
  61. package/dist/vite.d.mts +181 -160
  62. package/dist/vite.mjs +35 -35
  63. package/package.json +15 -14
  64. package/dist/alias-resolver-CHTPYtdq.mjs +0 -1
  65. package/dist/define-CRFUKkcA.d.mts +0 -14
  66. package/dist/define-rCXgNOOk.mjs +0 -1
  67. package/dist/feed-B3mYPCnT.mjs +0 -3
  68. package/dist/get-client-component-CDaY3lOP.mjs +0 -1
  69. package/dist/http-C5Y9ZrK9.mjs +0 -1
  70. package/dist/preload-modules-CJQ_IouX.mjs +0 -2
  71. package/dist/rari-global-Dygfa818.mjs +0 -1
  72. package/dist/robots-CsTVq3Jp.mjs +0 -2
  73. package/dist/router-Ctpd1kcp.mjs +0 -1
  74. package/dist/sitemap-BekxZtgA.mjs +0 -7
  75. package/dist/types-BC33STEP.d.mts +0 -97
  76. package/dist/types-DJQFFYSj.d.mts +0 -160
  77. package/dist/utils-CW4FEV95-DI7wf2Fu.mjs +0 -37
@@ -0,0 +1 @@
1
+ import e from"node:fs";import t from"node:path";const n=new Map,r=new Map;function i(t){let r=n.get(t);return r===void 0?(r=e.existsSync(t),n.set(t,r),r):r}function a(t){let n=r.get(t);if(n!==void 0)return n;try{n=e.statSync(t).isDirectory()}catch{n=!1}return r.set(t,n),n}function o(){n.clear(),r.clear()}function s(e,t){let n=null;for(let r of t)if(e.endsWith(r)&&(n??=i(e),n))return e;for(let n of t){let t=`${e}${n}`;if(i(t))return t}return null}function c(e,n){if(i(e)){if(!a(e))return null;for(let r of n){let n=t.join(e,`index${r}`);if(i(n))return n}}return null}const l=[`.tsx`,`.jsx`,`.ts`,`.js`];function u(e,n,r={},i=l){let a=e;for(let[t,n]of Object.entries(r))if(e.startsWith(`${t}/`)){a=e.replace(t,n);break}else if(e===t){a=n;break}let o=t.resolve(t.dirname(n),a),u=s(o,i);if(u!=null&&u!==``)return u;let d=c(o,i);return d!=null&&d!==``?d:`${o}.tsx`}const d=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`];function f(e,t=d){return s(e,t)??c(e,t)}const p=new WeakMap;function m(e){let t=p.get(e);return t||(t=Object.entries(e).sort((e,t)=>t[0].length-e[0].length),p.set(e,t),t)}function h(e,n,r){if(typeof e!=`string`)throw TypeError(`Expected source to be a string, but received ${typeof e}`);if(typeof n!=`object`||Array.isArray(n))throw TypeError(`Expected aliases to be a plain object, but received ${Array.isArray(n)?`array`:typeof n}`);if(Object.getPrototypeOf(n)!==Object.prototype&&Object.getPrototypeOf(n)!==null)throw TypeError(`Expected aliases to be a plain object, but received ${n.constructor.name||`object with custom prototype`}`);if(typeof r!=`string`)throw TypeError(`Expected projectRoot to be a string, but received ${typeof r}`);let i=m(n);for(let[n,a]of i)if(e.startsWith(`${n}/`)||e===n){let i=e.slice(n.length).replace(/^\/+/,``),o=t.join(a,i);return t.isAbsolute(o)?o:t.resolve(r,o)}return null}export{s as a,c as i,o as n,f as o,u as r,h as t};
package/dist/cli.mjs CHANGED
@@ -1,63 +1,63 @@
1
- import{getBinaryPath as e,getInstallationInstructions as t}from"./platform.mjs";import{spawn as n}from"node:child_process";import{existsSync as r,readFileSync as i,readdirSync as a,realpathSync as o,rmSync as s}from"node:fs";import{resolve as c}from"node:path";import l from"node:process";import{fileURLToPath as u}from"node:url";import{parseArgs as d,styleText as f}from"node:util";function p(e){console.warn(`${f(`blue`,`info`)} ${e}`)}function m(e){console.warn(`${f(`green`,`✓`)} ${e}`)}function h(e){console.error(`${f(`red`,`✗`)} ${e}`)}function g(e){console.warn(`${f(`yellow`,`⚠`)} ${e}`)}let _=null;function v(e){let t=r(e)?new Set(y(e)):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`:b(e)}function y(e){try{return a(e)}catch{return[]}}function b(e){try{let t=c(e,`package.json`);if(!r(t))return null;let n=JSON.parse(i(t,`utf-8`));if(n.packageManager?.startsWith(`pnpm`))return`pnpm`;if(n.packageManager?.startsWith(`yarn`))return`yarn`;if(n.packageManager?.startsWith(`bun`))return`bun`;if(n.packageManager?.startsWith(`npm`))return`npm`}catch{}return null}function x(e){try{let t=c(e,`package.json`);if(!r(t))return null;let n=JSON.parse(i(t,`utf-8`)),a={...n.dependencies,...n.devDependencies};if(a[`vite-plus`])return`vp`;if(a.vite)return`vite`}catch{}return null}function S(e){let t=e,n=null,r=null;for(;n||=v(t),r||=x(t),!(n&&r);){let e=c(t,`..`);if(e===t)break;t=e}return{cwd:e,packageManager:n??`npm`,viteBin:r??`vite`}}function C(){let e=l.cwd();return _?.cwd===e||(_=S(e)),_}function w(){return C().packageManager}function T(){let e=C().packageManager,t=l.platform===`win32`;switch(e){case`bun`:return t?`bun.cmd`:`bun`;case`pnpm`:return t?`pnpm.cmd`:`pnpm`;case`yarn`:return t?`yarn.cmd`:`yarn`;default:return t?`npx.cmd`:`npx`}}function E(e,t=l.cwd()){let n=l.platform===`win32`,i=t;for(;;){let t=c(i,`node_modules`,`.bin`),a=n?[c(t,`${e}.cmd`),c(t,`${e}.exe`),c(t,e)]:[c(t,e)];for(let e of a)if(r(e))return e;let o=c(i,`..`);if(o===i)break;i=o}return null}function D(e,t,r={}){let i=l.platform===`win32`;if(e===`npx`){let e=T();if(e.includes(`bun`))return n(i?`bunx.cmd`:`bunx`,t,{...r,shell:i});if(e.includes(`pnpm`))return n(e,[`exec`,...t],{...r,shell:i});if(e.includes(`yarn`)){let[a,...o]=t;return n(e,a===`vp`?[`dlx`,`-p`,`vite-plus`,`vp`,...o]:[`dlx`,...t],{...r,shell:i})}}return i&&e===`npx`?n(`npx.cmd`,t,{...r,shell:!0}):n(e,t,r)}function O(e,t,r={}){let i=E(e);return i?n(i,t,l.platform===`win32`&&i.endsWith(`.cmd`)?{...r,shell:!0}:r):D(`npx`,[e,...t],r)}async function k(e,t={}){return new Promise((n,r)=>{e.on(`exit`,e=>{n(e)}),e.on(`error`,e=>{t.tolerateErrors?(g(A(e)),n(1)):r(e)})})}function A(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function j(){let e=c(l.cwd(),`.env`);r(e)&&l.loadEnvFile(e)}function M(e){let{values:t,positionals:n}=d({args:e,options:{help:{type:`boolean`,short:`h`,default:!1}},allowPositionals:!0,strict:!1});if(t.help)return{command:`help`,args:[]};let[r,...i]=n;return{command:r,args:i}}function N(){return!!(l.env.RAILWAY_ENVIRONMENT||l.env.RAILWAY_PROJECT_ID||l.env.RAILWAY_SERVICE_ID)}function P(){return!!(l.env.RENDER||l.env.RENDER_SERVICE_ID||l.env.RENDER_SERVICE_NAME)}function F(){return N()||P()}function I(){return N()?`Railway`:P()?`Render`:`local`}function L(){return{port:l.env.PORT||l.env.RSC_PORT||`3000`,mode:l.env.NODE_ENV||`production`,host:F()?`0.0.0.0`:`127.0.0.1`}}async function R(){await W();let e=C().viteBin;p(`Type checking...`);let t=await k(O(`tsc`,[],{stdio:`inherit`,cwd:l.cwd()}));if(t===0)m(`Type check passed`);else throw h(`Type check failed with code ${t}`),Error(`Type check failed with code ${t}`);p(`Building for production...`);let n=await k(O(e,[`build`],{stdio:`inherit`,cwd:l.cwd()}));if(n===0)m(`Build complete`);else throw h(`Build failed with code ${n}`),Error(`Build failed with code ${n}`);await z()}async function z(){if(r(c(l.cwd(),`dist`,`server`,`image.json`))&&r(c(l.cwd(),`public`)))try{let t=await k(n(e(),[`optimize-images`],{stdio:`inherit`,cwd:l.cwd(),shell:!1}),{tolerateErrors:!0});t!==0&&g(`Image pre-optimization exited with code ${t}`)}catch(e){g(`Could not pre-optimize images: ${A(e)}`)}}async function B(){let e=C().viteBin;if(!r(c(l.cwd(),`dist`))){p(`First run detected - building project...`);let t=await k(O(e,[`build`,`--mode`,`development`],{stdio:`inherit`,cwd:l.cwd()}));if(t===0)m(`Initial build complete`);else throw h(`Build failed with code ${t}`),Error(`Build failed with code ${t}`)}p(`Starting Vite${e===`vp`?`+`:``} dev server...`);let t=O(e,[`dev`],{stdio:`inherit`,cwd:l.cwd()}),n=()=>{p(`Shutting down dev server...`),t.kill(`SIGTERM`)};return l.on(`SIGINT`,n),l.on(`SIGTERM`,n),t.on(`error`,e=>{h(`Failed to start Vite: ${e.message}`),l.exit(1)}),t.on(`exit`,e=>{e!==0&&e!==null&&(h(`Vite exited with code ${e}`),l.exit(e))}),new Promise(()=>{})}async function V(){let r;try{r=e()}catch{h(`Failed to obtain rari binary`),h(t()),l.exit(1)}let{port:i,mode:a,host:o}=L();if(F()){let e=I();p(`${e} environment detected`),p(`Starting rari server for ${e} deployment...`),p(`Mode: ${a}, Host: ${o}, Port: ${i}`),p(`using binary: ${r}`)}let s=[`--mode`,a,`--port`,i,`--host`,o],c=l.platform!==`win32`&&!!l.stdin.isTTY,u=n(r,s,{stdio:`inherit`,cwd:l.cwd(),detached:c,env:{...l.env,RUST_LOG:l.env.RUST_LOG||`error`}}),d=!1,f,g=()=>{d||(d=!0,p(`shutting down...`),u.kill(`SIGTERM`),f=setTimeout(()=>{u.kill(`SIGKILL`),l.exit(1)},5e3),f.unref?.())};return l.on(`SIGINT`,g),l.on(`SIGTERM`,g),l.on(`exit`,()=>{try{u.kill(`SIGKILL`)}catch{}}),u.on(`error`,e=>{h(`Failed to start rari server: ${e.message}`),e.message.includes(`ENOENT`)&&h(`Binary not found. Please ensure rari is properly installed.`),l.exit(1)}),u.on(`exit`,(e,t)=>{f&&clearTimeout(f),t?(d&&(p(`server stopped by signal ${t}`),l.exit(0)),h(`server stopped unexpectedly by signal ${t}`),l.exit(1)):e===0?(m(`server stopped successfully`),l.exit(0)):(h(`server exited with code ${e}`),l.exit(e||1))}),new Promise(()=>{})}async function H(){p(`Setting up Railway deployment...`),F()&&(h(`Already running in ${I()} environment. Use "rari start" instead.`),l.exit(1));let{createRailwayDeployment:e}=await import(`./railway-fmDbDigI.mjs`);await e()}async function U(){p(`Setting up Render deployment...`),F()&&(h(`Already running in ${I()} environment. Use "rari start" instead.`),l.exit(1));let{createRenderDeployment:e}=await import(`./render-2I7-kFd_.mjs`);await e()}async function W(){let e=c(l.cwd(),`dist`);r(e)?(p(`Cleaning dist folder...`),s(e,{recursive:!0,force:!0}),m(`Cleaned dist folder`)):p(`No dist folder to clean`)}function G(){console.warn(`${f(`bold`,`rari CLI`)}
1
+ import{_ as e,g as t,v as n}from"./type-guards-CTkEL8zw.mjs";import{getBinaryPath as r,getInstallationInstructions as i}from"./platform.mjs";import{spawn as a}from"node:child_process";import{existsSync as o,readFileSync as s,readdirSync as c,realpathSync as l,rmSync as u}from"node:fs";import{resolve as d}from"node:path";import f from"node:process";import{fileURLToPath as p}from"node:url";import{parseArgs as m,styleText as h}from"node:util";function g(e){console.warn(`${h(`blue`,`info`)} ${e}`)}function _(e){console.warn(`${h(`green`,`✓`)} ${e}`)}function v(e){console.error(`${h(`red`,`✗`)} ${e}`)}function y(e){console.warn(`${h(`yellow`,`⚠`)} ${e}`)}let b=null;function x(e){let t=o(e)?new Set(S(e)):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`:C(e)}function S(e){try{return c(e)}catch{return[]}}function C(n){try{let r=d(n,`package.json`);if(!o(r))return null;let i=t(s(r,`utf-8`));return i?e(i):null}catch{}return null}function w(e){try{let r=d(e,`package.json`);if(!o(r))return null;let i=t(s(r,`utf-8`));return i?n(i):null}catch{}return null}function T(e){let t=e,n=null,r=null;for(;t!==d(t,`..`)&&(n??=x(t),r??=w(t),!(n&&r));)t=d(t,`..`);return{cwd:e,packageManager:n??`npm`,viteBin:r??`vite`}}function E(){let e=f.cwd();return b?.cwd===e||(b=T(e)),b}function D(){return E().packageManager}function O(){let e=E().packageManager,t=f.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 k(e,t=f.cwd()){let n=f.platform===`win32`,r=t;for(;r!==d(r,`..`);){let t=d(r,`node_modules`,`.bin`),i=n?[d(t,`${e}.cmd`),d(t,`${e}.exe`),d(t,e)]:[d(t,e)];for(let e of i)if(o(e))return e;r=d(r,`..`)}return null}function A(e,t,n={}){let r=f.platform===`win32`;if(e===`npx`){let e=O();if(e.includes(`bun`))return a(r?`bunx.cmd`:`bunx`,t,{...n,shell:r});if(e.includes(`pnpm`))return a(e,[`exec`,...t],{...n,shell:r});if(e.includes(`yarn`)){let[i,...o]=t;return a(e,i===`vp`?[`dlx`,`-p`,`vite-plus`,`vp`,...o]:[`dlx`,...t],{...n,shell:r})}}return r&&e===`npx`?a(`npx.cmd`,t,{...n,shell:!0}):a(e,t,n)}function j(e,t,n={}){let r=k(e);return r!=null&&r!==``?a(r,t,f.platform===`win32`&&r.endsWith(`.cmd`)?{...n,shell:!0}:n):A(`npx`,[e,...t],n)}async function M(e,t={}){return new Promise((n,r)=>{e.on(`exit`,e=>{n(e)}),e.on(`error`,e=>{t.tolerateErrors?(y(N(e)),n(1)):r(e)})})}function N(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function P(){let e=d(f.cwd(),`.env`);o(e)&&f.loadEnvFile(e)}function F(e){let{values:t,positionals:n}=m({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 I(){return f.env.RAILWAY_ENVIRONMENT!=null&&f.env.RAILWAY_ENVIRONMENT!==``||f.env.RAILWAY_PROJECT_ID!=null&&f.env.RAILWAY_PROJECT_ID!==``||f.env.RAILWAY_SERVICE_ID!=null&&f.env.RAILWAY_SERVICE_ID!==``}function L(){return f.env.RENDER!=null&&f.env.RENDER!==``||f.env.RENDER_SERVICE_ID!=null&&f.env.RENDER_SERVICE_ID!==``||f.env.RENDER_SERVICE_NAME!=null&&f.env.RENDER_SERVICE_NAME!==``}function R(){return I()||L()}function z(){return I()?`Railway`:L()?`Render`:`local`}function B(){return{port:f.env.PORT!=null&&f.env.PORT!==``?f.env.PORT:f.env.RSC_PORT!=null&&f.env.RSC_PORT!==``?f.env.RSC_PORT:`3000`,mode:f.env.NODE_ENV!=null&&f.env.NODE_ENV!==``?f.env.NODE_ENV:`production`,host:R()?`0.0.0.0`:`127.0.0.1`}}async function V(){q();let e=E().viteBin;g(`Type checking...`);let t=await M(j(`tsc`,[],{stdio:`inherit`,cwd:f.cwd()}));if(t===0)_(`Type check passed`);else throw v(`Type check failed with code ${t}`),Error(`Type check failed with code ${t}`);g(`Building for production...`);let n=await M(j(e,[`build`],{stdio:`inherit`,cwd:f.cwd()}));if(n===0)_(`Build complete`);else throw v(`Build failed with code ${n}`),Error(`Build failed with code ${n}`);await H()}async function H(){if(o(d(f.cwd(),`dist`,`server`,`image.json`))&&o(d(f.cwd(),`public`)))try{let e=await M(a(r(),[`optimize-images`],{stdio:`inherit`,cwd:f.cwd(),shell:!1}),{tolerateErrors:!0});e!==0&&y(`Image pre-optimization exited with code ${e}`)}catch(e){y(`Could not pre-optimize images: ${N(e)}`)}}async function U(){let e=E().viteBin;if(!o(d(f.cwd(),`dist`))){g(`First run detected - building project...`);let t=await M(j(e,[`build`,`--mode`,`development`],{stdio:`inherit`,cwd:f.cwd()}));if(t===0)_(`Initial build complete`);else throw v(`Build failed with code ${t}`),Error(`Build failed with code ${t}`)}g(`Starting Vite${e===`vp`?`+`:``} dev server...`);let t=j(e,[`dev`],{stdio:`inherit`,cwd:f.cwd()}),n=()=>{g(`Shutting down dev server...`),t.kill(`SIGTERM`)};return f.on(`SIGINT`,n),f.on(`SIGTERM`,n),t.on(`error`,e=>{v(`Failed to start Vite: ${e.message}`),f.exit(1)}),t.on(`exit`,e=>{e!==0&&e!==null&&(v(`Vite exited with code ${e}`),f.exit(e))}),new Promise(()=>{})}async function W(){let e;try{e=r()}catch{v(`Failed to obtain rari binary`),v(i()),f.exit(1)}let{port:t,mode:n,host:o}=B();if(R()){let r=z();g(`${r} environment detected`),g(`Starting rari server for ${r} deployment...`),g(`Mode: ${n}, Host: ${o}, Port: ${t}`),g(`using binary: ${e}`)}let s=[`--mode`,n,`--port`,t,`--host`,o],c=f.platform!==`win32`&&f.stdin.isTTY,l=a(e,s,{stdio:`inherit`,cwd:f.cwd(),detached:c,env:{...f.env,RUST_LOG:f.env.RUST_LOG!=null&&f.env.RUST_LOG!==``?f.env.RUST_LOG:`error`}}),u=!1,d,p=()=>{u||(u=!0,g(`shutting down...`),l.kill(`SIGTERM`),d=setTimeout(()=>{l.kill(`SIGKILL`),f.exit(1)},5e3),d.unref())};return f.on(`SIGINT`,p),f.on(`SIGTERM`,p),f.on(`exit`,()=>{try{l.kill(`SIGKILL`)}catch{}}),l.on(`error`,e=>{v(`Failed to start rari server: ${e.message}`),e.message.includes(`ENOENT`)&&v(`Binary not found. Please ensure rari is properly installed.`),f.exit(1)}),l.on(`exit`,(e,t)=>{d&&clearTimeout(d),t!=null&&t!==``?(u&&(g(`server stopped by signal ${t}`),f.exit(0)),v(`server stopped unexpectedly by signal ${t}`),f.exit(1)):e===0?(_(`server stopped successfully`),f.exit(0)):(v(`server exited with code ${e}`),f.exit(e!=null&&e!==0?e:1))}),new Promise(()=>{})}async function G(){g(`Setting up Railway deployment...`),R()&&(v(`Already running in ${z()} environment. Use "rari start" instead.`),f.exit(1));let{createRailwayDeployment:e}=await import(`./railway-HYTbx27C.mjs`);e()}async function K(){g(`Setting up Render deployment...`),R()&&(v(`Already running in ${z()} environment. Use "rari start" instead.`),f.exit(1));let{createRenderDeployment:e}=await import(`./render-CG5rxWXV.mjs`);e()}function q(){let e=d(f.cwd(),`dist`);o(e)?(g(`Cleaning dist folder...`),u(e,{recursive:!0,force:!0}),_(`Cleaned dist folder`)):g(`No dist folder to clean`)}function J(){console.warn(`${h(`bold`,`rari CLI`)}
2
2
 
3
- ${f(`bold`,`Usage:`)}
4
- ${f(`cyan`,`rari dev`)} Start the development server with Vite
5
- ${f(`cyan`,`rari build`)} Build for production
6
- ${f(`cyan`,`rari start`)} Start the rari server (defaults to production)
7
- ${f(`cyan`,`rari clean`)} Remove the dist folder
8
- ${f(`cyan`,`rari deploy railway`)} Setup Railway deployment
9
- ${f(`cyan`,`rari deploy render`)} Setup Render deployment
10
- ${f(`cyan`,`rari help`)} Show this help message
3
+ ${h(`bold`,`Usage:`)}
4
+ ${h(`cyan`,`rari dev`)} Start the development server with Vite
5
+ ${h(`cyan`,`rari build`)} Build for production
6
+ ${h(`cyan`,`rari start`)} Start the rari server (defaults to production)
7
+ ${h(`cyan`,`rari clean`)} Remove the dist folder
8
+ ${h(`cyan`,`rari deploy railway`)} Setup Railway deployment
9
+ ${h(`cyan`,`rari deploy render`)} Setup Render deployment
10
+ ${h(`cyan`,`rari help`)} Show this help message
11
11
 
12
- ${f(`bold`,`Environment Variables:`)}
13
- ${f(`yellow`,`PORT`)} Server port (default: 3000)
14
- ${f(`yellow`,`RSC_PORT`)} Alternative server port
15
- ${f(`yellow`,`NODE_ENV`)} Environment (default: production for start, development for dev)
16
- ${f(`yellow`,`RUST_LOG`)} Rust logging level (default: info)
12
+ ${h(`bold`,`Environment Variables:`)}
13
+ ${h(`yellow`,`PORT`)} Server port (default: 3000)
14
+ ${h(`yellow`,`RSC_PORT`)} Alternative server port
15
+ ${h(`yellow`,`NODE_ENV`)} Environment (default: production for start, development for dev)
16
+ ${h(`yellow`,`RUST_LOG`)} Rust logging level (default: info)
17
17
 
18
- ${f(`bold`,`Examples:`)}
19
- ${f(`gray`,`# Start development server with Vite`)}
20
- ${f(`cyan`,`rari dev`)}
18
+ ${h(`bold`,`Examples:`)}
19
+ ${h(`gray`,`# Start development server with Vite`)}
20
+ ${h(`cyan`,`rari dev`)}
21
21
 
22
- ${f(`gray`,`# Build for production`)}
23
- ${f(`cyan`,`rari build`)}
22
+ ${h(`gray`,`# Build for production`)}
23
+ ${h(`cyan`,`rari build`)}
24
24
 
25
- ${f(`gray`,`# Clean dist folder`)}
26
- ${f(`cyan`,`rari clean`)}
25
+ ${h(`gray`,`# Clean dist folder`)}
26
+ ${h(`cyan`,`rari clean`)}
27
27
 
28
- ${f(`gray`,`# Start production server (default)`)}
29
- ${f(`cyan`,`rari start`)}
28
+ ${h(`gray`,`# Start production server (default)`)}
29
+ ${h(`cyan`,`rari start`)}
30
30
 
31
- ${f(`gray`,`# Start in development mode`)}
32
- ${f(`cyan`,`NODE_ENV=development rari start`)}
31
+ ${h(`gray`,`# Start in development mode`)}
32
+ ${h(`cyan`,`NODE_ENV=development rari start`)}
33
33
 
34
- ${f(`gray`,`# Start production server on port 8080`)}
35
- ${f(`cyan`,`PORT=8080 rari start`)}
34
+ ${h(`gray`,`# Start production server on port 8080`)}
35
+ ${h(`cyan`,`PORT=8080 rari start`)}
36
36
 
37
- ${f(`gray`,`# Setup Railway deployment`)}
38
- ${f(`cyan`,`rari deploy railway`)}
37
+ ${h(`gray`,`# Setup Railway deployment`)}
38
+ ${h(`cyan`,`rari deploy railway`)}
39
39
 
40
- ${f(`gray`,`# Setup Render deployment`)}
41
- ${f(`cyan`,`rari deploy render`)}
40
+ ${h(`gray`,`# Setup Render deployment`)}
41
+ ${h(`cyan`,`rari deploy render`)}
42
42
 
43
- ${f(`gray`,`# Start with debug logging`)}
44
- ${f(`cyan`,`RUST_LOG=debug rari start`)}
43
+ ${h(`gray`,`# Start with debug logging`)}
44
+ ${h(`cyan`,`RUST_LOG=debug rari start`)}
45
45
 
46
- ${f(`bold`,`Deployment:`)}
47
- ${f(`cyan`,`rari deploy railway`)} Creates Railway deployment files
48
- ${f(`cyan`,`rari deploy render`)} Creates Render deployment files
46
+ ${h(`bold`,`Deployment:`)}
47
+ ${h(`cyan`,`rari deploy railway`)} Creates Railway deployment files
48
+ ${h(`cyan`,`rari deploy render`)} Creates Render deployment files
49
49
 
50
50
  Platform deployment automatically detects the environment and configures:
51
51
  - Host binding (0.0.0.0 for platforms, 127.0.0.1 for local)
52
52
  - Port from platform's PORT environment variable
53
53
  - Production mode optimization
54
54
 
55
- ${f(`bold`,`Binary Resolution:`)}
55
+ ${h(`bold`,`Binary Resolution:`)}
56
56
  1. Platform-specific package (rari-{platform}-{arch})
57
57
  2. Global binary in PATH
58
58
  3. Install from source with Cargo
59
59
 
60
- ${f(`bold`,`Notes:`)}
60
+ ${h(`bold`,`Notes:`)}
61
61
  - 'rari start' defaults to production mode unless NODE_ENV is set
62
62
  - 'rari dev' runs in development mode with Vite hot reload
63
63
  - 'rari build' cleans, type checks, and builds for production
@@ -65,4 +65,4 @@ ${f(`bold`,`Notes:`)}
65
65
  - Platform deployment is automatically detected and configured
66
66
  - Use Ctrl+C to stop the server gracefully
67
67
 
68
- `)}async function K(){j();let{command:e,args:t}=M(l.argv.slice(2));switch(e){case void 0:case`help`:G();break;case`dev`:await B();break;case`build`:await R();break;case`start`:await V();break;case`clean`:await W();break;case`deploy`:t[0]===`railway`?await H():t[0]===`render`?await U():(h(`Unknown deployment target. Available: railway, render`),l.exit(1));break;default:console.error(`${f(`bold`,`Unknown command:`)} ${e}`),console.warn(`Run "${f(`cyan`,`rari help`)}" for available commands`),l.exit(1)}}function q(){let e=l.argv[1]?o(c(l.argv[1])):``,t=o(u(import.meta.url));return!!e&&t===e}q()&&K().catch(e=>{h(`CLI Error: ${A(e)}`),console.error(e),l.exit(1)});export{w as detectPackageManager,L as getDeploymentConfig,N as isRailwayEnvironment,P as isRenderEnvironment};
68
+ `)}async function Y(){P();let{command:e,args:t}=F(f.argv.slice(2));if(e==null||e===`help`){J();return}switch(e){case`dev`:await U();break;case`build`:await V();break;case`start`:await W();break;case`clean`:q();break;case`deploy`:t[0]===`railway`?await G():t[0]===`render`?await K():(v(`Unknown deployment target. Available: railway, render`),f.exit(1));break;default:console.error(`${h(`bold`,`Unknown command:`)} ${e}`),console.warn(`Run "${h(`cyan`,`rari help`)}" for available commands`),f.exit(1)}}function X(){let e=f.argv[1]?l(d(f.argv[1])):``,t=l(p(import.meta.url));return!!e&&t===e}X()&&Y().catch(e=>{v(`CLI Error: ${N(e)}`),console.error(e),f.exit(1)});export{D as detectPackageManager,B as getDeploymentConfig,I as isRailwayEnvironment,L as isRenderEnvironment};
@@ -0,0 +1,13 @@
1
+ import { ComponentType } from "react";
2
+ //#region src/mdx/components/define.d.ts
3
+ interface MdxComponentEntry {
4
+ readonly name: string;
5
+ readonly component: ComponentType<any>;
6
+ readonly id: string;
7
+ readonly client?: boolean;
8
+ readonly exportName?: string;
9
+ }
10
+ type MdxComponentsInput = Readonly<Record<string, ComponentType<any> | MdxComponentEntry>>;
11
+ declare function defineMdxComponents(input: readonly MdxComponentEntry[] | MdxComponentsInput): (content: string) => Record<string, any>;
12
+ //#endregion
13
+ export { defineMdxComponents as n, MdxComponentEntry as t };
@@ -0,0 +1 @@
1
+ import{p as e}from"./type-guards-CTkEL8zw.mjs";import{s as t}from"./regex-constants-Wm7xRA3u.mjs";import{t as n}from"./names-N6JRDeT1.mjs";import{registerClientReference as r}from"./runtime/rsc-references.mjs";import{r as i}from"./rari-global-5vGzhToD.mjs";function a(e,n,a=`default`){let o=`${n}#${a}`;if(typeof globalThis<`u`){let r=i(),s=n.replace(t,``).split(`/`).pop(),c=s!=null&&s!==``?s:a,l={id:a==="default"?c:a,path:n,type:`client`,component:e,registered:!0};r[o]=l,r[c]=l,r[n]=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 r(s,n,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)}function l(e){return c(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 u(e){let t=l(e);return e=>{let r={},i={},a=new Set(n(e));for(let e of t)if(a.has(e.name)){if(e.client===!1){r[e.name]=e.component;continue}i[e.name]={component:e.component,id:e.id,exportName:e.exportName}}return{...r,...o(i)}}}export{u as t};
@@ -0,0 +1,3 @@
1
+ import{p as e}from"./type-guards-CTkEL8zw.mjs";import{o as t,t as n}from"./alias-resolver-Cigam7Y7.mjs";import{t as r}from"./xml-N8OZmN7u.mjs";import{Buffer as i}from"node:buffer";import{promises as a}from"node:fs";import o from"node:path";const s=`\0virtual:feed`;function c(t){return e(t)&&typeof t.title==`string`&&typeof t.description==`string`&&typeof t.link==`string`&&Array.isArray(t.items)}async function l(e){if(typeof e==`function`){let t=e(),n=t instanceof Promise?await t:t;if(!c(n))throw Error(`Feed default export must resolve to a feed object`);return n}if(!c(e))throw Error(`Feed default export must be a feed object`);return e}function u(e){return(typeof e==`string`?new Date(e):e).toUTCString()}function d(e){return e==null||e===``?``:typeof e==`string`?` <dc:creator>${r(e)}</dc:creator>`:e.email!=null&&e.email!==``?` <author>${r(`${e.email} (${e.name})`)}</author>`:` <dc:creator>${r(e.name)}</dc:creator>`}function f(e){let t=[` <item>`];t.push(` <title>${r(e.title)}</title>`),t.push(` <link>${r(e.url)}</link>`),e.description!=null&&e.description!==``&&t.push(` <description>${r(e.description)}</description>`),e.content!=null&&e.content!==``&&t.push(` <content:encoded><![CDATA[${e.content.replace(/\]\]>/g,`]]]]><![CDATA[>`)}]]></content:encoded>`);let n=d(e.author);if(n&&t.push(n),e.pubDate!=null&&t.push(` <pubDate>${u(e.pubDate)}</pubDate>`),t.push(` <guid isPermaLink="${e.guid!=null&&e.guid!==``?`false`:`true`}">${r(e.guid!=null&&e.guid!==``?e.guid:e.url)}</guid>`),e.categories)for(let n of e.categories)t.push(` <category>${r(n)}</category>`);if(e.enclosure){let n=[`url="${r(e.enclosure.url)}"`];e.enclosure.length!==void 0&&n.push(`length="${e.enclosure.length}"`),n.push(`type="${r(e.enclosure.type!=null&&e.enclosure.type!==``?e.enclosure.type:`application/octet-stream`)}"`),t.push(` <enclosure ${n.join(` `)} />`)}return t.push(` </item>`),t.join(`
2
+ `)}function p(e){let t=e.items.some(e=>e.content!=null&&e.content!==``),n=e.items.some(e=>{let t=e.author;return t==null||t===``?!1:typeof t==`string`||t.email==null||t.email===``}),i=[];t&&i.push(`xmlns:content="http://purl.org/rss/1.0/modules/content/"`),n&&i.push(`xmlns:dc="http://purl.org/dc/elements/1.1/"`),i.push(`xmlns:atom="http://www.w3.org/2005/Atom"`);let a=[`<?xml version="1.0" encoding="UTF-8"?>`,`<rss version="2.0"${i.length>0?` ${i.join(` `)}`:``}>`,` <channel>`,` <title>${r(e.title)}</title>`,` <link>${r(e.link)}</link>`,` <description>${r(e.description)}</description>`,` <atom:link href="${r(`${e.link.replace(/\/+$/,``)}/feed.xml`)}" rel="self" type="application/rss+xml" />`];e.language!=null&&e.language!==``&&a.push(` <language>${r(e.language)}</language>`),e.copyright!=null&&e.copyright!==``&&a.push(` <copyright>${r(e.copyright)}</copyright>`),e.lastBuildDate!=null&&a.push(` <lastBuildDate>${u(e.lastBuildDate)}</lastBuildDate>`),e.ttl!==void 0&&a.push(` <ttl>${e.ttl}</ttl>`),e.image&&(a.push(` <image>`),a.push(` <url>${r(e.image.url)}</url>`),a.push(` <title>${r(e.image.title)}</title>`),a.push(` <link>${r(e.image.link)}</link>`),e.image.width!==void 0&&a.push(` <width>${e.image.width}</width>`),e.image.height!==void 0&&a.push(` <height>${e.image.height}</height>`),a.push(` </image>`));for(let t of e.items)a.push(f(t));return a.push(` </channel>`),a.push(`</rss>`),a.join(`
3
+ `)}function m(e){switch(e){case`ts`:return`ts`;case`tsx`:return`tsx`;case`js`:case`mjs`:return`js`;case`jsx`:return`jsx`;default:throw Error(`Unsupported feed file extension: ".${e}". Allowed extensions are: .ts, .tsx, .js, .jsx, .mjs`)}}async function h(e,t=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`]){let n=o.join(e,`feed.xml`);try{return await a.access(n),{type:`static`,path:n}}catch{}for(let n of t){let t=o.join(e,`feed${n}`);try{return await a.access(t),{type:`dynamic`,path:t}}catch{}}return null}function g(e,r,i={},c){return{name:`virtual-feed`,resolveId(r,a){if(r===s)return r;if(Object.keys(i).length>0){let e=n(r,i,c);if(e!=null&&e!==``){let n=t(e);return n!=null&&n!==``?n:e}}if(r.startsWith(`.`)){let n=a==null||a===``||a.startsWith(`\0`)?e.path:a,i=o.resolve(o.dirname(n),r),s=t(i);return s!=null&&s!==``?s:i}return null},async load(t){if(t===s)return{code:r,moduleType:m(o.extname(e.path).slice(1))};if(t&&!t.startsWith(`\0`))try{return{code:await a.readFile(t,`utf-8`),moduleType:m(o.extname(t).slice(1))}}catch{return null}return null}}}async function _(t){let{appDir:n,outDir:r,extensions:c,aliases:u={}}=t,d=await h(n,c);if(!d)return!1;await a.mkdir(r,{recursive:!0});let f=o.join(r,`feed.xml`);if(d.type===`static`)return await a.copyFile(d.path,f),!0;try{let{build:t}=await import(`rolldown`),r=await a.readFile(d.path,`utf-8`),c=o.dirname(o.dirname(n)),m=await t({input:s,external:[`rari`],platform:`node`,write:!1,output:{format:`esm`,codeSplitting:!1},plugins:[g(d,r,u,c)]});if(m.output.length===0)throw Error(`Failed to build feed module`);let h=m.output.find(e=>e.type===`chunk`&&e.isEntry)??m.output.find(e=>e.type===`chunk`);if(h?.type!==`chunk`)throw Error(`No chunk output found in feed build result`);let _=h.code,v=await import(`data:text/javascript;base64,${i.from(_).toString(`base64`)}`);if(!e(v))throw Error(`Feed file must export a default export (either an object or a function)`);let y=v.default;if(y==null)throw Error(`Feed file must export a default export (either an object or a function)`);let b=p(await l(y));return await a.writeFile(f,b),!0}catch(e){return console.error(`[rari] Failed to build/execute feed file:`,e),!1}}export{_ as generateFeedFile};
@@ -0,0 +1 @@
1
+ import{c as e,p as t,u as n}from"./type-guards-CTkEL8zw.mjs";import{n as r,r as i,t as a}from"./rari-global-5vGzhToD.mjs";import*as o from"react";function s(e){return e.startsWith(`./`)?[e,e.slice(2)]:[e,`./${e}`]}function c(e){let t=e.replace(/\\/g,`/`),n=new Set([t]),r=t.indexOf(`/src/`);r!==-1&&n.add(t.slice(r+1));let i=t.indexOf(`/components/`);return i!==-1&&n.add(t.slice(i+1)),[...n]}function l(e,t){if(t!==void 0)return t;let n=e.exportName;if(n!=null&&n!==``)return n}function u(e,t){let n=e.replace(/\\/g,`/`),r=t.replace(/\\/g,`/`);return!!(n===r||r.includes(`/`)&&n.endsWith(`/${r}`)||n.includes(`/`)&&r.endsWith(`/${n}`))}function d(e,t,n){for(let r of c(e))for(let e of s(r)){let r=Object.values(n).find(t=>t.path!==``&&u(t.path,e));if(r)return{info:r,exportName:l(r,t)}}return null}function f(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 p(e,t){return e.component==null?e.loadPromise?(await e.loadPromise,m(e,t)):e.loader?await f(e)==null?null:m(e,t):null:m(e,t)}function m(e,r){let i=e.component;if(i==null)return null;if(n(i))return i;if(!t(i))return null;if(r==null||r===``||r==="default")return i.default??i;if(r in i)return i[r];let a=i.default;return t(a)&&r in a?a[r]:null}function h(e){let t=e.replace(/\\/g,`/`);return t===e?[t]:[t,e]}function g(e){let t=i(),n=r(),o=a(),c=e.replace(/\\/g,`/`);for(let n of h(e))if(n in t){let e=t[n],r=n.indexOf(`#`);return{info:e,exportName:l(e,r===-1?void 0:n.slice(r+1))}}let u=c.indexOf(`#`),f=u===-1?c:c.slice(0,u),p=u===-1?void 0:c.slice(u+1);for(let n of h(e)){let e=n.indexOf(`#`),r=e===-1?n:n.slice(0,e);if(r in t)return{info:t[r],exportName:l(t[r],p)}}let m=c===e?[f]:[f,e.includes(`#`)?e.slice(0,e.indexOf(`#`)):e];for(let e of m){for(let r of s(e))if(r in n){let e=n[r];if(e!==``&&e in t)return{info:t[e],exportName:l(t[e],p)}}if(e in o){let n=o[e];if(n!==``&&n in t)return{info:t[n],exportName:l(t[n],p)}}}return d(f,p,t)}function _(e){return e instanceof Error?e:Error(String(e))}function v(e,t){return Object.assign(Error(`[rari] Lazy component "${t}" is loading`),{then:e.then.bind(e)})}function y(e){return e.component!=null||e.loader==null?e.loadPromise:e.loadError==null?e.loadPromise?e.loadPromise:f(e):Promise.reject(_(e.loadError))}function b(e,r,i){let a=l(e,i),o=m({...e,component:r},a);if(o==null)return t(r)&&(`default`in r||`__esModule`in r)?r:n(r)?{default:r,[a!=null&&a!==``?a:`default`]:r,__esModule:!0}:r;let s=a!=null&&a!==``?a:`default`;return{...t(r)?r:{},default:o,[s]:o,__esModule:!0}}function x(t,n,r,i){let a=l(t,i),s=a!=null&&a!==``?a:`default`,c=i=>{if(t.loadError!=null)throw _(t.loadError);if(t.component!=null){let r=m(t,a);if(r==null)throw Error(`[rari] Lazy component "${n}" loaded but export "${s}" is missing`);if(!e(r))throw Error(`[rari] Lazy component "${n}" export "${s}" is not a component`);return o.createElement(r,i)}throw v(r,n)};return c.displayName=`Lazy(${t.displayName??t.exportName??n})`,{default:c,[s]:c,__esModule:!0}}function S(e){let t=g(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 b(n,n.component,r);if(n.loader){if(n.loadError!=null)return x(n,e,Promise.resolve(),r);let t=y(n);if(t)return x(n,e,t,r)}return{}}async function C(e){let t=g(e);return t?p(t.info,t.exportName):null}function w(){typeof window>`u`||Reflect.set(globalThis,`__rari_chunk_load__`,async e=>{let t=i(),n=e.replace(/\\/g,`/`),r=e in t?t[e]:n in t?t[n]:Object.values(t).find(t=>t.path===e||t.path===n);if(r&&r.component==null&&r.loader!=null){let e=y(r);if(e)return e.then(()=>void 0)}return r?.loadPromise==null?Promise.resolve():r.loadPromise.then(()=>void 0)})}export{w as n,S as r,C as t};
@@ -1,39 +1,4 @@
1
- //#region src/runtime/shared/types.d.ts
2
- interface CookieOptions {
3
- path?: string;
4
- domain?: string;
5
- expires?: Date;
6
- maxAge?: number;
7
- httpOnly?: boolean;
8
- secure?: boolean;
9
- sameSite?: boolean | 'lax' | 'strict' | 'none';
10
- priority?: 'low' | 'medium' | 'high';
11
- partitioned?: boolean;
12
- }
13
- interface ReadonlyCookie {
14
- name: string;
15
- value: string;
16
- }
17
- interface ReadonlyHeaders {
18
- get: (name: string) => string | null;
19
- has: (name: string) => boolean;
20
- entries: () => IterableIterator<[string, string]>;
21
- forEach: (callback: (value: string, key: string) => void) => void;
22
- keys: () => IterableIterator<string>;
23
- values: () => IterableIterator<string>;
24
- }
25
- interface CookieStore {
26
- get: (name: string) => ReadonlyCookie | undefined;
27
- getAll: (name?: string) => ReadonlyCookie[];
28
- has: (name: string) => boolean;
29
- set: ((name: string, value: string, options?: CookieOptions) => void) & ((options: {
30
- name: string;
31
- value: string;
32
- } & CookieOptions) => void);
33
- delete: (name: string) => void;
34
- toString: () => string;
35
- }
36
- //#endregion
1
+ import { i as ReadonlyHeaders, n as CookieStore, r as ReadonlyCookie, t as CookieOptions } from "./types-_vPM8QuJ.mjs";
37
2
  //#region src/headers.d.ts
38
3
  declare function cookies(): Promise<CookieStore>;
39
4
  declare function headers(): Promise<ReadonlyHeaders>;
package/dist/headers.mjs CHANGED
@@ -1 +1 @@
1
- import{i as e}from"./rari-global-Dygfa818.mjs";function t(){let t=e();if(t.markUseCacheDynamic){t.markUseCacheDynamic();return}t.useCacheDynamicDepth=(t.useCacheDynamicDepth??0)+1}async function n(){t();let n=e().cookies?.();if(!n)throw Error(`[rari] cookies() is only available in server actions and server components.`);return n}async function r(){t();let n=e().headers?.();if(!n)throw Error(`[rari] headers() is only available in server actions and server components.`);return n}export{n as cookies,r as headers};
1
+ import{i as e}from"./rari-global-5vGzhToD.mjs";function t(){let t=e();if(t.markUseCacheDynamic){t.markUseCacheDynamic();return}t.useCacheDynamicDepth=(t.useCacheDynamicDepth??0)+1}async function n(){t();let n=e().cookies?.();if(!n)throw Error(`[rari] cookies() is only available in server actions and server components.`);return Promise.resolve(n)}async function r(){t();let n=e().headers?.();if(!n)throw Error(`[rari] headers() is only available in server actions and server components.`);return Promise.resolve(n)}export{n as cookies,r as headers};
package/dist/image.d.mts CHANGED
@@ -1,46 +1,50 @@
1
- //#region src/image/constants.d.ts
2
- type ImageFormat = 'avif' | 'webp';
3
- declare const DEFAULT_DEVICE_SIZES: number[];
4
- declare const DEFAULT_IMAGE_SIZES: number[];
5
- declare const DEFAULT_FORMATS: ImageFormat[];
6
- declare const DEFAULT_QUALITY_LEVELS: number[];
7
- declare const DEFAULT_MINIMUM_CACHE_TTL = 60;
8
- declare const DEFAULT_MAX_CACHE_SIZE: number;
9
- //#endregion
10
1
  //#region src/image/image.d.ts
11
2
  interface ImageProps {
12
- src: string | StaticImageData;
13
- alt: string;
14
- width?: number;
15
- height?: number;
16
- quality?: number;
17
- preload?: boolean;
18
- loading?: 'lazy' | 'eager';
19
- placeholder?: 'blur' | 'empty';
20
- blurDataURL?: string;
21
- fill?: boolean;
22
- sizes?: string;
23
- style?: React.CSSProperties;
24
- className?: string;
25
- onLoad?: (event: React.SyntheticEvent<HTMLImageElement>) => void;
26
- onError?: (event: React.SyntheticEvent<HTMLImageElement>) => void;
27
- unoptimized?: boolean;
28
- loader?: (props: {
3
+ readonly src: string | StaticImageData;
4
+ readonly alt: string;
5
+ readonly width?: number;
6
+ readonly height?: number;
7
+ readonly quality?: number;
8
+ readonly preload?: boolean;
9
+ readonly loading?: 'lazy' | 'eager';
10
+ readonly placeholder?: 'blur' | 'empty';
11
+ readonly blurDataURL?: string;
12
+ readonly fill?: boolean;
13
+ readonly sizes?: string;
14
+ readonly style?: React.CSSProperties;
15
+ readonly className?: string;
16
+ readonly onLoad?: (event: React.SyntheticEvent<HTMLImageElement>) => void;
17
+ readonly onError?: (event: React.SyntheticEvent<HTMLImageElement>) => void;
18
+ readonly unoptimized?: boolean;
19
+ readonly loader?: (props: Readonly<{
29
20
  src: string;
30
21
  width: number;
31
22
  quality: number;
32
- }) => string;
33
- overrideSrc?: string;
34
- decoding?: 'async' | 'sync' | 'auto';
23
+ }>) => string;
24
+ readonly overrideSrc?: string;
25
+ readonly decoding?: 'async' | 'sync' | 'auto';
35
26
  }
36
27
  interface StaticImageData {
37
- src: string;
38
- height: number;
39
- width: number;
40
- blurDataURL?: string;
28
+ readonly src: string;
29
+ readonly height: number;
30
+ readonly width: number;
31
+ readonly blurDataURL?: string;
41
32
  }
33
+ declare function Image$1({ src, alt, width, height, quality, preload, loading, placeholder, blurDataURL, fill, sizes, style, className, onLoad, onError, unoptimized, loader, overrideSrc, decoding }: ImageProps): import("react").JSX.Element;
34
+ //#endregion
35
+ //#region src/image/constants.d.ts
36
+ type ImageFormat = 'avif' | 'webp';
37
+ declare const DEFAULT_DEVICE_SIZES: number[];
38
+ declare const DEFAULT_IMAGE_SIZES: number[];
39
+ declare const DEFAULT_FORMATS: ImageFormat[];
40
+ declare const DEFAULT_QUALITY_LEVELS: number[];
41
+ declare const DEFAULT_MINIMUM_CACHE_TTL = 60;
42
+ declare const DEFAULT_MAX_CACHE_SIZE: number;
42
43
  //#endregion
43
44
  //#region src/image/index.d.ts
44
- declare const Image: any;
45
+ declare const Image: typeof Image$1 & {
46
+ $$typeof?: symbol;
47
+ $$id?: string;
48
+ };
45
49
  //#endregion
46
50
  export { DEFAULT_DEVICE_SIZES, DEFAULT_FORMATS, DEFAULT_IMAGE_SIZES, DEFAULT_MAX_CACHE_SIZE, DEFAULT_MINIMUM_CACHE_TTL, DEFAULT_QUALITY_LEVELS, Image, type ImageFormat, type ImageProps, type StaticImageData };
package/dist/image.mjs CHANGED
@@ -1 +1 @@
1
- import{a as e,i as t,n,o as r,r as i,t as a}from"./constants-De7aSsCq.mjs";import{useCallback as o,useEffect as s,useRef as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";function f(e,t,n,r){let i=new URLSearchParams;return i.set(`url`,e),i.set(`w`,t.toString()),i.set(`q`,n.toString()),r&&i.set(`f`,r),`/_rari/image?${i}`}function p({src:e,alt:t,width:r,height:i,quality:p=75,preload:m=!1,loading:h=`lazy`,placeholder:g=`empty`,blurDataURL:_,fill:v=!1,sizes:y,style:b,className:x,onLoad:S,onError:C,unoptimized:w=!1,loader:T,overrideSrc:E,decoding:D}){let O=typeof e==`string`?e:e.src,k=r||(typeof e==`string`?void 0:e.width),A=i||(typeof e==`string`?void 0:e.height),j=_||(typeof e==`string`?void 0:e.blurDataURL),M=E||O,N=m,P=D||(m?`sync`:`async`),[F,I]=l(!1),[L,R]=l(!1),z=c(null),B=c(S),V=c(null);s(()=>{B.current=S},[S]);let H=o(e=>{let t=e.currentTarget;t.src&&t.complete&&(g===`blur`&&I(!0),B.current&&B.current(e))},[g]),U=o(e=>{R(!0),g===`blur`&&I(!0),C&&C(e)},[g,C]);s(()=>{if(N){let e=document.createElement(`link`);return e.rel=`preload`,e.as=`image`,T?e.href=T({src:M,width:k||1920,quality:p}):w?e.href=M:e.href=f(M,k||1920,p),y&&e.setAttribute(`imagesizes`,y),document.head.appendChild(e),()=>{e.parentNode===document.head&&document.head.removeChild(e)}}},[N,M,k,p,y,T,w]),s(()=>{if(N||w||h===`eager`)return;let e=z.current;if(!e)return;let t=new IntersectionObserver(n=>{n.forEach(n=>{n.isIntersecting&&t.unobserve(e)})},{rootMargin:`50px`});return t.observe(e),()=>{t.disconnect()}},[N,w,h]);let W={...b,...v&&{position:`absolute`,inset:0,width:`100%`,height:`100%`,objectFit:`cover`},...g===`blur`&&j&&!F&&{backgroundImage:`url(${j})`,backgroundSize:`cover`,backgroundPosition:`center`,filter:`blur(20px)`,transition:`filter 0.3s ease-out`},...g===`blur`&&F&&{filter:`none`,transition:`filter 0.3s ease-out`}};if(w)return u(`img`,{ref:z,src:T?T({src:M,width:k||1920,quality:p}):M,alt:L?t:``,width:v?void 0:k,height:v?void 0:A,loading:N?`eager`:h,fetchPriority:N?`high`:`auto`,decoding:P,onLoad:H,onError:U,style:W,className:x});let G=k||1920,K=k?[k]:a,q=e=>T?K.map(e=>`${T({src:M,width:e,quality:p})} ${e}w`).join(`, `):K.map(t=>`${f(M,t,p,e)} ${t}w`).join(`, `),J=T?T({src:M,width:G,quality:p}):f(M,G,p),Y=K.length>1||K[0]!==G,X=u(`img`,{ref:z,src:J,srcSet:Y?q():void 0,sizes:Y?y:void 0,alt:L?t:``,width:v?void 0:k,height:v?void 0:A,loading:N?`eager`:h,fetchPriority:N?`high`:`auto`,decoding:P,onLoad:H,onError:U,style:W,className:x});return Y?d(`picture`,{ref:V,children:[n.includes(`avif`)&&u(`source`,{type:`image/avif`,srcSet:q(`avif`),sizes:y}),n.includes(`webp`)&&u(`source`,{type:`image/webp`,srcSet:q(`webp`),sizes:y}),X]}):X}const m=typeof window>`u`,h=p;m&&(h.$$typeof=Symbol.for(`react.client.reference`),h.$$id=`rari/image#Image`);export{a as DEFAULT_DEVICE_SIZES,n as DEFAULT_FORMATS,i as DEFAULT_IMAGE_SIZES,t as DEFAULT_MAX_CACHE_SIZE,e as DEFAULT_MINIMUM_CACHE_TTL,r as DEFAULT_QUALITY_LEVELS,h as Image};
1
+ import{a as e,i as t,n,o as r,r as i,t as a}from"./constants-De7aSsCq.mjs";import{useCallback as o,useEffect as s,useRef as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";function f(e,t,n,r){let i=new URLSearchParams;return i.set(`url`,e),i.set(`w`,t.toString()),i.set(`q`,n.toString()),r&&i.set(`f`,r),`/_rari/image?${i}`}function p({src:e,alt:t,width:r,height:i,quality:p=75,preload:m=!1,loading:h=`lazy`,placeholder:g=`empty`,blurDataURL:_,fill:v=!1,sizes:y,style:b,className:x,onLoad:S,onError:C,unoptimized:w=!1,loader:T,overrideSrc:E,decoding:D}){let O=typeof e==`string`?e:e.src,k=r!=null&&r!==0?r:typeof e==`string`?void 0:e.width,A=i!=null&&i!==0?i:typeof e==`string`?void 0:e.height,j=_!=null&&_!==``?_:typeof e==`string`?void 0:e.blurDataURL,M=E!=null&&E!==``?E:O,N=m,P=D??(m?`sync`:`async`),[F,I]=l(!1),[L,R]=l(!1),z=c(null),B=c(S),V=c(null);s(()=>{B.current=S},[S]);let H=o(e=>{let t=e.currentTarget;t.src&&t.complete&&(g===`blur`&&I(!0),B.current&&B.current(e))},[g]),U=o(e=>{R(!0),g===`blur`&&I(!0),C&&C(e)},[g,C]);s(()=>{if(!N)return;let e=document.createElement(`link`);return e.rel=`preload`,e.as=`image`,T?e.href=T({src:M,width:k!=null&&k!==0?k:1920,quality:p}):w?e.href=M:e.href=f(M,k!=null&&k!==0?k:1920,p),y!=null&&y!==``&&e.setAttribute(`imagesizes`,y),document.head.appendChild(e),()=>{e.parentNode===document.head&&document.head.removeChild(e)}},[N,M,k,p,y,T,w]),s(()=>{if(N||w||h===`eager`)return;let e=z.current;if(!e)return;let t=new IntersectionObserver(n=>{n.forEach(n=>{n.isIntersecting&&t.unobserve(e)})},{rootMargin:`50px`});return t.observe(e),()=>{t.disconnect()}},[N,w,h]);let W={...b,...v&&{position:`absolute`,inset:0,width:`100%`,height:`100%`,objectFit:`cover`},...g===`blur`&&j!=null&&j!==``&&!F&&{backgroundImage:`url(${j})`,backgroundSize:`cover`,backgroundPosition:`center`,filter:`blur(20px)`,transition:`filter 0.3s ease-out`},...g===`blur`&&F&&{filter:`none`,transition:`filter 0.3s ease-out`}};if(w)return u(`img`,{ref:z,src:T?T({src:M,width:k!=null&&k!==0?k:1920,quality:p}):M,alt:L?t:``,width:v?void 0:k,height:v?void 0:A,loading:N?`eager`:h,fetchPriority:N?`high`:`auto`,decoding:P,onLoad:H,onError:U,style:W,className:x});let G=k!=null&&k!==0?k:1920,K=k!=null&&k!==0?[k]:a,q=e=>T?K.map(e=>`${T({src:M,width:e,quality:p})} ${e}w`).join(`, `):K.map(t=>`${f(M,t,p,e)} ${t}w`).join(`, `),J=T?T({src:M,width:G,quality:p}):f(M,G,p),Y=K.length>1||K[0]!==G,X=u(`img`,{ref:z,src:J,srcSet:Y?q():void 0,sizes:Y?y:void 0,alt:L?t:``,width:v?void 0:k,height:v?void 0:A,loading:N?`eager`:h,fetchPriority:N?`high`:`auto`,decoding:P,onLoad:H,onError:U,style:W,className:x});return Y?d(`picture`,{ref:V,children:[n.includes(`avif`)&&u(`source`,{type:`image/avif`,srcSet:q(`avif`),sizes:y}),n.includes(`webp`)&&u(`source`,{type:`image/webp`,srcSet:q(`webp`),sizes:y}),X]}):X}const m=typeof window>`u`,h=p;m&&(h.$$typeof=Symbol.for(`react.client.reference`),h.$$id=`rari/image#Image`);export{a as DEFAULT_DEVICE_SIZES,n as DEFAULT_FORMATS,i as DEFAULT_IMAGE_SIZES,t as DEFAULT_MAX_CACHE_SIZE,e as DEFAULT_MINIMUM_CACHE_TTL,r as DEFAULT_QUALITY_LEVELS,h as Image};
package/dist/index.d.mts CHANGED
@@ -1,6 +1,5 @@
1
- import { a as Sitemap, c as SitemapVideo, d as RouteContext, f as RouteHandler, i as RobotsRule, l as ApiResponse, n as FeedEntry, o as SitemapEntry, r as Robots, s as SitemapImage, t as Feed, u as ApiRouteHandlers } from "./types-DJQFFYSj.mjs";
2
- import { c as RariURL, n as ProxyConfig, r as ProxyFunction, s as RariFetchEvent } from "./types-BC33STEP.mjs";
1
+ import { a as Sitemap, c as SitemapVideo, d as RouteContext, f as RouteHandler, i as RobotsRule, l as ApiResponse, n as FeedEntry, o as SitemapEntry, r as Robots, s as SitemapImage, t as Feed, u as ApiRouteHandlers } from "./types-BYob0lqv.mjs";
2
+ import { c as RariURL, d as RariResponse, n as ProxyConfig, r as ProxyFunction, s as RariFetchEvent } from "./types-DAdRjhuk.mjs";
3
3
  import { RariRequest } from "./proxy/RariRequest.mjs";
4
- import { RariResponse } from "./proxy/RariResponse.mjs";
5
- import { a as ErrorProps, d as Metadata, l as LayoutProps, p as PageProps } from "./types-DlF9FHQc.mjs";
4
+ import { a as ErrorProps, d as Metadata, l as LayoutProps, p as PageProps } from "./types-DCEyvFz7.mjs";
6
5
  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 };
@@ -1,2 +1,2 @@
1
- import { n as defineMdxComponents, t as MdxComponentEntry } from "../define-CRFUKkcA.mjs";
1
+ import { n as defineMdxComponents, t as MdxComponentEntry } from "../define-BafO1-XT.mjs";
2
2
  export { type MdxComponentEntry, defineMdxComponents };
@@ -1 +1 @@
1
- import{t as e}from"../define-rCXgNOOk.mjs";export{e as defineMdxComponents};
1
+ import{t as e}from"../define-CzFpVAjt.mjs";export{e as defineMdxComponents};
package/dist/mdx.d.mts CHANGED
@@ -1,30 +1,16 @@
1
- import { n as defineMdxComponents, t as MdxComponentEntry } from "./define-CRFUKkcA.mjs";
2
- import { ComponentType, ElementType, ExoticComponent, FragmentProps, Key, ReactElement } from "react";
3
-
1
+ import { n as defineMdxComponents, t as MdxComponentEntry } from "./define-BafO1-XT.mjs";
2
+ import { ComponentType } from "react";
3
+ import { EvaluateOptions as EvaluateOptions$1 } from "@mdx-js/mdx";
4
4
  //#region src/mdx/evaluate.d.ts
5
- interface EvaluateOptions {
5
+ interface EvaluateOptions extends EvaluateOptions$1 {
6
6
  components?: Record<string, any>;
7
- baseUrl?: string | URL;
8
- development?: boolean;
9
- remarkPlugins?: unknown[];
10
- rehypePlugins?: unknown[];
11
- recmaPlugins?: unknown[];
12
- Fragment?: ExoticComponent<FragmentProps>;
13
- jsx?: (type: ElementType, props: unknown, key?: Key) => ReactElement;
14
- jsxs?: (type: ElementType, props: unknown, key?: Key) => ReactElement;
15
- jsxDEV?: (type: ElementType, props: unknown, key?: Key, isStaticChildren?: boolean, source?: object, self?: unknown) => ReactElement;
16
- useMDXComponents?: () => Record<string, ComponentType<any>>;
17
- jsxImportSource?: string;
18
- format?: 'detect' | 'mdx' | 'md';
19
- outputFormat?: 'program' | 'function-body';
20
- [key: string]: unknown;
21
7
  }
22
8
  interface EvaluateResult {
23
9
  default: ComponentType<{
24
10
  components?: Record<string, any>;
25
11
  }>;
26
12
  }
27
- declare function evaluate(source: string, options?: EvaluateOptions): Promise<EvaluateResult>;
13
+ declare function evaluate(source: string, options: EvaluateOptions): Promise<EvaluateResult>;
28
14
  //#endregion
29
15
  //#region src/mdx/scan/names.d.ts
30
16
  declare function scanMdxComponentNames(content: string): string[];
package/dist/mdx.mjs CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./names-N6JRDeT1.mjs";import{t}from"./define-rCXgNOOk.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{t as defineMdxComponents,a as evaluate,e as scanMdxComponentNames};
1
+ import{t as e}from"./names-N6JRDeT1.mjs";import{t}from"./define-CzFpVAjt.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{t as defineMdxComponents,a as evaluate,e as scanMdxComponentNames};
package/dist/og.d.mts CHANGED
@@ -1,21 +1,31 @@
1
1
  import { ReactElement } from "react";
2
-
3
2
  //#region src/og/image-response.d.ts
4
3
  interface ImageResponseOptions {
5
- width?: number;
6
- height?: number;
4
+ readonly width?: number;
5
+ readonly height?: number;
7
6
  }
8
7
  interface ImageResponseSize {
9
- width: number;
10
- height: number;
8
+ readonly width: number;
9
+ readonly height: number;
11
10
  }
11
+ interface SerializedTextElement {
12
+ type: 'text';
13
+ value: string;
14
+ }
15
+ interface SerializedTreeElement {
16
+ type: 'element';
17
+ elementType: unknown;
18
+ props: Record<string, unknown>;
19
+ children: SerializedElement[];
20
+ }
21
+ type SerializedElement = SerializedTextElement | SerializedTreeElement;
12
22
  declare class ImageResponse {
13
- private element;
14
- private options;
23
+ private readonly element;
24
+ private readonly options;
15
25
  constructor(element: ReactElement, options?: ImageResponseOptions);
16
26
  toJSON(): {
17
27
  type: string;
18
- element: any;
28
+ element: SerializedElement | null;
19
29
  options: ImageResponseOptions;
20
30
  };
21
31
  private resolveAndInvoke;
package/dist/og.mjs CHANGED
@@ -1 +1 @@
1
- const e=Symbol.for(`react.memo`),t=Symbol.for(`react.forward_ref`);var n=class{element;options;constructor(e,t={}){this.element=e,this.options={width:t.width||1200,height:t.height||630}}toJSON(){return{type:`ImageResponse`,element:this.serializeElement(this.element),options:this.options}}resolveAndInvoke(n,r){let i=n;for(;i&&typeof i==`object`;)if(i.$$typeof===e)i=i.type;else if(i.$$typeof===t)i=i.render;else break;if(typeof i!=`function`)return null;try{let e=i(r||{});return e&&typeof e.then==`function`?(console.warn(`[ImageResponse] async/server component "${i?.name||i}" is not supported; skipping`),null):this.serializeElement(e)}catch(e){return console.error(`[ImageResponse] failed to render component "${i?.name||i?.toString()}":`,e),null}}serializeElement(e){if(typeof e==`string`||typeof e==`number`)return{type:`text`,value:String(e)};if(!e||!e.type)return null;let{type:t,props:n={}}=e;if(typeof t==`function`||t&&typeof t==`object`&&t.$$typeof)return this.resolveAndInvoke(t,n);let r=this.serializeChildren(n.children);return{type:`element`,elementType:t,props:this.serializeProps(n),children:r}}serializeChildren(e){if(!e)return[];if(Array.isArray(e))return e.map(e=>this.serializeElement(e)).filter(Boolean);let t=this.serializeElement(e);return t?[t]:[]}serializeProps(e){let{children:t,...n}=e,r={};for(let[e,t]of Object.entries(n))t!=null&&(r[e]=t);return r}};export{n as ImageResponse};
1
+ import{f as e,p as t}from"./type-guards-CTkEL8zw.mjs";const n=Symbol.for(`react.memo`),r=Symbol.for(`react.forward_ref`);function i(e){return t(e)&&typeof e.toString==`function`}function a(e){return t(e)&&`then`in e}function o(e){let t=e;for(;i(t);)if(t.$$typeof===n&&t.type!==void 0)t=t.type;else if(t.$$typeof===r&&t.render!==void 0)t=t.render;else break;return typeof t==`function`||i(t)?t:null}var s=class{element;options;constructor(e,t={}){this.element=e,this.options={width:t.width!=null&&t.width!==0?t.width:1200,height:t.height!=null&&t.height!==0?t.height:630}}toJSON(){return{type:`ImageResponse`,element:this.serializeElement(this.element),options:this.options}}resolveAndInvoke(e,t){let n=o(e);if(n==null||typeof n!=`function`)return null;try{let e=n(t);return e!==null&&a(e)?(console.warn(`[ImageResponse] async/server component "${n.name||n.toString()}" is not supported; skipping`),null):this.serializeElement(e)}catch(e){return console.error(`[ImageResponse] failed to render component "${n.name||n.toString()}":`,e),null}}serializeElement(n){if(typeof n==`string`||typeof n==`number`)return{type:`text`,value:String(n)};if(!t(n)||!e(n))return null;let{type:r,props:a={}}=n,s=o(r);if(typeof s==`function`||s!=null&&i(s))return this.resolveAndInvoke(r,a);let c=this.serializeChildren(a.children);return{type:`element`,elementType:r,props:this.serializeProps(a),children:c}}serializeChildren(e){if(e==null)return[];if(Array.isArray(e))return e.flatMap(e=>{let t=this.serializeElement(e);return t?[t]:[]});let t=this.serializeElement(e);return t?[t]:[]}serializeProps(e){let t={};for(let[n,r]of Object.entries(e))n!==`children`&&(r==null||typeof r==`string`||typeof r==`number`||typeof r==`boolean`)&&(t[n]=r);return t}};export{s as ImageResponse};
package/dist/platform.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{existsSync as e}from"node:fs";import{dirname as t,join as n}from"node:path";import r from"node:process";import{fileURLToPath as i}from"node:url";const a={"linux-x64":`rari-linux-x64`,"linux-arm64":`rari-linux-arm64`,"darwin-x64":`rari-darwin-x64`,"darwin-arm64":`rari-darwin-arm64`,"win32-arm64":`rari-win32-arm64`,"win32-x64":`rari-win32-x64`};function o(){let e=r.platform,t=r.arch,n;switch(e){case`darwin`:n=`darwin`;break;case`linux`:n=`linux`;break;case`win32`:n=`win32`;break;default:throw Error(`Unsupported platform: ${e}. rari supports Linux, macOS, and Windows.`)}let i;switch(t){case`x64`:i=`x64`;break;case`arm64`:i=`arm64`;break;default:throw Error(`Unsupported architecture: ${t}. rari supports x64 and ARM64.`)}let o=`${n}-${i}`,s=a[o];if(!s)throw Error(`Unsupported platform combination: ${n}-${i}. Supported platforms: ${Object.keys(a).join(`, `)}`);return{platform:n,arch:i,packageName:s,binaryName:n===`win32`?`rari.exe`:`rari`}}let s=null;function c(){let{packageName:r,binaryName:a}=o(),s=t(i(import.meta.url));for(;;){if(e(n(s,`pnpm-workspace.yaml`))){let t=n(s,`packages`,r,`bin`,a);if(e(t))return t;break}let i=t(s);if(i===s)break;s=i}try{let t=import.meta.resolve(`${r}/package.json`),o=n(i(new URL(`.`,t)),`bin`,a);if(e(o))return o;throw Error(`Binary not found at ${o}`)}catch{throw Error(`Failed to locate rari binary for ${r}. Please ensure the platform package is installed: npm install ${r}`)}}function l(){return s||(s=c(),s)}function u(){let{packageName:e}=o();return`
1
+ import{existsSync as e}from"node:fs";import{dirname as t,join as n}from"node:path";import r from"node:process";import{fileURLToPath as i}from"node:url";const a={"linux-x64":`rari-linux-x64`,"linux-arm64":`rari-linux-arm64`,"darwin-x64":`rari-darwin-x64`,"darwin-arm64":`rari-darwin-arm64`,"win32-arm64":`rari-win32-arm64`,"win32-x64":`rari-win32-x64`};function o(e){return Object.hasOwn(a,e)}function s(){let e=r.platform,t=r.arch,n;switch(e){case`darwin`:n=`darwin`;break;case`linux`:n=`linux`;break;case`win32`:n=`win32`;break;case`aix`:case`android`:case`cygwin`:case`freebsd`:case`haiku`:case`openbsd`:case`sunos`:case`netbsd`:throw Error(`Unsupported platform: ${e}. rari supports Linux, macOS, and Windows.`);default:throw Error(`Unsupported platform: ${String(e)}. rari supports Linux, macOS, and Windows.`)}let i;switch(t){case`x64`:i=`x64`;break;case`arm64`:i=`arm64`;break;case`arm`:case`ia32`:case`loong64`:case`mips`:case`mipsel`:case`ppc64`:case`riscv64`:case`s390x`:throw Error(`Unsupported architecture: ${t}. rari supports x64 and ARM64.`);default:throw Error(`Unsupported architecture: ${String(t)}. rari supports x64 and ARM64.`)}let s=`${n}-${i}`;if(!o(s))throw Error(`Unsupported platform combination: ${n}-${i}. Supported platforms: ${Object.keys(a).join(`, `)}`);let c=a[s];return{platform:n,arch:i,packageName:c,binaryName:n===`win32`?`rari.exe`:`rari`}}let c=null;function l(){let{packageName:r,binaryName:a}=s(),o=t(i(import.meta.url));for(;o!==t(o);){if(e(n(o,`pnpm-workspace.yaml`))){let t=n(o,`packages`,r,`bin`,a);if(e(t))return t;break}o=t(o)}try{let t=import.meta.resolve(`${r}/package.json`),o=n(i(new URL(`.`,t)),`bin`,a);if(e(o))return o;throw Error(`Binary not found at ${o}`)}catch{throw Error(`Failed to locate rari binary for ${r}. Please ensure the platform package is installed: npm install ${r}`)}}function u(){return c!=null&&c!==``||(c=l()),c}function d(){let{packageName:e}=s();return`
2
2
  To install rari for your platform, run:
3
3
 
4
4
  npm install ${e}
@@ -14,4 +14,4 @@ Or if you're using yarn:
14
14
  If you continue to have issues, you can also install from source:
15
15
 
16
16
  cargo install --git https://github.com/rari-build/rari
17
- `}export{l as getBinaryPath,u as getInstallationInstructions};
17
+ `}export{u as getBinaryPath,d as getInstallationInstructions};
@@ -0,0 +1,2 @@
1
+ import{l as e}from"./type-guards-CTkEL8zw.mjs";import{t}from"./get-client-component-CLpyIcLJ.mjs";async function n(n,r){let i=n.split(`
2
+ `),a=new Set;for(let t of i){let n=t.trim();if(!n)continue;let i=n.indexOf(`:`);if(i===-1)continue;let o=n.substring(i+1);if(o.startsWith(`I`))try{let t=o.substring(1),n=JSON.parse(t);if(e(n)){let e=n[0],t=typeof n[2]==`string`?n[2]:void 0,i=e.replace(/\\/g,`/`),o;o=i.includes(`#`)?i:t!=null&&t!==``&&t!=="default"?`${i}#${t}`:i,(!r||!r.has(o))&&a.add(o)}}catch{}}a.size>0&&await Promise.all(Array.from(a,async e=>{try{if(await t(e)==null){console.warn(`[rari] Failed to preload component: ${e}`);return}r?.add(e)}catch(t){console.error(`[rari] Error preloading component ${e}:`,t)}}))}export{n as t};
@@ -1,5 +1,4 @@
1
- import { c as RariURL, l as RequestCookies } from "../types-BC33STEP.mjs";
2
-
1
+ import { c as RariURL, l as RequestCookies } from "../types-DAdRjhuk.mjs";
3
2
  //#region src/proxy/http/request.d.ts
4
3
  declare class RariRequest {
5
4
  url: string;
@@ -25,16 +24,16 @@ declare class RariRequest {
25
24
  longitude?: string;
26
25
  };
27
26
  });
28
- static fromRequest(request: Request, options?: {
29
- ip?: string;
30
- geo?: {
31
- city?: string;
32
- country?: string;
33
- region?: string;
34
- latitude?: string;
35
- longitude?: string;
27
+ static fromRequest(request: Request, options?: Readonly<{
28
+ readonly ip?: string;
29
+ readonly geo?: {
30
+ readonly city?: string;
31
+ readonly country?: string;
32
+ readonly region?: string;
33
+ readonly latitude?: string;
34
+ readonly longitude?: string;
36
35
  };
37
- }): RariRequest;
36
+ }>): RariRequest;
38
37
  }
39
38
  //#endregion
40
39
  export { RariRequest };
@@ -1 +1 @@
1
- var e=class{cookies;pendingDeletes;pendingSets;constructor(e){this.cookies=new Map,this.pendingDeletes=new Set,this.pendingSets=new Map,e&&this.parseCookieHeader(e)}parseCookieHeader(e){let t=e.split(`;`).map(e=>e.trim());for(let e of t){let[t,...n]=e.split(`=`);if(t){let e=n.join(`=`);this.cookies.set(t,{name:t,value:e})}}}get(e){if(this.pendingDeletes.has(e))return;let t=this.pendingSets.get(e);return t?{name:t.name,value:t.value,path:t.options?.path}:this.cookies.get(e)}getAll(){let e=[];return this.cookies.forEach(t=>{this.pendingDeletes.has(t.name)||e.push(t)}),this.pendingSets.forEach(t=>{e.push({name:t.name,value:t.value,path:t.options?.path})}),e}has(e){return this.pendingDeletes.has(e)?!1:this.pendingSets.has(e)||this.cookies.has(e)}delete(e){this.pendingDeletes.add(e),this.pendingSets.delete(e)}set(e,t,n){if(typeof e==`string`)this.pendingSets.set(e,{name:e,value:t,options:n}),this.pendingDeletes.delete(e);else{let{name:t,value:n,...r}=e;this.pendingSets.set(t,{name:t,value:n,options:r}),this.pendingDeletes.delete(t)}}},t=class{url;constructor(e){this.url=typeof e==`string`?new URL(e):e}get href(){return this.url.href}get origin(){return this.url.origin}get protocol(){return this.url.protocol}get hostname(){return this.url.hostname}get port(){return this.url.port}get pathname(){return this.url.pathname}set pathname(e){this.url.pathname=e}get search(){return this.url.search}set search(e){this.url.search=e}get searchParams(){return this.url.searchParams}get hash(){return this.url.hash}set hash(e){this.url.hash=e}toString(){return this.url.toString()}},n=class n{url;method;headers;cookies;rariUrl;ip;geo;constructor(n,r){if(n instanceof Request)this.url=n.url,this.method=n.method,this.headers=new Headers(n.headers);else{let e=typeof n==`string`?n:n.toString();this.url=e,this.method=r?.method||`GET`,this.headers=new Headers(r?.headers)}this.rariUrl=new t(this.url),this.cookies=new e(this.headers.get(`cookie`)||void 0),this.ip=r?.ip,this.geo=r?.geo}static fromRequest(e,t){return new n(e,t)}};export{n as RariRequest};
1
+ var e=class{cookies;pendingDeletes;pendingSets;constructor(e){this.cookies=new Map,this.pendingDeletes=new Set,this.pendingSets=new Map,e!=null&&e!==``&&this.parseCookieHeader(e)}parseCookieHeader(e){let t=e.split(`;`).map(e=>e.trim());for(let e of t){let[t,...n]=e.split(`=`);if(t){let e=n.join(`=`);this.cookies.set(t,{name:t,value:e})}}}get(e){if(this.pendingDeletes.has(e))return;let t=this.pendingSets.get(e);return t?{name:t.name,value:t.value,path:t.options?.path}:this.cookies.get(e)}getAll(){let e=[];return this.cookies.forEach(t=>{this.pendingDeletes.has(t.name)||e.push(t)}),this.pendingSets.forEach(t=>{e.push({name:t.name,value:t.value,path:t.options?.path})}),e}has(e){return this.pendingDeletes.has(e)?!1:this.pendingSets.has(e)||this.cookies.has(e)}delete(e){this.pendingDeletes.add(e),this.pendingSets.delete(e)}set(e,t,n){if(typeof e==`string`)this.pendingSets.set(e,{name:e,value:t,options:n}),this.pendingDeletes.delete(e);else{let{name:t,value:n,...r}=e;this.pendingSets.set(t,{name:t,value:n,options:r}),this.pendingDeletes.delete(t)}}},t=class{url;constructor(e){this.url=typeof e==`string`?new URL(e):e}get href(){return this.url.href}get origin(){return this.url.origin}get protocol(){return this.url.protocol}get hostname(){return this.url.hostname}get port(){return this.url.port}get pathname(){return this.url.pathname}set pathname(e){this.url.pathname=e}get search(){return this.url.search}set search(e){this.url.search=e}get searchParams(){return this.url.searchParams}get hash(){return this.url.hash}set hash(e){this.url.hash=e}toString(){return this.url.toString()}},n=class n{url;method;headers;cookies;rariUrl;ip;geo;constructor(n,r){if(n instanceof Request)this.url=n.url,this.method=n.method,this.headers=new Headers(n.headers);else{let e=typeof n==`string`?n:n.toString();this.url=e,this.method=r?.method!=null&&r.method!==``?r.method:`GET`,this.headers=new Headers(r?.headers)}this.rariUrl=new t(this.url);let i=this.headers.get(`cookie`);this.cookies=new e(i!=null&&i!==``?i:void 0),this.ip=r?.ip,this.geo=r?.geo}static fromRequest(e,t){return new n(e,t)}};export{n as RariRequest};
@@ -1,17 +1,2 @@
1
- import { u as ResponseCookies } from "../types-BC33STEP.mjs";
2
-
3
- //#region src/proxy/http/response.d.ts
4
- declare class RariResponse extends Response {
5
- cookies: ResponseCookies;
6
- constructor(body?: BodyInit | null, init?: ResponseInit);
7
- static next(init?: {
8
- request?: {
9
- headers?: Headers | Record<string, string>;
10
- };
11
- }): RariResponse;
12
- static redirect(url: string | URL, status?: number): RariResponse;
13
- static rewrite(destination: string | URL): RariResponse;
14
- static json(data: unknown, init?: ResponseInit): RariResponse;
15
- }
16
- //#endregion
1
+ import { d as RariResponse } from "../types-DAdRjhuk.mjs";
17
2
  export { RariResponse };
@@ -1 +1 @@
1
- var e=class{cookies;constructor(){this.cookies=new Map}get(e){let t=this.cookies.get(e);if(t)return{name:t.name,value:t.value,path:t.options?.path}}getAll(){return Array.from(this.cookies.values(),e=>({name:e.name,value:e.value,path:e.options?.path}))}set(e,t,n){if(typeof e==`string`)this.cookies.set(e,{name:e,value:t,options:n});else{let{name:t,value:n,...r}=e;this.cookies.set(t,{name:t,value:n,options:r})}}delete(e){this.cookies.delete(e)}toSetCookieHeaders(){return Array.from(this.cookies.values(),e=>{let t=`${e.name}=${e.value}`;return e.options&&(e.options.path&&(t+=`; Path=${e.options.path}`),e.options.domain&&(t+=`; Domain=${e.options.domain}`),e.options.maxAge&&(t+=`; Max-Age=${e.options.maxAge}`),e.options.expires&&(t+=`; Expires=${e.options.expires.toUTCString()}`),e.options.httpOnly&&(t+=`; HttpOnly`),e.options.secure&&(t+=`; Secure`),e.options.sameSite&&(t+=`; SameSite=${e.options.sameSite}`)),t})}},t=class t extends Response{cookies;constructor(t,n){super(t,n),this.cookies=new e}static next(e){let n=new t(null,{status:200,headers:{"x-rari-proxy-continue":`true`}});return e?.request?.headers&&(e.request.headers instanceof Headers?e.request.headers:new Headers(e.request.headers)).forEach((e,t)=>{n.headers.set(`x-rari-proxy-request-${t}`,e)}),n}static redirect(e,n){return new t(null,{status:n||307,headers:{Location:e.toString()}})}static rewrite(e){return new t(null,{status:200,headers:{"x-rari-proxy-rewrite":e.toString()}})}static json(e,n){let r=JSON.stringify(e);return new t(r,{...n,headers:{"Content-Type":`application/json`,...n?.headers}})}};export{t as RariResponse};
1
+ var e=class{cookies;constructor(){this.cookies=new Map}get(e){let t=this.cookies.get(e);if(t)return{name:t.name,value:t.value,path:t.options?.path}}getAll(){return Array.from(this.cookies.values(),e=>({name:e.name,value:e.value,path:e.options?.path}))}set(e,t,n){if(typeof e==`string`)this.cookies.set(e,{name:e,value:t,options:n});else{let{name:t,value:n,...r}=e;this.cookies.set(t,{name:t,value:n,options:r})}}delete(e){this.cookies.delete(e)}toSetCookieHeaders(){return Array.from(this.cookies.values(),e=>{let t=`${e.name}=${e.value}`;return e.options&&(e.options.path!=null&&e.options.path!==``&&(t+=`; Path=${e.options.path}`),e.options.domain!=null&&e.options.domain!==``&&(t+=`; Domain=${e.options.domain}`),e.options.maxAge!=null&&(t+=`; Max-Age=${e.options.maxAge}`),e.options.expires&&(t+=`; Expires=${e.options.expires.toUTCString()}`),e.options.httpOnly&&(t+=`; HttpOnly`),e.options.secure&&(t+=`; Secure`),e.options.sameSite&&(t+=`; SameSite=${e.options.sameSite}`)),t})}},t=class t extends Response{cookies;constructor(t,n){super(t,n),this.cookies=new e}static next(e){let n=new t(null,{status:200,headers:{"x-rari-proxy-continue":`true`}});return e?.request?.headers&&(e.request.headers instanceof Headers?e.request.headers:new Headers(e.request.headers)).forEach((e,t)=>{n.headers.set(`x-rari-proxy-request-${t}`,e)}),n}static redirect(e,n){return new t(null,{status:n!=null&&n!==0?n:307,headers:{Location:e.toString()}})}static rewrite(e){return new t(null,{status:200,headers:{"x-rari-proxy-rewrite":e.toString()}})}static json(e,n){let r=JSON.stringify(e),i=new Headers(n?.headers);return i.set(`Content-Type`,`application/json`),new t(r,{...n,headers:i})}};export{t as RariResponse};