Skip to content

JS createGraph modifies objects returned by load #419

@0f-0b

Description

@0f-0b
import { createCache } from "jsr:@deno/cache-dir@0.8.0";
import { createGraph } from "jsr:@deno/graph@0.69.7";

const { load } = createCache();
{
  // the object returned by `load` is modified,
  await createGraph("https://examples.deno.land/hello-world.ts", { load });
}
{
  // which can lead to unexpected behavior elsewhere.
  const res = await load("https://examples.deno.land/hello-world.ts");
  if (res?.kind === "module") {
    const content = res.content;
    // this should print `true` but actually prints `false`.
    console.log(typeof content === "string" || ArrayBuffer.isView(content));
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions