@absolutejs/absolute 0.19.0-beta.1095 → 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"))
21399
- return null;
21400
- 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)
21775
+ if (!analysisSource.includes("createRouter") && !analysisSource.includes("defineRoutes"))
21408
21776
  return null;
21409
- const routesArray = readRoutesFromCreateRouterOptions(sf, optionsArg);
21777
+ const sf = ts5.createSourceFile(filePath, analysisSource, ts5.ScriptTarget.Latest, true, ts5.ScriptKind.TS);
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
  };
@@ -24450,7 +24822,7 @@ __export(exports_compileVue, {
24450
24822
  import { existsSync as existsSync25, readFileSync as readFileSync22, realpathSync as realpathSync2 } from "fs";
24451
24823
  import { mkdir as mkdir6 } from "fs/promises";
24452
24824
  import {
24453
- basename as basename9,
24825
+ basename as basename10,
24454
24826
  dirname as dirname16,
24455
24827
  isAbsolute as isAbsolute4,
24456
24828
  join as join33,
@@ -24572,7 +24944,7 @@ var resolveDevClientDir3 = () => {
24572
24944
  return cachedResult;
24573
24945
  const relativeFilePath = relative11(vueRootDir, sourceFilePath).replace(/\\/g, "/");
24574
24946
  const relativeWithoutExtension = relativeFilePath.replace(/\.vue$/, "");
24575
- const fileBaseName = basename9(sourceFilePath, ".vue");
24947
+ const fileBaseName = basename10(sourceFilePath, ".vue");
24576
24948
  const componentId = toKebab(fileBaseName);
24577
24949
  const rawSourceContent = await file3(sourceFilePath).text();
24578
24950
  const sourceContent = isEntryPoint ? addAutoRouterSetupApp(rawSourceContent) : rawSourceContent;
@@ -24782,7 +25154,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
24782
25154
  spaRoutes: result.spaRoutes
24783
25155
  };
24784
25156
  }
24785
- const entryBaseName = basename9(entryPath, ".vue");
25157
+ const entryBaseName = basename10(entryPath, ".vue");
24786
25158
  const indexOutputFile = join33(indexOutputDir, `${entryBaseName}.js`);
24787
25159
  const clientOutputFile = join33(clientOutputDir, relative11(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
24788
25160
  await mkdir6(dirname16(indexOutputFile), { recursive: true });
@@ -25481,7 +25853,7 @@ __export(exports_compileAngular, {
25481
25853
  compileAngular: () => compileAngular
25482
25854
  });
25483
25855
  import { existsSync as existsSync26, readFileSync as readFileSync23, promises as fs5 } from "fs";
25484
- 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";
25485
25857
  var {Glob: Glob6 } = globalThis.Bun;
25486
25858
  import ts12 from "typescript";
25487
25859
  var traceAngularPhase = async (name, fn2, metadata2) => {
@@ -25856,7 +26228,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
25856
26228
  const originalGetDefaultLibFileName = host.getDefaultLibFileName;
25857
26229
  host.getDefaultLibFileName = (opts) => {
25858
26230
  const fileName = originalGetDefaultLibFileName ? originalGetDefaultLibFileName(opts) : "lib.d.ts";
25859
- return basename10(fileName);
26231
+ return basename11(fileName);
25860
26232
  };
25861
26233
  const originalGetSourceFile = host.getSourceFile;
25862
26234
  host.getSourceFile = (fileName, languageVersion, onError) => {
@@ -26289,7 +26661,7 @@ ${fields}
26289
26661
  };
26290
26662
  const toOutputPath = (sourcePath) => {
26291
26663
  const inputDir = dirname17(sourcePath);
26292
- const fileBase = basename10(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
26664
+ const fileBase = basename11(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
26293
26665
  if (inputDir === outDir || inputDir.startsWith(`${outDir}${sep3}`)) {
26294
26666
  return join34(inputDir, fileBase);
26295
26667
  }
@@ -26345,7 +26717,7 @@ ${fields}
26345
26717
  const inputDir2 = dirname17(resolved);
26346
26718
  const relativeDir2 = inputDir2.startsWith(baseDir) ? inputDir2.substring(baseDir.length + 1) : inputDir2;
26347
26719
  const targetDir2 = join34(outDir, relativeDir2);
26348
- const targetPath2 = join34(targetDir2, basename10(resolved));
26720
+ const targetPath2 = join34(targetDir2, basename11(resolved));
26349
26721
  await fs5.mkdir(targetDir2, { recursive: true });
26350
26722
  await fs5.copyFile(resolved, targetPath2);
26351
26723
  allOutputs.push(targetPath2);
@@ -26360,7 +26732,7 @@ ${fields}
26360
26732
  const inlined = await inlineResources(sourceCode, dirname17(actualPath), stylePreprocessors);
26361
26733
  sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname17(actualPath)).source;
26362
26734
  const inputDir = dirname17(actualPath);
26363
- const fileBase = basename10(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
26735
+ const fileBase = basename11(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
26364
26736
  const targetPath = toOutputPath(actualPath);
26365
26737
  const targetDir = dirname17(targetPath);
26366
26738
  const relativeDir = relative12(outDir, targetDir).replace(/\\/g, "/");
@@ -26453,7 +26825,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
26453
26825
  let outputs = hmr ? await traceAngularPhase("jit/compile-entry", compileEntry, {
26454
26826
  entry: resolvedEntry
26455
26827
  }) : aotOutputs;
26456
- const fileBase = basename10(resolvedEntry).replace(/\.[tj]s$/, "");
26828
+ const fileBase = basename11(resolvedEntry).replace(/\.[tj]s$/, "");
26457
26829
  const jsName = `${fileBase}.js`;
26458
26830
  const compiledFallbackPaths = [
26459
26831
  join34(compiledRoot, relativeEntry),
@@ -29976,11 +30348,11 @@ __export(exports_compileEmber, {
29976
30348
  compileEmberFile: () => compileEmberFile,
29977
30349
  compileEmber: () => compileEmber,
29978
30350
  clearEmberCompilerCache: () => clearEmberCompilerCache,
29979
- basename: () => basename11
30351
+ basename: () => basename12
29980
30352
  });
29981
30353
  import { existsSync as existsSync28 } from "fs";
29982
30354
  import { mkdir as mkdir7, rm as rm4 } from "fs/promises";
29983
- 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";
29984
30356
  var {build: bunBuild2, Transpiler: Transpiler4, write: write4, file: file4 } = globalThis.Bun;
29985
30357
  var cachedPreprocessor = null, getPreprocessor = async () => {
29986
30358
  if (cachedPreprocessor)
@@ -30146,7 +30518,7 @@ export default PageComponent;
30146
30518
  preprocessed = rewriteTemplateEvalToScope(result.code);
30147
30519
  }
30148
30520
  const transpiled = transpiler5.transformSync(preprocessed);
30149
- const baseName = basename11(resolvedEntry).replace(/\.(gjs|gts|ts|js)$/, "");
30521
+ const baseName = basename12(resolvedEntry).replace(/\.(gjs|gts|ts|js)$/, "");
30150
30522
  const tmpDir = join35(compiledRoot, "_tmp");
30151
30523
  const serverDir = join35(compiledRoot, "server");
30152
30524
  const clientDir = join35(compiledRoot, "client");
@@ -30715,7 +31087,7 @@ import {
30715
31087
  statSync as statSync3,
30716
31088
  writeFileSync as writeFileSync9
30717
31089
  } from "fs";
30718
- 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";
30719
31091
  import { cwd, env as env3, exit } from "process";
30720
31092
  var {build: bunBuild7, Glob: Glob8 } = globalThis.Bun;
30721
31093
  var isDev2, isBuildTraceEnabled = () => {
@@ -30895,7 +31267,7 @@ var isDev2, isBuildTraceEnabled = () => {
30895
31267
  const svelteIndexDir = join40(getFrameworkGeneratedDir("svelte"), "indexes");
30896
31268
  const sveltePageEntries = svelteEntries.filter((file5) => resolve28(file5).startsWith(resolve28(sveltePagesPath)));
30897
31269
  for (const entry of sveltePageEntries) {
30898
- const name = basename12(entry).replace(/\.svelte(\.(ts|js))?$/, "");
31270
+ const name = basename13(entry).replace(/\.svelte(\.(ts|js))?$/, "");
30899
31271
  const indexFile = join40(svelteIndexDir, "pages", `${name}.js`);
30900
31272
  if (!existsSync30(indexFile))
30901
31273
  continue;
@@ -30908,7 +31280,7 @@ var isDev2, isBuildTraceEnabled = () => {
30908
31280
  const vueIndexDir = join40(getFrameworkGeneratedDir("vue"), "indexes");
30909
31281
  const vuePageEntries = vueEntries.filter((file5) => resolve28(file5).startsWith(resolve28(vuePagesPath)));
30910
31282
  for (const entry of vuePageEntries) {
30911
- const name = basename12(entry, ".vue");
31283
+ const name = basename13(entry, ".vue");
30912
31284
  const indexFile = join40(vueIndexDir, `${name}.js`);
30913
31285
  if (!existsSync30(indexFile))
30914
31286
  continue;
@@ -30989,7 +31361,7 @@ ${content.slice(firstUseIdx)}`;
30989
31361
  const urlFileMap = new Map;
30990
31362
  for (const srcPath of urlReferencedFiles) {
30991
31363
  const rel = relative14(projectRoot, srcPath).replace(/\\/g, "/");
30992
- const name = basename12(srcPath);
31364
+ const name = basename13(srcPath);
30993
31365
  const mtime = Math.round(statSync3(srcPath).mtimeMs);
30994
31366
  const url2 = `/@src/${rel}?v=${mtime}`;
30995
31367
  urlFileMap.set(name, url2);
@@ -30999,11 +31371,11 @@ ${content.slice(firstUseIdx)}`;
30999
31371
  }, buildProdUrlFileMap = (urlReferencedFiles, buildPath, nonReactClientOutputs) => {
31000
31372
  const urlFileMap = new Map;
31001
31373
  for (const srcPath of urlReferencedFiles) {
31002
- const srcBase = basename12(srcPath).replace(/\.[^.]+$/, "");
31003
- 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}.`));
31004
31376
  if (!output)
31005
31377
  continue;
31006
- urlFileMap.set(basename12(srcPath), `/${relative14(buildPath, output.path).replace(/\\/g, "/")}`);
31378
+ urlFileMap.set(basename13(srcPath), `/${relative14(buildPath, output.path).replace(/\\/g, "/")}`);
31007
31379
  }
31008
31380
  return urlFileMap;
31009
31381
  }, buildUrlFileMap = (urlReferencedFiles, hmr, projectRoot, buildPath, nonReactClientOutputs) => {
@@ -31016,7 +31388,7 @@ ${content.slice(firstUseIdx)}`;
31016
31388
  let content = readFileSync25(outputPath, "utf-8");
31017
31389
  let changed = false;
31018
31390
  content = content.replace(urlPattern, (_match, relPath) => {
31019
- const targetName = basename12(relPath);
31391
+ const targetName = basename13(relPath);
31020
31392
  const resolvedPath = urlFileMap.get(targetName);
31021
31393
  if (!resolvedPath)
31022
31394
  return _match;
@@ -31164,7 +31536,7 @@ ${content.slice(firstUseIdx)}`;
31164
31536
  const isIncremental = incrementalFiles && incrementalFiles.length > 0;
31165
31537
  const styleTransformConfig = createStyleTransformConfig(stylePreprocessors, postcss);
31166
31538
  const stylePreprocessorPlugin2 = createStylePreprocessorPlugin(styleTransformConfig);
31167
- const normalizedIncrementalFiles = incrementalFiles?.map(normalizePath);
31539
+ const normalizedIncrementalFiles = incrementalFiles?.map(normalizePath2);
31168
31540
  const throwOnError = options?.throwOnError === true;
31169
31541
  const hmr = options?.injectHMR === true;
31170
31542
  const buildPath = validateSafePath(buildDirectory, projectRoot);
@@ -31249,7 +31621,7 @@ ${content.slice(firstUseIdx)}`;
31249
31621
  if (!firstEntry)
31250
31622
  throw new Error("Expected at least one server directory entry");
31251
31623
  serverRoot = join40(firstEntry.dir, firstEntry.subdir);
31252
- serverOutDir = join40(buildPath, basename12(firstEntry.dir));
31624
+ serverOutDir = join40(buildPath, basename13(firstEntry.dir));
31253
31625
  } else if (serverDirMap.length > 1) {
31254
31626
  serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
31255
31627
  serverOutDir = buildPath;
@@ -31391,7 +31763,7 @@ ${content.slice(firstUseIdx)}`;
31391
31763
  mkdirSync12(htmlConventionsOutDir, { recursive: true });
31392
31764
  const htmlPathRemap = new Map;
31393
31765
  for (const sourcePath of htmlConventionSources) {
31394
- const dest = join40(htmlConventionsOutDir, basename12(sourcePath));
31766
+ const dest = join40(htmlConventionsOutDir, basename13(sourcePath));
31395
31767
  cpSync(sourcePath, dest, { force: true });
31396
31768
  htmlPathRemap.set(sourcePath, dest);
31397
31769
  }
@@ -31433,7 +31805,7 @@ ${content.slice(firstUseIdx)}`;
31433
31805
  const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/html/") && (f2.endsWith(".html") || isStylePath(f2)));
31434
31806
  const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
31435
31807
  if (entry.startsWith(resolve28(reactIndexesPath))) {
31436
- const pageName = basename12(entry, ".tsx");
31808
+ const pageName = basename13(entry, ".tsx");
31437
31809
  return join40(reactPagesPath, `${pageName}.tsx`);
31438
31810
  }
31439
31811
  return null;
@@ -31464,7 +31836,7 @@ ${content.slice(firstUseIdx)}`;
31464
31836
  return new Set;
31465
31837
  const resolved = new Set;
31466
31838
  for (const entry of vueEntries) {
31467
- const name = basename12(entry, ".vue");
31839
+ const name = basename13(entry, ".vue");
31468
31840
  if (ssrOnlyPageNames.has(name)) {
31469
31841
  resolved.add(resolve28(entry));
31470
31842
  }
@@ -31677,7 +32049,7 @@ ${content.slice(firstUseIdx)}`;
31677
32049
  const compiledPath = compiledPaths[idx];
31678
32050
  if (!compiledPath)
31679
32051
  continue;
31680
- const name = basename12(compiledPath).replace(/\.[^.]+$/, "");
32052
+ const name = basename13(compiledPath).replace(/\.[^.]+$/, "");
31681
32053
  const result = await bunBuild7({
31682
32054
  entrypoints: [compiledPath],
31683
32055
  format: "esm",
@@ -32010,7 +32382,7 @@ ${content.slice(firstUseIdx)}`;
32010
32382
  globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
32011
32383
  entrypoints: globalCssEntries,
32012
32384
  naming: `[dir]/[name].[hash].[ext]`,
32013
- outdir: stylesDir ? join40(buildPath, basename12(stylesDir)) : buildPath,
32385
+ outdir: stylesDir ? join40(buildPath, basename13(stylesDir)) : buildPath,
32014
32386
  plugins: [stylePreprocessorPlugin2],
32015
32387
  root: stylesDir || clientRoot,
32016
32388
  target: "browser",
@@ -32019,7 +32391,7 @@ ${content.slice(firstUseIdx)}`;
32019
32391
  vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
32020
32392
  entrypoints: vueCssPaths,
32021
32393
  naming: `[name].[hash].[ext]`,
32022
- outdir: join40(buildPath, assetsPath ? basename12(assetsPath) : "assets", "css"),
32394
+ outdir: join40(buildPath, assetsPath ? basename13(assetsPath) : "assets", "css"),
32023
32395
  target: "browser",
32024
32396
  throw: false
32025
32397
  }, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
@@ -32040,7 +32412,7 @@ ${content.slice(firstUseIdx)}`;
32040
32412
  const mapFiles = readdirSync5(buildPath, { recursive: true }).filter((entry) => entry.endsWith(".js.map") && !entry.includes("node_modules")).map((entry) => join40(buildPath, entry));
32041
32413
  for (const mapPath of mapFiles) {
32042
32414
  chainExternalSourcemap2(mapPath);
32043
- renameSync(mapPath, join40(sourcemapDir, basename12(mapPath)));
32415
+ renameSync(mapPath, join40(sourcemapDir, basename13(mapPath)));
32044
32416
  const jsPath = mapPath.slice(0, -4);
32045
32417
  try {
32046
32418
  const js = readFileSync25(jsPath, "utf-8").replace(/\n?\/\/# sourceMappingURL=[^\n]*\s*$/, `
@@ -32169,7 +32541,7 @@ ${content.slice(firstUseIdx)}`;
32169
32541
  for (const artifact of serverOutputs) {
32170
32542
  if (extname9(artifact.path) !== ".js")
32171
32543
  continue;
32172
- const fileWithHash = basename12(artifact.path);
32544
+ const fileWithHash = basename13(artifact.path);
32173
32545
  const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
32174
32546
  if (!baseName)
32175
32547
  continue;
@@ -32189,7 +32561,7 @@ ${content.slice(firstUseIdx)}`;
32189
32561
  for (const artifact of cssOutputs) {
32190
32562
  if (extname9(artifact.path) !== ".css")
32191
32563
  continue;
32192
- const cssName = stripHash(basename12(artifact.path), artifact.hash);
32564
+ const cssName = stripHash(basename13(artifact.path), artifact.hash);
32193
32565
  if (cssName)
32194
32566
  cssByName.set(cssName, artifact);
32195
32567
  }
@@ -32199,7 +32571,7 @@ ${content.slice(firstUseIdx)}`;
32199
32571
  await Promise.all(serverOutputs.map(async (artifact) => {
32200
32572
  if (extname9(artifact.path) !== ".js")
32201
32573
  return;
32202
- const pascalName = stripHash(basename12(artifact.path), artifact.hash);
32574
+ const pascalName = stripHash(basename13(artifact.path), artifact.hash);
32203
32575
  if (!pascalName)
32204
32576
  return;
32205
32577
  serverJsByPascalName.set(pascalName, artifact);
@@ -32214,14 +32586,14 @@ ${content.slice(firstUseIdx)}`;
32214
32586
  const spaSideManifestPaths = [];
32215
32587
  if (vueSpaRoutesBySource && vueSpaRoutesBySource.size > 0) {
32216
32588
  await Promise.all([...vueSpaRoutesBySource.entries()].map(async ([source, routes]) => {
32217
- const parentName = basename12(source, ".vue");
32589
+ const parentName = basename13(source, ".vue");
32218
32590
  const parentArtifact = serverJsByPascalName.get(parentName);
32219
32591
  if (!parentArtifact)
32220
32592
  return;
32221
32593
  const sourceDir = dirname20(source);
32222
32594
  const entries = routes.flatMap(({ path, importPath }) => {
32223
32595
  const childSourcePath = resolve28(sourceDir, importPath);
32224
- const childName = basename12(childSourcePath, ".vue");
32596
+ const childName = basename13(childSourcePath, ".vue");
32225
32597
  const childArtifact = serverJsByPascalName.get(childName);
32226
32598
  if (!childArtifact)
32227
32599
  return [];
@@ -32238,12 +32610,12 @@ ${content.slice(firstUseIdx)}`;
32238
32610
  }));
32239
32611
  }
32240
32612
  for (const serverPath of emberServerPaths) {
32241
- const fileBase = basename12(serverPath, ".js");
32613
+ const fileBase = basename13(serverPath, ".js");
32242
32614
  manifest[toPascal(fileBase)] = serverPath;
32243
32615
  }
32244
32616
  if (skipAngularClientBundle) {
32245
32617
  for (const clientPath of angularClientPaths) {
32246
- const fileBase = basename12(clientPath, ".js");
32618
+ const fileBase = basename13(clientPath, ".js");
32247
32619
  const relFromCwd = relative14(projectRoot, clientPath).replace(/\\/g, "/");
32248
32620
  manifest[`${toPascal(fileBase)}Index`] = `/@src/${relFromCwd}`;
32249
32621
  }
@@ -32269,7 +32641,7 @@ ${content.slice(firstUseIdx)}`;
32269
32641
  const processHtmlPages = async () => {
32270
32642
  if (!(htmlDir && htmlPagesPath))
32271
32643
  return;
32272
- const outputHtmlPages = isSingle ? join40(buildPath, "pages") : join40(buildPath, basename12(htmlDir), "pages");
32644
+ const outputHtmlPages = isSingle ? join40(buildPath, "pages") : join40(buildPath, basename13(htmlDir), "pages");
32273
32645
  mkdirSync12(outputHtmlPages, { recursive: true });
32274
32646
  cpSync(htmlPagesPath, outputHtmlPages, {
32275
32647
  force: true,
@@ -32284,7 +32656,7 @@ ${content.slice(firstUseIdx)}`;
32284
32656
  for (const htmlFile of htmlPageFiles) {
32285
32657
  if (hmr)
32286
32658
  injectHMRIntoHTMLFile(htmlFile, "html");
32287
- const fileName = basename12(htmlFile, ".html");
32659
+ const fileName = basename13(htmlFile, ".html");
32288
32660
  if (manifest[fileName] && manifest[fileName] !== htmlFile) {
32289
32661
  warnManifestKeyCollision(fileName, manifest[fileName], htmlFile);
32290
32662
  }
@@ -32294,14 +32666,14 @@ ${content.slice(firstUseIdx)}`;
32294
32666
  const processHtmxPages = async () => {
32295
32667
  if (!(htmxDir && htmxPagesPath))
32296
32668
  return;
32297
- const outputHtmxPages = isSingle ? join40(buildPath, "pages") : join40(buildPath, basename12(htmxDir), "pages");
32669
+ const outputHtmxPages = isSingle ? join40(buildPath, "pages") : join40(buildPath, basename13(htmxDir), "pages");
32298
32670
  mkdirSync12(outputHtmxPages, { recursive: true });
32299
32671
  cpSync(htmxPagesPath, outputHtmxPages, {
32300
32672
  force: true,
32301
32673
  recursive: true
32302
32674
  });
32303
32675
  if (shouldCopyHtmx) {
32304
- const htmxDestDir = isSingle ? buildPath : join40(buildPath, basename12(htmxDir));
32676
+ const htmxDestDir = isSingle ? buildPath : join40(buildPath, basename13(htmxDir));
32305
32677
  copyHtmxVendor(htmxDir, htmxDestDir);
32306
32678
  }
32307
32679
  if (shouldUpdateHtmxAssetPaths) {
@@ -32313,7 +32685,7 @@ ${content.slice(firstUseIdx)}`;
32313
32685
  for (const htmxFile of htmxPageFiles) {
32314
32686
  if (hmr)
32315
32687
  injectHMRIntoHTMLFile(htmxFile, "htmx");
32316
- const fileName = basename12(htmxFile, ".html");
32688
+ const fileName = basename13(htmxFile, ".html");
32317
32689
  if (manifest[fileName] && manifest[fileName] !== htmxFile) {
32318
32690
  warnManifestKeyCollision(fileName, manifest[fileName], htmxFile);
32319
32691
  }
@@ -32364,6 +32736,29 @@ ${content.slice(firstUseIdx)}`;
32364
32736
  frameworks: frameworkNames,
32365
32737
  mode: mode ?? (isDev2 ? "development" : "production")
32366
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"));
32367
32762
  if (isIncremental) {
32368
32763
  writeBuildTrace(buildPath);
32369
32764
  return { conventions: conventionsMap, manifest };
@@ -32433,6 +32828,7 @@ var init_build = __esm(() => {
32433
32828
  init_buildDirectoryLock();
32434
32829
  init_logger();
32435
32830
  init_validateSafePath();
32831
+ init_spaRouteManifest();
32436
32832
  isDev2 = env3.NODE_ENV === "development";
32437
32833
  SKIP_DIRS5 = new Set([
32438
32834
  "build",
@@ -33150,7 +33546,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
33150
33546
  }, collectAngularResourceDirs = (angularDir) => {
33151
33547
  const out = new Set;
33152
33548
  const angularRoot = resolve31(angularDir);
33153
- const angularRootNormalized = normalizePath(angularRoot);
33549
+ const angularRootNormalized = normalizePath2(angularRoot);
33154
33550
  const walk = (dir) => {
33155
33551
  let entries;
33156
33552
  try {
@@ -33203,8 +33599,8 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
33203
33599
  }
33204
33600
  const componentDir = dirname21(full);
33205
33601
  for (const ref of refs) {
33206
- const refAbs = normalizePath(resolve31(componentDir, ref));
33207
- const refDir = normalizePath(dirname21(refAbs));
33602
+ const refAbs = normalizePath2(resolve31(componentDir, ref));
33603
+ const refDir = normalizePath2(dirname21(refAbs));
33208
33604
  if (refDir === angularRootNormalized || refDir.startsWith(`${angularRootNormalized}/`)) {
33209
33605
  continue;
33210
33606
  }
@@ -33220,7 +33616,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
33220
33616
  const push = (path) => {
33221
33617
  if (!path)
33222
33618
  return;
33223
- const abs = normalizePath(resolve31(cwd2, path));
33619
+ const abs = normalizePath2(resolve31(cwd2, path));
33224
33620
  if (!roots.includes(abs))
33225
33621
  roots.push(abs);
33226
33622
  };
@@ -33245,7 +33641,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
33245
33641
  push(cfg.assetsDir);
33246
33642
  push(cfg.stylesDir);
33247
33643
  for (const candidate of ["src", "db", "assets", "styles"]) {
33248
- const abs = normalizePath(resolve31(cwd2, candidate));
33644
+ const abs = normalizePath2(resolve31(cwd2, candidate));
33249
33645
  if (existsSync33(abs) && !roots.includes(abs))
33250
33646
  roots.push(abs);
33251
33647
  }
@@ -33257,7 +33653,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
33257
33653
  continue;
33258
33654
  if (entry.name.startsWith("."))
33259
33655
  continue;
33260
- const abs = normalizePath(resolve31(cwd2, entry.name));
33656
+ const abs = normalizePath2(resolve31(cwd2, entry.name));
33261
33657
  if (roots.includes(abs))
33262
33658
  continue;
33263
33659
  if (shouldIgnorePath(abs, resolved))
@@ -33282,7 +33678,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
33282
33678
  const push = (base, sub) => {
33283
33679
  if (!base)
33284
33680
  return;
33285
- const normalizedBase = normalizePath(base);
33681
+ const normalizedBase = normalizePath2(base);
33286
33682
  paths.push(sub ? `${normalizedBase}/${sub}` : normalizedBase);
33287
33683
  };
33288
33684
  const cfg = resolved ?? {
@@ -33300,9 +33696,9 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
33300
33696
  push(cfg.htmxDir, "styles");
33301
33697
  }
33302
33698
  for (const root of roots) {
33303
- if (root === normalizePath(cfg.htmlDir ?? ""))
33699
+ if (root === normalizePath2(cfg.htmlDir ?? ""))
33304
33700
  continue;
33305
- if (root === normalizePath(cfg.htmxDir ?? ""))
33701
+ if (root === normalizePath2(cfg.htmxDir ?? ""))
33306
33702
  continue;
33307
33703
  paths.push(root);
33308
33704
  }
@@ -33571,7 +33967,7 @@ var computeFileHash = (filePath) => {
33571
33967
  return UNFOUND_INDEX;
33572
33968
  }
33573
33969
  }, hasFileChanged = (filePath, currentHash, previousHashes) => {
33574
- const normalizedPath = normalizePath(filePath);
33970
+ const normalizedPath = normalizePath2(filePath);
33575
33971
  const previousHash = previousHashes.get(normalizedPath);
33576
33972
  if (previousHash === undefined) {
33577
33973
  return true;
@@ -33672,7 +34068,7 @@ var classifyComponent = (filePath) => {
33672
34068
  var init_reactComponentClassifier = () => {};
33673
34069
 
33674
34070
  // src/dev/moduleMapper.ts
33675
- import { basename as basename13, resolve as resolve35 } from "path";
34071
+ import { basename as basename14, resolve as resolve35 } from "path";
33676
34072
  var buildModulePaths = (moduleKeys, manifest) => {
33677
34073
  const modulePaths = {};
33678
34074
  moduleKeys.forEach((key) => {
@@ -33719,7 +34115,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
33719
34115
  return grouped;
33720
34116
  }, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
33721
34117
  const normalizedFile = resolve35(sourceFile);
33722
- const fileName = basename13(normalizedFile);
34118
+ const fileName = basename14(normalizedFile);
33723
34119
  const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
33724
34120
  const pascalName = toPascal(baseName);
33725
34121
  const keys = [];
@@ -34166,7 +34562,7 @@ __export(exports_moduleServer, {
34166
34562
  SRC_URL_PREFIX: () => SRC_URL_PREFIX
34167
34563
  });
34168
34564
  import { existsSync as existsSync35, readFileSync as readFileSync30, realpathSync as realpathSync3, statSync as statSync6 } from "fs";
34169
- 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";
34170
34566
  var SRC_PREFIX = "/@src/", jsTranspiler2, legacyDecoratorTsconfig, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
34171
34567
  const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
34172
34568
  const allExports = [];
@@ -34599,7 +34995,7 @@ ${code}`;
34599
34995
  if (!vueCompiler) {
34600
34996
  vueCompiler = await import("@vue/compiler-sfc");
34601
34997
  }
34602
- const fileName = basename14(filePath, ".vue");
34998
+ const fileName = basename15(filePath, ".vue");
34603
34999
  const componentId = toKebab(fileName);
34604
35000
  const { descriptor } = vueCompiler.parse(raw, { filename: filePath });
34605
35001
  const hasScript = descriptor.script || descriptor.scriptSetup;
@@ -35327,7 +35723,7 @@ var init_simpleHTMXHMR = () => {};
35327
35723
 
35328
35724
  // src/dev/rebuildTrigger.ts
35329
35725
  import { existsSync as existsSync36, rmSync as rmSync3 } from "fs";
35330
- 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";
35331
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) => {
35332
35728
  if (!config2.tailwind)
35333
35729
  return;
@@ -35828,7 +36224,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
35828
36224
  if (serverDirs.length <= 1) {
35829
36225
  const dir = getFrameworkGeneratedDir2(framework, projectRoot);
35830
36226
  return {
35831
- serverOutDir: resolve41(resolvedPaths.buildDir, basename15(dir)),
36227
+ serverOutDir: resolve41(resolvedPaths.buildDir, basename16(dir)),
35832
36228
  serverRoot: resolve41(dir, "server")
35833
36229
  };
35834
36230
  }
@@ -35837,7 +36233,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
35837
36233
  serverRoot: commonAncestor2(serverDirs.map((entry) => entry.dir), projectRoot)
35838
36234
  };
35839
36235
  }, updateServerManifestEntry = (state, artifact) => {
35840
- const fileWithHash = basename15(artifact.path);
36236
+ const fileWithHash = basename16(artifact.path);
35841
36237
  const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
35842
36238
  if (!baseName) {
35843
36239
  return;
@@ -35851,7 +36247,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
35851
36247
  const prefixByDir = new Map;
35852
36248
  for (const artifact of freshOutputs) {
35853
36249
  const dir = dirname26(artifact.path);
35854
- const name = basename15(artifact.path);
36250
+ const name = basename16(artifact.path);
35855
36251
  const [prefix] = name.split(".");
35856
36252
  if (!prefix)
35857
36253
  continue;
@@ -36337,7 +36733,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
36337
36733
  await rewriteImports3(ssrPaths, angServerVendorPaths);
36338
36734
  }
36339
36735
  serverPaths.forEach((serverPath, idx) => {
36340
- const fileBase = basename15(serverPath, ".js");
36736
+ const fileBase = basename16(serverPath, ".js");
36341
36737
  const ssrPath = ssrPaths[idx] ?? serverPath;
36342
36738
  state.manifest[toPascal(fileBase)] = resolve41(ssrPath);
36343
36739
  });
@@ -36700,7 +37096,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
36700
37096
  const duration3 = Date.now() - startTime;
36701
37097
  const broadcastFiles = svelteFiles.length > 0 ? svelteFiles : filesToRebuild;
36702
37098
  broadcastFiles.forEach((sveltePagePath) => {
36703
- const fileName = basename15(sveltePagePath);
37099
+ const fileName = basename16(sveltePagePath);
36704
37100
  const baseName = fileName.replace(/\.svelte$/, "");
36705
37101
  const pascalName = toPascal(baseName);
36706
37102
  const cssKey = `${pascalName}CSS`;
@@ -36780,7 +37176,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
36780
37176
  const { vueServerPaths, vueIndexPaths, vueClientPaths, vueCssPaths } = await compileVue2(vueFiles, vueDir, true, getStyleTransformConfig(state.config));
36781
37177
  const serverEntries = [...vueServerPaths];
36782
37178
  const clientEntries = [...vueIndexPaths, ...vueClientPaths];
36783
- 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");
36784
37180
  const { serverRoot, serverOutDir } = await computeServerOutPaths(state.resolvedPaths, "vue");
36785
37181
  const [serverResult, clientResult, cssResult] = await Promise.all([
36786
37182
  serverEntries.length > 0 ? bunBuild9({
@@ -36928,7 +37324,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
36928
37324
  const { compileEmber: compileEmber2 } = await Promise.resolve().then(() => (init_compileEmber(), exports_compileEmber));
36929
37325
  const { serverPaths } = await compileEmber2(allPageEntries, emberDir, process.cwd(), true);
36930
37326
  for (const serverPath of serverPaths) {
36931
- const fileBase = basename15(serverPath, ".js");
37327
+ const fileBase = basename16(serverPath, ".js");
36932
37328
  state.manifest[toPascal(fileBase)] = resolve41(serverPath);
36933
37329
  }
36934
37330
  const { invalidateEmberSsrCache: invalidateEmberSsrCache2 } = await Promise.resolve().then(() => (init_ember(), exports_ember));
@@ -36999,7 +37395,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
36999
37395
  });
37000
37396
  }
37001
37397
  }, handleScriptUpdate = (state, scriptFile, manifest, framework, duration3) => {
37002
- const scriptBaseName = basename15(scriptFile).replace(/\.(ts|js|tsx|jsx)$/, "");
37398
+ const scriptBaseName = basename16(scriptFile).replace(/\.(ts|js|tsx|jsx)$/, "");
37003
37399
  const pascalName = toPascal(scriptBaseName);
37004
37400
  const scriptPath = manifest[pascalName] || null;
37005
37401
  if (!scriptPath) {
@@ -37078,7 +37474,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
37078
37474
  if (isSingle) {
37079
37475
  return resolve41(state.resolvedPaths.buildDir, "pages");
37080
37476
  }
37081
- 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");
37082
37478
  return resolve41(state.resolvedPaths.buildDir, dirName, "pages");
37083
37479
  }, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration3) => {
37084
37480
  try {
@@ -37117,7 +37513,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
37117
37513
  const shouldRefreshAllPages = htmlPageFiles.length === 0 && shouldRefreshFromIslandChange;
37118
37514
  const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
37119
37515
  await runSequentially(pageFilesToUpdate, async (pageFile) => {
37120
- const htmlPageName = basename15(pageFile);
37516
+ const htmlPageName = basename16(pageFile);
37121
37517
  const builtHtmlPagePath = resolve41(outputHtmlPages, htmlPageName);
37122
37518
  await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration3);
37123
37519
  });
@@ -37126,7 +37522,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
37126
37522
  if (!cssFile) {
37127
37523
  return;
37128
37524
  }
37129
- const cssBaseName = basename15(getStyleBaseName(cssFile));
37525
+ const cssBaseName = basename16(getStyleBaseName(cssFile));
37130
37526
  const cssPascalName = toPascal(cssBaseName);
37131
37527
  const cssKey = `${cssPascalName}CSS`;
37132
37528
  const cssUrl = manifest[cssKey] || null;
@@ -37175,7 +37571,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
37175
37571
  type: "vue-update"
37176
37572
  });
37177
37573
  }, broadcastVuePageChange = async (state, config2, vuePagePath, manifest, duration3) => {
37178
- const fileName = basename15(vuePagePath);
37574
+ const fileName = basename16(vuePagePath);
37179
37575
  const baseName = fileName.replace(/\.vue$/, "");
37180
37576
  const pascalName = toPascal(baseName);
37181
37577
  const vueRoot = config2.vueDirectory;
@@ -37221,7 +37617,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
37221
37617
  if (!cssFile) {
37222
37618
  return;
37223
37619
  }
37224
- const cssBaseName = basename15(getStyleBaseName(cssFile));
37620
+ const cssBaseName = basename16(getStyleBaseName(cssFile));
37225
37621
  const cssPascalName = toPascal(cssBaseName);
37226
37622
  const cssKey = `${cssPascalName}CSS`;
37227
37623
  const cssUrl = manifest[cssKey] || null;
@@ -37239,7 +37635,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
37239
37635
  });
37240
37636
  }, broadcastSveltePageUpdate = (state, sveltePagePath, manifest, duration3) => {
37241
37637
  try {
37242
- const fileName = basename15(sveltePagePath);
37638
+ const fileName = basename16(sveltePagePath);
37243
37639
  const baseName = fileName.replace(/\.svelte$/, "");
37244
37640
  const pascalName = toPascal(baseName);
37245
37641
  const cssKey = `${pascalName}CSS`;
@@ -37288,7 +37684,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
37288
37684
  if (!cssFile) {
37289
37685
  return;
37290
37686
  }
37291
- const cssBaseName = basename15(getStyleBaseName(cssFile));
37687
+ const cssBaseName = basename16(getStyleBaseName(cssFile));
37292
37688
  const cssPascalName = toPascal(cssBaseName);
37293
37689
  const cssKey = `${cssPascalName}CSS`;
37294
37690
  const cssUrl = manifest[cssKey] || null;
@@ -37368,7 +37764,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
37368
37764
  const shouldRefreshAllPages = htmxPageFiles.length === 0 && shouldRefreshFromIslandChange;
37369
37765
  const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
37370
37766
  await runSequentially(pageFilesToUpdate, async (htmxPageFile) => {
37371
- const htmxPageName = basename15(htmxPageFile);
37767
+ const htmxPageName = basename16(htmxPageFile);
37372
37768
  const builtHtmxPagePath = resolve41(outputHtmxPages, htmxPageName);
37373
37769
  await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration3);
37374
37770
  });
@@ -37478,7 +37874,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
37478
37874
  html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
37479
37875
  writeFs(destPath, html);
37480
37876
  }, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
37481
- const destPath = resolve41(outputDir, basename15(sourceFile));
37877
+ const destPath = resolve41(outputDir, basename16(sourceFile));
37482
37878
  const hmrScript = extractHmrScript(destPath, readFs);
37483
37879
  const source = await Bun.file(sourceFile).text();
37484
37880
  await Bun.write(destPath, source);
@@ -40082,7 +40478,7 @@ var handleHTMXPageRequest = async (pagePath) => {
40082
40478
  // src/core/prepare.ts
40083
40479
  import { createHash as createHash5 } from "crypto";
40084
40480
  import { existsSync as existsSync39, readdirSync as readdirSync9, readFileSync as readFileSync33 } from "fs";
40085
- 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";
40086
40482
  import { Elysia as Elysia8 } from "elysia";
40087
40483
 
40088
40484
  // src/plugins/openApiPlugin.ts
@@ -40230,304 +40626,8 @@ var loadIslandRegistry = async (registryPath) => {
40230
40626
 
40231
40627
  // src/core/prepare.ts
40232
40628
  init_pageMetadata();
40233
-
40234
- // src/utils/resolveConvention.ts
40235
- import { basename as basename2 } from "path";
40236
- var CONVENTIONS_KEY = "__absoluteConventions";
40237
- var isConventionsMap = (value) => Boolean(value) && typeof value === "object";
40238
- var getMap = () => {
40239
- const value = Reflect.get(globalThis, CONVENTIONS_KEY);
40240
- if (isConventionsMap(value))
40241
- return value;
40242
- const empty = {};
40243
- return empty;
40244
- };
40245
- var derivePageName = (pagePath) => {
40246
- const base = basename2(pagePath);
40247
- const dotIndex = base.indexOf(".");
40248
- const name = dotIndex > 0 ? base.slice(0, dotIndex) : base;
40249
- return toPascal(name);
40250
- };
40251
- var normalizeConventionPageName = (name) => toPascal(name).replace(/\d+$/, "");
40252
- var hasErrorConvention = (framework) => {
40253
- const conventions2 = getMap()[framework];
40254
- if (!conventions2)
40255
- return false;
40256
- if (conventions2.defaults?.error)
40257
- return true;
40258
- return Object.values(conventions2.pages ?? {}).some((page) => Boolean(page.error));
40259
- };
40260
- var resolveErrorConventionPath = (framework, pageName) => {
40261
- const conventions2 = getMap()[framework];
40262
- if (!conventions2)
40263
- return;
40264
- const exact = conventions2.pages?.[pageName]?.error;
40265
- if (exact)
40266
- return exact;
40267
- const normalizedPageName = normalizeConventionPageName(pageName);
40268
- for (const [candidate, page] of Object.entries(conventions2.pages ?? {})) {
40269
- if (normalizeConventionPageName(candidate) === normalizedPageName) {
40270
- return page.error ?? conventions2.defaults?.error;
40271
- }
40272
- }
40273
- return conventions2.defaults?.error;
40274
- };
40275
- var resolveNotFoundConventionPath = (framework) => getMap()[framework]?.defaults?.notFound;
40276
- var setConventions = (map3) => {
40277
- Reflect.set(globalThis, CONVENTIONS_KEY, map3);
40278
- };
40279
- var isDev = () => true;
40280
- var buildErrorProps = (error) => {
40281
- if (error instanceof Error) {
40282
- return {
40283
- name: error.name,
40284
- message: error.message,
40285
- ...isDev() && error.stack ? { stack: error.stack } : {}
40286
- };
40287
- }
40288
- return { message: String(error), name: "Error" };
40289
- };
40290
- var renderReactError = async (conventionPath, errorProps) => {
40291
- const { createElement } = await import("react");
40292
- const { renderToReadableStream } = await import("react-dom/server");
40293
- const mod = await import(conventionPath);
40294
- const ErrorComponent = mod.default;
40295
- if (typeof ErrorComponent !== "function")
40296
- return null;
40297
- const element = createElement(ErrorComponent, errorProps);
40298
- const stream = await renderToReadableStream(element);
40299
- return new Response(stream, {
40300
- headers: { "Content-Type": "text/html" },
40301
- status: 500
40302
- });
40303
- };
40304
- var renderSvelteError = async (conventionPath, errorProps) => {
40305
- const { render } = await import("svelte/server");
40306
- const mod = await import(conventionPath);
40307
- const ErrorComponent = mod.default;
40308
- if (!ErrorComponent)
40309
- return null;
40310
- const { head, body } = render(ErrorComponent, {
40311
- props: errorProps
40312
- });
40313
- const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
40314
- return new Response(html, {
40315
- headers: { "Content-Type": "text/html" },
40316
- status: 500
40317
- });
40318
- };
40319
- var unescapeVueStyles = (ssrBody) => {
40320
- let styles = "";
40321
- const body = ssrBody.replace(/<style>([\s\S]*?)<\/style>/g, (_2, css) => {
40322
- styles += `<style>${css.replace(/&quot;/g, '"').replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">")}</style>`;
40323
- return "";
40324
- });
40325
- return { body, styles };
40326
- };
40327
- var renderVueError = async (conventionPath, errorProps) => {
40328
- const { createSSRApp, h: h2 } = await import("vue");
40329
- const { renderToString } = await import("vue/server-renderer");
40330
- const mod = await import(conventionPath);
40331
- const ErrorComponent = mod.default;
40332
- if (!ErrorComponent)
40333
- return null;
40334
- const app = createSSRApp({
40335
- render: () => h2(ErrorComponent, errorProps)
40336
- });
40337
- const rawBody = await renderToString(app);
40338
- const { styles, body } = unescapeVueStyles(rawBody);
40339
- const html = `<!DOCTYPE html><html><head>${styles}</head><body><div id="root">${body}</div></body></html>`;
40340
- return new Response(html, {
40341
- headers: { "Content-Type": "text/html" },
40342
- status: 500
40343
- });
40344
- };
40345
- var renderAngularError = async (conventionPath, errorProps) => {
40346
- const mod = await import(conventionPath);
40347
- const renderFn = mod.default;
40348
- if (typeof renderFn !== "function")
40349
- return null;
40350
- const html = renderFn(errorProps);
40351
- return new Response(html, {
40352
- headers: { "Content-Type": "text/html" },
40353
- status: 500
40354
- });
40355
- };
40356
- var escapeHtml = (value) => value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
40357
- 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) : "");
40358
- var renderHtmlError = async (conventionPath, errorProps) => {
40359
- const template = await Bun.file(conventionPath).text();
40360
- const html = replaceErrorTokens(template, errorProps);
40361
- return new Response(html, {
40362
- headers: { "Content-Type": "text/html" },
40363
- status: 500
40364
- });
40365
- };
40366
- var logConventionRenderError = (framework, label, renderError) => {
40367
- const message = renderError instanceof Error ? renderError.message : "";
40368
- if (message.includes("Cannot find module") || message.includes("Cannot find package") || message.includes("not found in module")) {
40369
- 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}).`);
40370
- return;
40371
- }
40372
- console.error(`[SSR] Failed to render ${framework} convention ${label} page:`, renderError);
40373
- };
40374
- var renderEmberError = async () => null;
40375
- var renderEmberNotFound = async () => null;
40376
- var ERROR_RENDERERS = {
40377
- angular: renderAngularError,
40378
- ember: renderEmberError,
40379
- html: renderHtmlError,
40380
- react: renderReactError,
40381
- svelte: renderSvelteError,
40382
- vue: renderVueError
40383
- };
40384
- var tryFrameworkErrorConvention = async (framework, pageName, errorProps, error) => {
40385
- let conventionPath = resolveErrorConventionPath(framework, pageName);
40386
- if (!conventionPath && error instanceof Error && error.stack) {
40387
- for (const match of error.stack.matchAll(/^\s*at\s+([A-Za-z_$][\w$]*)/gm)) {
40388
- const candidate = match[1];
40389
- if (!candidate)
40390
- continue;
40391
- conventionPath = resolveErrorConventionPath(framework, candidate);
40392
- if (conventionPath)
40393
- break;
40394
- }
40395
- }
40396
- if (!conventionPath)
40397
- return null;
40398
- const renderer = ERROR_RENDERERS[framework];
40399
- if (!renderer)
40400
- return null;
40401
- try {
40402
- return await renderer(conventionPath, errorProps);
40403
- } catch (renderError) {
40404
- logConventionRenderError(framework, "error", renderError);
40405
- }
40406
- return null;
40407
- };
40408
- var renderConventionError = async (framework, pageName, error) => {
40409
- const errorProps = buildErrorProps(error);
40410
- const frameworkResponse = await tryFrameworkErrorConvention(framework, pageName, errorProps, error);
40411
- if (frameworkResponse)
40412
- return frameworkResponse;
40413
- if (framework !== "html") {
40414
- const htmlResponse = await tryFrameworkErrorConvention("html", pageName, errorProps, error);
40415
- if (htmlResponse)
40416
- return htmlResponse;
40417
- }
40418
- return null;
40419
- };
40420
- var renderReactNotFound = async (conventionPath) => {
40421
- const { createElement } = await import("react");
40422
- const { renderToReadableStream } = await import("react-dom/server");
40423
- const mod = await import(conventionPath);
40424
- const NotFoundComponent = mod.default;
40425
- if (typeof NotFoundComponent !== "function")
40426
- return null;
40427
- const element = createElement(NotFoundComponent);
40428
- const stream = await renderToReadableStream(element);
40429
- return new Response(stream, {
40430
- headers: { "Content-Type": "text/html" },
40431
- status: 404
40432
- });
40433
- };
40434
- var renderSvelteNotFound = async (conventionPath) => {
40435
- const { render } = await import("svelte/server");
40436
- const mod = await import(conventionPath);
40437
- const NotFoundComponent = mod.default;
40438
- if (!NotFoundComponent)
40439
- return null;
40440
- const { head, body } = render(NotFoundComponent);
40441
- const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
40442
- return new Response(html, {
40443
- headers: { "Content-Type": "text/html" },
40444
- status: 404
40445
- });
40446
- };
40447
- var renderVueNotFound = async (conventionPath) => {
40448
- const { createSSRApp, h: h2 } = await import("vue");
40449
- const { renderToString } = await import("vue/server-renderer");
40450
- const mod = await import(conventionPath);
40451
- const NotFoundComponent = mod.default;
40452
- if (!NotFoundComponent)
40453
- return null;
40454
- const app = createSSRApp({
40455
- render: () => h2(NotFoundComponent)
40456
- });
40457
- const rawBody = await renderToString(app);
40458
- const { styles, body } = unescapeVueStyles(rawBody);
40459
- const html = `<!DOCTYPE html><html><head>${styles}</head><body><div id="root">${body}</div></body></html>`;
40460
- return new Response(html, {
40461
- headers: { "Content-Type": "text/html" },
40462
- status: 404
40463
- });
40464
- };
40465
- var renderAngularNotFound = async (conventionPath) => {
40466
- const mod = await import(conventionPath);
40467
- const renderFn = mod.default;
40468
- if (typeof renderFn !== "function")
40469
- return null;
40470
- const html = renderFn();
40471
- return new Response(html, {
40472
- headers: { "Content-Type": "text/html" },
40473
- status: 404
40474
- });
40475
- };
40476
- var renderHtmlNotFound = async (conventionPath) => {
40477
- const html = await Bun.file(conventionPath).text();
40478
- return new Response(html, {
40479
- headers: { "Content-Type": "text/html" },
40480
- status: 404
40481
- });
40482
- };
40483
- var NOT_FOUND_RENDERERS = {
40484
- angular: renderAngularNotFound,
40485
- ember: renderEmberNotFound,
40486
- html: renderHtmlNotFound,
40487
- react: renderReactNotFound,
40488
- svelte: renderSvelteNotFound,
40489
- vue: renderVueNotFound
40490
- };
40491
- var renderConventionNotFound = async (framework) => {
40492
- const conventionPath = resolveNotFoundConventionPath(framework);
40493
- if (!conventionPath)
40494
- return null;
40495
- const renderer = NOT_FOUND_RENDERERS[framework];
40496
- if (!renderer)
40497
- return null;
40498
- try {
40499
- return await renderer(conventionPath);
40500
- } catch (renderError) {
40501
- logConventionRenderError(framework, "not-found", renderError);
40502
- }
40503
- return null;
40504
- };
40505
- var NOT_FOUND_PRIORITY = [
40506
- "react",
40507
- "svelte",
40508
- "vue",
40509
- "angular",
40510
- "html"
40511
- ];
40512
- var renderFirstNotFound = async () => {
40513
- const renderNext = async (frameworks2) => {
40514
- const [framework, ...remaining] = frameworks2;
40515
- if (!framework) {
40516
- return null;
40517
- }
40518
- if (!getMap()[framework]?.defaults?.notFound) {
40519
- return renderNext(remaining);
40520
- }
40521
- const response = await renderConventionNotFound(framework);
40522
- if (response) {
40523
- return response;
40524
- }
40525
- return renderNext(remaining);
40526
- };
40527
- return renderNext(NOT_FOUND_PRIORITY);
40528
- };
40529
-
40530
- // src/core/prepare.ts
40629
+ init_resolveConvention();
40630
+ init_spaRouteManifest();
40531
40631
  init_startupTimings();
40532
40632
  init_logger();
40533
40633
  var MS_PER_SECOND2 = 1000;
@@ -40754,7 +40854,7 @@ var loadPrerenderMap = (prerenderDir) => {
40754
40854
  for (const entry of entries) {
40755
40855
  if (!entry.endsWith(".html"))
40756
40856
  continue;
40757
- const name = basename16(entry, ".html");
40857
+ const name = basename17(entry, ".html");
40758
40858
  const route = name === "index" ? "/" : `/${name}`;
40759
40859
  map3.set(route, join49(prerenderDir, entry));
40760
40860
  }
@@ -40822,6 +40922,10 @@ var prepare = async (configOrPath) => {
40822
40922
  const conventions2 = JSON.parse(readFileSync33(conventionsPath, "utf-8"));
40823
40923
  setConventions(conventions2);
40824
40924
  }
40925
+ const spaRoutesPath = join49(buildDir, "spa-routes.json");
40926
+ if (existsSync39(spaRoutesPath)) {
40927
+ setSpaRouteManifest(JSON.parse(readFileSync33(spaRoutesPath, "utf-8")));
40928
+ }
40825
40929
  recordStep("load production conventions", stepStartedAt);
40826
40930
  stepStartedAt = performance.now();
40827
40931
  const { staticPlugin } = await import("@elysia/static");
@@ -41062,7 +41166,7 @@ import {
41062
41166
  writeFileSync as writeFileSync11
41063
41167
  } from "fs";
41064
41168
  import { homedir as homedir2 } from "os";
41065
- import { basename as basename17, join as join51 } from "path";
41169
+ import { basename as basename18, join as join51 } from "path";
41066
41170
  var registeredPids = new Set;
41067
41171
  var exitHandlerRegistered = false;
41068
41172
  var instanceFilePath = (pid) => join51(instanceRegistryDir(), `${pid}.json`);
@@ -41106,7 +41210,7 @@ var resolveProjectName = (cwd2) => {
41106
41210
  if (parsed !== null && typeof parsed === "object" && typeof parsed.name === "string" && parsed.name.trim().length > 0) {
41107
41211
  return parsed.name;
41108
41212
  }
41109
- return basename17(cwd2) || "unknown";
41213
+ return basename18(cwd2) || "unknown";
41110
41214
  };
41111
41215
 
41112
41216
  // src/utils/networking.ts
@@ -47776,5 +47880,5 @@ export {
47776
47880
  ANGULAR_INIT_TIMEOUT_MS
47777
47881
  };
47778
47882
 
47779
- //# debugId=1D2543DFA3A7B3D964756E2164756E21
47883
+ //# debugId=BB6BCC85C00C3B8064756E2164756E21
47780
47884
  //# sourceMappingURL=index.js.map