Skip to content

Commit

Permalink
fix #22 document is not defined (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjurbanski-reef authored May 18, 2023
1 parent 78dc213 commit 5f77c83
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions import-map.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"log/": "https://deno.land/[email protected]/log/",

"cac/": "https://unpkg.dev/[email protected]/",
"deno_dom/": "https://deno.land/x/[email protected]/",
"diff": "https://cdn.skypack.dev/diff@5",
"remark": "https://jspm.dev/remark@13",
"micromark-extension-frontmatter": "https://jspm.dev/micromark-extension-frontmatter@1",
Expand Down
11 changes: 11 additions & 0 deletions readable.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Document, DOMParser } from "deno_dom/deno-dom-wasm.ts";
import { cac } from "cac/mod.ts";
import { processArgs } from "cac/deno/deno.ts";
import { getLogger } from "log/mod.ts";
Expand All @@ -7,6 +8,16 @@ import check from "./cmd/check.ts";
import fmt, { FmtOptions } from "./cmd/fmt.ts";
import setupLogger from "./lib/setupLogger.ts";

/**
* Workaround for document reference error during parsing.
*/
declare module globalThis {
var document: any;
}
const parser = new DOMParser();
const doc = parser.parseFromString("<html></html>", "text/html");
globalThis.document = doc;

const cli = cac("readable")
.version(READABLE_VERSION)
.help()
Expand Down

0 comments on commit 5f77c83

Please sign in to comment.