Noob question about data for the new "Package Dependencies"

Just starting to prototype a few viz, and am obviously missing some fundamentals. :slight_smile:

I read the introduction to data, but don’t see something equivalent to the usage as per this new observable “Package Dependenices”

[https://beta.observablehq.com/@mbostock/package-dependencies]

How do I replace this object with one of my own?

Thanks,

Owen

OK, now I see pulling package.json for every module from unpkg.com, starting with the [name] variable set at the top of the workbook;

Since we are still using d3 v4, this is very helpful:

To visualize the dependencies of D3 v4, type d3@4 into the box, and click Submit. You’ll see this:

1 Like

Thanks, Mike, the only thing I am missing now is s where you set the Url prefix to ‘unpkg.com’ in the code?

Must be right in front of me, but don’t see it. :slight_smile:

-Owen

That’s in require.resolve.

If you want this to visualize dependencies of a package that’s not on npm, I suspect you’ll need to edit the notebook and replace the calls to require.resolve with something else that points to your package.json.

Ah–got it! Thanks, Mike