|
1 | 1 | import { concat } from "https://deno.land/[email protected]/bytes/mod.ts";
|
2 |
| -import type { Comment, DocumentEnd, Element } from "https://deno.land/x/[email protected]/types.d.ts"; |
| 2 | +import type { Comment, DocumentEnd, Element, TextChunk } from "https://deno.land/x/[email protected]/types.d.ts"; |
3 | 3 | import initLolHtml, { HTMLRewriter } from "https://deno.land/x/[email protected]/mod.js";
|
4 | 4 | import decodeLolHtmlWasm from "https://deno.land/x/[email protected]/wasm.js";
|
5 | 5 | import util from "../lib/util.ts";
|
6 | 6 | import { applyImportMap, getAlephPkgUri, getDeploymentId, toLocalPath } from "./helpers.ts";
|
7 | 7 | import type { ImportMap } from "./types.ts";
|
8 | 8 |
|
| 9 | +// init lol-html wasm |
9 | 10 | await initLolHtml(decodeLolHtmlWasm());
|
10 | 11 |
|
| 12 | +export type HTMLRewriterHandlers = { |
| 13 | + element?: (element: Element) => void; |
| 14 | + comments?: (element: Comment) => void; |
| 15 | + text?: (text: TextChunk) => void; |
| 16 | +}; |
| 17 | + |
11 | 18 | type LoadOptions = {
|
12 | 19 | isDev: boolean;
|
13 | 20 | importMap: ImportMap;
|
14 | 21 | ssr?: { suspense?: boolean };
|
15 | 22 | hmrWebSocketUrl?: string;
|
16 | 23 | };
|
17 | 24 |
|
18 |
| -// laod the `index.html` |
| 25 | +// load and fix the `index.html` |
19 | 26 | // - fix relative url to absolute url of `src` and `href`
|
20 | 27 | // - add `./framework/core/hmr.ts` when in `development` mode
|
21 | 28 | // - add `./framework/core/nomodule.ts`
|
@@ -238,4 +245,4 @@ export function parseHtmlLinks(html: string | Uint8Array): Promise<string[]> {
|
238 | 245 | });
|
239 | 246 | }
|
240 | 247 |
|
241 |
| -export { Comment, Element, HTMLRewriter }; |
| 248 | +export { Element, HTMLRewriter }; |
0 commit comments