import { i as wrapTitle, n as WrapTitleOptions, r as ogCardSvg, t as OgCardOptions } from "../../og-card-3fwMvrJq.js"; import { a as IndexingFinding, c as RedirectFinding, d as extractLinks, f as pageSignals, i as DuplicateTitleFinding, l as checkLinks, n as CheckLinksOptions, o as IndexingIssue, r as CrawlReport, s as PageSignals, t as BrokenLink, u as crawlSite } from "../../link-check-CVOhtrRy.js"; import { BrowserWorker } from "@cloudflare/puppeteer"; import { InitInput } from "@resvg/resvg-wasm"; //#region src/core/browser/types.d.ts /** * Binding contract for the Louise browser helpers. A site whose `Env` uses * Browser Run should `extends LouiseBrowserEnv`. The helpers take the binding * explicitly, so this is the typed contract, not an implicit reach. */ interface LouiseBrowserEnv { /** Cloudflare Browser Run (Browser Rendering) binding. */ BROWSER: BrowserWorker; } /** * A byte store for rendered OG images. It's declared structurally, so the module * depends on no storage binding, but no binding fits it as is: an R2 bucket's * `get` returns an object body and a KV namespace's returns a string or an * `ArrayBuffer`, and both take an options object where `put` takes a content * type. Wrap the one you use in a few lines that convert to and from * `Uint8Array`. Keys are content-hashed, so a hit means the exact page and * content were rendered. */ interface OgImageCache { get(key: string): Promise; put(key: string, bytes: Uint8Array, contentType?: string): Promise; } /** Renders an HTML string to PNG bytes. The edge implementation drives Browser * Run (see `createPuppeteerRenderer`); tests inject a stub. */ type OgRenderer = (html: string) => Promise; //#endregion //#region src/core/browser/og-image.d.ts interface OgCacheKeyOptions { /** Key namespace/prefix. Default `"og"`. */ prefix?: string; /** File extension. Default `"png"`. */ ext?: string; } /** * Build the cache key for a page's OG image: `/-.`. * The content hash means editing a page mints a new key (old card falls out of * cache naturally) while an unchanged page always resolves to the same key. */ declare function ogCacheKey(slug: string, content: string, options?: OgCacheKeyOptions): Promise; interface OgImageOptions { /** Stable, content-hashed cache key (see {@link ogCacheKey}). */ cacheKey: string; /** The card source markup fed to the renderer—SVG for * {@link createResvgRenderer}, HTML for {@link createPuppeteerRenderer}. */ markup: string; /** How to rasterize the markup to PNG bytes. */ render: OgRenderer; /** Byte store. Omit to always render (no caching). */ cache?: OgImageCache; } interface OgImageResult { bytes: Uint8Array; /** True when served from the cache (no browser session was launched). */ cached: boolean; } /** * Return a page's OG image, rendering it only on a cache miss. On a hit the * stored bytes come back with `cached: true` and the renderer is never called—so * no Browser Run session spins up. */ declare function ogImage(options: OgImageOptions): Promise; interface PuppeteerRendererOptions { /** Viewport (card) size. Default 1200×630—the standard OG card. */ width?: number; height?: number; deviceScaleFactor?: number; } /** * An {@link OgRenderer} backed by Cloudflare Browser Run. Launches a session, * sets the card HTML, screenshots the viewport as PNG, and always closes the * browser. `@cloudflare/puppeteer` is imported dynamically so it's pulled in * only by sites that actually render—keeping it a truly optional peer. */ declare function createPuppeteerRenderer(browser: BrowserWorker, options?: PuppeteerRendererOptions): OgRenderer; //#endregion //#region src/core/browser/resvg.d.ts /** The subset of `@resvg/resvg-wasm` this renderer uses. Declared structurally * (via `typeof import`) so the peer is a pure type—erased at build, never a * runtime import except the guarded dynamic `import()` below. */ type ResvgModule = typeof import("@resvg/resvg-wasm"); interface ResvgRendererOptions { /** The compiled resvg WASM, passed to `initWasm`: a `WebAssembly.Module`, the * `.wasm` bytes, or a `Response`/URL. On Cloudflare Workers, import the * package's `index_bg.wasm` (a `WebAssembly.Module`) and pass it here. */ wasm: InitInput | Promise; /** Raw font buffers used to shape ``. At least one is required for any * text to render; Workers has no system fonts. */ fonts: (Uint8Array | ArrayBuffer)[]; /** Family resvg falls back to when a `font-family` isn't matched. Set this to * the family of the font you pass so a single supplied font always renders. */ defaultFontFamily?: string; /** Force the output width in px (height scales to preserve aspect). Omit to * render at the SVG's intrinsic size (the card is authored at 1200×630). */ width?: number; /** Test seam: supply the resvg module instead of importing the optional peer. */ loadResvg?: () => Promise; } /** * Build an {@link OgRenderer} that rasterizes an SVG string to PNG bytes via * resvg/WASM. The WASM is initialized once per isolate (lazily, on first * render); each call constructs a `Resvg`, renders, and returns the PNG bytes. * Pair with {@link ogCardSvg} and drive through {@link ogImage} for caching. */ declare function createResvgRenderer(options: ResvgRendererOptions): OgRenderer; //#endregion export { type BrokenLink, type CheckLinksOptions, type CrawlReport, type DuplicateTitleFinding, type IndexingFinding, type IndexingIssue, type LouiseBrowserEnv, type OgCacheKeyOptions, type OgCardOptions, type OgImageCache, type OgImageOptions, type OgImageResult, type OgRenderer, type PageSignals, type PuppeteerRendererOptions, type RedirectFinding, type ResvgRendererOptions, type WrapTitleOptions, checkLinks, crawlSite, createPuppeteerRenderer, createResvgRenderer, extractLinks, ogCacheKey, ogCardSvg, ogImage, pageSignals, wrapTitle };