Add import source in metafile.inputs
Through the current metafile, we can analyze the module dependency graph, but we do not know how a specific dependency is imported. For example, import React from 'react', then the original import path is react. Of course, there are many submodules imported. Hopefully this information can be included in esbuild's metafile, for example:
interface Metadata {
inputs: {
[path: string]: {
bytes: number
imports: {
path: string
kind: string
// raw request path
request: string
}[]
}
}
}
seems same as https://github.com/evanw/esbuild/issues/1694
By raw request path it sounds like you're asking for the original (pre-resolve) import path instead of the calculated (post-resolve) import path. Is that correct?
For example, in the following code:
import React1 from 'react'
import React2 from './node_modules/react/index.js'
Right now the metafile contains this:
"index.js": {
"bytes": 78,
"imports": [
{
"path": "node_modules/react/index.js",
"kind": "import-statement"
},
{
"path": "node_modules/react/index.js",
"kind": "import-statement"
}
]
}
Are you asking for something like this?
"index.js": {
"bytes": 78,
"imports": [
{
"path": "node_modules/react/index.js",
"kind": "import-statement",
"request": "react"
},
{
"path": "node_modules/react/index.js",
"kind": "import-statement",
"request": "./node_modules/react/index.js"
}
]
}
Yes,that's right.
---Original--- From: "Evan @.> Date: Fri, May 27, 2022 03:30 AM To: @.>; Cc: @.@.>; Subject: Re: [evanw/esbuild] Add import source in metafile.inputs (Issue#2262)
By raw request path it sounds like you're asking for the original (pre-resolve) import path instead of the calculated (post-resolve) import path. Is that correct?
For example, in the following code: import React1 from 'react' import React2 from './node_modules/react/index.js'
Right now the metafile contains this: "index.js": { "bytes": 78, "imports": [ { "path": "node_modules/react/index.js", "kind": "import-statement" }, { "path": "node_modules/react/index.js", "kind": "import-statement" } ] }
Are you asking for something like this? "index.js": { "bytes": 78, "imports": [ { "path": "node_modules/react/index.js", "kind": "import-statement", "request": "react" }, { "path": "node_modules/react/index.js", "kind": "import-statement", "request": "./node_modules/react/index.js" } ] }
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
This has recently been implemented in version 0.16.13. I called it original instead of request but it's otherwise the same.