@absolutejs/absolute 0.19.0-beta.947 → 0.19.0-beta.949

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 (39) 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 +38 -21
  4. package/dist/angular/index.js.map +5 -6
  5. package/dist/angular/server.js +38 -21
  6. package/dist/angular/server.js.map +5 -6
  7. package/dist/build.js +843 -369
  8. package/dist/build.js.map +17 -17
  9. package/dist/cli/index.js +206 -50
  10. package/dist/client/index.js +2 -2
  11. package/dist/client/index.js.map +2 -2
  12. package/dist/index.js +1139 -460
  13. package/dist/index.js.map +19 -19
  14. package/dist/islands/index.js +2 -2
  15. package/dist/islands/index.js.map +2 -2
  16. package/dist/react/index.js +2 -27
  17. package/dist/react/index.js.map +4 -5
  18. package/dist/react/server.js +1 -26
  19. package/dist/react/server.js.map +4 -5
  20. package/dist/src/angular/pageHandler.d.ts +0 -1
  21. package/dist/src/build/compileAngular.d.ts +1 -0
  22. package/dist/src/build/compileTailwind.d.ts +4 -3
  23. package/dist/src/build/tailwindCompiler.d.ts +2 -2
  24. package/dist/src/core/devBuild.d.ts +17 -0
  25. package/dist/src/dev/serverEntryWatcher.d.ts +4 -0
  26. package/dist/src/react/pageHandler.d.ts +0 -1
  27. package/dist/src/svelte/pageHandler.d.ts +0 -1
  28. package/dist/src/vue/pageHandler.d.ts +0 -1
  29. package/dist/svelte/index.js +2 -25
  30. package/dist/svelte/index.js.map +4 -5
  31. package/dist/svelte/server.js +1 -24
  32. package/dist/svelte/server.js.map +4 -5
  33. package/dist/types/globals.d.ts +19 -0
  34. package/dist/vue/index.js +2 -25
  35. package/dist/vue/index.js.map +4 -5
  36. package/dist/vue/server.js +1 -24
  37. package/dist/vue/server.js.map +4 -5
  38. package/package.json +1 -1
  39. package/dist/src/core/ssrCache.d.ts +0 -3
package/dist/build.js CHANGED
@@ -2189,7 +2189,7 @@ var routePropsCache, cacheRouteData = (pagePath, data) => {
2189
2189
  value: propValue
2190
2190
  })).filter((entry) => entry.token).map((entry) => ({ provide: entry.token, useValue: entry.value }));
2191
2191
  return [...providers, ...propProviders];
2192
- }, clearSelectorCache = () => selectorCache.clear(), isInjectionToken = (value) => {
2192
+ }, isInjectionToken = (value) => {
2193
2193
  if (!value || typeof value !== "object") {
2194
2194
  return false;
2195
2195
  }
@@ -8934,13 +8934,17 @@ var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async ()
8934
8934
  const path = id.startsWith(".") || isAbsolute2(id) ? resolve9(base, id) : Bun.resolveSync(id, base);
8935
8935
  const module = await import(path);
8936
8936
  return { base: dirname5(path), module, path };
8937
- }, buildCompilerEntry = async (cssPath) => {
8937
+ }, buildCompilerEntry = async (cssPath, extraSources = []) => {
8938
8938
  const compile = await loadTailwindCompile();
8939
8939
  const absPath = resolve9(cssPath);
8940
- const css = await readFile2(absPath, "utf-8");
8940
+ const userCss = await readFile2(absPath, "utf-8");
8941
8941
  const cssMtimeMs = (await stat(absPath)).mtimeMs;
8942
8942
  const cssDependencies = new Map;
8943
8943
  cssDependencies.set(absPath, cssMtimeMs);
8944
+ const sourceDirectives = extraSources.map((pattern) => `@source ${JSON.stringify(pattern)};`).join(`
8945
+ `);
8946
+ const css = sourceDirectives ? `${sourceDirectives}
8947
+ ${userCss}` : userCss;
8944
8948
  const compiler = await compile(css, {
8945
8949
  base: dirname5(absPath),
8946
8950
  loadModule,
@@ -9062,12 +9066,12 @@ var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async ()
9062
9066
  });
9063
9067
  const results = await Promise.all(checks);
9064
9068
  return results.some(Boolean);
9065
- }, getCompilerEntry = async (cssPath) => {
9069
+ }, getCompilerEntry = async (cssPath, extraSources = []) => {
9066
9070
  const key = resolve9(cssPath);
9067
9071
  const cached = compilerCache.get(key);
9068
9072
  if (cached && !await isCompilerStale(cached))
9069
9073
  return cached;
9070
- const fresh = await buildCompilerEntry(cssPath);
9074
+ const fresh = await buildCompilerEntry(cssPath, extraSources);
9071
9075
  await populateCandidatesFromAllSources(fresh);
9072
9076
  compilerCache.set(key, fresh);
9073
9077
  return fresh;
@@ -9077,9 +9081,9 @@ var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async ()
9077
9081
  return;
9078
9082
  }
9079
9083
  compilerCache.delete(resolve9(cssPath));
9080
- }, incrementalTailwindBuild = async (tailwind, buildPath, changedFiles, styleTransformConfig) => {
9084
+ }, incrementalTailwindBuild = async (tailwind, buildPath, changedFiles, styleTransformConfig, extraSources = []) => {
9081
9085
  const startedAt = performance.now();
9082
- const entry = await getCompilerEntry(tailwind.input);
9086
+ const entry = await getCompilerEntry(tailwind.input, extraSources);
9083
9087
  const inputAbs = entry.cssPath;
9084
9088
  const filesToRescan = [];
9085
9089
  for (const file of changedFiles) {
@@ -9102,8 +9106,8 @@ var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async ()
9102
9106
  await Bun.write(outputPath, finalCss);
9103
9107
  entry.lastEmittedHash = hash;
9104
9108
  return { cssChanged: true, durationMs };
9105
- }, warmTailwindCompiler = async (tailwind) => {
9106
- await getCompilerEntry(tailwind.input);
9109
+ }, warmTailwindCompiler = async (tailwind, extraSources = []) => {
9110
+ await getCompilerEntry(tailwind.input, extraSources);
9107
9111
  };
9108
9112
  var init_tailwindCompiler = __esm(() => {
9109
9113
  init_stylePreprocessor();
@@ -9112,13 +9116,38 @@ var init_tailwindCompiler = __esm(() => {
9112
9116
  });
9113
9117
 
9114
9118
  // src/build/compileTailwind.ts
9119
+ var exports_compileTailwind = {};
9120
+ __export(exports_compileTailwind, {
9121
+ isTailwindCandidate: () => isTailwindCandidate,
9122
+ computeFrameworkTailwindSources: () => computeFrameworkTailwindSources,
9123
+ compileTailwindConfig: () => compileTailwindConfig,
9124
+ compileTailwind: () => compileTailwind
9125
+ });
9115
9126
  import { mkdir as mkdir3 } from "fs/promises";
9116
- import { dirname as dirname6, join as join8 } from "path";
9117
- var TAILWIND_CANDIDATE_EXTENSION_PATTERN, isTailwindCandidate = (filePath) => TAILWIND_CANDIDATE_EXTENSION_PATTERN.test(filePath), compileTailwind = async (input, output, buildPath, styleTransformConfig) => {
9127
+ import { dirname as dirname6, join as join8, resolve as resolve10 } from "path";
9128
+ var computeFrameworkTailwindSources = (config) => {
9129
+ const cwd = process.cwd();
9130
+ const dirs = [
9131
+ [config.angularDirectory, "**/*.{ts,tsx,html,htm}"],
9132
+ [config.svelteDirectory, "**/*.{ts,tsx,svelte,html,htm}"],
9133
+ [config.vueDirectory, "**/*.{ts,tsx,vue,html,htm}"],
9134
+ [config.reactDirectory, "**/*.{ts,tsx,js,jsx,html,htm}"],
9135
+ [config.htmlDirectory, "**/*.{html,htm}"],
9136
+ [config.htmxDirectory, "**/*.{html,htm,js,ts}"],
9137
+ [config.emberDirectory, "**/*.{ts,tsx,gts,gjs,hbs,html,htm}"]
9138
+ ];
9139
+ const out = [];
9140
+ for (const [dir, glob] of dirs) {
9141
+ if (!dir)
9142
+ continue;
9143
+ out.push(`${resolve10(cwd, dir)}/${glob}`);
9144
+ }
9145
+ return out;
9146
+ }, TAILWIND_CANDIDATE_EXTENSION_PATTERN, isTailwindCandidate = (filePath) => TAILWIND_CANDIDATE_EXTENSION_PATTERN.test(filePath), compileTailwind = async (input, output, buildPath, styleTransformConfig, extraSources = [], changedFiles = []) => {
9118
9147
  const outputPath = join8(buildPath, output);
9119
9148
  await mkdir3(dirname6(outputPath), { recursive: true });
9120
- await incrementalTailwindBuild({ input, output }, buildPath, [], styleTransformConfig);
9121
- }, compileTailwindConfig = async (tailwind, buildPath, styleTransformConfig) => compileTailwind(tailwind.input, tailwind.output, buildPath, styleTransformConfig);
9149
+ await incrementalTailwindBuild({ input, output }, buildPath, changedFiles, styleTransformConfig, extraSources);
9150
+ }, compileTailwindConfig = async (tailwind, buildPath, styleTransformConfig, extraSources = [], changedFiles = []) => compileTailwind(tailwind.input, tailwind.output, buildPath, styleTransformConfig, extraSources, changedFiles);
9122
9151
  var init_compileTailwind = __esm(() => {
9123
9152
  init_tailwindCompiler();
9124
9153
  TAILWIND_CANDIDATE_EXTENSION_PATTERN = /\.(html?|m?[jt]sx?|cjs|vue|svelte|astro|mdx?|css|s[ac]ss|less|styl(?:us)?)$/i;
@@ -9126,7 +9155,7 @@ var init_compileTailwind = __esm(() => {
9126
9155
 
9127
9156
  // src/utils/imageProcessing.ts
9128
9157
  import { existsSync as existsSync9, mkdirSync as mkdirSync3, readFileSync as readFileSync6, writeFileSync as writeFileSync3 } from "fs";
9129
- import { join as join9, resolve as resolve10 } from "path";
9158
+ import { join as join9, resolve as resolve11 } from "path";
9130
9159
  var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_ENDPOINT = "/_absolute/image", BLUR_DEVIATION = 20, sharpModule = undefined, sharpLoaded = false, sharpWarned = false, snapToSize = (target, sizes) => {
9131
9160
  for (const size of sizes) {
9132
9161
  if (size >= target)
@@ -9254,7 +9283,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
9254
9283
  return sharpModule;
9255
9284
  sharpLoaded = true;
9256
9285
  try {
9257
- const sharpPath = resolve10(process.cwd(), "node_modules/sharp");
9286
+ const sharpPath = resolve11(process.cwd(), "node_modules/sharp");
9258
9287
  const mod = await import(sharpPath);
9259
9288
  sharpModule = mod.default ?? mod;
9260
9289
  return sharpModule;
@@ -9443,6 +9472,9 @@ var replaceAssetRef = (match, prefix, dir, name, ext, suffix, manifest, filePath
9443
9472
  if (/data-external(?:\s*=\s*["'][^"']*["'])?/i.test(match)) {
9444
9473
  return match;
9445
9474
  }
9475
+ if (dir.startsWith("/") || /^[a-z][a-z0-9+.-]*:\/\//i.test(dir)) {
9476
+ return match;
9477
+ }
9446
9478
  const pascal = toPascal(name);
9447
9479
  let key;
9448
9480
  if (ext === ".css") {
@@ -9486,18 +9518,18 @@ var init_updateAssetPaths = __esm(() => {
9486
9518
 
9487
9519
  // src/dev/buildHMRClient.ts
9488
9520
  import { existsSync as existsSync12 } from "fs";
9489
- import { resolve as resolve11 } from "path";
9521
+ import { resolve as resolve12 } from "path";
9490
9522
  var {build: bunBuild } = globalThis.Bun;
9491
9523
  var resolveHmrClientPath = () => {
9492
9524
  const projectRoot = process.cwd();
9493
- const fromSource = resolve11(import.meta.dir, "client/hmrClient.ts");
9525
+ const fromSource = resolve12(import.meta.dir, "client/hmrClient.ts");
9494
9526
  if (existsSync12(fromSource) && fromSource.startsWith(projectRoot)) {
9495
9527
  return fromSource;
9496
9528
  }
9497
- const fromNodeModules = resolve11(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client/hmrClient.ts");
9529
+ const fromNodeModules = resolve12(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client/hmrClient.ts");
9498
9530
  if (existsSync12(fromNodeModules))
9499
9531
  return fromNodeModules;
9500
- return resolve11(import.meta.dir, "dev/client/hmrClient.ts");
9532
+ return resolve12(import.meta.dir, "dev/client/hmrClient.ts");
9501
9533
  }, hmrClientPath2, buildHMRClient = async () => {
9502
9534
  const entryPoint = hmrClientPath2;
9503
9535
  const result = await bunBuild({
@@ -9527,7 +9559,7 @@ var init_buildHMRClient = __esm(() => {
9527
9559
  // src/build/nativeRewrite.ts
9528
9560
  import { dlopen, FFIType, ptr } from "bun:ffi";
9529
9561
  import { platform as platform2, arch as arch2 } from "os";
9530
- import { resolve as resolve12 } from "path";
9562
+ import { resolve as resolve13 } from "path";
9531
9563
  var ffiDefinition, nativeLib = null, loadNative = () => {
9532
9564
  if (nativeLib !== null)
9533
9565
  return nativeLib;
@@ -9545,7 +9577,7 @@ var ffiDefinition, nativeLib = null, loadNative = () => {
9545
9577
  if (!libPath)
9546
9578
  return null;
9547
9579
  try {
9548
- const fullPath = resolve12(import.meta.dir, "../../native/packages", libPath);
9580
+ const fullPath = resolve13(import.meta.dir, "../../native/packages", libPath);
9549
9581
  const lib = dlopen(fullPath, ffiDefinition);
9550
9582
  nativeLib = lib.symbols;
9551
9583
  return nativeLib;
@@ -9691,7 +9723,7 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
9691
9723
 
9692
9724
  // src/build/angularLinkerPlugin.ts
9693
9725
  import { existsSync as existsSync13, mkdirSync as mkdirSync5, readFileSync as readFileSync9, writeFileSync as writeFileSync5 } from "fs";
9694
- import { dirname as dirname8, join as join12, relative as relative6, resolve as resolve13 } from "path";
9726
+ import { dirname as dirname8, join as join12, relative as relative6, resolve as resolve14 } from "path";
9695
9727
  import { createHash as createHash3 } from "crypto";
9696
9728
  var CACHE_ROOT, ANGULAR_LINKER_CANDIDATE_RE, createAngularLinkerPlugin = (linkerJitMode) => ({
9697
9729
  name: "angular-linker",
@@ -9733,7 +9765,7 @@ var CACHE_ROOT, ANGULAR_LINKER_CANDIDATE_RE, createAngularLinkerPlugin = (linker
9733
9765
  exists: existsSync13,
9734
9766
  readFile: readFileSync9,
9735
9767
  relative: relative6,
9736
- resolve: resolve13
9768
+ resolve: resolve14
9737
9769
  },
9738
9770
  linkerJitMode,
9739
9771
  logger: {
@@ -9764,7 +9796,7 @@ var CACHE_ROOT, ANGULAR_LINKER_CANDIDATE_RE, createAngularLinkerPlugin = (linker
9764
9796
  }
9765
9797
  }), angularLinkerPlugin;
9766
9798
  var init_angularLinkerPlugin = __esm(() => {
9767
- CACHE_ROOT = resolve13(".absolutejs", "cache", "angular-linker");
9799
+ CACHE_ROOT = resolve14(".absolutejs", "cache", "angular-linker");
9768
9800
  ANGULAR_LINKER_CANDIDATE_RE = /[\\/]node_modules[\\/].*\.m?js$/;
9769
9801
  angularLinkerPlugin = createAngularLinkerPlugin(false);
9770
9802
  });
@@ -9776,7 +9808,7 @@ __export(exports_hmrInjectionPlugin, {
9776
9808
  applyAngularHmrInjection: () => applyAngularHmrInjection
9777
9809
  });
9778
9810
  import { readFile as readFile5 } from "fs/promises";
9779
- import { relative as relative7, resolve as resolve14 } from "path";
9811
+ import { relative as relative7, resolve as resolve15 } from "path";
9780
9812
  var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames = (jsSource) => {
9781
9813
  const names = new Set;
9782
9814
  IMPORT_RE.lastIndex = 0;
@@ -9939,7 +9971,7 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
9939
9971
  }
9940
9972
  `, applyAngularHmrInjection = (jsSource, componentJsAbsPath, params) => {
9941
9973
  const { generatedAngularRoot, userAngularRoot, projectRoot } = params;
9942
- const normalizedGenRoot = resolve14(generatedAngularRoot).replace(/\\/g, "/");
9974
+ const normalizedGenRoot = resolve15(generatedAngularRoot).replace(/\\/g, "/");
9943
9975
  const normalizedPath = componentJsAbsPath.replace(/\\/g, "/");
9944
9976
  if (!normalizedPath.startsWith(normalizedGenRoot + "/"))
9945
9977
  return;
@@ -9957,7 +9989,7 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
9957
9989
  if (classNames.length === 0)
9958
9990
  return;
9959
9991
  const relFromGenRoot = relative7(generatedAngularRoot, componentJsAbsPath).replace(/\\/g, "/");
9960
- const userTsPath = resolve14(userAngularRoot, relFromGenRoot.replace(/\.js$/, ".ts"));
9992
+ const userTsPath = resolve15(userAngularRoot, relFromGenRoot.replace(/\.js$/, ".ts"));
9961
9993
  const projectRel = relative7(projectRoot, userTsPath).replace(/\\/g, "/");
9962
9994
  const tail = classNames.map((className) => {
9963
9995
  const id = `${projectRel}@${className}`;
@@ -9992,14 +10024,14 @@ var init_hmrInjectionPlugin = __esm(() => {
9992
10024
 
9993
10025
  // src/utils/cleanStaleOutputs.ts
9994
10026
  import { rm as rm2 } from "fs/promises";
9995
- import { resolve as resolve15 } from "path";
10027
+ import { resolve as resolve16 } from "path";
9996
10028
  var {Glob: Glob5 } = globalThis.Bun;
9997
10029
  var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPaths) => {
9998
- const currentPaths = new Set(currentOutputPaths.map((path) => resolve15(path)));
10030
+ const currentPaths = new Set(currentOutputPaths.map((path) => resolve16(path)));
9999
10031
  const glob = new Glob5("**/*");
10000
10032
  const removals = [];
10001
10033
  for (const relative8 of glob.scanSync({ cwd: buildPath })) {
10002
- const absolute = resolve15(buildPath, relative8);
10034
+ const absolute = resolve16(buildPath, relative8);
10003
10035
  if (currentPaths.has(absolute))
10004
10036
  continue;
10005
10037
  if (!HASHED_FILE_PATTERN.test(relative8))
@@ -10233,10 +10265,10 @@ var init_buildDirectoryLock = __esm(() => {
10233
10265
  });
10234
10266
 
10235
10267
  // src/utils/validateSafePath.ts
10236
- import { resolve as resolve16, relative as relative8 } from "path";
10268
+ import { resolve as resolve17, relative as relative8 } from "path";
10237
10269
  var validateSafePath = (targetPath, baseDirectory) => {
10238
- const absoluteBase = resolve16(baseDirectory);
10239
- const absoluteTarget = resolve16(baseDirectory, targetPath);
10270
+ const absoluteBase = resolve17(baseDirectory);
10271
+ const absoluteTarget = resolve17(baseDirectory, targetPath);
10240
10272
  const relativePath = normalizePath(relative8(absoluteBase, absoluteTarget));
10241
10273
  if (relativePath.startsWith("../") || relativePath === "..") {
10242
10274
  throw new Error(`Unsafe path: ${targetPath}`);
@@ -10391,7 +10423,7 @@ import {
10391
10423
  join as join16,
10392
10424
  basename as basename4,
10393
10425
  extname as extname5,
10394
- resolve as resolve17,
10426
+ resolve as resolve18,
10395
10427
  relative as relative9,
10396
10428
  sep as sep2
10397
10429
  } from "path";
@@ -10399,14 +10431,14 @@ import { env } from "process";
10399
10431
  var {write, file, Transpiler: Transpiler2 } = globalThis.Bun;
10400
10432
  var resolveDevClientDir2 = () => {
10401
10433
  const projectRoot = process.cwd();
10402
- const fromSource = resolve17(import.meta.dir, "../dev/client");
10434
+ const fromSource = resolve18(import.meta.dir, "../dev/client");
10403
10435
  if (existsSync14(fromSource) && fromSource.startsWith(projectRoot)) {
10404
10436
  return fromSource;
10405
10437
  }
10406
- const fromNodeModules = resolve17(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
10438
+ const fromNodeModules = resolve18(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
10407
10439
  if (existsSync14(fromNodeModules))
10408
10440
  return fromNodeModules;
10409
- return resolve17(import.meta.dir, "./dev/client");
10441
+ return resolve18(import.meta.dir, "./dev/client");
10410
10442
  }, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
10411
10443
  persistentCache.clear();
10412
10444
  sourceHashCache.clear();
@@ -10436,7 +10468,7 @@ var resolveDevClientDir2 = () => {
10436
10468
  }, resolveRelativeModule2 = async (spec, from) => {
10437
10469
  if (!spec.startsWith("."))
10438
10470
  return null;
10439
- const basePath = resolve17(dirname10(from), spec);
10471
+ const basePath = resolve18(dirname10(from), spec);
10440
10472
  const candidates = [
10441
10473
  basePath,
10442
10474
  `${basePath}.ts`,
@@ -10463,7 +10495,7 @@ var resolveDevClientDir2 = () => {
10463
10495
  const resolved = resolvePackageImport(spec);
10464
10496
  return resolved && /\.svelte(\.(?:ts|js))?$/.test(resolved) ? resolved : null;
10465
10497
  }
10466
- const basePath = resolve17(dirname10(from), spec);
10498
+ const basePath = resolve18(dirname10(from), spec);
10467
10499
  const explicit = /\.(svelte|svelte\.(?:ts|js))$/.test(basePath);
10468
10500
  if (!explicit) {
10469
10501
  const extensions = [".svelte", ".svelte.ts", ".svelte.js"];
@@ -10507,7 +10539,7 @@ var resolveDevClientDir2 = () => {
10507
10539
  const contentHash = Bun.hash(raw).toString(BASE_36_RADIX);
10508
10540
  const prevHash = sourceHashCache.get(src);
10509
10541
  const persistent = persistentCache.get(src);
10510
- if (prevHash === contentHash && persistent) {
10542
+ if (prevHash === contentHash && persistent && existsSync14(persistent.ssr) && existsSync14(persistent.client)) {
10511
10543
  cache.set(src, persistent);
10512
10544
  return persistent;
10513
10545
  }
@@ -10800,19 +10832,19 @@ import {
10800
10832
  isAbsolute as isAbsolute3,
10801
10833
  join as join17,
10802
10834
  relative as relative10,
10803
- resolve as resolve18
10835
+ resolve as resolve19
10804
10836
  } from "path";
10805
10837
  var {file: file2, write: write2, Transpiler: Transpiler3 } = globalThis.Bun;
10806
10838
  var resolveDevClientDir3 = () => {
10807
10839
  const projectRoot = process.cwd();
10808
- const fromSource = resolve18(import.meta.dir, "../dev/client");
10840
+ const fromSource = resolve19(import.meta.dir, "../dev/client");
10809
10841
  if (existsSync15(fromSource) && fromSource.startsWith(projectRoot)) {
10810
10842
  return fromSource;
10811
10843
  }
10812
- const fromNodeModules = resolve18(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
10844
+ const fromNodeModules = resolve19(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
10813
10845
  if (existsSync15(fromNodeModules))
10814
10846
  return fromNodeModules;
10815
- return resolve18(import.meta.dir, "./dev/client");
10847
+ return resolve19(import.meta.dir, "./dev/client");
10816
10848
  }, devClientDir3, hmrClientPath4, transpiler4, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
10817
10849
  scriptCache.clear();
10818
10850
  scriptSetupCache.clear();
@@ -10858,7 +10890,7 @@ var resolveDevClientDir3 = () => {
10858
10890
  return filePath.replace(/\.ts$/, ".js");
10859
10891
  if (isStylePath(filePath)) {
10860
10892
  if (sourceDir && (filePath.startsWith("./") || filePath.startsWith("../"))) {
10861
- return resolve18(sourceDir, filePath);
10893
+ return resolve19(sourceDir, filePath);
10862
10894
  }
10863
10895
  return filePath;
10864
10896
  }
@@ -10894,7 +10926,7 @@ var resolveDevClientDir3 = () => {
10894
10926
  const contentHash = Bun.hash(sourceContent).toString(BASE_36_RADIX);
10895
10927
  const prevHash = vueSourceHashCache.get(sourceFilePath);
10896
10928
  const persistent = persistentBuildCache.get(sourceFilePath);
10897
- if (prevHash === contentHash && persistent) {
10929
+ if (prevHash === contentHash && persistent && existsSync15(persistent.clientPath) && existsSync15(persistent.serverPath)) {
10898
10930
  cacheMap.set(sourceFilePath, persistent);
10899
10931
  return persistent;
10900
10932
  }
@@ -10922,12 +10954,12 @@ var resolveDevClientDir3 = () => {
10922
10954
  const childComponentPaths = importPaths.filter((path) => path.startsWith(".") && path.endsWith(".vue"));
10923
10955
  const packageComponentPaths = Array.from(resolvedPackageVueImports.entries());
10924
10956
  const helperModulePaths = importPaths.filter((path) => path.startsWith(".") && !path.endsWith(".vue") && !isStylePath(path));
10925
- const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute3(path)) && isStylePath(path)).map((path) => isAbsolute3(path) ? path : resolve18(dirname11(sourceFilePath), path));
10957
+ const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute3(path)) && isStylePath(path)).map((path) => isAbsolute3(path) ? path : resolve19(dirname11(sourceFilePath), path));
10926
10958
  for (const stylePath of stylePathsImported) {
10927
10959
  addStyleImporter(sourceFilePath, stylePath);
10928
10960
  }
10929
10961
  const childBuildResults = await Promise.all([
10930
- ...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve18(dirname11(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
10962
+ ...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve19(dirname11(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
10931
10963
  ...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors))
10932
10964
  ]);
10933
10965
  const hasScript = descriptor.script || descriptor.scriptSetup;
@@ -11038,7 +11070,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
11038
11070
  hmrId,
11039
11071
  serverPath: serverOutputPath,
11040
11072
  tsHelperPaths: [
11041
- ...helperModulePaths.map((helper) => resolve18(dirname11(sourceFilePath), helper.endsWith(".ts") ? helper : `${helper}.ts`)),
11073
+ ...helperModulePaths.map((helper) => resolve19(dirname11(sourceFilePath), helper.endsWith(".ts") ? helper : `${helper}.ts`)),
11042
11074
  ...childBuildResults.flatMap((child) => child.tsHelperPaths)
11043
11075
  ]
11044
11076
  };
@@ -11061,7 +11093,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
11061
11093
  const buildCache = new Map;
11062
11094
  const allTsHelperPaths = new Set;
11063
11095
  const compiledPages = await Promise.all(entryPoints.map(async (entryPath) => {
11064
- const result = await compileVueFile(resolve18(entryPath), {
11096
+ const result = await compileVueFile(resolve19(entryPath), {
11065
11097
  client: clientOutputDir,
11066
11098
  css: cssOutputDir,
11067
11099
  server: serverOutputDir
@@ -11720,23 +11752,25 @@ var init_lowerDeferSyntax = __esm(() => {
11720
11752
  // src/build/compileAngular.ts
11721
11753
  var exports_compileAngular = {};
11722
11754
  __export(exports_compileAngular, {
11755
+ invalidateAngularJitCache: () => invalidateAngularJitCache,
11723
11756
  compileAngularFiles: () => compileAngularFiles,
11724
11757
  compileAngularFileJIT: () => compileAngularFileJIT,
11725
11758
  compileAngularFile: () => compileAngularFile,
11726
11759
  compileAngular: () => compileAngular
11727
11760
  });
11728
11761
  import { existsSync as existsSync16, readFileSync as readFileSync11, promises as fs } from "fs";
11729
- import { join as join18, basename as basename6, sep as sep3, dirname as dirname12, resolve as resolve19, relative as relative11 } from "path";
11762
+ import { join as join18, basename as basename6, sep as sep3, dirname as dirname12, resolve as resolve20, relative as relative11 } from "path";
11763
+ var {Glob: Glob6 } = globalThis.Bun;
11730
11764
  import ts2 from "typescript";
11731
11765
  var traceAngularPhase = async (name, fn2, metadata) => {
11732
11766
  const tracePhase = globalThis.__absoluteBuildTracePhase;
11733
11767
  return tracePhase ? tracePhase(`compile/angular/${name}`, fn2, metadata) : await fn2();
11734
11768
  }, readTsconfigPathAliases = () => {
11735
11769
  try {
11736
- const configPath2 = resolve19(process.cwd(), "tsconfig.json");
11770
+ const configPath2 = resolve20(process.cwd(), "tsconfig.json");
11737
11771
  const config = ts2.readConfigFile(configPath2, ts2.sys.readFile).config;
11738
11772
  const compilerOptions = config?.compilerOptions ?? {};
11739
- const baseUrl = resolve19(process.cwd(), compilerOptions.baseUrl ?? ".");
11773
+ const baseUrl = resolve20(process.cwd(), compilerOptions.baseUrl ?? ".");
11740
11774
  const aliases = Object.entries(compilerOptions.paths ?? {}).map(([pattern, replacements]) => ({ pattern, replacements }));
11741
11775
  return { aliases, baseUrl };
11742
11776
  } catch {
@@ -11756,7 +11790,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
11756
11790
  const wildcardValue = exactMatch ? "" : specifier.slice(prefix.length, specifier.length - suffix.length);
11757
11791
  for (const replacement of alias.replacements) {
11758
11792
  const candidate = replacement.replace("*", wildcardValue);
11759
- const resolved = resolveSourceFile(resolve19(baseUrl, candidate));
11793
+ const resolved = resolveSourceFile(resolve20(baseUrl, candidate));
11760
11794
  if (resolved)
11761
11795
  return resolved;
11762
11796
  }
@@ -11775,13 +11809,13 @@ var traceAngularPhase = async (name, fn2, metadata) => {
11775
11809
  ];
11776
11810
  return candidates.find((file3) => existsSync16(file3));
11777
11811
  }, createLegacyAngularAnimationUsageResolver = (rootDir) => {
11778
- const baseDir = resolve19(rootDir);
11812
+ const baseDir = resolve20(rootDir);
11779
11813
  const tsconfigAliases = readTsconfigPathAliases();
11780
11814
  const transpiler5 = new Bun.Transpiler({ loader: "tsx" });
11781
11815
  const scanCache = new Map;
11782
11816
  const resolveLocalImport = (specifier, fromDir) => {
11783
11817
  if (specifier.startsWith(".") || specifier.startsWith("/")) {
11784
- return resolveSourceFile(resolve19(fromDir, specifier));
11818
+ return resolveSourceFile(resolve20(fromDir, specifier));
11785
11819
  }
11786
11820
  const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile);
11787
11821
  if (aliased)
@@ -11790,7 +11824,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
11790
11824
  const resolved = Bun.resolveSync(specifier, fromDir);
11791
11825
  if (resolved.includes("/node_modules/"))
11792
11826
  return;
11793
- const absolute = resolve19(resolved);
11827
+ const absolute = resolve20(resolved);
11794
11828
  if (!absolute.startsWith(baseDir))
11795
11829
  return;
11796
11830
  return resolveSourceFile(absolute);
@@ -11806,7 +11840,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
11806
11840
  usesLegacyAnimations: false
11807
11841
  });
11808
11842
  }
11809
- const resolved = resolve19(actualPath);
11843
+ const resolved = resolve20(actualPath);
11810
11844
  const cached = scanCache.get(resolved);
11811
11845
  if (cached)
11812
11846
  return cached;
@@ -11835,7 +11869,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
11835
11869
  const actualPath = resolveSourceFile(filePath);
11836
11870
  if (!actualPath)
11837
11871
  return false;
11838
- const resolved = resolve19(actualPath);
11872
+ const resolved = resolve20(actualPath);
11839
11873
  if (visited.has(resolved))
11840
11874
  return false;
11841
11875
  visited.add(resolved);
@@ -11853,14 +11887,14 @@ var traceAngularPhase = async (name, fn2, metadata) => {
11853
11887
  return (entryPath) => visit(entryPath);
11854
11888
  }, resolveDevClientDir4 = () => {
11855
11889
  const projectRoot = process.cwd();
11856
- const fromSource = resolve19(import.meta.dir, "../dev/client");
11890
+ const fromSource = resolve20(import.meta.dir, "../dev/client");
11857
11891
  if (existsSync16(fromSource) && fromSource.startsWith(projectRoot)) {
11858
11892
  return fromSource;
11859
11893
  }
11860
- const fromNodeModules = resolve19(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
11894
+ const fromNodeModules = resolve20(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
11861
11895
  if (existsSync16(fromNodeModules))
11862
11896
  return fromNodeModules;
11863
- return resolve19(import.meta.dir, "./dev/client");
11897
+ return resolve20(import.meta.dir, "./dev/client");
11864
11898
  }, devClientDir4, hmrClientPath5, formatDiagnosticMessage = (diagnostic) => {
11865
11899
  try {
11866
11900
  return ts2.flattenDiagnosticMessageText(diagnostic.messageText, `
@@ -11903,11 +11937,11 @@ var traceAngularPhase = async (name, fn2, metadata) => {
11903
11937
  if (hasJsLikeExtension(path))
11904
11938
  return `${path}${query}`;
11905
11939
  const importerDir = dirname12(importerOutputPath);
11906
- const fileCandidate = resolve19(importerDir, `${path}.js`);
11940
+ const fileCandidate = resolve20(importerDir, `${path}.js`);
11907
11941
  if (outputFiles?.has(fileCandidate) || existsSync16(fileCandidate)) {
11908
11942
  return `${path}.js${query}`;
11909
11943
  }
11910
- const indexCandidate = resolve19(importerDir, path, "index.js");
11944
+ const indexCandidate = resolve20(importerDir, path, "index.js");
11911
11945
  if (outputFiles?.has(indexCandidate) || existsSync16(indexCandidate)) {
11912
11946
  return `${path}/index.js${query}`;
11913
11947
  }
@@ -11935,7 +11969,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
11935
11969
  }, resolveLocalTsImport = (fromFile, specifier) => {
11936
11970
  if (!isRelativeModuleSpecifier(specifier))
11937
11971
  return null;
11938
- const basePath = resolve19(dirname12(fromFile), specifier);
11972
+ const basePath = resolve20(dirname12(fromFile), specifier);
11939
11973
  const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
11940
11974
  `${basePath}.ts`,
11941
11975
  `${basePath}.tsx`,
@@ -11946,7 +11980,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
11946
11980
  join18(basePath, "index.mts"),
11947
11981
  join18(basePath, "index.cts")
11948
11982
  ];
11949
- return candidates.map((candidate) => resolve19(candidate)).find((candidate) => existsSync16(candidate) && !candidate.endsWith(".d.ts")) ?? null;
11983
+ return candidates.map((candidate) => resolve20(candidate)).find((candidate) => existsSync16(candidate) && !candidate.endsWith(".d.ts")) ?? null;
11950
11984
  }, readFileForAotTransform = async (fileName, readFile6) => {
11951
11985
  const hostSource = readFile6?.(fileName);
11952
11986
  if (typeof hostSource === "string")
@@ -11981,7 +12015,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
11981
12015
  paths.push(join18(fileDir, urlMatch.replace(/['"]/g, "")));
11982
12016
  }
11983
12017
  }
11984
- return paths.map((path) => resolve19(path));
12018
+ return paths.map((path) => resolve20(path));
11985
12019
  }, readResourceCacheFile = async (cachePath) => {
11986
12020
  try {
11987
12021
  const entry = JSON.parse(await fs.readFile(cachePath, "utf-8"));
@@ -12023,7 +12057,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
12023
12057
  transformedFiles: 0
12024
12058
  };
12025
12059
  const transformFile = async (filePath) => {
12026
- const resolvedPath = resolve19(filePath);
12060
+ const resolvedPath = resolve20(filePath);
12027
12061
  if (visited.has(resolvedPath))
12028
12062
  return;
12029
12063
  visited.add(resolvedPath);
@@ -12058,7 +12092,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
12058
12092
  return { stats, transformedSources };
12059
12093
  }, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
12060
12094
  const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
12061
- const outputPath = resolve19(join18(outDir, relative11(process.cwd(), resolve19(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
12095
+ const outputPath = resolve20(join18(outDir, relative11(process.cwd(), resolve20(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
12062
12096
  return [
12063
12097
  outputPath,
12064
12098
  buildIslandMetadataExports(readFileSync11(inputPath, "utf-8"))
@@ -12069,7 +12103,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
12069
12103
  const tsLibDir = await traceAngularPhase("aot/resolve-typescript-lib", () => {
12070
12104
  const tsPath = __require.resolve("typescript");
12071
12105
  const tsRootDir = dirname12(tsPath);
12072
- return tsRootDir.endsWith("lib") ? tsRootDir : resolve19(tsRootDir, "lib");
12106
+ return tsRootDir.endsWith("lib") ? tsRootDir : resolve20(tsRootDir, "lib");
12073
12107
  });
12074
12108
  const config = await traceAngularPhase("aot/read-configuration", () => readConfiguration("./tsconfig.json"));
12075
12109
  const options = {
@@ -12111,7 +12145,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
12111
12145
  return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
12112
12146
  };
12113
12147
  const emitted = {};
12114
- const resolvedOutDir = resolve19(outDir);
12148
+ const resolvedOutDir = resolve20(outDir);
12115
12149
  host.writeFile = (fileName, text) => {
12116
12150
  const relativePath = resolveRelativePath(fileName, resolvedOutDir, outDir);
12117
12151
  emitted[relativePath] = text;
@@ -12133,12 +12167,12 @@ var traceAngularPhase = async (name, fn2, metadata) => {
12133
12167
  if (!fileName.endsWith(".ts") || fileName.endsWith(".d.ts")) {
12134
12168
  return source;
12135
12169
  }
12136
- const resolvedPath = resolve19(fileName);
12170
+ const resolvedPath = resolve20(fileName);
12137
12171
  return transformedSources.get(resolvedPath) ?? source;
12138
12172
  };
12139
12173
  const originalGetSourceFileForCompile = host.getSourceFile;
12140
12174
  host.getSourceFile = (fileName, languageVersion, onError) => {
12141
- const source = transformedSources.get(resolve19(fileName));
12175
+ const source = transformedSources.get(resolve20(fileName));
12142
12176
  if (source) {
12143
12177
  return ts2.createSourceFile(fileName, source, languageVersion, true);
12144
12178
  }
@@ -12162,7 +12196,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
12162
12196
  content,
12163
12197
  target: join18(outDir, fileName)
12164
12198
  }));
12165
- const outputFiles = new Set(rawEntries.map(({ target }) => resolve19(target)));
12199
+ const outputFiles = new Set(rawEntries.map(({ target }) => resolve20(target)));
12166
12200
  return rawEntries.map(({ content, target }) => {
12167
12201
  let processedContent = content.replace(/from\s+(['"])(\.\.?\/[^'"]+)(\1)/g, (match, quote, path) => {
12168
12202
  const rewritten = rewriteRelativeJsSpecifier(target, path, outputFiles);
@@ -12177,7 +12211,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
12177
12211
  return cleaned ? `import { ${cleaned}, InternalInjectFlags } from '@angular/core'` : `import { InternalInjectFlags } from '@angular/core'`;
12178
12212
  });
12179
12213
  processedContent = processedContent.replace(/\b(?<!Internal)InjectFlags\b/g, "InternalInjectFlags");
12180
- processedContent += islandMetadataByOutputPath.get(resolve19(target)) ?? "";
12214
+ processedContent += islandMetadataByOutputPath.get(resolve20(target)) ?? "";
12181
12215
  return { content: processedContent, target };
12182
12216
  });
12183
12217
  });
@@ -12186,7 +12220,9 @@ var traceAngularPhase = async (name, fn2, metadata) => {
12186
12220
  await fs.writeFile(target, content, "utf-8");
12187
12221
  })), { outputs: entries.length });
12188
12222
  return await traceAngularPhase("aot/collect-output-paths", () => entries.map(({ target }) => target), { outputs: entries.length });
12189
- }, compileAngularFile = async (inputPath, outDir, stylePreprocessors) => compileAngularFiles([inputPath], outDir, stylePreprocessors), jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), findUncommentedMatch = (source, pattern) => {
12223
+ }, compileAngularFile = async (inputPath, outDir, stylePreprocessors) => compileAngularFiles([inputPath], outDir, stylePreprocessors), jitContentCache, invalidateAngularJitCache = (filePath) => {
12224
+ jitContentCache.delete(resolve20(filePath));
12225
+ }, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), findUncommentedMatch = (source, pattern) => {
12190
12226
  const re2 = new RegExp(pattern.source, pattern.flags.includes("g") ? pattern.flags : pattern.flags + "g");
12191
12227
  let match;
12192
12228
  while ((match = re2.exec(source)) !== null) {
@@ -12198,7 +12234,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
12198
12234
  }
12199
12235
  return null;
12200
12236
  }, resolveAngularDeferImportSpecifier = () => {
12201
- const sourceEntry = resolve19(import.meta.dir, "../angular/components/index.ts");
12237
+ const sourceEntry = resolve20(import.meta.dir, "../angular/components/index.ts");
12202
12238
  if (existsSync16(sourceEntry)) {
12203
12239
  return sourceEntry.replace(/\\/g, "/");
12204
12240
  }
@@ -12428,10 +12464,10 @@ ${fields}
12428
12464
  source: result
12429
12465
  };
12430
12466
  }, compileAngularFileJIT = async (inputPath, outDir, rootDir, stylePreprocessors, cacheBuster) => {
12431
- const entryPath = resolve19(inputPath);
12467
+ const entryPath = resolve20(inputPath);
12432
12468
  const allOutputs = [];
12433
12469
  const visited = new Set;
12434
- const baseDir = resolve19(rootDir ?? process.cwd());
12470
+ const baseDir = resolve20(rootDir ?? process.cwd());
12435
12471
  let usesLegacyAnimations = false;
12436
12472
  const angularTranspiler = new Bun.Transpiler({
12437
12473
  loader: "ts",
@@ -12459,7 +12495,7 @@ ${fields}
12459
12495
  };
12460
12496
  const resolveLocalImport = (specifier, fromDir) => {
12461
12497
  if (specifier.startsWith(".") || specifier.startsWith("/")) {
12462
- return resolveSourceFile2(resolve19(fromDir, specifier));
12498
+ return resolveSourceFile2(resolve20(fromDir, specifier));
12463
12499
  }
12464
12500
  const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile2);
12465
12501
  if (aliased)
@@ -12468,7 +12504,7 @@ ${fields}
12468
12504
  const resolved = Bun.resolveSync(specifier, fromDir);
12469
12505
  if (resolved.includes("/node_modules/"))
12470
12506
  return;
12471
- const absolute = resolve19(resolved);
12507
+ const absolute = resolve20(resolved);
12472
12508
  if (!absolute.startsWith(baseDir))
12473
12509
  return;
12474
12510
  return resolveSourceFile2(absolute);
@@ -12517,13 +12553,13 @@ ${fields}
12517
12553
  return `${prefix}${dots}`;
12518
12554
  return `${prefix}../${dots}`;
12519
12555
  });
12520
- if (resolve19(actualPath) === entryPath) {
12556
+ if (resolve20(actualPath) === entryPath) {
12521
12557
  processedContent += buildIslandMetadataExports(sourceCode);
12522
12558
  }
12523
12559
  return processedContent;
12524
12560
  };
12525
12561
  const transpileFile = async (filePath) => {
12526
- const resolved = resolve19(filePath);
12562
+ const resolved = resolve20(filePath);
12527
12563
  if (visited.has(resolved))
12528
12564
  return;
12529
12565
  visited.add(resolved);
@@ -12575,7 +12611,7 @@ ${fields}
12575
12611
  importRewrites.set(specifier, relativeRewrite);
12576
12612
  return resolved2;
12577
12613
  }).filter((path) => Boolean(path));
12578
- const isEntry = resolve19(actualPath) === resolve19(entryPath);
12614
+ const isEntry = resolve20(actualPath) === resolve20(entryPath);
12579
12615
  const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
12580
12616
  const cacheKey2 = actualPath;
12581
12617
  const shouldWriteFile = cacheBuster && isEntry ? true : jitContentCache.get(cacheKey2) !== contentHash || !existsSync16(targetPath);
@@ -12611,10 +12647,29 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
12611
12647
  const compiledRoot = compiledParent;
12612
12648
  const indexesDir = join18(compiledParent, "indexes");
12613
12649
  await traceAngularPhase("setup/create-indexes-dir", () => fs.mkdir(indexesDir, { recursive: true }));
12614
- const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve19(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
12650
+ const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve20(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
12651
+ if (!hmr) {
12652
+ await traceAngularPhase("aot/copy-json-resources", async () => {
12653
+ const cwd = process.cwd();
12654
+ const angularSrcDir = resolve20(outRoot);
12655
+ if (!existsSync16(angularSrcDir))
12656
+ return;
12657
+ const jsonGlob = new Glob6("**/*.json");
12658
+ for (const rel of jsonGlob.scanSync({
12659
+ absolute: false,
12660
+ cwd: angularSrcDir
12661
+ })) {
12662
+ const sourcePath = join18(angularSrcDir, rel);
12663
+ const cwdRel = relative11(cwd, sourcePath);
12664
+ const targetPath = join18(compiledRoot, cwdRel);
12665
+ await fs.mkdir(dirname12(targetPath), { recursive: true });
12666
+ await fs.copyFile(sourcePath, targetPath);
12667
+ }
12668
+ });
12669
+ }
12615
12670
  const usesLegacyAngularAnimations = await traceAngularPhase("setup/legacy-animation-resolver", () => createLegacyAngularAnimationUsageResolver(outRoot));
12616
12671
  const compileTasks = entryPoints.map(async (entry) => {
12617
- const resolvedEntry = resolve19(entry);
12672
+ const resolvedEntry = resolve20(entry);
12618
12673
  const relativeEntry = relative11(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
12619
12674
  const compileEntry = () => compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors);
12620
12675
  let outputs = hmr ? await traceAngularPhase("jit/compile-entry", compileEntry, {
@@ -12626,10 +12681,10 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
12626
12681
  join18(compiledRoot, relativeEntry),
12627
12682
  join18(compiledRoot, "pages", jsName),
12628
12683
  join18(compiledRoot, jsName)
12629
- ].map((file3) => resolve19(file3));
12684
+ ].map((file3) => resolve20(file3));
12630
12685
  const resolveRawServerFile = (candidatePaths) => {
12631
12686
  const normalizedCandidates = [
12632
- ...candidatePaths.map((file3) => resolve19(file3)),
12687
+ ...candidatePaths.map((file3) => resolve20(file3)),
12633
12688
  ...compiledFallbackPaths
12634
12689
  ];
12635
12690
  let candidate = normalizedCandidates.find((file3) => existsSync16(file3) && file3.endsWith(`${sep3}pages${sep3}${jsName}`));
@@ -12685,7 +12740,6 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
12685
12740
  rewritten = `import '@angular/compiler';
12686
12741
  ${rewritten}`;
12687
12742
  }
12688
- rewritten = rewritten.replace(new RegExp(`templateUrl:\\s*['"]\\.\\/${fileBase}\\.html['"]`), `templateUrl: '../../pages/${fileBase}.html'`);
12689
12743
  if (detectedClassName && !rewritten.includes("export default")) {
12690
12744
  rewritten += `
12691
12745
  export default ${componentClassName};
@@ -13611,7 +13665,7 @@ __export(exports_fastHmrCompiler, {
13611
13665
  invalidateFingerprintCache: () => invalidateFingerprintCache
13612
13666
  });
13613
13667
  import { existsSync as existsSync17, readFileSync as readFileSync12, statSync } from "fs";
13614
- import { dirname as dirname13, extname as extname6, relative as relative12, resolve as resolve20 } from "path";
13668
+ import { dirname as dirname13, extname as extname6, relative as relative12, resolve as resolve21 } from "path";
13615
13669
  import ts6 from "typescript";
13616
13670
  var fail = (reason, detail, location) => ({
13617
13671
  ok: false,
@@ -13915,7 +13969,7 @@ var fail = (reason, detail, location) => ({
13915
13969
  if (!spec.startsWith(".") && !spec.startsWith("/")) {
13916
13970
  return true;
13917
13971
  }
13918
- const base = resolve20(componentDir, spec);
13972
+ const base = resolve21(componentDir, spec);
13919
13973
  const candidates = [
13920
13974
  `${base}.ts`,
13921
13975
  `${base}.tsx`,
@@ -14717,7 +14771,7 @@ var fail = (reason, detail, location) => ({
14717
14771
  return null;
14718
14772
  }, resolveDtsFromSpec = (spec, fromDir) => {
14719
14773
  const stripped = spec.replace(/\.[mc]?js$/, "");
14720
- const base = resolve20(fromDir, stripped);
14774
+ const base = resolve21(fromDir, stripped);
14721
14775
  const candidates = [
14722
14776
  `${base}.d.ts`,
14723
14777
  `${base}.d.mts`,
@@ -14741,7 +14795,7 @@ var fail = (reason, detail, location) => ({
14741
14795
  return null;
14742
14796
  }, resolveChildComponentInfo = (className, spec, componentDir, projectRoot) => {
14743
14797
  if (spec.startsWith(".") || spec.startsWith("/")) {
14744
- const base = resolve20(componentDir, spec);
14798
+ const base = resolve21(componentDir, spec);
14745
14799
  const candidates = [
14746
14800
  `${base}.ts`,
14747
14801
  `${base}.tsx`,
@@ -14840,7 +14894,18 @@ var fail = (reason, detail, location) => ({
14840
14894
  if (!initializerShapeIsStructural(init))
14841
14895
  continue;
14842
14896
  const name = member.name.getText();
14843
- const bodyHash = djb2Hash(init.getText());
14897
+ let bodyText;
14898
+ try {
14899
+ const printer = ts6.createPrinter({
14900
+ newLine: ts6.NewLineKind.LineFeed,
14901
+ omitTrailingSemicolon: true,
14902
+ removeComments: true
14903
+ });
14904
+ bodyText = printer.printNode(ts6.EmitHint.Unspecified, init, cls.getSourceFile());
14905
+ } catch {
14906
+ bodyText = init.getText();
14907
+ }
14908
+ const bodyHash = djb2Hash(bodyText);
14844
14909
  entries.push(`${name}:${bodyHash}`);
14845
14910
  }
14846
14911
  return entries.sort();
@@ -14947,13 +15012,13 @@ var fail = (reason, detail, location) => ({
14947
15012
  }
14948
15013
  if (!matches)
14949
15014
  continue;
14950
- const resolved = resolve20(componentDir, spec);
15015
+ const resolved = resolve21(componentDir, spec);
14951
15016
  for (const ext of TS_EXTENSIONS) {
14952
15017
  const candidate = resolved + ext;
14953
15018
  if (existsSync17(candidate))
14954
15019
  return candidate;
14955
15020
  }
14956
- const indexCandidate = resolve20(resolved, "index.ts");
15021
+ const indexCandidate = resolve21(resolved, "index.ts");
14957
15022
  if (existsSync17(indexCandidate))
14958
15023
  return indexCandidate;
14959
15024
  }
@@ -15049,15 +15114,21 @@ var fail = (reason, detail, location) => ({
15049
15114
  const providerImportSig = extractProviderImportSig(decoratorMeta.importsExpr, sourceFile, componentDir);
15050
15115
  const topLevelImports = extractTopLevelImports(sourceFile);
15051
15116
  const propertyFieldNames = extractPropertyFieldNames(cls);
15052
- const importsArraySig = decoratorMeta.importsExpr ? djb2Hash(decoratorMeta.importsExpr.getText()) : "";
15053
- const hostDirectivesSig = decoratorMeta.hostDirectivesExpr ? djb2Hash(decoratorMeta.hostDirectivesExpr.getText()) : "";
15054
- const animationsArraySig = decoratorMeta.animationsExpr ? djb2Hash(decoratorMeta.animationsExpr.getText()) : "";
15055
- const providersArraySig = decoratorMeta.providersExpr ? djb2Hash(decoratorMeta.providersExpr.getText()) : "";
15056
- const viewProvidersArraySig = decoratorMeta.viewProvidersExpr ? djb2Hash(decoratorMeta.viewProvidersExpr.getText()) : "";
15057
- const decoratorInputsArraySig = decoratorMeta.inputsArrayExpr ? djb2Hash(decoratorMeta.inputsArrayExpr.getText()) : "";
15058
- const decoratorOutputsArraySig = decoratorMeta.outputsArrayExpr ? djb2Hash(decoratorMeta.outputsArrayExpr.getText()) : "";
15059
- const hostBindingsSig = decoratorMeta.hostExpr ? djb2Hash(decoratorMeta.hostExpr.getText()) : "";
15060
- const schemasSig = decoratorMeta.schemasExpr ? djb2Hash(decoratorMeta.schemasExpr.getText()) : "";
15117
+ const printer = ts6.createPrinter({
15118
+ newLine: ts6.NewLineKind.LineFeed,
15119
+ omitTrailingSemicolon: true,
15120
+ removeComments: true
15121
+ });
15122
+ const canonicalText = (node) => printer.printNode(ts6.EmitHint.Unspecified, node, sourceFile);
15123
+ const importsArraySig = decoratorMeta.importsExpr ? djb2Hash(canonicalText(decoratorMeta.importsExpr)) : "";
15124
+ const hostDirectivesSig = decoratorMeta.hostDirectivesExpr ? djb2Hash(canonicalText(decoratorMeta.hostDirectivesExpr)) : "";
15125
+ const animationsArraySig = decoratorMeta.animationsExpr ? djb2Hash(canonicalText(decoratorMeta.animationsExpr)) : "";
15126
+ const providersArraySig = decoratorMeta.providersExpr ? djb2Hash(canonicalText(decoratorMeta.providersExpr)) : "";
15127
+ const viewProvidersArraySig = decoratorMeta.viewProvidersExpr ? djb2Hash(canonicalText(decoratorMeta.viewProvidersExpr)) : "";
15128
+ const decoratorInputsArraySig = decoratorMeta.inputsArrayExpr ? djb2Hash(canonicalText(decoratorMeta.inputsArrayExpr)) : "";
15129
+ const decoratorOutputsArraySig = decoratorMeta.outputsArrayExpr ? djb2Hash(canonicalText(decoratorMeta.outputsArrayExpr)) : "";
15130
+ const hostBindingsSig = decoratorMeta.hostExpr ? djb2Hash(canonicalText(decoratorMeta.hostExpr)) : "";
15131
+ const schemasSig = decoratorMeta.schemasExpr ? djb2Hash(canonicalText(decoratorMeta.schemasExpr)) : "";
15061
15132
  const PAGE_EXPORT_NAMES = new Set(["providers", "routes"]);
15062
15133
  const pageExportEntries = [];
15063
15134
  for (const stmt of sourceFile.statements) {
@@ -15073,7 +15144,7 @@ var fail = (reason, detail, location) => ({
15073
15144
  continue;
15074
15145
  if (!decl.initializer)
15075
15146
  continue;
15076
- pageExportEntries.push(`${decl.name.text}=${djb2Hash(decl.initializer.getText())}`);
15147
+ pageExportEntries.push(`${decl.name.text}=${djb2Hash(canonicalText(decl.initializer))}`);
15077
15148
  }
15078
15149
  }
15079
15150
  pageExportEntries.sort();
@@ -15180,7 +15251,7 @@ ${transpiled}
15180
15251
  }
15181
15252
  }${staticPatch}`;
15182
15253
  }, STYLE_PREPROCESSED_EXT, resolveAndReadStyleResource = (componentDir, url) => {
15183
- const abs = resolve20(componentDir, url);
15254
+ const abs = resolve21(componentDir, url);
15184
15255
  if (!existsSync17(abs))
15185
15256
  return null;
15186
15257
  const ext = extname6(abs).toLowerCase();
@@ -15220,7 +15291,7 @@ ${block}
15220
15291
  const cached = projectOptionsCache.get(projectRoot);
15221
15292
  if (cached !== undefined)
15222
15293
  return cached;
15223
- const tsconfigPath = resolve20(projectRoot, "tsconfig.json");
15294
+ const tsconfigPath = resolve21(projectRoot, "tsconfig.json");
15224
15295
  const opts = {};
15225
15296
  if (existsSync17(tsconfigPath)) {
15226
15297
  try {
@@ -15304,7 +15375,7 @@ ${block}
15304
15375
  templateText = decoratorMeta.template;
15305
15376
  templatePath = componentFilePath;
15306
15377
  } else if (decoratorMeta.templateUrl) {
15307
- const tplAbs = resolve20(componentDir, decoratorMeta.templateUrl);
15378
+ const tplAbs = resolve21(componentDir, decoratorMeta.templateUrl);
15308
15379
  if (!existsSync17(tplAbs)) {
15309
15380
  return fail("template-resource-not-found", `Template file not found: ${tplAbs}`, { file: componentFilePath });
15310
15381
  }
@@ -16067,7 +16138,7 @@ __export(exports_compileEmber, {
16067
16138
  });
16068
16139
  import { existsSync as existsSync18 } from "fs";
16069
16140
  import { mkdir as mkdir6, rm as rm4 } from "fs/promises";
16070
- import { basename as basename7, dirname as dirname14, extname as extname7, join as join19, resolve as resolve21 } from "path";
16141
+ import { basename as basename7, dirname as dirname14, extname as extname7, join as join19, resolve as resolve22 } from "path";
16071
16142
  var {build: bunBuild2, Transpiler: Transpiler4, write: write3, file: file3 } = globalThis.Bun;
16072
16143
  var cachedPreprocessor = null, getPreprocessor = async () => {
16073
16144
  if (cachedPreprocessor)
@@ -16163,7 +16234,7 @@ export const importSync = (specifier) => {
16163
16234
  const originalImporter = stagedSourceMap.get(args.importer);
16164
16235
  if (!originalImporter)
16165
16236
  return;
16166
- const candidateBase = resolve21(dirname14(originalImporter), args.path);
16237
+ const candidateBase = resolve22(dirname14(originalImporter), args.path);
16167
16238
  const extensionsToTry = ["", ".gts", ".gjs", ".ts", ".js"];
16168
16239
  for (const ext of extensionsToTry) {
16169
16240
  const candidate = candidateBase + ext;
@@ -16222,7 +16293,7 @@ export const renderToHTML = (props = {}) => {
16222
16293
  export { PageComponent };
16223
16294
  export default PageComponent;
16224
16295
  `, compileEmberFile = async (entry, compiledRoot, cwd = process.cwd()) => {
16225
- const resolvedEntry = resolve21(entry);
16296
+ const resolvedEntry = resolve22(entry);
16226
16297
  const source = await file3(resolvedEntry).text();
16227
16298
  let preprocessed = source;
16228
16299
  if (isTemplateTagFile(resolvedEntry)) {
@@ -16242,8 +16313,8 @@ export default PageComponent;
16242
16313
  mkdir6(serverDir, { recursive: true }),
16243
16314
  mkdir6(clientDir, { recursive: true })
16244
16315
  ]);
16245
- const tmpPagePath = resolve21(join19(tmpDir, `${baseName}.module.js`));
16246
- const tmpHarnessPath = resolve21(join19(tmpDir, `${baseName}.harness.js`));
16316
+ const tmpPagePath = resolve22(join19(tmpDir, `${baseName}.module.js`));
16317
+ const tmpHarnessPath = resolve22(join19(tmpDir, `${baseName}.harness.js`));
16247
16318
  await Promise.all([
16248
16319
  write3(tmpPagePath, transpiled),
16249
16320
  write3(tmpHarnessPath, generateServerHarness(tmpPagePath))
@@ -16285,7 +16356,7 @@ export default PageComponent;
16285
16356
  serverPaths: outputs.map((o3) => o3.serverPath)
16286
16357
  };
16287
16358
  }, compileEmberFileSource = async (entry) => {
16288
- const resolvedEntry = resolve21(entry);
16359
+ const resolvedEntry = resolve22(entry);
16289
16360
  const source = await file3(resolvedEntry).text();
16290
16361
  let preprocessed = source;
16291
16362
  if (isTemplateTagFile(resolvedEntry)) {
@@ -16318,24 +16389,24 @@ __export(exports_buildReactVendor, {
16318
16389
  buildReactVendor: () => buildReactVendor
16319
16390
  });
16320
16391
  import { existsSync as existsSync19, mkdirSync as mkdirSync7 } from "fs";
16321
- import { join as join20, resolve as resolve22 } from "path";
16392
+ import { join as join20, resolve as resolve23 } from "path";
16322
16393
  import { rm as rm5 } from "fs/promises";
16323
16394
  var {build: bunBuild3 } = globalThis.Bun;
16324
16395
  var resolveJsxDevRuntimeCompatPath = () => {
16325
16396
  const candidates = [
16326
- resolve22(import.meta.dir, "react", "jsxDevRuntimeCompat.js"),
16327
- resolve22(import.meta.dir, "src", "react", "jsxDevRuntimeCompat.ts"),
16328
- resolve22(import.meta.dir, "..", "react", "jsxDevRuntimeCompat.js"),
16329
- resolve22(import.meta.dir, "..", "src", "react", "jsxDevRuntimeCompat.ts"),
16330
- resolve22(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
16331
- resolve22(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
16397
+ resolve23(import.meta.dir, "react", "jsxDevRuntimeCompat.js"),
16398
+ resolve23(import.meta.dir, "src", "react", "jsxDevRuntimeCompat.ts"),
16399
+ resolve23(import.meta.dir, "..", "react", "jsxDevRuntimeCompat.js"),
16400
+ resolve23(import.meta.dir, "..", "src", "react", "jsxDevRuntimeCompat.ts"),
16401
+ resolve23(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
16402
+ resolve23(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
16332
16403
  ];
16333
16404
  for (const candidate of candidates) {
16334
16405
  if (existsSync19(candidate)) {
16335
16406
  return candidate.replace(/\\/g, "/");
16336
16407
  }
16337
16408
  }
16338
- return (candidates[0] ?? resolve22(import.meta.dir, "react", "jsxDevRuntimeCompat.js")).replace(/\\/g, "/");
16409
+ return (candidates[0] ?? resolve23(import.meta.dir, "react", "jsxDevRuntimeCompat.js")).replace(/\\/g, "/");
16339
16410
  }, jsxDevRuntimeCompatPath, reactSpecifiers, isResolvable = (specifier) => {
16340
16411
  try {
16341
16412
  Bun.resolveSync(specifier, process.cwd());
@@ -16446,7 +16517,7 @@ __export(exports_buildAngularVendor, {
16446
16517
  import { mkdirSync as mkdirSync8 } from "fs";
16447
16518
  import { join as join21 } from "path";
16448
16519
  import { rm as rm6 } from "fs/promises";
16449
- var {build: bunBuild4, Glob: Glob6 } = globalThis.Bun;
16520
+ var {build: bunBuild4, Glob: Glob7 } = globalThis.Bun;
16450
16521
  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) => {
16451
16522
  try {
16452
16523
  Bun.resolveSync(specifier, process.cwd());
@@ -16458,7 +16529,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
16458
16529
  const angular = new Set;
16459
16530
  const transitiveRoots = new Set;
16460
16531
  const transpiler6 = new Bun.Transpiler({ loader: "tsx" });
16461
- const glob = new Glob6("**/*.{ts,tsx,js,jsx}");
16532
+ const glob = new Glob7("**/*.{ts,tsx,js,jsx}");
16462
16533
  for (const dir of directories) {
16463
16534
  try {
16464
16535
  for await (const file4 of glob.scan({ absolute: true, cwd: dir })) {
@@ -16985,9 +17056,9 @@ import {
16985
17056
  statSync as statSync2,
16986
17057
  writeFileSync as writeFileSync7
16987
17058
  } from "fs";
16988
- import { basename as basename8, dirname as dirname15, extname as extname8, join as join25, relative as relative13, resolve as resolve23 } from "path";
17059
+ import { basename as basename8, dirname as dirname15, extname as extname8, join as join25, relative as relative13, resolve as resolve24 } from "path";
16989
17060
  import { cwd, env as env2, exit } from "process";
16990
- var {build: bunBuild7, Glob: Glob7 } = globalThis.Bun;
17061
+ var {build: bunBuild7, Glob: Glob8 } = globalThis.Bun;
16991
17062
  var isDev, isBuildTraceEnabled = () => {
16992
17063
  const value = env2.ABSOLUTE_BUILD_TRACE?.toLowerCase();
16993
17064
  return value === "1" || value === "true" || value === "yes";
@@ -17061,7 +17132,7 @@ var isDev, isBuildTraceEnabled = () => {
17061
17132
  exit(1);
17062
17133
  }, copyHtmxVendor = (htmxDir, htmxDestDir) => {
17063
17134
  mkdirSync11(htmxDestDir, { recursive: true });
17064
- const glob = new Glob7("htmx*.min.js");
17135
+ const glob = new Glob8("htmx*.min.js");
17065
17136
  for (const relPath of glob.scanSync({ cwd: htmxDir })) {
17066
17137
  const src = join25(htmxDir, relPath);
17067
17138
  const dest = join25(htmxDestDir, "htmx.min.js");
@@ -17076,8 +17147,8 @@ var isDev, isBuildTraceEnabled = () => {
17076
17147
  }
17077
17148
  }, resolveAbsoluteVersion = async () => {
17078
17149
  const candidates = [
17079
- resolve23(import.meta.dir, "..", "..", "package.json"),
17080
- resolve23(import.meta.dir, "..", "package.json")
17150
+ resolve24(import.meta.dir, "..", "..", "package.json"),
17151
+ resolve24(import.meta.dir, "..", "package.json")
17081
17152
  ];
17082
17153
  const resolveCandidate = async (remaining) => {
17083
17154
  const [candidate, ...rest] = remaining;
@@ -17093,7 +17164,7 @@ var isDev, isBuildTraceEnabled = () => {
17093
17164
  };
17094
17165
  await resolveCandidate(candidates);
17095
17166
  }, SKIP_DIRS, addWorkerPathIfExists = (file4, relPath, workerPaths) => {
17096
- const absPath = resolve23(file4, "..", relPath);
17167
+ const absPath = resolve24(file4, "..", relPath);
17097
17168
  try {
17098
17169
  statSync2(absPath);
17099
17170
  workerPaths.add(absPath);
@@ -17113,7 +17184,7 @@ var isDev, isBuildTraceEnabled = () => {
17113
17184
  collectWorkerPathsFromContent(content, pattern, file4, workerPaths);
17114
17185
  }
17115
17186
  }, scanWorkerReferencesInDir = async (dir, patterns, workerPaths) => {
17116
- const glob = new Glob7("**/*.{ts,tsx,js,jsx,svelte,vue}");
17187
+ const glob = new Glob8("**/*.{ts,tsx,js,jsx,svelte,vue}");
17117
17188
  for await (const file4 of glob.scan({ absolute: true, cwd: dir })) {
17118
17189
  const relToDir = file4.slice(dir.length + 1);
17119
17190
  const [firstSegment] = relToDir.split("/");
@@ -17155,7 +17226,7 @@ var isDev, isBuildTraceEnabled = () => {
17155
17226
  return;
17156
17227
  }
17157
17228
  const indexFiles = readDir(reactIndexesPath).filter((file4) => file4.endsWith(".tsx"));
17158
- const pagesRel = relative13(process.cwd(), resolve23(reactPagesPath)).replace(/\\/g, "/");
17229
+ const pagesRel = relative13(process.cwd(), resolve24(reactPagesPath)).replace(/\\/g, "/");
17159
17230
  for (const file4 of indexFiles) {
17160
17231
  let content = readFileSync13(join25(reactIndexesPath, file4), "utf-8");
17161
17232
  content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
@@ -17163,27 +17234,27 @@ var isDev, isBuildTraceEnabled = () => {
17163
17234
  }
17164
17235
  }, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
17165
17236
  const svelteIndexDir = join25(getFrameworkGeneratedDir("svelte"), "indexes");
17166
- const sveltePageEntries = svelteEntries.filter((file4) => resolve23(file4).startsWith(resolve23(sveltePagesPath)));
17237
+ const sveltePageEntries = svelteEntries.filter((file4) => resolve24(file4).startsWith(resolve24(sveltePagesPath)));
17167
17238
  for (const entry of sveltePageEntries) {
17168
17239
  const name = basename8(entry).replace(/\.svelte(\.(ts|js))?$/, "");
17169
17240
  const indexFile = join25(svelteIndexDir, "pages", `${name}.js`);
17170
17241
  if (!existsSync20(indexFile))
17171
17242
  continue;
17172
17243
  let content = readFileSync13(indexFile, "utf-8");
17173
- const srcRel = relative13(process.cwd(), resolve23(entry)).replace(/\\/g, "/");
17244
+ const srcRel = relative13(process.cwd(), resolve24(entry)).replace(/\\/g, "/");
17174
17245
  content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
17175
17246
  writeFileSync7(join25(devIndexDir, `${name}.svelte.js`), content);
17176
17247
  }
17177
17248
  }, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
17178
17249
  const vueIndexDir = join25(getFrameworkGeneratedDir("vue"), "indexes");
17179
- const vuePageEntries = vueEntries.filter((file4) => resolve23(file4).startsWith(resolve23(vuePagesPath)));
17250
+ const vuePageEntries = vueEntries.filter((file4) => resolve24(file4).startsWith(resolve24(vuePagesPath)));
17180
17251
  for (const entry of vuePageEntries) {
17181
17252
  const name = basename8(entry, ".vue");
17182
17253
  const indexFile = join25(vueIndexDir, `${name}.js`);
17183
17254
  if (!existsSync20(indexFile))
17184
17255
  continue;
17185
17256
  let content = readFileSync13(indexFile, "utf-8");
17186
- const srcRel = relative13(process.cwd(), resolve23(entry)).replace(/\\/g, "/");
17257
+ const srcRel = relative13(process.cwd(), resolve24(entry)).replace(/\\/g, "/");
17187
17258
  content = content.replace(/import\s+Comp(?:\s*,\s*\*\s+as\s+\w+)?\s+from\s+['"]([^'"]+)['"]/, (match) => match.replace(/from\s+['"][^'"]+['"]/, `from "/@src/${srcRel}"`));
17188
17259
  writeFileSync7(join25(devIndexDir, `${name}.vue.js`), content);
17189
17260
  }
@@ -17196,7 +17267,7 @@ var isDev, isBuildTraceEnabled = () => {
17196
17267
  const last = allComments[allComments.length - 1];
17197
17268
  if (!last?.[1])
17198
17269
  return JSON.stringify(outputPath);
17199
- const srcPath = resolve23(projectRoot, last[1].replace("/client/", "/").replace(/\.js$/, ".ts"));
17270
+ const srcPath = resolve24(projectRoot, last[1].replace("/client/", "/").replace(/\.js$/, ".ts"));
17200
17271
  return JSON.stringify(srcPath);
17201
17272
  }, QUOTE_CHARS, OPEN_BRACES, CLOSE_BRACES, findFunctionExpressionEnd = (content, startPos) => {
17202
17273
  let depth = 0;
@@ -17521,13 +17592,13 @@ ${content.slice(firstUseIdx)}`;
17521
17592
  const filterToIncrementalEntries = (entryPoints, mapToSource) => {
17522
17593
  if (!isIncremental || !incrementalFiles)
17523
17594
  return entryPoints;
17524
- const normalizedIncremental = new Set(incrementalFiles.map((f2) => resolve23(f2)));
17595
+ const normalizedIncremental = new Set(incrementalFiles.map((f2) => resolve24(f2)));
17525
17596
  const matchingEntries = [];
17526
17597
  for (const entry of entryPoints) {
17527
17598
  const sourceFile = mapToSource(entry);
17528
17599
  if (!sourceFile)
17529
17600
  continue;
17530
- if (!normalizedIncremental.has(resolve23(sourceFile)))
17601
+ if (!normalizedIncremental.has(resolve24(sourceFile)))
17531
17602
  continue;
17532
17603
  matchingEntries.push(entry);
17533
17604
  }
@@ -17542,7 +17613,15 @@ ${content.slice(firstUseIdx)}`;
17542
17613
  recursive: true
17543
17614
  }));
17544
17615
  }
17545
- const tailwindPromise = tailwind && (!isIncremental || normalizedIncrementalFiles?.some(isTailwindCandidate)) ? tracePhase("tailwind/build", () => compileTailwindConfig(tailwind, buildPath, styleTransformConfig)) : undefined;
17616
+ const tailwindPromise = tailwind && (!isIncremental || normalizedIncrementalFiles?.some(isTailwindCandidate)) ? tracePhase("tailwind/build", () => compileTailwindConfig(tailwind, buildPath, styleTransformConfig, computeFrameworkTailwindSources({
17617
+ angularDirectory,
17618
+ emberDirectory,
17619
+ htmlDirectory,
17620
+ htmxDirectory,
17621
+ reactDirectory,
17622
+ svelteDirectory,
17623
+ vueDirectory
17624
+ }), normalizedIncrementalFiles ?? [])) : undefined;
17546
17625
  const emptyConventionResult = {
17547
17626
  conventions: undefined,
17548
17627
  pageFiles: []
@@ -17574,7 +17653,7 @@ ${content.slice(firstUseIdx)}`;
17574
17653
  reactPagesPath ? tracePhase("scan/react-conventions", () => scanConventions(reactPagesPath, "*.tsx")) : emptyConventionResult,
17575
17654
  sveltePagesPath ? tracePhase("scan/svelte-conventions", () => scanConventions(sveltePagesPath, "*.svelte")) : emptyConventionResult,
17576
17655
  vuePagesPath ? tracePhase("scan/vue-conventions", () => scanConventions(vuePagesPath, "*.vue")) : emptyConventionResult,
17577
- angularPagesPath ? tracePhase("scan/angular-conventions", () => scanConventions(angularPagesPath, "*.ts")) : emptyConventionResult,
17656
+ angularPagesPath ? tracePhase("scan/angular-conventions", () => scanConventions(angularPagesPath, "**/*.ts")) : emptyConventionResult,
17578
17657
  emberPagesPath ? tracePhase("scan/ember-conventions", () => scanConventions(emberPagesPath, "*.{gjs,gts,ts}")) : emptyConventionResult,
17579
17658
  tracePhase("scan/html-conventions", async () => Promise.all(htmlConventionDirs.map((dir) => scanConventions(dir, "*.html")))),
17580
17659
  stylesDir ? tracePhase("scan/css", () => scanCssEntryPoints(stylesDir, stylesIgnore)) : []
@@ -17684,7 +17763,7 @@ ${content.slice(firstUseIdx)}`;
17684
17763
  }
17685
17764
  const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/html/") && (f2.endsWith(".html") || isStylePath(f2)));
17686
17765
  const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
17687
- if (entry.startsWith(resolve23(reactIndexesPath))) {
17766
+ if (entry.startsWith(resolve24(reactIndexesPath))) {
17688
17767
  const pageName = basename8(entry, ".tsx");
17689
17768
  return join25(reactPagesPath, `${pageName}.tsx`);
17690
17769
  }
@@ -17791,7 +17870,7 @@ ${content.slice(firstUseIdx)}`;
17791
17870
  const clientPath = islandSvelteClientPaths[idx];
17792
17871
  if (!sourcePath || !clientPath)
17793
17872
  continue;
17794
- islandSvelteClientPathMap.set(resolve23(sourcePath), clientPath);
17873
+ islandSvelteClientPathMap.set(resolve24(sourcePath), clientPath);
17795
17874
  }
17796
17875
  const islandVueClientPathMap = new Map;
17797
17876
  for (let idx = 0;idx < islandVueSources.length; idx++) {
@@ -17799,7 +17878,7 @@ ${content.slice(firstUseIdx)}`;
17799
17878
  const clientPath = islandVueClientPaths[idx];
17800
17879
  if (!sourcePath || !clientPath)
17801
17880
  continue;
17802
- islandVueClientPathMap.set(resolve23(sourcePath), clientPath);
17881
+ islandVueClientPathMap.set(resolve24(sourcePath), clientPath);
17803
17882
  }
17804
17883
  const islandAngularClientPathMap = new Map;
17805
17884
  for (let idx = 0;idx < islandAngularSources.length; idx++) {
@@ -17807,7 +17886,7 @@ ${content.slice(firstUseIdx)}`;
17807
17886
  const clientPath = islandAngularClientPaths[idx];
17808
17887
  if (!sourcePath || !clientPath)
17809
17888
  continue;
17810
- islandAngularClientPathMap.set(resolve23(sourcePath), clientPath);
17889
+ islandAngularClientPathMap.set(resolve24(sourcePath), clientPath);
17811
17890
  }
17812
17891
  const reactConventionSources = collectConventionSourceFiles(conventionsMap.react);
17813
17892
  const svelteConventionSources = collectConventionSourceFiles(conventionsMap.svelte);
@@ -18688,8 +18767,8 @@ __export(exports_dependencyGraph, {
18688
18767
  addFileToGraph: () => addFileToGraph
18689
18768
  });
18690
18769
  import { existsSync as existsSync22, readFileSync as readFileSync14 } from "fs";
18691
- var {Glob: Glob8 } = globalThis.Bun;
18692
- import { resolve as resolve24 } from "path";
18770
+ var {Glob: Glob9 } = globalThis.Bun;
18771
+ import { resolve as resolve25 } from "path";
18693
18772
  var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
18694
18773
  const lower = filePath.toLowerCase();
18695
18774
  if (lower.endsWith(".ts") || lower.endsWith(".tsx") || lower.endsWith(".jsx"))
@@ -18703,8 +18782,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
18703
18782
  if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
18704
18783
  return null;
18705
18784
  }
18706
- const fromDir = resolve24(fromFile, "..");
18707
- const normalized = resolve24(fromDir, importPath);
18785
+ const fromDir = resolve25(fromFile, "..");
18786
+ const normalized = resolve25(fromDir, importPath);
18708
18787
  const extensions = [
18709
18788
  ".ts",
18710
18789
  ".tsx",
@@ -18734,7 +18813,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
18734
18813
  dependents.delete(normalizedPath);
18735
18814
  }
18736
18815
  }, addFileToGraph = (graph, filePath) => {
18737
- const normalizedPath = resolve24(filePath);
18816
+ const normalizedPath = resolve25(filePath);
18738
18817
  if (!existsSync22(normalizedPath))
18739
18818
  return;
18740
18819
  const dependencies = extractDependencies(normalizedPath);
@@ -18748,13 +18827,23 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
18748
18827
  graph.dependents.get(dep)?.add(normalizedPath);
18749
18828
  };
18750
18829
  dependencies.forEach(addDependent);
18830
+ for (const [otherFile, otherDeps] of graph.dependencies) {
18831
+ if (otherFile === normalizedPath)
18832
+ continue;
18833
+ if (otherDeps.has(normalizedPath)) {
18834
+ if (!graph.dependents.has(normalizedPath)) {
18835
+ graph.dependents.set(normalizedPath, new Set);
18836
+ }
18837
+ graph.dependents.get(normalizedPath)?.add(otherFile);
18838
+ }
18839
+ }
18751
18840
  }, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
18752
18841
  const processedFiles = new Set;
18753
- const glob = new Glob8("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
18754
- const resolvedDirs = directories.map((dir) => resolve24(dir)).filter((dir) => existsSync22(dir));
18842
+ const glob = new Glob9("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
18843
+ const resolvedDirs = directories.map((dir) => resolve25(dir)).filter((dir) => existsSync22(dir));
18755
18844
  const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
18756
18845
  for (const file4 of allFiles) {
18757
- const fullPath = resolve24(file4);
18846
+ const fullPath = resolve25(file4);
18758
18847
  if (IGNORED_SEGMENTS.some((seg) => fullPath.includes(seg)))
18759
18848
  continue;
18760
18849
  if (processedFiles.has(fullPath))
@@ -18867,7 +18956,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
18867
18956
  return [];
18868
18957
  }
18869
18958
  }, getAffectedFiles = (graph, changedFile) => {
18870
- const normalizedPath = resolve24(changedFile);
18959
+ const normalizedPath = resolve25(changedFile);
18871
18960
  const affected = new Set;
18872
18961
  const toProcess = [normalizedPath];
18873
18962
  const processNode = (current) => {
@@ -18896,18 +18985,9 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
18896
18985
  }
18897
18986
  graph.dependencies.delete(normalizedPath);
18898
18987
  }, removeDependentsForFile = (graph, normalizedPath) => {
18899
- const dependents = graph.dependents.get(normalizedPath);
18900
- if (!dependents)
18901
- return;
18902
- for (const dependent of dependents) {
18903
- const depList = graph.dependencies.get(dependent);
18904
- if (!depList)
18905
- continue;
18906
- depList.delete(normalizedPath);
18907
- }
18908
18988
  graph.dependents.delete(normalizedPath);
18909
18989
  }, removeFileFromGraph = (graph, filePath) => {
18910
- const normalizedPath = resolve24(filePath);
18990
+ const normalizedPath = resolve25(filePath);
18911
18991
  removeDepsForFile(graph, normalizedPath);
18912
18992
  removeDependentsForFile(graph, normalizedPath);
18913
18993
  };
@@ -18950,12 +19030,12 @@ var globalVersionCounter = 0, createModuleVersionTracker = () => new Map, getNex
18950
19030
  };
18951
19031
 
18952
19032
  // src/dev/configResolver.ts
18953
- import { resolve as resolve25 } from "path";
19033
+ import { resolve as resolve26 } from "path";
18954
19034
  var resolveBuildPaths = (config) => {
18955
19035
  const cwd2 = process.cwd();
18956
19036
  const normalize = (path) => path.replace(/\\/g, "/");
18957
- const withDefault = (value, fallback) => normalize(resolve25(cwd2, value ?? fallback));
18958
- const optional = (value) => value ? normalize(resolve25(cwd2, value)) : undefined;
19037
+ const withDefault = (value, fallback) => normalize(resolve26(cwd2, value ?? fallback));
19038
+ const optional = (value) => value ? normalize(resolve26(cwd2, value)) : undefined;
18959
19039
  return {
18960
19040
  angularDir: optional(config.angularDirectory),
18961
19041
  assetsDir: optional(config.assetsDirectory),
@@ -19009,7 +19089,7 @@ var init_clientManager = __esm(() => {
19009
19089
 
19010
19090
  // src/dev/pathUtils.ts
19011
19091
  import { existsSync as existsSync23, readdirSync, readFileSync as readFileSync15 } from "fs";
19012
- import { dirname as dirname16, resolve as resolve26 } from "path";
19092
+ import { dirname as dirname16, resolve as resolve27 } from "path";
19013
19093
  var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
19014
19094
  if (shouldIgnorePath(filePath, resolved)) {
19015
19095
  return "ignored";
@@ -19085,7 +19165,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
19085
19165
  return "unknown";
19086
19166
  }, collectAngularResourceDirs = (angularDir) => {
19087
19167
  const out = new Set;
19088
- const angularRoot = resolve26(angularDir);
19168
+ const angularRoot = resolve27(angularDir);
19089
19169
  const angularRootNormalized = normalizePath(angularRoot);
19090
19170
  const walk = (dir) => {
19091
19171
  let entries;
@@ -19098,7 +19178,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
19098
19178
  if (entry.name.startsWith(".") || entry.name === "node_modules") {
19099
19179
  continue;
19100
19180
  }
19101
- const full = resolve26(dir, entry.name);
19181
+ const full = resolve27(dir, entry.name);
19102
19182
  if (entry.isDirectory()) {
19103
19183
  walk(full);
19104
19184
  continue;
@@ -19139,7 +19219,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
19139
19219
  }
19140
19220
  const componentDir = dirname16(full);
19141
19221
  for (const ref of refs) {
19142
- const refAbs = normalizePath(resolve26(componentDir, ref));
19222
+ const refAbs = normalizePath(resolve27(componentDir, ref));
19143
19223
  const refDir = normalizePath(dirname16(refAbs));
19144
19224
  if (refDir === angularRootNormalized || refDir.startsWith(angularRootNormalized + "/")) {
19145
19225
  continue;
@@ -19156,7 +19236,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
19156
19236
  const push = (path) => {
19157
19237
  if (!path)
19158
19238
  return;
19159
- const abs = normalizePath(resolve26(cwd2, path));
19239
+ const abs = normalizePath(resolve27(cwd2, path));
19160
19240
  if (!roots.includes(abs))
19161
19241
  roots.push(abs);
19162
19242
  };
@@ -19181,7 +19261,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
19181
19261
  push(cfg.assetsDir);
19182
19262
  push(cfg.stylesDir);
19183
19263
  for (const candidate of ["src", "db", "assets", "styles"]) {
19184
- const abs = normalizePath(resolve26(cwd2, candidate));
19264
+ const abs = normalizePath(resolve27(cwd2, candidate));
19185
19265
  if (existsSync23(abs) && !roots.includes(abs))
19186
19266
  roots.push(abs);
19187
19267
  }
@@ -19193,7 +19273,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
19193
19273
  continue;
19194
19274
  if (entry.name.startsWith("."))
19195
19275
  continue;
19196
- const abs = normalizePath(resolve26(cwd2, entry.name));
19276
+ const abs = normalizePath(resolve27(cwd2, entry.name));
19197
19277
  if (roots.includes(abs))
19198
19278
  continue;
19199
19279
  if (shouldIgnorePath(abs, resolved))
@@ -19267,8 +19347,8 @@ var init_pathUtils = __esm(() => {
19267
19347
 
19268
19348
  // src/dev/fileWatcher.ts
19269
19349
  import { watch } from "fs";
19270
- import { existsSync as existsSync24 } from "fs";
19271
- import { join as join27, resolve as resolve27 } from "path";
19350
+ import { existsSync as existsSync24, readdirSync as readdirSync2, statSync as statSync3 } from "fs";
19351
+ import { dirname as dirname17, join as join27, resolve as resolve28 } from "path";
19272
19352
  var safeRemoveFromGraph = (graph, fullPath) => {
19273
19353
  try {
19274
19354
  removeFileFromGraph(graph, fullPath);
@@ -19287,12 +19367,48 @@ var safeRemoveFromGraph = (graph, fullPath) => {
19287
19367
  operation: "add"
19288
19368
  });
19289
19369
  }
19290
- }, shouldSkipFilename = (filename, isStylesDir) => !isStylesDir && (filename === "compiled" || filename === "generated" || filename === "build" || filename === "indexes" || filename === "server" || filename === "client" || filename.includes("/compiled/") || filename.includes("/generated/") || filename.includes("/build/") || filename.includes("/indexes/") || filename.includes("/server/") || filename.includes("/client/") || filename.startsWith("compiled/") || filename.startsWith("generated/") || filename.startsWith("build/") || filename.startsWith("indexes/") || filename.startsWith("server/") || filename.startsWith("client/")) || filename.endsWith("/") || filename.includes(".tmp.") || filename.endsWith(".tmp") || filename.endsWith("~") || filename.startsWith(".#"), setupWatcher = (absolutePath, isStylesDir, state, onFileChange) => {
19291
- const watcher = watch(absolutePath, { recursive: true }, (event, filename) => {
19292
- if (!filename) {
19370
+ }, ATOMIC_WRITE_TEMP_PATTERNS, shouldSkipFilename = (filename, isStylesDir) => !isStylesDir && (filename === "compiled" || filename === "generated" || filename === "build" || filename === "indexes" || filename === "server" || filename === "client" || filename.includes("/compiled/") || filename.includes("/generated/") || filename.includes("/build/") || filename.includes("/indexes/") || filename.includes("/server/") || filename.includes("/client/") || filename.startsWith("compiled/") || filename.startsWith("generated/") || filename.startsWith("build/") || filename.startsWith("indexes/") || filename.startsWith("server/") || filename.startsWith("client/")) || filename.endsWith("/") || filename.includes(".tmp.") || filename.endsWith(".tmp") || filename.endsWith("~") || filename.startsWith(".#") || ATOMIC_WRITE_TEMP_PATTERNS.some((re2) => re2.test(filename)), setupWatcher = (absolutePath, isStylesDir, state, onFileChange) => {
19371
+ const ATOMIC_RECOVERY_WINDOW_MS = 1000;
19372
+ const recentlySynthesized = new Map;
19373
+ const atomicRecoveryScan = (eventDir) => {
19374
+ let entries;
19375
+ try {
19376
+ entries = readdirSync2(eventDir);
19377
+ } catch {
19293
19378
  return;
19294
19379
  }
19380
+ const now = Date.now();
19381
+ for (const name of entries) {
19382
+ if (shouldSkipFilename(name, isStylesDir))
19383
+ continue;
19384
+ const child = join27(eventDir, name).replace(/\\/g, "/");
19385
+ let st2;
19386
+ try {
19387
+ st2 = statSync3(child);
19388
+ } catch {
19389
+ continue;
19390
+ }
19391
+ if (!st2.isFile())
19392
+ continue;
19393
+ const age = now - st2.ctimeMs;
19394
+ if (age < 0 || age > ATOMIC_RECOVERY_WINDOW_MS)
19395
+ continue;
19396
+ const last = recentlySynthesized.get(child) ?? 0;
19397
+ if (now - last < 100)
19398
+ continue;
19399
+ recentlySynthesized.set(child, now);
19400
+ onFileChange(child);
19401
+ safeAddToGraph(state.dependencyGraph, child);
19402
+ }
19403
+ };
19404
+ const watcher = watch(absolutePath, { recursive: true }, (event, filename) => {
19405
+ if (!filename)
19406
+ return;
19295
19407
  if (shouldSkipFilename(filename, isStylesDir)) {
19408
+ if (event === "rename") {
19409
+ const eventDir = dirname17(join27(absolutePath, filename)).replace(/\\/g, "/");
19410
+ atomicRecoveryScan(eventDir);
19411
+ }
19296
19412
  return;
19297
19413
  }
19298
19414
  const fullPath = join27(absolutePath, filename).replace(/\\/g, "/");
@@ -19313,7 +19429,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
19313
19429
  }, addFileWatchers = (state, paths, onFileChange) => {
19314
19430
  const stylesDir = state.resolvedPaths?.stylesDir;
19315
19431
  paths.forEach((path) => {
19316
- const absolutePath = resolve27(path).replace(/\\/g, "/");
19432
+ const absolutePath = resolve28(path).replace(/\\/g, "/");
19317
19433
  if (!existsSync24(absolutePath)) {
19318
19434
  return;
19319
19435
  }
@@ -19324,7 +19440,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
19324
19440
  const watchPaths = getWatchPaths(config, state.resolvedPaths);
19325
19441
  const stylesDir = state.resolvedPaths?.stylesDir;
19326
19442
  watchPaths.forEach((path) => {
19327
- const absolutePath = resolve27(path).replace(/\\/g, "/");
19443
+ const absolutePath = resolve28(path).replace(/\\/g, "/");
19328
19444
  if (!existsSync24(absolutePath)) {
19329
19445
  return;
19330
19446
  }
@@ -19336,16 +19452,21 @@ var init_fileWatcher = __esm(() => {
19336
19452
  init_telemetryEvent();
19337
19453
  init_dependencyGraph();
19338
19454
  init_pathUtils();
19455
+ ATOMIC_WRITE_TEMP_PATTERNS = [
19456
+ /(^|\/)sed[A-Za-z0-9]{6,}$/,
19457
+ /(^|\/)4913$/,
19458
+ /(^|\/)\.absolutejs-hmr-/
19459
+ ];
19339
19460
  });
19340
19461
 
19341
19462
  // src/dev/assetStore.ts
19342
- import { resolve as resolve28 } from "path";
19463
+ import { resolve as resolve29 } from "path";
19343
19464
  import { readdir as readdir4, unlink } from "fs/promises";
19344
19465
  var mimeTypes, getMimeType = (filePath) => {
19345
19466
  const ext = filePath.slice(filePath.lastIndexOf("."));
19346
19467
  return mimeTypes[ext] ?? "application/octet-stream";
19347
19468
  }, HASHED_FILE_RE, stripHash = (webPath) => webPath.replace(/\.[a-z0-9]{8}(\.(js|css|mjs))$/, "$1"), processWalkEntry = (entry, dir, liveByIdentity, walkAndClean) => {
19348
- const fullPath = resolve28(dir, entry.name);
19469
+ const fullPath = resolve29(dir, entry.name);
19349
19470
  if (entry.isDirectory()) {
19350
19471
  return walkAndClean(fullPath);
19351
19472
  }
@@ -19361,10 +19482,10 @@ var mimeTypes, getMimeType = (filePath) => {
19361
19482
  }, cleanStaleAssets = async (store, manifest, buildDir) => {
19362
19483
  const liveByIdentity = new Map;
19363
19484
  for (const webPath of store.keys()) {
19364
- const diskPath = resolve28(buildDir, webPath.slice(1));
19485
+ const diskPath = resolve29(buildDir, webPath.slice(1));
19365
19486
  liveByIdentity.set(stripHash(diskPath), diskPath);
19366
19487
  }
19367
- const absBuildDir = resolve28(buildDir);
19488
+ const absBuildDir = resolve29(buildDir);
19368
19489
  Object.values(manifest).forEach((val) => {
19369
19490
  if (!HASHED_FILE_RE.test(val))
19370
19491
  return;
@@ -19382,7 +19503,7 @@ var mimeTypes, getMimeType = (filePath) => {
19382
19503
  } catch {}
19383
19504
  }, lookupAsset = (store, path) => store.get(path), processScanEntry = (entry, dir, prefix, store, scanDir) => {
19384
19505
  if (entry.isDirectory()) {
19385
- return scanDir(resolve28(dir, entry.name), `${prefix}${entry.name}/`);
19506
+ return scanDir(resolve29(dir, entry.name), `${prefix}${entry.name}/`);
19386
19507
  }
19387
19508
  if (!entry.name.startsWith("chunk-")) {
19388
19509
  return null;
@@ -19391,7 +19512,7 @@ var mimeTypes, getMimeType = (filePath) => {
19391
19512
  if (store.has(webPath)) {
19392
19513
  return null;
19393
19514
  }
19394
- return Bun.file(resolve28(dir, entry.name)).bytes().then((bytes) => {
19515
+ return Bun.file(resolve29(dir, entry.name)).bytes().then((bytes) => {
19395
19516
  store.set(webPath, bytes);
19396
19517
  return;
19397
19518
  }).catch(() => {});
@@ -19413,7 +19534,7 @@ var mimeTypes, getMimeType = (filePath) => {
19413
19534
  for (const webPath of newIdentities.values()) {
19414
19535
  if (store.has(webPath))
19415
19536
  continue;
19416
- loadPromises.push(Bun.file(resolve28(buildDir, webPath.slice(1))).bytes().then((bytes) => {
19537
+ loadPromises.push(Bun.file(resolve29(buildDir, webPath.slice(1))).bytes().then((bytes) => {
19417
19538
  store.set(webPath, bytes);
19418
19539
  return;
19419
19540
  }).catch(() => {}));
@@ -19444,7 +19565,7 @@ var init_assetStore = __esm(() => {
19444
19565
 
19445
19566
  // src/islands/pageMetadata.ts
19446
19567
  import { readFileSync as readFileSync16 } from "fs";
19447
- import { dirname as dirname17, resolve as resolve29 } from "path";
19568
+ import { dirname as dirname18, resolve as resolve30 } from "path";
19448
19569
  var pagePatterns, getPageDirs = (config) => [
19449
19570
  { dir: config.angularDirectory, framework: "angular" },
19450
19571
  { dir: config.emberDirectory, framework: "ember" },
@@ -19464,15 +19585,15 @@ var pagePatterns, getPageDirs = (config) => [
19464
19585
  const source = definition.buildReference?.source;
19465
19586
  if (!source)
19466
19587
  continue;
19467
- const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve29(dirname17(buildInfo.resolvedRegistryPath), source);
19468
- lookup.set(`${definition.framework}:${definition.component}`, resolve29(resolvedSource));
19588
+ const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve30(dirname18(buildInfo.resolvedRegistryPath), source);
19589
+ lookup.set(`${definition.framework}:${definition.component}`, resolve30(resolvedSource));
19469
19590
  }
19470
19591
  return lookup;
19471
19592
  }, getCurrentPageIslandMetadata = () => globalThis.__absolutePageIslandMetadata ?? new Map, metadataUsesSource = (metadata, target) => metadata.islands.some((usage) => {
19472
19593
  const candidate = usage.source;
19473
- return candidate ? resolve29(candidate) === target : false;
19594
+ return candidate ? resolve30(candidate) === target : false;
19474
19595
  }), getPagesUsingIslandSource = (sourcePath) => {
19475
- const target = resolve29(sourcePath);
19596
+ const target = resolve30(sourcePath);
19476
19597
  return [...getCurrentPageIslandMetadata().values()].filter((metadata) => metadataUsesSource(metadata, target)).map((metadata) => metadata.pagePath);
19477
19598
  }, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage) => {
19478
19599
  const sourcePath = islandSourceLookup.get(`${usage.framework}:${usage.component}`);
@@ -19484,13 +19605,13 @@ var pagePatterns, getPageDirs = (config) => [
19484
19605
  const pattern = pagePatterns[entry.framework];
19485
19606
  if (!pattern)
19486
19607
  return;
19487
- const files = await scanEntryPoints(resolve29(entry.dir), pattern);
19608
+ const files = await scanEntryPoints(resolve30(entry.dir), pattern);
19488
19609
  for (const filePath of files) {
19489
19610
  const source = readFileSync16(filePath, "utf-8");
19490
19611
  const islands = extractIslandUsagesFromSource(source);
19491
- pageMetadata.set(resolve29(filePath), {
19612
+ pageMetadata.set(resolve30(filePath), {
19492
19613
  islands: resolveIslandUsages(islands, islandSourceLookup),
19493
- pagePath: resolve29(filePath)
19614
+ pagePath: resolve30(filePath)
19494
19615
  });
19495
19616
  }
19496
19617
  }, loadPageIslandMetadata = async (config) => {
@@ -19613,9 +19734,9 @@ var init_transformCache = __esm(() => {
19613
19734
  });
19614
19735
 
19615
19736
  // src/dev/reactComponentClassifier.ts
19616
- import { resolve as resolve30 } from "path";
19737
+ import { resolve as resolve31 } from "path";
19617
19738
  var classifyComponent = (filePath) => {
19618
- const normalizedPath = resolve30(filePath);
19739
+ const normalizedPath = resolve31(filePath);
19619
19740
  if (normalizedPath.includes("/react/pages/")) {
19620
19741
  return "server";
19621
19742
  }
@@ -19627,7 +19748,7 @@ var classifyComponent = (filePath) => {
19627
19748
  var init_reactComponentClassifier = () => {};
19628
19749
 
19629
19750
  // src/dev/moduleMapper.ts
19630
- import { basename as basename9, resolve as resolve31 } from "path";
19751
+ import { basename as basename9, resolve as resolve32 } from "path";
19631
19752
  var buildModulePaths = (moduleKeys, manifest) => {
19632
19753
  const modulePaths = {};
19633
19754
  moduleKeys.forEach((key) => {
@@ -19637,7 +19758,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
19637
19758
  });
19638
19759
  return modulePaths;
19639
19760
  }, processChangedFile = (sourceFile, framework, manifest, resolvedPaths, processedFiles) => {
19640
- const normalizedFile = resolve31(sourceFile);
19761
+ const normalizedFile = resolve32(sourceFile);
19641
19762
  const normalizedPath = normalizedFile.replace(/\\/g, "/");
19642
19763
  if (processedFiles.has(normalizedFile)) {
19643
19764
  return null;
@@ -19673,7 +19794,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
19673
19794
  });
19674
19795
  return grouped;
19675
19796
  }, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
19676
- const normalizedFile = resolve31(sourceFile);
19797
+ const normalizedFile = resolve32(sourceFile);
19677
19798
  const fileName = basename9(normalizedFile);
19678
19799
  const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
19679
19800
  const pascalName = toPascal(baseName);
@@ -19734,15 +19855,15 @@ __export(exports_resolveOwningComponents, {
19734
19855
  resolveDescendantsOfParent: () => resolveDescendantsOfParent,
19735
19856
  invalidateResourceIndex: () => invalidateResourceIndex
19736
19857
  });
19737
- import { readdirSync as readdirSync2, readFileSync as readFileSync18, statSync as statSync3 } from "fs";
19738
- import { dirname as dirname18, extname as extname9, join as join28, resolve as resolve32 } from "path";
19858
+ import { readdirSync as readdirSync3, readFileSync as readFileSync18, statSync as statSync4 } from "fs";
19859
+ import { dirname as dirname19, extname as extname9, join as join28, resolve as resolve33 } from "path";
19739
19860
  import ts7 from "typescript";
19740
19861
  var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") || file4.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
19741
19862
  const out = [];
19742
19863
  const visit = (dir) => {
19743
19864
  let entries;
19744
19865
  try {
19745
- entries = readdirSync2(dir, { withFileTypes: true });
19866
+ entries = readdirSync3(dir, { withFileTypes: true });
19746
19867
  } catch {
19747
19868
  return;
19748
19869
  }
@@ -19848,7 +19969,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
19848
19969
  };
19849
19970
  visit(sourceFile);
19850
19971
  return out;
19851
- }, safeNormalize = (path) => resolve32(path).replace(/\\/g, "/"), resolveOwningComponents = (params) => {
19972
+ }, safeNormalize = (path) => resolve33(path).replace(/\\/g, "/"), resolveOwningComponents = (params) => {
19852
19973
  const { changedFilePath, userAngularRoot } = params;
19853
19974
  const changedAbs = safeNormalize(changedFilePath);
19854
19975
  const out = [];
@@ -19869,7 +19990,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
19869
19990
  }
19870
19991
  let rootStat;
19871
19992
  try {
19872
- rootStat = statSync3(userAngularRoot);
19993
+ rootStat = statSync4(userAngularRoot);
19873
19994
  } catch {
19874
19995
  return out;
19875
19996
  }
@@ -19889,7 +20010,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
19889
20010
  return null;
19890
20011
  }
19891
20012
  const sf = ts7.createSourceFile(childFilePath, source, ts7.ScriptTarget.ES2022, true, ts7.ScriptKind.TS);
19892
- const childDir = dirname18(childFilePath);
20013
+ const childDir = dirname19(childFilePath);
19893
20014
  for (const stmt of sf.statements) {
19894
20015
  if (!ts7.isImportDeclaration(stmt))
19895
20016
  continue;
@@ -19917,7 +20038,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
19917
20038
  if (!spec.startsWith(".") && !spec.startsWith("/")) {
19918
20039
  return null;
19919
20040
  }
19920
- const base = resolve32(childDir, spec);
20041
+ const base = resolve33(childDir, spec);
19921
20042
  const candidates = [
19922
20043
  `${base}.ts`,
19923
20044
  `${base}.tsx`,
@@ -19927,7 +20048,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
19927
20048
  const angularRootNorm = safeNormalize(angularRoot);
19928
20049
  for (const candidate of candidates) {
19929
20050
  try {
19930
- if (statSync3(candidate).isFile()) {
20051
+ if (statSync4(candidate).isFile()) {
19931
20052
  const norm = safeNormalize(candidate);
19932
20053
  if (!norm.startsWith(angularRootNorm))
19933
20054
  return null;
@@ -19946,7 +20067,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
19946
20067
  const parentFile = new Map;
19947
20068
  for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
19948
20069
  const classes = parseDecoratedClasses(tsPath);
19949
- const componentDir = dirname18(tsPath);
20070
+ const componentDir = dirname19(tsPath);
19950
20071
  for (const cls of classes) {
19951
20072
  const entity = {
19952
20073
  className: cls.className,
@@ -19955,7 +20076,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
19955
20076
  };
19956
20077
  if (cls.kind === "component") {
19957
20078
  for (const url of [...cls.templateUrls, ...cls.styleUrls]) {
19958
- const abs = safeNormalize(resolve32(componentDir, url));
20079
+ const abs = safeNormalize(resolve33(componentDir, url));
19959
20080
  const existing = resource.get(abs);
19960
20081
  if (existing)
19961
20082
  existing.push(entity);
@@ -19982,7 +20103,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
19982
20103
  const norm = safeNormalize(params.changedFilePath);
19983
20104
  let rootStat;
19984
20105
  try {
19985
- rootStat = statSync3(params.userAngularRoot);
20106
+ rootStat = statSync4(params.userAngularRoot);
19986
20107
  } catch {
19987
20108
  return [];
19988
20109
  }
@@ -20025,6 +20146,13 @@ var isValidHMRClientMessage = (data) => {
20025
20146
  };
20026
20147
 
20027
20148
  // src/dev/webSocket.ts
20149
+ var exports_webSocket = {};
20150
+ __export(exports_webSocket, {
20151
+ handleHMRMessage: () => handleHMRMessage,
20152
+ handleClientDisconnect: () => handleClientDisconnect,
20153
+ handleClientConnect: () => handleClientConnect,
20154
+ broadcastToClients: () => broadcastToClients
20155
+ });
20028
20156
  var trySendMessage = (client, messageStr) => {
20029
20157
  try {
20030
20158
  client.send(messageStr);
@@ -20125,14 +20253,6 @@ var init_webSocket = __esm(() => {
20125
20253
  init_logger();
20126
20254
  });
20127
20255
 
20128
- // src/core/ssrCache.ts
20129
- var dirtyFrameworks, isSsrCacheDirty = (framework) => dirtyFrameworks.has(framework), markSsrCacheDirty = (framework) => {
20130
- dirtyFrameworks.add(framework);
20131
- };
20132
- var init_ssrCache = __esm(() => {
20133
- dirtyFrameworks = new Set;
20134
- });
20135
-
20136
20256
  // src/utils/loadConfig.ts
20137
20257
  var exports_loadConfig = {};
20138
20258
  __export(exports_loadConfig, {
@@ -20141,7 +20261,7 @@ __export(exports_loadConfig, {
20141
20261
  isWorkspaceConfig: () => isWorkspaceConfig,
20142
20262
  getWorkspaceServices: () => getWorkspaceServices
20143
20263
  });
20144
- import { resolve as resolve33 } from "path";
20264
+ import { resolve as resolve34 } from "path";
20145
20265
  var RESERVED_TOP_LEVEL_KEYS, isObject2 = (value) => typeof value === "object" && value !== null, isCommandService = (service) => service.kind === "command" || Array.isArray(service.command), isServiceCandidate = (value) => isObject2(value) && (typeof value.entry === "string" || Array.isArray(value.command)), isWorkspaceConfig = (config) => {
20146
20266
  if (!isObject2(config)) {
20147
20267
  return false;
@@ -20192,7 +20312,7 @@ var RESERVED_TOP_LEVEL_KEYS, isObject2 = (value) => typeof value === "object" &&
20192
20312
  }
20193
20313
  return config;
20194
20314
  }, loadRawConfig = async (configPath2) => {
20195
- const resolved = resolve33(configPath2 ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
20315
+ const resolved = resolve34(configPath2 ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
20196
20316
  const mod = await import(resolved);
20197
20317
  const config = mod.default ?? mod.config;
20198
20318
  if (!config) {
@@ -20252,8 +20372,8 @@ __export(exports_moduleServer, {
20252
20372
  createModuleServer: () => createModuleServer,
20253
20373
  SRC_URL_PREFIX: () => SRC_URL_PREFIX
20254
20374
  });
20255
- import { existsSync as existsSync25, readFileSync as readFileSync19, statSync as statSync4 } from "fs";
20256
- import { basename as basename10, dirname as dirname19, extname as extname10, join as join29, resolve as resolve34, relative as relative14 } from "path";
20375
+ import { existsSync as existsSync25, readFileSync as readFileSync19, statSync as statSync5 } from "fs";
20376
+ import { basename as basename10, dirname as dirname20, extname as extname10, join as join29, resolve as resolve35, relative as relative14 } from "path";
20257
20377
  var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
20258
20378
  const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
20259
20379
  const allExports = [];
@@ -20273,7 +20393,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
20273
20393
  ${stubs}
20274
20394
  `;
20275
20395
  }, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
20276
- const found = extensions.find((ext) => existsSync25(resolve34(projectRoot, srcPath + ext)));
20396
+ const found = extensions.find((ext) => existsSync25(resolve35(projectRoot, srcPath + ext)));
20277
20397
  return found ? srcPath + found : srcPath;
20278
20398
  }, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
20279
20399
  const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
@@ -20288,24 +20408,24 @@ ${stubs}
20288
20408
  return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
20289
20409
  }, srcUrl = (relPath, projectRoot) => {
20290
20410
  const base = `${SRC_PREFIX}${relPath.replace(/\\/g, "/")}`;
20291
- const absPath = resolve34(projectRoot, relPath);
20411
+ const absPath = resolve35(projectRoot, relPath);
20292
20412
  const cached = mtimeCache.get(absPath);
20293
20413
  if (cached !== undefined)
20294
20414
  return `${base}?v=${buildVersion(cached, absPath)}`;
20295
20415
  try {
20296
- const mtime = Math.round(statSync4(absPath).mtimeMs);
20416
+ const mtime = Math.round(statSync5(absPath).mtimeMs);
20297
20417
  mtimeCache.set(absPath, mtime);
20298
20418
  return `${base}?v=${buildVersion(mtime, absPath)}`;
20299
20419
  } catch {
20300
20420
  return base;
20301
20421
  }
20302
20422
  }, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
20303
- const absPath = resolve34(fileDir, relPath);
20423
+ const absPath = resolve35(fileDir, relPath);
20304
20424
  const rel = relative14(projectRoot, absPath);
20305
20425
  const extension = extname10(rel);
20306
20426
  let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
20307
20427
  if (extname10(srcPath) === ".svelte") {
20308
- srcPath = relative14(projectRoot, resolveSvelteModulePath(resolve34(projectRoot, srcPath)));
20428
+ srcPath = relative14(projectRoot, resolveSvelteModulePath(resolve35(projectRoot, srcPath)));
20309
20429
  }
20310
20430
  return srcUrl(srcPath, projectRoot);
20311
20431
  }, NODE_BUILTIN_RE, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
@@ -20324,13 +20444,13 @@ ${stubs}
20324
20444
  const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
20325
20445
  const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
20326
20446
  if (!subpath) {
20327
- const pkgDir = resolve34(projectRoot, "node_modules", packageName ?? "");
20447
+ const pkgDir = resolve35(projectRoot, "node_modules", packageName ?? "");
20328
20448
  const pkgJsonPath = join29(pkgDir, "package.json");
20329
20449
  if (existsSync25(pkgJsonPath)) {
20330
20450
  const pkg = JSON.parse(readFileSync19(pkgJsonPath, "utf-8"));
20331
20451
  const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
20332
20452
  if (esmEntry) {
20333
- const resolved = resolve34(pkgDir, esmEntry);
20453
+ const resolved = resolve35(pkgDir, esmEntry);
20334
20454
  if (existsSync25(resolved))
20335
20455
  return relative14(projectRoot, resolved);
20336
20456
  }
@@ -20362,7 +20482,7 @@ ${stubs}
20362
20482
  };
20363
20483
  result = result.replace(/^((?:import\s+[\s\S]+?\s+from|export\s+[\s\S]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
20364
20484
  result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
20365
- const fileDir = dirname19(filePath);
20485
+ const fileDir = dirname20(filePath);
20366
20486
  result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
20367
20487
  result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
20368
20488
  result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
@@ -20377,12 +20497,12 @@ ${stubs}
20377
20497
  result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, rewriteAbsoluteToSrc);
20378
20498
  result = result.replace(/(import\s*\(\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["']\s*\))/g, rewriteAbsoluteToSrc);
20379
20499
  result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
20380
- const absPath = resolve34(fileDir, relPath);
20500
+ const absPath = resolve35(fileDir, relPath);
20381
20501
  const rel = relative14(projectRoot, absPath);
20382
20502
  return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
20383
20503
  });
20384
20504
  result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
20385
- const absPath = resolve34(fileDir, relPath);
20505
+ const absPath = resolve35(fileDir, relPath);
20386
20506
  const rel = relative14(projectRoot, absPath);
20387
20507
  return `'${srcUrl(rel, projectRoot)}'`;
20388
20508
  });
@@ -20695,7 +20815,7 @@ ${code}`;
20695
20815
  code = injectVueHmr(code, filePath, projectRoot, vueDir);
20696
20816
  return rewriteImports(code, filePath, projectRoot, rewriter);
20697
20817
  }, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
20698
- const hmrBase = vueDir ? resolve34(vueDir) : projectRoot;
20818
+ const hmrBase = vueDir ? resolve35(vueDir) : projectRoot;
20699
20819
  const hmrId = relative14(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
20700
20820
  let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
20701
20821
  result += [
@@ -20859,7 +20979,7 @@ export default {};
20859
20979
  const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
20860
20980
  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);`);
20861
20981
  }, resolveSourcePath = (relPath, projectRoot) => {
20862
- const filePath = resolve34(projectRoot, relPath);
20982
+ const filePath = resolve35(projectRoot, relPath);
20863
20983
  const ext = extname10(filePath);
20864
20984
  if (ext === ".svelte")
20865
20985
  return { ext, filePath: resolveSvelteModulePath(filePath) };
@@ -20896,14 +21016,14 @@ export default {};
20896
21016
  const absoluteCandidate = "/" + tail.replace(/^\/+/, "");
20897
21017
  const candidates = [
20898
21018
  absoluteCandidate,
20899
- resolve34(projectRoot, tail)
21019
+ resolve35(projectRoot, tail)
20900
21020
  ];
20901
21021
  try {
20902
21022
  const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_loadConfig(), exports_loadConfig));
20903
21023
  const cfg = await loadConfig2();
20904
- const angularDir = cfg.angularDirectory && resolve34(projectRoot, cfg.angularDirectory);
21024
+ const angularDir = cfg.angularDirectory && resolve35(projectRoot, cfg.angularDirectory);
20905
21025
  if (angularDir)
20906
- candidates.push(resolve34(angularDir, tail));
21026
+ candidates.push(resolve35(angularDir, tail));
20907
21027
  } catch {}
20908
21028
  for (const candidate of candidates) {
20909
21029
  if (await fileExists(candidate)) {
@@ -20933,8 +21053,8 @@ export default {};
20933
21053
  return transformAndCacheVue(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
20934
21054
  if (!TRANSPILABLE.has(ext))
20935
21055
  return;
20936
- const stat3 = statSync4(filePath);
20937
- const resolvedVueDir = vueDir ? resolve34(vueDir) : undefined;
21056
+ const stat3 = statSync5(filePath);
21057
+ const resolvedVueDir = vueDir ? resolve35(vueDir) : undefined;
20938
21058
  let content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
20939
21059
  const isAngularGeneratedJs = ext === ".js" && filePath.replace(/\\/g, "/").includes("/.absolutejs/generated/angular/");
20940
21060
  if (isAngularGeneratedJs) {
@@ -20961,12 +21081,12 @@ export default {};
20961
21081
  cachedAngularUserRoot = configuredAngularUserRoot ?? null;
20962
21082
  return cachedAngularUserRoot;
20963
21083
  }, configuredAngularUserRoot, transformAndCacheSvelte = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
20964
- const stat3 = statSync4(filePath);
21084
+ const stat3 = statSync5(filePath);
20965
21085
  const content = await transformSvelteFile(filePath, projectRoot, rewriter, stylePreprocessors);
20966
21086
  setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
20967
21087
  return jsResponse(content);
20968
21088
  }, transformAndCacheVue = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
20969
- const stat3 = statSync4(filePath);
21089
+ const stat3 = statSync5(filePath);
20970
21090
  const content = await transformVueFile(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
20971
21091
  setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
20972
21092
  return jsResponse(content);
@@ -20993,7 +21113,7 @@ export default {};
20993
21113
  const relPath = pathname.slice(SRC_PREFIX.length);
20994
21114
  if (relPath === "bun:wrap" || relPath.startsWith("bun:wrap?"))
20995
21115
  return handleBunWrapRequest();
20996
- const virtualCssResponse = handleVirtualSvelteCss(resolve34(projectRoot, relPath));
21116
+ const virtualCssResponse = handleVirtualSvelteCss(resolve35(projectRoot, relPath));
20997
21117
  if (virtualCssResponse)
20998
21118
  return virtualCssResponse;
20999
21119
  const { filePath, ext } = resolveSourcePath(relPath, projectRoot);
@@ -21009,11 +21129,11 @@ export default {};
21009
21129
  SRC_IMPORT_RE.lastIndex = 0;
21010
21130
  while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
21011
21131
  if (match[1])
21012
- files.push(resolve34(projectRoot, match[1]));
21132
+ files.push(resolve35(projectRoot, match[1]));
21013
21133
  }
21014
21134
  return files;
21015
21135
  }, invalidateModule = (filePath) => {
21016
- const resolved = resolve34(filePath);
21136
+ const resolved = resolve35(filePath);
21017
21137
  invalidate(filePath);
21018
21138
  if (resolved !== filePath)
21019
21139
  invalidate(resolved);
@@ -21158,7 +21278,7 @@ __export(exports_hmrCompiler, {
21158
21278
  getApplyMetadataModule: () => getApplyMetadataModule,
21159
21279
  encodeHmrComponentId: () => encodeHmrComponentId
21160
21280
  });
21161
- import { dirname as dirname20, relative as relative15, resolve as resolve35 } from "path";
21281
+ import { dirname as dirname21, relative as relative15, resolve as resolve36 } from "path";
21162
21282
  import { performance as performance2 } from "perf_hooks";
21163
21283
  var getApplyMetadataModule = async (encodedId) => {
21164
21284
  const decoded = decodeURIComponent(encodedId);
@@ -21167,7 +21287,7 @@ var getApplyMetadataModule = async (encodedId) => {
21167
21287
  return null;
21168
21288
  const filePathRel = decoded.slice(0, at2);
21169
21289
  const className = decoded.slice(at2 + 1);
21170
- const componentFilePath = resolve35(process.cwd(), filePathRel);
21290
+ const componentFilePath = resolve36(process.cwd(), filePathRel);
21171
21291
  const projectRelPath = relative15(process.cwd(), componentFilePath).replace(/\\/g, "/");
21172
21292
  const cacheKey2 = encodeURIComponent(`${projectRelPath}@${className}`);
21173
21293
  const { takePendingModule: takePendingModule2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
@@ -21178,7 +21298,7 @@ var getApplyMetadataModule = async (encodedId) => {
21178
21298
  const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
21179
21299
  const owners = resolveOwningComponents2({
21180
21300
  changedFilePath: componentFilePath,
21181
- userAngularRoot: dirname20(componentFilePath)
21301
+ userAngularRoot: dirname21(componentFilePath)
21182
21302
  });
21183
21303
  const owner = owners.find((o3) => o3.className === className);
21184
21304
  const kind = owner?.kind ?? "component";
@@ -21278,7 +21398,6 @@ var resolveRequestPathname = (request) => {
21278
21398
  moduleUrl.searchParams.set("t", String(emberCacheBuster));
21279
21399
  return moduleUrl.href;
21280
21400
  }, invalidateEmberSsrCache = () => {
21281
- markSsrCacheDirty("ember");
21282
21401
  emberCacheBuster = Date.now();
21283
21402
  }, buildHtmlShell = (headTag, bodyContent, indexPath, props) => {
21284
21403
  const propsScript = `window.__INITIAL_PROPS__=${JSON.stringify(props ?? {})};`;
@@ -21292,7 +21411,6 @@ var resolveRequestPathname = (request) => {
21292
21411
  const resolvedHeadTag = headTag ?? "<head></head>";
21293
21412
  try {
21294
21413
  installSimpleDomGlobals();
21295
- isSsrCacheDirty("ember");
21296
21414
  const bundle = await import(buildRuntimeModuleSpecifier(pagePath));
21297
21415
  if (typeof bundle.renderToHTML !== "function") {
21298
21416
  throw new Error(`Ember page bundle at ${pagePath} does not export renderToHTML(). Was it compiled by compileEmber()?`);
@@ -21310,9 +21428,7 @@ var resolveRequestPathname = (request) => {
21310
21428
  });
21311
21429
  }
21312
21430
  };
21313
- var init_pageHandler = __esm(() => {
21314
- init_ssrCache();
21315
- });
21431
+ var init_pageHandler = () => {};
21316
21432
 
21317
21433
  // src/ember/index.ts
21318
21434
  var exports_ember = {};
@@ -21329,11 +21445,11 @@ var exports_simpleHTMLHMR = {};
21329
21445
  __export(exports_simpleHTMLHMR, {
21330
21446
  handleHTMLUpdate: () => handleHTMLUpdate
21331
21447
  });
21332
- import { resolve as resolve36 } from "path";
21448
+ import { resolve as resolve37 } from "path";
21333
21449
  var handleHTMLUpdate = async (htmlFilePath) => {
21334
21450
  let htmlContent;
21335
21451
  try {
21336
- const resolvedPath = resolve36(htmlFilePath);
21452
+ const resolvedPath = resolve37(htmlFilePath);
21337
21453
  const file4 = Bun.file(resolvedPath);
21338
21454
  if (!await file4.exists()) {
21339
21455
  return null;
@@ -21359,11 +21475,11 @@ var exports_simpleHTMXHMR = {};
21359
21475
  __export(exports_simpleHTMXHMR, {
21360
21476
  handleHTMXUpdate: () => handleHTMXUpdate
21361
21477
  });
21362
- import { resolve as resolve37 } from "path";
21478
+ import { resolve as resolve38 } from "path";
21363
21479
  var handleHTMXUpdate = async (htmxFilePath) => {
21364
21480
  let htmlContent;
21365
21481
  try {
21366
- const resolvedPath = resolve37(htmxFilePath);
21482
+ const resolvedPath = resolve38(htmxFilePath);
21367
21483
  const file4 = Bun.file(resolvedPath);
21368
21484
  if (!await file4.exists()) {
21369
21485
  return null;
@@ -21385,19 +21501,20 @@ var handleHTMXUpdate = async (htmxFilePath) => {
21385
21501
  var init_simpleHTMXHMR = () => {};
21386
21502
 
21387
21503
  // src/dev/rebuildTrigger.ts
21388
- import { existsSync as existsSync26 } from "fs";
21389
- import { basename as basename11, dirname as dirname21, relative as relative16, resolve as resolve38, sep as sep4 } from "path";
21504
+ import { existsSync as existsSync26, rmSync as rmSync3 } from "fs";
21505
+ import { basename as basename11, dirname as dirname22, join as join30, relative as relative16, resolve as resolve39, sep as sep4 } from "path";
21390
21506
  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) => {
21391
21507
  if (!config.tailwind)
21392
21508
  return;
21393
21509
  if (!files.some(isTailwindCandidate))
21394
21510
  return;
21395
21511
  try {
21396
- const { cssChanged } = await incrementalTailwindBuild(config.tailwind, state.resolvedPaths.buildDir, files, getStyleTransformConfig(config));
21512
+ const { computeFrameworkTailwindSources: computeFrameworkTailwindSources2 } = await Promise.resolve().then(() => (init_compileTailwind(), exports_compileTailwind));
21513
+ const { cssChanged } = await incrementalTailwindBuild(config.tailwind, state.resolvedPaths.buildDir, files, getStyleTransformConfig(config), computeFrameworkTailwindSources2(config));
21397
21514
  if (!cssChanged)
21398
21515
  return;
21399
21516
  try {
21400
- const outputPath = resolve38(state.resolvedPaths.buildDir, config.tailwind.output);
21517
+ const outputPath = resolve39(state.resolvedPaths.buildDir, config.tailwind.output);
21401
21518
  const bytes = await Bun.file(outputPath).bytes();
21402
21519
  const webPath = `/${config.tailwind.output.replace(/^\/+/, "")}`;
21403
21520
  state.assetStore.set(webPath, bytes);
@@ -21480,11 +21597,39 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21480
21597
  detectedFw = detected !== "ignored" ? detected : affectedFrameworks[0];
21481
21598
  }
21482
21599
  return { ...parsed, framework: detectedFw };
21483
- }, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync26(affectedFile), collectDeletedFileAffected = (state, filePathInSet, processedFiles, validFiles) => {
21600
+ }, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync26(affectedFile), FRAMEWORK_DIR_KEYS_FOR_CLEANUP, removeStaleGenerated = (state, deletedFile) => {
21601
+ const config = state.config;
21602
+ const cwd2 = process.cwd();
21603
+ const absDeleted = resolve39(deletedFile).replace(/\\/g, "/");
21604
+ for (const { configKey, framework } of FRAMEWORK_DIR_KEYS_FOR_CLEANUP) {
21605
+ const dir = config[configKey];
21606
+ if (!dir)
21607
+ continue;
21608
+ const absDir = resolve39(cwd2, dir).replace(/\\/g, "/");
21609
+ if (!absDeleted.startsWith(`${absDir}/`))
21610
+ continue;
21611
+ const rel = absDeleted.slice(absDir.length + 1);
21612
+ const ext = rel.match(/\.(ts|tsx|jsx|svelte|vue|mjs|cjs)$/);
21613
+ if (!ext)
21614
+ return;
21615
+ const relJs = `${rel.slice(0, -ext[0].length)}.js`;
21616
+ const generatedDir = getFrameworkGeneratedDir(framework, cwd2);
21617
+ for (const candidate of [
21618
+ join30(generatedDir, relJs),
21619
+ `${join30(generatedDir, relJs)}.map`
21620
+ ]) {
21621
+ try {
21622
+ rmSync3(candidate, { force: true });
21623
+ } catch {}
21624
+ }
21625
+ return;
21626
+ }
21627
+ }, collectDeletedFileAffected = (state, filePathInSet, processedFiles, validFiles) => {
21484
21628
  state.fileHashes.delete(filePathInSet);
21629
+ removeStaleGenerated(state, filePathInSet);
21485
21630
  try {
21486
21631
  const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
21487
- const deletedPathResolved = resolve38(filePathInSet);
21632
+ const deletedPathResolved = resolve39(filePathInSet);
21488
21633
  affectedFiles.forEach((affectedFile) => {
21489
21634
  if (isValidDeletedAffectedFile(affectedFile, deletedPathResolved, processedFiles)) {
21490
21635
  validFiles.push(affectedFile);
@@ -21528,7 +21673,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21528
21673
  if (storedHash !== undefined && storedHash === fileHash) {
21529
21674
  return;
21530
21675
  }
21531
- const normalizedFilePath = resolve38(filePathInSet);
21676
+ const normalizedFilePath = resolve39(filePathInSet);
21532
21677
  if (!processedFiles.has(normalizedFilePath)) {
21533
21678
  validFiles.push(normalizedFilePath);
21534
21679
  processedFiles.add(normalizedFilePath);
@@ -21656,6 +21801,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21656
21801
  if (framework === "ignored") {
21657
21802
  return;
21658
21803
  }
21804
+ if (/\.(spec|test)\.(?:m?[tj]sx?)$/i.test(filePath) || /[\\/]__tests__[\\/]/.test(filePath)) {
21805
+ return;
21806
+ }
21659
21807
  const currentHash = computeFileHash(filePath);
21660
21808
  if (!hasFileChanged(filePath, currentHash, state.fileHashes)) {
21661
21809
  return;
@@ -21663,7 +21811,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21663
21811
  const publicDir = state.resolvedPaths.publicDir;
21664
21812
  const assetsDir = state.resolvedPaths.assetsDir;
21665
21813
  const handleStaticMirror = async (sourceDir, urlPrefix) => {
21666
- const absSource = resolve38(filePath);
21814
+ const absSource = resolve39(filePath);
21667
21815
  const normalizedSource = absSource.replace(/\\/g, "/");
21668
21816
  const normalizedDir = sourceDir.replace(/\\/g, "/");
21669
21817
  if (!normalizedSource.startsWith(normalizedDir + "/"))
@@ -21671,10 +21819,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21671
21819
  try {
21672
21820
  const relFromDir = normalizedSource.slice(normalizedDir.length + 1);
21673
21821
  const buildDir = state.resolvedPaths.buildDir;
21674
- const destPath = resolve38(buildDir, urlPrefix ? `${urlPrefix}/${relFromDir}` : relFromDir);
21822
+ const destPath = resolve39(buildDir, urlPrefix ? `${urlPrefix}/${relFromDir}` : relFromDir);
21675
21823
  const { mkdir: mkdir7, copyFile, readFile: readFile6 } = await import("fs/promises");
21676
- const { dirname: dirname22 } = await import("path");
21677
- await mkdir7(dirname22(destPath), { recursive: true });
21824
+ const { dirname: dirname23 } = await import("path");
21825
+ await mkdir7(dirname23(destPath), { recursive: true });
21678
21826
  await copyFile(absSource, destPath);
21679
21827
  const bytes = await readFile6(destPath);
21680
21828
  const webPath = urlPrefix ? `/${urlPrefix}/${relFromDir}` : `/${relFromDir}`;
@@ -21697,7 +21845,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21697
21845
  if (assetsDir && await handleStaticMirror(assetsDir, "assets"))
21698
21846
  return;
21699
21847
  if (framework === "unknown") {
21700
- invalidate(resolve38(filePath));
21848
+ invalidate(resolve39(filePath));
21701
21849
  const relPath = relative16(process.cwd(), filePath);
21702
21850
  logHmrUpdate(relPath);
21703
21851
  const angularDir = state.resolvedPaths.angularDir;
@@ -21705,10 +21853,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21705
21853
  if (angularDir && state.dependencyGraph) {
21706
21854
  try {
21707
21855
  const { addFileToGraph: addFileToGraph2 } = await Promise.resolve().then(() => (init_dependencyGraph(), exports_dependencyGraph));
21708
- addFileToGraph2(state.dependencyGraph, resolve38(filePath));
21709
- const affected = getAffectedFiles(state.dependencyGraph, resolve38(filePath));
21856
+ addFileToGraph2(state.dependencyGraph, resolve39(filePath));
21857
+ const affected = getAffectedFiles(state.dependencyGraph, resolve39(filePath));
21710
21858
  for (const dependent of affected) {
21711
- if (dependent === resolve38(filePath))
21859
+ if (dependent === resolve39(filePath))
21712
21860
  continue;
21713
21861
  const dependentFramework = detectFramework(dependent, state.resolvedPaths);
21714
21862
  if (dependentFramework !== "angular")
@@ -21725,13 +21873,14 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21725
21873
  } catch {}
21726
21874
  }
21727
21875
  if (!hasAngularDependent) {
21876
+ console.log(`[abs:restart] ${resolve39(filePath)}`);
21728
21877
  return;
21729
21878
  }
21730
21879
  try {
21731
21880
  const { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 } = await Promise.resolve().then(() => (init_generatedDir(), exports_generatedDir));
21732
21881
  const { invalidateModule: invalidateModuleServer } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
21733
21882
  const generatedAngularRoot = getFrameworkGeneratedDir2("angular");
21734
- const sourceAbs = resolve38(filePath).replace(/\\/g, "/");
21883
+ const sourceAbs = resolve39(filePath).replace(/\\/g, "/");
21735
21884
  const generatedTwin = `${generatedAngularRoot.replace(/\\/g, "/")}${sourceAbs.replace(/\.ts$/, ".js")}`;
21736
21885
  invalidateModuleServer(generatedTwin);
21737
21886
  } catch {}
@@ -21765,7 +21914,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21765
21914
  const userEditedFiles = new Set;
21766
21915
  state.fileChangeQueue.forEach((filePaths) => {
21767
21916
  for (const filePath2 of filePaths) {
21768
- userEditedFiles.add(resolve38(filePath2));
21917
+ userEditedFiles.add(resolve39(filePath2));
21769
21918
  }
21770
21919
  });
21771
21920
  state.lastUserEditedFiles = userEditedFiles;
@@ -21794,7 +21943,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21794
21943
  }
21795
21944
  if (!graph)
21796
21945
  return componentFile;
21797
- const dependents = graph.dependents.get(resolve38(componentFile));
21946
+ const dependents = graph.dependents.get(resolve39(componentFile));
21798
21947
  if (!dependents)
21799
21948
  return componentFile;
21800
21949
  for (const dep of dependents) {
@@ -21803,7 +21952,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21803
21952
  }
21804
21953
  return componentFile;
21805
21954
  }, resolveAngularPageEntries = (state, angularFiles, angularPagesPath) => {
21806
- const pageEntries = angularFiles.filter((file4) => file4.endsWith(".ts") && resolve38(file4).startsWith(angularPagesPath));
21955
+ const pageEntries = angularFiles.filter((file4) => file4.endsWith(".ts") && resolve39(file4).startsWith(angularPagesPath));
21807
21956
  if (pageEntries.length > 0 || !state.dependencyGraph) {
21808
21957
  return pageEntries;
21809
21958
  }
@@ -21812,7 +21961,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21812
21961
  const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
21813
21962
  const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
21814
21963
  affected.forEach((file4) => {
21815
- if (file4.endsWith(".ts") && resolve38(file4).startsWith(angularPagesPath)) {
21964
+ if (file4.endsWith(".ts") && resolve39(file4).startsWith(angularPagesPath)) {
21816
21965
  resolvedPages.add(file4);
21817
21966
  }
21818
21967
  });
@@ -21830,6 +21979,37 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21830
21979
  clientRoots.push(getGeneratedRoot2(projectRoot));
21831
21980
  const { commonAncestor: commonAncestor2 } = await Promise.resolve().then(() => (init_commonAncestor(), exports_commonAncestor));
21832
21981
  return clientRoots.length === 1 ? clientRoots[0] ?? projectRoot : commonAncestor2(clientRoots, projectRoot);
21982
+ }, computeServerOutPaths = async (resolvedPaths, framework) => {
21983
+ const { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 } = await Promise.resolve().then(() => (init_generatedDir(), exports_generatedDir));
21984
+ const { commonAncestor: commonAncestor2 } = await Promise.resolve().then(() => (init_commonAncestor(), exports_commonAncestor));
21985
+ const projectRoot = process.cwd();
21986
+ const serverDirs = [];
21987
+ if (resolvedPaths.svelteDir)
21988
+ serverDirs.push({
21989
+ dir: getFrameworkGeneratedDir2("svelte", projectRoot),
21990
+ subdir: "server"
21991
+ });
21992
+ if (resolvedPaths.vueDir)
21993
+ serverDirs.push({
21994
+ dir: getFrameworkGeneratedDir2("vue", projectRoot),
21995
+ subdir: "server"
21996
+ });
21997
+ if (resolvedPaths.angularDir)
21998
+ serverDirs.push({
21999
+ dir: getFrameworkGeneratedDir2("angular", projectRoot),
22000
+ subdir: ""
22001
+ });
22002
+ if (serverDirs.length <= 1) {
22003
+ const dir = getFrameworkGeneratedDir2(framework, projectRoot);
22004
+ return {
22005
+ serverOutDir: resolve39(resolvedPaths.buildDir, basename11(dir)),
22006
+ serverRoot: resolve39(dir, "server")
22007
+ };
22008
+ }
22009
+ return {
22010
+ serverOutDir: resolvedPaths.buildDir,
22011
+ serverRoot: commonAncestor2(serverDirs.map((entry) => entry.dir), projectRoot)
22012
+ };
21833
22013
  }, updateServerManifestEntry = (state, artifact) => {
21834
22014
  const fileWithHash = basename11(artifact.path);
21835
22015
  const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
@@ -21837,6 +22017,46 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21837
22017
  return;
21838
22018
  }
21839
22019
  state.manifest[toPascal(baseName)] = artifact.path;
22020
+ }, pruneStaleHashedSiblings = async (freshOutputs) => {
22021
+ if (!freshOutputs?.length)
22022
+ return;
22023
+ const { readdir: readdir5, unlink: unlink2 } = await import("fs/promises");
22024
+ const keepByDir = new Map;
22025
+ const prefixByDir = new Map;
22026
+ for (const artifact of freshOutputs) {
22027
+ const dir = dirname22(artifact.path);
22028
+ const name = basename11(artifact.path);
22029
+ const [prefix] = name.split(".");
22030
+ if (!prefix)
22031
+ continue;
22032
+ if (!keepByDir.has(dir))
22033
+ keepByDir.set(dir, new Set);
22034
+ if (!prefixByDir.has(dir))
22035
+ prefixByDir.set(dir, new Set);
22036
+ keepByDir.get(dir).add(name);
22037
+ prefixByDir.get(dir).add(prefix);
22038
+ }
22039
+ await Promise.all(Array.from(keepByDir.entries()).map(async ([dir, keep]) => {
22040
+ const prefixes = prefixByDir.get(dir);
22041
+ if (!prefixes)
22042
+ return;
22043
+ const entries = await readdir5(dir).catch(() => []);
22044
+ await Promise.all(entries.map(async (entryName) => {
22045
+ if (keep.has(entryName))
22046
+ return;
22047
+ if (!entryName.endsWith(".js"))
22048
+ return;
22049
+ const parts = entryName.split(".");
22050
+ if (parts.length !== 3)
22051
+ return;
22052
+ const [base] = parts;
22053
+ if (!base || !prefixes.has(base))
22054
+ return;
22055
+ try {
22056
+ await unlink2(`${dir}/${entryName}`);
22057
+ } catch {}
22058
+ }));
22059
+ }));
21840
22060
  }, bundleAngularClient = async (state, clientPaths, buildDir, userAngularRoot) => {
21841
22061
  const { build: bunBuild9 } = await Promise.resolve(globalThis.Bun);
21842
22062
  const { generateManifest: generateManifest2 } = await Promise.resolve().then(() => (init_generateManifest(), exports_generateManifest));
@@ -21934,8 +22154,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21934
22154
  if (detected !== "unknown")
21935
22155
  continue;
21936
22156
  try {
21937
- const affected = getAffectedFiles(state.dependencyGraph, resolve38(editedFile));
21938
- const hasAngularConsumer = affected.some((dep) => dep !== resolve38(editedFile) && detectFramework(dep, state.resolvedPaths) === "angular");
22157
+ const affected = getAffectedFiles(state.dependencyGraph, resolve39(editedFile));
22158
+ const hasAngularConsumer = affected.some((dep) => dep !== resolve39(editedFile) && detectFramework(dep, state.resolvedPaths) === "angular");
21939
22159
  if (hasAngularConsumer) {
21940
22160
  return {
21941
22161
  kind: "rebootstrap",
@@ -21982,7 +22202,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21982
22202
  }
21983
22203
  if (owners.length === 0 && (editedFile.endsWith(".ts") || editedFile.endsWith(".json")) && !editedFile.endsWith(".d.ts")) {
21984
22204
  const normalized = editedFile.replace(/\\/g, "/");
21985
- const angularDirAbs = resolve38(angularDir).replace(/\\/g, "/");
22205
+ const angularDirAbs = resolve39(angularDir).replace(/\\/g, "/");
21986
22206
  if (normalized.startsWith(angularDirAbs + "/")) {
21987
22207
  return {
21988
22208
  kind: "rebootstrap",
@@ -22110,7 +22330,6 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22110
22330
  if (pageEntries.length === 0)
22111
22331
  return;
22112
22332
  await compileAndBundleAngular(state, pageEntries, angularDir);
22113
- markSsrCacheDirty("angular");
22114
22333
  };
22115
22334
  const drive = async () => {
22116
22335
  try {
@@ -22126,16 +22345,16 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22126
22345
  };
22127
22346
  const fire = () => {
22128
22347
  ctx.debounceTimer = null;
22129
- const resolve39 = ctx.debouncedResolve;
22348
+ const resolve40 = ctx.debouncedResolve;
22130
22349
  ctx.debouncedResolve = null;
22131
22350
  ctx.debouncedPromise = null;
22132
22351
  if (ctx.inFlight) {
22133
22352
  ctx.pending = true;
22134
- ctx.inFlight.finally(() => resolve39?.());
22353
+ ctx.inFlight.finally(() => resolve40?.());
22135
22354
  return;
22136
22355
  }
22137
22356
  ctx.inFlight = drive();
22138
- ctx.inFlight.finally(() => resolve39?.());
22357
+ ctx.inFlight.finally(() => resolve40?.());
22139
22358
  };
22140
22359
  return ({ immediate = false } = {}) => {
22141
22360
  if (!ctx.debouncedPromise) {
@@ -22162,16 +22381,16 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22162
22381
  const diskRefreshPromise = (async () => {
22163
22382
  if (!angularDir || editedFiles.size === 0)
22164
22383
  return;
22165
- const angularDirAbs = resolve38(angularDir);
22384
+ const angularDirAbs = resolve39(angularDir);
22166
22385
  const filesUnderAngular = Array.from(editedFiles).filter((file4) => {
22167
- const abs = resolve38(file4);
22386
+ const abs = resolve39(file4);
22168
22387
  return abs === angularDirAbs || abs.startsWith(angularDirAbs + sep4);
22169
22388
  });
22170
22389
  if (filesUnderAngular.length === 0)
22171
22390
  return;
22172
22391
  try {
22173
22392
  const [
22174
- { compileAngularFileJIT: compileAngularFileJIT2 },
22393
+ { compileAngularFileJIT: compileAngularFileJIT2, invalidateAngularJitCache: invalidateAngularJitCache2 },
22175
22394
  { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 },
22176
22395
  { resolveOwningComponents: resolveOwningComponents2 }
22177
22396
  ] = await Promise.all([
@@ -22186,7 +22405,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22186
22405
  if (!ext)
22187
22406
  continue;
22188
22407
  if (ext === ".ts" || ext === ".tsx") {
22189
- tsFilesToRefresh.add(resolve38(file4));
22408
+ tsFilesToRefresh.add(resolve39(file4));
22190
22409
  continue;
22191
22410
  }
22192
22411
  const owners = resolveOwningComponents2({
@@ -22194,19 +22413,22 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22194
22413
  userAngularRoot: angularDirAbs
22195
22414
  });
22196
22415
  for (const owner of owners) {
22197
- tsFilesToRefresh.add(resolve38(owner.componentFilePath));
22416
+ tsFilesToRefresh.add(resolve39(owner.componentFilePath));
22198
22417
  }
22199
22418
  }
22200
22419
  if (tsFilesToRefresh.size === 0)
22201
22420
  return;
22202
- await Promise.all(Array.from(tsFilesToRefresh).map((file4) => compileAngularFileJIT2(file4, compiledRoot, angularDirAbs, getStyleTransformConfig(state.config), String(Date.now())).catch((err) => {
22203
- logWarn(`[hmr] disk-refresh JIT failed for ${file4}: ${err instanceof Error ? err.message : String(err)}`);
22204
- })));
22421
+ await Promise.all(Array.from(tsFilesToRefresh).map((file4) => {
22422
+ invalidateAngularJitCache2(file4);
22423
+ return compileAngularFileJIT2(file4, compiledRoot, angularDirAbs, getStyleTransformConfig(state.config)).catch((err) => {
22424
+ logWarn(`[hmr] disk-refresh JIT failed for ${file4}: ${err instanceof Error ? err.message : String(err)}`);
22425
+ });
22426
+ }));
22205
22427
  try {
22206
22428
  const { invalidateModule: invalidateModule2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
22207
22429
  for (const tsFile of tsFilesToRefresh) {
22208
22430
  const rel = relative16(angularDirAbs, tsFile).replace(/\\/g, "/").replace(/\.[tj]sx?$/, ".js");
22209
- const compiledFile = resolve38(compiledRoot, rel);
22431
+ const compiledFile = resolve39(compiledRoot, rel);
22210
22432
  invalidateModule2(compiledFile);
22211
22433
  }
22212
22434
  } catch {}
@@ -22222,12 +22444,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22222
22444
  try {
22223
22445
  const { primeComponentFingerprint: primeComponentFingerprint2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
22224
22446
  const { readdir: readdir5 } = await import("fs/promises");
22225
- const { join: join30 } = await import("path");
22447
+ const { join: join31 } = await import("path");
22226
22448
  const walk = async (dir) => {
22227
22449
  const entries = await readdir5(dir, { withFileTypes: true });
22228
22450
  const files = [];
22229
22451
  for (const entry of entries) {
22230
- const full = join30(dir, entry.name);
22452
+ const full = join31(dir, entry.name);
22231
22453
  if (entry.isDirectory()) {
22232
22454
  files.push(...await walk(full));
22233
22455
  } else if (entry.isFile() && entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts")) {
@@ -22257,18 +22479,22 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22257
22479
  serverPaths.forEach((serverPath, idx) => {
22258
22480
  const fileBase = basename11(serverPath, ".js");
22259
22481
  const ssrPath = ssrPaths[idx] ?? serverPath;
22260
- state.manifest[toPascal(fileBase)] = resolve38(ssrPath);
22482
+ state.manifest[toPascal(fileBase)] = resolve39(ssrPath);
22261
22483
  });
22262
22484
  if (clientPaths.length > 0) {
22263
22485
  await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir, angularDir);
22264
22486
  }
22487
+ broadcastToClients(state, {
22488
+ data: { manifest: state.manifest },
22489
+ type: "angular-tier-zero-ssr-rebuild-complete"
22490
+ });
22265
22491
  }, handleAngularFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
22266
22492
  const angularDir = config.angularDirectory ?? "";
22267
22493
  const angularFiles = filesToRebuild.filter((file4) => detectFramework(file4, state.resolvedPaths) === "angular");
22268
22494
  for (const file4 of angularFiles) {
22269
- state.fileHashes.set(resolve38(file4), computeFileHash(file4));
22495
+ state.fileHashes.set(resolve39(file4), computeFileHash(file4));
22270
22496
  }
22271
- const angularPagesPath = resolve38(angularDir, "pages");
22497
+ const angularPagesPath = resolve39(angularDir, "pages");
22272
22498
  const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
22273
22499
  const tierStart = performance.now();
22274
22500
  const verdict = await decideAngularTier(state, angularDir);
@@ -22280,6 +22506,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22280
22506
  broadcastSurgical(state, verdict.queue);
22281
22507
  const b2 = verdict.breakdown;
22282
22508
  logInfo(`[ng-hmr] tier-0 ${queueDescription(verdict.queue)} (server ${tierMs}ms: imports ${b2.importsMs}/resolve ${b2.resolveMs}/compile ${b2.compileMs}; awaiting client apply)`);
22509
+ runBundle();
22283
22510
  } else if (verdict.tier === 1 && verdict.kind === "remount") {
22284
22511
  await runAngularHmrIncremental(state, angularDir, pageEntries);
22285
22512
  broadcastRemount(state, verdict.queue);
@@ -22307,13 +22534,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22307
22534
  if (isComponentFile2)
22308
22535
  return primaryFile;
22309
22536
  const { findNearestComponent: findNearestComponent2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
22310
- const nearest = findNearestComponent2(resolve38(primaryFile));
22537
+ const nearest = findNearestComponent2(resolve39(primaryFile));
22311
22538
  return nearest ?? primaryFile;
22312
22539
  }, handleReactModuleServerPath = async (state, reactFiles, startTime, onRebuildComplete) => {
22313
22540
  for (const file4 of reactFiles) {
22314
- state.fileHashes.set(resolve38(file4), computeFileHash(file4));
22541
+ state.fileHashes.set(resolve39(file4), computeFileHash(file4));
22315
22542
  }
22316
- markSsrCacheDirty("react");
22317
22543
  const primaryFile = reactFiles.find((file4) => !file4.replace(/\\/g, "/").includes("/pages/")) ?? reactFiles[0];
22318
22544
  if (!primaryFile) {
22319
22545
  onRebuildComplete({
@@ -22391,23 +22617,136 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22391
22617
  },
22392
22618
  type: "svelte-update"
22393
22619
  });
22394
- }, handleSvelteModuleServerPath = async (state, svelteFiles, startTime, onRebuildComplete) => {
22620
+ }, handleSvelteModuleServerPath = async (state, svelteFiles, config, startTime, onRebuildComplete) => {
22395
22621
  for (const file4 of svelteFiles) {
22396
- state.fileHashes.set(resolve38(file4), computeFileHash(file4));
22622
+ state.fileHashes.set(resolve39(file4), computeFileHash(file4));
22397
22623
  }
22398
- markSsrCacheDirty("svelte");
22399
22624
  const serverDuration = Date.now() - startTime;
22400
22625
  await runSequentially(svelteFiles, (changedFile) => broadcastSvelteModuleUpdate(state, changedFile, svelteFiles, serverDuration));
22626
+ scheduleSvelteBundleRebuild(state, svelteFiles, config)();
22401
22627
  onRebuildComplete({
22402
22628
  hmrState: state,
22403
22629
  manifest: state.manifest
22404
22630
  });
22405
22631
  return state.manifest;
22632
+ }, SVELTE_BUNDLE_DEBOUNCE_MS = 2000, svelteBundleState, vueBundleState, getOrCreateBundleCtx = (store, state) => {
22633
+ let ctx = store.get(state);
22634
+ if (!ctx) {
22635
+ ctx = {
22636
+ debouncedPromise: null,
22637
+ debouncedResolve: null,
22638
+ debounceTimer: null,
22639
+ inFlight: null,
22640
+ pending: false,
22641
+ pendingFiles: new Set
22642
+ };
22643
+ store.set(state, ctx);
22644
+ }
22645
+ return ctx;
22646
+ }, runSvelteBundleRebuild = async (state, svelteFiles, config) => {
22647
+ if (svelteFiles.length === 0)
22648
+ return;
22649
+ const svelteDir = config.svelteDirectory ?? "";
22650
+ if (!svelteDir)
22651
+ return;
22652
+ const { buildDir } = state.resolvedPaths;
22653
+ const { compileSvelte: compileSvelte2 } = await Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte));
22654
+ const { build: bunBuild9 } = await Promise.resolve(globalThis.Bun);
22655
+ const clientRoot = await computeClientRoot(state.resolvedPaths);
22656
+ const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true, getStyleTransformConfig(state.config));
22657
+ const serverEntries = [...svelteServerPaths];
22658
+ const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
22659
+ const { serverRoot, serverOutDir } = await computeServerOutPaths(state.resolvedPaths, "svelte");
22660
+ const [serverResult, clientResult] = await Promise.all([
22661
+ serverEntries.length > 0 ? bunBuild9({
22662
+ entrypoints: serverEntries,
22663
+ external: [
22664
+ "react",
22665
+ "react/*",
22666
+ "react-dom",
22667
+ "react-dom/*",
22668
+ "svelte",
22669
+ "svelte/*"
22670
+ ],
22671
+ format: "esm",
22672
+ naming: "[dir]/[name].[hash].[ext]",
22673
+ outdir: serverOutDir,
22674
+ plugins: [
22675
+ createStylePreprocessorPlugin(getStyleTransformConfig(state.config))
22676
+ ],
22677
+ root: serverRoot,
22678
+ target: "bun",
22679
+ throw: false
22680
+ }) : undefined,
22681
+ clientEntries.length > 0 ? bunBuild9({
22682
+ entrypoints: clientEntries,
22683
+ format: "esm",
22684
+ naming: "[dir]/[name].[hash].[ext]",
22685
+ outdir: buildDir,
22686
+ plugins: [
22687
+ createStylePreprocessorPlugin(getStyleTransformConfig(state.config))
22688
+ ],
22689
+ root: clientRoot,
22690
+ target: "browser",
22691
+ throw: false
22692
+ }) : undefined
22693
+ ]);
22694
+ handleServerManifestUpdate(state, serverResult);
22695
+ await handleClientManifestUpdate(state, clientResult, buildDir);
22696
+ await pruneStaleHashedSiblings(serverResult?.outputs);
22697
+ broadcastToClients(state, {
22698
+ data: { manifest: state.manifest },
22699
+ type: "svelte-tier-zero-ssr-rebuild-complete"
22700
+ });
22701
+ }, scheduleSvelteBundleRebuild = (state, svelteFiles, config) => {
22702
+ const ctx = getOrCreateBundleCtx(svelteBundleState, state);
22703
+ for (const file4 of svelteFiles)
22704
+ ctx.pendingFiles.add(file4);
22705
+ const drive = async () => {
22706
+ try {
22707
+ while (true) {
22708
+ ctx.pending = false;
22709
+ const filesSnapshot = Array.from(ctx.pendingFiles);
22710
+ ctx.pendingFiles.clear();
22711
+ if (filesSnapshot.length === 0)
22712
+ break;
22713
+ await runSvelteBundleRebuild(state, filesSnapshot, config);
22714
+ if (!ctx.pending)
22715
+ break;
22716
+ }
22717
+ } finally {
22718
+ ctx.inFlight = null;
22719
+ }
22720
+ };
22721
+ const fire = () => {
22722
+ ctx.debounceTimer = null;
22723
+ const resolveFn = ctx.debouncedResolve;
22724
+ ctx.debouncedResolve = null;
22725
+ ctx.debouncedPromise = null;
22726
+ if (ctx.inFlight) {
22727
+ ctx.pending = true;
22728
+ ctx.inFlight.finally(() => resolveFn?.());
22729
+ return;
22730
+ }
22731
+ ctx.inFlight = drive();
22732
+ ctx.inFlight.finally(() => resolveFn?.());
22733
+ };
22734
+ return () => {
22735
+ if (!ctx.debouncedPromise) {
22736
+ ctx.debouncedPromise = new Promise((res) => {
22737
+ ctx.debouncedResolve = res;
22738
+ });
22739
+ }
22740
+ if (ctx.debounceTimer)
22741
+ clearTimeout(ctx.debounceTimer);
22742
+ ctx.debounceTimer = setTimeout(fire, SVELTE_BUNDLE_DEBOUNCE_MS);
22743
+ return ctx.debouncedPromise;
22744
+ };
22406
22745
  }, handleSvelteFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
22407
22746
  const svelteDir = config.svelteDirectory ?? "";
22408
22747
  const svelteFiles = filesToRebuild.filter((file4) => (file4.endsWith(".svelte") || file4.includes(".svelte.")) && detectFramework(file4, state.resolvedPaths) === "svelte");
22409
22748
  if (svelteFiles.length > 0) {
22410
- return handleSvelteModuleServerPath(state, svelteFiles, startTime, onRebuildComplete);
22749
+ return handleSvelteModuleServerPath(state, svelteFiles, config, startTime, onRebuildComplete);
22411
22750
  }
22412
22751
  const { buildDir } = state.resolvedPaths;
22413
22752
  if (svelteFiles.length > 0) {
@@ -22417,9 +22756,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22417
22756
  const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true, getStyleTransformConfig(state.config));
22418
22757
  const serverEntries = [...svelteServerPaths];
22419
22758
  const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
22420
- const { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 } = await Promise.resolve().then(() => (init_generatedDir(), exports_generatedDir));
22421
- const serverRoot = resolve38(getFrameworkGeneratedDir2("svelte"), "server");
22422
- const serverOutDir = resolve38(buildDir, basename11(svelteDir));
22759
+ const { serverRoot, serverOutDir } = await computeServerOutPaths(state.resolvedPaths, "svelte");
22423
22760
  const [serverResult, clientResult] = await Promise.all([
22424
22761
  serverEntries.length > 0 ? bunBuild9({
22425
22762
  entrypoints: serverEntries,
@@ -22514,26 +22851,131 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22514
22851
  },
22515
22852
  type: "vue-update"
22516
22853
  });
22517
- }, handleVueModuleServerPath = async (state, vueFiles, nonVueFiles, startTime, onRebuildComplete) => {
22854
+ }, handleVueModuleServerPath = async (state, vueFiles, nonVueFiles, config, startTime, onRebuildComplete) => {
22518
22855
  for (const file4 of [...vueFiles, ...nonVueFiles]) {
22519
- state.fileHashes.set(resolve38(file4), computeFileHash(file4));
22856
+ state.fileHashes.set(resolve39(file4), computeFileHash(file4));
22520
22857
  }
22521
- markSsrCacheDirty("vue");
22522
22858
  await invalidateNonVueModules(nonVueFiles);
22523
22859
  const serverDuration = Date.now() - startTime;
22524
22860
  const forceReload = nonVueFiles.length > 0;
22525
22861
  await runSequentially(vueFiles, (changedFile) => broadcastVueModuleUpdate(state, changedFile, vueFiles, nonVueFiles, forceReload, serverDuration));
22862
+ scheduleVueBundleRebuild(state, vueFiles, config)();
22526
22863
  onRebuildComplete({
22527
22864
  hmrState: state,
22528
22865
  manifest: state.manifest
22529
22866
  });
22530
22867
  return state.manifest;
22868
+ }, VUE_BUNDLE_DEBOUNCE_MS = 2000, runVueBundleRebuild = async (state, vueFiles, config) => {
22869
+ if (vueFiles.length === 0)
22870
+ return;
22871
+ const vueDir = config.vueDirectory ?? "";
22872
+ if (!vueDir)
22873
+ return;
22874
+ const { buildDir } = state.resolvedPaths;
22875
+ const { compileVue: compileVue2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
22876
+ const { build: bunBuild9 } = await Promise.resolve(globalThis.Bun);
22877
+ const clientRoot = await computeClientRoot(state.resolvedPaths);
22878
+ const { vueServerPaths, vueIndexPaths, vueClientPaths, vueCssPaths } = await compileVue2(vueFiles, vueDir, true, getStyleTransformConfig(state.config));
22879
+ const serverEntries = [...vueServerPaths];
22880
+ const clientEntries = [...vueIndexPaths, ...vueClientPaths];
22881
+ const cssOutDir = join30(buildDir, state.resolvedPaths.assetsDir ? basename11(state.resolvedPaths.assetsDir) : "assets", "css");
22882
+ const { serverRoot, serverOutDir } = await computeServerOutPaths(state.resolvedPaths, "vue");
22883
+ const [serverResult, clientResult, cssResult] = await Promise.all([
22884
+ serverEntries.length > 0 ? bunBuild9({
22885
+ entrypoints: serverEntries,
22886
+ external: ["vue", "vue/*", "@vue/*"],
22887
+ format: "esm",
22888
+ naming: "[dir]/[name].[hash].[ext]",
22889
+ outdir: serverOutDir,
22890
+ plugins: [
22891
+ createStylePreprocessorPlugin(getStyleTransformConfig(state.config))
22892
+ ],
22893
+ root: serverRoot,
22894
+ target: "bun",
22895
+ throw: false
22896
+ }) : undefined,
22897
+ clientEntries.length > 0 ? bunBuild9({
22898
+ entrypoints: clientEntries,
22899
+ format: "esm",
22900
+ naming: "[dir]/[name].[hash].[ext]",
22901
+ outdir: buildDir,
22902
+ plugins: [
22903
+ createStylePreprocessorPlugin(getStyleTransformConfig(state.config))
22904
+ ],
22905
+ root: clientRoot,
22906
+ target: "browser",
22907
+ throw: false
22908
+ }) : undefined,
22909
+ vueCssPaths.length > 0 ? bunBuild9({
22910
+ entrypoints: vueCssPaths,
22911
+ naming: "[name].[hash].[ext]",
22912
+ outdir: cssOutDir,
22913
+ plugins: [
22914
+ createStylePreprocessorPlugin(getStyleTransformConfig(state.config))
22915
+ ],
22916
+ target: "browser",
22917
+ throw: false
22918
+ }) : undefined
22919
+ ]);
22920
+ handleServerManifestUpdate(state, serverResult);
22921
+ await handleClientManifestUpdate(state, clientResult, buildDir);
22922
+ await handleClientManifestUpdate(state, cssResult, buildDir);
22923
+ await pruneStaleHashedSiblings(serverResult?.outputs);
22924
+ await pruneStaleHashedSiblings(cssResult?.outputs);
22925
+ broadcastToClients(state, {
22926
+ data: { manifest: state.manifest },
22927
+ type: "vue-tier-zero-ssr-rebuild-complete"
22928
+ });
22929
+ }, scheduleVueBundleRebuild = (state, vueFiles, config) => {
22930
+ const ctx = getOrCreateBundleCtx(vueBundleState, state);
22931
+ for (const file4 of vueFiles)
22932
+ ctx.pendingFiles.add(file4);
22933
+ const drive = async () => {
22934
+ try {
22935
+ while (true) {
22936
+ ctx.pending = false;
22937
+ const filesSnapshot = Array.from(ctx.pendingFiles);
22938
+ ctx.pendingFiles.clear();
22939
+ if (filesSnapshot.length === 0)
22940
+ break;
22941
+ await runVueBundleRebuild(state, filesSnapshot, config);
22942
+ if (!ctx.pending)
22943
+ break;
22944
+ }
22945
+ } finally {
22946
+ ctx.inFlight = null;
22947
+ }
22948
+ };
22949
+ const fire = () => {
22950
+ ctx.debounceTimer = null;
22951
+ const resolveFn = ctx.debouncedResolve;
22952
+ ctx.debouncedResolve = null;
22953
+ ctx.debouncedPromise = null;
22954
+ if (ctx.inFlight) {
22955
+ ctx.pending = true;
22956
+ ctx.inFlight.finally(() => resolveFn?.());
22957
+ return;
22958
+ }
22959
+ ctx.inFlight = drive();
22960
+ ctx.inFlight.finally(() => resolveFn?.());
22961
+ };
22962
+ return () => {
22963
+ if (!ctx.debouncedPromise) {
22964
+ ctx.debouncedPromise = new Promise((res) => {
22965
+ ctx.debouncedResolve = res;
22966
+ });
22967
+ }
22968
+ if (ctx.debounceTimer)
22969
+ clearTimeout(ctx.debounceTimer);
22970
+ ctx.debounceTimer = setTimeout(fire, VUE_BUNDLE_DEBOUNCE_MS);
22971
+ return ctx.debouncedPromise;
22972
+ };
22531
22973
  }, handleVueFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
22532
22974
  const vueFiles = filesToRebuild.filter((file4) => file4.endsWith(".vue") && detectFramework(file4, state.resolvedPaths) === "vue");
22533
22975
  const nonVueFiles = filesToRebuild.filter((file4) => !file4.endsWith(".vue") && detectFramework(file4, state.resolvedPaths) === "vue");
22534
22976
  collectAffectedVueFiles(state, nonVueFiles, vueFiles);
22535
22977
  if (vueFiles.length > 0) {
22536
- return handleVueModuleServerPath(state, vueFiles, nonVueFiles, startTime, onRebuildComplete);
22978
+ return handleVueModuleServerPath(state, vueFiles, nonVueFiles, config, startTime, onRebuildComplete);
22537
22979
  }
22538
22980
  onRebuildComplete({ hmrState: state, manifest: state.manifest });
22539
22981
  return state.manifest;
@@ -22544,7 +22986,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22544
22986
  recursive: true,
22545
22987
  withFileTypes: true
22546
22988
  });
22547
- return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) => resolve38(emberPagesPath, entry.name));
22989
+ return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) => resolve39(emberPagesPath, entry.name));
22548
22990
  } catch {
22549
22991
  return [];
22550
22992
  }
@@ -22556,10 +22998,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22556
22998
  return state.manifest;
22557
22999
  }
22558
23000
  for (const file4 of emberFiles) {
22559
- state.fileHashes.set(resolve38(file4), computeFileHash(file4));
23001
+ state.fileHashes.set(resolve39(file4), computeFileHash(file4));
22560
23002
  }
22561
- const emberPagesPath = resolve38(emberDir, "pages");
22562
- const directPageEntries = emberFiles.filter((file4) => resolve38(file4).startsWith(emberPagesPath));
23003
+ const emberPagesPath = resolve39(emberDir, "pages");
23004
+ const directPageEntries = emberFiles.filter((file4) => resolve39(file4).startsWith(emberPagesPath));
22563
23005
  const allPageEntries = directPageEntries.length > 0 ? directPageEntries : await collectAllEmberPages(emberPagesPath);
22564
23006
  if (allPageEntries.length === 0) {
22565
23007
  onRebuildComplete({ hmrState: state, manifest: state.manifest });
@@ -22569,7 +23011,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22569
23011
  const { serverPaths } = await compileEmber2(allPageEntries, emberDir, process.cwd(), true);
22570
23012
  for (const serverPath of serverPaths) {
22571
23013
  const fileBase = basename11(serverPath, ".js");
22572
- state.manifest[toPascal(fileBase)] = resolve38(serverPath);
23014
+ state.manifest[toPascal(fileBase)] = resolve39(serverPath);
22573
23015
  }
22574
23016
  const { invalidateEmberSsrCache: invalidateEmberSsrCache2 } = await Promise.resolve().then(() => (init_ember(), exports_ember));
22575
23017
  invalidateEmberSsrCache2();
@@ -22661,8 +23103,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22661
23103
  if (!buildReference?.source) {
22662
23104
  return;
22663
23105
  }
22664
- const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve38(dirname21(buildInfo.resolvedRegistryPath), buildReference.source);
22665
- islandFiles.add(resolve38(sourcePath));
23106
+ const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve39(dirname22(buildInfo.resolvedRegistryPath), buildReference.source);
23107
+ islandFiles.add(resolve39(sourcePath));
22666
23108
  }, resolveIslandSourceFiles = async (config) => {
22667
23109
  const registryPath = config.islands?.registry;
22668
23110
  if (!registryPath) {
@@ -22670,7 +23112,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22670
23112
  }
22671
23113
  const buildInfo = await loadIslandRegistryBuildInfo(registryPath);
22672
23114
  const islandFiles = new Set([
22673
- resolve38(buildInfo.resolvedRegistryPath)
23115
+ resolve39(buildInfo.resolvedRegistryPath)
22674
23116
  ]);
22675
23117
  for (const definition of buildInfo.definitions) {
22676
23118
  resolveIslandDefinitionSource(definition, buildInfo, islandFiles);
@@ -22681,7 +23123,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22681
23123
  if (islandFiles.size === 0) {
22682
23124
  return false;
22683
23125
  }
22684
- return filesToRebuild.some((file4) => islandFiles.has(resolve38(file4)));
23126
+ return filesToRebuild.some((file4) => islandFiles.has(resolve39(file4)));
22685
23127
  }, handleIslandSourceReload = async (state, config, filesToRebuild, manifest) => {
22686
23128
  const shouldReload = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
22687
23129
  if (!shouldReload) {
@@ -22716,10 +23158,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22716
23158
  }, computeOutputPagesDir = (state, config, framework) => {
22717
23159
  const isSingle = !config.reactDirectory && !config.svelteDirectory && !config.vueDirectory && (framework === "html" ? !config.htmxDirectory : !config.htmlDirectory);
22718
23160
  if (isSingle) {
22719
- return resolve38(state.resolvedPaths.buildDir, "pages");
23161
+ return resolve39(state.resolvedPaths.buildDir, "pages");
22720
23162
  }
22721
23163
  const dirName = framework === "html" ? basename11(config.htmlDirectory ?? "html") : basename11(config.htmxDirectory ?? "htmx");
22722
- return resolve38(state.resolvedPaths.buildDir, dirName, "pages");
23164
+ return resolve39(state.resolvedPaths.buildDir, dirName, "pages");
22723
23165
  }, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
22724
23166
  try {
22725
23167
  const { handleHTMLUpdate: handleHTMLUpdate2 } = await Promise.resolve().then(() => (init_simpleHTMLHMR(), exports_simpleHTMLHMR));
@@ -22758,7 +23200,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22758
23200
  const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
22759
23201
  await runSequentially(pageFilesToUpdate, async (pageFile) => {
22760
23202
  const htmlPageName = basename11(pageFile);
22761
- const builtHtmlPagePath = resolve38(outputHtmlPages, htmlPageName);
23203
+ const builtHtmlPagePath = resolve39(outputHtmlPages, htmlPageName);
22762
23204
  await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
22763
23205
  });
22764
23206
  }, handleVueCssOnlyUpdate = (state, vueCssFiles, manifest, duration) => {
@@ -22823,7 +23265,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22823
23265
  const cssKey = `${pascalName}CSS`;
22824
23266
  const cssUrl = manifest[cssKey] || null;
22825
23267
  const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
22826
- const hmrMeta = vueHmrMetadata2.get(resolve38(vuePagePath));
23268
+ const hmrMeta = vueHmrMetadata2.get(resolve39(vuePagePath));
22827
23269
  const changeType = hmrMeta?.changeType ?? "full";
22828
23270
  if (changeType === "style-only") {
22829
23271
  broadcastVueStyleOnly(state, vuePagePath, baseName, cssUrl, hmrId, manifest, duration);
@@ -23008,7 +23450,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
23008
23450
  const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
23009
23451
  await runSequentially(pageFilesToUpdate, async (htmxPageFile) => {
23010
23452
  const htmxPageName = basename11(htmxPageFile);
23011
- const builtHtmxPagePath = resolve38(outputHtmxPages, htmxPageName);
23453
+ const builtHtmxPagePath = resolve39(outputHtmxPages, htmxPageName);
23012
23454
  await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
23013
23455
  });
23014
23456
  }, collectUpdatedModulePaths = (allModuleUpdates) => {
@@ -23117,7 +23559,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
23117
23559
  html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
23118
23560
  writeFs(destPath, html);
23119
23561
  }, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
23120
- const destPath = resolve38(outputDir, basename11(sourceFile));
23562
+ const destPath = resolve39(outputDir, basename11(sourceFile));
23121
23563
  const hmrScript = extractHmrScript(destPath, readFs);
23122
23564
  const source = await Bun.file(sourceFile).text();
23123
23565
  await Bun.write(destPath, source);
@@ -23258,6 +23700,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
23258
23700
  type: "rebuild-complete"
23259
23701
  });
23260
23702
  if (config.tailwind && filesToRebuild && filesToRebuild.some(isTailwindCandidate)) {
23703
+ try {
23704
+ const outputPath = resolve39(state.resolvedPaths.buildDir, config.tailwind.output);
23705
+ const bytes = await Bun.file(outputPath).bytes();
23706
+ const webPath = `/${config.tailwind.output.replace(/^\/+/, "")}`;
23707
+ state.assetStore.set(webPath, bytes);
23708
+ } catch {}
23261
23709
  broadcastToClients(state, {
23262
23710
  data: { framework: "tailwind", manifest },
23263
23711
  message: "Tailwind utilities recompiled",
@@ -23274,18 +23722,6 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
23274
23722
  await handleFullBuildHMR(state, config, affectedFrameworks, filesToRebuild, manifest, duration);
23275
23723
  }
23276
23724
  broadcastFrameworkUpdates(state, affectedFrameworks, filesToRebuild, manifest, startTime);
23277
- if (affectedFrameworks.includes("angular")) {
23278
- markSsrCacheDirty("angular");
23279
- }
23280
- if (affectedFrameworks.includes("react")) {
23281
- markSsrCacheDirty("react");
23282
- }
23283
- if (affectedFrameworks.includes("svelte")) {
23284
- markSsrCacheDirty("svelte");
23285
- }
23286
- if (affectedFrameworks.includes("vue")) {
23287
- markSsrCacheDirty("vue");
23288
- }
23289
23725
  onRebuildComplete({ hmrState: state, manifest });
23290
23726
  return manifest;
23291
23727
  }, drainPendingQueue = (state, config, onRebuildComplete) => {
@@ -23368,6 +23804,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
23368
23804
  }
23369
23805
  };
23370
23806
  var init_rebuildTrigger = __esm(() => {
23807
+ init_generatedDir();
23371
23808
  init_build();
23372
23809
  init_scanEntryPoints();
23373
23810
  init_islandEntries();
@@ -23387,8 +23824,14 @@ var init_rebuildTrigger = __esm(() => {
23387
23824
  init_stylePreprocessor();
23388
23825
  init_compileTailwind();
23389
23826
  init_tailwindCompiler();
23390
- init_ssrCache();
23391
23827
  moduleServerPromise = Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
23828
+ FRAMEWORK_DIR_KEYS_FOR_CLEANUP = [
23829
+ { configKey: "reactDirectory", framework: "react" },
23830
+ { configKey: "svelteDirectory", framework: "svelte" },
23831
+ { configKey: "vueDirectory", framework: "vue" },
23832
+ { configKey: "emberDirectory", framework: "ember" },
23833
+ { configKey: "angularDirectory", framework: "angular" }
23834
+ ];
23392
23835
  USER_FIXABLE_FAST_HMR_REASONS = new Set([
23393
23836
  "template-parse-error",
23394
23837
  "template-resource-not-found",
@@ -23396,6 +23839,8 @@ var init_rebuildTrigger = __esm(() => {
23396
23839
  ]);
23397
23840
  angularBundleState = new WeakMap;
23398
23841
  getReactModuleUrl = getModuleUrl;
23842
+ svelteBundleState = new WeakMap;
23843
+ vueBundleState = new WeakMap;
23399
23844
  EMBER_PAGE_EXTENSIONS = [".gts", ".gjs", ".ts", ".js"];
23400
23845
  HMR_SCRIPT_PATTERN = /<script>window\.__HMR_FRAMEWORK__[\s\S]*?<\/script>\s*<script data-hmr-client>[\s\S]*?<\/script>/;
23401
23846
  STYLE_FILE_EXT_RE = /\.(?:css|scss|sass|less|styl|stylus)$/i;
@@ -23428,9 +23873,9 @@ __export(exports_buildDepVendor, {
23428
23873
  buildDepVendor: () => buildDepVendor
23429
23874
  });
23430
23875
  import { mkdirSync as mkdirSync13 } from "fs";
23431
- import { join as join30 } from "path";
23876
+ import { join as join31 } from "path";
23432
23877
  import { rm as rm10 } from "fs/promises";
23433
- var {build: bunBuild9, Glob: Glob9 } = globalThis.Bun;
23878
+ var {build: bunBuild9, Glob: Glob10 } = globalThis.Bun;
23434
23879
  var toSafeFileName6 = (specifier) => {
23435
23880
  const prefix = specifier.startsWith("@") ? "_" : "";
23436
23881
  return prefix + specifier.replace(/\//g, "_").replace(/@/g, "").replace(/-/g, "_");
@@ -23456,7 +23901,7 @@ var toSafeFileName6 = (specifier) => {
23456
23901
  return { dep, framework };
23457
23902
  }, scanDirFiles = async (dir) => {
23458
23903
  const empty = [];
23459
- const glob = new Glob9("**/*.{ts,tsx,js,jsx}");
23904
+ const glob = new Glob10("**/*.{ts,tsx,js,jsx}");
23460
23905
  try {
23461
23906
  const all = await Array.fromAsync(glob.scan({ absolute: true, cwd: dir }));
23462
23907
  return all.filter((file4) => !isSkippedFile(file4));
@@ -23539,7 +23984,7 @@ var toSafeFileName6 = (specifier) => {
23539
23984
  }), buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
23540
23985
  const entries = await Promise.all(specifiers.map(async (specifier) => {
23541
23986
  const safeName = toSafeFileName6(specifier);
23542
- const entryPath = join30(tmpDir, `${safeName}.ts`);
23987
+ const entryPath = join31(tmpDir, `${safeName}.ts`);
23543
23988
  await Bun.write(entryPath, await generateVendorEntrySource(specifier));
23544
23989
  return { entryPath, specifier };
23545
23990
  }));
@@ -23600,9 +24045,9 @@ var toSafeFileName6 = (specifier) => {
23600
24045
  const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
23601
24046
  if (initialSpecs.length === 0 && frameworkRoots.length === 0)
23602
24047
  return {};
23603
- const vendorDir = join30(buildDir, "vendor");
24048
+ const vendorDir = join31(buildDir, "vendor");
23604
24049
  mkdirSync13(vendorDir, { recursive: true });
23605
- const tmpDir = join30(buildDir, "_dep_vendor_tmp");
24050
+ const tmpDir = join31(buildDir, "_dep_vendor_tmp");
23606
24051
  mkdirSync13(tmpDir, { recursive: true });
23607
24052
  const allSpecs = new Set(initialSpecs);
23608
24053
  const alreadyScanned = new Set;
@@ -23681,11 +24126,12 @@ var init_buildDepVendor = __esm(() => {
23681
24126
  // src/core/devBuild.ts
23682
24127
  var exports_devBuild = {};
23683
24128
  __export(exports_devBuild, {
23684
- devBuild: () => devBuild
24129
+ devBuild: () => devBuild,
24130
+ applyConfigChanges: () => applyConfigChanges
23685
24131
  });
23686
24132
  import { readdir as readdir5 } from "fs/promises";
23687
- import { statSync as statSync5 } from "fs";
23688
- import { resolve as resolve39 } from "path";
24133
+ import { statSync as statSync6 } from "fs";
24134
+ import { resolve as resolve40 } from "path";
23689
24135
  var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
23690
24136
  const configuredDirs = [
23691
24137
  config.reactDirectory,
@@ -23708,7 +24154,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
23708
24154
  return Object.keys(config).length > 0 ? config : null;
23709
24155
  }, reloadConfig = async () => {
23710
24156
  try {
23711
- const configPath2 = resolve39(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
24157
+ const configPath2 = resolve40(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
23712
24158
  const source = await Bun.file(configPath2).text();
23713
24159
  return parseDirectoryConfig(source);
23714
24160
  } catch {
@@ -23717,12 +24163,28 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
23717
24163
  }, detectConfigChanges = async (cached) => {
23718
24164
  const newConfig = await reloadConfig();
23719
24165
  if (!newConfig)
23720
- return;
24166
+ return { added: [], removed: [] };
23721
24167
  const state = cached.hmrState;
23722
24168
  const oldConfig = state.config;
23723
- const hasChanges = FRAMEWORK_DIR_KEYS.some((key) => newConfig[key] !== oldConfig[key]);
23724
- if (!hasChanges)
23725
- return;
24169
+ const added = [];
24170
+ const removed = [];
24171
+ for (const key of FRAMEWORK_DIR_KEYS) {
24172
+ const oldVal = oldConfig[key];
24173
+ const newVal = newConfig[key];
24174
+ if (oldVal === newVal)
24175
+ continue;
24176
+ if (!oldVal && newVal)
24177
+ added.push(key);
24178
+ else if (oldVal && !newVal)
24179
+ removed.push(key);
24180
+ else if (oldVal && newVal) {
24181
+ removed.push(key);
24182
+ added.push(key);
24183
+ }
24184
+ }
24185
+ if (added.length === 0 && removed.length === 0) {
24186
+ return { added: [], removed: [] };
24187
+ }
23726
24188
  const oldWatchPaths = new Set(getWatchPaths(oldConfig, state.resolvedPaths));
23727
24189
  for (const key of FRAMEWORK_DIR_KEYS) {
23728
24190
  state.config[key] = newConfig[key];
@@ -23754,6 +24216,12 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
23754
24216
  });
23755
24217
  });
23756
24218
  }
24219
+ return { added, removed };
24220
+ }, applyConfigChanges = async () => {
24221
+ const cached = globalThis.__hmrDevResult;
24222
+ if (!cached)
24223
+ return null;
24224
+ return detectConfigChanges(cached);
23757
24225
  }, removeStaleKeys = (target, source) => {
23758
24226
  for (const key of Object.keys(target)) {
23759
24227
  if (!(key in source))
@@ -23793,7 +24261,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
23793
24261
  state.fileChangeQueue.clear();
23794
24262
  }
23795
24263
  }, handleCachedReload = async () => {
23796
- const serverMtime = statSync5(resolve39(Bun.main)).mtimeMs;
24264
+ const serverMtime = statSync6(resolve40(Bun.main)).mtimeMs;
23797
24265
  const lastMtime = globalThis.__hmrServerMtime;
23798
24266
  globalThis.__hmrServerMtime = serverMtime;
23799
24267
  const cached = globalThis.__hmrDevResult;
@@ -23830,8 +24298,8 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
23830
24298
  return true;
23831
24299
  }, resolveAbsoluteVersion2 = async () => {
23832
24300
  const candidates = [
23833
- resolve39(import.meta.dir, "..", "..", "package.json"),
23834
- resolve39(import.meta.dir, "..", "package.json")
24301
+ resolve40(import.meta.dir, "..", "..", "package.json"),
24302
+ resolve40(import.meta.dir, "..", "package.json")
23835
24303
  ];
23836
24304
  const [candidate, ...remaining] = candidates;
23837
24305
  if (!candidate) {
@@ -23857,7 +24325,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
23857
24325
  const entries = await readdir5(vendorDir).catch(() => emptyStringArray);
23858
24326
  await Promise.all(entries.filter((entry) => entry.endsWith(".js")).map(async (entry) => {
23859
24327
  const webPath = `/${framework}/vendor/${entry}`;
23860
- const bytes = await Bun.file(resolve39(vendorDir, entry)).bytes();
24328
+ const bytes = await Bun.file(resolve40(vendorDir, entry)).bytes();
23861
24329
  assetStore.set(webPath, bytes);
23862
24330
  }));
23863
24331
  }, devBuild = async (config) => {
@@ -23925,11 +24393,11 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
23925
24393
  cleanStaleAssets(state.assetStore, manifest, state.resolvedPaths.buildDir);
23926
24394
  recordStep("populate asset store", stepStartedAt);
23927
24395
  stepStartedAt = performance.now();
23928
- const reactVendorDir = resolve39(state.resolvedPaths.buildDir, "react", "vendor");
23929
- const angularVendorDir = resolve39(state.resolvedPaths.buildDir, "angular", "vendor");
23930
- const svelteVendorDir = resolve39(state.resolvedPaths.buildDir, "svelte", "vendor");
23931
- const vueVendorDir = resolve39(state.resolvedPaths.buildDir, "vue", "vendor");
23932
- const depVendorDir = resolve39(state.resolvedPaths.buildDir, "vendor");
24396
+ const reactVendorDir = resolve40(state.resolvedPaths.buildDir, "react", "vendor");
24397
+ const angularVendorDir = resolve40(state.resolvedPaths.buildDir, "angular", "vendor");
24398
+ const svelteVendorDir = resolve40(state.resolvedPaths.buildDir, "svelte", "vendor");
24399
+ const vueVendorDir = resolve40(state.resolvedPaths.buildDir, "vue", "vendor");
24400
+ const depVendorDir = resolve40(state.resolvedPaths.buildDir, "vendor");
23933
24401
  const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
23934
24402
  const [, angularSpecs, , , , , depPaths] = await Promise.all([
23935
24403
  config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
@@ -23986,8 +24454,11 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
23986
24454
  recordStep("warm compilers", stepStartedAt);
23987
24455
  if (config.tailwind) {
23988
24456
  stepStartedAt = performance.now();
23989
- const { warmTailwindCompiler: warmTailwindCompiler2 } = await Promise.resolve().then(() => (init_tailwindCompiler(), exports_tailwindCompiler));
23990
- await warmTailwindCompiler2(config.tailwind);
24457
+ const [{ warmTailwindCompiler: warmTailwindCompiler2 }, { computeFrameworkTailwindSources: computeFrameworkTailwindSources2 }] = await Promise.all([
24458
+ Promise.resolve().then(() => (init_tailwindCompiler(), exports_tailwindCompiler)),
24459
+ Promise.resolve().then(() => (init_compileTailwind(), exports_compileTailwind))
24460
+ ]);
24461
+ await warmTailwindCompiler2(config.tailwind, computeFrameworkTailwindSources2(config));
23991
24462
  recordStep("warm tailwind compiler", stepStartedAt);
23992
24463
  }
23993
24464
  state.manifest = manifest;
@@ -24007,7 +24478,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
24007
24478
  manifest
24008
24479
  };
24009
24480
  globalThis.__hmrDevResult = result;
24010
- globalThis.__hmrServerMtime = statSync5(resolve39(Bun.main)).mtimeMs;
24481
+ globalThis.__hmrServerMtime = statSync6(resolve40(Bun.main)).mtimeMs;
24011
24482
  return result;
24012
24483
  };
24013
24484
  var init_devBuild = __esm(() => {
@@ -24036,6 +24507,9 @@ var init_devBuild = __esm(() => {
24036
24507
  ];
24037
24508
  });
24038
24509
 
24510
+ // types/websocket.ts
24511
+ var WS_READY_STATE_OPEN = 1;
24512
+
24039
24513
  // src/build.ts
24040
24514
  init_build();
24041
24515
  init_devBuild();
@@ -24044,5 +24518,5 @@ export {
24044
24518
  build
24045
24519
  };
24046
24520
 
24047
- //# debugId=23D5B57CAFDE1D0564756E2164756E21
24521
+ //# debugId=E187E589A388125A64756E2164756E21
24048
24522
  //# sourceMappingURL=build.js.map