rip-lang 3.13.8 → 3.13.9

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.
@@ -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 z1(){return new y({}).getReactiveRuntime()}function b1(){return new y({}).getComponentRuntime()}var L3="3.13.8",V3="2026-02-23@19:16:04GMT";if(typeof globalThis<"u"&&!globalThis.__rip)Function(z1())();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 z1(){return new y({}).getReactiveRuntime()}function b1(){return new y({}).getComponentRuntime()}var L3="3.13.9",V3="2026-02-23@20:22:12GMT";if(typeof globalThis<"u"&&!globalThis.__rip)Function(z1())();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[F,Y]of Object.entries(e.modules))if($.includes(F))return Y;let W=await fetch($).then((F)=>{if(!F.ok)throw Error(`importRip: ${$} (${F.status})`);return F.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:y1,compileToJS:d,formatSExpr:x,getStdlibCode:H1,VERSION:L3,BUILD_DATE:V3,getReactiveRuntime:z1,getComponentRuntime:b1};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 P1={};g2(P1,{throttle:()=>g3,stash:()=>V2,setContext:()=>N2,raw:()=>h2,launch:()=>x3,isStash:()=>b3,hold:()=>l3,hasContext:()=>E2,getContext:()=>G2,delay:()=>j2,debounce:()=>v3,createRouter:()=>y2,createResource:()=>c3,createRenderer:()=>b2,createComponents:()=>C2});var w2,l1,u1,m,G1,D2,r,j,c1,Y1,_1,x1,M2,H2,q1,O1,z2,q2,O2,v1,g1,G2,P2,k1,E2,F1,m1,I2,B2,N2,T2,S2,n1,L2;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:D2}=globalThis.__rip);({setContext:N2,getContext:G2,hasContext:E2}=globalThis.__ripComponent||{});G1=Symbol("stash");m=Symbol("signals");u1=Symbol("raw");l1=new WeakMap;c1=0;x1=j(0);k1=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};F1=function($){return k1($,Symbol.for("keys"))};L2=function($){let W;if(!($!=null&&typeof $==="object"))return $;if($[G1])return $;if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Promise)return $;if(W=l1.get($),W)return W;return m1($)};m1=function($){let W,A;return A=null,W={get:function(U,u){let f,F;if(u===G1)return!0;if(u===u1)return U;if(typeof u==="symbol")return Reflect.get(U,u);if(u==="length"&&Array.isArray(U))return F1(U).value,U.length;if(u==="get")return function(Y){return T2(A,Y)};if(u==="set")return function(Y,_){return S2(A,Y,_)};if(f=k1(U,u),F=f.value,F!=null&&typeof F==="object")return L2(F);return F},set:function(U,u,f){let F,Y;if(F=U[u],Y=f?.[u1]?f[u1]:f,Y===F)return!0;if(U[u]=Y,U[m]?.has(u))U[m].get(u).value=Y;if(F===void 0&&Y!==void 0)F1(U).value=++c1;return x1.value++,!0},deleteProperty:function(U,u){let f;if(delete U[u],f=U[m]?.get(u),f)f.value=void 0;return F1(U).value=++c1,!0},ownKeys:function(U){return F1(U).value,Reflect.ownKeys(U)}},A=new Proxy($,W),l1.set($,A),A};w2=/([./][^./\[\s]+|\[[-+]?\d+\]|\[(?:"[^"]+"|'[^']+')\])/;n1=function($){let W,A,U,u,f;U=("."+$).split(w2),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};T2=function($,W){let A,U;U=n1(W),A=$;for(let u of U){if(A==null)return;A=A[u]}return A};S2=function($,W,A){let U,u;u=n1(W),U=$;for(let f=0;f<u.length;f++){let F=u[f];if(f===u.length-1)U[F]=A;else{if(U[F]==null)U[F]={};U=U[F]}}return A};_1=function($){return typeof $==="function"?$:function(){return $.value}};Y1=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};O2=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};B2=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}};I2=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 F=u.regex.names[f];U[F]=decodeURIComponent(A[f+1])}return{route:u,params:U}}return null};q1=function($,W="components"){let A,U,u,f,F,Y,_,X,R;_=[],u=new Map,A=$.listAll(W);for(let w of A){if(Y=w.slice(W.length+1),!Y.endsWith(".rip"))continue;if(f=Y.split("/").pop(),f==="_layout.rip"){U=Y==="_layout.rip"?"":Y.slice(0,-12),u.set(U,w);continue}if(f.startsWith("_"))continue;if(X=Y.split("/"),X.length>1&&X.some(function(H,Z){return Z<X.length-1&&H.startsWith("_")}))continue;R=O2(Y),F=B2(R),_.push({pattern:R,regex:F,file:w,rel:Y})}return _.sort(function(w,H){let Z,K,Q,D;if(K=(w.pattern.match(/:/g)||[]).length,D=(H.pattern.match(/:/g)||[]).length,Z=w.pattern.includes("*")?1:0,Q=H.pattern.includes("*")?1:0,Z!==Q)return Z-Q;if(K!==D)return K-D;return w.pattern.localeCompare(H.pattern)}),{routes:_,layouts:u}};P2=function($,W,A){let U,u,f,F;if(U=[],f=$.slice(W.length+1),F=f.split("/"),u="",A.has(""))U.push(A.get(""));for(let Y=0;Y<F.length;Y++){let _=F[Y];if(Y===F.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};g1=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};v1=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};q2=function($){let W;return W=$.split("/").pop().replace(/\.rip$/,""),W.replace(/(^|[-_])([a-z])/g,function(A,U,u){return u.toUpperCase()})};H2=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=q2(f),U[u])console.warn(`[Rip] Component name collision: ${u} (${U[u]} vs ${f})`);U[u]=f}return U};O1=async function($,W,A=null,U=null,u=null){let f,F,Y,_,X,R,w,H,Z,K,Q,D;if(A&&U){if(F=A.getCompiled(U),F)return F}if(w=W($),u){K={};for(let M in u.map){let q=u.map[M];if(q!==U&&w.includes(`new ${M}(`)){if(!u.classes[M]){if(_=A.read(q),_){Y=await O1(_,W,A,q,u),X=v1(Y);for(let O in X){let z=X[O];u.classes[O]=z}}}if(u.classes[M])K[M]=!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:y1,compileToJS:d,formatSExpr:x,getStdlibCode:H1,VERSION:L3,BUILD_DATE:V3,getReactiveRuntime:z1,getComponentRuntime:b1};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=document.querySelectorAll('script[type="text/rip"][data-name]').length>0,U=W?.getAttribute("data-url")||"";if(!A&&!U)return;let f={hash:W?.getAttribute("data-hash")!=="false"};await $.launch(U,f)}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 P1={};g2(P1,{throttle:()=>g3,stash:()=>V2,setContext:()=>N2,raw:()=>h2,launch:()=>x3,isStash:()=>b3,hold:()=>l3,hasContext:()=>E2,getContext:()=>G2,delay:()=>j2,debounce:()=>v3,createRouter:()=>y2,createResource:()=>c3,createRenderer:()=>b2,createComponents:()=>C2});var w2,l1,u1,m,G1,D2,r,j,c1,Y1,_1,x1,M2,H2,q1,O1,z2,q2,O2,v1,g1,G2,P2,k1,E2,F1,m1,I2,B2,N2,T2,S2,n1,L2;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:D2}=globalThis.__rip);({setContext:N2,getContext:G2,hasContext:E2}=globalThis.__ripComponent||{});G1=Symbol("stash");m=Symbol("signals");u1=Symbol("raw");l1=new WeakMap;c1=0;x1=j(0);k1=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};F1=function($){return k1($,Symbol.for("keys"))};L2=function($){let W;if(!($!=null&&typeof $==="object"))return $;if($[G1])return $;if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Promise)return $;if(W=l1.get($),W)return W;return m1($)};m1=function($){let W,A;return A=null,W={get:function(U,u){let f,F;if(u===G1)return!0;if(u===u1)return U;if(typeof u==="symbol")return Reflect.get(U,u);if(u==="length"&&Array.isArray(U))return F1(U).value,U.length;if(u==="get")return function(Y){return T2(A,Y)};if(u==="set")return function(Y,_){return S2(A,Y,_)};if(f=k1(U,u),F=f.value,F!=null&&typeof F==="object")return L2(F);return F},set:function(U,u,f){let F,Y;if(F=U[u],Y=f?.[u1]?f[u1]:f,Y===F)return!0;if(U[u]=Y,U[m]?.has(u))U[m].get(u).value=Y;if(F===void 0&&Y!==void 0)F1(U).value=++c1;return x1.value++,!0},deleteProperty:function(U,u){let f;if(delete U[u],f=U[m]?.get(u),f)f.value=void 0;return F1(U).value=++c1,!0},ownKeys:function(U){return F1(U).value,Reflect.ownKeys(U)}},A=new Proxy($,W),l1.set($,A),A};w2=/([./][^./\[\s]+|\[[-+]?\d+\]|\[(?:"[^"]+"|'[^']+')\])/;n1=function($){let W,A,U,u,f;U=("."+$).split(w2),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};T2=function($,W){let A,U;U=n1(W),A=$;for(let u of U){if(A==null)return;A=A[u]}return A};S2=function($,W,A){let U,u;u=n1(W),U=$;for(let f=0;f<u.length;f++){let F=u[f];if(f===u.length-1)U[F]=A;else{if(U[F]==null)U[F]={};U=U[F]}}return A};_1=function($){return typeof $==="function"?$:function(){return $.value}};Y1=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};O2=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};B2=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}};I2=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 F=u.regex.names[f];U[F]=decodeURIComponent(A[f+1])}return{route:u,params:U}}return null};q1=function($,W="components"){let A,U,u,f,F,Y,_,X,R;_=[],u=new Map,A=$.listAll(W);for(let w of A){if(Y=w.slice(W.length+1),!Y.endsWith(".rip"))continue;if(f=Y.split("/").pop(),f==="_layout.rip"){U=Y==="_layout.rip"?"":Y.slice(0,-12),u.set(U,w);continue}if(f.startsWith("_"))continue;if(X=Y.split("/"),X.length>1&&X.some(function(H,Z){return Z<X.length-1&&H.startsWith("_")}))continue;R=O2(Y),F=B2(R),_.push({pattern:R,regex:F,file:w,rel:Y})}return _.sort(function(w,H){let Z,K,Q,D;if(K=(w.pattern.match(/:/g)||[]).length,D=(H.pattern.match(/:/g)||[]).length,Z=w.pattern.includes("*")?1:0,Q=H.pattern.includes("*")?1:0,Z!==Q)return Z-Q;if(K!==D)return K-D;return w.pattern.localeCompare(H.pattern)}),{routes:_,layouts:u}};P2=function($,W,A){let U,u,f,F;if(U=[],f=$.slice(W.length+1),F=f.split("/"),u="",A.has(""))U.push(A.get(""));for(let Y=0;Y<F.length;Y++){let _=F[Y];if(Y===F.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};g1=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};v1=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};q2=function($){let W;return W=$.split("/").pop().replace(/\.rip$/,""),W.replace(/(^|[-_])([a-z])/g,function(A,U,u){return u.toUpperCase()})};H2=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=q2(f),U[u])console.warn(`[Rip] Component name collision: ${u} (${U[u]} vs ${f})`);U[u]=f}return U};O1=async function($,W,A=null,U=null,u=null){let f,F,Y,_,X,R,w,H,Z,K,Q,D;if(A&&U){if(F=A.getCompiled(U),F)return F}if(w=W($),u){K={};for(let M in u.map){let q=u.map[M];if(q!==U&&w.includes(`new ${M}(`)){if(!u.classes[M]){if(_=A.read(q),_){Y=await O1(_,W,A,q,u),X=v1(Y);for(let O in X){let z=X[O];u.classes[O]=z}}}if(u.classes[M])K[M]=!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
538
  `:"",f=new Blob([R+w],{type:"application/javascript"}),D=URL.createObjectURL(f),H=await import(D),u){X=v1(H);for(let M in X){let q=X[M];u.classes[M]=q}}if(A&&U)A.setCompiled(U,H);return H};z2=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 V2=function($={}){return m1($)},h2=function($){return $?.[u1]?$[u1]:$},b3=function($){return $?.[G1]===!0},c3=function($,W={}){let A,U,u,f,F;if(A=j(W.initial||null),u=j(!1),U=j(null),f=async function(){let Y;return u.value=!0,U.value=null,(async()=>{try{return Y=await $(),A.value=Y}catch(_){return U.value=_}finally{u.value=!1}})()},F={data:void 0,loading:void 0,error:void 0,refetch:f},Object.defineProperty(F,"data",{get:function(){return A.value}}),Object.defineProperty(F,"loading",{get:function(){return u.value}}),Object.defineProperty(F,"error",{get:function(){return U.value}}),!W.lazy)f();return F},j2=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"?Y1(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"?Y1(U,W):U},g3=function($,W){let A,U,u;return A=_1(W),u=j(A()),U=0,r(function(){let f,F,Y,_;if(_=A(),f=Date.now(),F=$-(f-U),F<=0)return u.value=_,U=f;else return Y=setTimeout(function(){return u.value=A(),U=Date.now()},F),function(){return clearTimeout(Y)}}),typeof W!=="function"?Y1(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"?Y1(U,W):U},C2=function(){let $,W,A,U;return W=new Map,U=[],$=new Map,A=function(u,f){for(let F of U)F(u,f)},{read:function(u){return W.get(u)},write:function(u,f){let F;return F=!W.has(u),W.set(u,f),$.delete(u),A(F?"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,F,Y;Y=[],f=u?u+"/":"";for(let[_]of W)if(_.startsWith(f)){if(F=_.slice(f.length),F.includes("/"))continue;Y.push(_)}return Y},listAll:function(u=""){let f,F;F=[],f=u?u+"/":"";for(let[Y]of W)if(Y.startsWith(f))F.push(Y);return F},load:function(u){for(let f in u){let F=u[f];W.set(f,F)}},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)}}},y2=function($,W={}){let A,U,u,f,F,Y,_,X,R,w,H,Z,K,Q,D,M,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},D=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)},F=j(z(w?D():location.pathname)),f=j({}),_=j(null),U=j([]),Y=j({}),A=j(""),u=j2(100,j(!1)),E=q1($,q),H=new Set,$.watch(function(J,G){if(!G.startsWith(q+"/"))return;return E=q1($,q)}),M=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=I2(I,E.routes),T){D2(function(){return F.value=I,f.value=T.params,_.value=T.route,U.value=P2(T.route.file,q,E.layouts),Y.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 M(D())},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 M(J)?history.pushState(null,"",P(F.read())):void 0},replace:function(J){return M(J)?history.replaceState(null,"",P(F.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=q1($,q)},routes:void 0,init:function(){return M(D()),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:F.value,params:f.value,route:_.value,layouts:U.value,query:Y.value,hash:A.value}}}),Object.defineProperty(O,"path",{get:function(){return F.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 Y.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},b2=function($={}){let W,A,U,u,f,F,Y,_,X,R,w,H,Z,K,Q,D,M,q,O,z,E,P;if({router:z,app:W,components:f,resolver:O,compile:U,target:E,onError:M}=$,F=typeof E==="string"?document.querySelector(E):E||document.getElementById("app"),!F)F=document.createElement("div"),F.id="app",document.body.appendChild(F);return F.style.opacity="0",Y=null,R=null,X=null,_=[],Z=[],Q=F,H=0,w=null,u=new Map,K=$.cacheSize||10,A=function(){let J,G;if(Y&&R){if(Y.beforeUnmount)Y.beforeUnmount();if(u.set(R,Y),u.size>K){if(G=u.keys().next().value,J=u.get(G),J.unmounted)J.unmounted();u.delete(G)}return Y=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=F},f.watch(function(J,G){let I;if(u.has(G)){if(I=u.get(G),I.unmounted)I.unmounted();return u.delete(G)}}),D=async function(J){let G,I,B,N,T,L,h,c,Z1,E1,f1,i1,n,p1,R1,o,Q1,I1,C,d1,B1,a;if({route:C,params:o,layouts:c,query:I1}=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(B1=f.read(C.file),!B1){if(M)M({status:404,message:`File not found: ${C.file}`});z.navigating=!1;return}if(i1=await O1(B1,U,f,C.file,O),N!==H){z.navigating=!1;return}if(G=g1(i1),!G){if(M)M({status:500,message:`No component found in ${C.file}`});z.navigating=!1;return}if(f1=!M2(c,_),p1=Y?._target,f1)P();else A();if(n=f1?F:Q,f1&&c.length>0){F.innerHTML="",n=F;for(let v of c){if(E1=f.read(v),!E1)continue;if(Z1=await O1(E1,U,f,v,O),N!==H){z.navigating=!1;return}if(I=g1(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),d1=a.querySelector("#content")||a,n=d1}_=[...c],Q=n}else if(f1)F.innerHTML="",_=[],Q=F;if(B=u.get(C.file),B)u.delete(C.file),n.appendChild(B._target),Y=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:I1,router:z}),h.beforeMount)h.beforeMount();if(h.mount(R1),Y=h,R=C.file,h.load)await h.load(o,I1)}return p1?.remove(),z.navigating=!1,F.style.opacity==="0"?document.fonts.ready.then(function(){return requestAnimationFrame(function(){return F.style.transition="opacity 150ms ease-in",F.style.opacity="1"})}):void 0}catch(v){if(z.navigating=!1,F.style.opacity="1",console.error(`Renderer: error mounting ${C.file}:`,v),M)M({status:500,message:v.message,error:v});T=!1;for(let N1=Z.length-1;N1>=0;N1--){let r1=Z[N1];if(r1.onError)try{r1.onError(v),T=!0;break}catch(c2){console.error("Renderer: error boundary failed:",c2)}}return(()=>{if(!T)return Q1=document.createElement("pre"),Q1.style.cssText="color:red;padding:1em",Q1.textContent=v.stack||v.message,F.innerHTML="",F.appendChild(Q1)})()}})()},q={start:function(){return w=r(function(){let J;return J=z.current,J.route?D(J):void 0}),z.init(),q},stop:function(){if(P(),w)w(),w=null;return F.innerHTML=""},remount:function(){let J;return J=z.current,J.route?D(J):void 0},cache:u},q},x3=async function($="",W={}){let A,U,u,f,F,Y,_,X,R,w,H,Z,K,Q,D,M,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)Y=W.bundle;else if(W.components&&Array.isArray(W.components)){w={};for(let J of W.components)if(M=await fetch(J),M.ok)K=J.split("/").pop(),w[`components/${K}`]=await M.text();Y={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;Y={components:w,data:{}}}else{if(_=`${$}/bundle`,M=await fetch(_,{cache:"no-cache"}),!M.ok)throw Error(`launch: ${_} (${M.status})`);Y=await M.json()}if(f=V2({components:{},routes:{},data:{}}),Y.data)f.data=Y.data;if(Y.routes)f.routes=Y.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(h2(f.data)))}catch{return null}})()},r(function(){let J;return x1.value,J=setTimeout(A,2000),function(){return clearTimeout(J)}}),window.addEventListener("beforeunload",A)}if(F=C2(),Y.components)F.load(Y.components);if(X=`__rip_${$.replace(/\//g,"_")||"app"}`,q={map:H2(F),classes:{},key:X},typeof globalThis<"u")globalThis[X]=q.classes;if(f.data.title&&typeof document<"u")document.title=f.data.title;if(O=y2(F,{root:"components",base:$,hash:Z,onError:function(J){return console.error(`[Rip] Error ${J.status}: ${J.message||J.path}`)}}),D=b2({router:O,app:f,components:F,resolver:q,compile:R,target:P,onError:function(J){return console.error(`[Rip] ${J.message}`,J.error)}}),D.start(),Y.data?.watch)z2(`${$}/watch`);if(typeof window<"u")window.app=f,window.__RIP__={app:f,components:F,router:O,renderer:D,cache:D.cache,version:"0.3.0"};return{app:f,components:F,router:O,renderer:D}};e.modules["app.rip"]=P1;for(let[$,W]of Object.entries(P1))if(typeof W==="function")globalThis[$]=W;export{C3 as rip,j3 as processRipScripts,s as parser,e as importRip,H1 as getStdlibCode,z1 as getReactiveRuntime,b1 as getComponentRuntime,x as formatSExpr,d as compileToJS,y1 as compile,L3 as VERSION,p as Lexer,M1 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" data-url=""></script>
498
+ <script type="module" src="dist/rip.min.js"></script>
499
499
  </head>
500
500
  <body>
501
501
 
@@ -1307,7 +1307,7 @@
1307
1307
 
1308
1308
  { success: true, value: evalResult, result }
1309
1309
  catch error
1310
- { success: false, error: error.message }
1310
+ { success: false, error: error?.message or String(error or 'Unknown error') }
1311
1311
 
1312
1312
  # --- REPL Commands ---
1313
1313
 
@@ -1403,7 +1403,7 @@
1403
1403
  replBuffer = if replBuffer then replBuffer + "\n" + line else line
1404
1404
 
1405
1405
  # Try to evaluate
1406
- evalResult = evaluateRip replBuffer
1406
+ evalResult = evaluateRip! replBuffer
1407
1407
 
1408
1408
  if evalResult.success
1409
1409
  # Show debug info if enabled
@@ -1426,7 +1426,7 @@
1426
1426
  replBuffer = ''
1427
1427
  promptSpan.textContent = 'rip>'
1428
1428
 
1429
- else if evalResult.error.includes 'Unexpected end'
1429
+ else if evalResult.error?.includes 'Unexpected end'
1430
1430
  # Incomplete input — wait for more
1431
1431
  promptSpan.textContent = '....>'
1432
1432
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rip-lang",
3
- "version": "3.13.8",
3
+ "version": "3.13.9",
4
4
  "description": "A modern language that compiles to JavaScript",
5
5
  "type": "module",
6
6
  "main": "src/compiler.js",
package/src/browser.js CHANGED
@@ -134,15 +134,19 @@ if (typeof globalThis !== 'undefined') {
134
134
  globalThis.__ripExports = { compile, compileToJS, formatSExpr, getStdlibCode, VERSION, BUILD_DATE, getReactiveRuntime, getComponentRuntime };
135
135
  }
136
136
 
137
- // Auto-launch: if app.rip is bundled and the page has component scripts or a data-url,
138
- // call launch() automatically with config from the script tag's data attributes.
139
- // Hash routing defaults to true (opt out with data-hash="false").
137
+ // Auto-launch: discover how to start the Rip App, in order of priority:
138
+ // 1. Nothing on the page → do nothing
139
+ // 2. Inline data-name scripts → compile and mount those
140
+ // 3. data-url="bundle" (or path) → fetch components from server
141
+ // 4. data-url="" (empty) → do nothing (explicit opt-out)
140
142
  async function autoLaunch() {
141
143
  if (globalThis.__ripLaunched) return;
142
144
  const ui = importRip.modules?.['app.rip'];
143
145
  if (!ui?.launch) return;
144
146
  const cfg = document.querySelector('script[data-hash], script[data-url]');
147
+ const tag = document.querySelectorAll('script[type="text/rip"][data-name]').length > 0;
145
148
  const url = cfg?.getAttribute('data-url') || '';
149
+ if (!tag && !url) return;
146
150
  const hash = cfg?.getAttribute('data-hash');
147
151
  const opts = { hash: hash !== 'false' };
148
152
  await ui.launch(url, opts);