@absolutejs/absolute 0.19.0-beta.766 → 0.19.0-beta.767

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.
@@ -4861,13 +4861,31 @@ var derivePageName = (pagePath) => {
4861
4861
  const name = dotIndex > 0 ? base.slice(0, dotIndex) : base;
4862
4862
  return toPascal(name);
4863
4863
  };
4864
+ var normalizeConventionPageName = (name) => toPascal(name).replace(/\d+$/, "");
4864
4865
  var resolveErrorConventionPath = (framework, pageName) => {
4865
4866
  const conventions = getMap()[framework];
4866
4867
  if (!conventions)
4867
4868
  return;
4868
- return conventions.pages?.[pageName]?.error ?? conventions.defaults?.error;
4869
+ const exact = conventions.pages?.[pageName]?.error;
4870
+ if (exact)
4871
+ return exact;
4872
+ const normalizedPageName = normalizeConventionPageName(pageName);
4873
+ for (const [candidate, page] of Object.entries(conventions.pages ?? {})) {
4874
+ if (normalizeConventionPageName(candidate) === normalizedPageName) {
4875
+ return page.error ?? conventions.defaults?.error;
4876
+ }
4877
+ }
4878
+ return conventions.defaults?.error;
4869
4879
  };
4870
4880
  var resolveNotFoundConventionPath = (framework) => getMap()[framework]?.defaults?.notFound;
4881
+ var hasErrorConvention = (framework) => {
4882
+ const conventions = getMap()[framework];
4883
+ if (!conventions)
4884
+ return false;
4885
+ if (conventions.defaults?.error)
4886
+ return true;
4887
+ return Object.values(conventions.pages ?? {}).some((page) => Boolean(page.error));
4888
+ };
4871
4889
  var setConventions = (map) => {
4872
4890
  Reflect.set(globalThis, CONVENTIONS_KEY, map);
4873
4891
  };
@@ -4953,7 +4971,17 @@ var ERROR_RENDERERS = {
4953
4971
  vue: renderVueError
4954
4972
  };
4955
4973
  var renderConventionError = async (framework, pageName, error) => {
4956
- const conventionPath = resolveErrorConventionPath(framework, pageName);
4974
+ let conventionPath = resolveErrorConventionPath(framework, pageName);
4975
+ if (!conventionPath && error instanceof Error && error.stack) {
4976
+ for (const match of error.stack.matchAll(/^\s*at\s+([A-Za-z_$][\w$]*)/gm)) {
4977
+ const candidate = match[1];
4978
+ if (!candidate)
4979
+ continue;
4980
+ conventionPath = resolveErrorConventionPath(framework, candidate);
4981
+ if (conventionPath)
4982
+ break;
4983
+ }
4984
+ }
4957
4985
  if (!conventionPath)
4958
4986
  return null;
4959
4987
  const errorProps = buildErrorProps(error);
@@ -5579,5 +5607,5 @@ export {
5579
5607
  ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER
5580
5608
  };
5581
5609
 
5582
- //# debugId=5503040E3F1992BE64756E2164756E21
5610
+ //# debugId=1182DBD27B32BA4764756E2164756E21
5583
5611
  //# sourceMappingURL=server.js.map