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

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.
@@ -19,6 +19,9 @@ export type VueSetupAppContext = {
19
19
  * instead. Pass the destination location and an optional status
20
20
  * (defaults to `302`). */
21
21
  setRedirect: (location: string, status?: number) => void;
22
+ /** Server-only. Mark the current SPA route as unmatched so the page
23
+ * handler returns the project's not-found convention with HTTP 404. */
24
+ setNotFound: () => void;
22
25
  };
23
26
  export type VueSetupApp = (app: App, ctx: VueSetupAppContext) => void | Promise<void>;
24
27
  /** Structural shape of a single vue-router route record. Kept loose
package/dist/vue/index.js CHANGED
@@ -5070,6 +5070,7 @@ var handleVuePageRequest = async (input) => {
5070
5070
  render: () => h4(resolvedPage.component, maybeProps ?? null)
5071
5071
  });
5072
5072
  let pendingRedirect = null;
5073
+ let pendingNotFound = false;
5073
5074
  if (resolvedPage.setupApp) {
5074
5075
  const url = resolveRequestRenderUrl(input.request);
5075
5076
  await resolvedPage.setupApp(app, {
@@ -5081,6 +5082,9 @@ var handleVuePageRequest = async (input) => {
5081
5082
  location,
5082
5083
  status: status ?? 302
5083
5084
  };
5085
+ },
5086
+ setNotFound: () => {
5087
+ pendingNotFound = true;
5084
5088
  }
5085
5089
  });
5086
5090
  }
@@ -5091,6 +5095,12 @@ var handleVuePageRequest = async (input) => {
5091
5095
  status: redirect.status
5092
5096
  });
5093
5097
  }
5098
+ if (pendingNotFound) {
5099
+ return await renderFirstNotFound() ?? new Response("Not found", {
5100
+ headers: { "Content-Type": "text/plain" },
5101
+ status: 404
5102
+ });
5103
+ }
5094
5104
  const head = `<!DOCTYPE html><html>${resolvedHeadTag}<body><div id="root">`;
5095
5105
  const ssrOnlyHmrShim = clientMode === "none" ? await getSsrOnlyHmrShim() : "";
5096
5106
  const tail = clientMode === "none" ? `</div>${ssrOnlyHmrShim}</body></html>` : `</div><script>window.__INITIAL_PROPS__=${JSON.stringify(maybeProps ?? {})}</script><script type="module" src="${resolvedIndexPath}"></script></body></html>`;
@@ -5598,5 +5608,5 @@ export {
5598
5608
  Image
5599
5609
  };
5600
5610
 
5601
- //# debugId=F0E283E992F376C264756E2164756E21
5611
+ //# debugId=214220BE4E9490D964756E2164756E21
5602
5612
  //# sourceMappingURL=index.js.map