Yo! I have to use Rollup's JavaScript API to bundle some code directly in the browser (it's an online REPL). I use UNPKG to fetch the packages, and at some point, I need a list of all the imported file, packages etc.
I am used to bundle in the browser using esbuild; with esbuild's JavaScript API I can get the list I need, once the bundle is created, by accessing bundle?.metafile?.inputs.
The bundle.metafile.inputs looks like this :
{
'a:App.jsx': {
bytes: 368,
imports: [
{
kind: "import-statement",
path: "b:https://unpkg.com/react"
},
{
kind: "import-statement",
path: "b:https://unpkg.com/react-dom/client"
}
]
},
'b:https://unpkg.com/react': {
bytes: 190,
imports:[
{
kind: "require-call",
path: "b:https://unpkg.com/react@18.2.0/cjs/react.production.min.js"
}
]
}
// ... here all of the other imports and imports of imports
}
I looked for something similar in Rollup's documentation but couldn't find any.
Is there anything similar to what I need in Rollup's JS API, or perhaps any existing plugin specific for a usecase without file-system (I mean, with just a virtual one), or do I have to create a similar plugin myself?
Thx in advance,