rip-lang 3.13.1 → 3.13.2
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.min.js +1 -1
- package/docs/dist/rip.min.js.br +0 -0
- package/package.json +1 -1
- package/src/repl.js +14 -18
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.2-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>
|
package/docs/dist/rip.min.js
CHANGED
|
@@ -529,7 +529,7 @@ 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.
|
|
532
|
+
`}function H1(){return new y({}).getReactiveRuntime()}function y1(){return new y({}).getComponentRuntime()}var L3="3.13.2",V3="2026-02-23@04:08:17GMT";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 ->
|
package/docs/dist/rip.min.js.br
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/repl.js
CHANGED
|
@@ -399,25 +399,21 @@ export class RipREPL {
|
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
401
|
|
|
402
|
-
//
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
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
|
-
|
|
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) {
|