rari 0.16.0 → 0.17.1

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 (68) hide show
  1. package/dist/api-routes-Dc2tv31o.mjs +1 -0
  2. package/dist/cli.d.mts +1 -1
  3. package/dist/cli.mjs +39 -39
  4. package/dist/constants-CRK2JRKf.mjs +1 -0
  5. package/dist/{define-CRafeveU.mjs → define-B_ozIapW.mjs} +1 -1
  6. package/dist/dist-paths-C4EV064W.mjs +1 -0
  7. package/dist/{execute-B1z6YRUF.mjs → execute-CbhDMAQ3.mjs} +1 -1
  8. package/dist/feed-NrJzjZyg.mjs +10 -0
  9. package/dist/font/google-catalog.d.mts +1952 -0
  10. package/dist/font/google.d.mts +1 -1946
  11. package/dist/font/google.mjs +1 -1
  12. package/dist/form-state-DAygOjc8.mjs +1 -0
  13. package/dist/get-client-component-s7qprTUa.mjs +1 -0
  14. package/dist/headers.d.mts +1 -1
  15. package/dist/image/static.d.mts +1 -0
  16. package/dist/image/static.mjs +1 -0
  17. package/dist/image.d.mts +4 -35
  18. package/dist/image.mjs +1 -1
  19. package/dist/index.d.mts +6 -1
  20. package/dist/index.mjs +1 -1
  21. package/dist/mdx/define.mjs +1 -1
  22. package/dist/mdx.mjs +1 -1
  23. package/dist/navigation-transition-store-CSKrbtbK.mjs +1 -0
  24. package/dist/path-CTEC1xmy.mjs +1 -0
  25. package/dist/platform.mjs +1 -1
  26. package/dist/preload-modules-Dv_GzGCm.mjs +2 -0
  27. package/dist/proxy/RariResponse.mjs +1 -1
  28. package/dist/proxy/runtime-executor.mjs +1 -1
  29. package/dist/regex-constants-DzXwNGh2.mjs +1 -0
  30. package/dist/{robots-B1bFAd4J.mjs → robots-BOPIkPcN.mjs} +1 -1
  31. package/dist/router-Cl4J7j1A.mjs +1 -0
  32. package/dist/router.d.mts +8 -5
  33. package/dist/router.mjs +1 -1
  34. package/dist/{rsc-vite-build-Cpu5suGN.mjs → rsc-vite-build-CSnu8C3P.mjs} +1 -1
  35. package/dist/runtime/AppRouterProvider.mjs +1 -1
  36. package/dist/runtime/ClientRouter.mjs +4 -4
  37. package/dist/runtime/ErrorBoundaryWrapper.mjs +1 -1
  38. package/dist/runtime/call-server.mjs +1 -1
  39. package/dist/runtime/entry-client.d.mts +1 -1
  40. package/dist/runtime/entry-client.mjs +3 -3
  41. package/dist/runtime/flight-router-state.d.mts +1 -0
  42. package/dist/runtime/flight-router-state.mjs +1 -1
  43. package/dist/runtime/merge-flight-refresh.d.mts +4 -0
  44. package/dist/runtime/merge-flight-refresh.mjs +1 -1
  45. package/dist/runtime/rsc-client-runtime.d.mts +1 -1
  46. package/dist/runtime/rsc-client-runtime.mjs +1 -1
  47. package/dist/serialize-router-state-uOGGpmBr.mjs +1 -0
  48. package/dist/sitemap--bdIkWl5.mjs +13 -0
  49. package/dist/static-modules-DBL6iFbg.d.mts +61 -0
  50. package/dist/{types-Q-x_0kVB.d.mts → types-C8N3Hc8I.d.mts} +1 -0
  51. package/dist/{types-xTbuE-Js.d.mts → types-DfSnnFaF.d.mts} +3 -1
  52. package/dist/vite.d.mts +3 -1
  53. package/dist/vite.mjs +141 -197
  54. package/dist/{xml-EW5iM39h.mjs → xml-DPsk9WTz.mjs} +1 -1
  55. package/package.json +22 -19
  56. package/dist/api-routes-ChRr3O5-.mjs +0 -1
  57. package/dist/constants-BFdy-wPN.mjs +0 -1
  58. package/dist/feed-uUGeOZmR.mjs +0 -10
  59. package/dist/form-state-DZJs9bve.mjs +0 -1
  60. package/dist/get-client-component-DU5z65us.mjs +0 -1
  61. package/dist/path-C74rvUep.mjs +0 -1
  62. package/dist/preload-modules-1i2BJqux.mjs +0 -2
  63. package/dist/prompt-uaCPq0_A-BW0EkzOD.mjs +0 -45
  64. package/dist/regex-constants-DBMCJbMw.mjs +0 -1
  65. package/dist/router-D6X8JHst.mjs +0 -1
  66. package/dist/runtime/LoadingErrorBoundary.d.mts +0 -10
  67. package/dist/runtime/LoadingErrorBoundary.mjs +0 -1
  68. package/dist/sitemap-DJY3OiJ0.mjs +0 -13
@@ -0,0 +1 @@
1
+ const e=`RARI_NOT_FOUND`;function t(e){return typeof e==`object`&&!!e&&`digest`in e&&e.digest===`RARI_NOT_FOUND`}function n(){let t=/* @__PURE__ */ Error(e);throw t.digest=e,t}var r=class extends Response{static json(e,t){return Response.json(e,t)}static redirect(e,t=307){return/^https?:\/\//i.test(e)?Response.redirect(e,t):new Response(null,{status:t,headers:{location:e}})}static noContent(e){return new Response(null,{...e,status:204})}};export{n as i,e as n,t as r,r as t};
package/dist/cli.d.mts CHANGED
@@ -7,7 +7,7 @@ export declare function resolveEffectiveViteRoot(configDir: string, configSource
7
7
  export declare function resolveViteBuildPackageRoot(cwd: string, viteBin?: 'vp' | 'vite', command?: ViteAppCommand): string;
8
8
  export declare function resolveConfiguredBuildOutDir(packageRoot: string): string;
9
9
  export declare function findImageConfigPath(packageRoot: string): string | null;
10
- export declare function outDirFromImageConfigPath(imageConfigPath: string): string;
10
+ export declare function outDirFromImageConfigPath(imageConfigPath: string, packageRoot: string): string;
11
11
  //#endregion
12
12
  //#region src/cli/index.d.ts
13
13
  type PackageManager = 'pnpm' | 'yarn' | 'bun' | 'npm';
package/dist/cli.mjs CHANGED
@@ -1,63 +1,63 @@
1
- import{C as e,S as t,d as n,x as r}from"./type-guards-BJXKlA6x.mjs";import{getBinaryPath as i,getInstallationInstructions as a}from"./platform.mjs";import{spawn as o}from"node:child_process";import{existsSync as s,readFileSync as c,readdirSync as l,realpathSync as u,rmSync as d}from"node:fs";import{dirname as f,isAbsolute as p,join as m,resolve as h}from"node:path";import g from"node:process";import{fileURLToPath as _}from"node:url";import{parseArgs as ee,styleText as v}from"node:util";import{once as y}from"node:events";function b(e){console.warn(`${v(`blue`,`info`)} ${e}`)}function x(e){console.warn(`${v(`green`,`✓`)} ${e}`)}function S(e){console.error(`${v(`red`,`✗`)} ${e}`)}function C(e){console.warn(`${v(`yellow`,`⚠`)} ${e}`)}const w=[`vite.config.ts`,`vite.config.mts`,`vite.config.js`,`vite.config.mjs`,`vite.config.cjs`,`vite.config.cts`];function T(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 E(e){let t=/(?:^|[,{\s])outDir\s*:\s*['"]([^'"]+)['"]/.exec(e)?.[1];return t!=null&&t!==``?t:null}function D(e){let t=/(?:^|[,{\s])root\s*:\s*['"]([^'"]+)['"]/.exec(e)?.[1];return t!=null&&t!==``?t:null}function O(e){for(let t of w){let n=h(e,t);if(s(n))try{return c(n,`utf8`)}catch{return null}}return null}function k(e,t){return p(t)?t:h(e,t)}function A(e,t){let n=t==null?null:D(t);return n==null||n===``?e:k(e,n)}function j(e,t=`vp`,n=`build`){if(t!==`vp`)return e;let r=O(e);if(r==null)return e;let i=T(r,n);if(i==null||i===``)return e;let a=h(e,i);return s(a)?a:e}function M(e){let t=O(e),n=A(e,t),r=t==null?null:E(t);return r==null||r===``?h(n,`dist`):k(n,r)}function N(e){let t=M(e),n=m(t,`server`,`image.json`);if(s(n))return n;let r=h(e,`dist`);if(t!==r){let e=m(r,`server`,`image.json`);if(s(e))return e}let i;try{i=l(e)}catch{return null}for(let t of i){if(t===`node_modules`||t===`dist`||t.startsWith(`.`))continue;let n=m(e,t,`server`,`image.json`);if(s(n))return n}return null}function P(e){return f(f(e))}let F=null;function I(e){let t=s(e)?new Set(L(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`:R(e)}function L(e){try{return l(e)}catch{return[]}}function R(e){try{let n=h(e,`package.json`);if(!s(n))return null;let i=r(c(n,`utf-8`));return i?t(i):null}catch{}return null}function te(t){try{let n=h(t,`package.json`);if(!s(n))return null;let i=r(c(n,`utf-8`));return i?e(i):null}catch{}return null}function ne(e){let t=e,n=null,r=null;for(;t!==h(t,`..`)&&(n??=I(t),r??=te(t),!(n&&r));)t=h(t,`..`);return{cwd:e,packageManager:n??`npm`,viteBin:r??`vite`}}function z(){let e=g.cwd();return F?.cwd===e||(F=ne(e)),F}function re(){return z().packageManager}function ie(){let e=z().packageManager,t=g.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 B(e,t=g.cwd()){let n=g.platform===`win32`,r=t;for(;r!==h(r,`..`);){let t=h(r,`node_modules`,`.bin`),i=n?[h(t,`${e}.cmd`),h(t,`${e}.exe`),h(t,e)]:[h(t,e)];for(let e of i)if(s(e))return e;r=h(r,`..`)}return null}function V(e,t,n={}){let r=g.platform===`win32`;if(e===`npx`){let e=ie();if(e.includes(`bun`))return o(r?`bunx.cmd`:`bunx`,t,{...n,shell:r});if(e.includes(`pnpm`))return o(e,[`exec`,...t],{...n,shell:r});if(e.includes(`yarn`)){let[i,...a]=t,s=i===`vp`?[`dlx`,`-p`,`vite-plus`,`vp`,...a]:[`dlx`,...t];return o(e,s,{...n,shell:r})}}return r&&e===`npx`?o(`npx.cmd`,t,{...n,shell:!0}):o(e,t,n)}function H(e,t,n={}){let r=B(e);if(r!=null&&r!==``){let e=g.platform===`win32`&&r.endsWith(`.cmd`);return o(r,t,e?{...n,shell:!0}:n)}return V(`npx`,[e,...t],n)}async function U(e,t={}){try{let[t]=await y(e,`close`);return t}catch(e){if(t.tolerateErrors)return C(W(e)),1;throw e}}function W(e){if(n(e))return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function G(){let e=h(g.cwd(),`.env`);s(e)&&g.loadEnvFile(e)}function K(e){let{values:t,positionals:n}=ee({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 g.env.RAILWAY_ENVIRONMENT!=null&&g.env.RAILWAY_ENVIRONMENT!==``||g.env.RAILWAY_PROJECT_ID!=null&&g.env.RAILWAY_PROJECT_ID!==``||g.env.RAILWAY_SERVICE_ID!=null&&g.env.RAILWAY_SERVICE_ID!==``}function J(){return g.env.RENDER!=null&&g.env.RENDER!==``||g.env.RENDER_SERVICE_ID!=null&&g.env.RENDER_SERVICE_ID!==``||g.env.RENDER_SERVICE_NAME!=null&&g.env.RENDER_SERVICE_NAME!==``}function Y(){return q()||J()}function X(){return q()?`Railway`:J()?`Render`:`local`}function Z(){return{port:g.env.PORT!=null&&g.env.PORT!==``?g.env.PORT:g.env.RSC_PORT!=null&&g.env.RSC_PORT!==``?g.env.RSC_PORT:`3000`,mode:g.env.NODE_ENV!=null&&g.env.NODE_ENV!==``?g.env.NODE_ENV:`production`,host:Y()?`0.0.0.0`:`127.0.0.1`}}async function ae(){$();let e=z().viteBin;b(`Type checking...`);let t=await U(H(`tsc`,[],{stdio:`inherit`,cwd:g.cwd()}));if(t===0)x(`Type check passed`);else throw S(`Type check failed with code ${t}`),Error(`Type check failed with code ${t}`);b(`Building for production...`);let n=await U(H(e,[`build`],{stdio:`inherit`,cwd:g.cwd()}));if(n===0)x(`Build complete`);else throw S(`Build failed with code ${n}`),Error(`Build failed with code ${n}`);await oe()}async function oe(){let e=g.cwd(),{viteBin:t}=z(),n=j(e,t),a=M(n),l=h(a,`server`,`image.json`),u=s(l)?l:N(n);if(u==null)return;let d=P(u),f=`assets`;try{let e=r(c(u,`utf-8`));e&&typeof e.assetsDir==`string`&&e.assetsDir.length>0&&(f=e.assetsDir.replaceAll(/^\/+|\/+$/g,``))}catch{}let p=h(n,`public`),m=h(d,f),_=h(d,`server`,`static-image-sources.json`);if(s(p)||s(m)||s(_))try{let e=i(),t=await U(o(e,[`optimize-images`,`--config`,u],{stdio:`inherit`,cwd:n,shell:!1}),{tolerateErrors:!0});t!==0&&C(`Image pre-optimization exited with code ${t}`)}catch(e){C(`Could not pre-optimize images: ${W(e)}`)}}async function se(){let e=z().viteBin,t=h(g.cwd(),`dist`);if(!s(t)){b(`First run detected - building project...`);let t=await U(H(e,[`build`,`--mode`,`development`],{stdio:`inherit`,cwd:g.cwd()}));if(t===0)x(`Initial build complete`);else throw S(`Build failed with code ${t}`),Error(`Build failed with code ${t}`)}b(`Starting Vite${e===`vp`?`+`:``} dev server...`);let n=H(e,[`dev`],{stdio:`inherit`,cwd:g.cwd()}),r=()=>{b(`Shutting down dev server...`),n.kill(`SIGTERM`)};return g.on(`SIGINT`,r),g.on(`SIGTERM`,r),n.on(`error`,e=>{S(`Failed to start Vite: ${e.message}`),g.exit(1)}),n.on(`exit`,e=>{e!==0&&e!==null&&(S(`Vite exited with code ${e}`),g.exit(e))}),new Promise(()=>{})}async function Q(){let e;try{e=i()}catch{S(`Failed to obtain rari binary`),S(a()),g.exit(1)}let{port:t,mode:n,host:r}=Z();if(Y()){let i=X();b(`${i} environment detected`),b(`Starting rari server for ${i} deployment...`),b(`Mode: ${n}, Host: ${r}, Port: ${t}`),b(`using binary: ${e}`)}let s=[`--mode`,n,`--port`,t,`--host`,r],c=g.platform!==`win32`&&g.stdin.isTTY,l=o(e,s,{stdio:`inherit`,cwd:g.cwd(),detached:c,env:{...g.env,RUST_LOG:g.env.RUST_LOG!=null&&g.env.RUST_LOG!==``?g.env.RUST_LOG:`error`}}),u=!1,d,f=()=>{u||(u=!0,b(`shutting down...`),l.kill(`SIGTERM`),d=setTimeout(()=>{l.kill(`SIGKILL`),g.exit(1)},5e3),d.unref())};return g.on(`SIGINT`,f),g.on(`SIGTERM`,f),g.on(`exit`,()=>{try{l.kill(`SIGKILL`)}catch{}}),l.on(`error`,e=>{S(`Failed to start rari server: ${e.message}`),e.message.includes(`ENOENT`)&&S(`Binary not found. Please ensure rari is properly installed.`),g.exit(1)}),l.on(`exit`,(e,t)=>{d&&clearTimeout(d),t!=null&&t!==``?(u&&(b(`server stopped by signal ${t}`),g.exit(0)),S(`server stopped unexpectedly by signal ${t}`),g.exit(1)):e===0?(x(`server stopped successfully`),g.exit(0)):(S(`server exited with code ${e}`),g.exit(e!=null&&e!==0?e:1))}),new Promise(()=>{})}async function ce(){b(`Setting up Railway deployment...`),Y()&&(S(`Already running in ${X()} environment. Use "rari start" instead.`),g.exit(1));let{createRailwayDeployment:e}=await import(`./railway-CE3nqaKt.mjs`);e()}async function le(){b(`Setting up Render deployment...`),Y()&&(S(`Already running in ${X()} environment. Use "rari start" instead.`),g.exit(1));let{createRenderDeployment:e}=await import(`./render-D0eMtn5L.mjs`);e()}function $(){let e=h(g.cwd(),`dist`);s(e)?(b(`Cleaning dist folder...`),d(e,{recursive:!0,force:!0}),x(`Cleaned dist folder`)):b(`No dist folder to clean`)}function ue(){console.warn(`${v(`bold`,`rari CLI`)}
1
+ import{C as e,S as t,d as n,x as r}from"./type-guards-BJXKlA6x.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(e){try{let n=v(e,`package.json`);if(!l(n))return null;let i=r(u(n,`utf-8`));return i?t(i):null}catch{}return null}function ie(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 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(n(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
2
 
3
- ${v(`bold`,`Usage:`)}
4
- ${v(`cyan`,`rari dev`)} Start the development server with Vite
5
- ${v(`cyan`,`rari build`)} Build for production
6
- ${v(`cyan`,`rari start`)} Start the rari server (defaults to production)
7
- ${v(`cyan`,`rari clean`)} Remove the dist folder
8
- ${v(`cyan`,`rari deploy railway`)} Setup Railway deployment
9
- ${v(`cyan`,`rari deploy render`)} Setup Render deployment
10
- ${v(`cyan`,`rari help`)} Show this help message
3
+ ${S(`bold`,`Usage:`)}
4
+ ${S(`cyan`,`rari dev`)} Start the development server with Vite
5
+ ${S(`cyan`,`rari build`)} Build for production
6
+ ${S(`cyan`,`rari start`)} Start the rari server (defaults to production)
7
+ ${S(`cyan`,`rari clean`)} Remove the dist folder
8
+ ${S(`cyan`,`rari deploy railway`)} Setup Railway deployment
9
+ ${S(`cyan`,`rari deploy render`)} Setup Render deployment
10
+ ${S(`cyan`,`rari help`)} Show this help message
11
11
 
12
- ${v(`bold`,`Environment Variables:`)}
13
- ${v(`yellow`,`PORT`)} Server port (default: 3000)
14
- ${v(`yellow`,`RSC_PORT`)} Alternative server port
15
- ${v(`yellow`,`NODE_ENV`)} Environment (default: production for start, development for dev)
16
- ${v(`yellow`,`RUST_LOG`)} Rust logging level (default: info)
12
+ ${S(`bold`,`Environment Variables:`)}
13
+ ${S(`yellow`,`PORT`)} Server port (default: 3000)
14
+ ${S(`yellow`,`RSC_PORT`)} Alternative server port
15
+ ${S(`yellow`,`NODE_ENV`)} Environment (default: production for start, development for dev)
16
+ ${S(`yellow`,`RUST_LOG`)} Rust logging level (default: info)
17
17
 
18
- ${v(`bold`,`Examples:`)}
19
- ${v(`gray`,`# Start development server with Vite`)}
20
- ${v(`cyan`,`rari dev`)}
18
+ ${S(`bold`,`Examples:`)}
19
+ ${S(`gray`,`# Start development server with Vite`)}
20
+ ${S(`cyan`,`rari dev`)}
21
21
 
22
- ${v(`gray`,`# Build for production`)}
23
- ${v(`cyan`,`rari build`)}
22
+ ${S(`gray`,`# Build for production`)}
23
+ ${S(`cyan`,`rari build`)}
24
24
 
25
- ${v(`gray`,`# Clean dist folder`)}
26
- ${v(`cyan`,`rari clean`)}
25
+ ${S(`gray`,`# Clean dist folder`)}
26
+ ${S(`cyan`,`rari clean`)}
27
27
 
28
- ${v(`gray`,`# Start production server (default)`)}
29
- ${v(`cyan`,`rari start`)}
28
+ ${S(`gray`,`# Start production server (default)`)}
29
+ ${S(`cyan`,`rari start`)}
30
30
 
31
- ${v(`gray`,`# Start in development mode`)}
32
- ${v(`cyan`,`NODE_ENV=development rari start`)}
31
+ ${S(`gray`,`# Start in development mode`)}
32
+ ${S(`cyan`,`NODE_ENV=development rari start`)}
33
33
 
34
- ${v(`gray`,`# Start production server on port 8080`)}
35
- ${v(`cyan`,`PORT=8080 rari start`)}
34
+ ${S(`gray`,`# Start production server on port 8080`)}
35
+ ${S(`cyan`,`PORT=8080 rari start`)}
36
36
 
37
- ${v(`gray`,`# Setup Railway deployment`)}
38
- ${v(`cyan`,`rari deploy railway`)}
37
+ ${S(`gray`,`# Setup Railway deployment`)}
38
+ ${S(`cyan`,`rari deploy railway`)}
39
39
 
40
- ${v(`gray`,`# Setup Render deployment`)}
41
- ${v(`cyan`,`rari deploy render`)}
40
+ ${S(`gray`,`# Setup Render deployment`)}
41
+ ${S(`cyan`,`rari deploy render`)}
42
42
 
43
- ${v(`gray`,`# Start with debug logging`)}
44
- ${v(`cyan`,`RUST_LOG=debug rari start`)}
43
+ ${S(`gray`,`# Start with debug logging`)}
44
+ ${S(`cyan`,`RUST_LOG=debug rari start`)}
45
45
 
46
- ${v(`bold`,`Deployment:`)}
47
- ${v(`cyan`,`rari deploy railway`)} Creates Railway deployment files
48
- ${v(`cyan`,`rari deploy render`)} Creates Render deployment files
46
+ ${S(`bold`,`Deployment:`)}
47
+ ${S(`cyan`,`rari deploy railway`)} Creates Railway deployment files
48
+ ${S(`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
- ${v(`bold`,`Binary Resolution:`)}
55
+ ${S(`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
- ${v(`bold`,`Notes:`)}
60
+ ${S(`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 @@ ${v(`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 de(){G();let{command:e,args:t}=K(g.argv.slice(2));if(e==null||e===`help`){ue();return}switch(e){case`dev`:await se();break;case`build`:await ae();break;case`start`:await Q();break;case`clean`:$();break;case`deploy`:t[0]===`railway`?await ce():t[0]===`render`?await le():(S(`Unknown deployment target. Available: railway, render`),g.exit(1));break;default:console.error(`${v(`bold`,`Unknown command:`)} ${e}`),console.warn(`Run "${v(`cyan`,`rari help`)}" for available commands`),g.exit(1)}}function fe(){let e=g.argv[1]?u(h(g.argv[1])):``,t=u(_(import.meta.url));return!!e&&t===e}fe()&&de().catch(e=>{S(`CLI Error: ${W(e)}`),console.error(e),g.exit(1)});export{re as detectPackageManager,N as findImageConfigPath,Z as getDeploymentConfig,q as isRailwayEnvironment,J as isRenderEnvironment,P as outDirFromImageConfigPath,E as readBuildOutDir,T as readDefaultPackageTarget,D as readViteRoot,M as resolveConfiguredBuildOutDir,A as resolveEffectiveViteRoot,j as resolveViteBuildPackageRoot};
68
+ `)}async function he(){se();let{command:e,args:t}=ce(y.argv.slice(2));if(e==null||e===`help`){me();return}switch(e){case`dev`:await ue();break;case`build`:await Q();break;case`start`:await de();break;case`clean`:$();break;case`deploy`:t[0]===`railway`?await fe():t[0]===`render`?await pe():(T(`Unknown deployment target. Available: railway, render`),y.exit(1));break;default:console.error(`${S(`bold`,`Unknown command:`)} ${e}`),console.warn(`Run "${S(`cyan`,`rari help`)}" for available commands`),y.exit(1)}}function ge(){let e=y.argv[1]?f(v(y.argv[1])):``,t=f(b(import.meta.url));return!!e&&t===e}ge()&&he().catch(e=>{T(`CLI Error: ${K(e)}`),console.error(e),y.exit(1)});export{oe as detectPackageManager,F as findImageConfigPath,Z as getDeploymentConfig,q as isRailwayEnvironment,J as isRenderEnvironment,I as outDirFromImageConfigPath,O as readBuildOutDir,D as readDefaultPackageTarget,k as readViteRoot,P as resolveConfiguredBuildOutDir,M as resolveEffectiveViteRoot,N as resolveViteBuildPackageRoot};
@@ -0,0 +1 @@
1
+ const e=[640,750,828,1080,1200,1920,2048,3840],t=[16,32,48,64,96,128,256,384],n=[`avif`],r=[25,50,75,100],i=60,a=16,o=25;export{t as a,n as i,a as n,i as o,e as r,r as s,o as t};
@@ -1 +1 @@
1
- import{v as e}from"./type-guards-BJXKlA6x.mjs";import{s as t}from"./regex-constants-DBMCJbMw.mjs";import{t as n}from"./names-CLmM0CPi.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};
1
+ import{v as e}from"./type-guards-BJXKlA6x.mjs";import{s as t}from"./regex-constants-DzXwNGh2.mjs";import{t as n}from"./names-CLmM0CPi.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)?[...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 t=c(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{l as t};
@@ -0,0 +1 @@
1
+ import e from"node:path";const t=`dist/client`,n=`dist`;function r(t,n){return e.isAbsolute(n)?n:e.resolve(t,n)}function i(t){return e.basename(t)===`client`?e.dirname(t):t}function a(e,n){return r(e,n!=null&&n!==``?n:t)}export{i as a,a as i,n,r,t};
@@ -1 +1 @@
1
- import{a as e,v as t}from"./type-guards-BJXKlA6x.mjs";import{s as n,t as r,u as i}from"./rsc-vite-build-Cpu5suGN.mjs";import{promises as a}from"node:fs";import o from"node:path";import{pathToFileURL as s}from"node:url";import{randomUUID as c}from"node:crypto";const l=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`];async function u(t){let{appDir:n,staticFileName:r,dynamicBaseName:i,extensions:s=l,rethrowNonEnoent:c=!1}=t,u=o.join(n,r);try{return await a.access(u),{type:`static`,path:u}}catch(t){if(c&&e(t)!==`ENOENT`)throw t}for(let t of s){let r=o.join(n,`${i}${t}`);try{return await a.access(r),{type:`dynamic`,path:r}}catch(t){if(c&&e(t)!==`ENOENT`)throw t}}return null}function d(e,t){switch(e){case`ts`:return`ts`;case`tsx`:return`tsx`;case`js`:case`mjs`:return`js`;case`jsx`:return`jsx`;case`json`:if(t===`sitemap`)return`json`}throw Error(`Unsupported ${t} file extension: ".${e}". Allowed extensions are: ${t===`sitemap`?`.ts, .tsx, .js, .jsx, .mjs, .json`:`.ts, .tsx, .js, .jsx, .mjs`}`)}function f(e){let{name:t,virtualId:r,sourcePath:s,sourceCode:c,aliases:l={},projectRoot:u,kind:f}=e;return{name:t,resolveId(e,t){if(e===r)return e;if(Object.keys(l).length>0){let t=n(e,l,u);if(t!=null&&t!==``){let e=i(t);return e!=null&&e!==``?e:t}}if(e.startsWith(`.`)){let n=t==null||t===``||t.startsWith(`\0`)?s:t,r=o.resolve(o.dirname(n),e),a=i(r);return a!=null&&a!==``?a:r}return null},async load(e){if(e===r){let e=o.extname(s).slice(1);return{code:c,moduleType:d(e,f)}}if(e&&!e.startsWith(`\0`))try{return{code:await a.readFile(e,`utf-8`),moduleType:d(o.extname(e).slice(1),f)}}catch{return null}return null}}}function p(e){return e===`rari`||e.startsWith(`rari/`)}async function m(e){let{virtualId:t,sourcePath:n,sourceCode:i,aliases:l={},projectRoot:u,kind:d,pluginName:m,label:h}=e,g=await r({root:u,virtualId:t,external:p,plugins:[f({name:m,virtualId:t,sourcePath:n,sourceCode:i,aliases:l,projectRoot:u,kind:d})]});if(g==null)throw Error(`Failed to build ${h} module`);let _=o.join(u,`node_modules`,`.cache`,`rari-metadata`);await a.mkdir(_,{recursive:!0});let v=o.join(_,`${h}-${c()}.mjs`);await using y=new AsyncDisposableStack;return y.defer(async()=>{await a.rm(v,{force:!0})}),await a.writeFile(v,g.code,`utf8`),await import(s(v).href)}function h(e,n){if(!t(e))throw Error(`${n} file must export a default export (either an object or a function)`);let r=e.default;if(r==null)throw Error(`${n} file must export a default export (either an object or a function)`);return r}function g(e){return o.resolve(e,`..`,`..`)}export{u as i,g as n,h as r,m as t};
1
+ import{a as e,v as t}from"./type-guards-BJXKlA6x.mjs";import{s as n,t as r,u as i}from"./rsc-vite-build-CSnu8C3P.mjs";import{promises as a}from"node:fs";import o from"node:path";import{pathToFileURL as s}from"node:url";import{randomUUID as c}from"node:crypto";const l=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`];async function u(t){let{appDir:n,staticFileName:r,dynamicBaseName:i,extensions:s=l,rethrowNonEnoent:c=!1}=t,u=o.join(n,r);try{return await a.access(u),{type:`static`,path:u}}catch(t){if(c&&e(t)!==`ENOENT`)throw t}for(let t of s){let r=o.join(n,`${i}${t}`);try{return await a.access(r),{type:`dynamic`,path:r}}catch(t){if(c&&e(t)!==`ENOENT`)throw t}}return null}function d(e,t){switch(e){case`ts`:return`ts`;case`tsx`:return`tsx`;case`js`:case`mjs`:return`js`;case`jsx`:return`jsx`;case`json`:if(t===`sitemap`)return`json`}throw Error(`Unsupported ${t} file extension: ".${e}". Allowed extensions are: ${t===`sitemap`?`.ts, .tsx, .js, .jsx, .mjs, .json`:`.ts, .tsx, .js, .jsx, .mjs`}`)}function f(e){let{name:t,virtualId:r,sourcePath:s,sourceCode:c,aliases:l={},projectRoot:u,kind:f}=e;return{name:t,resolveId(e,t){if(e===r)return e;if(Object.keys(l).length>0){let t=n(e,l,u);if(t!=null&&t!==``){let e=i(t);return e!=null&&e!==``?e:t}}if(e.startsWith(`.`)){let n=t==null||t===``||t.startsWith(`\0`)?s:t,r=o.resolve(o.dirname(n),e),a=i(r);return a!=null&&a!==``?a:r}return null},async load(e){if(e===r){let e=o.extname(s).slice(1);return{code:c,moduleType:d(e,f)}}if(e&&!e.startsWith(`\0`))try{return{code:await a.readFile(e,`utf-8`),moduleType:d(o.extname(e).slice(1),f)}}catch{return null}return null}}}function p(e){return e===`rari`||e.startsWith(`rari/`)}async function m(e){let{virtualId:t,sourcePath:n,sourceCode:i,aliases:l={},projectRoot:u,kind:d,pluginName:m,label:h}=e,g=await r({root:u,virtualId:t,external:p,plugins:[f({name:m,virtualId:t,sourcePath:n,sourceCode:i,aliases:l,projectRoot:u,kind:d})]});if(g==null)throw Error(`Failed to build ${h} module`);let _=o.join(u,`node_modules`,`.cache`,`rari-metadata`);await a.mkdir(_,{recursive:!0});let v=o.join(_,`${h}-${c()}.mjs`);await using y=new AsyncDisposableStack;return y.defer(async()=>{await a.rm(v,{force:!0})}),await a.writeFile(v,g.code,`utf8`),await import(s(v).href)}function h(e,n){if(!t(e))throw Error(`${n} file must export a default export (either an object or a function)`);let r=e.default;if(r==null)throw Error(`${n} file must export a default export (either an object or a function)`);return r}function g(e){return o.resolve(e,`..`,`..`)}export{u as i,g as n,h as r,m as t};
@@ -0,0 +1,10 @@
1
+ import{v as e}from"./type-guards-BJXKlA6x.mjs";import{t}from"./xml-DPsk9WTz.mjs";import{i as n,n as r,r as i,t as a}from"./execute-CbhDMAQ3.mjs";import{promises as o}from"node:fs";import s from"node:path";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>${t(e)}</dc:creator>`:e.email!=null&&e.email!==``?` <author>${t(`${e.email} (${e.name})`)}</author>`:` <dc:creator>${t(e.name)}</dc:creator>`}function f(e){let n=[` <item>`,` <title>${t(e.title)}</title>`,` <link>${t(e.url)}</link>`];return e.description!=null&&e.description!==``&&n.push(` <description>${t(e.description)}</description>`),n.push(...p(e),...m(e),...h(e)),n.push(` </item>`),n.join(`
2
+ `)}function p(e){let t=[];e.content!=null&&e.content!==``&&t.push(` <content:encoded><![CDATA[${e.content.replace(/\]\]>/g,`]]]]><![CDATA[>`)}]]></content:encoded>`);let n=d(e.author);return n&&t.push(n),t}function m(e){let n=[];if(e.pubDate!=null&&n.push(` <pubDate>${u(e.pubDate)}</pubDate>`),n.push(` <guid isPermaLink="${e.guid!=null&&e.guid!==``?`false`:`true`}">${t(e.guid!=null&&e.guid!==``?e.guid:e.url)}</guid>`),e.categories)for(let r of e.categories)n.push(` <category>${t(r)}</category>`);return n}function h(e){if(!e.enclosure)return[];let n=[`url="${t(e.enclosure.url)}"`];return e.enclosure.length!==void 0&&n.push(`length="${e.enclosure.length}"`),n.push(`type="${t(e.enclosure.type!=null&&e.enclosure.type!==``?e.enclosure.type:`application/octet-stream`)}"`),[` <enclosure ${n.join(` `)} />`]}function g(e){let n=e.items.some(e=>e.content!=null&&e.content!==``),r=e.items.some(e=>{let t=e.author;return t==null||t===``?!1:typeof t==`string`||t.email==null||t.email===``}),i=[];n&&i.push(`xmlns:content="http://purl.org/rss/1.0/modules/content/"`),r&&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>${t(e.title)}</title>`,` <link>${t(e.link)}</link>`,` <description>${t(e.description)}</description>`,` <atom:link href="${t(`${e.link.replace(/\/+$/,``)}/feed.xml`)}" rel="self" type="application/rss+xml" />`];e.language!=null&&e.language!==``&&a.push(` <language>${t(e.language)}</language>`),e.copyright!=null&&e.copyright!==``&&a.push(` <copyright>${t(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>${t(e.image.url)}</url>`),a.push(` <title>${t(e.image.title)}</title>`),a.push(` <link>${t(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
+ `)}
4
+ /* v8 ignore start - file system operations, better tested in integration/e2e */
5
+ async function _(e,t=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`]){return n({appDir:e,staticFileName:`feed.xml`,dynamicBaseName:`feed`,extensions:t})}
6
+ /* v8 ignore stop */
7
+ /* v8 ignore start - file system operations and dynamic imports, better tested in integration/e2e */
8
+ async function v(e){let{appDir:t,outDir:n,extensions:c,aliases:u={}}=e,d=await _(t,c);if(!d)return!1;await o.mkdir(n,{recursive:!0});let f=s.join(n,`feed.xml`);if(d.type===`static`)return await o.copyFile(d.path,f),!0;try{let e=await o.readFile(d.path,`utf-8`),n=await a({virtualId:`\0virtual:feed`,sourcePath:d.path,sourceCode:e,aliases:u,projectRoot:r(t),kind:`feed`,pluginName:`virtual-feed`,label:`feed`}),s=g(await l(i(n,`Feed`)));return await o.writeFile(f,s),!0}catch(e){return console.error(`[rari] Failed to build/execute feed file:`,e),!1}}
9
+ /* v8 ignore stop */
10
+ export{v as generateFeedFile};