@opentf/afw-build 0.6.0 → 0.7.0

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.
Files changed (2) hide show
  1. package/document.js +9 -1
  2. package/package.json +1 -1
package/document.js CHANGED
@@ -245,6 +245,14 @@ export async function renderDocument(render, {
245
245
  return { status, html: document, dataJson, loaded: !!match, metadata, route: result.route ?? null };
246
246
  }
247
247
 
248
+ /**
249
+ * The inline route data of a 404 page, so the client adopts it as the 404 page even
250
+ * where the URL matches a route (a loader's `notFound()`, or a static host serving
251
+ * 404.html for a path it has no file for). Mirrors `NOT_FOUND_PAYLOAD` in the
252
+ * `@opentf/afw` runtime (runtime/route-data.js).
253
+ */
254
+ export const NOT_FOUND_DATA = '{"__afwNotFound":true}';
255
+
248
256
  /** The 404 page as a document (`noindex`), or `null` when the app has none. */
249
257
  export async function renderNotFound(render, { shell, baseUrl = "", preload = "" } = {}) {
250
258
  const result = await render.renderRoute("/__afw_404__");
@@ -253,7 +261,7 @@ export async function renderNotFound(render, { shell, baseUrl = "", preload = ""
253
261
  if (preload) head += `\n${preload}`;
254
262
  return {
255
263
  status: 404,
256
- html: injectHydrationData(injectMarkup(injectHead(shell, head), result.html), result.hydration),
264
+ html: injectRouteData(injectHydrationData(injectMarkup(injectHead(shell, head), result.html), result.hydration), NOT_FOUND_DATA),
257
265
  dataJson: "",
258
266
  loaded: false,
259
267
  metadata: result.metadata ?? {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentf/afw-build",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "The toolchain-neutral core of AFW's build: compiler client, compile targets and file-based routing.",
5
5
  "type": "module",
6
6
  "scripts": {