cspotcode / cspotcode/node-source-map-support

Expose module redirection helper for use in ESM hooks

Đang mở
#31 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
16
Fork
4
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.