Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS createGraph modifies objects returned by load #419

Open
0f-0b opened this issue Mar 19, 2024 · 0 comments
Open

JS createGraph modifies objects returned by load #419

0f-0b opened this issue Mar 19, 2024 · 0 comments

Comments

@0f-0b
Copy link
Contributor

0f-0b commented Mar 19, 2024

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));
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant