denoland / denoland/deno_graph

JS `createGraph` modifies objects returned by `load`

Open
#419 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
137
Forks
47
Avg merge
2d 7h
Merged PRs (30d)
4

Description

```ts
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));
}
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the createGraph entry point and trace how the supplied load callback's result is handled. Reproduce the example with createCache and load, then verify that calling createGraph leaves the returned module content unchanged and that the final type check prints true.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.