mirror of
https://github.com/SoPat712/Speeder.git
synced 2026-10-08 11:05:02 -04:00
chore: refresh release and test tooling
This commit is contained in:
11 files changed
+206
-252
No files matched your search
@@ -8,6 +8,7 @@ import { applyJSDOMWindow } from "./jsdom-globals.js";
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const repoRoot = path.resolve(__dirname, "..", "..");
|
||||
let activeDom = null;
|
||||
|
||||
function readRepoFile(relPath) {
|
||||
return fs.readFileSync(path.join(repoRoot, relPath), "utf8");
|
||||
@@ -18,11 +19,13 @@ function readRepoFile(relPath) {
|
||||
* top-level `const` redeclaration errors (avoids document.write).
|
||||
*/
|
||||
export function loadHtmlString(html, options = {}) {
|
||||
if (activeDom) activeDom.window.close();
|
||||
const dom = new JSDOM(html, {
|
||||
url: options.url || "https://example.org/",
|
||||
pretendToBeVisual: true,
|
||||
runScripts: "dangerously"
|
||||
});
|
||||
activeDom = dom;
|
||||
applyJSDOMWindow(dom.window);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ const { JSDOM } = require("jsdom");
|
||||
const vi = globalThis.vi;
|
||||
|
||||
const ROOT = path.resolve(__dirname, "..", "..");
|
||||
let activeDom = null;
|
||||
|
||||
function clone(value) {
|
||||
if (value === undefined) return undefined;
|
||||
@@ -47,11 +48,13 @@ function applyJSDOMWindow(win) {
|
||||
|
||||
function loadHtmlString(html, options) {
|
||||
const config = options || {};
|
||||
if (activeDom) activeDom.window.close();
|
||||
const dom = new JSDOM(html, {
|
||||
url: config.url || "https://example.org/",
|
||||
pretendToBeVisual: true,
|
||||
runScripts: "dangerously"
|
||||
});
|
||||
activeDom = dom;
|
||||
applyJSDOMWindow(dom.window);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user