@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/index.js CHANGED
@@ -140,6 +140,9 @@ var isValidHMRClientMessage = (data) => {
140
140
  }
141
141
  };
142
142
 
143
+ // types/websocket.ts
144
+ var WS_READY_STATE_OPEN = 1;
145
+
143
146
  // src/build/stylePreprocessor.ts
144
147
  var exports_stylePreprocessor = {};
145
148
  __export(exports_stylePreprocessor, {
@@ -5698,13 +5701,17 @@ var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async ()
5698
5701
  const path = id.startsWith(".") || isAbsolute2(id) ? resolve3(base, id) : Bun.resolveSync(id, base);
5699
5702
  const module = await import(path);
5700
5703
  return { base: dirname3(path), module, path };
5701
- }, buildCompilerEntry = async (cssPath) => {
5704
+ }, buildCompilerEntry = async (cssPath, extraSources = []) => {
5702
5705
  const compile = await loadTailwindCompile();
5703
5706
  const absPath = resolve3(cssPath);
5704
- const css = await readFile2(absPath, "utf-8");
5707
+ const userCss = await readFile2(absPath, "utf-8");
5705
5708
  const cssMtimeMs = (await stat(absPath)).mtimeMs;
5706
5709
  const cssDependencies = new Map;
5707
5710
  cssDependencies.set(absPath, cssMtimeMs);
5711
+ const sourceDirectives = extraSources.map((pattern) => `@source ${JSON.stringify(pattern)};`).join(`
5712
+ `);
5713
+ const css = sourceDirectives ? `${sourceDirectives}
5714
+ ${userCss}` : userCss;
5708
5715
  const compiler = await compile(css, {
5709
5716
  base: dirname3(absPath),
5710
5717
  loadModule,
@@ -5826,12 +5833,12 @@ var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async ()
5826
5833
  });
5827
5834
  const results = await Promise.all(checks);
5828
5835
  return results.some(Boolean);
5829
- }, getCompilerEntry = async (cssPath) => {
5836
+ }, getCompilerEntry = async (cssPath, extraSources = []) => {
5830
5837
  const key = resolve3(cssPath);
5831
5838
  const cached = compilerCache.get(key);
5832
5839
  if (cached && !await isCompilerStale(cached))
5833
5840
  return cached;
5834
- const fresh = await buildCompilerEntry(cssPath);
5841
+ const fresh = await buildCompilerEntry(cssPath, extraSources);
5835
5842
  await populateCandidatesFromAllSources(fresh);
5836
5843
  compilerCache.set(key, fresh);
5837
5844
  return fresh;
@@ -5841,9 +5848,9 @@ var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async ()
5841
5848
  return;
5842
5849
  }
5843
5850
  compilerCache.delete(resolve3(cssPath));
5844
- }, incrementalTailwindBuild = async (tailwind, buildPath, changedFiles, styleTransformConfig) => {
5851
+ }, incrementalTailwindBuild = async (tailwind, buildPath, changedFiles, styleTransformConfig, extraSources = []) => {
5845
5852
  const startedAt = performance.now();
5846
- const entry = await getCompilerEntry(tailwind.input);
5853
+ const entry = await getCompilerEntry(tailwind.input, extraSources);
5847
5854
  const inputAbs = entry.cssPath;
5848
5855
  const filesToRescan = [];
5849
5856
  for (const file of changedFiles) {
@@ -5866,8 +5873,8 @@ var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async ()
5866
5873
  await Bun.write(outputPath, finalCss);
5867
5874
  entry.lastEmittedHash = hash;
5868
5875
  return { cssChanged: true, durationMs };
5869
- }, warmTailwindCompiler = async (tailwind) => {
5870
- await getCompilerEntry(tailwind.input);
5876
+ }, warmTailwindCompiler = async (tailwind, extraSources = []) => {
5877
+ await getCompilerEntry(tailwind.input, extraSources);
5871
5878
  };
5872
5879
  var init_tailwindCompiler = __esm(() => {
5873
5880
  init_stylePreprocessor();
@@ -5876,13 +5883,38 @@ var init_tailwindCompiler = __esm(() => {
5876
5883
  });
5877
5884
 
5878
5885
  // src/build/compileTailwind.ts
5886
+ var exports_compileTailwind = {};
5887
+ __export(exports_compileTailwind, {
5888
+ isTailwindCandidate: () => isTailwindCandidate,
5889
+ computeFrameworkTailwindSources: () => computeFrameworkTailwindSources,
5890
+ compileTailwindConfig: () => compileTailwindConfig,
5891
+ compileTailwind: () => compileTailwind
5892
+ });
5879
5893
  import { mkdir } from "fs/promises";
5880
- import { dirname as dirname4, join as join4 } from "path";
5881
- var TAILWIND_CANDIDATE_EXTENSION_PATTERN, isTailwindCandidate = (filePath) => TAILWIND_CANDIDATE_EXTENSION_PATTERN.test(filePath), compileTailwind = async (input, output, buildPath, styleTransformConfig) => {
5894
+ import { dirname as dirname4, join as join4, resolve as resolve4 } from "path";
5895
+ var computeFrameworkTailwindSources = (config) => {
5896
+ const cwd = process.cwd();
5897
+ const dirs = [
5898
+ [config.angularDirectory, "**/*.{ts,tsx,html,htm}"],
5899
+ [config.svelteDirectory, "**/*.{ts,tsx,svelte,html,htm}"],
5900
+ [config.vueDirectory, "**/*.{ts,tsx,vue,html,htm}"],
5901
+ [config.reactDirectory, "**/*.{ts,tsx,js,jsx,html,htm}"],
5902
+ [config.htmlDirectory, "**/*.{html,htm}"],
5903
+ [config.htmxDirectory, "**/*.{html,htm,js,ts}"],
5904
+ [config.emberDirectory, "**/*.{ts,tsx,gts,gjs,hbs,html,htm}"]
5905
+ ];
5906
+ const out = [];
5907
+ for (const [dir, glob] of dirs) {
5908
+ if (!dir)
5909
+ continue;
5910
+ out.push(`${resolve4(cwd, dir)}/${glob}`);
5911
+ }
5912
+ return out;
5913
+ }, TAILWIND_CANDIDATE_EXTENSION_PATTERN, isTailwindCandidate = (filePath) => TAILWIND_CANDIDATE_EXTENSION_PATTERN.test(filePath), compileTailwind = async (input, output, buildPath, styleTransformConfig, extraSources = [], changedFiles = []) => {
5882
5914
  const outputPath = join4(buildPath, output);
5883
5915
  await mkdir(dirname4(outputPath), { recursive: true });
5884
- await incrementalTailwindBuild({ input, output }, buildPath, [], styleTransformConfig);
5885
- }, compileTailwindConfig = async (tailwind, buildPath, styleTransformConfig) => compileTailwind(tailwind.input, tailwind.output, buildPath, styleTransformConfig);
5916
+ await incrementalTailwindBuild({ input, output }, buildPath, changedFiles, styleTransformConfig, extraSources);
5917
+ }, compileTailwindConfig = async (tailwind, buildPath, styleTransformConfig, extraSources = [], changedFiles = []) => compileTailwind(tailwind.input, tailwind.output, buildPath, styleTransformConfig, extraSources, changedFiles);
5886
5918
  var init_compileTailwind = __esm(() => {
5887
5919
  init_tailwindCompiler();
5888
5920
  TAILWIND_CANDIDATE_EXTENSION_PATTERN = /\.(html?|m?[jt]sx?|cjs|vue|svelte|astro|mdx?|css|s[ac]ss|less|styl(?:us)?)$/i;
@@ -6967,7 +6999,7 @@ var routePropsCache, cacheRouteData = (pagePath, data) => {
6967
6999
  value: propValue
6968
7000
  })).filter((entry) => entry.token).map((entry) => ({ provide: entry.token, useValue: entry.value }));
6969
7001
  return [...providers, ...propProviders];
6970
- }, clearSelectorCache = () => selectorCache.clear(), isInjectionToken = (value) => {
7002
+ }, isInjectionToken = (value) => {
6971
7003
  if (!value || typeof value !== "object") {
6972
7004
  return false;
6973
7005
  }
@@ -7213,7 +7245,7 @@ var init_islandSsr = __esm(() => {
7213
7245
  });
7214
7246
 
7215
7247
  // src/build/resolvePackageImport.ts
7216
- import { resolve as resolve4, join as join5 } from "path";
7248
+ import { resolve as resolve5, join as join5 } from "path";
7217
7249
  import { existsSync as existsSync5, readFileSync as readFileSync5 } from "fs";
7218
7250
  var resolveExportPath = (entry, conditions) => {
7219
7251
  if (typeof entry === "string")
@@ -7235,10 +7267,10 @@ var resolveExportPath = (entry, conditions) => {
7235
7267
  const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
7236
7268
  const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
7237
7269
  const exportKey = subpath ? `./${subpath}` : ".";
7238
- const currentPackageJsonPath = resolve4(process.cwd(), "package.json");
7270
+ const currentPackageJsonPath = resolve5(process.cwd(), "package.json");
7239
7271
  const currentPackageJson = existsSync5(currentPackageJsonPath) ? JSON.parse(readFileSync5(currentPackageJsonPath, "utf-8")) : null;
7240
7272
  const currentPackageDir = currentPackageJson?.name === packageName ? process.cwd() : null;
7241
- const packageDir = currentPackageDir ?? resolve4(process.cwd(), "node_modules", packageName ?? "");
7273
+ const packageDir = currentPackageDir ?? resolve5(process.cwd(), "node_modules", packageName ?? "");
7242
7274
  const packageJsonPath = join5(packageDir, "package.json");
7243
7275
  if (!existsSync5(packageJsonPath))
7244
7276
  return null;
@@ -7254,12 +7286,12 @@ var resolveExportPath = (entry, conditions) => {
7254
7286
  if (!importPath)
7255
7287
  return null;
7256
7288
  if (currentPackageDir && importPath.startsWith("./dist/")) {
7257
- const sourceCandidate = resolve4(packageDir, importPath.replace(/^\.\/dist\//, "./src/"));
7289
+ const sourceCandidate = resolve5(packageDir, importPath.replace(/^\.\/dist\//, "./src/"));
7258
7290
  if (existsSync5(sourceCandidate)) {
7259
7291
  return sourceCandidate;
7260
7292
  }
7261
7293
  }
7262
- const resolved = resolve4(packageDir, importPath);
7294
+ const resolved = resolve5(packageDir, importPath);
7263
7295
  return existsSync5(resolved) ? resolved : null;
7264
7296
  } catch {
7265
7297
  return null;
@@ -7393,7 +7425,7 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
7393
7425
 
7394
7426
  // src/core/svelteServerModule.ts
7395
7427
  import { mkdir as mkdir2, readdir } from "fs/promises";
7396
- import { basename, dirname as dirname5, extname as extname2, join as join6, relative as relative2, resolve as resolve5 } from "path";
7428
+ import { basename, dirname as dirname5, extname as extname2, join as join6, relative as relative2, resolve as resolve6 } from "path";
7397
7429
  var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
7398
7430
  const importPath = relative2(dirname5(from), target).replace(/\\/g, "/");
7399
7431
  return importPath.startsWith(".") ? importPath : `./${importPath}`;
@@ -7441,7 +7473,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
7441
7473
  if (!spec.startsWith(".")) {
7442
7474
  return null;
7443
7475
  }
7444
- const basePath = resolve5(dirname5(from), spec);
7476
+ const basePath = resolve6(dirname5(from), spec);
7445
7477
  const candidates = [
7446
7478
  basePath,
7447
7479
  `${basePath}.ts`,
@@ -7473,7 +7505,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
7473
7505
  if (!spec.startsWith(".")) {
7474
7506
  return null;
7475
7507
  }
7476
- const explicitPath = resolve5(dirname5(from), spec);
7508
+ const explicitPath = resolve6(dirname5(from), spec);
7477
7509
  if (extname2(explicitPath) === ".svelte") {
7478
7510
  return explicitPath;
7479
7511
  }
@@ -7573,7 +7605,7 @@ var init_svelteServerModule = __esm(() => {
7573
7605
 
7574
7606
  // src/core/vueServerModule.ts
7575
7607
  import { mkdir as mkdir3 } from "fs/promises";
7576
- import { dirname as dirname6, join as join7, relative as relative3, resolve as resolve6 } from "path";
7608
+ import { dirname as dirname6, join as join7, relative as relative3, resolve as resolve7 } from "path";
7577
7609
  var {Transpiler } = globalThis.Bun;
7578
7610
  var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, transpiler2, ensureRelativeImportPath2 = (from, target) => {
7579
7611
  const importPath = relative3(dirname6(from), target).replace(/\\/g, "/");
@@ -7636,7 +7668,7 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, tran
7636
7668
  }).code : "const ssrRender = () => {};";
7637
7669
  const childImportPaths = extractRelativeVueImports(compiledScript.content);
7638
7670
  const compiledChildren = await Promise.all(childImportPaths.map(async (relativeImport) => ({
7639
- compiledPath: await compileVueServerModule(resolve6(dirname6(sourcePath), relativeImport)),
7671
+ compiledPath: await compileVueServerModule(resolve7(dirname6(sourcePath), relativeImport)),
7640
7672
  spec: relativeImport
7641
7673
  })));
7642
7674
  const strippedScript = stripExports(compiledScript.content);
@@ -7823,7 +7855,7 @@ var init_renderIslandMarkup = __esm(() => {
7823
7855
 
7824
7856
  // src/build/islandEntries.ts
7825
7857
  import { mkdirSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
7826
- import { dirname as dirname7, extname as extname3, join as join8, relative as relative4, resolve as resolve7 } from "path";
7858
+ import { dirname as dirname7, extname as extname3, join as join8, relative as relative4, resolve as resolve8 } from "path";
7827
7859
  import ts from "typescript";
7828
7860
  var frameworks, isRecord4 = (value) => typeof value === "object" && value !== null, resolveRegistryExport = (mod) => {
7829
7861
  if (isRecord4(mod.islandRegistry))
@@ -7838,7 +7870,7 @@ var frameworks, isRecord4 = (value) => typeof value === "object" && value !== nu
7838
7870
  if (sourcePath.startsWith("file://")) {
7839
7871
  return new URL(sourcePath).pathname;
7840
7872
  }
7841
- return resolve7(dirname7(registryPath), sourcePath);
7873
+ return resolve8(dirname7(registryPath), sourcePath);
7842
7874
  }, getObjectPropertyName = (name) => {
7843
7875
  if (ts.isIdentifier(name) || ts.isStringLiteral(name)) {
7844
7876
  return name.text;
@@ -8078,7 +8110,7 @@ export default component;
8078
8110
  generatedRoot
8079
8111
  };
8080
8112
  }, loadIslandRegistryBuildInfo = async (registryPath) => {
8081
- const resolvedRegistryPath = resolve7(registryPath);
8113
+ const resolvedRegistryPath = resolve8(registryPath);
8082
8114
  const registrySource = Bun.file(resolvedRegistryPath);
8083
8115
  const registrySourceText = await registrySource.text();
8084
8116
  const parsedInfo = parseIslandRegistryBuildInfo(registrySourceText, resolvedRegistryPath);
@@ -8345,7 +8377,7 @@ __export(exports_loadConfig, {
8345
8377
  isWorkspaceConfig: () => isWorkspaceConfig,
8346
8378
  getWorkspaceServices: () => getWorkspaceServices
8347
8379
  });
8348
- import { resolve as resolve8 } from "path";
8380
+ import { resolve as resolve9 } from "path";
8349
8381
  var RESERVED_TOP_LEVEL_KEYS, isObject = (value) => typeof value === "object" && value !== null, isCommandService = (service) => service.kind === "command" || Array.isArray(service.command), isServiceCandidate = (value) => isObject(value) && (typeof value.entry === "string" || Array.isArray(value.command)), isWorkspaceConfig = (config) => {
8350
8382
  if (!isObject(config)) {
8351
8383
  return false;
@@ -8396,7 +8428,7 @@ var RESERVED_TOP_LEVEL_KEYS, isObject = (value) => typeof value === "object" &&
8396
8428
  }
8397
8429
  return config;
8398
8430
  }, loadRawConfig = async (configPath) => {
8399
- const resolved = resolve8(configPath ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
8431
+ const resolved = resolve9(configPath ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
8400
8432
  const mod = await import(resolved);
8401
8433
  const config = mod.default ?? mod.config;
8402
8434
  if (!config) {
@@ -8539,7 +8571,7 @@ var init_sourceMetadata = __esm(() => {
8539
8571
 
8540
8572
  // src/islands/pageMetadata.ts
8541
8573
  import { readFileSync as readFileSync7 } from "fs";
8542
- import { dirname as dirname8, resolve as resolve10 } from "path";
8574
+ import { dirname as dirname8, resolve as resolve11 } from "path";
8543
8575
  var pagePatterns, getPageDirs = (config) => [
8544
8576
  { dir: config.angularDirectory, framework: "angular" },
8545
8577
  { dir: config.emberDirectory, framework: "ember" },
@@ -8559,15 +8591,15 @@ var pagePatterns, getPageDirs = (config) => [
8559
8591
  const source = definition.buildReference?.source;
8560
8592
  if (!source)
8561
8593
  continue;
8562
- const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve10(dirname8(buildInfo.resolvedRegistryPath), source);
8563
- lookup.set(`${definition.framework}:${definition.component}`, resolve10(resolvedSource));
8594
+ const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve11(dirname8(buildInfo.resolvedRegistryPath), source);
8595
+ lookup.set(`${definition.framework}:${definition.component}`, resolve11(resolvedSource));
8564
8596
  }
8565
8597
  return lookup;
8566
8598
  }, getCurrentPageIslandMetadata = () => globalThis.__absolutePageIslandMetadata ?? new Map, metadataUsesSource = (metadata2, target) => metadata2.islands.some((usage) => {
8567
8599
  const candidate = usage.source;
8568
- return candidate ? resolve10(candidate) === target : false;
8600
+ return candidate ? resolve11(candidate) === target : false;
8569
8601
  }), getPagesUsingIslandSource = (sourcePath) => {
8570
- const target = resolve10(sourcePath);
8602
+ const target = resolve11(sourcePath);
8571
8603
  return [...getCurrentPageIslandMetadata().values()].filter((metadata2) => metadataUsesSource(metadata2, target)).map((metadata2) => metadata2.pagePath);
8572
8604
  }, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage) => {
8573
8605
  const sourcePath = islandSourceLookup.get(`${usage.framework}:${usage.component}`);
@@ -8579,13 +8611,13 @@ var pagePatterns, getPageDirs = (config) => [
8579
8611
  const pattern = pagePatterns[entry.framework];
8580
8612
  if (!pattern)
8581
8613
  return;
8582
- const files = await scanEntryPoints(resolve10(entry.dir), pattern);
8614
+ const files = await scanEntryPoints(resolve11(entry.dir), pattern);
8583
8615
  for (const filePath of files) {
8584
8616
  const source = readFileSync7(filePath, "utf-8");
8585
8617
  const islands = extractIslandUsagesFromSource(source);
8586
- pageMetadata.set(resolve10(filePath), {
8618
+ pageMetadata.set(resolve11(filePath), {
8587
8619
  islands: resolveIslandUsages(islands, islandSourceLookup),
8588
- pagePath: resolve10(filePath)
8620
+ pagePath: resolve11(filePath)
8589
8621
  });
8590
8622
  }
8591
8623
  }, loadPageIslandMetadata = async (config) => {
@@ -8945,7 +8977,7 @@ var init_generateManifest = __esm(() => {
8945
8977
  });
8946
8978
 
8947
8979
  // src/build/verifyAngularCoreUniqueness.ts
8948
- import { resolve as resolve11 } from "path";
8980
+ import { resolve as resolve12 } from "path";
8949
8981
  var ANGULAR_CORE_IMPORT_RE, ANGULAR_CORE_PACKAGE_RE, classifySpecifier = (specifier, artifactPath, serverOutDir) => {
8950
8982
  if (!ANGULAR_CORE_PACKAGE_RE.test(specifier))
8951
8983
  return null;
@@ -8955,9 +8987,9 @@ var ANGULAR_CORE_IMPORT_RE, ANGULAR_CORE_PACKAGE_RE, classifySpecifier = (specif
8955
8987
  if (specifier.startsWith("/")) {
8956
8988
  absolute = specifier;
8957
8989
  } else if (specifier.startsWith(".")) {
8958
- absolute = resolve11(artifactPath, "..", specifier);
8990
+ absolute = resolve12(artifactPath, "..", specifier);
8959
8991
  } else {
8960
- absolute = serverOutDir ? resolve11(serverOutDir, specifier) : resolve11(artifactPath, "..", specifier);
8992
+ absolute = serverOutDir ? resolve12(serverOutDir, specifier) : resolve12(artifactPath, "..", specifier);
8961
8993
  }
8962
8994
  return {
8963
8995
  kind: "resolved",
@@ -9022,18 +9054,18 @@ var init_verifyAngularCoreUniqueness = __esm(() => {
9022
9054
  // src/build/generateReactIndexes.ts
9023
9055
  import { existsSync as existsSync7, mkdirSync as mkdirSync2 } from "fs";
9024
9056
  import { readdir as readdir2, rm, writeFile } from "fs/promises";
9025
- import { basename as basename3, join as join9, relative as relative5, resolve as resolve12, sep } from "path";
9057
+ import { basename as basename3, join as join9, relative as relative5, resolve as resolve13, sep } from "path";
9026
9058
  var {Glob: Glob2 } = globalThis.Bun;
9027
9059
  var indexContentCache, resolveDevClientDir = () => {
9028
9060
  const projectRoot = process.cwd();
9029
- const fromSource = resolve12(import.meta.dir, "../dev/client");
9061
+ const fromSource = resolve13(import.meta.dir, "../dev/client");
9030
9062
  if (existsSync7(fromSource) && fromSource.startsWith(projectRoot)) {
9031
9063
  return fromSource;
9032
9064
  }
9033
- const fromNodeModules = resolve12(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
9065
+ const fromNodeModules = resolve13(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
9034
9066
  if (existsSync7(fromNodeModules))
9035
9067
  return fromNodeModules;
9036
- return resolve12(import.meta.dir, "./dev/client");
9068
+ return resolve13(import.meta.dir, "./dev/client");
9037
9069
  }, devClientDir, errorOverlayPath, hmrClientPath, refreshSetupPath, generateReactIndexFiles = async (reactPagesDirectory, reactIndexesDirectory, isDev2 = false) => {
9038
9070
  if (!existsSync7(reactIndexesDirectory)) {
9039
9071
  mkdirSync2(reactIndexesDirectory, { recursive: true });
@@ -9061,7 +9093,7 @@ var indexContentCache, resolveDevClientDir = () => {
9061
9093
  });
9062
9094
  }));
9063
9095
  }
9064
- const pagesRelPath = relative5(resolve12(reactIndexesDirectory), resolve12(reactPagesDirectory)).split(sep).join("/");
9096
+ const pagesRelPath = relative5(resolve13(reactIndexesDirectory), resolve13(reactPagesDirectory)).split(sep).join("/");
9065
9097
  const promises = files.map(async (file2) => {
9066
9098
  const fileName = basename3(file2);
9067
9099
  const componentName = fileName.split(".")[0];
@@ -9335,7 +9367,7 @@ var indexContentCache, resolveDevClientDir = () => {
9335
9367
  `
9336
9368
  // Pre-warm: import the page module from the module server`,
9337
9369
  `// immediately so the browser caches all /@src/ URLs.`,
9338
- `import('/@src/${relative5(process.cwd(), resolve12(reactPagesDirectory, `${componentName}.tsx`)).replace(/\\/g, "/")}').catch(() => {});`
9370
+ `import('/@src/${relative5(process.cwd(), resolve13(reactPagesDirectory, `${componentName}.tsx`)).replace(/\\/g, "/")}').catch(() => {});`
9339
9371
  ] : []
9340
9372
  ].join(`
9341
9373
  `);
@@ -9503,7 +9535,7 @@ var init_scanCssEntryPoints = __esm(() => {
9503
9535
 
9504
9536
  // src/utils/imageProcessing.ts
9505
9537
  import { existsSync as existsSync10, mkdirSync as mkdirSync3, readFileSync as readFileSync8, writeFileSync as writeFileSync4 } from "fs";
9506
- import { join as join10, resolve as resolve13 } from "path";
9538
+ import { join as join10, resolve as resolve14 } from "path";
9507
9539
  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) => {
9508
9540
  for (const size of sizes) {
9509
9541
  if (size >= target)
@@ -9631,7 +9663,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
9631
9663
  return sharpModule;
9632
9664
  sharpLoaded = true;
9633
9665
  try {
9634
- const sharpPath = resolve13(process.cwd(), "node_modules/sharp");
9666
+ const sharpPath = resolve14(process.cwd(), "node_modules/sharp");
9635
9667
  const mod = await import(sharpPath);
9636
9668
  sharpModule = mod.default ?? mod;
9637
9669
  return sharpModule;
@@ -9820,6 +9852,9 @@ var replaceAssetRef = (match, prefix, dir, name, ext, suffix, manifest, filePath
9820
9852
  if (/data-external(?:\s*=\s*["'][^"']*["'])?/i.test(match)) {
9821
9853
  return match;
9822
9854
  }
9855
+ if (dir.startsWith("/") || /^[a-z][a-z0-9+.-]*:\/\//i.test(dir)) {
9856
+ return match;
9857
+ }
9823
9858
  const pascal = toPascal(name);
9824
9859
  let key;
9825
9860
  if (ext === ".css") {
@@ -9863,18 +9898,18 @@ var init_updateAssetPaths = __esm(() => {
9863
9898
 
9864
9899
  // src/dev/buildHMRClient.ts
9865
9900
  import { existsSync as existsSync13 } from "fs";
9866
- import { resolve as resolve14 } from "path";
9901
+ import { resolve as resolve15 } from "path";
9867
9902
  var {build: bunBuild } = globalThis.Bun;
9868
9903
  var resolveHmrClientPath = () => {
9869
9904
  const projectRoot = process.cwd();
9870
- const fromSource = resolve14(import.meta.dir, "client/hmrClient.ts");
9905
+ const fromSource = resolve15(import.meta.dir, "client/hmrClient.ts");
9871
9906
  if (existsSync13(fromSource) && fromSource.startsWith(projectRoot)) {
9872
9907
  return fromSource;
9873
9908
  }
9874
- const fromNodeModules = resolve14(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client/hmrClient.ts");
9909
+ const fromNodeModules = resolve15(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client/hmrClient.ts");
9875
9910
  if (existsSync13(fromNodeModules))
9876
9911
  return fromNodeModules;
9877
- return resolve14(import.meta.dir, "dev/client/hmrClient.ts");
9912
+ return resolve15(import.meta.dir, "dev/client/hmrClient.ts");
9878
9913
  }, hmrClientPath2, buildHMRClient = async () => {
9879
9914
  const entryPoint = hmrClientPath2;
9880
9915
  const result = await bunBuild({
@@ -9904,7 +9939,7 @@ var init_buildHMRClient = __esm(() => {
9904
9939
  // src/build/nativeRewrite.ts
9905
9940
  import { dlopen, FFIType, ptr } from "bun:ffi";
9906
9941
  import { platform as platform2, arch as arch2 } from "os";
9907
- import { resolve as resolve15 } from "path";
9942
+ import { resolve as resolve16 } from "path";
9908
9943
  var ffiDefinition, nativeLib = null, loadNative = () => {
9909
9944
  if (nativeLib !== null)
9910
9945
  return nativeLib;
@@ -9922,7 +9957,7 @@ var ffiDefinition, nativeLib = null, loadNative = () => {
9922
9957
  if (!libPath)
9923
9958
  return null;
9924
9959
  try {
9925
- const fullPath = resolve15(import.meta.dir, "../../native/packages", libPath);
9960
+ const fullPath = resolve16(import.meta.dir, "../../native/packages", libPath);
9926
9961
  const lib = dlopen(fullPath, ffiDefinition);
9927
9962
  nativeLib = lib.symbols;
9928
9963
  return nativeLib;
@@ -10068,7 +10103,7 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
10068
10103
 
10069
10104
  // src/build/angularLinkerPlugin.ts
10070
10105
  import { existsSync as existsSync14, mkdirSync as mkdirSync5, readFileSync as readFileSync11, writeFileSync as writeFileSync6 } from "fs";
10071
- import { dirname as dirname10, join as join13, relative as relative6, resolve as resolve16 } from "path";
10106
+ import { dirname as dirname10, join as join13, relative as relative6, resolve as resolve17 } from "path";
10072
10107
  import { createHash as createHash3 } from "crypto";
10073
10108
  var CACHE_ROOT, ANGULAR_LINKER_CANDIDATE_RE, createAngularLinkerPlugin = (linkerJitMode) => ({
10074
10109
  name: "angular-linker",
@@ -10110,7 +10145,7 @@ var CACHE_ROOT, ANGULAR_LINKER_CANDIDATE_RE, createAngularLinkerPlugin = (linker
10110
10145
  exists: existsSync14,
10111
10146
  readFile: readFileSync11,
10112
10147
  relative: relative6,
10113
- resolve: resolve16
10148
+ resolve: resolve17
10114
10149
  },
10115
10150
  linkerJitMode,
10116
10151
  logger: {
@@ -10141,7 +10176,7 @@ var CACHE_ROOT, ANGULAR_LINKER_CANDIDATE_RE, createAngularLinkerPlugin = (linker
10141
10176
  }
10142
10177
  }), angularLinkerPlugin;
10143
10178
  var init_angularLinkerPlugin = __esm(() => {
10144
- CACHE_ROOT = resolve16(".absolutejs", "cache", "angular-linker");
10179
+ CACHE_ROOT = resolve17(".absolutejs", "cache", "angular-linker");
10145
10180
  ANGULAR_LINKER_CANDIDATE_RE = /[\\/]node_modules[\\/].*\.m?js$/;
10146
10181
  angularLinkerPlugin = createAngularLinkerPlugin(false);
10147
10182
  });
@@ -10153,7 +10188,7 @@ __export(exports_hmrInjectionPlugin, {
10153
10188
  applyAngularHmrInjection: () => applyAngularHmrInjection
10154
10189
  });
10155
10190
  import { readFile as readFile5 } from "fs/promises";
10156
- import { relative as relative7, resolve as resolve17 } from "path";
10191
+ import { relative as relative7, resolve as resolve18 } from "path";
10157
10192
  var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames = (jsSource) => {
10158
10193
  const names = new Set;
10159
10194
  IMPORT_RE.lastIndex = 0;
@@ -10316,7 +10351,7 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
10316
10351
  }
10317
10352
  `, applyAngularHmrInjection = (jsSource, componentJsAbsPath, params) => {
10318
10353
  const { generatedAngularRoot, userAngularRoot, projectRoot } = params;
10319
- const normalizedGenRoot = resolve17(generatedAngularRoot).replace(/\\/g, "/");
10354
+ const normalizedGenRoot = resolve18(generatedAngularRoot).replace(/\\/g, "/");
10320
10355
  const normalizedPath = componentJsAbsPath.replace(/\\/g, "/");
10321
10356
  if (!normalizedPath.startsWith(normalizedGenRoot + "/"))
10322
10357
  return;
@@ -10334,7 +10369,7 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
10334
10369
  if (classNames.length === 0)
10335
10370
  return;
10336
10371
  const relFromGenRoot = relative7(generatedAngularRoot, componentJsAbsPath).replace(/\\/g, "/");
10337
- const userTsPath = resolve17(userAngularRoot, relFromGenRoot.replace(/\.js$/, ".ts"));
10372
+ const userTsPath = resolve18(userAngularRoot, relFromGenRoot.replace(/\.js$/, ".ts"));
10338
10373
  const projectRel = relative7(projectRoot, userTsPath).replace(/\\/g, "/");
10339
10374
  const tail = classNames.map((className) => {
10340
10375
  const id = `${projectRel}@${className}`;
@@ -10369,14 +10404,14 @@ var init_hmrInjectionPlugin = __esm(() => {
10369
10404
 
10370
10405
  // src/utils/cleanStaleOutputs.ts
10371
10406
  import { rm as rm2 } from "fs/promises";
10372
- import { resolve as resolve18 } from "path";
10407
+ import { resolve as resolve19 } from "path";
10373
10408
  var {Glob: Glob5 } = globalThis.Bun;
10374
10409
  var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPaths) => {
10375
- const currentPaths = new Set(currentOutputPaths.map((path) => resolve18(path)));
10410
+ const currentPaths = new Set(currentOutputPaths.map((path) => resolve19(path)));
10376
10411
  const glob = new Glob5("**/*");
10377
10412
  const removals = [];
10378
10413
  for (const relative8 of glob.scanSync({ cwd: buildPath })) {
10379
- const absolute = resolve18(buildPath, relative8);
10414
+ const absolute = resolve19(buildPath, relative8);
10380
10415
  if (currentPaths.has(absolute))
10381
10416
  continue;
10382
10417
  if (!HASHED_FILE_PATTERN.test(relative8))
@@ -10610,10 +10645,10 @@ var init_buildDirectoryLock = __esm(() => {
10610
10645
  });
10611
10646
 
10612
10647
  // src/utils/validateSafePath.ts
10613
- import { resolve as resolve19, relative as relative8 } from "path";
10648
+ import { resolve as resolve20, relative as relative8 } from "path";
10614
10649
  var validateSafePath = (targetPath, baseDirectory) => {
10615
- const absoluteBase = resolve19(baseDirectory);
10616
- const absoluteTarget = resolve19(baseDirectory, targetPath);
10650
+ const absoluteBase = resolve20(baseDirectory);
10651
+ const absoluteTarget = resolve20(baseDirectory, targetPath);
10617
10652
  const relativePath = normalizePath(relative8(absoluteBase, absoluteTarget));
10618
10653
  if (relativePath.startsWith("../") || relativePath === "..") {
10619
10654
  throw new Error(`Unsafe path: ${targetPath}`);
@@ -10691,7 +10726,7 @@ import {
10691
10726
  join as join17,
10692
10727
  basename as basename5,
10693
10728
  extname as extname5,
10694
- resolve as resolve20,
10729
+ resolve as resolve21,
10695
10730
  relative as relative9,
10696
10731
  sep as sep2
10697
10732
  } from "path";
@@ -10699,14 +10734,14 @@ import { env as env2 } from "process";
10699
10734
  var {write, file: file2, Transpiler: Transpiler2 } = globalThis.Bun;
10700
10735
  var resolveDevClientDir2 = () => {
10701
10736
  const projectRoot = process.cwd();
10702
- const fromSource = resolve20(import.meta.dir, "../dev/client");
10737
+ const fromSource = resolve21(import.meta.dir, "../dev/client");
10703
10738
  if (existsSync15(fromSource) && fromSource.startsWith(projectRoot)) {
10704
10739
  return fromSource;
10705
10740
  }
10706
- const fromNodeModules = resolve20(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
10741
+ const fromNodeModules = resolve21(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
10707
10742
  if (existsSync15(fromNodeModules))
10708
10743
  return fromNodeModules;
10709
- return resolve20(import.meta.dir, "./dev/client");
10744
+ return resolve21(import.meta.dir, "./dev/client");
10710
10745
  }, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
10711
10746
  persistentCache.clear();
10712
10747
  sourceHashCache.clear();
@@ -10736,7 +10771,7 @@ var resolveDevClientDir2 = () => {
10736
10771
  }, resolveRelativeModule2 = async (spec, from) => {
10737
10772
  if (!spec.startsWith("."))
10738
10773
  return null;
10739
- const basePath = resolve20(dirname12(from), spec);
10774
+ const basePath = resolve21(dirname12(from), spec);
10740
10775
  const candidates = [
10741
10776
  basePath,
10742
10777
  `${basePath}.ts`,
@@ -10763,7 +10798,7 @@ var resolveDevClientDir2 = () => {
10763
10798
  const resolved = resolvePackageImport(spec);
10764
10799
  return resolved && /\.svelte(\.(?:ts|js))?$/.test(resolved) ? resolved : null;
10765
10800
  }
10766
- const basePath = resolve20(dirname12(from), spec);
10801
+ const basePath = resolve21(dirname12(from), spec);
10767
10802
  const explicit = /\.(svelte|svelte\.(?:ts|js))$/.test(basePath);
10768
10803
  if (!explicit) {
10769
10804
  const extensions = [".svelte", ".svelte.ts", ".svelte.js"];
@@ -10807,7 +10842,7 @@ var resolveDevClientDir2 = () => {
10807
10842
  const contentHash = Bun.hash(raw).toString(BASE_36_RADIX);
10808
10843
  const prevHash = sourceHashCache.get(src);
10809
10844
  const persistent = persistentCache.get(src);
10810
- if (prevHash === contentHash && persistent) {
10845
+ if (prevHash === contentHash && persistent && existsSync15(persistent.ssr) && existsSync15(persistent.client)) {
10811
10846
  cache.set(src, persistent);
10812
10847
  return persistent;
10813
10848
  }
@@ -11100,19 +11135,19 @@ import {
11100
11135
  isAbsolute as isAbsolute3,
11101
11136
  join as join18,
11102
11137
  relative as relative10,
11103
- resolve as resolve21
11138
+ resolve as resolve22
11104
11139
  } from "path";
11105
11140
  var {file: file3, write: write2, Transpiler: Transpiler3 } = globalThis.Bun;
11106
11141
  var resolveDevClientDir3 = () => {
11107
11142
  const projectRoot = process.cwd();
11108
- const fromSource = resolve21(import.meta.dir, "../dev/client");
11143
+ const fromSource = resolve22(import.meta.dir, "../dev/client");
11109
11144
  if (existsSync16(fromSource) && fromSource.startsWith(projectRoot)) {
11110
11145
  return fromSource;
11111
11146
  }
11112
- const fromNodeModules = resolve21(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
11147
+ const fromNodeModules = resolve22(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
11113
11148
  if (existsSync16(fromNodeModules))
11114
11149
  return fromNodeModules;
11115
- return resolve21(import.meta.dir, "./dev/client");
11150
+ return resolve22(import.meta.dir, "./dev/client");
11116
11151
  }, devClientDir3, hmrClientPath4, transpiler4, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
11117
11152
  scriptCache.clear();
11118
11153
  scriptSetupCache.clear();
@@ -11158,7 +11193,7 @@ var resolveDevClientDir3 = () => {
11158
11193
  return filePath.replace(/\.ts$/, ".js");
11159
11194
  if (isStylePath(filePath)) {
11160
11195
  if (sourceDir && (filePath.startsWith("./") || filePath.startsWith("../"))) {
11161
- return resolve21(sourceDir, filePath);
11196
+ return resolve22(sourceDir, filePath);
11162
11197
  }
11163
11198
  return filePath;
11164
11199
  }
@@ -11194,7 +11229,7 @@ var resolveDevClientDir3 = () => {
11194
11229
  const contentHash = Bun.hash(sourceContent).toString(BASE_36_RADIX);
11195
11230
  const prevHash = vueSourceHashCache.get(sourceFilePath);
11196
11231
  const persistent = persistentBuildCache.get(sourceFilePath);
11197
- if (prevHash === contentHash && persistent) {
11232
+ if (prevHash === contentHash && persistent && existsSync16(persistent.clientPath) && existsSync16(persistent.serverPath)) {
11198
11233
  cacheMap.set(sourceFilePath, persistent);
11199
11234
  return persistent;
11200
11235
  }
@@ -11222,12 +11257,12 @@ var resolveDevClientDir3 = () => {
11222
11257
  const childComponentPaths = importPaths.filter((path) => path.startsWith(".") && path.endsWith(".vue"));
11223
11258
  const packageComponentPaths = Array.from(resolvedPackageVueImports.entries());
11224
11259
  const helperModulePaths = importPaths.filter((path) => path.startsWith(".") && !path.endsWith(".vue") && !isStylePath(path));
11225
- const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute3(path)) && isStylePath(path)).map((path) => isAbsolute3(path) ? path : resolve21(dirname13(sourceFilePath), path));
11260
+ const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute3(path)) && isStylePath(path)).map((path) => isAbsolute3(path) ? path : resolve22(dirname13(sourceFilePath), path));
11226
11261
  for (const stylePath of stylePathsImported) {
11227
11262
  addStyleImporter(sourceFilePath, stylePath);
11228
11263
  }
11229
11264
  const childBuildResults = await Promise.all([
11230
- ...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve21(dirname13(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
11265
+ ...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve22(dirname13(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
11231
11266
  ...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors))
11232
11267
  ]);
11233
11268
  const hasScript = descriptor.script || descriptor.scriptSetup;
@@ -11338,7 +11373,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
11338
11373
  hmrId,
11339
11374
  serverPath: serverOutputPath,
11340
11375
  tsHelperPaths: [
11341
- ...helperModulePaths.map((helper) => resolve21(dirname13(sourceFilePath), helper.endsWith(".ts") ? helper : `${helper}.ts`)),
11376
+ ...helperModulePaths.map((helper) => resolve22(dirname13(sourceFilePath), helper.endsWith(".ts") ? helper : `${helper}.ts`)),
11342
11377
  ...childBuildResults.flatMap((child) => child.tsHelperPaths)
11343
11378
  ]
11344
11379
  };
@@ -11361,7 +11396,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
11361
11396
  const buildCache = new Map;
11362
11397
  const allTsHelperPaths = new Set;
11363
11398
  const compiledPages = await Promise.all(entryPoints.map(async (entryPath) => {
11364
- const result = await compileVueFile(resolve21(entryPath), {
11399
+ const result = await compileVueFile(resolve22(entryPath), {
11365
11400
  client: clientOutputDir,
11366
11401
  css: cssOutputDir,
11367
11402
  server: serverOutputDir
@@ -12020,23 +12055,25 @@ var init_lowerDeferSyntax = __esm(() => {
12020
12055
  // src/build/compileAngular.ts
12021
12056
  var exports_compileAngular = {};
12022
12057
  __export(exports_compileAngular, {
12058
+ invalidateAngularJitCache: () => invalidateAngularJitCache,
12023
12059
  compileAngularFiles: () => compileAngularFiles,
12024
12060
  compileAngularFileJIT: () => compileAngularFileJIT,
12025
12061
  compileAngularFile: () => compileAngularFile,
12026
12062
  compileAngular: () => compileAngular
12027
12063
  });
12028
12064
  import { existsSync as existsSync17, readFileSync as readFileSync13, promises as fs } from "fs";
12029
- import { join as join19, basename as basename7, sep as sep3, dirname as dirname14, resolve as resolve22, relative as relative11 } from "path";
12065
+ import { join as join19, basename as basename7, sep as sep3, dirname as dirname14, resolve as resolve23, relative as relative11 } from "path";
12066
+ var {Glob: Glob6 } = globalThis.Bun;
12030
12067
  import ts2 from "typescript";
12031
12068
  var traceAngularPhase = async (name, fn2, metadata2) => {
12032
12069
  const tracePhase = globalThis.__absoluteBuildTracePhase;
12033
12070
  return tracePhase ? tracePhase(`compile/angular/${name}`, fn2, metadata2) : await fn2();
12034
12071
  }, readTsconfigPathAliases = () => {
12035
12072
  try {
12036
- const configPath2 = resolve22(process.cwd(), "tsconfig.json");
12073
+ const configPath2 = resolve23(process.cwd(), "tsconfig.json");
12037
12074
  const config = ts2.readConfigFile(configPath2, ts2.sys.readFile).config;
12038
12075
  const compilerOptions = config?.compilerOptions ?? {};
12039
- const baseUrl = resolve22(process.cwd(), compilerOptions.baseUrl ?? ".");
12076
+ const baseUrl = resolve23(process.cwd(), compilerOptions.baseUrl ?? ".");
12040
12077
  const aliases = Object.entries(compilerOptions.paths ?? {}).map(([pattern, replacements]) => ({ pattern, replacements }));
12041
12078
  return { aliases, baseUrl };
12042
12079
  } catch {
@@ -12056,7 +12093,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
12056
12093
  const wildcardValue = exactMatch ? "" : specifier.slice(prefix.length, specifier.length - suffix.length);
12057
12094
  for (const replacement of alias.replacements) {
12058
12095
  const candidate = replacement.replace("*", wildcardValue);
12059
- const resolved = resolveSourceFile(resolve22(baseUrl, candidate));
12096
+ const resolved = resolveSourceFile(resolve23(baseUrl, candidate));
12060
12097
  if (resolved)
12061
12098
  return resolved;
12062
12099
  }
@@ -12075,13 +12112,13 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
12075
12112
  ];
12076
12113
  return candidates.find((file4) => existsSync17(file4));
12077
12114
  }, createLegacyAngularAnimationUsageResolver = (rootDir) => {
12078
- const baseDir = resolve22(rootDir);
12115
+ const baseDir = resolve23(rootDir);
12079
12116
  const tsconfigAliases = readTsconfigPathAliases();
12080
12117
  const transpiler5 = new Bun.Transpiler({ loader: "tsx" });
12081
12118
  const scanCache = new Map;
12082
12119
  const resolveLocalImport = (specifier, fromDir) => {
12083
12120
  if (specifier.startsWith(".") || specifier.startsWith("/")) {
12084
- return resolveSourceFile(resolve22(fromDir, specifier));
12121
+ return resolveSourceFile(resolve23(fromDir, specifier));
12085
12122
  }
12086
12123
  const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile);
12087
12124
  if (aliased)
@@ -12090,7 +12127,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
12090
12127
  const resolved = Bun.resolveSync(specifier, fromDir);
12091
12128
  if (resolved.includes("/node_modules/"))
12092
12129
  return;
12093
- const absolute = resolve22(resolved);
12130
+ const absolute = resolve23(resolved);
12094
12131
  if (!absolute.startsWith(baseDir))
12095
12132
  return;
12096
12133
  return resolveSourceFile(absolute);
@@ -12106,7 +12143,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
12106
12143
  usesLegacyAnimations: false
12107
12144
  });
12108
12145
  }
12109
- const resolved = resolve22(actualPath);
12146
+ const resolved = resolve23(actualPath);
12110
12147
  const cached = scanCache.get(resolved);
12111
12148
  if (cached)
12112
12149
  return cached;
@@ -12135,7 +12172,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
12135
12172
  const actualPath = resolveSourceFile(filePath);
12136
12173
  if (!actualPath)
12137
12174
  return false;
12138
- const resolved = resolve22(actualPath);
12175
+ const resolved = resolve23(actualPath);
12139
12176
  if (visited.has(resolved))
12140
12177
  return false;
12141
12178
  visited.add(resolved);
@@ -12153,14 +12190,14 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
12153
12190
  return (entryPath) => visit(entryPath);
12154
12191
  }, resolveDevClientDir4 = () => {
12155
12192
  const projectRoot = process.cwd();
12156
- const fromSource = resolve22(import.meta.dir, "../dev/client");
12193
+ const fromSource = resolve23(import.meta.dir, "../dev/client");
12157
12194
  if (existsSync17(fromSource) && fromSource.startsWith(projectRoot)) {
12158
12195
  return fromSource;
12159
12196
  }
12160
- const fromNodeModules = resolve22(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
12197
+ const fromNodeModules = resolve23(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
12161
12198
  if (existsSync17(fromNodeModules))
12162
12199
  return fromNodeModules;
12163
- return resolve22(import.meta.dir, "./dev/client");
12200
+ return resolve23(import.meta.dir, "./dev/client");
12164
12201
  }, devClientDir4, hmrClientPath5, formatDiagnosticMessage = (diagnostic) => {
12165
12202
  try {
12166
12203
  return ts2.flattenDiagnosticMessageText(diagnostic.messageText, `
@@ -12203,11 +12240,11 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
12203
12240
  if (hasJsLikeExtension(path))
12204
12241
  return `${path}${query}`;
12205
12242
  const importerDir = dirname14(importerOutputPath);
12206
- const fileCandidate = resolve22(importerDir, `${path}.js`);
12243
+ const fileCandidate = resolve23(importerDir, `${path}.js`);
12207
12244
  if (outputFiles?.has(fileCandidate) || existsSync17(fileCandidate)) {
12208
12245
  return `${path}.js${query}`;
12209
12246
  }
12210
- const indexCandidate = resolve22(importerDir, path, "index.js");
12247
+ const indexCandidate = resolve23(importerDir, path, "index.js");
12211
12248
  if (outputFiles?.has(indexCandidate) || existsSync17(indexCandidate)) {
12212
12249
  return `${path}/index.js${query}`;
12213
12250
  }
@@ -12235,7 +12272,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
12235
12272
  }, resolveLocalTsImport = (fromFile, specifier) => {
12236
12273
  if (!isRelativeModuleSpecifier(specifier))
12237
12274
  return null;
12238
- const basePath = resolve22(dirname14(fromFile), specifier);
12275
+ const basePath = resolve23(dirname14(fromFile), specifier);
12239
12276
  const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
12240
12277
  `${basePath}.ts`,
12241
12278
  `${basePath}.tsx`,
@@ -12246,7 +12283,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
12246
12283
  join19(basePath, "index.mts"),
12247
12284
  join19(basePath, "index.cts")
12248
12285
  ];
12249
- return candidates.map((candidate) => resolve22(candidate)).find((candidate) => existsSync17(candidate) && !candidate.endsWith(".d.ts")) ?? null;
12286
+ return candidates.map((candidate) => resolve23(candidate)).find((candidate) => existsSync17(candidate) && !candidate.endsWith(".d.ts")) ?? null;
12250
12287
  }, readFileForAotTransform = async (fileName, readFile6) => {
12251
12288
  const hostSource = readFile6?.(fileName);
12252
12289
  if (typeof hostSource === "string")
@@ -12281,7 +12318,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
12281
12318
  paths.push(join19(fileDir, urlMatch.replace(/['"]/g, "")));
12282
12319
  }
12283
12320
  }
12284
- return paths.map((path) => resolve22(path));
12321
+ return paths.map((path) => resolve23(path));
12285
12322
  }, readResourceCacheFile = async (cachePath) => {
12286
12323
  try {
12287
12324
  const entry = JSON.parse(await fs.readFile(cachePath, "utf-8"));
@@ -12323,7 +12360,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
12323
12360
  transformedFiles: 0
12324
12361
  };
12325
12362
  const transformFile = async (filePath) => {
12326
- const resolvedPath = resolve22(filePath);
12363
+ const resolvedPath = resolve23(filePath);
12327
12364
  if (visited.has(resolvedPath))
12328
12365
  return;
12329
12366
  visited.add(resolvedPath);
@@ -12358,7 +12395,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
12358
12395
  return { stats, transformedSources };
12359
12396
  }, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
12360
12397
  const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
12361
- const outputPath = resolve22(join19(outDir, relative11(process.cwd(), resolve22(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
12398
+ const outputPath = resolve23(join19(outDir, relative11(process.cwd(), resolve23(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
12362
12399
  return [
12363
12400
  outputPath,
12364
12401
  buildIslandMetadataExports(readFileSync13(inputPath, "utf-8"))
@@ -12369,7 +12406,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
12369
12406
  const tsLibDir = await traceAngularPhase("aot/resolve-typescript-lib", () => {
12370
12407
  const tsPath = __require.resolve("typescript");
12371
12408
  const tsRootDir = dirname14(tsPath);
12372
- return tsRootDir.endsWith("lib") ? tsRootDir : resolve22(tsRootDir, "lib");
12409
+ return tsRootDir.endsWith("lib") ? tsRootDir : resolve23(tsRootDir, "lib");
12373
12410
  });
12374
12411
  const config = await traceAngularPhase("aot/read-configuration", () => readConfiguration("./tsconfig.json"));
12375
12412
  const options = {
@@ -12411,7 +12448,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
12411
12448
  return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
12412
12449
  };
12413
12450
  const emitted = {};
12414
- const resolvedOutDir = resolve22(outDir);
12451
+ const resolvedOutDir = resolve23(outDir);
12415
12452
  host.writeFile = (fileName, text) => {
12416
12453
  const relativePath = resolveRelativePath(fileName, resolvedOutDir, outDir);
12417
12454
  emitted[relativePath] = text;
@@ -12433,12 +12470,12 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
12433
12470
  if (!fileName.endsWith(".ts") || fileName.endsWith(".d.ts")) {
12434
12471
  return source;
12435
12472
  }
12436
- const resolvedPath = resolve22(fileName);
12473
+ const resolvedPath = resolve23(fileName);
12437
12474
  return transformedSources.get(resolvedPath) ?? source;
12438
12475
  };
12439
12476
  const originalGetSourceFileForCompile = host.getSourceFile;
12440
12477
  host.getSourceFile = (fileName, languageVersion, onError) => {
12441
- const source = transformedSources.get(resolve22(fileName));
12478
+ const source = transformedSources.get(resolve23(fileName));
12442
12479
  if (source) {
12443
12480
  return ts2.createSourceFile(fileName, source, languageVersion, true);
12444
12481
  }
@@ -12462,7 +12499,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
12462
12499
  content,
12463
12500
  target: join19(outDir, fileName)
12464
12501
  }));
12465
- const outputFiles = new Set(rawEntries.map(({ target }) => resolve22(target)));
12502
+ const outputFiles = new Set(rawEntries.map(({ target }) => resolve23(target)));
12466
12503
  return rawEntries.map(({ content, target }) => {
12467
12504
  let processedContent = content.replace(/from\s+(['"])(\.\.?\/[^'"]+)(\1)/g, (match, quote, path) => {
12468
12505
  const rewritten = rewriteRelativeJsSpecifier(target, path, outputFiles);
@@ -12477,7 +12514,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
12477
12514
  return cleaned ? `import { ${cleaned}, InternalInjectFlags } from '@angular/core'` : `import { InternalInjectFlags } from '@angular/core'`;
12478
12515
  });
12479
12516
  processedContent = processedContent.replace(/\b(?<!Internal)InjectFlags\b/g, "InternalInjectFlags");
12480
- processedContent += islandMetadataByOutputPath.get(resolve22(target)) ?? "";
12517
+ processedContent += islandMetadataByOutputPath.get(resolve23(target)) ?? "";
12481
12518
  return { content: processedContent, target };
12482
12519
  });
12483
12520
  });
@@ -12486,7 +12523,9 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
12486
12523
  await fs.writeFile(target, content, "utf-8");
12487
12524
  })), { outputs: entries.length });
12488
12525
  return await traceAngularPhase("aot/collect-output-paths", () => entries.map(({ target }) => target), { outputs: entries.length });
12489
- }, compileAngularFile = async (inputPath, outDir, stylePreprocessors) => compileAngularFiles([inputPath], outDir, stylePreprocessors), jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), findUncommentedMatch = (source, pattern) => {
12526
+ }, compileAngularFile = async (inputPath, outDir, stylePreprocessors) => compileAngularFiles([inputPath], outDir, stylePreprocessors), jitContentCache, invalidateAngularJitCache = (filePath) => {
12527
+ jitContentCache.delete(resolve23(filePath));
12528
+ }, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), findUncommentedMatch = (source, pattern) => {
12490
12529
  const re2 = new RegExp(pattern.source, pattern.flags.includes("g") ? pattern.flags : pattern.flags + "g");
12491
12530
  let match;
12492
12531
  while ((match = re2.exec(source)) !== null) {
@@ -12498,7 +12537,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
12498
12537
  }
12499
12538
  return null;
12500
12539
  }, resolveAngularDeferImportSpecifier = () => {
12501
- const sourceEntry = resolve22(import.meta.dir, "../angular/components/index.ts");
12540
+ const sourceEntry = resolve23(import.meta.dir, "../angular/components/index.ts");
12502
12541
  if (existsSync17(sourceEntry)) {
12503
12542
  return sourceEntry.replace(/\\/g, "/");
12504
12543
  }
@@ -12728,10 +12767,10 @@ ${fields}
12728
12767
  source: result
12729
12768
  };
12730
12769
  }, compileAngularFileJIT = async (inputPath, outDir, rootDir, stylePreprocessors, cacheBuster) => {
12731
- const entryPath = resolve22(inputPath);
12770
+ const entryPath = resolve23(inputPath);
12732
12771
  const allOutputs = [];
12733
12772
  const visited = new Set;
12734
- const baseDir = resolve22(rootDir ?? process.cwd());
12773
+ const baseDir = resolve23(rootDir ?? process.cwd());
12735
12774
  let usesLegacyAnimations = false;
12736
12775
  const angularTranspiler = new Bun.Transpiler({
12737
12776
  loader: "ts",
@@ -12759,7 +12798,7 @@ ${fields}
12759
12798
  };
12760
12799
  const resolveLocalImport = (specifier, fromDir) => {
12761
12800
  if (specifier.startsWith(".") || specifier.startsWith("/")) {
12762
- return resolveSourceFile2(resolve22(fromDir, specifier));
12801
+ return resolveSourceFile2(resolve23(fromDir, specifier));
12763
12802
  }
12764
12803
  const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile2);
12765
12804
  if (aliased)
@@ -12768,7 +12807,7 @@ ${fields}
12768
12807
  const resolved = Bun.resolveSync(specifier, fromDir);
12769
12808
  if (resolved.includes("/node_modules/"))
12770
12809
  return;
12771
- const absolute = resolve22(resolved);
12810
+ const absolute = resolve23(resolved);
12772
12811
  if (!absolute.startsWith(baseDir))
12773
12812
  return;
12774
12813
  return resolveSourceFile2(absolute);
@@ -12817,13 +12856,13 @@ ${fields}
12817
12856
  return `${prefix}${dots}`;
12818
12857
  return `${prefix}../${dots}`;
12819
12858
  });
12820
- if (resolve22(actualPath) === entryPath) {
12859
+ if (resolve23(actualPath) === entryPath) {
12821
12860
  processedContent += buildIslandMetadataExports(sourceCode);
12822
12861
  }
12823
12862
  return processedContent;
12824
12863
  };
12825
12864
  const transpileFile = async (filePath) => {
12826
- const resolved = resolve22(filePath);
12865
+ const resolved = resolve23(filePath);
12827
12866
  if (visited.has(resolved))
12828
12867
  return;
12829
12868
  visited.add(resolved);
@@ -12875,7 +12914,7 @@ ${fields}
12875
12914
  importRewrites.set(specifier, relativeRewrite);
12876
12915
  return resolved2;
12877
12916
  }).filter((path) => Boolean(path));
12878
- const isEntry = resolve22(actualPath) === resolve22(entryPath);
12917
+ const isEntry = resolve23(actualPath) === resolve23(entryPath);
12879
12918
  const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
12880
12919
  const cacheKey2 = actualPath;
12881
12920
  const shouldWriteFile = cacheBuster && isEntry ? true : jitContentCache.get(cacheKey2) !== contentHash || !existsSync17(targetPath);
@@ -12911,10 +12950,29 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
12911
12950
  const compiledRoot = compiledParent;
12912
12951
  const indexesDir = join19(compiledParent, "indexes");
12913
12952
  await traceAngularPhase("setup/create-indexes-dir", () => fs.mkdir(indexesDir, { recursive: true }));
12914
- const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve22(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
12953
+ const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve23(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
12954
+ if (!hmr) {
12955
+ await traceAngularPhase("aot/copy-json-resources", async () => {
12956
+ const cwd = process.cwd();
12957
+ const angularSrcDir = resolve23(outRoot);
12958
+ if (!existsSync17(angularSrcDir))
12959
+ return;
12960
+ const jsonGlob = new Glob6("**/*.json");
12961
+ for (const rel of jsonGlob.scanSync({
12962
+ absolute: false,
12963
+ cwd: angularSrcDir
12964
+ })) {
12965
+ const sourcePath = join19(angularSrcDir, rel);
12966
+ const cwdRel = relative11(cwd, sourcePath);
12967
+ const targetPath = join19(compiledRoot, cwdRel);
12968
+ await fs.mkdir(dirname14(targetPath), { recursive: true });
12969
+ await fs.copyFile(sourcePath, targetPath);
12970
+ }
12971
+ });
12972
+ }
12915
12973
  const usesLegacyAngularAnimations = await traceAngularPhase("setup/legacy-animation-resolver", () => createLegacyAngularAnimationUsageResolver(outRoot));
12916
12974
  const compileTasks = entryPoints.map(async (entry) => {
12917
- const resolvedEntry = resolve22(entry);
12975
+ const resolvedEntry = resolve23(entry);
12918
12976
  const relativeEntry = relative11(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
12919
12977
  const compileEntry = () => compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors);
12920
12978
  let outputs = hmr ? await traceAngularPhase("jit/compile-entry", compileEntry, {
@@ -12926,10 +12984,10 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
12926
12984
  join19(compiledRoot, relativeEntry),
12927
12985
  join19(compiledRoot, "pages", jsName),
12928
12986
  join19(compiledRoot, jsName)
12929
- ].map((file4) => resolve22(file4));
12987
+ ].map((file4) => resolve23(file4));
12930
12988
  const resolveRawServerFile = (candidatePaths) => {
12931
12989
  const normalizedCandidates = [
12932
- ...candidatePaths.map((file4) => resolve22(file4)),
12990
+ ...candidatePaths.map((file4) => resolve23(file4)),
12933
12991
  ...compiledFallbackPaths
12934
12992
  ];
12935
12993
  let candidate = normalizedCandidates.find((file4) => existsSync17(file4) && file4.endsWith(`${sep3}pages${sep3}${jsName}`));
@@ -12985,7 +13043,6 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
12985
13043
  rewritten = `import '@angular/compiler';
12986
13044
  ${rewritten}`;
12987
13045
  }
12988
- rewritten = rewritten.replace(new RegExp(`templateUrl:\\s*['"]\\.\\/${fileBase}\\.html['"]`), `templateUrl: '../../pages/${fileBase}.html'`);
12989
13046
  if (detectedClassName && !rewritten.includes("export default")) {
12990
13047
  rewritten += `
12991
13048
  export default ${componentClassName};
@@ -13911,7 +13968,7 @@ __export(exports_fastHmrCompiler, {
13911
13968
  invalidateFingerprintCache: () => invalidateFingerprintCache
13912
13969
  });
13913
13970
  import { existsSync as existsSync18, readFileSync as readFileSync14, statSync } from "fs";
13914
- import { dirname as dirname15, extname as extname6, relative as relative12, resolve as resolve23 } from "path";
13971
+ import { dirname as dirname15, extname as extname6, relative as relative12, resolve as resolve24 } from "path";
13915
13972
  import ts6 from "typescript";
13916
13973
  var fail = (reason, detail, location) => ({
13917
13974
  ok: false,
@@ -14215,7 +14272,7 @@ var fail = (reason, detail, location) => ({
14215
14272
  if (!spec.startsWith(".") && !spec.startsWith("/")) {
14216
14273
  return true;
14217
14274
  }
14218
- const base = resolve23(componentDir, spec);
14275
+ const base = resolve24(componentDir, spec);
14219
14276
  const candidates = [
14220
14277
  `${base}.ts`,
14221
14278
  `${base}.tsx`,
@@ -15017,7 +15074,7 @@ var fail = (reason, detail, location) => ({
15017
15074
  return null;
15018
15075
  }, resolveDtsFromSpec = (spec, fromDir) => {
15019
15076
  const stripped = spec.replace(/\.[mc]?js$/, "");
15020
- const base = resolve23(fromDir, stripped);
15077
+ const base = resolve24(fromDir, stripped);
15021
15078
  const candidates = [
15022
15079
  `${base}.d.ts`,
15023
15080
  `${base}.d.mts`,
@@ -15041,7 +15098,7 @@ var fail = (reason, detail, location) => ({
15041
15098
  return null;
15042
15099
  }, resolveChildComponentInfo = (className, spec, componentDir, projectRoot) => {
15043
15100
  if (spec.startsWith(".") || spec.startsWith("/")) {
15044
- const base = resolve23(componentDir, spec);
15101
+ const base = resolve24(componentDir, spec);
15045
15102
  const candidates = [
15046
15103
  `${base}.ts`,
15047
15104
  `${base}.tsx`,
@@ -15140,7 +15197,18 @@ var fail = (reason, detail, location) => ({
15140
15197
  if (!initializerShapeIsStructural(init))
15141
15198
  continue;
15142
15199
  const name = member.name.getText();
15143
- const bodyHash = djb2Hash(init.getText());
15200
+ let bodyText;
15201
+ try {
15202
+ const printer = ts6.createPrinter({
15203
+ newLine: ts6.NewLineKind.LineFeed,
15204
+ omitTrailingSemicolon: true,
15205
+ removeComments: true
15206
+ });
15207
+ bodyText = printer.printNode(ts6.EmitHint.Unspecified, init, cls.getSourceFile());
15208
+ } catch {
15209
+ bodyText = init.getText();
15210
+ }
15211
+ const bodyHash = djb2Hash(bodyText);
15144
15212
  entries.push(`${name}:${bodyHash}`);
15145
15213
  }
15146
15214
  return entries.sort();
@@ -15247,13 +15315,13 @@ var fail = (reason, detail, location) => ({
15247
15315
  }
15248
15316
  if (!matches)
15249
15317
  continue;
15250
- const resolved = resolve23(componentDir, spec);
15318
+ const resolved = resolve24(componentDir, spec);
15251
15319
  for (const ext of TS_EXTENSIONS) {
15252
15320
  const candidate = resolved + ext;
15253
15321
  if (existsSync18(candidate))
15254
15322
  return candidate;
15255
15323
  }
15256
- const indexCandidate = resolve23(resolved, "index.ts");
15324
+ const indexCandidate = resolve24(resolved, "index.ts");
15257
15325
  if (existsSync18(indexCandidate))
15258
15326
  return indexCandidate;
15259
15327
  }
@@ -15349,15 +15417,21 @@ var fail = (reason, detail, location) => ({
15349
15417
  const providerImportSig = extractProviderImportSig(decoratorMeta.importsExpr, sourceFile, componentDir);
15350
15418
  const topLevelImports = extractTopLevelImports(sourceFile);
15351
15419
  const propertyFieldNames = extractPropertyFieldNames(cls);
15352
- const importsArraySig = decoratorMeta.importsExpr ? djb2Hash(decoratorMeta.importsExpr.getText()) : "";
15353
- const hostDirectivesSig = decoratorMeta.hostDirectivesExpr ? djb2Hash(decoratorMeta.hostDirectivesExpr.getText()) : "";
15354
- const animationsArraySig = decoratorMeta.animationsExpr ? djb2Hash(decoratorMeta.animationsExpr.getText()) : "";
15355
- const providersArraySig = decoratorMeta.providersExpr ? djb2Hash(decoratorMeta.providersExpr.getText()) : "";
15356
- const viewProvidersArraySig = decoratorMeta.viewProvidersExpr ? djb2Hash(decoratorMeta.viewProvidersExpr.getText()) : "";
15357
- const decoratorInputsArraySig = decoratorMeta.inputsArrayExpr ? djb2Hash(decoratorMeta.inputsArrayExpr.getText()) : "";
15358
- const decoratorOutputsArraySig = decoratorMeta.outputsArrayExpr ? djb2Hash(decoratorMeta.outputsArrayExpr.getText()) : "";
15359
- const hostBindingsSig = decoratorMeta.hostExpr ? djb2Hash(decoratorMeta.hostExpr.getText()) : "";
15360
- const schemasSig = decoratorMeta.schemasExpr ? djb2Hash(decoratorMeta.schemasExpr.getText()) : "";
15420
+ const printer = ts6.createPrinter({
15421
+ newLine: ts6.NewLineKind.LineFeed,
15422
+ omitTrailingSemicolon: true,
15423
+ removeComments: true
15424
+ });
15425
+ const canonicalText = (node) => printer.printNode(ts6.EmitHint.Unspecified, node, sourceFile);
15426
+ const importsArraySig = decoratorMeta.importsExpr ? djb2Hash(canonicalText(decoratorMeta.importsExpr)) : "";
15427
+ const hostDirectivesSig = decoratorMeta.hostDirectivesExpr ? djb2Hash(canonicalText(decoratorMeta.hostDirectivesExpr)) : "";
15428
+ const animationsArraySig = decoratorMeta.animationsExpr ? djb2Hash(canonicalText(decoratorMeta.animationsExpr)) : "";
15429
+ const providersArraySig = decoratorMeta.providersExpr ? djb2Hash(canonicalText(decoratorMeta.providersExpr)) : "";
15430
+ const viewProvidersArraySig = decoratorMeta.viewProvidersExpr ? djb2Hash(canonicalText(decoratorMeta.viewProvidersExpr)) : "";
15431
+ const decoratorInputsArraySig = decoratorMeta.inputsArrayExpr ? djb2Hash(canonicalText(decoratorMeta.inputsArrayExpr)) : "";
15432
+ const decoratorOutputsArraySig = decoratorMeta.outputsArrayExpr ? djb2Hash(canonicalText(decoratorMeta.outputsArrayExpr)) : "";
15433
+ const hostBindingsSig = decoratorMeta.hostExpr ? djb2Hash(canonicalText(decoratorMeta.hostExpr)) : "";
15434
+ const schemasSig = decoratorMeta.schemasExpr ? djb2Hash(canonicalText(decoratorMeta.schemasExpr)) : "";
15361
15435
  const PAGE_EXPORT_NAMES = new Set(["providers", "routes"]);
15362
15436
  const pageExportEntries = [];
15363
15437
  for (const stmt of sourceFile.statements) {
@@ -15373,7 +15447,7 @@ var fail = (reason, detail, location) => ({
15373
15447
  continue;
15374
15448
  if (!decl.initializer)
15375
15449
  continue;
15376
- pageExportEntries.push(`${decl.name.text}=${djb2Hash(decl.initializer.getText())}`);
15450
+ pageExportEntries.push(`${decl.name.text}=${djb2Hash(canonicalText(decl.initializer))}`);
15377
15451
  }
15378
15452
  }
15379
15453
  pageExportEntries.sort();
@@ -15480,7 +15554,7 @@ ${transpiled}
15480
15554
  }
15481
15555
  }${staticPatch}`;
15482
15556
  }, STYLE_PREPROCESSED_EXT, resolveAndReadStyleResource = (componentDir, url) => {
15483
- const abs = resolve23(componentDir, url);
15557
+ const abs = resolve24(componentDir, url);
15484
15558
  if (!existsSync18(abs))
15485
15559
  return null;
15486
15560
  const ext = extname6(abs).toLowerCase();
@@ -15520,7 +15594,7 @@ ${block}
15520
15594
  const cached = projectOptionsCache.get(projectRoot);
15521
15595
  if (cached !== undefined)
15522
15596
  return cached;
15523
- const tsconfigPath = resolve23(projectRoot, "tsconfig.json");
15597
+ const tsconfigPath = resolve24(projectRoot, "tsconfig.json");
15524
15598
  const opts = {};
15525
15599
  if (existsSync18(tsconfigPath)) {
15526
15600
  try {
@@ -15604,7 +15678,7 @@ ${block}
15604
15678
  templateText = decoratorMeta.template;
15605
15679
  templatePath = componentFilePath;
15606
15680
  } else if (decoratorMeta.templateUrl) {
15607
- const tplAbs = resolve23(componentDir, decoratorMeta.templateUrl);
15681
+ const tplAbs = resolve24(componentDir, decoratorMeta.templateUrl);
15608
15682
  if (!existsSync18(tplAbs)) {
15609
15683
  return fail("template-resource-not-found", `Template file not found: ${tplAbs}`, { file: componentFilePath });
15610
15684
  }
@@ -16367,7 +16441,7 @@ __export(exports_compileEmber, {
16367
16441
  });
16368
16442
  import { existsSync as existsSync19 } from "fs";
16369
16443
  import { mkdir as mkdir6, rm as rm4 } from "fs/promises";
16370
- import { basename as basename8, dirname as dirname16, extname as extname7, join as join20, resolve as resolve24 } from "path";
16444
+ import { basename as basename8, dirname as dirname16, extname as extname7, join as join20, resolve as resolve25 } from "path";
16371
16445
  var {build: bunBuild2, Transpiler: Transpiler4, write: write3, file: file4 } = globalThis.Bun;
16372
16446
  var cachedPreprocessor = null, getPreprocessor = async () => {
16373
16447
  if (cachedPreprocessor)
@@ -16463,7 +16537,7 @@ export const importSync = (specifier) => {
16463
16537
  const originalImporter = stagedSourceMap.get(args.importer);
16464
16538
  if (!originalImporter)
16465
16539
  return;
16466
- const candidateBase = resolve24(dirname16(originalImporter), args.path);
16540
+ const candidateBase = resolve25(dirname16(originalImporter), args.path);
16467
16541
  const extensionsToTry = ["", ".gts", ".gjs", ".ts", ".js"];
16468
16542
  for (const ext of extensionsToTry) {
16469
16543
  const candidate = candidateBase + ext;
@@ -16522,7 +16596,7 @@ export const renderToHTML = (props = {}) => {
16522
16596
  export { PageComponent };
16523
16597
  export default PageComponent;
16524
16598
  `, compileEmberFile = async (entry, compiledRoot, cwd = process.cwd()) => {
16525
- const resolvedEntry = resolve24(entry);
16599
+ const resolvedEntry = resolve25(entry);
16526
16600
  const source = await file4(resolvedEntry).text();
16527
16601
  let preprocessed = source;
16528
16602
  if (isTemplateTagFile(resolvedEntry)) {
@@ -16542,8 +16616,8 @@ export default PageComponent;
16542
16616
  mkdir6(serverDir, { recursive: true }),
16543
16617
  mkdir6(clientDir, { recursive: true })
16544
16618
  ]);
16545
- const tmpPagePath = resolve24(join20(tmpDir, `${baseName}.module.js`));
16546
- const tmpHarnessPath = resolve24(join20(tmpDir, `${baseName}.harness.js`));
16619
+ const tmpPagePath = resolve25(join20(tmpDir, `${baseName}.module.js`));
16620
+ const tmpHarnessPath = resolve25(join20(tmpDir, `${baseName}.harness.js`));
16547
16621
  await Promise.all([
16548
16622
  write3(tmpPagePath, transpiled),
16549
16623
  write3(tmpHarnessPath, generateServerHarness(tmpPagePath))
@@ -16585,7 +16659,7 @@ export default PageComponent;
16585
16659
  serverPaths: outputs.map((o3) => o3.serverPath)
16586
16660
  };
16587
16661
  }, compileEmberFileSource = async (entry) => {
16588
- const resolvedEntry = resolve24(entry);
16662
+ const resolvedEntry = resolve25(entry);
16589
16663
  const source = await file4(resolvedEntry).text();
16590
16664
  let preprocessed = source;
16591
16665
  if (isTemplateTagFile(resolvedEntry)) {
@@ -16618,24 +16692,24 @@ __export(exports_buildReactVendor, {
16618
16692
  buildReactVendor: () => buildReactVendor
16619
16693
  });
16620
16694
  import { existsSync as existsSync20, mkdirSync as mkdirSync7 } from "fs";
16621
- import { join as join21, resolve as resolve25 } from "path";
16695
+ import { join as join21, resolve as resolve26 } from "path";
16622
16696
  import { rm as rm5 } from "fs/promises";
16623
16697
  var {build: bunBuild3 } = globalThis.Bun;
16624
16698
  var resolveJsxDevRuntimeCompatPath = () => {
16625
16699
  const candidates = [
16626
- resolve25(import.meta.dir, "react", "jsxDevRuntimeCompat.js"),
16627
- resolve25(import.meta.dir, "src", "react", "jsxDevRuntimeCompat.ts"),
16628
- resolve25(import.meta.dir, "..", "react", "jsxDevRuntimeCompat.js"),
16629
- resolve25(import.meta.dir, "..", "src", "react", "jsxDevRuntimeCompat.ts"),
16630
- resolve25(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
16631
- resolve25(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
16700
+ resolve26(import.meta.dir, "react", "jsxDevRuntimeCompat.js"),
16701
+ resolve26(import.meta.dir, "src", "react", "jsxDevRuntimeCompat.ts"),
16702
+ resolve26(import.meta.dir, "..", "react", "jsxDevRuntimeCompat.js"),
16703
+ resolve26(import.meta.dir, "..", "src", "react", "jsxDevRuntimeCompat.ts"),
16704
+ resolve26(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
16705
+ resolve26(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
16632
16706
  ];
16633
16707
  for (const candidate of candidates) {
16634
16708
  if (existsSync20(candidate)) {
16635
16709
  return candidate.replace(/\\/g, "/");
16636
16710
  }
16637
16711
  }
16638
- return (candidates[0] ?? resolve25(import.meta.dir, "react", "jsxDevRuntimeCompat.js")).replace(/\\/g, "/");
16712
+ return (candidates[0] ?? resolve26(import.meta.dir, "react", "jsxDevRuntimeCompat.js")).replace(/\\/g, "/");
16639
16713
  }, jsxDevRuntimeCompatPath, reactSpecifiers, isResolvable = (specifier) => {
16640
16714
  try {
16641
16715
  Bun.resolveSync(specifier, process.cwd());
@@ -16746,7 +16820,7 @@ __export(exports_buildAngularVendor, {
16746
16820
  import { mkdirSync as mkdirSync8 } from "fs";
16747
16821
  import { join as join22 } from "path";
16748
16822
  import { rm as rm6 } from "fs/promises";
16749
- var {build: bunBuild4, Glob: Glob6 } = globalThis.Bun;
16823
+ var {build: bunBuild4, Glob: Glob7 } = globalThis.Bun;
16750
16824
  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) => {
16751
16825
  try {
16752
16826
  Bun.resolveSync(specifier, process.cwd());
@@ -16758,7 +16832,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
16758
16832
  const angular = new Set;
16759
16833
  const transitiveRoots = new Set;
16760
16834
  const transpiler6 = new Bun.Transpiler({ loader: "tsx" });
16761
- const glob = new Glob6("**/*.{ts,tsx,js,jsx}");
16835
+ const glob = new Glob7("**/*.{ts,tsx,js,jsx}");
16762
16836
  for (const dir of directories) {
16763
16837
  try {
16764
16838
  for await (const file5 of glob.scan({ absolute: true, cwd: dir })) {
@@ -17285,9 +17359,9 @@ import {
17285
17359
  statSync as statSync2,
17286
17360
  writeFileSync as writeFileSync8
17287
17361
  } from "fs";
17288
- import { basename as basename9, dirname as dirname17, extname as extname8, join as join26, relative as relative13, resolve as resolve26 } from "path";
17362
+ import { basename as basename9, dirname as dirname17, extname as extname8, join as join26, relative as relative13, resolve as resolve27 } from "path";
17289
17363
  import { cwd, env as env3, exit } from "process";
17290
- var {build: bunBuild7, Glob: Glob7 } = globalThis.Bun;
17364
+ var {build: bunBuild7, Glob: Glob8 } = globalThis.Bun;
17291
17365
  var isDev2, isBuildTraceEnabled = () => {
17292
17366
  const value = env3.ABSOLUTE_BUILD_TRACE?.toLowerCase();
17293
17367
  return value === "1" || value === "true" || value === "yes";
@@ -17361,7 +17435,7 @@ var isDev2, isBuildTraceEnabled = () => {
17361
17435
  exit(1);
17362
17436
  }, copyHtmxVendor = (htmxDir, htmxDestDir) => {
17363
17437
  mkdirSync11(htmxDestDir, { recursive: true });
17364
- const glob = new Glob7("htmx*.min.js");
17438
+ const glob = new Glob8("htmx*.min.js");
17365
17439
  for (const relPath of glob.scanSync({ cwd: htmxDir })) {
17366
17440
  const src = join26(htmxDir, relPath);
17367
17441
  const dest = join26(htmxDestDir, "htmx.min.js");
@@ -17376,8 +17450,8 @@ var isDev2, isBuildTraceEnabled = () => {
17376
17450
  }
17377
17451
  }, resolveAbsoluteVersion = async () => {
17378
17452
  const candidates = [
17379
- resolve26(import.meta.dir, "..", "..", "package.json"),
17380
- resolve26(import.meta.dir, "..", "package.json")
17453
+ resolve27(import.meta.dir, "..", "..", "package.json"),
17454
+ resolve27(import.meta.dir, "..", "package.json")
17381
17455
  ];
17382
17456
  const resolveCandidate = async (remaining) => {
17383
17457
  const [candidate, ...rest] = remaining;
@@ -17393,7 +17467,7 @@ var isDev2, isBuildTraceEnabled = () => {
17393
17467
  };
17394
17468
  await resolveCandidate(candidates);
17395
17469
  }, SKIP_DIRS, addWorkerPathIfExists = (file5, relPath, workerPaths) => {
17396
- const absPath = resolve26(file5, "..", relPath);
17470
+ const absPath = resolve27(file5, "..", relPath);
17397
17471
  try {
17398
17472
  statSync2(absPath);
17399
17473
  workerPaths.add(absPath);
@@ -17413,7 +17487,7 @@ var isDev2, isBuildTraceEnabled = () => {
17413
17487
  collectWorkerPathsFromContent(content, pattern, file5, workerPaths);
17414
17488
  }
17415
17489
  }, scanWorkerReferencesInDir = async (dir, patterns, workerPaths) => {
17416
- const glob = new Glob7("**/*.{ts,tsx,js,jsx,svelte,vue}");
17490
+ const glob = new Glob8("**/*.{ts,tsx,js,jsx,svelte,vue}");
17417
17491
  for await (const file5 of glob.scan({ absolute: true, cwd: dir })) {
17418
17492
  const relToDir = file5.slice(dir.length + 1);
17419
17493
  const [firstSegment] = relToDir.split("/");
@@ -17455,7 +17529,7 @@ var isDev2, isBuildTraceEnabled = () => {
17455
17529
  return;
17456
17530
  }
17457
17531
  const indexFiles = readDir(reactIndexesPath).filter((file5) => file5.endsWith(".tsx"));
17458
- const pagesRel = relative13(process.cwd(), resolve26(reactPagesPath)).replace(/\\/g, "/");
17532
+ const pagesRel = relative13(process.cwd(), resolve27(reactPagesPath)).replace(/\\/g, "/");
17459
17533
  for (const file5 of indexFiles) {
17460
17534
  let content = readFileSync15(join26(reactIndexesPath, file5), "utf-8");
17461
17535
  content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
@@ -17463,27 +17537,27 @@ var isDev2, isBuildTraceEnabled = () => {
17463
17537
  }
17464
17538
  }, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
17465
17539
  const svelteIndexDir = join26(getFrameworkGeneratedDir("svelte"), "indexes");
17466
- const sveltePageEntries = svelteEntries.filter((file5) => resolve26(file5).startsWith(resolve26(sveltePagesPath)));
17540
+ const sveltePageEntries = svelteEntries.filter((file5) => resolve27(file5).startsWith(resolve27(sveltePagesPath)));
17467
17541
  for (const entry of sveltePageEntries) {
17468
17542
  const name = basename9(entry).replace(/\.svelte(\.(ts|js))?$/, "");
17469
17543
  const indexFile = join26(svelteIndexDir, "pages", `${name}.js`);
17470
17544
  if (!existsSync21(indexFile))
17471
17545
  continue;
17472
17546
  let content = readFileSync15(indexFile, "utf-8");
17473
- const srcRel = relative13(process.cwd(), resolve26(entry)).replace(/\\/g, "/");
17547
+ const srcRel = relative13(process.cwd(), resolve27(entry)).replace(/\\/g, "/");
17474
17548
  content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
17475
17549
  writeFileSync8(join26(devIndexDir, `${name}.svelte.js`), content);
17476
17550
  }
17477
17551
  }, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
17478
17552
  const vueIndexDir = join26(getFrameworkGeneratedDir("vue"), "indexes");
17479
- const vuePageEntries = vueEntries.filter((file5) => resolve26(file5).startsWith(resolve26(vuePagesPath)));
17553
+ const vuePageEntries = vueEntries.filter((file5) => resolve27(file5).startsWith(resolve27(vuePagesPath)));
17480
17554
  for (const entry of vuePageEntries) {
17481
17555
  const name = basename9(entry, ".vue");
17482
17556
  const indexFile = join26(vueIndexDir, `${name}.js`);
17483
17557
  if (!existsSync21(indexFile))
17484
17558
  continue;
17485
17559
  let content = readFileSync15(indexFile, "utf-8");
17486
- const srcRel = relative13(process.cwd(), resolve26(entry)).replace(/\\/g, "/");
17560
+ const srcRel = relative13(process.cwd(), resolve27(entry)).replace(/\\/g, "/");
17487
17561
  content = content.replace(/import\s+Comp(?:\s*,\s*\*\s+as\s+\w+)?\s+from\s+['"]([^'"]+)['"]/, (match) => match.replace(/from\s+['"][^'"]+['"]/, `from "/@src/${srcRel}"`));
17488
17562
  writeFileSync8(join26(devIndexDir, `${name}.vue.js`), content);
17489
17563
  }
@@ -17496,7 +17570,7 @@ var isDev2, isBuildTraceEnabled = () => {
17496
17570
  const last = allComments[allComments.length - 1];
17497
17571
  if (!last?.[1])
17498
17572
  return JSON.stringify(outputPath);
17499
- const srcPath = resolve26(projectRoot, last[1].replace("/client/", "/").replace(/\.js$/, ".ts"));
17573
+ const srcPath = resolve27(projectRoot, last[1].replace("/client/", "/").replace(/\.js$/, ".ts"));
17500
17574
  return JSON.stringify(srcPath);
17501
17575
  }, QUOTE_CHARS, OPEN_BRACES, CLOSE_BRACES, findFunctionExpressionEnd = (content, startPos) => {
17502
17576
  let depth = 0;
@@ -17821,13 +17895,13 @@ ${content.slice(firstUseIdx)}`;
17821
17895
  const filterToIncrementalEntries = (entryPoints, mapToSource) => {
17822
17896
  if (!isIncremental || !incrementalFiles)
17823
17897
  return entryPoints;
17824
- const normalizedIncremental = new Set(incrementalFiles.map((f2) => resolve26(f2)));
17898
+ const normalizedIncremental = new Set(incrementalFiles.map((f2) => resolve27(f2)));
17825
17899
  const matchingEntries = [];
17826
17900
  for (const entry of entryPoints) {
17827
17901
  const sourceFile = mapToSource(entry);
17828
17902
  if (!sourceFile)
17829
17903
  continue;
17830
- if (!normalizedIncremental.has(resolve26(sourceFile)))
17904
+ if (!normalizedIncremental.has(resolve27(sourceFile)))
17831
17905
  continue;
17832
17906
  matchingEntries.push(entry);
17833
17907
  }
@@ -17842,7 +17916,15 @@ ${content.slice(firstUseIdx)}`;
17842
17916
  recursive: true
17843
17917
  }));
17844
17918
  }
17845
- const tailwindPromise = tailwind && (!isIncremental || normalizedIncrementalFiles?.some(isTailwindCandidate)) ? tracePhase("tailwind/build", () => compileTailwindConfig(tailwind, buildPath, styleTransformConfig)) : undefined;
17919
+ const tailwindPromise = tailwind && (!isIncremental || normalizedIncrementalFiles?.some(isTailwindCandidate)) ? tracePhase("tailwind/build", () => compileTailwindConfig(tailwind, buildPath, styleTransformConfig, computeFrameworkTailwindSources({
17920
+ angularDirectory,
17921
+ emberDirectory,
17922
+ htmlDirectory,
17923
+ htmxDirectory,
17924
+ reactDirectory,
17925
+ svelteDirectory,
17926
+ vueDirectory
17927
+ }), normalizedIncrementalFiles ?? [])) : undefined;
17846
17928
  const emptyConventionResult = {
17847
17929
  conventions: undefined,
17848
17930
  pageFiles: []
@@ -17874,7 +17956,7 @@ ${content.slice(firstUseIdx)}`;
17874
17956
  reactPagesPath ? tracePhase("scan/react-conventions", () => scanConventions(reactPagesPath, "*.tsx")) : emptyConventionResult,
17875
17957
  sveltePagesPath ? tracePhase("scan/svelte-conventions", () => scanConventions(sveltePagesPath, "*.svelte")) : emptyConventionResult,
17876
17958
  vuePagesPath ? tracePhase("scan/vue-conventions", () => scanConventions(vuePagesPath, "*.vue")) : emptyConventionResult,
17877
- angularPagesPath ? tracePhase("scan/angular-conventions", () => scanConventions(angularPagesPath, "*.ts")) : emptyConventionResult,
17959
+ angularPagesPath ? tracePhase("scan/angular-conventions", () => scanConventions(angularPagesPath, "**/*.ts")) : emptyConventionResult,
17878
17960
  emberPagesPath ? tracePhase("scan/ember-conventions", () => scanConventions(emberPagesPath, "*.{gjs,gts,ts}")) : emptyConventionResult,
17879
17961
  tracePhase("scan/html-conventions", async () => Promise.all(htmlConventionDirs.map((dir) => scanConventions(dir, "*.html")))),
17880
17962
  stylesDir ? tracePhase("scan/css", () => scanCssEntryPoints(stylesDir, stylesIgnore)) : []
@@ -17984,7 +18066,7 @@ ${content.slice(firstUseIdx)}`;
17984
18066
  }
17985
18067
  const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/html/") && (f2.endsWith(".html") || isStylePath(f2)));
17986
18068
  const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
17987
- if (entry.startsWith(resolve26(reactIndexesPath))) {
18069
+ if (entry.startsWith(resolve27(reactIndexesPath))) {
17988
18070
  const pageName = basename9(entry, ".tsx");
17989
18071
  return join26(reactPagesPath, `${pageName}.tsx`);
17990
18072
  }
@@ -18091,7 +18173,7 @@ ${content.slice(firstUseIdx)}`;
18091
18173
  const clientPath = islandSvelteClientPaths[idx];
18092
18174
  if (!sourcePath || !clientPath)
18093
18175
  continue;
18094
- islandSvelteClientPathMap.set(resolve26(sourcePath), clientPath);
18176
+ islandSvelteClientPathMap.set(resolve27(sourcePath), clientPath);
18095
18177
  }
18096
18178
  const islandVueClientPathMap = new Map;
18097
18179
  for (let idx = 0;idx < islandVueSources.length; idx++) {
@@ -18099,7 +18181,7 @@ ${content.slice(firstUseIdx)}`;
18099
18181
  const clientPath = islandVueClientPaths[idx];
18100
18182
  if (!sourcePath || !clientPath)
18101
18183
  continue;
18102
- islandVueClientPathMap.set(resolve26(sourcePath), clientPath);
18184
+ islandVueClientPathMap.set(resolve27(sourcePath), clientPath);
18103
18185
  }
18104
18186
  const islandAngularClientPathMap = new Map;
18105
18187
  for (let idx = 0;idx < islandAngularSources.length; idx++) {
@@ -18107,7 +18189,7 @@ ${content.slice(firstUseIdx)}`;
18107
18189
  const clientPath = islandAngularClientPaths[idx];
18108
18190
  if (!sourcePath || !clientPath)
18109
18191
  continue;
18110
- islandAngularClientPathMap.set(resolve26(sourcePath), clientPath);
18192
+ islandAngularClientPathMap.set(resolve27(sourcePath), clientPath);
18111
18193
  }
18112
18194
  const reactConventionSources = collectConventionSourceFiles(conventionsMap.react);
18113
18195
  const svelteConventionSources = collectConventionSourceFiles(conventionsMap.svelte);
@@ -18988,8 +19070,8 @@ __export(exports_dependencyGraph, {
18988
19070
  addFileToGraph: () => addFileToGraph
18989
19071
  });
18990
19072
  import { existsSync as existsSync23, readFileSync as readFileSync16 } from "fs";
18991
- var {Glob: Glob8 } = globalThis.Bun;
18992
- import { resolve as resolve27 } from "path";
19073
+ var {Glob: Glob9 } = globalThis.Bun;
19074
+ import { resolve as resolve28 } from "path";
18993
19075
  var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
18994
19076
  const lower = filePath.toLowerCase();
18995
19077
  if (lower.endsWith(".ts") || lower.endsWith(".tsx") || lower.endsWith(".jsx"))
@@ -19003,8 +19085,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
19003
19085
  if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
19004
19086
  return null;
19005
19087
  }
19006
- const fromDir = resolve27(fromFile, "..");
19007
- const normalized = resolve27(fromDir, importPath);
19088
+ const fromDir = resolve28(fromFile, "..");
19089
+ const normalized = resolve28(fromDir, importPath);
19008
19090
  const extensions = [
19009
19091
  ".ts",
19010
19092
  ".tsx",
@@ -19034,7 +19116,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
19034
19116
  dependents.delete(normalizedPath);
19035
19117
  }
19036
19118
  }, addFileToGraph = (graph, filePath) => {
19037
- const normalizedPath = resolve27(filePath);
19119
+ const normalizedPath = resolve28(filePath);
19038
19120
  if (!existsSync23(normalizedPath))
19039
19121
  return;
19040
19122
  const dependencies = extractDependencies(normalizedPath);
@@ -19048,13 +19130,23 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
19048
19130
  graph.dependents.get(dep)?.add(normalizedPath);
19049
19131
  };
19050
19132
  dependencies.forEach(addDependent);
19133
+ for (const [otherFile, otherDeps] of graph.dependencies) {
19134
+ if (otherFile === normalizedPath)
19135
+ continue;
19136
+ if (otherDeps.has(normalizedPath)) {
19137
+ if (!graph.dependents.has(normalizedPath)) {
19138
+ graph.dependents.set(normalizedPath, new Set);
19139
+ }
19140
+ graph.dependents.get(normalizedPath)?.add(otherFile);
19141
+ }
19142
+ }
19051
19143
  }, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
19052
19144
  const processedFiles = new Set;
19053
- const glob = new Glob8("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
19054
- const resolvedDirs = directories.map((dir) => resolve27(dir)).filter((dir) => existsSync23(dir));
19145
+ const glob = new Glob9("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
19146
+ const resolvedDirs = directories.map((dir) => resolve28(dir)).filter((dir) => existsSync23(dir));
19055
19147
  const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
19056
19148
  for (const file5 of allFiles) {
19057
- const fullPath = resolve27(file5);
19149
+ const fullPath = resolve28(file5);
19058
19150
  if (IGNORED_SEGMENTS.some((seg) => fullPath.includes(seg)))
19059
19151
  continue;
19060
19152
  if (processedFiles.has(fullPath))
@@ -19167,7 +19259,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
19167
19259
  return [];
19168
19260
  }
19169
19261
  }, getAffectedFiles = (graph, changedFile) => {
19170
- const normalizedPath = resolve27(changedFile);
19262
+ const normalizedPath = resolve28(changedFile);
19171
19263
  const affected = new Set;
19172
19264
  const toProcess = [normalizedPath];
19173
19265
  const processNode = (current) => {
@@ -19196,18 +19288,9 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
19196
19288
  }
19197
19289
  graph.dependencies.delete(normalizedPath);
19198
19290
  }, removeDependentsForFile = (graph, normalizedPath) => {
19199
- const dependents = graph.dependents.get(normalizedPath);
19200
- if (!dependents)
19201
- return;
19202
- for (const dependent of dependents) {
19203
- const depList = graph.dependencies.get(dependent);
19204
- if (!depList)
19205
- continue;
19206
- depList.delete(normalizedPath);
19207
- }
19208
19291
  graph.dependents.delete(normalizedPath);
19209
19292
  }, removeFileFromGraph = (graph, filePath) => {
19210
- const normalizedPath = resolve27(filePath);
19293
+ const normalizedPath = resolve28(filePath);
19211
19294
  removeDepsForFile(graph, normalizedPath);
19212
19295
  removeDependentsForFile(graph, normalizedPath);
19213
19296
  };
@@ -19250,12 +19333,12 @@ var globalVersionCounter = 0, createModuleVersionTracker = () => new Map, getNex
19250
19333
  };
19251
19334
 
19252
19335
  // src/dev/configResolver.ts
19253
- import { resolve as resolve28 } from "path";
19336
+ import { resolve as resolve29 } from "path";
19254
19337
  var resolveBuildPaths = (config) => {
19255
19338
  const cwd2 = process.cwd();
19256
19339
  const normalize = (path) => path.replace(/\\/g, "/");
19257
- const withDefault = (value, fallback) => normalize(resolve28(cwd2, value ?? fallback));
19258
- const optional = (value) => value ? normalize(resolve28(cwd2, value)) : undefined;
19340
+ const withDefault = (value, fallback) => normalize(resolve29(cwd2, value ?? fallback));
19341
+ const optional = (value) => value ? normalize(resolve29(cwd2, value)) : undefined;
19259
19342
  return {
19260
19343
  angularDir: optional(config.angularDirectory),
19261
19344
  assetsDir: optional(config.assetsDirectory),
@@ -19309,7 +19392,7 @@ var init_clientManager = __esm(() => {
19309
19392
 
19310
19393
  // src/dev/pathUtils.ts
19311
19394
  import { existsSync as existsSync24, readdirSync, readFileSync as readFileSync17 } from "fs";
19312
- import { dirname as dirname18, resolve as resolve29 } from "path";
19395
+ import { dirname as dirname18, resolve as resolve30 } from "path";
19313
19396
  var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
19314
19397
  if (shouldIgnorePath(filePath, resolved)) {
19315
19398
  return "ignored";
@@ -19385,7 +19468,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
19385
19468
  return "unknown";
19386
19469
  }, collectAngularResourceDirs = (angularDir) => {
19387
19470
  const out = new Set;
19388
- const angularRoot = resolve29(angularDir);
19471
+ const angularRoot = resolve30(angularDir);
19389
19472
  const angularRootNormalized = normalizePath(angularRoot);
19390
19473
  const walk = (dir) => {
19391
19474
  let entries;
@@ -19398,7 +19481,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
19398
19481
  if (entry.name.startsWith(".") || entry.name === "node_modules") {
19399
19482
  continue;
19400
19483
  }
19401
- const full = resolve29(dir, entry.name);
19484
+ const full = resolve30(dir, entry.name);
19402
19485
  if (entry.isDirectory()) {
19403
19486
  walk(full);
19404
19487
  continue;
@@ -19439,7 +19522,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
19439
19522
  }
19440
19523
  const componentDir = dirname18(full);
19441
19524
  for (const ref of refs) {
19442
- const refAbs = normalizePath(resolve29(componentDir, ref));
19525
+ const refAbs = normalizePath(resolve30(componentDir, ref));
19443
19526
  const refDir = normalizePath(dirname18(refAbs));
19444
19527
  if (refDir === angularRootNormalized || refDir.startsWith(angularRootNormalized + "/")) {
19445
19528
  continue;
@@ -19456,7 +19539,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
19456
19539
  const push = (path) => {
19457
19540
  if (!path)
19458
19541
  return;
19459
- const abs = normalizePath(resolve29(cwd2, path));
19542
+ const abs = normalizePath(resolve30(cwd2, path));
19460
19543
  if (!roots.includes(abs))
19461
19544
  roots.push(abs);
19462
19545
  };
@@ -19481,7 +19564,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
19481
19564
  push(cfg.assetsDir);
19482
19565
  push(cfg.stylesDir);
19483
19566
  for (const candidate of ["src", "db", "assets", "styles"]) {
19484
- const abs = normalizePath(resolve29(cwd2, candidate));
19567
+ const abs = normalizePath(resolve30(cwd2, candidate));
19485
19568
  if (existsSync24(abs) && !roots.includes(abs))
19486
19569
  roots.push(abs);
19487
19570
  }
@@ -19493,7 +19576,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
19493
19576
  continue;
19494
19577
  if (entry.name.startsWith("."))
19495
19578
  continue;
19496
- const abs = normalizePath(resolve29(cwd2, entry.name));
19579
+ const abs = normalizePath(resolve30(cwd2, entry.name));
19497
19580
  if (roots.includes(abs))
19498
19581
  continue;
19499
19582
  if (shouldIgnorePath(abs, resolved))
@@ -19567,8 +19650,8 @@ var init_pathUtils = __esm(() => {
19567
19650
 
19568
19651
  // src/dev/fileWatcher.ts
19569
19652
  import { watch } from "fs";
19570
- import { existsSync as existsSync25 } from "fs";
19571
- import { join as join28, resolve as resolve30 } from "path";
19653
+ import { existsSync as existsSync25, readdirSync as readdirSync2, statSync as statSync3 } from "fs";
19654
+ import { dirname as dirname19, join as join28, resolve as resolve31 } from "path";
19572
19655
  var safeRemoveFromGraph = (graph, fullPath) => {
19573
19656
  try {
19574
19657
  removeFileFromGraph(graph, fullPath);
@@ -19587,12 +19670,48 @@ var safeRemoveFromGraph = (graph, fullPath) => {
19587
19670
  operation: "add"
19588
19671
  });
19589
19672
  }
19590
- }, 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) => {
19591
- const watcher = watch(absolutePath, { recursive: true }, (event, filename) => {
19592
- if (!filename) {
19673
+ }, 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) => {
19674
+ const ATOMIC_RECOVERY_WINDOW_MS = 1000;
19675
+ const recentlySynthesized = new Map;
19676
+ const atomicRecoveryScan = (eventDir) => {
19677
+ let entries;
19678
+ try {
19679
+ entries = readdirSync2(eventDir);
19680
+ } catch {
19593
19681
  return;
19594
19682
  }
19683
+ const now = Date.now();
19684
+ for (const name of entries) {
19685
+ if (shouldSkipFilename(name, isStylesDir))
19686
+ continue;
19687
+ const child = join28(eventDir, name).replace(/\\/g, "/");
19688
+ let st2;
19689
+ try {
19690
+ st2 = statSync3(child);
19691
+ } catch {
19692
+ continue;
19693
+ }
19694
+ if (!st2.isFile())
19695
+ continue;
19696
+ const age = now - st2.ctimeMs;
19697
+ if (age < 0 || age > ATOMIC_RECOVERY_WINDOW_MS)
19698
+ continue;
19699
+ const last = recentlySynthesized.get(child) ?? 0;
19700
+ if (now - last < 100)
19701
+ continue;
19702
+ recentlySynthesized.set(child, now);
19703
+ onFileChange(child);
19704
+ safeAddToGraph(state.dependencyGraph, child);
19705
+ }
19706
+ };
19707
+ const watcher = watch(absolutePath, { recursive: true }, (event, filename) => {
19708
+ if (!filename)
19709
+ return;
19595
19710
  if (shouldSkipFilename(filename, isStylesDir)) {
19711
+ if (event === "rename") {
19712
+ const eventDir = dirname19(join28(absolutePath, filename)).replace(/\\/g, "/");
19713
+ atomicRecoveryScan(eventDir);
19714
+ }
19596
19715
  return;
19597
19716
  }
19598
19717
  const fullPath = join28(absolutePath, filename).replace(/\\/g, "/");
@@ -19613,7 +19732,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
19613
19732
  }, addFileWatchers = (state, paths, onFileChange) => {
19614
19733
  const stylesDir = state.resolvedPaths?.stylesDir;
19615
19734
  paths.forEach((path) => {
19616
- const absolutePath = resolve30(path).replace(/\\/g, "/");
19735
+ const absolutePath = resolve31(path).replace(/\\/g, "/");
19617
19736
  if (!existsSync25(absolutePath)) {
19618
19737
  return;
19619
19738
  }
@@ -19624,7 +19743,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
19624
19743
  const watchPaths = getWatchPaths(config, state.resolvedPaths);
19625
19744
  const stylesDir = state.resolvedPaths?.stylesDir;
19626
19745
  watchPaths.forEach((path) => {
19627
- const absolutePath = resolve30(path).replace(/\\/g, "/");
19746
+ const absolutePath = resolve31(path).replace(/\\/g, "/");
19628
19747
  if (!existsSync25(absolutePath)) {
19629
19748
  return;
19630
19749
  }
@@ -19636,16 +19755,21 @@ var init_fileWatcher = __esm(() => {
19636
19755
  init_telemetryEvent();
19637
19756
  init_dependencyGraph();
19638
19757
  init_pathUtils();
19758
+ ATOMIC_WRITE_TEMP_PATTERNS = [
19759
+ /(^|\/)sed[A-Za-z0-9]{6,}$/,
19760
+ /(^|\/)4913$/,
19761
+ /(^|\/)\.absolutejs-hmr-/
19762
+ ];
19639
19763
  });
19640
19764
 
19641
19765
  // src/dev/assetStore.ts
19642
- import { resolve as resolve31 } from "path";
19766
+ import { resolve as resolve32 } from "path";
19643
19767
  import { readdir as readdir4, unlink } from "fs/promises";
19644
19768
  var mimeTypes, getMimeType = (filePath) => {
19645
19769
  const ext = filePath.slice(filePath.lastIndexOf("."));
19646
19770
  return mimeTypes[ext] ?? "application/octet-stream";
19647
19771
  }, HASHED_FILE_RE, stripHash = (webPath) => webPath.replace(/\.[a-z0-9]{8}(\.(js|css|mjs))$/, "$1"), processWalkEntry = (entry, dir, liveByIdentity, walkAndClean) => {
19648
- const fullPath = resolve31(dir, entry.name);
19772
+ const fullPath = resolve32(dir, entry.name);
19649
19773
  if (entry.isDirectory()) {
19650
19774
  return walkAndClean(fullPath);
19651
19775
  }
@@ -19661,10 +19785,10 @@ var mimeTypes, getMimeType = (filePath) => {
19661
19785
  }, cleanStaleAssets = async (store, manifest, buildDir) => {
19662
19786
  const liveByIdentity = new Map;
19663
19787
  for (const webPath of store.keys()) {
19664
- const diskPath = resolve31(buildDir, webPath.slice(1));
19788
+ const diskPath = resolve32(buildDir, webPath.slice(1));
19665
19789
  liveByIdentity.set(stripHash(diskPath), diskPath);
19666
19790
  }
19667
- const absBuildDir = resolve31(buildDir);
19791
+ const absBuildDir = resolve32(buildDir);
19668
19792
  Object.values(manifest).forEach((val) => {
19669
19793
  if (!HASHED_FILE_RE.test(val))
19670
19794
  return;
@@ -19682,7 +19806,7 @@ var mimeTypes, getMimeType = (filePath) => {
19682
19806
  } catch {}
19683
19807
  }, lookupAsset = (store, path) => store.get(path), processScanEntry = (entry, dir, prefix, store, scanDir) => {
19684
19808
  if (entry.isDirectory()) {
19685
- return scanDir(resolve31(dir, entry.name), `${prefix}${entry.name}/`);
19809
+ return scanDir(resolve32(dir, entry.name), `${prefix}${entry.name}/`);
19686
19810
  }
19687
19811
  if (!entry.name.startsWith("chunk-")) {
19688
19812
  return null;
@@ -19691,7 +19815,7 @@ var mimeTypes, getMimeType = (filePath) => {
19691
19815
  if (store.has(webPath)) {
19692
19816
  return null;
19693
19817
  }
19694
- return Bun.file(resolve31(dir, entry.name)).bytes().then((bytes) => {
19818
+ return Bun.file(resolve32(dir, entry.name)).bytes().then((bytes) => {
19695
19819
  store.set(webPath, bytes);
19696
19820
  return;
19697
19821
  }).catch(() => {});
@@ -19713,7 +19837,7 @@ var mimeTypes, getMimeType = (filePath) => {
19713
19837
  for (const webPath of newIdentities.values()) {
19714
19838
  if (store.has(webPath))
19715
19839
  continue;
19716
- loadPromises.push(Bun.file(resolve31(buildDir, webPath.slice(1))).bytes().then((bytes) => {
19840
+ loadPromises.push(Bun.file(resolve32(buildDir, webPath.slice(1))).bytes().then((bytes) => {
19717
19841
  store.set(webPath, bytes);
19718
19842
  return;
19719
19843
  }).catch(() => {}));
@@ -19839,9 +19963,9 @@ var init_transformCache = __esm(() => {
19839
19963
  });
19840
19964
 
19841
19965
  // src/dev/reactComponentClassifier.ts
19842
- import { resolve as resolve32 } from "path";
19966
+ import { resolve as resolve33 } from "path";
19843
19967
  var classifyComponent = (filePath) => {
19844
- const normalizedPath = resolve32(filePath);
19968
+ const normalizedPath = resolve33(filePath);
19845
19969
  if (normalizedPath.includes("/react/pages/")) {
19846
19970
  return "server";
19847
19971
  }
@@ -19853,7 +19977,7 @@ var classifyComponent = (filePath) => {
19853
19977
  var init_reactComponentClassifier = () => {};
19854
19978
 
19855
19979
  // src/dev/moduleMapper.ts
19856
- import { basename as basename10, resolve as resolve33 } from "path";
19980
+ import { basename as basename10, resolve as resolve34 } from "path";
19857
19981
  var buildModulePaths = (moduleKeys, manifest) => {
19858
19982
  const modulePaths = {};
19859
19983
  moduleKeys.forEach((key) => {
@@ -19863,7 +19987,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
19863
19987
  });
19864
19988
  return modulePaths;
19865
19989
  }, processChangedFile = (sourceFile, framework, manifest, resolvedPaths, processedFiles) => {
19866
- const normalizedFile = resolve33(sourceFile);
19990
+ const normalizedFile = resolve34(sourceFile);
19867
19991
  const normalizedPath = normalizedFile.replace(/\\/g, "/");
19868
19992
  if (processedFiles.has(normalizedFile)) {
19869
19993
  return null;
@@ -19899,7 +20023,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
19899
20023
  });
19900
20024
  return grouped;
19901
20025
  }, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
19902
- const normalizedFile = resolve33(sourceFile);
20026
+ const normalizedFile = resolve34(sourceFile);
19903
20027
  const fileName = basename10(normalizedFile);
19904
20028
  const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
19905
20029
  const pascalName = toPascal(baseName);
@@ -19960,15 +20084,15 @@ __export(exports_resolveOwningComponents, {
19960
20084
  resolveDescendantsOfParent: () => resolveDescendantsOfParent,
19961
20085
  invalidateResourceIndex: () => invalidateResourceIndex
19962
20086
  });
19963
- import { readdirSync as readdirSync2, readFileSync as readFileSync19, statSync as statSync3 } from "fs";
19964
- import { dirname as dirname19, extname as extname9, join as join29, resolve as resolve34 } from "path";
20087
+ import { readdirSync as readdirSync3, readFileSync as readFileSync19, statSync as statSync4 } from "fs";
20088
+ import { dirname as dirname20, extname as extname9, join as join29, resolve as resolve35 } from "path";
19965
20089
  import ts7 from "typescript";
19966
20090
  var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") || file5.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
19967
20091
  const out = [];
19968
20092
  const visit = (dir) => {
19969
20093
  let entries;
19970
20094
  try {
19971
- entries = readdirSync2(dir, { withFileTypes: true });
20095
+ entries = readdirSync3(dir, { withFileTypes: true });
19972
20096
  } catch {
19973
20097
  return;
19974
20098
  }
@@ -20074,7 +20198,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
20074
20198
  };
20075
20199
  visit(sourceFile);
20076
20200
  return out;
20077
- }, safeNormalize = (path) => resolve34(path).replace(/\\/g, "/"), resolveOwningComponents = (params) => {
20201
+ }, safeNormalize = (path) => resolve35(path).replace(/\\/g, "/"), resolveOwningComponents = (params) => {
20078
20202
  const { changedFilePath, userAngularRoot } = params;
20079
20203
  const changedAbs = safeNormalize(changedFilePath);
20080
20204
  const out = [];
@@ -20095,7 +20219,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
20095
20219
  }
20096
20220
  let rootStat;
20097
20221
  try {
20098
- rootStat = statSync3(userAngularRoot);
20222
+ rootStat = statSync4(userAngularRoot);
20099
20223
  } catch {
20100
20224
  return out;
20101
20225
  }
@@ -20115,7 +20239,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
20115
20239
  return null;
20116
20240
  }
20117
20241
  const sf = ts7.createSourceFile(childFilePath, source, ts7.ScriptTarget.ES2022, true, ts7.ScriptKind.TS);
20118
- const childDir = dirname19(childFilePath);
20242
+ const childDir = dirname20(childFilePath);
20119
20243
  for (const stmt of sf.statements) {
20120
20244
  if (!ts7.isImportDeclaration(stmt))
20121
20245
  continue;
@@ -20143,7 +20267,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
20143
20267
  if (!spec.startsWith(".") && !spec.startsWith("/")) {
20144
20268
  return null;
20145
20269
  }
20146
- const base = resolve34(childDir, spec);
20270
+ const base = resolve35(childDir, spec);
20147
20271
  const candidates = [
20148
20272
  `${base}.ts`,
20149
20273
  `${base}.tsx`,
@@ -20153,7 +20277,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
20153
20277
  const angularRootNorm = safeNormalize(angularRoot);
20154
20278
  for (const candidate of candidates) {
20155
20279
  try {
20156
- if (statSync3(candidate).isFile()) {
20280
+ if (statSync4(candidate).isFile()) {
20157
20281
  const norm = safeNormalize(candidate);
20158
20282
  if (!norm.startsWith(angularRootNorm))
20159
20283
  return null;
@@ -20172,7 +20296,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
20172
20296
  const parentFile = new Map;
20173
20297
  for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
20174
20298
  const classes = parseDecoratedClasses(tsPath);
20175
- const componentDir = dirname19(tsPath);
20299
+ const componentDir = dirname20(tsPath);
20176
20300
  for (const cls of classes) {
20177
20301
  const entity = {
20178
20302
  className: cls.className,
@@ -20181,7 +20305,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
20181
20305
  };
20182
20306
  if (cls.kind === "component") {
20183
20307
  for (const url of [...cls.templateUrls, ...cls.styleUrls]) {
20184
- const abs = safeNormalize(resolve34(componentDir, url));
20308
+ const abs = safeNormalize(resolve35(componentDir, url));
20185
20309
  const existing = resource.get(abs);
20186
20310
  if (existing)
20187
20311
  existing.push(entity);
@@ -20208,7 +20332,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
20208
20332
  const norm = safeNormalize(params.changedFilePath);
20209
20333
  let rootStat;
20210
20334
  try {
20211
- rootStat = statSync3(params.userAngularRoot);
20335
+ rootStat = statSync4(params.userAngularRoot);
20212
20336
  } catch {
20213
20337
  return [];
20214
20338
  }
@@ -20230,6 +20354,13 @@ var init_resolveOwningComponents = __esm(() => {
20230
20354
  });
20231
20355
 
20232
20356
  // src/dev/webSocket.ts
20357
+ var exports_webSocket = {};
20358
+ __export(exports_webSocket, {
20359
+ handleHMRMessage: () => handleHMRMessage,
20360
+ handleClientDisconnect: () => handleClientDisconnect,
20361
+ handleClientConnect: () => handleClientConnect,
20362
+ broadcastToClients: () => broadcastToClients
20363
+ });
20233
20364
  var trySendMessage = (client2, messageStr) => {
20234
20365
  try {
20235
20366
  client2.send(messageStr);
@@ -20330,14 +20461,6 @@ var init_webSocket = __esm(() => {
20330
20461
  init_logger();
20331
20462
  });
20332
20463
 
20333
- // src/core/ssrCache.ts
20334
- var dirtyFrameworks, isSsrCacheDirty = (framework) => dirtyFrameworks.has(framework), markSsrCacheDirty = (framework) => {
20335
- dirtyFrameworks.add(framework);
20336
- };
20337
- var init_ssrCache = __esm(() => {
20338
- dirtyFrameworks = new Set;
20339
- });
20340
-
20341
20464
  // src/dev/moduleServer.ts
20342
20465
  var exports_moduleServer = {};
20343
20466
  __export(exports_moduleServer, {
@@ -20349,8 +20472,8 @@ __export(exports_moduleServer, {
20349
20472
  createModuleServer: () => createModuleServer,
20350
20473
  SRC_URL_PREFIX: () => SRC_URL_PREFIX
20351
20474
  });
20352
- import { existsSync as existsSync26, readFileSync as readFileSync20, statSync as statSync4 } from "fs";
20353
- import { basename as basename11, dirname as dirname20, extname as extname10, join as join30, resolve as resolve35, relative as relative14 } from "path";
20475
+ import { existsSync as existsSync26, readFileSync as readFileSync20, statSync as statSync5 } from "fs";
20476
+ import { basename as basename11, dirname as dirname21, extname as extname10, join as join30, resolve as resolve36, relative as relative14 } from "path";
20354
20477
  var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
20355
20478
  const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
20356
20479
  const allExports = [];
@@ -20370,7 +20493,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
20370
20493
  ${stubs}
20371
20494
  `;
20372
20495
  }, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
20373
- const found = extensions.find((ext) => existsSync26(resolve35(projectRoot, srcPath + ext)));
20496
+ const found = extensions.find((ext) => existsSync26(resolve36(projectRoot, srcPath + ext)));
20374
20497
  return found ? srcPath + found : srcPath;
20375
20498
  }, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
20376
20499
  const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
@@ -20385,24 +20508,24 @@ ${stubs}
20385
20508
  return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
20386
20509
  }, srcUrl = (relPath, projectRoot) => {
20387
20510
  const base = `${SRC_PREFIX}${relPath.replace(/\\/g, "/")}`;
20388
- const absPath = resolve35(projectRoot, relPath);
20511
+ const absPath = resolve36(projectRoot, relPath);
20389
20512
  const cached = mtimeCache.get(absPath);
20390
20513
  if (cached !== undefined)
20391
20514
  return `${base}?v=${buildVersion(cached, absPath)}`;
20392
20515
  try {
20393
- const mtime = Math.round(statSync4(absPath).mtimeMs);
20516
+ const mtime = Math.round(statSync5(absPath).mtimeMs);
20394
20517
  mtimeCache.set(absPath, mtime);
20395
20518
  return `${base}?v=${buildVersion(mtime, absPath)}`;
20396
20519
  } catch {
20397
20520
  return base;
20398
20521
  }
20399
20522
  }, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
20400
- const absPath = resolve35(fileDir, relPath);
20523
+ const absPath = resolve36(fileDir, relPath);
20401
20524
  const rel = relative14(projectRoot, absPath);
20402
20525
  const extension = extname10(rel);
20403
20526
  let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
20404
20527
  if (extname10(srcPath) === ".svelte") {
20405
- srcPath = relative14(projectRoot, resolveSvelteModulePath(resolve35(projectRoot, srcPath)));
20528
+ srcPath = relative14(projectRoot, resolveSvelteModulePath(resolve36(projectRoot, srcPath)));
20406
20529
  }
20407
20530
  return srcUrl(srcPath, projectRoot);
20408
20531
  }, NODE_BUILTIN_RE, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
@@ -20421,13 +20544,13 @@ ${stubs}
20421
20544
  const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
20422
20545
  const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
20423
20546
  if (!subpath) {
20424
- const pkgDir = resolve35(projectRoot, "node_modules", packageName ?? "");
20547
+ const pkgDir = resolve36(projectRoot, "node_modules", packageName ?? "");
20425
20548
  const pkgJsonPath = join30(pkgDir, "package.json");
20426
20549
  if (existsSync26(pkgJsonPath)) {
20427
20550
  const pkg = JSON.parse(readFileSync20(pkgJsonPath, "utf-8"));
20428
20551
  const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
20429
20552
  if (esmEntry) {
20430
- const resolved = resolve35(pkgDir, esmEntry);
20553
+ const resolved = resolve36(pkgDir, esmEntry);
20431
20554
  if (existsSync26(resolved))
20432
20555
  return relative14(projectRoot, resolved);
20433
20556
  }
@@ -20459,7 +20582,7 @@ ${stubs}
20459
20582
  };
20460
20583
  result = result.replace(/^((?:import\s+[\s\S]+?\s+from|export\s+[\s\S]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
20461
20584
  result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
20462
- const fileDir = dirname20(filePath);
20585
+ const fileDir = dirname21(filePath);
20463
20586
  result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
20464
20587
  result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
20465
20588
  result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
@@ -20474,12 +20597,12 @@ ${stubs}
20474
20597
  result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, rewriteAbsoluteToSrc);
20475
20598
  result = result.replace(/(import\s*\(\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["']\s*\))/g, rewriteAbsoluteToSrc);
20476
20599
  result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
20477
- const absPath = resolve35(fileDir, relPath);
20600
+ const absPath = resolve36(fileDir, relPath);
20478
20601
  const rel = relative14(projectRoot, absPath);
20479
20602
  return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
20480
20603
  });
20481
20604
  result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
20482
- const absPath = resolve35(fileDir, relPath);
20605
+ const absPath = resolve36(fileDir, relPath);
20483
20606
  const rel = relative14(projectRoot, absPath);
20484
20607
  return `'${srcUrl(rel, projectRoot)}'`;
20485
20608
  });
@@ -20792,7 +20915,7 @@ ${code}`;
20792
20915
  code = injectVueHmr(code, filePath, projectRoot, vueDir);
20793
20916
  return rewriteImports(code, filePath, projectRoot, rewriter);
20794
20917
  }, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
20795
- const hmrBase = vueDir ? resolve35(vueDir) : projectRoot;
20918
+ const hmrBase = vueDir ? resolve36(vueDir) : projectRoot;
20796
20919
  const hmrId = relative14(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
20797
20920
  let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
20798
20921
  result += [
@@ -20956,7 +21079,7 @@ export default {};
20956
21079
  const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
20957
21080
  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);`);
20958
21081
  }, resolveSourcePath = (relPath, projectRoot) => {
20959
- const filePath = resolve35(projectRoot, relPath);
21082
+ const filePath = resolve36(projectRoot, relPath);
20960
21083
  const ext = extname10(filePath);
20961
21084
  if (ext === ".svelte")
20962
21085
  return { ext, filePath: resolveSvelteModulePath(filePath) };
@@ -20993,14 +21116,14 @@ export default {};
20993
21116
  const absoluteCandidate = "/" + tail.replace(/^\/+/, "");
20994
21117
  const candidates = [
20995
21118
  absoluteCandidate,
20996
- resolve35(projectRoot, tail)
21119
+ resolve36(projectRoot, tail)
20997
21120
  ];
20998
21121
  try {
20999
21122
  const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_loadConfig(), exports_loadConfig));
21000
21123
  const cfg = await loadConfig2();
21001
- const angularDir = cfg.angularDirectory && resolve35(projectRoot, cfg.angularDirectory);
21124
+ const angularDir = cfg.angularDirectory && resolve36(projectRoot, cfg.angularDirectory);
21002
21125
  if (angularDir)
21003
- candidates.push(resolve35(angularDir, tail));
21126
+ candidates.push(resolve36(angularDir, tail));
21004
21127
  } catch {}
21005
21128
  for (const candidate of candidates) {
21006
21129
  if (await fileExists(candidate)) {
@@ -21030,8 +21153,8 @@ export default {};
21030
21153
  return transformAndCacheVue(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
21031
21154
  if (!TRANSPILABLE.has(ext))
21032
21155
  return;
21033
- const stat3 = statSync4(filePath);
21034
- const resolvedVueDir = vueDir ? resolve35(vueDir) : undefined;
21156
+ const stat3 = statSync5(filePath);
21157
+ const resolvedVueDir = vueDir ? resolve36(vueDir) : undefined;
21035
21158
  let content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
21036
21159
  const isAngularGeneratedJs = ext === ".js" && filePath.replace(/\\/g, "/").includes("/.absolutejs/generated/angular/");
21037
21160
  if (isAngularGeneratedJs) {
@@ -21058,12 +21181,12 @@ export default {};
21058
21181
  cachedAngularUserRoot = configuredAngularUserRoot ?? null;
21059
21182
  return cachedAngularUserRoot;
21060
21183
  }, configuredAngularUserRoot, transformAndCacheSvelte = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
21061
- const stat3 = statSync4(filePath);
21184
+ const stat3 = statSync5(filePath);
21062
21185
  const content = await transformSvelteFile(filePath, projectRoot, rewriter, stylePreprocessors);
21063
21186
  setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
21064
21187
  return jsResponse(content);
21065
21188
  }, transformAndCacheVue = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
21066
- const stat3 = statSync4(filePath);
21189
+ const stat3 = statSync5(filePath);
21067
21190
  const content = await transformVueFile(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
21068
21191
  setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
21069
21192
  return jsResponse(content);
@@ -21090,7 +21213,7 @@ export default {};
21090
21213
  const relPath = pathname.slice(SRC_PREFIX.length);
21091
21214
  if (relPath === "bun:wrap" || relPath.startsWith("bun:wrap?"))
21092
21215
  return handleBunWrapRequest();
21093
- const virtualCssResponse = handleVirtualSvelteCss(resolve35(projectRoot, relPath));
21216
+ const virtualCssResponse = handleVirtualSvelteCss(resolve36(projectRoot, relPath));
21094
21217
  if (virtualCssResponse)
21095
21218
  return virtualCssResponse;
21096
21219
  const { filePath, ext } = resolveSourcePath(relPath, projectRoot);
@@ -21106,11 +21229,11 @@ export default {};
21106
21229
  SRC_IMPORT_RE.lastIndex = 0;
21107
21230
  while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
21108
21231
  if (match[1])
21109
- files.push(resolve35(projectRoot, match[1]));
21232
+ files.push(resolve36(projectRoot, match[1]));
21110
21233
  }
21111
21234
  return files;
21112
21235
  }, invalidateModule = (filePath) => {
21113
- const resolved = resolve35(filePath);
21236
+ const resolved = resolve36(filePath);
21114
21237
  invalidate(filePath);
21115
21238
  if (resolved !== filePath)
21116
21239
  invalidate(resolved);
@@ -21255,7 +21378,7 @@ __export(exports_hmrCompiler, {
21255
21378
  getApplyMetadataModule: () => getApplyMetadataModule,
21256
21379
  encodeHmrComponentId: () => encodeHmrComponentId
21257
21380
  });
21258
- import { dirname as dirname21, relative as relative15, resolve as resolve36 } from "path";
21381
+ import { dirname as dirname22, relative as relative15, resolve as resolve37 } from "path";
21259
21382
  import { performance as performance2 } from "perf_hooks";
21260
21383
  var getApplyMetadataModule = async (encodedId) => {
21261
21384
  const decoded = decodeURIComponent(encodedId);
@@ -21264,7 +21387,7 @@ var getApplyMetadataModule = async (encodedId) => {
21264
21387
  return null;
21265
21388
  const filePathRel = decoded.slice(0, at2);
21266
21389
  const className = decoded.slice(at2 + 1);
21267
- const componentFilePath = resolve36(process.cwd(), filePathRel);
21390
+ const componentFilePath = resolve37(process.cwd(), filePathRel);
21268
21391
  const projectRelPath = relative15(process.cwd(), componentFilePath).replace(/\\/g, "/");
21269
21392
  const cacheKey2 = encodeURIComponent(`${projectRelPath}@${className}`);
21270
21393
  const { takePendingModule: takePendingModule2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
@@ -21275,7 +21398,7 @@ var getApplyMetadataModule = async (encodedId) => {
21275
21398
  const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
21276
21399
  const owners = resolveOwningComponents2({
21277
21400
  changedFilePath: componentFilePath,
21278
- userAngularRoot: dirname21(componentFilePath)
21401
+ userAngularRoot: dirname22(componentFilePath)
21279
21402
  });
21280
21403
  const owner = owners.find((o3) => o3.className === className);
21281
21404
  const kind = owner?.kind ?? "component";
@@ -21375,7 +21498,6 @@ var resolveRequestPathname = (request) => {
21375
21498
  moduleUrl.searchParams.set("t", String(emberCacheBuster));
21376
21499
  return moduleUrl.href;
21377
21500
  }, invalidateEmberSsrCache = () => {
21378
- markSsrCacheDirty("ember");
21379
21501
  emberCacheBuster = Date.now();
21380
21502
  }, buildHtmlShell = (headTag, bodyContent, indexPath, props) => {
21381
21503
  const propsScript = `window.__INITIAL_PROPS__=${JSON.stringify(props ?? {})};`;
@@ -21389,7 +21511,6 @@ var resolveRequestPathname = (request) => {
21389
21511
  const resolvedHeadTag = headTag ?? "<head></head>";
21390
21512
  try {
21391
21513
  installSimpleDomGlobals();
21392
- isSsrCacheDirty("ember");
21393
21514
  const bundle = await import(buildRuntimeModuleSpecifier(pagePath));
21394
21515
  if (typeof bundle.renderToHTML !== "function") {
21395
21516
  throw new Error(`Ember page bundle at ${pagePath} does not export renderToHTML(). Was it compiled by compileEmber()?`);
@@ -21407,9 +21528,7 @@ var resolveRequestPathname = (request) => {
21407
21528
  });
21408
21529
  }
21409
21530
  };
21410
- var init_pageHandler = __esm(() => {
21411
- init_ssrCache();
21412
- });
21531
+ var init_pageHandler = () => {};
21413
21532
 
21414
21533
  // src/ember/index.ts
21415
21534
  var exports_ember = {};
@@ -21426,11 +21545,11 @@ var exports_simpleHTMLHMR = {};
21426
21545
  __export(exports_simpleHTMLHMR, {
21427
21546
  handleHTMLUpdate: () => handleHTMLUpdate
21428
21547
  });
21429
- import { resolve as resolve37 } from "path";
21548
+ import { resolve as resolve38 } from "path";
21430
21549
  var handleHTMLUpdate = async (htmlFilePath) => {
21431
21550
  let htmlContent;
21432
21551
  try {
21433
- const resolvedPath = resolve37(htmlFilePath);
21552
+ const resolvedPath = resolve38(htmlFilePath);
21434
21553
  const file5 = Bun.file(resolvedPath);
21435
21554
  if (!await file5.exists()) {
21436
21555
  return null;
@@ -21456,11 +21575,11 @@ var exports_simpleHTMXHMR = {};
21456
21575
  __export(exports_simpleHTMXHMR, {
21457
21576
  handleHTMXUpdate: () => handleHTMXUpdate
21458
21577
  });
21459
- import { resolve as resolve38 } from "path";
21578
+ import { resolve as resolve39 } from "path";
21460
21579
  var handleHTMXUpdate = async (htmxFilePath) => {
21461
21580
  let htmlContent;
21462
21581
  try {
21463
- const resolvedPath = resolve38(htmxFilePath);
21582
+ const resolvedPath = resolve39(htmxFilePath);
21464
21583
  const file5 = Bun.file(resolvedPath);
21465
21584
  if (!await file5.exists()) {
21466
21585
  return null;
@@ -21482,19 +21601,20 @@ var handleHTMXUpdate = async (htmxFilePath) => {
21482
21601
  var init_simpleHTMXHMR = () => {};
21483
21602
 
21484
21603
  // src/dev/rebuildTrigger.ts
21485
- import { existsSync as existsSync27 } from "fs";
21486
- import { basename as basename12, dirname as dirname22, relative as relative16, resolve as resolve39, sep as sep4 } from "path";
21604
+ import { existsSync as existsSync27, rmSync as rmSync3 } from "fs";
21605
+ import { basename as basename12, dirname as dirname23, join as join31, relative as relative16, resolve as resolve40, sep as sep4 } from "path";
21487
21606
  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) => {
21488
21607
  if (!config.tailwind)
21489
21608
  return;
21490
21609
  if (!files.some(isTailwindCandidate))
21491
21610
  return;
21492
21611
  try {
21493
- const { cssChanged } = await incrementalTailwindBuild(config.tailwind, state.resolvedPaths.buildDir, files, getStyleTransformConfig(config));
21612
+ const { computeFrameworkTailwindSources: computeFrameworkTailwindSources2 } = await Promise.resolve().then(() => (init_compileTailwind(), exports_compileTailwind));
21613
+ const { cssChanged } = await incrementalTailwindBuild(config.tailwind, state.resolvedPaths.buildDir, files, getStyleTransformConfig(config), computeFrameworkTailwindSources2(config));
21494
21614
  if (!cssChanged)
21495
21615
  return;
21496
21616
  try {
21497
- const outputPath = resolve39(state.resolvedPaths.buildDir, config.tailwind.output);
21617
+ const outputPath = resolve40(state.resolvedPaths.buildDir, config.tailwind.output);
21498
21618
  const bytes = await Bun.file(outputPath).bytes();
21499
21619
  const webPath = `/${config.tailwind.output.replace(/^\/+/, "")}`;
21500
21620
  state.assetStore.set(webPath, bytes);
@@ -21577,11 +21697,39 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21577
21697
  detectedFw = detected !== "ignored" ? detected : affectedFrameworks[0];
21578
21698
  }
21579
21699
  return { ...parsed, framework: detectedFw };
21580
- }, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync27(affectedFile), collectDeletedFileAffected = (state, filePathInSet, processedFiles, validFiles) => {
21700
+ }, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync27(affectedFile), FRAMEWORK_DIR_KEYS_FOR_CLEANUP, removeStaleGenerated = (state, deletedFile) => {
21701
+ const config = state.config;
21702
+ const cwd2 = process.cwd();
21703
+ const absDeleted = resolve40(deletedFile).replace(/\\/g, "/");
21704
+ for (const { configKey, framework } of FRAMEWORK_DIR_KEYS_FOR_CLEANUP) {
21705
+ const dir = config[configKey];
21706
+ if (!dir)
21707
+ continue;
21708
+ const absDir = resolve40(cwd2, dir).replace(/\\/g, "/");
21709
+ if (!absDeleted.startsWith(`${absDir}/`))
21710
+ continue;
21711
+ const rel = absDeleted.slice(absDir.length + 1);
21712
+ const ext = rel.match(/\.(ts|tsx|jsx|svelte|vue|mjs|cjs)$/);
21713
+ if (!ext)
21714
+ return;
21715
+ const relJs = `${rel.slice(0, -ext[0].length)}.js`;
21716
+ const generatedDir = getFrameworkGeneratedDir(framework, cwd2);
21717
+ for (const candidate of [
21718
+ join31(generatedDir, relJs),
21719
+ `${join31(generatedDir, relJs)}.map`
21720
+ ]) {
21721
+ try {
21722
+ rmSync3(candidate, { force: true });
21723
+ } catch {}
21724
+ }
21725
+ return;
21726
+ }
21727
+ }, collectDeletedFileAffected = (state, filePathInSet, processedFiles, validFiles) => {
21581
21728
  state.fileHashes.delete(filePathInSet);
21729
+ removeStaleGenerated(state, filePathInSet);
21582
21730
  try {
21583
21731
  const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
21584
- const deletedPathResolved = resolve39(filePathInSet);
21732
+ const deletedPathResolved = resolve40(filePathInSet);
21585
21733
  affectedFiles.forEach((affectedFile) => {
21586
21734
  if (isValidDeletedAffectedFile(affectedFile, deletedPathResolved, processedFiles)) {
21587
21735
  validFiles.push(affectedFile);
@@ -21625,7 +21773,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21625
21773
  if (storedHash !== undefined && storedHash === fileHash) {
21626
21774
  return;
21627
21775
  }
21628
- const normalizedFilePath = resolve39(filePathInSet);
21776
+ const normalizedFilePath = resolve40(filePathInSet);
21629
21777
  if (!processedFiles.has(normalizedFilePath)) {
21630
21778
  validFiles.push(normalizedFilePath);
21631
21779
  processedFiles.add(normalizedFilePath);
@@ -21753,6 +21901,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21753
21901
  if (framework === "ignored") {
21754
21902
  return;
21755
21903
  }
21904
+ if (/\.(spec|test)\.(?:m?[tj]sx?)$/i.test(filePath) || /[\\/]__tests__[\\/]/.test(filePath)) {
21905
+ return;
21906
+ }
21756
21907
  const currentHash = computeFileHash(filePath);
21757
21908
  if (!hasFileChanged(filePath, currentHash, state.fileHashes)) {
21758
21909
  return;
@@ -21760,7 +21911,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21760
21911
  const publicDir = state.resolvedPaths.publicDir;
21761
21912
  const assetsDir = state.resolvedPaths.assetsDir;
21762
21913
  const handleStaticMirror = async (sourceDir, urlPrefix) => {
21763
- const absSource = resolve39(filePath);
21914
+ const absSource = resolve40(filePath);
21764
21915
  const normalizedSource = absSource.replace(/\\/g, "/");
21765
21916
  const normalizedDir = sourceDir.replace(/\\/g, "/");
21766
21917
  if (!normalizedSource.startsWith(normalizedDir + "/"))
@@ -21768,10 +21919,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21768
21919
  try {
21769
21920
  const relFromDir = normalizedSource.slice(normalizedDir.length + 1);
21770
21921
  const buildDir = state.resolvedPaths.buildDir;
21771
- const destPath = resolve39(buildDir, urlPrefix ? `${urlPrefix}/${relFromDir}` : relFromDir);
21922
+ const destPath = resolve40(buildDir, urlPrefix ? `${urlPrefix}/${relFromDir}` : relFromDir);
21772
21923
  const { mkdir: mkdir7, copyFile, readFile: readFile6 } = await import("fs/promises");
21773
- const { dirname: dirname23 } = await import("path");
21774
- await mkdir7(dirname23(destPath), { recursive: true });
21924
+ const { dirname: dirname24 } = await import("path");
21925
+ await mkdir7(dirname24(destPath), { recursive: true });
21775
21926
  await copyFile(absSource, destPath);
21776
21927
  const bytes = await readFile6(destPath);
21777
21928
  const webPath = urlPrefix ? `/${urlPrefix}/${relFromDir}` : `/${relFromDir}`;
@@ -21794,7 +21945,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21794
21945
  if (assetsDir && await handleStaticMirror(assetsDir, "assets"))
21795
21946
  return;
21796
21947
  if (framework === "unknown") {
21797
- invalidate(resolve39(filePath));
21948
+ invalidate(resolve40(filePath));
21798
21949
  const relPath = relative16(process.cwd(), filePath);
21799
21950
  logHmrUpdate(relPath);
21800
21951
  const angularDir = state.resolvedPaths.angularDir;
@@ -21802,10 +21953,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21802
21953
  if (angularDir && state.dependencyGraph) {
21803
21954
  try {
21804
21955
  const { addFileToGraph: addFileToGraph2 } = await Promise.resolve().then(() => (init_dependencyGraph(), exports_dependencyGraph));
21805
- addFileToGraph2(state.dependencyGraph, resolve39(filePath));
21806
- const affected = getAffectedFiles(state.dependencyGraph, resolve39(filePath));
21956
+ addFileToGraph2(state.dependencyGraph, resolve40(filePath));
21957
+ const affected = getAffectedFiles(state.dependencyGraph, resolve40(filePath));
21807
21958
  for (const dependent of affected) {
21808
- if (dependent === resolve39(filePath))
21959
+ if (dependent === resolve40(filePath))
21809
21960
  continue;
21810
21961
  const dependentFramework = detectFramework(dependent, state.resolvedPaths);
21811
21962
  if (dependentFramework !== "angular")
@@ -21822,13 +21973,14 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21822
21973
  } catch {}
21823
21974
  }
21824
21975
  if (!hasAngularDependent) {
21976
+ console.log(`[abs:restart] ${resolve40(filePath)}`);
21825
21977
  return;
21826
21978
  }
21827
21979
  try {
21828
21980
  const { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 } = await Promise.resolve().then(() => (init_generatedDir(), exports_generatedDir));
21829
21981
  const { invalidateModule: invalidateModuleServer } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
21830
21982
  const generatedAngularRoot = getFrameworkGeneratedDir2("angular");
21831
- const sourceAbs = resolve39(filePath).replace(/\\/g, "/");
21983
+ const sourceAbs = resolve40(filePath).replace(/\\/g, "/");
21832
21984
  const generatedTwin = `${generatedAngularRoot.replace(/\\/g, "/")}${sourceAbs.replace(/\.ts$/, ".js")}`;
21833
21985
  invalidateModuleServer(generatedTwin);
21834
21986
  } catch {}
@@ -21862,7 +22014,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21862
22014
  const userEditedFiles = new Set;
21863
22015
  state.fileChangeQueue.forEach((filePaths) => {
21864
22016
  for (const filePath2 of filePaths) {
21865
- userEditedFiles.add(resolve39(filePath2));
22017
+ userEditedFiles.add(resolve40(filePath2));
21866
22018
  }
21867
22019
  });
21868
22020
  state.lastUserEditedFiles = userEditedFiles;
@@ -21891,7 +22043,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21891
22043
  }
21892
22044
  if (!graph)
21893
22045
  return componentFile;
21894
- const dependents = graph.dependents.get(resolve39(componentFile));
22046
+ const dependents = graph.dependents.get(resolve40(componentFile));
21895
22047
  if (!dependents)
21896
22048
  return componentFile;
21897
22049
  for (const dep of dependents) {
@@ -21900,7 +22052,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21900
22052
  }
21901
22053
  return componentFile;
21902
22054
  }, resolveAngularPageEntries = (state, angularFiles, angularPagesPath) => {
21903
- const pageEntries = angularFiles.filter((file5) => file5.endsWith(".ts") && resolve39(file5).startsWith(angularPagesPath));
22055
+ const pageEntries = angularFiles.filter((file5) => file5.endsWith(".ts") && resolve40(file5).startsWith(angularPagesPath));
21904
22056
  if (pageEntries.length > 0 || !state.dependencyGraph) {
21905
22057
  return pageEntries;
21906
22058
  }
@@ -21909,7 +22061,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21909
22061
  const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
21910
22062
  const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
21911
22063
  affected.forEach((file5) => {
21912
- if (file5.endsWith(".ts") && resolve39(file5).startsWith(angularPagesPath)) {
22064
+ if (file5.endsWith(".ts") && resolve40(file5).startsWith(angularPagesPath)) {
21913
22065
  resolvedPages.add(file5);
21914
22066
  }
21915
22067
  });
@@ -21927,6 +22079,37 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21927
22079
  clientRoots.push(getGeneratedRoot2(projectRoot));
21928
22080
  const { commonAncestor: commonAncestor2 } = await Promise.resolve().then(() => (init_commonAncestor(), exports_commonAncestor));
21929
22081
  return clientRoots.length === 1 ? clientRoots[0] ?? projectRoot : commonAncestor2(clientRoots, projectRoot);
22082
+ }, computeServerOutPaths = async (resolvedPaths, framework) => {
22083
+ const { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 } = await Promise.resolve().then(() => (init_generatedDir(), exports_generatedDir));
22084
+ const { commonAncestor: commonAncestor2 } = await Promise.resolve().then(() => (init_commonAncestor(), exports_commonAncestor));
22085
+ const projectRoot = process.cwd();
22086
+ const serverDirs = [];
22087
+ if (resolvedPaths.svelteDir)
22088
+ serverDirs.push({
22089
+ dir: getFrameworkGeneratedDir2("svelte", projectRoot),
22090
+ subdir: "server"
22091
+ });
22092
+ if (resolvedPaths.vueDir)
22093
+ serverDirs.push({
22094
+ dir: getFrameworkGeneratedDir2("vue", projectRoot),
22095
+ subdir: "server"
22096
+ });
22097
+ if (resolvedPaths.angularDir)
22098
+ serverDirs.push({
22099
+ dir: getFrameworkGeneratedDir2("angular", projectRoot),
22100
+ subdir: ""
22101
+ });
22102
+ if (serverDirs.length <= 1) {
22103
+ const dir = getFrameworkGeneratedDir2(framework, projectRoot);
22104
+ return {
22105
+ serverOutDir: resolve40(resolvedPaths.buildDir, basename12(dir)),
22106
+ serverRoot: resolve40(dir, "server")
22107
+ };
22108
+ }
22109
+ return {
22110
+ serverOutDir: resolvedPaths.buildDir,
22111
+ serverRoot: commonAncestor2(serverDirs.map((entry) => entry.dir), projectRoot)
22112
+ };
21930
22113
  }, updateServerManifestEntry = (state, artifact) => {
21931
22114
  const fileWithHash = basename12(artifact.path);
21932
22115
  const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
@@ -21934,6 +22117,46 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
21934
22117
  return;
21935
22118
  }
21936
22119
  state.manifest[toPascal(baseName)] = artifact.path;
22120
+ }, pruneStaleHashedSiblings = async (freshOutputs) => {
22121
+ if (!freshOutputs?.length)
22122
+ return;
22123
+ const { readdir: readdir5, unlink: unlink2 } = await import("fs/promises");
22124
+ const keepByDir = new Map;
22125
+ const prefixByDir = new Map;
22126
+ for (const artifact of freshOutputs) {
22127
+ const dir = dirname23(artifact.path);
22128
+ const name = basename12(artifact.path);
22129
+ const [prefix] = name.split(".");
22130
+ if (!prefix)
22131
+ continue;
22132
+ if (!keepByDir.has(dir))
22133
+ keepByDir.set(dir, new Set);
22134
+ if (!prefixByDir.has(dir))
22135
+ prefixByDir.set(dir, new Set);
22136
+ keepByDir.get(dir).add(name);
22137
+ prefixByDir.get(dir).add(prefix);
22138
+ }
22139
+ await Promise.all(Array.from(keepByDir.entries()).map(async ([dir, keep]) => {
22140
+ const prefixes = prefixByDir.get(dir);
22141
+ if (!prefixes)
22142
+ return;
22143
+ const entries = await readdir5(dir).catch(() => []);
22144
+ await Promise.all(entries.map(async (entryName) => {
22145
+ if (keep.has(entryName))
22146
+ return;
22147
+ if (!entryName.endsWith(".js"))
22148
+ return;
22149
+ const parts = entryName.split(".");
22150
+ if (parts.length !== 3)
22151
+ return;
22152
+ const [base] = parts;
22153
+ if (!base || !prefixes.has(base))
22154
+ return;
22155
+ try {
22156
+ await unlink2(`${dir}/${entryName}`);
22157
+ } catch {}
22158
+ }));
22159
+ }));
21937
22160
  }, bundleAngularClient = async (state, clientPaths, buildDir, userAngularRoot) => {
21938
22161
  const { build: bunBuild9 } = await Promise.resolve(globalThis.Bun);
21939
22162
  const { generateManifest: generateManifest2 } = await Promise.resolve().then(() => (init_generateManifest(), exports_generateManifest));
@@ -22031,8 +22254,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22031
22254
  if (detected !== "unknown")
22032
22255
  continue;
22033
22256
  try {
22034
- const affected = getAffectedFiles(state.dependencyGraph, resolve39(editedFile));
22035
- const hasAngularConsumer = affected.some((dep) => dep !== resolve39(editedFile) && detectFramework(dep, state.resolvedPaths) === "angular");
22257
+ const affected = getAffectedFiles(state.dependencyGraph, resolve40(editedFile));
22258
+ const hasAngularConsumer = affected.some((dep) => dep !== resolve40(editedFile) && detectFramework(dep, state.resolvedPaths) === "angular");
22036
22259
  if (hasAngularConsumer) {
22037
22260
  return {
22038
22261
  kind: "rebootstrap",
@@ -22079,7 +22302,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22079
22302
  }
22080
22303
  if (owners.length === 0 && (editedFile.endsWith(".ts") || editedFile.endsWith(".json")) && !editedFile.endsWith(".d.ts")) {
22081
22304
  const normalized = editedFile.replace(/\\/g, "/");
22082
- const angularDirAbs = resolve39(angularDir).replace(/\\/g, "/");
22305
+ const angularDirAbs = resolve40(angularDir).replace(/\\/g, "/");
22083
22306
  if (normalized.startsWith(angularDirAbs + "/")) {
22084
22307
  return {
22085
22308
  kind: "rebootstrap",
@@ -22207,7 +22430,6 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22207
22430
  if (pageEntries.length === 0)
22208
22431
  return;
22209
22432
  await compileAndBundleAngular(state, pageEntries, angularDir);
22210
- markSsrCacheDirty("angular");
22211
22433
  };
22212
22434
  const drive = async () => {
22213
22435
  try {
@@ -22223,16 +22445,16 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22223
22445
  };
22224
22446
  const fire = () => {
22225
22447
  ctx.debounceTimer = null;
22226
- const resolve40 = ctx.debouncedResolve;
22448
+ const resolve41 = ctx.debouncedResolve;
22227
22449
  ctx.debouncedResolve = null;
22228
22450
  ctx.debouncedPromise = null;
22229
22451
  if (ctx.inFlight) {
22230
22452
  ctx.pending = true;
22231
- ctx.inFlight.finally(() => resolve40?.());
22453
+ ctx.inFlight.finally(() => resolve41?.());
22232
22454
  return;
22233
22455
  }
22234
22456
  ctx.inFlight = drive();
22235
- ctx.inFlight.finally(() => resolve40?.());
22457
+ ctx.inFlight.finally(() => resolve41?.());
22236
22458
  };
22237
22459
  return ({ immediate = false } = {}) => {
22238
22460
  if (!ctx.debouncedPromise) {
@@ -22259,16 +22481,16 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22259
22481
  const diskRefreshPromise = (async () => {
22260
22482
  if (!angularDir || editedFiles.size === 0)
22261
22483
  return;
22262
- const angularDirAbs = resolve39(angularDir);
22484
+ const angularDirAbs = resolve40(angularDir);
22263
22485
  const filesUnderAngular = Array.from(editedFiles).filter((file5) => {
22264
- const abs = resolve39(file5);
22486
+ const abs = resolve40(file5);
22265
22487
  return abs === angularDirAbs || abs.startsWith(angularDirAbs + sep4);
22266
22488
  });
22267
22489
  if (filesUnderAngular.length === 0)
22268
22490
  return;
22269
22491
  try {
22270
22492
  const [
22271
- { compileAngularFileJIT: compileAngularFileJIT2 },
22493
+ { compileAngularFileJIT: compileAngularFileJIT2, invalidateAngularJitCache: invalidateAngularJitCache2 },
22272
22494
  { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 },
22273
22495
  { resolveOwningComponents: resolveOwningComponents2 }
22274
22496
  ] = await Promise.all([
@@ -22283,7 +22505,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22283
22505
  if (!ext)
22284
22506
  continue;
22285
22507
  if (ext === ".ts" || ext === ".tsx") {
22286
- tsFilesToRefresh.add(resolve39(file5));
22508
+ tsFilesToRefresh.add(resolve40(file5));
22287
22509
  continue;
22288
22510
  }
22289
22511
  const owners = resolveOwningComponents2({
@@ -22291,19 +22513,22 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22291
22513
  userAngularRoot: angularDirAbs
22292
22514
  });
22293
22515
  for (const owner of owners) {
22294
- tsFilesToRefresh.add(resolve39(owner.componentFilePath));
22516
+ tsFilesToRefresh.add(resolve40(owner.componentFilePath));
22295
22517
  }
22296
22518
  }
22297
22519
  if (tsFilesToRefresh.size === 0)
22298
22520
  return;
22299
- await Promise.all(Array.from(tsFilesToRefresh).map((file5) => compileAngularFileJIT2(file5, compiledRoot, angularDirAbs, getStyleTransformConfig(state.config), String(Date.now())).catch((err) => {
22300
- logWarn(`[hmr] disk-refresh JIT failed for ${file5}: ${err instanceof Error ? err.message : String(err)}`);
22301
- })));
22521
+ await Promise.all(Array.from(tsFilesToRefresh).map((file5) => {
22522
+ invalidateAngularJitCache2(file5);
22523
+ return compileAngularFileJIT2(file5, compiledRoot, angularDirAbs, getStyleTransformConfig(state.config)).catch((err) => {
22524
+ logWarn(`[hmr] disk-refresh JIT failed for ${file5}: ${err instanceof Error ? err.message : String(err)}`);
22525
+ });
22526
+ }));
22302
22527
  try {
22303
22528
  const { invalidateModule: invalidateModule2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
22304
22529
  for (const tsFile of tsFilesToRefresh) {
22305
22530
  const rel = relative16(angularDirAbs, tsFile).replace(/\\/g, "/").replace(/\.[tj]sx?$/, ".js");
22306
- const compiledFile = resolve39(compiledRoot, rel);
22531
+ const compiledFile = resolve40(compiledRoot, rel);
22307
22532
  invalidateModule2(compiledFile);
22308
22533
  }
22309
22534
  } catch {}
@@ -22319,12 +22544,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22319
22544
  try {
22320
22545
  const { primeComponentFingerprint: primeComponentFingerprint2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
22321
22546
  const { readdir: readdir5 } = await import("fs/promises");
22322
- const { join: join31 } = await import("path");
22547
+ const { join: join32 } = await import("path");
22323
22548
  const walk = async (dir) => {
22324
22549
  const entries = await readdir5(dir, { withFileTypes: true });
22325
22550
  const files = [];
22326
22551
  for (const entry of entries) {
22327
- const full = join31(dir, entry.name);
22552
+ const full = join32(dir, entry.name);
22328
22553
  if (entry.isDirectory()) {
22329
22554
  files.push(...await walk(full));
22330
22555
  } else if (entry.isFile() && entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts")) {
@@ -22354,18 +22579,22 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22354
22579
  serverPaths.forEach((serverPath, idx) => {
22355
22580
  const fileBase = basename12(serverPath, ".js");
22356
22581
  const ssrPath = ssrPaths[idx] ?? serverPath;
22357
- state.manifest[toPascal(fileBase)] = resolve39(ssrPath);
22582
+ state.manifest[toPascal(fileBase)] = resolve40(ssrPath);
22358
22583
  });
22359
22584
  if (clientPaths.length > 0) {
22360
22585
  await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir, angularDir);
22361
22586
  }
22587
+ broadcastToClients(state, {
22588
+ data: { manifest: state.manifest },
22589
+ type: "angular-tier-zero-ssr-rebuild-complete"
22590
+ });
22362
22591
  }, handleAngularFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
22363
22592
  const angularDir = config.angularDirectory ?? "";
22364
22593
  const angularFiles = filesToRebuild.filter((file5) => detectFramework(file5, state.resolvedPaths) === "angular");
22365
22594
  for (const file5 of angularFiles) {
22366
- state.fileHashes.set(resolve39(file5), computeFileHash(file5));
22595
+ state.fileHashes.set(resolve40(file5), computeFileHash(file5));
22367
22596
  }
22368
- const angularPagesPath = resolve39(angularDir, "pages");
22597
+ const angularPagesPath = resolve40(angularDir, "pages");
22369
22598
  const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
22370
22599
  const tierStart = performance.now();
22371
22600
  const verdict = await decideAngularTier(state, angularDir);
@@ -22377,6 +22606,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22377
22606
  broadcastSurgical(state, verdict.queue);
22378
22607
  const b2 = verdict.breakdown;
22379
22608
  logInfo(`[ng-hmr] tier-0 ${queueDescription(verdict.queue)} (server ${tierMs}ms: imports ${b2.importsMs}/resolve ${b2.resolveMs}/compile ${b2.compileMs}; awaiting client apply)`);
22609
+ runBundle();
22380
22610
  } else if (verdict.tier === 1 && verdict.kind === "remount") {
22381
22611
  await runAngularHmrIncremental(state, angularDir, pageEntries);
22382
22612
  broadcastRemount(state, verdict.queue);
@@ -22404,13 +22634,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22404
22634
  if (isComponentFile2)
22405
22635
  return primaryFile;
22406
22636
  const { findNearestComponent: findNearestComponent2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
22407
- const nearest = findNearestComponent2(resolve39(primaryFile));
22637
+ const nearest = findNearestComponent2(resolve40(primaryFile));
22408
22638
  return nearest ?? primaryFile;
22409
22639
  }, handleReactModuleServerPath = async (state, reactFiles, startTime, onRebuildComplete) => {
22410
22640
  for (const file5 of reactFiles) {
22411
- state.fileHashes.set(resolve39(file5), computeFileHash(file5));
22641
+ state.fileHashes.set(resolve40(file5), computeFileHash(file5));
22412
22642
  }
22413
- markSsrCacheDirty("react");
22414
22643
  const primaryFile = reactFiles.find((file5) => !file5.replace(/\\/g, "/").includes("/pages/")) ?? reactFiles[0];
22415
22644
  if (!primaryFile) {
22416
22645
  onRebuildComplete({
@@ -22488,23 +22717,136 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22488
22717
  },
22489
22718
  type: "svelte-update"
22490
22719
  });
22491
- }, handleSvelteModuleServerPath = async (state, svelteFiles, startTime, onRebuildComplete) => {
22720
+ }, handleSvelteModuleServerPath = async (state, svelteFiles, config, startTime, onRebuildComplete) => {
22492
22721
  for (const file5 of svelteFiles) {
22493
- state.fileHashes.set(resolve39(file5), computeFileHash(file5));
22722
+ state.fileHashes.set(resolve40(file5), computeFileHash(file5));
22494
22723
  }
22495
- markSsrCacheDirty("svelte");
22496
22724
  const serverDuration = Date.now() - startTime;
22497
22725
  await runSequentially(svelteFiles, (changedFile) => broadcastSvelteModuleUpdate(state, changedFile, svelteFiles, serverDuration));
22726
+ scheduleSvelteBundleRebuild(state, svelteFiles, config)();
22498
22727
  onRebuildComplete({
22499
22728
  hmrState: state,
22500
22729
  manifest: state.manifest
22501
22730
  });
22502
22731
  return state.manifest;
22732
+ }, SVELTE_BUNDLE_DEBOUNCE_MS = 2000, svelteBundleState, vueBundleState, getOrCreateBundleCtx = (store, state) => {
22733
+ let ctx = store.get(state);
22734
+ if (!ctx) {
22735
+ ctx = {
22736
+ debouncedPromise: null,
22737
+ debouncedResolve: null,
22738
+ debounceTimer: null,
22739
+ inFlight: null,
22740
+ pending: false,
22741
+ pendingFiles: new Set
22742
+ };
22743
+ store.set(state, ctx);
22744
+ }
22745
+ return ctx;
22746
+ }, runSvelteBundleRebuild = async (state, svelteFiles, config) => {
22747
+ if (svelteFiles.length === 0)
22748
+ return;
22749
+ const svelteDir = config.svelteDirectory ?? "";
22750
+ if (!svelteDir)
22751
+ return;
22752
+ const { buildDir } = state.resolvedPaths;
22753
+ const { compileSvelte: compileSvelte2 } = await Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte));
22754
+ const { build: bunBuild9 } = await Promise.resolve(globalThis.Bun);
22755
+ const clientRoot = await computeClientRoot(state.resolvedPaths);
22756
+ const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true, getStyleTransformConfig(state.config));
22757
+ const serverEntries = [...svelteServerPaths];
22758
+ const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
22759
+ const { serverRoot, serverOutDir } = await computeServerOutPaths(state.resolvedPaths, "svelte");
22760
+ const [serverResult, clientResult] = await Promise.all([
22761
+ serverEntries.length > 0 ? bunBuild9({
22762
+ entrypoints: serverEntries,
22763
+ external: [
22764
+ "react",
22765
+ "react/*",
22766
+ "react-dom",
22767
+ "react-dom/*",
22768
+ "svelte",
22769
+ "svelte/*"
22770
+ ],
22771
+ format: "esm",
22772
+ naming: "[dir]/[name].[hash].[ext]",
22773
+ outdir: serverOutDir,
22774
+ plugins: [
22775
+ createStylePreprocessorPlugin(getStyleTransformConfig(state.config))
22776
+ ],
22777
+ root: serverRoot,
22778
+ target: "bun",
22779
+ throw: false
22780
+ }) : undefined,
22781
+ clientEntries.length > 0 ? bunBuild9({
22782
+ entrypoints: clientEntries,
22783
+ format: "esm",
22784
+ naming: "[dir]/[name].[hash].[ext]",
22785
+ outdir: buildDir,
22786
+ plugins: [
22787
+ createStylePreprocessorPlugin(getStyleTransformConfig(state.config))
22788
+ ],
22789
+ root: clientRoot,
22790
+ target: "browser",
22791
+ throw: false
22792
+ }) : undefined
22793
+ ]);
22794
+ handleServerManifestUpdate(state, serverResult);
22795
+ await handleClientManifestUpdate(state, clientResult, buildDir);
22796
+ await pruneStaleHashedSiblings(serverResult?.outputs);
22797
+ broadcastToClients(state, {
22798
+ data: { manifest: state.manifest },
22799
+ type: "svelte-tier-zero-ssr-rebuild-complete"
22800
+ });
22801
+ }, scheduleSvelteBundleRebuild = (state, svelteFiles, config) => {
22802
+ const ctx = getOrCreateBundleCtx(svelteBundleState, state);
22803
+ for (const file5 of svelteFiles)
22804
+ ctx.pendingFiles.add(file5);
22805
+ const drive = async () => {
22806
+ try {
22807
+ while (true) {
22808
+ ctx.pending = false;
22809
+ const filesSnapshot = Array.from(ctx.pendingFiles);
22810
+ ctx.pendingFiles.clear();
22811
+ if (filesSnapshot.length === 0)
22812
+ break;
22813
+ await runSvelteBundleRebuild(state, filesSnapshot, config);
22814
+ if (!ctx.pending)
22815
+ break;
22816
+ }
22817
+ } finally {
22818
+ ctx.inFlight = null;
22819
+ }
22820
+ };
22821
+ const fire = () => {
22822
+ ctx.debounceTimer = null;
22823
+ const resolveFn = ctx.debouncedResolve;
22824
+ ctx.debouncedResolve = null;
22825
+ ctx.debouncedPromise = null;
22826
+ if (ctx.inFlight) {
22827
+ ctx.pending = true;
22828
+ ctx.inFlight.finally(() => resolveFn?.());
22829
+ return;
22830
+ }
22831
+ ctx.inFlight = drive();
22832
+ ctx.inFlight.finally(() => resolveFn?.());
22833
+ };
22834
+ return () => {
22835
+ if (!ctx.debouncedPromise) {
22836
+ ctx.debouncedPromise = new Promise((res) => {
22837
+ ctx.debouncedResolve = res;
22838
+ });
22839
+ }
22840
+ if (ctx.debounceTimer)
22841
+ clearTimeout(ctx.debounceTimer);
22842
+ ctx.debounceTimer = setTimeout(fire, SVELTE_BUNDLE_DEBOUNCE_MS);
22843
+ return ctx.debouncedPromise;
22844
+ };
22503
22845
  }, handleSvelteFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
22504
22846
  const svelteDir = config.svelteDirectory ?? "";
22505
22847
  const svelteFiles = filesToRebuild.filter((file5) => (file5.endsWith(".svelte") || file5.includes(".svelte.")) && detectFramework(file5, state.resolvedPaths) === "svelte");
22506
22848
  if (svelteFiles.length > 0) {
22507
- return handleSvelteModuleServerPath(state, svelteFiles, startTime, onRebuildComplete);
22849
+ return handleSvelteModuleServerPath(state, svelteFiles, config, startTime, onRebuildComplete);
22508
22850
  }
22509
22851
  const { buildDir } = state.resolvedPaths;
22510
22852
  if (svelteFiles.length > 0) {
@@ -22514,9 +22856,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22514
22856
  const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true, getStyleTransformConfig(state.config));
22515
22857
  const serverEntries = [...svelteServerPaths];
22516
22858
  const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
22517
- const { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 } = await Promise.resolve().then(() => (init_generatedDir(), exports_generatedDir));
22518
- const serverRoot = resolve39(getFrameworkGeneratedDir2("svelte"), "server");
22519
- const serverOutDir = resolve39(buildDir, basename12(svelteDir));
22859
+ const { serverRoot, serverOutDir } = await computeServerOutPaths(state.resolvedPaths, "svelte");
22520
22860
  const [serverResult, clientResult] = await Promise.all([
22521
22861
  serverEntries.length > 0 ? bunBuild9({
22522
22862
  entrypoints: serverEntries,
@@ -22611,26 +22951,131 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22611
22951
  },
22612
22952
  type: "vue-update"
22613
22953
  });
22614
- }, handleVueModuleServerPath = async (state, vueFiles, nonVueFiles, startTime, onRebuildComplete) => {
22954
+ }, handleVueModuleServerPath = async (state, vueFiles, nonVueFiles, config, startTime, onRebuildComplete) => {
22615
22955
  for (const file5 of [...vueFiles, ...nonVueFiles]) {
22616
- state.fileHashes.set(resolve39(file5), computeFileHash(file5));
22956
+ state.fileHashes.set(resolve40(file5), computeFileHash(file5));
22617
22957
  }
22618
- markSsrCacheDirty("vue");
22619
22958
  await invalidateNonVueModules(nonVueFiles);
22620
22959
  const serverDuration = Date.now() - startTime;
22621
22960
  const forceReload = nonVueFiles.length > 0;
22622
22961
  await runSequentially(vueFiles, (changedFile) => broadcastVueModuleUpdate(state, changedFile, vueFiles, nonVueFiles, forceReload, serverDuration));
22962
+ scheduleVueBundleRebuild(state, vueFiles, config)();
22623
22963
  onRebuildComplete({
22624
22964
  hmrState: state,
22625
22965
  manifest: state.manifest
22626
22966
  });
22627
22967
  return state.manifest;
22968
+ }, VUE_BUNDLE_DEBOUNCE_MS = 2000, runVueBundleRebuild = async (state, vueFiles, config) => {
22969
+ if (vueFiles.length === 0)
22970
+ return;
22971
+ const vueDir = config.vueDirectory ?? "";
22972
+ if (!vueDir)
22973
+ return;
22974
+ const { buildDir } = state.resolvedPaths;
22975
+ const { compileVue: compileVue2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
22976
+ const { build: bunBuild9 } = await Promise.resolve(globalThis.Bun);
22977
+ const clientRoot = await computeClientRoot(state.resolvedPaths);
22978
+ const { vueServerPaths, vueIndexPaths, vueClientPaths, vueCssPaths } = await compileVue2(vueFiles, vueDir, true, getStyleTransformConfig(state.config));
22979
+ const serverEntries = [...vueServerPaths];
22980
+ const clientEntries = [...vueIndexPaths, ...vueClientPaths];
22981
+ const cssOutDir = join31(buildDir, state.resolvedPaths.assetsDir ? basename12(state.resolvedPaths.assetsDir) : "assets", "css");
22982
+ const { serverRoot, serverOutDir } = await computeServerOutPaths(state.resolvedPaths, "vue");
22983
+ const [serverResult, clientResult, cssResult] = await Promise.all([
22984
+ serverEntries.length > 0 ? bunBuild9({
22985
+ entrypoints: serverEntries,
22986
+ external: ["vue", "vue/*", "@vue/*"],
22987
+ format: "esm",
22988
+ naming: "[dir]/[name].[hash].[ext]",
22989
+ outdir: serverOutDir,
22990
+ plugins: [
22991
+ createStylePreprocessorPlugin(getStyleTransformConfig(state.config))
22992
+ ],
22993
+ root: serverRoot,
22994
+ target: "bun",
22995
+ throw: false
22996
+ }) : undefined,
22997
+ clientEntries.length > 0 ? bunBuild9({
22998
+ entrypoints: clientEntries,
22999
+ format: "esm",
23000
+ naming: "[dir]/[name].[hash].[ext]",
23001
+ outdir: buildDir,
23002
+ plugins: [
23003
+ createStylePreprocessorPlugin(getStyleTransformConfig(state.config))
23004
+ ],
23005
+ root: clientRoot,
23006
+ target: "browser",
23007
+ throw: false
23008
+ }) : undefined,
23009
+ vueCssPaths.length > 0 ? bunBuild9({
23010
+ entrypoints: vueCssPaths,
23011
+ naming: "[name].[hash].[ext]",
23012
+ outdir: cssOutDir,
23013
+ plugins: [
23014
+ createStylePreprocessorPlugin(getStyleTransformConfig(state.config))
23015
+ ],
23016
+ target: "browser",
23017
+ throw: false
23018
+ }) : undefined
23019
+ ]);
23020
+ handleServerManifestUpdate(state, serverResult);
23021
+ await handleClientManifestUpdate(state, clientResult, buildDir);
23022
+ await handleClientManifestUpdate(state, cssResult, buildDir);
23023
+ await pruneStaleHashedSiblings(serverResult?.outputs);
23024
+ await pruneStaleHashedSiblings(cssResult?.outputs);
23025
+ broadcastToClients(state, {
23026
+ data: { manifest: state.manifest },
23027
+ type: "vue-tier-zero-ssr-rebuild-complete"
23028
+ });
23029
+ }, scheduleVueBundleRebuild = (state, vueFiles, config) => {
23030
+ const ctx = getOrCreateBundleCtx(vueBundleState, state);
23031
+ for (const file5 of vueFiles)
23032
+ ctx.pendingFiles.add(file5);
23033
+ const drive = async () => {
23034
+ try {
23035
+ while (true) {
23036
+ ctx.pending = false;
23037
+ const filesSnapshot = Array.from(ctx.pendingFiles);
23038
+ ctx.pendingFiles.clear();
23039
+ if (filesSnapshot.length === 0)
23040
+ break;
23041
+ await runVueBundleRebuild(state, filesSnapshot, config);
23042
+ if (!ctx.pending)
23043
+ break;
23044
+ }
23045
+ } finally {
23046
+ ctx.inFlight = null;
23047
+ }
23048
+ };
23049
+ const fire = () => {
23050
+ ctx.debounceTimer = null;
23051
+ const resolveFn = ctx.debouncedResolve;
23052
+ ctx.debouncedResolve = null;
23053
+ ctx.debouncedPromise = null;
23054
+ if (ctx.inFlight) {
23055
+ ctx.pending = true;
23056
+ ctx.inFlight.finally(() => resolveFn?.());
23057
+ return;
23058
+ }
23059
+ ctx.inFlight = drive();
23060
+ ctx.inFlight.finally(() => resolveFn?.());
23061
+ };
23062
+ return () => {
23063
+ if (!ctx.debouncedPromise) {
23064
+ ctx.debouncedPromise = new Promise((res) => {
23065
+ ctx.debouncedResolve = res;
23066
+ });
23067
+ }
23068
+ if (ctx.debounceTimer)
23069
+ clearTimeout(ctx.debounceTimer);
23070
+ ctx.debounceTimer = setTimeout(fire, VUE_BUNDLE_DEBOUNCE_MS);
23071
+ return ctx.debouncedPromise;
23072
+ };
22628
23073
  }, handleVueFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
22629
23074
  const vueFiles = filesToRebuild.filter((file5) => file5.endsWith(".vue") && detectFramework(file5, state.resolvedPaths) === "vue");
22630
23075
  const nonVueFiles = filesToRebuild.filter((file5) => !file5.endsWith(".vue") && detectFramework(file5, state.resolvedPaths) === "vue");
22631
23076
  collectAffectedVueFiles(state, nonVueFiles, vueFiles);
22632
23077
  if (vueFiles.length > 0) {
22633
- return handleVueModuleServerPath(state, vueFiles, nonVueFiles, startTime, onRebuildComplete);
23078
+ return handleVueModuleServerPath(state, vueFiles, nonVueFiles, config, startTime, onRebuildComplete);
22634
23079
  }
22635
23080
  onRebuildComplete({ hmrState: state, manifest: state.manifest });
22636
23081
  return state.manifest;
@@ -22641,7 +23086,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22641
23086
  recursive: true,
22642
23087
  withFileTypes: true
22643
23088
  });
22644
- return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) => resolve39(emberPagesPath, entry.name));
23089
+ return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) => resolve40(emberPagesPath, entry.name));
22645
23090
  } catch {
22646
23091
  return [];
22647
23092
  }
@@ -22653,10 +23098,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22653
23098
  return state.manifest;
22654
23099
  }
22655
23100
  for (const file5 of emberFiles) {
22656
- state.fileHashes.set(resolve39(file5), computeFileHash(file5));
23101
+ state.fileHashes.set(resolve40(file5), computeFileHash(file5));
22657
23102
  }
22658
- const emberPagesPath = resolve39(emberDir, "pages");
22659
- const directPageEntries = emberFiles.filter((file5) => resolve39(file5).startsWith(emberPagesPath));
23103
+ const emberPagesPath = resolve40(emberDir, "pages");
23104
+ const directPageEntries = emberFiles.filter((file5) => resolve40(file5).startsWith(emberPagesPath));
22660
23105
  const allPageEntries = directPageEntries.length > 0 ? directPageEntries : await collectAllEmberPages(emberPagesPath);
22661
23106
  if (allPageEntries.length === 0) {
22662
23107
  onRebuildComplete({ hmrState: state, manifest: state.manifest });
@@ -22666,7 +23111,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22666
23111
  const { serverPaths } = await compileEmber2(allPageEntries, emberDir, process.cwd(), true);
22667
23112
  for (const serverPath of serverPaths) {
22668
23113
  const fileBase = basename12(serverPath, ".js");
22669
- state.manifest[toPascal(fileBase)] = resolve39(serverPath);
23114
+ state.manifest[toPascal(fileBase)] = resolve40(serverPath);
22670
23115
  }
22671
23116
  const { invalidateEmberSsrCache: invalidateEmberSsrCache2 } = await Promise.resolve().then(() => (init_ember(), exports_ember));
22672
23117
  invalidateEmberSsrCache2();
@@ -22758,8 +23203,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22758
23203
  if (!buildReference?.source) {
22759
23204
  return;
22760
23205
  }
22761
- const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve39(dirname22(buildInfo.resolvedRegistryPath), buildReference.source);
22762
- islandFiles.add(resolve39(sourcePath));
23206
+ const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve40(dirname23(buildInfo.resolvedRegistryPath), buildReference.source);
23207
+ islandFiles.add(resolve40(sourcePath));
22763
23208
  }, resolveIslandSourceFiles = async (config) => {
22764
23209
  const registryPath = config.islands?.registry;
22765
23210
  if (!registryPath) {
@@ -22767,7 +23212,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22767
23212
  }
22768
23213
  const buildInfo = await loadIslandRegistryBuildInfo(registryPath);
22769
23214
  const islandFiles = new Set([
22770
- resolve39(buildInfo.resolvedRegistryPath)
23215
+ resolve40(buildInfo.resolvedRegistryPath)
22771
23216
  ]);
22772
23217
  for (const definition of buildInfo.definitions) {
22773
23218
  resolveIslandDefinitionSource(definition, buildInfo, islandFiles);
@@ -22778,7 +23223,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22778
23223
  if (islandFiles.size === 0) {
22779
23224
  return false;
22780
23225
  }
22781
- return filesToRebuild.some((file5) => islandFiles.has(resolve39(file5)));
23226
+ return filesToRebuild.some((file5) => islandFiles.has(resolve40(file5)));
22782
23227
  }, handleIslandSourceReload = async (state, config, filesToRebuild, manifest) => {
22783
23228
  const shouldReload = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
22784
23229
  if (!shouldReload) {
@@ -22813,10 +23258,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22813
23258
  }, computeOutputPagesDir = (state, config, framework) => {
22814
23259
  const isSingle = !config.reactDirectory && !config.svelteDirectory && !config.vueDirectory && (framework === "html" ? !config.htmxDirectory : !config.htmlDirectory);
22815
23260
  if (isSingle) {
22816
- return resolve39(state.resolvedPaths.buildDir, "pages");
23261
+ return resolve40(state.resolvedPaths.buildDir, "pages");
22817
23262
  }
22818
23263
  const dirName = framework === "html" ? basename12(config.htmlDirectory ?? "html") : basename12(config.htmxDirectory ?? "htmx");
22819
- return resolve39(state.resolvedPaths.buildDir, dirName, "pages");
23264
+ return resolve40(state.resolvedPaths.buildDir, dirName, "pages");
22820
23265
  }, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
22821
23266
  try {
22822
23267
  const { handleHTMLUpdate: handleHTMLUpdate2 } = await Promise.resolve().then(() => (init_simpleHTMLHMR(), exports_simpleHTMLHMR));
@@ -22855,7 +23300,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22855
23300
  const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
22856
23301
  await runSequentially(pageFilesToUpdate, async (pageFile) => {
22857
23302
  const htmlPageName = basename12(pageFile);
22858
- const builtHtmlPagePath = resolve39(outputHtmlPages, htmlPageName);
23303
+ const builtHtmlPagePath = resolve40(outputHtmlPages, htmlPageName);
22859
23304
  await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
22860
23305
  });
22861
23306
  }, handleVueCssOnlyUpdate = (state, vueCssFiles, manifest, duration) => {
@@ -22920,7 +23365,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
22920
23365
  const cssKey = `${pascalName}CSS`;
22921
23366
  const cssUrl = manifest[cssKey] || null;
22922
23367
  const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
22923
- const hmrMeta = vueHmrMetadata2.get(resolve39(vuePagePath));
23368
+ const hmrMeta = vueHmrMetadata2.get(resolve40(vuePagePath));
22924
23369
  const changeType = hmrMeta?.changeType ?? "full";
22925
23370
  if (changeType === "style-only") {
22926
23371
  broadcastVueStyleOnly(state, vuePagePath, baseName, cssUrl, hmrId, manifest, duration);
@@ -23105,7 +23550,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
23105
23550
  const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
23106
23551
  await runSequentially(pageFilesToUpdate, async (htmxPageFile) => {
23107
23552
  const htmxPageName = basename12(htmxPageFile);
23108
- const builtHtmxPagePath = resolve39(outputHtmxPages, htmxPageName);
23553
+ const builtHtmxPagePath = resolve40(outputHtmxPages, htmxPageName);
23109
23554
  await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
23110
23555
  });
23111
23556
  }, collectUpdatedModulePaths = (allModuleUpdates) => {
@@ -23214,7 +23659,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
23214
23659
  html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
23215
23660
  writeFs(destPath, html);
23216
23661
  }, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
23217
- const destPath = resolve39(outputDir, basename12(sourceFile));
23662
+ const destPath = resolve40(outputDir, basename12(sourceFile));
23218
23663
  const hmrScript = extractHmrScript(destPath, readFs);
23219
23664
  const source = await Bun.file(sourceFile).text();
23220
23665
  await Bun.write(destPath, source);
@@ -23355,6 +23800,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
23355
23800
  type: "rebuild-complete"
23356
23801
  });
23357
23802
  if (config.tailwind && filesToRebuild && filesToRebuild.some(isTailwindCandidate)) {
23803
+ try {
23804
+ const outputPath = resolve40(state.resolvedPaths.buildDir, config.tailwind.output);
23805
+ const bytes = await Bun.file(outputPath).bytes();
23806
+ const webPath = `/${config.tailwind.output.replace(/^\/+/, "")}`;
23807
+ state.assetStore.set(webPath, bytes);
23808
+ } catch {}
23358
23809
  broadcastToClients(state, {
23359
23810
  data: { framework: "tailwind", manifest },
23360
23811
  message: "Tailwind utilities recompiled",
@@ -23371,18 +23822,6 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
23371
23822
  await handleFullBuildHMR(state, config, affectedFrameworks, filesToRebuild, manifest, duration);
23372
23823
  }
23373
23824
  broadcastFrameworkUpdates(state, affectedFrameworks, filesToRebuild, manifest, startTime);
23374
- if (affectedFrameworks.includes("angular")) {
23375
- markSsrCacheDirty("angular");
23376
- }
23377
- if (affectedFrameworks.includes("react")) {
23378
- markSsrCacheDirty("react");
23379
- }
23380
- if (affectedFrameworks.includes("svelte")) {
23381
- markSsrCacheDirty("svelte");
23382
- }
23383
- if (affectedFrameworks.includes("vue")) {
23384
- markSsrCacheDirty("vue");
23385
- }
23386
23825
  onRebuildComplete({ hmrState: state, manifest });
23387
23826
  return manifest;
23388
23827
  }, drainPendingQueue = (state, config, onRebuildComplete) => {
@@ -23465,6 +23904,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
23465
23904
  }
23466
23905
  };
23467
23906
  var init_rebuildTrigger = __esm(() => {
23907
+ init_generatedDir();
23468
23908
  init_build();
23469
23909
  init_scanEntryPoints();
23470
23910
  init_islandEntries();
@@ -23484,8 +23924,14 @@ var init_rebuildTrigger = __esm(() => {
23484
23924
  init_stylePreprocessor();
23485
23925
  init_compileTailwind();
23486
23926
  init_tailwindCompiler();
23487
- init_ssrCache();
23488
23927
  moduleServerPromise = Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
23928
+ FRAMEWORK_DIR_KEYS_FOR_CLEANUP = [
23929
+ { configKey: "reactDirectory", framework: "react" },
23930
+ { configKey: "svelteDirectory", framework: "svelte" },
23931
+ { configKey: "vueDirectory", framework: "vue" },
23932
+ { configKey: "emberDirectory", framework: "ember" },
23933
+ { configKey: "angularDirectory", framework: "angular" }
23934
+ ];
23489
23935
  USER_FIXABLE_FAST_HMR_REASONS = new Set([
23490
23936
  "template-parse-error",
23491
23937
  "template-resource-not-found",
@@ -23493,6 +23939,8 @@ var init_rebuildTrigger = __esm(() => {
23493
23939
  ]);
23494
23940
  angularBundleState = new WeakMap;
23495
23941
  getReactModuleUrl = getModuleUrl;
23942
+ svelteBundleState = new WeakMap;
23943
+ vueBundleState = new WeakMap;
23496
23944
  EMBER_PAGE_EXTENSIONS = [".gts", ".gjs", ".ts", ".js"];
23497
23945
  HMR_SCRIPT_PATTERN = /<script>window\.__HMR_FRAMEWORK__[\s\S]*?<\/script>\s*<script data-hmr-client>[\s\S]*?<\/script>/;
23498
23946
  STYLE_FILE_EXT_RE = /\.(?:css|scss|sass|less|styl|stylus)$/i;
@@ -23505,9 +23953,9 @@ __export(exports_buildDepVendor, {
23505
23953
  buildDepVendor: () => buildDepVendor
23506
23954
  });
23507
23955
  import { mkdirSync as mkdirSync13 } from "fs";
23508
- import { join as join31 } from "path";
23956
+ import { join as join32 } from "path";
23509
23957
  import { rm as rm10 } from "fs/promises";
23510
- var {build: bunBuild9, Glob: Glob9 } = globalThis.Bun;
23958
+ var {build: bunBuild9, Glob: Glob10 } = globalThis.Bun;
23511
23959
  var toSafeFileName6 = (specifier) => {
23512
23960
  const prefix = specifier.startsWith("@") ? "_" : "";
23513
23961
  return prefix + specifier.replace(/\//g, "_").replace(/@/g, "").replace(/-/g, "_");
@@ -23533,7 +23981,7 @@ var toSafeFileName6 = (specifier) => {
23533
23981
  return { dep, framework };
23534
23982
  }, scanDirFiles = async (dir) => {
23535
23983
  const empty = [];
23536
- const glob = new Glob9("**/*.{ts,tsx,js,jsx}");
23984
+ const glob = new Glob10("**/*.{ts,tsx,js,jsx}");
23537
23985
  try {
23538
23986
  const all = await Array.fromAsync(glob.scan({ absolute: true, cwd: dir }));
23539
23987
  return all.filter((file5) => !isSkippedFile(file5));
@@ -23616,7 +24064,7 @@ var toSafeFileName6 = (specifier) => {
23616
24064
  }), buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
23617
24065
  const entries = await Promise.all(specifiers.map(async (specifier) => {
23618
24066
  const safeName = toSafeFileName6(specifier);
23619
- const entryPath = join31(tmpDir, `${safeName}.ts`);
24067
+ const entryPath = join32(tmpDir, `${safeName}.ts`);
23620
24068
  await Bun.write(entryPath, await generateVendorEntrySource(specifier));
23621
24069
  return { entryPath, specifier };
23622
24070
  }));
@@ -23677,9 +24125,9 @@ var toSafeFileName6 = (specifier) => {
23677
24125
  const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
23678
24126
  if (initialSpecs.length === 0 && frameworkRoots.length === 0)
23679
24127
  return {};
23680
- const vendorDir = join31(buildDir, "vendor");
24128
+ const vendorDir = join32(buildDir, "vendor");
23681
24129
  mkdirSync13(vendorDir, { recursive: true });
23682
- const tmpDir = join31(buildDir, "_dep_vendor_tmp");
24130
+ const tmpDir = join32(buildDir, "_dep_vendor_tmp");
23683
24131
  mkdirSync13(tmpDir, { recursive: true });
23684
24132
  const allSpecs = new Set(initialSpecs);
23685
24133
  const alreadyScanned = new Set;
@@ -23758,11 +24206,12 @@ var init_buildDepVendor = __esm(() => {
23758
24206
  // src/core/devBuild.ts
23759
24207
  var exports_devBuild = {};
23760
24208
  __export(exports_devBuild, {
23761
- devBuild: () => devBuild
24209
+ devBuild: () => devBuild,
24210
+ applyConfigChanges: () => applyConfigChanges
23762
24211
  });
23763
24212
  import { readdir as readdir5 } from "fs/promises";
23764
- import { statSync as statSync5 } from "fs";
23765
- import { resolve as resolve40 } from "path";
24213
+ import { statSync as statSync6 } from "fs";
24214
+ import { resolve as resolve41 } from "path";
23766
24215
  var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
23767
24216
  const configuredDirs = [
23768
24217
  config.reactDirectory,
@@ -23785,7 +24234,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
23785
24234
  return Object.keys(config).length > 0 ? config : null;
23786
24235
  }, reloadConfig = async () => {
23787
24236
  try {
23788
- const configPath2 = resolve40(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
24237
+ const configPath2 = resolve41(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
23789
24238
  const source = await Bun.file(configPath2).text();
23790
24239
  return parseDirectoryConfig(source);
23791
24240
  } catch {
@@ -23794,12 +24243,28 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
23794
24243
  }, detectConfigChanges = async (cached) => {
23795
24244
  const newConfig = await reloadConfig();
23796
24245
  if (!newConfig)
23797
- return;
24246
+ return { added: [], removed: [] };
23798
24247
  const state = cached.hmrState;
23799
24248
  const oldConfig = state.config;
23800
- const hasChanges = FRAMEWORK_DIR_KEYS.some((key) => newConfig[key] !== oldConfig[key]);
23801
- if (!hasChanges)
23802
- return;
24249
+ const added = [];
24250
+ const removed = [];
24251
+ for (const key of FRAMEWORK_DIR_KEYS) {
24252
+ const oldVal = oldConfig[key];
24253
+ const newVal = newConfig[key];
24254
+ if (oldVal === newVal)
24255
+ continue;
24256
+ if (!oldVal && newVal)
24257
+ added.push(key);
24258
+ else if (oldVal && !newVal)
24259
+ removed.push(key);
24260
+ else if (oldVal && newVal) {
24261
+ removed.push(key);
24262
+ added.push(key);
24263
+ }
24264
+ }
24265
+ if (added.length === 0 && removed.length === 0) {
24266
+ return { added: [], removed: [] };
24267
+ }
23803
24268
  const oldWatchPaths = new Set(getWatchPaths(oldConfig, state.resolvedPaths));
23804
24269
  for (const key of FRAMEWORK_DIR_KEYS) {
23805
24270
  state.config[key] = newConfig[key];
@@ -23831,6 +24296,12 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
23831
24296
  });
23832
24297
  });
23833
24298
  }
24299
+ return { added, removed };
24300
+ }, applyConfigChanges = async () => {
24301
+ const cached = globalThis.__hmrDevResult;
24302
+ if (!cached)
24303
+ return null;
24304
+ return detectConfigChanges(cached);
23834
24305
  }, removeStaleKeys = (target, source) => {
23835
24306
  for (const key of Object.keys(target)) {
23836
24307
  if (!(key in source))
@@ -23870,7 +24341,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
23870
24341
  state.fileChangeQueue.clear();
23871
24342
  }
23872
24343
  }, handleCachedReload = async () => {
23873
- const serverMtime = statSync5(resolve40(Bun.main)).mtimeMs;
24344
+ const serverMtime = statSync6(resolve41(Bun.main)).mtimeMs;
23874
24345
  const lastMtime = globalThis.__hmrServerMtime;
23875
24346
  globalThis.__hmrServerMtime = serverMtime;
23876
24347
  const cached = globalThis.__hmrDevResult;
@@ -23907,8 +24378,8 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
23907
24378
  return true;
23908
24379
  }, resolveAbsoluteVersion2 = async () => {
23909
24380
  const candidates = [
23910
- resolve40(import.meta.dir, "..", "..", "package.json"),
23911
- resolve40(import.meta.dir, "..", "package.json")
24381
+ resolve41(import.meta.dir, "..", "..", "package.json"),
24382
+ resolve41(import.meta.dir, "..", "package.json")
23912
24383
  ];
23913
24384
  const [candidate, ...remaining] = candidates;
23914
24385
  if (!candidate) {
@@ -23934,7 +24405,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
23934
24405
  const entries = await readdir5(vendorDir).catch(() => emptyStringArray);
23935
24406
  await Promise.all(entries.filter((entry) => entry.endsWith(".js")).map(async (entry) => {
23936
24407
  const webPath = `/${framework}/vendor/${entry}`;
23937
- const bytes = await Bun.file(resolve40(vendorDir, entry)).bytes();
24408
+ const bytes = await Bun.file(resolve41(vendorDir, entry)).bytes();
23938
24409
  assetStore.set(webPath, bytes);
23939
24410
  }));
23940
24411
  }, devBuild = async (config) => {
@@ -24002,11 +24473,11 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
24002
24473
  cleanStaleAssets(state.assetStore, manifest, state.resolvedPaths.buildDir);
24003
24474
  recordStep("populate asset store", stepStartedAt);
24004
24475
  stepStartedAt = performance.now();
24005
- const reactVendorDir = resolve40(state.resolvedPaths.buildDir, "react", "vendor");
24006
- const angularVendorDir = resolve40(state.resolvedPaths.buildDir, "angular", "vendor");
24007
- const svelteVendorDir = resolve40(state.resolvedPaths.buildDir, "svelte", "vendor");
24008
- const vueVendorDir = resolve40(state.resolvedPaths.buildDir, "vue", "vendor");
24009
- const depVendorDir = resolve40(state.resolvedPaths.buildDir, "vendor");
24476
+ const reactVendorDir = resolve41(state.resolvedPaths.buildDir, "react", "vendor");
24477
+ const angularVendorDir = resolve41(state.resolvedPaths.buildDir, "angular", "vendor");
24478
+ const svelteVendorDir = resolve41(state.resolvedPaths.buildDir, "svelte", "vendor");
24479
+ const vueVendorDir = resolve41(state.resolvedPaths.buildDir, "vue", "vendor");
24480
+ const depVendorDir = resolve41(state.resolvedPaths.buildDir, "vendor");
24010
24481
  const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
24011
24482
  const [, angularSpecs, , , , , depPaths] = await Promise.all([
24012
24483
  config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
@@ -24063,8 +24534,11 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
24063
24534
  recordStep("warm compilers", stepStartedAt);
24064
24535
  if (config.tailwind) {
24065
24536
  stepStartedAt = performance.now();
24066
- const { warmTailwindCompiler: warmTailwindCompiler2 } = await Promise.resolve().then(() => (init_tailwindCompiler(), exports_tailwindCompiler));
24067
- await warmTailwindCompiler2(config.tailwind);
24537
+ const [{ warmTailwindCompiler: warmTailwindCompiler2 }, { computeFrameworkTailwindSources: computeFrameworkTailwindSources2 }] = await Promise.all([
24538
+ Promise.resolve().then(() => (init_tailwindCompiler(), exports_tailwindCompiler)),
24539
+ Promise.resolve().then(() => (init_compileTailwind(), exports_compileTailwind))
24540
+ ]);
24541
+ await warmTailwindCompiler2(config.tailwind, computeFrameworkTailwindSources2(config));
24068
24542
  recordStep("warm tailwind compiler", stepStartedAt);
24069
24543
  }
24070
24544
  state.manifest = manifest;
@@ -24084,7 +24558,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
24084
24558
  manifest
24085
24559
  };
24086
24560
  globalThis.__hmrDevResult = result;
24087
- globalThis.__hmrServerMtime = statSync5(resolve40(Bun.main)).mtimeMs;
24561
+ globalThis.__hmrServerMtime = statSync6(resolve41(Bun.main)).mtimeMs;
24088
24562
  return result;
24089
24563
  };
24090
24564
  var init_devBuild = __esm(() => {
@@ -24229,8 +24703,8 @@ var STORE_KEY = "__elysiaStore", getGlobalValue = (key) => Reflect.get(globalThi
24229
24703
  return null;
24230
24704
  if (!pathname.startsWith("/"))
24231
24705
  return null;
24232
- const { resolve: resolve41, normalize } = await import("path");
24233
- const candidate = resolve41(buildDir, pathname.slice(1));
24706
+ const { resolve: resolve42, normalize } = await import("path");
24707
+ const candidate = resolve42(buildDir, pathname.slice(1));
24234
24708
  const normalizedBuild = normalize(buildDir);
24235
24709
  if (!candidate.startsWith(normalizedBuild))
24236
24710
  return null;
@@ -24314,12 +24788,12 @@ __export(exports_devtoolsJson, {
24314
24788
  devtoolsJson: () => devtoolsJson
24315
24789
  });
24316
24790
  import { existsSync as existsSync28, mkdirSync as mkdirSync14, readFileSync as readFileSync21, writeFileSync as writeFileSync9 } from "fs";
24317
- import { dirname as dirname23, join as join32, resolve as resolve41 } from "path";
24791
+ import { dirname as dirname24, join as join33, resolve as resolve42 } from "path";
24318
24792
  import { Elysia as Elysia3 } from "elysia";
24319
24793
  var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_KEY = "__absoluteDevtoolsWorkspaceUuid", getGlobalUuid = () => Reflect.get(globalThis, UUID_CACHE_KEY), setGlobalUuid = (uuid) => {
24320
24794
  Reflect.set(globalThis, UUID_CACHE_KEY, uuid);
24321
24795
  return uuid;
24322
- }, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) => resolve41(uuidCachePath ?? join32(buildDir, ".absolute", "chrome-devtools-workspace-uuid")), readCachedUuid = (cachePath) => {
24796
+ }, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) => resolve42(uuidCachePath ?? join33(buildDir, ".absolute", "chrome-devtools-workspace-uuid")), readCachedUuid = (cachePath) => {
24323
24797
  if (!existsSync28(cachePath))
24324
24798
  return null;
24325
24799
  try {
@@ -24341,11 +24815,11 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
24341
24815
  if (cachedUuid)
24342
24816
  return setGlobalUuid(cachedUuid);
24343
24817
  const uuid = crypto.randomUUID();
24344
- mkdirSync14(dirname23(cachePath), { recursive: true });
24818
+ mkdirSync14(dirname24(cachePath), { recursive: true });
24345
24819
  writeFileSync9(cachePath, uuid, "utf-8");
24346
24820
  return setGlobalUuid(uuid);
24347
24821
  }, devtoolsJson = (buildDir, options = {}) => {
24348
- const rootPath = resolve41(options.projectRoot ?? process.cwd());
24822
+ const rootPath = resolve42(options.projectRoot ?? process.cwd());
24349
24823
  const root = options.normalizeForWindowsContainer === false ? rootPath : normalizeDevtoolsWorkspaceRoot(rootPath);
24350
24824
  const uuid = getOrCreateUuid(buildDir, options);
24351
24825
  return new Elysia3({ name: "absolute-devtools-json" }).get(ENDPOINT, () => ({
@@ -24358,11 +24832,11 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
24358
24832
  if (process.env.WSL_DISTRO_NAME) {
24359
24833
  const distro = process.env.WSL_DISTRO_NAME;
24360
24834
  const withoutLeadingSlash = root.replace(/^\//, "");
24361
- return join32("\\\\wsl.localhost", distro, withoutLeadingSlash).replace(/\//g, "\\");
24835
+ return join33("\\\\wsl.localhost", distro, withoutLeadingSlash).replace(/\//g, "\\");
24362
24836
  }
24363
24837
  if (process.env.DOCKER_DESKTOP && !root.startsWith("\\\\")) {
24364
24838
  const withoutLeadingSlash = root.replace(/^\//, "");
24365
- return join32("\\\\wsl.localhost", "docker-desktop-data", withoutLeadingSlash).replace(/\//g, "\\");
24839
+ return join33("\\\\wsl.localhost", "docker-desktop-data", withoutLeadingSlash).replace(/\//g, "\\");
24366
24840
  }
24367
24841
  return root;
24368
24842
  };
@@ -24374,7 +24848,7 @@ __export(exports_imageOptimizer, {
24374
24848
  imageOptimizer: () => imageOptimizer
24375
24849
  });
24376
24850
  import { existsSync as existsSync29 } from "fs";
24377
- import { resolve as resolve42 } from "path";
24851
+ import { resolve as resolve43 } from "path";
24378
24852
  import { Elysia as Elysia4 } from "elysia";
24379
24853
  var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avifInProgress, safeResolve = (path, baseDir) => {
24380
24854
  try {
@@ -24387,7 +24861,7 @@ var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avi
24387
24861
  }
24388
24862
  }, resolveLocalImage = (url, buildDir) => {
24389
24863
  const cleanPath = url.startsWith("/") ? url.slice(1) : url;
24390
- return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath, resolve42(process.cwd()));
24864
+ return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath, resolve43(process.cwd()));
24391
24865
  }, parseQueryParams = (query, allowedSizes, defaultQuality) => {
24392
24866
  const url = typeof query["url"] === "string" ? query["url"] : undefined;
24393
24867
  const wParam = typeof query["w"] === "string" ? query["w"] : undefined;
@@ -24679,7 +25153,7 @@ __export(exports_prerender, {
24679
25153
  PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
24680
25154
  });
24681
25155
  import { mkdirSync as mkdirSync15, readFileSync as readFileSync22 } from "fs";
24682
- import { join as join33 } from "path";
25156
+ import { join as join34 } from "path";
24683
25157
  var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_TIMEOUT_MS = 30000, PRERENDER_BYPASS_HEADER = "X-Absolute-Prerender-Bypass", routeToFilename = (route) => route === "/" ? "index.html" : `${route.slice(1).replace(/\//g, "-")}.html`, writeTimestamp = async (htmlPath) => {
24684
25158
  const metaPath = htmlPath.replace(/\.html$/, ".meta");
24685
25159
  await Bun.write(metaPath, String(Date.now()));
@@ -24745,7 +25219,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
24745
25219
  return false;
24746
25220
  const html = await res.text();
24747
25221
  const fileName = routeToFilename(route);
24748
- const filePath = join33(prerenderDir, fileName);
25222
+ const filePath = join34(prerenderDir, fileName);
24749
25223
  await Bun.write(filePath, html);
24750
25224
  await writeTimestamp(filePath);
24751
25225
  return true;
@@ -24771,13 +25245,13 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
24771
25245
  }
24772
25246
  const html = await res.text();
24773
25247
  const fileName = routeToFilename(route);
24774
- const filePath = join33(prerenderDir, fileName);
25248
+ const filePath = join34(prerenderDir, fileName);
24775
25249
  await Bun.write(filePath, html);
24776
25250
  await writeTimestamp(filePath);
24777
25251
  result.routes.set(route, filePath);
24778
25252
  log2?.(` Pre-rendered ${route} \u2192 ${fileName} (${html.length} bytes)`);
24779
25253
  }, prerender = async (port, outDir, staticConfig, log2) => {
24780
- const prerenderDir = join33(outDir, "_prerendered");
25254
+ const prerenderDir = join34(outDir, "_prerendered");
24781
25255
  mkdirSync15(prerenderDir, { recursive: true });
24782
25256
  const baseUrl = `http://localhost:${port}`;
24783
25257
  let routes;
@@ -24871,6 +25345,175 @@ ${serverOutput}` : "Server failed to start for pre-rendering";
24871
25345
  };
24872
25346
  var init_prerender = () => {};
24873
25347
 
25348
+ // src/dev/serverEntryWatcher.ts
25349
+ var exports_serverEntryWatcher = {};
25350
+ __export(exports_serverEntryWatcher, {
25351
+ startServerEntryWatcher: () => startServerEntryWatcher
25352
+ });
25353
+ import { copyFileSync as copyFileSync2, existsSync as existsSync32, statSync as statSync7, unlinkSync as unlinkSync2, watch as watch2 } from "fs";
25354
+ import { dirname as dirname25, join as join37, resolve as resolve45 } from "path";
25355
+ var ATOMIC_RECOVERY_WINDOW_MS = 1000, RELOAD_DEBOUNCE_MS = 80, ATOMIC_WRITE_TEMP_PATTERNS2, isAtomicWriteTemp = (filename) => filename.endsWith(".tmp") || filename.includes(".tmp.") || filename.endsWith("~") || filename.startsWith(".#") || filename.startsWith(".absolutejs-hmr-") || ATOMIC_WRITE_TEMP_PATTERNS2.some((re2) => re2.test(filename)), startServerEntryWatcher = () => {
25356
+ if (globalThis.__absoluteEntryWatcherStarted)
25357
+ return;
25358
+ const main = Bun.main;
25359
+ if (!main || !existsSync32(main))
25360
+ return;
25361
+ globalThis.__absoluteEntryWatcherStarted = true;
25362
+ const entryPath = resolve45(main);
25363
+ const entryDir = dirname25(entryPath);
25364
+ const entryBase = entryPath.slice(entryDir.length + 1);
25365
+ const configPath2 = resolve45(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
25366
+ const configDir2 = dirname25(configPath2);
25367
+ const configBase = configPath2.slice(configDir2.length + 1);
25368
+ const recentlyHandled = new Map;
25369
+ let entryReloadTimer = null;
25370
+ let configReloadTimer = null;
25371
+ const triggerEntryReload = async (cause) => {
25372
+ const now = Date.now();
25373
+ const last = recentlyHandled.get(`entry:${cause}`) ?? 0;
25374
+ if (now - last < 100)
25375
+ return;
25376
+ recentlyHandled.set(`entry:${cause}`, now);
25377
+ const tmpName = `.absolutejs-hmr-${now}-${Math.random().toString(36).slice(2, 8)}.ts`;
25378
+ const tmpPath = join37(entryDir, tmpName);
25379
+ try {
25380
+ console.log(`[hmr] reloading server entry (${cause})`);
25381
+ copyFileSync2(entryPath, tmpPath);
25382
+ await import(tmpPath);
25383
+ const hmrState2 = globalThis.__hmrDevResult?.hmrState;
25384
+ if (hmrState2) {
25385
+ const { broadcastToClients: broadcastToClients2 } = await Promise.resolve().then(() => (init_webSocket(), exports_webSocket));
25386
+ broadcastToClients2(hmrState2, {
25387
+ data: { entryPath, cause },
25388
+ type: "server-entry-reloaded"
25389
+ });
25390
+ }
25391
+ } catch (err) {
25392
+ console.error(`[hmr] entry re-evaluation failed: ${err instanceof Error ? err.message : String(err)}`);
25393
+ console.log(`[abs:restart] ${entryPath}`);
25394
+ } finally {
25395
+ try {
25396
+ unlinkSync2(tmpPath);
25397
+ } catch {}
25398
+ }
25399
+ };
25400
+ const triggerConfigChange = async (cause) => {
25401
+ const now = Date.now();
25402
+ const last = recentlyHandled.get(`config:${cause}`) ?? 0;
25403
+ if (now - last < 100)
25404
+ return;
25405
+ recentlyHandled.set(`config:${cause}`, now);
25406
+ try {
25407
+ const diff = await applyConfigChanges();
25408
+ if (!diff) {
25409
+ return;
25410
+ }
25411
+ if (diff.removed.length === 0 && diff.added.length === 0) {
25412
+ console.log("[hmr] absolute.config.ts changed (non-framework keys) \u2014 restarting");
25413
+ console.log(`[abs:restart] ${configPath2}`);
25414
+ return;
25415
+ }
25416
+ if (diff.removed.length > 0) {
25417
+ console.log(`[hmr] absolute.config.ts removed framework(s) ${diff.removed.join(", ")} \u2014 restarting`);
25418
+ console.log(`[abs:restart] ${configPath2}`);
25419
+ return;
25420
+ }
25421
+ console.log(`[hmr] absolute.config.ts added framework(s) ${diff.added.join(", ")} \u2014 restarting (initial build needed)`);
25422
+ console.log(`[abs:restart] ${configPath2}`);
25423
+ } catch (err) {
25424
+ console.error(`[hmr] config change handling failed: ${err instanceof Error ? err.message : String(err)}`);
25425
+ console.log(`[abs:restart] ${configPath2}`);
25426
+ }
25427
+ };
25428
+ const scheduleEntryReload = (cause) => {
25429
+ if (entryReloadTimer)
25430
+ return;
25431
+ entryReloadTimer = setTimeout(() => {
25432
+ entryReloadTimer = null;
25433
+ triggerEntryReload(cause);
25434
+ }, RELOAD_DEBOUNCE_MS);
25435
+ };
25436
+ const scheduleConfigChange = (cause) => {
25437
+ if (configReloadTimer)
25438
+ return;
25439
+ configReloadTimer = setTimeout(() => {
25440
+ configReloadTimer = null;
25441
+ triggerConfigChange(cause);
25442
+ }, RELOAD_DEBOUNCE_MS);
25443
+ };
25444
+ const recoveryScan = (dir) => {
25445
+ let entries;
25446
+ try {
25447
+ const { readdirSync: readdirSync5 } = __require("fs");
25448
+ entries = readdirSync5(dir, { withFileTypes: true });
25449
+ } catch {
25450
+ return;
25451
+ }
25452
+ const now = Date.now();
25453
+ for (const entry of entries) {
25454
+ if (!entry.isFile())
25455
+ continue;
25456
+ const isEntry = dir === entryDir && entry.name === entryBase;
25457
+ const isConfig = dir === configDir2 && entry.name === configBase;
25458
+ if (!isEntry && !isConfig)
25459
+ continue;
25460
+ let st2;
25461
+ try {
25462
+ st2 = statSync7(join37(dir, entry.name));
25463
+ } catch {
25464
+ continue;
25465
+ }
25466
+ if (now - st2.ctimeMs > ATOMIC_RECOVERY_WINDOW_MS)
25467
+ continue;
25468
+ if (isEntry)
25469
+ scheduleEntryReload(entry.name);
25470
+ if (isConfig)
25471
+ scheduleConfigChange(entry.name);
25472
+ }
25473
+ };
25474
+ const handleEvent = (dir, _event, filename) => {
25475
+ if (!filename)
25476
+ return;
25477
+ if (isAtomicWriteTemp(filename)) {
25478
+ recoveryScan(dir);
25479
+ return;
25480
+ }
25481
+ if (dir === entryDir && filename === entryBase) {
25482
+ scheduleEntryReload(filename);
25483
+ return;
25484
+ }
25485
+ if (dir === configDir2 && filename === configBase) {
25486
+ scheduleConfigChange(filename);
25487
+ return;
25488
+ }
25489
+ };
25490
+ const entryWatcher = watch2(entryDir, { recursive: false }, (event, file5) => handleEvent(entryDir, event, file5));
25491
+ let configWatcher = null;
25492
+ if (configDir2 !== entryDir) {
25493
+ configWatcher = watch2(configDir2, { recursive: false }, (event, file5) => handleEvent(configDir2, event, file5));
25494
+ }
25495
+ const closeAll = () => {
25496
+ try {
25497
+ entryWatcher.close();
25498
+ } catch {}
25499
+ if (configWatcher) {
25500
+ try {
25501
+ configWatcher.close();
25502
+ } catch {}
25503
+ }
25504
+ };
25505
+ process.once("exit", closeAll);
25506
+ process.once("SIGINT", closeAll);
25507
+ process.once("SIGTERM", closeAll);
25508
+ };
25509
+ var init_serverEntryWatcher = __esm(() => {
25510
+ init_devBuild();
25511
+ ATOMIC_WRITE_TEMP_PATTERNS2 = [
25512
+ /^sed[A-Za-z0-9]{6,}$/,
25513
+ /^4913$/
25514
+ ];
25515
+ });
25516
+
24874
25517
  // src/core/streamingSlotRegistrar.ts
24875
25518
  var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
24876
25519
  var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
@@ -25053,8 +25696,6 @@ var hmrState = {
25053
25696
  pingInterval: null,
25054
25697
  reconnectTimeout: null
25055
25698
  };
25056
- // types/websocket.ts
25057
- var WS_READY_STATE_OPEN = 1;
25058
25699
  // src/build/index.ts
25059
25700
  init_compileTailwind();
25060
25701
  init_tailwindCompiler();
@@ -25376,13 +26017,13 @@ var handleHTMXPageRequest = async (pagePath) => {
25376
26017
  };
25377
26018
  // src/core/prepare.ts
25378
26019
  init_loadConfig();
25379
- import { existsSync as existsSync30, readdirSync as readdirSync3, readFileSync as readFileSync23 } from "fs";
25380
- import { basename as basename13, join as join34, relative as relative17, resolve as resolve43 } from "path";
26020
+ import { existsSync as existsSync30, readdirSync as readdirSync4, readFileSync as readFileSync23 } from "fs";
26021
+ import { basename as basename13, join as join35, relative as relative17, resolve as resolve44 } from "path";
25381
26022
  import { Elysia as Elysia5 } from "elysia";
25382
26023
 
25383
26024
  // src/core/loadIslandRegistry.ts
25384
26025
  init_islandEntries();
25385
- import { resolve as resolve9 } from "path";
26026
+ import { resolve as resolve10 } from "path";
25386
26027
  var isRecord6 = (value) => typeof value === "object" && value !== null;
25387
26028
  var resolveRegistryExport2 = (mod) => {
25388
26029
  if (isRecord6(mod.islandRegistry))
@@ -25394,7 +26035,7 @@ var resolveRegistryExport2 = (mod) => {
25394
26035
  var isRegistryModuleExport = (value) => isRecord6(value);
25395
26036
  var isIslandRegistryInput = (value) => isRecord6(value);
25396
26037
  var loadIslandRegistry = async (registryPath) => {
25397
- const resolvedRegistryPath = resolve9(registryPath);
26038
+ const resolvedRegistryPath = resolve10(registryPath);
25398
26039
  const buildInfo = await loadIslandRegistryBuildInfo(resolvedRegistryPath);
25399
26040
  if (buildInfo.definitions.length > 0) {
25400
26041
  return buildInfo.registry;
@@ -25734,12 +26375,12 @@ var buildPrewarmDirs = (config) => {
25734
26375
  return dirs;
25735
26376
  };
25736
26377
  var collectPrewarmFiles = async (prewarmDirs) => {
25737
- const { Glob: Glob10 } = await Promise.resolve(globalThis.Bun);
26378
+ const { Glob: Glob11 } = await Promise.resolve(globalThis.Bun);
25738
26379
  const files = [];
25739
26380
  for (const { dir, pattern } of prewarmDirs) {
25740
- const glob = new Glob10(pattern);
26381
+ const glob = new Glob11(pattern);
25741
26382
  const matches = [
25742
- ...glob.scanSync({ absolute: true, cwd: resolve43(dir) })
26383
+ ...glob.scanSync({ absolute: true, cwd: resolve44(dir) })
25743
26384
  ];
25744
26385
  files.push(...matches);
25745
26386
  }
@@ -25775,7 +26416,7 @@ var patchManifestIndexes = (manifest, devIndexDir, SRC_URL_PREFIX2) => {
25775
26416
  const fileName = resolveDevIndexFileName(manifest[key], baseName);
25776
26417
  if (!fileName)
25777
26418
  continue;
25778
- const srcPath = resolve43(devIndexDir, fileName);
26419
+ const srcPath = resolve44(devIndexDir, fileName);
25779
26420
  if (!existsSync30(srcPath))
25780
26421
  continue;
25781
26422
  const rel = relative17(process.cwd(), srcPath).replace(/\\/g, "/");
@@ -25848,7 +26489,7 @@ var prepareDev = async (config, buildDir) => {
25848
26489
  stepStartedAt = performance.now();
25849
26490
  const hmrPlugin = hmr2(result.hmrState, result.manifest, moduleHandler);
25850
26491
  const { devtoolsJson: devtoolsJson2 } = await Promise.resolve().then(() => (init_devtoolsJson(), exports_devtoolsJson));
25851
- const devIndexDir = resolve43(buildDir, "_src_indexes");
26492
+ const devIndexDir = resolve44(buildDir, "_src_indexes");
25852
26493
  patchManifestIndexes(result.manifest, devIndexDir, SRC_URL_PREFIX2);
25853
26494
  recordStep("configure dev plugins", stepStartedAt);
25854
26495
  stepStartedAt = performance.now();
@@ -25888,7 +26529,7 @@ var loadPrerenderMap = (prerenderDir) => {
25888
26529
  return map;
25889
26530
  let entries;
25890
26531
  try {
25891
- entries = readdirSync3(prerenderDir);
26532
+ entries = readdirSync4(prerenderDir);
25892
26533
  } catch {
25893
26534
  return map;
25894
26535
  }
@@ -25897,7 +26538,7 @@ var loadPrerenderMap = (prerenderDir) => {
25897
26538
  continue;
25898
26539
  const name = basename13(entry, ".html");
25899
26540
  const route = name === "index" ? "/" : `/${name}`;
25900
- map.set(route, join34(prerenderDir, entry));
26541
+ map.set(route, join35(prerenderDir, entry));
25901
26542
  }
25902
26543
  return map;
25903
26544
  };
@@ -25929,7 +26570,7 @@ var prepare = async (configOrPath) => {
25929
26570
  recordStep("load config", stepStartedAt);
25930
26571
  const nodeEnv = process.env["NODE_ENV"];
25931
26572
  const isDev3 = nodeEnv === "development";
25932
- const buildDir = resolve43(process.env.ABSOLUTE_BUILD_DIR ?? config.buildDirectory ?? "build");
26573
+ const buildDir = resolve44(process.env.ABSOLUTE_BUILD_DIR ?? config.buildDirectory ?? "build");
25933
26574
  if (isDev3) {
25934
26575
  stepStartedAt = performance.now();
25935
26576
  const result = await prepareDev(config, buildDir);
@@ -25946,7 +26587,7 @@ var prepare = async (configOrPath) => {
25946
26587
  setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
25947
26588
  recordStep("load production manifest and island metadata", stepStartedAt);
25948
26589
  stepStartedAt = performance.now();
25949
- const conventionsPath = join34(buildDir, "conventions.json");
26590
+ const conventionsPath = join35(buildDir, "conventions.json");
25950
26591
  if (existsSync30(conventionsPath)) {
25951
26592
  const conventions2 = JSON.parse(readFileSync23(conventionsPath, "utf-8"));
25952
26593
  setConventions(conventions2);
@@ -25962,7 +26603,7 @@ var prepare = async (configOrPath) => {
25962
26603
  });
25963
26604
  recordStep("create static plugin", stepStartedAt);
25964
26605
  stepStartedAt = performance.now();
25965
- const prerenderDir = join34(buildDir, "_prerendered");
26606
+ const prerenderDir = join35(buildDir, "_prerendered");
25966
26607
  const prerenderMap = loadPrerenderMap(prerenderDir);
25967
26608
  recordStep("load prerender map", stepStartedAt);
25968
26609
  if (prerenderMap.size > 0) {
@@ -26020,11 +26661,11 @@ import { argv } from "process";
26020
26661
  var {env: env4 } = globalThis.Bun;
26021
26662
 
26022
26663
  // src/dev/devCert.ts
26023
- import { existsSync as existsSync31, mkdirSync as mkdirSync16, readFileSync as readFileSync24, rmSync as rmSync3 } from "fs";
26024
- import { join as join35 } from "path";
26025
- var CERT_DIR = join35(process.cwd(), ".absolutejs");
26026
- var CERT_PATH = join35(CERT_DIR, "cert.pem");
26027
- var KEY_PATH = join35(CERT_DIR, "key.pem");
26664
+ import { existsSync as existsSync31, mkdirSync as mkdirSync16, readFileSync as readFileSync24, rmSync as rmSync4 } from "fs";
26665
+ import { join as join36 } from "path";
26666
+ var CERT_DIR = join36(process.cwd(), ".absolutejs");
26667
+ var CERT_PATH = join36(CERT_DIR, "cert.pem");
26668
+ var KEY_PATH = join36(CERT_DIR, "key.pem");
26028
26669
  var CERT_VALIDITY_DAYS = 365;
26029
26670
  var devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`);
26030
26671
  var devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`);
@@ -26179,37 +26820,75 @@ var loadTls = () => {
26179
26820
  };
26180
26821
  var tls = loadTls();
26181
26822
  var protocol = tls ? "https" : "http";
26182
- var networking = (app) => env4.ABSOLUTE_COMPILED_RUNTIME === "1" ? app : app.listen({
26183
- hostname: host,
26184
- port,
26185
- ...tls ? {
26186
- tls: {
26187
- cert: tls.cert,
26188
- key: tls.key
26189
- }
26190
- } : {}
26191
- }, () => {
26192
- if (visibility === "internal" || managedByWorkspace) {
26193
- return;
26194
- }
26195
- const isHotReload = Boolean(globalThis.__hmrServerStartup);
26196
- globalThis.__hmrServerStartup = true;
26197
- if (isHotReload) {
26198
- return;
26823
+ var networking = (app) => {
26824
+ if (env4.ABSOLUTE_COMPILED_RUNTIME === "1")
26825
+ return app;
26826
+ const liveServer = globalThis.__absoluteBunServer;
26827
+ if (liveServer && typeof liveServer.reload === "function") {
26828
+ const prevStore = globalThis.__absolutePreviousAppStore;
26829
+ if (prevStore && app.store && typeof app.store === "object") {
26830
+ const newStore = app.store;
26831
+ const oldStore = prevStore;
26832
+ for (const key of Object.keys(newStore)) {
26833
+ if (key in oldStore) {
26834
+ newStore[key] = oldStore[key];
26835
+ }
26836
+ }
26837
+ }
26838
+ globalThis.__absolutePreviousAppStore = app.store;
26839
+ try {
26840
+ app.compile();
26841
+ } catch {}
26842
+ liveServer.reload({
26843
+ fetch: (request) => app.fetch(request),
26844
+ routes: {}
26845
+ });
26846
+ return app;
26199
26847
  }
26200
- const buildDuration = globalThis.__hmrBuildDuration ?? Number(env4.ABSOLUTE_BUILD_DURATION || 0);
26201
- const readyDuration = process.uptime() * MILLISECONDS_IN_A_SECOND;
26202
- const version = globalThis.__absoluteVersion || env4.ABSOLUTE_VERSION || "";
26203
- startupBanner({
26204
- buildDuration,
26205
- host,
26206
- networkUrl: hostFlag ? `${protocol}://${localIP}:${port}/` : undefined,
26848
+ const listened = app.listen({
26849
+ hostname: host,
26207
26850
  port,
26208
- protocol,
26209
- readyDuration,
26210
- version
26851
+ ...tls ? {
26852
+ tls: {
26853
+ cert: tls.cert,
26854
+ key: tls.key
26855
+ }
26856
+ } : {}
26857
+ }, () => {
26858
+ if (visibility === "internal" || managedByWorkspace) {
26859
+ return;
26860
+ }
26861
+ const isHotReload = Boolean(globalThis.__hmrServerStartup);
26862
+ globalThis.__hmrServerStartup = true;
26863
+ if (isHotReload) {
26864
+ return;
26865
+ }
26866
+ const buildDuration = globalThis.__hmrBuildDuration ?? Number(env4.ABSOLUTE_BUILD_DURATION || 0);
26867
+ const readyDuration = process.uptime() * MILLISECONDS_IN_A_SECOND;
26868
+ const version = globalThis.__absoluteVersion || env4.ABSOLUTE_VERSION || "";
26869
+ startupBanner({
26870
+ buildDuration,
26871
+ host,
26872
+ networkUrl: hostFlag ? `${protocol}://${localIP}:${port}/` : undefined,
26873
+ port,
26874
+ protocol,
26875
+ readyDuration,
26876
+ version
26877
+ });
26211
26878
  });
26212
- });
26879
+ if (app.server) {
26880
+ globalThis.__absoluteBunServer = app.server;
26881
+ globalThis.__absolutePreviousAppStore = app.store;
26882
+ if (env4.NODE_ENV === "development") {
26883
+ Promise.resolve().then(() => (init_serverEntryWatcher(), exports_serverEntryWatcher)).then(({ startServerEntryWatcher: startServerEntryWatcher2 }) => {
26884
+ startServerEntryWatcher2();
26885
+ }).catch((err) => {
26886
+ console.error(`[hmr] entry watcher setup failed: ${err instanceof Error ? err.message : String(err)}`);
26887
+ });
26888
+ }
26889
+ }
26890
+ return listened;
26891
+ };
26213
26892
  // src/plugins/pageRouter.ts
26214
26893
  var pageRouterPlugin = () => {
26215
26894
  console.log("Page Router Plugin Not Implemented Yet");
@@ -26359,8 +27038,8 @@ var jsonLd2 = (schema) => {
26359
27038
  };
26360
27039
  // src/utils/defineEnv.ts
26361
27040
  var {env: bunEnv } = globalThis.Bun;
26362
- import { existsSync as existsSync32, readFileSync as readFileSync25 } from "fs";
26363
- import { resolve as resolve44 } from "path";
27041
+ import { existsSync as existsSync33, readFileSync as readFileSync25 } from "fs";
27042
+ import { resolve as resolve46 } from "path";
26364
27043
 
26365
27044
  // node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
26366
27045
  var exports_value = {};
@@ -32395,8 +33074,8 @@ ${lines.join(`
32395
33074
  };
32396
33075
  var checkEnvFileSecurity = (properties) => {
32397
33076
  const cwd2 = process.cwd();
32398
- const envPath = resolve44(cwd2, ".env");
32399
- if (!existsSync32(envPath))
33077
+ const envPath = resolve46(cwd2, ".env");
33078
+ if (!existsSync33(envPath))
32400
33079
  return;
32401
33080
  const sensitiveKeys = Object.keys(properties).filter(isSensitive);
32402
33081
  if (sensitiveKeys.length === 0)
@@ -32405,8 +33084,8 @@ var checkEnvFileSecurity = (properties) => {
32405
33084
  const presentKeys = sensitiveKeys.filter((key) => envContent.includes(`${key}=`));
32406
33085
  if (presentKeys.length === 0)
32407
33086
  return;
32408
- const gitignorePath = resolve44(cwd2, ".gitignore");
32409
- if (existsSync32(gitignorePath)) {
33087
+ const gitignorePath = resolve46(cwd2, ".gitignore");
33088
+ if (existsSync33(gitignorePath)) {
32410
33089
  const gitignore = readFileSync25(gitignorePath, "utf-8");
32411
33090
  if (gitignore.split(`
32412
33091
  `).some((line) => line.trim() === ".env"))
@@ -32647,5 +33326,5 @@ export {
32647
33326
  ANGULAR_INIT_TIMEOUT_MS
32648
33327
  };
32649
33328
 
32650
- //# debugId=20AB647BED125D3764756E2164756E21
33329
+ //# debugId=A0C3830E747857F064756E2164756E21
32651
33330
  //# sourceMappingURL=index.js.map