@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/index.js CHANGED
@@ -151,6 +151,173 @@ body{min-height:100vh;background:linear-gradient(135deg,rgba(15,23,42,0.98) 0%,r
151
151
  </html>`;
152
152
  };
153
153
 
154
+ // src/utils/stringModifiers.ts
155
+ var normalizeSlug = (str) => str.trim().replace(/\s+/g, "-").replace(/[^A-Za-z0-9\-_]+/g, "").replace(/[-_]{2,}/g, "-"), toKebab = (str) => normalizeSlug(str).replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), toPascal = (str) => {
156
+ if (!str.includes("-") && !str.includes("_")) {
157
+ return str.charAt(0).toUpperCase() + str.slice(1);
158
+ }
159
+ return normalizeSlug(str).split(/[-_]/).filter(Boolean).map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1).toLowerCase()).join("");
160
+ }, toScreamingSnake = (str) => str.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toUpperCase();
161
+
162
+ // src/utils/resolveConvention.ts
163
+ import { basename } from "path";
164
+ var conventionsMap, setConventions = (map) => {
165
+ conventionsMap = map;
166
+ }, resolveErrorConventionPath = (framework, pageName) => {
167
+ const fw = conventionsMap[framework];
168
+ if (!fw)
169
+ return;
170
+ return fw.pages?.[pageName]?.error ?? fw.defaults?.error;
171
+ }, resolveNotFoundConventionPath = (framework) => conventionsMap[framework]?.defaults?.notFound, derivePageName = (pagePath) => {
172
+ const base = basename(pagePath);
173
+ const dotIndex = base.indexOf(".");
174
+ const name = dotIndex > 0 ? base.slice(0, dotIndex) : base;
175
+ return toPascal(name);
176
+ }, isDev = () => true, buildErrorProps = (error) => {
177
+ const message = error instanceof Error ? error.message : String(error);
178
+ const stack = isDev() && error instanceof Error ? error.stack : undefined;
179
+ return { error: { message, stack } };
180
+ }, renderConventionError = async (framework, pageName, error) => {
181
+ const conventionPath = resolveErrorConventionPath(framework, pageName);
182
+ if (!conventionPath)
183
+ return null;
184
+ const errorProps = buildErrorProps(error);
185
+ try {
186
+ if (framework === "react") {
187
+ const { createElement } = await import("react");
188
+ const { renderToReadableStream } = await import("react-dom/server");
189
+ const mod = await import(conventionPath);
190
+ const firstKey = Object.keys(mod)[0];
191
+ const ErrorComponent = mod.default ?? (firstKey ? mod[firstKey] : undefined);
192
+ const element = createElement(ErrorComponent, errorProps);
193
+ const stream = await renderToReadableStream(element);
194
+ return new Response(stream, {
195
+ headers: { "Content-Type": "text/html" },
196
+ status: 500
197
+ });
198
+ }
199
+ if (framework === "svelte") {
200
+ const { render } = await import("svelte/server");
201
+ const mod = await import(conventionPath);
202
+ const ErrorComponent = mod.default;
203
+ const { head, body } = render(ErrorComponent, {
204
+ props: errorProps
205
+ });
206
+ const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
207
+ return new Response(html, {
208
+ headers: { "Content-Type": "text/html" },
209
+ status: 500
210
+ });
211
+ }
212
+ if (framework === "vue") {
213
+ const { createSSRApp, h } = await import("vue");
214
+ const { renderToString } = await import("vue/server-renderer");
215
+ const mod = await import(conventionPath);
216
+ const ErrorComponent = mod.default;
217
+ const app = createSSRApp({
218
+ render: () => h(ErrorComponent, errorProps)
219
+ });
220
+ const body = await renderToString(app);
221
+ const html = `<!DOCTYPE html><html><head></head><body><div id="root">${body}</div></body></html>`;
222
+ return new Response(html, {
223
+ headers: { "Content-Type": "text/html" },
224
+ status: 500
225
+ });
226
+ }
227
+ if (framework === "angular") {
228
+ const mod = await import(conventionPath);
229
+ const renderError = mod.default ?? mod.renderError;
230
+ if (typeof renderError === "function") {
231
+ const html = renderError(errorProps);
232
+ return new Response(html, {
233
+ headers: { "Content-Type": "text/html" },
234
+ status: 500
235
+ });
236
+ }
237
+ }
238
+ } catch (renderError) {
239
+ console.error(`[SSR] Failed to render ${framework} convention error page:`, renderError);
240
+ }
241
+ return null;
242
+ }, renderConventionNotFound = async (framework) => {
243
+ const conventionPath = resolveNotFoundConventionPath(framework);
244
+ if (!conventionPath)
245
+ return null;
246
+ try {
247
+ if (framework === "react") {
248
+ const { createElement } = await import("react");
249
+ const { renderToReadableStream } = await import("react-dom/server");
250
+ const mod = await import(conventionPath);
251
+ const nfKey = Object.keys(mod)[0];
252
+ const NotFoundComponent = mod.default ?? (nfKey ? mod[nfKey] : undefined);
253
+ const element = createElement(NotFoundComponent);
254
+ const stream = await renderToReadableStream(element);
255
+ return new Response(stream, {
256
+ headers: { "Content-Type": "text/html" },
257
+ status: 404
258
+ });
259
+ }
260
+ if (framework === "svelte") {
261
+ const { render } = await import("svelte/server");
262
+ const mod = await import(conventionPath);
263
+ const NotFoundComponent = mod.default;
264
+ const { head, body } = render(NotFoundComponent);
265
+ const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
266
+ return new Response(html, {
267
+ headers: { "Content-Type": "text/html" },
268
+ status: 404
269
+ });
270
+ }
271
+ if (framework === "vue") {
272
+ const { createSSRApp, h } = await import("vue");
273
+ const { renderToString } = await import("vue/server-renderer");
274
+ const mod = await import(conventionPath);
275
+ const NotFoundComponent = mod.default;
276
+ const app = createSSRApp({
277
+ render: () => h(NotFoundComponent)
278
+ });
279
+ const body = await renderToString(app);
280
+ const html = `<!DOCTYPE html><html><head></head><body><div id="root">${body}</div></body></html>`;
281
+ return new Response(html, {
282
+ headers: { "Content-Type": "text/html" },
283
+ status: 404
284
+ });
285
+ }
286
+ if (framework === "angular") {
287
+ const mod = await import(conventionPath);
288
+ const renderNotFound = mod.default ?? mod.renderNotFound;
289
+ if (typeof renderNotFound === "function") {
290
+ const html = renderNotFound();
291
+ return new Response(html, {
292
+ headers: { "Content-Type": "text/html" },
293
+ status: 404
294
+ });
295
+ }
296
+ }
297
+ } catch (renderError) {
298
+ console.error(`[SSR] Failed to render ${framework} convention not-found page:`, renderError);
299
+ }
300
+ return null;
301
+ }, NOT_FOUND_PRIORITY, renderFirstNotFound = async () => {
302
+ for (const framework of NOT_FOUND_PRIORITY) {
303
+ if (!conventionsMap[framework]?.defaults?.notFound)
304
+ continue;
305
+ const response = await renderConventionNotFound(framework);
306
+ if (response)
307
+ return response;
308
+ }
309
+ return null;
310
+ };
311
+ var init_resolveConvention = __esm(() => {
312
+ conventionsMap = {};
313
+ NOT_FOUND_PRIORITY = [
314
+ "react",
315
+ "svelte",
316
+ "vue",
317
+ "angular"
318
+ ];
319
+ });
320
+
154
321
  // src/react/pageHandler.ts
155
322
  var ssrDirty = false, buildDirtyResponse = (index, maybeProps) => {
156
323
  const propsScript = maybeProps ? `window.__INITIAL_PROPS__=${JSON.stringify(maybeProps)};` : "";
@@ -184,6 +351,10 @@ var ssrDirty = false, buildDirtyResponse = (index, maybeProps) => {
184
351
  });
185
352
  } catch (error) {
186
353
  console.error("[SSR] React render error:", error);
354
+ const pageName = PageComponent.name || PageComponent.displayName || "";
355
+ const conventionResponse = await renderConventionError("react", pageName, error);
356
+ if (conventionResponse)
357
+ return conventionResponse;
187
358
  return new Response(ssrErrorPage("react", error), {
188
359
  headers: { "Content-Type": "text/html" },
189
360
  status: 500
@@ -192,7 +363,9 @@ var ssrDirty = false, buildDirtyResponse = (index, maybeProps) => {
192
363
  }, invalidateReactSsrCache = () => {
193
364
  ssrDirty = true;
194
365
  };
195
- var init_pageHandler = () => {};
366
+ var init_pageHandler = __esm(() => {
367
+ init_resolveConvention();
368
+ });
196
369
 
197
370
  // src/utils/getDurationString.ts
198
371
  var getDurationString = (duration) => {
@@ -337,14 +510,6 @@ var init_logger = __esm(() => {
337
510
  // src/utils/normalizePath.ts
338
511
  var normalizePath = (path) => path.replace(/\\/g, "/");
339
512
 
340
- // src/utils/stringModifiers.ts
341
- var normalizeSlug = (str) => str.trim().replace(/\s+/g, "-").replace(/[^A-Za-z0-9\-_]+/g, "").replace(/[-_]{2,}/g, "-"), toKebab = (str) => normalizeSlug(str).replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), toPascal = (str) => {
342
- if (!str.includes("-") && !str.includes("_")) {
343
- return str.charAt(0).toUpperCase() + str.slice(1);
344
- }
345
- return normalizeSlug(str).split(/[-_]/).filter(Boolean).map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1).toLowerCase()).join("");
346
- }, toScreamingSnake = (str) => str.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toUpperCase();
347
-
348
513
  // src/build/generateManifest.ts
349
514
  var exports_generateManifest = {};
350
515
  __export(exports_generateManifest, {
@@ -422,7 +587,7 @@ __export(exports_generateReactIndexes, {
422
587
  });
423
588
  import { existsSync, mkdirSync } from "fs";
424
589
  import { readdir, rm, writeFile } from "fs/promises";
425
- import { basename, join, relative, resolve as resolve2, sep } from "path";
590
+ import { basename as basename2, join, relative, resolve as resolve2, sep } from "path";
426
591
  var {Glob } = globalThis.Bun;
427
592
  var indexContentCache, resolveDevClientDir = () => {
428
593
  const projectRoot = process.cwd();
@@ -434,16 +599,19 @@ var indexContentCache, resolveDevClientDir = () => {
434
599
  if (existsSync(fromNodeModules))
435
600
  return fromNodeModules;
436
601
  return resolve2(import.meta.dir, "./dev/client");
437
- }, devClientDir, errorOverlayPath, hmrClientPath, refreshSetupPath, generateReactIndexFiles = async (reactPagesDirectory, reactIndexesDirectory, isDev = false) => {
602
+ }, devClientDir, errorOverlayPath, hmrClientPath, refreshSetupPath, generateReactIndexFiles = async (reactPagesDirectory, reactIndexesDirectory, isDev2 = false) => {
438
603
  if (!existsSync(reactIndexesDirectory)) {
439
604
  mkdirSync(reactIndexesDirectory, { recursive: true });
440
605
  }
606
+ const CONVENTION_RE = /^(?:(.+)\.)?(error|loading|not-found)\.[^.]+$/;
441
607
  const pagesGlob = new Glob("*.*");
442
608
  const files = [];
443
609
  for await (const file2 of pagesGlob.scan({ cwd: reactPagesDirectory })) {
610
+ if (CONVENTION_RE.test(file2))
611
+ continue;
444
612
  files.push(file2);
445
613
  }
446
- const currentPageNames = new Set(files.map((file2) => basename(file2).split(".")[0]));
614
+ const currentPageNames = new Set(files.map((file2) => basename2(file2).split(".")[0]));
447
615
  const emptyStringArray = [];
448
616
  const existingIndexes = await readdir(reactIndexesDirectory).catch(() => emptyStringArray);
449
617
  const staleIndexes = existingIndexes.filter((indexFile) => {
@@ -460,9 +628,9 @@ var indexContentCache, resolveDevClientDir = () => {
460
628
  }
461
629
  const pagesRelPath = relative(resolve2(reactIndexesDirectory), resolve2(reactPagesDirectory)).split(sep).join("/");
462
630
  const promises = files.map(async (file2) => {
463
- const fileName = basename(file2);
631
+ const fileName = basename2(file2);
464
632
  const [componentName] = fileName.split(".");
465
- const hmrPreamble = isDev ? [
633
+ const hmrPreamble = isDev2 ? [
466
634
  `window.__HMR_FRAMEWORK__ = "react";`,
467
635
  `window.__REACT_COMPONENT_KEY__ = "${componentName}Index";`,
468
636
  `import '${refreshSetupPath}';`,
@@ -470,14 +638,14 @@ var indexContentCache, resolveDevClientDir = () => {
470
638
  `import { showErrorOverlay, hideErrorOverlay } from '${errorOverlayPath}';
471
639
  `
472
640
  ] : [];
473
- const reactImports = isDev ? [
641
+ const reactImports = isDev2 ? [
474
642
  `import { hydrateRoot, createRoot } from 'react-dom/client';`,
475
643
  `import { createElement, Component } from 'react';`
476
644
  ] : [
477
645
  `import { hydrateRoot, createRoot } from 'react-dom/client';`,
478
646
  `import { createElement } from 'react';`
479
647
  ];
480
- const errorBoundaryDef = isDev ? [
648
+ const errorBoundaryDef = isDev2 ? [
481
649
  `
482
650
  // Dev-only Error Boundary to catch React render errors`,
483
651
  `class ErrorBoundary extends Component {`,
@@ -530,7 +698,7 @@ var indexContentCache, resolveDevClientDir = () => {
530
698
  `,
531
699
  ...errorBoundaryDef,
532
700
  `// Hydration with error handling and fallback`,
533
- `const isDev = ${isDev};`,
701
+ `const isDev = ${isDev2};`,
534
702
  `const componentPath = '${pagesRelPath}/${componentName}';
535
703
  `,
536
704
  `function isHydrationError(error) {`,
@@ -603,7 +771,7 @@ var indexContentCache, resolveDevClientDir = () => {
603
771
  `,
604
772
  ` // Render into the same root container when falling back to client-only`,
605
773
  ` const root = createRoot(container);`,
606
- ` root.render(${isDev ? `createElement(ErrorBoundary, null, createElement(${componentName}, mergedProps))` : `createElement(${componentName}, mergedProps)`});`,
774
+ ` root.render(${isDev2 ? `createElement(ErrorBoundary, null, createElement(${componentName}, mergedProps))` : `createElement(${componentName}, mergedProps)`});`,
607
775
  ` window.__REACT_ROOT__ = root;`,
608
776
  ` window.__HMR_CLIENT_ONLY_MODE__ = true;`,
609
777
  ` } catch (fallbackError) {`,
@@ -648,14 +816,14 @@ var indexContentCache, resolveDevClientDir = () => {
648
816
  ` // After HMR, SSR is skipped to avoid stale content flash \u2014 render client-only`,
649
817
  ` if (window.__SSR_DIRTY__) {`,
650
818
  ` root = createRoot(container);`,
651
- ` root.render(${isDev ? `createElement(ErrorBoundary, null, createElement(${componentName}, mergedProps))` : `createElement(${componentName}, mergedProps)`});`,
819
+ ` root.render(${isDev2 ? `createElement(ErrorBoundary, null, createElement(${componentName}, mergedProps))` : `createElement(${componentName}, mergedProps)`});`,
652
820
  ` window.__REACT_ROOT__ = root;`,
653
821
  ` } else {`,
654
822
  ` try {`,
655
823
  ` // Use onRecoverableError to catch hydration errors (React 19)`,
656
824
  ` root = hydrateRoot(`,
657
825
  ` container,`,
658
- ` ${isDev ? `createElement(ErrorBoundary, null, createElement(${componentName}, mergedProps))` : `createElement(${componentName}, mergedProps)`},`,
826
+ ` ${isDev2 ? `createElement(ErrorBoundary, null, createElement(${componentName}, mergedProps))` : `createElement(${componentName}, mergedProps)`},`,
659
827
  ` {`,
660
828
  ` onRecoverableError: (error) => {`,
661
829
  ` // Check if this is a hydration error (isHydrationError filters out whitespace-only head mismatches)`,
@@ -725,7 +893,7 @@ var indexContentCache, resolveDevClientDir = () => {
725
893
  ` };`,
726
894
  ` }`,
727
895
  `}`,
728
- ...isDev ? [
896
+ ...isDev2 ? [
729
897
  `
730
898
  // Pre-warm: import the page module from the module server`,
731
899
  `// immediately so the browser caches all /@src/ URLs.`,
@@ -744,7 +912,7 @@ var indexContentCache, resolveDevClientDir = () => {
744
912
  await writeFile(indexPath, content);
745
913
  });
746
914
  await Promise.all(promises);
747
- if (!isDev) {
915
+ if (!isDev2) {
748
916
  return;
749
917
  }
750
918
  const refreshPath = join(reactIndexesDirectory, "_refresh.tsx");
@@ -840,14 +1008,61 @@ var scanEntryPoints = async (dir, pattern) => {
840
1008
  };
841
1009
  var init_scanEntryPoints = () => {};
842
1010
 
843
- // src/build/scanCssEntryPoints.ts
844
- import { existsSync as existsSync3 } from "fs";
1011
+ // src/build/scanConventions.ts
1012
+ import { basename as basename3 } from "path";
845
1013
  var {Glob: Glob3 } = globalThis.Bun;
1014
+ import { existsSync as existsSync3 } from "fs";
1015
+ var CONVENTION_RE, scanConventions = async (pagesDir, pattern) => {
1016
+ if (!existsSync3(pagesDir)) {
1017
+ return { pageFiles: [], conventions: undefined };
1018
+ }
1019
+ const pageFiles = [];
1020
+ const defaults = {};
1021
+ const pages = {};
1022
+ const glob = new Glob3(pattern);
1023
+ for await (const file2 of glob.scan({ absolute: true, cwd: pagesDir })) {
1024
+ const fileName = basename3(file2);
1025
+ const match = CONVENTION_RE.exec(fileName);
1026
+ if (!match) {
1027
+ pageFiles.push(file2);
1028
+ continue;
1029
+ }
1030
+ const [, pageName, kind] = match;
1031
+ if (pageName) {
1032
+ if (!pages[pageName])
1033
+ pages[pageName] = {};
1034
+ if (kind === "error")
1035
+ pages[pageName].error = file2;
1036
+ else if (kind === "loading")
1037
+ pages[pageName].loading = file2;
1038
+ } else {
1039
+ if (kind === "error")
1040
+ defaults.error = file2;
1041
+ else if (kind === "loading")
1042
+ defaults.loading = file2;
1043
+ else if (kind === "not-found")
1044
+ defaults.notFound = file2;
1045
+ }
1046
+ }
1047
+ const hasConventions = defaults.error !== undefined || defaults.loading !== undefined || defaults.notFound !== undefined || Object.keys(pages).length > 0;
1048
+ const conventions2 = hasConventions ? {
1049
+ ...defaults.error || defaults.loading || defaults.notFound ? { defaults } : {},
1050
+ ...Object.keys(pages).length > 0 ? { pages } : {}
1051
+ } : undefined;
1052
+ return { pageFiles, conventions: conventions2 };
1053
+ };
1054
+ var init_scanConventions = __esm(() => {
1055
+ CONVENTION_RE = /^(?:(.+)\.)?(error|loading|not-found)\.[^.]+$/;
1056
+ });
1057
+
1058
+ // src/build/scanCssEntryPoints.ts
1059
+ import { existsSync as existsSync4 } from "fs";
1060
+ var {Glob: Glob4 } = globalThis.Bun;
846
1061
  var scanCssEntryPoints = async (dir, ignore) => {
847
- if (!existsSync3(dir))
1062
+ if (!existsSync4(dir))
848
1063
  return [];
849
1064
  const entryPaths = [];
850
- const glob = new Glob3("**/*.css");
1065
+ const glob = new Glob4("**/*.css");
851
1066
  for await (const file2 of glob.scan({ absolute: true, cwd: dir })) {
852
1067
  const normalized = normalizePath(file2);
853
1068
  if (ignore?.some((pattern) => normalized.includes(pattern)))
@@ -859,7 +1074,7 @@ var scanCssEntryPoints = async (dir, ignore) => {
859
1074
  var init_scanCssEntryPoints = () => {};
860
1075
 
861
1076
  // src/utils/imageProcessing.ts
862
- import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync, writeFileSync } from "fs";
1077
+ import { existsSync as existsSync5, mkdirSync as mkdirSync2, readFileSync, writeFileSync } from "fs";
863
1078
  import { join as join2, resolve as resolve3 } from "path";
864
1079
  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) => {
865
1080
  for (const size of sizes) {
@@ -914,7 +1129,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATIO
914
1129
  return [...device, ...image2].sort((left, right) => left - right);
915
1130
  }, getCacheDir = (buildDir) => {
916
1131
  const dir = join2(buildDir, ".cache", "images");
917
- if (!existsSync4(dir))
1132
+ if (!existsSync5(dir))
918
1133
  mkdirSync2(dir, { recursive: true });
919
1134
  return dir;
920
1135
  }, getCacheKey = (url, width, quality, format) => {
@@ -972,7 +1187,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATIO
972
1187
  }, readFromCache = (cacheDir, cacheKey) => {
973
1188
  const metaPath = join2(cacheDir, `${cacheKey}.meta`);
974
1189
  const dataPath = join2(cacheDir, `${cacheKey}.data`);
975
- if (!existsSync4(metaPath) || !existsSync4(dataPath))
1190
+ if (!existsSync5(metaPath) || !existsSync5(dataPath))
976
1191
  return null;
977
1192
  try {
978
1193
  const meta = JSON.parse(readFileSync(metaPath, "utf-8"));
@@ -1091,12 +1306,12 @@ var init_optimizeHtmlImages = __esm(() => {
1091
1306
  });
1092
1307
 
1093
1308
  // src/cli/scripts/telemetry.ts
1094
- import { existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
1309
+ import { existsSync as existsSync6, mkdirSync as mkdirSync3, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
1095
1310
  import { homedir } from "os";
1096
1311
  import { join as join3 } from "path";
1097
1312
  var configDir, configPath, getTelemetryConfig = () => {
1098
1313
  try {
1099
- if (!existsSync5(configPath))
1314
+ if (!existsSync6(configPath))
1100
1315
  return null;
1101
1316
  const raw = readFileSync2(configPath, "utf-8");
1102
1317
  const config = JSON.parse(raw);
@@ -1111,11 +1326,11 @@ var init_telemetry = __esm(() => {
1111
1326
  });
1112
1327
 
1113
1328
  // src/cli/telemetryEvent.ts
1114
- import { existsSync as existsSync6, readFileSync as readFileSync3 } from "fs";
1329
+ import { existsSync as existsSync7, readFileSync as readFileSync3 } from "fs";
1115
1330
  import { arch, platform } from "os";
1116
1331
  import { dirname, join as join4, parse } from "path";
1117
1332
  var checkCandidate = (candidate) => {
1118
- if (!existsSync6(candidate)) {
1333
+ if (!existsSync7(candidate)) {
1119
1334
  return null;
1120
1335
  }
1121
1336
  const pkg = JSON.parse(readFileSync3(candidate, "utf-8"));
@@ -1220,17 +1435,17 @@ var init_updateAssetPaths = __esm(() => {
1220
1435
  });
1221
1436
 
1222
1437
  // src/dev/buildHMRClient.ts
1223
- import { existsSync as existsSync7 } from "fs";
1438
+ import { existsSync as existsSync8 } from "fs";
1224
1439
  import { resolve as resolve4 } from "path";
1225
1440
  var {build: bunBuild } = globalThis.Bun;
1226
1441
  var resolveHmrClientPath = () => {
1227
1442
  const projectRoot = process.cwd();
1228
1443
  const fromSource = resolve4(import.meta.dir, "client/hmrClient.ts");
1229
- if (existsSync7(fromSource) && fromSource.startsWith(projectRoot)) {
1444
+ if (existsSync8(fromSource) && fromSource.startsWith(projectRoot)) {
1230
1445
  return fromSource;
1231
1446
  }
1232
1447
  const fromNodeModules = resolve4(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client/hmrClient.ts");
1233
- if (existsSync7(fromNodeModules))
1448
+ if (existsSync8(fromNodeModules))
1234
1449
  return fromNodeModules;
1235
1450
  return resolve4(import.meta.dir, "dev/client/hmrClient.ts");
1236
1451
  }, hmrClientPath2, buildHMRClient = async () => {
@@ -1422,7 +1637,7 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
1422
1637
  };
1423
1638
 
1424
1639
  // src/build/angularLinkerPlugin.ts
1425
- import { existsSync as existsSync8, mkdirSync as mkdirSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
1640
+ import { existsSync as existsSync9, mkdirSync as mkdirSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
1426
1641
  import { dirname as dirname2, join as join5, relative as relative2, resolve as resolve6 } from "path";
1427
1642
  import { createHash } from "crypto";
1428
1643
  var CACHE_DIR, angularLinkerPlugin;
@@ -1447,7 +1662,7 @@ var init_angularLinkerPlugin = __esm(() => {
1447
1662
  }
1448
1663
  const hash = createHash("md5").update(source).digest("hex");
1449
1664
  const cachePath = join5(CACHE_DIR, `${hash}.js`);
1450
- if (existsSync8(cachePath)) {
1665
+ if (existsSync9(cachePath)) {
1451
1666
  return {
1452
1667
  contents: readFileSync4(cachePath, "utf-8"),
1453
1668
  loader: "js"
@@ -1464,7 +1679,7 @@ var init_angularLinkerPlugin = __esm(() => {
1464
1679
  linkerPlugin = mod.createEs2015LinkerPlugin({
1465
1680
  fileSystem: {
1466
1681
  dirname: dirname2,
1467
- exists: existsSync8,
1682
+ exists: existsSync9,
1468
1683
  readFile: readFileSync4,
1469
1684
  relative: relative2,
1470
1685
  resolve: resolve6
@@ -1502,10 +1717,10 @@ var init_angularLinkerPlugin = __esm(() => {
1502
1717
  // src/utils/cleanStaleOutputs.ts
1503
1718
  import { rm as rm2 } from "fs/promises";
1504
1719
  import { resolve as resolve7 } from "path";
1505
- var {Glob: Glob4 } = globalThis.Bun;
1720
+ var {Glob: Glob5 } = globalThis.Bun;
1506
1721
  var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPaths) => {
1507
1722
  const currentPaths = new Set(currentOutputPaths.map((path) => resolve7(path)));
1508
- const glob = new Glob4("**/*");
1723
+ const glob = new Glob5("**/*");
1509
1724
  const removals = [];
1510
1725
  for (const relative3 of glob.scanSync({ cwd: buildPath })) {
1511
1726
  const absolute = resolve7(buildPath, relative3);
@@ -1583,7 +1798,7 @@ var init_validateSafePath = () => {};
1583
1798
 
1584
1799
  // src/build/resolvePackageImport.ts
1585
1800
  import { resolve as resolve9, join as join7 } from "path";
1586
- import { existsSync as existsSync9, readFileSync as readFileSync5 } from "fs";
1801
+ import { existsSync as existsSync10, readFileSync as readFileSync5 } from "fs";
1587
1802
  var resolvePackageImport = (specifier) => {
1588
1803
  if (specifier.startsWith(".") || specifier.startsWith("/"))
1589
1804
  return null;
@@ -1594,7 +1809,7 @@ var resolvePackageImport = (specifier) => {
1594
1809
  const exportKey = subpath ? `./${subpath}` : ".";
1595
1810
  const packageDir = resolve9(process.cwd(), "node_modules", packageName ?? "");
1596
1811
  const packageJsonPath = join7(packageDir, "package.json");
1597
- if (!existsSync9(packageJsonPath))
1812
+ if (!existsSync10(packageJsonPath))
1598
1813
  return null;
1599
1814
  try {
1600
1815
  const packageJson = JSON.parse(readFileSync5(packageJsonPath, "utf-8"));
@@ -1608,7 +1823,7 @@ var resolvePackageImport = (specifier) => {
1608
1823
  if (!importPath)
1609
1824
  return null;
1610
1825
  const resolved = resolve9(packageDir, importPath);
1611
- return existsSync9(resolved) ? resolved : null;
1826
+ return existsSync10(resolved) ? resolved : null;
1612
1827
  } catch {
1613
1828
  return null;
1614
1829
  }
@@ -1621,12 +1836,12 @@ __export(exports_compileSvelte, {
1621
1836
  compileSvelte: () => compileSvelte,
1622
1837
  clearSvelteCompilerCache: () => clearSvelteCompilerCache
1623
1838
  });
1624
- import { existsSync as existsSync10 } from "fs";
1839
+ import { existsSync as existsSync11 } from "fs";
1625
1840
  import { mkdir, stat } from "fs/promises";
1626
1841
  import {
1627
1842
  dirname as dirname3,
1628
1843
  join as join8,
1629
- basename as basename2,
1844
+ basename as basename4,
1630
1845
  extname as extname2,
1631
1846
  resolve as resolve10,
1632
1847
  relative as relative4,
@@ -1637,11 +1852,11 @@ var {write, file: file2, Transpiler } = globalThis.Bun;
1637
1852
  var resolveDevClientDir2 = () => {
1638
1853
  const projectRoot = process.cwd();
1639
1854
  const fromSource = resolve10(import.meta.dir, "../dev/client");
1640
- if (existsSync10(fromSource) && fromSource.startsWith(projectRoot)) {
1855
+ if (existsSync11(fromSource) && fromSource.startsWith(projectRoot)) {
1641
1856
  return fromSource;
1642
1857
  }
1643
1858
  const fromNodeModules = resolve10(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
1644
- if (existsSync10(fromNodeModules))
1859
+ if (existsSync11(fromNodeModules))
1645
1860
  return fromNodeModules;
1646
1861
  return resolve10(import.meta.dir, "./dev/client");
1647
1862
  }, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
@@ -1679,7 +1894,7 @@ var resolveDevClientDir2 = () => {
1679
1894
  if (await exists(jsPath))
1680
1895
  return jsPath;
1681
1896
  return null;
1682
- }, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev = false) => {
1897
+ }, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev2 = false) => {
1683
1898
  const { compile, compileModule, preprocess } = await import("svelte/compiler");
1684
1899
  const generatedDir = join8(svelteRoot, "generated");
1685
1900
  const clientDir = join8(generatedDir, "client");
@@ -1705,7 +1920,7 @@ var resolveDevClientDir2 = () => {
1705
1920
  const transpiled = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler.transformSync(preprocessed) : preprocessed;
1706
1921
  const rawRel = dirname3(relative4(svelteRoot, src)).replace(/\\/g, "/");
1707
1922
  const relDir = rawRel.startsWith("..") ? `_ext/${relative4(process.cwd(), dirname3(src)).replace(/\\/g, "/")}` : rawRel;
1708
- const baseName = basename2(src).replace(/\.svelte(\.(ts|js))?$/, "");
1923
+ const baseName = basename4(src).replace(/\.svelte(\.(ts|js))?$/, "");
1709
1924
  const importPaths = Array.from(transpiled.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
1710
1925
  const resolvedImports = await Promise.all(importPaths.map((importPath) => resolveSvelte(importPath, src)));
1711
1926
  const childSources = resolvedImports.filter((path) => path !== null);
@@ -1751,10 +1966,10 @@ var resolveDevClientDir2 = () => {
1751
1966
  dev: mode === "client" && dev,
1752
1967
  filename: src,
1753
1968
  generate: mode,
1754
- hmr: mode === "client" && isDev
1969
+ hmr: mode === "client" && isDev2
1755
1970
  }).js.code;
1756
1971
  let code = compiled.replace(/\.svelte(?:\.(?:ts|js))?(['"])/g, ".js$1");
1757
- if (mode === "client" && isDev) {
1972
+ if (mode === "client" && isDev2) {
1758
1973
  const moduleKey = `/@src/${relative4(process.cwd(), src).replace(/\\/g, "/")}`;
1759
1974
  code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
1760
1975
  if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
@@ -1798,11 +2013,11 @@ var resolveDevClientDir2 = () => {
1798
2013
  const roots = await Promise.all(entryPoints.map(build2));
1799
2014
  await Promise.all(roots.map(async ({ client: client2 }) => {
1800
2015
  const relClientDir = dirname3(relative4(clientDir, client2));
1801
- const name = basename2(client2, extname2(client2));
2016
+ const name = basename4(client2, extname2(client2));
1802
2017
  const indexPath = join8(indexDir, relClientDir, `${name}.js`);
1803
2018
  const importRaw = relative4(dirname3(indexPath), client2).split(sep2).join("/");
1804
2019
  const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
1805
- const hmrImports = isDev ? `window.__HMR_FRAMEWORK__ = "svelte";
2020
+ const hmrImports = isDev2 ? `window.__HMR_FRAMEWORK__ = "svelte";
1806
2021
  import "${hmrClientPath3}";
1807
2022
  ` : "";
1808
2023
  const bootstrap = `${hmrImports}import Component from "${importPath}";
@@ -1844,7 +2059,7 @@ if (typeof window !== "undefined") {
1844
2059
  svelteClientPaths: roots.map(({ client: client2 }) => client2),
1845
2060
  svelteIndexPaths: roots.map(({ client: client2 }) => {
1846
2061
  const rel = dirname3(relative4(clientDir, client2));
1847
- return join8(indexDir, rel, basename2(client2));
2062
+ return join8(indexDir, rel, basename4(client2));
1848
2063
  }),
1849
2064
  svelteServerPaths: roots.map(({ ssr }) => ssr)
1850
2065
  };
@@ -1868,18 +2083,18 @@ __export(exports_compileVue, {
1868
2083
  compileVue: () => compileVue,
1869
2084
  clearVueHmrCaches: () => clearVueHmrCaches
1870
2085
  });
1871
- import { existsSync as existsSync11 } from "fs";
2086
+ import { existsSync as existsSync12 } from "fs";
1872
2087
  import { mkdir as mkdir2 } from "fs/promises";
1873
- import { basename as basename3, dirname as dirname4, join as join9, relative as relative5, resolve as resolve11 } from "path";
2088
+ import { basename as basename5, dirname as dirname4, join as join9, relative as relative5, resolve as resolve11 } from "path";
1874
2089
  var {file: file3, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
1875
2090
  var resolveDevClientDir3 = () => {
1876
2091
  const projectRoot = process.cwd();
1877
2092
  const fromSource = resolve11(import.meta.dir, "../dev/client");
1878
- if (existsSync11(fromSource) && fromSource.startsWith(projectRoot)) {
2093
+ if (existsSync12(fromSource) && fromSource.startsWith(projectRoot)) {
1879
2094
  return fromSource;
1880
2095
  }
1881
2096
  const fromNodeModules = resolve11(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
1882
- if (existsSync11(fromNodeModules))
2097
+ if (existsSync12(fromNodeModules))
1883
2098
  return fromNodeModules;
1884
2099
  return resolve11(import.meta.dir, "./dev/client");
1885
2100
  }, devClientDir3, hmrClientPath4, transpiler2, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
@@ -1949,7 +2164,7 @@ var resolveDevClientDir3 = () => {
1949
2164
  return cachedResult;
1950
2165
  const relativeFilePath = relative5(vueRootDir, sourceFilePath).replace(/\\/g, "/");
1951
2166
  const relativeWithoutExtension = relativeFilePath.replace(/\.vue$/, "");
1952
- const fileBaseName = basename3(sourceFilePath, ".vue");
2167
+ const fileBaseName = basename5(sourceFilePath, ".vue");
1953
2168
  const componentId = toKebab(fileBaseName);
1954
2169
  const sourceContent = await file3(sourceFilePath).text();
1955
2170
  const contentHash = Bun.hash(sourceContent).toString(BASE_36_RADIX);
@@ -2096,7 +2311,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
2096
2311
  cacheMap.set(sourceFilePath, result);
2097
2312
  persistentBuildCache.set(sourceFilePath, result);
2098
2313
  return result;
2099
- }, compileVue = async (entryPoints, vueRootDir, isDev = false) => {
2314
+ }, compileVue = async (entryPoints, vueRootDir, isDev2 = false) => {
2100
2315
  const compiler = await import("@vue/compiler-sfc");
2101
2316
  const generatedDir = join9(vueRootDir, "generated");
2102
2317
  const clientOutputDir = join9(generatedDir, "client");
@@ -2118,11 +2333,11 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
2118
2333
  server: serverOutputDir
2119
2334
  }, buildCache, true, vueRootDir, compiler);
2120
2335
  result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
2121
- const entryBaseName = basename3(entryPath, ".vue");
2336
+ const entryBaseName = basename5(entryPath, ".vue");
2122
2337
  const indexOutputFile = join9(indexOutputDir, `${entryBaseName}.js`);
2123
2338
  const clientOutputFile = join9(clientOutputDir, relative5(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
2124
2339
  await mkdir2(dirname4(indexOutputFile), { recursive: true });
2125
- const vueHmrImports = isDev ? [
2340
+ const vueHmrImports = isDev2 ? [
2126
2341
  `window.__HMR_FRAMEWORK__ = "vue";`,
2127
2342
  `import "${hmrClientPath4}";`
2128
2343
  ] : [];
@@ -110229,10 +110444,10 @@ ${lanes.join(`
110229
110444
  }
110230
110445
  function getDefaultLibFilePriority(a) {
110231
110446
  if (containsPath(defaultLibraryPath, a.fileName, false)) {
110232
- const basename4 = getBaseFileName(a.fileName);
110233
- if (basename4 === "lib.d.ts" || basename4 === "lib.es6.d.ts")
110447
+ const basename6 = getBaseFileName(a.fileName);
110448
+ if (basename6 === "lib.d.ts" || basename6 === "lib.es6.d.ts")
110234
110449
  return 0;
110235
- const name = removeSuffix(removePrefix(basename4, "lib."), ".d.ts");
110450
+ const name = removeSuffix(removePrefix(basename6, "lib."), ".d.ts");
110236
110451
  const index = libs.indexOf(name);
110237
110452
  if (index !== -1)
110238
110453
  return index + 1;
@@ -162795,8 +163010,8 @@ ${options.prefix}` : `
162795
163010
  }
162796
163011
  };
162797
163012
  for (const file4 of files) {
162798
- const basename4 = getBaseFileName(file4);
162799
- if (basename4 === "package.json" || basename4 === "bower.json") {
163013
+ const basename6 = getBaseFileName(file4);
163014
+ if (basename6 === "package.json" || basename6 === "bower.json") {
162800
163015
  createProjectWatcher(file4, "FileWatcher");
162801
163016
  continue;
162802
163017
  }
@@ -165673,8 +165888,8 @@ All files are: ${JSON.stringify(names)}`, "Err");
165673
165888
  const fileOrDirectoryPath = removeIgnoredPath(this.toPath(fileOrDirectory));
165674
165889
  if (!fileOrDirectoryPath)
165675
165890
  return;
165676
- const basename4 = getBaseFileName(fileOrDirectoryPath);
165677
- if (((_a = result.affectedModuleSpecifierCacheProjects) == null ? undefined : _a.size) && (basename4 === "package.json" || basename4 === "node_modules")) {
165891
+ const basename6 = getBaseFileName(fileOrDirectoryPath);
165892
+ if (((_a = result.affectedModuleSpecifierCacheProjects) == null ? undefined : _a.size) && (basename6 === "package.json" || basename6 === "node_modules")) {
165678
165893
  result.affectedModuleSpecifierCacheProjects.forEach((project) => {
165679
165894
  var _a2;
165680
165895
  (_a2 = project.getModuleSpecifierCache()) == null || _a2.clear();
@@ -170988,8 +171203,8 @@ __export(exports_compileAngular, {
170988
171203
  compileAngularFile: () => compileAngularFile,
170989
171204
  compileAngular: () => compileAngular
170990
171205
  });
170991
- import { existsSync as existsSync12, readFileSync as readFileSync6, promises as fs } from "fs";
170992
- import { join as join10, basename as basename4, sep as sep3, dirname as dirname5, resolve as resolve12, relative as relative6 } from "path";
171206
+ import { existsSync as existsSync13, readFileSync as readFileSync6, promises as fs } from "fs";
171207
+ import { join as join10, basename as basename6, sep as sep3, dirname as dirname5, resolve as resolve12, relative as relative6 } from "path";
170993
171208
  import { createHash as createHash2 } from "crypto";
170994
171209
  var import_typescript, computeConfigHash = () => {
170995
171210
  try {
@@ -171001,11 +171216,11 @@ var import_typescript, computeConfigHash = () => {
171001
171216
  }, resolveDevClientDir4 = () => {
171002
171217
  const projectRoot = process.cwd();
171003
171218
  const fromSource = resolve12(import.meta.dir, "../dev/client");
171004
- if (existsSync12(fromSource) && fromSource.startsWith(projectRoot)) {
171219
+ if (existsSync13(fromSource) && fromSource.startsWith(projectRoot)) {
171005
171220
  return fromSource;
171006
171221
  }
171007
171222
  const fromNodeModules = resolve12(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
171008
- if (existsSync12(fromNodeModules))
171223
+ if (existsSync13(fromNodeModules))
171009
171224
  return fromNodeModules;
171010
171225
  return resolve12(import.meta.dir, "./dev/client");
171011
171226
  }, devClientDir4, hmrClientPath5, hmrRuntimePath, injectHMRRegistration = (content, sourceId) => {
@@ -171096,7 +171311,7 @@ ${registrations}
171096
171311
  const originalGetDefaultLibFileName = host.getDefaultLibFileName;
171097
171312
  host.getDefaultLibFileName = (opts) => {
171098
171313
  const fileName = originalGetDefaultLibFileName ? originalGetDefaultLibFileName(opts) : "lib.d.ts";
171099
- return basename4(fileName);
171314
+ return basename6(fileName);
171100
171315
  };
171101
171316
  const originalGetSourceFile = host.getSourceFile;
171102
171317
  host.getSourceFile = (fileName, languageVersion, onError) => {
@@ -171147,7 +171362,7 @@ ${registrations}
171147
171362
  await Promise.all(entries.map(({ target, content }) => fs.writeFile(target, content, "utf-8")));
171148
171363
  return entries.map(({ target }) => target);
171149
171364
  }, jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), readAndEscapeFile = async (filePath) => {
171150
- if (!existsSync12(filePath))
171365
+ if (!existsSync13(filePath))
171151
171366
  return null;
171152
171367
  const content = await fs.readFile(filePath, "utf-8");
171153
171368
  return escapeTemplateContent(content);
@@ -171209,13 +171424,13 @@ ${registrations}
171209
171424
  let actualPath = resolved;
171210
171425
  if (!actualPath.endsWith(".ts"))
171211
171426
  actualPath += ".ts";
171212
- if (!existsSync12(actualPath))
171427
+ if (!existsSync13(actualPath))
171213
171428
  return;
171214
171429
  let sourceCode = await fs.readFile(actualPath, "utf-8");
171215
171430
  sourceCode = await inlineResources(sourceCode, dirname5(actualPath));
171216
171431
  const inputDir = dirname5(actualPath);
171217
171432
  const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
171218
- const fileBase = basename4(actualPath).replace(/\.ts$/, ".js");
171433
+ const fileBase = basename6(actualPath).replace(/\.ts$/, ".js");
171219
171434
  const targetDir = join10(outDir, relativeDir);
171220
171435
  const targetPath = join10(targetDir, fileBase);
171221
171436
  const importRegex = /from\s+['"](\.\.?\/[^'"]+)['"]/g;
@@ -171228,7 +171443,7 @@ ${registrations}
171228
171443
  const packageImportRewrites = new Map;
171229
171444
  const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
171230
171445
  const cacheKey2 = actualPath;
171231
- if (jitContentCache.get(cacheKey2) === contentHash && existsSync12(targetPath)) {
171446
+ if (jitContentCache.get(cacheKey2) === contentHash && existsSync13(targetPath)) {
171232
171447
  allOutputs.push(targetPath);
171233
171448
  } else {
171234
171449
  let processedContent = angularTranspiler.transformSync(sourceCode);
@@ -171272,7 +171487,7 @@ ${registrations}
171272
171487
  await fs.mkdir(indexesDir, { recursive: true });
171273
171488
  const compileTasks = entryPoints.map(async (entry) => {
171274
171489
  const outputs = hmr ? await compileAngularFileJIT(entry, compiledRoot, outRoot) : await compileAngularFile(entry, compiledRoot);
171275
- const fileBase = basename4(entry).replace(/\.[tj]s$/, "");
171490
+ const fileBase = basename6(entry).replace(/\.[tj]s$/, "");
171276
171491
  const jsName = `${fileBase}.js`;
171277
171492
  let rawServerFile = outputs.find((file4) => file4.endsWith(`${sep3}pages${sep3}${jsName}`));
171278
171493
  if (!rawServerFile) {
@@ -171286,7 +171501,7 @@ ${registrations}
171286
171501
  const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
171287
171502
  const cachedWrapper = wrapperOutputCache.get(entry);
171288
171503
  const clientFile = join10(indexesDir, jsName);
171289
- if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync12(clientFile)) {
171504
+ if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync13(clientFile)) {
171290
171505
  return { clientPath: clientFile, indexUnchanged: true, serverPath: rawServerFile };
171291
171506
  }
171292
171507
  let rewritten = original.replace(new RegExp(`templateUrl:\\s*['"]\\.\\/${fileBase}\\.html['"]`), `templateUrl: '../../pages/${fileBase}.html'`);
@@ -171685,17 +171900,62 @@ var init_rewriteImports = __esm(() => {
171685
171900
  import {
171686
171901
  copyFileSync,
171687
171902
  cpSync,
171688
- existsSync as existsSync13,
171903
+ existsSync as existsSync14,
171689
171904
  mkdirSync as mkdirSync9,
171690
171905
  readFileSync as readFileSync7,
171691
171906
  rmSync,
171692
171907
  statSync,
171693
171908
  writeFileSync as writeFileSync4
171694
171909
  } from "fs";
171695
- import { basename as basename5, join as join15, relative as relative7, resolve as resolve13 } from "path";
171910
+ import { basename as basename7, join as join15, relative as relative7, resolve as resolve13 } from "path";
171696
171911
  import { cwd, env as env2, exit } from "process";
171697
- var {build: bunBuild6, Glob: Glob5 } = globalThis.Bun;
171698
- var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental, throwOnError) => {
171912
+ var {build: bunBuild6, Glob: Glob6 } = globalThis.Bun;
171913
+ var isDev2, collectConventionSourceFiles = (entry) => {
171914
+ if (!entry)
171915
+ return [];
171916
+ const files = [];
171917
+ if (entry.defaults?.error)
171918
+ files.push(entry.defaults.error);
171919
+ if (entry.defaults?.loading)
171920
+ files.push(entry.defaults.loading);
171921
+ if (entry.defaults?.notFound)
171922
+ files.push(entry.defaults.notFound);
171923
+ if (entry.pages) {
171924
+ for (const page of Object.values(entry.pages)) {
171925
+ if (page.error)
171926
+ files.push(page.error);
171927
+ if (page.loading)
171928
+ files.push(page.loading);
171929
+ }
171930
+ }
171931
+ return files;
171932
+ }, updateConventionCompiledPaths = (entry, sourcePaths, compiledPaths) => {
171933
+ if (!entry || sourcePaths.length !== compiledPaths.length)
171934
+ return;
171935
+ const pathMap = new Map;
171936
+ for (let i = 0;i < sourcePaths.length; i++) {
171937
+ const src = sourcePaths[i];
171938
+ const compiled = compiledPaths[i];
171939
+ if (src && compiled)
171940
+ pathMap.set(src, compiled);
171941
+ }
171942
+ if (entry.defaults) {
171943
+ if (entry.defaults.error && pathMap.has(entry.defaults.error))
171944
+ entry.defaults.error = pathMap.get(entry.defaults.error);
171945
+ if (entry.defaults.loading && pathMap.has(entry.defaults.loading))
171946
+ entry.defaults.loading = pathMap.get(entry.defaults.loading);
171947
+ if (entry.defaults.notFound && pathMap.has(entry.defaults.notFound))
171948
+ entry.defaults.notFound = pathMap.get(entry.defaults.notFound);
171949
+ }
171950
+ if (entry.pages) {
171951
+ for (const page of Object.values(entry.pages)) {
171952
+ if (page.error && pathMap.has(page.error))
171953
+ page.error = pathMap.get(page.error);
171954
+ if (page.loading && pathMap.has(page.loading))
171955
+ page.loading = pathMap.get(page.loading);
171956
+ }
171957
+ }
171958
+ }, extractBuildError = (logs, pass, label, frameworkNames, isIncremental, throwOnError) => {
171699
171959
  const errLog = logs.find((log2) => log2.level === "error") ?? logs[0];
171700
171960
  if (!errLog) {
171701
171961
  exit(1);
@@ -171715,7 +171975,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171715
171975
  exit(1);
171716
171976
  }, copyHtmxVendor = (htmxDir, htmxDestDir) => {
171717
171977
  mkdirSync9(htmxDestDir, { recursive: true });
171718
- const glob = new Glob5("htmx*.min.js");
171978
+ const glob = new Glob6("htmx*.min.js");
171719
171979
  for (const relPath of glob.scanSync({ cwd: htmxDir })) {
171720
171980
  const src = join15(htmxDir, relPath);
171721
171981
  const dest = join15(htmxDestDir, "htmx.min.js");
@@ -171763,7 +172023,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171763
172023
  collectWorkerPathsFromContent(content, pattern, file4, workerPaths);
171764
172024
  }
171765
172025
  }, scanWorkerReferencesInDir = async (dir, patterns, workerPaths) => {
171766
- const glob = new Glob5("**/*.{ts,tsx,js,jsx,svelte,vue}");
172026
+ const glob = new Glob6("**/*.{ts,tsx,js,jsx,svelte,vue}");
171767
172027
  for await (const file4 of glob.scan({ absolute: true, cwd: dir })) {
171768
172028
  const relToDir = file4.slice(dir.length + 1);
171769
172029
  const [firstSegment] = relToDir.split("/");
@@ -171814,9 +172074,9 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171814
172074
  const svelteIndexDir = join15(svelteDir, "generated", "indexes");
171815
172075
  const sveltePageEntries = svelteEntries.filter((file4) => resolve13(file4).startsWith(resolve13(sveltePagesPath)));
171816
172076
  for (const entry of sveltePageEntries) {
171817
- const name = basename5(entry).replace(/\.svelte(\.(ts|js))?$/, "");
172077
+ const name = basename7(entry).replace(/\.svelte(\.(ts|js))?$/, "");
171818
172078
  const indexFile = join15(svelteIndexDir, "pages", `${name}.js`);
171819
- if (!existsSync13(indexFile))
172079
+ if (!existsSync14(indexFile))
171820
172080
  continue;
171821
172081
  let content = readFileSync7(indexFile, "utf-8");
171822
172082
  const srcRel = relative7(process.cwd(), resolve13(entry)).replace(/\\/g, "/");
@@ -171827,9 +172087,9 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171827
172087
  const vueIndexDir = join15(vueDir, "generated", "indexes");
171828
172088
  const vuePageEntries = vueEntries.filter((file4) => resolve13(file4).startsWith(resolve13(vuePagesPath)));
171829
172089
  for (const entry of vuePageEntries) {
171830
- const name = basename5(entry, ".vue");
172090
+ const name = basename7(entry, ".vue");
171831
172091
  const indexFile = join15(vueIndexDir, `${name}.js`);
171832
- if (!existsSync13(indexFile))
172092
+ if (!existsSync14(indexFile))
171833
172093
  continue;
171834
172094
  let content = readFileSync7(indexFile, "utf-8");
171835
172095
  const srcRel = relative7(process.cwd(), resolve13(entry)).replace(/\\/g, "/");
@@ -171908,7 +172168,7 @@ ${content.slice(firstUseIdx)}`;
171908
172168
  const urlFileMap = new Map;
171909
172169
  for (const srcPath of urlReferencedFiles) {
171910
172170
  const rel = relative7(projectRoot, srcPath).replace(/\\/g, "/");
171911
- const name = basename5(srcPath);
172171
+ const name = basename7(srcPath);
171912
172172
  const mtime = Math.round(statSync(srcPath).mtimeMs);
171913
172173
  const url = `/@src/${rel}?v=${mtime}`;
171914
172174
  urlFileMap.set(name, url);
@@ -171918,11 +172178,11 @@ ${content.slice(firstUseIdx)}`;
171918
172178
  }, buildProdUrlFileMap = (urlReferencedFiles, buildPath, nonReactClientOutputs) => {
171919
172179
  const urlFileMap = new Map;
171920
172180
  for (const srcPath of urlReferencedFiles) {
171921
- const srcBase = basename5(srcPath).replace(/\.[^.]+$/, "");
171922
- const output = nonReactClientOutputs.find((artifact) => basename5(artifact.path).startsWith(`${srcBase}.`));
172181
+ const srcBase = basename7(srcPath).replace(/\.[^.]+$/, "");
172182
+ const output = nonReactClientOutputs.find((artifact) => basename7(artifact.path).startsWith(`${srcBase}.`));
171923
172183
  if (!output)
171924
172184
  continue;
171925
- urlFileMap.set(basename5(srcPath), `/${relative7(buildPath, output.path).replace(/\\/g, "/")}`);
172185
+ urlFileMap.set(basename7(srcPath), `/${relative7(buildPath, output.path).replace(/\\/g, "/")}`);
171926
172186
  }
171927
172187
  return urlFileMap;
171928
172188
  }, buildUrlFileMap = (urlReferencedFiles, hmr, projectRoot, buildPath, nonReactClientOutputs) => {
@@ -171935,7 +172195,7 @@ ${content.slice(firstUseIdx)}`;
171935
172195
  let content = readFileSync7(outputPath, "utf-8");
171936
172196
  let changed = false;
171937
172197
  content = content.replace(urlPattern, (_match, relPath) => {
171938
- const targetName = basename5(relPath);
172198
+ const targetName = basename7(relPath);
171939
172199
  const resolvedPath = urlFileMap.get(targetName);
171940
172200
  if (!resolvedPath)
171941
172201
  return _match;
@@ -172007,7 +172267,7 @@ ${content.slice(firstUseIdx)}`;
172007
172267
  sendTelemetryEvent("build:start", {
172008
172268
  framework: frameworkNames[0],
172009
172269
  frameworks: frameworkNames,
172010
- mode: mode ?? (isDev ? "development" : "production"),
172270
+ mode: mode ?? (isDev2 ? "development" : "production"),
172011
172271
  tailwind: Boolean(tailwind)
172012
172272
  });
172013
172273
  const sourceClientRoots = [
@@ -172038,7 +172298,7 @@ ${content.slice(firstUseIdx)}`;
172038
172298
  if (!firstEntry)
172039
172299
  throw new Error("Expected at least one server directory entry");
172040
172300
  serverRoot = join15(firstEntry.dir, firstEntry.subdir);
172041
- serverOutDir = join15(buildPath, basename5(firstEntry.dir));
172301
+ serverOutDir = join15(buildPath, basename7(firstEntry.dir));
172042
172302
  } else if (serverDirMap.length > 1) {
172043
172303
  serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
172044
172304
  serverOutDir = buildPath;
@@ -172084,27 +172344,45 @@ ${content.slice(firstUseIdx)}`;
172084
172344
  await proc.exited;
172085
172345
  };
172086
172346
  const tailwindPromise = tailwind && (!isIncremental || normalizedIncrementalFiles?.some((file4) => file4.endsWith(".css"))) ? compileTailwind(tailwind.input, tailwind.output) : undefined;
172347
+ const emptyConventionResult = {
172348
+ pageFiles: [],
172349
+ conventions: undefined
172350
+ };
172087
172351
  const [
172088
172352
  ,
172089
172353
  allReactEntries,
172090
172354
  allHtmlEntries,
172091
- allSvelteEntries,
172092
- allVueEntries,
172093
- allAngularEntries,
172355
+ reactConventionResult,
172356
+ svelteConventionResult,
172357
+ vueConventionResult,
172358
+ angularConventionResult,
172094
172359
  allGlobalCssEntries
172095
172360
  ] = await Promise.all([
172096
172361
  tailwindPromise,
172097
172362
  reactIndexesPath ? scanEntryPoints(reactIndexesPath, "*.tsx") : [],
172098
172363
  htmlScriptsPath ? scanEntryPoints(htmlScriptsPath, "*.{js,ts}") : [],
172099
- sveltePagesPath ? scanEntryPoints(sveltePagesPath, "*.svelte") : [],
172100
- vuePagesPath ? scanEntryPoints(vuePagesPath, "*.vue") : [],
172101
- angularPagesPath ? scanEntryPoints(angularPagesPath, "*.ts") : [],
172364
+ reactPagesPath ? scanConventions(reactPagesPath, "*.tsx") : emptyConventionResult,
172365
+ sveltePagesPath ? scanConventions(sveltePagesPath, "*.svelte") : emptyConventionResult,
172366
+ vuePagesPath ? scanConventions(vuePagesPath, "*.vue") : emptyConventionResult,
172367
+ angularPagesPath ? scanConventions(angularPagesPath, "*.ts") : emptyConventionResult,
172102
172368
  stylesDir ? scanCssEntryPoints(stylesDir, stylesIgnore) : []
172103
172369
  ]);
172370
+ const allSvelteEntries = svelteConventionResult.pageFiles;
172371
+ const allVueEntries = vueConventionResult.pageFiles;
172372
+ const allAngularEntries = angularConventionResult.pageFiles;
172373
+ const conventionsMap2 = {};
172374
+ if (reactConventionResult.conventions)
172375
+ conventionsMap2.react = reactConventionResult.conventions;
172376
+ if (svelteConventionResult.conventions)
172377
+ conventionsMap2.svelte = svelteConventionResult.conventions;
172378
+ if (vueConventionResult.conventions)
172379
+ conventionsMap2.vue = vueConventionResult.conventions;
172380
+ if (angularConventionResult.conventions)
172381
+ conventionsMap2.angular = angularConventionResult.conventions;
172104
172382
  const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/html/") && (f.endsWith(".html") || f.endsWith(".css")));
172105
172383
  const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
172106
172384
  if (entry.startsWith(resolve13(reactIndexesPath))) {
172107
- const pageName = basename5(entry, ".tsx");
172385
+ const pageName = basename7(entry, ".tsx");
172108
172386
  return join15(reactPagesPath, `${pageName}.tsx`);
172109
172387
  }
172110
172388
  return null;
@@ -172140,6 +172418,16 @@ ${content.slice(firstUseIdx)}`;
172140
172418
  serverPaths: [...emptyStringArray]
172141
172419
  }
172142
172420
  ]);
172421
+ const svelteConventionSources = collectConventionSourceFiles(conventionsMap2.svelte);
172422
+ const vueConventionSources = collectConventionSourceFiles(conventionsMap2.vue);
172423
+ if (svelteConventionSources.length > 0 || vueConventionSources.length > 0) {
172424
+ const [svelteConvResult, vueConvResult] = await Promise.all([
172425
+ svelteConventionSources.length > 0 && svelteDir ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteConventionSources, svelteDir, new Map, false)) : { svelteServerPaths: [] },
172426
+ vueConventionSources.length > 0 && vueDir ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueConventionSources, vueDir, false)) : { vueServerPaths: [] }
172427
+ ]);
172428
+ updateConventionCompiledPaths(conventionsMap2.svelte, svelteConventionSources, svelteConvResult.svelteServerPaths);
172429
+ updateConventionCompiledPaths(conventionsMap2.vue, vueConventionSources, vueConvResult.vueServerPaths);
172430
+ }
172143
172431
  const serverEntryPoints = [
172144
172432
  ...svelteServerPaths,
172145
172433
  ...vueServerPaths,
@@ -172184,7 +172472,7 @@ ${content.slice(firstUseIdx)}`;
172184
172472
  },
172185
172473
  frameworks: frameworkNames,
172186
172474
  incremental: Boolean(isIncremental),
172187
- mode: mode ?? (isDev ? "development" : "production"),
172475
+ mode: mode ?? (isDev2 ? "development" : "production"),
172188
172476
  scannedEntries: {
172189
172477
  angular: allAngularEntries.length,
172190
172478
  html: allHtmlEntries.length,
@@ -172229,7 +172517,7 @@ ${content.slice(firstUseIdx)}`;
172229
172517
  entrypoints: reactClientEntryPoints,
172230
172518
  ...vendorPaths ? { external: Object.keys(vendorPaths) } : {},
172231
172519
  format: "esm",
172232
- minify: !isDev,
172520
+ minify: !isDev2,
172233
172521
  naming: `[dir]/[name].[hash].[ext]`,
172234
172522
  outdir: buildPath,
172235
172523
  ...hmr ? { jsx: { development: true }, reactFastRefresh: true } : {},
@@ -172292,22 +172580,22 @@ ${content.slice(firstUseIdx)}`;
172292
172580
  ...Object.keys(svelteVendorPaths2 ?? {})
172293
172581
  ],
172294
172582
  format: "esm",
172295
- minify: !isDev,
172583
+ minify: !isDev2,
172296
172584
  naming: `[dir]/[name].[hash].[ext]`,
172297
172585
  outdir: buildPath,
172298
172586
  plugins: [
172299
- ...angularDir && !isDev ? [angularLinkerPlugin] : [],
172587
+ ...angularDir && !isDev2 ? [angularLinkerPlugin] : [],
172300
172588
  ...htmlScriptPlugin ? [htmlScriptPlugin] : []
172301
172589
  ],
172302
172590
  root: clientRoot,
172303
- splitting: !isDev,
172591
+ splitting: !isDev2,
172304
172592
  target: "browser",
172305
172593
  throw: false
172306
172594
  }) : undefined,
172307
172595
  globalCssEntries.length > 0 ? bunBuild6({
172308
172596
  entrypoints: globalCssEntries,
172309
172597
  naming: `[dir]/[name].[hash].[ext]`,
172310
- outdir: stylesDir ? join15(buildPath, basename5(stylesDir)) : buildPath,
172598
+ outdir: stylesDir ? join15(buildPath, basename7(stylesDir)) : buildPath,
172311
172599
  root: stylesDir || clientRoot,
172312
172600
  target: "browser",
172313
172601
  throw: false
@@ -172315,7 +172603,7 @@ ${content.slice(firstUseIdx)}`;
172315
172603
  vueCssPaths.length > 0 ? bunBuild6({
172316
172604
  entrypoints: vueCssPaths,
172317
172605
  naming: `[name].[hash].[ext]`,
172318
- outdir: join15(buildPath, assetsPath ? basename5(assetsPath) : "assets", "css"),
172606
+ outdir: join15(buildPath, assetsPath ? basename7(assetsPath) : "assets", "css"),
172319
172607
  target: "browser",
172320
172608
  throw: false
172321
172609
  }) : undefined
@@ -172394,7 +172682,7 @@ ${content.slice(firstUseIdx)}`;
172394
172682
  ], buildPath)
172395
172683
  };
172396
172684
  for (const artifact of serverOutputs) {
172397
- const fileWithHash = basename5(artifact.path);
172685
+ const fileWithHash = basename7(artifact.path);
172398
172686
  const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
172399
172687
  if (!baseName)
172400
172688
  continue;
@@ -172421,7 +172709,7 @@ ${content.slice(firstUseIdx)}`;
172421
172709
  const processHtmlPages = async () => {
172422
172710
  if (!(htmlDir && htmlPagesPath))
172423
172711
  return;
172424
- const outputHtmlPages = isSingle ? join15(buildPath, "pages") : join15(buildPath, basename5(htmlDir), "pages");
172712
+ const outputHtmlPages = isSingle ? join15(buildPath, "pages") : join15(buildPath, basename7(htmlDir), "pages");
172425
172713
  if (shouldCopyHtml) {
172426
172714
  mkdirSync9(outputHtmlPages, { recursive: true });
172427
172715
  cpSync(htmlPagesPath, outputHtmlPages, {
@@ -172437,14 +172725,14 @@ ${content.slice(firstUseIdx)}`;
172437
172725
  for (const htmlFile of htmlPageFiles) {
172438
172726
  if (hmr)
172439
172727
  injectHMRIntoHTMLFile(htmlFile, "html");
172440
- const fileName = basename5(htmlFile, ".html");
172728
+ const fileName = basename7(htmlFile, ".html");
172441
172729
  manifest[fileName] = htmlFile;
172442
172730
  }
172443
172731
  };
172444
172732
  const processHtmxPages = async () => {
172445
172733
  if (!(htmxDir && htmxPagesPath))
172446
172734
  return;
172447
- const outputHtmxPages = isSingle ? join15(buildPath, "pages") : join15(buildPath, basename5(htmxDir), "pages");
172735
+ const outputHtmxPages = isSingle ? join15(buildPath, "pages") : join15(buildPath, basename7(htmxDir), "pages");
172448
172736
  if (shouldCopyHtmx) {
172449
172737
  mkdirSync9(outputHtmxPages, { recursive: true });
172450
172738
  cpSync(htmxPagesPath, outputHtmxPages, {
@@ -172453,7 +172741,7 @@ ${content.slice(firstUseIdx)}`;
172453
172741
  });
172454
172742
  }
172455
172743
  if (shouldCopyHtmx) {
172456
- const htmxDestDir = isSingle ? buildPath : join15(buildPath, basename5(htmxDir));
172744
+ const htmxDestDir = isSingle ? buildPath : join15(buildPath, basename7(htmxDir));
172457
172745
  copyHtmxVendor(htmxDir, htmxDestDir);
172458
172746
  }
172459
172747
  if (shouldUpdateHtmxAssetPaths) {
@@ -172464,7 +172752,7 @@ ${content.slice(firstUseIdx)}`;
172464
172752
  for (const htmxFile of htmxPageFiles) {
172465
172753
  if (hmr)
172466
172754
  injectHMRIntoHTMLFile(htmxFile, "htmx");
172467
- const fileName = basename5(htmxFile, ".html");
172755
+ const fileName = basename7(htmxFile, ".html");
172468
172756
  manifest[fileName] = htmxFile;
172469
172757
  }
172470
172758
  };
@@ -172502,12 +172790,15 @@ ${content.slice(firstUseIdx)}`;
172502
172790
  sendTelemetryEvent("build:complete", {
172503
172791
  durationMs: Math.round(performance.now() - buildStart),
172504
172792
  frameworks: frameworkNames,
172505
- mode: mode ?? (isDev ? "development" : "production")
172793
+ mode: mode ?? (isDev2 ? "development" : "production")
172506
172794
  });
172507
172795
  if (!isIncremental) {
172508
172796
  writeFileSync4(join15(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
172797
+ if (Object.keys(conventionsMap2).length > 0) {
172798
+ writeFileSync4(join15(buildPath, "conventions.json"), JSON.stringify(conventionsMap2, null, "\t"));
172799
+ }
172509
172800
  }
172510
- return manifest;
172801
+ return { manifest, conventions: conventionsMap2 };
172511
172802
  };
172512
172803
  var init_build = __esm(() => {
172513
172804
  init_constants();
@@ -172516,6 +172807,7 @@ var init_build = __esm(() => {
172516
172807
  init_htmlScriptHMRPlugin();
172517
172808
  init_outputLogs();
172518
172809
  init_scanEntryPoints();
172810
+ init_scanConventions();
172519
172811
  init_scanCssEntryPoints();
172520
172812
  init_optimizeHtmlImages();
172521
172813
  init_updateAssetPaths();
@@ -172528,7 +172820,7 @@ var init_build = __esm(() => {
172528
172820
  init_commonAncestor();
172529
172821
  init_logger();
172530
172822
  init_validateSafePath();
172531
- isDev = env2.NODE_ENV === "development";
172823
+ isDev2 = env2.NODE_ENV === "development";
172532
172824
  SKIP_DIRS = new Set([
172533
172825
  "build",
172534
172826
  "node_modules",
@@ -172559,14 +172851,14 @@ var init_build = __esm(() => {
172559
172851
  ].join("");
172560
172852
  vueFeatureFlags = {
172561
172853
  __VUE_OPTIONS_API__: "true",
172562
- __VUE_PROD_DEVTOOLS__: isDev ? "true" : "false",
172563
- __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: isDev ? "true" : "false"
172854
+ __VUE_PROD_DEVTOOLS__: isDev2 ? "true" : "false",
172855
+ __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: isDev2 ? "true" : "false"
172564
172856
  };
172565
172857
  });
172566
172858
 
172567
172859
  // src/dev/dependencyGraph.ts
172568
- import { existsSync as existsSync14, readFileSync as readFileSync8 } from "fs";
172569
- var {Glob: Glob6 } = globalThis.Bun;
172860
+ import { existsSync as existsSync15, readFileSync as readFileSync8 } from "fs";
172861
+ var {Glob: Glob7 } = globalThis.Bun;
172570
172862
  import { resolve as resolve14 } from "path";
172571
172863
  var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
172572
172864
  const lower = filePath.toLowerCase();
@@ -172595,10 +172887,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
172595
172887
  ];
172596
172888
  for (const ext of extensions) {
172597
172889
  const withExt = normalized + ext;
172598
- if (existsSync14(withExt))
172890
+ if (existsSync15(withExt))
172599
172891
  return withExt;
172600
172892
  }
172601
- if (existsSync14(normalized))
172893
+ if (existsSync15(normalized))
172602
172894
  return normalized;
172603
172895
  return null;
172604
172896
  }, clearExistingDependents = (graph, normalizedPath) => {
@@ -172613,7 +172905,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
172613
172905
  }
172614
172906
  }, addFileToGraph = (graph, filePath) => {
172615
172907
  const normalizedPath = resolve14(filePath);
172616
- if (!existsSync14(normalizedPath))
172908
+ if (!existsSync15(normalizedPath))
172617
172909
  return;
172618
172910
  const dependencies = extractDependencies(normalizedPath);
172619
172911
  clearExistingDependents(graph, normalizedPath);
@@ -172628,8 +172920,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
172628
172920
  dependencies.forEach(addDependent);
172629
172921
  }, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
172630
172922
  const processedFiles = new Set;
172631
- const glob = new Glob6("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
172632
- const resolvedDirs = directories.map((dir) => resolve14(dir)).filter((dir) => existsSync14(dir));
172923
+ const glob = new Glob7("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
172924
+ const resolvedDirs = directories.map((dir) => resolve14(dir)).filter((dir) => existsSync15(dir));
172633
172925
  const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
172634
172926
  for (const file4 of allFiles) {
172635
172927
  const fullPath = resolve14(file4);
@@ -173020,7 +173312,7 @@ var init_pathUtils = __esm(() => {
173020
173312
 
173021
173313
  // src/dev/fileWatcher.ts
173022
173314
  import { watch } from "fs";
173023
- import { existsSync as existsSync15 } from "fs";
173315
+ import { existsSync as existsSync16 } from "fs";
173024
173316
  import { join as join16, resolve as resolve16 } from "path";
173025
173317
  var safeRemoveFromGraph = (graph, fullPath) => {
173026
173318
  try {
@@ -173052,12 +173344,12 @@ var safeRemoveFromGraph = (graph, fullPath) => {
173052
173344
  if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
173053
173345
  return;
173054
173346
  }
173055
- if (event === "rename" && !existsSync15(fullPath)) {
173347
+ if (event === "rename" && !existsSync16(fullPath)) {
173056
173348
  safeRemoveFromGraph(state.dependencyGraph, fullPath);
173057
173349
  onFileChange(fullPath);
173058
173350
  return;
173059
173351
  }
173060
- if (existsSync15(fullPath)) {
173352
+ if (existsSync16(fullPath)) {
173061
173353
  onFileChange(fullPath);
173062
173354
  safeAddToGraph(state.dependencyGraph, fullPath);
173063
173355
  }
@@ -173067,7 +173359,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
173067
173359
  const stylesDir = state.resolvedPaths?.stylesDir;
173068
173360
  paths.forEach((path) => {
173069
173361
  const absolutePath = resolve16(path).replace(/\\/g, "/");
173070
- if (!existsSync15(absolutePath)) {
173362
+ if (!existsSync16(absolutePath)) {
173071
173363
  return;
173072
173364
  }
173073
173365
  const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
@@ -173078,7 +173370,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
173078
173370
  const stylesDir = state.resolvedPaths?.stylesDir;
173079
173371
  watchPaths.forEach((path) => {
173080
173372
  const absolutePath = resolve16(path).replace(/\\/g, "/");
173081
- if (!existsSync15(absolutePath)) {
173373
+ if (!existsSync16(absolutePath)) {
173082
173374
  return;
173083
173375
  }
173084
173376
  const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
@@ -173234,7 +173526,7 @@ var classifyComponent = (filePath) => {
173234
173526
  var init_reactComponentClassifier = () => {};
173235
173527
 
173236
173528
  // src/dev/moduleMapper.ts
173237
- import { basename as basename6, resolve as resolve19 } from "path";
173529
+ import { basename as basename8, resolve as resolve19 } from "path";
173238
173530
  var buildModulePaths = (moduleKeys, manifest) => {
173239
173531
  const modulePaths = {};
173240
173532
  moduleKeys.forEach((key) => {
@@ -173281,7 +173573,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
173281
173573
  return grouped;
173282
173574
  }, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
173283
173575
  const normalizedFile = resolve19(sourceFile);
173284
- const fileName = basename6(normalizedFile);
173576
+ const fileName = basename8(normalizedFile);
173285
173577
  const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
173286
173578
  const pascalName = toPascal(baseName);
173287
173579
  const keys = [];
@@ -173510,7 +173802,7 @@ var init_registerClientScript = __esm(() => {
173510
173802
  });
173511
173803
 
173512
173804
  // src/angular/injectorPatch.ts
173513
- import { existsSync as existsSync16, readFileSync as readFileSync10, writeFileSync as writeFileSync5 } from "fs";
173805
+ import { existsSync as existsSync17, readFileSync as readFileSync10, writeFileSync as writeFileSync5 } from "fs";
173514
173806
  import { dirname as dirname6, join as join17, resolve as resolve20 } from "path";
173515
173807
  var applyInjectorPatch = (chunkPath, content) => {
173516
173808
  if (content.includes('Symbol.for("angular.currentInjector")')) {
@@ -173548,7 +173840,7 @@ var applyInjectorPatch = (chunkPath, content) => {
173548
173840
  writeFileSync5(chunkPath, patched, "utf-8");
173549
173841
  }, resolveAngularCoreDir = () => {
173550
173842
  const fromProject = resolve20(process.cwd(), "node_modules/@angular/core");
173551
- if (existsSync16(join17(fromProject, "package.json"))) {
173843
+ if (existsSync17(join17(fromProject, "package.json"))) {
173552
173844
  return fromProject;
173553
173845
  }
173554
173846
  return dirname6(__require.resolve("@angular/core/package.json"));
@@ -173565,11 +173857,11 @@ var init_injectorPatch = __esm(() => {
173565
173857
  });
173566
173858
 
173567
173859
  // src/angular/resolveAngularPackage.ts
173568
- import { existsSync as existsSync17 } from "fs";
173860
+ import { existsSync as existsSync18 } from "fs";
173569
173861
  import { resolve as resolve21 } from "path";
173570
173862
  var resolveAngularPackage = (specifier) => {
173571
173863
  const fromProject = resolve21(process.cwd(), "node_modules", specifier);
173572
- if (existsSync17(fromProject)) {
173864
+ if (existsSync18(fromProject)) {
173573
173865
  return fromProject;
173574
173866
  }
173575
173867
  return specifier;
@@ -173857,6 +174149,10 @@ var ssrDirty2 = false, lastSelector = "angular-page", invalidateAngularSsrCache
173857
174149
  });
173858
174150
  } catch (error) {
173859
174151
  console.error("[SSR] Angular render error:", error);
174152
+ const pageName = derivePageName(pagePath);
174153
+ const conventionResponse = await renderConventionError("angular", pageName, error);
174154
+ if (conventionResponse)
174155
+ return conventionResponse;
173860
174156
  return new Response(ssrErrorPage("angular", error), {
173861
174157
  headers: { "Content-Type": "text/html" },
173862
174158
  status: 500
@@ -173866,6 +174162,7 @@ var ssrDirty2 = false, lastSelector = "angular-page", invalidateAngularSsrCache
173866
174162
  };
173867
174163
  var init_pageHandler2 = __esm(() => {
173868
174164
  init_constants();
174165
+ init_resolveConvention();
173869
174166
  init_registerClientScript();
173870
174167
  init_angularDeps();
173871
174168
  init_ssrRender();
@@ -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 resolve22, 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 resolve22, 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(resolve22(projectRoot, srcPath + ext)));
174430
+ const found = extensions.find((ext) => existsSync19(resolve22(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 resolve25 } from "path";
175140
+ import { basename as basename10, relative as relative9, resolve as resolve25 } 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((file4) => existsSync19(file4));
175226
+ const dependentFiles = Array.from(dependents).filter((file4) => existsSync20(file4));
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)] = resolve25(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 = resolve25(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 = resolve25(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 = resolve25(svelteDir, "generated", "server");
175430
- const serverOutDir = resolve25(buildDir, basename8(svelteDir));
175739
+ const serverOutDir = resolve25(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 resolve25(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 resolve25(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((file4) => file4.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 = resolve25(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((file4) => file4.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 = resolve25(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 = resolve25(outputDir, basename8(sourceFile));
176383
+ const destPath = resolve25(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 build2(buildConfig);
176180
- if (!manifest) {
176488
+ const buildResult = await build2(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((file4) => !isSkippedFile(file4));
@@ -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 build2({
176816
+ const buildResult = await build2({
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 build2({
176913
+ const buildResult = await build2({
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 conventions2 = 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 = resolve26(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: conventions2
176676
176990
  };
176677
176991
  globalThis.__hmrDevResult = result;
176678
176992
  globalThis.__hmrServerMtime = statSync3(resolve26(Bun.main)).mtimeMs;
@@ -176817,13 +177131,13 @@ var exports_imageOptimizer = {};
176817
177131
  __export(exports_imageOptimizer, {
176818
177132
  imageOptimizer: () => imageOptimizer
176819
177133
  });
176820
- import { existsSync as existsSync20 } from "fs";
177134
+ import { existsSync as existsSync21 } from "fs";
176821
177135
  import { resolve as resolve27 } from "path";
176822
177136
  import { Elysia } from "elysia";
176823
177137
  var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avifInProgress, safeResolve = (path, baseDir) => {
176824
177138
  try {
176825
177139
  const resolved = validateSafePath(path, baseDir);
176826
- if (existsSync20(resolved))
177140
+ if (existsSync21(resolved))
176827
177141
  return resolved;
176828
177142
  return null;
176829
177143
  } catch {
@@ -177248,10 +177562,10 @@ __export(exports_devCert, {
177248
177562
  hasCert: () => hasCert,
177249
177563
  ensureDevCert: () => ensureDevCert
177250
177564
  });
177251
- import { existsSync as existsSync22, mkdirSync as mkdirSync12, readFileSync as readFileSync13, rmSync as rmSync2 } from "fs";
177565
+ import { existsSync as existsSync23, mkdirSync as mkdirSync12, readFileSync as readFileSync13, rmSync as rmSync2 } from "fs";
177252
177566
  import { platform as platform3 } from "os";
177253
177567
  import { join as join21 } from "path";
177254
- var CERT_DIR, CERT_PATH, KEY_PATH, CERT_VALIDITY_DAYS = 365, devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`), devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`), certFilesExist = () => existsSync22(CERT_PATH) && existsSync22(KEY_PATH), isCertExpired = () => {
177568
+ var CERT_DIR, CERT_PATH, KEY_PATH, CERT_VALIDITY_DAYS = 365, devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`), devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`), certFilesExist = () => existsSync23(CERT_PATH) && existsSync23(KEY_PATH), isCertExpired = () => {
177255
177569
  try {
177256
177570
  const certPem = readFileSync13(CERT_PATH, "utf-8");
177257
177571
  const proc = Bun.spawnSync(["openssl", "x509", "-enddate", "-noout"], {
@@ -177485,8 +177799,8 @@ var {file } = globalThis.Bun;
177485
177799
  var handleHTMLPageRequest = (pagePath) => file(pagePath);
177486
177800
  var handleHTMXPageRequest = (pagePath) => file(pagePath);
177487
177801
  // src/core/prepare.ts
177488
- import { existsSync as existsSync21, readdirSync as readdirSync2, readFileSync as readFileSync12 } from "fs";
177489
- import { basename as basename9, join as join20, relative as relative10, resolve as resolve28 } from "path";
177802
+ import { existsSync as existsSync22, readdirSync as readdirSync2, readFileSync as readFileSync12 } from "fs";
177803
+ import { basename as basename11, join as join20, relative as relative10, resolve as resolve28 } from "path";
177490
177804
 
177491
177805
  // src/utils/loadConfig.ts
177492
177806
  import { resolve } from "path";
@@ -177502,6 +177816,7 @@ Expected: export default defineConfig({ ... })`);
177502
177816
  };
177503
177817
 
177504
177818
  // src/core/prepare.ts
177819
+ init_resolveConvention();
177505
177820
  var buildPrewarmDirs = (config) => {
177506
177821
  const dirs = [];
177507
177822
  if (config.svelteDirectory) {
@@ -177522,10 +177837,10 @@ var buildPrewarmDirs = (config) => {
177522
177837
  return dirs;
177523
177838
  };
177524
177839
  var collectPrewarmFiles = async (prewarmDirs) => {
177525
- const { Glob: Glob8 } = await Promise.resolve(globalThis.Bun);
177840
+ const { Glob: Glob9 } = await Promise.resolve(globalThis.Bun);
177526
177841
  const files = [];
177527
177842
  for (const { dir, pattern } of prewarmDirs) {
177528
- const glob = new Glob8(pattern);
177843
+ const glob = new Glob9(pattern);
177529
177844
  const matches = [
177530
177845
  ...glob.scanSync({ absolute: true, cwd: resolve28(dir) })
177531
177846
  ];
@@ -177564,7 +177879,7 @@ var patchManifestIndexes = (manifest, devIndexDir, SRC_URL_PREFIX2) => {
177564
177879
  if (!fileName)
177565
177880
  continue;
177566
177881
  const srcPath = resolve28(devIndexDir, fileName);
177567
- if (!existsSync21(srcPath))
177882
+ if (!existsSync22(srcPath))
177568
177883
  continue;
177569
177884
  const rel = relative10(process.cwd(), srcPath).replace(/\\/g, "/");
177570
177885
  manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
@@ -177609,21 +177924,26 @@ var prepareDev = async (config, buildDir) => {
177609
177924
  const hmrPlugin = hmr2(result.hmrState, result.manifest, moduleHandler);
177610
177925
  const devIndexDir = resolve28(buildDir, "_src_indexes");
177611
177926
  patchManifestIndexes(result.manifest, devIndexDir, SRC_URL_PREFIX2);
177927
+ if (result.conventions)
177928
+ setConventions(result.conventions);
177612
177929
  const { imageOptimizer: imageOptimizer2 } = await Promise.resolve().then(() => (init_imageOptimizer(), exports_imageOptimizer));
177613
177930
  return {
177614
177931
  manifest: result.manifest,
177615
- absolutejs: (app) => addSitemapHook(hmrPlugin(app.use(imageOptimizer2(config.images, buildDir)).use(staticPlugin({ assets: buildDir, prefix: "" }))), buildDir, config.sitemap)
177932
+ absolutejs: (app) => addNotFoundHook(addSitemapHook(hmrPlugin(app.use(imageOptimizer2(config.images, buildDir)).use(staticPlugin({
177933
+ assets: buildDir,
177934
+ prefix: ""
177935
+ }))), buildDir, config.sitemap))
177616
177936
  };
177617
177937
  };
177618
177938
  var loadPrerenderMap = (prerenderDir) => {
177619
177939
  const map = new Map;
177620
- if (!existsSync21(prerenderDir))
177940
+ if (!existsSync22(prerenderDir))
177621
177941
  return map;
177622
177942
  try {
177623
177943
  for (const entry of readdirSync2(prerenderDir)) {
177624
177944
  if (!entry.endsWith(".html"))
177625
177945
  continue;
177626
- const name = basename9(entry, ".html");
177946
+ const name = basename11(entry, ".html");
177627
177947
  const route = name === "index" ? "/" : `/${name}`;
177628
177948
  map.set(route, join20(prerenderDir, entry));
177629
177949
  }
@@ -177636,14 +177956,26 @@ var addSitemapHook = (app, buildDir, sitemapConfig) => app.onStart((started) =>
177636
177956
  return;
177637
177957
  Promise.resolve().then(() => (init_generateSitemap(), exports_generateSitemap)).then(({ generateSitemap: generateSitemap2 }) => generateSitemap2(started.routes, server2.url.origin, buildDir, sitemapConfig)).catch((err) => console.error("[sitemap] Generation failed:", err));
177638
177958
  });
177959
+ var addNotFoundHook = (app) => app.onError(async ({ code }) => {
177960
+ if (code !== "NOT_FOUND")
177961
+ return;
177962
+ const response = await renderFirstNotFound();
177963
+ if (response)
177964
+ return response;
177965
+ });
177639
177966
  var prepare = async (configOrPath) => {
177640
177967
  const config = await loadConfig(configOrPath);
177641
177968
  const nodeEnv = process.env["NODE_ENV"];
177642
- const isDev2 = nodeEnv === "development";
177643
- const buildDir = resolve28(isDev2 ? config.buildDirectory ?? "build" : process.env.ABSOLUTE_BUILD_DIR ?? config.buildDirectory ?? "build");
177644
- if (isDev2)
177969
+ const isDev3 = nodeEnv === "development";
177970
+ const buildDir = resolve28(isDev3 ? config.buildDirectory ?? "build" : process.env.ABSOLUTE_BUILD_DIR ?? config.buildDirectory ?? "build");
177971
+ if (isDev3)
177645
177972
  return prepareDev(config, buildDir);
177646
177973
  const manifest = JSON.parse(readFileSync12(`${buildDir}/manifest.json`, "utf-8"));
177974
+ const conventionsPath = join20(buildDir, "conventions.json");
177975
+ if (existsSync22(conventionsPath)) {
177976
+ const conventions2 = JSON.parse(readFileSync12(conventionsPath, "utf-8"));
177977
+ setConventions(conventions2);
177978
+ }
177647
177979
  const { staticPlugin } = await import("@elysiajs/static");
177648
177980
  const staticFiles = staticPlugin({ assets: buildDir, prefix: "" });
177649
177981
  const prerenderDir = join20(buildDir, "_prerendered");
@@ -177676,11 +178008,11 @@ var prepare = async (configOrPath) => {
177676
178008
  });
177677
178009
  });
177678
178010
  const { imageOptimizer: imageOptimizer3 } = await Promise.resolve().then(() => (init_imageOptimizer(), exports_imageOptimizer));
177679
- const absolutejs2 = (app) => addSitemapHook(app.use(imageOptimizer3(config.images, buildDir)).use(prerenderPlugin).use(staticFiles), buildDir, config.sitemap);
178011
+ const absolutejs2 = (app) => addNotFoundHook(addSitemapHook(app.use(imageOptimizer3(config.images, buildDir)).use(prerenderPlugin).use(staticFiles), buildDir, config.sitemap));
177680
178012
  return { absolutejs: absolutejs2, manifest };
177681
178013
  }
177682
178014
  const { imageOptimizer: imageOptimizer2 } = await Promise.resolve().then(() => (init_imageOptimizer(), exports_imageOptimizer));
177683
- const absolutejs = (app) => addSitemapHook(app.use(imageOptimizer2(config.images, buildDir)).use(staticFiles), buildDir, config.sitemap);
178015
+ const absolutejs = (app) => addNotFoundHook(addSitemapHook(app.use(imageOptimizer2(config.images, buildDir)).use(staticFiles), buildDir, config.sitemap));
177684
178016
  return { absolutejs, manifest };
177685
178017
  };
177686
178018
  // src/plugins/networking.ts
@@ -177980,5 +178312,5 @@ export {
177980
178312
  ANGULAR_INIT_TIMEOUT_MS
177981
178313
  };
177982
178314
 
177983
- //# debugId=787382D8103748BE64756E2164756E21
178315
+ //# debugId=AB59F796F36384F564756E2164756E21
177984
178316
  //# sourceMappingURL=index.js.map