@absolutejs/absolute 0.19.0-beta.845 → 0.19.0-beta.847

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.
Files changed (37) hide show
  1. package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
  2. package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
  3. package/dist/angular/index.js +45 -23
  4. package/dist/angular/index.js.map +11 -10
  5. package/dist/angular/server.js +45 -23
  6. package/dist/angular/server.js.map +11 -10
  7. package/dist/build.js +955 -498
  8. package/dist/build.js.map +16 -13
  9. package/dist/cli/index.js +547 -286
  10. package/dist/client/index.js +16 -9
  11. package/dist/client/index.js.map +6 -5
  12. package/dist/dev/client/handlers/angular.ts +309 -19
  13. package/dist/dev/client/handlers/angularRuntime.ts +468 -0
  14. package/dist/dev/client/hmrToast.ts +150 -0
  15. package/dist/index.js +1002 -545
  16. package/dist/index.js.map +17 -14
  17. package/dist/islands/index.js +32 -11
  18. package/dist/islands/index.js.map +7 -6
  19. package/dist/react/index.js +32 -11
  20. package/dist/react/index.js.map +7 -6
  21. package/dist/src/build/rewriteImports.d.ts +6 -14
  22. package/dist/src/build/rewriteImportsPlugin.d.ts +48 -0
  23. package/dist/src/dev/angular/editTypeDetection.d.ts +8 -0
  24. package/dist/src/dev/pathUtils.d.ts +3 -0
  25. package/dist/src/utils/buildDirectoryLock.d.ts +26 -3
  26. package/dist/src/utils/loadConfig.d.ts +5 -0
  27. package/dist/src/utils/resolveDevPort.d.ts +21 -0
  28. package/dist/src/utils/runtimeMode.d.ts +3 -0
  29. package/dist/svelte/index.js +32 -11
  30. package/dist/svelte/index.js.map +7 -6
  31. package/dist/svelte/server.js +17 -3
  32. package/dist/svelte/server.js.map +3 -3
  33. package/dist/types/build.d.ts +15 -0
  34. package/dist/types/globals.d.ts +12 -0
  35. package/dist/vue/index.js +32 -11
  36. package/dist/vue/index.js.map +7 -6
  37. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -620,6 +620,18 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
620
620
  return runPostcss(await readFile(filePath, "utf-8"), filePath, config);
621
621
  }
622
622
  return compileStyleSource(filePath, undefined, undefined, config);
623
+ }, CSS_IMPORT_PATTERN, resolveCssImportsSync = (content, baseDir, visited) => {
624
+ return content.replace(CSS_IMPORT_PATTERN, (match, importPath) => {
625
+ const fullPath = isAbsolute(importPath) ? importPath : resolve2(baseDir, importPath);
626
+ if (visited.has(fullPath))
627
+ return "";
628
+ if (!existsSync3(fullPath))
629
+ return match;
630
+ const nextVisited = new Set(visited);
631
+ nextVisited.add(fullPath);
632
+ const imported = readFileSync3(fullPath, "utf-8");
633
+ return resolveCssImportsSync(imported, dirname2(fullPath), nextVisited);
634
+ });
623
635
  }, compileStyleFileIfNeededSync = (filePath, config) => {
624
636
  const rawContents = readFileSync3(filePath, "utf-8");
625
637
  const language = getStyleLanguage(filePath);
@@ -637,7 +649,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
637
649
  }
638
650
  const contents = withAdditionalData(rawContents, options.additionalData);
639
651
  const loadPaths = normalizeLoadPaths(filePath, options.loadPaths);
640
- return sass.compileString(contents, {
652
+ const compiled = sass.compileString(contents, {
641
653
  importers: [
642
654
  createSassImporter(filePath, loadPaths, language, config)
643
655
  ],
@@ -646,6 +658,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
646
658
  syntax: language === "sass" ? "indented" : "scss",
647
659
  url: new URL(`file://${filePath}`)
648
660
  }).css;
661
+ return resolveCssImportsSync(compiled, dirname2(filePath), new Set([filePath]));
649
662
  }
650
663
  if (language === "less") {
651
664
  throw new Error(`Unable to compile ${filePath}: Less styleUrl preprocessing is async-only. Import the Less file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
@@ -653,7 +666,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
653
666
  if (language === "stylus") {
654
667
  throw new Error(`Unable to compile ${filePath}: Stylus styleUrl preprocessing is async-only. Import the Stylus file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
655
668
  }
656
- return rawContents;
669
+ return resolveCssImportsSync(rawContents, dirname2(filePath), new Set([filePath]));
657
670
  }, getCssOutputExtension = (filePath) => isPreprocessableStylePath(filePath) ? ".css" : extname(filePath);
658
671
  var init_stylePreprocessor = __esm(() => {
659
672
  CSS_EXTENSION_PATTERN = /\.css$/i;
@@ -666,6 +679,7 @@ var init_stylePreprocessor = __esm(() => {
666
679
  styleDependencyGraph = new Map;
667
680
  styleOutputHashes = new Map;
668
681
  stylePreprocessorPlugin = createStylePreprocessorPlugin();
682
+ CSS_IMPORT_PATTERN = /@import\s+["']([^"']+)["']\s*;?/g;
669
683
  });
670
684
 
671
685
  // node_modules/tailwindcss/dist/chunk-HTB5LLOP.mjs
@@ -6557,6 +6571,9 @@ var init_streamingSlots = __esm(() => {
6557
6571
  };
6558
6572
  });
6559
6573
 
6574
+ // src/utils/runtimeMode.ts
6575
+ var ENV_VAR = "NODE_ENV", isProductionRuntime = () => process.env[ENV_VAR] === "production", isDevelopmentRuntime = () => process.env[ENV_VAR] === "development";
6576
+
6560
6577
  // src/angular/angularPatch.ts
6561
6578
  var exports_angularPatch = {};
6562
6579
  __export(exports_angularPatch, {
@@ -6639,7 +6656,8 @@ var ensureHead = (doc) => {
6639
6656
  }
6640
6657
  layoutPatchApplied = true;
6641
6658
  }, applyPatches = async () => {
6642
- const { \u{275}DominoAdapter } = await import(resolveAngularRuntimePath("@angular/platform-server"));
6659
+ const spec = isProductionRuntime() ? resolveAngularRuntimePath("@angular/platform-server") : "@angular/platform-server";
6660
+ const { \u{275}DominoAdapter } = await import(spec);
6643
6661
  if (!\u{275}DominoAdapter?.prototype) {
6644
6662
  console.warn("[Angular Patch] \u0275DominoAdapter not found, skipping patches");
6645
6663
  return false;
@@ -6706,18 +6724,21 @@ var initDominoAdapter = (platformServer) => {
6706
6724
  console.error("Failed to initialize DominoAdapter:", err);
6707
6725
  }
6708
6726
  }, loadAngularDeps = async () => {
6709
- if (true) {
6710
- await import(resolveAngularRuntimePath("@angular/compiler"));
6727
+ if (!isProductionRuntime()) {
6728
+ await import("@angular/compiler");
6711
6729
  }
6712
6730
  const { applyPatches: applyPatches2 } = await Promise.resolve().then(() => (init_angularPatch(), exports_angularPatch));
6713
6731
  await applyPatches2();
6732
+ const useBareSpecifiers = !isProductionRuntime();
6714
6733
  const [platformBrowser, platformServer, common, core] = await Promise.all([
6715
- import(resolveAngularRuntimePath("@angular/platform-browser")),
6716
- import(resolveAngularRuntimePath("@angular/platform-server")),
6717
- import(resolveAngularRuntimePath("@angular/common")),
6718
- import(resolveAngularRuntimePath("@angular/core"))
6734
+ useBareSpecifiers ? import("@angular/platform-browser") : import(resolveAngularRuntimePath("@angular/platform-browser")),
6735
+ useBareSpecifiers ? import("@angular/platform-server") : import(resolveAngularRuntimePath("@angular/platform-server")),
6736
+ useBareSpecifiers ? import("@angular/common") : import(resolveAngularRuntimePath("@angular/common")),
6737
+ useBareSpecifiers ? import("@angular/core") : import(resolveAngularRuntimePath("@angular/core"))
6719
6738
  ]);
6720
- if (false) {}
6739
+ if (!isDevelopmentRuntime()) {
6740
+ core.enableProdMode();
6741
+ }
6721
6742
  initDominoAdapter(platformServer);
6722
6743
  return {
6723
6744
  APP_BASE_HREF: common.APP_BASE_HREF,
@@ -9842,9 +9863,34 @@ var commonAncestor = (paths, fallback) => {
9842
9863
  var init_commonAncestor = () => {};
9843
9864
 
9844
9865
  // src/utils/buildDirectoryLock.ts
9845
- import { mkdir as mkdir3, rm as rm4, stat as stat2, writeFile as writeFile4 } from "fs/promises";
9866
+ import { mkdirSync as mkdirSync6, unlinkSync, writeFileSync as writeFileSync7, readFileSync as readFileSync12 } from "fs";
9846
9867
  import { dirname as dirname10, join as join14 } from "path";
9847
- var DEFAULT_LOCK_TIMEOUT_MS = 120000, DEFAULT_STALE_LOCK_MS, LOCK_POLL_MS = 250, heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", isAlreadyExistsError = (error) => error instanceof Error && ("code" in error) && error.code === "EEXIST", lockPathForBuildDirectory = (buildDirectory) => join14(dirname10(buildDirectory), `.${buildDirectory.split(/[\\/]/).pop()}.lock`), readHeldLockEnv = () => new Set((process.env[HELD_LOCKS_ENV] ?? "").split(`
9868
+ var heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", exitHandlersRegistered = false, registerExitHandlersOnce = () => {
9869
+ if (exitHandlersRegistered)
9870
+ return;
9871
+ exitHandlersRegistered = true;
9872
+ const releaseAllSync = () => {
9873
+ for (const lock of heldLocks.values()) {
9874
+ try {
9875
+ lock.releaseSync();
9876
+ } catch {}
9877
+ }
9878
+ heldLocks.clear();
9879
+ };
9880
+ process.on("exit", releaseAllSync);
9881
+ process.on("SIGINT", () => {
9882
+ releaseAllSync();
9883
+ process.exit(130);
9884
+ });
9885
+ process.on("SIGTERM", () => {
9886
+ releaseAllSync();
9887
+ process.exit(143);
9888
+ });
9889
+ process.on("uncaughtException", (err) => {
9890
+ releaseAllSync();
9891
+ throw err;
9892
+ });
9893
+ }, isAlreadyExistsError = (error) => error instanceof Error && ("code" in error) && error.code === "EEXIST", lockPathForBuildDirectory = (buildDirectory) => join14(dirname10(buildDirectory), ".absolutejs", "build.lock"), readHeldLockEnv = () => new Set((process.env[HELD_LOCKS_ENV] ?? "").split(`
9848
9894
  `).filter((entry) => entry.length > 0)), writeHeldLockEnv = (locks) => {
9849
9895
  if (locks.size === 0) {
9850
9896
  delete process.env[HELD_LOCKS_ENV];
@@ -9860,7 +9906,41 @@ var DEFAULT_LOCK_TIMEOUT_MS = 120000, DEFAULT_STALE_LOCK_MS, LOCK_POLL_MS = 250,
9860
9906
  const locks = readHeldLockEnv();
9861
9907
  locks.delete(buildDirectory);
9862
9908
  writeHeldLockEnv(locks);
9863
- }, acquireBuildDirectoryLock = async (buildDirectory, options = {}) => {
9909
+ }, writeLockFileSync = (lockPath, metadata2) => {
9910
+ mkdirSync6(dirname10(lockPath), { recursive: true });
9911
+ writeFileSync7(lockPath, JSON.stringify(metadata2, null, 2), { flag: "wx" });
9912
+ }, readLockMetadata = (lockPath) => {
9913
+ try {
9914
+ const raw = readFileSync12(lockPath, "utf-8");
9915
+ const parsed = JSON.parse(raw);
9916
+ if (typeof parsed === "object" && parsed !== null && typeof parsed.pid === "number") {
9917
+ return {
9918
+ pid: parsed.pid,
9919
+ port: typeof parsed.port === "number" ? parsed.port : null,
9920
+ startedAt: typeof parsed.startedAt === "string" ? parsed.startedAt : new Date().toISOString()
9921
+ };
9922
+ }
9923
+ } catch {}
9924
+ return null;
9925
+ }, isProcessAlive = (pid) => {
9926
+ try {
9927
+ process.kill(pid, 0);
9928
+ return true;
9929
+ } catch (err) {
9930
+ const code = err.code;
9931
+ if (code === "ESRCH")
9932
+ return false;
9933
+ if (code === "EPERM")
9934
+ return true;
9935
+ return true;
9936
+ }
9937
+ }, removeStaleLockSync = (lockPath, pid) => {
9938
+ try {
9939
+ unlinkSync(lockPath);
9940
+ console.warn(`[absolutejs] removed stale lock from PID ${pid}`);
9941
+ } catch {}
9942
+ }, LOCK_POLL_MS = 250, DEFAULT_WAIT_TIMEOUT_MS = 120000, acquireBuildDirectoryLock = async (buildDirectory, options = {}) => {
9943
+ registerExitHandlersOnce();
9864
9944
  if (readHeldLockEnv().has(buildDirectory)) {
9865
9945
  return async () => {};
9866
9946
  }
@@ -9876,52 +9956,66 @@ var DEFAULT_LOCK_TIMEOUT_MS = 120000, DEFAULT_STALE_LOCK_MS, LOCK_POLL_MS = 250,
9876
9956
  };
9877
9957
  }
9878
9958
  const lockPath = lockPathForBuildDirectory(buildDirectory);
9879
- const staleLockMs = options.staleLockMs ?? DEFAULT_STALE_LOCK_MS;
9880
- const timeoutMs = options.timeoutMs ?? DEFAULT_LOCK_TIMEOUT_MS;
9959
+ const wait = options.wait !== false;
9960
+ const waitTimeoutMs = options.waitTimeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS;
9881
9961
  const start = Date.now();
9962
+ const tryCreate = () => {
9963
+ writeLockFileSync(lockPath, {
9964
+ pid: process.pid,
9965
+ port: options.port ?? null,
9966
+ startedAt: new Date().toISOString()
9967
+ });
9968
+ };
9882
9969
  while (true) {
9883
9970
  try {
9884
- await mkdir3(dirname10(lockPath), { recursive: true });
9885
- await mkdir3(lockPath);
9886
- await writeFile4(join14(lockPath, "owner"), JSON.stringify({
9887
- buildDirectory,
9888
- createdAt: new Date().toISOString(),
9889
- pid: process.pid
9890
- }, null, 2));
9891
- const release = async () => {
9892
- await rm4(lockPath, { force: true, recursive: true }).catch(() => {});
9893
- };
9894
- heldLocks.set(buildDirectory, { count: 1, release });
9895
- markHeldLock(buildDirectory);
9896
- return async () => {
9897
- const current = heldLocks.get(buildDirectory);
9898
- if (!current)
9899
- return;
9900
- current.count -= 1;
9901
- if (current.count > 0)
9902
- return;
9903
- heldLocks.delete(buildDirectory);
9904
- unmarkHeldLock(buildDirectory);
9905
- await current.release();
9906
- };
9971
+ tryCreate();
9972
+ break;
9907
9973
  } catch (error) {
9908
9974
  if (!isAlreadyExistsError(error))
9909
9975
  throw error;
9910
- try {
9911
- const lockStat = await stat2(lockPath);
9912
- if (Date.now() - lockStat.mtimeMs > staleLockMs) {
9913
- await rm4(lockPath, { force: true, recursive: true });
9914
- continue;
9915
- }
9916
- } catch {}
9917
- if (Date.now() - start > timeoutMs) {
9918
- throw new Error(`Timed out waiting for AbsoluteJS build directory lock: ${buildDirectory}`);
9976
+ const existing = readLockMetadata(lockPath);
9977
+ if (!existing) {
9978
+ try {
9979
+ unlinkSync(lockPath);
9980
+ } catch {}
9981
+ continue;
9919
9982
  }
9920
- await Bun.sleep(LOCK_POLL_MS);
9983
+ if (!isProcessAlive(existing.pid)) {
9984
+ removeStaleLockSync(lockPath, existing.pid);
9985
+ continue;
9986
+ }
9987
+ if (wait && Date.now() - start < waitTimeoutMs) {
9988
+ await Bun.sleep(LOCK_POLL_MS);
9989
+ continue;
9990
+ }
9991
+ const portInfo = existing.port ? ` on port ${existing.port}` : "";
9992
+ const elapsedNote = wait ? ` Waited ${Math.round((Date.now() - start) / 1000)}s.` : "";
9993
+ throw new Error(`AbsoluteJS build lock is held by PID ${existing.pid}${portInfo} (started ${existing.startedAt}).${elapsedNote} ` + `Another process owns ${buildDirectory}. ` + `Run \`kill ${existing.pid}\` (or wait for it to finish) and try again.`);
9921
9994
  }
9922
9995
  }
9923
- }, withBuildDirectoryLock = async (buildDirectory, action) => {
9924
- const release = await acquireBuildDirectoryLock(buildDirectory);
9996
+ const releaseSync = () => {
9997
+ try {
9998
+ unlinkSync(lockPath);
9999
+ } catch {}
10000
+ };
10001
+ const release = async () => {
10002
+ releaseSync();
10003
+ };
10004
+ heldLocks.set(buildDirectory, { count: 1, release, releaseSync });
10005
+ markHeldLock(buildDirectory);
10006
+ return async () => {
10007
+ const current = heldLocks.get(buildDirectory);
10008
+ if (!current)
10009
+ return;
10010
+ current.count -= 1;
10011
+ if (current.count > 0)
10012
+ return;
10013
+ heldLocks.delete(buildDirectory);
10014
+ unmarkHeldLock(buildDirectory);
10015
+ await current.release();
10016
+ };
10017
+ }, withBuildDirectoryLock = async (buildDirectory, action, options = {}) => {
10018
+ const release = await acquireBuildDirectoryLock(buildDirectory, options);
9925
10019
  try {
9926
10020
  return await action();
9927
10021
  } finally {
@@ -9929,7 +10023,6 @@ var DEFAULT_LOCK_TIMEOUT_MS = 120000, DEFAULT_STALE_LOCK_MS, LOCK_POLL_MS = 250,
9929
10023
  }
9930
10024
  };
9931
10025
  var init_buildDirectoryLock = __esm(() => {
9932
- DEFAULT_STALE_LOCK_MS = 10 * 60000;
9933
10026
  heldLocks = new Map;
9934
10027
  });
9935
10028
 
@@ -10009,7 +10102,7 @@ __export(exports_compileSvelte, {
10009
10102
  clearSvelteCompilerCache: () => clearSvelteCompilerCache
10010
10103
  });
10011
10104
  import { existsSync as existsSync15 } from "fs";
10012
- import { mkdir as mkdir4, stat as stat3 } from "fs/promises";
10105
+ import { mkdir as mkdir3, stat as stat2 } from "fs/promises";
10013
10106
  import {
10014
10107
  dirname as dirname11,
10015
10108
  join as join15,
@@ -10052,7 +10145,7 @@ var resolveDevClientDir2 = () => {
10052
10145
  return /\b__require\b/.test(stripped) ? code : stripped;
10053
10146
  }, exists = async (path) => {
10054
10147
  try {
10055
- await stat3(path);
10148
+ await stat2(path);
10056
10149
  return true;
10057
10150
  } catch {
10058
10151
  return false;
@@ -10120,7 +10213,7 @@ var resolveDevClientDir2 = () => {
10120
10213
  const clientDir = join15(generatedDir, "client");
10121
10214
  const indexDir = join15(generatedDir, "indexes");
10122
10215
  const serverDir = join15(generatedDir, "server");
10123
- await Promise.all([clientDir, indexDir, serverDir].map((dir) => mkdir4(dir, { recursive: true })));
10216
+ await Promise.all([clientDir, indexDir, serverDir].map((dir) => mkdir3(dir, { recursive: true })));
10124
10217
  const dev = env2.NODE_ENV !== "production";
10125
10218
  const build2 = async (src) => {
10126
10219
  const memoized = cache.get(src);
@@ -10226,8 +10319,8 @@ var resolveDevClientDir2 = () => {
10226
10319
  const ssrPath = join15(serverDir, relDir, `${baseName}.js`);
10227
10320
  const clientPath = join15(clientDir, relDir, `${baseName}.js`);
10228
10321
  await Promise.all([
10229
- mkdir4(dirname11(ssrPath), { recursive: true }),
10230
- mkdir4(dirname11(clientPath), { recursive: true })
10322
+ mkdir3(dirname11(ssrPath), { recursive: true }),
10323
+ mkdir3(dirname11(clientPath), { recursive: true })
10231
10324
  ]);
10232
10325
  if (isModule) {
10233
10326
  const bundle = rewriteExternalImports(generate("client"), "client");
@@ -10328,7 +10421,7 @@ if (typeof window !== "undefined") {
10328
10421
  setTimeout(releaseStreamingSlots, 0);
10329
10422
  }
10330
10423
  }`;
10331
- await mkdir4(dirname11(indexPath), { recursive: true });
10424
+ await mkdir3(dirname11(indexPath), { recursive: true });
10332
10425
  return write(indexPath, bootstrap);
10333
10426
  }));
10334
10427
  return {
@@ -10416,7 +10509,7 @@ __export(exports_compileVue, {
10416
10509
  clearVueHmrCaches: () => clearVueHmrCaches
10417
10510
  });
10418
10511
  import { existsSync as existsSync16 } from "fs";
10419
- import { mkdir as mkdir5 } from "fs/promises";
10512
+ import { mkdir as mkdir4 } from "fs/promises";
10420
10513
  import {
10421
10514
  basename as basename6,
10422
10515
  dirname as dirname12,
@@ -10597,7 +10690,7 @@ var resolveDevClientDir3 = () => {
10597
10690
  let cssOutputPaths = [];
10598
10691
  if (isEntryPoint && allCss.length) {
10599
10692
  const cssOutputFile = join16(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`);
10600
- await mkdir5(dirname12(cssOutputFile), { recursive: true });
10693
+ await mkdir4(dirname12(cssOutputFile), { recursive: true });
10601
10694
  await write2(cssOutputFile, allCss.join(`
10602
10695
  `));
10603
10696
  cssOutputPaths = [cssOutputFile];
@@ -10648,8 +10741,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
10648
10741
  }
10649
10742
  return result2;
10650
10743
  };
10651
- await mkdir5(dirname12(clientOutputPath), { recursive: true });
10652
- await mkdir5(dirname12(serverOutputPath), { recursive: true });
10744
+ await mkdir4(dirname12(clientOutputPath), { recursive: true });
10745
+ await mkdir4(dirname12(serverOutputPath), { recursive: true });
10653
10746
  await write2(clientOutputPath, rewritePackageImports(adjustImports(clientCode), clientOutputPath, "client"));
10654
10747
  await write2(serverOutputPath, rewritePackageImports(adjustImports(serverCode), serverOutputPath, "server"));
10655
10748
  const result = {
@@ -10674,10 +10767,10 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
10674
10767
  const serverOutputDir = join16(generatedDir, "server");
10675
10768
  const cssOutputDir = join16(generatedDir, "compiled");
10676
10769
  await Promise.all([
10677
- mkdir5(clientOutputDir, { recursive: true }),
10678
- mkdir5(indexOutputDir, { recursive: true }),
10679
- mkdir5(serverOutputDir, { recursive: true }),
10680
- mkdir5(cssOutputDir, { recursive: true })
10770
+ mkdir4(clientOutputDir, { recursive: true }),
10771
+ mkdir4(indexOutputDir, { recursive: true }),
10772
+ mkdir4(serverOutputDir, { recursive: true }),
10773
+ mkdir4(cssOutputDir, { recursive: true })
10681
10774
  ]);
10682
10775
  const buildCache = new Map;
10683
10776
  const allTsHelperPaths = new Set;
@@ -10691,7 +10784,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
10691
10784
  const entryBaseName = basename6(entryPath, ".vue");
10692
10785
  const indexOutputFile = join16(indexOutputDir, `${entryBaseName}.js`);
10693
10786
  const clientOutputFile = join16(clientOutputDir, relative8(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
10694
- await mkdir5(dirname12(indexOutputFile), { recursive: true });
10787
+ await mkdir4(dirname12(indexOutputFile), { recursive: true });
10695
10788
  const vueHmrImports = isDev2 ? [
10696
10789
  `window.__HMR_FRAMEWORK__ = "vue";`,
10697
10790
  `import "${hmrClientPath4}";`
@@ -10845,8 +10938,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
10845
10938
  const relativeJsPath = relative8(vueRootDir, tsPath).replace(/\.ts$/, ".js");
10846
10939
  const outClientPath = join16(clientOutputDir, relativeJsPath);
10847
10940
  const outServerPath = join16(serverOutputDir, relativeJsPath);
10848
- await mkdir5(dirname12(outClientPath), { recursive: true });
10849
- await mkdir5(dirname12(outServerPath), { recursive: true });
10941
+ await mkdir4(dirname12(outClientPath), { recursive: true });
10942
+ await mkdir4(dirname12(outServerPath), { recursive: true });
10850
10943
  await write2(outClientPath, transpiledCode);
10851
10944
  await write2(outServerPath, transpiledCode);
10852
10945
  }));
@@ -11345,7 +11438,7 @@ __export(exports_compileAngular, {
11345
11438
  compileAngularFile: () => compileAngularFile,
11346
11439
  compileAngular: () => compileAngular
11347
11440
  });
11348
- import { existsSync as existsSync17, readFileSync as readFileSync12, promises as fs } from "fs";
11441
+ import { existsSync as existsSync17, readFileSync as readFileSync13, promises as fs } from "fs";
11349
11442
  import { join as join17, basename as basename7, sep as sep3, dirname as dirname13, resolve as resolve19, relative as relative9 } from "path";
11350
11443
  import ts2 from "typescript";
11351
11444
  var traceAngularPhase = async (name, fn2, metadata2) => {
@@ -11482,16 +11575,16 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
11482
11575
  return fromNodeModules;
11483
11576
  return resolve19(import.meta.dir, "./dev/client");
11484
11577
  }, devClientDir4, hmrClientPath5, hmrRuntimePath, injectHMRRegistration = (content, sourceId) => {
11485
- const componentClassRegex = /(?:export\s+)?class\s+(\w+Component)\s/g;
11486
- const componentNames = [];
11578
+ const entityClassRegex = /(?:export\s+)?class\s+(\w+(?:Component|Service|Directive|Pipe))\s/g;
11579
+ const entityNames = [];
11487
11580
  let match;
11488
- while ((match = componentClassRegex.exec(content)) !== null) {
11581
+ while ((match = entityClassRegex.exec(content)) !== null) {
11489
11582
  if (match[1])
11490
- componentNames.push(match[1]);
11583
+ entityNames.push(match[1]);
11491
11584
  }
11492
- if (componentNames.length === 0)
11585
+ if (entityNames.length === 0)
11493
11586
  return content;
11494
- const registrations = componentNames.map((name) => ` if (typeof ${name} === 'function') window.__ANGULAR_HMR__.register('${sourceId}#${name}', ${name});`).join(`
11587
+ const registrations = entityNames.map((name) => ` if (typeof ${name} === 'function') window.__ANGULAR_HMR__.register('${sourceId}#${name}', ${name});`).join(`
11495
11588
  `);
11496
11589
  const hmrBlock = `
11497
11590
  // Angular HMR Runtime Layer (Level 3) \u2014 Auto-registration
@@ -11700,7 +11793,7 @@ ${registrations}
11700
11793
  const outputPath = resolve19(join17(outDir, relative9(process.cwd(), resolve19(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
11701
11794
  return [
11702
11795
  outputPath,
11703
- buildIslandMetadataExports(readFileSync12(inputPath, "utf-8"))
11796
+ buildIslandMetadataExports(readFileSync13(inputPath, "utf-8"))
11704
11797
  ];
11705
11798
  })), { entries: inputPaths.length });
11706
11799
  await traceAngularPhase("aot/preload-compiler", () => import("@angular/compiler"));
@@ -12009,7 +12102,7 @@ ${fields}
12009
12102
  if (!existsSync17(templatePath)) {
12010
12103
  throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
12011
12104
  }
12012
- const templateRaw2 = readFileSync12(templatePath, "utf-8");
12105
+ const templateRaw2 = readFileSync13(templatePath, "utf-8");
12013
12106
  const lowered2 = lowerAngularDeferSyntax(templateRaw2);
12014
12107
  const escaped2 = escapeTemplateContent(lowered2.template);
12015
12108
  const replacedSource2 = source.slice(0, templateUrlMatch.index) + `template: \`${escaped2}\`` + source.slice(templateUrlMatch.index + templateUrlMatch[0].length);
@@ -12987,7 +13080,7 @@ __export(exports_compileEmber, {
12987
13080
  basename: () => basename8
12988
13081
  });
12989
13082
  import { existsSync as existsSync18 } from "fs";
12990
- import { mkdir as mkdir6, rm as rm5 } from "fs/promises";
13083
+ import { mkdir as mkdir5, rm as rm4 } from "fs/promises";
12991
13084
  import { basename as basename8, dirname as dirname14, extname as extname6, join as join18, resolve as resolve20 } from "path";
12992
13085
  var {build: bunBuild2, Transpiler: Transpiler3, write: write3, file: file4 } = globalThis.Bun;
12993
13086
  var cachedPreprocessor = null, getPreprocessor = async () => {
@@ -13159,9 +13252,9 @@ export default PageComponent;
13159
13252
  const serverDir = join18(compiledRoot, "server");
13160
13253
  const clientDir = join18(compiledRoot, "client");
13161
13254
  await Promise.all([
13162
- mkdir6(tmpDir, { recursive: true }),
13163
- mkdir6(serverDir, { recursive: true }),
13164
- mkdir6(clientDir, { recursive: true })
13255
+ mkdir5(tmpDir, { recursive: true }),
13256
+ mkdir5(serverDir, { recursive: true }),
13257
+ mkdir5(clientDir, { recursive: true })
13165
13258
  ]);
13166
13259
  const tmpPagePath = resolve20(join18(tmpDir, `${baseName}.module.js`));
13167
13260
  const tmpHarnessPath = resolve20(join18(tmpDir, `${baseName}.harness.js`));
@@ -13188,7 +13281,7 @@ export default PageComponent;
13188
13281
  if (!buildResult.success) {
13189
13282
  console.warn(`\u26A0\uFE0F Ember server build for ${baseName} had errors:`, buildResult.logs);
13190
13283
  }
13191
- await rm5(tmpDir, { force: true, recursive: true });
13284
+ await rm4(tmpDir, { force: true, recursive: true });
13192
13285
  const clientPath = join18(clientDir, `${baseName}.js`);
13193
13286
  await write3(clientPath, transpiled);
13194
13287
  return { clientPath, serverPath };
@@ -13237,9 +13330,9 @@ __export(exports_buildReactVendor, {
13237
13330
  computeVendorPaths: () => computeVendorPaths,
13238
13331
  buildReactVendor: () => buildReactVendor
13239
13332
  });
13240
- import { existsSync as existsSync19, mkdirSync as mkdirSync6 } from "fs";
13333
+ import { existsSync as existsSync19, mkdirSync as mkdirSync7 } from "fs";
13241
13334
  import { join as join19, resolve as resolve21 } from "path";
13242
- import { rm as rm6 } from "fs/promises";
13335
+ import { rm as rm5 } from "fs/promises";
13243
13336
  var {build: bunBuild3 } = globalThis.Bun;
13244
13337
  var resolveJsxDevRuntimeCompatPath = () => {
13245
13338
  const candidates = [
@@ -13293,9 +13386,9 @@ var resolveJsxDevRuntimeCompatPath = () => {
13293
13386
  `;
13294
13387
  }, buildReactVendor = async (buildDir) => {
13295
13388
  const vendorDir = join19(buildDir, "react", "vendor");
13296
- mkdirSync6(vendorDir, { recursive: true });
13389
+ mkdirSync7(vendorDir, { recursive: true });
13297
13390
  const tmpDir = join19(buildDir, "_vendor_tmp");
13298
- mkdirSync6(tmpDir, { recursive: true });
13391
+ mkdirSync7(tmpDir, { recursive: true });
13299
13392
  const specifiers = resolveVendorSpecifiers();
13300
13393
  const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
13301
13394
  const safeName = toSafeFileName(specifier);
@@ -13314,7 +13407,7 @@ var resolveJsxDevRuntimeCompatPath = () => {
13314
13407
  target: "browser",
13315
13408
  throw: false
13316
13409
  });
13317
- await rm6(tmpDir, { force: true, recursive: true });
13410
+ await rm5(tmpDir, { force: true, recursive: true });
13318
13411
  if (!result.success) {
13319
13412
  console.warn("\u26A0\uFE0F React vendor build had errors:", result.logs);
13320
13413
  }
@@ -13363,9 +13456,9 @@ __export(exports_buildAngularVendor, {
13363
13456
  buildAngularVendor: () => buildAngularVendor,
13364
13457
  buildAngularServerVendor: () => buildAngularServerVendor
13365
13458
  });
13366
- import { mkdirSync as mkdirSync7 } from "fs";
13459
+ import { mkdirSync as mkdirSync8 } from "fs";
13367
13460
  import { join as join20 } from "path";
13368
- import { rm as rm7 } from "fs/promises";
13461
+ import { rm as rm6 } from "fs/promises";
13369
13462
  var {build: bunBuild4, Glob: Glob6 } = globalThis.Bun;
13370
13463
  var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => jitMode ? [...REQUIRED_ANGULAR_SPECIFIERS_BASE, "@angular/compiler"] : REQUIRED_ANGULAR_SPECIFIERS_BASE, SERVER_ONLY_ANGULAR_SPECIFIERS, BUILD_ONLY_ANGULAR_SPECIFIER_PREFIXES, isBuildOnlyAngularSpecifier = (spec) => BUILD_ONLY_ANGULAR_SPECIFIER_PREFIXES.some((prefix) => spec === prefix || spec.startsWith(`${prefix}/`)), SCAN_SKIP_DIRS, isResolvable2 = (specifier) => {
13371
13464
  try {
@@ -13401,7 +13494,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
13401
13494
  }
13402
13495
  return { angular, transitiveRoots };
13403
13496
  }, PARTIAL_DECL_MARKERS, containsPartialDeclarations = (source) => PARTIAL_DECL_MARKERS.some((marker) => source.includes(marker)), collectTransitiveAngularSpecs = async (roots, angularFound) => {
13404
- const { readFileSync: readFileSync13 } = await import("fs");
13497
+ const { readFileSync: readFileSync14 } = await import("fs");
13405
13498
  const transpiler5 = new Bun.Transpiler({ loader: "js" });
13406
13499
  const visited = new Set;
13407
13500
  const frontier = [];
@@ -13422,7 +13515,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
13422
13515
  }
13423
13516
  let content;
13424
13517
  try {
13425
- content = readFileSync13(resolved, "utf-8");
13518
+ content = readFileSync14(resolved, "utf-8");
13426
13519
  } catch {
13427
13520
  continue;
13428
13521
  }
@@ -13462,9 +13555,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
13462
13555
  return Array.from(angular).filter(isResolvable2);
13463
13556
  }, buildAngularVendor = async (buildDir, directories = [], linkerJitMode = false, depVendorSpecifiers = []) => {
13464
13557
  const vendorDir = join20(buildDir, "angular", "vendor");
13465
- mkdirSync7(vendorDir, { recursive: true });
13558
+ mkdirSync8(vendorDir, { recursive: true });
13466
13559
  const tmpDir = join20(buildDir, "_angular_vendor_tmp");
13467
- mkdirSync7(tmpDir, { recursive: true });
13560
+ mkdirSync8(tmpDir, { recursive: true });
13468
13561
  const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
13469
13562
  const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
13470
13563
  const safeName = toSafeFileName2(specifier);
@@ -13484,7 +13577,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
13484
13577
  target: "browser",
13485
13578
  throw: false
13486
13579
  });
13487
- await rm7(tmpDir, { force: true, recursive: true });
13580
+ await rm6(tmpDir, { force: true, recursive: true });
13488
13581
  if (!result.success) {
13489
13582
  console.warn("\u26A0\uFE0F Angular vendor build had errors:", result.logs);
13490
13583
  }
@@ -13500,9 +13593,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
13500
13593
  return computeAngularVendorPaths(specifiers);
13501
13594
  }, buildAngularServerVendor = async (buildDir, directories = [], linkerJitMode = false) => {
13502
13595
  const vendorDir = join20(buildDir, "angular", "vendor", "server");
13503
- mkdirSync7(vendorDir, { recursive: true });
13596
+ mkdirSync8(vendorDir, { recursive: true });
13504
13597
  const tmpDir = join20(buildDir, "_angular_server_vendor_tmp");
13505
- mkdirSync7(tmpDir, { recursive: true });
13598
+ mkdirSync8(tmpDir, { recursive: true });
13506
13599
  const browserSpecs = await resolveAngularSpecifiers(directories, linkerJitMode);
13507
13600
  const allSpecs = new Set(browserSpecs);
13508
13601
  for (const spec of SERVER_ONLY_ANGULAR_SPECIFIERS) {
@@ -13527,7 +13620,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
13527
13620
  target: "bun",
13528
13621
  throw: false
13529
13622
  });
13530
- await rm7(tmpDir, { force: true, recursive: true });
13623
+ await rm6(tmpDir, { force: true, recursive: true });
13531
13624
  if (!result.success) {
13532
13625
  console.warn("\u26A0\uFE0F Angular server vendor build had errors:", result.logs);
13533
13626
  }
@@ -13591,15 +13684,15 @@ __export(exports_buildVueVendor, {
13591
13684
  computeVueVendorPaths: () => computeVueVendorPaths,
13592
13685
  buildVueVendor: () => buildVueVendor
13593
13686
  });
13594
- import { mkdirSync as mkdirSync8 } from "fs";
13687
+ import { mkdirSync as mkdirSync9 } from "fs";
13595
13688
  import { join as join21 } from "path";
13596
- import { rm as rm8 } from "fs/promises";
13689
+ import { rm as rm7 } from "fs/promises";
13597
13690
  var {build: bunBuild5 } = globalThis.Bun;
13598
13691
  var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"), buildVueVendor = async (buildDir) => {
13599
13692
  const vendorDir = join21(buildDir, "vue", "vendor");
13600
- mkdirSync8(vendorDir, { recursive: true });
13693
+ mkdirSync9(vendorDir, { recursive: true });
13601
13694
  const tmpDir = join21(buildDir, "_vue_vendor_tmp");
13602
- mkdirSync8(tmpDir, { recursive: true });
13695
+ mkdirSync9(tmpDir, { recursive: true });
13603
13696
  const entrypoints = await Promise.all(vueSpecifiers.map(async (specifier) => {
13604
13697
  const safeName = toSafeFileName3(specifier);
13605
13698
  const entryPath = join21(tmpDir, `${safeName}.ts`);
@@ -13622,22 +13715,22 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
13622
13715
  target: "browser",
13623
13716
  throw: false
13624
13717
  });
13625
- await rm8(tmpDir, { force: true, recursive: true });
13718
+ await rm7(tmpDir, { force: true, recursive: true });
13626
13719
  if (!result.success) {
13627
13720
  console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
13628
13721
  return;
13629
13722
  }
13630
- const { readFileSync: readFileSync13, writeFileSync: writeFileSync7, readdirSync } = await import("fs");
13723
+ const { readFileSync: readFileSync14, writeFileSync: writeFileSync8, readdirSync } = await import("fs");
13631
13724
  const files = readdirSync(vendorDir).filter((f2) => f2.endsWith(".js"));
13632
13725
  for (const file5 of files) {
13633
13726
  const filePath = join21(vendorDir, file5);
13634
- const content = readFileSync13(filePath, "utf-8");
13727
+ const content = readFileSync14(filePath, "utf-8");
13635
13728
  if (!content.includes("__VUE_HMR_RUNTIME__"))
13636
13729
  continue;
13637
13730
  const patched = content.replace(/getGlobalThis\(\)\.__VUE_HMR_RUNTIME__\s*=\s*\{/, "getGlobalThis().__VUE_HMR_RUNTIME__ = getGlobalThis().__VUE_HMR_RUNTIME__ || {");
13638
13731
  if (patched === content)
13639
13732
  continue;
13640
- writeFileSync7(filePath, patched);
13733
+ writeFileSync8(filePath, patched);
13641
13734
  }
13642
13735
  }, computeVueVendorPaths = () => {
13643
13736
  const paths = {};
@@ -13656,9 +13749,9 @@ __export(exports_buildSvelteVendor, {
13656
13749
  computeSvelteVendorPaths: () => computeSvelteVendorPaths,
13657
13750
  buildSvelteVendor: () => buildSvelteVendor
13658
13751
  });
13659
- import { mkdirSync as mkdirSync9 } from "fs";
13752
+ import { mkdirSync as mkdirSync10 } from "fs";
13660
13753
  import { join as join22 } from "path";
13661
- import { rm as rm9 } from "fs/promises";
13754
+ import { rm as rm8 } from "fs/promises";
13662
13755
  var {build: bunBuild6 } = globalThis.Bun;
13663
13756
  var svelteSpecifiers, isResolvable3 = (specifier) => {
13664
13757
  try {
@@ -13672,9 +13765,9 @@ var svelteSpecifiers, isResolvable3 = (specifier) => {
13672
13765
  if (specifiers.length === 0)
13673
13766
  return;
13674
13767
  const vendorDir = join22(buildDir, "svelte", "vendor");
13675
- mkdirSync9(vendorDir, { recursive: true });
13768
+ mkdirSync10(vendorDir, { recursive: true });
13676
13769
  const tmpDir = join22(buildDir, "_svelte_vendor_tmp");
13677
- mkdirSync9(tmpDir, { recursive: true });
13770
+ mkdirSync10(tmpDir, { recursive: true });
13678
13771
  const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
13679
13772
  const safeName = toSafeFileName4(specifier);
13680
13773
  const entryPath = join22(tmpDir, `${safeName}.ts`);
@@ -13692,7 +13785,7 @@ var svelteSpecifiers, isResolvable3 = (specifier) => {
13692
13785
  target: "browser",
13693
13786
  throw: false
13694
13787
  });
13695
- await rm9(tmpDir, { force: true, recursive: true });
13788
+ await rm8(tmpDir, { force: true, recursive: true });
13696
13789
  if (!result.success) {
13697
13790
  console.warn("\u26A0\uFE0F Svelte vendor build had errors:", result.logs);
13698
13791
  }
@@ -13715,12 +13808,19 @@ var init_buildSvelteVendor = __esm(() => {
13715
13808
  ];
13716
13809
  });
13717
13810
 
13718
- // src/build/rewriteImports.ts
13719
- var exports_rewriteImports = {};
13720
- __export(exports_rewriteImports, {
13811
+ // src/build/rewriteImportsPlugin.ts
13812
+ var exports_rewriteImportsPlugin = {};
13813
+ __export(exports_rewriteImportsPlugin, {
13721
13814
  rewriteVendorDirectories: () => rewriteVendorDirectories,
13722
- rewriteImports: () => rewriteImports
13815
+ rewriteImportsInContent: () => rewriteImportsInContent,
13816
+ rewriteBuildOutputsWith: () => rewriteBuildOutputsWith,
13817
+ rewriteBuildOutputs: () => rewriteBuildOutputs,
13818
+ jsRewriteImports: () => jsRewriteImports,
13819
+ fixMissingReExportNamespacesInContent: () => fixMissingReExportNamespacesInContent,
13820
+ buildWithImportRewrite: () => buildWithImportRewrite
13723
13821
  });
13822
+ import { readdir as readdir3 } from "fs/promises";
13823
+ import { join as join23 } from "path";
13724
13824
  var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
13725
13825
  let result = content;
13726
13826
  for (const [specifier, webPath] of replacements) {
@@ -13733,90 +13833,157 @@ var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewrit
13733
13833
  result = result.replace(dynamicRegex, `$1${webPath}$2`);
13734
13834
  }
13735
13835
  return result;
13736
- }, rewriteImports = async (outputPaths, vendorPaths) => {
13737
- const jsFiles = outputPaths.filter((path) => path.endsWith(".js"));
13738
- if (jsFiles.length === 0)
13739
- return;
13836
+ }, rewriteImportsInContent = (content, vendorPaths) => {
13837
+ if (Object.keys(vendorPaths).length === 0)
13838
+ return content;
13740
13839
  const replacements = Object.entries(vendorPaths).sort(([keyA], [keyB]) => keyB.length - keyA.length);
13741
- await Promise.all(jsFiles.map(async (filePath) => {
13742
- const original = await Bun.file(filePath).text();
13743
- const native = nativeRewriteImports(original, replacements);
13744
- const content = native ?? jsRewriteImports(original, replacements);
13745
- if (content !== original) {
13746
- await Bun.write(filePath, content);
13840
+ const native = nativeRewriteImports(content, replacements);
13841
+ return native ?? jsRewriteImports(content, replacements);
13842
+ }, fixMissingReExportNamespacesInContent = (content) => {
13843
+ const REEXPORT_PATTERN = /__reExport\(\s*[A-Za-z_$][\w$]*\s*,\s*([A-Za-z_$][\w$]*)\s*\)/g;
13844
+ REEXPORT_PATTERN.lastIndex = 0;
13845
+ const missing = [];
13846
+ let match;
13847
+ while ((match = REEXPORT_PATTERN.exec(content)) !== null) {
13848
+ const ident = match[1];
13849
+ if (!ident)
13850
+ continue;
13851
+ const nsImportRe = new RegExp(`\\bimport\\s*\\*\\s*as\\s+${ident}\\s+from\\b`);
13852
+ if (nsImportRe.test(content))
13853
+ continue;
13854
+ const declRe = new RegExp(`\\b(?:const|let|var|function|class)\\s+${ident}\\b`);
13855
+ if (declRe.test(content))
13856
+ continue;
13857
+ const namedImportRe = new RegExp(`\\bimport\\s*\\{[^}]*\\b${ident}\\b[^}]*\\}\\s*from\\b`);
13858
+ if (namedImportRe.test(content))
13859
+ continue;
13860
+ const importPathRe = /(?:from\s+|import\s*)["']([^"']+)["']/g;
13861
+ let pathMatch;
13862
+ let sourcePath;
13863
+ while ((pathMatch = importPathRe.exec(content)) !== null) {
13864
+ const p2 = pathMatch[1];
13865
+ if (!p2)
13866
+ continue;
13867
+ const base = p2.split("/").pop()?.replace(/\.[mc]?js$/, "");
13868
+ if (!base)
13869
+ continue;
13870
+ const normalized = base.startsWith("_") ? base.slice(1) : base;
13871
+ if (normalized === ident || normalized.endsWith(`_${ident}`)) {
13872
+ sourcePath = p2;
13873
+ break;
13874
+ }
13875
+ }
13876
+ if (sourcePath)
13877
+ missing.push({ ident, path: sourcePath });
13878
+ }
13879
+ if (missing.length === 0)
13880
+ return content;
13881
+ const seen = new Set;
13882
+ const unique = missing.filter((entry) => {
13883
+ if (seen.has(entry.ident))
13884
+ return false;
13885
+ seen.add(entry.ident);
13886
+ return true;
13887
+ });
13888
+ const inserts = unique.map((entry) => `import * as ${entry.ident} from "${entry.path}";`).join(`
13889
+ `);
13890
+ return `${inserts}
13891
+ ${content}`;
13892
+ }, isReadableArtifact = (artifact) => artifact.path.endsWith(".js"), rewriteBuildOutputs = async (outputs, vendorPaths) => {
13893
+ if (Object.keys(vendorPaths).length === 0)
13894
+ return;
13895
+ await Promise.all(outputs.filter(isReadableArtifact).map(async (artifact) => {
13896
+ let original;
13897
+ try {
13898
+ original = await artifact.text();
13899
+ } catch (err) {
13900
+ const code = err.code;
13901
+ if (code === "ENOENT")
13902
+ return;
13903
+ throw err;
13904
+ }
13905
+ const rewritten = rewriteImportsInContent(original, vendorPaths);
13906
+ if (rewritten === original)
13907
+ return;
13908
+ try {
13909
+ await Bun.write(artifact.path, rewritten);
13910
+ } catch (err) {
13911
+ const code = err.code;
13912
+ if (code === "ENOENT")
13913
+ return;
13914
+ throw err;
13915
+ }
13916
+ }));
13917
+ }, rewriteBuildOutputsWith = async (outputs, resolveVendorPaths) => {
13918
+ await Promise.all(outputs.filter(isReadableArtifact).map(async (artifact) => {
13919
+ const vendorPaths = resolveVendorPaths(artifact);
13920
+ if (Object.keys(vendorPaths).length === 0)
13921
+ return;
13922
+ let original;
13923
+ try {
13924
+ original = await artifact.text();
13925
+ } catch (err) {
13926
+ const code = err.code;
13927
+ if (code === "ENOENT")
13928
+ return;
13929
+ throw err;
13930
+ }
13931
+ const rewritten = rewriteImportsInContent(original, vendorPaths);
13932
+ if (rewritten === original)
13933
+ return;
13934
+ try {
13935
+ await Bun.write(artifact.path, rewritten);
13936
+ } catch (err) {
13937
+ const code = err.code;
13938
+ if (code === "ENOENT")
13939
+ return;
13940
+ throw err;
13747
13941
  }
13748
13942
  }));
13749
13943
  }, rewriteVendorDirectories = async (vendorDirs, vendorPaths) => {
13750
13944
  if (Object.keys(vendorPaths).length === 0)
13751
13945
  return;
13752
- const { readdirSync } = await import("fs");
13753
- const { join: join23 } = await import("path");
13754
13946
  const allFiles = [];
13755
13947
  for (const dir of vendorDirs) {
13756
13948
  try {
13757
- const files = readdirSync(dir).filter((f2) => f2.endsWith(".js")).map((f2) => join23(dir, f2));
13758
- allFiles.push(...files);
13949
+ const entries = await readdir3(dir);
13950
+ for (const entry of entries) {
13951
+ if (entry.endsWith(".js"))
13952
+ allFiles.push(join23(dir, entry));
13953
+ }
13759
13954
  } catch {}
13760
13955
  }
13761
- await rewriteImports(allFiles, vendorPaths);
13762
- await fixMissingReExportNamespaces(allFiles);
13763
- }, fixMissingReExportNamespaces = async (files) => {
13764
- const REEXPORT_PATTERN = /__reExport\(\s*[A-Za-z_$][\w$]*\s*,\s*([A-Za-z_$][\w$]*)\s*\)/g;
13765
- await Promise.all(files.map(async (filePath) => {
13766
- const content = await Bun.file(filePath).text();
13767
- REEXPORT_PATTERN.lastIndex = 0;
13768
- const missing = [];
13769
- let match;
13770
- while ((match = REEXPORT_PATTERN.exec(content)) !== null) {
13771
- const ident = match[1];
13772
- if (!ident)
13773
- continue;
13774
- const nsImportRe = new RegExp(`\\bimport\\s*\\*\\s*as\\s+${ident}\\s+from\\b`);
13775
- if (nsImportRe.test(content))
13776
- continue;
13777
- const declRe = new RegExp(`\\b(?:const|let|var|function|class)\\s+${ident}\\b`);
13778
- if (declRe.test(content))
13779
- continue;
13780
- const namedImportRe = new RegExp(`\\bimport\\s*\\{[^}]*\\b${ident}\\b[^}]*\\}\\s*from\\b`);
13781
- if (namedImportRe.test(content))
13782
- continue;
13783
- const importPathRe = /(?:from\s+|import\s*)["']([^"']+)["']/g;
13784
- let pathMatch;
13785
- let sourcePath;
13786
- while ((pathMatch = importPathRe.exec(content)) !== null) {
13787
- const p2 = pathMatch[1];
13788
- if (!p2)
13789
- continue;
13790
- const base = p2.split("/").pop()?.replace(/\.[mc]?js$/, "");
13791
- if (!base)
13792
- continue;
13793
- const normalized = base.startsWith("_") ? base.slice(1) : base;
13794
- if (normalized === ident || normalized.endsWith(`_${ident}`)) {
13795
- sourcePath = p2;
13796
- break;
13797
- }
13798
- }
13799
- if (sourcePath) {
13800
- missing.push({ ident, path: sourcePath });
13801
- }
13956
+ await Promise.all(allFiles.map(async (filePath) => {
13957
+ let original;
13958
+ try {
13959
+ original = await Bun.file(filePath).text();
13960
+ } catch (err) {
13961
+ const code = err.code;
13962
+ if (code === "ENOENT")
13963
+ return;
13964
+ throw err;
13802
13965
  }
13803
- if (missing.length === 0)
13966
+ let next = rewriteImportsInContent(original, vendorPaths);
13967
+ next = fixMissingReExportNamespacesInContent(next);
13968
+ if (next === original)
13804
13969
  return;
13805
- const seen = new Set;
13806
- const unique = missing.filter((entry) => {
13807
- if (seen.has(entry.ident))
13808
- return false;
13809
- seen.add(entry.ident);
13810
- return true;
13811
- });
13812
- const inserts = unique.map((entry) => `import * as ${entry.ident} from "${entry.path}";`).join(`
13813
- `);
13814
- const patched = `${inserts}
13815
- ${content}`;
13816
- await Bun.write(filePath, patched);
13970
+ try {
13971
+ await Bun.write(filePath, next);
13972
+ } catch (err) {
13973
+ const code = err.code;
13974
+ if (code === "ENOENT")
13975
+ return;
13976
+ throw err;
13977
+ }
13817
13978
  }));
13979
+ }, buildWithImportRewrite = async (pendingBuild, vendorPaths) => {
13980
+ const result = await pendingBuild;
13981
+ if (result.outputs.length > 0) {
13982
+ await rewriteBuildOutputs(result.outputs, vendorPaths);
13983
+ }
13984
+ return result;
13818
13985
  };
13819
- var init_rewriteImports = __esm(() => {
13986
+ var init_rewriteImportsPlugin = __esm(() => {
13820
13987
  init_nativeRewrite();
13821
13988
  });
13822
13989
 
@@ -13825,13 +13992,13 @@ import {
13825
13992
  copyFileSync,
13826
13993
  cpSync,
13827
13994
  existsSync as existsSync20,
13828
- mkdirSync as mkdirSync10,
13829
- readFileSync as readFileSync13,
13995
+ mkdirSync as mkdirSync11,
13996
+ readFileSync as readFileSync14,
13830
13997
  rmSync as rmSync2,
13831
13998
  statSync,
13832
- writeFileSync as writeFileSync7
13999
+ writeFileSync as writeFileSync8
13833
14000
  } from "fs";
13834
- import { basename as basename9, dirname as dirname15, extname as extname7, join as join23, relative as relative10, resolve as resolve22 } from "path";
14001
+ import { basename as basename9, dirname as dirname15, extname as extname7, join as join24, relative as relative10, resolve as resolve22 } from "path";
13835
14002
  import { cwd, env as env3, exit } from "process";
13836
14003
  var {build: bunBuild7, Glob: Glob7 } = globalThis.Bun;
13837
14004
  var isDev2, isBuildTraceEnabled = () => {
@@ -13906,11 +14073,11 @@ var isDev2, isBuildTraceEnabled = () => {
13906
14073
  throw err;
13907
14074
  exit(1);
13908
14075
  }, copyHtmxVendor = (htmxDir, htmxDestDir) => {
13909
- mkdirSync10(htmxDestDir, { recursive: true });
14076
+ mkdirSync11(htmxDestDir, { recursive: true });
13910
14077
  const glob = new Glob7("htmx*.min.js");
13911
14078
  for (const relPath of glob.scanSync({ cwd: htmxDir })) {
13912
- const src = join23(htmxDir, relPath);
13913
- const dest = join23(htmxDestDir, "htmx.min.js");
14079
+ const src = join24(htmxDir, relPath);
14080
+ const dest = join24(htmxDestDir, "htmx.min.js");
13914
14081
  copyFileSync(src, dest);
13915
14082
  return;
13916
14083
  }
@@ -13954,7 +14121,7 @@ var isDev2, isBuildTraceEnabled = () => {
13954
14121
  addWorkerPathIfExists(file5, relPath, workerPaths);
13955
14122
  }
13956
14123
  }, collectWorkerPathsFromFile = (file5, patterns, workerPaths) => {
13957
- const content = readFileSync13(file5, "utf-8");
14124
+ const content = readFileSync14(file5, "utf-8");
13958
14125
  for (const pattern of patterns) {
13959
14126
  collectWorkerPathsFromContent(content, pattern, file5, workerPaths);
13960
14127
  }
@@ -13985,8 +14152,8 @@ var isDev2, isBuildTraceEnabled = () => {
13985
14152
  vuePagesPath
13986
14153
  }) => {
13987
14154
  const { readdirSync: readDir } = await import("fs");
13988
- const devIndexDir = join23(buildPath, "_src_indexes");
13989
- mkdirSync10(devIndexDir, { recursive: true });
14155
+ const devIndexDir = join24(buildPath, "_src_indexes");
14156
+ mkdirSync11(devIndexDir, { recursive: true });
13990
14157
  if (reactIndexesPath && reactPagesPath) {
13991
14158
  copyReactDevIndexes(reactIndexesPath, reactPagesPath, devIndexDir, readDir);
13992
14159
  }
@@ -14003,35 +14170,35 @@ var isDev2, isBuildTraceEnabled = () => {
14003
14170
  const indexFiles = readDir(reactIndexesPath).filter((file5) => file5.endsWith(".tsx"));
14004
14171
  const pagesRel = relative10(process.cwd(), resolve22(reactPagesPath)).replace(/\\/g, "/");
14005
14172
  for (const file5 of indexFiles) {
14006
- let content = readFileSync13(join23(reactIndexesPath, file5), "utf-8");
14173
+ let content = readFileSync14(join24(reactIndexesPath, file5), "utf-8");
14007
14174
  content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
14008
- writeFileSync7(join23(devIndexDir, file5), content);
14175
+ writeFileSync8(join24(devIndexDir, file5), content);
14009
14176
  }
14010
14177
  }, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
14011
- const svelteIndexDir = join23(svelteDir, "generated", "indexes");
14178
+ const svelteIndexDir = join24(svelteDir, "generated", "indexes");
14012
14179
  const sveltePageEntries = svelteEntries.filter((file5) => resolve22(file5).startsWith(resolve22(sveltePagesPath)));
14013
14180
  for (const entry of sveltePageEntries) {
14014
14181
  const name = basename9(entry).replace(/\.svelte(\.(ts|js))?$/, "");
14015
- const indexFile = join23(svelteIndexDir, "pages", `${name}.js`);
14182
+ const indexFile = join24(svelteIndexDir, "pages", `${name}.js`);
14016
14183
  if (!existsSync20(indexFile))
14017
14184
  continue;
14018
- let content = readFileSync13(indexFile, "utf-8");
14185
+ let content = readFileSync14(indexFile, "utf-8");
14019
14186
  const srcRel = relative10(process.cwd(), resolve22(entry)).replace(/\\/g, "/");
14020
14187
  content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
14021
- writeFileSync7(join23(devIndexDir, `${name}.svelte.js`), content);
14188
+ writeFileSync8(join24(devIndexDir, `${name}.svelte.js`), content);
14022
14189
  }
14023
14190
  }, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
14024
- const vueIndexDir = join23(vueDir, "generated", "indexes");
14191
+ const vueIndexDir = join24(vueDir, "generated", "indexes");
14025
14192
  const vuePageEntries = vueEntries.filter((file5) => resolve22(file5).startsWith(resolve22(vuePagesPath)));
14026
14193
  for (const entry of vuePageEntries) {
14027
14194
  const name = basename9(entry, ".vue");
14028
- const indexFile = join23(vueIndexDir, `${name}.js`);
14195
+ const indexFile = join24(vueIndexDir, `${name}.js`);
14029
14196
  if (!existsSync20(indexFile))
14030
14197
  continue;
14031
- let content = readFileSync13(indexFile, "utf-8");
14198
+ let content = readFileSync14(indexFile, "utf-8");
14032
14199
  const srcRel = relative10(process.cwd(), resolve22(entry)).replace(/\\/g, "/");
14033
14200
  content = content.replace(/import\s+Comp(?:\s*,\s*\*\s+as\s+\w+)?\s+from\s+['"]([^'"]+)['"]/, (match) => match.replace(/from\s+['"][^'"]+['"]/, `from "/@src/${srcRel}"`));
14034
- writeFileSync7(join23(devIndexDir, `${name}.vue.js`), content);
14201
+ writeFileSync8(join24(devIndexDir, `${name}.vue.js`), content);
14035
14202
  }
14036
14203
  }, resolveVueRuntimeId = (content, firstUseName, outputPath, projectRoot) => {
14037
14204
  const varIdx = content.indexOf(`var ${firstUseName} =`);
@@ -14079,7 +14246,7 @@ var isDev2, isBuildTraceEnabled = () => {
14079
14246
  }
14080
14247
  return result;
14081
14248
  }, VUE_HMR_RUNTIME, injectVueComposableTracking = (outputPath, projectRoot) => {
14082
- let content = readFileSync13(outputPath, "utf-8");
14249
+ let content = readFileSync14(outputPath, "utf-8");
14083
14250
  const usePattern = /^var\s+(use[A-Z]\w*)\s*=/gm;
14084
14251
  const useNames = [];
14085
14252
  let match;
@@ -14100,7 +14267,7 @@ var isDev2, isBuildTraceEnabled = () => {
14100
14267
  content = `${content.slice(0, firstUseIdx) + runtime}
14101
14268
  ${content.slice(firstUseIdx)}`;
14102
14269
  content = wrapUseFunctions(content, useNames);
14103
- writeFileSync7(outputPath, content);
14270
+ writeFileSync8(outputPath, content);
14104
14271
  }, buildDevUrlFileMap = (urlReferencedFiles, projectRoot) => {
14105
14272
  const urlFileMap = new Map;
14106
14273
  for (const srcPath of urlReferencedFiles) {
@@ -14129,7 +14296,7 @@ ${content.slice(firstUseIdx)}`;
14129
14296
  }, rewriteUrlReferences = (outputPaths, urlFileMap) => {
14130
14297
  const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
14131
14298
  for (const outputPath of outputPaths) {
14132
- let content = readFileSync13(outputPath, "utf-8");
14299
+ let content = readFileSync14(outputPath, "utf-8");
14133
14300
  let changed = false;
14134
14301
  content = content.replace(urlPattern, (_match, relPath) => {
14135
14302
  const targetName = basename9(relPath);
@@ -14140,7 +14307,7 @@ ${content.slice(firstUseIdx)}`;
14140
14307
  return `new URL('${resolvedPath}', import.meta.url)`;
14141
14308
  });
14142
14309
  if (changed)
14143
- writeFileSync7(outputPath, content);
14310
+ writeFileSync8(outputPath, content);
14144
14311
  }
14145
14312
  }, vueFeatureFlags, bunBuildPassKeys, bunBuildPassKeySet, reservedBunBuildConfigKeys, passLockedKeys, isObject2 = (value) => typeof value === "object" && value !== null, isBunBuildPassConfig = (config) => isObject2(config) && Object.keys(config).some((key) => bunBuildPassKeySet.has(key)), sanitizeBunBuildOverride = (override, extraReservedKeys = new Set) => {
14146
14313
  if (!override)
@@ -14253,10 +14420,10 @@ ${content.slice(firstUseIdx)}`;
14253
14420
  restoreTracePhase();
14254
14421
  return;
14255
14422
  }
14256
- const traceDir = join23(buildPath2, ".absolute-trace");
14423
+ const traceDir = join24(buildPath2, ".absolute-trace");
14257
14424
  const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
14258
- mkdirSync10(traceDir, { recursive: true });
14259
- writeFileSync7(join23(traceDir, `build-trace-${timestamp}.json`), JSON.stringify({
14425
+ mkdirSync11(traceDir, { recursive: true });
14426
+ writeFileSync8(join24(traceDir, `build-trace-${timestamp}.json`), JSON.stringify({
14260
14427
  events: traceEvents,
14261
14428
  frameworks: traceFrameworkNames,
14262
14429
  generatedAt: new Date().toISOString(),
@@ -14287,15 +14454,15 @@ ${content.slice(firstUseIdx)}`;
14287
14454
  const stylesPath = typeof stylesConfig === "string" ? stylesConfig : stylesConfig?.path;
14288
14455
  const stylesIgnore = typeof stylesConfig === "object" ? stylesConfig.ignore : undefined;
14289
14456
  const stylesDir = stylesPath && validateSafePath(stylesPath, projectRoot);
14290
- const reactIndexesPath = reactDir && join23(reactDir, "generated", "indexes");
14291
- const reactPagesPath = reactDir && join23(reactDir, "pages");
14292
- const htmlPagesPath = htmlDir && join23(htmlDir, "pages");
14293
- const htmlScriptsPath = htmlDir && join23(htmlDir, "scripts");
14294
- const sveltePagesPath = svelteDir && join23(svelteDir, "pages");
14295
- const vuePagesPath = vueDir && join23(vueDir, "pages");
14296
- const htmxPagesPath = htmxDir && join23(htmxDir, "pages");
14297
- const angularPagesPath = angularDir && join23(angularDir, "pages");
14298
- const emberPagesPath = emberDir && join23(emberDir, "pages");
14457
+ const reactIndexesPath = reactDir && join24(reactDir, "generated", "indexes");
14458
+ const reactPagesPath = reactDir && join24(reactDir, "pages");
14459
+ const htmlPagesPath = htmlDir && join24(htmlDir, "pages");
14460
+ const htmlScriptsPath = htmlDir && join24(htmlDir, "scripts");
14461
+ const sveltePagesPath = svelteDir && join24(svelteDir, "pages");
14462
+ const vuePagesPath = vueDir && join24(vueDir, "pages");
14463
+ const htmxPagesPath = htmxDir && join24(htmxDir, "pages");
14464
+ const angularPagesPath = angularDir && join24(angularDir, "pages");
14465
+ const emberPagesPath = emberDir && join24(emberDir, "pages");
14299
14466
  const frontends = [
14300
14467
  reactDir,
14301
14468
  htmlDir,
@@ -14335,12 +14502,12 @@ ${content.slice(firstUseIdx)}`;
14335
14502
  if (svelteDir)
14336
14503
  serverDirMap.push({
14337
14504
  dir: svelteDir,
14338
- subdir: join23("generated", "server")
14505
+ subdir: join24("generated", "server")
14339
14506
  });
14340
14507
  if (vueDir)
14341
14508
  serverDirMap.push({
14342
14509
  dir: vueDir,
14343
- subdir: join23("generated", "server")
14510
+ subdir: join24("generated", "server")
14344
14511
  });
14345
14512
  if (angularDir)
14346
14513
  serverDirMap.push({ dir: angularDir, subdir: "generated" });
@@ -14350,14 +14517,14 @@ ${content.slice(firstUseIdx)}`;
14350
14517
  const [firstEntry] = serverDirMap;
14351
14518
  if (!firstEntry)
14352
14519
  throw new Error("Expected at least one server directory entry");
14353
- serverRoot = join23(firstEntry.dir, firstEntry.subdir);
14354
- serverOutDir = join23(buildPath, basename9(firstEntry.dir));
14520
+ serverRoot = join24(firstEntry.dir, firstEntry.subdir);
14521
+ serverOutDir = join24(buildPath, basename9(firstEntry.dir));
14355
14522
  } else if (serverDirMap.length > 1) {
14356
14523
  serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
14357
14524
  serverOutDir = buildPath;
14358
14525
  }
14359
14526
  const publicPath = publicDirectory && validateSafePath(publicDirectory, projectRoot);
14360
- await tracePhase("build-dir/create", () => mkdirSync10(buildPath, { recursive: true }));
14527
+ await tracePhase("build-dir/create", () => mkdirSync11(buildPath, { recursive: true }));
14361
14528
  if (publicPath)
14362
14529
  await tracePhase("public/copy", () => cpSync(publicPath, buildPath, { force: true, recursive: true }));
14363
14530
  const filterToIncrementalEntries = (entryPoints, mapToSource) => {
@@ -14379,7 +14546,7 @@ ${content.slice(firstUseIdx)}`;
14379
14546
  await tracePhase("react/index-generation", () => generateReactIndexFiles(reactPagesPath, reactIndexesPath, hmr));
14380
14547
  }
14381
14548
  if (assetsPath && (!isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/assets/")))) {
14382
- await tracePhase("assets/copy", () => cpSync(assetsPath, join23(buildPath, "assets"), {
14549
+ await tracePhase("assets/copy", () => cpSync(assetsPath, join24(buildPath, "assets"), {
14383
14550
  force: true,
14384
14551
  recursive: true
14385
14552
  }));
@@ -14433,7 +14600,7 @@ ${content.slice(firstUseIdx)}`;
14433
14600
  const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
14434
14601
  if (entry.startsWith(resolve22(reactIndexesPath))) {
14435
14602
  const pageName = basename9(entry, ".tsx");
14436
- return join23(reactPagesPath, `${pageName}.tsx`);
14603
+ return join24(reactPagesPath, `${pageName}.tsx`);
14437
14604
  }
14438
14605
  return null;
14439
14606
  }) : allReactEntries;
@@ -14537,9 +14704,9 @@ ${content.slice(firstUseIdx)}`;
14537
14704
  const compileReactConventions = async () => {
14538
14705
  if (reactConventionSources.length === 0)
14539
14706
  return emptyStringArray;
14540
- const destDir = join23(buildPath, "conventions", "react");
14707
+ const destDir = join24(buildPath, "conventions", "react");
14541
14708
  rmSync2(destDir, { force: true, recursive: true });
14542
- mkdirSync10(destDir, { recursive: true });
14709
+ mkdirSync11(destDir, { recursive: true });
14543
14710
  const destPaths = [];
14544
14711
  for (let idx = 0;idx < reactConventionSources.length; idx++) {
14545
14712
  const source = reactConventionSources[idx];
@@ -14581,9 +14748,9 @@ ${content.slice(firstUseIdx)}`;
14581
14748
  angularConventionSources.length > 0 && angularDir ? tracePhase("compile/convention-angular", () => Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(angularConventionSources, angularDir, hmr, styleTransformConfig))) : { serverPaths: emptyStringArray }
14582
14749
  ]);
14583
14750
  const bundleConventionFiles = async (framework, compiledPaths) => {
14584
- const destDir = join23(buildPath, "conventions", framework);
14751
+ const destDir = join24(buildPath, "conventions", framework);
14585
14752
  rmSync2(destDir, { force: true, recursive: true });
14586
- mkdirSync10(destDir, { recursive: true });
14753
+ mkdirSync11(destDir, { recursive: true });
14587
14754
  const destPaths = [];
14588
14755
  for (let idx = 0;idx < compiledPaths.length; idx++) {
14589
14756
  const compiledPath = compiledPaths[idx];
@@ -14654,7 +14821,7 @@ ${content.slice(firstUseIdx)}`;
14654
14821
  }
14655
14822
  })) : {
14656
14823
  entries: [],
14657
- generatedRoot: join23(buildPath, "_island_entries")
14824
+ generatedRoot: join24(buildPath, "_island_entries")
14658
14825
  };
14659
14826
  const islandClientEntryPoints = islandEntryResult.entries.map((entry) => entry.entryPath);
14660
14827
  if (serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && islandClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
@@ -14690,7 +14857,7 @@ ${content.slice(firstUseIdx)}`;
14690
14857
  return {};
14691
14858
  }
14692
14859
  if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
14693
- const refreshEntry = join23(reactIndexesPath, "_refresh.tsx");
14860
+ const refreshEntry = join24(reactIndexesPath, "_refresh.tsx");
14694
14861
  if (!reactClientEntryPoints.includes(refreshEntry))
14695
14862
  reactClientEntryPoints.push(refreshEntry);
14696
14863
  }
@@ -14706,12 +14873,7 @@ ${content.slice(firstUseIdx)}`;
14706
14873
  angularVendorPaths2 = computeAngularVendorPaths2(globalThis.__angularVendorSpecifiers);
14707
14874
  setAngularVendorPaths(angularVendorPaths2);
14708
14875
  }
14709
- let angularServerVendorPaths2 = getAngularServerVendorPaths();
14710
- if (!angularServerVendorPaths2 && hmr && angularDir) {
14711
- const { computeAngularServerVendorPaths: computeAngularServerVendorPaths2 } = await Promise.resolve().then(() => (init_buildAngularVendor(), exports_buildAngularVendor));
14712
- angularServerVendorPaths2 = computeAngularServerVendorPaths2(buildPath, globalThis.__angularVendorSpecifiers ?? []);
14713
- setAngularServerVendorPaths(angularServerVendorPaths2);
14714
- }
14876
+ let angularServerVendorPaths2 = hmr ? undefined : getAngularServerVendorPaths();
14715
14877
  if (!hmr && angularDir) {
14716
14878
  const angularSourceDirs = [
14717
14879
  angularDir,
@@ -14794,19 +14956,19 @@ ${content.slice(firstUseIdx)}`;
14794
14956
  throw: false
14795
14957
  }, resolveBunBuildOverride(bunBuildConfig, "reactClient")) : undefined;
14796
14958
  if (reactDir && reactClientEntryPoints.length > 0) {
14797
- rmSync2(join23(buildPath, "react", "generated", "indexes"), {
14959
+ rmSync2(join24(buildPath, "react", "generated", "indexes"), {
14798
14960
  force: true,
14799
14961
  recursive: true
14800
14962
  });
14801
14963
  }
14802
14964
  if (angularDir && angularClientPaths.length > 0) {
14803
- rmSync2(join23(buildPath, "angular", "indexes"), {
14965
+ rmSync2(join24(buildPath, "angular", "indexes"), {
14804
14966
  force: true,
14805
14967
  recursive: true
14806
14968
  });
14807
14969
  }
14808
14970
  if (islandClientEntryPoints.length > 0) {
14809
- rmSync2(join23(buildPath, "islands"), {
14971
+ rmSync2(join24(buildPath, "islands"), {
14810
14972
  force: true,
14811
14973
  recursive: true
14812
14974
  });
@@ -14875,7 +15037,7 @@ ${content.slice(firstUseIdx)}`;
14875
15037
  globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
14876
15038
  entrypoints: globalCssEntries,
14877
15039
  naming: `[dir]/[name].[hash].[ext]`,
14878
- outdir: stylesDir ? join23(buildPath, basename9(stylesDir)) : buildPath,
15040
+ outdir: stylesDir ? join24(buildPath, basename9(stylesDir)) : buildPath,
14879
15041
  plugins: [stylePreprocessorPlugin2],
14880
15042
  root: stylesDir || clientRoot,
14881
15043
  target: "browser",
@@ -14884,7 +15046,7 @@ ${content.slice(firstUseIdx)}`;
14884
15046
  vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
14885
15047
  entrypoints: vueCssPaths,
14886
15048
  naming: `[name].[hash].[ext]`,
14887
- outdir: join23(buildPath, assetsPath ? basename9(assetsPath) : "assets", "css"),
15049
+ outdir: join24(buildPath, assetsPath ? basename9(assetsPath) : "assets", "css"),
14888
15050
  target: "browser",
14889
15051
  throw: false
14890
15052
  }, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
@@ -14941,25 +15103,24 @@ ${content.slice(firstUseIdx)}`;
14941
15103
  ...allNonReactVendorPaths
14942
15104
  };
14943
15105
  if (nonReactClientOutputs.length > 0 && Object.keys(allNonReactVendorPaths).length > 0) {
14944
- const { rewriteImports: rewriteImports2 } = await Promise.resolve().then(() => (init_rewriteImports(), exports_rewriteImports));
14945
- await tracePhase("postprocess/non-react-vendor-imports", () => rewriteImports2(nonReactClientOutputs.map((artifact) => artifact.path), allNonReactVendorPaths));
15106
+ const { rewriteBuildOutputs: rewriteBuildOutputs2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
15107
+ await tracePhase("postprocess/non-react-vendor-imports", () => rewriteBuildOutputs2(nonReactClientOutputs, allNonReactVendorPaths));
14946
15108
  }
14947
15109
  if (islandClientOutputs.length > 0 && Object.keys(allIslandVendorPaths).length > 0) {
14948
- const { rewriteImports: rewriteImports2 } = await Promise.resolve().then(() => (init_rewriteImports(), exports_rewriteImports));
14949
- await tracePhase("postprocess/island-vendor-imports", () => rewriteImports2(islandClientOutputs.map((artifact) => artifact.path), allIslandVendorPaths));
15110
+ const { rewriteBuildOutputs: rewriteBuildOutputs2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
15111
+ await tracePhase("postprocess/island-vendor-imports", () => rewriteBuildOutputs2(islandClientOutputs, allIslandVendorPaths));
14950
15112
  }
14951
15113
  if (serverOutputs.length > 0 && angularServerVendorPaths2 && Object.keys(angularServerVendorPaths2).length > 0) {
14952
- const { rewriteImports: rewriteImports2 } = await Promise.resolve().then(() => (init_rewriteImports(), exports_rewriteImports));
14953
- const jsArtifacts = serverOutputs.filter((artifact) => artifact.path.endsWith(".js"));
14954
- await tracePhase("postprocess/server-angular-vendor-imports", () => Promise.all(jsArtifacts.map(async (artifact) => {
15114
+ const { rewriteBuildOutputsWith: rewriteBuildOutputsWith2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
15115
+ await tracePhase("postprocess/server-angular-vendor-imports", () => rewriteBuildOutputsWith2(serverOutputs, (artifact) => {
14955
15116
  const fileDir = dirname15(artifact.path);
14956
15117
  const relativePaths = {};
14957
15118
  for (const [specifier, absolute] of Object.entries(angularServerVendorPaths2)) {
14958
15119
  const rel = relative10(fileDir, absolute);
14959
15120
  relativePaths[specifier] = rel.startsWith(".") ? rel : `./${rel}`;
14960
15121
  }
14961
- return rewriteImports2([artifact.path], relativePaths);
14962
- })));
15122
+ return relativePaths;
15123
+ }));
14963
15124
  }
14964
15125
  const cssLogs = [
14965
15126
  ...globalCssResult?.logs ?? [],
@@ -15025,19 +15186,19 @@ ${content.slice(firstUseIdx)}`;
15025
15186
  const injectHMRIntoHTMLFile = (filePath, framework) => {
15026
15187
  if (!hmrClientBundle)
15027
15188
  return;
15028
- let html = readFileSync13(filePath, "utf-8");
15189
+ let html = readFileSync14(filePath, "utf-8");
15029
15190
  if (html.includes("data-hmr-client"))
15030
15191
  return;
15031
15192
  const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
15032
15193
  const bodyClose = /<\/body\s*>/i.exec(html);
15033
15194
  html = bodyClose ? html.slice(0, bodyClose.index) + tag + html.slice(bodyClose.index) : html + tag;
15034
- writeFileSync7(filePath, html);
15195
+ writeFileSync8(filePath, html);
15035
15196
  };
15036
15197
  const processHtmlPages = async () => {
15037
15198
  if (!(htmlDir && htmlPagesPath))
15038
15199
  return;
15039
- const outputHtmlPages = isSingle ? join23(buildPath, "pages") : join23(buildPath, basename9(htmlDir), "pages");
15040
- mkdirSync10(outputHtmlPages, { recursive: true });
15200
+ const outputHtmlPages = isSingle ? join24(buildPath, "pages") : join24(buildPath, basename9(htmlDir), "pages");
15201
+ mkdirSync11(outputHtmlPages, { recursive: true });
15041
15202
  cpSync(htmlPagesPath, outputHtmlPages, {
15042
15203
  force: true,
15043
15204
  recursive: true
@@ -15058,14 +15219,14 @@ ${content.slice(firstUseIdx)}`;
15058
15219
  const processHtmxPages = async () => {
15059
15220
  if (!(htmxDir && htmxPagesPath))
15060
15221
  return;
15061
- const outputHtmxPages = isSingle ? join23(buildPath, "pages") : join23(buildPath, basename9(htmxDir), "pages");
15062
- mkdirSync10(outputHtmxPages, { recursive: true });
15222
+ const outputHtmxPages = isSingle ? join24(buildPath, "pages") : join24(buildPath, basename9(htmxDir), "pages");
15223
+ mkdirSync11(outputHtmxPages, { recursive: true });
15063
15224
  cpSync(htmxPagesPath, outputHtmxPages, {
15064
15225
  force: true,
15065
15226
  recursive: true
15066
15227
  });
15067
15228
  if (shouldCopyHtmx) {
15068
- const htmxDestDir = isSingle ? buildPath : join23(buildPath, basename9(htmxDir));
15229
+ const htmxDestDir = isSingle ? buildPath : join24(buildPath, basename9(htmxDir));
15069
15230
  copyHtmxVendor(htmxDir, htmxDestDir);
15070
15231
  }
15071
15232
  if (shouldUpdateHtmxAssetPaths) {
@@ -15126,9 +15287,9 @@ ${content.slice(firstUseIdx)}`;
15126
15287
  writeBuildTrace(buildPath);
15127
15288
  return { conventions: conventionsMap, manifest };
15128
15289
  }
15129
- writeFileSync7(join23(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
15290
+ writeFileSync8(join24(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
15130
15291
  if (Object.keys(conventionsMap).length > 0) {
15131
- writeFileSync7(join23(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
15292
+ writeFileSync8(join24(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
15132
15293
  }
15133
15294
  writeBuildTrace(buildPath);
15134
15295
  if (tailwind && mode === "production") {
@@ -15225,9 +15386,9 @@ var init_build = __esm(() => {
15225
15386
  });
15226
15387
 
15227
15388
  // src/build/buildEmberVendor.ts
15228
- import { mkdirSync as mkdirSync11, existsSync as existsSync21 } from "fs";
15229
- import { join as join24 } from "path";
15230
- import { rm as rm10 } from "fs/promises";
15389
+ import { mkdirSync as mkdirSync12, existsSync as existsSync21 } from "fs";
15390
+ import { join as join25 } from "path";
15391
+ import { rm as rm9 } from "fs/promises";
15231
15392
  var {build: bunBuild8 } = globalThis.Bun;
15232
15393
  var toSafeFileName5 = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), generateMacrosShim = () => `// Generated shim for @embroider/macros \u2014 provides minimal runtime
15233
15394
  // implementations for macros that would normally be replaced at
@@ -15278,7 +15439,7 @@ export const importSync = (specifier) => {
15278
15439
  if (standaloneSpecifiers.has(specifier)) {
15279
15440
  return { resolveTo: specifier, specifier };
15280
15441
  }
15281
- const emberInternalPath = join24(cwd2, "node_modules/ember-source/dist/packages", specifier, "index.js");
15442
+ const emberInternalPath = join25(cwd2, "node_modules/ember-source/dist/packages", specifier, "index.js");
15282
15443
  if (!existsSync21(emberInternalPath)) {
15283
15444
  throw new Error(`Ember vendor build: cannot find ${specifier} at ${emberInternalPath}. ` + `Is ember-source installed and at least 6.12?`);
15284
15445
  }
@@ -15310,7 +15471,7 @@ export const importSync = (specifier) => {
15310
15471
  if (standalonePackages.has(args.path)) {
15311
15472
  return;
15312
15473
  }
15313
- const internal = join24(cwd2, "node_modules/ember-source/dist/packages", args.path, "index.js");
15474
+ const internal = join25(cwd2, "node_modules/ember-source/dist/packages", args.path, "index.js");
15314
15475
  if (existsSync21(internal)) {
15315
15476
  return { path: internal };
15316
15477
  }
@@ -15318,16 +15479,16 @@ export const importSync = (specifier) => {
15318
15479
  });
15319
15480
  }
15320
15481
  }), buildEmberVendor = async (buildDir, cwd2 = process.cwd()) => {
15321
- const vendorDir = join24(buildDir, "ember", "vendor");
15322
- mkdirSync11(vendorDir, { recursive: true });
15323
- const tmpDir = join24(buildDir, "_ember_vendor_tmp");
15324
- mkdirSync11(tmpDir, { recursive: true });
15325
- const macrosShimPath = join24(tmpDir, "embroider_macros_shim.js");
15482
+ const vendorDir = join25(buildDir, "ember", "vendor");
15483
+ mkdirSync12(vendorDir, { recursive: true });
15484
+ const tmpDir = join25(buildDir, "_ember_vendor_tmp");
15485
+ mkdirSync12(tmpDir, { recursive: true });
15486
+ const macrosShimPath = join25(tmpDir, "embroider_macros_shim.js");
15326
15487
  await Bun.write(macrosShimPath, generateMacrosShim());
15327
15488
  const resolutions = REQUIRED_EMBER_SPECIFIERS.map((specifier) => resolveEmberSpecifier(specifier, cwd2));
15328
15489
  const entrypoints = await Promise.all(resolutions.map(async (resolution) => {
15329
15490
  const safeName = toSafeFileName5(resolution.specifier);
15330
- const entryPath = join24(tmpDir, `${safeName}.js`);
15491
+ const entryPath = join25(tmpDir, `${safeName}.js`);
15331
15492
  const source = resolution.specifier === "@embroider/macros" ? `export * from ${JSON.stringify(macrosShimPath)};
15332
15493
  ` : generateVendorEntrySource2(resolution);
15333
15494
  await Bun.write(entryPath, source);
@@ -15344,7 +15505,7 @@ export const importSync = (specifier) => {
15344
15505
  target: "browser",
15345
15506
  throw: false
15346
15507
  });
15347
- await rm10(tmpDir, { force: true, recursive: true });
15508
+ await rm9(tmpDir, { force: true, recursive: true });
15348
15509
  if (!result.success) {
15349
15510
  console.warn("\u26A0\uFE0F Ember vendor build had errors:", result.logs);
15350
15511
  }
@@ -15371,7 +15532,7 @@ var init_buildEmberVendor = __esm(() => {
15371
15532
  });
15372
15533
 
15373
15534
  // src/dev/dependencyGraph.ts
15374
- import { existsSync as existsSync22, readFileSync as readFileSync14 } from "fs";
15535
+ import { existsSync as existsSync22, readFileSync as readFileSync15 } from "fs";
15375
15536
  var {Glob: Glob8 } = globalThis.Bun;
15376
15537
  import { resolve as resolve23 } from "path";
15377
15538
  var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
@@ -15532,15 +15693,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
15532
15693
  const lowerPath = filePath.toLowerCase();
15533
15694
  const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
15534
15695
  if (loader === "html") {
15535
- const content = readFileSync14(filePath, "utf-8");
15696
+ const content = readFileSync15(filePath, "utf-8");
15536
15697
  return extractHtmlDependencies(filePath, content);
15537
15698
  }
15538
15699
  if (loader === "tsx" || loader === "js") {
15539
- const content = readFileSync14(filePath, "utf-8");
15700
+ const content = readFileSync15(filePath, "utf-8");
15540
15701
  return extractJsDependencies(filePath, content, loader);
15541
15702
  }
15542
15703
  if (isSvelteOrVue) {
15543
- const content = readFileSync14(filePath, "utf-8");
15704
+ const content = readFileSync15(filePath, "utf-8");
15544
15705
  return extractSvelteVueDependencies(filePath, content);
15545
15706
  }
15546
15707
  return [];
@@ -15691,7 +15852,8 @@ var init_clientManager = __esm(() => {
15691
15852
  });
15692
15853
 
15693
15854
  // src/dev/pathUtils.ts
15694
- import { readdirSync } from "fs";
15855
+ import { existsSync as existsSync23 } from "fs";
15856
+ import { resolve as resolve25 } from "path";
15695
15857
  var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
15696
15858
  if (shouldIgnorePath(filePath, resolved)) {
15697
15859
  return "ignored";
@@ -15765,28 +15927,15 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
15765
15927
  return "assets";
15766
15928
  }
15767
15929
  return "unknown";
15768
- }, getSiblingDirs = (frameworkDirs, cfg) => {
15769
- if (frameworkDirs.length === 0)
15770
- return [];
15771
- const root = commonAncestor(frameworkDirs);
15772
- if (!root)
15773
- return [];
15774
- const knownNames = new Set([...frameworkDirs, cfg.assetsDir, cfg.stylesDir].filter((dir) => Boolean(dir)).map((dir) => normalizePath(dir).split("/").pop()));
15775
- knownNames.add("build");
15776
- knownNames.add("node_modules");
15777
- knownNames.add(".absolutejs");
15778
- try {
15779
- return readdirSync(root, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !knownNames.has(entry.name)).map((entry) => `${root}/${entry.name}`);
15780
- } catch {
15781
- return [];
15782
- }
15783
- }, getWatchPaths = (config, resolved) => {
15784
- const paths = [];
15785
- const push = (base, sub) => {
15786
- if (!base)
15930
+ }, collectPositiveWatchRoots = (config, resolved) => {
15931
+ const cwd2 = process.cwd();
15932
+ const roots = [];
15933
+ const push = (path) => {
15934
+ if (!path)
15787
15935
  return;
15788
- const normalizedBase = normalizePath(base);
15789
- paths.push(sub ? `${normalizedBase}/${sub}` : normalizedBase);
15936
+ const abs = normalizePath(resolve25(cwd2, path));
15937
+ if (!roots.includes(abs))
15938
+ roots.push(abs);
15790
15939
  };
15791
15940
  const cfg = resolved ?? {
15792
15941
  angularDir: config.angularDirectory,
@@ -15804,44 +15953,76 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
15804
15953
  push(cfg.vueDir);
15805
15954
  push(cfg.emberDir);
15806
15955
  push(cfg.angularDir);
15807
- push(cfg.htmlDir, "pages");
15808
- push(cfg.htmlDir, "scripts");
15809
- push(cfg.htmlDir, "styles");
15810
- push(cfg.htmxDir, "pages");
15811
- push(cfg.htmxDir, "scripts");
15812
- push(cfg.htmxDir, "styles");
15956
+ push(cfg.htmlDir);
15957
+ push(cfg.htmxDir);
15813
15958
  push(cfg.assetsDir);
15814
15959
  push(cfg.stylesDir);
15815
- const frameworkDirs = [
15816
- cfg.reactDir,
15817
- cfg.svelteDir,
15818
- cfg.vueDir,
15819
- cfg.angularDir,
15820
- cfg.emberDir,
15821
- cfg.htmlDir,
15822
- cfg.htmxDir
15823
- ].filter((dir) => Boolean(dir)).map(normalizePath);
15824
- for (const siblingPath of getSiblingDirs(frameworkDirs, cfg)) {
15825
- push(siblingPath);
15960
+ for (const candidate of ["src", "db", "assets", "styles"]) {
15961
+ const abs = normalizePath(resolve25(cwd2, candidate));
15962
+ if (existsSync23(abs) && !roots.includes(abs))
15963
+ roots.push(abs);
15964
+ }
15965
+ const extraDirs = config.dev?.watchDirs ?? [];
15966
+ for (const dir of extraDirs)
15967
+ push(dir);
15968
+ return roots;
15969
+ }, getWatchPaths = (config, resolved) => {
15970
+ const roots = collectPositiveWatchRoots(config, resolved);
15971
+ const paths = [];
15972
+ const push = (base, sub) => {
15973
+ if (!base)
15974
+ return;
15975
+ const normalizedBase = normalizePath(base);
15976
+ paths.push(sub ? `${normalizedBase}/${sub}` : normalizedBase);
15977
+ };
15978
+ const cfg = resolved ?? {
15979
+ htmlDir: config.htmlDirectory,
15980
+ htmxDir: config.htmxDirectory
15981
+ };
15982
+ if (cfg.htmlDir) {
15983
+ push(cfg.htmlDir, "pages");
15984
+ push(cfg.htmlDir, "scripts");
15985
+ push(cfg.htmlDir, "styles");
15986
+ }
15987
+ if (cfg.htmxDir) {
15988
+ push(cfg.htmxDir, "pages");
15989
+ push(cfg.htmxDir, "scripts");
15990
+ push(cfg.htmxDir, "styles");
15991
+ }
15992
+ for (const root of roots) {
15993
+ if (root === normalizePath(cfg.htmlDir ?? ""))
15994
+ continue;
15995
+ if (root === normalizePath(cfg.htmxDir ?? ""))
15996
+ continue;
15997
+ paths.push(root);
15826
15998
  }
15827
15999
  return paths;
15828
- }, shouldIgnorePath = (path, resolved) => {
15829
- const normalizedPath = path.replace(/\\/g, "/");
15830
- if (resolved?.stylesDir && normalizedPath.startsWith(resolved.stylesDir)) {
15831
- return false;
16000
+ }, HARD_DENY_PATTERN, shouldIgnorePath = (path, resolved) => {
16001
+ const normalized = path.replace(/\\/g, "/");
16002
+ if (resolved?.stylesDir) {
16003
+ const styles = normalized.startsWith(resolved.stylesDir.replace(/\\/g, "/"));
16004
+ if (styles)
16005
+ return false;
15832
16006
  }
15833
- const managedDirPattern = /(^|\/)(build|generated|\.absolutejs|node_modules|\.git)(\/|$)/;
15834
- return managedDirPattern.test(normalizedPath) || normalizedPath.endsWith(".log") || normalizedPath.endsWith(".tmp");
16007
+ if (HARD_DENY_PATTERN.test(normalized))
16008
+ return true;
16009
+ if (normalized.endsWith(".log"))
16010
+ return true;
16011
+ if (normalized.endsWith(".tmp"))
16012
+ return true;
16013
+ if (normalized.endsWith("~"))
16014
+ return true;
16015
+ return false;
15835
16016
  };
15836
16017
  var init_pathUtils = __esm(() => {
15837
- init_commonAncestor();
15838
16018
  STYLE_EXTENSION_PATTERN2 = /\.(css|s[ac]ss|less|styl(?:us)?)$/i;
16019
+ HARD_DENY_PATTERN = /(^|\/)(build|generated|compiled|indexes|\.absolutejs|node_modules|\.git|\.test-builds|dist)(\/|$)/;
15839
16020
  });
15840
16021
 
15841
16022
  // src/dev/fileWatcher.ts
15842
16023
  import { watch } from "fs";
15843
- import { existsSync as existsSync23 } from "fs";
15844
- import { join as join25, resolve as resolve25 } from "path";
16024
+ import { existsSync as existsSync24 } from "fs";
16025
+ import { join as join26, resolve as resolve26 } from "path";
15845
16026
  var safeRemoveFromGraph = (graph, fullPath) => {
15846
16027
  try {
15847
16028
  removeFileFromGraph(graph, fullPath);
@@ -15868,16 +16049,16 @@ var safeRemoveFromGraph = (graph, fullPath) => {
15868
16049
  if (shouldSkipFilename(filename, isStylesDir)) {
15869
16050
  return;
15870
16051
  }
15871
- const fullPath = join25(absolutePath, filename).replace(/\\/g, "/");
16052
+ const fullPath = join26(absolutePath, filename).replace(/\\/g, "/");
15872
16053
  if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
15873
16054
  return;
15874
16055
  }
15875
- if (event === "rename" && !existsSync23(fullPath)) {
16056
+ if (event === "rename" && !existsSync24(fullPath)) {
15876
16057
  safeRemoveFromGraph(state.dependencyGraph, fullPath);
15877
16058
  onFileChange(fullPath);
15878
16059
  return;
15879
16060
  }
15880
- if (existsSync23(fullPath)) {
16061
+ if (existsSync24(fullPath)) {
15881
16062
  onFileChange(fullPath);
15882
16063
  safeAddToGraph(state.dependencyGraph, fullPath);
15883
16064
  }
@@ -15886,8 +16067,8 @@ var safeRemoveFromGraph = (graph, fullPath) => {
15886
16067
  }, addFileWatchers = (state, paths, onFileChange) => {
15887
16068
  const stylesDir = state.resolvedPaths?.stylesDir;
15888
16069
  paths.forEach((path) => {
15889
- const absolutePath = resolve25(path).replace(/\\/g, "/");
15890
- if (!existsSync23(absolutePath)) {
16070
+ const absolutePath = resolve26(path).replace(/\\/g, "/");
16071
+ if (!existsSync24(absolutePath)) {
15891
16072
  return;
15892
16073
  }
15893
16074
  const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
@@ -15897,8 +16078,8 @@ var safeRemoveFromGraph = (graph, fullPath) => {
15897
16078
  const watchPaths = getWatchPaths(config, state.resolvedPaths);
15898
16079
  const stylesDir = state.resolvedPaths?.stylesDir;
15899
16080
  watchPaths.forEach((path) => {
15900
- const absolutePath = resolve25(path).replace(/\\/g, "/");
15901
- if (!existsSync23(absolutePath)) {
16081
+ const absolutePath = resolve26(path).replace(/\\/g, "/");
16082
+ if (!existsSync24(absolutePath)) {
15902
16083
  return;
15903
16084
  }
15904
16085
  const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
@@ -15912,13 +16093,13 @@ var init_fileWatcher = __esm(() => {
15912
16093
  });
15913
16094
 
15914
16095
  // src/dev/assetStore.ts
15915
- import { resolve as resolve26 } from "path";
15916
- import { readdir as readdir3, unlink } from "fs/promises";
16096
+ import { resolve as resolve27 } from "path";
16097
+ import { readdir as readdir4, unlink } from "fs/promises";
15917
16098
  var mimeTypes, getMimeType = (filePath) => {
15918
16099
  const ext = filePath.slice(filePath.lastIndexOf("."));
15919
16100
  return mimeTypes[ext] ?? "application/octet-stream";
15920
16101
  }, HASHED_FILE_RE, stripHash = (webPath) => webPath.replace(/\.[a-z0-9]{8}(\.(js|css|mjs))$/, "$1"), processWalkEntry = (entry, dir, liveByIdentity, walkAndClean) => {
15921
- const fullPath = resolve26(dir, entry.name);
16102
+ const fullPath = resolve27(dir, entry.name);
15922
16103
  if (entry.isDirectory()) {
15923
16104
  return walkAndClean(fullPath);
15924
16105
  }
@@ -15934,10 +16115,10 @@ var mimeTypes, getMimeType = (filePath) => {
15934
16115
  }, cleanStaleAssets = async (store, manifest, buildDir) => {
15935
16116
  const liveByIdentity = new Map;
15936
16117
  for (const webPath of store.keys()) {
15937
- const diskPath = resolve26(buildDir, webPath.slice(1));
16118
+ const diskPath = resolve27(buildDir, webPath.slice(1));
15938
16119
  liveByIdentity.set(stripHash(diskPath), diskPath);
15939
16120
  }
15940
- const absBuildDir = resolve26(buildDir);
16121
+ const absBuildDir = resolve27(buildDir);
15941
16122
  Object.values(manifest).forEach((val) => {
15942
16123
  if (!HASHED_FILE_RE.test(val))
15943
16124
  return;
@@ -15947,7 +16128,7 @@ var mimeTypes, getMimeType = (filePath) => {
15947
16128
  });
15948
16129
  try {
15949
16130
  const walkAndClean = async (dir) => {
15950
- const entries = await readdir3(dir, { withFileTypes: true });
16131
+ const entries = await readdir4(dir, { withFileTypes: true });
15951
16132
  const tasks = entries.map((entry) => processWalkEntry(entry, dir, liveByIdentity, walkAndClean)).filter((task) => task !== null);
15952
16133
  await Promise.all(tasks);
15953
16134
  };
@@ -15955,7 +16136,7 @@ var mimeTypes, getMimeType = (filePath) => {
15955
16136
  } catch {}
15956
16137
  }, lookupAsset = (store, path) => store.get(path), processScanEntry = (entry, dir, prefix, store, scanDir) => {
15957
16138
  if (entry.isDirectory()) {
15958
- return scanDir(resolve26(dir, entry.name), `${prefix}${entry.name}/`);
16139
+ return scanDir(resolve27(dir, entry.name), `${prefix}${entry.name}/`);
15959
16140
  }
15960
16141
  if (!entry.name.startsWith("chunk-")) {
15961
16142
  return null;
@@ -15964,7 +16145,7 @@ var mimeTypes, getMimeType = (filePath) => {
15964
16145
  if (store.has(webPath)) {
15965
16146
  return null;
15966
16147
  }
15967
- return Bun.file(resolve26(dir, entry.name)).bytes().then((bytes) => {
16148
+ return Bun.file(resolve27(dir, entry.name)).bytes().then((bytes) => {
15968
16149
  store.set(webPath, bytes);
15969
16150
  return;
15970
16151
  }).catch(() => {});
@@ -15986,14 +16167,14 @@ var mimeTypes, getMimeType = (filePath) => {
15986
16167
  for (const webPath of newIdentities.values()) {
15987
16168
  if (store.has(webPath))
15988
16169
  continue;
15989
- loadPromises.push(Bun.file(resolve26(buildDir, webPath.slice(1))).bytes().then((bytes) => {
16170
+ loadPromises.push(Bun.file(resolve27(buildDir, webPath.slice(1))).bytes().then((bytes) => {
15990
16171
  store.set(webPath, bytes);
15991
16172
  return;
15992
16173
  }).catch(() => {}));
15993
16174
  }
15994
16175
  try {
15995
16176
  const scanDir = async (dir, prefix) => {
15996
- const entries = await readdir3(dir, { withFileTypes: true });
16177
+ const entries = await readdir4(dir, { withFileTypes: true });
15997
16178
  const subTasks = entries.map((entry) => processScanEntry(entry, dir, prefix, store, scanDir)).filter((task) => task !== null);
15998
16179
  await Promise.all(subTasks);
15999
16180
  };
@@ -16016,10 +16197,10 @@ var init_assetStore = __esm(() => {
16016
16197
  });
16017
16198
 
16018
16199
  // src/dev/fileHashTracker.ts
16019
- import { readFileSync as readFileSync15 } from "fs";
16200
+ import { readFileSync as readFileSync16 } from "fs";
16020
16201
  var computeFileHash = (filePath) => {
16021
16202
  try {
16022
- const fileContent = readFileSync15(filePath);
16203
+ const fileContent = readFileSync16(filePath);
16023
16204
  return Number(Bun.hash(fileContent));
16024
16205
  } catch {
16025
16206
  return UNFOUND_INDEX;
@@ -16099,9 +16280,9 @@ var init_transformCache = __esm(() => {
16099
16280
  });
16100
16281
 
16101
16282
  // src/dev/reactComponentClassifier.ts
16102
- import { resolve as resolve27 } from "path";
16283
+ import { resolve as resolve28 } from "path";
16103
16284
  var classifyComponent = (filePath) => {
16104
- const normalizedPath = resolve27(filePath);
16285
+ const normalizedPath = resolve28(filePath);
16105
16286
  if (normalizedPath.includes("/react/pages/")) {
16106
16287
  return "server";
16107
16288
  }
@@ -16113,7 +16294,7 @@ var classifyComponent = (filePath) => {
16113
16294
  var init_reactComponentClassifier = () => {};
16114
16295
 
16115
16296
  // src/dev/moduleMapper.ts
16116
- import { basename as basename10, resolve as resolve28 } from "path";
16297
+ import { basename as basename10, resolve as resolve29 } from "path";
16117
16298
  var buildModulePaths = (moduleKeys, manifest) => {
16118
16299
  const modulePaths = {};
16119
16300
  moduleKeys.forEach((key) => {
@@ -16123,7 +16304,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
16123
16304
  });
16124
16305
  return modulePaths;
16125
16306
  }, processChangedFile = (sourceFile, framework, manifest, resolvedPaths, processedFiles) => {
16126
- const normalizedFile = resolve28(sourceFile);
16307
+ const normalizedFile = resolve29(sourceFile);
16127
16308
  const normalizedPath = normalizedFile.replace(/\\/g, "/");
16128
16309
  if (processedFiles.has(normalizedFile)) {
16129
16310
  return null;
@@ -16159,7 +16340,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
16159
16340
  });
16160
16341
  return grouped;
16161
16342
  }, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
16162
- const normalizedFile = resolve28(sourceFile);
16343
+ const normalizedFile = resolve29(sourceFile);
16163
16344
  const fileName = basename10(normalizedFile);
16164
16345
  const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
16165
16346
  const pascalName = toPascal(baseName);
@@ -16318,6 +16499,239 @@ var init_ssrCache = __esm(() => {
16318
16499
  dirtyFrameworks = new Set;
16319
16500
  });
16320
16501
 
16502
+ // src/dev/angular/editTypeDetection.ts
16503
+ import { readFileSync as readFileSync17 } from "fs";
16504
+ import { basename as basename11 } from "path";
16505
+ import * as ts3 from "typescript";
16506
+ var TYPE_PRIORITY, STYLE_EXT_RE, COMPONENT_STYLE_RE, TEMPLATE_RE, COMPONENT_CLASS_RE, SERVICE_RE, ROUTES_RE, SIDE_EFFECT_CALL_NAMES, SIDE_EFFECT_NEW_NAMES, getCalleeName = (node) => {
16507
+ const callee = node.expression;
16508
+ if (ts3.isIdentifier(callee))
16509
+ return callee.text;
16510
+ if (ts3.isPropertyAccessExpression(callee))
16511
+ return callee.name.text;
16512
+ return null;
16513
+ }, getNewExprName = (node) => {
16514
+ const callee = node.expression;
16515
+ if (ts3.isIdentifier(callee))
16516
+ return callee.text;
16517
+ if (ts3.isPropertyAccessExpression(callee))
16518
+ return callee.name.text;
16519
+ return null;
16520
+ }, collectMethodBodies = (cls) => {
16521
+ const methods = new Map;
16522
+ cls.members.forEach((member) => {
16523
+ if (!member.name || !ts3.isIdentifier(member.name))
16524
+ return;
16525
+ if (ts3.isMethodDeclaration(member) && member.body) {
16526
+ methods.set(member.name.text, member.body);
16527
+ return;
16528
+ }
16529
+ if (ts3.isPropertyDeclaration(member) && member.initializer) {
16530
+ const init = member.initializer;
16531
+ if (ts3.isArrowFunction(init) || ts3.isFunctionExpression(init)) {
16532
+ methods.set(member.name.text, init.body);
16533
+ }
16534
+ }
16535
+ });
16536
+ return methods;
16537
+ }, findSideEffectInBody = (body, methods, visited) => {
16538
+ let hit = { found: false };
16539
+ const walk = (node) => {
16540
+ if (hit.found)
16541
+ return;
16542
+ if (ts3.isCallExpression(node)) {
16543
+ const name = getCalleeName(node);
16544
+ if (name && SIDE_EFFECT_CALL_NAMES.has(name)) {
16545
+ hit = {
16546
+ found: true,
16547
+ reason: `constructor invokes ${name}(...)`
16548
+ };
16549
+ return;
16550
+ }
16551
+ if (name && methods.has(name) && !visited.has(name)) {
16552
+ visited.add(name);
16553
+ const target = methods.get(name);
16554
+ if (target) {
16555
+ const inner = findSideEffectInBody(target, methods, visited);
16556
+ if (inner.found) {
16557
+ hit = {
16558
+ found: true,
16559
+ reason: `${inner.reason} (via this.${name}())`
16560
+ };
16561
+ return;
16562
+ }
16563
+ }
16564
+ }
16565
+ }
16566
+ if (ts3.isNewExpression(node)) {
16567
+ const name = getNewExprName(node);
16568
+ if (name && SIDE_EFFECT_NEW_NAMES.has(name)) {
16569
+ hit = {
16570
+ found: true,
16571
+ reason: `constructor instantiates new ${name}(...)`
16572
+ };
16573
+ return;
16574
+ }
16575
+ }
16576
+ ts3.forEachChild(node, walk);
16577
+ };
16578
+ walk(body);
16579
+ return hit;
16580
+ }, analyzeServiceFile = (file5) => {
16581
+ let source;
16582
+ try {
16583
+ source = readFileSync17(file5, "utf8");
16584
+ } catch {
16585
+ return {
16586
+ hasSideEffectCtor: true,
16587
+ reason: "service file unreadable \u2014 defaulting to reboot"
16588
+ };
16589
+ }
16590
+ const sf = ts3.createSourceFile(file5, source, ts3.ScriptTarget.Latest, true);
16591
+ let result = {
16592
+ hasSideEffectCtor: false,
16593
+ reason: "constructor has no side-effecting calls"
16594
+ };
16595
+ const visit = (node) => {
16596
+ if (result.hasSideEffectCtor)
16597
+ return;
16598
+ if (!ts3.isClassDeclaration(node)) {
16599
+ ts3.forEachChild(node, visit);
16600
+ return;
16601
+ }
16602
+ const methods = collectMethodBodies(node);
16603
+ const ctor = node.members.find(ts3.isConstructorDeclaration);
16604
+ const targets = [];
16605
+ if (ctor?.body)
16606
+ targets.push(ctor.body);
16607
+ node.members.forEach((member) => {
16608
+ if (ts3.isPropertyDeclaration(member) && member.initializer) {
16609
+ targets.push(member.initializer);
16610
+ }
16611
+ });
16612
+ for (const target of targets) {
16613
+ const r = findSideEffectInBody(target, methods, new Set);
16614
+ if (r.found) {
16615
+ result = { hasSideEffectCtor: true, reason: r.reason };
16616
+ break;
16617
+ }
16618
+ }
16619
+ if (!result.hasSideEffectCtor)
16620
+ ts3.forEachChild(node, visit);
16621
+ };
16622
+ visit(sf);
16623
+ return result;
16624
+ }, classifyAngularEdit = (file5) => {
16625
+ const base = basename11(file5);
16626
+ if (TEMPLATE_RE.test(file5)) {
16627
+ return {
16628
+ type: "template",
16629
+ reason: `${base} \u2014 template edit`,
16630
+ sourceFile: file5
16631
+ };
16632
+ }
16633
+ if (COMPONENT_STYLE_RE.test(file5)) {
16634
+ return {
16635
+ type: "style-component",
16636
+ reason: `${base} \u2014 component-scoped stylesheet edit`,
16637
+ sourceFile: file5
16638
+ };
16639
+ }
16640
+ if (STYLE_EXT_RE.test(file5)) {
16641
+ return {
16642
+ type: "reboot",
16643
+ reason: `${base} \u2014 non-component-named stylesheet, falling back to reboot until scoping is verified`,
16644
+ sourceFile: file5
16645
+ };
16646
+ }
16647
+ if (ROUTES_RE.test(file5)) {
16648
+ return {
16649
+ type: "route",
16650
+ reason: `${base} \u2014 router config, requires reboot`,
16651
+ sourceFile: file5
16652
+ };
16653
+ }
16654
+ if (SERVICE_RE.test(file5)) {
16655
+ const a = analyzeServiceFile(file5);
16656
+ if (a.hasSideEffectCtor) {
16657
+ return {
16658
+ type: "service-with-side-effects",
16659
+ reason: `${base} \u2014 ${a.reason}`,
16660
+ sourceFile: file5
16661
+ };
16662
+ }
16663
+ return {
16664
+ type: "service-method-only",
16665
+ reason: `${base} \u2014 ${a.reason}`,
16666
+ sourceFile: file5
16667
+ };
16668
+ }
16669
+ if (COMPONENT_CLASS_RE.test(file5)) {
16670
+ return {
16671
+ type: "class-component",
16672
+ reason: `${base} \u2014 component class edit`,
16673
+ sourceFile: file5
16674
+ };
16675
+ }
16676
+ return {
16677
+ type: "reboot",
16678
+ reason: `${base} \u2014 unrecognized angular file type, falling back to reboot`,
16679
+ sourceFile: file5
16680
+ };
16681
+ }, collapseClassifications = (classifications) => {
16682
+ if (classifications.length === 0) {
16683
+ return {
16684
+ type: "reboot",
16685
+ reason: "no classifiable files in batch",
16686
+ sourceFile: ""
16687
+ };
16688
+ }
16689
+ let winner = classifications[0];
16690
+ for (let i = 1;i < classifications.length; i++) {
16691
+ const candidate = classifications[i];
16692
+ if (TYPE_PRIORITY[candidate.type] > TYPE_PRIORITY[winner.type]) {
16693
+ winner = candidate;
16694
+ }
16695
+ }
16696
+ return winner;
16697
+ };
16698
+ var init_editTypeDetection = __esm(() => {
16699
+ TYPE_PRIORITY = {
16700
+ template: 0,
16701
+ "style-component": 1,
16702
+ "service-method-only": 2,
16703
+ "class-component": 3,
16704
+ "service-with-side-effects": 4,
16705
+ route: 5,
16706
+ reboot: 6
16707
+ };
16708
+ STYLE_EXT_RE = /\.(css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
16709
+ COMPONENT_STYLE_RE = /\.component\.(css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
16710
+ TEMPLATE_RE = /\.html$/i;
16711
+ COMPONENT_CLASS_RE = /\.component\.ts$/i;
16712
+ SERVICE_RE = /\.service\.ts$/i;
16713
+ ROUTES_RE = /(?:^|[\\/])(?:app\.)?routes\.ts$/i;
16714
+ SIDE_EFFECT_CALL_NAMES = new Set([
16715
+ "subscribe",
16716
+ "setInterval",
16717
+ "setTimeout",
16718
+ "addEventListener",
16719
+ "effect",
16720
+ "afterNextRender",
16721
+ "afterRender",
16722
+ "afterEveryRender",
16723
+ "requestAnimationFrame",
16724
+ "requestIdleCallback"
16725
+ ]);
16726
+ SIDE_EFFECT_NEW_NAMES = new Set([
16727
+ "Worker",
16728
+ "SharedWorker",
16729
+ "EventSource",
16730
+ "WebSocket",
16731
+ "BroadcastChannel"
16732
+ ]);
16733
+ });
16734
+
16321
16735
  // src/dev/moduleServer.ts
16322
16736
  var exports_moduleServer = {};
16323
16737
  __export(exports_moduleServer, {
@@ -16329,8 +16743,8 @@ __export(exports_moduleServer, {
16329
16743
  createModuleServer: () => createModuleServer,
16330
16744
  SRC_URL_PREFIX: () => SRC_URL_PREFIX
16331
16745
  });
16332
- import { existsSync as existsSync24, readFileSync as readFileSync16, statSync as statSync2 } from "fs";
16333
- import { basename as basename11, dirname as dirname16, extname as extname8, join as join26, resolve as resolve29, relative as relative11 } from "path";
16746
+ import { existsSync as existsSync25, readFileSync as readFileSync18, statSync as statSync2 } from "fs";
16747
+ import { basename as basename12, dirname as dirname16, extname as extname8, join as join27, resolve as resolve30, relative as relative11 } from "path";
16334
16748
  var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
16335
16749
  const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
16336
16750
  const allExports = [];
@@ -16350,7 +16764,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
16350
16764
  ${stubs}
16351
16765
  `;
16352
16766
  }, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
16353
- const found = extensions.find((ext) => existsSync24(resolve29(projectRoot, srcPath + ext)));
16767
+ const found = extensions.find((ext) => existsSync25(resolve30(projectRoot, srcPath + ext)));
16354
16768
  return found ? srcPath + found : srcPath;
16355
16769
  }, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
16356
16770
  const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
@@ -16365,7 +16779,7 @@ ${stubs}
16365
16779
  return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
16366
16780
  }, srcUrl = (relPath, projectRoot) => {
16367
16781
  const base = `${SRC_PREFIX}${relPath.replace(/\\/g, "/")}`;
16368
- const absPath = resolve29(projectRoot, relPath);
16782
+ const absPath = resolve30(projectRoot, relPath);
16369
16783
  const cached = mtimeCache.get(absPath);
16370
16784
  if (cached !== undefined)
16371
16785
  return `${base}?v=${buildVersion(cached, absPath)}`;
@@ -16377,12 +16791,12 @@ ${stubs}
16377
16791
  return base;
16378
16792
  }
16379
16793
  }, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
16380
- const absPath = resolve29(fileDir, relPath);
16794
+ const absPath = resolve30(fileDir, relPath);
16381
16795
  const rel = relative11(projectRoot, absPath);
16382
16796
  const extension = extname8(rel);
16383
16797
  let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
16384
16798
  if (extname8(srcPath) === ".svelte") {
16385
- srcPath = relative11(projectRoot, resolveSvelteModulePath(resolve29(projectRoot, srcPath)));
16799
+ srcPath = relative11(projectRoot, resolveSvelteModulePath(resolve30(projectRoot, srcPath)));
16386
16800
  }
16387
16801
  return srcUrl(srcPath, projectRoot);
16388
16802
  }, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
@@ -16399,14 +16813,14 @@ ${stubs}
16399
16813
  const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
16400
16814
  const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
16401
16815
  if (!subpath) {
16402
- const pkgDir = resolve29(projectRoot, "node_modules", packageName ?? "");
16403
- const pkgJsonPath = join26(pkgDir, "package.json");
16404
- if (existsSync24(pkgJsonPath)) {
16405
- const pkg = JSON.parse(readFileSync16(pkgJsonPath, "utf-8"));
16816
+ const pkgDir = resolve30(projectRoot, "node_modules", packageName ?? "");
16817
+ const pkgJsonPath = join27(pkgDir, "package.json");
16818
+ if (existsSync25(pkgJsonPath)) {
16819
+ const pkg = JSON.parse(readFileSync18(pkgJsonPath, "utf-8"));
16406
16820
  const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
16407
16821
  if (esmEntry) {
16408
- const resolved = resolve29(pkgDir, esmEntry);
16409
- if (existsSync24(resolved))
16822
+ const resolved = resolve30(pkgDir, esmEntry);
16823
+ if (existsSync25(resolved))
16410
16824
  return relative11(projectRoot, resolved);
16411
16825
  }
16412
16826
  }
@@ -16416,7 +16830,7 @@ ${stubs}
16416
16830
  } catch {
16417
16831
  return;
16418
16832
  }
16419
- }, rewriteImports2 = (code, filePath, projectRoot, rewriter) => {
16833
+ }, rewriteImports = (code, filePath, projectRoot, rewriter) => {
16420
16834
  let result = code;
16421
16835
  const vendorReplace = (_match, prefix, specifier, suffix) => {
16422
16836
  const webPath = rewriter?.lookup.get(specifier);
@@ -16450,12 +16864,12 @@ ${stubs}
16450
16864
  return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
16451
16865
  });
16452
16866
  result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
16453
- const absPath = resolve29(fileDir, relPath);
16867
+ const absPath = resolve30(fileDir, relPath);
16454
16868
  const rel = relative11(projectRoot, absPath);
16455
16869
  return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
16456
16870
  });
16457
16871
  result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
16458
- const absPath = resolve29(fileDir, relPath);
16872
+ const absPath = resolve30(fileDir, relPath);
16459
16873
  const rel = relative11(projectRoot, absPath);
16460
16874
  return `'${srcUrl(rel, projectRoot)}'`;
16461
16875
  });
@@ -16501,7 +16915,7 @@ ${code}`;
16501
16915
  reactFastRefreshWarningEmitted = true;
16502
16916
  logWarn("React HMR is blocked: this Bun build ignores " + "`reactFastRefresh` on Bun.Transpiler, so component state " + "cannot be preserved across edits. Tracking " + "https://github.com/oven-sh/bun/pull/28312 \u2014 if it still has " + "not merged, leave a \uD83D\uDC4D on the PR so the Bun team knows it " + "is blocking you. Until then, React edits trigger a full " + "reload instead of a fast refresh.");
16503
16917
  }, transformReactFile = (filePath, projectRoot, rewriter) => {
16504
- const raw = readFileSync16(filePath, "utf-8");
16918
+ const raw = readFileSync18(filePath, "utf-8");
16505
16919
  const valueExports = tsxTranspiler.scan(raw).exports;
16506
16920
  let transpiled = reactTranspiler.transformSync(raw);
16507
16921
  transpiled = preserveTypeExports(raw, transpiled, valueExports);
@@ -16515,9 +16929,9 @@ ${transpiled}`;
16515
16929
  const relPath = relative11(projectRoot, filePath).replace(/\\/g, "/");
16516
16930
  transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
16517
16931
  transpiled += buildIslandMetadataExports(raw);
16518
- return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
16932
+ return rewriteImports(transpiled, filePath, projectRoot, rewriter);
16519
16933
  }, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
16520
- const raw = readFileSync16(filePath, "utf-8");
16934
+ const raw = readFileSync18(filePath, "utf-8");
16521
16935
  const ext = extname8(filePath);
16522
16936
  const isTS = ext === ".ts" || ext === ".tsx";
16523
16937
  const isTSX = ext === ".tsx" || ext === ".jsx";
@@ -16531,7 +16945,7 @@ ${transpiled}`;
16531
16945
  if (isTS) {
16532
16946
  transpiled = preserveTypeExports(raw, transpiled, valueExports);
16533
16947
  }
16534
- transpiled = rewriteImports2(transpiled, filePath, projectRoot, rewriter);
16948
+ transpiled = rewriteImports(transpiled, filePath, projectRoot, rewriter);
16535
16949
  if (!vueDir || !filePath.startsWith(vueDir) || !isTS)
16536
16950
  return transpiled;
16537
16951
  const useExports = valueExports.filter((e) => e.startsWith("use"));
@@ -16683,7 +17097,7 @@ ${code}`;
16683
17097
  ` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
16684
17098
  return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
16685
17099
  }, transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
16686
- const raw = readFileSync16(filePath, "utf-8");
17100
+ const raw = readFileSync18(filePath, "utf-8");
16687
17101
  if (!svelteCompiler) {
16688
17102
  svelteCompiler = await import("svelte/compiler");
16689
17103
  }
@@ -16693,7 +17107,7 @@ ${code}`;
16693
17107
  const source = isModule ? loweredSource.code : (await svelteCompiler.preprocess(loweredSource.code, createSvelteStylePreprocessor(stylePreprocessors))).code;
16694
17108
  const enableAsync = loweredAwaitSource.transformed || loweredSource.transformed;
16695
17109
  const code = isModule ? compileSvelteModule(source, filePath) : compileSvelteComponent(source, filePath, projectRoot, enableAsync);
16696
- return rewriteImports2(code, filePath, projectRoot, rewriter);
17110
+ return rewriteImports(code, filePath, projectRoot, rewriter);
16697
17111
  }, compileVueTemplate = (descriptor, compiledScript, filePath, componentId) => {
16698
17112
  const compiler = getLoadedVueCompiler();
16699
17113
  const scriptContent = compiledScript.content;
@@ -16743,12 +17157,12 @@ export default __script__;`;
16743
17157
  return `${cssInjection}
16744
17158
  ${code}`;
16745
17159
  }, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
16746
- const rawSource = readFileSync16(filePath, "utf-8");
17160
+ const rawSource = readFileSync18(filePath, "utf-8");
16747
17161
  const raw = addAutoRouterSetupApp(rawSource);
16748
17162
  if (!vueCompiler) {
16749
17163
  vueCompiler = await import("@vue/compiler-sfc");
16750
17164
  }
16751
- const fileName = basename11(filePath, ".vue");
17165
+ const fileName = basename12(filePath, ".vue");
16752
17166
  const componentId = fileName.toLowerCase();
16753
17167
  const { descriptor } = vueCompiler.parse(raw, { filename: filePath });
16754
17168
  const hasScript = descriptor.script || descriptor.scriptSetup;
@@ -16764,9 +17178,9 @@ ${code}`;
16764
17178
  code = await compileVueStyles(descriptor, filePath, componentId, code, stylePreprocessors);
16765
17179
  code = tsTranspiler2.transformSync(code);
16766
17180
  code = injectVueHmr(code, filePath, projectRoot, vueDir);
16767
- return rewriteImports2(code, filePath, projectRoot, rewriter);
17181
+ return rewriteImports(code, filePath, projectRoot, rewriter);
16768
17182
  }, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
16769
- const hmrBase = vueDir ? resolve29(vueDir) : projectRoot;
17183
+ const hmrBase = vueDir ? resolve30(vueDir) : projectRoot;
16770
17184
  const hmrId = relative11(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
16771
17185
  let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
16772
17186
  result += [
@@ -16781,11 +17195,11 @@ ${code}`;
16781
17195
  `);
16782
17196
  return result;
16783
17197
  }, resolveSvelteModulePath = (path) => {
16784
- if (existsSync24(path))
17198
+ if (existsSync25(path))
16785
17199
  return path;
16786
- if (existsSync24(`${path}.ts`))
17200
+ if (existsSync25(`${path}.ts`))
16787
17201
  return `${path}.ts`;
16788
- if (existsSync24(`${path}.js`))
17202
+ if (existsSync25(`${path}.js`))
16789
17203
  return `${path}.js`;
16790
17204
  return path;
16791
17205
  }, jsResponse = (body) => {
@@ -16798,7 +17212,7 @@ ${code}`;
16798
17212
  }
16799
17213
  });
16800
17214
  }, handleCssRequest = (filePath) => {
16801
- const raw = readFileSync16(filePath, "utf-8");
17215
+ const raw = readFileSync18(filePath, "utf-8");
16802
17216
  const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
16803
17217
  return [
16804
17218
  `const style = document.createElement('style');`,
@@ -16925,13 +17339,13 @@ export default {};
16925
17339
  const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
16926
17340
  return jsResponse(`var s=document.createElement('style');s.textContent=\`${escaped}\`;s.dataset.svelteHmr=${JSON.stringify(cssCheckPath)};var p=document.querySelector('style[data-svelte-hmr="${cssCheckPath}"]');if(p)p.remove();document.head.appendChild(s);`);
16927
17341
  }, resolveSourcePath = (relPath, projectRoot) => {
16928
- const filePath = resolve29(projectRoot, relPath);
17342
+ const filePath = resolve30(projectRoot, relPath);
16929
17343
  const ext = extname8(filePath);
16930
17344
  if (ext === ".svelte")
16931
17345
  return { ext, filePath: resolveSvelteModulePath(filePath) };
16932
17346
  if (ext)
16933
17347
  return { ext, filePath };
16934
- const found = MODULE_EXTENSIONS.find((candidate) => existsSync24(filePath + candidate));
17348
+ const found = MODULE_EXTENSIONS.find((candidate) => existsSync25(filePath + candidate));
16935
17349
  if (!found)
16936
17350
  return { ext, filePath };
16937
17351
  const resolved = filePath + found;
@@ -16951,20 +17365,20 @@ export default {};
16951
17365
  return transformAndCacheVue(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
16952
17366
  if (!TRANSPILABLE.has(ext))
16953
17367
  return;
16954
- const stat4 = statSync2(filePath);
16955
- const resolvedVueDir = vueDir ? resolve29(vueDir) : undefined;
17368
+ const stat3 = statSync2(filePath);
17369
+ const resolvedVueDir = vueDir ? resolve30(vueDir) : undefined;
16956
17370
  const content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
16957
- setTransformed(filePath, content, stat4.mtimeMs, extractImportedFiles(content, projectRoot));
17371
+ setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
16958
17372
  return jsResponse(content);
16959
17373
  }, transformAndCacheSvelte = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
16960
- const stat4 = statSync2(filePath);
17374
+ const stat3 = statSync2(filePath);
16961
17375
  const content = await transformSvelteFile(filePath, projectRoot, rewriter, stylePreprocessors);
16962
- setTransformed(filePath, content, stat4.mtimeMs, extractImportedFiles(content, projectRoot));
17376
+ setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
16963
17377
  return jsResponse(content);
16964
17378
  }, transformAndCacheVue = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
16965
- const stat4 = statSync2(filePath);
17379
+ const stat3 = statSync2(filePath);
16966
17380
  const content = await transformVueFile(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
16967
- setTransformed(filePath, content, stat4.mtimeMs, extractImportedFiles(content, projectRoot));
17381
+ setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
16968
17382
  return jsResponse(content);
16969
17383
  }, transformErrorResponse = (err) => {
16970
17384
  const errMsg = err instanceof Error ? err.message : String(err);
@@ -16983,7 +17397,7 @@ export default {};
16983
17397
  if (!pathname.startsWith(SRC_PREFIX))
16984
17398
  return;
16985
17399
  const relPath = pathname.slice(SRC_PREFIX.length);
16986
- const virtualCssResponse = handleVirtualSvelteCss(resolve29(projectRoot, relPath));
17400
+ const virtualCssResponse = handleVirtualSvelteCss(resolve30(projectRoot, relPath));
16987
17401
  if (virtualCssResponse)
16988
17402
  return virtualCssResponse;
16989
17403
  const { filePath, ext } = resolveSourcePath(relPath, projectRoot);
@@ -16999,11 +17413,11 @@ export default {};
16999
17413
  SRC_IMPORT_RE.lastIndex = 0;
17000
17414
  while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
17001
17415
  if (match[1])
17002
- files.push(resolve29(projectRoot, match[1]));
17416
+ files.push(resolve30(projectRoot, match[1]));
17003
17417
  }
17004
17418
  return files;
17005
17419
  }, invalidateModule = (filePath) => {
17006
- const resolved = resolve29(filePath);
17420
+ const resolved = resolve30(filePath);
17007
17421
  invalidate(filePath);
17008
17422
  if (resolved !== filePath)
17009
17423
  invalidate(resolved);
@@ -17078,6 +17492,46 @@ var init_moduleServer = __esm(() => {
17078
17492
  SRC_URL_PREFIX = SRC_PREFIX;
17079
17493
  });
17080
17494
 
17495
+ // src/build/rewriteImports.ts
17496
+ var exports_rewriteImports = {};
17497
+ __export(exports_rewriteImports, {
17498
+ rewriteVendorDirectories: () => rewriteVendorDirectories2,
17499
+ rewriteImports: () => rewriteImports2
17500
+ });
17501
+ var rewriteImports2 = async (outputPaths, vendorPaths) => {
17502
+ const jsFiles = outputPaths.filter((path) => path.endsWith(".js"));
17503
+ if (jsFiles.length === 0)
17504
+ return;
17505
+ if (Object.keys(vendorPaths).length === 0)
17506
+ return;
17507
+ await Promise.all(jsFiles.map(async (filePath) => {
17508
+ let original;
17509
+ try {
17510
+ original = await Bun.file(filePath).text();
17511
+ } catch (err) {
17512
+ const code = err.code;
17513
+ if (code === "ENOENT")
17514
+ return;
17515
+ throw err;
17516
+ }
17517
+ const rewritten = rewriteImportsInContent(original, vendorPaths);
17518
+ if (rewritten === original)
17519
+ return;
17520
+ try {
17521
+ await Bun.write(filePath, rewritten);
17522
+ } catch (err) {
17523
+ const code = err.code;
17524
+ if (code === "ENOENT")
17525
+ return;
17526
+ throw err;
17527
+ }
17528
+ }));
17529
+ }, rewriteVendorDirectories2;
17530
+ var init_rewriteImports = __esm(() => {
17531
+ init_rewriteImportsPlugin();
17532
+ rewriteVendorDirectories2 = rewriteVendorDirectories;
17533
+ });
17534
+
17081
17535
  // src/utils/ssrErrorPage.ts
17082
17536
  var ssrErrorPage = (framework, error) => {
17083
17537
  const frameworkColors2 = {
@@ -17209,11 +17663,11 @@ var exports_simpleHTMLHMR = {};
17209
17663
  __export(exports_simpleHTMLHMR, {
17210
17664
  handleHTMLUpdate: () => handleHTMLUpdate
17211
17665
  });
17212
- import { resolve as resolve30 } from "path";
17666
+ import { resolve as resolve31 } from "path";
17213
17667
  var handleHTMLUpdate = async (htmlFilePath) => {
17214
17668
  let htmlContent;
17215
17669
  try {
17216
- const resolvedPath = resolve30(htmlFilePath);
17670
+ const resolvedPath = resolve31(htmlFilePath);
17217
17671
  const file5 = Bun.file(resolvedPath);
17218
17672
  if (!await file5.exists()) {
17219
17673
  return null;
@@ -17239,11 +17693,11 @@ var exports_simpleHTMXHMR = {};
17239
17693
  __export(exports_simpleHTMXHMR, {
17240
17694
  handleHTMXUpdate: () => handleHTMXUpdate
17241
17695
  });
17242
- import { resolve as resolve31 } from "path";
17696
+ import { resolve as resolve32 } from "path";
17243
17697
  var handleHTMXUpdate = async (htmxFilePath) => {
17244
17698
  let htmlContent;
17245
17699
  try {
17246
- const resolvedPath = resolve31(htmxFilePath);
17700
+ const resolvedPath = resolve32(htmxFilePath);
17247
17701
  const file5 = Bun.file(resolvedPath);
17248
17702
  if (!await file5.exists()) {
17249
17703
  return null;
@@ -17265,8 +17719,8 @@ var handleHTMXUpdate = async (htmxFilePath) => {
17265
17719
  var init_simpleHTMXHMR = () => {};
17266
17720
 
17267
17721
  // src/dev/rebuildTrigger.ts
17268
- import { existsSync as existsSync25 } from "fs";
17269
- import { basename as basename12, dirname as dirname17, relative as relative12, resolve as resolve32 } from "path";
17722
+ import { existsSync as existsSync26 } from "fs";
17723
+ import { basename as basename13, dirname as dirname17, relative as relative12, resolve as resolve33 } from "path";
17270
17724
  var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequentially = (items, action) => items.reduce((chain, item) => chain.then(() => action(item)), Promise.resolve()), getStyleTransformConfig = (config) => createStyleTransformConfig(config.stylePreprocessors, config.postcss), recompileTailwindForFastPath = async (state, config, files) => {
17271
17725
  if (!config.tailwind)
17272
17726
  return;
@@ -17354,11 +17808,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
17354
17808
  detectedFw = detected !== "ignored" ? detected : affectedFrameworks[0];
17355
17809
  }
17356
17810
  return { ...parsed, framework: detectedFw };
17357
- }, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync25(affectedFile), collectDeletedFileAffected = (state, filePathInSet, processedFiles, validFiles) => {
17811
+ }, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync26(affectedFile), collectDeletedFileAffected = (state, filePathInSet, processedFiles, validFiles) => {
17358
17812
  state.fileHashes.delete(filePathInSet);
17359
17813
  try {
17360
17814
  const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
17361
- const deletedPathResolved = resolve32(filePathInSet);
17815
+ const deletedPathResolved = resolve33(filePathInSet);
17362
17816
  affectedFiles.forEach((affectedFile) => {
17363
17817
  if (isValidDeletedAffectedFile(affectedFile, deletedPathResolved, processedFiles)) {
17364
17818
  validFiles.push(affectedFile);
@@ -17372,7 +17826,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
17372
17826
  if (!dependents || dependents.size === 0) {
17373
17827
  return;
17374
17828
  }
17375
- const dependentFiles = Array.from(dependents).filter((file5) => existsSync25(file5));
17829
+ const dependentFiles = Array.from(dependents).filter((file5) => existsSync26(file5));
17376
17830
  if (dependentFiles.length === 0) {
17377
17831
  return;
17378
17832
  }
@@ -17388,7 +17842,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
17388
17842
  try {
17389
17843
  const affectedFiles = getAffectedFiles(state.dependencyGraph, normalizedFilePath);
17390
17844
  affectedFiles.forEach((affectedFile) => {
17391
- if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync25(affectedFile)) {
17845
+ if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync26(affectedFile)) {
17392
17846
  validFiles.push(affectedFile);
17393
17847
  processedFiles.add(affectedFile);
17394
17848
  }
@@ -17402,7 +17856,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
17402
17856
  if (storedHash !== undefined && storedHash === fileHash) {
17403
17857
  return;
17404
17858
  }
17405
- const normalizedFilePath = resolve32(filePathInSet);
17859
+ const normalizedFilePath = resolve33(filePathInSet);
17406
17860
  if (!processedFiles.has(normalizedFilePath)) {
17407
17861
  validFiles.push(normalizedFilePath);
17408
17862
  processedFiles.add(normalizedFilePath);
@@ -17413,7 +17867,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
17413
17867
  collectChangedFileAffected(state, normalizedFilePath, processedFiles, validFiles);
17414
17868
  }, processFilePathSet = (state, filePathSet, processedFiles, validFiles) => {
17415
17869
  filePathSet.forEach((filePathInSet) => {
17416
- if (!existsSync25(filePathInSet)) {
17870
+ if (!existsSync26(filePathInSet)) {
17417
17871
  collectDeletedFileAffected(state, filePathInSet, processedFiles, validFiles);
17418
17872
  return;
17419
17873
  }
@@ -17506,7 +17960,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
17506
17960
  return;
17507
17961
  }
17508
17962
  if (framework === "unknown") {
17509
- invalidate(resolve32(filePath));
17963
+ invalidate(resolve33(filePath));
17510
17964
  const relPath = relative12(process.cwd(), filePath);
17511
17965
  logHmrUpdate(relPath);
17512
17966
  return;
@@ -17550,12 +18004,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
17550
18004
  return componentFile;
17551
18005
  }
17552
18006
  const tsCounterpart = componentFile.replace(/\.html$/, ".ts");
17553
- if (existsSync25(tsCounterpart)) {
18007
+ if (existsSync26(tsCounterpart)) {
17554
18008
  return tsCounterpart;
17555
18009
  }
17556
18010
  if (!graph)
17557
18011
  return componentFile;
17558
- const dependents = graph.dependents.get(resolve32(componentFile));
18012
+ const dependents = graph.dependents.get(resolve33(componentFile));
17559
18013
  if (!dependents)
17560
18014
  return componentFile;
17561
18015
  for (const dep of dependents) {
@@ -17564,7 +18018,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
17564
18018
  }
17565
18019
  return componentFile;
17566
18020
  }, resolveAngularPageEntries = (state, angularFiles, angularPagesPath) => {
17567
- const pageEntries = angularFiles.filter((file5) => file5.endsWith(".ts") && resolve32(file5).startsWith(angularPagesPath));
18021
+ const pageEntries = angularFiles.filter((file5) => file5.endsWith(".ts") && resolve33(file5).startsWith(angularPagesPath));
17568
18022
  if (pageEntries.length > 0 || !state.dependencyGraph) {
17569
18023
  return pageEntries;
17570
18024
  }
@@ -17573,7 +18027,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
17573
18027
  const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
17574
18028
  const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
17575
18029
  affected.forEach((file5) => {
17576
- if (file5.endsWith(".ts") && resolve32(file5).startsWith(angularPagesPath)) {
18030
+ if (file5.endsWith(".ts") && resolve33(file5).startsWith(angularPagesPath)) {
17577
18031
  resolvedPages.add(file5);
17578
18032
  }
17579
18033
  });
@@ -17590,7 +18044,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
17590
18044
  const { commonAncestor: commonAncestor2 } = await Promise.resolve().then(() => (init_commonAncestor(), exports_commonAncestor));
17591
18045
  return clientRoots.length === 1 ? clientRoots[0] ?? process.cwd() : commonAncestor2(clientRoots, process.cwd());
17592
18046
  }, updateServerManifestEntry = (state, artifact) => {
17593
- const fileWithHash = basename12(artifact.path);
18047
+ const fileWithHash = basename13(artifact.path);
17594
18048
  const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
17595
18049
  if (!baseName) {
17596
18050
  return;
@@ -17643,9 +18097,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
17643
18097
  const clientManifest = generateManifest2(clientResult.outputs, buildDir);
17644
18098
  Object.assign(state.manifest, clientManifest);
17645
18099
  await populateAssetStore(state.assetStore, clientManifest, buildDir);
17646
- }, broadcastAngularPageUpdates = (state, pagesToUpdate, manifest, startTime) => {
18100
+ }, broadcastAngularPageUpdates = (state, pagesToUpdate, manifest, startTime, classification) => {
17647
18101
  pagesToUpdate.forEach((angularPagePath) => {
17648
- const fileName = basename12(angularPagePath);
18102
+ const fileName = basename13(angularPagePath);
17649
18103
  const baseName = fileName.replace(/\.[tj]s$/, "");
17650
18104
  const pascalName = toPascal(baseName);
17651
18105
  const cssKey = `${pascalName}CSS`;
@@ -17656,10 +18110,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
17656
18110
  data: {
17657
18111
  cssBaseName: baseName,
17658
18112
  cssUrl,
18113
+ editSourceFile: classification.sourceFile,
17659
18114
  framework: "angular",
17660
18115
  manifest,
18116
+ reason: classification.reason,
17661
18117
  sourceFile: angularPagePath,
17662
- updateType: "logic"
18118
+ updateType: classification.type
17663
18119
  },
17664
18120
  type: "angular-update"
17665
18121
  });
@@ -17682,9 +18138,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
17682
18138
  await rewriteImports3(ssrPaths, angServerVendorPaths);
17683
18139
  }
17684
18140
  serverPaths.forEach((serverPath, idx) => {
17685
- const fileBase = basename12(serverPath, ".js");
18141
+ const fileBase = basename13(serverPath, ".js");
17686
18142
  const ssrPath = ssrPaths[idx] ?? serverPath;
17687
- state.manifest[toPascal(fileBase)] = resolve32(ssrPath);
18143
+ state.manifest[toPascal(fileBase)] = resolve33(ssrPath);
17688
18144
  });
17689
18145
  if (clientPaths.length > 0) {
17690
18146
  await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir);
@@ -17693,9 +18149,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
17693
18149
  const angularDir = config.angularDirectory ?? "";
17694
18150
  const angularFiles = filesToRebuild.filter((file5) => detectFramework(file5, state.resolvedPaths) === "angular");
17695
18151
  for (const file5 of angularFiles) {
17696
- state.fileHashes.set(resolve32(file5), computeFileHash(file5));
18152
+ state.fileHashes.set(resolve33(file5), computeFileHash(file5));
17697
18153
  }
17698
- const angularPagesPath = resolve32(angularDir, "pages");
18154
+ const angularPagesPath = resolve33(angularDir, "pages");
17699
18155
  const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
17700
18156
  if (pageEntries.length > 0) {
17701
18157
  await compileAndBundleAngular(state, pageEntries, angularDir);
@@ -17705,7 +18161,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
17705
18161
  const angularHmrFiles = angularFiles.filter((file5) => file5.endsWith(".ts") || file5.endsWith(".html"));
17706
18162
  const angularPageFiles = angularHmrFiles.filter((file5) => file5.replace(/\\/g, "/").includes("/pages/"));
17707
18163
  const pagesToUpdate = angularPageFiles.length > 0 ? angularPageFiles : pageEntries;
17708
- broadcastAngularPageUpdates(state, pagesToUpdate, manifest, startTime);
18164
+ const classification = collapseClassifications(angularFiles.map(classifyAngularEdit));
18165
+ broadcastAngularPageUpdates(state, pagesToUpdate, manifest, startTime, classification);
17709
18166
  onRebuildComplete({ hmrState: state, manifest });
17710
18167
  return manifest;
17711
18168
  }, getModuleUrl = async (pageFile) => {
@@ -17720,11 +18177,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
17720
18177
  if (isComponentFile2)
17721
18178
  return primaryFile;
17722
18179
  const { findNearestComponent: findNearestComponent2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
17723
- const nearest = findNearestComponent2(resolve32(primaryFile));
18180
+ const nearest = findNearestComponent2(resolve33(primaryFile));
17724
18181
  return nearest ?? primaryFile;
17725
18182
  }, handleReactModuleServerPath = async (state, reactFiles, startTime, onRebuildComplete) => {
17726
18183
  for (const file5 of reactFiles) {
17727
- state.fileHashes.set(resolve32(file5), computeFileHash(file5));
18184
+ state.fileHashes.set(resolve33(file5), computeFileHash(file5));
17728
18185
  }
17729
18186
  markSsrCacheDirty("react");
17730
18187
  const primaryFile = reactFiles.find((file5) => !file5.replace(/\\/g, "/").includes("/pages/")) ?? reactFiles[0];
@@ -17806,7 +18263,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
17806
18263
  });
17807
18264
  }, handleSvelteModuleServerPath = async (state, svelteFiles, startTime, onRebuildComplete) => {
17808
18265
  for (const file5 of svelteFiles) {
17809
- state.fileHashes.set(resolve32(file5), computeFileHash(file5));
18266
+ state.fileHashes.set(resolve33(file5), computeFileHash(file5));
17810
18267
  }
17811
18268
  markSsrCacheDirty("svelte");
17812
18269
  const serverDuration = Date.now() - startTime;
@@ -17830,8 +18287,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
17830
18287
  const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true, getStyleTransformConfig(state.config));
17831
18288
  const serverEntries = [...svelteServerPaths];
17832
18289
  const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
17833
- const serverRoot = resolve32(svelteDir, "generated", "server");
17834
- const serverOutDir = resolve32(buildDir, basename12(svelteDir));
18290
+ const serverRoot = resolve33(svelteDir, "generated", "server");
18291
+ const serverOutDir = resolve33(buildDir, basename13(svelteDir));
17835
18292
  const [serverResult, clientResult] = await Promise.all([
17836
18293
  serverEntries.length > 0 ? bunBuild9({
17837
18294
  entrypoints: serverEntries,
@@ -17873,7 +18330,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
17873
18330
  const duration = Date.now() - startTime;
17874
18331
  const broadcastFiles = svelteFiles.length > 0 ? svelteFiles : filesToRebuild;
17875
18332
  broadcastFiles.forEach((sveltePagePath) => {
17876
- const fileName = basename12(sveltePagePath);
18333
+ const fileName = basename13(sveltePagePath);
17877
18334
  const baseName = fileName.replace(/\.svelte$/, "");
17878
18335
  const pascalName = toPascal(baseName);
17879
18336
  const cssKey = `${pascalName}CSS`;
@@ -17928,7 +18385,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
17928
18385
  });
17929
18386
  }, handleVueModuleServerPath = async (state, vueFiles, nonVueFiles, startTime, onRebuildComplete) => {
17930
18387
  for (const file5 of [...vueFiles, ...nonVueFiles]) {
17931
- state.fileHashes.set(resolve32(file5), computeFileHash(file5));
18388
+ state.fileHashes.set(resolve33(file5), computeFileHash(file5));
17932
18389
  }
17933
18390
  markSsrCacheDirty("vue");
17934
18391
  await invalidateNonVueModules(nonVueFiles);
@@ -17950,13 +18407,13 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
17950
18407
  onRebuildComplete({ hmrState: state, manifest: state.manifest });
17951
18408
  return state.manifest;
17952
18409
  }, EMBER_PAGE_EXTENSIONS, collectAllEmberPages = async (emberPagesPath) => {
17953
- const { readdir: readdir4 } = await import("fs/promises");
18410
+ const { readdir: readdir5 } = await import("fs/promises");
17954
18411
  try {
17955
- const entries = await readdir4(emberPagesPath, {
18412
+ const entries = await readdir5(emberPagesPath, {
17956
18413
  recursive: true,
17957
18414
  withFileTypes: true
17958
18415
  });
17959
- return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) => resolve32(emberPagesPath, entry.name));
18416
+ return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) => resolve33(emberPagesPath, entry.name));
17960
18417
  } catch {
17961
18418
  return [];
17962
18419
  }
@@ -17968,10 +18425,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
17968
18425
  return state.manifest;
17969
18426
  }
17970
18427
  for (const file5 of emberFiles) {
17971
- state.fileHashes.set(resolve32(file5), computeFileHash(file5));
18428
+ state.fileHashes.set(resolve33(file5), computeFileHash(file5));
17972
18429
  }
17973
- const emberPagesPath = resolve32(emberDir, "pages");
17974
- const directPageEntries = emberFiles.filter((file5) => resolve32(file5).startsWith(emberPagesPath));
18430
+ const emberPagesPath = resolve33(emberDir, "pages");
18431
+ const directPageEntries = emberFiles.filter((file5) => resolve33(file5).startsWith(emberPagesPath));
17975
18432
  const allPageEntries = directPageEntries.length > 0 ? directPageEntries : await collectAllEmberPages(emberPagesPath);
17976
18433
  if (allPageEntries.length === 0) {
17977
18434
  onRebuildComplete({ hmrState: state, manifest: state.manifest });
@@ -17980,8 +18437,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
17980
18437
  const { compileEmber: compileEmber2 } = await Promise.resolve().then(() => (init_compileEmber(), exports_compileEmber));
17981
18438
  const { serverPaths } = await compileEmber2(allPageEntries, emberDir, process.cwd(), true);
17982
18439
  for (const serverPath of serverPaths) {
17983
- const fileBase = basename12(serverPath, ".js");
17984
- state.manifest[toPascal(fileBase)] = resolve32(serverPath);
18440
+ const fileBase = basename13(serverPath, ".js");
18441
+ state.manifest[toPascal(fileBase)] = resolve33(serverPath);
17985
18442
  }
17986
18443
  const { invalidateEmberSsrCache: invalidateEmberSsrCache2 } = await Promise.resolve().then(() => (init_ember(), exports_ember));
17987
18444
  invalidateEmberSsrCache2();
@@ -18051,7 +18508,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
18051
18508
  });
18052
18509
  }
18053
18510
  }, handleScriptUpdate = (state, scriptFile, manifest, framework, duration) => {
18054
- const scriptBaseName = basename12(scriptFile).replace(/\.(ts|js|tsx|jsx)$/, "");
18511
+ const scriptBaseName = basename13(scriptFile).replace(/\.(ts|js|tsx|jsx)$/, "");
18055
18512
  const pascalName = toPascal(scriptBaseName);
18056
18513
  const scriptPath = manifest[pascalName] || null;
18057
18514
  if (!scriptPath) {
@@ -18073,8 +18530,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
18073
18530
  if (!buildReference?.source) {
18074
18531
  return;
18075
18532
  }
18076
- const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve32(dirname17(buildInfo.resolvedRegistryPath), buildReference.source);
18077
- islandFiles.add(resolve32(sourcePath));
18533
+ const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve33(dirname17(buildInfo.resolvedRegistryPath), buildReference.source);
18534
+ islandFiles.add(resolve33(sourcePath));
18078
18535
  }, resolveIslandSourceFiles = async (config) => {
18079
18536
  const registryPath = config.islands?.registry;
18080
18537
  if (!registryPath) {
@@ -18082,7 +18539,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
18082
18539
  }
18083
18540
  const buildInfo = await loadIslandRegistryBuildInfo(registryPath);
18084
18541
  const islandFiles = new Set([
18085
- resolve32(buildInfo.resolvedRegistryPath)
18542
+ resolve33(buildInfo.resolvedRegistryPath)
18086
18543
  ]);
18087
18544
  for (const definition of buildInfo.definitions) {
18088
18545
  resolveIslandDefinitionSource(definition, buildInfo, islandFiles);
@@ -18093,7 +18550,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
18093
18550
  if (islandFiles.size === 0) {
18094
18551
  return false;
18095
18552
  }
18096
- return filesToRebuild.some((file5) => islandFiles.has(resolve32(file5)));
18553
+ return filesToRebuild.some((file5) => islandFiles.has(resolve33(file5)));
18097
18554
  }, handleIslandSourceReload = async (state, config, filesToRebuild, manifest) => {
18098
18555
  const shouldReload = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
18099
18556
  if (!shouldReload) {
@@ -18128,10 +18585,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
18128
18585
  }, computeOutputPagesDir = (state, config, framework) => {
18129
18586
  const isSingle = !config.reactDirectory && !config.svelteDirectory && !config.vueDirectory && (framework === "html" ? !config.htmxDirectory : !config.htmlDirectory);
18130
18587
  if (isSingle) {
18131
- return resolve32(state.resolvedPaths.buildDir, "pages");
18588
+ return resolve33(state.resolvedPaths.buildDir, "pages");
18132
18589
  }
18133
- const dirName = framework === "html" ? basename12(config.htmlDirectory ?? "html") : basename12(config.htmxDirectory ?? "htmx");
18134
- return resolve32(state.resolvedPaths.buildDir, dirName, "pages");
18590
+ const dirName = framework === "html" ? basename13(config.htmlDirectory ?? "html") : basename13(config.htmxDirectory ?? "htmx");
18591
+ return resolve33(state.resolvedPaths.buildDir, dirName, "pages");
18135
18592
  }, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
18136
18593
  try {
18137
18594
  const { handleHTMLUpdate: handleHTMLUpdate2 } = await Promise.resolve().then(() => (init_simpleHTMLHMR(), exports_simpleHTMLHMR));
@@ -18169,8 +18626,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
18169
18626
  const shouldRefreshAllPages = htmlPageFiles.length === 0 && shouldRefreshFromIslandChange;
18170
18627
  const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
18171
18628
  await runSequentially(pageFilesToUpdate, async (pageFile) => {
18172
- const htmlPageName = basename12(pageFile);
18173
- const builtHtmlPagePath = resolve32(outputHtmlPages, htmlPageName);
18629
+ const htmlPageName = basename13(pageFile);
18630
+ const builtHtmlPagePath = resolve33(outputHtmlPages, htmlPageName);
18174
18631
  await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
18175
18632
  });
18176
18633
  }, handleVueCssOnlyUpdate = (state, vueCssFiles, manifest, duration) => {
@@ -18178,7 +18635,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
18178
18635
  if (!cssFile) {
18179
18636
  return;
18180
18637
  }
18181
- const cssBaseName = basename12(getStyleBaseName(cssFile));
18638
+ const cssBaseName = basename13(getStyleBaseName(cssFile));
18182
18639
  const cssPascalName = toPascal(cssBaseName);
18183
18640
  const cssKey = `${cssPascalName}CSS`;
18184
18641
  const cssUrl = manifest[cssKey] || null;
@@ -18227,7 +18684,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
18227
18684
  type: "vue-update"
18228
18685
  });
18229
18686
  }, broadcastVuePageChange = async (state, config, vuePagePath, manifest, duration) => {
18230
- const fileName = basename12(vuePagePath);
18687
+ const fileName = basename13(vuePagePath);
18231
18688
  const baseName = fileName.replace(/\.vue$/, "");
18232
18689
  const pascalName = toPascal(baseName);
18233
18690
  const vueRoot = config.vueDirectory;
@@ -18235,7 +18692,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
18235
18692
  const cssKey = `${pascalName}CSS`;
18236
18693
  const cssUrl = manifest[cssKey] || null;
18237
18694
  const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
18238
- const hmrMeta = vueHmrMetadata2.get(resolve32(vuePagePath));
18695
+ const hmrMeta = vueHmrMetadata2.get(resolve33(vuePagePath));
18239
18696
  const changeType = hmrMeta?.changeType ?? "full";
18240
18697
  if (changeType === "style-only") {
18241
18698
  broadcastVueStyleOnly(state, vuePagePath, baseName, cssUrl, hmrId, manifest, duration);
@@ -18273,7 +18730,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
18273
18730
  if (!cssFile) {
18274
18731
  return;
18275
18732
  }
18276
- const cssBaseName = basename12(getStyleBaseName(cssFile));
18733
+ const cssBaseName = basename13(getStyleBaseName(cssFile));
18277
18734
  const cssPascalName = toPascal(cssBaseName);
18278
18735
  const cssKey = `${cssPascalName}CSS`;
18279
18736
  const cssUrl = manifest[cssKey] || null;
@@ -18291,7 +18748,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
18291
18748
  });
18292
18749
  }, broadcastSveltePageUpdate = (state, sveltePagePath, manifest, duration) => {
18293
18750
  try {
18294
- const fileName = basename12(sveltePagePath);
18751
+ const fileName = basename13(sveltePagePath);
18295
18752
  const baseName = fileName.replace(/\.svelte$/, "");
18296
18753
  const pascalName = toPascal(baseName);
18297
18754
  const cssKey = `${pascalName}CSS`;
@@ -18353,7 +18810,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
18353
18810
  if (!cssFile) {
18354
18811
  return;
18355
18812
  }
18356
- const cssBaseName = basename12(getStyleBaseName(cssFile));
18813
+ const cssBaseName = basename13(getStyleBaseName(cssFile));
18357
18814
  const cssPascalName = toPascal(cssBaseName);
18358
18815
  const cssKey = `${cssPascalName}CSS`;
18359
18816
  const cssUrl = manifest[cssKey] || null;
@@ -18369,9 +18826,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
18369
18826
  },
18370
18827
  type: "angular-update"
18371
18828
  });
18372
- }, broadcastAngularPageHmrUpdate = (state, angularPagePath, manifest, duration) => {
18829
+ }, broadcastAngularPageHmrUpdate = (state, angularPagePath, manifest, duration, classification) => {
18373
18830
  try {
18374
- const fileName = basename12(angularPagePath);
18831
+ const fileName = basename13(angularPagePath);
18375
18832
  const baseName = fileName.replace(/\.[tj]s$/, "");
18376
18833
  const pascalName = toPascal(baseName);
18377
18834
  const cssKey = `${pascalName}CSS`;
@@ -18381,10 +18838,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
18381
18838
  data: {
18382
18839
  cssBaseName: baseName,
18383
18840
  cssUrl,
18841
+ editSourceFile: classification.sourceFile,
18384
18842
  framework: "angular",
18385
18843
  manifest,
18844
+ reason: classification.reason,
18386
18845
  sourceFile: angularPagePath,
18387
- updateType: "logic"
18846
+ updateType: classification.type
18388
18847
  },
18389
18848
  type: "angular-update"
18390
18849
  });
@@ -18413,8 +18872,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
18413
18872
  handleAngularCssOnlyUpdate(state, angularCssFiles, manifest, duration);
18414
18873
  return;
18415
18874
  }
18875
+ const classification = collapseClassifications(angularFiles.map(classifyAngularEdit));
18416
18876
  pagesToUpdate.forEach((angularPagePath) => {
18417
- broadcastAngularPageHmrUpdate(state, angularPagePath, manifest, duration);
18877
+ broadcastAngularPageHmrUpdate(state, angularPagePath, manifest, duration, classification);
18418
18878
  });
18419
18879
  }, handleHTMXScriptHMR = (state, filesToRebuild, manifest, duration) => {
18420
18880
  if (!state.resolvedPaths.htmxDir) {
@@ -18469,8 +18929,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
18469
18929
  const shouldRefreshAllPages = htmxPageFiles.length === 0 && shouldRefreshFromIslandChange;
18470
18930
  const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
18471
18931
  await runSequentially(pageFilesToUpdate, async (htmxPageFile) => {
18472
- const htmxPageName = basename12(htmxPageFile);
18473
- const builtHtmxPagePath = resolve32(outputHtmxPages, htmxPageName);
18932
+ const htmxPageName = basename13(htmxPageFile);
18933
+ const builtHtmxPagePath = resolve33(outputHtmxPages, htmxPageName);
18474
18934
  await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
18475
18935
  });
18476
18936
  }, collectUpdatedModulePaths = (allModuleUpdates) => {
@@ -18579,7 +19039,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
18579
19039
  html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
18580
19040
  writeFs(destPath, html);
18581
19041
  }, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
18582
- const destPath = resolve32(outputDir, basename12(sourceFile));
19042
+ const destPath = resolve33(outputDir, basename13(sourceFile));
18583
19043
  const hmrScript = extractHmrScript(destPath, readFs);
18584
19044
  const source = await Bun.file(sourceFile).text();
18585
19045
  await Bun.write(destPath, source);
@@ -18825,6 +19285,7 @@ var init_rebuildTrigger = __esm(() => {
18825
19285
  init_compileTailwind();
18826
19286
  init_tailwindCompiler();
18827
19287
  init_ssrCache();
19288
+ init_editTypeDetection();
18828
19289
  moduleServerPromise = Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
18829
19290
  getReactModuleUrl = getModuleUrl;
18830
19291
  EMBER_PAGE_EXTENSIONS = [".gts", ".gjs", ".ts", ".js"];
@@ -18837,9 +19298,9 @@ __export(exports_buildDepVendor, {
18837
19298
  computeDepVendorPaths: () => computeDepVendorPaths,
18838
19299
  buildDepVendor: () => buildDepVendor
18839
19300
  });
18840
- import { mkdirSync as mkdirSync12 } from "fs";
18841
- import { join as join27 } from "path";
18842
- import { rm as rm11 } from "fs/promises";
19301
+ import { mkdirSync as mkdirSync13 } from "fs";
19302
+ import { join as join28 } from "path";
19303
+ import { rm as rm10 } from "fs/promises";
18843
19304
  var {build: bunBuild9, Glob: Glob9 } = globalThis.Bun;
18844
19305
  var toSafeFileName6 = (specifier) => {
18845
19306
  const prefix = specifier.startsWith("@") ? "_" : "";
@@ -18892,7 +19353,7 @@ var toSafeFileName6 = (specifier) => {
18892
19353
  framework: Array.from(framework).filter(isResolvable4)
18893
19354
  };
18894
19355
  }, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
18895
- const { readFileSync: readFileSync17 } = await import("fs");
19356
+ const { readFileSync: readFileSync19 } = await import("fs");
18896
19357
  const transpiler5 = new Bun.Transpiler({ loader: "js" });
18897
19358
  const newSpecs = new Set;
18898
19359
  for (const spec of specs) {
@@ -18907,7 +19368,7 @@ var toSafeFileName6 = (specifier) => {
18907
19368
  }
18908
19369
  let content;
18909
19370
  try {
18910
- content = readFileSync17(resolved, "utf-8");
19371
+ content = readFileSync19(resolved, "utf-8");
18911
19372
  } catch {
18912
19373
  continue;
18913
19374
  }
@@ -18949,7 +19410,7 @@ var toSafeFileName6 = (specifier) => {
18949
19410
  }), buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
18950
19411
  const entries = await Promise.all(specifiers.map(async (specifier) => {
18951
19412
  const safeName = toSafeFileName6(specifier);
18952
- const entryPath = join27(tmpDir, `${safeName}.ts`);
19413
+ const entryPath = join28(tmpDir, `${safeName}.ts`);
18953
19414
  await Bun.write(entryPath, await generateVendorEntrySource(specifier));
18954
19415
  return { entryPath, specifier };
18955
19416
  }));
@@ -19010,10 +19471,10 @@ var toSafeFileName6 = (specifier) => {
19010
19471
  const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
19011
19472
  if (initialSpecs.length === 0 && frameworkRoots.length === 0)
19012
19473
  return {};
19013
- const vendorDir = join27(buildDir, "vendor");
19014
- mkdirSync12(vendorDir, { recursive: true });
19015
- const tmpDir = join27(buildDir, "_dep_vendor_tmp");
19016
- mkdirSync12(tmpDir, { recursive: true });
19474
+ const vendorDir = join28(buildDir, "vendor");
19475
+ mkdirSync13(vendorDir, { recursive: true });
19476
+ const tmpDir = join28(buildDir, "_dep_vendor_tmp");
19477
+ mkdirSync13(tmpDir, { recursive: true });
19017
19478
  const allSpecs = new Set(initialSpecs);
19018
19479
  const alreadyScanned = new Set;
19019
19480
  let frontier = [...allSpecs, ...frameworkRoots];
@@ -19032,7 +19493,7 @@ var toSafeFileName6 = (specifier) => {
19032
19493
  if (!success) {
19033
19494
  console.warn("\u26A0\uFE0F Dependency vendor build had errors:", result.logs);
19034
19495
  }
19035
- await rm11(tmpDir, { force: true, recursive: true });
19496
+ await rm10(tmpDir, { force: true, recursive: true });
19036
19497
  const paths = {};
19037
19498
  for (const specifier of allSpecs) {
19038
19499
  paths[specifier] = `/vendor/${toSafeFileName6(specifier)}.js`;
@@ -19093,9 +19554,9 @@ var exports_devBuild = {};
19093
19554
  __export(exports_devBuild, {
19094
19555
  devBuild: () => devBuild
19095
19556
  });
19096
- import { readdir as readdir4 } from "fs/promises";
19557
+ import { readdir as readdir5 } from "fs/promises";
19097
19558
  import { statSync as statSync3 } from "fs";
19098
- import { resolve as resolve33 } from "path";
19559
+ import { resolve as resolve34 } from "path";
19099
19560
  var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
19100
19561
  const configuredDirs = [
19101
19562
  config.reactDirectory,
@@ -19118,7 +19579,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
19118
19579
  return Object.keys(config).length > 0 ? config : null;
19119
19580
  }, reloadConfig = async () => {
19120
19581
  try {
19121
- const configPath2 = resolve33(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
19582
+ const configPath2 = resolve34(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
19122
19583
  const source = await Bun.file(configPath2).text();
19123
19584
  return parseDirectoryConfig(source);
19124
19585
  } catch {
@@ -19203,7 +19664,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
19203
19664
  state.fileChangeQueue.clear();
19204
19665
  }
19205
19666
  }, handleCachedReload = async () => {
19206
- const serverMtime = statSync3(resolve33(Bun.main)).mtimeMs;
19667
+ const serverMtime = statSync3(resolve34(Bun.main)).mtimeMs;
19207
19668
  const lastMtime = globalThis.__hmrServerMtime;
19208
19669
  globalThis.__hmrServerMtime = serverMtime;
19209
19670
  const cached = globalThis.__hmrDevResult;
@@ -19240,8 +19701,8 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
19240
19701
  return true;
19241
19702
  }, resolveAbsoluteVersion2 = async () => {
19242
19703
  const candidates = [
19243
- resolve33(import.meta.dir, "..", "..", "package.json"),
19244
- resolve33(import.meta.dir, "..", "package.json")
19704
+ resolve34(import.meta.dir, "..", "..", "package.json"),
19705
+ resolve34(import.meta.dir, "..", "package.json")
19245
19706
  ];
19246
19707
  const [candidate, ...remaining] = candidates;
19247
19708
  if (!candidate) {
@@ -19264,10 +19725,10 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
19264
19725
  await resolveAbsoluteVersionFromCandidates(remaining);
19265
19726
  }, loadVendorFiles = async (assetStore, vendorDir, framework) => {
19266
19727
  const emptyStringArray = [];
19267
- const entries = await readdir4(vendorDir).catch(() => emptyStringArray);
19728
+ const entries = await readdir5(vendorDir).catch(() => emptyStringArray);
19268
19729
  await Promise.all(entries.filter((entry) => entry.endsWith(".js")).map(async (entry) => {
19269
19730
  const webPath = `/${framework}/vendor/${entry}`;
19270
- const bytes = await Bun.file(resolve33(vendorDir, entry)).bytes();
19731
+ const bytes = await Bun.file(resolve34(vendorDir, entry)).bytes();
19271
19732
  assetStore.set(webPath, bytes);
19272
19733
  }));
19273
19734
  }, devBuild = async (config) => {
@@ -19308,7 +19769,6 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
19308
19769
  const sourceDirs = collectDepVendorSourceDirs(config);
19309
19770
  if (config.angularDirectory) {
19310
19771
  setAngularVendorPaths(await computeAngularVendorPathsAsync(sourceDirs));
19311
- setAngularServerVendorPaths(await computeAngularServerVendorPathsAsync(state.resolvedPaths.buildDir, sourceDirs));
19312
19772
  }
19313
19773
  const { computeDepVendorPaths: computeDepVendorPaths2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
19314
19774
  globalThis.__depVendorPaths = await computeDepVendorPaths2(sourceDirs);
@@ -19336,16 +19796,16 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
19336
19796
  cleanStaleAssets(state.assetStore, manifest, state.resolvedPaths.buildDir);
19337
19797
  recordStep("populate asset store", stepStartedAt);
19338
19798
  stepStartedAt = performance.now();
19339
- const reactVendorDir = resolve33(state.resolvedPaths.buildDir, "react", "vendor");
19340
- const angularVendorDir = resolve33(state.resolvedPaths.buildDir, "angular", "vendor");
19341
- const svelteVendorDir = resolve33(state.resolvedPaths.buildDir, "svelte", "vendor");
19342
- const vueVendorDir = resolve33(state.resolvedPaths.buildDir, "vue", "vendor");
19343
- const depVendorDir = resolve33(state.resolvedPaths.buildDir, "vendor");
19799
+ const reactVendorDir = resolve34(state.resolvedPaths.buildDir, "react", "vendor");
19800
+ const angularVendorDir = resolve34(state.resolvedPaths.buildDir, "angular", "vendor");
19801
+ const svelteVendorDir = resolve34(state.resolvedPaths.buildDir, "svelte", "vendor");
19802
+ const vueVendorDir = resolve34(state.resolvedPaths.buildDir, "vue", "vendor");
19803
+ const depVendorDir = resolve34(state.resolvedPaths.buildDir, "vendor");
19344
19804
  const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
19345
- const [, angularSpecs, angularServerSpecs, , , , depPaths] = await Promise.all([
19805
+ const [, angularSpecs, , , , , depPaths] = await Promise.all([
19346
19806
  config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
19347
19807
  config.angularDirectory ? buildAngularVendor(state.resolvedPaths.buildDir, sourceDirs, true, Object.keys(globalThis.__depVendorPaths ?? {})) : Promise.resolve(undefined),
19348
- config.angularDirectory ? buildAngularServerVendor(state.resolvedPaths.buildDir, sourceDirs, true) : Promise.resolve(undefined),
19808
+ Promise.resolve(undefined),
19349
19809
  config.svelteDirectory ? buildSvelteVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
19350
19810
  config.vueDirectory ? buildVueVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
19351
19811
  config.emberDirectory ? buildEmberVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
@@ -19353,9 +19813,6 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
19353
19813
  ]);
19354
19814
  if (angularSpecs)
19355
19815
  globalThis.__angularVendorSpecifiers = angularSpecs;
19356
- if (angularServerSpecs) {
19357
- setAngularServerVendorPaths(computeAngularServerVendorPaths(state.resolvedPaths.buildDir, angularServerSpecs));
19358
- }
19359
19816
  if (config.emberDirectory) {
19360
19817
  setEmberVendorPaths(computeEmberVendorPaths());
19361
19818
  }
@@ -19376,8 +19833,8 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
19376
19833
  config.vueDirectory ? vueVendorDir : null,
19377
19834
  depVendorDir
19378
19835
  ].filter((d2) => d2 !== null);
19379
- const { rewriteVendorDirectories: rewriteVendorDirectories2 } = await Promise.resolve().then(() => (init_rewriteImports(), exports_rewriteImports));
19380
- await rewriteVendorDirectories2(activeVendorDirs, combinedVendorPaths);
19836
+ const { rewriteVendorDirectories: rewriteVendorDirectories3 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
19837
+ await rewriteVendorDirectories3(activeVendorDirs, combinedVendorPaths);
19381
19838
  recordStep("rewrite vendor cross-references", stepStartedAt);
19382
19839
  stepStartedAt = performance.now();
19383
19840
  await Promise.all([
@@ -19421,7 +19878,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
19421
19878
  manifest
19422
19879
  };
19423
19880
  globalThis.__hmrDevResult = result;
19424
- globalThis.__hmrServerMtime = statSync3(resolve33(Bun.main)).mtimeMs;
19881
+ globalThis.__hmrServerMtime = statSync3(resolve34(Bun.main)).mtimeMs;
19425
19882
  return result;
19426
19883
  };
19427
19884
  var init_devBuild = __esm(() => {
@@ -19594,17 +20051,17 @@ __export(exports_devtoolsJson, {
19594
20051
  normalizeDevtoolsWorkspaceRoot: () => normalizeDevtoolsWorkspaceRoot,
19595
20052
  devtoolsJson: () => devtoolsJson
19596
20053
  });
19597
- import { existsSync as existsSync26, mkdirSync as mkdirSync13, readFileSync as readFileSync17, writeFileSync as writeFileSync8 } from "fs";
19598
- import { dirname as dirname18, join as join28, resolve as resolve34 } from "path";
20054
+ import { existsSync as existsSync27, mkdirSync as mkdirSync14, readFileSync as readFileSync19, writeFileSync as writeFileSync9 } from "fs";
20055
+ import { dirname as dirname18, join as join29, resolve as resolve35 } from "path";
19599
20056
  import { Elysia as Elysia3 } from "elysia";
19600
20057
  var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_KEY = "__absoluteDevtoolsWorkspaceUuid", getGlobalUuid = () => Reflect.get(globalThis, UUID_CACHE_KEY), setGlobalUuid = (uuid) => {
19601
20058
  Reflect.set(globalThis, UUID_CACHE_KEY, uuid);
19602
20059
  return uuid;
19603
- }, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) => resolve34(uuidCachePath ?? join28(buildDir, ".absolute", "chrome-devtools-workspace-uuid")), readCachedUuid = (cachePath) => {
19604
- if (!existsSync26(cachePath))
20060
+ }, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) => resolve35(uuidCachePath ?? join29(buildDir, ".absolute", "chrome-devtools-workspace-uuid")), readCachedUuid = (cachePath) => {
20061
+ if (!existsSync27(cachePath))
19605
20062
  return null;
19606
20063
  try {
19607
- const value = readFileSync17(cachePath, "utf-8").trim();
20064
+ const value = readFileSync19(cachePath, "utf-8").trim();
19608
20065
  return isUuidV4(value) ? value : null;
19609
20066
  } catch {
19610
20067
  return null;
@@ -19622,11 +20079,11 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
19622
20079
  if (cachedUuid)
19623
20080
  return setGlobalUuid(cachedUuid);
19624
20081
  const uuid = crypto.randomUUID();
19625
- mkdirSync13(dirname18(cachePath), { recursive: true });
19626
- writeFileSync8(cachePath, uuid, "utf-8");
20082
+ mkdirSync14(dirname18(cachePath), { recursive: true });
20083
+ writeFileSync9(cachePath, uuid, "utf-8");
19627
20084
  return setGlobalUuid(uuid);
19628
20085
  }, devtoolsJson = (buildDir, options = {}) => {
19629
- const rootPath = resolve34(options.projectRoot ?? process.cwd());
20086
+ const rootPath = resolve35(options.projectRoot ?? process.cwd());
19630
20087
  const root = options.normalizeForWindowsContainer === false ? rootPath : normalizeDevtoolsWorkspaceRoot(rootPath);
19631
20088
  const uuid = getOrCreateUuid(buildDir, options);
19632
20089
  return new Elysia3({ name: "absolute-devtools-json" }).get(ENDPOINT, () => ({
@@ -19639,11 +20096,11 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
19639
20096
  if (process.env.WSL_DISTRO_NAME) {
19640
20097
  const distro = process.env.WSL_DISTRO_NAME;
19641
20098
  const withoutLeadingSlash = root.replace(/^\//, "");
19642
- return join28("\\\\wsl.localhost", distro, withoutLeadingSlash).replace(/\//g, "\\");
20099
+ return join29("\\\\wsl.localhost", distro, withoutLeadingSlash).replace(/\//g, "\\");
19643
20100
  }
19644
20101
  if (process.env.DOCKER_DESKTOP && !root.startsWith("\\\\")) {
19645
20102
  const withoutLeadingSlash = root.replace(/^\//, "");
19646
- return join28("\\\\wsl.localhost", "docker-desktop-data", withoutLeadingSlash).replace(/\//g, "\\");
20103
+ return join29("\\\\wsl.localhost", "docker-desktop-data", withoutLeadingSlash).replace(/\//g, "\\");
19647
20104
  }
19648
20105
  return root;
19649
20106
  };
@@ -19654,13 +20111,13 @@ var exports_imageOptimizer = {};
19654
20111
  __export(exports_imageOptimizer, {
19655
20112
  imageOptimizer: () => imageOptimizer
19656
20113
  });
19657
- import { existsSync as existsSync27 } from "fs";
19658
- import { resolve as resolve35 } from "path";
20114
+ import { existsSync as existsSync28 } from "fs";
20115
+ import { resolve as resolve36 } from "path";
19659
20116
  import { Elysia as Elysia4 } from "elysia";
19660
20117
  var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avifInProgress, safeResolve = (path, baseDir) => {
19661
20118
  try {
19662
20119
  const resolved = validateSafePath(path, baseDir);
19663
- if (existsSync27(resolved))
20120
+ if (existsSync28(resolved))
19664
20121
  return resolved;
19665
20122
  return null;
19666
20123
  } catch {
@@ -19668,7 +20125,7 @@ var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avi
19668
20125
  }
19669
20126
  }, resolveLocalImage = (url, buildDir) => {
19670
20127
  const cleanPath = url.startsWith("/") ? url.slice(1) : url;
19671
- return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath, resolve35(process.cwd()));
20128
+ return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath, resolve36(process.cwd()));
19672
20129
  }, parseQueryParams = (query, allowedSizes, defaultQuality) => {
19673
20130
  const url = typeof query["url"] === "string" ? query["url"] : undefined;
19674
20131
  const wParam = typeof query["w"] === "string" ? query["w"] : undefined;
@@ -19959,15 +20416,15 @@ __export(exports_prerender, {
19959
20416
  prerender: () => prerender,
19960
20417
  PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
19961
20418
  });
19962
- import { mkdirSync as mkdirSync14, readFileSync as readFileSync18 } from "fs";
19963
- import { join as join29 } from "path";
20419
+ import { mkdirSync as mkdirSync15, readFileSync as readFileSync20 } from "fs";
20420
+ import { join as join30 } from "path";
19964
20421
  var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_TIMEOUT_MS = 30000, PRERENDER_BYPASS_HEADER = "X-Absolute-Prerender-Bypass", routeToFilename = (route) => route === "/" ? "index.html" : `${route.slice(1).replace(/\//g, "-")}.html`, writeTimestamp = async (htmlPath) => {
19965
20422
  const metaPath = htmlPath.replace(/\.html$/, ".meta");
19966
20423
  await Bun.write(metaPath, String(Date.now()));
19967
20424
  }, readTimestamp = (htmlPath) => {
19968
20425
  const metaPath = htmlPath.replace(/\.html$/, ".meta");
19969
20426
  try {
19970
- const content = readFileSync18(metaPath, "utf-8");
20427
+ const content = readFileSync20(metaPath, "utf-8");
19971
20428
  return Number(content) || 0;
19972
20429
  } catch {
19973
20430
  return 0;
@@ -20026,7 +20483,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
20026
20483
  return false;
20027
20484
  const html = await res.text();
20028
20485
  const fileName = routeToFilename(route);
20029
- const filePath = join29(prerenderDir, fileName);
20486
+ const filePath = join30(prerenderDir, fileName);
20030
20487
  await Bun.write(filePath, html);
20031
20488
  await writeTimestamp(filePath);
20032
20489
  return true;
@@ -20052,14 +20509,14 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
20052
20509
  }
20053
20510
  const html = await res.text();
20054
20511
  const fileName = routeToFilename(route);
20055
- const filePath = join29(prerenderDir, fileName);
20512
+ const filePath = join30(prerenderDir, fileName);
20056
20513
  await Bun.write(filePath, html);
20057
20514
  await writeTimestamp(filePath);
20058
20515
  result.routes.set(route, filePath);
20059
20516
  log2?.(` Pre-rendered ${route} \u2192 ${fileName} (${html.length} bytes)`);
20060
20517
  }, prerender = async (port, outDir, staticConfig, log2) => {
20061
- const prerenderDir = join29(outDir, "_prerendered");
20062
- mkdirSync14(prerenderDir, { recursive: true });
20518
+ const prerenderDir = join30(outDir, "_prerendered");
20519
+ mkdirSync15(prerenderDir, { recursive: true });
20063
20520
  const baseUrl = `http://localhost:${port}`;
20064
20521
  let routes;
20065
20522
  if (staticConfig.routes === "all") {
@@ -20654,8 +21111,8 @@ var handleHTMXPageRequest = async (pagePath) => {
20654
21111
  });
20655
21112
  };
20656
21113
  // src/core/prepare.ts
20657
- import { existsSync as existsSync28, readdirSync as readdirSync2, readFileSync as readFileSync19 } from "fs";
20658
- import { basename as basename13, join as join30, relative as relative13, resolve as resolve36 } from "path";
21114
+ import { existsSync as existsSync29, readdirSync, readFileSync as readFileSync21 } from "fs";
21115
+ import { basename as basename14, join as join31, relative as relative13, resolve as resolve37 } from "path";
20659
21116
  import { Elysia as Elysia5 } from "elysia";
20660
21117
 
20661
21118
  // src/utils/loadConfig.ts
@@ -21078,7 +21535,7 @@ var collectPrewarmFiles = async (prewarmDirs) => {
21078
21535
  for (const { dir, pattern } of prewarmDirs) {
21079
21536
  const glob = new Glob10(pattern);
21080
21537
  const matches = [
21081
- ...glob.scanSync({ absolute: true, cwd: resolve36(dir) })
21538
+ ...glob.scanSync({ absolute: true, cwd: resolve37(dir) })
21082
21539
  ];
21083
21540
  files.push(...matches);
21084
21541
  }
@@ -21114,8 +21571,8 @@ var patchManifestIndexes = (manifest, devIndexDir, SRC_URL_PREFIX2) => {
21114
21571
  const fileName = resolveDevIndexFileName(manifest[key], baseName);
21115
21572
  if (!fileName)
21116
21573
  continue;
21117
- const srcPath = resolve36(devIndexDir, fileName);
21118
- if (!existsSync28(srcPath))
21574
+ const srcPath = resolve37(devIndexDir, fileName);
21575
+ if (!existsSync29(srcPath))
21119
21576
  continue;
21120
21577
  const rel = relative13(process.cwd(), srcPath).replace(/\\/g, "/");
21121
21578
  manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
@@ -21187,7 +21644,7 @@ var prepareDev = async (config, buildDir) => {
21187
21644
  stepStartedAt = performance.now();
21188
21645
  const hmrPlugin = hmr2(result.hmrState, result.manifest, moduleHandler);
21189
21646
  const { devtoolsJson: devtoolsJson2 } = await Promise.resolve().then(() => (init_devtoolsJson(), exports_devtoolsJson));
21190
- const devIndexDir = resolve36(buildDir, "_src_indexes");
21647
+ const devIndexDir = resolve37(buildDir, "_src_indexes");
21191
21648
  patchManifestIndexes(result.manifest, devIndexDir, SRC_URL_PREFIX2);
21192
21649
  recordStep("configure dev plugins", stepStartedAt);
21193
21650
  stepStartedAt = performance.now();
@@ -21223,20 +21680,20 @@ var prepareDev = async (config, buildDir) => {
21223
21680
  };
21224
21681
  var loadPrerenderMap = (prerenderDir) => {
21225
21682
  const map = new Map;
21226
- if (!existsSync28(prerenderDir))
21683
+ if (!existsSync29(prerenderDir))
21227
21684
  return map;
21228
21685
  let entries;
21229
21686
  try {
21230
- entries = readdirSync2(prerenderDir);
21687
+ entries = readdirSync(prerenderDir);
21231
21688
  } catch {
21232
21689
  return map;
21233
21690
  }
21234
21691
  for (const entry of entries) {
21235
21692
  if (!entry.endsWith(".html"))
21236
21693
  continue;
21237
- const name = basename13(entry, ".html");
21694
+ const name = basename14(entry, ".html");
21238
21695
  const route = name === "index" ? "/" : `/${name}`;
21239
- map.set(route, join30(prerenderDir, entry));
21696
+ map.set(route, join31(prerenderDir, entry));
21240
21697
  }
21241
21698
  return map;
21242
21699
  };
@@ -21268,7 +21725,7 @@ var prepare = async (configOrPath) => {
21268
21725
  recordStep("load config", stepStartedAt);
21269
21726
  const nodeEnv = process.env["NODE_ENV"];
21270
21727
  const isDev3 = nodeEnv === "development";
21271
- const buildDir = resolve36(process.env.ABSOLUTE_BUILD_DIR ?? config.buildDirectory ?? "build");
21728
+ const buildDir = resolve37(process.env.ABSOLUTE_BUILD_DIR ?? config.buildDirectory ?? "build");
21272
21729
  if (isDev3) {
21273
21730
  stepStartedAt = performance.now();
21274
21731
  const result = await prepareDev(config, buildDir);
@@ -21277,7 +21734,7 @@ var prepare = async (configOrPath) => {
21277
21734
  return result;
21278
21735
  }
21279
21736
  stepStartedAt = performance.now();
21280
- const manifest = JSON.parse(readFileSync19(`${buildDir}/manifest.json`, "utf-8"));
21737
+ const manifest = JSON.parse(readFileSync21(`${buildDir}/manifest.json`, "utf-8"));
21281
21738
  setCurrentIslandManifest(manifest);
21282
21739
  if (config.islands?.registry) {
21283
21740
  setCurrentIslandRegistry(await loadIslandRegistry(config.islands.registry));
@@ -21285,9 +21742,9 @@ var prepare = async (configOrPath) => {
21285
21742
  setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
21286
21743
  recordStep("load production manifest and island metadata", stepStartedAt);
21287
21744
  stepStartedAt = performance.now();
21288
- const conventionsPath = join30(buildDir, "conventions.json");
21289
- if (existsSync28(conventionsPath)) {
21290
- const conventions2 = JSON.parse(readFileSync19(conventionsPath, "utf-8"));
21745
+ const conventionsPath = join31(buildDir, "conventions.json");
21746
+ if (existsSync29(conventionsPath)) {
21747
+ const conventions2 = JSON.parse(readFileSync21(conventionsPath, "utf-8"));
21291
21748
  setConventions(conventions2);
21292
21749
  }
21293
21750
  recordStep("load production conventions", stepStartedAt);
@@ -21301,7 +21758,7 @@ var prepare = async (configOrPath) => {
21301
21758
  });
21302
21759
  recordStep("create static plugin", stepStartedAt);
21303
21760
  stepStartedAt = performance.now();
21304
- const prerenderDir = join30(buildDir, "_prerendered");
21761
+ const prerenderDir = join31(buildDir, "_prerendered");
21305
21762
  const prerenderMap = loadPrerenderMap(prerenderDir);
21306
21763
  recordStep("load prerender map", stepStartedAt);
21307
21764
  if (prerenderMap.size > 0) {
@@ -21359,18 +21816,18 @@ import { argv } from "process";
21359
21816
  var {env: env4 } = globalThis.Bun;
21360
21817
 
21361
21818
  // src/dev/devCert.ts
21362
- import { existsSync as existsSync29, mkdirSync as mkdirSync15, readFileSync as readFileSync20, rmSync as rmSync3 } from "fs";
21363
- import { join as join31 } from "path";
21364
- var CERT_DIR = join31(process.cwd(), ".absolutejs");
21365
- var CERT_PATH = join31(CERT_DIR, "cert.pem");
21366
- var KEY_PATH = join31(CERT_DIR, "key.pem");
21819
+ import { existsSync as existsSync30, mkdirSync as mkdirSync16, readFileSync as readFileSync22, rmSync as rmSync3 } from "fs";
21820
+ import { join as join32 } from "path";
21821
+ var CERT_DIR = join32(process.cwd(), ".absolutejs");
21822
+ var CERT_PATH = join32(CERT_DIR, "cert.pem");
21823
+ var KEY_PATH = join32(CERT_DIR, "key.pem");
21367
21824
  var CERT_VALIDITY_DAYS = 365;
21368
21825
  var devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`);
21369
21826
  var devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`);
21370
- var certFilesExist = () => existsSync29(CERT_PATH) && existsSync29(KEY_PATH);
21827
+ var certFilesExist = () => existsSync30(CERT_PATH) && existsSync30(KEY_PATH);
21371
21828
  var isCertExpired = () => {
21372
21829
  try {
21373
- const certPem = readFileSync20(CERT_PATH, "utf-8");
21830
+ const certPem = readFileSync22(CERT_PATH, "utf-8");
21374
21831
  const proc = Bun.spawnSync(["openssl", "x509", "-enddate", "-noout"], {
21375
21832
  stdin: new TextEncoder().encode(certPem)
21376
21833
  });
@@ -21444,7 +21901,7 @@ var generateCert = () => {
21444
21901
  }
21445
21902
  };
21446
21903
  var ensureDevCert = () => {
21447
- mkdirSync15(CERT_DIR, { recursive: true });
21904
+ mkdirSync16(CERT_DIR, { recursive: true });
21448
21905
  if (hasCert()) {
21449
21906
  return { cert: CERT_PATH, key: KEY_PATH };
21450
21907
  }
@@ -21466,8 +21923,8 @@ var loadDevCert = () => {
21466
21923
  return null;
21467
21924
  try {
21468
21925
  return {
21469
- cert: readFileSync20(paths.cert, "utf-8"),
21470
- key: readFileSync20(paths.key, "utf-8")
21926
+ cert: readFileSync22(paths.cert, "utf-8"),
21927
+ key: readFileSync22(paths.key, "utf-8")
21471
21928
  };
21472
21929
  } catch {
21473
21930
  return null;
@@ -21494,8 +21951,8 @@ var getLocalIPAddress = () => {
21494
21951
 
21495
21952
  // src/plugins/networking.ts
21496
21953
  init_startupBanner();
21497
- var host = env4.HOST ?? "localhost";
21498
- var port = env4.PORT ?? DEFAULT_PORT;
21954
+ var host = env4.ABSOLUTE_HOST ?? env4.HOST ?? "localhost";
21955
+ var port = env4.ABSOLUTE_PORT ?? env4.PORT ?? DEFAULT_PORT;
21499
21956
  var visibility = env4.ABSOLUTE_WORKSPACE_SERVICE_VISIBILITY ?? "public";
21500
21957
  var managedByWorkspace = env4.ABSOLUTE_WORKSPACE_MANAGED === "1";
21501
21958
  var localIP;
@@ -21695,8 +22152,8 @@ var jsonLd2 = (schema) => {
21695
22152
  };
21696
22153
  // src/utils/defineEnv.ts
21697
22154
  var {env: bunEnv } = globalThis.Bun;
21698
- import { existsSync as existsSync30, readFileSync as readFileSync21 } from "fs";
21699
- import { resolve as resolve37 } from "path";
22155
+ import { existsSync as existsSync31, readFileSync as readFileSync23 } from "fs";
22156
+ import { resolve as resolve38 } from "path";
21700
22157
 
21701
22158
  // node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
21702
22159
  var exports_value = {};
@@ -27731,19 +28188,19 @@ ${lines.join(`
27731
28188
  };
27732
28189
  var checkEnvFileSecurity = (properties) => {
27733
28190
  const cwd2 = process.cwd();
27734
- const envPath = resolve37(cwd2, ".env");
27735
- if (!existsSync30(envPath))
28191
+ const envPath = resolve38(cwd2, ".env");
28192
+ if (!existsSync31(envPath))
27736
28193
  return;
27737
28194
  const sensitiveKeys = Object.keys(properties).filter(isSensitive);
27738
28195
  if (sensitiveKeys.length === 0)
27739
28196
  return;
27740
- const envContent = readFileSync21(envPath, "utf-8");
28197
+ const envContent = readFileSync23(envPath, "utf-8");
27741
28198
  const presentKeys = sensitiveKeys.filter((key) => envContent.includes(`${key}=`));
27742
28199
  if (presentKeys.length === 0)
27743
28200
  return;
27744
- const gitignorePath = resolve37(cwd2, ".gitignore");
27745
- if (existsSync30(gitignorePath)) {
27746
- const gitignore = readFileSync21(gitignorePath, "utf-8");
28201
+ const gitignorePath = resolve38(cwd2, ".gitignore");
28202
+ if (existsSync31(gitignorePath)) {
28203
+ const gitignore = readFileSync23(gitignorePath, "utf-8");
27747
28204
  if (gitignore.split(`
27748
28205
  `).some((line) => line.trim() === ".env"))
27749
28206
  return;
@@ -27981,5 +28438,5 @@ export {
27981
28438
  ANGULAR_INIT_TIMEOUT_MS
27982
28439
  };
27983
28440
 
27984
- //# debugId=04E6614BD238791664756E2164756E21
28441
+ //# debugId=570E7C55E9A2645364756E2164756E21
27985
28442
  //# sourceMappingURL=index.js.map