@kubohiroya/sb3-toolchain 0.6.0 → 0.7.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
@@ -31,7 +31,7 @@ Scratch 3およびTurboWarpの`.sb3`プロジェクトを、Gitで差分を確
31
31
  再現可能なインストールのため、検証済みのnpmバージョンを固定します。
32
32
 
33
33
  ```bash
34
- pnpm add --save-dev --save-exact @kubohiroya/sb3-toolchain@0.6.0
34
+ pnpm add --save-dev --save-exact @kubohiroya/sb3-toolchain@0.7.0
35
35
  ```
36
36
 
37
37
  ## クイックスタート
package/README.md CHANGED
@@ -32,7 +32,7 @@ expanded sources and rebuilding bit-for-bit identical SB3 files from the same in
32
32
  Pin the verified npm version for reproducible installation.
33
33
 
34
34
  ```bash
35
- pnpm add --save-dev --save-exact @kubohiroya/sb3-toolchain@0.6.0
35
+ pnpm add --save-dev --save-exact @kubohiroya/sb3-toolchain@0.7.0
36
36
  ```
37
37
 
38
38
  ## Quick start
@@ -262,6 +262,13 @@ metadata:
262
262
  }
263
263
  ```
264
264
 
265
+ For every ordinary block that does not already define its own `blockIconURI`, the bundle copies the
266
+ member's top-level `getInfo().blockIconURI` onto the transformed block. TurboWarp supports
267
+ `blockIconURI` at block level, so blocks keep their originating extension's icon even though the
268
+ bundle is registered as one extension. A block-specific icon always wins, and members without an
269
+ icon keep the previous icon-free output. Generated headings, documentation buttons, member LABELs,
270
+ and member BUTTONs are not given an inherited icon.
271
+
265
272
  When a member's `getInfo()` returns a non-empty string [`docsURI`](https://docs.turbowarp.org/development/extensions/assorted-apis#docsuri),
266
273
  the bundle inserts an `Open Documentation` button immediately after that member's heading. It uses TurboWarp's native
267
274
  `OPEN_EXTENSION_DOCS` callback, so it preserves the normal `docsURI` behavior instead of delegating
@@ -254,6 +254,13 @@ TurboWarp Editorのパレットでは、各グループが次の形式の装飾
254
254
  }
255
255
  ```
256
256
 
257
+ 各通常ブロックが独自の`blockIconURI`を持たない場合、bundleはメンバーのトップレベル
258
+ `getInfo().blockIconURI`を変換後のブロックへコピーします。TurboWarpはブロック単位の
259
+ `blockIconURI`に対応しているため、1つの機能拡張として登録されたbundleでも、各ブロックは由来元の
260
+ 機能拡張アイコンを保持します。ブロック固有アイコンが常に優先され、アイコンを持たないメンバーの出力は
261
+ 従来どおりです。生成見出し、ドキュメントボタン、メンバーのLABEL、メンバーのBUTTONには継承アイコンを
262
+ 設定しません。
263
+
257
264
  メンバーの`getInfo()`が空でない文字列[`docsURI`](https://docs.turbowarp.org/development/extensions/assorted-apis#docsuri)を返す場合、
258
265
  bundleはそのメンバー見出しの直後に`Open Documentation`ボタンを挿入します。機能拡張コードへの委譲ではなく、TurboWarp標準の
259
266
  `OPEN_EXTENSION_DOCS` callbackを使用するため、通常の`docsURI`と同じ動作を保持します。生成ボタンには別の
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubohiroya/sb3-toolchain",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Git-friendly source management and deterministic builds for Scratch 3 and TurboWarp SB3 projects",
5
5
  "type": "module",
6
6
  "license": "MPL-2.0",
package/src/constants.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // SPDX-License-Identifier: MPL-2.0
2
2
 
3
3
  export const packageName = '@kubohiroya/sb3-toolchain';
4
- export const packageVersion = '0.6.0';
4
+ export const packageVersion = '0.7.0';
@@ -359,6 +359,10 @@ ${loaders}
359
359
  throw new Error('Static bundle member ' + componentId + ' must have a non-empty name.');
360
360
  }
361
361
  const namespace = componentId + '__';
362
+ const memberBlockIconURI =
363
+ typeof info.blockIconURI === 'string' && info.blockIconURI.length > 0
364
+ ? info.blockIconURI
365
+ : null;
362
366
  const customFieldTypes = info.customFieldTypes || {};
363
367
  for (const [fieldName, fieldInfo] of Object.entries(customFieldTypes)) {
364
368
  result.customFieldTypes[namespace + fieldName] = fieldInfo;
@@ -391,6 +395,14 @@ ${loaders}
391
395
  throw new Error('XML blocks are unsupported in static bundle member ' + componentId + '.');
392
396
  }
393
397
  const transformed = {...block};
398
+ if (
399
+ memberBlockIconURI !== null &&
400
+ !Object.prototype.hasOwnProperty.call(block, 'blockIconURI') &&
401
+ block.blockType !== Scratch.BlockType.LABEL &&
402
+ block.blockType !== Scratch.BlockType.BUTTON
403
+ ) {
404
+ transformed.blockIconURI = memberBlockIconURI;
405
+ }
394
406
  if (block.arguments) {
395
407
  transformed.arguments = Object.fromEntries(
396
408
  Object.entries(block.arguments).map(([argumentName, argument]) => {