cspotcode / cspotcode/node-source-map-support

Expose module redirection helper for use in ESM hooks

未關閉
#31 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
JavaScript
星號
16
分支
4
PR 合併指標
30 天內沒有已合併 PR

描述

Enhancement to redirection feature added in #23 and #30
We can install a redirector for `require()` by patching `Module._resolveFilename` but we can't do that for ESM loader hooks. If a loader hook wants to redirect, it needs to call out to us directly.

Consumers like ts-node who implement their own loader hooks may want to do the same redirection. We can expose a function they can use to do this redirection. Perhaps it can even support our redirection callback? Perhaps not since ESM loaders will eventually run in a separate thread.

Should it be implemented as a loader itself? To support chaining? Probably not since it would be more complex, and most likely the only consumer of this feature is going to be ts-node.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。