@kubohiroya/turbowarp-plus-editor-test-runtime 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.ja.md CHANGED
@@ -43,9 +43,14 @@ await page.goto(server.url);
43
43
  await page.evaluate(project => setup(project), project);
44
44
  ```
45
45
 
46
- `EditorRuntime.start(container, {locale, project})` は、`EditorHost` に次の 2 つを加えたもので解決します。
46
+ `EditorRuntime.start(container, {locale, project})` は、`EditorHost` に次を加えたもので解決します。
47
47
  - `workspace`:VM の編集対象を表示するワークスペース。
48
48
  - `loadProject(project)`
49
+ - `registerExtension(extension)`:拡張機能のオブジェクトを、VM が組み込みの拡張機能を登録するのと同じように登録します(sandbox・Loader・確認なし)。そのブロック・メニュー・独自のフィールドを、GUI が拡張機能の追加や変更のときに行うのと同じように、ワークスペースに定義します。動的なブロックは扱いません。その定義には GUI 自身のブロックの工場が要るためです。
50
+
51
+ ページには次もあります。
52
+ - `EditorRuntime.vmModules`:VM 自身の `ScratchCommon`・`createTranslate`・`staticFetch`・central `dispatch`。Loader の registrar が必要とするものです。`dispatch` はシングルトンで、これらは runtime の VM が使うインスタンスそのものです。
53
+ - `EditorRuntime.VirtualMachine`:VM の構築子。プレビューのような 2 つ目の VM が要る試験のためです。
49
54
 
50
55
  ページ用の型は `@kubohiroya/turbowarp-plus-editor-test-runtime/page` にあります。
51
56
 
package/README.md CHANGED
@@ -46,6 +46,11 @@ await page.evaluate(project => setup(project), project);
46
46
  `EditorRuntime.start(container, {locale, project})` resolves with an `EditorHost` plus:
47
47
  - `workspace`: the workspace that shows the VM's editing target.
48
48
  - `loadProject(project)`
49
+ - `registerExtension(extension)`: registers an extension object as the VM registers its built-in ones (no sandbox, Loader or review). Its blocks, menus and custom fields are defined in the workspace, as the GUI does when an extension is added or changes. Dynamic blocks are not supported: defining them needs the GUI's own block factory.
50
+
51
+ The page also has:
52
+ - `EditorRuntime.vmModules`: the VM's own `ScratchCommon`, `createTranslate`, `staticFetch` and central `dispatch`, as the Loader's registrar needs them. `dispatch` is a singleton, and these are the instances the runtime's VM uses.
53
+ - `EditorRuntime.VirtualMachine`: the VM constructor, for a test that needs a second VM, such as a preview.
49
54
 
50
55
  The types for the page are in `@kubohiroya/turbowarp-plus-editor-test-runtime/page`.
51
56