rari 0.16.0 → 0.17.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/api-routes-Dc2tv31o.mjs +1 -0
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +39 -39
- package/dist/constants-CRK2JRKf.mjs +1 -0
- package/dist/{define-CRafeveU.mjs → define-B_ozIapW.mjs} +1 -1
- package/dist/dist-paths-C4EV064W.mjs +1 -0
- package/dist/{execute-B1z6YRUF.mjs → execute-CbhDMAQ3.mjs} +1 -1
- package/dist/feed-NrJzjZyg.mjs +10 -0
- package/dist/form-state-DAygOjc8.mjs +1 -0
- package/dist/get-client-component-s7qprTUa.mjs +1 -0
- package/dist/headers.d.mts +1 -1
- package/dist/image/static.d.mts +1 -0
- package/dist/image/static.mjs +1 -0
- package/dist/image.d.mts +4 -35
- package/dist/image.mjs +1 -1
- package/dist/index.d.mts +6 -1
- package/dist/index.mjs +1 -1
- package/dist/mdx/define.mjs +1 -1
- package/dist/mdx.mjs +1 -1
- package/dist/navigation-transition-store-CSKrbtbK.mjs +1 -0
- package/dist/path-CTEC1xmy.mjs +1 -0
- package/dist/preload-modules-Dv_GzGCm.mjs +2 -0
- package/dist/proxy/RariResponse.mjs +1 -1
- package/dist/proxy/runtime-executor.mjs +1 -1
- package/dist/regex-constants-DzXwNGh2.mjs +1 -0
- package/dist/{robots-B1bFAd4J.mjs → robots-BOPIkPcN.mjs} +1 -1
- package/dist/router-Cl4J7j1A.mjs +1 -0
- package/dist/router.d.mts +8 -5
- package/dist/router.mjs +1 -1
- package/dist/{rsc-vite-build-Cpu5suGN.mjs → rsc-vite-build-CSnu8C3P.mjs} +1 -1
- package/dist/runtime/AppRouterProvider.mjs +1 -1
- package/dist/runtime/ClientRouter.mjs +4 -4
- package/dist/runtime/call-server.mjs +1 -1
- package/dist/runtime/entry-client.d.mts +1 -1
- package/dist/runtime/entry-client.mjs +3 -3
- package/dist/runtime/flight-router-state.d.mts +1 -0
- package/dist/runtime/flight-router-state.mjs +1 -1
- package/dist/runtime/merge-flight-refresh.d.mts +4 -0
- package/dist/runtime/merge-flight-refresh.mjs +1 -1
- package/dist/runtime/rsc-client-runtime.d.mts +1 -1
- package/dist/runtime/rsc-client-runtime.mjs +1 -1
- package/dist/serialize-router-state-uOGGpmBr.mjs +1 -0
- package/dist/sitemap--bdIkWl5.mjs +13 -0
- package/dist/static-modules-DBL6iFbg.d.mts +61 -0
- package/dist/{types-Q-x_0kVB.d.mts → types-C8N3Hc8I.d.mts} +1 -0
- package/dist/{types-xTbuE-Js.d.mts → types-DfSnnFaF.d.mts} +3 -1
- package/dist/vite.d.mts +3 -1
- package/dist/vite.mjs +141 -197
- package/dist/{xml-EW5iM39h.mjs → xml-DPsk9WTz.mjs} +1 -1
- package/package.json +20 -17
- package/dist/api-routes-ChRr3O5-.mjs +0 -1
- package/dist/constants-BFdy-wPN.mjs +0 -1
- package/dist/feed-uUGeOZmR.mjs +0 -10
- package/dist/form-state-DZJs9bve.mjs +0 -1
- package/dist/get-client-component-DU5z65us.mjs +0 -1
- package/dist/path-C74rvUep.mjs +0 -1
- package/dist/preload-modules-1i2BJqux.mjs +0 -2
- package/dist/prompt-uaCPq0_A-BW0EkzOD.mjs +0 -45
- package/dist/regex-constants-DBMCJbMw.mjs +0 -1
- package/dist/router-D6X8JHst.mjs +0 -1
- package/dist/runtime/LoadingErrorBoundary.d.mts +0 -10
- package/dist/runtime/LoadingErrorBoundary.mjs +0 -1
- 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{
|
|
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
|
-
${
|
|
4
|
-
${
|
|
5
|
-
${
|
|
6
|
-
${
|
|
7
|
-
${
|
|
8
|
-
${
|
|
9
|
-
${
|
|
10
|
-
${
|
|
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
|
-
${
|
|
13
|
-
${
|
|
14
|
-
${
|
|
15
|
-
${
|
|
16
|
-
${
|
|
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
|
-
${
|
|
19
|
-
${
|
|
20
|
-
${
|
|
18
|
+
${S(`bold`,`Examples:`)}
|
|
19
|
+
${S(`gray`,`# Start development server with Vite`)}
|
|
20
|
+
${S(`cyan`,`rari dev`)}
|
|
21
21
|
|
|
22
|
-
${
|
|
23
|
-
${
|
|
22
|
+
${S(`gray`,`# Build for production`)}
|
|
23
|
+
${S(`cyan`,`rari build`)}
|
|
24
24
|
|
|
25
|
-
${
|
|
26
|
-
${
|
|
25
|
+
${S(`gray`,`# Clean dist folder`)}
|
|
26
|
+
${S(`cyan`,`rari clean`)}
|
|
27
27
|
|
|
28
|
-
${
|
|
29
|
-
${
|
|
28
|
+
${S(`gray`,`# Start production server (default)`)}
|
|
29
|
+
${S(`cyan`,`rari start`)}
|
|
30
30
|
|
|
31
|
-
${
|
|
32
|
-
${
|
|
31
|
+
${S(`gray`,`# Start in development mode`)}
|
|
32
|
+
${S(`cyan`,`NODE_ENV=development rari start`)}
|
|
33
33
|
|
|
34
|
-
${
|
|
35
|
-
${
|
|
34
|
+
${S(`gray`,`# Start production server on port 8080`)}
|
|
35
|
+
${S(`cyan`,`PORT=8080 rari start`)}
|
|
36
36
|
|
|
37
|
-
${
|
|
38
|
-
${
|
|
37
|
+
${S(`gray`,`# Setup Railway deployment`)}
|
|
38
|
+
${S(`cyan`,`rari deploy railway`)}
|
|
39
39
|
|
|
40
|
-
${
|
|
41
|
-
${
|
|
40
|
+
${S(`gray`,`# Setup Render deployment`)}
|
|
41
|
+
${S(`cyan`,`rari deploy render`)}
|
|
42
42
|
|
|
43
|
-
${
|
|
44
|
-
${
|
|
43
|
+
${S(`gray`,`# Start with debug logging`)}
|
|
44
|
+
${S(`cyan`,`RUST_LOG=debug rari start`)}
|
|
45
45
|
|
|
46
|
-
${
|
|
47
|
-
${
|
|
48
|
-
${
|
|
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
|
-
${
|
|
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
|
-
${
|
|
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
|
|
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-
|
|
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-
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,r){let i=!0,a=/* @__PURE__ */ new Set;for(let n of r.keys())if(!a.has(n)){a.add(n);try{t(e,r,n)}catch{i=!1}}for(let t of e.elements)try{n(t,a)}catch{i=!1}return i}function t(e,t,n){let r=t.getAll(n).filter(e=>typeof e==`string`),i=new Set(r),a=e.elements.namedItem(n);if(a instanceof RadioNodeList){a.forEach(e=>{e instanceof HTMLInputElement&&(e.type===`radio`||e.type===`checkbox`?e.checked=i.has(e.value):r.length===1&&(e.value=r[0]))});return}if(a instanceof HTMLSelectElement&&a.multiple){for(let e of a.options)e.selected=i.has(e.value);return}(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement||a instanceof HTMLSelectElement)&&(a instanceof HTMLInputElement&&(a.type===`checkbox`||a.type===`radio`)?a.checked=i.has(a.value):r.length>0&&(a.value=r[0]))}function n(e,t){if(e instanceof HTMLInputElement&&(e.type===`checkbox`||e.type===`radio`)){e.name!==``&&!t.has(e.name)&&(e.checked=!1);return}if(e instanceof HTMLSelectElement&&e.multiple){if(e.name===``||t.has(e.name))return;for(let t of e.options)t.selected=!1}}function r(){let e=/* @__PURE__ */ new Map;return typeof document>`u`||document.querySelectorAll(`form`).forEach((t,n)=>{e.set(`form-${n}`,new FormData(t))}),e}function i(t){typeof document<`u`&&document.querySelectorAll(`form`).forEach((n,r)=>{let i=t.get(`form-${r}`);i&&e(n,i)})}export{r as n,i as r,e as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as e,u as t,v as n,w as r}from"./type-guards-BJXKlA6x.mjs";import{o as i}from"./path-CTEC1xmy.mjs";import{n as a,r as o,t as s}from"./rari-global-5vGzhToD.mjs";import*as c from"react";function l(e){return e.startsWith(`./`)?[e,e.slice(2)]:[e,`./${e}`]}function u(e){let t=i(e),n=/* @__PURE__ */ new Set([t]),r=t.indexOf(`/src/`);r!==-1&&n.add(t.slice(r+1));let a=t.indexOf(`/components/`);return a!==-1&&n.add(t.slice(a+1)),[...n]}function d(e,t){if(t!==void 0)return t;let n=e.exportName;if(n!=null&&n!==``)return n}function f(e,t){let n=i(e),r=i(t);return!!(n===r||r.includes(`/`)&&n.endsWith(`/${r}`)||n.includes(`/`)&&r.endsWith(`/${n}`))}function p(e,t,n){for(let r of u(e))for(let e of l(r)){let r=Object.values(n).find(t=>typeof t.path!=`string`||t.path===``?!1:f(t.path,e));if(r)return{info:r,exportName:d(r,t)}}return null}function m(e){return e.loading=!0,e.loadPromise=e.loader().then(t=>(e.component=t,e.registered=!0,e.loading=!1,t)).catch(t=>{throw console.error(`[rari] Failed to load component ${e.id}:`,t),e.loading=!1,e.loadError=t,e.loadPromise=void 0,t}),e.loadPromise}async function h(e,t){return e.component==null?e.loadPromise?(await e.loadPromise,g(e,t)):e.loader?await m(e)==null?null:g(e,t):null:g(e,t)}function g(t,r){let i=t.component;if(i==null)return null;if(e(i))return i;if(!n(i))return null;if(r==null||r===``||r==="default")return i.default??i;if(r in i)return i[r];let a=i.default;return n(a)&&r in a?a[r]:null}function _(e){let t=i(e);return t===e?[t]:[t,e]}function v(e){let t=o(),n=a(),r=s(),c=i(e),l=y(e,t);if(l!=null)return l;let u=c.indexOf(`#`),d=u===-1?c:c.slice(0,u),f=u===-1?void 0:c.slice(u+1);return b(e,f,t)??x(e,d,f,t,n,r)??p(d,f,t)}function y(e,t){for(let n of _(e)){if(!(n in t))continue;let e=t[n],r=n.indexOf(`#`);return{info:e,exportName:d(e,r===-1?void 0:n.slice(r+1))}}return null}function b(e,t,n){for(let r of _(e)){let e=r.indexOf(`#`),i=e===-1?r:r.slice(0,e);if(i in n)return{info:n[i],exportName:d(n[i],t)}}return null}function x(e,t,n,r,a,o){let s=i(e)===e?[t]:[t,e.includes(`#`)?e.slice(0,e.indexOf(`#`)):e];for(let e of s){let t=S(e,n,r,a);if(t!=null)return t;let i=C(e,n,r,o);if(i!=null)return i}return null}function S(e,t,n,r){for(let i of l(e)){if(!(i in r))continue;let e=r[i];if(e!==``&&e in n)return{info:n[e],exportName:d(n[e],t)}}return null}function C(e,t,n,r){if(!(e in r))return null;let i=r[e];return i===``||!(i in n)?null:{info:n[i],exportName:d(n[i],t)}}function w(e){return e.component!=null||e.loader==null?e.loadPromise:e.loadError==null?e.loadPromise?e.loadPromise:m(e):Promise.reject(r(e.loadError))}function T(t,r,i){let a=d(t,i),o=g({...t,component:r},a);if(o==null)return n(r)&&(`default`in r||`__esModule`in r)?r:e(r)?{default:r,[a!=null&&a!==``?a:`default`]:r,__esModule:!0}:r;let s=a!=null&&a!==``?a:`default`;return{...n(r)?r:{},default:o,[s]:o,__esModule:!0}}function E(e,n,i,a){let o=d(e,a),s=o!=null&&o!==``?o:`default`,l=a=>{if(e.loadError!=null)throw r(e.loadError);if(e.component!=null){let r=g(e,o);if(r==null)throw Error(`[rari] Lazy component "${n}" loaded but export "${s}" is missing`);if(!t(r))throw Error(`[rari] Lazy component "${n}" export "${s}" is not a component`);return c.createElement(r,a)}throw i};return l.displayName=`Lazy(${e.displayName??e.exportName??n})`,{default:l,[s]:l,__esModule:!0}}function D(e){let t=v(e);if(!t)return import.meta.env.DEV&&console.warn(`[rari] __rari_rsc_require__: component "${e}" not found in registry`),{};let{info:n,exportName:r}=t;if(n.component!=null)return T(n,n.component,r);if(n.loader){if(n.loadError!=null)return E(n,e,Promise.resolve(),r);let t=w(n);if(t)return E(n,e,t,r)}return{}}async function O(e){let t=v(e);return t?h(t.info,t.exportName):null}function k(){if(typeof window>`u`)return;let e=e=>{let t=o(),n=i(e);return e in t?t[e]:n in t?t[n]:Object.values(t).find(t=>t.path===e||t.path===n)};Reflect.set(globalThis,`__rari_get_script_filename__`,t=>{let n=e(t)?.path??i(t),r=i(n);if(r.startsWith(`http://`)||r.startsWith(`https://`))return r;let a=r.indexOf(`/src/`);return a===-1?r.startsWith(`src/`)?`/${r}`:r.startsWith(`/`)?r:`/${r}`:r.slice(a)}),Reflect.set(globalThis,`__rari_chunk_load__`,async t=>{let n=e(t);if(n&&n.component==null&&n.loader!=null){let e=w(n);if(e)return e.then(()=>void 0)}return n?.loadPromise==null?Promise.resolve():n.loadPromise.then(()=>void 0)})}export{k as n,D as r,O as t};
|
package/dist/headers.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as ReadonlyHeaders, n as CookieStore, r as ReadonlyCookie, t as CookieOptions } from "./types-
|
|
1
|
+
import { i as ReadonlyHeaders, n as CookieStore, r as ReadonlyCookie, t as CookieOptions } from "./types-C8N3Hc8I.mjs";
|
|
2
2
|
//#region src/headers.d.ts
|
|
3
3
|
export declare function cookies(): Promise<CookieStore>;
|
|
4
4
|
export declare function headers(): Promise<ReadonlyHeaders>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../static-modules-DBL6iFbg.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
package/dist/image.d.mts
CHANGED
|
@@ -1,44 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
interface ImageProps {
|
|
3
|
-
readonly src: string | StaticImageData;
|
|
4
|
-
readonly alt: string;
|
|
5
|
-
readonly width?: number;
|
|
6
|
-
readonly height?: number;
|
|
7
|
-
readonly quality?: number;
|
|
8
|
-
readonly preload?: boolean;
|
|
9
|
-
readonly loading?: 'lazy' | 'eager';
|
|
10
|
-
readonly placeholder?: 'blur' | 'empty';
|
|
11
|
-
readonly blurDataURL?: string;
|
|
12
|
-
readonly fill?: boolean;
|
|
13
|
-
readonly sizes?: string;
|
|
14
|
-
readonly style?: React.CSSProperties;
|
|
15
|
-
readonly className?: string;
|
|
16
|
-
readonly onLoad?: (event: React.SyntheticEvent<HTMLImageElement>) => void;
|
|
17
|
-
readonly onError?: (event: React.SyntheticEvent<HTMLImageElement>) => void;
|
|
18
|
-
readonly unoptimized?: boolean;
|
|
19
|
-
readonly loader?: (props: Readonly<{
|
|
20
|
-
src: string;
|
|
21
|
-
width: number;
|
|
22
|
-
quality: number;
|
|
23
|
-
}>) => string;
|
|
24
|
-
readonly overrideSrc?: string;
|
|
25
|
-
readonly decoding?: 'async' | 'sync' | 'auto';
|
|
26
|
-
}
|
|
27
|
-
interface StaticImageData {
|
|
28
|
-
readonly src: string;
|
|
29
|
-
readonly height: number;
|
|
30
|
-
readonly width: number;
|
|
31
|
-
readonly blurDataURL?: string;
|
|
32
|
-
}
|
|
33
|
-
declare function Image$1({ src, alt, width, height, quality, preload, loading, placeholder, blurDataURL, fill, sizes, style, className, onLoad, onError, unoptimized, loader, overrideSrc, decoding }: ImageProps): import("react").JSX.Element;
|
|
34
|
-
//#endregion
|
|
1
|
+
import { n as ImageProps, r as StaticImageData, t as Image$1 } from "./static-modules-DBL6iFbg.mjs";
|
|
35
2
|
//#region src/image/constants.d.ts
|
|
36
|
-
type ImageFormat = 'avif' | 'webp';
|
|
3
|
+
type ImageFormat = 'avif' | 'webp' | 'jpeg';
|
|
37
4
|
export declare const DEFAULT_DEVICE_SIZES: number[];
|
|
38
5
|
export declare const DEFAULT_IMAGE_SIZES: number[];
|
|
39
6
|
export declare const DEFAULT_FORMATS: ImageFormat[];
|
|
40
7
|
export declare const DEFAULT_QUALITY_LEVELS: number[];
|
|
41
8
|
export declare const DEFAULT_MINIMUM_CACHE_TTL = 60;
|
|
9
|
+
export declare const BLUR_PLACEHOLDER_WIDTH = 16;
|
|
10
|
+
export declare const BLUR_PLACEHOLDER_QUALITY = 25;
|
|
42
11
|
//#endregion
|
|
43
12
|
//#region src/image/index.d.ts
|
|
44
13
|
declare const Image: typeof Image$1 & {
|
package/dist/image.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,i as t,n,r,t as
|
|
1
|
+
import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./constants-CRK2JRKf.mjs";import{useCallback as s,useEffect as c,useRef as l,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";const p=Math.max(...i);function m(e){return Math.min(Math.max(e,1),p)}function h(e){let{fill:t,width:n,intrinsicWidth:r}=e;if(t)return{defaultWidth:p,widths:i};let a=n!=null&&n!==0?n:r!=null&&r!==0?r:void 0;if(a==null)return{defaultWidth:1920,widths:i};let o=m(a);return{defaultWidth:o,widths:[o]}}function g(e,t,n,r){let i=new URLSearchParams;return i.set(`url`,e),i.set(`w`,t.toString()),i.set(`q`,n.toString()),r&&i.set(`f`,r),`/_rari/image?${i}`}function _(e,t,n,r,i){return e==null?g(t,n,r,i):e({src:t,width:n,quality:r})}function v(e,t,n){return e!=null&&e!==``?e:t||n?`100vw`:void 0}function y(e){let{link:t,finalSrc:n,defaultWidth:r,quality:a,preloadSizes:o,loader:s,preloadFormat:c,preloadAvifOnly:l}=e,u=i.map(e=>`${_(s,n,e,a,c)} ${e}w`).join(`, `);t.href=_(s,n,r,a,c),t.setAttribute(`imagesrcset`,u),o!=null&&t.setAttribute(`imagesizes`,o),l&&(t.type=`image/avif`)}function b(e){let{link:n,finalSrc:r,defaultWidth:i,quality:a,sizes:o,loader:s,unoptimized:c,fill:l,shouldUseSrcSet:u}=e,d=u&&!c,f=v(o,d,l),p=s==null&&t.length===1&&t[0]===`avif`,m=p?`avif`:void 0;if(c){n.href=s==null?r:s({src:r,width:i,quality:a});return}if(d){y({link:n,finalSrc:r,defaultWidth:i,quality:a,preloadSizes:f,loader:s,preloadFormat:m,preloadAvifOnly:p});return}n.href=_(s,r,i,a),f!=null&&n.setAttribute(`imagesizes`,f)}function x(e,t,n){if(e!=null&&e!==0)return e;if(!t&&n!=null&&n!==0)return n}function ee(e){let{src:t,width:n,height:r,fill:i,placeholder:a,blurDataURL:o,loader:s}=e,c=typeof t==`string`?t:t.src,l=typeof t==`string`?void 0:t.width,u=typeof t==`string`?void 0:t.height,d=o!=null&&o!==``?o:typeof t==`string`?void 0:t.blurDataURL,f=d!=null&&d!==``?d:void 0,p=a===`blur`&&f==null?_(s,c,16,25,`jpeg`):void 0;return{imgSrc:c,imgWidth:x(n,i,l),imgHeight:x(r,i,u),inlineBlurDataURL:f,optimizerBlurUrl:p}}function S(e){return{position:`absolute`,inset:0,width:`100%`,height:`100%`,objectFit:e?.objectFit??`cover`}}function C(e){return{backgroundImage:`url("${e}")`,backgroundSize:`cover`,backgroundPosition:`center`,filter:`blur(20px)`,transition:`filter 0.3s ease-out`}}function te(e){let{style:t,fill:n,placeholder:r,imgBlurDataURL:i,blurComplete:a}=e,o=r===`blur`&&i!=null&&i!==``&&!a,s=r===`blur`&&a;return{...t,...n?S(t):null,...o?C(i):null,...s?{filter:`none`,transition:`filter 0.3s ease-out`}:null}}function ne(e,t,n,r){return e==null?t:e({src:t,width:n,quality:r})}function w(e,t,n,r,i){return e==null?n.map(e=>`${g(t,e,r,i)} ${e}w`).join(`, `):n.map(n=>`${e({src:t,width:n,quality:r})} ${n}w`).join(`, `)}function T(e,t){return e!=null&&e!==``?e:t?`100vw`:void 0}function E({imgRef:e,src:t,srcSet:n,sizes:r,alt:i,showAltText:a,fill:o,imgWidth:s,imgHeight:c,shouldPreload:l,loading:u,imgDecoding:f,placeholder:p,onLoad:m,handleLoad:h,handleError:g,imgStyle:_,className:v}){return/* @__PURE__ */ d(`img`,{ref:e,src:t,srcSet:n,sizes:r,alt:a?i:``,width:o?void 0:s,height:o?void 0:c,loading:l?`eager`:u,fetchPriority:l?`high`:`auto`,decoding:f,onLoad:p===`blur`||m!=null?h:void 0,onError:g,style:_,className:v})}function D({src:e,alt:n,width:r,height:i,quality:a=75,preload:o=!1,loading:p=`lazy`,placeholder:m=`empty`,blurDataURL:g,fill:v=!1,sizes:y,style:x,className:S,onLoad:C,onError:D,unoptimized:O=!1,loader:k,overrideSrc:A,decoding:re}){let{imgSrc:ie,imgWidth:j,imgHeight:M,inlineBlurDataURL:N,optimizerBlurUrl:P}=ee({src:e,width:r,height:i,fill:v,placeholder:m,blurDataURL:g,loader:k}),F=A!=null&&A!==``?A:ie,I=o,ae=re??(o?`sync`:`async`),L=h({fill:v,width:r,intrinsicWidth:typeof e==`string`?void 0:e.width}),R=L.widths.length>1||L.widths[0]!==L.defaultWidth,z=I||p===`eager`,[B,V]=u(!1),[H,U]=u(!1),[W,G]=u(F),[K,q]=u(z),J=l(null),Y=l(C),oe=l(null);W!==F&&(G(F),q(z),V(!1));let X=N??(z||K?P:void 0);c(()=>{Y.current=C},[C]);let se=s(e=>{let t=e.currentTarget;t.src&&t.complete&&(m===`blur`&&V(!0),Y.current&&Y.current(e))},[m]),ce=s(e=>{U(!0),m===`blur`&&V(!0),D&&D(e)},[m,D]);c(()=>{if(!I)return;let e=document.createElement(`link`);return e.rel=`preload`,e.as=`image`,b({link:e,finalSrc:F,defaultWidth:L.defaultWidth,quality:a,sizes:y,loader:k,unoptimized:O,fill:v,shouldUseSrcSet:R}),document.head.appendChild(e),()=>{e.parentNode===document.head&&document.head.removeChild(e)}},[I,F,L.defaultWidth,a,y,k,O,v,R]),c(()=>{if(z||K||P==null||m!==`blur`)return;let e=J.current;if(!e)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(q(!0),t.disconnect())},{rootMargin:`200px`});return t.observe(e),()=>{t.disconnect()}},[z,K,P,m,F]);let Z={imgRef:J,alt:n,showAltText:H,fill:v,imgWidth:j,imgHeight:M,shouldPreload:I,loading:p,imgDecoding:ae,placeholder:m,onLoad:C,handleLoad:se,handleError:ce,imgStyle:te({style:x,fill:v,placeholder:m,imgBlurDataURL:X,blurComplete:B}),className:S};if(O)return E({...Z,src:ne(k,F,L.defaultWidth,a)});let Q=T(y,R),le=_(k,F,L.defaultWidth,a),$=E({...Z,src:le,srcSet:R?w(k,F,L.widths,a):void 0,sizes:R?Q:void 0});return R?/* @__PURE__ */ f(`picture`,{ref:oe,children:[t.includes(`avif`)&&/* @__PURE__ */ d(`source`,{type:`image/avif`,srcSet:w(k,F,L.widths,a,`avif`),sizes:Q}),t.includes(`webp`)&&/* @__PURE__ */ d(`source`,{type:`image/webp`,srcSet:w(k,F,L.widths,a,`webp`),sizes:Q}),$]}):$}const O=typeof window>`u`,k=D;O&&(k.$$typeof=Symbol.for(`react.client.reference`),k.$$id=`rari/image#Image`);export{o as BLUR_PLACEHOLDER_QUALITY,n as BLUR_PLACEHOLDER_WIDTH,i as DEFAULT_DEVICE_SIZES,t as DEFAULT_FORMATS,e as DEFAULT_IMAGE_SIZES,r as DEFAULT_MINIMUM_CACHE_TTL,a as DEFAULT_QUALITY_LEVELS,k as Image};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import { D as RouteContext, E as ApiRouteHandlers, O as RouteHandler, T as ApiResponse, _ as LayoutProps, a as Sitemap, c as SitemapVideo, i as RobotsRule, n as FeedEntry, o as SitemapEntry, p as ErrorProps, r as Robots, s as SitemapImage, t as Feed, x as PageProps, y as Metadata } from "./types-
|
|
1
|
+
import { D as RouteContext, E as ApiRouteHandlers, O as RouteHandler, T as ApiResponse, _ as LayoutProps, a as Sitemap, c as SitemapVideo, i as RobotsRule, n as FeedEntry, o as SitemapEntry, p as ErrorProps, r as Robots, s as SitemapImage, t as Feed, x as PageProps, y as Metadata } from "./types-DfSnnFaF.mjs";
|
|
2
2
|
import { c as RariURL, d as RariResponse, n as ProxyConfig, r as ProxyFunction, s as RariFetchEvent } from "./types-DAdRjhuk.mjs";
|
|
3
3
|
import { RariRequest } from "./proxy/RariRequest.mjs";
|
|
4
|
+
//#region src/navigation/not-found.d.ts
|
|
5
|
+
export declare const NOT_FOUND_ERROR_DIGEST = "RARI_NOT_FOUND";
|
|
6
|
+
export declare function isNotFoundError(error: unknown): boolean;
|
|
7
|
+
export declare function notFound(): never;
|
|
8
|
+
//#endregion
|
|
4
9
|
export { ApiResponse, type ApiRouteHandlers, type ErrorProps, type Feed, type FeedEntry, type LayoutProps, type Metadata, type PageProps, type ProxyConfig, type ProxyFunction, type RariFetchEvent, RariRequest, RariResponse, type RariURL, type Robots, type RobotsRule, type RouteContext, type RouteHandler, type Sitemap, type SitemapEntry, type SitemapImage, type SitemapVideo };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{i as e,n as t,r as n,t as r}from"./api-routes-Dc2tv31o.mjs";import{RariRequest as i}from"./proxy/RariRequest.mjs";import{RariResponse as a}from"./proxy/RariResponse.mjs";export{r as ApiResponse,t as NOT_FOUND_ERROR_DIGEST,i as RariRequest,a as RariResponse,n as isNotFoundError,e as notFound};
|
package/dist/mdx/define.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"../define-
|
|
1
|
+
import{t as e}from"../define-B_ozIapW.mjs";export{e as defineMdxComponents};
|
package/dist/mdx.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./names-CLmM0CPi.mjs";import{t}from"./define-
|
|
1
|
+
import{t as e}from"./names-CLmM0CPi.mjs";import{t}from"./define-B_ozIapW.mjs";import{createElement as n}from"react";import{evaluate as r}from"@mdx-js/mdx";import{getMDXComponents as i}from"rari/mdx/registry";async function a(e,t){let{components:a={},...o}=t,s=await r(e,o),c=s.default,l=i(e);function u(e){let t={...l,...a,...e.components};return n(c,{...e,components:t})}return{...s,default:u}}export{t as defineMdxComponents,a as evaluate,e as scanMdxComponentNames};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=0,t=`/`,n=``,r=!1,i={generation:e,pathname:t,search:n},a=null;const o=/* @__PURE__ */ new Set;function s(){i={generation:e,pathname:t,search:n}}function c(){s();for(let e of o)e()}function l(){r||typeof window>`u`||(r=!0,t=window.location.pathname,n=window.location.search,s())}function u(){return l(),i}function d(e=`/`){return a?.pathname===e&&a.search===``&&a.generation===0||(a={generation:0,pathname:e,search:``}),a}function f(e){return o.add(e),()=>{o.delete(e)}}function p(i){r=!0,e+=1,t=i.pathname,n=i.search??``,c()}function m(){if(typeof window>`u`)return;r=!0;let e=window.location.pathname,i=window.location.search;(e!==t||i!==n)&&(t=e,n=i,c())}export{m as a,f as i,u as n,p as r,d as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as e,t}from"./regex-constants-DzXwNGh2.mjs";function n(t,n={}){let{collapseSlashes:r=!1,ensureLeadingSlash:i=!0}=n,a=r?t.replace(e,`/`):t;if(a===`/`)return`/`;if(!a)return i?`/`:``;for(;a.endsWith(`/`)&&a.length>1;)a=a.slice(0,-1);return i&&!a.startsWith(`/`)&&(a=`/${a}`),a}function r(e,t=`http://localhost`){let n=URL.parse(e,t);if(n!=null)return n.pathname;let r=e.split(/[?#]/,1)[0]??e;return r===``?`/`:r}function i(e){return e.replace(t,`/`)}function a(){return globalThis.process?.platform===`win32`}function o(e,t){let n=i(e),r=i(t).replace(/\/+$/,``);return a()&&(n=n.toLowerCase(),r=r.toLowerCase()),n===r||n.startsWith(`${r}/`)}function s(e,t=`assets`){let n=(e??t).replace(/^\/+|\/+$/g,``);return n===``?t:n}const c=/\?.*$/;function l(e){return e.replace(c,``)}export{l as a,r as i,s as n,i as o,n as r,o as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{f as e}from"./type-guards-BJXKlA6x.mjs";import{o as t}from"./path-CTEC1xmy.mjs";import{t as n}from"./get-client-component-s7qprTUa.mjs";import*as r from"react";function i(e){return r.isValidElement(e)||e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function a(e){if(!Array.isArray(e))return e;let t=e;return t.length===1&&r.isValidElement(t[0])?t[0]:t.length>0&&t.every(i)?r.createElement(r.Fragment,null,...t):e}async function o(e,t){let r=s(e,t);r.size!==0&&await Promise.all(Array.from(r,async e=>{try{if(await n(e)==null){console.warn(`[rari] Failed to preload component: ${e}`);return}t?.add(e)}catch(t){console.error(`[rari] Error preloading component ${e}:`,t)}}))}function s(e,t){let n=/* @__PURE__ */ new Set;for(let r of e.split(`
|
|
2
|
+
`)){let e=c(r);e!=null&&(!t||!t.has(e))&&n.add(e)}return n}function c(n){let r=n.trim();if(!r)return null;let i=r.indexOf(`:`);if(i===-1)return null;let a=r.substring(i+1);if(!a.startsWith(`I`))return null;try{let n=JSON.parse(a.substring(1));if(!e(n))return null;let r=n[0];if(!r.includes(`/`)&&r.startsWith(`$`))return null;let i=typeof n[2]==`string`?n[2]:void 0,o=t(r);return o.includes(`#`)?o:i!=null&&i!==``&&i!=="default"?`${o}#${i}`:o}catch{return null}}export{a as n,o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=class{cookies;constructor(){this.cookies=/* @__PURE__ */ new Map}get(e){let t=this.cookies.get(e);if(t)return{name:t.name,value:t.value,path:t.options?.path}}getAll(){return Array.from(this.cookies.values(),e=>({name:e.name,value:e.value,path:e.options?.path}))}set(e,t,n){if(typeof e==`string`)this.cookies.set(e,{name:e,value:t,options:n});else{let{name:t,value:n,...r}=e;this.cookies.set(t,{name:t,value:n,options:r})}}delete(e){this.cookies.delete(e)}toSetCookieHeaders(){return Array.from(this.cookies.values(),e=>{let t=`${e.name}=${e.value}
|
|
1
|
+
var e=class{cookies;constructor(){this.cookies=/* @__PURE__ */ new Map}get(e){let t=this.cookies.get(e);if(t)return{name:t.name,value:t.value,path:t.options?.path}}getAll(){return Array.from(this.cookies.values(),e=>({name:e.name,value:e.value,path:e.options?.path}))}set(e,t,n){if(typeof e==`string`)this.cookies.set(e,{name:e,value:t,options:n});else{let{name:t,value:n,...r}=e;this.cookies.set(t,{name:t,value:n,options:r})}}delete(e){this.cookies.delete(e)}toSetCookieHeaders(){return Array.from(this.cookies.values(),e=>t(e))}};function t(e){let t=`${e.name}=${e.value}`,n=e.options;return n==null?t:(n.path!=null&&n.path!==``&&(t+=`; Path=${n.path}`),n.domain!=null&&n.domain!==``&&(t+=`; Domain=${n.domain}`),n.maxAge!=null&&(t+=`; Max-Age=${n.maxAge}`),n.expires&&(t+=`; Expires=${n.expires.toUTCString()}`),n.httpOnly&&(t+=`; HttpOnly`),n.secure&&(t+=`; Secure`),n.sameSite&&(t+=`; SameSite=${n.sameSite}`),t)}var n=class t extends Response{cookies;constructor(t,n){super(t,n),this.cookies=new e}static next(e){let n=new t(null,{status:200,headers:{"x-rari-proxy-continue":`true`}});return e?.request?.headers&&(e.request.headers instanceof Headers?e.request.headers:new Headers(e.request.headers)).forEach((e,t)=>{n.headers.set(`x-rari-proxy-request-${t}`,e)}),n}static redirect(e,n){return new t(null,{status:n!=null&&n!==0?n:307,headers:{Location:e.toString()}})}static rewrite(e){return new t(null,{status:200,headers:{"x-rari-proxy-rewrite":e.toString()}})}static json(e,n){let r=JSON.stringify(e),i=new Headers(n?.headers);return i.set(`Content-Type`,`application/json`),new t(r,{...n,headers:i})}};export{n as RariResponse};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as e,v as t}from"../type-guards-BJXKlA6x.mjs";import{r as n}from"../path-
|
|
1
|
+
import{m as e,v as t}from"../type-guards-BJXKlA6x.mjs";import{r as n}from"../path-CTEC1xmy.mjs";const r={collapseSlashes:!0,ensureLeadingSlash:!1},i=/:(\w+)([?*+]?)|\*/g,a=/[\\+?(){}]/g,o=/[?#]/g,s=/* @__PURE__ */ new Map;function c(e){return e.replace(o,e=>encodeURIComponent(e))}function l(e){return c(e).replace(a,`\\$&`)}function u(e){let t=[],n=``,r=0;for(let a of e.matchAll(i)){let i=a.index;n+=l(e.slice(r,i));let o=a[0];if(o===`*`)n+=`*`;else{let e=a[1],r=a[2];t.push(e),n+=`:${e}${r}`}r=i+o.length}return n+=l(e.slice(r)),{pathname:n,paramNames:t}}function d(e){let t=n(e,r),i=s.get(t);if(i)return i;let{pathname:a,paramNames:o}=u(t),c={urlPattern:new URLPattern({pathname:a}),paramNames:o};return s.set(t,c),c}function f(e,t){let i=c(n(e,r));return d(t).urlPattern.exec({pathname:i})}
|
|
2
2
|
/* v8 ignore start - requires complex RariRequest mocking */
|
|
3
3
|
function p(e,t){return e.headers.get(t)}function m(e,t){return e.rariUrl.searchParams.get(t)}function h(e,t){let n=e.cookies.get(t);return n?n.value:null}function g(e,t){return e.rariUrl.hostname===t?e.rariUrl.hostname:null}function _(e,t){switch(t.type){case`header`:return p(e,t.key);case`query`:return m(e,t.key);case`cookie`:return h(e,t.key);case`host`:return g(e,t.key);default:throw Error(`Unknown condition type: ${t.type}`)}}function v(e,t){let n=_(e,t);return!(n===null||t.value!==void 0&&n!==t.value)}function y(e,t){let n=_(e,t);return n===null||t.value!==void 0&&n!==t.value}function b(e,t){if(t.has){for(let n of t.has)if(!v(e,n))return!1}if(t.missing){for(let n of t.missing)if(!y(e,n))return!1}return!0}
|
|
4
4
|
/* v8 ignore stop */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=/\.(?:tsx?|jsx?)$/,t=/^[A-Z]:\\/i,n=/\\/g,r=/[/\\]/,i=/\/{2,}/g,a=/^src\//,o={AMPERSAND:/&/g,LT:/</g,GT:/>/g,QUOTE:/"/g,APOS:/'/g},s=/[^\w/-]/g,c=/export\s+(?:function|const|class)\s+(\w+)/,l=/export\s+(?:default\s+)?(?:async\s+)?(?:function|class)[\s{(]/,u=/export\s+default\s+(?:(?:async\s+)?\(|(?:async\s+)?[a-zA-Z_$][\w$]*\s*=>)/,d=/export\s+(?:const|let|var)\s+[a-zA-Z_$][\w$]*(?:\s*:[^;]*[^;=\s])?\s*=\s*(?:async\s+)?(?:function[\s*(]|\([^)]*\)\s*=>|[a-zA-Z_$][\w$]*\s*=>)/,f=/\.[^.]*$/,p=/['"]/g;export{l as a,o as c,p as d,a as f,u as i,i as l,t as m,s as n,c as o,e as p,d as r,f as s,n as t,r as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{v as e}from"./type-guards-BJXKlA6x.mjs";import{i as t,n,r,t as i}from"./execute-
|
|
1
|
+
import{v as e}from"./type-guards-BJXKlA6x.mjs";import{i as t,n,r,t as i}from"./execute-CbhDMAQ3.mjs";import{promises as a}from"node:fs";import o from"node:path";function s(t){return e(t)&&t.rules!=null}async function c(e){if(typeof e==`function`){let t=e(),n=t instanceof Promise?await t:t;if(!s(n))throw Error(`Robots default export must resolve to a robots object`);return n}if(!s(e))throw Error(`Robots default export must be a robots object`);return e}function l(e){return typeof e==`string`?e===``?[`*`]:[e]:e==null?[`*`]:[...e]}function u(e){return e===void 0?[]:typeof e==`string`?e===``?[]:[e]:[...e].filter(e=>e!==``)}function d(e){let t=[],n=l(e.userAgent);for(let r of n){t.push(`User-Agent: ${r}`);let n=u(e.allow);for(let e of n)t.push(`Allow: ${e}`);let i=u(e.disallow);for(let e of i)t.push(`Disallow: ${e}`);e.crawlDelay!==void 0&&t.push(`Crawl-delay: ${e.crawlDelay}`),t.push(``)}return t}function f(e){return e==null||e===``?[]:[`Host: ${e}`,``]}function p(e){return u(e).map(e=>`Sitemap: ${e}`)}function m(e){let t=[],n=Array.isArray(e.rules)?e.rules:[e.rules];for(let e of n)t.push(...d(e));return t.push(...f(e.host)),t.push(...p(e.sitemap)),t.join(`
|
|
2
2
|
`)}
|
|
3
3
|
/* v8 ignore start - file system operations, better tested in integration/e2e */
|
|
4
4
|
async function h(e,n=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`]){return t({appDir:e,staticFileName:`robots.txt`,dynamicBaseName:`robots`,extensions:n,rethrowNonEnoent:!0})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./navigate-DuyUa6qD.mjs";import{i as t,v as n}from"./type-guards-BJXKlA6x.mjs";import{a as r,i,n as a,t as o}from"./navigation-transition-store-CSKrbtbK.mjs";import{c as s}from"react/compiler-runtime";import{createContext as c,use as l,useEffect as u,useRef as d,useSyncExternalStore as f}from"react";import{jsx as p}from"react/jsx-runtime";const m=c(null);function h(){let e=l(m);if(!e)throw Error(`useRouter must be used within a RouterProvider`);return e}function g(){return h().pathname}function _(){return h().searchParams}function v(){return f(i,b,y)}function y(){return o().generation}function b(){return a().generation}function x(e){return n(e)&&typeof e.navigate==`function`}function S(n){let r=s(17),{children:c,initialPathname:l}=n,h;r[0]===l?h=r[1]:(h=()=>o(l),r[0]=l,r[1]=h);let g=f(i,a,h),_=d(null),v;r[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=[],r[2]=v):v=r[2],u(D,v);let y,b;r[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{let n=e();n&&(_.current=n);let r=e=>{let n=t(e,x);n&&(_.current=n.navigate)},i=()=>{_.current=null};return window.addEventListener(`rari:register-navigate`,r),window.addEventListener(`rari:deregister-navigate`,i),()=>{window.removeEventListener(`rari:register-navigate`,r),window.removeEventListener(`rari:deregister-navigate`,i)}},b=[],r[3]=y,r[4]=b):(y=r[3],b=r[4]),u(y,b);let S;r[5]===g.search?S=r[6]:(S=g.search.startsWith(`?`)?g.search.slice(1):g.search,r[5]=g.search,r[6]=S);let O;r[7]===S?O=r[8]:(O=new URLSearchParams(S),r[7]=S,r[8]=O);let k=O,A,j;r[9]===Symbol.for(`react.memo_cache_sentinel`)?(A=async(e,t)=>{_.current?await _.current(e,t):(console.warn(`[rari] Router not ready, falling back to window.location`),window.location.href=e)},j=async(e,t)=>{_.current?await _.current(e,{...t,replace:!0}):(console.warn(`[rari] Router not ready, falling back to window.location`),window.location.replace(e))},r[9]=A,r[10]=j):(A=r[9],j=r[10]);let M;r[11]!==k||r[12]!==g.pathname?(M={pathname:g.pathname,searchParams:k,push:A,replace:j,back:E,forward:T,refresh:w,prefetch:C},r[11]=k,r[12]=g.pathname,r[13]=M):M=r[13];let N=M,P;return r[14]!==c||r[15]!==N?(P=/* @__PURE__ */ p(m,{value:N,children:c}),r[14]=c,r[15]=N,r[16]=P):P=r[16],P}async function C(e){try{let t=new URL(e,window.location.origin);await fetch(t.pathname+t.search,{headers:{Accept:`text/x-component`},priority:`low`})}catch(e){console.warn(`[rari] Prefetch failed:`,e)}}function w(){window.dispatchEvent(new CustomEvent(`rari:app-router-rerender`))}function T(){window.history.forward()}function E(){window.history.back()}function D(){r()}export{v as a,_ as i,g as n,h as r,S as t};
|
package/dist/router.d.mts
CHANGED
|
@@ -8,6 +8,13 @@ interface NavigationOptions {
|
|
|
8
8
|
//#region src/router/navigation/navigate.d.ts
|
|
9
9
|
export declare function navigate(href: string, options?: NavigationOptions): Promise<void>;
|
|
10
10
|
//#endregion
|
|
11
|
+
//#region src/router/navigation/router-provider.d.ts
|
|
12
|
+
interface RouterProviderProps {
|
|
13
|
+
readonly children: React.ReactNode;
|
|
14
|
+
readonly initialPathname: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function RouterProvider({ children, initialPathname }: RouterProviderProps): import("react").JSX.Element;
|
|
17
|
+
//#endregion
|
|
11
18
|
//#region src/router/navigation/use-router.d.ts
|
|
12
19
|
interface RouterContextValue {
|
|
13
20
|
pathname: string;
|
|
@@ -19,13 +26,9 @@ interface RouterContextValue {
|
|
|
19
26
|
refresh: () => void;
|
|
20
27
|
prefetch: (href: string) => Promise<void>;
|
|
21
28
|
}
|
|
22
|
-
interface RouterProviderProps {
|
|
23
|
-
readonly children: React.ReactNode;
|
|
24
|
-
readonly initialPathname: string;
|
|
25
|
-
}
|
|
26
|
-
export declare function RouterProvider({ children, initialPathname }: RouterProviderProps): import("react").JSX.Element;
|
|
27
29
|
export declare function useRouter(): RouterContextValue;
|
|
28
30
|
export declare function usePathname(): string;
|
|
29
31
|
export declare function useSearchParams(): URLSearchParams;
|
|
32
|
+
export declare function useViewTransitionKey(): number;
|
|
30
33
|
//#endregion
|
|
31
34
|
export type { NavigationOptions, RouterContextValue, RouterProviderProps };
|
package/dist/router.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./navigate-DuyUa6qD.mjs";import{
|
|
1
|
+
import{r as e}from"./navigate-DuyUa6qD.mjs";import{a as t,i as n,n as r,r as i,t as a}from"./router-Cl4J7j1A.mjs";export{a as RouterProvider,e as navigate,r as usePathname,i as useRouter,n as useSearchParams,t as useViewTransitionKey};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{v as e}from"./type-guards-BJXKlA6x.mjs";import{o as t}from"./path-
|
|
1
|
+
import{v as e}from"./type-guards-BJXKlA6x.mjs";import{o as t}from"./path-CTEC1xmy.mjs";import{Buffer as n}from"node:buffer";import r from"node:fs";import i from"node:path";import{createBuilder as a}from"vite-plus";const o=/* @__PURE__ */ new Map,s=/* @__PURE__ */ new Map;function c(e){let t=o.get(e);return t===void 0?(t=r.existsSync(e),o.set(e,t),t):t}function l(e){let t=s.get(e);if(t!==void 0)return t;try{t=r.statSync(e).isDirectory()}catch{t=!1}return s.set(e,t),t}function u(){o.clear(),s.clear()}function d(e,t){let n=null;for(let r of t)if(r!==``&&e.endsWith(r)&&(n??=c(e),n&&!l(e)))return e;for(let n of t){let t=`${e}${n}`;if(c(t)&&!l(t))return t}return null}function f(e,t){if(c(e)){if(!l(e))return null;for(let n of t){let t=i.join(e,`index${n}`);if(c(t))return t}}return null}const p=[`.tsx`,`.jsx`,`.ts`,`.js`];function m(e,t,n={},r=p){let a=e;for(let[t,r]of Object.entries(n))if(e.startsWith(`${t}/`)){a=e.replace(t,r);break}else if(e===t){a=r;break}let o=i.resolve(i.dirname(t),a),s=d(o,r);if(s!=null&&s!==``)return s;let c=f(o,r);return c!=null&&c!==``?c:`${o}.tsx`}const h=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`];function g(e,t=h){return d(e,t)??f(e,t)}const _=/* @__PURE__ */ new WeakMap;function v(e){let t=_.get(e);return t||(t=Object.entries(e).sort((e,t)=>t[0].length-e[0].length),_.set(e,t),t)}function y(e,t,n){if(typeof e!=`string`)throw TypeError(`Expected source to be a string, but received ${typeof e}`);if(typeof t!=`object`||Array.isArray(t))throw TypeError(`Expected aliases to be a plain object, but received ${Array.isArray(t)?`array`:typeof t}`);if(Object.getPrototypeOf(t)!==Object.prototype&&Object.getPrototypeOf(t)!==null)throw TypeError(`Expected aliases to be a plain object, but received ${t.constructor.name||`object with custom prototype`}`);if(typeof n!=`string`)throw TypeError(`Expected projectRoot to be a string, but received ${typeof n}`);let r=v(t);for(let[t,a]of r)if(e.startsWith(`${t}/`)||e===t){let r=e.slice(t.length).replace(/^\/+/,``),o=i.join(a,r);return i.isAbsolute(o)?o:i.resolve(n,o)}return null}const b=/^node:/,x=/* @__PURE__ */ new Map;function S(e){let t=i.resolve(e.root);return JSON.stringify({root:t,configFile:e.configFile??null,logLevel:e.logLevel??null})}async function C(e){let t=typeof e==`string`?{root:e}:e,n=i.resolve(t.root),r=S(t),o=x.get(r);return o??(o=a({root:n,...t.configFile===void 0?{}:{configFile:t.configFile},...t.logLevel==null?{}:{logLevel:t.logLevel},oxc:{jsx:{development:!1}}}).catch(e=>{throw x.delete(r),e}),x.set(r,o)),o}function w(t){let n=i.resolve(t);for(let t of x.keys()){let r=JSON.parse(t);e(r)&&r.root===n&&x.delete(t)}}function T(e){return typeof e==`object`&&!!e&&`type`in e}function E(e){let t=Array.isArray(e)?e:[e],n=[];for(let e of t){if(typeof e!=`object`||!e)continue;let t=e.output;if(Array.isArray(t))for(let e of t)T(e)&&n.push(e)}return n}function D(e){return typeof e==`string`?e:n.from(e).toString(`utf8`)}function O(e){return e==null?[]:e instanceof Set?[...e].map(e=>t(String(e))):Array.isArray(e)?e.map(e=>t(String(e))):[]}const k=[b,`react`,`react-dom`,`react/jsx-runtime`,`react/jsx-dev-runtime`,`react/compiler-runtime`,/^rari(?:\/|$)/,`react-server-dom-rari/server`],A=[b,`react`,`react-dom`,`react/jsx-runtime`,`react/jsx-dev-runtime`,`react/compiler-runtime`,/^rari(?:\/|$)/,`react-server-dom-webpack/client`,/^react-server-dom-webpack\//];function j(e){return{write:e.write,emptyOutDir:e.emptyOutDir,copyPublicDir:e.copyPublicDir,minify:e.minify,emitAssets:e.emitAssets,rolldownOptions:e.rolldownOptions}}function M(e,t){e.write=t.write,e.emptyOutDir=t.emptyOutDir,e.copyPublicDir=t.copyPublicDir,e.minify=t.minify,e.emitAssets=t.emitAssets,e.rolldownOptions=t.rolldownOptions}function N(e){let n=/* @__PURE__ */ new Map,r=[],i=/* @__PURE__ */ new Map,a=/* @__PURE__ */ new Map;for(let o of e){if(o.type===`asset`){let e=t(o.fileName);e.endsWith(`.css`)?n.set(e,D(o.source)):r.push({fileName:e,code:o.source});continue}let e=t(o.fileName);if(o.isEntry){let e=o.name;if(e==null||e===``)continue;i.set(e,{code:o.code,cssAssetSources:[]}),a.set(e,O(o.viteMetadata?.importedCss));continue}r.push({fileName:e,code:o.code})}return{cssByFileName:n,extraFiles:r,entryOutputs:i,entryCssFiles:a}}function P(e,t,n){for(let[r,i]of e){let a=(t.get(r)??[]).map(e=>n.get(e)).filter(e=>e!=null);if(a.length===0&&e.size===1&&n.size>0){e.set(r,{...i,cssAssetSources:[...n.values()]});continue}e.set(r,{...i,cssAssetSources:a})}}async function F(e){let t=/* @__PURE__ */ new Map,n=[];for(let r of e.entries){let i=await L({...e,entries:[r]});if(i==null)return null;for(let[e,n]of i.outputs)t.set(e,n);n.push(...i.extraFiles)}return{outputs:t,extraFiles:n}}function I(e,t,n,r){e.write=!1,e.emptyOutDir=!1,e.copyPublicDir=!1,e.emitAssets=!0,e.minify=t.minify===!0&&`oxc`,e.rolldownOptions={...r,input:n,platform:`node`,output:{format:`es`,entryFileNames:`[name].js`,chunkFileNames:`chunks/[name]-[hash].js`,assetFileNames:`assets/[name]-[hash][extname]`,...t.codeSplitting===!1?{codeSplitting:!1}:{}},external:[...t.environmentName===`ssr`?A:k]}}async function L(t){if(t.entries.length===0)return{outputs:/* @__PURE__ */ new Map,extraFiles:[]};if(t.codeSplitting===!1&&t.entries.length>1)return F(t);let n=t.viteBuilder.environments[t.environmentName];if(n==null)return null;await n.init();let r={};for(let e of t.entries)r[e.entryName]=e.filePath;let i=n.config.build,a=j(i),o=e(a.rolldownOptions)?{...a.rolldownOptions}:{},s=t.label??t.environmentName.toUpperCase();try{I(i,t,r,o);let e=E(await t.viteBuilder.build(n));if(e.length===0)return null;let a=N(e);P(a.entryOutputs,a.entryCssFiles,a.cssByFileName);for(let e of t.entries)if(!a.entryOutputs.has(e.entryName))return null;return{outputs:a.entryOutputs,extraFiles:a.extraFiles}}catch(e){return console.warn(`[rari] Vite ${s} environment build failed:`,e),null}finally{M(i,a)}}async function R(e){return L({viteBuilder:e.viteBuilder,environmentName:`rsc`,entries:e.entries.map(e=>({entryName:e.componentId,filePath:e.filePath})),minify:e.minify,codeSplitting:e.codeSplitting,label:`RSC`})}async function z(e){return L({viteBuilder:e.viteBuilder,environmentName:`ssr`,entries:e.entries,minify:e.minify??!1,label:`SSR`})}function B(e,n){return t(i.join(e,`${n}.js`))}async function V(e){let t=await a({configFile:!1,root:e.root,logLevel:`error`,plugins:[...e.plugins],define:{global:`globalThis`},resolve:{conditions:[`import`,`module`,`default`],extensions:[`.mjs`,`.js`,`.ts`,`.tsx`,`.jsx`],mainFields:[`module`,`main`]},environments:{ssr:{consumer:`server`,build:{write:!1,emptyOutDir:!1,copyPublicDir:!1,emitAssets:!1,minify:!1,cssMinify:!1,target:`esnext`,rolldownOptions:{input:{entry:e.virtualId},platform:`node`,external:e.external,output:{format:`es`,codeSplitting:!1,entryFileNames:`[name].js`}}}}},builder:{sharedPlugins:!0},css:{transformer:`lightningcss`}}),n=t.environments.ssr;await n.init();let r=E(await t.build(n)),i=r.find(e=>e.type===`chunk`&&e.isEntry)??r.find(e=>e.type===`chunk`);return i?.type===`chunk`?{code:i.code}:null}export{C as a,u as c,w as i,m as l,R as n,B as o,z as r,y as s,V as t,g as u};
|