@absolutejs/absolute 0.19.0-beta.1094 → 0.19.0-beta.1096

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
@@ -19651,6 +19651,343 @@ var normalizeSlug = (str) => str.trim().replace(/\s+/g, "-").replace(/[^A-Za-z0-
19651
19651
  return normalizeSlug(str).split(/[-_]/).filter(Boolean).map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1).toLowerCase()).join("");
19652
19652
  };
19653
19653
 
19654
+ // src/utils/resolveConvention.ts
19655
+ import { basename as basename2 } from "path";
19656
+ var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boolean(value) && typeof value === "object", getMap = () => {
19657
+ const value = Reflect.get(globalThis, CONVENTIONS_KEY);
19658
+ if (isConventionsMap(value))
19659
+ return value;
19660
+ const empty = {};
19661
+ return empty;
19662
+ }, derivePageName = (pagePath) => {
19663
+ const base = basename2(pagePath);
19664
+ const dotIndex = base.indexOf(".");
19665
+ const name = dotIndex > 0 ? base.slice(0, dotIndex) : base;
19666
+ return toPascal(name);
19667
+ }, normalizeConventionPageName = (name) => toPascal(name).replace(/\d+$/, ""), hasErrorConvention = (framework) => {
19668
+ const conventions2 = getMap()[framework];
19669
+ if (!conventions2)
19670
+ return false;
19671
+ if (conventions2.defaults?.error)
19672
+ return true;
19673
+ return Object.values(conventions2.pages ?? {}).some((page) => Boolean(page.error));
19674
+ }, resolveErrorConventionPath = (framework, pageName) => {
19675
+ const conventions2 = getMap()[framework];
19676
+ if (!conventions2)
19677
+ return;
19678
+ const exact = conventions2.pages?.[pageName]?.error;
19679
+ if (exact)
19680
+ return exact;
19681
+ const normalizedPageName = normalizeConventionPageName(pageName);
19682
+ for (const [candidate, page] of Object.entries(conventions2.pages ?? {})) {
19683
+ if (normalizeConventionPageName(candidate) === normalizedPageName) {
19684
+ return page.error ?? conventions2.defaults?.error;
19685
+ }
19686
+ }
19687
+ return conventions2.defaults?.error;
19688
+ }, resolveNotFoundConventionPath = (framework) => getMap()[framework]?.defaults?.notFound, setConventions = (map3) => {
19689
+ Reflect.set(globalThis, CONVENTIONS_KEY, map3);
19690
+ }, isDev = () => true, buildErrorProps = (error) => {
19691
+ if (error instanceof Error) {
19692
+ return {
19693
+ name: error.name,
19694
+ message: error.message,
19695
+ ...isDev() && error.stack ? { stack: error.stack } : {}
19696
+ };
19697
+ }
19698
+ return { message: String(error), name: "Error" };
19699
+ }, renderReactError = async (conventionPath, errorProps) => {
19700
+ const { createElement } = await import("react");
19701
+ const { renderToReadableStream } = await import("react-dom/server");
19702
+ const mod = await import(conventionPath);
19703
+ const ErrorComponent = mod.default;
19704
+ if (typeof ErrorComponent !== "function")
19705
+ return null;
19706
+ const element = createElement(ErrorComponent, errorProps);
19707
+ const stream = await renderToReadableStream(element);
19708
+ return new Response(stream, {
19709
+ headers: { "Content-Type": "text/html" },
19710
+ status: 500
19711
+ });
19712
+ }, renderSvelteError = async (conventionPath, errorProps) => {
19713
+ const { render } = await import("svelte/server");
19714
+ const mod = await import(conventionPath);
19715
+ const ErrorComponent = mod.default;
19716
+ if (!ErrorComponent)
19717
+ return null;
19718
+ const { head, body } = render(ErrorComponent, {
19719
+ props: errorProps
19720
+ });
19721
+ const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
19722
+ return new Response(html, {
19723
+ headers: { "Content-Type": "text/html" },
19724
+ status: 500
19725
+ });
19726
+ }, unescapeVueStyles = (ssrBody) => {
19727
+ let styles = "";
19728
+ const body = ssrBody.replace(/<style>([\s\S]*?)<\/style>/g, (_2, css) => {
19729
+ styles += `<style>${css.replace(/&quot;/g, '"').replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">")}</style>`;
19730
+ return "";
19731
+ });
19732
+ return { body, styles };
19733
+ }, renderVueError = async (conventionPath, errorProps) => {
19734
+ const { createSSRApp, h: h2 } = await import("vue");
19735
+ const { renderToString } = await import("vue/server-renderer");
19736
+ const mod = await import(conventionPath);
19737
+ const ErrorComponent = mod.default;
19738
+ if (!ErrorComponent)
19739
+ return null;
19740
+ const app = createSSRApp({
19741
+ render: () => h2(ErrorComponent, errorProps)
19742
+ });
19743
+ const rawBody = await renderToString(app);
19744
+ const { styles, body } = unescapeVueStyles(rawBody);
19745
+ const html = `<!DOCTYPE html><html><head>${styles}</head><body><div id="root">${body}</div></body></html>`;
19746
+ return new Response(html, {
19747
+ headers: { "Content-Type": "text/html" },
19748
+ status: 500
19749
+ });
19750
+ }, renderAngularError = async (conventionPath, errorProps) => {
19751
+ const mod = await import(conventionPath);
19752
+ const renderFn = mod.default;
19753
+ if (typeof renderFn !== "function")
19754
+ return null;
19755
+ const html = renderFn(errorProps);
19756
+ return new Response(html, {
19757
+ headers: { "Content-Type": "text/html" },
19758
+ status: 500
19759
+ });
19760
+ }, escapeHtml = (value) => value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), replaceErrorTokens = (template, errorProps) => template.replace(/\{\{\s*name\s*\}\}/g, escapeHtml(errorProps.name)).replace(/\{\{\s*message\s*\}\}/g, escapeHtml(errorProps.message)).replace(/\{\{\s*stack\s*\}\}/g, errorProps.stack ? escapeHtml(errorProps.stack) : ""), renderHtmlError = async (conventionPath, errorProps) => {
19761
+ const template = await Bun.file(conventionPath).text();
19762
+ const html = replaceErrorTokens(template, errorProps);
19763
+ return new Response(html, {
19764
+ headers: { "Content-Type": "text/html" },
19765
+ status: 500
19766
+ });
19767
+ }, logConventionRenderError = (framework, label, renderError) => {
19768
+ const message = renderError instanceof Error ? renderError.message : "";
19769
+ if (message.includes("Cannot find module") || message.includes("Cannot find package") || message.includes("not found in module")) {
19770
+ console.error(`[SSR] Convention ${label} page for ${framework} failed: missing framework package. Ensure the ${framework} runtime is installed (e.g. bun add ${framework === "react" ? "react react-dom" : framework}).`);
19771
+ return;
19772
+ }
19773
+ console.error(`[SSR] Failed to render ${framework} convention ${label} page:`, renderError);
19774
+ }, renderEmberError = async () => null, renderEmberNotFound = async () => null, ERROR_RENDERERS, tryFrameworkErrorConvention = async (framework, pageName, errorProps, error) => {
19775
+ let conventionPath = resolveErrorConventionPath(framework, pageName);
19776
+ if (!conventionPath && error instanceof Error && error.stack) {
19777
+ for (const match of error.stack.matchAll(/^\s*at\s+([A-Za-z_$][\w$]*)/gm)) {
19778
+ const candidate = match[1];
19779
+ if (!candidate)
19780
+ continue;
19781
+ conventionPath = resolveErrorConventionPath(framework, candidate);
19782
+ if (conventionPath)
19783
+ break;
19784
+ }
19785
+ }
19786
+ if (!conventionPath)
19787
+ return null;
19788
+ const renderer = ERROR_RENDERERS[framework];
19789
+ if (!renderer)
19790
+ return null;
19791
+ try {
19792
+ return await renderer(conventionPath, errorProps);
19793
+ } catch (renderError) {
19794
+ logConventionRenderError(framework, "error", renderError);
19795
+ }
19796
+ return null;
19797
+ }, renderConventionError = async (framework, pageName, error) => {
19798
+ const errorProps = buildErrorProps(error);
19799
+ const frameworkResponse = await tryFrameworkErrorConvention(framework, pageName, errorProps, error);
19800
+ if (frameworkResponse)
19801
+ return frameworkResponse;
19802
+ if (framework !== "html") {
19803
+ const htmlResponse = await tryFrameworkErrorConvention("html", pageName, errorProps, error);
19804
+ if (htmlResponse)
19805
+ return htmlResponse;
19806
+ }
19807
+ return null;
19808
+ }, renderReactNotFound = async (conventionPath) => {
19809
+ const { createElement } = await import("react");
19810
+ const { renderToReadableStream } = await import("react-dom/server");
19811
+ const mod = await import(conventionPath);
19812
+ const NotFoundComponent = mod.default;
19813
+ if (typeof NotFoundComponent !== "function")
19814
+ return null;
19815
+ const element = createElement(NotFoundComponent);
19816
+ const stream = await renderToReadableStream(element);
19817
+ return new Response(stream, {
19818
+ headers: { "Content-Type": "text/html" },
19819
+ status: 404
19820
+ });
19821
+ }, renderSvelteNotFound = async (conventionPath) => {
19822
+ const { render } = await import("svelte/server");
19823
+ const mod = await import(conventionPath);
19824
+ const NotFoundComponent = mod.default;
19825
+ if (!NotFoundComponent)
19826
+ return null;
19827
+ const { head, body } = render(NotFoundComponent);
19828
+ const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
19829
+ return new Response(html, {
19830
+ headers: { "Content-Type": "text/html" },
19831
+ status: 404
19832
+ });
19833
+ }, renderVueNotFound = async (conventionPath) => {
19834
+ const { createSSRApp, h: h2 } = await import("vue");
19835
+ const { renderToString } = await import("vue/server-renderer");
19836
+ const mod = await import(conventionPath);
19837
+ const NotFoundComponent = mod.default;
19838
+ if (!NotFoundComponent)
19839
+ return null;
19840
+ const app = createSSRApp({
19841
+ render: () => h2(NotFoundComponent)
19842
+ });
19843
+ const rawBody = await renderToString(app);
19844
+ const { styles, body } = unescapeVueStyles(rawBody);
19845
+ const html = `<!DOCTYPE html><html><head>${styles}</head><body><div id="root">${body}</div></body></html>`;
19846
+ return new Response(html, {
19847
+ headers: { "Content-Type": "text/html" },
19848
+ status: 404
19849
+ });
19850
+ }, renderAngularNotFound = async (conventionPath) => {
19851
+ const mod = await import(conventionPath);
19852
+ const renderFn = mod.default;
19853
+ if (typeof renderFn !== "function")
19854
+ return null;
19855
+ const html = renderFn();
19856
+ return new Response(html, {
19857
+ headers: { "Content-Type": "text/html" },
19858
+ status: 404
19859
+ });
19860
+ }, renderHtmlNotFound = async (conventionPath) => {
19861
+ const html = await Bun.file(conventionPath).text();
19862
+ return new Response(html, {
19863
+ headers: { "Content-Type": "text/html" },
19864
+ status: 404
19865
+ });
19866
+ }, NOT_FOUND_RENDERERS, renderConventionNotFound = async (framework) => {
19867
+ const conventionPath = resolveNotFoundConventionPath(framework);
19868
+ if (!conventionPath)
19869
+ return null;
19870
+ const renderer = NOT_FOUND_RENDERERS[framework];
19871
+ if (!renderer)
19872
+ return null;
19873
+ try {
19874
+ return await renderer(conventionPath);
19875
+ } catch (renderError) {
19876
+ logConventionRenderError(framework, "not-found", renderError);
19877
+ }
19878
+ return null;
19879
+ }, NOT_FOUND_PRIORITY, renderFirstNotFound = async () => {
19880
+ const renderNext = async (frameworks2) => {
19881
+ const [framework, ...remaining] = frameworks2;
19882
+ if (!framework) {
19883
+ return null;
19884
+ }
19885
+ if (!getMap()[framework]?.defaults?.notFound) {
19886
+ return renderNext(remaining);
19887
+ }
19888
+ const response = await renderConventionNotFound(framework);
19889
+ if (response) {
19890
+ return response;
19891
+ }
19892
+ return renderNext(remaining);
19893
+ };
19894
+ return renderNext(NOT_FOUND_PRIORITY);
19895
+ };
19896
+ var init_resolveConvention = __esm(() => {
19897
+ ERROR_RENDERERS = {
19898
+ angular: renderAngularError,
19899
+ ember: renderEmberError,
19900
+ html: renderHtmlError,
19901
+ react: renderReactError,
19902
+ svelte: renderSvelteError,
19903
+ vue: renderVueError
19904
+ };
19905
+ NOT_FOUND_RENDERERS = {
19906
+ angular: renderAngularNotFound,
19907
+ ember: renderEmberNotFound,
19908
+ html: renderHtmlNotFound,
19909
+ react: renderReactNotFound,
19910
+ svelte: renderSvelteNotFound,
19911
+ vue: renderVueNotFound
19912
+ };
19913
+ NOT_FOUND_PRIORITY = [
19914
+ "react",
19915
+ "svelte",
19916
+ "vue",
19917
+ "angular",
19918
+ "html"
19919
+ ];
19920
+ });
19921
+
19922
+ // src/utils/spaRouteManifest.ts
19923
+ import { basename as basename3 } from "path";
19924
+ var SPA_ROUTES_KEY = "__absoluteSpaRoutes", setSpaRouteManifest = (hosts) => {
19925
+ Reflect.set(globalThis, SPA_ROUTES_KEY, hosts);
19926
+ }, getSpaRouteManifest = () => {
19927
+ const value = Reflect.get(globalThis, SPA_ROUTES_KEY);
19928
+ return Array.isArray(value) ? value : [];
19929
+ }, normalizePath = (path) => {
19930
+ const withLeadingSlash = path.startsWith("/") ? path : `/${path}`;
19931
+ const trimmed = withLeadingSlash.replace(/\/+$/, "");
19932
+ return trimmed || "/";
19933
+ }, fullRoutePath = (baseHref, routePath) => {
19934
+ const base = normalizePath(baseHref);
19935
+ const route = normalizePath(routePath);
19936
+ if (base !== "/" && (route === base || route.startsWith(`${base}/`))) {
19937
+ return route;
19938
+ }
19939
+ if (base === "/")
19940
+ return route;
19941
+ return normalizePath(`${base}/${route.replace(/^\/+/, "")}`);
19942
+ }, routePattern = (path) => {
19943
+ const segments = normalizePath(path).split("/").filter(Boolean);
19944
+ let expression = "^";
19945
+ for (const segment of segments) {
19946
+ if (segment === "*" || segment === "**") {
19947
+ expression += "(?:/.*)?";
19948
+ continue;
19949
+ }
19950
+ const parameter = /^:[A-Za-z_$][A-Za-z0-9_$]*(?:\((.*)\))?(\?)?$/.exec(segment);
19951
+ if (parameter) {
19952
+ const valuePattern = parameter[1] || "[^/]+";
19953
+ expression += parameter[2] ? `(?:/${valuePattern})?` : `/${valuePattern}`;
19954
+ continue;
19955
+ }
19956
+ expression += `/${segment.replace(/[.+?^${}()|[\]\\]/g, "\\$&")}`;
19957
+ }
19958
+ return new RegExp(`${expression || "^/"}/?$`);
19959
+ }, sourcePageName = (sourceFile) => basename3(sourceFile).replace(/\.[^.]+$/, "").toLowerCase(), isKnownSpaRoute = (framework, pageName, request) => {
19960
+ if (!request)
19961
+ return true;
19962
+ let pathname;
19963
+ try {
19964
+ pathname = normalizePath(new URL(request.url).pathname);
19965
+ } catch {
19966
+ return true;
19967
+ }
19968
+ const hosts = getSpaRouteManifest().filter((host) => {
19969
+ if (host.framework !== framework)
19970
+ return false;
19971
+ if (sourcePageName(host.sourceFile) !== pageName.toLowerCase())
19972
+ return false;
19973
+ const base = normalizePath(host.baseHref);
19974
+ return base === "/" || pathname === base || pathname.startsWith(`${base}/`);
19975
+ });
19976
+ if (hosts.length === 0)
19977
+ return true;
19978
+ return hosts.some((host) => host.routes.some((route) => routePattern(fullRoutePath(host.baseHref, route.path)).test(pathname)));
19979
+ }, renderSpaNotFound = async (framework, pageName, request) => {
19980
+ if (isKnownSpaRoute(framework, pageName, request))
19981
+ return null;
19982
+ return await renderFirstNotFound() ?? new Response("Not found", {
19983
+ headers: { "Content-Type": "text/plain" },
19984
+ status: 404
19985
+ });
19986
+ };
19987
+ var init_spaRouteManifest = __esm(() => {
19988
+ init_resolveConvention();
19989
+ });
19990
+
19654
19991
  // src/utils/getDurationString.ts
19655
19992
  var getDurationString = (duration3) => {
19656
19993
  let durationString;
@@ -19925,7 +20262,7 @@ var init_devRouteRegistrationCallsite = __esm(() => {
19925
20262
  });
19926
20263
 
19927
20264
  // src/utils/normalizePath.ts
19928
- var normalizePath = (path) => path.replace(/\\/g, "/");
20265
+ var normalizePath2 = (path) => path.replace(/\\/g, "/");
19929
20266
 
19930
20267
  // src/build/generateManifest.ts
19931
20268
  var exports_generateManifest = {};
@@ -19965,8 +20302,8 @@ var getManifestKey = (folder, pascalName, isClientComponent, isReact, isVue, isS
19965
20302
  return stem.slice(0, -hashSuffix.length);
19966
20303
  return stem;
19967
20304
  }, generateManifest = (outputs, buildPath) => outputs.reduce((manifest, artifact) => {
19968
- const normalizedArtifactPath = normalizePath(artifact.path);
19969
- const normalizedBuildPath = normalizePath(buildPath);
20305
+ const normalizedArtifactPath = normalizePath2(artifact.path);
20306
+ const normalizedBuildPath = normalizePath2(buildPath);
19970
20307
  let relative6 = normalizedArtifactPath.startsWith(normalizedBuildPath) ? normalizedArtifactPath.slice(normalizedBuildPath.length) : normalizedArtifactPath;
19971
20308
  relative6 = relative6.replace(/^\/+/, "");
19972
20309
  const segments = relative6.split("/");
@@ -20091,7 +20428,7 @@ var init_verifyAngularCoreUniqueness = __esm(() => {
20091
20428
  // src/build/generateReactIndexes.ts
20092
20429
  import { existsSync as existsSync10, mkdirSync as mkdirSync2 } from "fs";
20093
20430
  import { readdir as readdir3, rm, writeFile } from "fs/promises";
20094
- import { basename as basename3, join as join14, relative as relative6, resolve as resolve14, sep } from "path";
20431
+ import { basename as basename4, join as join14, relative as relative6, resolve as resolve14, sep } from "path";
20095
20432
  var {Glob: Glob2 } = globalThis.Bun;
20096
20433
  var indexContentCache, resolveDevClientDir = () => {
20097
20434
  const projectRoot = process.cwd();
@@ -20115,7 +20452,7 @@ var indexContentCache, resolveDevClientDir = () => {
20115
20452
  continue;
20116
20453
  files.push(file2);
20117
20454
  }
20118
- const currentPageNames = new Set(files.map((file2) => basename3(file2).split(".")[0]));
20455
+ const currentPageNames = new Set(files.map((file2) => basename4(file2).split(".")[0]));
20119
20456
  const emptyStringArray = [];
20120
20457
  const existingIndexes = await readdir3(reactIndexesDirectory).catch(() => emptyStringArray);
20121
20458
  const staleIndexes = existingIndexes.filter((indexFile) => {
@@ -20132,7 +20469,7 @@ var indexContentCache, resolveDevClientDir = () => {
20132
20469
  }
20133
20470
  const pagesRelPath = relative6(resolve14(reactIndexesDirectory), resolve14(reactPagesDirectory)).split(sep).join("/");
20134
20471
  const promises = files.map(async (file2) => {
20135
- const fileName = basename3(file2);
20472
+ const fileName = basename4(file2);
20136
20473
  const componentName = fileName.split(".")[0];
20137
20474
  const pascalComponentName = toPascal(componentName);
20138
20475
  const hmrPreamble = isDev2 ? [
@@ -20502,11 +20839,11 @@ var init_outputLogs = __esm(() => {
20502
20839
  });
20503
20840
 
20504
20841
  // src/build/scanConventions.ts
20505
- import { basename as basename4 } from "path";
20842
+ import { basename as basename5 } from "path";
20506
20843
  var {Glob: Glob3 } = globalThis.Bun;
20507
20844
  import { existsSync as existsSync11 } from "fs";
20508
20845
  var CONVENTION_RE, classifyFile = (file2, pageFiles, defaults, pages) => {
20509
- const fileName = basename4(file2);
20846
+ const fileName = basename5(file2);
20510
20847
  const match = CONVENTION_RE.exec(fileName);
20511
20848
  if (!match) {
20512
20849
  pageFiles.push(file2);
@@ -20675,6 +21012,10 @@ var init_scanRouteRegistrations = __esm(() => {
20675
21012
  });
20676
21013
 
20677
21014
  // src/angular/staticAnalyzeSpaRoutes.ts
21015
+ var exports_staticAnalyzeSpaRoutes = {};
21016
+ __export(exports_staticAnalyzeSpaRoutes, {
21017
+ analyzeAngularSpaRoutes: () => analyzeAngularSpaRoutes
21018
+ });
20678
21019
  import { existsSync as existsSync12, promises as fs } from "fs";
20679
21020
  import { join as join16 } from "path";
20680
21021
  import ts3 from "typescript";
@@ -20773,8 +21114,6 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
20773
21114
  extractRoutePaths(childrenLiteral, joined, sitemapExcluded, out);
20774
21115
  continue;
20775
21116
  }
20776
- if (redirected)
20777
- continue;
20778
21117
  if (joined === "")
20779
21118
  continue;
20780
21119
  out.push({
@@ -20903,6 +21242,10 @@ var init_staticAnalyzeSpaRoutes = __esm(() => {
20903
21242
  });
20904
21243
 
20905
21244
  // src/react/staticAnalyzeSpaRoutes.ts
21245
+ var exports_staticAnalyzeSpaRoutes2 = {};
21246
+ __export(exports_staticAnalyzeSpaRoutes2, {
21247
+ analyzeReactSpaRoutes: () => analyzeReactSpaRoutes
21248
+ });
20906
21249
  import { existsSync as existsSync13, promises as fs2 } from "fs";
20907
21250
  import { join as join17 } from "path";
20908
21251
  import ts4 from "typescript";
@@ -20999,8 +21342,6 @@ var DYNAMIC_SEGMENT_PATTERN2, pathHasDynamic2 = (path) => path.split("/").some((
20999
21342
  extractRouteEntries(childrenLiteral, joined, out);
21000
21343
  continue;
21001
21344
  }
21002
- if (redirected)
21003
- continue;
21004
21345
  if (!isIndex && pathSegment === null)
21005
21346
  continue;
21006
21347
  if (joined === "")
@@ -21069,8 +21410,8 @@ var DYNAMIC_SEGMENT_PATTERN2, pathHasDynamic2 = (path) => path.split("/").some((
21069
21410
  }
21070
21411
  if (!routesArray)
21071
21412
  return null;
21072
- const basename5 = readBasenameFromOptions(call.arguments[1]);
21073
- const baseHref = basename5 ? `${basename5.replace(/\/+$/, "")}/` : "/";
21413
+ const basename6 = readBasenameFromOptions(call.arguments[1]);
21414
+ const baseHref = basename6 ? `${basename6.replace(/\/+$/, "")}/` : "/";
21074
21415
  const routes = [];
21075
21416
  extractRouteEntries(routesArray, "", routes);
21076
21417
  return { baseHref, routes, sourceFile: filePath };
@@ -21113,6 +21454,10 @@ var init_staticAnalyzeSpaRoutes2 = __esm(() => {
21113
21454
  });
21114
21455
 
21115
21456
  // src/svelte/staticAnalyzeSpaRoutes.ts
21457
+ var exports_staticAnalyzeSpaRoutes3 = {};
21458
+ __export(exports_staticAnalyzeSpaRoutes3, {
21459
+ analyzeSvelteSpaRoutes: () => analyzeSvelteSpaRoutes
21460
+ });
21116
21461
  import { existsSync as existsSync14, promises as fs3 } from "fs";
21117
21462
  import { join as join18 } from "path";
21118
21463
  var DYNAMIC_SEGMENT_PATTERN3, pathHasDynamic3 = (path) => path.split("/").some((seg) => DYNAMIC_SEGMENT_PATTERN3.test(seg) || seg === "**"), joinSegments3 = (parent, child) => {
@@ -21217,6 +21562,10 @@ var init_staticAnalyzeSpaRoutes3 = __esm(() => {
21217
21562
  });
21218
21563
 
21219
21564
  // src/vue/staticAnalyzeSpaRoutes.ts
21565
+ var exports_staticAnalyzeSpaRoutes4 = {};
21566
+ __export(exports_staticAnalyzeSpaRoutes4, {
21567
+ analyzeVueSpaRoutes: () => analyzeVueSpaRoutes
21568
+ });
21220
21569
  import { existsSync as existsSync15, promises as fs4 } from "fs";
21221
21570
  import { join as join19 } from "path";
21222
21571
  import ts5 from "typescript";
@@ -21278,6 +21627,7 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
21278
21627
  let pathSegment = null;
21279
21628
  let redirected = false;
21280
21629
  let sitemapExcluded = false;
21630
+ let alias = null;
21281
21631
  let childrenLiteral = null;
21282
21632
  for (const property of element.properties) {
21283
21633
  const key = readPropertyKey3(property);
@@ -21287,6 +21637,8 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
21287
21637
  continue;
21288
21638
  if (key === "path") {
21289
21639
  pathSegment = readStringLiteral3(property.initializer);
21640
+ } else if (key === "alias") {
21641
+ alias = readStringLiteral3(property.initializer);
21290
21642
  } else if (key === "redirect") {
21291
21643
  redirected = true;
21292
21644
  } else if (key === "children" && ts5.isArrayLiteralExpression(property.initializer)) {
@@ -21311,8 +21663,6 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
21311
21663
  extractRouteEntries2(childrenLiteral, joined, out);
21312
21664
  continue;
21313
21665
  }
21314
- if (redirected)
21315
- continue;
21316
21666
  if (joined === "")
21317
21667
  continue;
21318
21668
  out.push({
@@ -21321,7 +21671,34 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
21321
21671
  redirected,
21322
21672
  sitemapExcluded
21323
21673
  });
21674
+ if (alias) {
21675
+ out.push({
21676
+ dynamic: pathHasDynamic4(alias),
21677
+ path: alias,
21678
+ redirected: false,
21679
+ sitemapExcluded: true
21680
+ });
21681
+ }
21324
21682
  }
21683
+ }, findDefineRoutesArray = (sf) => {
21684
+ let found = null;
21685
+ const visit = (node) => {
21686
+ if (found)
21687
+ return;
21688
+ if (ts5.isCallExpression(node) && ts5.isIdentifier(node.expression) && node.expression.text === "defineRoutes" && node.arguments[0] && ts5.isArrayLiteralExpression(node.arguments[0])) {
21689
+ found = node.arguments[0];
21690
+ return;
21691
+ }
21692
+ ts5.forEachChild(node, visit);
21693
+ };
21694
+ ts5.forEachChild(sf, visit);
21695
+ return found;
21696
+ }, inferBaseHref = (routes) => {
21697
+ const firstSegments = routes.map((route) => route.path.split("/").filter(Boolean)[0]).filter((segment) => Boolean(segment));
21698
+ const first = firstSegments[0];
21699
+ if (!first || firstSegments.some((segment) => segment !== first))
21700
+ return "/";
21701
+ return `/${first}/`;
21325
21702
  }, findCreateRouterCall = (sf) => {
21326
21703
  let found = null;
21327
21704
  const visit = (node) => {
@@ -21395,24 +21772,19 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
21395
21772
  return null;
21396
21773
  analysisSource = script;
21397
21774
  }
21398
- if (!analysisSource.includes("createRouter"))
21775
+ if (!analysisSource.includes("createRouter") && !analysisSource.includes("defineRoutes"))
21399
21776
  return null;
21400
21777
  const sf = ts5.createSourceFile(filePath, analysisSource, ts5.ScriptTarget.Latest, true, ts5.ScriptKind.TS);
21401
- if (!importsSymbolFrom2(sf, "createRouter", "vue-router"))
21402
- return null;
21403
- const call = findCreateRouterCall(sf);
21404
- if (!call)
21405
- return null;
21406
- const optionsArg = call.arguments[0];
21407
- if (!optionsArg)
21408
- return null;
21409
- const routesArray = readRoutesFromCreateRouterOptions(sf, optionsArg);
21778
+ const defineRoutesArray = findDefineRoutesArray(sf);
21779
+ const call = importsSymbolFrom2(sf, "createRouter", "vue-router") ? findCreateRouterCall(sf) : null;
21780
+ const optionsArg = call?.arguments[0];
21781
+ const routesArray = defineRoutesArray ?? (optionsArg ? readRoutesFromCreateRouterOptions(sf, optionsArg) : null);
21410
21782
  if (!routesArray)
21411
21783
  return null;
21412
- const base = findCreateWebHistoryBase(sf) ?? "/";
21413
- const baseHref = base.endsWith("/") ? base : `${base}/`;
21414
21784
  const routes = [];
21415
21785
  extractRouteEntries2(routesArray, "", routes);
21786
+ const base = findCreateWebHistoryBase(sf) ?? inferBaseHref(routes);
21787
+ const baseHref = base.endsWith("/") ? base : `${base}/`;
21416
21788
  return { baseHref, routes, sourceFile: filePath };
21417
21789
  }, walkSourceFiles2 = async (dir, out) => {
21418
21790
  let items;
@@ -21693,7 +22065,7 @@ var scanCssEntryPoints = async (dir, ignore) => {
21693
22065
  const entryPaths = [];
21694
22066
  const glob = new Glob4("**/*.{css,scss,sass,less,styl,stylus}");
21695
22067
  for await (const file2 of glob.scan({ absolute: true, cwd: dir })) {
21696
- const normalized = normalizePath(file2);
22068
+ const normalized = normalizePath2(file2);
21697
22069
  if (isStyleModulePath(normalized) || ignore?.some((pattern) => normalized.includes(pattern)))
21698
22070
  continue;
21699
22071
  entryPaths.push(file2);
@@ -22320,7 +22692,7 @@ var init_angularLinkerPlugin = __esm(() => {
22320
22692
 
22321
22693
  // src/build/externalAssetPlugin.ts
22322
22694
  import { copyFileSync, existsSync as existsSync22, mkdirSync as mkdirSync6, statSync } from "fs";
22323
- import { basename as basename5, dirname as dirname12, join as join24, resolve as resolve18 } from "path";
22695
+ import { basename as basename6, dirname as dirname12, join as join24, resolve as resolve18 } from "path";
22324
22696
  var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
22325
22697
  name: "absolute-external-asset",
22326
22698
  setup(bld) {
@@ -22345,7 +22717,7 @@ var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
22345
22717
  continue;
22346
22718
  if (!statSync(assetPath).isFile())
22347
22719
  continue;
22348
- const targetPath = join24(outDir, basename5(assetPath));
22720
+ const targetPath = join24(outDir, basename6(assetPath));
22349
22721
  if (existsSync22(targetPath))
22350
22722
  continue;
22351
22723
  mkdirSync6(dirname12(targetPath), { recursive: true });
@@ -22358,7 +22730,7 @@ var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
22358
22730
  var init_externalAssetPlugin = () => {};
22359
22731
 
22360
22732
  // src/build/islandRegistryTransform.ts
22361
- import { basename as basename6 } from "path";
22733
+ import { basename as basename7 } from "path";
22362
22734
  import ts6 from "typescript";
22363
22735
  var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts6.isIdentifier(name) || ts6.isStringLiteral(name) ? name.text : null, isIslandRegistryHelperImport2 = (source) => source === "@absolutejs/absolute/islands" || source.endsWith("/islands") || source.endsWith("/core/islands"), collectRegistryFactory = (sourceFile) => {
22364
22736
  const factoryNames = new Set;
@@ -22522,7 +22894,7 @@ var VALID_FRAMEWORKS, getObjectPropertyName2 = (name) => ts6.isIdentifier(name)
22522
22894
  }
22523
22895
  return "ts";
22524
22896
  }, createIslandRegistryDefinitionPlugin = (info) => {
22525
- const registryBase = basename6(info.resolvedRegistryPath).replace(/\.[mc]?[jt]sx?$/, "");
22897
+ const registryBase = basename7(info.resolvedRegistryPath).replace(/\.[mc]?[jt]sx?$/, "");
22526
22898
  const filter = new RegExp(`(^|[/\\\\])${escapeRegExp(registryBase)}\\.[mc]?[jt]sx?$`);
22527
22899
  return {
22528
22900
  name: "absolute-island-registry-definitions",
@@ -22839,7 +23211,7 @@ __export(exports_commonAncestor, {
22839
23211
  var commonAncestor = (paths, fallback) => {
22840
23212
  if (paths.length === 0)
22841
23213
  return fallback;
22842
- const segmentsList = paths.map((p2) => normalizePath(p2).split("/"));
23214
+ const segmentsList = paths.map((p2) => normalizePath2(p2).split("/"));
22843
23215
  const [first] = segmentsList;
22844
23216
  if (!first)
22845
23217
  return fallback;
@@ -23017,7 +23389,7 @@ import { resolve as resolve21, relative as relative9 } from "path";
23017
23389
  var validateSafePath = (targetPath, baseDirectory) => {
23018
23390
  const absoluteBase = resolve21(baseDirectory);
23019
23391
  const absoluteTarget = resolve21(baseDirectory, targetPath);
23020
- const relativePath = normalizePath(relative9(absoluteBase, absoluteTarget));
23392
+ const relativePath = normalizePath2(relative9(absoluteBase, absoluteTarget));
23021
23393
  if (relativePath.startsWith("../") || relativePath === "..") {
23022
23394
  throw new Error(`Unsafe path: ${targetPath}`);
23023
23395
  }
@@ -23328,7 +23700,7 @@ var init_scanAngularHandlerCalls = __esm(() => {
23328
23700
 
23329
23701
  // src/build/scanAngularPageRoutes.ts
23330
23702
  import { readdirSync as readdirSync4, readFileSync as readFileSync19 } from "fs";
23331
- import { basename as basename7, join as join30 } from "path";
23703
+ import { basename as basename8, join as join30 } from "path";
23332
23704
  import ts9 from "typescript";
23333
23705
  var SOURCE_EXTENSIONS4, SKIP_DIRS4, hasSourceExtension4 = (filePath) => {
23334
23706
  const idx = filePath.lastIndexOf(".");
@@ -23338,7 +23710,7 @@ var SOURCE_EXTENSIONS4, SKIP_DIRS4, hasSourceExtension4 = (filePath) => {
23338
23710
  }, isPageFile = (filePath) => {
23339
23711
  if (!hasSourceExtension4(filePath))
23340
23712
  return false;
23341
- const base = basename7(filePath);
23713
+ const base = basename8(filePath);
23342
23714
  if (base.endsWith(".d.ts"))
23343
23715
  return false;
23344
23716
  if (base.endsWith(".test.ts"))
@@ -23404,7 +23776,7 @@ var SOURCE_EXTENSIONS4, SKIP_DIRS4, hasSourceExtension4 = (filePath) => {
23404
23776
  continue;
23405
23777
  }
23406
23778
  const hasRoutes = hasTopLevelRoutesExport(source, file2);
23407
- const base = basename7(file2).replace(/\.[cm]?[tj]sx?$/, "");
23779
+ const base = basename8(file2).replace(/\.[cm]?[tj]sx?$/, "");
23408
23780
  const manifestKey = toPascal(base);
23409
23781
  out.push({
23410
23782
  hasRoutes,
@@ -23619,7 +23991,7 @@ import { mkdir as mkdir5, stat as stat2 } from "fs/promises";
23619
23991
  import {
23620
23992
  dirname as dirname15,
23621
23993
  join as join32,
23622
- basename as basename8,
23994
+ basename as basename9,
23623
23995
  extname as extname6,
23624
23996
  resolve as resolve22,
23625
23997
  relative as relative10,
@@ -23755,7 +24127,7 @@ var resolveDevClientDir2 = () => {
23755
24127
  const transpiledClient = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedClient) : preprocessedClient;
23756
24128
  const rawRel = dirname15(relative10(svelteRoot, src)).replace(/\\/g, "/");
23757
24129
  const relDir = rawRel.startsWith("..") ? `_ext/${relative10(process.cwd(), dirname15(src)).replace(/\\/g, "/")}` : rawRel;
23758
- const baseName = basename8(src).replace(/\.svelte(\.(ts|js))?$/, "");
24130
+ const baseName = basename9(src).replace(/\.svelte(\.(ts|js))?$/, "");
23759
24131
  const importPaths = Array.from(transpiledServer.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
23760
24132
  const resolvedModuleImports = await Promise.all(importPaths.map((importPath) => resolveRelativeModule2(importPath, src)));
23761
24133
  const resolvedImports = await Promise.all(importPaths.map((importPath) => resolveSvelte(importPath, src)));
@@ -23867,7 +24239,7 @@ var resolveDevClientDir2 = () => {
23867
24239
  const roots = await Promise.all(entryPoints.map(build2));
23868
24240
  await Promise.all(roots.map(async ({ client: client2, hasAwaitSlot }) => {
23869
24241
  const relClientDir = dirname15(relative10(clientDir, client2));
23870
- const name = basename8(client2, extname6(client2));
24242
+ const name = basename9(client2, extname6(client2));
23871
24243
  const indexPath = join32(indexDir, relClientDir, `${name}.js`);
23872
24244
  const importRaw = relative10(dirname15(indexPath), client2).split(sep2).join("/");
23873
24245
  const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
@@ -23955,7 +24327,7 @@ if (typeof window !== "undefined") {
23955
24327
  svelteClientPaths: roots.map(({ client: client2 }) => client2),
23956
24328
  svelteIndexPaths: roots.map(({ client: client2 }) => {
23957
24329
  const rel = dirname15(relative10(clientDir, client2));
23958
- return join32(indexDir, rel, basename8(client2));
24330
+ return join32(indexDir, rel, basename9(client2));
23959
24331
  }),
23960
24332
  svelteServerPaths: roots.map(({ ssr }) => ssr)
23961
24333
  };
@@ -24409,9 +24781,23 @@ export const setupApp = async (app, ctx) => {
24409
24781
  if (ctx.isServer) {
24410
24782
  await router.push(ctx.url);
24411
24783
  }
24412
- await router.isReady();
24413
- if (__absoluteUserSetupApp__) {
24414
- await __absoluteUserSetupApp__(app, { ...ctx, router });
24784
+ await router.isReady();
24785
+ if (__absoluteUserSetupApp__) {
24786
+ await __absoluteUserSetupApp__(app, { ...ctx, router });
24787
+ }
24788
+ const currentRouteMatched = router.currentRoute.value.matched.length > 0;
24789
+ if (!currentRouteMatched) {
24790
+ if (ctx.isServer) {
24791
+ ctx.setNotFound();
24792
+ } else {
24793
+ window.location.assign(ctx.url);
24794
+ }
24795
+ return;
24796
+ }
24797
+ if (!ctx.isServer) {
24798
+ router.afterEach((to) => {
24799
+ if (to.matched.length === 0) window.location.assign(to.fullPath);
24800
+ });
24415
24801
  }
24416
24802
  };
24417
24803
  `;
@@ -24436,7 +24822,7 @@ __export(exports_compileVue, {
24436
24822
  import { existsSync as existsSync25, readFileSync as readFileSync22, realpathSync as realpathSync2 } from "fs";
24437
24823
  import { mkdir as mkdir6 } from "fs/promises";
24438
24824
  import {
24439
- basename as basename9,
24825
+ basename as basename10,
24440
24826
  dirname as dirname16,
24441
24827
  isAbsolute as isAbsolute4,
24442
24828
  join as join33,
@@ -24558,7 +24944,7 @@ var resolveDevClientDir3 = () => {
24558
24944
  return cachedResult;
24559
24945
  const relativeFilePath = relative11(vueRootDir, sourceFilePath).replace(/\\/g, "/");
24560
24946
  const relativeWithoutExtension = relativeFilePath.replace(/\.vue$/, "");
24561
- const fileBaseName = basename9(sourceFilePath, ".vue");
24947
+ const fileBaseName = basename10(sourceFilePath, ".vue");
24562
24948
  const componentId = toKebab(fileBaseName);
24563
24949
  const rawSourceContent = await file3(sourceFilePath).text();
24564
24950
  const sourceContent = isEntryPoint ? addAutoRouterSetupApp(rawSourceContent) : rawSourceContent;
@@ -24768,7 +25154,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
24768
25154
  spaRoutes: result.spaRoutes
24769
25155
  };
24770
25156
  }
24771
- const entryBaseName = basename9(entryPath, ".vue");
25157
+ const entryBaseName = basename10(entryPath, ".vue");
24772
25158
  const indexOutputFile = join33(indexOutputDir, `${entryBaseName}.js`);
24773
25159
  const clientOutputFile = join33(clientOutputDir, relative11(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
24774
25160
  await mkdir6(dirname16(indexOutputFile), { recursive: true });
@@ -24836,6 +25222,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
24836
25222
  " await setupAppHook(app, {",
24837
25223
  " isServer: false,",
24838
25224
  " router: null,",
25225
+ " setNotFound: () => {},",
24839
25226
  " setRedirect: () => {},",
24840
25227
  " url: clientUrl",
24841
25228
  " });",
@@ -25466,7 +25853,7 @@ __export(exports_compileAngular, {
25466
25853
  compileAngular: () => compileAngular
25467
25854
  });
25468
25855
  import { existsSync as existsSync26, readFileSync as readFileSync23, promises as fs5 } from "fs";
25469
- import { join as join34, basename as basename10, sep as sep3, dirname as dirname17, resolve as resolve24, relative as relative12 } from "path";
25856
+ import { join as join34, basename as basename11, sep as sep3, dirname as dirname17, resolve as resolve24, relative as relative12 } from "path";
25470
25857
  var {Glob: Glob6 } = globalThis.Bun;
25471
25858
  import ts12 from "typescript";
25472
25859
  var traceAngularPhase = async (name, fn2, metadata2) => {
@@ -25841,7 +26228,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
25841
26228
  const originalGetDefaultLibFileName = host.getDefaultLibFileName;
25842
26229
  host.getDefaultLibFileName = (opts) => {
25843
26230
  const fileName = originalGetDefaultLibFileName ? originalGetDefaultLibFileName(opts) : "lib.d.ts";
25844
- return basename10(fileName);
26231
+ return basename11(fileName);
25845
26232
  };
25846
26233
  const originalGetSourceFile = host.getSourceFile;
25847
26234
  host.getSourceFile = (fileName, languageVersion, onError) => {
@@ -26274,7 +26661,7 @@ ${fields}
26274
26661
  };
26275
26662
  const toOutputPath = (sourcePath) => {
26276
26663
  const inputDir = dirname17(sourcePath);
26277
- const fileBase = basename10(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
26664
+ const fileBase = basename11(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
26278
26665
  if (inputDir === outDir || inputDir.startsWith(`${outDir}${sep3}`)) {
26279
26666
  return join34(inputDir, fileBase);
26280
26667
  }
@@ -26330,7 +26717,7 @@ ${fields}
26330
26717
  const inputDir2 = dirname17(resolved);
26331
26718
  const relativeDir2 = inputDir2.startsWith(baseDir) ? inputDir2.substring(baseDir.length + 1) : inputDir2;
26332
26719
  const targetDir2 = join34(outDir, relativeDir2);
26333
- const targetPath2 = join34(targetDir2, basename10(resolved));
26720
+ const targetPath2 = join34(targetDir2, basename11(resolved));
26334
26721
  await fs5.mkdir(targetDir2, { recursive: true });
26335
26722
  await fs5.copyFile(resolved, targetPath2);
26336
26723
  allOutputs.push(targetPath2);
@@ -26345,7 +26732,7 @@ ${fields}
26345
26732
  const inlined = await inlineResources(sourceCode, dirname17(actualPath), stylePreprocessors);
26346
26733
  sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname17(actualPath)).source;
26347
26734
  const inputDir = dirname17(actualPath);
26348
- const fileBase = basename10(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
26735
+ const fileBase = basename11(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
26349
26736
  const targetPath = toOutputPath(actualPath);
26350
26737
  const targetDir = dirname17(targetPath);
26351
26738
  const relativeDir = relative12(outDir, targetDir).replace(/\\/g, "/");
@@ -26438,7 +26825,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
26438
26825
  let outputs = hmr ? await traceAngularPhase("jit/compile-entry", compileEntry, {
26439
26826
  entry: resolvedEntry
26440
26827
  }) : aotOutputs;
26441
- const fileBase = basename10(resolvedEntry).replace(/\.[tj]s$/, "");
26828
+ const fileBase = basename11(resolvedEntry).replace(/\.[tj]s$/, "");
26442
26829
  const jsName = `${fileBase}.js`;
26443
26830
  const compiledFallbackPaths = [
26444
26831
  join34(compiledRoot, relativeEntry),
@@ -29961,11 +30348,11 @@ __export(exports_compileEmber, {
29961
30348
  compileEmberFile: () => compileEmberFile,
29962
30349
  compileEmber: () => compileEmber,
29963
30350
  clearEmberCompilerCache: () => clearEmberCompilerCache,
29964
- basename: () => basename11
30351
+ basename: () => basename12
29965
30352
  });
29966
30353
  import { existsSync as existsSync28 } from "fs";
29967
30354
  import { mkdir as mkdir7, rm as rm4 } from "fs/promises";
29968
- import { basename as basename11, dirname as dirname19, extname as extname8, join as join35, resolve as resolve26 } from "path";
30355
+ import { basename as basename12, dirname as dirname19, extname as extname8, join as join35, resolve as resolve26 } from "path";
29969
30356
  var {build: bunBuild2, Transpiler: Transpiler4, write: write4, file: file4 } = globalThis.Bun;
29970
30357
  var cachedPreprocessor = null, getPreprocessor = async () => {
29971
30358
  if (cachedPreprocessor)
@@ -30131,7 +30518,7 @@ export default PageComponent;
30131
30518
  preprocessed = rewriteTemplateEvalToScope(result.code);
30132
30519
  }
30133
30520
  const transpiled = transpiler5.transformSync(preprocessed);
30134
- const baseName = basename11(resolvedEntry).replace(/\.(gjs|gts|ts|js)$/, "");
30521
+ const baseName = basename12(resolvedEntry).replace(/\.(gjs|gts|ts|js)$/, "");
30135
30522
  const tmpDir = join35(compiledRoot, "_tmp");
30136
30523
  const serverDir = join35(compiledRoot, "server");
30137
30524
  const clientDir = join35(compiledRoot, "client");
@@ -30700,7 +31087,7 @@ import {
30700
31087
  statSync as statSync3,
30701
31088
  writeFileSync as writeFileSync9
30702
31089
  } from "fs";
30703
- import { basename as basename12, dirname as dirname20, extname as extname9, join as join40, relative as relative14, resolve as resolve28 } from "path";
31090
+ import { basename as basename13, dirname as dirname20, extname as extname9, join as join40, relative as relative14, resolve as resolve28 } from "path";
30704
31091
  import { cwd, env as env3, exit } from "process";
30705
31092
  var {build: bunBuild7, Glob: Glob8 } = globalThis.Bun;
30706
31093
  var isDev2, isBuildTraceEnabled = () => {
@@ -30880,7 +31267,7 @@ var isDev2, isBuildTraceEnabled = () => {
30880
31267
  const svelteIndexDir = join40(getFrameworkGeneratedDir("svelte"), "indexes");
30881
31268
  const sveltePageEntries = svelteEntries.filter((file5) => resolve28(file5).startsWith(resolve28(sveltePagesPath)));
30882
31269
  for (const entry of sveltePageEntries) {
30883
- const name = basename12(entry).replace(/\.svelte(\.(ts|js))?$/, "");
31270
+ const name = basename13(entry).replace(/\.svelte(\.(ts|js))?$/, "");
30884
31271
  const indexFile = join40(svelteIndexDir, "pages", `${name}.js`);
30885
31272
  if (!existsSync30(indexFile))
30886
31273
  continue;
@@ -30893,7 +31280,7 @@ var isDev2, isBuildTraceEnabled = () => {
30893
31280
  const vueIndexDir = join40(getFrameworkGeneratedDir("vue"), "indexes");
30894
31281
  const vuePageEntries = vueEntries.filter((file5) => resolve28(file5).startsWith(resolve28(vuePagesPath)));
30895
31282
  for (const entry of vuePageEntries) {
30896
- const name = basename12(entry, ".vue");
31283
+ const name = basename13(entry, ".vue");
30897
31284
  const indexFile = join40(vueIndexDir, `${name}.js`);
30898
31285
  if (!existsSync30(indexFile))
30899
31286
  continue;
@@ -30974,7 +31361,7 @@ ${content.slice(firstUseIdx)}`;
30974
31361
  const urlFileMap = new Map;
30975
31362
  for (const srcPath of urlReferencedFiles) {
30976
31363
  const rel = relative14(projectRoot, srcPath).replace(/\\/g, "/");
30977
- const name = basename12(srcPath);
31364
+ const name = basename13(srcPath);
30978
31365
  const mtime = Math.round(statSync3(srcPath).mtimeMs);
30979
31366
  const url2 = `/@src/${rel}?v=${mtime}`;
30980
31367
  urlFileMap.set(name, url2);
@@ -30984,11 +31371,11 @@ ${content.slice(firstUseIdx)}`;
30984
31371
  }, buildProdUrlFileMap = (urlReferencedFiles, buildPath, nonReactClientOutputs) => {
30985
31372
  const urlFileMap = new Map;
30986
31373
  for (const srcPath of urlReferencedFiles) {
30987
- const srcBase = basename12(srcPath).replace(/\.[^.]+$/, "");
30988
- const output = nonReactClientOutputs.find((artifact) => basename12(artifact.path).startsWith(`${srcBase}.`));
31374
+ const srcBase = basename13(srcPath).replace(/\.[^.]+$/, "");
31375
+ const output = nonReactClientOutputs.find((artifact) => basename13(artifact.path).startsWith(`${srcBase}.`));
30989
31376
  if (!output)
30990
31377
  continue;
30991
- urlFileMap.set(basename12(srcPath), `/${relative14(buildPath, output.path).replace(/\\/g, "/")}`);
31378
+ urlFileMap.set(basename13(srcPath), `/${relative14(buildPath, output.path).replace(/\\/g, "/")}`);
30992
31379
  }
30993
31380
  return urlFileMap;
30994
31381
  }, buildUrlFileMap = (urlReferencedFiles, hmr, projectRoot, buildPath, nonReactClientOutputs) => {
@@ -31001,7 +31388,7 @@ ${content.slice(firstUseIdx)}`;
31001
31388
  let content = readFileSync25(outputPath, "utf-8");
31002
31389
  let changed = false;
31003
31390
  content = content.replace(urlPattern, (_match, relPath) => {
31004
- const targetName = basename12(relPath);
31391
+ const targetName = basename13(relPath);
31005
31392
  const resolvedPath = urlFileMap.get(targetName);
31006
31393
  if (!resolvedPath)
31007
31394
  return _match;
@@ -31149,7 +31536,7 @@ ${content.slice(firstUseIdx)}`;
31149
31536
  const isIncremental = incrementalFiles && incrementalFiles.length > 0;
31150
31537
  const styleTransformConfig = createStyleTransformConfig(stylePreprocessors, postcss);
31151
31538
  const stylePreprocessorPlugin2 = createStylePreprocessorPlugin(styleTransformConfig);
31152
- const normalizedIncrementalFiles = incrementalFiles?.map(normalizePath);
31539
+ const normalizedIncrementalFiles = incrementalFiles?.map(normalizePath2);
31153
31540
  const throwOnError = options?.throwOnError === true;
31154
31541
  const hmr = options?.injectHMR === true;
31155
31542
  const buildPath = validateSafePath(buildDirectory, projectRoot);
@@ -31234,7 +31621,7 @@ ${content.slice(firstUseIdx)}`;
31234
31621
  if (!firstEntry)
31235
31622
  throw new Error("Expected at least one server directory entry");
31236
31623
  serverRoot = join40(firstEntry.dir, firstEntry.subdir);
31237
- serverOutDir = join40(buildPath, basename12(firstEntry.dir));
31624
+ serverOutDir = join40(buildPath, basename13(firstEntry.dir));
31238
31625
  } else if (serverDirMap.length > 1) {
31239
31626
  serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
31240
31627
  serverOutDir = buildPath;
@@ -31376,7 +31763,7 @@ ${content.slice(firstUseIdx)}`;
31376
31763
  mkdirSync12(htmlConventionsOutDir, { recursive: true });
31377
31764
  const htmlPathRemap = new Map;
31378
31765
  for (const sourcePath of htmlConventionSources) {
31379
- const dest = join40(htmlConventionsOutDir, basename12(sourcePath));
31766
+ const dest = join40(htmlConventionsOutDir, basename13(sourcePath));
31380
31767
  cpSync(sourcePath, dest, { force: true });
31381
31768
  htmlPathRemap.set(sourcePath, dest);
31382
31769
  }
@@ -31418,7 +31805,7 @@ ${content.slice(firstUseIdx)}`;
31418
31805
  const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/html/") && (f2.endsWith(".html") || isStylePath(f2)));
31419
31806
  const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
31420
31807
  if (entry.startsWith(resolve28(reactIndexesPath))) {
31421
- const pageName = basename12(entry, ".tsx");
31808
+ const pageName = basename13(entry, ".tsx");
31422
31809
  return join40(reactPagesPath, `${pageName}.tsx`);
31423
31810
  }
31424
31811
  return null;
@@ -31449,7 +31836,7 @@ ${content.slice(firstUseIdx)}`;
31449
31836
  return new Set;
31450
31837
  const resolved = new Set;
31451
31838
  for (const entry of vueEntries) {
31452
- const name = basename12(entry, ".vue");
31839
+ const name = basename13(entry, ".vue");
31453
31840
  if (ssrOnlyPageNames.has(name)) {
31454
31841
  resolved.add(resolve28(entry));
31455
31842
  }
@@ -31662,7 +32049,7 @@ ${content.slice(firstUseIdx)}`;
31662
32049
  const compiledPath = compiledPaths[idx];
31663
32050
  if (!compiledPath)
31664
32051
  continue;
31665
- const name = basename12(compiledPath).replace(/\.[^.]+$/, "");
32052
+ const name = basename13(compiledPath).replace(/\.[^.]+$/, "");
31666
32053
  const result = await bunBuild7({
31667
32054
  entrypoints: [compiledPath],
31668
32055
  format: "esm",
@@ -31995,7 +32382,7 @@ ${content.slice(firstUseIdx)}`;
31995
32382
  globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
31996
32383
  entrypoints: globalCssEntries,
31997
32384
  naming: `[dir]/[name].[hash].[ext]`,
31998
- outdir: stylesDir ? join40(buildPath, basename12(stylesDir)) : buildPath,
32385
+ outdir: stylesDir ? join40(buildPath, basename13(stylesDir)) : buildPath,
31999
32386
  plugins: [stylePreprocessorPlugin2],
32000
32387
  root: stylesDir || clientRoot,
32001
32388
  target: "browser",
@@ -32004,7 +32391,7 @@ ${content.slice(firstUseIdx)}`;
32004
32391
  vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
32005
32392
  entrypoints: vueCssPaths,
32006
32393
  naming: `[name].[hash].[ext]`,
32007
- outdir: join40(buildPath, assetsPath ? basename12(assetsPath) : "assets", "css"),
32394
+ outdir: join40(buildPath, assetsPath ? basename13(assetsPath) : "assets", "css"),
32008
32395
  target: "browser",
32009
32396
  throw: false
32010
32397
  }, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
@@ -32025,7 +32412,7 @@ ${content.slice(firstUseIdx)}`;
32025
32412
  const mapFiles = readdirSync5(buildPath, { recursive: true }).filter((entry) => entry.endsWith(".js.map") && !entry.includes("node_modules")).map((entry) => join40(buildPath, entry));
32026
32413
  for (const mapPath of mapFiles) {
32027
32414
  chainExternalSourcemap2(mapPath);
32028
- renameSync(mapPath, join40(sourcemapDir, basename12(mapPath)));
32415
+ renameSync(mapPath, join40(sourcemapDir, basename13(mapPath)));
32029
32416
  const jsPath = mapPath.slice(0, -4);
32030
32417
  try {
32031
32418
  const js = readFileSync25(jsPath, "utf-8").replace(/\n?\/\/# sourceMappingURL=[^\n]*\s*$/, `
@@ -32154,7 +32541,7 @@ ${content.slice(firstUseIdx)}`;
32154
32541
  for (const artifact of serverOutputs) {
32155
32542
  if (extname9(artifact.path) !== ".js")
32156
32543
  continue;
32157
- const fileWithHash = basename12(artifact.path);
32544
+ const fileWithHash = basename13(artifact.path);
32158
32545
  const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
32159
32546
  if (!baseName)
32160
32547
  continue;
@@ -32174,7 +32561,7 @@ ${content.slice(firstUseIdx)}`;
32174
32561
  for (const artifact of cssOutputs) {
32175
32562
  if (extname9(artifact.path) !== ".css")
32176
32563
  continue;
32177
- const cssName = stripHash(basename12(artifact.path), artifact.hash);
32564
+ const cssName = stripHash(basename13(artifact.path), artifact.hash);
32178
32565
  if (cssName)
32179
32566
  cssByName.set(cssName, artifact);
32180
32567
  }
@@ -32184,7 +32571,7 @@ ${content.slice(firstUseIdx)}`;
32184
32571
  await Promise.all(serverOutputs.map(async (artifact) => {
32185
32572
  if (extname9(artifact.path) !== ".js")
32186
32573
  return;
32187
- const pascalName = stripHash(basename12(artifact.path), artifact.hash);
32574
+ const pascalName = stripHash(basename13(artifact.path), artifact.hash);
32188
32575
  if (!pascalName)
32189
32576
  return;
32190
32577
  serverJsByPascalName.set(pascalName, artifact);
@@ -32199,14 +32586,14 @@ ${content.slice(firstUseIdx)}`;
32199
32586
  const spaSideManifestPaths = [];
32200
32587
  if (vueSpaRoutesBySource && vueSpaRoutesBySource.size > 0) {
32201
32588
  await Promise.all([...vueSpaRoutesBySource.entries()].map(async ([source, routes]) => {
32202
- const parentName = basename12(source, ".vue");
32589
+ const parentName = basename13(source, ".vue");
32203
32590
  const parentArtifact = serverJsByPascalName.get(parentName);
32204
32591
  if (!parentArtifact)
32205
32592
  return;
32206
32593
  const sourceDir = dirname20(source);
32207
32594
  const entries = routes.flatMap(({ path, importPath }) => {
32208
32595
  const childSourcePath = resolve28(sourceDir, importPath);
32209
- const childName = basename12(childSourcePath, ".vue");
32596
+ const childName = basename13(childSourcePath, ".vue");
32210
32597
  const childArtifact = serverJsByPascalName.get(childName);
32211
32598
  if (!childArtifact)
32212
32599
  return [];
@@ -32223,12 +32610,12 @@ ${content.slice(firstUseIdx)}`;
32223
32610
  }));
32224
32611
  }
32225
32612
  for (const serverPath of emberServerPaths) {
32226
- const fileBase = basename12(serverPath, ".js");
32613
+ const fileBase = basename13(serverPath, ".js");
32227
32614
  manifest[toPascal(fileBase)] = serverPath;
32228
32615
  }
32229
32616
  if (skipAngularClientBundle) {
32230
32617
  for (const clientPath of angularClientPaths) {
32231
- const fileBase = basename12(clientPath, ".js");
32618
+ const fileBase = basename13(clientPath, ".js");
32232
32619
  const relFromCwd = relative14(projectRoot, clientPath).replace(/\\/g, "/");
32233
32620
  manifest[`${toPascal(fileBase)}Index`] = `/@src/${relFromCwd}`;
32234
32621
  }
@@ -32254,7 +32641,7 @@ ${content.slice(firstUseIdx)}`;
32254
32641
  const processHtmlPages = async () => {
32255
32642
  if (!(htmlDir && htmlPagesPath))
32256
32643
  return;
32257
- const outputHtmlPages = isSingle ? join40(buildPath, "pages") : join40(buildPath, basename12(htmlDir), "pages");
32644
+ const outputHtmlPages = isSingle ? join40(buildPath, "pages") : join40(buildPath, basename13(htmlDir), "pages");
32258
32645
  mkdirSync12(outputHtmlPages, { recursive: true });
32259
32646
  cpSync(htmlPagesPath, outputHtmlPages, {
32260
32647
  force: true,
@@ -32269,7 +32656,7 @@ ${content.slice(firstUseIdx)}`;
32269
32656
  for (const htmlFile of htmlPageFiles) {
32270
32657
  if (hmr)
32271
32658
  injectHMRIntoHTMLFile(htmlFile, "html");
32272
- const fileName = basename12(htmlFile, ".html");
32659
+ const fileName = basename13(htmlFile, ".html");
32273
32660
  if (manifest[fileName] && manifest[fileName] !== htmlFile) {
32274
32661
  warnManifestKeyCollision(fileName, manifest[fileName], htmlFile);
32275
32662
  }
@@ -32279,14 +32666,14 @@ ${content.slice(firstUseIdx)}`;
32279
32666
  const processHtmxPages = async () => {
32280
32667
  if (!(htmxDir && htmxPagesPath))
32281
32668
  return;
32282
- const outputHtmxPages = isSingle ? join40(buildPath, "pages") : join40(buildPath, basename12(htmxDir), "pages");
32669
+ const outputHtmxPages = isSingle ? join40(buildPath, "pages") : join40(buildPath, basename13(htmxDir), "pages");
32283
32670
  mkdirSync12(outputHtmxPages, { recursive: true });
32284
32671
  cpSync(htmxPagesPath, outputHtmxPages, {
32285
32672
  force: true,
32286
32673
  recursive: true
32287
32674
  });
32288
32675
  if (shouldCopyHtmx) {
32289
- const htmxDestDir = isSingle ? buildPath : join40(buildPath, basename12(htmxDir));
32676
+ const htmxDestDir = isSingle ? buildPath : join40(buildPath, basename13(htmxDir));
32290
32677
  copyHtmxVendor(htmxDir, htmxDestDir);
32291
32678
  }
32292
32679
  if (shouldUpdateHtmxAssetPaths) {
@@ -32298,7 +32685,7 @@ ${content.slice(firstUseIdx)}`;
32298
32685
  for (const htmxFile of htmxPageFiles) {
32299
32686
  if (hmr)
32300
32687
  injectHMRIntoHTMLFile(htmxFile, "htmx");
32301
- const fileName = basename12(htmxFile, ".html");
32688
+ const fileName = basename13(htmxFile, ".html");
32302
32689
  if (manifest[fileName] && manifest[fileName] !== htmxFile) {
32303
32690
  warnManifestKeyCollision(fileName, manifest[fileName], htmxFile);
32304
32691
  }
@@ -32349,6 +32736,29 @@ ${content.slice(firstUseIdx)}`;
32349
32736
  frameworks: frameworkNames,
32350
32737
  mode: mode ?? (isDev2 ? "development" : "production")
32351
32738
  });
32739
+ const [reactSpaHosts, svelteSpaHosts, vueSpaHosts, angularSpaHosts] = await Promise.all([
32740
+ reactDir ? Promise.resolve().then(() => (init_staticAnalyzeSpaRoutes2(), exports_staticAnalyzeSpaRoutes2)).then((module) => module.analyzeReactSpaRoutes(reactDir)) : [],
32741
+ svelteDir ? Promise.resolve().then(() => (init_staticAnalyzeSpaRoutes3(), exports_staticAnalyzeSpaRoutes3)).then((module) => module.analyzeSvelteSpaRoutes(svelteDir)) : [],
32742
+ vueDir ? Promise.resolve().then(() => (init_staticAnalyzeSpaRoutes4(), exports_staticAnalyzeSpaRoutes4)).then((module) => module.analyzeVueSpaRoutes(vueDir)) : [],
32743
+ angularDir ? Promise.resolve().then(() => (init_staticAnalyzeSpaRoutes(), exports_staticAnalyzeSpaRoutes)).then((module) => module.analyzeAngularSpaRoutes(angularDir)) : []
32744
+ ]);
32745
+ const spaRouteHosts = [
32746
+ ...reactSpaHosts.map((host) => ({
32747
+ ...host,
32748
+ framework: "react"
32749
+ })),
32750
+ ...svelteSpaHosts.map((host) => ({
32751
+ ...host,
32752
+ framework: "svelte"
32753
+ })),
32754
+ ...vueSpaHosts.map((host) => ({ ...host, framework: "vue" })),
32755
+ ...angularSpaHosts.map((host) => ({
32756
+ ...host,
32757
+ framework: "angular"
32758
+ }))
32759
+ ];
32760
+ setSpaRouteManifest(spaRouteHosts);
32761
+ writeFileSync9(join40(buildPath, "spa-routes.json"), JSON.stringify(spaRouteHosts, null, "\t"));
32352
32762
  if (isIncremental) {
32353
32763
  writeBuildTrace(buildPath);
32354
32764
  return { conventions: conventionsMap, manifest };
@@ -32418,6 +32828,7 @@ var init_build = __esm(() => {
32418
32828
  init_buildDirectoryLock();
32419
32829
  init_logger();
32420
32830
  init_validateSafePath();
32831
+ init_spaRouteManifest();
32421
32832
  isDev2 = env3.NODE_ENV === "development";
32422
32833
  SKIP_DIRS5 = new Set([
32423
32834
  "build",
@@ -33135,7 +33546,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
33135
33546
  }, collectAngularResourceDirs = (angularDir) => {
33136
33547
  const out = new Set;
33137
33548
  const angularRoot = resolve31(angularDir);
33138
- const angularRootNormalized = normalizePath(angularRoot);
33549
+ const angularRootNormalized = normalizePath2(angularRoot);
33139
33550
  const walk = (dir) => {
33140
33551
  let entries;
33141
33552
  try {
@@ -33188,8 +33599,8 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
33188
33599
  }
33189
33600
  const componentDir = dirname21(full);
33190
33601
  for (const ref of refs) {
33191
- const refAbs = normalizePath(resolve31(componentDir, ref));
33192
- const refDir = normalizePath(dirname21(refAbs));
33602
+ const refAbs = normalizePath2(resolve31(componentDir, ref));
33603
+ const refDir = normalizePath2(dirname21(refAbs));
33193
33604
  if (refDir === angularRootNormalized || refDir.startsWith(`${angularRootNormalized}/`)) {
33194
33605
  continue;
33195
33606
  }
@@ -33205,7 +33616,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
33205
33616
  const push = (path) => {
33206
33617
  if (!path)
33207
33618
  return;
33208
- const abs = normalizePath(resolve31(cwd2, path));
33619
+ const abs = normalizePath2(resolve31(cwd2, path));
33209
33620
  if (!roots.includes(abs))
33210
33621
  roots.push(abs);
33211
33622
  };
@@ -33230,7 +33641,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
33230
33641
  push(cfg.assetsDir);
33231
33642
  push(cfg.stylesDir);
33232
33643
  for (const candidate of ["src", "db", "assets", "styles"]) {
33233
- const abs = normalizePath(resolve31(cwd2, candidate));
33644
+ const abs = normalizePath2(resolve31(cwd2, candidate));
33234
33645
  if (existsSync33(abs) && !roots.includes(abs))
33235
33646
  roots.push(abs);
33236
33647
  }
@@ -33242,7 +33653,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
33242
33653
  continue;
33243
33654
  if (entry.name.startsWith("."))
33244
33655
  continue;
33245
- const abs = normalizePath(resolve31(cwd2, entry.name));
33656
+ const abs = normalizePath2(resolve31(cwd2, entry.name));
33246
33657
  if (roots.includes(abs))
33247
33658
  continue;
33248
33659
  if (shouldIgnorePath(abs, resolved))
@@ -33267,7 +33678,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
33267
33678
  const push = (base, sub) => {
33268
33679
  if (!base)
33269
33680
  return;
33270
- const normalizedBase = normalizePath(base);
33681
+ const normalizedBase = normalizePath2(base);
33271
33682
  paths.push(sub ? `${normalizedBase}/${sub}` : normalizedBase);
33272
33683
  };
33273
33684
  const cfg = resolved ?? {
@@ -33285,9 +33696,9 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
33285
33696
  push(cfg.htmxDir, "styles");
33286
33697
  }
33287
33698
  for (const root of roots) {
33288
- if (root === normalizePath(cfg.htmlDir ?? ""))
33699
+ if (root === normalizePath2(cfg.htmlDir ?? ""))
33289
33700
  continue;
33290
- if (root === normalizePath(cfg.htmxDir ?? ""))
33701
+ if (root === normalizePath2(cfg.htmxDir ?? ""))
33291
33702
  continue;
33292
33703
  paths.push(root);
33293
33704
  }
@@ -33556,7 +33967,7 @@ var computeFileHash = (filePath) => {
33556
33967
  return UNFOUND_INDEX;
33557
33968
  }
33558
33969
  }, hasFileChanged = (filePath, currentHash, previousHashes) => {
33559
- const normalizedPath = normalizePath(filePath);
33970
+ const normalizedPath = normalizePath2(filePath);
33560
33971
  const previousHash = previousHashes.get(normalizedPath);
33561
33972
  if (previousHash === undefined) {
33562
33973
  return true;
@@ -33657,7 +34068,7 @@ var classifyComponent = (filePath) => {
33657
34068
  var init_reactComponentClassifier = () => {};
33658
34069
 
33659
34070
  // src/dev/moduleMapper.ts
33660
- import { basename as basename13, resolve as resolve35 } from "path";
34071
+ import { basename as basename14, resolve as resolve35 } from "path";
33661
34072
  var buildModulePaths = (moduleKeys, manifest) => {
33662
34073
  const modulePaths = {};
33663
34074
  moduleKeys.forEach((key) => {
@@ -33704,7 +34115,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
33704
34115
  return grouped;
33705
34116
  }, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
33706
34117
  const normalizedFile = resolve35(sourceFile);
33707
- const fileName = basename13(normalizedFile);
34118
+ const fileName = basename14(normalizedFile);
33708
34119
  const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
33709
34120
  const pascalName = toPascal(baseName);
33710
34121
  const keys = [];
@@ -34151,7 +34562,7 @@ __export(exports_moduleServer, {
34151
34562
  SRC_URL_PREFIX: () => SRC_URL_PREFIX
34152
34563
  });
34153
34564
  import { existsSync as existsSync35, readFileSync as readFileSync30, realpathSync as realpathSync3, statSync as statSync6 } from "fs";
34154
- import { basename as basename14, dirname as dirname24, extname as extname11, join as join44, resolve as resolve37, relative as relative15 } from "path";
34565
+ import { basename as basename15, dirname as dirname24, extname as extname11, join as join44, resolve as resolve37, relative as relative15 } from "path";
34155
34566
  var SRC_PREFIX = "/@src/", jsTranspiler2, legacyDecoratorTsconfig, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
34156
34567
  const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
34157
34568
  const allExports = [];
@@ -34584,7 +34995,7 @@ ${code}`;
34584
34995
  if (!vueCompiler) {
34585
34996
  vueCompiler = await import("@vue/compiler-sfc");
34586
34997
  }
34587
- const fileName = basename14(filePath, ".vue");
34998
+ const fileName = basename15(filePath, ".vue");
34588
34999
  const componentId = toKebab(fileName);
34589
35000
  const { descriptor } = vueCompiler.parse(raw, { filename: filePath });
34590
35001
  const hasScript = descriptor.script || descriptor.scriptSetup;
@@ -35312,7 +35723,7 @@ var init_simpleHTMXHMR = () => {};
35312
35723
 
35313
35724
  // src/dev/rebuildTrigger.ts
35314
35725
  import { existsSync as existsSync36, rmSync as rmSync3 } from "fs";
35315
- import { basename as basename15, dirname as dirname26, join as join45, relative as relative17, resolve as resolve41, sep as sep4 } from "path";
35726
+ import { basename as basename16, dirname as dirname26, join as join45, relative as relative17, resolve as resolve41, sep as sep4 } from "path";
35316
35727
  var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequentially = (items, action) => items.reduce((chain, item) => chain.then(() => action(item)), Promise.resolve()), getStyleTransformConfig = (config2) => createStyleTransformConfig(config2.stylePreprocessors, config2.postcss), recompileTailwindForFastPath = async (state, config2, files) => {
35317
35728
  if (!config2.tailwind)
35318
35729
  return;
@@ -35813,7 +36224,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
35813
36224
  if (serverDirs.length <= 1) {
35814
36225
  const dir = getFrameworkGeneratedDir2(framework, projectRoot);
35815
36226
  return {
35816
- serverOutDir: resolve41(resolvedPaths.buildDir, basename15(dir)),
36227
+ serverOutDir: resolve41(resolvedPaths.buildDir, basename16(dir)),
35817
36228
  serverRoot: resolve41(dir, "server")
35818
36229
  };
35819
36230
  }
@@ -35822,7 +36233,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
35822
36233
  serverRoot: commonAncestor2(serverDirs.map((entry) => entry.dir), projectRoot)
35823
36234
  };
35824
36235
  }, updateServerManifestEntry = (state, artifact) => {
35825
- const fileWithHash = basename15(artifact.path);
36236
+ const fileWithHash = basename16(artifact.path);
35826
36237
  const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
35827
36238
  if (!baseName) {
35828
36239
  return;
@@ -35836,7 +36247,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
35836
36247
  const prefixByDir = new Map;
35837
36248
  for (const artifact of freshOutputs) {
35838
36249
  const dir = dirname26(artifact.path);
35839
- const name = basename15(artifact.path);
36250
+ const name = basename16(artifact.path);
35840
36251
  const [prefix] = name.split(".");
35841
36252
  if (!prefix)
35842
36253
  continue;
@@ -36322,7 +36733,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
36322
36733
  await rewriteImports3(ssrPaths, angServerVendorPaths);
36323
36734
  }
36324
36735
  serverPaths.forEach((serverPath, idx) => {
36325
- const fileBase = basename15(serverPath, ".js");
36736
+ const fileBase = basename16(serverPath, ".js");
36326
36737
  const ssrPath = ssrPaths[idx] ?? serverPath;
36327
36738
  state.manifest[toPascal(fileBase)] = resolve41(ssrPath);
36328
36739
  });
@@ -36685,7 +37096,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
36685
37096
  const duration3 = Date.now() - startTime;
36686
37097
  const broadcastFiles = svelteFiles.length > 0 ? svelteFiles : filesToRebuild;
36687
37098
  broadcastFiles.forEach((sveltePagePath) => {
36688
- const fileName = basename15(sveltePagePath);
37099
+ const fileName = basename16(sveltePagePath);
36689
37100
  const baseName = fileName.replace(/\.svelte$/, "");
36690
37101
  const pascalName = toPascal(baseName);
36691
37102
  const cssKey = `${pascalName}CSS`;
@@ -36765,7 +37176,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
36765
37176
  const { vueServerPaths, vueIndexPaths, vueClientPaths, vueCssPaths } = await compileVue2(vueFiles, vueDir, true, getStyleTransformConfig(state.config));
36766
37177
  const serverEntries = [...vueServerPaths];
36767
37178
  const clientEntries = [...vueIndexPaths, ...vueClientPaths];
36768
- const cssOutDir = join45(buildDir, state.resolvedPaths.assetsDir ? basename15(state.resolvedPaths.assetsDir) : "assets", "css");
37179
+ const cssOutDir = join45(buildDir, state.resolvedPaths.assetsDir ? basename16(state.resolvedPaths.assetsDir) : "assets", "css");
36769
37180
  const { serverRoot, serverOutDir } = await computeServerOutPaths(state.resolvedPaths, "vue");
36770
37181
  const [serverResult, clientResult, cssResult] = await Promise.all([
36771
37182
  serverEntries.length > 0 ? bunBuild9({
@@ -36913,7 +37324,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
36913
37324
  const { compileEmber: compileEmber2 } = await Promise.resolve().then(() => (init_compileEmber(), exports_compileEmber));
36914
37325
  const { serverPaths } = await compileEmber2(allPageEntries, emberDir, process.cwd(), true);
36915
37326
  for (const serverPath of serverPaths) {
36916
- const fileBase = basename15(serverPath, ".js");
37327
+ const fileBase = basename16(serverPath, ".js");
36917
37328
  state.manifest[toPascal(fileBase)] = resolve41(serverPath);
36918
37329
  }
36919
37330
  const { invalidateEmberSsrCache: invalidateEmberSsrCache2 } = await Promise.resolve().then(() => (init_ember(), exports_ember));
@@ -36984,7 +37395,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
36984
37395
  });
36985
37396
  }
36986
37397
  }, handleScriptUpdate = (state, scriptFile, manifest, framework, duration3) => {
36987
- const scriptBaseName = basename15(scriptFile).replace(/\.(ts|js|tsx|jsx)$/, "");
37398
+ const scriptBaseName = basename16(scriptFile).replace(/\.(ts|js|tsx|jsx)$/, "");
36988
37399
  const pascalName = toPascal(scriptBaseName);
36989
37400
  const scriptPath = manifest[pascalName] || null;
36990
37401
  if (!scriptPath) {
@@ -37063,7 +37474,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
37063
37474
  if (isSingle) {
37064
37475
  return resolve41(state.resolvedPaths.buildDir, "pages");
37065
37476
  }
37066
- const dirName = framework === "html" ? basename15(config2.htmlDirectory ?? "html") : basename15(config2.htmxDirectory ?? "htmx");
37477
+ const dirName = framework === "html" ? basename16(config2.htmlDirectory ?? "html") : basename16(config2.htmxDirectory ?? "htmx");
37067
37478
  return resolve41(state.resolvedPaths.buildDir, dirName, "pages");
37068
37479
  }, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration3) => {
37069
37480
  try {
@@ -37102,7 +37513,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
37102
37513
  const shouldRefreshAllPages = htmlPageFiles.length === 0 && shouldRefreshFromIslandChange;
37103
37514
  const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
37104
37515
  await runSequentially(pageFilesToUpdate, async (pageFile) => {
37105
- const htmlPageName = basename15(pageFile);
37516
+ const htmlPageName = basename16(pageFile);
37106
37517
  const builtHtmlPagePath = resolve41(outputHtmlPages, htmlPageName);
37107
37518
  await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration3);
37108
37519
  });
@@ -37111,7 +37522,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
37111
37522
  if (!cssFile) {
37112
37523
  return;
37113
37524
  }
37114
- const cssBaseName = basename15(getStyleBaseName(cssFile));
37525
+ const cssBaseName = basename16(getStyleBaseName(cssFile));
37115
37526
  const cssPascalName = toPascal(cssBaseName);
37116
37527
  const cssKey = `${cssPascalName}CSS`;
37117
37528
  const cssUrl = manifest[cssKey] || null;
@@ -37160,7 +37571,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
37160
37571
  type: "vue-update"
37161
37572
  });
37162
37573
  }, broadcastVuePageChange = async (state, config2, vuePagePath, manifest, duration3) => {
37163
- const fileName = basename15(vuePagePath);
37574
+ const fileName = basename16(vuePagePath);
37164
37575
  const baseName = fileName.replace(/\.vue$/, "");
37165
37576
  const pascalName = toPascal(baseName);
37166
37577
  const vueRoot = config2.vueDirectory;
@@ -37206,7 +37617,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
37206
37617
  if (!cssFile) {
37207
37618
  return;
37208
37619
  }
37209
- const cssBaseName = basename15(getStyleBaseName(cssFile));
37620
+ const cssBaseName = basename16(getStyleBaseName(cssFile));
37210
37621
  const cssPascalName = toPascal(cssBaseName);
37211
37622
  const cssKey = `${cssPascalName}CSS`;
37212
37623
  const cssUrl = manifest[cssKey] || null;
@@ -37224,7 +37635,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
37224
37635
  });
37225
37636
  }, broadcastSveltePageUpdate = (state, sveltePagePath, manifest, duration3) => {
37226
37637
  try {
37227
- const fileName = basename15(sveltePagePath);
37638
+ const fileName = basename16(sveltePagePath);
37228
37639
  const baseName = fileName.replace(/\.svelte$/, "");
37229
37640
  const pascalName = toPascal(baseName);
37230
37641
  const cssKey = `${pascalName}CSS`;
@@ -37273,7 +37684,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
37273
37684
  if (!cssFile) {
37274
37685
  return;
37275
37686
  }
37276
- const cssBaseName = basename15(getStyleBaseName(cssFile));
37687
+ const cssBaseName = basename16(getStyleBaseName(cssFile));
37277
37688
  const cssPascalName = toPascal(cssBaseName);
37278
37689
  const cssKey = `${cssPascalName}CSS`;
37279
37690
  const cssUrl = manifest[cssKey] || null;
@@ -37353,7 +37764,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
37353
37764
  const shouldRefreshAllPages = htmxPageFiles.length === 0 && shouldRefreshFromIslandChange;
37354
37765
  const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
37355
37766
  await runSequentially(pageFilesToUpdate, async (htmxPageFile) => {
37356
- const htmxPageName = basename15(htmxPageFile);
37767
+ const htmxPageName = basename16(htmxPageFile);
37357
37768
  const builtHtmxPagePath = resolve41(outputHtmxPages, htmxPageName);
37358
37769
  await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration3);
37359
37770
  });
@@ -37463,7 +37874,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
37463
37874
  html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
37464
37875
  writeFs(destPath, html);
37465
37876
  }, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
37466
- const destPath = resolve41(outputDir, basename15(sourceFile));
37877
+ const destPath = resolve41(outputDir, basename16(sourceFile));
37467
37878
  const hmrScript = extractHmrScript(destPath, readFs);
37468
37879
  const source = await Bun.file(sourceFile).text();
37469
37880
  await Bun.write(destPath, source);
@@ -40067,7 +40478,7 @@ var handleHTMXPageRequest = async (pagePath) => {
40067
40478
  // src/core/prepare.ts
40068
40479
  import { createHash as createHash5 } from "crypto";
40069
40480
  import { existsSync as existsSync39, readdirSync as readdirSync9, readFileSync as readFileSync33 } from "fs";
40070
- import { basename as basename16, join as join49, relative as relative18, resolve as resolve45 } from "path";
40481
+ import { basename as basename17, join as join49, relative as relative18, resolve as resolve45 } from "path";
40071
40482
  import { Elysia as Elysia8 } from "elysia";
40072
40483
 
40073
40484
  // src/plugins/openApiPlugin.ts
@@ -40215,304 +40626,8 @@ var loadIslandRegistry = async (registryPath) => {
40215
40626
 
40216
40627
  // src/core/prepare.ts
40217
40628
  init_pageMetadata();
40218
-
40219
- // src/utils/resolveConvention.ts
40220
- import { basename as basename2 } from "path";
40221
- var CONVENTIONS_KEY = "__absoluteConventions";
40222
- var isConventionsMap = (value) => Boolean(value) && typeof value === "object";
40223
- var getMap = () => {
40224
- const value = Reflect.get(globalThis, CONVENTIONS_KEY);
40225
- if (isConventionsMap(value))
40226
- return value;
40227
- const empty = {};
40228
- return empty;
40229
- };
40230
- var derivePageName = (pagePath) => {
40231
- const base = basename2(pagePath);
40232
- const dotIndex = base.indexOf(".");
40233
- const name = dotIndex > 0 ? base.slice(0, dotIndex) : base;
40234
- return toPascal(name);
40235
- };
40236
- var normalizeConventionPageName = (name) => toPascal(name).replace(/\d+$/, "");
40237
- var hasErrorConvention = (framework) => {
40238
- const conventions2 = getMap()[framework];
40239
- if (!conventions2)
40240
- return false;
40241
- if (conventions2.defaults?.error)
40242
- return true;
40243
- return Object.values(conventions2.pages ?? {}).some((page) => Boolean(page.error));
40244
- };
40245
- var resolveErrorConventionPath = (framework, pageName) => {
40246
- const conventions2 = getMap()[framework];
40247
- if (!conventions2)
40248
- return;
40249
- const exact = conventions2.pages?.[pageName]?.error;
40250
- if (exact)
40251
- return exact;
40252
- const normalizedPageName = normalizeConventionPageName(pageName);
40253
- for (const [candidate, page] of Object.entries(conventions2.pages ?? {})) {
40254
- if (normalizeConventionPageName(candidate) === normalizedPageName) {
40255
- return page.error ?? conventions2.defaults?.error;
40256
- }
40257
- }
40258
- return conventions2.defaults?.error;
40259
- };
40260
- var resolveNotFoundConventionPath = (framework) => getMap()[framework]?.defaults?.notFound;
40261
- var setConventions = (map3) => {
40262
- Reflect.set(globalThis, CONVENTIONS_KEY, map3);
40263
- };
40264
- var isDev = () => true;
40265
- var buildErrorProps = (error) => {
40266
- if (error instanceof Error) {
40267
- return {
40268
- name: error.name,
40269
- message: error.message,
40270
- ...isDev() && error.stack ? { stack: error.stack } : {}
40271
- };
40272
- }
40273
- return { message: String(error), name: "Error" };
40274
- };
40275
- var renderReactError = async (conventionPath, errorProps) => {
40276
- const { createElement } = await import("react");
40277
- const { renderToReadableStream } = await import("react-dom/server");
40278
- const mod = await import(conventionPath);
40279
- const ErrorComponent = mod.default;
40280
- if (typeof ErrorComponent !== "function")
40281
- return null;
40282
- const element = createElement(ErrorComponent, errorProps);
40283
- const stream = await renderToReadableStream(element);
40284
- return new Response(stream, {
40285
- headers: { "Content-Type": "text/html" },
40286
- status: 500
40287
- });
40288
- };
40289
- var renderSvelteError = async (conventionPath, errorProps) => {
40290
- const { render } = await import("svelte/server");
40291
- const mod = await import(conventionPath);
40292
- const ErrorComponent = mod.default;
40293
- if (!ErrorComponent)
40294
- return null;
40295
- const { head, body } = render(ErrorComponent, {
40296
- props: errorProps
40297
- });
40298
- const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
40299
- return new Response(html, {
40300
- headers: { "Content-Type": "text/html" },
40301
- status: 500
40302
- });
40303
- };
40304
- var unescapeVueStyles = (ssrBody) => {
40305
- let styles = "";
40306
- const body = ssrBody.replace(/<style>([\s\S]*?)<\/style>/g, (_2, css) => {
40307
- styles += `<style>${css.replace(/&quot;/g, '"').replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">")}</style>`;
40308
- return "";
40309
- });
40310
- return { body, styles };
40311
- };
40312
- var renderVueError = async (conventionPath, errorProps) => {
40313
- const { createSSRApp, h: h2 } = await import("vue");
40314
- const { renderToString } = await import("vue/server-renderer");
40315
- const mod = await import(conventionPath);
40316
- const ErrorComponent = mod.default;
40317
- if (!ErrorComponent)
40318
- return null;
40319
- const app = createSSRApp({
40320
- render: () => h2(ErrorComponent, errorProps)
40321
- });
40322
- const rawBody = await renderToString(app);
40323
- const { styles, body } = unescapeVueStyles(rawBody);
40324
- const html = `<!DOCTYPE html><html><head>${styles}</head><body><div id="root">${body}</div></body></html>`;
40325
- return new Response(html, {
40326
- headers: { "Content-Type": "text/html" },
40327
- status: 500
40328
- });
40329
- };
40330
- var renderAngularError = async (conventionPath, errorProps) => {
40331
- const mod = await import(conventionPath);
40332
- const renderFn = mod.default;
40333
- if (typeof renderFn !== "function")
40334
- return null;
40335
- const html = renderFn(errorProps);
40336
- return new Response(html, {
40337
- headers: { "Content-Type": "text/html" },
40338
- status: 500
40339
- });
40340
- };
40341
- var escapeHtml = (value) => value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
40342
- var replaceErrorTokens = (template, errorProps) => template.replace(/\{\{\s*name\s*\}\}/g, escapeHtml(errorProps.name)).replace(/\{\{\s*message\s*\}\}/g, escapeHtml(errorProps.message)).replace(/\{\{\s*stack\s*\}\}/g, errorProps.stack ? escapeHtml(errorProps.stack) : "");
40343
- var renderHtmlError = async (conventionPath, errorProps) => {
40344
- const template = await Bun.file(conventionPath).text();
40345
- const html = replaceErrorTokens(template, errorProps);
40346
- return new Response(html, {
40347
- headers: { "Content-Type": "text/html" },
40348
- status: 500
40349
- });
40350
- };
40351
- var logConventionRenderError = (framework, label, renderError) => {
40352
- const message = renderError instanceof Error ? renderError.message : "";
40353
- if (message.includes("Cannot find module") || message.includes("Cannot find package") || message.includes("not found in module")) {
40354
- console.error(`[SSR] Convention ${label} page for ${framework} failed: missing framework package. Ensure the ${framework} runtime is installed (e.g. bun add ${framework === "react" ? "react react-dom" : framework}).`);
40355
- return;
40356
- }
40357
- console.error(`[SSR] Failed to render ${framework} convention ${label} page:`, renderError);
40358
- };
40359
- var renderEmberError = async () => null;
40360
- var renderEmberNotFound = async () => null;
40361
- var ERROR_RENDERERS = {
40362
- angular: renderAngularError,
40363
- ember: renderEmberError,
40364
- html: renderHtmlError,
40365
- react: renderReactError,
40366
- svelte: renderSvelteError,
40367
- vue: renderVueError
40368
- };
40369
- var tryFrameworkErrorConvention = async (framework, pageName, errorProps, error) => {
40370
- let conventionPath = resolveErrorConventionPath(framework, pageName);
40371
- if (!conventionPath && error instanceof Error && error.stack) {
40372
- for (const match of error.stack.matchAll(/^\s*at\s+([A-Za-z_$][\w$]*)/gm)) {
40373
- const candidate = match[1];
40374
- if (!candidate)
40375
- continue;
40376
- conventionPath = resolveErrorConventionPath(framework, candidate);
40377
- if (conventionPath)
40378
- break;
40379
- }
40380
- }
40381
- if (!conventionPath)
40382
- return null;
40383
- const renderer = ERROR_RENDERERS[framework];
40384
- if (!renderer)
40385
- return null;
40386
- try {
40387
- return await renderer(conventionPath, errorProps);
40388
- } catch (renderError) {
40389
- logConventionRenderError(framework, "error", renderError);
40390
- }
40391
- return null;
40392
- };
40393
- var renderConventionError = async (framework, pageName, error) => {
40394
- const errorProps = buildErrorProps(error);
40395
- const frameworkResponse = await tryFrameworkErrorConvention(framework, pageName, errorProps, error);
40396
- if (frameworkResponse)
40397
- return frameworkResponse;
40398
- if (framework !== "html") {
40399
- const htmlResponse = await tryFrameworkErrorConvention("html", pageName, errorProps, error);
40400
- if (htmlResponse)
40401
- return htmlResponse;
40402
- }
40403
- return null;
40404
- };
40405
- var renderReactNotFound = async (conventionPath) => {
40406
- const { createElement } = await import("react");
40407
- const { renderToReadableStream } = await import("react-dom/server");
40408
- const mod = await import(conventionPath);
40409
- const NotFoundComponent = mod.default;
40410
- if (typeof NotFoundComponent !== "function")
40411
- return null;
40412
- const element = createElement(NotFoundComponent);
40413
- const stream = await renderToReadableStream(element);
40414
- return new Response(stream, {
40415
- headers: { "Content-Type": "text/html" },
40416
- status: 404
40417
- });
40418
- };
40419
- var renderSvelteNotFound = async (conventionPath) => {
40420
- const { render } = await import("svelte/server");
40421
- const mod = await import(conventionPath);
40422
- const NotFoundComponent = mod.default;
40423
- if (!NotFoundComponent)
40424
- return null;
40425
- const { head, body } = render(NotFoundComponent);
40426
- const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
40427
- return new Response(html, {
40428
- headers: { "Content-Type": "text/html" },
40429
- status: 404
40430
- });
40431
- };
40432
- var renderVueNotFound = async (conventionPath) => {
40433
- const { createSSRApp, h: h2 } = await import("vue");
40434
- const { renderToString } = await import("vue/server-renderer");
40435
- const mod = await import(conventionPath);
40436
- const NotFoundComponent = mod.default;
40437
- if (!NotFoundComponent)
40438
- return null;
40439
- const app = createSSRApp({
40440
- render: () => h2(NotFoundComponent)
40441
- });
40442
- const rawBody = await renderToString(app);
40443
- const { styles, body } = unescapeVueStyles(rawBody);
40444
- const html = `<!DOCTYPE html><html><head>${styles}</head><body><div id="root">${body}</div></body></html>`;
40445
- return new Response(html, {
40446
- headers: { "Content-Type": "text/html" },
40447
- status: 404
40448
- });
40449
- };
40450
- var renderAngularNotFound = async (conventionPath) => {
40451
- const mod = await import(conventionPath);
40452
- const renderFn = mod.default;
40453
- if (typeof renderFn !== "function")
40454
- return null;
40455
- const html = renderFn();
40456
- return new Response(html, {
40457
- headers: { "Content-Type": "text/html" },
40458
- status: 404
40459
- });
40460
- };
40461
- var renderHtmlNotFound = async (conventionPath) => {
40462
- const html = await Bun.file(conventionPath).text();
40463
- return new Response(html, {
40464
- headers: { "Content-Type": "text/html" },
40465
- status: 404
40466
- });
40467
- };
40468
- var NOT_FOUND_RENDERERS = {
40469
- angular: renderAngularNotFound,
40470
- ember: renderEmberNotFound,
40471
- html: renderHtmlNotFound,
40472
- react: renderReactNotFound,
40473
- svelte: renderSvelteNotFound,
40474
- vue: renderVueNotFound
40475
- };
40476
- var renderConventionNotFound = async (framework) => {
40477
- const conventionPath = resolveNotFoundConventionPath(framework);
40478
- if (!conventionPath)
40479
- return null;
40480
- const renderer = NOT_FOUND_RENDERERS[framework];
40481
- if (!renderer)
40482
- return null;
40483
- try {
40484
- return await renderer(conventionPath);
40485
- } catch (renderError) {
40486
- logConventionRenderError(framework, "not-found", renderError);
40487
- }
40488
- return null;
40489
- };
40490
- var NOT_FOUND_PRIORITY = [
40491
- "react",
40492
- "svelte",
40493
- "vue",
40494
- "angular",
40495
- "html"
40496
- ];
40497
- var renderFirstNotFound = async () => {
40498
- const renderNext = async (frameworks2) => {
40499
- const [framework, ...remaining] = frameworks2;
40500
- if (!framework) {
40501
- return null;
40502
- }
40503
- if (!getMap()[framework]?.defaults?.notFound) {
40504
- return renderNext(remaining);
40505
- }
40506
- const response = await renderConventionNotFound(framework);
40507
- if (response) {
40508
- return response;
40509
- }
40510
- return renderNext(remaining);
40511
- };
40512
- return renderNext(NOT_FOUND_PRIORITY);
40513
- };
40514
-
40515
- // src/core/prepare.ts
40629
+ init_resolveConvention();
40630
+ init_spaRouteManifest();
40516
40631
  init_startupTimings();
40517
40632
  init_logger();
40518
40633
  var MS_PER_SECOND2 = 1000;
@@ -40739,7 +40854,7 @@ var loadPrerenderMap = (prerenderDir) => {
40739
40854
  for (const entry of entries) {
40740
40855
  if (!entry.endsWith(".html"))
40741
40856
  continue;
40742
- const name = basename16(entry, ".html");
40857
+ const name = basename17(entry, ".html");
40743
40858
  const route = name === "index" ? "/" : `/${name}`;
40744
40859
  map3.set(route, join49(prerenderDir, entry));
40745
40860
  }
@@ -40807,6 +40922,10 @@ var prepare = async (configOrPath) => {
40807
40922
  const conventions2 = JSON.parse(readFileSync33(conventionsPath, "utf-8"));
40808
40923
  setConventions(conventions2);
40809
40924
  }
40925
+ const spaRoutesPath = join49(buildDir, "spa-routes.json");
40926
+ if (existsSync39(spaRoutesPath)) {
40927
+ setSpaRouteManifest(JSON.parse(readFileSync33(spaRoutesPath, "utf-8")));
40928
+ }
40810
40929
  recordStep("load production conventions", stepStartedAt);
40811
40930
  stepStartedAt = performance.now();
40812
40931
  const { staticPlugin } = await import("@elysia/static");
@@ -41047,7 +41166,7 @@ import {
41047
41166
  writeFileSync as writeFileSync11
41048
41167
  } from "fs";
41049
41168
  import { homedir as homedir2 } from "os";
41050
- import { basename as basename17, join as join51 } from "path";
41169
+ import { basename as basename18, join as join51 } from "path";
41051
41170
  var registeredPids = new Set;
41052
41171
  var exitHandlerRegistered = false;
41053
41172
  var instanceFilePath = (pid) => join51(instanceRegistryDir(), `${pid}.json`);
@@ -41091,7 +41210,7 @@ var resolveProjectName = (cwd2) => {
41091
41210
  if (parsed !== null && typeof parsed === "object" && typeof parsed.name === "string" && parsed.name.trim().length > 0) {
41092
41211
  return parsed.name;
41093
41212
  }
41094
- return basename17(cwd2) || "unknown";
41213
+ return basename18(cwd2) || "unknown";
41095
41214
  };
41096
41215
 
41097
41216
  // src/utils/networking.ts
@@ -47761,5 +47880,5 @@ export {
47761
47880
  ANGULAR_INIT_TIMEOUT_MS
47762
47881
  };
47763
47882
 
47764
- //# debugId=1579DC7EEE9BCDA264756E2164756E21
47883
+ //# debugId=BB6BCC85C00C3B8064756E2164756E21
47765
47884
  //# sourceMappingURL=index.js.map