cspotcode / cspotcode/node-source-map-support

Expose module redirection helper for use in ESM hooks

オープン
#31 コメント 0 件 リアクション 0 件 担当者 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 を短くまとめたダイジェスト。