nodejs / nodejs/node

Provide built-in implementations of module linker, initializeImportMeta, importModuleDynamically

オープン
#31,234 コメント 12 件 リアクション 9 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

vm
主要言語
JavaScript
スター
122k
フォーク
37.3k
平均マージ
4日 2時間
マージ済み PR(30日)
283

説明

Is your feature request related to a problem? Please describe.

When using vm.SourceTextModule we have to implement a linker, initializeImportMeta, and importModuleDynamically, even if we just want the default behavior of built-in module support. There are many subtle ways to get that wrong.

Describe the solution you'd like

Default implementations that do basically what built-in module support does:

  • A linker function that:
    • Reads files from disk, within a specified root.
    • Uses Node module resolution as implemented for modules
    • Uses a specified module cache
    • initializeImportMeta that sets url property
    • By configuration, allows access to built-in modules.

Describe alternatives you've considered

Userland libraries can take the first cuts at easy-to-use vm.Modules, but I think something for common use cases should likely be included.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

vm.SourceTextModule のエントリポイントと、issue で参照されている Node のモジュール解決動作から始めます。linker、initializeImportMeta、importModuleDynamically に要求されているデフォルトを、root、モジュールキャッシュ、組み込みモジュールの設定を含めて確認します。一般的な vm.Modules がカスタムコールバックなしで組み込み実装を使用できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, node.js
領域
backend
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。