Skip to content
Meeko
Type to search the guides and the API reference. Open it from any page with / or Ctrl K; move with the arrow keys and open a result with Enter.
Get started

Contents

On this page

Not translated yet

This page has not been translated into English yet, so it is shown in Spanish.

PrerenderOptions

interfaz

Opciones de prerenderRoutes.

ts
import type { PrerenderOptions } from "@meekojs/meeko/build";

Source code src/framework/prerender.ts:39

Declaración #

ts
interface PrerenderOptions {
	readonly routes: readonly RouteRecord[]
	readonly handler: (request: Request) => Promise<Response>
	readonly loadRoute?: (file: string) => Promise<PageRoute>
	readonly outputRoot: string
	readonly origin?: string
	readonly transformHtml?: (html: string) => string | Promise<string>
	readonly extendUrls?: (urls: string[]) => void | Promise<void>
}

Example #

ts
import { prerenderRoutes } from "@meekojs/meeko/build";
import type { PrerenderOptions } from "@meekojs/meeko/build";

const options: PrerenderOptions = {
  routes,
  handler: (request) => handler(request),
  loadRoute: (file) => import(file).then((module) => module.route),
  outputRoot: "dist/prerender",
  origin: "https://example.com",
};
await prerenderRoutes(options);

Propiedades #

routes #

propiedad sólo lectura

readonly routes: readonly RouteRecord[]

Manifiesto de rutas; sólo se renderizan las render: "prerender".

handler #

propiedad sólo lectura

readonly handler: (request: Request) => Promise<Response>

Renderiza una página. No debe ejecutar el middleware de servidor, que vuelve a ejecutarse al servirla.

loadRoute #

propiedad sólo lectura opcional

readonly loadRoute?: (file: string) => Promise<PageRoute>

Carga las opciones de ruta de un sidecar, para leer render y prerenderEntries.

outputRoot #

propiedad sólo lectura

readonly outputRoot: string

Carpeta de salida del HTML, los payloads y manifest.json.

origin #

propiedad sólo lectura opcional

readonly origin?: string

Origen de las peticiones de render; por defecto, http://meeko.local.

transformHtml #

propiedad sólo lectura opcional

readonly transformHtml?: (html: string) => string | Promise<string>

Transforma el HTML antes de guardarlo.

extendUrls #

propiedad sólo lectura opcional since 1.2.0

readonly extendUrls?: (urls: string[]) => void | Promise<void>

Recibe las URL (pathname) que se van a prerenderizar y puede añadir o quitar entradas; cada URL que añade debe corresponder a una ruta. meeko build lo usa para el hook prerender:routes.

See also #

Was this page helpful?

Add a comment

It is sent when you choose “Yes” or “No”. Only the page, your answer and the comment are stored: no cookies and no personal data.

0 of 2000 characters

Edit on GitHub: packages/meeko/src/framework/prerender.ts