All files / client/src hmr.js

42.85% Statements 3/7
25% Branches 1/4
100% Functions 1/1
40% Lines 2/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35                                                        1x 1x          
/**
 * Coherent.js HMR Client
 *
 * @deprecated Import from '@coherent.js/client' or '@coherent.js/client/src/hmr/index.js' instead.
 * This file is kept for backward compatibility and auto-initializes HMR on import.
 *
 * Migration:
 *   // Old (deprecated)
 *   import '@coherent.js/client/src/hmr.js';
 *
 *   // New
 *   import { hmrClient } from '@coherent.js/client';
 *   hmrClient.connect();
 *
 * @module @coherent.js/client/hmr
 */
 
// Re-export all HMR modules for backward compatibility
export * from './hmr/index.js';
 
// Import hmrClient for auto-initialization
import { hmrClient } from './hmr/index.js';
 
/**
 * Legacy auto-initialization IIFE
 * Maintains backward compatibility with existing code that imports this file
 * for its side effect of auto-connecting to the dev server.
 */
(function initHMR() {
  Eif (typeof window === 'undefined') return;
  if (window.__coherent_hmr_initialized) return;
  window.__coherent_hmr_initialized = true;
  hmrClient.connect();
})();