@satori-sh/cli 0.0.29 → 0.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -365,18 +365,33 @@ ${instruction}`);
365
365
  return;
366
366
  }
367
367
  const info = await getInfoDisplay();
368
- if (typeof globalThis.Element === "undefined") {
369
- globalThis.Element = class Element {
370
- };
371
- }
372
368
  if (typeof globalThis.document === "undefined") {
373
- globalThis.document = {
374
- createElement: () => ({}),
375
- createElementNS: () => ({}),
376
- createTextNode: () => ({})
369
+ const { parseHTML } = await import("linkedom");
370
+ const { document, window } = parseHTML("<html><body></body></html>");
371
+ const domWindow = window;
372
+ const globalScope = globalThis;
373
+ globalScope.window = window;
374
+ globalScope.document = document;
375
+ globalScope.Element = domWindow.Element ?? class Element {
376
+ };
377
+ globalScope.Node = domWindow.Node ?? class Node {
378
+ };
379
+ globalScope.Text = domWindow.Text ?? class Text {
380
+ };
381
+ globalScope.HTMLElement = domWindow.HTMLElement ?? class HTMLElement {
377
382
  };
383
+ globalScope.SVGElement = domWindow.SVGElement ?? class SVGElement {
384
+ };
385
+ globalScope.SVGSVGElement = domWindow.SVGSVGElement ?? class SVGSVGElement {
386
+ };
387
+ if (domWindow.navigator) {
388
+ globalScope.navigator = domWindow.navigator;
389
+ }
390
+ if (domWindow.getComputedStyle) {
391
+ globalScope.getComputedStyle = domWindow.getComputedStyle;
392
+ }
378
393
  }
379
- const { runInteractiveApp } = await import("./ui-OEY6KRG2.js");
394
+ const { runInteractiveApp } = await import("./ui-4LVANHF6.js");
380
395
  await runInteractiveApp({
381
396
  initialPrompt,
382
397
  options,