/** * The middleware provides support for Web request-response handling using fetch-like behavior, and for Node.js native http request and responses object, including using Connect framework, via the imported adaptor. */ import { FragmentGateway, FragmentMiddlewareOptions } from '../fragment-gateway'; /** * Creates middleware for handling web-based fragment rendering. * @param {FragmentGateway} gateway - The fragment gateway instance. * @param {FragmentMiddlewareOptions} [options={}] - Optional middleware settings. * @returns {Function} - A middleware function for processing web requests. */ export declare function getWebMiddleware(gateway: FragmentGateway, options?: FragmentMiddlewareOptions): (request: Request, next: () => Promise) => Promise; /** * Strips from the response body. * * Nested doctype tags might cause some browsers to complain or choke (e.g. Firefox in some cases). * * Browsers don't materialize this tag in the DOM anyway so it should be ok to strip them (if it's nested within other elements). * * HTMLRewriter doesn't support modifying the doctype tag, so we strip it manually here. * * @param fragmentResponse * @returns */ export declare function stripDoctype(fragmentResponse: Response): Response; /** * Rewrites html so that any , , and tags are replaced with , , and tags. * * DOM doesn't allow duplicates of these three elements in the document, and the main document already contains them. * * We need to replace these tags, to prevent the DOM from silently dropping them when the content is added to the main document. * * @param {Response} fragmentResponse response to rewrite * @returns {Response} rewritten response */ export declare function prefixHtmlHeadBody(fragmentResponse: Response): Response; /** * Rewrites html so that any script tags and script preload/prefetch links become inert and don't execute. * * @param {Response} fragmentResponse response to rewrite * @returns {Response} rewritten response */ export declare function neutralizeScriptAndLinkTags(fragmentResponse: Response): Response; /** * A tagged template that produces a ReadableStream of its content. * It supports interpolating other ReadableStreams, which allows you * to easily wrap streams with text or combine multiple streams, etc. * * @example * const wrappedBody = asReadableStream``; * const combinedStream = asReadableStream`${stream1}${stream2}`; */ export declare function asReadableStream(strings: TemplateStringsArray, ...values: Array): ReadableStream;