tova 0.2.6 → 0.2.8
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/bin/tova.js +22 -1
- package/package.json +1 -1
- package/src/analyzer/analyzer.js +11 -1
- package/src/version.js +1 -1
package/bin/tova.js
CHANGED
|
@@ -764,6 +764,18 @@ async function devServer(args) {
|
|
|
764
764
|
processes.push({ child, label: 'server', port });
|
|
765
765
|
rebuildPortOffset++;
|
|
766
766
|
}
|
|
767
|
+
|
|
768
|
+
// Wait for server to be ready before triggering browser reload
|
|
769
|
+
if (processes.length > 0) {
|
|
770
|
+
const serverPort = processes[0].port;
|
|
771
|
+
for (let i = 0; i < 50; i++) {
|
|
772
|
+
try {
|
|
773
|
+
const res = await fetch(`http://localhost:${serverPort}/`);
|
|
774
|
+
if (res.ok || res.status === 404) break;
|
|
775
|
+
} catch {}
|
|
776
|
+
await new Promise(r => setTimeout(r, 100));
|
|
777
|
+
}
|
|
778
|
+
}
|
|
767
779
|
console.log(' ✓ Rebuild complete');
|
|
768
780
|
notifyReload();
|
|
769
781
|
});
|
|
@@ -791,7 +803,16 @@ async function generateDevHTML(clientCode, srcDir, reloadPort = 0) {
|
|
|
791
803
|
(function() {
|
|
792
804
|
var es = new EventSource("http://localhost:${reloadPort}/__tova_reload");
|
|
793
805
|
es.onmessage = function(e) { if (e.data === "reload") window.location.reload(); };
|
|
794
|
-
es.onerror = function() {
|
|
806
|
+
es.onerror = function() {
|
|
807
|
+
es.close();
|
|
808
|
+
// Server is rebuilding — poll until it's back, then reload
|
|
809
|
+
var check = setInterval(function() {
|
|
810
|
+
fetch(window.location.href, { mode: "no-cors" }).then(function() {
|
|
811
|
+
clearInterval(check);
|
|
812
|
+
window.location.reload();
|
|
813
|
+
}).catch(function() {});
|
|
814
|
+
}, 500);
|
|
815
|
+
};
|
|
795
816
|
})();
|
|
796
817
|
</script>` : '';
|
|
797
818
|
|
package/package.json
CHANGED
package/src/analyzer/analyzer.js
CHANGED
|
@@ -703,7 +703,8 @@ export class Analyzer {
|
|
|
703
703
|
|
|
704
704
|
visitSharedBlock(node) {
|
|
705
705
|
const prevScope = this.currentScope;
|
|
706
|
-
|
|
706
|
+
const sharedScope = this.currentScope.child('shared');
|
|
707
|
+
this.currentScope = sharedScope;
|
|
707
708
|
try {
|
|
708
709
|
for (const stmt of node.body) {
|
|
709
710
|
this.visitNode(stmt);
|
|
@@ -711,6 +712,13 @@ export class Analyzer {
|
|
|
711
712
|
} finally {
|
|
712
713
|
this.currentScope = prevScope;
|
|
713
714
|
}
|
|
715
|
+
// Promote shared symbols (types, functions) to parent scope
|
|
716
|
+
// so server/client blocks can reference them
|
|
717
|
+
for (const [name, sym] of sharedScope.symbols) {
|
|
718
|
+
if (!prevScope.symbols.has(name)) {
|
|
719
|
+
prevScope.symbols.set(name, sym);
|
|
720
|
+
}
|
|
721
|
+
}
|
|
714
722
|
}
|
|
715
723
|
|
|
716
724
|
// ─── Declaration visitors ─────────────────────────────────
|
|
@@ -1982,6 +1990,8 @@ export class Analyzer {
|
|
|
1982
1990
|
}
|
|
1983
1991
|
case 'ExpressionStatement':
|
|
1984
1992
|
return this._definitelyReturns(node.expression);
|
|
1993
|
+
case 'CallExpression':
|
|
1994
|
+
return true;
|
|
1985
1995
|
default:
|
|
1986
1996
|
return false;
|
|
1987
1997
|
}
|
package/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Auto-generated by scripts/embed-runtime.js — do not edit
|
|
2
|
-
export const VERSION = "0.2.
|
|
2
|
+
export const VERSION = "0.2.8";
|