@absolutejs/absolute 0.18.9-beta.0 → 0.18.9-beta.2

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.js CHANGED
@@ -782,6 +782,16 @@ var escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), applyAllR
782
782
  result = result.replace(dynamicRegex, `$1${webPath}$2`);
783
783
  }
784
784
  return result;
785
+ }, REFRESH_STUBS, patchRefreshGlobals = async (outputPaths) => {
786
+ const jsFiles = outputPaths.filter((path) => path.endsWith(".js"));
787
+ await Promise.all(jsFiles.map(async (filePath) => {
788
+ const content = await Bun.file(filePath).text();
789
+ if (!content.includes("$RefreshReg$(") && !content.includes("$RefreshSig$("))
790
+ return;
791
+ if (content.startsWith("window.$RefreshReg$"))
792
+ return;
793
+ await Bun.write(filePath, REFRESH_STUBS + content);
794
+ }));
785
795
  }, rewriteReactImports = async (outputPaths, vendorPaths) => {
786
796
  const jsFiles = outputPaths.filter((path) => path.endsWith(".js"));
787
797
  if (jsFiles.length === 0)
@@ -795,6 +805,10 @@ var escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), applyAllR
795
805
  }
796
806
  }));
797
807
  };
808
+ var init_rewriteReactImports = __esm(() => {
809
+ REFRESH_STUBS = "window.$RefreshReg$||(window.$RefreshReg$=function(){});" + `window.$RefreshSig$||(window.$RefreshSig$=function(){return function(t){return t}});
810
+ `;
811
+ });
798
812
 
799
813
  // src/core/devVendorPaths.ts
800
814
  var exports_devVendorPaths = {};
@@ -171487,6 +171501,7 @@ var init_build = __esm(() => {
171487
171501
  init_scanCssEntryPoints();
171488
171502
  init_updateAssetPaths();
171489
171503
  init_buildHMRClient();
171504
+ init_rewriteReactImports();
171490
171505
  init_telemetryEvent();
171491
171506
  init_angularLinkerPlugin();
171492
171507
  init_cleanStaleOutputs();
@@ -202478,9 +202493,11 @@ var parseErrorLocationFromMessage = (msg) => {
202478
202493
  if (!clientResult.success) {
202479
202494
  return;
202480
202495
  }
202496
+ const clientOutputPaths = clientResult.outputs.map((art) => art.path);
202481
202497
  if (vendorPaths) {
202482
- await rewriteReactImports(clientResult.outputs.map((art) => art.path), vendorPaths);
202498
+ await rewriteReactImports(clientOutputPaths, vendorPaths);
202483
202499
  }
202500
+ await patchRefreshGlobals(clientOutputPaths);
202484
202501
  const clientManifest = generateManifest(clientResult.outputs, buildDir);
202485
202502
  Object.assign(state.manifest, clientManifest);
202486
202503
  populateAssetStore(state.assetStore, clientManifest, buildDir);
@@ -202509,9 +202526,11 @@ var parseErrorLocationFromMessage = (msg) => {
202509
202526
  if (!result.success) {
202510
202527
  return;
202511
202528
  }
202529
+ const pageOutputPaths = result.outputs.map((artifact) => artifact.path);
202512
202530
  if (vendorPaths) {
202513
- await rewriteReactImports(result.outputs.map((artifact) => artifact.path), vendorPaths);
202531
+ await rewriteReactImports(pageOutputPaths, vendorPaths);
202514
202532
  }
202533
+ await patchRefreshGlobals(pageOutputPaths);
202515
202534
  const pageManifest = generateManifest(result.outputs, buildDir);
202516
202535
  Object.assign(state.manifest, pageManifest);
202517
202536
  populateAssetStore(state.assetStore, pageManifest, buildDir);
@@ -203424,6 +203443,7 @@ var init_rebuildTrigger = __esm(() => {
203424
203443
  init_compileVue();
203425
203444
  init_compileAngular();
203426
203445
  init_commonAncestor();
203446
+ init_rewriteReactImports();
203427
203447
  });
203428
203448
 
203429
203449
  // src/core/devBuild.ts
@@ -203988,5 +204008,5 @@ export {
203988
204008
  ANGULAR_INIT_TIMEOUT_MS
203989
204009
  };
203990
204010
 
203991
- //# debugId=867B1E7115D2CA0564756E2164756E21
204011
+ //# debugId=ACA94E93892A48A264756E2164756E21
203992
204012
  //# sourceMappingURL=index.js.map