what-compiler 0.13.10 → 0.13.11

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/dist/index.min.js CHANGED
@@ -403,8 +403,10 @@ if (import.meta.hot) {
403
403
  import.meta.hot.accept((newModule) => {
404
404
  if (newModule) {
405
405
  // Signal to the What runtime that this module was hot-updated
406
- if (window.__WHAT_HMR_ACCEPT__) {
406
+ if (typeof window.__WHAT_HMR_ACCEPT__ === 'function') {
407
407
  window.__WHAT_HMR_ACCEPT__(${JSON.stringify(e)}, newModule);
408
+ } else {
409
+ window.location.reload();
408
410
  }
409
411
  }
410
412
  });
@@ -403,8 +403,10 @@ if (import.meta.hot) {
403
403
  import.meta.hot.accept((newModule) => {
404
404
  if (newModule) {
405
405
  // Signal to the What runtime that this module was hot-updated
406
- if (window.__WHAT_HMR_ACCEPT__) {
406
+ if (typeof window.__WHAT_HMR_ACCEPT__ === 'function') {
407
407
  window.__WHAT_HMR_ACCEPT__(${JSON.stringify(e)}, newModule);
408
+ } else {
409
+ window.location.reload();
408
410
  }
409
411
  }
410
412
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "what-compiler",
3
- "version": "0.13.10",
3
+ "version": "0.13.11",
4
4
  "description": "JSX compiler for What Framework - transforms JSX to optimized DOM operations",
5
5
  "main": "src/index.js",
6
6
  "types": "index.d.ts",
@@ -49,7 +49,7 @@
49
49
  "license": "MIT",
50
50
  "peerDependencies": {
51
51
  "@babel/core": "^7.0.0",
52
- "what-core": "^0.13.10"
52
+ "what-core": "^0.13.11"
53
53
  },
54
54
  "files": [
55
55
  "src",
@@ -4,8 +4,8 @@
4
4
  * 1. Transforms JSX via the What babel plugin
5
5
  * 2. Provides file-based routing via virtual:what-routes
6
6
  * 3. Watches pages directory for route changes
7
- * 4. HMR support: component files get granular hot-module replacement,
8
- * signal/utility files trigger full reload
7
+ * 4. Component hot updates use an installed replacement hook or reload the
8
+ * page; signal/utility files trigger full reload
9
9
  */
10
10
 
11
11
  import path from 'path';
@@ -459,8 +459,9 @@ function isUtilityFile(filePath) {
459
459
 
460
460
  /**
461
461
  * Generate HMR boundary code for a component file.
462
- * When the module is updated, Vite's HMR runtime calls import.meta.hot.accept(),
463
- * which re-runs the module. The component re-renders in place.
462
+ * Vite calls the accept callback after reevaluating the updated module.
463
+ * An installed replacement runtime owns the update. Otherwise reload the page:
464
+ * accepting the module alone leaves its already-mounted component unchanged.
464
465
  */
465
466
  function generateHMRBoundary(filePath) {
466
467
  return `
@@ -470,8 +471,10 @@ if (import.meta.hot) {
470
471
  import.meta.hot.accept((newModule) => {
471
472
  if (newModule) {
472
473
  // Signal to the What runtime that this module was hot-updated
473
- if (window.__WHAT_HMR_ACCEPT__) {
474
+ if (typeof window.__WHAT_HMR_ACCEPT__ === 'function') {
474
475
  window.__WHAT_HMR_ACCEPT__(${JSON.stringify(filePath)}, newModule);
476
+ } else {
477
+ window.location.reload();
475
478
  }
476
479
  }
477
480
  });