@kubohiroya/turbowarp-asset-cache 0.3.1 → 0.3.2

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 ADDED
@@ -0,0 +1,152 @@
1
+ # TurboWarp-Asset-Cache
2
+
3
+ [English](README.md)
4
+
5
+ TurboWarpのプロジェクト向けに、画像・音声・実行時テキストをブラウザ内へ保持するasset cacheです。
6
+ composition hostには、OPFSを明示的に選べるhybridなbinary backingを提供します。外部ファイル、
7
+ プロジェクト内のコスチューム/背景/音、Temporary Variablesのテキスト参照を登録し、TurboWarpのblockや
8
+ composition hostから利用できるようにします。
9
+
10
+ Asset Cacheは従来の`isLoaded`とcacheのlifecycle semanticsを意図的に維持しています。汎用のサーバー
11
+ object storeではなく、format 2 manifestではすべてのblockを`server.supported: false`としています。
12
+ 移植可能なnamespace/keyの永続化とサーバー側への移送には
13
+ [`@kubohiroya/turbowarp-kvs`](https://github.com/kubohiroya/turbowarp-kvs)を使ってください。
14
+
15
+ `@kubohiroya/turbowarp-asset-manager`は非推奨です。composition利用側は、asset登録・描画・再生・
16
+ DOM image resource・検証済みremote cache APIについて、importパスを
17
+ `@kubohiroya/turbowarp-asset-cache/composition`へ置き換えられます。binary object、bundle、
18
+ session backingのAPIは`@kubohiroya/turbowarp-kvs`から直接importしてください。standaloneの
19
+ プロジェクトでは、拡張機能IDも`kubohiroyaassetmanager`から`kubohiroyaassetcache`へ置き換える必要が
20
+ あります。公開済みのSB3成果物は、元の拡張機能に固定したままにしてください。
21
+
22
+ ## ユーザーガイド
23
+
24
+ 導入手順、安全上の注意、レシピ、図入りのblock解説は
25
+ [English user guide](https://kubohiroya.github.io/turbowarp-asset-cache/)または
26
+ [日本語ユーザーガイド](https://kubohiroya.github.io/turbowarp-asset-cache/ja/)を参照してください。
27
+
28
+ ## できること
29
+
30
+ - 画像、音声、プロジェクトasset、実行時テキストを論理的なasset名で登録します。
31
+ - 登録済みの画像やテキストを、スプライト、クローン、ステージへ適用します。
32
+ - 登録済みの音声を再生し、actorのアニメーション列にも対応します。
33
+ - host拡張機能向けに、blockを使わないComposition APIを提供します。
34
+ - SVGとremote binaryの入力を、利用前およびcacheへの書き込み前に検証します。
35
+ - アプリケーションshell向けに、story単位のIndexedDB cache制御を利用できる状態に保ちます。
36
+ - 既定はIndexedDBのまま、composition hostが検証済みbinary objectのbyte列にOPFSを選べるようにします。
37
+
38
+ ## 統合方法を選ぶ
39
+
40
+ TurboWarpのプロジェクトが`dist/asset-cache.js`を直接読み込み、パレットにAsset Cacheのblockを並べる場合は
41
+ Standalone拡張機能を使います。
42
+
43
+ 別のunsandboxed拡張機能やアプリケーションshellが`@kubohiroya/turbowarp-asset-cache/composition`を
44
+ importし、registryを内部に閉じたまま、パレットへAsset Cacheのblockを追加したくない場合はComposition APIを
45
+ 使います。
46
+
47
+ ## 動作条件と安全性
48
+
49
+ standaloneでの利用には、TurboWarp Desktop、またはunsandboxedなカスタム拡張機能を読み込める他の
50
+ TurboWarp環境が必要です。実行時テキストの描画には、さらにTemporary Variables(`lmsTempVars2`)と
51
+ Animated Text(`text`)が必要です。
52
+
53
+ SVG入力は既定で拒否します。remote binaryのcache entryは、保存前にサイズ・content-type・SHA-256を
54
+ 検証します。IndexedDBは機密の境界ではなく補助的なcacheとして扱います。
55
+
56
+ メンテナはNode.js 22以降と、Corepack経由のpnpmを使います。インストール例とCDN URLのsource of truthは
57
+ `package.json`のversionです。
58
+
59
+ ## セキュリティダイアログの説明言語
60
+
61
+ この版のビルドでは、既定の英語説明に加えて`Description[ja]`コメントへ日本語の説明を出力します。このメタデータに対応した共通セキュリティダイアログは、Editorが日本語なら日本語の説明を表示し、対応する翻訳がなければ元の説明を表示します。
62
+
63
+ 説明の翻訳は必要な実行モードを変えません。この拡張は引き続き`Unsandboxed: required`です。
64
+
65
+ ## インストール
66
+
67
+ [`dist/asset-cache.js`](dist/asset-cache.js)をダウンロードし、TurboWarp Desktopでローカルの
68
+ カスタム拡張機能として読み込みます。確認されたら**サンドボックス化せずに実行**を有効にします。
69
+
70
+ ビルド済みのJavaScriptファイルをこのリポジトリにcommitしてあるため、Node.jsのインストールやビルドの実行は
71
+ 必要ありません。
72
+
73
+ versionを付けたnpm packageにも、同じレビュー済みビルドが入っています。
74
+
75
+ ```bash
76
+ pnpm add --save-exact @kubohiroya/turbowarp-asset-cache@0.3.2
77
+ ```
78
+
79
+ `node_modules/@kubohiroya/turbowarp-asset-cache/dist/asset-cache.js`を読み込むか、version固定の
80
+ CDN URLを使います。
81
+
82
+ ```text
83
+ https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-asset-cache@0.3.2/dist/asset-cache.js
84
+ ```
85
+
86
+ ## クイックスタート
87
+
88
+ 1. `dist/asset-cache.js`をunsandboxedなTurboWarp拡張機能として読み込みます。
89
+ 2. `register resource [RESOURCE_ID] as asset [NAME]`でリソースを登録します。
90
+ 3. `show asset [NAME] on this sprite`、`set stage backdrop to asset [NAME]`、または音声blockでassetを使います。
91
+ 4. プロジェクトのlifecycleや保存方針として明示的な後片付けが必要な場合は、cacheと削除のblockを使います。
92
+
93
+ ## Compositionの例
94
+
95
+ ```js
96
+ import {createAssetManagerComposition} from '@kubohiroya/turbowarp-asset-cache/composition';
97
+
98
+ const assets = createAssetManagerComposition();
99
+ await assets.registerEmbeddedAsset({
100
+ name: 'Opening',
101
+ sourceName: 'opening.svg',
102
+ mimeType: 'image/svg+xml',
103
+ bytes: new TextEncoder().encode('<svg xmlns="http://www.w3.org/2000/svg"/>')
104
+ });
105
+ await assets.applyToStage('Opening');
106
+ assets.releaseAll();
107
+ ```
108
+
109
+ ## 統合の全体像
110
+
111
+ - standaloneのプロジェクトは、リソース識別子、実行時テキスト、診断、actorアニメーション、読み込み互換性、
112
+ 拡張機能IDの移行について[Runtime and Standalone Contracts](docs/runtime-contracts.md)を参照してください。
113
+ - composition hostは、埋め込みasset、構造化locator、音声voice、DOM image resource、SVG検証、
114
+ story単位のcache、検証済みremote binary、binary bundle、session限定のbinary backingについて
115
+ [Composition API](docs/composition-api.md)を参照してください。
116
+ - blockの利用者とドキュメントのメンテナは、生成されたblock表について
117
+ [Block Reference](docs/block-reference.md)を参照してください。
118
+
119
+ ## 開発
120
+
121
+ ```bash
122
+ corepack enable
123
+ pnpm install --frozen-lockfile
124
+ pnpm run check
125
+ ```
126
+
127
+ block APIの正式なsourceは`src/block-definitions.json`です。変更したらblockのドキュメントを再生成します。
128
+
129
+ ```bash
130
+ pnpm run docs
131
+ ```
132
+
133
+ ビルドは`dist/asset-cache.js`、`dist/extension-manifest.json`、`dist/composition.js`、
134
+ `dist/types/composition.d.ts`を生成します。決定的なformat 2 manifestはすべてのblock signatureを記録し、
135
+ Asset Cacheのパレット全体をブラウザ専用として明示します。拡張機能、block metadata、Compositionのsourceを
136
+ 変更したら、再ビルドした成果物をcommitしてください。
137
+
138
+ ## リリース
139
+
140
+ 公開前にローカルでリリース検査を実行します。
141
+
142
+ ```bash
143
+ pnpm run pack:check
144
+ pnpm run release:check
145
+ ```
146
+
147
+ npm packageのアーカイブには、README、LICENSE、Standalone bundle、拡張機能API manifest、
148
+ Composition bundle、Compositionの型宣言を含める必要があります。
149
+
150
+ ## ライセンス
151
+
152
+ SPDX-License-Identifier: MPL-2.0
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # TurboWarp-Asset-Cache
2
2
 
3
+ [日本語](README.ja.md)
4
+
3
5
  A browser-local image, audio, and runtime-text asset cache for TurboWarp projects, with an explicit OPFS hybrid binary backing for composition hosts. It registers external files, project-local costumes/backdrops/sounds, and Temporary Variables text references for use from TurboWarp blocks or composition hosts.
4
6
 
5
7
  Asset Cache intentionally keeps the legacy `isLoaded` and cache lifecycle semantics. It is not a general server object store: every block is marked `server.supported: false` in the format 2 manifest. Use [`@kubohiroya/turbowarp-kvs`](https://github.com/kubohiroya/turbowarp-kvs) for portable namespace/key persistence and server lowering.
@@ -39,6 +41,12 @@ SVG input is reject-by-default, remote binary cache entries are size/content-typ
39
41
 
40
42
  Maintainers use Node.js 22 or later with pnpm through Corepack. The package version in `package.json` is the source of truth for install examples and CDN URLs.
41
43
 
44
+ ## Security dialog description language
45
+
46
+ Builds include a Japanese `Description[ja]` header alongside the default English
47
+ description. A supporting shared security dialog follows the Editor locale and falls back to
48
+ the original description when no translation is available. Translation does not change the `Unsandboxed: required` requirement.
49
+
42
50
  ## Installation
43
51
 
44
52
  Download [`dist/asset-cache.js`](dist/asset-cache.js), then open TurboWarp Desktop and load it as a local custom extension. Enable **Run extension without sandbox** when prompted.
@@ -48,13 +56,13 @@ The built JavaScript file is committed to this repository so users do not need t
48
56
  The versioned npm package contains the same reviewed build:
49
57
 
50
58
  ```bash
51
- pnpm add --save-exact @kubohiroya/turbowarp-asset-cache@0.3.1
59
+ pnpm add --save-exact @kubohiroya/turbowarp-asset-cache@0.3.2
52
60
  ```
53
61
 
54
62
  Load `node_modules/@kubohiroya/turbowarp-asset-cache/dist/asset-cache.js`, or use the version-pinned CDN URL:
55
63
 
56
64
  ```text
57
- https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-asset-cache@0.3.1/dist/asset-cache.js
65
+ https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-asset-cache@0.3.2/dist/asset-cache.js
58
66
  ```
59
67
 
60
68
  ## Quick Start
@@ -4,6 +4,7 @@
4
4
  // By: Hiroya Kubo
5
5
  // License: MPL-2.0
6
6
  // Unsandboxed: required
7
+ // Description[ja]: TurboWarpで画像・音声・実行時テキストの素材を登録・保持し、表示・再生します。
7
8
 
8
9
  (function (Scratch) {
9
10
  'use strict';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubohiroya/turbowarp-asset-cache",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "A browser-local image, audio, and runtime-text asset cache for TurboWarp projects.",
5
5
  "author": "Hiroya Kubo <hiroya@cuc.ac.jp>",
6
6
  "type": "module",
@@ -25,6 +25,7 @@
25
25
  "schemas/",
26
26
  "docs/fixed-input-editors.ja.md",
27
27
  "README.md",
28
+ "README.ja.md",
28
29
  "LICENSE",
29
30
  "docs/audio-playback.md"
30
31
  ],
@@ -66,7 +67,7 @@
66
67
  "@kubohiroya/turbowarp-extension-data-editor": "0.2.1",
67
68
  "@kubohiroya/turbowarp-extension-manifest": "0.3.2",
68
69
  "@kubohiroya/turbowarp-named-data": "0.3.1",
69
- "@kubohiroya/vite-plugin-turbowarp-extension": "0.6.1",
70
+ "@kubohiroya/vite-plugin-turbowarp-extension": "0.7.0",
70
71
  "@types/node": "^22.20.1",
71
72
  "@xmldom/xmldom": "0.9.11",
72
73
  "eslint": "^9.39.5",