rip-lang 3.13.1 → 3.13.3

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/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  </p>
10
10
 
11
11
  <p align="center">
12
- <a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.13.1-blue.svg" alt="Version"></a>
12
+ <a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.13.3-blue.svg" alt="Version"></a>
13
13
  <a href="#zero-dependencies"><img src="https://img.shields.io/badge/dependencies-ZERO-brightgreen.svg" alt="Dependencies"></a>
14
14
  <a href="#"><img src="https://img.shields.io/badge/tests-1%2C243%2F1%2C243-brightgreen.svg" alt="Tests"></a>
15
15
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License"></a>
@@ -529,10 +529,10 @@ globalThis.sleep ??= (ms) => new Promise(r => setTimeout(r, ms));
529
529
  globalThis.todo ??= (msg) => { throw new Error(msg || "Not implemented"); };
530
530
  globalThis.warn ??= console.warn;
531
531
  globalThis.zip ??= (...a) => a[0].map((_, i) => a.map(b => b[i]));
532
- `}function H1(){return new y({}).getReactiveRuntime()}function y1(){return new y({}).getComponentRuntime()}var L3="3.13.1",V3="2026-02-23@03:45:47GMT";if(typeof globalThis<"u"&&!globalThis.__rip)Function(H1())();var h3=($)=>{let W=$.match(/^[ \t]*(?=\S)/gm),A=Math.min(...(W||[]).map((U)=>U.length));return $.replace(RegExp(`^[ ]{${A}}`,"gm"),"").trim()};async function j3(){let $=document.querySelectorAll('script[type="text/rip"]');for(let W of $){if(W.hasAttribute("data-rip-processed"))continue;if(W.hasAttribute("data-name"))continue;try{let A;if(W.src){let u=await fetch(W.src);if(!u.ok){console.error(`Rip: failed to fetch ${W.src} (${u.status})`);continue}A=await u.text()}else A=h3(W.textContent);let U;try{U=d(A)}catch(u){console.error("Rip compile error:",u.message),console.error("Source:",A);continue}await(0,eval)(`(async()=>{
532
+ `}function H1(){return new y({}).getReactiveRuntime()}function y1(){return new y({}).getComponentRuntime()}var L3="3.13.3",V3="2026-02-23@04:30:03GMT";if(typeof globalThis<"u"&&!globalThis.__rip)Function(H1())();var h3=($)=>{let W=$.match(/^[ \t]*(?=\S)/gm),A=Math.min(...(W||[]).map((U)=>U.length));return $.replace(RegExp(`^[ ]{${A}}`,"gm"),"").trim()};async function j3(){let $=document.querySelectorAll('script[type="text/rip"]');for(let W of $){if(W.hasAttribute("data-rip-processed"))continue;if(W.hasAttribute("data-name"))continue;try{let A;if(W.src){let u=await fetch(W.src);if(!u.ok){console.error(`Rip: failed to fetch ${W.src} (${u.status})`);continue}A=await u.text()}else A=h3(W.textContent);let U;try{U=d(A)}catch(u){console.error("Rip compile error:",u.message),console.error("Source:",A);continue}await(0,eval)(`(async()=>{
533
533
  ${U}
534
534
  })()`),W.setAttribute("data-rip-processed","true")}catch(A){console.error("Rip runtime error:",A)}}}async function e($){for(let[Y,F]of Object.entries(e.modules))if($.includes(Y))return F;let W=await fetch($).then((Y)=>{if(!Y.ok)throw Error(`importRip: ${$} (${Y.status})`);return Y.text()}),A=d(W),U=`// ${$}
535
535
  `,u=new Blob([U+A],{type:"application/javascript"});return await import(URL.createObjectURL(u))}e.modules={};function C3($){try{let W=$.replace(/^/gm," "),U=d(`do ->
536
- ${W}`).replace(/^let\s+[^;]+;\s*\n\s*/m,"");U=U.replace(/^const\s+(\w+)\s*=/gm,"globalThis.$1 =");let u=(0,eval)(U);if(u&&typeof u.then==="function")return u.then((f)=>{if(f!==void 0)globalThis._=f;return f});if(u!==void 0)globalThis._=u;return u}catch(W){console.error("Rip compilation error:",W.message);return}}if(typeof globalThis<"u")globalThis.rip=C3,globalThis.importRip=e,globalThis.compileToJS=d,globalThis.__ripExports={compile:C1,compileToJS:d,formatSExpr:x,VERSION:L3,BUILD_DATE:V3,getReactiveRuntime:H1,getComponentRuntime:y1};async function y3(){if(globalThis.__ripLaunched)return;let $=e.modules?.["app.rip"];if(!$?.launch)return;let W=document.querySelector("script[data-hash], script[data-url]"),A=W?.getAttribute("data-url")||"",u={hash:W?.getAttribute("data-hash")!=="false"};await $.launch(A,u)}if(typeof document<"u")globalThis.__ripScriptsReady=new Promise(($)=>{let W=()=>j3().then(y3).then($);if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",()=>queueMicrotask(W));else queueMicrotask(W)});var G1={};v2(G1,{throttle:()=>g3,stash:()=>L2,setContext:()=>B2,raw:()=>V2,launch:()=>x3,isStash:()=>b3,hold:()=>l3,hasContext:()=>P2,getContext:()=>O2,delay:()=>h2,debounce:()=>v3,createRouter:()=>C2,createResource:()=>c3,createRenderer:()=>y2,createComponents:()=>j2});var K2,g1,u1,m,O1,w2,r,j,b1,F1,_1,l1,M2,D2,z1,q1,H2,z2,q2,c1,v1,O2,G2,x1,P2,Y1,k1,E2,I2,B2,N2,T2,m1,S2;globalThis.abort??=($)=>{if($)console.error($);process.exit(1)};globalThis.assert??=($,W)=>{if(!$)throw Error(W||"Assertion failed")};globalThis.exit??=($)=>process.exit($||0);globalThis.kind??=($)=>$!=null?($.constructor?.name||Object.prototype.toString.call($).slice(8,-1)).toLowerCase():String($);globalThis.noop??=()=>{};globalThis.p??=console.log;globalThis.pp??=($)=>{return console.log(JSON.stringify($,null,2)),$};globalThis.raise??=($,W)=>{throw W!==void 0?new $(W):Error($)};globalThis.rand??=($,W)=>W!==void 0?($>W&&([$,W]=[W,$]),Math.floor(Math.random()*(W-$+1)+$)):$?Math.floor(Math.random()*$):Math.random();globalThis.sleep??=($)=>new Promise((W)=>setTimeout(W,$));globalThis.todo??=($)=>{throw Error($||"Not implemented")};globalThis.warn??=console.warn;globalThis.zip??=(...$)=>$[0].map((W,A)=>$.map((U)=>U[A]));({__state:j,__effect:r,__batch:w2}=globalThis.__rip);({setContext:B2,getContext:O2,hasContext:P2}=globalThis.__ripComponent||{});O1=Symbol("stash");m=Symbol("signals");u1=Symbol("raw");g1=new WeakMap;b1=0;l1=j(0);x1=function($,W){let A;if(!$[m])Object.defineProperty($,m,{value:new Map,enumerable:!1});if(A=$[m].get(W),!A)A=j($[W]),$[m].set(W,A);return A};Y1=function($){return x1($,Symbol.for("keys"))};S2=function($){let W;if(!($!=null&&typeof $==="object"))return $;if($[O1])return $;if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Promise)return $;if(W=g1.get($),W)return W;return k1($)};k1=function($){let W,A;return A=null,W={get:function(U,u){let f,Y;if(u===O1)return!0;if(u===u1)return U;if(typeof u==="symbol")return Reflect.get(U,u);if(u==="length"&&Array.isArray(U))return Y1(U).value,U.length;if(u==="get")return function(F){return N2(A,F)};if(u==="set")return function(F,_){return T2(A,F,_)};if(f=x1(U,u),Y=f.value,Y!=null&&typeof Y==="object")return S2(Y);return Y},set:function(U,u,f){let Y,F;if(Y=U[u],F=f?.[u1]?f[u1]:f,F===Y)return!0;if(U[u]=F,U[m]?.has(u))U[m].get(u).value=F;if(Y===void 0&&F!==void 0)Y1(U).value=++b1;return l1.value++,!0},deleteProperty:function(U,u){let f;if(delete U[u],f=U[m]?.get(u),f)f.value=void 0;return Y1(U).value=++b1,!0},ownKeys:function(U){return Y1(U).value,Reflect.ownKeys(U)}},A=new Proxy($,W),g1.set($,A),A};K2=/([./][^./\[\s]+|\[[-+]?\d+\]|\[(?:"[^"]+"|'[^']+')\])/;m1=function($){let W,A,U,u,f;U=("."+$).split(K2),U.shift(),f=[],A=0;while(A<U.length){if(u=U[A],W=u[0],W==="."||W==="/")f.push(u.slice(1));else if(W==="[")if(u[1]==='"'||u[1]==="'")f.push(u.slice(2,-2));else f.push(+u.slice(1,-1));A+=2}return f};N2=function($,W){let A,U;U=m1(W),A=$;for(let u of U){if(A==null)return;A=A[u]}return A};T2=function($,W,A){let U,u;u=m1(W),U=$;for(let f=0;f<u.length;f++){let Y=u[f];if(f===u.length-1)U[Y]=A;else{if(U[Y]==null)U[Y]={};U=U[Y]}}return A};_1=function($){return typeof $==="function"?$:function(){return $.value}};F1=function($,W){let A;return A={read:function(){return $.read()}},Object.defineProperty(A,"value",{get:function(){return $.value},set:function(U){return W.value=U}}),A};q2=function($){let W;if(W=$.replace(/\.rip$/,""),W=W.replace(/\[\.\.\.(\w+)\]/g,"*$1"),W=W.replace(/\[(\w+)\]/g,":$1"),W==="index")return"/";return W=W.replace(/\/index$/,""),"/"+W};I2=function($){let W,A;return W=[],A=$.replace(/\*(\w+)/g,function(U,u){return W.push(u),"(.+)"}).replace(/:(\w+)/g,function(U,u){return W.push(u),"([^/]+)"}),{regex:new RegExp("^"+A+"$"),names:W}};E2=function($,W){let A,U;for(let u of W)if(A=$.match(u.regex.regex),A){U={};for(let f=0;f<u.regex.names.length;f++){let Y=u.regex.names[f];U[Y]=decodeURIComponent(A[f+1])}return{route:u,params:U}}return null};z1=function($,W="components"){let A,U,u,f,Y,F,_,X,R;_=[],u=new Map,A=$.listAll(W);for(let w of A){if(F=w.slice(W.length+1),!F.endsWith(".rip"))continue;if(f=F.split("/").pop(),f==="_layout.rip"){U=F==="_layout.rip"?"":F.slice(0,-12),u.set(U,w);continue}if(f.startsWith("_"))continue;if(X=F.split("/"),X.length>1&&X.some(function(H,Z){return Z<X.length-1&&H.startsWith("_")}))continue;R=q2(F),Y=I2(R),_.push({pattern:R,regex:Y,file:w,rel:F})}return _.sort(function(w,H){let Z,K,Q,M;if(K=(w.pattern.match(/:/g)||[]).length,M=(H.pattern.match(/:/g)||[]).length,Z=w.pattern.includes("*")?1:0,Q=H.pattern.includes("*")?1:0,Z!==Q)return Z-Q;if(K!==M)return K-M;return w.pattern.localeCompare(H.pattern)}),{routes:_,layouts:u}};G2=function($,W,A){let U,u,f,Y;if(U=[],f=$.slice(W.length+1),Y=f.split("/"),u="",A.has(""))U.push(A.get(""));for(let F=0;F<Y.length;F++){let _=Y[F];if(F===Y.length-1)break;if(u=u?u+"/"+_:_,A.has(u))U.push(A.get(u))}return U};M2=function($,W){if($.length!==W.length)return!1;for(let A=0;A<$.length;A++)if($[A]!==W[A])return!1;return!0};v1=function($){for(let W in $){let A=$[W];if(typeof A==="function"&&(A.prototype?.mount||A.prototype?._create))return A}return typeof $.default==="function"?$.default:void 0};c1=function($){let W;W={};for(let A in $){let U=$[A];if(typeof U==="function"&&(U.prototype?.mount||U.prototype?._create))W[A]=U}return W};z2=function($){let W;return W=$.split("/").pop().replace(/\.rip$/,""),W.replace(/(^|[-_])([a-z])/g,function(A,U,u){return u.toUpperCase()})};D2=function($,W="components"){let A,U,u;U={};for(let f of $.listAll(W)){if(!f.endsWith(".rip"))continue;if(A=f.split("/").pop(),A.startsWith("_"))continue;if(u=z2(f),U[u])console.warn(`[Rip] Component name collision: ${u} (${U[u]} vs ${f})`);U[u]=f}return U};q1=async function($,W,A=null,U=null,u=null){let f,Y,F,_,X,R,w,H,Z,K,Q,M;if(A&&U){if(Y=A.getCompiled(U),Y)return Y}if(w=W($),u){K={};for(let D in u.map){let q=u.map[D];if(q!==U&&w.includes(`new ${D}(`)){if(!u.classes[D]){if(_=A.read(q),_){F=await q1(_,W,A,q,u),X=c1(F);for(let O in X){let z=X[O];u.classes[O]=z}}}if(u.classes[D])K[D]=!0}}if(Z=Object.keys(K),Z.length>0)Q=`const {${Z.join(", ")}} = globalThis['${u.key}'];
536
+ ${W}`).replace(/^let\s+[^;]+;\s*\n\s*/m,"");U=U.replace(/^const\s+(\w+)\s*=/gm,"globalThis.$1 =");let u=(0,eval)(U);if(u&&typeof u.then==="function")return u.then((f)=>{if(f!==void 0)globalThis._=f;return f});if(u!==void 0)globalThis._=u;return u}catch(W){console.error("Rip compilation error:",W.message);return}}if(typeof globalThis<"u")globalThis.rip=C3,globalThis.importRip=e,globalThis.compileToJS=d,globalThis.__ripExports={compile:C1,compileToJS:d,formatSExpr:x,VERSION:L3,BUILD_DATE:V3,getReactiveRuntime:H1,getComponentRuntime:y1};async function y3(){if(globalThis.__ripLaunched)return;let $=e.modules?.["app.rip"];if(!$?.launch)return;let W=document.querySelector("script[data-hash], script[data-url]"),A=W?.getAttribute("data-url")||"",u={hash:W?.getAttribute("data-hash")!=="false"};if(W?.hasAttribute("data-url")&&!A)u.bundle=!1;await $.launch(A,u)}if(typeof document<"u")globalThis.__ripScriptsReady=new Promise(($)=>{let W=()=>j3().then(y3).then($);if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",()=>queueMicrotask(W));else queueMicrotask(W)});var G1={};v2(G1,{throttle:()=>g3,stash:()=>L2,setContext:()=>B2,raw:()=>V2,launch:()=>x3,isStash:()=>b3,hold:()=>l3,hasContext:()=>P2,getContext:()=>O2,delay:()=>h2,debounce:()=>v3,createRouter:()=>C2,createResource:()=>c3,createRenderer:()=>y2,createComponents:()=>j2});var K2,g1,u1,m,O1,w2,r,j,b1,F1,_1,l1,M2,D2,z1,q1,H2,z2,q2,c1,v1,O2,G2,x1,P2,Y1,k1,E2,I2,B2,N2,T2,m1,S2;globalThis.abort??=($)=>{if($)console.error($);process.exit(1)};globalThis.assert??=($,W)=>{if(!$)throw Error(W||"Assertion failed")};globalThis.exit??=($)=>process.exit($||0);globalThis.kind??=($)=>$!=null?($.constructor?.name||Object.prototype.toString.call($).slice(8,-1)).toLowerCase():String($);globalThis.noop??=()=>{};globalThis.p??=console.log;globalThis.pp??=($)=>{return console.log(JSON.stringify($,null,2)),$};globalThis.raise??=($,W)=>{throw W!==void 0?new $(W):Error($)};globalThis.rand??=($,W)=>W!==void 0?($>W&&([$,W]=[W,$]),Math.floor(Math.random()*(W-$+1)+$)):$?Math.floor(Math.random()*$):Math.random();globalThis.sleep??=($)=>new Promise((W)=>setTimeout(W,$));globalThis.todo??=($)=>{throw Error($||"Not implemented")};globalThis.warn??=console.warn;globalThis.zip??=(...$)=>$[0].map((W,A)=>$.map((U)=>U[A]));({__state:j,__effect:r,__batch:w2}=globalThis.__rip);({setContext:B2,getContext:O2,hasContext:P2}=globalThis.__ripComponent||{});O1=Symbol("stash");m=Symbol("signals");u1=Symbol("raw");g1=new WeakMap;b1=0;l1=j(0);x1=function($,W){let A;if(!$[m])Object.defineProperty($,m,{value:new Map,enumerable:!1});if(A=$[m].get(W),!A)A=j($[W]),$[m].set(W,A);return A};Y1=function($){return x1($,Symbol.for("keys"))};S2=function($){let W;if(!($!=null&&typeof $==="object"))return $;if($[O1])return $;if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Promise)return $;if(W=g1.get($),W)return W;return k1($)};k1=function($){let W,A;return A=null,W={get:function(U,u){let f,Y;if(u===O1)return!0;if(u===u1)return U;if(typeof u==="symbol")return Reflect.get(U,u);if(u==="length"&&Array.isArray(U))return Y1(U).value,U.length;if(u==="get")return function(F){return N2(A,F)};if(u==="set")return function(F,_){return T2(A,F,_)};if(f=x1(U,u),Y=f.value,Y!=null&&typeof Y==="object")return S2(Y);return Y},set:function(U,u,f){let Y,F;if(Y=U[u],F=f?.[u1]?f[u1]:f,F===Y)return!0;if(U[u]=F,U[m]?.has(u))U[m].get(u).value=F;if(Y===void 0&&F!==void 0)Y1(U).value=++b1;return l1.value++,!0},deleteProperty:function(U,u){let f;if(delete U[u],f=U[m]?.get(u),f)f.value=void 0;return Y1(U).value=++b1,!0},ownKeys:function(U){return Y1(U).value,Reflect.ownKeys(U)}},A=new Proxy($,W),g1.set($,A),A};K2=/([./][^./\[\s]+|\[[-+]?\d+\]|\[(?:"[^"]+"|'[^']+')\])/;m1=function($){let W,A,U,u,f;U=("."+$).split(K2),U.shift(),f=[],A=0;while(A<U.length){if(u=U[A],W=u[0],W==="."||W==="/")f.push(u.slice(1));else if(W==="[")if(u[1]==='"'||u[1]==="'")f.push(u.slice(2,-2));else f.push(+u.slice(1,-1));A+=2}return f};N2=function($,W){let A,U;U=m1(W),A=$;for(let u of U){if(A==null)return;A=A[u]}return A};T2=function($,W,A){let U,u;u=m1(W),U=$;for(let f=0;f<u.length;f++){let Y=u[f];if(f===u.length-1)U[Y]=A;else{if(U[Y]==null)U[Y]={};U=U[Y]}}return A};_1=function($){return typeof $==="function"?$:function(){return $.value}};F1=function($,W){let A;return A={read:function(){return $.read()}},Object.defineProperty(A,"value",{get:function(){return $.value},set:function(U){return W.value=U}}),A};q2=function($){let W;if(W=$.replace(/\.rip$/,""),W=W.replace(/\[\.\.\.(\w+)\]/g,"*$1"),W=W.replace(/\[(\w+)\]/g,":$1"),W==="index")return"/";return W=W.replace(/\/index$/,""),"/"+W};I2=function($){let W,A;return W=[],A=$.replace(/\*(\w+)/g,function(U,u){return W.push(u),"(.+)"}).replace(/:(\w+)/g,function(U,u){return W.push(u),"([^/]+)"}),{regex:new RegExp("^"+A+"$"),names:W}};E2=function($,W){let A,U;for(let u of W)if(A=$.match(u.regex.regex),A){U={};for(let f=0;f<u.regex.names.length;f++){let Y=u.regex.names[f];U[Y]=decodeURIComponent(A[f+1])}return{route:u,params:U}}return null};z1=function($,W="components"){let A,U,u,f,Y,F,_,X,R;_=[],u=new Map,A=$.listAll(W);for(let w of A){if(F=w.slice(W.length+1),!F.endsWith(".rip"))continue;if(f=F.split("/").pop(),f==="_layout.rip"){U=F==="_layout.rip"?"":F.slice(0,-12),u.set(U,w);continue}if(f.startsWith("_"))continue;if(X=F.split("/"),X.length>1&&X.some(function(H,Z){return Z<X.length-1&&H.startsWith("_")}))continue;R=q2(F),Y=I2(R),_.push({pattern:R,regex:Y,file:w,rel:F})}return _.sort(function(w,H){let Z,K,Q,M;if(K=(w.pattern.match(/:/g)||[]).length,M=(H.pattern.match(/:/g)||[]).length,Z=w.pattern.includes("*")?1:0,Q=H.pattern.includes("*")?1:0,Z!==Q)return Z-Q;if(K!==M)return K-M;return w.pattern.localeCompare(H.pattern)}),{routes:_,layouts:u}};G2=function($,W,A){let U,u,f,Y;if(U=[],f=$.slice(W.length+1),Y=f.split("/"),u="",A.has(""))U.push(A.get(""));for(let F=0;F<Y.length;F++){let _=Y[F];if(F===Y.length-1)break;if(u=u?u+"/"+_:_,A.has(u))U.push(A.get(u))}return U};M2=function($,W){if($.length!==W.length)return!1;for(let A=0;A<$.length;A++)if($[A]!==W[A])return!1;return!0};v1=function($){for(let W in $){let A=$[W];if(typeof A==="function"&&(A.prototype?.mount||A.prototype?._create))return A}return typeof $.default==="function"?$.default:void 0};c1=function($){let W;W={};for(let A in $){let U=$[A];if(typeof U==="function"&&(U.prototype?.mount||U.prototype?._create))W[A]=U}return W};z2=function($){let W;return W=$.split("/").pop().replace(/\.rip$/,""),W.replace(/(^|[-_])([a-z])/g,function(A,U,u){return u.toUpperCase()})};D2=function($,W="components"){let A,U,u;U={};for(let f of $.listAll(W)){if(!f.endsWith(".rip"))continue;if(A=f.split("/").pop(),A.startsWith("_"))continue;if(u=z2(f),U[u])console.warn(`[Rip] Component name collision: ${u} (${U[u]} vs ${f})`);U[u]=f}return U};q1=async function($,W,A=null,U=null,u=null){let f,Y,F,_,X,R,w,H,Z,K,Q,M;if(A&&U){if(Y=A.getCompiled(U),Y)return Y}if(w=W($),u){K={};for(let D in u.map){let q=u.map[D];if(q!==U&&w.includes(`new ${D}(`)){if(!u.classes[D]){if(_=A.read(q),_){F=await q1(_,W,A,q,u),X=c1(F);for(let O in X){let z=X[O];u.classes[O]=z}}}if(u.classes[D])K[D]=!0}}if(Z=Object.keys(K),Z.length>0)Q=`const {${Z.join(", ")}} = globalThis['${u.key}'];
537
537
  `,w=Q+w}if(R=U?`// ${U}
538
- `:"",f=new Blob([R+w],{type:"application/javascript"}),M=URL.createObjectURL(f),H=await import(M),u){X=c1(H);for(let D in X){let q=X[D];u.classes[D]=q}}if(A&&U)A.setCompiled(U,H);return H};H2=function($){let W,A,U;return U=1000,A=30000,W=function(){let u;return u=new EventSource($),u.addEventListener("connected",function(){return U=1000,console.log("[Rip] Hot reload connected")}),u.addEventListener("reload",function(){return console.log("[Rip] Reloading..."),location.reload()}),u.addEventListener("css",function(){for(let f of document.querySelectorAll('link[rel="stylesheet"]'))$=new URL(f.href),$.searchParams.set("_t",Date.now()),f.href=$.toString()}),u.onerror=function(){return u.close(),setTimeout(W,U),U=Math.min(U*2,A)}},W()};var L2=function($={}){return k1($)},V2=function($){return $?.[u1]?$[u1]:$},b3=function($){return $?.[O1]===!0},c3=function($,W={}){let A,U,u,f,Y;if(A=j(W.initial||null),u=j(!1),U=j(null),f=async function(){let F;return u.value=!0,U.value=null,(async()=>{try{return F=await $(),A.value=F}catch(_){return U.value=_}finally{u.value=!1}})()},Y={data:void 0,loading:void 0,error:void 0,refetch:f},Object.defineProperty(Y,"data",{get:function(){return A.value}}),Object.defineProperty(Y,"loading",{get:function(){return u.value}}),Object.defineProperty(Y,"error",{get:function(){return U.value}}),!W.lazy)f();return Y},h2=function($,W){let A,U;return A=_1(W),U=j(!!A()),r(function(){let u;if(A())return u=setTimeout(function(){return U.value=!0},$),function(){return clearTimeout(u)};else return U.value=!1}),typeof W!=="function"?F1(U,W):U},v3=function($,W){let A,U;return A=_1(W),U=j(A()),r(function(){let u,f;return f=A(),u=setTimeout(function(){return U.value=f},$),function(){return clearTimeout(u)}}),typeof W!=="function"?F1(U,W):U},g3=function($,W){let A,U,u;return A=_1(W),u=j(A()),U=0,r(function(){let f,Y,F,_;if(_=A(),f=Date.now(),Y=$-(f-U),Y<=0)return u.value=_,U=f;else return F=setTimeout(function(){return u.value=A(),U=Date.now()},Y),function(){return clearTimeout(F)}}),typeof W!=="function"?F1(u,W):u},l3=function($,W){let A,U;return A=_1(W),U=j(!!A()),r(function(){let u;if(A())return U.value=!0;else return u=setTimeout(function(){return U.value=!1},$),function(){return clearTimeout(u)}}),typeof W!=="function"?F1(U,W):U},j2=function(){let $,W,A,U;return W=new Map,U=[],$=new Map,A=function(u,f){for(let Y of U)Y(u,f)},{read:function(u){return W.get(u)},write:function(u,f){let Y;return Y=!W.has(u),W.set(u,f),$.delete(u),A(Y?"create":"change",u)},del:function(u){return W.delete(u),$.delete(u),A("delete",u)},exists:function(u){return W.has(u)},size:function(){return W.size},list:function(u=""){let f,Y,F;F=[],f=u?u+"/":"";for(let[_]of W)if(_.startsWith(f)){if(Y=_.slice(f.length),Y.includes("/"))continue;F.push(_)}return F},listAll:function(u=""){let f,Y;Y=[],f=u?u+"/":"";for(let[F]of W)if(F.startsWith(f))Y.push(F);return Y},load:function(u){for(let f in u){let Y=u[f];W.set(f,Y)}},watch:function(u){return U.push(u),function(){return U.splice(U.indexOf(u),1)}},getCompiled:function(u){return $.get(u)},setCompiled:function(u,f){return $.set(u,f)}}},C2=function($,W={}){let A,U,u,f,Y,F,_,X,R,w,H,Z,K,Q,M,D,q,O,z,E,P;if(q=W.root||"components",R=W.base||"",w=W.hash||!1,K=W.onError||null,z=function(J){return R&&J.startsWith(R)?J.slice(R.length)||"/":J},X=function(J){return R?R+J:J},M=function(){let J;if(w){if(J=location.hash.slice(1),!J)return"/";return J[0]==="/"?J:"/"+J}else return location.pathname+location.search+location.hash},P=function(J){return w?J==="/"?location.pathname:"#"+J.slice(1):X(J)},Y=j(z(w?M():location.pathname)),f=j({}),_=j(null),U=j([]),F=j({}),A=j(""),u=h2(100,j(!1)),E=z1($,q),H=new Set,$.watch(function(J,G){if(!G.startsWith(q+"/"))return;return E=z1($,q)}),D=function(J){let G,I,B,N,T;if(N=J.split("?")[0].split("#")[0],I=z(N),I=I[0]==="/"?I:"/"+I,B=J.split("?")[1]?.split("#")[0]||"",G=J.includes("#")?J.split("#")[1]:"",T=E2(I,E.routes),T){w2(function(){return Y.value=I,f.value=T.params,_.value=T.route,U.value=G2(T.route.file,q,E.layouts),F.value=Object.fromEntries(new URLSearchParams(B)),A.value=G});for(let L of H)L(O.current);return!0}if(K)K({status:404,path:I});return!1},Q=function(){return D(M())},typeof window<"u")window.addEventListener("popstate",Q);if(Z=function(J){let G,I,B;if(J.button!==0||J.metaKey||J.ctrlKey||J.shiftKey||J.altKey)return;I=J.target;while(I&&I.tagName!=="A")I=I.parentElement;if(!I?.href)return;if(B=new URL(I.href,location.origin),B.origin!==location.origin)return;if(I.target==="_blank"||I.hasAttribute("data-external"))return;return J.preventDefault(),G=w&&B.hash?B.hash.slice(1)||"/":B.pathname+B.search+B.hash,O.push(G)},typeof document<"u")document.addEventListener("click",Z);return O={push:function(J){return D(J)?history.pushState(null,"",P(Y.read())):void 0},replace:function(J){return D(J)?history.replaceState(null,"",P(Y.read())):void 0},back:function(){return history.back()},forward:function(){return history.forward()},current:void 0,path:void 0,params:void 0,route:void 0,layouts:void 0,query:void 0,hash:void 0,navigating:void 0,onNavigate:function(J){return H.add(J),function(){return H.delete(J)}},rebuild:function(){return E=z1($,q)},routes:void 0,init:function(){return D(M()),O},destroy:function(){if(typeof window<"u")window.removeEventListener("popstate",Q);if(typeof document<"u")document.removeEventListener("click",Z);return H.clear()}},Object.defineProperty(O,"current",{get:function(){return{path:Y.value,params:f.value,route:_.value,layouts:U.value,query:F.value,hash:A.value}}}),Object.defineProperty(O,"path",{get:function(){return Y.value}}),Object.defineProperty(O,"params",{get:function(){return f.value}}),Object.defineProperty(O,"route",{get:function(){return _.value}}),Object.defineProperty(O,"layouts",{get:function(){return U.value}}),Object.defineProperty(O,"query",{get:function(){return F.value}}),Object.defineProperty(O,"hash",{get:function(){return A.value}}),Object.defineProperty(O,"navigating",{get:function(){return u.value},set:function(J){return u.value=J}}),Object.defineProperty(O,"routes",{get:function(){return E.routes}}),O},y2=function($={}){let W,A,U,u,f,Y,F,_,X,R,w,H,Z,K,Q,M,D,q,O,z,E,P;if({router:z,app:W,components:f,resolver:O,compile:U,target:E,onError:D}=$,Y=typeof E==="string"?document.querySelector(E):E||document.getElementById("app"),!Y)Y=document.createElement("div"),Y.id="app",document.body.appendChild(Y);return Y.style.opacity="0",F=null,R=null,X=null,_=[],Z=[],Q=Y,H=0,w=null,u=new Map,K=$.cacheSize||10,A=function(){let J,G;if(F&&R){if(F.beforeUnmount)F.beforeUnmount();if(u.set(R,F),u.size>K){if(G=u.keys().next().value,J=u.get(G),J.unmounted)J.unmounted();u.delete(G)}return F=null,R=null}},P=function(){A();for(let J=Z.length-1;J>=0;J--){let G=Z[J];if(G.beforeUnmount)G.beforeUnmount();if(G.unmounted)G.unmounted();G._target?.remove()}return Z=[],Q=Y},f.watch(function(J,G){let I;if(u.has(G)){if(I=u.get(G),I.unmounted)I.unmounted();return u.delete(G)}}),M=async function(J){let G,I,B,N,T,L,h,c,Z1,P1,f1,n1,n,i1,R1,o,Q1,E1,C,p1,I1,a;if({route:C,params:o,layouts:c,query:E1}=J,!C)return;if(C.file===R&&JSON.stringify(o)===JSON.stringify(X))return;return X=o,N=++H,z.navigating=!0,(async()=>{try{if(I1=f.read(C.file),!I1){if(D)D({status:404,message:`File not found: ${C.file}`});z.navigating=!1;return}if(n1=await q1(I1,U,f,C.file,O),N!==H){z.navigating=!1;return}if(G=v1(n1),!G){if(D)D({status:500,message:`No component found in ${C.file}`});z.navigating=!1;return}if(f1=!M2(c,_),i1=F?._target,f1)P();else A();if(n=f1?Y:Q,f1&&c.length>0){Y.innerHTML="",n=Y;for(let v of c){if(P1=f.read(v),!P1)continue;if(Z1=await q1(P1,U,f,v,O),N!==H){z.navigating=!1;return}if(I=v1(Z1),!I)continue;if(L=new I({app:W,params:o,router:z}),L.beforeMount)L.beforeMount();a=document.createElement("div"),a.setAttribute("data-layout",v),n.appendChild(a),L.mount(a),Z.push(L),p1=a.querySelector("#content")||a,n=p1}_=[...c],Q=n}else if(f1)Y.innerHTML="",_=[],Q=Y;if(B=u.get(C.file),B)u.delete(C.file),n.appendChild(B._target),F=B,R=C.file;else{if(R1=document.createElement("div"),R1.setAttribute("data-component",C.file),n.appendChild(R1),h=new G({app:W,params:o,query:E1,router:z}),h.beforeMount)h.beforeMount();if(h.mount(R1),F=h,R=C.file,h.load)await h.load(o,E1)}return i1?.remove(),z.navigating=!1,Y.style.opacity==="0"?document.fonts.ready.then(function(){return requestAnimationFrame(function(){return Y.style.transition="opacity 150ms ease-in",Y.style.opacity="1"})}):void 0}catch(v){if(z.navigating=!1,Y.style.opacity="1",console.error(`Renderer: error mounting ${C.file}:`,v),D)D({status:500,message:v.message,error:v});T=!1;for(let B1=Z.length-1;B1>=0;B1--){let d1=Z[B1];if(d1.onError)try{d1.onError(v),T=!0;break}catch(b2){console.error("Renderer: error boundary failed:",b2)}}return(()=>{if(!T)return Q1=document.createElement("pre"),Q1.style.cssText="color:red;padding:1em",Q1.textContent=v.stack||v.message,Y.innerHTML="",Y.appendChild(Q1)})()}})()},q={start:function(){return w=r(function(){let J;return J=z.current,J.route?M(J):void 0}),z.init(),q},stop:function(){if(P(),w)w(),w=null;return Y.innerHTML=""},remount:function(){let J;return J=z.current,J.route?M(J):void 0},cache:u},q},x3=async function($="",W={}){let A,U,u,f,Y,F,_,X,R,w,H,Z,K,Q,M,D,q,O,z,E,P;if(globalThis.__ripLaunched=!0,typeof $==="object")W=$,$="";if($=$.replace(/\/+$/,""),P=W.target||"#app",R=W.compile||null,Q=W.persist||!1,Z=W.hash||!1,!R)R=globalThis?.compileToJS||null;if(typeof document<"u"&&!document.querySelector(P))H=document.createElement("div"),H.id=P.replace(/^#/,""),document.body.prepend(H);if(W.bundle)F=W.bundle;else if(W.components&&Array.isArray(W.components)){w={};for(let J of W.components)if(D=await fetch(J),D.ok)K=J.split("/").pop(),w[`components/${K}`]=await D.text();F={components:w,data:{}}}else if(typeof document<"u"&&document.querySelectorAll('script[type="text/rip"][data-name]').length>0){w={};for(let J of document.querySelectorAll('script[type="text/rip"][data-name]'))K=J.getAttribute("data-name"),K+=!K.endsWith(".rip")?".rip":void 0,w[`components/${K}`]=J.textContent;F={components:w,data:{}}}else{if(_=`${$}/bundle`,D=await fetch(_,{cache:"no-cache"}),!D.ok)throw Error(`launch: ${_} (${D.status})`);F=await D.json()}if(f=L2({components:{},routes:{},data:{}}),F.data)f.data=F.data;if(F.routes)f.routes=F.routes;if(Q&&typeof sessionStorage<"u"){u=`__rip_${$}`,U=Q==="local"?localStorage:sessionStorage;try{if(z=U.getItem(u),z){E=JSON.parse(z);for(let J in E){let G=E[J];f.data[J]=G}}}catch{}A=function(){return(()=>{try{return U.setItem(u,JSON.stringify(V2(f.data)))}catch{return null}})()},r(function(){let J;return l1.value,J=setTimeout(A,2000),function(){return clearTimeout(J)}}),window.addEventListener("beforeunload",A)}if(Y=j2(),F.components)Y.load(F.components);if(X=`__rip_${$.replace(/\//g,"_")||"app"}`,q={map:D2(Y),classes:{},key:X},typeof globalThis<"u")globalThis[X]=q.classes;if(f.data.title&&typeof document<"u")document.title=f.data.title;if(O=C2(Y,{root:"components",base:$,hash:Z,onError:function(J){return console.error(`[Rip] Error ${J.status}: ${J.message||J.path}`)}}),M=y2({router:O,app:f,components:Y,resolver:q,compile:R,target:P,onError:function(J){return console.error(`[Rip] ${J.message}`,J.error)}}),M.start(),F.data?.watch)H2(`${$}/watch`);if(typeof window<"u")window.app=f,window.__RIP__={app:f,components:Y,router:O,renderer:M,cache:M.cache,version:"0.3.0"};return{app:f,components:Y,router:O,renderer:M}};e.modules["app.rip"]=G1;for(let[$,W]of Object.entries(G1))if(typeof W==="function")globalThis[$]=W;export{C3 as rip,j3 as processRipScripts,s as parser,e as importRip,H1 as getReactiveRuntime,y1 as getComponentRuntime,x as formatSExpr,d as compileToJS,C1 as compile,L3 as VERSION,p as Lexer,D1 as Compiler,y as CodeGenerator,V3 as BUILD_DATE};
538
+ `:"",f=new Blob([R+w],{type:"application/javascript"}),M=URL.createObjectURL(f),H=await import(M),u){X=c1(H);for(let D in X){let q=X[D];u.classes[D]=q}}if(A&&U)A.setCompiled(U,H);return H};H2=function($){let W,A,U;return U=1000,A=30000,W=function(){let u;return u=new EventSource($),u.addEventListener("connected",function(){return U=1000,console.log("[Rip] Hot reload connected")}),u.addEventListener("reload",function(){return console.log("[Rip] Reloading..."),location.reload()}),u.addEventListener("css",function(){for(let f of document.querySelectorAll('link[rel="stylesheet"]'))$=new URL(f.href),$.searchParams.set("_t",Date.now()),f.href=$.toString()}),u.onerror=function(){return u.close(),setTimeout(W,U),U=Math.min(U*2,A)}},W()};var L2=function($={}){return k1($)},V2=function($){return $?.[u1]?$[u1]:$},b3=function($){return $?.[O1]===!0},c3=function($,W={}){let A,U,u,f,Y;if(A=j(W.initial||null),u=j(!1),U=j(null),f=async function(){let F;return u.value=!0,U.value=null,(async()=>{try{return F=await $(),A.value=F}catch(_){return U.value=_}finally{u.value=!1}})()},Y={data:void 0,loading:void 0,error:void 0,refetch:f},Object.defineProperty(Y,"data",{get:function(){return A.value}}),Object.defineProperty(Y,"loading",{get:function(){return u.value}}),Object.defineProperty(Y,"error",{get:function(){return U.value}}),!W.lazy)f();return Y},h2=function($,W){let A,U;return A=_1(W),U=j(!!A()),r(function(){let u;if(A())return u=setTimeout(function(){return U.value=!0},$),function(){return clearTimeout(u)};else return U.value=!1}),typeof W!=="function"?F1(U,W):U},v3=function($,W){let A,U;return A=_1(W),U=j(A()),r(function(){let u,f;return f=A(),u=setTimeout(function(){return U.value=f},$),function(){return clearTimeout(u)}}),typeof W!=="function"?F1(U,W):U},g3=function($,W){let A,U,u;return A=_1(W),u=j(A()),U=0,r(function(){let f,Y,F,_;if(_=A(),f=Date.now(),Y=$-(f-U),Y<=0)return u.value=_,U=f;else return F=setTimeout(function(){return u.value=A(),U=Date.now()},Y),function(){return clearTimeout(F)}}),typeof W!=="function"?F1(u,W):u},l3=function($,W){let A,U;return A=_1(W),U=j(!!A()),r(function(){let u;if(A())return U.value=!0;else return u=setTimeout(function(){return U.value=!1},$),function(){return clearTimeout(u)}}),typeof W!=="function"?F1(U,W):U},j2=function(){let $,W,A,U;return W=new Map,U=[],$=new Map,A=function(u,f){for(let Y of U)Y(u,f)},{read:function(u){return W.get(u)},write:function(u,f){let Y;return Y=!W.has(u),W.set(u,f),$.delete(u),A(Y?"create":"change",u)},del:function(u){return W.delete(u),$.delete(u),A("delete",u)},exists:function(u){return W.has(u)},size:function(){return W.size},list:function(u=""){let f,Y,F;F=[],f=u?u+"/":"";for(let[_]of W)if(_.startsWith(f)){if(Y=_.slice(f.length),Y.includes("/"))continue;F.push(_)}return F},listAll:function(u=""){let f,Y;Y=[],f=u?u+"/":"";for(let[F]of W)if(F.startsWith(f))Y.push(F);return Y},load:function(u){for(let f in u){let Y=u[f];W.set(f,Y)}},watch:function(u){return U.push(u),function(){return U.splice(U.indexOf(u),1)}},getCompiled:function(u){return $.get(u)},setCompiled:function(u,f){return $.set(u,f)}}},C2=function($,W={}){let A,U,u,f,Y,F,_,X,R,w,H,Z,K,Q,M,D,q,O,z,E,P;if(q=W.root||"components",R=W.base||"",w=W.hash||!1,K=W.onError||null,z=function(J){return R&&J.startsWith(R)?J.slice(R.length)||"/":J},X=function(J){return R?R+J:J},M=function(){let J;if(w){if(J=location.hash.slice(1),!J)return"/";return J[0]==="/"?J:"/"+J}else return location.pathname+location.search+location.hash},P=function(J){return w?J==="/"?location.pathname:"#"+J.slice(1):X(J)},Y=j(z(w?M():location.pathname)),f=j({}),_=j(null),U=j([]),F=j({}),A=j(""),u=h2(100,j(!1)),E=z1($,q),H=new Set,$.watch(function(J,G){if(!G.startsWith(q+"/"))return;return E=z1($,q)}),D=function(J){let G,I,B,N,T;if(N=J.split("?")[0].split("#")[0],I=z(N),I=I[0]==="/"?I:"/"+I,B=J.split("?")[1]?.split("#")[0]||"",G=J.includes("#")?J.split("#")[1]:"",T=E2(I,E.routes),T){w2(function(){return Y.value=I,f.value=T.params,_.value=T.route,U.value=G2(T.route.file,q,E.layouts),F.value=Object.fromEntries(new URLSearchParams(B)),A.value=G});for(let L of H)L(O.current);return!0}if(K)K({status:404,path:I});return!1},Q=function(){return D(M())},typeof window<"u")window.addEventListener("popstate",Q);if(Z=function(J){let G,I,B;if(J.button!==0||J.metaKey||J.ctrlKey||J.shiftKey||J.altKey)return;I=J.target;while(I&&I.tagName!=="A")I=I.parentElement;if(!I?.href)return;if(B=new URL(I.href,location.origin),B.origin!==location.origin)return;if(I.target==="_blank"||I.hasAttribute("data-external"))return;return J.preventDefault(),G=w&&B.hash?B.hash.slice(1)||"/":B.pathname+B.search+B.hash,O.push(G)},typeof document<"u")document.addEventListener("click",Z);return O={push:function(J){return D(J)?history.pushState(null,"",P(Y.read())):void 0},replace:function(J){return D(J)?history.replaceState(null,"",P(Y.read())):void 0},back:function(){return history.back()},forward:function(){return history.forward()},current:void 0,path:void 0,params:void 0,route:void 0,layouts:void 0,query:void 0,hash:void 0,navigating:void 0,onNavigate:function(J){return H.add(J),function(){return H.delete(J)}},rebuild:function(){return E=z1($,q)},routes:void 0,init:function(){return D(M()),O},destroy:function(){if(typeof window<"u")window.removeEventListener("popstate",Q);if(typeof document<"u")document.removeEventListener("click",Z);return H.clear()}},Object.defineProperty(O,"current",{get:function(){return{path:Y.value,params:f.value,route:_.value,layouts:U.value,query:F.value,hash:A.value}}}),Object.defineProperty(O,"path",{get:function(){return Y.value}}),Object.defineProperty(O,"params",{get:function(){return f.value}}),Object.defineProperty(O,"route",{get:function(){return _.value}}),Object.defineProperty(O,"layouts",{get:function(){return U.value}}),Object.defineProperty(O,"query",{get:function(){return F.value}}),Object.defineProperty(O,"hash",{get:function(){return A.value}}),Object.defineProperty(O,"navigating",{get:function(){return u.value},set:function(J){return u.value=J}}),Object.defineProperty(O,"routes",{get:function(){return E.routes}}),O},y2=function($={}){let W,A,U,u,f,Y,F,_,X,R,w,H,Z,K,Q,M,D,q,O,z,E,P;if({router:z,app:W,components:f,resolver:O,compile:U,target:E,onError:D}=$,Y=typeof E==="string"?document.querySelector(E):E||document.getElementById("app"),!Y)Y=document.createElement("div"),Y.id="app",document.body.appendChild(Y);return Y.style.opacity="0",F=null,R=null,X=null,_=[],Z=[],Q=Y,H=0,w=null,u=new Map,K=$.cacheSize||10,A=function(){let J,G;if(F&&R){if(F.beforeUnmount)F.beforeUnmount();if(u.set(R,F),u.size>K){if(G=u.keys().next().value,J=u.get(G),J.unmounted)J.unmounted();u.delete(G)}return F=null,R=null}},P=function(){A();for(let J=Z.length-1;J>=0;J--){let G=Z[J];if(G.beforeUnmount)G.beforeUnmount();if(G.unmounted)G.unmounted();G._target?.remove()}return Z=[],Q=Y},f.watch(function(J,G){let I;if(u.has(G)){if(I=u.get(G),I.unmounted)I.unmounted();return u.delete(G)}}),M=async function(J){let G,I,B,N,T,L,h,c,Z1,P1,f1,n1,n,i1,R1,o,Q1,E1,C,p1,I1,a;if({route:C,params:o,layouts:c,query:E1}=J,!C)return;if(C.file===R&&JSON.stringify(o)===JSON.stringify(X))return;return X=o,N=++H,z.navigating=!0,(async()=>{try{if(I1=f.read(C.file),!I1){if(D)D({status:404,message:`File not found: ${C.file}`});z.navigating=!1;return}if(n1=await q1(I1,U,f,C.file,O),N!==H){z.navigating=!1;return}if(G=v1(n1),!G){if(D)D({status:500,message:`No component found in ${C.file}`});z.navigating=!1;return}if(f1=!M2(c,_),i1=F?._target,f1)P();else A();if(n=f1?Y:Q,f1&&c.length>0){Y.innerHTML="",n=Y;for(let v of c){if(P1=f.read(v),!P1)continue;if(Z1=await q1(P1,U,f,v,O),N!==H){z.navigating=!1;return}if(I=v1(Z1),!I)continue;if(L=new I({app:W,params:o,router:z}),L.beforeMount)L.beforeMount();a=document.createElement("div"),a.setAttribute("data-layout",v),n.appendChild(a),L.mount(a),Z.push(L),p1=a.querySelector("#content")||a,n=p1}_=[...c],Q=n}else if(f1)Y.innerHTML="",_=[],Q=Y;if(B=u.get(C.file),B)u.delete(C.file),n.appendChild(B._target),F=B,R=C.file;else{if(R1=document.createElement("div"),R1.setAttribute("data-component",C.file),n.appendChild(R1),h=new G({app:W,params:o,query:E1,router:z}),h.beforeMount)h.beforeMount();if(h.mount(R1),F=h,R=C.file,h.load)await h.load(o,E1)}return i1?.remove(),z.navigating=!1,Y.style.opacity==="0"?document.fonts.ready.then(function(){return requestAnimationFrame(function(){return Y.style.transition="opacity 150ms ease-in",Y.style.opacity="1"})}):void 0}catch(v){if(z.navigating=!1,Y.style.opacity="1",console.error(`Renderer: error mounting ${C.file}:`,v),D)D({status:500,message:v.message,error:v});T=!1;for(let B1=Z.length-1;B1>=0;B1--){let d1=Z[B1];if(d1.onError)try{d1.onError(v),T=!0;break}catch(b2){console.error("Renderer: error boundary failed:",b2)}}return(()=>{if(!T)return Q1=document.createElement("pre"),Q1.style.cssText="color:red;padding:1em",Q1.textContent=v.stack||v.message,Y.innerHTML="",Y.appendChild(Q1)})()}})()},q={start:function(){return w=r(function(){let J;return J=z.current,J.route?M(J):void 0}),z.init(),q},stop:function(){if(P(),w)w(),w=null;return Y.innerHTML=""},remount:function(){let J;return J=z.current,J.route?M(J):void 0},cache:u},q},x3=async function($="",W={}){let A,U,u,f,Y,F,_,X,R,w,H,Z,K,Q,M,D,q,O,z,E,P;if(globalThis.__ripLaunched=!0,typeof $==="object")W=$,$="";if($=$.replace(/\/+$/,""),P=W.target||"#app",R=W.compile||null,Q=W.persist||!1,Z=W.hash||!1,!R)R=globalThis?.compileToJS||null;if(typeof document<"u"&&!document.querySelector(P))H=document.createElement("div"),H.id=P.replace(/^#/,""),document.body.prepend(H);if(W.bundle)F=W.bundle;else if(W.components&&Array.isArray(W.components)){w={};for(let J of W.components)if(D=await fetch(J),D.ok)K=J.split("/").pop(),w[`components/${K}`]=await D.text();F={components:w,data:{}}}else if(typeof document<"u"&&document.querySelectorAll('script[type="text/rip"][data-name]').length>0){w={};for(let J of document.querySelectorAll('script[type="text/rip"][data-name]'))K=J.getAttribute("data-name"),K+=!K.endsWith(".rip")?".rip":void 0,w[`components/${K}`]=J.textContent;F={components:w,data:{}}}else if(W.bundle===!1)F={components:{},data:{}};else{if(_=`${$}/bundle`,D=await fetch(_,{cache:"no-cache"}),!D.ok)throw Error(`launch: ${_} (${D.status})`);F=await D.json()}if(f=L2({components:{},routes:{},data:{}}),F.data)f.data=F.data;if(F.routes)f.routes=F.routes;if(Q&&typeof sessionStorage<"u"){u=`__rip_${$}`,U=Q==="local"?localStorage:sessionStorage;try{if(z=U.getItem(u),z){E=JSON.parse(z);for(let J in E){let G=E[J];f.data[J]=G}}}catch{}A=function(){return(()=>{try{return U.setItem(u,JSON.stringify(V2(f.data)))}catch{return null}})()},r(function(){let J;return l1.value,J=setTimeout(A,2000),function(){return clearTimeout(J)}}),window.addEventListener("beforeunload",A)}if(Y=j2(),F.components)Y.load(F.components);if(X=`__rip_${$.replace(/\//g,"_")||"app"}`,q={map:D2(Y),classes:{},key:X},typeof globalThis<"u")globalThis[X]=q.classes;if(f.data.title&&typeof document<"u")document.title=f.data.title;if(O=C2(Y,{root:"components",base:$,hash:Z,onError:function(J){return console.error(`[Rip] Error ${J.status}: ${J.message||J.path}`)}}),M=y2({router:O,app:f,components:Y,resolver:q,compile:R,target:P,onError:function(J){return console.error(`[Rip] ${J.message}`,J.error)}}),M.start(),F.data?.watch)H2(`${$}/watch`);if(typeof window<"u")window.app=f,window.__RIP__={app:f,components:Y,router:O,renderer:M,cache:M.cache,version:"0.3.0"};return{app:f,components:Y,router:O,renderer:M}};e.modules["app.rip"]=G1;for(let[$,W]of Object.entries(G1))if(typeof W==="function")globalThis[$]=W;export{C3 as rip,j3 as processRipScripts,s as parser,e as importRip,H1 as getReactiveRuntime,y1 as getComponentRuntime,x as formatSExpr,d as compileToJS,C1 as compile,L3 as VERSION,p as Lexer,D1 as Compiler,y as CodeGenerator,V3 as BUILD_DATE};
Binary file
package/docs/index.html CHANGED
@@ -495,7 +495,7 @@
495
495
  body.light .repl-prompt-text { color: #007acc; }
496
496
  </style>
497
497
  <link rel="preload" href="https://cdn.jsdelivr.net/npm/monaco-editor@0.52.0/min/vs/loader.js" as="script">
498
- <script type="module" src="dist/rip.min.js"></script>
498
+ <script type="module" src="dist/rip.min.js" data-url=""></script>
499
499
  </head>
500
500
  <body>
501
501
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rip-lang",
3
- "version": "3.13.1",
3
+ "version": "3.13.3",
4
4
  "description": "A modern language that compiles to JavaScript",
5
5
  "type": "module",
6
6
  "main": "src/compiler.js",
package/src/app.rip CHANGED
@@ -926,6 +926,8 @@ export launch = (appBase = '', opts = {}) ->
926
926
  name += '.rip' unless name.endsWith('.rip')
927
927
  components["components/#{name}"] = script.textContent
928
928
  bundle = { components, data: {} }
929
+ else if opts.bundle is false
930
+ bundle = { components: {}, data: {} }
929
931
  else
930
932
  bundleUrl = "#{appBase}/bundle"
931
933
  res = await fetch(bundleUrl, cache: 'no-cache')
package/src/browser.js CHANGED
@@ -144,6 +144,7 @@ async function autoLaunch() {
144
144
  const url = cfg?.getAttribute('data-url') || '';
145
145
  const hash = cfg?.getAttribute('data-hash');
146
146
  const opts = { hash: hash !== 'false' };
147
+ if (cfg?.hasAttribute('data-url') && !url) opts.bundle = false;
147
148
  await ui.launch(url, opts);
148
149
  }
149
150
 
package/src/repl.js CHANGED
@@ -399,25 +399,21 @@ export class RipREPL {
399
399
  }
400
400
  }
401
401
 
402
- // Build module code
403
- const moduleCode = `${staticImports}
404
- ${restoreCode}
405
- let __result;
406
- ${lines.join('\n')}
407
- ${saveCode}
408
- export { __result };
409
- `;
410
-
411
- // Create and evaluate module
412
- const mod = new vm.SourceTextModule(moduleCode, {
413
- context: this.vmContext,
414
- identifier: this.cwd + '/repl-' + Date.now()
415
- });
416
-
417
- await mod.link(this.linker.bind(this));
418
- await mod.evaluate();
402
+ // Use vm.runInContext for most code (simpler, supports await)
403
+ // Fall back to vm.SourceTextModule only when imports are needed
404
+ if (staticImports) {
405
+ const moduleCode = `${staticImports}\n${restoreCode}\nlet __result;\n${lines.join('\n')}\n${saveCode}\nexport { __result };\n`;
406
+ const mod = new vm.SourceTextModule(moduleCode, {
407
+ context: this.vmContext,
408
+ identifier: this.cwd + '/repl-' + Date.now()
409
+ });
410
+ await mod.link(this.linker.bind(this));
411
+ await mod.evaluate();
412
+ return mod.namespace.__result;
413
+ }
419
414
 
420
- return mod.namespace.__result;
415
+ const wrapped = `(async () => {\n${restoreCode}\nlet __result;\n${lines.join('\n')}\n${saveCode}\nreturn __result;\n})()`;
416
+ return await vm.runInContext(wrapped, this.vmContext);
421
417
  }
422
418
 
423
419
  printResult(value) {