rari 0.7.9 → 0.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RariRequest-D2LI2Fku.mjs +1 -0
- package/dist/RariRequest-DvF3tBO7.mjs +1 -0
- package/dist/chunk-C7YniUGR.mjs +1 -0
- package/dist/cli.mjs +41 -415
- package/dist/client.d.mts +3 -3
- package/dist/client.mjs +3 -1269
- package/dist/constants-DCDaPbFM.mjs +1 -0
- package/dist/image/index.mjs +1 -173
- package/dist/index.mjs +1 -8
- package/dist/mdx.mjs +1 -78
- package/dist/og/index.mjs +1 -50
- package/dist/platform-iVwv_Z06.mjs +1 -0
- package/dist/proxy/runtime-executor.mjs +1 -86
- package/dist/railway-hYu3gNGo.mjs +102 -0
- package/dist/render-sqptvp3C.mjs +108 -0
- package/dist/robots-generator-BalXAHqI.mjs +2 -0
- package/dist/routes-2L4UuyND.mjs +1 -0
- package/dist/routes-DxBzqo4i.mjs +1 -0
- package/dist/runtime/actions.mjs +1 -196
- package/dist/runtime-client-r4vTOC5x.mjs +6 -0
- package/dist/server-build-D9KCO66Y.mjs +124 -0
- package/dist/server-build-tqzWSQbG.mjs +1 -0
- package/dist/vite-CYAYYRQ5.mjs +74 -0
- package/dist/vite.mjs +1 -8
- package/package.json +1 -1
- package/dist/RariRequest-DM6Q4JDB.mjs +0 -156
- package/dist/RariRequest-D_4bWdqr.mjs +0 -3
- package/dist/chunk-DViRIILg.mjs +0 -7
- package/dist/constants-wQafG3CE.mjs +0 -33
- package/dist/platform-BVanT5X-.mjs +0 -3
- package/dist/railway-C4ZbcXlH.mjs +0 -209
- package/dist/render-BBLLGOgo.mjs +0 -215
- package/dist/robots-generator-D14uBu7L.mjs +0 -105
- package/dist/routes-DVpNEEhv.mjs +0 -3
- package/dist/routes-n_EfMXUa.mjs +0 -305
- package/dist/runtime-client-DkgL4Orp.mjs +0 -430
- package/dist/server-build-Chl-ND4C.mjs +0 -3
- package/dist/server-build-X1pfRKXQ.mjs +0 -1143
- package/dist/vite-BnOllkxk.mjs +0 -3344
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=class{cookies;pendingDeletes;pendingSets;constructor(e){this.cookies=new Map,this.pendingDeletes=new Set,this.pendingSets=new Map,e&&this.parseCookieHeader(e)}parseCookieHeader(e){let t=e.split(`;`).map(e=>e.trim());for(let e of t){let[t,...n]=e.split(`=`);if(t){let e=n.join(`=`);this.cookies.set(t,{name:t,value:e})}}}get(e){if(this.pendingDeletes.has(e))return;let t=this.pendingSets.get(e);return t?{name:t.name,value:t.value,path:t.options?.path}:this.cookies.get(e)}getAll(){let e=[];return this.cookies.forEach(t=>{this.pendingDeletes.has(t.name)||e.push(t)}),this.pendingSets.forEach(t=>{e.push({name:t.name,value:t.value,path:t.options?.path})}),e}has(e){return this.pendingDeletes.has(e)?!1:this.pendingSets.has(e)||this.cookies.has(e)}delete(e){this.pendingDeletes.add(e),this.pendingSets.delete(e)}set(e,t,n){if(typeof e==`string`)this.pendingSets.set(e,{name:e,value:t,options:n}),this.pendingDeletes.delete(e);else{let{name:t,value:n,...r}=e;this.pendingSets.set(t,{name:t,value:n,options:r}),this.pendingDeletes.delete(t)}}getPendingChanges(){return{deletes:Array.from(this.pendingDeletes),sets:Array.from(this.pendingSets.values())}}},t=class{url;constructor(e){this.url=typeof e==`string`?new URL(e):e}get href(){return this.url.href}get origin(){return this.url.origin}get protocol(){return this.url.protocol}get hostname(){return this.url.hostname}get port(){return this.url.port}get pathname(){return this.url.pathname}set pathname(e){this.url.pathname=e}get search(){return this.url.search}set search(e){this.url.search=e}get searchParams(){return this.url.searchParams}get hash(){return this.url.hash}set hash(e){this.url.hash=e}toString(){return this.url.toString()}},n=class n{url;method;headers;cookies;rariUrl;ip;geo;constructor(n,r){n instanceof Request?(this.url=n.url,this.method=n.method,this.headers=new Headers(n.headers)):(this.url=typeof n==`string`?n:n.toString(),this.method=r?.method||`GET`,this.headers=new Headers(r?.headers)),this.rariUrl=new t(this.url),this.cookies=new e(this.headers.get(`cookie`)||void 0),this.ip=r?.ip,this.geo=r?.geo}static fromRequest(e,t){return new n(e,t)}};export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./RariRequest-D2LI2Fku.mjs";export{e as RariRequest};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as e}from"node:module";var t=e(import.meta.url);export{t};
|
package/dist/cli.mjs
CHANGED
|
@@ -1,419 +1,77 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as
|
|
3
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
4
|
-
import { join, resolve } from "node:path";
|
|
5
|
-
import process from "node:process";
|
|
6
|
-
import { spawn } from "node:child_process";
|
|
7
|
-
|
|
8
|
-
//#region src/platform.ts
|
|
9
|
-
const SUPPORTED_PLATFORMS = {
|
|
10
|
-
"linux-x64": "rari-linux-x64",
|
|
11
|
-
"linux-arm64": "rari-linux-arm64",
|
|
12
|
-
"darwin-x64": "rari-darwin-x64",
|
|
13
|
-
"darwin-arm64": "rari-darwin-arm64",
|
|
14
|
-
"win32-x64": "rari-win32-x64"
|
|
15
|
-
};
|
|
16
|
-
function getPlatformInfo() {
|
|
17
|
-
const platform = process.platform;
|
|
18
|
-
const arch = process.arch;
|
|
19
|
-
let normalizedPlatform;
|
|
20
|
-
switch (platform) {
|
|
21
|
-
case "darwin":
|
|
22
|
-
normalizedPlatform = "darwin";
|
|
23
|
-
break;
|
|
24
|
-
case "linux":
|
|
25
|
-
normalizedPlatform = "linux";
|
|
26
|
-
break;
|
|
27
|
-
case "win32":
|
|
28
|
-
normalizedPlatform = "win32";
|
|
29
|
-
break;
|
|
30
|
-
default: throw new Error(`Unsupported platform: ${platform}. rari supports Linux, macOS, and Windows.`);
|
|
31
|
-
}
|
|
32
|
-
let normalizedArch;
|
|
33
|
-
switch (arch) {
|
|
34
|
-
case "x64":
|
|
35
|
-
normalizedArch = "x64";
|
|
36
|
-
break;
|
|
37
|
-
case "arm64":
|
|
38
|
-
normalizedArch = "arm64";
|
|
39
|
-
break;
|
|
40
|
-
default: throw new Error(`Unsupported architecture: ${arch}. rari supports x64 and ARM64.`);
|
|
41
|
-
}
|
|
42
|
-
const packageName = SUPPORTED_PLATFORMS[`${normalizedPlatform}-${normalizedArch}`];
|
|
43
|
-
if (!packageName) throw new Error(`Unsupported platform combination: ${normalizedPlatform}-${normalizedArch}. Supported platforms: ${Object.keys(SUPPORTED_PLATFORMS).join(", ")}`);
|
|
44
|
-
return {
|
|
45
|
-
platform: normalizedPlatform,
|
|
46
|
-
arch: normalizedArch,
|
|
47
|
-
packageName,
|
|
48
|
-
binaryName: normalizedPlatform === "win32" ? "rari.exe" : "rari"
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
function getBinaryPath() {
|
|
52
|
-
const { packageName, binaryName } = getPlatformInfo();
|
|
53
|
-
try {
|
|
54
|
-
let currentDir = process.cwd();
|
|
55
|
-
let workspaceRoot = null;
|
|
56
|
-
while (currentDir !== "/" && currentDir !== "") {
|
|
57
|
-
if (existsSync(join(currentDir, "packages"))) {
|
|
58
|
-
workspaceRoot = currentDir;
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
currentDir = join(currentDir, "..");
|
|
62
|
-
}
|
|
63
|
-
if (workspaceRoot) {
|
|
64
|
-
const binaryPath = join(join(workspaceRoot, "packages", packageName), "bin", binaryName);
|
|
65
|
-
if (existsSync(binaryPath)) return binaryPath;
|
|
66
|
-
}
|
|
67
|
-
} catch {}
|
|
68
|
-
try {
|
|
69
|
-
const binaryPath = join(__require.resolve(`${packageName}/package.json`).replace("/package.json", ""), "bin", binaryName);
|
|
70
|
-
if (existsSync(binaryPath)) return binaryPath;
|
|
71
|
-
throw new Error(`Binary not found at ${binaryPath}`);
|
|
72
|
-
} catch {
|
|
73
|
-
throw new Error(`Failed to locate rari binary for ${packageName}. Please ensure the platform package is installed: npm install ${packageName}`);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
function getInstallationInstructions() {
|
|
77
|
-
const { packageName } = getPlatformInfo();
|
|
78
|
-
return `
|
|
2
|
+
import{t as e}from"./chunk-C7YniUGR.mjs";import{existsSync as t,readFileSync as n}from"node:fs";import{join as r,resolve as i}from"node:path";import a from"node:process";import{spawn as o}from"node:child_process";const s={"linux-x64":`rari-linux-x64`,"linux-arm64":`rari-linux-arm64`,"darwin-x64":`rari-darwin-x64`,"darwin-arm64":`rari-darwin-arm64`,"win32-x64":`rari-win32-x64`};function c(){let e=a.platform,t=a.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 r;switch(t){case`x64`:r=`x64`;break;case`arm64`:r=`arm64`;break;default:throw Error(`Unsupported architecture: ${t}. rari supports x64 and ARM64.`)}let i=s[`${n}-${r}`];if(!i)throw Error(`Unsupported platform combination: ${n}-${r}. Supported platforms: ${Object.keys(s).join(`, `)}`);return{platform:n,arch:r,packageName:i,binaryName:n===`win32`?`rari.exe`:`rari`}}function l(){let{packageName:n,binaryName:i}=c();try{let e=a.cwd(),o=null;for(;e!==`/`&&e!==``;){if(t(r(e,`packages`))){o=e;break}e=r(e,`..`)}if(o){let e=r(r(o,`packages`,n),`bin`,i);if(t(e))return e}}catch{}try{let a=r(e.resolve(`${n}/package.json`).replace(`/package.json`,``),`bin`,i);if(t(a))return a;throw Error(`Binary not found at ${a}`)}catch{throw Error(`Failed to locate rari binary for ${n}. Please ensure the platform package is installed: npm install ${n}`)}}function u(){let{packageName:e}=c();return`
|
|
79
3
|
To install rari for your platform, run:
|
|
80
4
|
|
|
81
|
-
npm install ${
|
|
5
|
+
npm install ${e}
|
|
82
6
|
|
|
83
7
|
Or if you're using pnpm:
|
|
84
8
|
|
|
85
|
-
pnpm add ${
|
|
9
|
+
pnpm add ${e}
|
|
86
10
|
|
|
87
11
|
Or if you're using yarn:
|
|
88
12
|
|
|
89
|
-
yarn add ${
|
|
13
|
+
yarn add ${e}
|
|
90
14
|
|
|
91
15
|
If you continue to have issues, you can also install from source:
|
|
92
16
|
|
|
93
17
|
cargo install --git https://github.com/rari-build/rari
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
//#endregion
|
|
98
|
-
//#region src/utils/colors.ts
|
|
99
|
-
const isColorSupported = !(process.env.NO_COLOR || process.argv.includes("--no-color")) && (process.env.FORCE_COLOR || process.argv.includes("--color") || process.platform === "win32" || process.stdout?.isTTY && process.env.TERM !== "dumb" || process.env.CI);
|
|
100
|
-
function formatter(open, close, replace = open) {
|
|
101
|
-
return (input) => {
|
|
102
|
-
const string = String(input);
|
|
103
|
-
const index = string.indexOf(close, open.length);
|
|
104
|
-
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
function replaceClose(string, close, replace, index) {
|
|
108
|
-
let result = "";
|
|
109
|
-
let cursor = 0;
|
|
110
|
-
do {
|
|
111
|
-
result += string.substring(cursor, index) + replace;
|
|
112
|
-
cursor = index + close.length;
|
|
113
|
-
index = string.indexOf(close, cursor);
|
|
114
|
-
} while (~index);
|
|
115
|
-
return result + string.substring(cursor);
|
|
116
|
-
}
|
|
117
|
-
const f = isColorSupported ? formatter : () => String;
|
|
118
|
-
const colors = {
|
|
119
|
-
isColorSupported,
|
|
120
|
-
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
121
|
-
red: f("\x1B[31m", "\x1B[39m"),
|
|
122
|
-
green: f("\x1B[32m", "\x1B[39m"),
|
|
123
|
-
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
124
|
-
blue: f("\x1B[34m", "\x1B[39m"),
|
|
125
|
-
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
126
|
-
gray: f("\x1B[90m", "\x1B[39m")
|
|
127
|
-
};
|
|
128
|
-
var colors_default = colors;
|
|
18
|
+
`}const d=!(a.env.NO_COLOR||a.argv.includes(`--no-color`))&&(a.env.FORCE_COLOR||a.argv.includes(`--color`)||a.platform===`win32`||a.stdout?.isTTY&&a.env.TERM!==`dumb`||a.env.CI);function f(e,t,n=e){return r=>{let i=String(r),a=i.indexOf(t,e.length);return~a?e+p(i,t,n,a)+t:e+i+t}}function p(e,t,n,r){let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)}const m=d?f:()=>String;var h={isColorSupported:d,bold:m(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),red:m(`\x1B[31m`,`\x1B[39m`),green:m(`\x1B[32m`,`\x1B[39m`),yellow:m(`\x1B[33m`,`\x1B[39m`),blue:m(`\x1B[34m`,`\x1B[39m`),cyan:m(`\x1B[36m`,`\x1B[39m`),gray:m(`\x1B[90m`,`\x1B[39m`)};function g(){let e=i(a.cwd(),`.env`);if(t(e)){let t=n(e,`utf-8`);for(let e of t.split(`
|
|
19
|
+
`)){let t=e.trim();if(!t||t.startsWith(`#`))continue;let n=t.match(/^([^=]+)=(.*)$/);if(n){let[,e,t]=n,r=e.trim(),i=t.trim();(i.startsWith(`"`)&&i.endsWith(`"`)||i.startsWith(`'`)&&i.endsWith(`'`))&&(i=i.slice(1,-1)),a.env[r]||(a.env[r]=i)}}}}g();const[,,_,...v]=a.argv;function y(e){console.warn(`${h.blue(`info`)} ${e}`)}function b(e){console.warn(`${h.green(`✓`)} ${e}`)}function x(e){console.error(`${h.red(`✗`)} ${e}`)}function S(){return!!(a.env.RAILWAY_ENVIRONMENT||a.env.RAILWAY_PROJECT_ID||a.env.RAILWAY_SERVICE_ID)}function C(){return!!(a.env.RENDER||a.env.RENDER_SERVICE_ID||a.env.RENDER_SERVICE_NAME)}function w(){return S()||C()}function T(){return S()?`Railway`:C()?`Render`:`local`}function E(){return{port:a.env.PORT||a.env.RSC_PORT||`3000`,mode:a.env.NODE_ENV||`production`,host:w()?`0.0.0.0`:`127.0.0.1`}}async function D(){let{existsSync:e,rmSync:t}=await import(`node:fs`),{resolve:n}=await import(`node:path`),{spawn:r}=await import(`node:child_process`),i=n(a.cwd(),`dist`);e(i)&&(y(`Cleaning dist folder...`),t(i,{recursive:!0,force:!0})),y(`Type checking...`);let o=r(`npx`,[`tsgo`],{stdio:`inherit`,cwd:a.cwd(),shell:!0});await new Promise((e,t)=>{o.on(`exit`,n=>{n===0?(b(`Type check passed`),e()):(x(`Type check failed with code ${n}`),t(Error(`Type check failed with code ${n}`)))}),o.on(`error`,t)}),y(`Building for production...`);let s=r(`npx`,[`vite`,`build`],{stdio:`inherit`,cwd:a.cwd(),shell:!0});await new Promise((e,t)=>{s.on(`exit`,n=>{n===0?(b(`Build complete`),e()):(x(`Build failed with code ${n}`),t(Error(`Build failed with code ${n}`)))}),s.on(`error`,t)})}async function O(){let{existsSync:e}=await import(`node:fs`),{resolve:t}=await import(`node:path`),{spawn:n}=await import(`node:child_process`);if(!e(t(a.cwd(),`dist`))){y(`First run detected - building project...`);let e=n(`npx`,[`vite`,`build`,`--mode`,`development`],{stdio:`inherit`,cwd:a.cwd(),shell:!0});await new Promise((t,n)=>{e.on(`exit`,e=>{e===0?(b(`Initial build complete`),t()):(x(`Build failed with code ${e}`),n(Error(`Build failed with code ${e}`)))}),e.on(`error`,n)})}y(`Starting Vite dev server...`);let r=n(`npx`,[`vite`],{stdio:`inherit`,cwd:a.cwd(),shell:!0}),i=()=>{y(`Shutting down dev server...`),r.kill(`SIGTERM`)};return a.on(`SIGINT`,i),a.on(`SIGTERM`,i),r.on(`error`,e=>{x(`Failed to start Vite: ${e.message}`),a.exit(1)}),r.on(`exit`,e=>{e!==0&&e!==null&&(x(`Vite exited with code ${e}`),a.exit(e))}),new Promise(()=>{})}async function k(){let e;try{e=l()}catch{x(`Failed to obtain rari binary`),x(u()),a.exit(1)}let{port:t,mode:n,host:r}=E();if(w()){let i=T();y(`${i} environment detected`),y(`Starting rari server for ${i} deployment...`),y(`Mode: ${n}, Host: ${r}, Port: ${t}`),y(`using binary: ${e}`)}let i=o(e,[`--mode`,n,`--port`,t,`--host`,r],{stdio:`inherit`,cwd:a.cwd(),env:{...a.env,RUST_LOG:a.env.RUST_LOG||`error`}}),s=()=>{y(`shutting down...`),i.kill(`SIGTERM`)};return a.on(`SIGINT`,s),a.on(`SIGTERM`,s),i.on(`error`,e=>{x(`Failed to start rari server: ${e.message}`),e.message.includes(`ENOENT`)&&x(`Binary not found. Please ensure rari is properly installed.`),a.exit(1)}),i.on(`exit`,(e,t)=>{t?y(`server stopped by signal ${t}`):e===0?b(`server stopped successfully`):(x(`server exited with code ${e}`),a.exit(e||1))}),new Promise(()=>{})}async function A(){y(`Setting up Railway deployment...`),w()&&(x(`Already running in ${T()} environment. Use "rari start" instead.`),a.exit(1));let{createRailwayDeployment:e}=await import(`./railway-hYu3gNGo.mjs`);await e()}async function j(){y(`Setting up Render deployment...`),w()&&(x(`Already running in ${T()} environment. Use "rari start" instead.`),a.exit(1));let{createRenderDeployment:e}=await import(`./render-sqptvp3C.mjs`);await e()}async function M(){switch(_){case void 0:case`help`:case`--help`:case`-h`:console.warn(`${h.bold(`rari CLI`)}
|
|
129
20
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const trimmed = line.trim();
|
|
138
|
-
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
139
|
-
const match = trimmed.match(/^([^=]+)=(.*)$/);
|
|
140
|
-
if (match) {
|
|
141
|
-
const [, key, value] = match;
|
|
142
|
-
const cleanKey = key.trim();
|
|
143
|
-
let cleanValue = value.trim();
|
|
144
|
-
if (cleanValue.startsWith("\"") && cleanValue.endsWith("\"") || cleanValue.startsWith("'") && cleanValue.endsWith("'")) cleanValue = cleanValue.slice(1, -1);
|
|
145
|
-
if (!process.env[cleanKey]) process.env[cleanKey] = cleanValue;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
loadEnvFile();
|
|
151
|
-
const [, , command, ...args] = process.argv;
|
|
152
|
-
function logInfo(message) {
|
|
153
|
-
console.warn(`${colors_default.blue("info")} ${message}`);
|
|
154
|
-
}
|
|
155
|
-
function logSuccess(message) {
|
|
156
|
-
console.warn(`${colors_default.green("✓")} ${message}`);
|
|
157
|
-
}
|
|
158
|
-
function logError(message) {
|
|
159
|
-
console.error(`${colors_default.red("✗")} ${message}`);
|
|
160
|
-
}
|
|
161
|
-
function isRailwayEnvironment() {
|
|
162
|
-
return !!(process.env.RAILWAY_ENVIRONMENT || process.env.RAILWAY_PROJECT_ID || process.env.RAILWAY_SERVICE_ID);
|
|
163
|
-
}
|
|
164
|
-
function isRenderEnvironment() {
|
|
165
|
-
return !!(process.env.RENDER || process.env.RENDER_SERVICE_ID || process.env.RENDER_SERVICE_NAME);
|
|
166
|
-
}
|
|
167
|
-
function isPlatformEnvironment() {
|
|
168
|
-
return isRailwayEnvironment() || isRenderEnvironment();
|
|
169
|
-
}
|
|
170
|
-
function getPlatformName() {
|
|
171
|
-
if (isRailwayEnvironment()) return "Railway";
|
|
172
|
-
if (isRenderEnvironment()) return "Render";
|
|
173
|
-
return "local";
|
|
174
|
-
}
|
|
175
|
-
function getDeploymentConfig() {
|
|
176
|
-
return {
|
|
177
|
-
port: process.env.PORT || process.env.RSC_PORT || "3000",
|
|
178
|
-
mode: process.env.NODE_ENV || "production",
|
|
179
|
-
host: isPlatformEnvironment() ? "0.0.0.0" : "127.0.0.1"
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
async function runViteBuild() {
|
|
183
|
-
const { existsSync: existsSync$1, rmSync } = await import("node:fs");
|
|
184
|
-
const { resolve: resolve$1 } = await import("node:path");
|
|
185
|
-
const { spawn: spawn$1 } = await import("node:child_process");
|
|
186
|
-
const distPath = resolve$1(process.cwd(), "dist");
|
|
187
|
-
if (existsSync$1(distPath)) {
|
|
188
|
-
logInfo("Cleaning dist folder...");
|
|
189
|
-
rmSync(distPath, {
|
|
190
|
-
recursive: true,
|
|
191
|
-
force: true
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
logInfo("Type checking...");
|
|
195
|
-
const typecheckProcess = spawn$1("npx", ["tsgo"], {
|
|
196
|
-
stdio: "inherit",
|
|
197
|
-
cwd: process.cwd(),
|
|
198
|
-
shell: true
|
|
199
|
-
});
|
|
200
|
-
await new Promise((resolve$2, reject) => {
|
|
201
|
-
typecheckProcess.on("exit", (code) => {
|
|
202
|
-
if (code === 0) {
|
|
203
|
-
logSuccess("Type check passed");
|
|
204
|
-
resolve$2();
|
|
205
|
-
} else {
|
|
206
|
-
logError(`Type check failed with code ${code}`);
|
|
207
|
-
reject(/* @__PURE__ */ new Error(`Type check failed with code ${code}`));
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
typecheckProcess.on("error", reject);
|
|
211
|
-
});
|
|
212
|
-
logInfo("Building for production...");
|
|
213
|
-
const buildProcess = spawn$1("npx", ["vite", "build"], {
|
|
214
|
-
stdio: "inherit",
|
|
215
|
-
cwd: process.cwd(),
|
|
216
|
-
shell: true
|
|
217
|
-
});
|
|
218
|
-
await new Promise((resolve$2, reject) => {
|
|
219
|
-
buildProcess.on("exit", (code) => {
|
|
220
|
-
if (code === 0) {
|
|
221
|
-
logSuccess("Build complete");
|
|
222
|
-
resolve$2();
|
|
223
|
-
} else {
|
|
224
|
-
logError(`Build failed with code ${code}`);
|
|
225
|
-
reject(/* @__PURE__ */ new Error(`Build failed with code ${code}`));
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
buildProcess.on("error", reject);
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
async function runViteDev() {
|
|
232
|
-
const { existsSync: existsSync$1 } = await import("node:fs");
|
|
233
|
-
const { resolve: resolve$1 } = await import("node:path");
|
|
234
|
-
const { spawn: spawn$1 } = await import("node:child_process");
|
|
235
|
-
if (!existsSync$1(resolve$1(process.cwd(), "dist"))) {
|
|
236
|
-
logInfo("First run detected - building project...");
|
|
237
|
-
const buildProcess = spawn$1("npx", [
|
|
238
|
-
"vite",
|
|
239
|
-
"build",
|
|
240
|
-
"--mode",
|
|
241
|
-
"development"
|
|
242
|
-
], {
|
|
243
|
-
stdio: "inherit",
|
|
244
|
-
cwd: process.cwd(),
|
|
245
|
-
shell: true
|
|
246
|
-
});
|
|
247
|
-
await new Promise((resolve$2, reject) => {
|
|
248
|
-
buildProcess.on("exit", (code) => {
|
|
249
|
-
if (code === 0) {
|
|
250
|
-
logSuccess("Initial build complete");
|
|
251
|
-
resolve$2();
|
|
252
|
-
} else {
|
|
253
|
-
logError(`Build failed with code ${code}`);
|
|
254
|
-
reject(/* @__PURE__ */ new Error(`Build failed with code ${code}`));
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
|
-
buildProcess.on("error", reject);
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
logInfo("Starting Vite dev server...");
|
|
261
|
-
const viteProcess = spawn$1("npx", ["vite"], {
|
|
262
|
-
stdio: "inherit",
|
|
263
|
-
cwd: process.cwd(),
|
|
264
|
-
shell: true
|
|
265
|
-
});
|
|
266
|
-
const shutdown = () => {
|
|
267
|
-
logInfo("Shutting down dev server...");
|
|
268
|
-
viteProcess.kill("SIGTERM");
|
|
269
|
-
};
|
|
270
|
-
process.on("SIGINT", shutdown);
|
|
271
|
-
process.on("SIGTERM", shutdown);
|
|
272
|
-
viteProcess.on("error", (error) => {
|
|
273
|
-
logError(`Failed to start Vite: ${error.message}`);
|
|
274
|
-
process.exit(1);
|
|
275
|
-
});
|
|
276
|
-
viteProcess.on("exit", (code) => {
|
|
277
|
-
if (code !== 0 && code !== null) {
|
|
278
|
-
logError(`Vite exited with code ${code}`);
|
|
279
|
-
process.exit(code);
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
return new Promise(() => {});
|
|
283
|
-
}
|
|
284
|
-
async function startRustServer() {
|
|
285
|
-
let binaryPath;
|
|
286
|
-
try {
|
|
287
|
-
binaryPath = getBinaryPath();
|
|
288
|
-
} catch {
|
|
289
|
-
logError("Failed to obtain rari binary");
|
|
290
|
-
logError(getInstallationInstructions());
|
|
291
|
-
process.exit(1);
|
|
292
|
-
}
|
|
293
|
-
const { port, mode, host } = getDeploymentConfig();
|
|
294
|
-
if (isPlatformEnvironment()) {
|
|
295
|
-
const platformName = getPlatformName();
|
|
296
|
-
logInfo(`${platformName} environment detected`);
|
|
297
|
-
logInfo(`Starting rari server for ${platformName} deployment...`);
|
|
298
|
-
logInfo(`Mode: ${mode}, Host: ${host}, Port: ${port}`);
|
|
299
|
-
logInfo(`using binary: ${binaryPath}`);
|
|
300
|
-
}
|
|
301
|
-
const rustServer = spawn(binaryPath, [
|
|
302
|
-
"--mode",
|
|
303
|
-
mode,
|
|
304
|
-
"--port",
|
|
305
|
-
port,
|
|
306
|
-
"--host",
|
|
307
|
-
host
|
|
308
|
-
], {
|
|
309
|
-
stdio: "inherit",
|
|
310
|
-
cwd: process.cwd(),
|
|
311
|
-
env: {
|
|
312
|
-
...process.env,
|
|
313
|
-
RUST_LOG: process.env.RUST_LOG || "error"
|
|
314
|
-
}
|
|
315
|
-
});
|
|
316
|
-
const shutdown = () => {
|
|
317
|
-
logInfo("shutting down...");
|
|
318
|
-
rustServer.kill("SIGTERM");
|
|
319
|
-
};
|
|
320
|
-
process.on("SIGINT", shutdown);
|
|
321
|
-
process.on("SIGTERM", shutdown);
|
|
322
|
-
rustServer.on("error", (error) => {
|
|
323
|
-
logError(`Failed to start rari server: ${error.message}`);
|
|
324
|
-
if (error.message.includes("ENOENT")) logError("Binary not found. Please ensure rari is properly installed.");
|
|
325
|
-
process.exit(1);
|
|
326
|
-
});
|
|
327
|
-
rustServer.on("exit", (code, signal) => {
|
|
328
|
-
if (signal) logInfo(`server stopped by signal ${signal}`);
|
|
329
|
-
else if (code === 0) logSuccess("server stopped successfully");
|
|
330
|
-
else {
|
|
331
|
-
logError(`server exited with code ${code}`);
|
|
332
|
-
process.exit(code || 1);
|
|
333
|
-
}
|
|
334
|
-
});
|
|
335
|
-
return new Promise(() => {});
|
|
336
|
-
}
|
|
337
|
-
async function deployToRailway() {
|
|
338
|
-
logInfo("Setting up Railway deployment...");
|
|
339
|
-
if (isPlatformEnvironment()) {
|
|
340
|
-
logError(`Already running in ${getPlatformName()} environment. Use "rari start" instead.`);
|
|
341
|
-
process.exit(1);
|
|
342
|
-
}
|
|
343
|
-
const { createRailwayDeployment } = await import("./railway-C4ZbcXlH.mjs");
|
|
344
|
-
await createRailwayDeployment();
|
|
345
|
-
}
|
|
346
|
-
async function deployToRender() {
|
|
347
|
-
logInfo("Setting up Render deployment...");
|
|
348
|
-
if (isPlatformEnvironment()) {
|
|
349
|
-
logError(`Already running in ${getPlatformName()} environment. Use "rari start" instead.`);
|
|
350
|
-
process.exit(1);
|
|
351
|
-
}
|
|
352
|
-
const { createRenderDeployment } = await import("./render-BBLLGOgo.mjs");
|
|
353
|
-
await createRenderDeployment();
|
|
354
|
-
}
|
|
355
|
-
async function main() {
|
|
356
|
-
switch (command) {
|
|
357
|
-
case void 0:
|
|
358
|
-
case "help":
|
|
359
|
-
case "--help":
|
|
360
|
-
case "-h":
|
|
361
|
-
console.warn(`${colors_default.bold("rari CLI")}
|
|
21
|
+
${h.bold(`Usage:`)}
|
|
22
|
+
${h.cyan(`rari dev`)} Start the development server with Vite
|
|
23
|
+
${h.cyan(`rari build`)} Build for production
|
|
24
|
+
${h.cyan(`rari start`)} Start the rari server (defaults to production)
|
|
25
|
+
${h.cyan(`rari deploy railway`)} Setup Railway deployment
|
|
26
|
+
${h.cyan(`rari deploy render`)} Setup Render deployment
|
|
27
|
+
${h.cyan(`rari help`)} Show this help message
|
|
362
28
|
|
|
363
|
-
${
|
|
364
|
-
${
|
|
365
|
-
${
|
|
366
|
-
${
|
|
367
|
-
${
|
|
368
|
-
${colors_default.cyan("rari deploy render")} Setup Render deployment
|
|
369
|
-
${colors_default.cyan("rari help")} Show this help message
|
|
29
|
+
${h.bold(`Environment Variables:`)}
|
|
30
|
+
${h.yellow(`PORT`)} Server port (default: 3000)
|
|
31
|
+
${h.yellow(`RSC_PORT`)} Alternative server port
|
|
32
|
+
${h.yellow(`NODE_ENV`)} Environment (default: production for start, development for dev)
|
|
33
|
+
${h.yellow(`RUST_LOG`)} Rust logging level (default: info)
|
|
370
34
|
|
|
371
|
-
${
|
|
372
|
-
${
|
|
373
|
-
${
|
|
374
|
-
${colors_default.yellow("NODE_ENV")} Environment (default: production for start, development for dev)
|
|
375
|
-
${colors_default.yellow("RUST_LOG")} Rust logging level (default: info)
|
|
35
|
+
${h.bold(`Examples:`)}
|
|
36
|
+
${h.gray(`# Start development server with Vite`)}
|
|
37
|
+
${h.cyan(`rari dev`)}
|
|
376
38
|
|
|
377
|
-
${
|
|
378
|
-
${
|
|
379
|
-
${colors_default.cyan("rari dev")}
|
|
39
|
+
${h.gray(`# Build for production`)}
|
|
40
|
+
${h.cyan(`rari build`)}
|
|
380
41
|
|
|
381
|
-
${
|
|
382
|
-
${
|
|
42
|
+
${h.gray(`# Start production server (default)`)}
|
|
43
|
+
${h.cyan(`rari start`)}
|
|
383
44
|
|
|
384
|
-
${
|
|
385
|
-
${
|
|
45
|
+
${h.gray(`# Start in development mode`)}
|
|
46
|
+
${h.cyan(`NODE_ENV=development rari start`)}
|
|
386
47
|
|
|
387
|
-
${
|
|
388
|
-
${
|
|
48
|
+
${h.gray(`# Start production server on port 8080`)}
|
|
49
|
+
${h.cyan(`PORT=8080 rari start`)}
|
|
389
50
|
|
|
390
|
-
${
|
|
391
|
-
${
|
|
51
|
+
${h.gray(`# Setup Railway deployment`)}
|
|
52
|
+
${h.cyan(`rari deploy railway`)}
|
|
392
53
|
|
|
393
|
-
${
|
|
394
|
-
${
|
|
54
|
+
${h.gray(`# Setup Render deployment`)}
|
|
55
|
+
${h.cyan(`rari deploy render`)}
|
|
395
56
|
|
|
396
|
-
${
|
|
397
|
-
${
|
|
57
|
+
${h.gray(`# Start with debug logging`)}
|
|
58
|
+
${h.cyan(`RUST_LOG=debug rari start`)}
|
|
398
59
|
|
|
399
|
-
|
|
400
|
-
${
|
|
401
|
-
|
|
402
|
-
${colors_default.bold("Deployment:")}
|
|
403
|
-
${colors_default.cyan("rari deploy railway")} Creates Railway deployment files
|
|
404
|
-
${colors_default.cyan("rari deploy render")} Creates Render deployment files
|
|
60
|
+
${h.bold(`Deployment:`)}
|
|
61
|
+
${h.cyan(`rari deploy railway`)} Creates Railway deployment files
|
|
62
|
+
${h.cyan(`rari deploy render`)} Creates Render deployment files
|
|
405
63
|
|
|
406
64
|
Platform deployment automatically detects the environment and configures:
|
|
407
65
|
- Host binding (0.0.0.0 for platforms, 127.0.0.1 for local)
|
|
408
66
|
- Port from platform's PORT environment variable
|
|
409
67
|
- Production mode optimization
|
|
410
68
|
|
|
411
|
-
${
|
|
69
|
+
${h.bold(`Binary Resolution:`)}
|
|
412
70
|
1. Platform-specific package (rari-{platform}-{arch})
|
|
413
71
|
2. Global binary in PATH
|
|
414
72
|
3. Install from source with Cargo
|
|
415
73
|
|
|
416
|
-
${
|
|
74
|
+
${h.bold(`Notes:`)}
|
|
417
75
|
- 'rari start' defaults to production mode unless NODE_ENV is set
|
|
418
76
|
- 'rari dev' runs in development mode with Vite hot reload
|
|
419
77
|
- 'rari build' cleans, type checks, and builds for production
|
|
@@ -421,36 +79,4 @@ ${colors_default.bold("Notes:")}
|
|
|
421
79
|
- Platform deployment is automatically detected and configured
|
|
422
80
|
- Use Ctrl+C to stop the server gracefully
|
|
423
81
|
|
|
424
|
-
`);
|
|
425
|
-
break;
|
|
426
|
-
case "dev":
|
|
427
|
-
await runViteDev();
|
|
428
|
-
break;
|
|
429
|
-
case "build":
|
|
430
|
-
await runViteBuild();
|
|
431
|
-
break;
|
|
432
|
-
case "start":
|
|
433
|
-
await startRustServer();
|
|
434
|
-
break;
|
|
435
|
-
case "deploy":
|
|
436
|
-
if (args[0] === "railway") await deployToRailway();
|
|
437
|
-
else if (args[0] === "render") await deployToRender();
|
|
438
|
-
else {
|
|
439
|
-
logError("Unknown deployment target. Available: railway, render");
|
|
440
|
-
process.exit(1);
|
|
441
|
-
}
|
|
442
|
-
break;
|
|
443
|
-
default:
|
|
444
|
-
console.error(`${colors_default.bold("Unknown command:")} ${command}`);
|
|
445
|
-
console.warn(`Run "${colors_default.cyan("rari help")}" for available commands`);
|
|
446
|
-
process.exit(1);
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
if (process.argv[1] && (import.meta.url === `file://${process.argv[1]}` || import.meta.url.endsWith("/dist/cli.mjs") && process.argv[1].includes("cli.mjs"))) main().catch((error) => {
|
|
450
|
-
logError(`CLI Error: ${error.message}`);
|
|
451
|
-
console.error(error);
|
|
452
|
-
process.exit(1);
|
|
453
|
-
});
|
|
454
|
-
|
|
455
|
-
//#endregion
|
|
456
|
-
export { getBinaryPath as n, getInstallationInstructions as r, colors_default as t };
|
|
82
|
+
`);break;case`dev`:await O();break;case`build`:await D();break;case`start`:await k();break;case`deploy`:v[0]===`railway`?await A():v[0]===`render`?await j():(x(`Unknown deployment target. Available: railway, render`),a.exit(1));break;default:console.error(`${h.bold(`Unknown command:`)} ${_}`),console.warn(`Run "${h.cyan(`rari help`)}" for available commands`),a.exit(1)}}a.argv[1]&&(import.meta.url===`file://${a.argv[1]}`||import.meta.url.endsWith(`/dist/cli.mjs`)&&a.argv[1].includes(`cli.mjs`))&&M().catch(e=>{x(`CLI Error: ${e.message}`),console.error(e),a.exit(1)});export{l as n,u as r,h as t};
|
package/dist/client.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { A as extractMetadata, C as RouteSegment, D as StaticParamsResult, E as ServerPropsResult, M as extractServerPropsWithCache, N as extractStaticParams, O as clearPropsCache, P as hasServerSideDataFetching, T as MetadataResult, _ as GenerateStaticParams, a as LoadingSpinner, b as LoadingEntry, c as createErrorBoundary, d as AppRouteEntry, f as AppRouteManifest, g as GenerateMetadata, h as ErrorProps, i as HttpRuntimeClient, j as extractServerProps, k as clearPropsCacheForComponent, l as createHttpRuntimeClient, m as ErrorEntry, n as DefaultLoading, o as NotFound, p as AppRouteMatch, r as ErrorBoundary, s as RuntimeClient, t as DefaultError, u as createLoadingBoundary, v as LayoutEntry, w as RouteSegmentType, x as NotFoundEntry } from "./runtime-client-BV3qaQrj.mjs";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { Component, ErrorInfo, ReactNode } from "react";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/router/ClientRouter.d.ts
|
|
7
7
|
interface ClientRouterProps {
|
|
@@ -11,7 +11,7 @@ interface ClientRouterProps {
|
|
|
11
11
|
declare function ClientRouter({
|
|
12
12
|
children,
|
|
13
13
|
initialRoute
|
|
14
|
-
}: ClientRouterProps):
|
|
14
|
+
}: ClientRouterProps): react_jsx_runtime0.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/router/LayoutErrorBoundary.d.ts
|
|
17
17
|
interface LayoutErrorBoundaryProps {
|
|
@@ -77,7 +77,7 @@ declare function NavigationErrorOverlay({
|
|
|
77
77
|
onDismiss,
|
|
78
78
|
retryCount,
|
|
79
79
|
maxRetries
|
|
80
|
-
}: NavigationErrorOverlayProps):
|
|
80
|
+
}: NavigationErrorOverlayProps): react_jsx_runtime0.JSX.Element;
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region src/router/route-info-types.d.ts
|
|
83
83
|
interface RouteInfoRequest {
|