@absolutejs/absolute 0.19.0-beta.133 → 0.19.0-beta.135

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
@@ -171258,7 +171258,7 @@ import {
171258
171258
  statSync,
171259
171259
  writeFileSync as writeFileSync3
171260
171260
  } from "fs";
171261
- import { basename as basename5, dirname as dirname6, join as join13, relative as relative7, resolve as resolve11 } from "path";
171261
+ import { basename as basename5, join as join13, relative as relative7, resolve as resolve11 } from "path";
171262
171262
  import { cwd, env as env2, exit } from "process";
171263
171263
  var {build: bunBuild6, Glob: Glob5 } = globalThis.Bun;
171264
171264
  var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental, throwOnError) => {
@@ -171538,13 +171538,23 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171538
171538
  ...angularServerPaths
171539
171539
  ];
171540
171540
  const reactClientEntryPoints = [...reactEntries];
171541
+ const allFrameworkDirs = [
171542
+ reactDir,
171543
+ svelteDir,
171544
+ vueDir,
171545
+ angularDir,
171546
+ htmlDir,
171547
+ htmxDir
171548
+ ].filter((d) => Boolean(d));
171549
+ const urlReferencedFiles = await scanWorkerReferences(allFrameworkDirs);
171541
171550
  const nonReactClientEntryPoints = [
171542
171551
  ...svelteIndexPaths,
171543
171552
  ...svelteClientPaths,
171544
171553
  ...htmlEntries,
171545
171554
  ...vueIndexPaths,
171546
171555
  ...vueClientPaths,
171547
- ...angularClientPaths
171556
+ ...angularClientPaths,
171557
+ ...urlReferencedFiles
171548
171558
  ];
171549
171559
  if (serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
171550
171560
  logWarn("No entry points found, manifest will be empty");
@@ -171719,15 +171729,6 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171719
171729
  if (hmr && reactClientOutputPaths.length > 0) {
171720
171730
  await patchRefreshGlobals(reactClientOutputPaths);
171721
171731
  }
171722
- const frameworkDirs = [
171723
- reactDir,
171724
- svelteDir,
171725
- vueDir,
171726
- angularDir,
171727
- htmlDir,
171728
- htmxDir
171729
- ].filter((d) => Boolean(d));
171730
- const workerEntryPoints = await scanWorkerReferences(frameworkDirs);
171731
171732
  const nonReactClientLogs = nonReactClientResult?.logs ?? [];
171732
171733
  const nonReactClientOutputs = nonReactClientResult?.outputs ?? [];
171733
171734
  if (nonReactClientResult && !nonReactClientResult.success && nonReactClientLogs.length > 0) {
@@ -171758,22 +171759,36 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171758
171759
  if (vueCssResult && !vueCssResult.success && vueCssResult.logs.length > 0) {
171759
171760
  extractBuildError(vueCssResult.logs, "vue-css", "Vue CSS", frameworkNames, isIncremental, throwOnError);
171760
171761
  }
171761
- if (hmr && workerEntryPoints.length > 0) {
171762
+ if (urlReferencedFiles.length > 0) {
171762
171763
  const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
171763
171764
  const allClientOutputPaths = [
171764
171765
  ...reactClientOutputPaths,
171765
171766
  ...nonReactClientOutputs.map((a) => a.path)
171766
171767
  ];
171768
+ const urlFileMap = new Map;
171769
+ if (hmr) {
171770
+ for (const srcPath of urlReferencedFiles) {
171771
+ const rel = relative7(projectRoot, srcPath).replace(/\\/g, "/");
171772
+ urlFileMap.set(basename5(srcPath), `/@src/${rel}`);
171773
+ }
171774
+ } else {
171775
+ for (const srcPath of urlReferencedFiles) {
171776
+ const srcBase = basename5(srcPath).replace(/\.[^.]+$/, "");
171777
+ const output = nonReactClientOutputs.find((a) => basename5(a.path).startsWith(srcBase + "."));
171778
+ if (output) {
171779
+ urlFileMap.set(basename5(srcPath), "/" + relative7(buildPath, output.path).replace(/\\/g, "/"));
171780
+ }
171781
+ }
171782
+ }
171767
171783
  for (const outputPath of allClientOutputPaths) {
171768
171784
  let content = readFileSync5(outputPath, "utf-8");
171769
171785
  let changed = false;
171770
171786
  content = content.replace(urlPattern, (_match, relPath) => {
171771
171787
  const targetName = basename5(relPath);
171772
- const workerSrc = workerEntryPoints.find((wp) => basename5(wp) === targetName);
171773
- if (workerSrc) {
171774
- const rel = relative7(projectRoot, workerSrc);
171788
+ const resolvedPath = urlFileMap.get(targetName);
171789
+ if (resolvedPath) {
171775
171790
  changed = true;
171776
- return `new URL('/@src/${rel.replace(/\\/g, "/")}', import.meta.url)`;
171791
+ return `new URL('${resolvedPath}', import.meta.url)`;
171777
171792
  }
171778
171793
  return _match;
171779
171794
  });
@@ -171781,59 +171796,6 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171781
171796
  writeFileSync3(outputPath, content);
171782
171797
  }
171783
171798
  }
171784
- let workerOutputs = [];
171785
- if (workerEntryPoints.length > 0) {
171786
- const workerResult = await bunBuild6({
171787
- entrypoints: workerEntryPoints,
171788
- format: "esm",
171789
- minify: !isDev,
171790
- naming: "[dir]/[name].[hash].[ext]",
171791
- outdir: buildPath,
171792
- root: commonAncestor(workerEntryPoints.map((p) => dirname6(p))),
171793
- target: "browser",
171794
- throw: false
171795
- });
171796
- if (workerResult.success) {
171797
- workerOutputs = workerResult.outputs;
171798
- const workerUrlMap = new Map;
171799
- for (const artifact of workerOutputs) {
171800
- for (const ep of workerEntryPoints) {
171801
- const epBase = basename5(ep).replace(/\.[^.]+$/, "");
171802
- if (basename5(artifact.path).startsWith(epBase)) {
171803
- workerUrlMap.set(ep, "/" + relative7(buildPath, artifact.path));
171804
- }
171805
- }
171806
- }
171807
- const allClientOutputPaths = [
171808
- ...reactClientOutputPaths,
171809
- ...nonReactClientOutputs.map((a) => a.path)
171810
- ];
171811
- for (const outputPath of allClientOutputPaths) {
171812
- let content = readFileSync5(outputPath, "utf-8");
171813
- let changed = false;
171814
- for (const [srcPath, hashedPath] of workerUrlMap) {
171815
- const srcRelPatterns = [
171816
- "./" + relative7(buildPath, srcPath),
171817
- "../" + relative7(buildPath, srcPath),
171818
- relative7(buildPath, srcPath)
171819
- ];
171820
- for (const pattern of srcRelPatterns) {
171821
- if (content.includes(pattern)) {
171822
- content = content.replaceAll(pattern, hashedPath);
171823
- changed = true;
171824
- }
171825
- }
171826
- }
171827
- if (changed)
171828
- writeFileSync3(outputPath, content);
171829
- }
171830
- } else {
171831
- const workerLogs = workerResult.logs;
171832
- if (workerLogs.length > 0) {
171833
- extractBuildError(workerLogs, "worker", "Worker", frameworkNames, isIncremental, throwOnError);
171834
- }
171835
- }
171836
- }
171837
171799
  const allLogs = [
171838
171800
  ...serverLogs,
171839
171801
  ...reactClientLogs,
@@ -171847,8 +171809,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171847
171809
  ...serverOutputs,
171848
171810
  ...reactClientOutputs,
171849
171811
  ...nonReactClientOutputs,
171850
- ...cssOutputs,
171851
- ...workerOutputs
171812
+ ...cssOutputs
171852
171813
  ], buildPath)
171853
171814
  };
171854
171815
  for (const artifact of serverOutputs) {
@@ -205735,5 +205696,5 @@ export {
205735
205696
  ANGULAR_INIT_TIMEOUT_MS
205736
205697
  };
205737
205698
 
205738
- //# debugId=361691875C3A51BD64756E2164756E21
205699
+ //# debugId=74CA01BF01A9C39364756E2164756E21
205739
205700
  //# sourceMappingURL=index.js.map