NativeScript / NativeScript/ios

Support ES modules

オープン
#87 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

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

enhancement
主要言語
JavaScript
スター
150
フォーク
43
平均マージ
3日 10時間
マージ済み PR(30日)
22

説明

The runtime currently handles commonjs modules - and if an import statement is encountered the application will crash.

The implementation is currently in ModuleInternal.mm

It would be awesome if es modules were supported, since v8 already supports them - we are just missing the implementation for loading them (same-ish logic as for commonjs)

A reduced example for supporting es modules: https://stackoverflow.com/a/52031275/2270725

The gist of it is - we have to call ScriptCompiler::CompileModule on the source

Local<Module> module;
if (!ScriptCompiler::CompileModule(isolate, &source).ToLocal(&module)) {
  // if you have a v8::TryCatch, you should check it here.
  return;
}

Unresolved questions:

  • Can the runtime support both types and interop between them?

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

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

はじめの一歩

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

調査の方向性

ModuleInternal.mm から始め、既存の commonjs の読み込み経路を追跡し、提供されている ScriptCompiler::CompileModule の例と比較してください。V8 モジュールの読み込みと commonjs の相互運用がどのように機能すべきかを調査してください。import 文でクラッシュが発生しなくなり、ランタイムが両方のモジュール型の意図された相互作用をサポートすれば完了です。

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

評価

技術スタック
ios, javascript
領域
mobile-dev
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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