tova 0.2.7 → 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 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() { setTimeout(function() { window.location.reload(); }, 1000); };
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tova",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "Tova — a modern programming language that transpiles to JavaScript, unifying frontend and backend",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
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.7";
2
+ export const VERSION = "0.2.8";