rari 0.15.16 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.d.mts +11 -0
- package/dist/cli.mjs +39 -39
- package/dist/{define-CzFpVAjt.mjs → define-CRafeveU.mjs} +1 -1
- package/dist/execute-B1z6YRUF.mjs +1 -0
- package/dist/feed-uUGeOZmR.mjs +10 -0
- package/dist/font/google.d.mts +1951 -0
- package/dist/font/google.mjs +1 -0
- package/dist/font/local.d.mts +4 -0
- package/dist/font/local.mjs +1 -0
- package/dist/font.d.mts +3 -0
- package/dist/font.mjs +1 -0
- package/dist/form-state-DZJs9bve.mjs +1 -0
- package/dist/get-client-component-DU5z65us.mjs +1 -0
- package/dist/headers.d.mts +4 -4
- package/dist/image.d.mts +6 -6
- package/dist/image.mjs +1 -1
- package/dist/index.d.mts +1 -2
- package/dist/mdx/define.mjs +1 -1
- package/dist/mdx/registry.d.mts +2 -3
- package/dist/mdx.d.mts +3 -3
- package/dist/mdx.mjs +1 -1
- package/dist/names-CLmM0CPi.mjs +1 -0
- package/dist/og.d.mts +2 -2
- package/dist/og.mjs +1 -1
- package/dist/path-C74rvUep.mjs +1 -0
- package/dist/platform.d.mts +3 -4
- package/dist/preload-modules-1i2BJqux.mjs +2 -0
- package/dist/prompt-uaCPq0_A-BW0EkzOD.mjs +45 -0
- package/dist/proxy/RariRequest.d.mts +2 -3
- package/dist/proxy/RariRequest.mjs +1 -1
- package/dist/proxy/RariResponse.mjs +1 -1
- package/dist/proxy/runtime-executor.d.mts +2 -4
- package/dist/proxy/runtime-executor.mjs +7 -1
- package/dist/{railway-dlVtU472.mjs → railway-CE3nqaKt.mjs} +1 -1
- package/dist/regex-constants-DBMCJbMw.mjs +1 -0
- package/dist/{render-Dipra0HL.mjs → render-D0eMtn5L.mjs} +1 -1
- package/dist/robots-B1bFAd4J.mjs +9 -0
- package/dist/router-D6X8JHst.mjs +1 -0
- package/dist/router.d.mts +6 -10
- package/dist/router.mjs +1 -1
- package/dist/rsc-vite-build-Cpu5suGN.mjs +1 -0
- package/dist/runtime/AppRouterProvider.d.mts +10 -7
- package/dist/runtime/AppRouterProvider.mjs +1 -1
- package/dist/runtime/ClientRouter.d.mts +3 -5
- package/dist/runtime/ClientRouter.mjs +7 -1
- package/dist/runtime/ErrorBoundaryWrapper.d.mts +2 -3
- package/dist/runtime/ErrorBoundaryWrapper.mjs +1 -1
- package/dist/runtime/LoadingErrorBoundary.d.mts +2 -3
- package/dist/runtime/action-flight-refresh.d.mts +4 -5
- package/dist/runtime/action-flight-refresh.mjs +1 -1
- package/dist/runtime/action-revalidation-kind.d.mts +6 -7
- package/dist/runtime/call-server.d.mts +2 -3
- package/dist/runtime/call-server.mjs +1 -1
- package/dist/runtime/entry-client.d.mts +3 -5
- package/dist/runtime/entry-client.mjs +3 -3
- package/dist/runtime/flight-route-cache.d.mts +7 -13
- package/dist/runtime/flight-route-cache.mjs +1 -1
- package/dist/runtime/flight-router-state.d.mts +7 -8
- package/dist/runtime/merge-flight-refresh.d.mts +2 -3
- package/dist/runtime/merge-flight-refresh.mjs +1 -1
- package/dist/runtime/rsc-client-runtime.d.mts +3 -2
- package/dist/runtime/rsc-client-runtime.mjs +1 -1
- package/dist/runtime/rsc-references.d.mts +3 -4
- package/dist/sitemap-DJY3OiJ0.mjs +13 -0
- package/dist/type-guards-BJXKlA6x.mjs +1 -0
- package/dist/types-CkZPEEdi.d.mts +43 -0
- package/dist/{types-_vPM8QuJ.d.mts → types-Q-x_0kVB.d.mts} +0 -9
- package/dist/{types-0350HUwk.d.mts → types-xTbuE-Js.d.mts} +237 -3
- package/dist/utils-YdvPzSET-Cbo6Ofmz.mjs +37 -0
- package/dist/vite.d.mts +38 -23
- package/dist/vite.mjs +836 -71
- package/dist/{xml-N8OZmN7u.mjs → xml-EW5iM39h.mjs} +1 -1
- package/package.json +42 -32
- package/dist/alias-resolver-Cigam7Y7.mjs +0 -1
- package/dist/feed-Ixvy9L12.mjs +0 -3
- package/dist/get-client-component-CLpyIcLJ.mjs +0 -1
- package/dist/names-N6JRDeT1.mjs +0 -1
- package/dist/preload-modules-QmSvKk0Q.mjs +0 -2
- package/dist/regex-constants-Wm7xRA3u.mjs +0 -1
- package/dist/robots-BGCTYwKN.mjs +0 -2
- package/dist/router-D84JWQz7.mjs +0 -1
- package/dist/sitemap-1n5BIACA.mjs +0 -7
- package/dist/type-guards-CTkEL8zw.mjs +0 -1
- package/dist/types-DCEyvFz7.d.mts +0 -199
- package/dist/utils-BLSRP4f6-8hVIII5T.mjs +0 -37
package/dist/cli.d.mts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
//#region src/cli/build-target.d.ts
|
|
2
|
+
type ViteAppCommand = 'build' | 'dev' | 'preview' | 'pack';
|
|
3
|
+
export declare function readDefaultPackageTarget(configSource: string, command?: ViteAppCommand): string | null;
|
|
4
|
+
export declare function readBuildOutDir(configSource: string): string | null;
|
|
5
|
+
export declare function readViteRoot(configSource: string): string | null;
|
|
6
|
+
export declare function resolveEffectiveViteRoot(configDir: string, configSource: string | null): string;
|
|
7
|
+
export declare function resolveViteBuildPackageRoot(cwd: string, viteBin?: 'vp' | 'vite', command?: ViteAppCommand): string;
|
|
8
|
+
export declare function resolveConfiguredBuildOutDir(packageRoot: string): string;
|
|
9
|
+
export declare function findImageConfigPath(packageRoot: string): string | null;
|
|
10
|
+
export declare function outDirFromImageConfigPath(imageConfigPath: string): string;
|
|
11
|
+
//#endregion
|
|
1
12
|
//#region src/cli/index.d.ts
|
|
2
13
|
type PackageManager = 'pnpm' | 'yarn' | 'bun' | 'npm';
|
|
3
14
|
declare function detectPackageManager(): PackageManager;
|
package/dist/cli.mjs
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import{
|
|
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`)}
|
|
2
2
|
|
|
3
|
-
${
|
|
4
|
-
${
|
|
5
|
-
${
|
|
6
|
-
${
|
|
7
|
-
${
|
|
8
|
-
${
|
|
9
|
-
${
|
|
10
|
-
${
|
|
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
|
|
11
11
|
|
|
12
|
-
${
|
|
13
|
-
${
|
|
14
|
-
${
|
|
15
|
-
${
|
|
16
|
-
${
|
|
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)
|
|
17
17
|
|
|
18
|
-
${
|
|
19
|
-
${
|
|
20
|
-
${
|
|
18
|
+
${v(`bold`,`Examples:`)}
|
|
19
|
+
${v(`gray`,`# Start development server with Vite`)}
|
|
20
|
+
${v(`cyan`,`rari dev`)}
|
|
21
21
|
|
|
22
|
-
${
|
|
23
|
-
${
|
|
22
|
+
${v(`gray`,`# Build for production`)}
|
|
23
|
+
${v(`cyan`,`rari build`)}
|
|
24
24
|
|
|
25
|
-
${
|
|
26
|
-
${
|
|
25
|
+
${v(`gray`,`# Clean dist folder`)}
|
|
26
|
+
${v(`cyan`,`rari clean`)}
|
|
27
27
|
|
|
28
|
-
${
|
|
29
|
-
${
|
|
28
|
+
${v(`gray`,`# Start production server (default)`)}
|
|
29
|
+
${v(`cyan`,`rari start`)}
|
|
30
30
|
|
|
31
|
-
${
|
|
32
|
-
${
|
|
31
|
+
${v(`gray`,`# Start in development mode`)}
|
|
32
|
+
${v(`cyan`,`NODE_ENV=development rari start`)}
|
|
33
33
|
|
|
34
|
-
${
|
|
35
|
-
${
|
|
34
|
+
${v(`gray`,`# Start production server on port 8080`)}
|
|
35
|
+
${v(`cyan`,`PORT=8080 rari start`)}
|
|
36
36
|
|
|
37
|
-
${
|
|
38
|
-
${
|
|
37
|
+
${v(`gray`,`# Setup Railway deployment`)}
|
|
38
|
+
${v(`cyan`,`rari deploy railway`)}
|
|
39
39
|
|
|
40
|
-
${
|
|
41
|
-
${
|
|
40
|
+
${v(`gray`,`# Setup Render deployment`)}
|
|
41
|
+
${v(`cyan`,`rari deploy render`)}
|
|
42
42
|
|
|
43
|
-
${
|
|
44
|
-
${
|
|
43
|
+
${v(`gray`,`# Start with debug logging`)}
|
|
44
|
+
${v(`cyan`,`RUST_LOG=debug rari start`)}
|
|
45
45
|
|
|
46
|
-
${
|
|
47
|
-
${
|
|
48
|
-
${
|
|
46
|
+
${v(`bold`,`Deployment:`)}
|
|
47
|
+
${v(`cyan`,`rari deploy railway`)} Creates Railway deployment files
|
|
48
|
+
${v(`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
|
-
${
|
|
55
|
+
${v(`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
|
-
${
|
|
60
|
+
${v(`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 @@ ${h(`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
|
|
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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
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};
|
|
@@ -0,0 +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};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{v as e}from"./type-guards-BJXKlA6x.mjs";import{t}from"./xml-EW5iM39h.mjs";import{i as n,n as r,r as i,t as a}from"./execute-B1z6YRUF.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>`];n.push(` <title>${t(e.title)}</title>`),n.push(` <link>${t(e.url)}</link>`),e.description!=null&&e.description!==``&&n.push(` <description>${t(e.description)}</description>`),e.content!=null&&e.content!==``&&n.push(` <content:encoded><![CDATA[${e.content.replace(/\]\]>/g,`]]]]><![CDATA[>`)}]]></content:encoded>`);let r=d(e.author);if(r&&n.push(r),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>`);if(e.enclosure){let r=[`url="${t(e.enclosure.url)}"`];e.enclosure.length!==void 0&&r.push(`length="${e.enclosure.length}"`),r.push(`type="${t(e.enclosure.type!=null&&e.enclosure.type!==``?e.enclosure.type:`application/octet-stream`)}"`),n.push(` <enclosure ${r.join(` `)} />`)}return n.push(` </item>`),n.join(`
|
|
2
|
+
`)}function p(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 m(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 h(e){let{appDir:t,outDir:n,extensions:c,aliases:u={}}=e,d=await m(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=p(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{h as generateFeedFile};
|