@absolutejs/absolute 0.18.9-beta.1 → 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/build.js CHANGED
@@ -705,6 +705,16 @@ var escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), applyAllR
705
705
  result = result.replace(dynamicRegex, `$1${webPath}$2`);
706
706
  }
707
707
  return result;
708
+ }, REFRESH_STUBS, patchRefreshGlobals = async (outputPaths) => {
709
+ const jsFiles = outputPaths.filter((path) => path.endsWith(".js"));
710
+ await Promise.all(jsFiles.map(async (filePath) => {
711
+ const content = await Bun.file(filePath).text();
712
+ if (!content.includes("$RefreshReg$(") && !content.includes("$RefreshSig$("))
713
+ return;
714
+ if (content.startsWith("window.$RefreshReg$"))
715
+ return;
716
+ await Bun.write(filePath, REFRESH_STUBS + content);
717
+ }));
708
718
  }, rewriteReactImports = async (outputPaths, vendorPaths) => {
709
719
  const jsFiles = outputPaths.filter((path) => path.endsWith(".js"));
710
720
  if (jsFiles.length === 0)
@@ -718,6 +728,10 @@ var escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), applyAllR
718
728
  }
719
729
  }));
720
730
  };
731
+ var init_rewriteReactImports = __esm(() => {
732
+ REFRESH_STUBS = "window.$RefreshReg$||(window.$RefreshReg$=function(){});" + `window.$RefreshSig$||(window.$RefreshSig$=function(){return function(t){return t}});
733
+ `;
734
+ });
721
735
 
722
736
  // src/core/devVendorPaths.ts
723
737
  var exports_devVendorPaths = {};
@@ -171410,6 +171424,7 @@ var init_build = __esm(() => {
171410
171424
  init_scanCssEntryPoints();
171411
171425
  init_updateAssetPaths();
171412
171426
  init_buildHMRClient();
171427
+ init_rewriteReactImports();
171413
171428
  init_telemetryEvent();
171414
171429
  init_angularLinkerPlugin();
171415
171430
  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
@@ -203654,5 +203674,5 @@ export {
203654
203674
  build
203655
203675
  };
203656
203676
 
203657
- //# debugId=4353CF9EC853629B64756E2164756E21
203677
+ //# debugId=034ACDC63668474A64756E2164756E21
203658
203678
  //# sourceMappingURL=build.js.map