tova 0.4.4 → 0.4.6

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
@@ -1319,13 +1319,19 @@ async function generateDevHTML(clientCode, srcDir, reloadPort = 0) {
1319
1319
  const liveReloadScript = reloadPort ? `
1320
1320
  <script>
1321
1321
  (function() {
1322
- var es = new EventSource("http://localhost:${reloadPort}/__tova_reload");
1322
+ var reloadUrl = "http://localhost:${reloadPort}/__tova_reload";
1323
+ var es = new EventSource(reloadUrl);
1324
+ var errorCount = 0;
1325
+ es.onopen = function() { errorCount = 0; };
1323
1326
  es.onmessage = function(e) { if (e.data === "reload") window.location.reload(); };
1324
1327
  es.onerror = function() {
1328
+ errorCount++;
1329
+ // EventSource auto-reconnects — only intervene after repeated failures
1330
+ if (errorCount < 3) return;
1325
1331
  es.close();
1326
- // Server is rebuilding — poll until it's back, then reload
1332
+ // SSE server is likely gone (dev server restarting) — poll until back
1327
1333
  var check = setInterval(function() {
1328
- fetch(window.location.href, { mode: "no-cors" }).then(function() {
1334
+ fetch(reloadUrl, { mode: "no-cors" }).then(function(r) {
1329
1335
  clearInterval(check);
1330
1336
  window.location.reload();
1331
1337
  }).catch(function() {});
@@ -4393,7 +4399,8 @@ _tova "$@"
4393
4399
 
4394
4400
  function detectInstallMethod() {
4395
4401
  const execPath = process.execPath || process.argv[0];
4396
- if (execPath.includes('.tova/bin')) return 'binary';
4402
+ const scriptPath = process.argv[1] || '';
4403
+ if (execPath.includes('.tova/bin') || scriptPath.includes('.tova/')) return 'binary';
4397
4404
  return 'npm';
4398
4405
  }
4399
4406
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tova",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
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.4.4";
2
+ export const VERSION = "0.4.6";