@absolutejs/absolute 0.19.0-beta.216 → 0.19.0-beta.218

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/build.js CHANGED
@@ -316,9 +316,12 @@ var indexContentCache, resolveDevClientDir = () => {
316
316
  if (!existsSync(reactIndexesDirectory)) {
317
317
  mkdirSync(reactIndexesDirectory, { recursive: true });
318
318
  }
319
+ const CONVENTION_RE = /^(?:(.+)\.)?(error|loading|not-found)\.[^.]+$/;
319
320
  const pagesGlob = new Glob("*.*");
320
321
  const files = [];
321
322
  for await (const file of pagesGlob.scan({ cwd: reactPagesDirectory })) {
323
+ if (CONVENTION_RE.test(file))
324
+ continue;
322
325
  files.push(file);
323
326
  }
324
327
  const currentPageNames = new Set(files.map((file) => basename(file).split(".")[0]));
@@ -718,14 +721,61 @@ var scanEntryPoints = async (dir, pattern) => {
718
721
  };
719
722
  var init_scanEntryPoints = () => {};
720
723
 
721
- // src/build/scanCssEntryPoints.ts
722
- import { existsSync as existsSync3 } from "fs";
724
+ // src/build/scanConventions.ts
725
+ import { basename as basename2 } from "path";
723
726
  var {Glob: Glob3 } = globalThis.Bun;
727
+ import { existsSync as existsSync3 } from "fs";
728
+ var CONVENTION_RE, scanConventions = async (pagesDir, pattern) => {
729
+ if (!existsSync3(pagesDir)) {
730
+ return { pageFiles: [], conventions: undefined };
731
+ }
732
+ const pageFiles = [];
733
+ const defaults = {};
734
+ const pages = {};
735
+ const glob = new Glob3(pattern);
736
+ for await (const file of glob.scan({ absolute: true, cwd: pagesDir })) {
737
+ const fileName = basename2(file);
738
+ const match = CONVENTION_RE.exec(fileName);
739
+ if (!match) {
740
+ pageFiles.push(file);
741
+ continue;
742
+ }
743
+ const [, pageName, kind] = match;
744
+ if (pageName) {
745
+ if (!pages[pageName])
746
+ pages[pageName] = {};
747
+ if (kind === "error")
748
+ pages[pageName].error = file;
749
+ else if (kind === "loading")
750
+ pages[pageName].loading = file;
751
+ } else {
752
+ if (kind === "error")
753
+ defaults.error = file;
754
+ else if (kind === "loading")
755
+ defaults.loading = file;
756
+ else if (kind === "not-found")
757
+ defaults.notFound = file;
758
+ }
759
+ }
760
+ const hasConventions = defaults.error !== undefined || defaults.loading !== undefined || defaults.notFound !== undefined || Object.keys(pages).length > 0;
761
+ const conventions = hasConventions ? {
762
+ ...defaults.error || defaults.loading || defaults.notFound ? { defaults } : {},
763
+ ...Object.keys(pages).length > 0 ? { pages } : {}
764
+ } : undefined;
765
+ return { pageFiles, conventions };
766
+ };
767
+ var init_scanConventions = __esm(() => {
768
+ CONVENTION_RE = /^(?:(.+)\.)?(error|loading|not-found)\.[^.]+$/;
769
+ });
770
+
771
+ // src/build/scanCssEntryPoints.ts
772
+ import { existsSync as existsSync4 } from "fs";
773
+ var {Glob: Glob4 } = globalThis.Bun;
724
774
  var scanCssEntryPoints = async (dir, ignore) => {
725
- if (!existsSync3(dir))
775
+ if (!existsSync4(dir))
726
776
  return [];
727
777
  const entryPaths = [];
728
- const glob = new Glob3("**/*.css");
778
+ const glob = new Glob4("**/*.css");
729
779
  for await (const file of glob.scan({ absolute: true, cwd: dir })) {
730
780
  const normalized = normalizePath(file);
731
781
  if (ignore?.some((pattern) => normalized.includes(pattern)))
@@ -737,7 +787,7 @@ var scanCssEntryPoints = async (dir, ignore) => {
737
787
  var init_scanCssEntryPoints = () => {};
738
788
 
739
789
  // src/utils/imageProcessing.ts
740
- import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync, writeFileSync } from "fs";
790
+ import { existsSync as existsSync5, mkdirSync as mkdirSync2, readFileSync, writeFileSync } from "fs";
741
791
  import { join as join2, resolve as resolve2 } from "path";
742
792
  var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATION_ENDPOINT = "/_absolute/image", BLUR_DEVIATION = 20, sharpModule = undefined, sharpLoaded = false, sharpWarned = false, snapToSize = (target, sizes) => {
743
793
  for (const size of sizes) {
@@ -792,7 +842,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATIO
792
842
  return [...device, ...image].sort((left, right) => left - right);
793
843
  }, getCacheDir = (buildDir) => {
794
844
  const dir = join2(buildDir, ".cache", "images");
795
- if (!existsSync4(dir))
845
+ if (!existsSync5(dir))
796
846
  mkdirSync2(dir, { recursive: true });
797
847
  return dir;
798
848
  }, getCacheKey = (url, width, quality, format) => {
@@ -850,7 +900,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATIO
850
900
  }, readFromCache = (cacheDir, cacheKey) => {
851
901
  const metaPath = join2(cacheDir, `${cacheKey}.meta`);
852
902
  const dataPath = join2(cacheDir, `${cacheKey}.data`);
853
- if (!existsSync4(metaPath) || !existsSync4(dataPath))
903
+ if (!existsSync5(metaPath) || !existsSync5(dataPath))
854
904
  return null;
855
905
  try {
856
906
  const meta = JSON.parse(readFileSync(metaPath, "utf-8"));
@@ -969,12 +1019,12 @@ var init_optimizeHtmlImages = __esm(() => {
969
1019
  });
970
1020
 
971
1021
  // src/cli/scripts/telemetry.ts
972
- import { existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
1022
+ import { existsSync as existsSync6, mkdirSync as mkdirSync3, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
973
1023
  import { homedir } from "os";
974
1024
  import { join as join3 } from "path";
975
1025
  var configDir, configPath, getTelemetryConfig = () => {
976
1026
  try {
977
- if (!existsSync5(configPath))
1027
+ if (!existsSync6(configPath))
978
1028
  return null;
979
1029
  const raw = readFileSync2(configPath, "utf-8");
980
1030
  const config = JSON.parse(raw);
@@ -989,11 +1039,11 @@ var init_telemetry = __esm(() => {
989
1039
  });
990
1040
 
991
1041
  // src/cli/telemetryEvent.ts
992
- import { existsSync as existsSync6, readFileSync as readFileSync3 } from "fs";
1042
+ import { existsSync as existsSync7, readFileSync as readFileSync3 } from "fs";
993
1043
  import { arch, platform } from "os";
994
1044
  import { dirname, join as join4, parse } from "path";
995
1045
  var checkCandidate = (candidate) => {
996
- if (!existsSync6(candidate)) {
1046
+ if (!existsSync7(candidate)) {
997
1047
  return null;
998
1048
  }
999
1049
  const pkg = JSON.parse(readFileSync3(candidate, "utf-8"));
@@ -1098,17 +1148,17 @@ var init_updateAssetPaths = __esm(() => {
1098
1148
  });
1099
1149
 
1100
1150
  // src/dev/buildHMRClient.ts
1101
- import { existsSync as existsSync7 } from "fs";
1151
+ import { existsSync as existsSync8 } from "fs";
1102
1152
  import { resolve as resolve3 } from "path";
1103
1153
  var {build: bunBuild } = globalThis.Bun;
1104
1154
  var resolveHmrClientPath = () => {
1105
1155
  const projectRoot = process.cwd();
1106
1156
  const fromSource = resolve3(import.meta.dir, "client/hmrClient.ts");
1107
- if (existsSync7(fromSource) && fromSource.startsWith(projectRoot)) {
1157
+ if (existsSync8(fromSource) && fromSource.startsWith(projectRoot)) {
1108
1158
  return fromSource;
1109
1159
  }
1110
1160
  const fromNodeModules = resolve3(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client/hmrClient.ts");
1111
- if (existsSync7(fromNodeModules))
1161
+ if (existsSync8(fromNodeModules))
1112
1162
  return fromNodeModules;
1113
1163
  return resolve3(import.meta.dir, "dev/client/hmrClient.ts");
1114
1164
  }, hmrClientPath2, buildHMRClient = async () => {
@@ -1300,7 +1350,7 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
1300
1350
  };
1301
1351
 
1302
1352
  // src/build/angularLinkerPlugin.ts
1303
- import { existsSync as existsSync8, mkdirSync as mkdirSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
1353
+ import { existsSync as existsSync9, mkdirSync as mkdirSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
1304
1354
  import { dirname as dirname2, join as join5, relative as relative2, resolve as resolve5 } from "path";
1305
1355
  import { createHash } from "crypto";
1306
1356
  var CACHE_DIR, angularLinkerPlugin;
@@ -1325,7 +1375,7 @@ var init_angularLinkerPlugin = __esm(() => {
1325
1375
  }
1326
1376
  const hash = createHash("md5").update(source).digest("hex");
1327
1377
  const cachePath = join5(CACHE_DIR, `${hash}.js`);
1328
- if (existsSync8(cachePath)) {
1378
+ if (existsSync9(cachePath)) {
1329
1379
  return {
1330
1380
  contents: readFileSync4(cachePath, "utf-8"),
1331
1381
  loader: "js"
@@ -1342,7 +1392,7 @@ var init_angularLinkerPlugin = __esm(() => {
1342
1392
  linkerPlugin = mod.createEs2015LinkerPlugin({
1343
1393
  fileSystem: {
1344
1394
  dirname: dirname2,
1345
- exists: existsSync8,
1395
+ exists: existsSync9,
1346
1396
  readFile: readFileSync4,
1347
1397
  relative: relative2,
1348
1398
  resolve: resolve5
@@ -1380,10 +1430,10 @@ var init_angularLinkerPlugin = __esm(() => {
1380
1430
  // src/utils/cleanStaleOutputs.ts
1381
1431
  import { rm as rm2 } from "fs/promises";
1382
1432
  import { resolve as resolve6 } from "path";
1383
- var {Glob: Glob4 } = globalThis.Bun;
1433
+ var {Glob: Glob5 } = globalThis.Bun;
1384
1434
  var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPaths) => {
1385
1435
  const currentPaths = new Set(currentOutputPaths.map((path) => resolve6(path)));
1386
- const glob = new Glob4("**/*");
1436
+ const glob = new Glob5("**/*");
1387
1437
  const removals = [];
1388
1438
  for (const relative3 of glob.scanSync({ cwd: buildPath })) {
1389
1439
  const absolute = resolve6(buildPath, relative3);
@@ -1461,7 +1511,7 @@ var init_validateSafePath = () => {};
1461
1511
 
1462
1512
  // src/build/resolvePackageImport.ts
1463
1513
  import { resolve as resolve8, join as join7 } from "path";
1464
- import { existsSync as existsSync9, readFileSync as readFileSync5 } from "fs";
1514
+ import { existsSync as existsSync10, readFileSync as readFileSync5 } from "fs";
1465
1515
  var resolvePackageImport = (specifier) => {
1466
1516
  if (specifier.startsWith(".") || specifier.startsWith("/"))
1467
1517
  return null;
@@ -1472,7 +1522,7 @@ var resolvePackageImport = (specifier) => {
1472
1522
  const exportKey = subpath ? `./${subpath}` : ".";
1473
1523
  const packageDir = resolve8(process.cwd(), "node_modules", packageName ?? "");
1474
1524
  const packageJsonPath = join7(packageDir, "package.json");
1475
- if (!existsSync9(packageJsonPath))
1525
+ if (!existsSync10(packageJsonPath))
1476
1526
  return null;
1477
1527
  try {
1478
1528
  const packageJson = JSON.parse(readFileSync5(packageJsonPath, "utf-8"));
@@ -1486,7 +1536,7 @@ var resolvePackageImport = (specifier) => {
1486
1536
  if (!importPath)
1487
1537
  return null;
1488
1538
  const resolved = resolve8(packageDir, importPath);
1489
- return existsSync9(resolved) ? resolved : null;
1539
+ return existsSync10(resolved) ? resolved : null;
1490
1540
  } catch {
1491
1541
  return null;
1492
1542
  }
@@ -1499,12 +1549,12 @@ __export(exports_compileSvelte, {
1499
1549
  compileSvelte: () => compileSvelte,
1500
1550
  clearSvelteCompilerCache: () => clearSvelteCompilerCache
1501
1551
  });
1502
- import { existsSync as existsSync10 } from "fs";
1552
+ import { existsSync as existsSync11 } from "fs";
1503
1553
  import { mkdir, stat } from "fs/promises";
1504
1554
  import {
1505
1555
  dirname as dirname3,
1506
1556
  join as join8,
1507
- basename as basename2,
1557
+ basename as basename3,
1508
1558
  extname as extname2,
1509
1559
  resolve as resolve9,
1510
1560
  relative as relative4,
@@ -1515,11 +1565,11 @@ var {write, file, Transpiler } = globalThis.Bun;
1515
1565
  var resolveDevClientDir2 = () => {
1516
1566
  const projectRoot = process.cwd();
1517
1567
  const fromSource = resolve9(import.meta.dir, "../dev/client");
1518
- if (existsSync10(fromSource) && fromSource.startsWith(projectRoot)) {
1568
+ if (existsSync11(fromSource) && fromSource.startsWith(projectRoot)) {
1519
1569
  return fromSource;
1520
1570
  }
1521
1571
  const fromNodeModules = resolve9(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
1522
- if (existsSync10(fromNodeModules))
1572
+ if (existsSync11(fromNodeModules))
1523
1573
  return fromNodeModules;
1524
1574
  return resolve9(import.meta.dir, "./dev/client");
1525
1575
  }, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
@@ -1583,7 +1633,7 @@ var resolveDevClientDir2 = () => {
1583
1633
  const transpiled = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler.transformSync(preprocessed) : preprocessed;
1584
1634
  const rawRel = dirname3(relative4(svelteRoot, src)).replace(/\\/g, "/");
1585
1635
  const relDir = rawRel.startsWith("..") ? `_ext/${relative4(process.cwd(), dirname3(src)).replace(/\\/g, "/")}` : rawRel;
1586
- const baseName = basename2(src).replace(/\.svelte(\.(ts|js))?$/, "");
1636
+ const baseName = basename3(src).replace(/\.svelte(\.(ts|js))?$/, "");
1587
1637
  const importPaths = Array.from(transpiled.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
1588
1638
  const resolvedImports = await Promise.all(importPaths.map((importPath) => resolveSvelte(importPath, src)));
1589
1639
  const childSources = resolvedImports.filter((path) => path !== null);
@@ -1676,7 +1726,7 @@ var resolveDevClientDir2 = () => {
1676
1726
  const roots = await Promise.all(entryPoints.map(build));
1677
1727
  await Promise.all(roots.map(async ({ client }) => {
1678
1728
  const relClientDir = dirname3(relative4(clientDir, client));
1679
- const name = basename2(client, extname2(client));
1729
+ const name = basename3(client, extname2(client));
1680
1730
  const indexPath = join8(indexDir, relClientDir, `${name}.js`);
1681
1731
  const importRaw = relative4(dirname3(indexPath), client).split(sep2).join("/");
1682
1732
  const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
@@ -1722,7 +1772,7 @@ if (typeof window !== "undefined") {
1722
1772
  svelteClientPaths: roots.map(({ client }) => client),
1723
1773
  svelteIndexPaths: roots.map(({ client }) => {
1724
1774
  const rel = dirname3(relative4(clientDir, client));
1725
- return join8(indexDir, rel, basename2(client));
1775
+ return join8(indexDir, rel, basename3(client));
1726
1776
  }),
1727
1777
  svelteServerPaths: roots.map(({ ssr }) => ssr)
1728
1778
  };
@@ -1746,18 +1796,18 @@ __export(exports_compileVue, {
1746
1796
  compileVue: () => compileVue,
1747
1797
  clearVueHmrCaches: () => clearVueHmrCaches
1748
1798
  });
1749
- import { existsSync as existsSync11 } from "fs";
1799
+ import { existsSync as existsSync12 } from "fs";
1750
1800
  import { mkdir as mkdir2 } from "fs/promises";
1751
- import { basename as basename3, dirname as dirname4, join as join9, relative as relative5, resolve as resolve10 } from "path";
1801
+ import { basename as basename4, dirname as dirname4, join as join9, relative as relative5, resolve as resolve10 } from "path";
1752
1802
  var {file: file2, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
1753
1803
  var resolveDevClientDir3 = () => {
1754
1804
  const projectRoot = process.cwd();
1755
1805
  const fromSource = resolve10(import.meta.dir, "../dev/client");
1756
- if (existsSync11(fromSource) && fromSource.startsWith(projectRoot)) {
1806
+ if (existsSync12(fromSource) && fromSource.startsWith(projectRoot)) {
1757
1807
  return fromSource;
1758
1808
  }
1759
1809
  const fromNodeModules = resolve10(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
1760
- if (existsSync11(fromNodeModules))
1810
+ if (existsSync12(fromNodeModules))
1761
1811
  return fromNodeModules;
1762
1812
  return resolve10(import.meta.dir, "./dev/client");
1763
1813
  }, devClientDir3, hmrClientPath4, transpiler2, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
@@ -1827,7 +1877,7 @@ var resolveDevClientDir3 = () => {
1827
1877
  return cachedResult;
1828
1878
  const relativeFilePath = relative5(vueRootDir, sourceFilePath).replace(/\\/g, "/");
1829
1879
  const relativeWithoutExtension = relativeFilePath.replace(/\.vue$/, "");
1830
- const fileBaseName = basename3(sourceFilePath, ".vue");
1880
+ const fileBaseName = basename4(sourceFilePath, ".vue");
1831
1881
  const componentId = toKebab(fileBaseName);
1832
1882
  const sourceContent = await file2(sourceFilePath).text();
1833
1883
  const contentHash = Bun.hash(sourceContent).toString(BASE_36_RADIX);
@@ -1996,7 +2046,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
1996
2046
  server: serverOutputDir
1997
2047
  }, buildCache, true, vueRootDir, compiler);
1998
2048
  result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
1999
- const entryBaseName = basename3(entryPath, ".vue");
2049
+ const entryBaseName = basename4(entryPath, ".vue");
2000
2050
  const indexOutputFile = join9(indexOutputDir, `${entryBaseName}.js`);
2001
2051
  const clientOutputFile = join9(clientOutputDir, relative5(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
2002
2052
  await mkdir2(dirname4(indexOutputFile), { recursive: true });
@@ -110107,10 +110157,10 @@ ${lanes.join(`
110107
110157
  }
110108
110158
  function getDefaultLibFilePriority(a) {
110109
110159
  if (containsPath(defaultLibraryPath, a.fileName, false)) {
110110
- const basename4 = getBaseFileName(a.fileName);
110111
- if (basename4 === "lib.d.ts" || basename4 === "lib.es6.d.ts")
110160
+ const basename5 = getBaseFileName(a.fileName);
110161
+ if (basename5 === "lib.d.ts" || basename5 === "lib.es6.d.ts")
110112
110162
  return 0;
110113
- const name = removeSuffix(removePrefix(basename4, "lib."), ".d.ts");
110163
+ const name = removeSuffix(removePrefix(basename5, "lib."), ".d.ts");
110114
110164
  const index = libs.indexOf(name);
110115
110165
  if (index !== -1)
110116
110166
  return index + 1;
@@ -162673,8 +162723,8 @@ ${options.prefix}` : `
162673
162723
  }
162674
162724
  };
162675
162725
  for (const file3 of files) {
162676
- const basename4 = getBaseFileName(file3);
162677
- if (basename4 === "package.json" || basename4 === "bower.json") {
162726
+ const basename5 = getBaseFileName(file3);
162727
+ if (basename5 === "package.json" || basename5 === "bower.json") {
162678
162728
  createProjectWatcher(file3, "FileWatcher");
162679
162729
  continue;
162680
162730
  }
@@ -165551,8 +165601,8 @@ All files are: ${JSON.stringify(names)}`, "Err");
165551
165601
  const fileOrDirectoryPath = removeIgnoredPath(this.toPath(fileOrDirectory));
165552
165602
  if (!fileOrDirectoryPath)
165553
165603
  return;
165554
- const basename4 = getBaseFileName(fileOrDirectoryPath);
165555
- if (((_a = result.affectedModuleSpecifierCacheProjects) == null ? undefined : _a.size) && (basename4 === "package.json" || basename4 === "node_modules")) {
165604
+ const basename5 = getBaseFileName(fileOrDirectoryPath);
165605
+ if (((_a = result.affectedModuleSpecifierCacheProjects) == null ? undefined : _a.size) && (basename5 === "package.json" || basename5 === "node_modules")) {
165556
165606
  result.affectedModuleSpecifierCacheProjects.forEach((project) => {
165557
165607
  var _a2;
165558
165608
  (_a2 = project.getModuleSpecifierCache()) == null || _a2.clear();
@@ -170866,8 +170916,8 @@ __export(exports_compileAngular, {
170866
170916
  compileAngularFile: () => compileAngularFile,
170867
170917
  compileAngular: () => compileAngular
170868
170918
  });
170869
- import { existsSync as existsSync12, readFileSync as readFileSync6, promises as fs } from "fs";
170870
- import { join as join10, basename as basename4, sep as sep3, dirname as dirname5, resolve as resolve11, relative as relative6 } from "path";
170919
+ import { existsSync as existsSync13, readFileSync as readFileSync6, promises as fs } from "fs";
170920
+ import { join as join10, basename as basename5, sep as sep3, dirname as dirname5, resolve as resolve11, relative as relative6 } from "path";
170871
170921
  import { createHash as createHash2 } from "crypto";
170872
170922
  var import_typescript, computeConfigHash = () => {
170873
170923
  try {
@@ -170879,11 +170929,11 @@ var import_typescript, computeConfigHash = () => {
170879
170929
  }, resolveDevClientDir4 = () => {
170880
170930
  const projectRoot = process.cwd();
170881
170931
  const fromSource = resolve11(import.meta.dir, "../dev/client");
170882
- if (existsSync12(fromSource) && fromSource.startsWith(projectRoot)) {
170932
+ if (existsSync13(fromSource) && fromSource.startsWith(projectRoot)) {
170883
170933
  return fromSource;
170884
170934
  }
170885
170935
  const fromNodeModules = resolve11(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
170886
- if (existsSync12(fromNodeModules))
170936
+ if (existsSync13(fromNodeModules))
170887
170937
  return fromNodeModules;
170888
170938
  return resolve11(import.meta.dir, "./dev/client");
170889
170939
  }, devClientDir4, hmrClientPath5, hmrRuntimePath, injectHMRRegistration = (content, sourceId) => {
@@ -170974,7 +171024,7 @@ ${registrations}
170974
171024
  const originalGetDefaultLibFileName = host.getDefaultLibFileName;
170975
171025
  host.getDefaultLibFileName = (opts) => {
170976
171026
  const fileName = originalGetDefaultLibFileName ? originalGetDefaultLibFileName(opts) : "lib.d.ts";
170977
- return basename4(fileName);
171027
+ return basename5(fileName);
170978
171028
  };
170979
171029
  const originalGetSourceFile = host.getSourceFile;
170980
171030
  host.getSourceFile = (fileName, languageVersion, onError) => {
@@ -171025,7 +171075,7 @@ ${registrations}
171025
171075
  await Promise.all(entries.map(({ target, content }) => fs.writeFile(target, content, "utf-8")));
171026
171076
  return entries.map(({ target }) => target);
171027
171077
  }, jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), readAndEscapeFile = async (filePath) => {
171028
- if (!existsSync12(filePath))
171078
+ if (!existsSync13(filePath))
171029
171079
  return null;
171030
171080
  const content = await fs.readFile(filePath, "utf-8");
171031
171081
  return escapeTemplateContent(content);
@@ -171087,13 +171137,13 @@ ${registrations}
171087
171137
  let actualPath = resolved;
171088
171138
  if (!actualPath.endsWith(".ts"))
171089
171139
  actualPath += ".ts";
171090
- if (!existsSync12(actualPath))
171140
+ if (!existsSync13(actualPath))
171091
171141
  return;
171092
171142
  let sourceCode = await fs.readFile(actualPath, "utf-8");
171093
171143
  sourceCode = await inlineResources(sourceCode, dirname5(actualPath));
171094
171144
  const inputDir = dirname5(actualPath);
171095
171145
  const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
171096
- const fileBase = basename4(actualPath).replace(/\.ts$/, ".js");
171146
+ const fileBase = basename5(actualPath).replace(/\.ts$/, ".js");
171097
171147
  const targetDir = join10(outDir, relativeDir);
171098
171148
  const targetPath = join10(targetDir, fileBase);
171099
171149
  const importRegex = /from\s+['"](\.\.?\/[^'"]+)['"]/g;
@@ -171106,7 +171156,7 @@ ${registrations}
171106
171156
  const packageImportRewrites = new Map;
171107
171157
  const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
171108
171158
  const cacheKey2 = actualPath;
171109
- if (jitContentCache.get(cacheKey2) === contentHash && existsSync12(targetPath)) {
171159
+ if (jitContentCache.get(cacheKey2) === contentHash && existsSync13(targetPath)) {
171110
171160
  allOutputs.push(targetPath);
171111
171161
  } else {
171112
171162
  let processedContent = angularTranspiler.transformSync(sourceCode);
@@ -171150,7 +171200,7 @@ ${registrations}
171150
171200
  await fs.mkdir(indexesDir, { recursive: true });
171151
171201
  const compileTasks = entryPoints.map(async (entry) => {
171152
171202
  const outputs = hmr ? await compileAngularFileJIT(entry, compiledRoot, outRoot) : await compileAngularFile(entry, compiledRoot);
171153
- const fileBase = basename4(entry).replace(/\.[tj]s$/, "");
171203
+ const fileBase = basename5(entry).replace(/\.[tj]s$/, "");
171154
171204
  const jsName = `${fileBase}.js`;
171155
171205
  let rawServerFile = outputs.find((file3) => file3.endsWith(`${sep3}pages${sep3}${jsName}`));
171156
171206
  if (!rawServerFile) {
@@ -171164,7 +171214,7 @@ ${registrations}
171164
171214
  const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
171165
171215
  const cachedWrapper = wrapperOutputCache.get(entry);
171166
171216
  const clientFile = join10(indexesDir, jsName);
171167
- if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync12(clientFile)) {
171217
+ if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync13(clientFile)) {
171168
171218
  return { clientPath: clientFile, indexUnchanged: true, serverPath: rawServerFile };
171169
171219
  }
171170
171220
  let rewritten = original.replace(new RegExp(`templateUrl:\\s*['"]\\.\\/${fileBase}\\.html['"]`), `templateUrl: '../../pages/${fileBase}.html'`);
@@ -171563,17 +171613,62 @@ var init_rewriteImports = __esm(() => {
171563
171613
  import {
171564
171614
  copyFileSync,
171565
171615
  cpSync,
171566
- existsSync as existsSync13,
171616
+ existsSync as existsSync14,
171567
171617
  mkdirSync as mkdirSync9,
171568
171618
  readFileSync as readFileSync7,
171569
171619
  rmSync,
171570
171620
  statSync,
171571
171621
  writeFileSync as writeFileSync4
171572
171622
  } from "fs";
171573
- import { basename as basename5, join as join15, relative as relative7, resolve as resolve12 } from "path";
171623
+ import { basename as basename6, join as join15, relative as relative7, resolve as resolve12 } from "path";
171574
171624
  import { cwd, env as env2, exit } from "process";
171575
- var {build: bunBuild6, Glob: Glob5 } = globalThis.Bun;
171576
- var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental, throwOnError) => {
171625
+ var {build: bunBuild6, Glob: Glob6 } = globalThis.Bun;
171626
+ var isDev, collectConventionSourceFiles = (entry) => {
171627
+ if (!entry)
171628
+ return [];
171629
+ const files = [];
171630
+ if (entry.defaults?.error)
171631
+ files.push(entry.defaults.error);
171632
+ if (entry.defaults?.loading)
171633
+ files.push(entry.defaults.loading);
171634
+ if (entry.defaults?.notFound)
171635
+ files.push(entry.defaults.notFound);
171636
+ if (entry.pages) {
171637
+ for (const page of Object.values(entry.pages)) {
171638
+ if (page.error)
171639
+ files.push(page.error);
171640
+ if (page.loading)
171641
+ files.push(page.loading);
171642
+ }
171643
+ }
171644
+ return files;
171645
+ }, updateConventionCompiledPaths = (entry, sourcePaths, compiledPaths) => {
171646
+ if (!entry || sourcePaths.length !== compiledPaths.length)
171647
+ return;
171648
+ const pathMap = new Map;
171649
+ for (let i = 0;i < sourcePaths.length; i++) {
171650
+ const src = sourcePaths[i];
171651
+ const compiled = compiledPaths[i];
171652
+ if (src && compiled)
171653
+ pathMap.set(src, compiled);
171654
+ }
171655
+ if (entry.defaults) {
171656
+ if (entry.defaults.error && pathMap.has(entry.defaults.error))
171657
+ entry.defaults.error = pathMap.get(entry.defaults.error);
171658
+ if (entry.defaults.loading && pathMap.has(entry.defaults.loading))
171659
+ entry.defaults.loading = pathMap.get(entry.defaults.loading);
171660
+ if (entry.defaults.notFound && pathMap.has(entry.defaults.notFound))
171661
+ entry.defaults.notFound = pathMap.get(entry.defaults.notFound);
171662
+ }
171663
+ if (entry.pages) {
171664
+ for (const page of Object.values(entry.pages)) {
171665
+ if (page.error && pathMap.has(page.error))
171666
+ page.error = pathMap.get(page.error);
171667
+ if (page.loading && pathMap.has(page.loading))
171668
+ page.loading = pathMap.get(page.loading);
171669
+ }
171670
+ }
171671
+ }, extractBuildError = (logs, pass, label, frameworkNames, isIncremental, throwOnError) => {
171577
171672
  const errLog = logs.find((log2) => log2.level === "error") ?? logs[0];
171578
171673
  if (!errLog) {
171579
171674
  exit(1);
@@ -171593,7 +171688,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171593
171688
  exit(1);
171594
171689
  }, copyHtmxVendor = (htmxDir, htmxDestDir) => {
171595
171690
  mkdirSync9(htmxDestDir, { recursive: true });
171596
- const glob = new Glob5("htmx*.min.js");
171691
+ const glob = new Glob6("htmx*.min.js");
171597
171692
  for (const relPath of glob.scanSync({ cwd: htmxDir })) {
171598
171693
  const src = join15(htmxDir, relPath);
171599
171694
  const dest = join15(htmxDestDir, "htmx.min.js");
@@ -171641,7 +171736,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171641
171736
  collectWorkerPathsFromContent(content, pattern, file3, workerPaths);
171642
171737
  }
171643
171738
  }, scanWorkerReferencesInDir = async (dir, patterns, workerPaths) => {
171644
- const glob = new Glob5("**/*.{ts,tsx,js,jsx,svelte,vue}");
171739
+ const glob = new Glob6("**/*.{ts,tsx,js,jsx,svelte,vue}");
171645
171740
  for await (const file3 of glob.scan({ absolute: true, cwd: dir })) {
171646
171741
  const relToDir = file3.slice(dir.length + 1);
171647
171742
  const [firstSegment] = relToDir.split("/");
@@ -171692,9 +171787,9 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171692
171787
  const svelteIndexDir = join15(svelteDir, "generated", "indexes");
171693
171788
  const sveltePageEntries = svelteEntries.filter((file3) => resolve12(file3).startsWith(resolve12(sveltePagesPath)));
171694
171789
  for (const entry of sveltePageEntries) {
171695
- const name = basename5(entry).replace(/\.svelte(\.(ts|js))?$/, "");
171790
+ const name = basename6(entry).replace(/\.svelte(\.(ts|js))?$/, "");
171696
171791
  const indexFile = join15(svelteIndexDir, "pages", `${name}.js`);
171697
- if (!existsSync13(indexFile))
171792
+ if (!existsSync14(indexFile))
171698
171793
  continue;
171699
171794
  let content = readFileSync7(indexFile, "utf-8");
171700
171795
  const srcRel = relative7(process.cwd(), resolve12(entry)).replace(/\\/g, "/");
@@ -171705,9 +171800,9 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171705
171800
  const vueIndexDir = join15(vueDir, "generated", "indexes");
171706
171801
  const vuePageEntries = vueEntries.filter((file3) => resolve12(file3).startsWith(resolve12(vuePagesPath)));
171707
171802
  for (const entry of vuePageEntries) {
171708
- const name = basename5(entry, ".vue");
171803
+ const name = basename6(entry, ".vue");
171709
171804
  const indexFile = join15(vueIndexDir, `${name}.js`);
171710
- if (!existsSync13(indexFile))
171805
+ if (!existsSync14(indexFile))
171711
171806
  continue;
171712
171807
  let content = readFileSync7(indexFile, "utf-8");
171713
171808
  const srcRel = relative7(process.cwd(), resolve12(entry)).replace(/\\/g, "/");
@@ -171786,7 +171881,7 @@ ${content.slice(firstUseIdx)}`;
171786
171881
  const urlFileMap = new Map;
171787
171882
  for (const srcPath of urlReferencedFiles) {
171788
171883
  const rel = relative7(projectRoot, srcPath).replace(/\\/g, "/");
171789
- const name = basename5(srcPath);
171884
+ const name = basename6(srcPath);
171790
171885
  const mtime = Math.round(statSync(srcPath).mtimeMs);
171791
171886
  const url = `/@src/${rel}?v=${mtime}`;
171792
171887
  urlFileMap.set(name, url);
@@ -171796,11 +171891,11 @@ ${content.slice(firstUseIdx)}`;
171796
171891
  }, buildProdUrlFileMap = (urlReferencedFiles, buildPath, nonReactClientOutputs) => {
171797
171892
  const urlFileMap = new Map;
171798
171893
  for (const srcPath of urlReferencedFiles) {
171799
- const srcBase = basename5(srcPath).replace(/\.[^.]+$/, "");
171800
- const output = nonReactClientOutputs.find((artifact) => basename5(artifact.path).startsWith(`${srcBase}.`));
171894
+ const srcBase = basename6(srcPath).replace(/\.[^.]+$/, "");
171895
+ const output = nonReactClientOutputs.find((artifact) => basename6(artifact.path).startsWith(`${srcBase}.`));
171801
171896
  if (!output)
171802
171897
  continue;
171803
- urlFileMap.set(basename5(srcPath), `/${relative7(buildPath, output.path).replace(/\\/g, "/")}`);
171898
+ urlFileMap.set(basename6(srcPath), `/${relative7(buildPath, output.path).replace(/\\/g, "/")}`);
171804
171899
  }
171805
171900
  return urlFileMap;
171806
171901
  }, buildUrlFileMap = (urlReferencedFiles, hmr, projectRoot, buildPath, nonReactClientOutputs) => {
@@ -171813,7 +171908,7 @@ ${content.slice(firstUseIdx)}`;
171813
171908
  let content = readFileSync7(outputPath, "utf-8");
171814
171909
  let changed = false;
171815
171910
  content = content.replace(urlPattern, (_match, relPath) => {
171816
- const targetName = basename5(relPath);
171911
+ const targetName = basename6(relPath);
171817
171912
  const resolvedPath = urlFileMap.get(targetName);
171818
171913
  if (!resolvedPath)
171819
171914
  return _match;
@@ -171916,7 +172011,7 @@ ${content.slice(firstUseIdx)}`;
171916
172011
  if (!firstEntry)
171917
172012
  throw new Error("Expected at least one server directory entry");
171918
172013
  serverRoot = join15(firstEntry.dir, firstEntry.subdir);
171919
- serverOutDir = join15(buildPath, basename5(firstEntry.dir));
172014
+ serverOutDir = join15(buildPath, basename6(firstEntry.dir));
171920
172015
  } else if (serverDirMap.length > 1) {
171921
172016
  serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
171922
172017
  serverOutDir = buildPath;
@@ -171962,27 +172057,45 @@ ${content.slice(firstUseIdx)}`;
171962
172057
  await proc.exited;
171963
172058
  };
171964
172059
  const tailwindPromise = tailwind && (!isIncremental || normalizedIncrementalFiles?.some((file3) => file3.endsWith(".css"))) ? compileTailwind(tailwind.input, tailwind.output) : undefined;
172060
+ const emptyConventionResult = {
172061
+ pageFiles: [],
172062
+ conventions: undefined
172063
+ };
171965
172064
  const [
171966
172065
  ,
171967
172066
  allReactEntries,
171968
172067
  allHtmlEntries,
171969
- allSvelteEntries,
171970
- allVueEntries,
171971
- allAngularEntries,
172068
+ reactConventionResult,
172069
+ svelteConventionResult,
172070
+ vueConventionResult,
172071
+ angularConventionResult,
171972
172072
  allGlobalCssEntries
171973
172073
  ] = await Promise.all([
171974
172074
  tailwindPromise,
171975
172075
  reactIndexesPath ? scanEntryPoints(reactIndexesPath, "*.tsx") : [],
171976
172076
  htmlScriptsPath ? scanEntryPoints(htmlScriptsPath, "*.{js,ts}") : [],
171977
- sveltePagesPath ? scanEntryPoints(sveltePagesPath, "*.svelte") : [],
171978
- vuePagesPath ? scanEntryPoints(vuePagesPath, "*.vue") : [],
171979
- angularPagesPath ? scanEntryPoints(angularPagesPath, "*.ts") : [],
172077
+ reactPagesPath ? scanConventions(reactPagesPath, "*.tsx") : emptyConventionResult,
172078
+ sveltePagesPath ? scanConventions(sveltePagesPath, "*.svelte") : emptyConventionResult,
172079
+ vuePagesPath ? scanConventions(vuePagesPath, "*.vue") : emptyConventionResult,
172080
+ angularPagesPath ? scanConventions(angularPagesPath, "*.ts") : emptyConventionResult,
171980
172081
  stylesDir ? scanCssEntryPoints(stylesDir, stylesIgnore) : []
171981
172082
  ]);
172083
+ const allSvelteEntries = svelteConventionResult.pageFiles;
172084
+ const allVueEntries = vueConventionResult.pageFiles;
172085
+ const allAngularEntries = angularConventionResult.pageFiles;
172086
+ const conventionsMap = {};
172087
+ if (reactConventionResult.conventions)
172088
+ conventionsMap.react = reactConventionResult.conventions;
172089
+ if (svelteConventionResult.conventions)
172090
+ conventionsMap.svelte = svelteConventionResult.conventions;
172091
+ if (vueConventionResult.conventions)
172092
+ conventionsMap.vue = vueConventionResult.conventions;
172093
+ if (angularConventionResult.conventions)
172094
+ conventionsMap.angular = angularConventionResult.conventions;
171982
172095
  const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/html/") && (f.endsWith(".html") || f.endsWith(".css")));
171983
172096
  const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
171984
172097
  if (entry.startsWith(resolve12(reactIndexesPath))) {
171985
- const pageName = basename5(entry, ".tsx");
172098
+ const pageName = basename6(entry, ".tsx");
171986
172099
  return join15(reactPagesPath, `${pageName}.tsx`);
171987
172100
  }
171988
172101
  return null;
@@ -172018,6 +172131,16 @@ ${content.slice(firstUseIdx)}`;
172018
172131
  serverPaths: [...emptyStringArray]
172019
172132
  }
172020
172133
  ]);
172134
+ const svelteConventionSources = collectConventionSourceFiles(conventionsMap.svelte);
172135
+ const vueConventionSources = collectConventionSourceFiles(conventionsMap.vue);
172136
+ if (svelteConventionSources.length > 0 || vueConventionSources.length > 0) {
172137
+ const [svelteConvResult, vueConvResult] = await Promise.all([
172138
+ svelteConventionSources.length > 0 && svelteDir ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteConventionSources, svelteDir, new Map, false)) : { svelteServerPaths: [] },
172139
+ vueConventionSources.length > 0 && vueDir ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueConventionSources, vueDir, false)) : { vueServerPaths: [] }
172140
+ ]);
172141
+ updateConventionCompiledPaths(conventionsMap.svelte, svelteConventionSources, svelteConvResult.svelteServerPaths);
172142
+ updateConventionCompiledPaths(conventionsMap.vue, vueConventionSources, vueConvResult.vueServerPaths);
172143
+ }
172021
172144
  const serverEntryPoints = [
172022
172145
  ...svelteServerPaths,
172023
172146
  ...vueServerPaths,
@@ -172185,7 +172308,7 @@ ${content.slice(firstUseIdx)}`;
172185
172308
  globalCssEntries.length > 0 ? bunBuild6({
172186
172309
  entrypoints: globalCssEntries,
172187
172310
  naming: `[dir]/[name].[hash].[ext]`,
172188
- outdir: stylesDir ? join15(buildPath, basename5(stylesDir)) : buildPath,
172311
+ outdir: stylesDir ? join15(buildPath, basename6(stylesDir)) : buildPath,
172189
172312
  root: stylesDir || clientRoot,
172190
172313
  target: "browser",
172191
172314
  throw: false
@@ -172193,7 +172316,7 @@ ${content.slice(firstUseIdx)}`;
172193
172316
  vueCssPaths.length > 0 ? bunBuild6({
172194
172317
  entrypoints: vueCssPaths,
172195
172318
  naming: `[name].[hash].[ext]`,
172196
- outdir: join15(buildPath, assetsPath ? basename5(assetsPath) : "assets", "css"),
172319
+ outdir: join15(buildPath, assetsPath ? basename6(assetsPath) : "assets", "css"),
172197
172320
  target: "browser",
172198
172321
  throw: false
172199
172322
  }) : undefined
@@ -172272,7 +172395,7 @@ ${content.slice(firstUseIdx)}`;
172272
172395
  ], buildPath)
172273
172396
  };
172274
172397
  for (const artifact of serverOutputs) {
172275
- const fileWithHash = basename5(artifact.path);
172398
+ const fileWithHash = basename6(artifact.path);
172276
172399
  const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
172277
172400
  if (!baseName)
172278
172401
  continue;
@@ -172299,7 +172422,7 @@ ${content.slice(firstUseIdx)}`;
172299
172422
  const processHtmlPages = async () => {
172300
172423
  if (!(htmlDir && htmlPagesPath))
172301
172424
  return;
172302
- const outputHtmlPages = isSingle ? join15(buildPath, "pages") : join15(buildPath, basename5(htmlDir), "pages");
172425
+ const outputHtmlPages = isSingle ? join15(buildPath, "pages") : join15(buildPath, basename6(htmlDir), "pages");
172303
172426
  if (shouldCopyHtml) {
172304
172427
  mkdirSync9(outputHtmlPages, { recursive: true });
172305
172428
  cpSync(htmlPagesPath, outputHtmlPages, {
@@ -172315,14 +172438,14 @@ ${content.slice(firstUseIdx)}`;
172315
172438
  for (const htmlFile of htmlPageFiles) {
172316
172439
  if (hmr)
172317
172440
  injectHMRIntoHTMLFile(htmlFile, "html");
172318
- const fileName = basename5(htmlFile, ".html");
172441
+ const fileName = basename6(htmlFile, ".html");
172319
172442
  manifest[fileName] = htmlFile;
172320
172443
  }
172321
172444
  };
172322
172445
  const processHtmxPages = async () => {
172323
172446
  if (!(htmxDir && htmxPagesPath))
172324
172447
  return;
172325
- const outputHtmxPages = isSingle ? join15(buildPath, "pages") : join15(buildPath, basename5(htmxDir), "pages");
172448
+ const outputHtmxPages = isSingle ? join15(buildPath, "pages") : join15(buildPath, basename6(htmxDir), "pages");
172326
172449
  if (shouldCopyHtmx) {
172327
172450
  mkdirSync9(outputHtmxPages, { recursive: true });
172328
172451
  cpSync(htmxPagesPath, outputHtmxPages, {
@@ -172331,7 +172454,7 @@ ${content.slice(firstUseIdx)}`;
172331
172454
  });
172332
172455
  }
172333
172456
  if (shouldCopyHtmx) {
172334
- const htmxDestDir = isSingle ? buildPath : join15(buildPath, basename5(htmxDir));
172457
+ const htmxDestDir = isSingle ? buildPath : join15(buildPath, basename6(htmxDir));
172335
172458
  copyHtmxVendor(htmxDir, htmxDestDir);
172336
172459
  }
172337
172460
  if (shouldUpdateHtmxAssetPaths) {
@@ -172342,7 +172465,7 @@ ${content.slice(firstUseIdx)}`;
172342
172465
  for (const htmxFile of htmxPageFiles) {
172343
172466
  if (hmr)
172344
172467
  injectHMRIntoHTMLFile(htmxFile, "htmx");
172345
- const fileName = basename5(htmxFile, ".html");
172468
+ const fileName = basename6(htmxFile, ".html");
172346
172469
  manifest[fileName] = htmxFile;
172347
172470
  }
172348
172471
  };
@@ -172384,8 +172507,11 @@ ${content.slice(firstUseIdx)}`;
172384
172507
  });
172385
172508
  if (!isIncremental) {
172386
172509
  writeFileSync4(join15(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
172510
+ if (Object.keys(conventionsMap).length > 0) {
172511
+ writeFileSync4(join15(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
172512
+ }
172387
172513
  }
172388
- return manifest;
172514
+ return { manifest, conventions: conventionsMap };
172389
172515
  };
172390
172516
  var init_build = __esm(() => {
172391
172517
  init_constants();
@@ -172394,6 +172520,7 @@ var init_build = __esm(() => {
172394
172520
  init_htmlScriptHMRPlugin();
172395
172521
  init_outputLogs();
172396
172522
  init_scanEntryPoints();
172523
+ init_scanConventions();
172397
172524
  init_scanCssEntryPoints();
172398
172525
  init_optimizeHtmlImages();
172399
172526
  init_updateAssetPaths();
@@ -172443,8 +172570,8 @@ var init_build = __esm(() => {
172443
172570
  });
172444
172571
 
172445
172572
  // src/dev/dependencyGraph.ts
172446
- import { existsSync as existsSync14, readFileSync as readFileSync8 } from "fs";
172447
- var {Glob: Glob6 } = globalThis.Bun;
172573
+ import { existsSync as existsSync15, readFileSync as readFileSync8 } from "fs";
172574
+ var {Glob: Glob7 } = globalThis.Bun;
172448
172575
  import { resolve as resolve13 } from "path";
172449
172576
  var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
172450
172577
  const lower = filePath.toLowerCase();
@@ -172473,10 +172600,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
172473
172600
  ];
172474
172601
  for (const ext of extensions) {
172475
172602
  const withExt = normalized + ext;
172476
- if (existsSync14(withExt))
172603
+ if (existsSync15(withExt))
172477
172604
  return withExt;
172478
172605
  }
172479
- if (existsSync14(normalized))
172606
+ if (existsSync15(normalized))
172480
172607
  return normalized;
172481
172608
  return null;
172482
172609
  }, clearExistingDependents = (graph, normalizedPath) => {
@@ -172491,7 +172618,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
172491
172618
  }
172492
172619
  }, addFileToGraph = (graph, filePath) => {
172493
172620
  const normalizedPath = resolve13(filePath);
172494
- if (!existsSync14(normalizedPath))
172621
+ if (!existsSync15(normalizedPath))
172495
172622
  return;
172496
172623
  const dependencies = extractDependencies(normalizedPath);
172497
172624
  clearExistingDependents(graph, normalizedPath);
@@ -172506,8 +172633,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
172506
172633
  dependencies.forEach(addDependent);
172507
172634
  }, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
172508
172635
  const processedFiles = new Set;
172509
- const glob = new Glob6("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
172510
- const resolvedDirs = directories.map((dir) => resolve13(dir)).filter((dir) => existsSync14(dir));
172636
+ const glob = new Glob7("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
172637
+ const resolvedDirs = directories.map((dir) => resolve13(dir)).filter((dir) => existsSync15(dir));
172511
172638
  const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
172512
172639
  for (const file3 of allFiles) {
172513
172640
  const fullPath = resolve13(file3);
@@ -172898,7 +173025,7 @@ var init_pathUtils = __esm(() => {
172898
173025
 
172899
173026
  // src/dev/fileWatcher.ts
172900
173027
  import { watch } from "fs";
172901
- import { existsSync as existsSync15 } from "fs";
173028
+ import { existsSync as existsSync16 } from "fs";
172902
173029
  import { join as join16, resolve as resolve15 } from "path";
172903
173030
  var safeRemoveFromGraph = (graph, fullPath) => {
172904
173031
  try {
@@ -172930,12 +173057,12 @@ var safeRemoveFromGraph = (graph, fullPath) => {
172930
173057
  if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
172931
173058
  return;
172932
173059
  }
172933
- if (event === "rename" && !existsSync15(fullPath)) {
173060
+ if (event === "rename" && !existsSync16(fullPath)) {
172934
173061
  safeRemoveFromGraph(state.dependencyGraph, fullPath);
172935
173062
  onFileChange(fullPath);
172936
173063
  return;
172937
173064
  }
172938
- if (existsSync15(fullPath)) {
173065
+ if (existsSync16(fullPath)) {
172939
173066
  onFileChange(fullPath);
172940
173067
  safeAddToGraph(state.dependencyGraph, fullPath);
172941
173068
  }
@@ -172945,7 +173072,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
172945
173072
  const stylesDir = state.resolvedPaths?.stylesDir;
172946
173073
  paths.forEach((path) => {
172947
173074
  const absolutePath = resolve15(path).replace(/\\/g, "/");
172948
- if (!existsSync15(absolutePath)) {
173075
+ if (!existsSync16(absolutePath)) {
172949
173076
  return;
172950
173077
  }
172951
173078
  const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
@@ -172956,7 +173083,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
172956
173083
  const stylesDir = state.resolvedPaths?.stylesDir;
172957
173084
  watchPaths.forEach((path) => {
172958
173085
  const absolutePath = resolve15(path).replace(/\\/g, "/");
172959
- if (!existsSync15(absolutePath)) {
173086
+ if (!existsSync16(absolutePath)) {
172960
173087
  return;
172961
173088
  }
172962
173089
  const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
@@ -173112,7 +173239,7 @@ var classifyComponent = (filePath) => {
173112
173239
  var init_reactComponentClassifier = () => {};
173113
173240
 
173114
173241
  // src/dev/moduleMapper.ts
173115
- import { basename as basename6, resolve as resolve18 } from "path";
173242
+ import { basename as basename7, resolve as resolve18 } from "path";
173116
173243
  var buildModulePaths = (moduleKeys, manifest) => {
173117
173244
  const modulePaths = {};
173118
173245
  moduleKeys.forEach((key) => {
@@ -173159,7 +173286,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
173159
173286
  return grouped;
173160
173287
  }, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
173161
173288
  const normalizedFile = resolve18(sourceFile);
173162
- const fileName = basename6(normalizedFile);
173289
+ const fileName = basename7(normalizedFile);
173163
173290
  const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
173164
173291
  const pascalName = toPascal(baseName);
173165
173292
  const keys = [];
@@ -173387,6 +173514,165 @@ body{min-height:100vh;background:linear-gradient(135deg,rgba(15,23,42,0.98) 0%,r
173387
173514
  </html>`;
173388
173515
  };
173389
173516
 
173517
+ // src/utils/resolveConvention.ts
173518
+ import { basename as basename8 } from "path";
173519
+ var conventionsMap, setConventions = (map) => {
173520
+ conventionsMap = map;
173521
+ }, resolveErrorConventionPath = (framework, pageName) => {
173522
+ const fw = conventionsMap[framework];
173523
+ if (!fw)
173524
+ return;
173525
+ return fw.pages?.[pageName]?.error ?? fw.defaults?.error;
173526
+ }, resolveNotFoundConventionPath = (framework) => conventionsMap[framework]?.defaults?.notFound, derivePageName = (pagePath) => {
173527
+ const base = basename8(pagePath);
173528
+ const dotIndex = base.indexOf(".");
173529
+ const name = dotIndex > 0 ? base.slice(0, dotIndex) : base;
173530
+ return toPascal(name);
173531
+ }, isDev2 = () => true, buildErrorProps = (error) => {
173532
+ const message = error instanceof Error ? error.message : String(error);
173533
+ const stack = isDev2() && error instanceof Error ? error.stack : undefined;
173534
+ return { error: { message, stack } };
173535
+ }, renderConventionError = async (framework, pageName, error) => {
173536
+ const conventionPath = resolveErrorConventionPath(framework, pageName);
173537
+ if (!conventionPath)
173538
+ return null;
173539
+ const errorProps = buildErrorProps(error);
173540
+ try {
173541
+ if (framework === "react") {
173542
+ const { createElement } = await import("react");
173543
+ const { renderToReadableStream } = await import("react-dom/server");
173544
+ const mod = await import(conventionPath);
173545
+ const firstKey = Object.keys(mod)[0];
173546
+ const ErrorComponent = mod.default ?? (firstKey ? mod[firstKey] : undefined);
173547
+ const element = createElement(ErrorComponent, errorProps);
173548
+ const stream = await renderToReadableStream(element);
173549
+ return new Response(stream, {
173550
+ headers: { "Content-Type": "text/html" },
173551
+ status: 500
173552
+ });
173553
+ }
173554
+ if (framework === "svelte") {
173555
+ const { render } = await import("svelte/server");
173556
+ const mod = await import(conventionPath);
173557
+ const ErrorComponent = mod.default;
173558
+ const { head, body } = render(ErrorComponent, {
173559
+ props: errorProps
173560
+ });
173561
+ const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
173562
+ return new Response(html, {
173563
+ headers: { "Content-Type": "text/html" },
173564
+ status: 500
173565
+ });
173566
+ }
173567
+ if (framework === "vue") {
173568
+ const { createSSRApp, h } = await import("vue");
173569
+ const { renderToString } = await import("vue/server-renderer");
173570
+ const mod = await import(conventionPath);
173571
+ const ErrorComponent = mod.default;
173572
+ const app = createSSRApp({
173573
+ render: () => h(ErrorComponent, errorProps)
173574
+ });
173575
+ const body = await renderToString(app);
173576
+ const html = `<!DOCTYPE html><html><head></head><body><div id="root">${body}</div></body></html>`;
173577
+ return new Response(html, {
173578
+ headers: { "Content-Type": "text/html" },
173579
+ status: 500
173580
+ });
173581
+ }
173582
+ if (framework === "angular") {
173583
+ const mod = await import(conventionPath);
173584
+ const renderError = mod.default ?? mod.renderError;
173585
+ if (typeof renderError === "function") {
173586
+ const html = renderError(errorProps);
173587
+ return new Response(html, {
173588
+ headers: { "Content-Type": "text/html" },
173589
+ status: 500
173590
+ });
173591
+ }
173592
+ }
173593
+ } catch (renderError) {
173594
+ console.error(`[SSR] Failed to render ${framework} convention error page:`, renderError);
173595
+ }
173596
+ return null;
173597
+ }, renderConventionNotFound = async (framework) => {
173598
+ const conventionPath = resolveNotFoundConventionPath(framework);
173599
+ if (!conventionPath)
173600
+ return null;
173601
+ try {
173602
+ if (framework === "react") {
173603
+ const { createElement } = await import("react");
173604
+ const { renderToReadableStream } = await import("react-dom/server");
173605
+ const mod = await import(conventionPath);
173606
+ const nfKey = Object.keys(mod)[0];
173607
+ const NotFoundComponent = mod.default ?? (nfKey ? mod[nfKey] : undefined);
173608
+ const element = createElement(NotFoundComponent);
173609
+ const stream = await renderToReadableStream(element);
173610
+ return new Response(stream, {
173611
+ headers: { "Content-Type": "text/html" },
173612
+ status: 404
173613
+ });
173614
+ }
173615
+ if (framework === "svelte") {
173616
+ const { render } = await import("svelte/server");
173617
+ const mod = await import(conventionPath);
173618
+ const NotFoundComponent = mod.default;
173619
+ const { head, body } = render(NotFoundComponent);
173620
+ const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
173621
+ return new Response(html, {
173622
+ headers: { "Content-Type": "text/html" },
173623
+ status: 404
173624
+ });
173625
+ }
173626
+ if (framework === "vue") {
173627
+ const { createSSRApp, h } = await import("vue");
173628
+ const { renderToString } = await import("vue/server-renderer");
173629
+ const mod = await import(conventionPath);
173630
+ const NotFoundComponent = mod.default;
173631
+ const app = createSSRApp({
173632
+ render: () => h(NotFoundComponent)
173633
+ });
173634
+ const body = await renderToString(app);
173635
+ const html = `<!DOCTYPE html><html><head></head><body><div id="root">${body}</div></body></html>`;
173636
+ return new Response(html, {
173637
+ headers: { "Content-Type": "text/html" },
173638
+ status: 404
173639
+ });
173640
+ }
173641
+ if (framework === "angular") {
173642
+ const mod = await import(conventionPath);
173643
+ const renderNotFound = mod.default ?? mod.renderNotFound;
173644
+ if (typeof renderNotFound === "function") {
173645
+ const html = renderNotFound();
173646
+ return new Response(html, {
173647
+ headers: { "Content-Type": "text/html" },
173648
+ status: 404
173649
+ });
173650
+ }
173651
+ }
173652
+ } catch (renderError) {
173653
+ console.error(`[SSR] Failed to render ${framework} convention not-found page:`, renderError);
173654
+ }
173655
+ return null;
173656
+ }, NOT_FOUND_PRIORITY, renderFirstNotFound = async () => {
173657
+ for (const framework of NOT_FOUND_PRIORITY) {
173658
+ if (!conventionsMap[framework]?.defaults?.notFound)
173659
+ continue;
173660
+ const response = await renderConventionNotFound(framework);
173661
+ if (response)
173662
+ return response;
173663
+ }
173664
+ return null;
173665
+ };
173666
+ var init_resolveConvention = __esm(() => {
173667
+ conventionsMap = {};
173668
+ NOT_FOUND_PRIORITY = [
173669
+ "react",
173670
+ "svelte",
173671
+ "vue",
173672
+ "angular"
173673
+ ];
173674
+ });
173675
+
173390
173676
  // src/utils/registerClientScript.ts
173391
173677
  var scriptRegistry, requestCounter = 0, getRequestId = () => `req_${Date.now()}_${++requestCounter}`, ssrContextGetter = null, registerClientScript = (script, requestId) => {
173392
173678
  const id = requestId || ssrContextGetter?.() || Object.getOwnPropertyDescriptor(globalThis, "__absolutejs_requestId")?.value || getRequestId();
@@ -173467,7 +173753,7 @@ var init_registerClientScript = __esm(() => {
173467
173753
  });
173468
173754
 
173469
173755
  // src/angular/injectorPatch.ts
173470
- import { existsSync as existsSync16, readFileSync as readFileSync10, writeFileSync as writeFileSync5 } from "fs";
173756
+ import { existsSync as existsSync17, readFileSync as readFileSync10, writeFileSync as writeFileSync5 } from "fs";
173471
173757
  import { dirname as dirname6, join as join17, resolve as resolve19 } from "path";
173472
173758
  var applyInjectorPatch = (chunkPath, content) => {
173473
173759
  if (content.includes('Symbol.for("angular.currentInjector")')) {
@@ -173505,7 +173791,7 @@ var applyInjectorPatch = (chunkPath, content) => {
173505
173791
  writeFileSync5(chunkPath, patched, "utf-8");
173506
173792
  }, resolveAngularCoreDir = () => {
173507
173793
  const fromProject = resolve19(process.cwd(), "node_modules/@angular/core");
173508
- if (existsSync16(join17(fromProject, "package.json"))) {
173794
+ if (existsSync17(join17(fromProject, "package.json"))) {
173509
173795
  return fromProject;
173510
173796
  }
173511
173797
  return dirname6(__require.resolve("@angular/core/package.json"));
@@ -173522,11 +173808,11 @@ var init_injectorPatch = __esm(() => {
173522
173808
  });
173523
173809
 
173524
173810
  // src/angular/resolveAngularPackage.ts
173525
- import { existsSync as existsSync17 } from "fs";
173811
+ import { existsSync as existsSync18 } from "fs";
173526
173812
  import { resolve as resolve20 } from "path";
173527
173813
  var resolveAngularPackage = (specifier) => {
173528
173814
  const fromProject = resolve20(process.cwd(), "node_modules", specifier);
173529
- if (existsSync17(fromProject)) {
173815
+ if (existsSync18(fromProject)) {
173530
173816
  return fromProject;
173531
173817
  }
173532
173818
  return specifier;
@@ -173814,6 +174100,10 @@ var ssrDirty = false, lastSelector = "angular-page", invalidateAngularSsrCache =
173814
174100
  });
173815
174101
  } catch (error) {
173816
174102
  console.error("[SSR] Angular render error:", error);
174103
+ const pageName = derivePageName(pagePath);
174104
+ const conventionResponse = await renderConventionError("angular", pageName, error);
174105
+ if (conventionResponse)
174106
+ return conventionResponse;
173817
174107
  return new Response(ssrErrorPage("angular", error), {
173818
174108
  headers: { "Content-Type": "text/html" },
173819
174109
  status: 500
@@ -173823,6 +174113,7 @@ var ssrDirty = false, lastSelector = "angular-page", invalidateAngularSsrCache =
173823
174113
  };
173824
174114
  var init_pageHandler = __esm(() => {
173825
174115
  init_constants();
174116
+ init_resolveConvention();
173826
174117
  init_registerClientScript();
173827
174118
  init_angularDeps();
173828
174119
  init_ssrRender();
@@ -173863,6 +174154,10 @@ var ssrDirty2 = false, buildDirtyResponse = (index, maybeProps) => {
173863
174154
  });
173864
174155
  } catch (error) {
173865
174156
  console.error("[SSR] React render error:", error);
174157
+ const pageName = PageComponent.name || PageComponent.displayName || "";
174158
+ const conventionResponse = await renderConventionError("react", pageName, error);
174159
+ if (conventionResponse)
174160
+ return conventionResponse;
173866
174161
  return new Response(ssrErrorPage("react", error), {
173867
174162
  headers: { "Content-Type": "text/html" },
173868
174163
  status: 500
@@ -173871,7 +174166,9 @@ var ssrDirty2 = false, buildDirtyResponse = (index, maybeProps) => {
173871
174166
  }, invalidateReactSsrCache = () => {
173872
174167
  ssrDirty2 = true;
173873
174168
  };
173874
- var init_pageHandler2 = () => {};
174169
+ var init_pageHandler2 = __esm(() => {
174170
+ init_resolveConvention();
174171
+ });
173875
174172
 
173876
174173
  // src/utils/escapeScriptContent.ts
173877
174174
  var ESCAPE_LOOKUP, ESCAPE_REGEX, escapeScriptContent = (content) => content.replace(ESCAPE_REGEX, (char) => {
@@ -173967,6 +174264,10 @@ var ssrDirty3 = false, buildDirtyResponse2 = (indexPath, props) => {
173967
174264
  });
173968
174265
  } catch (error) {
173969
174266
  console.error("[SSR] Svelte render error:", error);
174267
+ const pageName = derivePageName(pagePath);
174268
+ const conventionResponse = await renderConventionError("svelte", pageName, error);
174269
+ if (conventionResponse)
174270
+ return conventionResponse;
173970
174271
  return new Response(ssrErrorPage("svelte", error), {
173971
174272
  headers: { "Content-Type": "text/html" },
173972
174273
  status: 500
@@ -173975,7 +174276,9 @@ var ssrDirty3 = false, buildDirtyResponse2 = (indexPath, props) => {
173975
174276
  }, invalidateSvelteSsrCache = () => {
173976
174277
  ssrDirty3 = true;
173977
174278
  };
173978
- var init_pageHandler3 = () => {};
174279
+ var init_pageHandler3 = __esm(() => {
174280
+ init_resolveConvention();
174281
+ });
173979
174282
 
173980
174283
  // src/vue/pageHandler.ts
173981
174284
  var ssrDirty4 = false, buildDirtyResponse3 = (headTag, indexPath, maybeProps) => {
@@ -174015,6 +174318,10 @@ var ssrDirty4 = false, buildDirtyResponse3 = (headTag, indexPath, maybeProps) =>
174015
174318
  });
174016
174319
  } catch (error) {
174017
174320
  console.error("[SSR] Vue render error:", error);
174321
+ const pageName = derivePageName(pagePath);
174322
+ const conventionResponse = await renderConventionError("vue", pageName, error);
174323
+ if (conventionResponse)
174324
+ return conventionResponse;
174018
174325
  return new Response(ssrErrorPage("vue", error), {
174019
174326
  headers: { "Content-Type": "text/html" },
174020
174327
  status: 500
@@ -174023,7 +174330,9 @@ var ssrDirty4 = false, buildDirtyResponse3 = (headTag, indexPath, maybeProps) =>
174023
174330
  }, invalidateVueSsrCache = () => {
174024
174331
  ssrDirty4 = true;
174025
174332
  };
174026
- var init_pageHandler4 = () => {};
174333
+ var init_pageHandler4 = __esm(() => {
174334
+ init_resolveConvention();
174335
+ });
174027
174336
 
174028
174337
  // src/dev/transformCache.ts
174029
174338
  var exports_transformCache = {};
@@ -174097,8 +174406,8 @@ __export(exports_moduleServer, {
174097
174406
  createModuleServer: () => createModuleServer,
174098
174407
  SRC_URL_PREFIX: () => SRC_URL_PREFIX
174099
174408
  });
174100
- import { existsSync as existsSync18, readFileSync as readFileSync11, statSync as statSync2 } from "fs";
174101
- import { basename as basename7, dirname as dirname7, extname as extname3, resolve as resolve21, relative as relative8 } from "path";
174409
+ import { existsSync as existsSync19, readFileSync as readFileSync11, statSync as statSync2 } from "fs";
174410
+ import { basename as basename9, dirname as dirname7, extname as extname3, resolve as resolve21, relative as relative8 } from "path";
174102
174411
  var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
174103
174412
  const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
174104
174413
  const allExports = [];
@@ -174118,7 +174427,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
174118
174427
  ${stubs}
174119
174428
  `;
174120
174429
  }, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
174121
- const found = extensions.find((ext) => existsSync18(resolve21(projectRoot, srcPath + ext)));
174430
+ const found = extensions.find((ext) => existsSync19(resolve21(projectRoot, srcPath + ext)));
174122
174431
  return found ? srcPath + found : srcPath;
174123
174432
  }, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
174124
174433
  const entries = Object.entries(vendorPaths).sort(([a], [b]) => b.length - a.length);
@@ -174170,7 +174479,7 @@ ${stubs}
174170
174479
  try {
174171
174480
  const resolved = Bun.resolveSync(specifier, projectRoot);
174172
174481
  const browserPath = resolved.replace(/\/index\.js$/, "/browser/index.js");
174173
- const target = existsSync18(browserPath) ? browserPath : resolved;
174482
+ const target = existsSync19(browserPath) ? browserPath : resolved;
174174
174483
  const rel = relative8(projectRoot, target);
174175
174484
  return `${prefix}/@src/${rel}${suffix}`;
174176
174485
  } catch {}
@@ -174455,7 +174764,7 @@ ${code}`;
174455
174764
  if (!vueCompiler) {
174456
174765
  vueCompiler = await import("@vue/compiler-sfc");
174457
174766
  }
174458
- const fileName = basename7(filePath, ".vue");
174767
+ const fileName = basename9(filePath, ".vue");
174459
174768
  const componentId = fileName.toLowerCase();
174460
174769
  const { descriptor } = vueCompiler.parse(raw, { filename: filePath });
174461
174770
  const compiledScript = vueCompiler.compileScript(descriptor, {
@@ -174483,11 +174792,11 @@ ${code}`;
174483
174792
  `);
174484
174793
  return result;
174485
174794
  }, resolveSvelteModulePath = (path) => {
174486
- if (existsSync18(path))
174795
+ if (existsSync19(path))
174487
174796
  return path;
174488
- if (existsSync18(`${path}.ts`))
174797
+ if (existsSync19(`${path}.ts`))
174489
174798
  return `${path}.ts`;
174490
- if (existsSync18(`${path}.js`))
174799
+ if (existsSync19(`${path}.js`))
174491
174800
  return `${path}.js`;
174492
174801
  return path;
174493
174802
  }, jsResponse = (body) => {
@@ -174632,7 +174941,7 @@ export default {};
174632
174941
  return { ext, filePath: resolveSvelteModulePath(filePath) };
174633
174942
  if (ext)
174634
174943
  return { ext, filePath };
174635
- const found = MODULE_EXTENSIONS.find((candidate) => existsSync18(filePath + candidate));
174944
+ const found = MODULE_EXTENSIONS.find((candidate) => existsSync19(filePath + candidate));
174636
174945
  if (!found)
174637
174946
  return { ext, filePath };
174638
174947
  const resolved = filePath + found;
@@ -174826,9 +175135,9 @@ var handleHTMXUpdate = async (htmxFilePath) => {
174826
175135
  var init_simpleHTMXHMR = () => {};
174827
175136
 
174828
175137
  // src/dev/rebuildTrigger.ts
174829
- import { existsSync as existsSync19 } from "fs";
175138
+ import { existsSync as existsSync20 } from "fs";
174830
175139
  import { rm as rm8 } from "fs/promises";
174831
- import { basename as basename8, relative as relative9, resolve as resolve24 } from "path";
175140
+ import { basename as basename10, relative as relative9, resolve as resolve24 } from "path";
174832
175141
  var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseErrorLocationFromMessage = (msg) => {
174833
175142
  const pathLineCol = msg.match(/^([^\s:]+):(\d+)(?::(\d+))?/);
174834
175143
  if (pathLineCol) {
@@ -174896,7 +175205,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
174896
175205
  detectedFw = detected !== "ignored" ? detected : affectedFrameworks[0];
174897
175206
  }
174898
175207
  return { ...parsed, framework: detectedFw };
174899
- }, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync19(affectedFile), collectDeletedFileAffected = (state, filePathInSet, processedFiles, validFiles) => {
175208
+ }, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync20(affectedFile), collectDeletedFileAffected = (state, filePathInSet, processedFiles, validFiles) => {
174900
175209
  state.fileHashes.delete(filePathInSet);
174901
175210
  try {
174902
175211
  const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
@@ -174914,7 +175223,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
174914
175223
  if (!dependents || dependents.size === 0) {
174915
175224
  return;
174916
175225
  }
174917
- const dependentFiles = Array.from(dependents).filter((file3) => existsSync19(file3));
175226
+ const dependentFiles = Array.from(dependents).filter((file3) => existsSync20(file3));
174918
175227
  if (dependentFiles.length === 0) {
174919
175228
  return;
174920
175229
  }
@@ -174930,7 +175239,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
174930
175239
  try {
174931
175240
  const affectedFiles = getAffectedFiles(state.dependencyGraph, normalizedFilePath);
174932
175241
  affectedFiles.forEach((affectedFile) => {
174933
- if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync19(affectedFile)) {
175242
+ if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync20(affectedFile)) {
174934
175243
  validFiles.push(affectedFile);
174935
175244
  processedFiles.add(affectedFile);
174936
175245
  }
@@ -174955,7 +175264,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
174955
175264
  collectChangedFileAffected(state, normalizedFilePath, processedFiles, validFiles);
174956
175265
  }, processFilePathSet = (state, filePathSet, processedFiles, validFiles) => {
174957
175266
  filePathSet.forEach((filePathInSet) => {
174958
- if (!existsSync19(filePathInSet)) {
175267
+ if (!existsSync20(filePathInSet)) {
174959
175268
  collectDeletedFileAffected(state, filePathInSet, processedFiles, validFiles);
174960
175269
  return;
174961
175270
  }
@@ -175063,7 +175372,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
175063
175372
  return componentFile;
175064
175373
  }
175065
175374
  const tsCounterpart = componentFile.replace(/\.html$/, ".ts");
175066
- if (existsSync19(tsCounterpart)) {
175375
+ if (existsSync20(tsCounterpart)) {
175067
175376
  return tsCounterpart;
175068
175377
  }
175069
175378
  if (!graph)
@@ -175103,7 +175412,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
175103
175412
  const { commonAncestor: commonAncestor2 } = await Promise.resolve().then(() => (init_commonAncestor(), exports_commonAncestor));
175104
175413
  return clientRoots.length === 1 ? clientRoots[0] ?? process.cwd() : commonAncestor2(clientRoots, process.cwd());
175105
175414
  }, updateServerManifestEntry = (state, artifact) => {
175106
- const fileWithHash = basename8(artifact.path);
175415
+ const fileWithHash = basename10(artifact.path);
175107
175416
  const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
175108
175417
  if (!baseName) {
175109
175418
  return;
@@ -175143,7 +175452,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
175143
175452
  await populateAssetStore(state.assetStore, clientManifest, buildDir);
175144
175453
  }, broadcastAngularPageUpdates = (state, pagesToUpdate, manifest, startTime) => {
175145
175454
  pagesToUpdate.forEach((angularPagePath) => {
175146
- const fileName = basename8(angularPagePath);
175455
+ const fileName = basename10(angularPagePath);
175147
175456
  const baseName = fileName.replace(/\.[tj]s$/, "");
175148
175457
  const pascalName = toPascal(baseName);
175149
175458
  const cssKey = `${pascalName}CSS`;
@@ -175166,7 +175475,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
175166
175475
  const { compileAngular: compileAngular2 } = await Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular));
175167
175476
  const { clientPaths, serverPaths } = await compileAngular2(pageEntries, angularDir, true);
175168
175477
  serverPaths.forEach((serverPath) => {
175169
- const fileBase = basename8(serverPath, ".js");
175478
+ const fileBase = basename10(serverPath, ".js");
175170
175479
  state.manifest[toPascal(fileBase)] = resolve24(serverPath);
175171
175480
  });
175172
175481
  if (clientPaths.length > 0) {
@@ -175198,9 +175507,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
175198
175507
  onRebuildComplete({ hmrState: state, manifest });
175199
175508
  return manifest;
175200
175509
  }, resolveReactEntryForPageFile = (normalized, pagesPathResolved, reactIndexesPath) => {
175201
- const pageName = basename8(normalized, ".tsx");
175510
+ const pageName = basename10(normalized, ".tsx");
175202
175511
  const indexPath = resolve24(reactIndexesPath, `${pageName}.tsx`);
175203
- if (!existsSync19(indexPath)) {
175512
+ if (!existsSync20(indexPath)) {
175204
175513
  return;
175205
175514
  }
175206
175515
  return indexPath;
@@ -175210,9 +175519,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
175210
175519
  if (!dep.startsWith(pagesPathResolved)) {
175211
175520
  return;
175212
175521
  }
175213
- const pageName = basename8(dep, ".tsx");
175522
+ const pageName = basename10(dep, ".tsx");
175214
175523
  const indexPath = resolve24(reactIndexesPath, `${pageName}.tsx`);
175215
- if (existsSync19(indexPath) && !reactEntries.includes(indexPath)) {
175524
+ if (existsSync20(indexPath) && !reactEntries.includes(indexPath)) {
175216
175525
  reactEntries.push(indexPath);
175217
175526
  }
175218
175527
  });
@@ -175427,7 +175736,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
175427
175736
  const serverEntries = [...svelteServerPaths];
175428
175737
  const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
175429
175738
  const serverRoot = resolve24(svelteDir, "generated", "server");
175430
- const serverOutDir = resolve24(buildDir, basename8(svelteDir));
175739
+ const serverOutDir = resolve24(buildDir, basename10(svelteDir));
175431
175740
  const [serverResult, clientResult] = await Promise.all([
175432
175741
  serverEntries.length > 0 ? bunBuild7({
175433
175742
  entrypoints: serverEntries,
@@ -175460,7 +175769,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
175460
175769
  const duration = Date.now() - startTime;
175461
175770
  const broadcastFiles = svelteFiles.length > 0 ? svelteFiles : filesToRebuild;
175462
175771
  broadcastFiles.forEach((sveltePagePath) => {
175463
- const fileName = basename8(sveltePagePath);
175772
+ const fileName = basename10(sveltePagePath);
175464
175773
  const baseName = fileName.replace(/\.svelte$/, "");
175465
175774
  const pascalName = toPascal(baseName);
175466
175775
  const cssKey = `${pascalName}CSS`;
@@ -175588,7 +175897,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
175588
175897
  });
175589
175898
  }
175590
175899
  }, handleScriptUpdate = (state, scriptFile, manifest, framework, duration) => {
175591
- const scriptBaseName = basename8(scriptFile).replace(/\.(ts|js|tsx|jsx)$/, "");
175900
+ const scriptBaseName = basename10(scriptFile).replace(/\.(ts|js|tsx|jsx)$/, "");
175592
175901
  const pascalName = toPascal(scriptBaseName);
175593
175902
  const scriptPath = manifest[pascalName] || null;
175594
175903
  if (!scriptPath) {
@@ -175626,7 +175935,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
175626
175935
  if (isSingle) {
175627
175936
  return resolve24(state.resolvedPaths.buildDir, "pages");
175628
175937
  }
175629
- const dirName = framework === "html" ? basename8(config.htmlDirectory ?? "html") : basename8(config.htmxDirectory ?? "htmx");
175938
+ const dirName = framework === "html" ? basename10(config.htmlDirectory ?? "html") : basename10(config.htmxDirectory ?? "htmx");
175630
175939
  return resolve24(state.resolvedPaths.buildDir, dirName, "pages");
175631
175940
  }, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
175632
175941
  try {
@@ -175662,7 +175971,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
175662
175971
  const htmlPageFiles = htmlFrameworkFiles.filter((file3) => file3.endsWith(".html"));
175663
175972
  const outputHtmlPages = computeOutputPagesDir(state, config, "html");
175664
175973
  for (const pageFile of htmlPageFiles) {
175665
- const htmlPageName = basename8(pageFile);
175974
+ const htmlPageName = basename10(pageFile);
175666
175975
  const builtHtmlPagePath = resolve24(outputHtmlPages, htmlPageName);
175667
175976
  await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
175668
175977
  }
@@ -175671,7 +175980,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
175671
175980
  if (!cssFile) {
175672
175981
  return;
175673
175982
  }
175674
- const cssBaseName = basename8(cssFile, ".css");
175983
+ const cssBaseName = basename10(cssFile, ".css");
175675
175984
  const cssPascalName = toPascal(cssBaseName);
175676
175985
  const cssKey = `${cssPascalName}CSS`;
175677
175986
  const cssUrl = manifest[cssKey] || null;
@@ -175720,7 +176029,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
175720
176029
  type: "vue-update"
175721
176030
  });
175722
176031
  }, broadcastVuePageChange = async (state, config, vuePagePath, manifest, duration) => {
175723
- const fileName = basename8(vuePagePath);
176032
+ const fileName = basename10(vuePagePath);
175724
176033
  const baseName = fileName.replace(/\.vue$/, "");
175725
176034
  const pascalName = toPascal(baseName);
175726
176035
  const vueRoot = config.vueDirectory;
@@ -175768,7 +176077,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
175768
176077
  if (!cssFile) {
175769
176078
  return;
175770
176079
  }
175771
- const cssBaseName = basename8(cssFile, ".css");
176080
+ const cssBaseName = basename10(cssFile, ".css");
175772
176081
  const cssPascalName = toPascal(cssBaseName);
175773
176082
  const cssKey = `${cssPascalName}CSS`;
175774
176083
  const cssUrl = manifest[cssKey] || null;
@@ -175786,7 +176095,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
175786
176095
  });
175787
176096
  }, broadcastSveltePageUpdate = (state, sveltePagePath, manifest, duration) => {
175788
176097
  try {
175789
- const fileName = basename8(sveltePagePath);
176098
+ const fileName = basename10(sveltePagePath);
175790
176099
  const baseName = fileName.replace(/\.svelte$/, "");
175791
176100
  const pascalName = toPascal(baseName);
175792
176101
  const cssKey = `${pascalName}CSS`;
@@ -175848,7 +176157,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
175848
176157
  if (!cssFile) {
175849
176158
  return;
175850
176159
  }
175851
- const cssBaseName = basename8(cssFile, ".css");
176160
+ const cssBaseName = basename10(cssFile, ".css");
175852
176161
  const cssPascalName = toPascal(cssBaseName);
175853
176162
  const cssKey = `${cssPascalName}CSS`;
175854
176163
  const cssUrl = manifest[cssKey] || null;
@@ -175866,7 +176175,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
175866
176175
  });
175867
176176
  }, broadcastAngularPageHmrUpdate = (state, angularPagePath, manifest, duration) => {
175868
176177
  try {
175869
- const fileName = basename8(angularPagePath);
176178
+ const fileName = basename10(angularPagePath);
175870
176179
  const baseName = fileName.replace(/\.[tj]s$/, "");
175871
176180
  const pascalName = toPascal(baseName);
175872
176181
  const cssKey = `${pascalName}CSS`;
@@ -175961,7 +176270,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
175961
176270
  const htmxPageFiles = htmxFrameworkFiles.filter((file3) => file3.endsWith(".html"));
175962
176271
  const outputHtmxPages = computeOutputPagesDir(state, config, "htmx");
175963
176272
  for (const htmxPageFile of htmxPageFiles) {
175964
- const htmxPageName = basename8(htmxPageFile);
176273
+ const htmxPageName = basename10(htmxPageFile);
175965
176274
  const builtHtmxPagePath = resolve24(outputHtmxPages, htmxPageName);
175966
176275
  await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
175967
176276
  }
@@ -176071,7 +176380,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
176071
176380
  html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
176072
176381
  writeFs(destPath, html);
176073
176382
  }, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
176074
- const destPath = resolve24(outputDir, basename8(sourceFile));
176383
+ const destPath = resolve24(outputDir, basename10(sourceFile));
176075
176384
  const hmrScript = extractHmrScript(destPath, readFs);
176076
176385
  const source = await Bun.file(sourceFile).text();
176077
176386
  await Bun.write(destPath, source);
@@ -176176,10 +176485,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
176176
176485
  throwOnError: true
176177
176486
  }
176178
176487
  };
176179
- const manifest = await build(buildConfig);
176180
- if (!manifest) {
176488
+ const buildResult = await build(buildConfig);
176489
+ if (!buildResult?.manifest) {
176181
176490
  throw new Error("Build failed - no manifest generated");
176182
176491
  }
176492
+ const manifest = buildResult.manifest;
176183
176493
  const duration = Date.now() - startTime;
176184
176494
  sendTelemetryEvent("hmr:rebuild-complete", {
176185
176495
  durationMs: duration,
@@ -176299,7 +176609,7 @@ __export(exports_buildDepVendor, {
176299
176609
  import { mkdirSync as mkdirSync10 } from "fs";
176300
176610
  import { join as join18 } from "path";
176301
176611
  import { rm as rm9 } from "fs/promises";
176302
- var {build: bunBuild7, Glob: Glob7 } = globalThis.Bun;
176612
+ var {build: bunBuild7, Glob: Glob8 } = globalThis.Bun;
176303
176613
  var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g, "").replace(/-/g, "_"), isResolvable3 = (specifier) => {
176304
176614
  try {
176305
176615
  __require.resolve(specifier);
@@ -176317,7 +176627,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
176317
176627
  }
176318
176628
  }, scanDirFiles = async (dir) => {
176319
176629
  const empty = [];
176320
- const glob = new Glob7("**/*.{ts,tsx,js,jsx}");
176630
+ const glob = new Glob8("**/*.{ts,tsx,js,jsx}");
176321
176631
  try {
176322
176632
  const all = await Array.fromAsync(glob.scan({ absolute: true, cwd: dir }));
176323
176633
  return all.filter((file3) => !isSkippedFile(file3));
@@ -176503,7 +176813,7 @@ var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
176503
176813
  await waitForRebuild(state);
176504
176814
  state.isRebuilding = true;
176505
176815
  try {
176506
- const newManifest = await build({
176816
+ const buildResult = await build({
176507
176817
  ...state.config,
176508
176818
  mode: "development",
176509
176819
  options: {
@@ -176512,8 +176822,9 @@ var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
176512
176822
  throwOnError: true
176513
176823
  }
176514
176824
  });
176515
- if (!newManifest)
176825
+ if (!buildResult?.manifest)
176516
176826
  return;
176827
+ const newManifest = buildResult.manifest;
176517
176828
  removeStaleKeys(cached.manifest, newManifest);
176518
176829
  Object.assign(cached.manifest, newManifest);
176519
176830
  state.manifest = cached.manifest;
@@ -176599,7 +176910,7 @@ var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
176599
176910
  }
176600
176911
  await resolveAbsoluteVersion2();
176601
176912
  const buildStart = performance.now();
176602
- const manifest = await build({
176913
+ const buildResult = await build({
176603
176914
  ...config,
176604
176915
  mode: "development",
176605
176916
  options: {
@@ -176607,11 +176918,13 @@ var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
176607
176918
  injectHMR: true
176608
176919
  }
176609
176920
  });
176610
- if (!manifest || Object.keys(manifest).length === 0) {
176921
+ const manifest = buildResult.manifest ?? {};
176922
+ const conventions = buildResult.conventions ?? {};
176923
+ if (Object.keys(manifest).length === 0) {
176611
176924
  console.log("\u26A0\uFE0F Manifest is empty - this is OK for HTML/HTMX-only projects");
176612
176925
  }
176613
- await populateAssetStore(state.assetStore, manifest ?? {}, state.resolvedPaths.buildDir);
176614
- cleanStaleAssets(state.assetStore, manifest ?? {}, state.resolvedPaths.buildDir);
176926
+ await populateAssetStore(state.assetStore, manifest, state.resolvedPaths.buildDir);
176927
+ cleanStaleAssets(state.assetStore, manifest, state.resolvedPaths.buildDir);
176615
176928
  const buildReactVendorTask = config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir).then(async () => {
176616
176929
  const vendorDir = resolve25(state.resolvedPaths.buildDir, "react", "vendor");
176617
176930
  await loadVendorFiles(state.assetStore, vendorDir, "react");
@@ -176672,7 +176985,8 @@ var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
176672
176985
  globalThis.__hmrBuildDuration = performance.now() - buildStart;
176673
176986
  const result = {
176674
176987
  hmrState: state,
176675
- manifest
176988
+ manifest,
176989
+ conventions
176676
176990
  };
176677
176991
  globalThis.__hmrDevResult = result;
176678
176992
  globalThis.__hmrServerMtime = statSync3(resolve25(Bun.main)).mtimeMs;
@@ -176710,5 +177024,5 @@ export {
176710
177024
  build
176711
177025
  };
176712
177026
 
176713
- //# debugId=B5B95DBA2BB208B564756E2164756E21
177027
+ //# debugId=2B46E23BF817F40764756E2164756E21
176714
177028
  //# sourceMappingURL=build.js.map