@absolutejs/absolute 0.19.0-beta.6 → 0.19.0-beta.8

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.
@@ -46,19 +46,6 @@ export const handleReactUpdate = (message: {
46
46
  const newUrl = componentKey && message.data.manifest?.[componentKey];
47
47
 
48
48
  if (newUrl && refreshRuntime) {
49
- // If the manifest URL hasn't changed, Bun.build() read cached content
50
- // (the rebuild ran before bun --hot updated). Reload instead — by the
51
- // time the page loads, bun --hot will have the fresh modules.
52
- const currentSrc = document.querySelector<HTMLScriptElement>(
53
- 'script[type="module"][src]'
54
- )?.getAttribute('src');
55
- const currentPath = currentSrc?.split('?')[0];
56
- if (currentPath && currentPath === newUrl) {
57
- window.location.reload();
58
-
59
- return;
60
- }
61
-
62
49
  applyRefreshImport(newUrl, refreshRuntime);
63
50
 
64
51
  return;
package/dist/index.js CHANGED
@@ -171312,6 +171312,29 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171312
171312
  setAngularVendorPaths(angularVendorPaths2);
171313
171313
  }
171314
171314
  const htmlScriptPlugin = hmr ? createHTMLScriptHMRPlugin(htmlDir, htmxDir) : undefined;
171315
+ const freshFilePlugin = isIncremental ? {
171316
+ name: "hmr-fresh-files",
171317
+ setup(pluginBuild) {
171318
+ pluginBuild.onLoad({ filter: /\.(tsx?|jsx?)$/ }, (args) => {
171319
+ try {
171320
+ const contents = readFileSync5(args.path, "utf-8");
171321
+ const ext = args.path.split(".").pop() ?? "tsx";
171322
+ const loaderMap = {
171323
+ js: "js",
171324
+ jsx: "jsx",
171325
+ ts: "ts",
171326
+ tsx: "tsx"
171327
+ };
171328
+ return {
171329
+ contents,
171330
+ loader: loaderMap[ext] ?? "tsx"
171331
+ };
171332
+ } catch {
171333
+ return;
171334
+ }
171335
+ });
171336
+ }
171337
+ } : undefined;
171315
171338
  const reactBuildConfig = reactClientEntryPoints.length > 0 ? {
171316
171339
  entrypoints: reactClientEntryPoints,
171317
171340
  ...vendorPaths ? { external: Object.keys(vendorPaths) } : {},
@@ -171320,6 +171343,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171320
171343
  naming: `[dir]/[name].[hash].[ext]`,
171321
171344
  outdir: buildPath,
171322
171345
  ...hmr ? { jsx: { development: true }, reactFastRefresh: true } : {},
171346
+ ...freshFilePlugin ? { plugins: [freshFilePlugin] } : {},
171323
171347
  root: clientRoot,
171324
171348
  splitting: true,
171325
171349
  target: "browser",
@@ -202550,17 +202574,38 @@ var parseErrorLocationFromMessage = (msg) => {
202550
202574
  vendorPaths = computeVendorPaths2();
202551
202575
  setDevVendorPaths2(vendorPaths);
202552
202576
  }
202553
- const { rmSync: rmSync2 } = await import("fs");
202577
+ const { rmSync: rmSync2, readFileSync: readFileSync9 } = await import("fs");
202554
202578
  rmSync2(resolve19(buildDir, "react", "indexes"), {
202555
202579
  force: true,
202556
202580
  recursive: true
202557
202581
  });
202582
+ const freshFilePlugin = {
202583
+ name: "hmr-fresh-files",
202584
+ setup(build3) {
202585
+ build3.onLoad({ filter: /\.(tsx?|jsx?)$/ }, (args) => {
202586
+ try {
202587
+ const contents = readFileSync9(args.path, "utf-8");
202588
+ const ext = args.path.split(".").pop() ?? "tsx";
202589
+ const loaderMap = {
202590
+ js: "js",
202591
+ jsx: "jsx",
202592
+ ts: "ts",
202593
+ tsx: "tsx"
202594
+ };
202595
+ return { contents, loader: loaderMap[ext] ?? "tsx" };
202596
+ } catch {
202597
+ return;
202598
+ }
202599
+ });
202600
+ }
202601
+ };
202558
202602
  const clientResult = await bunBuild5({
202559
202603
  entrypoints: reactEntries,
202560
202604
  format: "esm",
202561
202605
  jsx: { development: true },
202562
202606
  naming: "[dir]/[name].[hash].[ext]",
202563
202607
  outdir: buildDir,
202608
+ plugins: [freshFilePlugin],
202564
202609
  reactFastRefresh: true,
202565
202610
  root: clientRoot,
202566
202611
  splitting: true,
@@ -203987,5 +204032,5 @@ export {
203987
204032
  ANGULAR_INIT_TIMEOUT_MS
203988
204033
  };
203989
204034
 
203990
- //# debugId=1681BB757EF4C68C64756E2164756E21
204035
+ //# debugId=3DF2C619AEF5C5C064756E2164756E21
203991
204036
  //# sourceMappingURL=index.js.map