Add async alternative to import.meta.resolve() with additional options
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.4k
- 平均マージ
- 4日 2時間
- マージ済み PR(30日)
- 283
説明
What is the problem this feature will solve?
Tools often need to resolve imports of files they are analyzing, which requires a resolve API that import.meta.resolve() isn't suited for.
- The
resolve()call needs a referrer path, which is only available with a flag and is non standard - The tool might want to specify import conditions, which are non-standard
- The call should be async, so that file system access isn't blocking. This is especially important for online resolution in servers.
Node might be able to add non-standard options via a second argument, though I'm a bit dubious of this approach because it might preclude import.meta.resolve() from adding a standard second argument.
So currently, we have complex user land resolvers that try to emulate what Node does, like Rollup's.
What is the feature you are proposing to solve the problem?
I think node:module should provide a function to perform built-in resolution, given a referrer path and import conditions.
This API would be free from having to conform to the import.meta.resolve() standard. import.meta.resolve() would still exist for cross-platform needs of resolving from within the referrer only.
What alternatives have you considered?
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、Node の既存の import.meta.resolve() の動作と、issue で説明されている node:module API の範囲を確認します。リファラーのパスと import conditions を受け取る非同期の組み込み resolver を定義し、標準的なクロスプラットフォームでの使用のために import.meta.resolve() を維持します。提案する API とその互換性への影響が確定すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, node.js
- 領域
- api, backend
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100