@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/build.js CHANGED
@@ -4746,6 +4746,10 @@ var init_devRouteRegistrationCallsite = __esm(() => {
4746
4746
  });
4747
4747
 
4748
4748
  // src/angular/staticAnalyzeSpaRoutes.ts
4749
+ var exports_staticAnalyzeSpaRoutes = {};
4750
+ __export(exports_staticAnalyzeSpaRoutes, {
4751
+ analyzeAngularSpaRoutes: () => analyzeAngularSpaRoutes
4752
+ });
4749
4753
  import { existsSync as existsSync8, promises as fs } from "fs";
4750
4754
  import { join as join11 } from "path";
4751
4755
  import ts3 from "typescript";
@@ -4844,8 +4848,6 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
4844
4848
  extractRoutePaths(childrenLiteral, joined, sitemapExcluded, out);
4845
4849
  continue;
4846
4850
  }
4847
- if (redirected)
4848
- continue;
4849
4851
  if (joined === "")
4850
4852
  continue;
4851
4853
  out.push({
@@ -4974,6 +4976,10 @@ var init_staticAnalyzeSpaRoutes = __esm(() => {
4974
4976
  });
4975
4977
 
4976
4978
  // src/react/staticAnalyzeSpaRoutes.ts
4979
+ var exports_staticAnalyzeSpaRoutes2 = {};
4980
+ __export(exports_staticAnalyzeSpaRoutes2, {
4981
+ analyzeReactSpaRoutes: () => analyzeReactSpaRoutes
4982
+ });
4977
4983
  import { existsSync as existsSync9, promises as fs2 } from "fs";
4978
4984
  import { join as join12 } from "path";
4979
4985
  import ts4 from "typescript";
@@ -5070,8 +5076,6 @@ var DYNAMIC_SEGMENT_PATTERN2, pathHasDynamic2 = (path) => path.split("/").some((
5070
5076
  extractRouteEntries(childrenLiteral, joined, out);
5071
5077
  continue;
5072
5078
  }
5073
- if (redirected)
5074
- continue;
5075
5079
  if (!isIndex && pathSegment === null)
5076
5080
  continue;
5077
5081
  if (joined === "")
@@ -5184,6 +5188,10 @@ var init_staticAnalyzeSpaRoutes2 = __esm(() => {
5184
5188
  });
5185
5189
 
5186
5190
  // src/svelte/staticAnalyzeSpaRoutes.ts
5191
+ var exports_staticAnalyzeSpaRoutes3 = {};
5192
+ __export(exports_staticAnalyzeSpaRoutes3, {
5193
+ analyzeSvelteSpaRoutes: () => analyzeSvelteSpaRoutes
5194
+ });
5187
5195
  import { existsSync as existsSync10, promises as fs3 } from "fs";
5188
5196
  import { join as join13 } from "path";
5189
5197
  var DYNAMIC_SEGMENT_PATTERN3, pathHasDynamic3 = (path) => path.split("/").some((seg) => DYNAMIC_SEGMENT_PATTERN3.test(seg) || seg === "**"), joinSegments3 = (parent, child) => {
@@ -5288,6 +5296,10 @@ var init_staticAnalyzeSpaRoutes3 = __esm(() => {
5288
5296
  });
5289
5297
 
5290
5298
  // src/vue/staticAnalyzeSpaRoutes.ts
5299
+ var exports_staticAnalyzeSpaRoutes4 = {};
5300
+ __export(exports_staticAnalyzeSpaRoutes4, {
5301
+ analyzeVueSpaRoutes: () => analyzeVueSpaRoutes
5302
+ });
5291
5303
  import { existsSync as existsSync11, promises as fs4 } from "fs";
5292
5304
  import { join as join14 } from "path";
5293
5305
  import ts5 from "typescript";
@@ -5349,6 +5361,7 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
5349
5361
  let pathSegment = null;
5350
5362
  let redirected = false;
5351
5363
  let sitemapExcluded = false;
5364
+ let alias = null;
5352
5365
  let childrenLiteral = null;
5353
5366
  for (const property of element.properties) {
5354
5367
  const key = readPropertyKey3(property);
@@ -5358,6 +5371,8 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
5358
5371
  continue;
5359
5372
  if (key === "path") {
5360
5373
  pathSegment = readStringLiteral3(property.initializer);
5374
+ } else if (key === "alias") {
5375
+ alias = readStringLiteral3(property.initializer);
5361
5376
  } else if (key === "redirect") {
5362
5377
  redirected = true;
5363
5378
  } else if (key === "children" && ts5.isArrayLiteralExpression(property.initializer)) {
@@ -5382,8 +5397,6 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
5382
5397
  extractRouteEntries2(childrenLiteral, joined, out);
5383
5398
  continue;
5384
5399
  }
5385
- if (redirected)
5386
- continue;
5387
5400
  if (joined === "")
5388
5401
  continue;
5389
5402
  out.push({
@@ -5392,7 +5405,34 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
5392
5405
  redirected,
5393
5406
  sitemapExcluded
5394
5407
  });
5408
+ if (alias) {
5409
+ out.push({
5410
+ dynamic: pathHasDynamic4(alias),
5411
+ path: alias,
5412
+ redirected: false,
5413
+ sitemapExcluded: true
5414
+ });
5415
+ }
5395
5416
  }
5417
+ }, findDefineRoutesArray = (sf) => {
5418
+ let found = null;
5419
+ const visit = (node) => {
5420
+ if (found)
5421
+ return;
5422
+ if (ts5.isCallExpression(node) && ts5.isIdentifier(node.expression) && node.expression.text === "defineRoutes" && node.arguments[0] && ts5.isArrayLiteralExpression(node.arguments[0])) {
5423
+ found = node.arguments[0];
5424
+ return;
5425
+ }
5426
+ ts5.forEachChild(node, visit);
5427
+ };
5428
+ ts5.forEachChild(sf, visit);
5429
+ return found;
5430
+ }, inferBaseHref = (routes) => {
5431
+ const firstSegments = routes.map((route) => route.path.split("/").filter(Boolean)[0]).filter((segment) => Boolean(segment));
5432
+ const first = firstSegments[0];
5433
+ if (!first || firstSegments.some((segment) => segment !== first))
5434
+ return "/";
5435
+ return `/${first}/`;
5396
5436
  }, findCreateRouterCall = (sf) => {
5397
5437
  let found = null;
5398
5438
  const visit = (node) => {
@@ -5466,24 +5506,19 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
5466
5506
  return null;
5467
5507
  analysisSource = script;
5468
5508
  }
5469
- if (!analysisSource.includes("createRouter"))
5509
+ if (!analysisSource.includes("createRouter") && !analysisSource.includes("defineRoutes"))
5470
5510
  return null;
5471
5511
  const sf = ts5.createSourceFile(filePath, analysisSource, ts5.ScriptTarget.Latest, true, ts5.ScriptKind.TS);
5472
- if (!importsSymbolFrom2(sf, "createRouter", "vue-router"))
5473
- return null;
5474
- const call = findCreateRouterCall(sf);
5475
- if (!call)
5476
- return null;
5477
- const optionsArg = call.arguments[0];
5478
- if (!optionsArg)
5479
- return null;
5480
- const routesArray = readRoutesFromCreateRouterOptions(sf, optionsArg);
5512
+ const defineRoutesArray = findDefineRoutesArray(sf);
5513
+ const call = importsSymbolFrom2(sf, "createRouter", "vue-router") ? findCreateRouterCall(sf) : null;
5514
+ const optionsArg = call?.arguments[0];
5515
+ const routesArray = defineRoutesArray ?? (optionsArg ? readRoutesFromCreateRouterOptions(sf, optionsArg) : null);
5481
5516
  if (!routesArray)
5482
5517
  return null;
5483
- const base = findCreateWebHistoryBase(sf) ?? "/";
5484
- const baseHref = base.endsWith("/") ? base : `${base}/`;
5485
5518
  const routes = [];
5486
5519
  extractRouteEntries2(routesArray, "", routes);
5520
+ const base = findCreateWebHistoryBase(sf) ?? inferBaseHref(routes);
5521
+ const baseHref = base.endsWith("/") ? base : `${base}/`;
5487
5522
  return { baseHref, routes, sourceFile: filePath };
5488
5523
  }, walkSourceFiles2 = async (dir, out) => {
5489
5524
  let items;
@@ -12854,6 +12889,343 @@ var validateSafePath = (targetPath, baseDirectory) => {
12854
12889
  };
12855
12890
  var init_validateSafePath = () => {};
12856
12891
 
12892
+ // src/utils/resolveConvention.ts
12893
+ import { basename as basename6 } from "path";
12894
+ var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boolean(value) && typeof value === "object", getMap = () => {
12895
+ const value = Reflect.get(globalThis, CONVENTIONS_KEY);
12896
+ if (isConventionsMap(value))
12897
+ return value;
12898
+ const empty = {};
12899
+ return empty;
12900
+ }, derivePageName = (pagePath) => {
12901
+ const base = basename6(pagePath);
12902
+ const dotIndex = base.indexOf(".");
12903
+ const name = dotIndex > 0 ? base.slice(0, dotIndex) : base;
12904
+ return toPascal(name);
12905
+ }, normalizeConventionPageName = (name) => toPascal(name).replace(/\d+$/, ""), hasErrorConvention = (framework) => {
12906
+ const conventions = getMap()[framework];
12907
+ if (!conventions)
12908
+ return false;
12909
+ if (conventions.defaults?.error)
12910
+ return true;
12911
+ return Object.values(conventions.pages ?? {}).some((page) => Boolean(page.error));
12912
+ }, resolveErrorConventionPath = (framework, pageName) => {
12913
+ const conventions = getMap()[framework];
12914
+ if (!conventions)
12915
+ return;
12916
+ const exact = conventions.pages?.[pageName]?.error;
12917
+ if (exact)
12918
+ return exact;
12919
+ const normalizedPageName = normalizeConventionPageName(pageName);
12920
+ for (const [candidate, page] of Object.entries(conventions.pages ?? {})) {
12921
+ if (normalizeConventionPageName(candidate) === normalizedPageName) {
12922
+ return page.error ?? conventions.defaults?.error;
12923
+ }
12924
+ }
12925
+ return conventions.defaults?.error;
12926
+ }, resolveNotFoundConventionPath = (framework) => getMap()[framework]?.defaults?.notFound, setConventions = (map) => {
12927
+ Reflect.set(globalThis, CONVENTIONS_KEY, map);
12928
+ }, isDev = () => true, buildErrorProps = (error) => {
12929
+ if (error instanceof Error) {
12930
+ return {
12931
+ name: error.name,
12932
+ message: error.message,
12933
+ ...isDev() && error.stack ? { stack: error.stack } : {}
12934
+ };
12935
+ }
12936
+ return { message: String(error), name: "Error" };
12937
+ }, renderReactError = async (conventionPath, errorProps) => {
12938
+ const { createElement } = await import("react");
12939
+ const { renderToReadableStream } = await import("react-dom/server");
12940
+ const mod = await import(conventionPath);
12941
+ const ErrorComponent = mod.default;
12942
+ if (typeof ErrorComponent !== "function")
12943
+ return null;
12944
+ const element = createElement(ErrorComponent, errorProps);
12945
+ const stream = await renderToReadableStream(element);
12946
+ return new Response(stream, {
12947
+ headers: { "Content-Type": "text/html" },
12948
+ status: 500
12949
+ });
12950
+ }, renderSvelteError = async (conventionPath, errorProps) => {
12951
+ const { render } = await import("svelte/server");
12952
+ const mod = await import(conventionPath);
12953
+ const ErrorComponent = mod.default;
12954
+ if (!ErrorComponent)
12955
+ return null;
12956
+ const { head, body } = render(ErrorComponent, {
12957
+ props: errorProps
12958
+ });
12959
+ const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
12960
+ return new Response(html, {
12961
+ headers: { "Content-Type": "text/html" },
12962
+ status: 500
12963
+ });
12964
+ }, unescapeVueStyles = (ssrBody) => {
12965
+ let styles = "";
12966
+ const body = ssrBody.replace(/<style>([\s\S]*?)<\/style>/g, (_2, css) => {
12967
+ styles += `<style>${css.replace(/&quot;/g, '"').replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">")}</style>`;
12968
+ return "";
12969
+ });
12970
+ return { body, styles };
12971
+ }, renderVueError = async (conventionPath, errorProps) => {
12972
+ const { createSSRApp, h: h2 } = await import("vue");
12973
+ const { renderToString } = await import("vue/server-renderer");
12974
+ const mod = await import(conventionPath);
12975
+ const ErrorComponent = mod.default;
12976
+ if (!ErrorComponent)
12977
+ return null;
12978
+ const app = createSSRApp({
12979
+ render: () => h2(ErrorComponent, errorProps)
12980
+ });
12981
+ const rawBody = await renderToString(app);
12982
+ const { styles, body } = unescapeVueStyles(rawBody);
12983
+ const html = `<!DOCTYPE html><html><head>${styles}</head><body><div id="root">${body}</div></body></html>`;
12984
+ return new Response(html, {
12985
+ headers: { "Content-Type": "text/html" },
12986
+ status: 500
12987
+ });
12988
+ }, renderAngularError = async (conventionPath, errorProps) => {
12989
+ const mod = await import(conventionPath);
12990
+ const renderFn = mod.default;
12991
+ if (typeof renderFn !== "function")
12992
+ return null;
12993
+ const html = renderFn(errorProps);
12994
+ return new Response(html, {
12995
+ headers: { "Content-Type": "text/html" },
12996
+ status: 500
12997
+ });
12998
+ }, 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) => {
12999
+ const template = await Bun.file(conventionPath).text();
13000
+ const html = replaceErrorTokens(template, errorProps);
13001
+ return new Response(html, {
13002
+ headers: { "Content-Type": "text/html" },
13003
+ status: 500
13004
+ });
13005
+ }, logConventionRenderError = (framework, label, renderError) => {
13006
+ const message = renderError instanceof Error ? renderError.message : "";
13007
+ if (message.includes("Cannot find module") || message.includes("Cannot find package") || message.includes("not found in module")) {
13008
+ 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}).`);
13009
+ return;
13010
+ }
13011
+ console.error(`[SSR] Failed to render ${framework} convention ${label} page:`, renderError);
13012
+ }, renderEmberError = async () => null, renderEmberNotFound = async () => null, ERROR_RENDERERS, tryFrameworkErrorConvention = async (framework, pageName, errorProps, error) => {
13013
+ let conventionPath = resolveErrorConventionPath(framework, pageName);
13014
+ if (!conventionPath && error instanceof Error && error.stack) {
13015
+ for (const match of error.stack.matchAll(/^\s*at\s+([A-Za-z_$][\w$]*)/gm)) {
13016
+ const candidate = match[1];
13017
+ if (!candidate)
13018
+ continue;
13019
+ conventionPath = resolveErrorConventionPath(framework, candidate);
13020
+ if (conventionPath)
13021
+ break;
13022
+ }
13023
+ }
13024
+ if (!conventionPath)
13025
+ return null;
13026
+ const renderer = ERROR_RENDERERS[framework];
13027
+ if (!renderer)
13028
+ return null;
13029
+ try {
13030
+ return await renderer(conventionPath, errorProps);
13031
+ } catch (renderError) {
13032
+ logConventionRenderError(framework, "error", renderError);
13033
+ }
13034
+ return null;
13035
+ }, renderConventionError = async (framework, pageName, error) => {
13036
+ const errorProps = buildErrorProps(error);
13037
+ const frameworkResponse = await tryFrameworkErrorConvention(framework, pageName, errorProps, error);
13038
+ if (frameworkResponse)
13039
+ return frameworkResponse;
13040
+ if (framework !== "html") {
13041
+ const htmlResponse = await tryFrameworkErrorConvention("html", pageName, errorProps, error);
13042
+ if (htmlResponse)
13043
+ return htmlResponse;
13044
+ }
13045
+ return null;
13046
+ }, renderReactNotFound = async (conventionPath) => {
13047
+ const { createElement } = await import("react");
13048
+ const { renderToReadableStream } = await import("react-dom/server");
13049
+ const mod = await import(conventionPath);
13050
+ const NotFoundComponent = mod.default;
13051
+ if (typeof NotFoundComponent !== "function")
13052
+ return null;
13053
+ const element = createElement(NotFoundComponent);
13054
+ const stream = await renderToReadableStream(element);
13055
+ return new Response(stream, {
13056
+ headers: { "Content-Type": "text/html" },
13057
+ status: 404
13058
+ });
13059
+ }, renderSvelteNotFound = async (conventionPath) => {
13060
+ const { render } = await import("svelte/server");
13061
+ const mod = await import(conventionPath);
13062
+ const NotFoundComponent = mod.default;
13063
+ if (!NotFoundComponent)
13064
+ return null;
13065
+ const { head, body } = render(NotFoundComponent);
13066
+ const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
13067
+ return new Response(html, {
13068
+ headers: { "Content-Type": "text/html" },
13069
+ status: 404
13070
+ });
13071
+ }, renderVueNotFound = async (conventionPath) => {
13072
+ const { createSSRApp, h: h2 } = await import("vue");
13073
+ const { renderToString } = await import("vue/server-renderer");
13074
+ const mod = await import(conventionPath);
13075
+ const NotFoundComponent = mod.default;
13076
+ if (!NotFoundComponent)
13077
+ return null;
13078
+ const app = createSSRApp({
13079
+ render: () => h2(NotFoundComponent)
13080
+ });
13081
+ const rawBody = await renderToString(app);
13082
+ const { styles, body } = unescapeVueStyles(rawBody);
13083
+ const html = `<!DOCTYPE html><html><head>${styles}</head><body><div id="root">${body}</div></body></html>`;
13084
+ return new Response(html, {
13085
+ headers: { "Content-Type": "text/html" },
13086
+ status: 404
13087
+ });
13088
+ }, renderAngularNotFound = async (conventionPath) => {
13089
+ const mod = await import(conventionPath);
13090
+ const renderFn = mod.default;
13091
+ if (typeof renderFn !== "function")
13092
+ return null;
13093
+ const html = renderFn();
13094
+ return new Response(html, {
13095
+ headers: { "Content-Type": "text/html" },
13096
+ status: 404
13097
+ });
13098
+ }, renderHtmlNotFound = async (conventionPath) => {
13099
+ const html = await Bun.file(conventionPath).text();
13100
+ return new Response(html, {
13101
+ headers: { "Content-Type": "text/html" },
13102
+ status: 404
13103
+ });
13104
+ }, NOT_FOUND_RENDERERS, renderConventionNotFound = async (framework) => {
13105
+ const conventionPath = resolveNotFoundConventionPath(framework);
13106
+ if (!conventionPath)
13107
+ return null;
13108
+ const renderer = NOT_FOUND_RENDERERS[framework];
13109
+ if (!renderer)
13110
+ return null;
13111
+ try {
13112
+ return await renderer(conventionPath);
13113
+ } catch (renderError) {
13114
+ logConventionRenderError(framework, "not-found", renderError);
13115
+ }
13116
+ return null;
13117
+ }, NOT_FOUND_PRIORITY, renderFirstNotFound = async () => {
13118
+ const renderNext = async (frameworks2) => {
13119
+ const [framework, ...remaining] = frameworks2;
13120
+ if (!framework) {
13121
+ return null;
13122
+ }
13123
+ if (!getMap()[framework]?.defaults?.notFound) {
13124
+ return renderNext(remaining);
13125
+ }
13126
+ const response = await renderConventionNotFound(framework);
13127
+ if (response) {
13128
+ return response;
13129
+ }
13130
+ return renderNext(remaining);
13131
+ };
13132
+ return renderNext(NOT_FOUND_PRIORITY);
13133
+ };
13134
+ var init_resolveConvention = __esm(() => {
13135
+ ERROR_RENDERERS = {
13136
+ angular: renderAngularError,
13137
+ ember: renderEmberError,
13138
+ html: renderHtmlError,
13139
+ react: renderReactError,
13140
+ svelte: renderSvelteError,
13141
+ vue: renderVueError
13142
+ };
13143
+ NOT_FOUND_RENDERERS = {
13144
+ angular: renderAngularNotFound,
13145
+ ember: renderEmberNotFound,
13146
+ html: renderHtmlNotFound,
13147
+ react: renderReactNotFound,
13148
+ svelte: renderSvelteNotFound,
13149
+ vue: renderVueNotFound
13150
+ };
13151
+ NOT_FOUND_PRIORITY = [
13152
+ "react",
13153
+ "svelte",
13154
+ "vue",
13155
+ "angular",
13156
+ "html"
13157
+ ];
13158
+ });
13159
+
13160
+ // src/utils/spaRouteManifest.ts
13161
+ import { basename as basename7 } from "path";
13162
+ var SPA_ROUTES_KEY = "__absoluteSpaRoutes", setSpaRouteManifest = (hosts) => {
13163
+ Reflect.set(globalThis, SPA_ROUTES_KEY, hosts);
13164
+ }, getSpaRouteManifest = () => {
13165
+ const value = Reflect.get(globalThis, SPA_ROUTES_KEY);
13166
+ return Array.isArray(value) ? value : [];
13167
+ }, normalizePath2 = (path) => {
13168
+ const withLeadingSlash = path.startsWith("/") ? path : `/${path}`;
13169
+ const trimmed = withLeadingSlash.replace(/\/+$/, "");
13170
+ return trimmed || "/";
13171
+ }, fullRoutePath = (baseHref, routePath) => {
13172
+ const base = normalizePath2(baseHref);
13173
+ const route = normalizePath2(routePath);
13174
+ if (base !== "/" && (route === base || route.startsWith(`${base}/`))) {
13175
+ return route;
13176
+ }
13177
+ if (base === "/")
13178
+ return route;
13179
+ return normalizePath2(`${base}/${route.replace(/^\/+/, "")}`);
13180
+ }, routePattern = (path) => {
13181
+ const segments = normalizePath2(path).split("/").filter(Boolean);
13182
+ let expression = "^";
13183
+ for (const segment of segments) {
13184
+ if (segment === "*" || segment === "**") {
13185
+ expression += "(?:/.*)?";
13186
+ continue;
13187
+ }
13188
+ const parameter = /^:[A-Za-z_$][A-Za-z0-9_$]*(?:\((.*)\))?(\?)?$/.exec(segment);
13189
+ if (parameter) {
13190
+ const valuePattern = parameter[1] || "[^/]+";
13191
+ expression += parameter[2] ? `(?:/${valuePattern})?` : `/${valuePattern}`;
13192
+ continue;
13193
+ }
13194
+ expression += `/${segment.replace(/[.+?^${}()|[\]\\]/g, "\\$&")}`;
13195
+ }
13196
+ return new RegExp(`${expression || "^/"}/?$`);
13197
+ }, sourcePageName = (sourceFile) => basename7(sourceFile).replace(/\.[^.]+$/, "").toLowerCase(), isKnownSpaRoute = (framework, pageName, request) => {
13198
+ if (!request)
13199
+ return true;
13200
+ let pathname;
13201
+ try {
13202
+ pathname = normalizePath2(new URL(request.url).pathname);
13203
+ } catch {
13204
+ return true;
13205
+ }
13206
+ const hosts = getSpaRouteManifest().filter((host) => {
13207
+ if (host.framework !== framework)
13208
+ return false;
13209
+ if (sourcePageName(host.sourceFile) !== pageName.toLowerCase())
13210
+ return false;
13211
+ const base = normalizePath2(host.baseHref);
13212
+ return base === "/" || pathname === base || pathname.startsWith(`${base}/`);
13213
+ });
13214
+ if (hosts.length === 0)
13215
+ return true;
13216
+ return hosts.some((host) => host.routes.some((route) => routePattern(fullRoutePath(host.baseHref, route.path)).test(pathname)));
13217
+ }, renderSpaNotFound = async (framework, pageName, request) => {
13218
+ if (isKnownSpaRoute(framework, pageName, request))
13219
+ return null;
13220
+ return await renderFirstNotFound() ?? new Response("Not found", {
13221
+ headers: { "Content-Type": "text/plain" },
13222
+ status: 404
13223
+ });
13224
+ };
13225
+ var init_spaRouteManifest = __esm(() => {
13226
+ init_resolveConvention();
13227
+ });
13228
+
12857
13229
  // src/build/scanVueSsrOnlyPages.ts
12858
13230
  var exports_scanVueSsrOnlyPages = {};
12859
13231
  __export(exports_scanVueSsrOnlyPages, {
@@ -13157,7 +13529,7 @@ var init_scanAngularHandlerCalls = __esm(() => {
13157
13529
 
13158
13530
  // src/build/scanAngularPageRoutes.ts
13159
13531
  import { readdirSync as readdirSync4, readFileSync as readFileSync15 } from "fs";
13160
- import { basename as basename6, join as join26 } from "path";
13532
+ import { basename as basename8, join as join26 } from "path";
13161
13533
  import ts9 from "typescript";
13162
13534
  var SOURCE_EXTENSIONS4, SKIP_DIRS4, hasSourceExtension4 = (filePath) => {
13163
13535
  const idx = filePath.lastIndexOf(".");
@@ -13167,7 +13539,7 @@ var SOURCE_EXTENSIONS4, SKIP_DIRS4, hasSourceExtension4 = (filePath) => {
13167
13539
  }, isPageFile = (filePath) => {
13168
13540
  if (!hasSourceExtension4(filePath))
13169
13541
  return false;
13170
- const base = basename6(filePath);
13542
+ const base = basename8(filePath);
13171
13543
  if (base.endsWith(".d.ts"))
13172
13544
  return false;
13173
13545
  if (base.endsWith(".test.ts"))
@@ -13233,7 +13605,7 @@ var SOURCE_EXTENSIONS4, SKIP_DIRS4, hasSourceExtension4 = (filePath) => {
13233
13605
  continue;
13234
13606
  }
13235
13607
  const hasRoutes = hasTopLevelRoutesExport(source, file);
13236
- const base = basename6(file).replace(/\.[cm]?[tj]sx?$/, "");
13608
+ const base = basename8(file).replace(/\.[cm]?[tj]sx?$/, "");
13237
13609
  const manifestKey = toPascal(base);
13238
13610
  out.push({
13239
13611
  hasRoutes,
@@ -13525,7 +13897,7 @@ import { mkdir as mkdir5, stat as stat2 } from "fs/promises";
13525
13897
  import {
13526
13898
  dirname as dirname13,
13527
13899
  join as join28,
13528
- basename as basename7,
13900
+ basename as basename9,
13529
13901
  extname as extname6,
13530
13902
  resolve as resolve19,
13531
13903
  relative as relative10,
@@ -13626,7 +13998,7 @@ var resolveDevClientDir2 = () => {
13626
13998
  client: toClient.startsWith(".") || toClient.startsWith("/") ? toClient : `./${toClient}`,
13627
13999
  server: toServer.startsWith(".") ? toServer : `./${toServer}`
13628
14000
  });
13629
- }, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev = false, stylePreprocessors) => {
14001
+ }, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev2 = false, stylePreprocessors) => {
13630
14002
  const { compile, compileModule, preprocess } = await import("svelte/compiler");
13631
14003
  const generatedDir = getFrameworkGeneratedDir("svelte");
13632
14004
  const clientDir = join28(generatedDir, "client");
@@ -13661,7 +14033,7 @@ var resolveDevClientDir2 = () => {
13661
14033
  const transpiledClient = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedClient) : preprocessedClient;
13662
14034
  const rawRel = dirname13(relative10(svelteRoot, src)).replace(/\\/g, "/");
13663
14035
  const relDir = rawRel.startsWith("..") ? `_ext/${relative10(process.cwd(), dirname13(src)).replace(/\\/g, "/")}` : rawRel;
13664
- const baseName = basename7(src).replace(/\.svelte(\.(ts|js))?$/, "");
14036
+ const baseName = basename9(src).replace(/\.svelte(\.(ts|js))?$/, "");
13665
14037
  const importPaths = Array.from(transpiledServer.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
13666
14038
  const resolvedModuleImports = await Promise.all(importPaths.map((importPath) => resolveRelativeModule2(importPath, src)));
13667
14039
  const resolvedImports = await Promise.all(importPaths.map((importPath) => resolveSvelte(importPath, src)));
@@ -13719,10 +14091,10 @@ var resolveDevClientDir2 = () => {
13719
14091
  },
13720
14092
  filename: src,
13721
14093
  generate: mode,
13722
- hmr: mode === "client" && isDev
14094
+ hmr: mode === "client" && isDev2
13723
14095
  }).js;
13724
14096
  let code = compiledJs.code.replace(/\.svelte(?:\.(?:ts|js))?(['"])/g, ".js$1");
13725
- if (mode === "client" && isDev) {
14097
+ if (mode === "client" && isDev2) {
13726
14098
  const moduleKey = `/@src/${relative10(process.cwd(), src).replace(/\\/g, "/")}`;
13727
14099
  code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
13728
14100
  if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
@@ -13773,11 +14145,11 @@ var resolveDevClientDir2 = () => {
13773
14145
  const roots = await Promise.all(entryPoints.map(build));
13774
14146
  await Promise.all(roots.map(async ({ client, hasAwaitSlot }) => {
13775
14147
  const relClientDir = dirname13(relative10(clientDir, client));
13776
- const name = basename7(client, extname6(client));
14148
+ const name = basename9(client, extname6(client));
13777
14149
  const indexPath = join28(indexDir, relClientDir, `${name}.js`);
13778
14150
  const importRaw = relative10(dirname13(indexPath), client).split(sep2).join("/");
13779
14151
  const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
13780
- const hmrImports = isDev ? `window.__HMR_FRAMEWORK__ = "svelte";
14152
+ const hmrImports = isDev2 ? `window.__HMR_FRAMEWORK__ = "svelte";
13781
14153
  import "${hmrClientPath3}";
13782
14154
  ` : "";
13783
14155
  const bootstrap = `${hmrImports}import Component from "${importPath}";
@@ -13861,7 +14233,7 @@ if (typeof window !== "undefined") {
13861
14233
  svelteClientPaths: roots.map(({ client }) => client),
13862
14234
  svelteIndexPaths: roots.map(({ client }) => {
13863
14235
  const rel = dirname13(relative10(clientDir, client));
13864
- return join28(indexDir, rel, basename7(client));
14236
+ return join28(indexDir, rel, basename9(client));
13865
14237
  }),
13866
14238
  svelteServerPaths: roots.map(({ ssr }) => ssr)
13867
14239
  };
@@ -14319,6 +14691,20 @@ export const setupApp = async (app, ctx) => {
14319
14691
  if (__absoluteUserSetupApp__) {
14320
14692
  await __absoluteUserSetupApp__(app, { ...ctx, router });
14321
14693
  }
14694
+ const currentRouteMatched = router.currentRoute.value.matched.length > 0;
14695
+ if (!currentRouteMatched) {
14696
+ if (ctx.isServer) {
14697
+ ctx.setNotFound();
14698
+ } else {
14699
+ window.location.assign(ctx.url);
14700
+ }
14701
+ return;
14702
+ }
14703
+ if (!ctx.isServer) {
14704
+ router.afterEach((to) => {
14705
+ if (to.matched.length === 0) window.location.assign(to.fullPath);
14706
+ });
14707
+ }
14322
14708
  };
14323
14709
  `;
14324
14710
  return sourceContent.replace(SCRIPT_REGEX, `${openTag}${rewrittenScript}${autoWrapper}${closeTag}`);
@@ -14342,7 +14728,7 @@ __export(exports_compileVue, {
14342
14728
  import { existsSync as existsSync22, readFileSync as readFileSync18, realpathSync as realpathSync2 } from "fs";
14343
14729
  import { mkdir as mkdir6 } from "fs/promises";
14344
14730
  import {
14345
- basename as basename8,
14731
+ basename as basename10,
14346
14732
  dirname as dirname14,
14347
14733
  isAbsolute as isAbsolute4,
14348
14734
  join as join29,
@@ -14464,7 +14850,7 @@ var resolveDevClientDir3 = () => {
14464
14850
  return cachedResult;
14465
14851
  const relativeFilePath = relative11(vueRootDir, sourceFilePath).replace(/\\/g, "/");
14466
14852
  const relativeWithoutExtension = relativeFilePath.replace(/\.vue$/, "");
14467
- const fileBaseName = basename8(sourceFilePath, ".vue");
14853
+ const fileBaseName = basename10(sourceFilePath, ".vue");
14468
14854
  const componentId = toKebab(fileBaseName);
14469
14855
  const rawSourceContent = await file2(sourceFilePath).text();
14470
14856
  const sourceContent = isEntryPoint ? addAutoRouterSetupApp(rawSourceContent) : rawSourceContent;
@@ -14641,7 +15027,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
14641
15027
  cacheMap.set(sourceFilePath, result);
14642
15028
  persistentBuildCache.set(sourceFilePath, result);
14643
15029
  return result;
14644
- }, compileVue = async (entryPoints, vueRootDir, isDev = false, stylePreprocessors, ssrOnlyEntries) => {
15030
+ }, compileVue = async (entryPoints, vueRootDir, isDev2 = false, stylePreprocessors, ssrOnlyEntries) => {
14645
15031
  const compiler = await import("@vue/compiler-sfc");
14646
15032
  const generatedDir = getFrameworkGeneratedDir("vue");
14647
15033
  const clientOutputDir = join29(generatedDir, "client");
@@ -14674,11 +15060,11 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
14674
15060
  spaRoutes: result.spaRoutes
14675
15061
  };
14676
15062
  }
14677
- const entryBaseName = basename8(entryPath, ".vue");
15063
+ const entryBaseName = basename10(entryPath, ".vue");
14678
15064
  const indexOutputFile = join29(indexOutputDir, `${entryBaseName}.js`);
14679
15065
  const clientOutputFile = join29(clientOutputDir, relative11(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
14680
15066
  await mkdir6(dirname14(indexOutputFile), { recursive: true });
14681
- const vueHmrImports = isDev ? [
15067
+ const vueHmrImports = isDev2 ? [
14682
15068
  `window.__HMR_FRAMEWORK__ = "vue";`,
14683
15069
  `import "${hmrClientPath4}";`
14684
15070
  ] : [];
@@ -14742,6 +15128,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
14742
15128
  " await setupAppHook(app, {",
14743
15129
  " isServer: false,",
14744
15130
  " router: null,",
15131
+ " setNotFound: () => {},",
14745
15132
  " setRedirect: () => {},",
14746
15133
  " url: clientUrl",
14747
15134
  " });",
@@ -15372,7 +15759,7 @@ __export(exports_compileAngular, {
15372
15759
  compileAngular: () => compileAngular
15373
15760
  });
15374
15761
  import { existsSync as existsSync23, readFileSync as readFileSync19, promises as fs5 } from "fs";
15375
- import { join as join30, basename as basename9, sep as sep3, dirname as dirname15, resolve as resolve21, relative as relative12 } from "path";
15762
+ import { join as join30, basename as basename11, sep as sep3, dirname as dirname15, resolve as resolve21, relative as relative12 } from "path";
15376
15763
  var {Glob: Glob6 } = globalThis.Bun;
15377
15764
  import ts12 from "typescript";
15378
15765
  var traceAngularPhase = async (name, fn2, metadata) => {
@@ -15747,7 +16134,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
15747
16134
  const originalGetDefaultLibFileName = host.getDefaultLibFileName;
15748
16135
  host.getDefaultLibFileName = (opts) => {
15749
16136
  const fileName = originalGetDefaultLibFileName ? originalGetDefaultLibFileName(opts) : "lib.d.ts";
15750
- return basename9(fileName);
16137
+ return basename11(fileName);
15751
16138
  };
15752
16139
  const originalGetSourceFile = host.getSourceFile;
15753
16140
  host.getSourceFile = (fileName, languageVersion, onError) => {
@@ -16180,7 +16567,7 @@ ${fields}
16180
16567
  };
16181
16568
  const toOutputPath = (sourcePath) => {
16182
16569
  const inputDir = dirname15(sourcePath);
16183
- const fileBase = basename9(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
16570
+ const fileBase = basename11(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
16184
16571
  if (inputDir === outDir || inputDir.startsWith(`${outDir}${sep3}`)) {
16185
16572
  return join30(inputDir, fileBase);
16186
16573
  }
@@ -16236,7 +16623,7 @@ ${fields}
16236
16623
  const inputDir2 = dirname15(resolved);
16237
16624
  const relativeDir2 = inputDir2.startsWith(baseDir) ? inputDir2.substring(baseDir.length + 1) : inputDir2;
16238
16625
  const targetDir2 = join30(outDir, relativeDir2);
16239
- const targetPath2 = join30(targetDir2, basename9(resolved));
16626
+ const targetPath2 = join30(targetDir2, basename11(resolved));
16240
16627
  await fs5.mkdir(targetDir2, { recursive: true });
16241
16628
  await fs5.copyFile(resolved, targetPath2);
16242
16629
  allOutputs.push(targetPath2);
@@ -16251,7 +16638,7 @@ ${fields}
16251
16638
  const inlined = await inlineResources(sourceCode, dirname15(actualPath), stylePreprocessors);
16252
16639
  sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname15(actualPath)).source;
16253
16640
  const inputDir = dirname15(actualPath);
16254
- const fileBase = basename9(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
16641
+ const fileBase = basename11(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
16255
16642
  const targetPath = toOutputPath(actualPath);
16256
16643
  const targetDir = dirname15(targetPath);
16257
16644
  const relativeDir = relative12(outDir, targetDir).replace(/\\/g, "/");
@@ -16344,7 +16731,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
16344
16731
  let outputs = hmr ? await traceAngularPhase("jit/compile-entry", compileEntry, {
16345
16732
  entry: resolvedEntry
16346
16733
  }) : aotOutputs;
16347
- const fileBase = basename9(resolvedEntry).replace(/\.[tj]s$/, "");
16734
+ const fileBase = basename11(resolvedEntry).replace(/\.[tj]s$/, "");
16348
16735
  const jsName = `${fileBase}.js`;
16349
16736
  const compiledFallbackPaths = [
16350
16737
  join30(compiledRoot, relativeEntry),
@@ -19867,11 +20254,11 @@ __export(exports_compileEmber, {
19867
20254
  compileEmberFile: () => compileEmberFile,
19868
20255
  compileEmber: () => compileEmber,
19869
20256
  clearEmberCompilerCache: () => clearEmberCompilerCache,
19870
- basename: () => basename10
20257
+ basename: () => basename12
19871
20258
  });
19872
20259
  import { existsSync as existsSync25 } from "fs";
19873
20260
  import { mkdir as mkdir7, rm as rm4 } from "fs/promises";
19874
- import { basename as basename10, dirname as dirname17, extname as extname8, join as join31, resolve as resolve23 } from "path";
20261
+ import { basename as basename12, dirname as dirname17, extname as extname8, join as join31, resolve as resolve23 } from "path";
19875
20262
  var {build: bunBuild2, Transpiler: Transpiler4, write: write4, file: file3 } = globalThis.Bun;
19876
20263
  var cachedPreprocessor = null, getPreprocessor = async () => {
19877
20264
  if (cachedPreprocessor)
@@ -20037,7 +20424,7 @@ export default PageComponent;
20037
20424
  preprocessed = rewriteTemplateEvalToScope(result.code);
20038
20425
  }
20039
20426
  const transpiled = transpiler5.transformSync(preprocessed);
20040
- const baseName = basename10(resolvedEntry).replace(/\.(gjs|gts|ts|js)$/, "");
20427
+ const baseName = basename12(resolvedEntry).replace(/\.(gjs|gts|ts|js)$/, "");
20041
20428
  const tmpDir = join31(compiledRoot, "_tmp");
20042
20429
  const serverDir = join31(compiledRoot, "server");
20043
20430
  const clientDir = join31(compiledRoot, "client");
@@ -20606,10 +20993,10 @@ import {
20606
20993
  statSync as statSync3,
20607
20994
  writeFileSync as writeFileSync8
20608
20995
  } from "fs";
20609
- import { basename as basename11, dirname as dirname18, extname as extname9, join as join36, relative as relative14, resolve as resolve25 } from "path";
20996
+ import { basename as basename13, dirname as dirname18, extname as extname9, join as join36, relative as relative14, resolve as resolve25 } from "path";
20610
20997
  import { cwd, env as env2, exit } from "process";
20611
20998
  var {build: bunBuild7, Glob: Glob8 } = globalThis.Bun;
20612
- var isDev, isBuildTraceEnabled = () => {
20999
+ var isDev2, isBuildTraceEnabled = () => {
20613
21000
  const value = env2.ABSOLUTE_BUILD_TRACE?.toLowerCase();
20614
21001
  return value === "1" || value === "true" || value === "yes";
20615
21002
  }, collectConventionSourceFiles = (entry) => {
@@ -20786,7 +21173,7 @@ var isDev, isBuildTraceEnabled = () => {
20786
21173
  const svelteIndexDir = join36(getFrameworkGeneratedDir("svelte"), "indexes");
20787
21174
  const sveltePageEntries = svelteEntries.filter((file4) => resolve25(file4).startsWith(resolve25(sveltePagesPath)));
20788
21175
  for (const entry of sveltePageEntries) {
20789
- const name = basename11(entry).replace(/\.svelte(\.(ts|js))?$/, "");
21176
+ const name = basename13(entry).replace(/\.svelte(\.(ts|js))?$/, "");
20790
21177
  const indexFile = join36(svelteIndexDir, "pages", `${name}.js`);
20791
21178
  if (!existsSync27(indexFile))
20792
21179
  continue;
@@ -20799,7 +21186,7 @@ var isDev, isBuildTraceEnabled = () => {
20799
21186
  const vueIndexDir = join36(getFrameworkGeneratedDir("vue"), "indexes");
20800
21187
  const vuePageEntries = vueEntries.filter((file4) => resolve25(file4).startsWith(resolve25(vuePagesPath)));
20801
21188
  for (const entry of vuePageEntries) {
20802
- const name = basename11(entry, ".vue");
21189
+ const name = basename13(entry, ".vue");
20803
21190
  const indexFile = join36(vueIndexDir, `${name}.js`);
20804
21191
  if (!existsSync27(indexFile))
20805
21192
  continue;
@@ -20880,7 +21267,7 @@ ${content.slice(firstUseIdx)}`;
20880
21267
  const urlFileMap = new Map;
20881
21268
  for (const srcPath of urlReferencedFiles) {
20882
21269
  const rel = relative14(projectRoot, srcPath).replace(/\\/g, "/");
20883
- const name = basename11(srcPath);
21270
+ const name = basename13(srcPath);
20884
21271
  const mtime = Math.round(statSync3(srcPath).mtimeMs);
20885
21272
  const url = `/@src/${rel}?v=${mtime}`;
20886
21273
  urlFileMap.set(name, url);
@@ -20890,11 +21277,11 @@ ${content.slice(firstUseIdx)}`;
20890
21277
  }, buildProdUrlFileMap = (urlReferencedFiles, buildPath, nonReactClientOutputs) => {
20891
21278
  const urlFileMap = new Map;
20892
21279
  for (const srcPath of urlReferencedFiles) {
20893
- const srcBase = basename11(srcPath).replace(/\.[^.]+$/, "");
20894
- const output = nonReactClientOutputs.find((artifact) => basename11(artifact.path).startsWith(`${srcBase}.`));
21280
+ const srcBase = basename13(srcPath).replace(/\.[^.]+$/, "");
21281
+ const output = nonReactClientOutputs.find((artifact) => basename13(artifact.path).startsWith(`${srcBase}.`));
20895
21282
  if (!output)
20896
21283
  continue;
20897
- urlFileMap.set(basename11(srcPath), `/${relative14(buildPath, output.path).replace(/\\/g, "/")}`);
21284
+ urlFileMap.set(basename13(srcPath), `/${relative14(buildPath, output.path).replace(/\\/g, "/")}`);
20898
21285
  }
20899
21286
  return urlFileMap;
20900
21287
  }, buildUrlFileMap = (urlReferencedFiles, hmr, projectRoot, buildPath, nonReactClientOutputs) => {
@@ -20907,7 +21294,7 @@ ${content.slice(firstUseIdx)}`;
20907
21294
  let content = readFileSync21(outputPath, "utf-8");
20908
21295
  let changed = false;
20909
21296
  content = content.replace(urlPattern, (_match, relPath) => {
20910
- const targetName = basename11(relPath);
21297
+ const targetName = basename13(relPath);
20911
21298
  const resolvedPath = urlFileMap.get(targetName);
20912
21299
  if (!resolvedPath)
20913
21300
  return _match;
@@ -20939,8 +21326,8 @@ ${content.slice(firstUseIdx)}`;
20939
21326
  ...config.default ?? {},
20940
21327
  ...config[pass] ?? {}
20941
21328
  }, locked);
20942
- }, resolveClientSourcemap = (sourcemaps, isDev2) => {
20943
- if (isDev2)
21329
+ }, resolveClientSourcemap = (sourcemaps, isDev3) => {
21330
+ if (isDev3)
20944
21331
  return sourcemaps === false ? "none" : "inline";
20945
21332
  if (sourcemaps === "external" || sourcemaps === true)
20946
21333
  return "external";
@@ -21045,7 +21432,7 @@ ${content.slice(firstUseIdx)}`;
21045
21432
  events: traceEvents,
21046
21433
  frameworks: traceFrameworkNames,
21047
21434
  generatedAt: new Date().toISOString(),
21048
- mode: mode ?? (isDev ? "development" : "production"),
21435
+ mode: mode ?? (isDev2 ? "development" : "production"),
21049
21436
  totalDurationMs: performance.now() - buildStart,
21050
21437
  version: 1
21051
21438
  }, null, 2));
@@ -21104,7 +21491,7 @@ ${content.slice(firstUseIdx)}`;
21104
21491
  sendTelemetryEvent("build:start", {
21105
21492
  framework: frameworkNames[0],
21106
21493
  frameworks: frameworkNames,
21107
- mode: mode ?? (isDev ? "development" : "production"),
21494
+ mode: mode ?? (isDev2 ? "development" : "production"),
21108
21495
  tailwind: Boolean(tailwind)
21109
21496
  });
21110
21497
  const generatedRoot = getGeneratedRoot(projectRoot);
@@ -21140,7 +21527,7 @@ ${content.slice(firstUseIdx)}`;
21140
21527
  if (!firstEntry)
21141
21528
  throw new Error("Expected at least one server directory entry");
21142
21529
  serverRoot = join36(firstEntry.dir, firstEntry.subdir);
21143
- serverOutDir = join36(buildPath, basename11(firstEntry.dir));
21530
+ serverOutDir = join36(buildPath, basename13(firstEntry.dir));
21144
21531
  } else if (serverDirMap.length > 1) {
21145
21532
  serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
21146
21533
  serverOutDir = buildPath;
@@ -21282,7 +21669,7 @@ ${content.slice(firstUseIdx)}`;
21282
21669
  mkdirSync12(htmlConventionsOutDir, { recursive: true });
21283
21670
  const htmlPathRemap = new Map;
21284
21671
  for (const sourcePath of htmlConventionSources) {
21285
- const dest = join36(htmlConventionsOutDir, basename11(sourcePath));
21672
+ const dest = join36(htmlConventionsOutDir, basename13(sourcePath));
21286
21673
  cpSync(sourcePath, dest, { force: true });
21287
21674
  htmlPathRemap.set(sourcePath, dest);
21288
21675
  }
@@ -21324,7 +21711,7 @@ ${content.slice(firstUseIdx)}`;
21324
21711
  const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/html/") && (f2.endsWith(".html") || isStylePath(f2)));
21325
21712
  const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
21326
21713
  if (entry.startsWith(resolve25(reactIndexesPath))) {
21327
- const pageName = basename11(entry, ".tsx");
21714
+ const pageName = basename13(entry, ".tsx");
21328
21715
  return join36(reactPagesPath, `${pageName}.tsx`);
21329
21716
  }
21330
21717
  return null;
@@ -21355,7 +21742,7 @@ ${content.slice(firstUseIdx)}`;
21355
21742
  return new Set;
21356
21743
  const resolved = new Set;
21357
21744
  for (const entry of vueEntries) {
21358
- const name = basename11(entry, ".vue");
21745
+ const name = basename13(entry, ".vue");
21359
21746
  if (ssrOnlyPageNames.has(name)) {
21360
21747
  resolved.add(resolve25(entry));
21361
21748
  }
@@ -21528,7 +21915,7 @@ ${content.slice(firstUseIdx)}`;
21528
21915
  entrypoints: [source],
21529
21916
  format: "esm",
21530
21917
  jsx: { development: false },
21531
- minify: !isDev,
21918
+ minify: !isDev2,
21532
21919
  naming: `${idx}-[name].[ext]`,
21533
21920
  outdir: destDir,
21534
21921
  plugins: [stylePreprocessorPlugin2],
@@ -21568,11 +21955,11 @@ ${content.slice(firstUseIdx)}`;
21568
21955
  const compiledPath = compiledPaths[idx];
21569
21956
  if (!compiledPath)
21570
21957
  continue;
21571
- const name = basename11(compiledPath).replace(/\.[^.]+$/, "");
21958
+ const name = basename13(compiledPath).replace(/\.[^.]+$/, "");
21572
21959
  const result = await bunBuild7({
21573
21960
  entrypoints: [compiledPath],
21574
21961
  format: "esm",
21575
- minify: !isDev,
21962
+ minify: !isDev2,
21576
21963
  naming: `${idx}-${name}.[ext]`,
21577
21964
  outdir: destDir,
21578
21965
  splitting: false,
@@ -21657,7 +22044,7 @@ ${content.slice(firstUseIdx)}`;
21657
22044
  },
21658
22045
  frameworks: frameworkNames,
21659
22046
  incremental: Boolean(isIncremental),
21660
- mode: mode ?? (isDev ? "development" : "production"),
22047
+ mode: mode ?? (isDev2 ? "development" : "production"),
21661
22048
  scannedEntries: {
21662
22049
  angular: allAngularEntries.length,
21663
22050
  html: allHtmlEntries.length,
@@ -21777,7 +22164,7 @@ ${content.slice(firstUseIdx)}`;
21777
22164
  entrypoints: reactClientEntryPoints,
21778
22165
  ...Object.keys(reactExternalPaths).length > 0 ? { external: Object.keys(reactExternalPaths) } : {},
21779
22166
  format: "esm",
21780
- minify: !isDev,
22167
+ minify: !isDev2,
21781
22168
  naming: `[dir]/[name].[hash].[ext]`,
21782
22169
  outdir: buildPath,
21783
22170
  ...hmr ? {
@@ -21789,7 +22176,7 @@ ${content.slice(firstUseIdx)}`;
21789
22176
  ...islandRegistryPlugins
21790
22177
  ],
21791
22178
  root: clientRoot,
21792
- sourcemap: resolveClientSourcemap(sourcemaps, isDev),
22179
+ sourcemap: resolveClientSourcemap(sourcemaps, isDev2),
21793
22180
  splitting: true,
21794
22181
  target: "browser",
21795
22182
  throw: false
@@ -21835,7 +22222,7 @@ ${content.slice(firstUseIdx)}`;
21835
22222
  ] : []
21836
22223
  ],
21837
22224
  root: serverRoot,
21838
- sourcemap: isDev ? "inline" : "none",
22225
+ sourcemap: isDev2 ? "inline" : "none",
21839
22226
  target: "bun",
21840
22227
  throw: false,
21841
22228
  tsconfig: "./tsconfig.json"
@@ -21847,7 +22234,7 @@ ${content.slice(firstUseIdx)}`;
21847
22234
  entrypoints: nonReactClientEntryPoints,
21848
22235
  external: Object.keys(nonReactExternalPaths),
21849
22236
  format: "esm",
21850
- minify: !isDev,
22237
+ minify: !isDev2,
21851
22238
  naming: `[dir]/[name].[hash].[ext]`,
21852
22239
  outdir: buildPath,
21853
22240
  plugins: [
@@ -21864,8 +22251,8 @@ ${content.slice(firstUseIdx)}`;
21864
22251
  ...htmlScriptPlugin ? [htmlScriptPlugin] : []
21865
22252
  ],
21866
22253
  root: clientRoot,
21867
- sourcemap: resolveClientSourcemap(sourcemaps, isDev),
21868
- splitting: !isDev,
22254
+ sourcemap: resolveClientSourcemap(sourcemaps, isDev2),
22255
+ splitting: !isDev2,
21869
22256
  target: "browser",
21870
22257
  throw: false,
21871
22258
  tsconfig: "./tsconfig.json"
@@ -21876,7 +22263,7 @@ ${content.slice(firstUseIdx)}`;
21876
22263
  entrypoints: islandClientEntryPoints,
21877
22264
  external: Object.keys(nonReactExternalPaths),
21878
22265
  format: "esm",
21879
- minify: !isDev,
22266
+ minify: !isDev2,
21880
22267
  naming: `[dir]/[name].[hash].[ext]`,
21881
22268
  outdir: buildPath,
21882
22269
  plugins: [
@@ -21892,8 +22279,8 @@ ${content.slice(firstUseIdx)}`;
21892
22279
  ...angularDir ? [createAngularLinkerPlugin(hmr)] : []
21893
22280
  ],
21894
22281
  root: islandEntryResult.generatedRoot,
21895
- sourcemap: resolveClientSourcemap(sourcemaps, isDev),
21896
- splitting: !isDev,
22282
+ sourcemap: resolveClientSourcemap(sourcemaps, isDev2),
22283
+ splitting: !isDev2,
21897
22284
  target: "browser",
21898
22285
  throw: false,
21899
22286
  tsconfig: "./tsconfig.json"
@@ -21901,7 +22288,7 @@ ${content.slice(firstUseIdx)}`;
21901
22288
  globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
21902
22289
  entrypoints: globalCssEntries,
21903
22290
  naming: `[dir]/[name].[hash].[ext]`,
21904
- outdir: stylesDir ? join36(buildPath, basename11(stylesDir)) : buildPath,
22291
+ outdir: stylesDir ? join36(buildPath, basename13(stylesDir)) : buildPath,
21905
22292
  plugins: [stylePreprocessorPlugin2],
21906
22293
  root: stylesDir || clientRoot,
21907
22294
  target: "browser",
@@ -21910,28 +22297,28 @@ ${content.slice(firstUseIdx)}`;
21910
22297
  vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
21911
22298
  entrypoints: vueCssPaths,
21912
22299
  naming: `[name].[hash].[ext]`,
21913
- outdir: join36(buildPath, assetsPath ? basename11(assetsPath) : "assets", "css"),
22300
+ outdir: join36(buildPath, assetsPath ? basename13(assetsPath) : "assets", "css"),
21914
22301
  target: "browser",
21915
22302
  throw: false
21916
22303
  }, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
21917
22304
  ]);
21918
22305
  const serverLogs = serverResult?.logs ?? [];
21919
22306
  const serverOutputs = serverResult?.outputs ?? [];
21920
- if (isDev && serverResult?.success) {
22307
+ if (isDev2 && serverResult?.success) {
21921
22308
  const { chainBundleInlineSourcemap: chainBundleInlineSourcemap2 } = await Promise.resolve().then(() => (init_chainInlineSourcemaps(), exports_chainInlineSourcemaps));
21922
22309
  for (const out of serverOutputs) {
21923
22310
  if (out.path.endsWith(".js"))
21924
22311
  chainBundleInlineSourcemap2(out.path);
21925
22312
  }
21926
22313
  }
21927
- if (!isDev && resolveClientSourcemap(sourcemaps, isDev) === "external") {
22314
+ if (!isDev2 && resolveClientSourcemap(sourcemaps, isDev2) === "external") {
21928
22315
  const { chainExternalSourcemap: chainExternalSourcemap2 } = await Promise.resolve().then(() => (init_chainInlineSourcemaps(), exports_chainInlineSourcemaps));
21929
22316
  const sourcemapDir = join36(projectRoot, "sourcemaps");
21930
22317
  mkdirSync12(sourcemapDir, { recursive: true });
21931
22318
  const mapFiles = readdirSync5(buildPath, { recursive: true }).filter((entry) => entry.endsWith(".js.map") && !entry.includes("node_modules")).map((entry) => join36(buildPath, entry));
21932
22319
  for (const mapPath of mapFiles) {
21933
22320
  chainExternalSourcemap2(mapPath);
21934
- renameSync(mapPath, join36(sourcemapDir, basename11(mapPath)));
22321
+ renameSync(mapPath, join36(sourcemapDir, basename13(mapPath)));
21935
22322
  const jsPath = mapPath.slice(0, -4);
21936
22323
  try {
21937
22324
  const js = readFileSync21(jsPath, "utf-8").replace(/\n?\/\/# sourceMappingURL=[^\n]*\s*$/, `
@@ -22060,7 +22447,7 @@ ${content.slice(firstUseIdx)}`;
22060
22447
  for (const artifact of serverOutputs) {
22061
22448
  if (extname9(artifact.path) !== ".js")
22062
22449
  continue;
22063
- const fileWithHash = basename11(artifact.path);
22450
+ const fileWithHash = basename13(artifact.path);
22064
22451
  const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
22065
22452
  if (!baseName)
22066
22453
  continue;
@@ -22080,7 +22467,7 @@ ${content.slice(firstUseIdx)}`;
22080
22467
  for (const artifact of cssOutputs) {
22081
22468
  if (extname9(artifact.path) !== ".css")
22082
22469
  continue;
22083
- const cssName = stripHash(basename11(artifact.path), artifact.hash);
22470
+ const cssName = stripHash(basename13(artifact.path), artifact.hash);
22084
22471
  if (cssName)
22085
22472
  cssByName.set(cssName, artifact);
22086
22473
  }
@@ -22090,7 +22477,7 @@ ${content.slice(firstUseIdx)}`;
22090
22477
  await Promise.all(serverOutputs.map(async (artifact) => {
22091
22478
  if (extname9(artifact.path) !== ".js")
22092
22479
  return;
22093
- const pascalName = stripHash(basename11(artifact.path), artifact.hash);
22480
+ const pascalName = stripHash(basename13(artifact.path), artifact.hash);
22094
22481
  if (!pascalName)
22095
22482
  return;
22096
22483
  serverJsByPascalName.set(pascalName, artifact);
@@ -22105,14 +22492,14 @@ ${content.slice(firstUseIdx)}`;
22105
22492
  const spaSideManifestPaths = [];
22106
22493
  if (vueSpaRoutesBySource && vueSpaRoutesBySource.size > 0) {
22107
22494
  await Promise.all([...vueSpaRoutesBySource.entries()].map(async ([source, routes]) => {
22108
- const parentName = basename11(source, ".vue");
22495
+ const parentName = basename13(source, ".vue");
22109
22496
  const parentArtifact = serverJsByPascalName.get(parentName);
22110
22497
  if (!parentArtifact)
22111
22498
  return;
22112
22499
  const sourceDir = dirname18(source);
22113
22500
  const entries = routes.flatMap(({ path, importPath }) => {
22114
22501
  const childSourcePath = resolve25(sourceDir, importPath);
22115
- const childName = basename11(childSourcePath, ".vue");
22502
+ const childName = basename13(childSourcePath, ".vue");
22116
22503
  const childArtifact = serverJsByPascalName.get(childName);
22117
22504
  if (!childArtifact)
22118
22505
  return [];
@@ -22129,12 +22516,12 @@ ${content.slice(firstUseIdx)}`;
22129
22516
  }));
22130
22517
  }
22131
22518
  for (const serverPath of emberServerPaths) {
22132
- const fileBase = basename11(serverPath, ".js");
22519
+ const fileBase = basename13(serverPath, ".js");
22133
22520
  manifest[toPascal(fileBase)] = serverPath;
22134
22521
  }
22135
22522
  if (skipAngularClientBundle) {
22136
22523
  for (const clientPath of angularClientPaths) {
22137
- const fileBase = basename11(clientPath, ".js");
22524
+ const fileBase = basename13(clientPath, ".js");
22138
22525
  const relFromCwd = relative14(projectRoot, clientPath).replace(/\\/g, "/");
22139
22526
  manifest[`${toPascal(fileBase)}Index`] = `/@src/${relFromCwd}`;
22140
22527
  }
@@ -22160,7 +22547,7 @@ ${content.slice(firstUseIdx)}`;
22160
22547
  const processHtmlPages = async () => {
22161
22548
  if (!(htmlDir && htmlPagesPath))
22162
22549
  return;
22163
- const outputHtmlPages = isSingle ? join36(buildPath, "pages") : join36(buildPath, basename11(htmlDir), "pages");
22550
+ const outputHtmlPages = isSingle ? join36(buildPath, "pages") : join36(buildPath, basename13(htmlDir), "pages");
22164
22551
  mkdirSync12(outputHtmlPages, { recursive: true });
22165
22552
  cpSync(htmlPagesPath, outputHtmlPages, {
22166
22553
  force: true,
@@ -22175,7 +22562,7 @@ ${content.slice(firstUseIdx)}`;
22175
22562
  for (const htmlFile of htmlPageFiles) {
22176
22563
  if (hmr)
22177
22564
  injectHMRIntoHTMLFile(htmlFile, "html");
22178
- const fileName = basename11(htmlFile, ".html");
22565
+ const fileName = basename13(htmlFile, ".html");
22179
22566
  if (manifest[fileName] && manifest[fileName] !== htmlFile) {
22180
22567
  warnManifestKeyCollision(fileName, manifest[fileName], htmlFile);
22181
22568
  }
@@ -22185,14 +22572,14 @@ ${content.slice(firstUseIdx)}`;
22185
22572
  const processHtmxPages = async () => {
22186
22573
  if (!(htmxDir && htmxPagesPath))
22187
22574
  return;
22188
- const outputHtmxPages = isSingle ? join36(buildPath, "pages") : join36(buildPath, basename11(htmxDir), "pages");
22575
+ const outputHtmxPages = isSingle ? join36(buildPath, "pages") : join36(buildPath, basename13(htmxDir), "pages");
22189
22576
  mkdirSync12(outputHtmxPages, { recursive: true });
22190
22577
  cpSync(htmxPagesPath, outputHtmxPages, {
22191
22578
  force: true,
22192
22579
  recursive: true
22193
22580
  });
22194
22581
  if (shouldCopyHtmx) {
22195
- const htmxDestDir = isSingle ? buildPath : join36(buildPath, basename11(htmxDir));
22582
+ const htmxDestDir = isSingle ? buildPath : join36(buildPath, basename13(htmxDir));
22196
22583
  copyHtmxVendor(htmxDir, htmxDestDir);
22197
22584
  }
22198
22585
  if (shouldUpdateHtmxAssetPaths) {
@@ -22204,7 +22591,7 @@ ${content.slice(firstUseIdx)}`;
22204
22591
  for (const htmxFile of htmxPageFiles) {
22205
22592
  if (hmr)
22206
22593
  injectHMRIntoHTMLFile(htmxFile, "htmx");
22207
- const fileName = basename11(htmxFile, ".html");
22594
+ const fileName = basename13(htmxFile, ".html");
22208
22595
  if (manifest[fileName] && manifest[fileName] !== htmxFile) {
22209
22596
  warnManifestKeyCollision(fileName, manifest[fileName], htmxFile);
22210
22597
  }
@@ -22253,8 +22640,31 @@ ${content.slice(firstUseIdx)}`;
22253
22640
  sendTelemetryEvent("build:complete", {
22254
22641
  durationMs: Math.round(performance.now() - buildStart),
22255
22642
  frameworks: frameworkNames,
22256
- mode: mode ?? (isDev ? "development" : "production")
22643
+ mode: mode ?? (isDev2 ? "development" : "production")
22257
22644
  });
22645
+ const [reactSpaHosts, svelteSpaHosts, vueSpaHosts, angularSpaHosts] = await Promise.all([
22646
+ reactDir ? Promise.resolve().then(() => (init_staticAnalyzeSpaRoutes2(), exports_staticAnalyzeSpaRoutes2)).then((module) => module.analyzeReactSpaRoutes(reactDir)) : [],
22647
+ svelteDir ? Promise.resolve().then(() => (init_staticAnalyzeSpaRoutes3(), exports_staticAnalyzeSpaRoutes3)).then((module) => module.analyzeSvelteSpaRoutes(svelteDir)) : [],
22648
+ vueDir ? Promise.resolve().then(() => (init_staticAnalyzeSpaRoutes4(), exports_staticAnalyzeSpaRoutes4)).then((module) => module.analyzeVueSpaRoutes(vueDir)) : [],
22649
+ angularDir ? Promise.resolve().then(() => (init_staticAnalyzeSpaRoutes(), exports_staticAnalyzeSpaRoutes)).then((module) => module.analyzeAngularSpaRoutes(angularDir)) : []
22650
+ ]);
22651
+ const spaRouteHosts = [
22652
+ ...reactSpaHosts.map((host) => ({
22653
+ ...host,
22654
+ framework: "react"
22655
+ })),
22656
+ ...svelteSpaHosts.map((host) => ({
22657
+ ...host,
22658
+ framework: "svelte"
22659
+ })),
22660
+ ...vueSpaHosts.map((host) => ({ ...host, framework: "vue" })),
22661
+ ...angularSpaHosts.map((host) => ({
22662
+ ...host,
22663
+ framework: "angular"
22664
+ }))
22665
+ ];
22666
+ setSpaRouteManifest(spaRouteHosts);
22667
+ writeFileSync8(join36(buildPath, "spa-routes.json"), JSON.stringify(spaRouteHosts, null, "\t"));
22258
22668
  if (isIncremental) {
22259
22669
  writeBuildTrace(buildPath);
22260
22670
  return { conventions: conventionsMap, manifest };
@@ -22324,7 +22734,8 @@ var init_build = __esm(() => {
22324
22734
  init_buildDirectoryLock();
22325
22735
  init_logger();
22326
22736
  init_validateSafePath();
22327
- isDev = env2.NODE_ENV === "development";
22737
+ init_spaRouteManifest();
22738
+ isDev2 = env2.NODE_ENV === "development";
22328
22739
  SKIP_DIRS5 = new Set([
22329
22740
  "build",
22330
22741
  "node_modules",
@@ -22355,8 +22766,8 @@ var init_build = __esm(() => {
22355
22766
  ].join("");
22356
22767
  vueFeatureFlags = {
22357
22768
  __VUE_OPTIONS_API__: "true",
22358
- __VUE_PROD_DEVTOOLS__: isDev ? "true" : "false",
22359
- __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: isDev ? "true" : "false"
22769
+ __VUE_PROD_DEVTOOLS__: isDev2 ? "true" : "false",
22770
+ __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: isDev2 ? "true" : "false"
22360
22771
  };
22361
22772
  bunBuildPassKeys = [
22362
22773
  "server",
@@ -23637,7 +24048,7 @@ var classifyComponent = (filePath) => {
23637
24048
  var init_reactComponentClassifier = () => {};
23638
24049
 
23639
24050
  // src/dev/moduleMapper.ts
23640
- import { basename as basename12, resolve as resolve33 } from "path";
24051
+ import { basename as basename14, resolve as resolve33 } from "path";
23641
24052
  var buildModulePaths = (moduleKeys, manifest) => {
23642
24053
  const modulePaths = {};
23643
24054
  moduleKeys.forEach((key) => {
@@ -23684,7 +24095,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
23684
24095
  return grouped;
23685
24096
  }, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
23686
24097
  const normalizedFile = resolve33(sourceFile);
23687
- const fileName = basename12(normalizedFile);
24098
+ const fileName = basename14(normalizedFile);
23688
24099
  const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
23689
24100
  const pascalName = toPascal(baseName);
23690
24101
  const keys = [];
@@ -24260,7 +24671,7 @@ __export(exports_moduleServer, {
24260
24671
  SRC_URL_PREFIX: () => SRC_URL_PREFIX
24261
24672
  });
24262
24673
  import { existsSync as existsSync32, readFileSync as readFileSync27, realpathSync as realpathSync3, statSync as statSync6 } from "fs";
24263
- import { basename as basename13, dirname as dirname23, extname as extname11, join as join40, resolve as resolve36, relative as relative15 } from "path";
24674
+ import { basename as basename15, dirname as dirname23, extname as extname11, join as join40, resolve as resolve36, relative as relative15 } from "path";
24264
24675
  var SRC_PREFIX = "/@src/", jsTranspiler2, legacyDecoratorTsconfig, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
24265
24676
  const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
24266
24677
  const allExports = [];
@@ -24693,7 +25104,7 @@ ${code}`;
24693
25104
  if (!vueCompiler) {
24694
25105
  vueCompiler = await import("@vue/compiler-sfc");
24695
25106
  }
24696
- const fileName = basename13(filePath, ".vue");
25107
+ const fileName = basename15(filePath, ".vue");
24697
25108
  const componentId = toKebab(fileName);
24698
25109
  const { descriptor } = vueCompiler.parse(raw, { filename: filePath });
24699
25110
  const hasScript = descriptor.script || descriptor.scriptSetup;
@@ -25458,7 +25869,7 @@ var init_simpleHTMXHMR = () => {};
25458
25869
 
25459
25870
  // src/dev/rebuildTrigger.ts
25460
25871
  import { existsSync as existsSync33, rmSync as rmSync3 } from "fs";
25461
- import { basename as basename14, dirname as dirname25, join as join41, relative as relative17, resolve as resolve40, sep as sep4 } from "path";
25872
+ import { basename as basename16, dirname as dirname25, join as join41, relative as relative17, resolve as resolve40, sep as sep4 } from "path";
25462
25873
  var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequentially = (items, action) => items.reduce((chain, item) => chain.then(() => action(item)), Promise.resolve()), getStyleTransformConfig = (config) => createStyleTransformConfig(config.stylePreprocessors, config.postcss), recompileTailwindForFastPath = async (state, config, files) => {
25463
25874
  if (!config.tailwind)
25464
25875
  return;
@@ -25959,7 +26370,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
25959
26370
  if (serverDirs.length <= 1) {
25960
26371
  const dir = getFrameworkGeneratedDir2(framework, projectRoot);
25961
26372
  return {
25962
- serverOutDir: resolve40(resolvedPaths.buildDir, basename14(dir)),
26373
+ serverOutDir: resolve40(resolvedPaths.buildDir, basename16(dir)),
25963
26374
  serverRoot: resolve40(dir, "server")
25964
26375
  };
25965
26376
  }
@@ -25968,7 +26379,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
25968
26379
  serverRoot: commonAncestor2(serverDirs.map((entry) => entry.dir), projectRoot)
25969
26380
  };
25970
26381
  }, updateServerManifestEntry = (state, artifact) => {
25971
- const fileWithHash = basename14(artifact.path);
26382
+ const fileWithHash = basename16(artifact.path);
25972
26383
  const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
25973
26384
  if (!baseName) {
25974
26385
  return;
@@ -25982,7 +26393,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
25982
26393
  const prefixByDir = new Map;
25983
26394
  for (const artifact of freshOutputs) {
25984
26395
  const dir = dirname25(artifact.path);
25985
- const name = basename14(artifact.path);
26396
+ const name = basename16(artifact.path);
25986
26397
  const [prefix] = name.split(".");
25987
26398
  if (!prefix)
25988
26399
  continue;
@@ -26468,7 +26879,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
26468
26879
  await rewriteImports3(ssrPaths, angServerVendorPaths);
26469
26880
  }
26470
26881
  serverPaths.forEach((serverPath, idx) => {
26471
- const fileBase = basename14(serverPath, ".js");
26882
+ const fileBase = basename16(serverPath, ".js");
26472
26883
  const ssrPath = ssrPaths[idx] ?? serverPath;
26473
26884
  state.manifest[toPascal(fileBase)] = resolve40(ssrPath);
26474
26885
  });
@@ -26831,7 +27242,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
26831
27242
  const duration = Date.now() - startTime;
26832
27243
  const broadcastFiles = svelteFiles.length > 0 ? svelteFiles : filesToRebuild;
26833
27244
  broadcastFiles.forEach((sveltePagePath) => {
26834
- const fileName = basename14(sveltePagePath);
27245
+ const fileName = basename16(sveltePagePath);
26835
27246
  const baseName = fileName.replace(/\.svelte$/, "");
26836
27247
  const pascalName = toPascal(baseName);
26837
27248
  const cssKey = `${pascalName}CSS`;
@@ -26911,7 +27322,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
26911
27322
  const { vueServerPaths, vueIndexPaths, vueClientPaths, vueCssPaths } = await compileVue2(vueFiles, vueDir, true, getStyleTransformConfig(state.config));
26912
27323
  const serverEntries = [...vueServerPaths];
26913
27324
  const clientEntries = [...vueIndexPaths, ...vueClientPaths];
26914
- const cssOutDir = join41(buildDir, state.resolvedPaths.assetsDir ? basename14(state.resolvedPaths.assetsDir) : "assets", "css");
27325
+ const cssOutDir = join41(buildDir, state.resolvedPaths.assetsDir ? basename16(state.resolvedPaths.assetsDir) : "assets", "css");
26915
27326
  const { serverRoot, serverOutDir } = await computeServerOutPaths(state.resolvedPaths, "vue");
26916
27327
  const [serverResult, clientResult, cssResult] = await Promise.all([
26917
27328
  serverEntries.length > 0 ? bunBuild9({
@@ -27059,7 +27470,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
27059
27470
  const { compileEmber: compileEmber2 } = await Promise.resolve().then(() => (init_compileEmber(), exports_compileEmber));
27060
27471
  const { serverPaths } = await compileEmber2(allPageEntries, emberDir, process.cwd(), true);
27061
27472
  for (const serverPath of serverPaths) {
27062
- const fileBase = basename14(serverPath, ".js");
27473
+ const fileBase = basename16(serverPath, ".js");
27063
27474
  state.manifest[toPascal(fileBase)] = resolve40(serverPath);
27064
27475
  }
27065
27476
  const { invalidateEmberSsrCache: invalidateEmberSsrCache2 } = await Promise.resolve().then(() => (init_ember(), exports_ember));
@@ -27130,7 +27541,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
27130
27541
  });
27131
27542
  }
27132
27543
  }, handleScriptUpdate = (state, scriptFile, manifest, framework, duration) => {
27133
- const scriptBaseName = basename14(scriptFile).replace(/\.(ts|js|tsx|jsx)$/, "");
27544
+ const scriptBaseName = basename16(scriptFile).replace(/\.(ts|js|tsx|jsx)$/, "");
27134
27545
  const pascalName = toPascal(scriptBaseName);
27135
27546
  const scriptPath = manifest[pascalName] || null;
27136
27547
  if (!scriptPath) {
@@ -27209,7 +27620,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
27209
27620
  if (isSingle) {
27210
27621
  return resolve40(state.resolvedPaths.buildDir, "pages");
27211
27622
  }
27212
- const dirName = framework === "html" ? basename14(config.htmlDirectory ?? "html") : basename14(config.htmxDirectory ?? "htmx");
27623
+ const dirName = framework === "html" ? basename16(config.htmlDirectory ?? "html") : basename16(config.htmxDirectory ?? "htmx");
27213
27624
  return resolve40(state.resolvedPaths.buildDir, dirName, "pages");
27214
27625
  }, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
27215
27626
  try {
@@ -27248,7 +27659,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
27248
27659
  const shouldRefreshAllPages = htmlPageFiles.length === 0 && shouldRefreshFromIslandChange;
27249
27660
  const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
27250
27661
  await runSequentially(pageFilesToUpdate, async (pageFile) => {
27251
- const htmlPageName = basename14(pageFile);
27662
+ const htmlPageName = basename16(pageFile);
27252
27663
  const builtHtmlPagePath = resolve40(outputHtmlPages, htmlPageName);
27253
27664
  await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
27254
27665
  });
@@ -27257,7 +27668,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
27257
27668
  if (!cssFile) {
27258
27669
  return;
27259
27670
  }
27260
- const cssBaseName = basename14(getStyleBaseName(cssFile));
27671
+ const cssBaseName = basename16(getStyleBaseName(cssFile));
27261
27672
  const cssPascalName = toPascal(cssBaseName);
27262
27673
  const cssKey = `${cssPascalName}CSS`;
27263
27674
  const cssUrl = manifest[cssKey] || null;
@@ -27306,7 +27717,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
27306
27717
  type: "vue-update"
27307
27718
  });
27308
27719
  }, broadcastVuePageChange = async (state, config, vuePagePath, manifest, duration) => {
27309
- const fileName = basename14(vuePagePath);
27720
+ const fileName = basename16(vuePagePath);
27310
27721
  const baseName = fileName.replace(/\.vue$/, "");
27311
27722
  const pascalName = toPascal(baseName);
27312
27723
  const vueRoot = config.vueDirectory;
@@ -27352,7 +27763,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
27352
27763
  if (!cssFile) {
27353
27764
  return;
27354
27765
  }
27355
- const cssBaseName = basename14(getStyleBaseName(cssFile));
27766
+ const cssBaseName = basename16(getStyleBaseName(cssFile));
27356
27767
  const cssPascalName = toPascal(cssBaseName);
27357
27768
  const cssKey = `${cssPascalName}CSS`;
27358
27769
  const cssUrl = manifest[cssKey] || null;
@@ -27370,7 +27781,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
27370
27781
  });
27371
27782
  }, broadcastSveltePageUpdate = (state, sveltePagePath, manifest, duration) => {
27372
27783
  try {
27373
- const fileName = basename14(sveltePagePath);
27784
+ const fileName = basename16(sveltePagePath);
27374
27785
  const baseName = fileName.replace(/\.svelte$/, "");
27375
27786
  const pascalName = toPascal(baseName);
27376
27787
  const cssKey = `${pascalName}CSS`;
@@ -27419,7 +27830,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
27419
27830
  if (!cssFile) {
27420
27831
  return;
27421
27832
  }
27422
- const cssBaseName = basename14(getStyleBaseName(cssFile));
27833
+ const cssBaseName = basename16(getStyleBaseName(cssFile));
27423
27834
  const cssPascalName = toPascal(cssBaseName);
27424
27835
  const cssKey = `${cssPascalName}CSS`;
27425
27836
  const cssUrl = manifest[cssKey] || null;
@@ -27499,7 +27910,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
27499
27910
  const shouldRefreshAllPages = htmxPageFiles.length === 0 && shouldRefreshFromIslandChange;
27500
27911
  const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
27501
27912
  await runSequentially(pageFilesToUpdate, async (htmxPageFile) => {
27502
- const htmxPageName = basename14(htmxPageFile);
27913
+ const htmxPageName = basename16(htmxPageFile);
27503
27914
  const builtHtmxPagePath = resolve40(outputHtmxPages, htmxPageName);
27504
27915
  await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
27505
27916
  });
@@ -27609,7 +28020,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
27609
28020
  html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
27610
28021
  writeFs(destPath, html);
27611
28022
  }, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
27612
- const destPath = resolve40(outputDir, basename14(sourceFile));
28023
+ const destPath = resolve40(outputDir, basename16(sourceFile));
27613
28024
  const hmrScript = extractHmrScript(destPath, readFs);
27614
28025
  const source = await Bun.file(sourceFile).text();
27615
28026
  await Bun.write(destPath, source);
@@ -28684,5 +29095,5 @@ export {
28684
29095
  build
28685
29096
  };
28686
29097
 
28687
- //# debugId=EF9AB7EF23A864D264756E2164756E21
29098
+ //# debugId=43AB0E9B045691AA64756E2164756E21
28688
29099
  //# sourceMappingURL=build.js.map