forked from dragonstyle/deno-dom
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master'
- Loading branch information
Showing
83 changed files
with
1,735 additions
and
386 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM mcr.microsoft.com/devcontainers/base:debian | ||
|
||
# Install deno | ||
ENV DENO_INSTALL=/deno | ||
RUN mkdir -p /deno \ | ||
&& curl -fsSL https://deno.land/install.sh | sh \ | ||
&& chown -R vscode /deno | ||
|
||
ENV PATH=${DENO_INSTALL}/bin:${PATH} \ | ||
DENO_DIR=${DENO_INSTALL}/.cache/deno |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "Deno", | ||
"build": { | ||
"dockerfile": "Dockerfile" | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"editor.defaultFormatter": "denoland.vscode-deno", | ||
"deno.lint": true, | ||
"deno.enable": true | ||
}, | ||
"extensions": ["denoland.vscode-deno"] | ||
}, | ||
"remoteUser": "vscode" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,45 @@ | ||
/** | ||
* @module | ||
* | ||
* This module exposes the Deno DOM API with the WASM (Web Assembly) backend. | ||
* This module is different from the primary WASM module because it allows | ||
* you to control when the WASM HTML parsing engine loads (which is a | ||
* relatively slow process). You can't use any of the parsing functions | ||
* of Deno DOM until you invoke the async `initParser()` export. | ||
* | ||
* @example | ||
* ```ts | ||
* import { DOMParser, initParser } from "jsr:@b-fuze/deno-dom/wasm-noinit"; | ||
* | ||
* // ...and when you need Deno DOM's parser make sure you initialize it... | ||
* await initParser(); | ||
* | ||
* // Then you can use Deno DOM as you would normally | ||
* const doc = new DOMParser().parseFromString( | ||
* ` | ||
* <h1>Hello World!</h1> | ||
* <p>Hello from <a href="https://deno.land/">Deno!</a></p> | ||
* `, | ||
* "text/html", | ||
* ); | ||
* | ||
* const p = doc.querySelector("p")!; | ||
* console.log(p.textContent); // "Hello from Deno!" | ||
* ``` | ||
*/ | ||
|
||
import initWasm, { | ||
parse, | ||
parse_frag as parseFrag, | ||
} from "./build/deno-wasm/deno-wasm.js"; | ||
import { register } from "./src/parser.ts"; | ||
import { type Parser, register } from "./src/parser.ts"; | ||
|
||
export async function initParser() { | ||
await initWasm(); | ||
register(parse, parseFrag); | ||
register( | ||
parse, | ||
parseFrag as Parser, | ||
); | ||
} | ||
|
||
export * from "./src/api.ts"; |
Oops, something went wrong.