rip-lang 3.13.136 → 3.13.137
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 +1 -1
- package/docs/dist/rip.js +2 -2
- package/docs/dist/rip.min.js +1 -1
- package/docs/dist/rip.min.js.br +0 -0
- package/package.json +2 -2
- package/src/typecheck.js +49 -3
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.
|
|
12
|
+
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.13.137-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%2C436%2F1%2C436-brightgreen.svg" alt="Tests"></a>
|
|
15
15
|
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License"></a>
|
package/docs/dist/rip.js
CHANGED
|
@@ -10677,8 +10677,8 @@ globalThis.zip ??= (...a) => a[0].map((_, i) => a.map(b => b[i]));
|
|
|
10677
10677
|
return new CodeEmitter({}).getComponentRuntime();
|
|
10678
10678
|
}
|
|
10679
10679
|
// src/browser.js
|
|
10680
|
-
var VERSION = "3.13.
|
|
10681
|
-
var BUILD_DATE = "2026-04-10@
|
|
10680
|
+
var VERSION = "3.13.137";
|
|
10681
|
+
var BUILD_DATE = "2026-04-10@11:08:16GMT";
|
|
10682
10682
|
if (typeof globalThis !== "undefined") {
|
|
10683
10683
|
if (!globalThis.__rip)
|
|
10684
10684
|
new Function(getReactiveRuntime())();
|
package/docs/dist/rip.min.js
CHANGED
|
@@ -737,7 +737,7 @@ globalThis.sleep ??= (ms) => new Promise(r => setTimeout(r, ms));
|
|
|
737
737
|
globalThis.todo ??= (msg) => { throw new Error(msg || "Not implemented"); };
|
|
738
738
|
globalThis.warn ??= console.warn;
|
|
739
739
|
globalThis.zip ??= (...a) => a[0].map((_, i) => a.map(b => b[i]));
|
|
740
|
-
`}function b1(){return new W1({}).getReactiveRuntime()}function j1(){return new W1({}).getComponentRuntime()}var m2="3.13.
|
|
740
|
+
`}function b1(){return new W1({}).getReactiveRuntime()}function j1(){return new W1({}).getComponentRuntime()}var m2="3.13.137",k2="2026-04-10@11:08:16GMT";if(typeof globalThis<"u"){if(!globalThis.__rip)Function(b1())();if(!globalThis.__ripComponent)Function(j1())()}var C4=(f)=>{let w=f.match(/^[ \t]*(?=\S)/gm),_=Math.min(...(w||[]).map((U)=>U.length));return f.replace(RegExp(`^[ ]{${_}}`,"gm"),"").trim()};async function i2(){let f=[],w=document.querySelector('script[src$="rip.min.js"], script[src$="rip.js"]'),_=w?.getAttribute("data-src");if(_){for(let U of _.trim().split(/\s+/))if(U)f.push({url:U})}for(let U of document.querySelectorAll('script[type="text/rip"]'))if(U.src)f.push({url:U.src});else{let u=C4(U.textContent);if(u)f.push({code:u})}if(f.length>0){let U=await Promise.allSettled(f.map(async(A)=>{if(!A.url)return;let G=await fetch(A.url);if(!G.ok)throw Error(`${A.url} (${G.status})`);if(A.url.endsWith(".rip"))A.code=await G.text();else{let Y=await G.json();A.bundle=Y}}));for(let A of U)if(A.status==="rejected")console.warn("Rip: fetch failed:",A.reason.message);let u=[],$=[];for(let A of f)if(A.bundle)u.push(A.bundle);else if(A.code)$.push(A);let W=w?.getAttribute("data-router");if(W!=null&&u.length>0){let A={skipRuntimes:!0,skipExports:!0,skipImports:!0};if($.length>0){let Y="";for(let Z of $)try{Y+=Q1(Z.code,A)+`
|
|
741
741
|
`}catch(Q){console.error(P1(Q,{source:Z.code,file:Z.url||"inline",color:!1}))}if(Y)try{await(0,eval)(`(async()=>{
|
|
742
742
|
${Y}
|
|
743
743
|
})()`)}catch(Z){console.error("Rip runtime error:",Z)}}let G=I1.modules?.["ui.rip"];if(G?.launch){let Y=u[u.length-1],Z=w.getAttribute("data-persist"),Q={bundle:Y,hash:W==="hash"};if(Z!=null)Q.persist=Z==="local"?"local":!0;await G.launch("",Q)}}else{let A=[];for(let Z of u){for(let[Q,K]of Object.entries(Z.components||{}))A.push({code:K,url:Q});if(Z.data){let Q=w?.getAttribute("data-state"),K={};if(Q)try{K=JSON.parse(Q)}catch{}Object.assign(K,Z.data),w?.setAttribute("data-state",JSON.stringify(K))}}A.push(...$);let G={skipRuntimes:!0,skipExports:!0,skipImports:!0},Y=[];for(let Z of A){if(!Z.code)continue;try{let Q=Q1(Z.code,G);Y.push({js:Q,url:Z.url||"inline"})}catch(Q){console.error(P1(Q,{source:Z.code,file:Z.url||"inline",color:!1}))}}if(!globalThis.__ripApp&&w){let Z=globalThis.stash;if(Z){let Q={},K=w.getAttribute("data-state");if(K)try{Q=JSON.parse(K)}catch(J){console.error("Rip: invalid data-state JSON:",J.message)}let D=Z({data:Q});if(globalThis.__ripApp=D,typeof window<"u")window.app=D;let H=w.getAttribute("data-persist");if(H!=null&&globalThis.persistStash)globalThis.persistStash(D,{local:H==="local"})}}if(Y.length>0){let Z=Y.map((K)=>K.js).join(`
|
package/docs/dist/rip.min.js.br
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rip-lang",
|
|
3
|
-
"version": "3.13.
|
|
3
|
+
"version": "3.13.137",
|
|
4
4
|
"description": "A modern language that compiles to JavaScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/compiler.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"parser": "bun src/grammar/solar.rip -o src/parser.js src/grammar/grammar.rip",
|
|
39
39
|
"serve": "bun scripts/serve.js",
|
|
40
40
|
"test": "bun test/runner.js",
|
|
41
|
-
"test:types": "
|
|
41
|
+
"test:types": "bun test/types/runner.js",
|
|
42
42
|
"test:ui": "bun run --cwd packages/ui test:e2e",
|
|
43
43
|
"test:ui:chromium": "bun run --cwd packages/ui test:e2e:chromium",
|
|
44
44
|
"test:ui:axe": "bun run --cwd packages/ui test:e2e:axe",
|
package/src/typecheck.js
CHANGED
|
@@ -198,6 +198,17 @@ export function patchUninitializedTypes(ts, service, compiledEntries) {
|
|
|
198
198
|
if (ts.isFunctionDeclaration(stmt) && stmt.body) {
|
|
199
199
|
patchStatements(stmt.body.statements);
|
|
200
200
|
}
|
|
201
|
+
// Recurse into function expressions / arrows assigned to variables
|
|
202
|
+
// or passed as arguments (e.g., __computed(() => { let x; ... }))
|
|
203
|
+
const walkForFunctions = (node) => {
|
|
204
|
+
if (!node) return;
|
|
205
|
+
if ((ts.isFunctionExpression(node) || ts.isArrowFunction(node)) && node.body) {
|
|
206
|
+
if (ts.isBlock(node.body)) patchStatements(node.body.statements);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
ts.forEachChild(node, walkForFunctions);
|
|
210
|
+
};
|
|
211
|
+
walkForFunctions(stmt);
|
|
201
212
|
}
|
|
202
213
|
}
|
|
203
214
|
|
|
@@ -951,7 +962,7 @@ export function compileForCheck(filePath, source, compiler, opts = {}) {
|
|
|
951
962
|
for (const v of vars) {
|
|
952
963
|
if (inlined.has(v) || bailed.has(v)) continue;
|
|
953
964
|
const ve = reEsc(v);
|
|
954
|
-
const assignRe = new RegExp('^' + reEsc(indent) + ve + '\\s
|
|
965
|
+
const assignRe = new RegExp('^' + reEsc(indent) + ve + '\\s*=(?!=)\\s*(.*);\\s*$');
|
|
955
966
|
const assign = line.match(assignRe);
|
|
956
967
|
if (assign) {
|
|
957
968
|
cl[j] = `${indent}let ${v} = ${assign[1]};`;
|
|
@@ -964,9 +975,44 @@ export function compileForCheck(filePath, source, compiler, opts = {}) {
|
|
|
964
975
|
}
|
|
965
976
|
|
|
966
977
|
const remaining = vars.filter(v => !inlined.has(v));
|
|
967
|
-
cl[i] =
|
|
978
|
+
if (remaining.length) cl[i] = `${indent}let ${remaining.join(', ')};`;
|
|
979
|
+
else cl[i] = '';
|
|
980
|
+
}
|
|
981
|
+
code = cl.join('\n');
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
// Merge typed `let` declarations from the DTS header into initialized body
|
|
985
|
+
// declarations. After the shadow rewrite above, the body may have `let x = expr;`
|
|
986
|
+
// while the DTS header still has `let x: Type;`. TS uses the uninitialized header
|
|
987
|
+
// declaration for flow analysis, causing TS2454 ("used before being assigned").
|
|
988
|
+
// Fix: annotate the body declaration with the header type and remove the header line.
|
|
989
|
+
if (hasTypes && headerDts && code) {
|
|
990
|
+
const dl = headerDts.split('\n');
|
|
991
|
+
const cl = code.split('\n');
|
|
992
|
+
const letTypes = new Map();
|
|
993
|
+
|
|
994
|
+
for (let i = 0; i < dl.length; i++) {
|
|
995
|
+
const m = dl[i].match(/^(?:export\s+)?(?:declare\s+)?let\s+(\w+):\s+(.+);$/);
|
|
996
|
+
if (m) letTypes.set(m[1], { type: m[2], idx: i });
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
if (letTypes.size > 0) {
|
|
1000
|
+
const movedDts = new Set();
|
|
1001
|
+
|
|
1002
|
+
for (let j = 0; j < cl.length; j++) {
|
|
1003
|
+
const lm = cl[j].match(/^(\s*let\s+)(\w+)(\s*=\s*)/);
|
|
1004
|
+
if (lm && letTypes.has(lm[2])) {
|
|
1005
|
+
const entry = letTypes.get(lm[2]);
|
|
1006
|
+
cl[j] = lm[1] + lm[2] + ': ' + entry.type + lm[3] + cl[j].slice(lm[0].length);
|
|
1007
|
+
movedDts.add(entry.idx);
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
if (movedDts.size > 0) {
|
|
1012
|
+
code = cl.join('\n');
|
|
1013
|
+
headerDts = dl.filter((_, i) => !movedDts.has(i)).join('\n').trimEnd() + '\n';
|
|
1014
|
+
}
|
|
968
1015
|
}
|
|
969
|
-
code = cl.filter(l => l !== '').join('\n');
|
|
970
1016
|
}
|
|
971
1017
|
|
|
972
1018
|
let tsContent = (hasTypes ? headerDts + '\n' : '') + code;
|