@kubohiroya/turbowarp-asset-cache 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 +7 -2
- package/README.md +2 -2
- package/dist/asset-cache.js +37 -11
- package/dist/composition.js +57 -16
- package/dist/types/composition.d.ts +16 -0
- package/dist/types/extension.d.ts +7 -1
- package/package.json +5 -5
package/README.ja.md
CHANGED
|
@@ -54,6 +54,11 @@ Standalone拡張機能を使います。
|
|
|
54
54
|
importし、registryを内部に閉じたまま、パレットへAsset Cacheのblockを追加したくない場合はComposition APIを
|
|
55
55
|
使います。
|
|
56
56
|
|
|
57
|
+
独立したプレビューVMでは、`createAssetManagerComposition.supportsRuntimeIsolation === true`を確認し、
|
|
58
|
+
`createAssetManagerComposition(undefined, {runtime: previewVm.runtime})`で描画とイベント購読の所有先を指定します。
|
|
59
|
+
省略時は従来どおり拡張機能のホストruntimeを使います。終了時の`releaseAll()`は、そのcompositionが所有する
|
|
60
|
+
`STOP_FOR_TARGET`購読も解除します。同じcompositionへ再登録すると必要な購読を再開します。
|
|
61
|
+
|
|
57
62
|
## 動作条件と安全性
|
|
58
63
|
|
|
59
64
|
standaloneでの利用には、TurboWarp Desktop、またはunsandboxedなカスタム拡張機能を読み込める他の
|
|
@@ -83,14 +88,14 @@ SVG入力は既定で拒否します。remote binaryのcache entryは、保存
|
|
|
83
88
|
versionを付けたnpm packageにも、同じレビュー済みビルドが入っています。
|
|
84
89
|
|
|
85
90
|
```bash
|
|
86
|
-
pnpm add --save-exact @kubohiroya/turbowarp-asset-cache@0.
|
|
91
|
+
pnpm add --save-exact @kubohiroya/turbowarp-asset-cache@0.7.0
|
|
87
92
|
```
|
|
88
93
|
|
|
89
94
|
`node_modules/@kubohiroya/turbowarp-asset-cache/dist/asset-cache.js`を読み込むか、version固定の
|
|
90
95
|
CDN URLを使います。
|
|
91
96
|
|
|
92
97
|
```text
|
|
93
|
-
https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-asset-cache@0.
|
|
98
|
+
https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-asset-cache@0.7.0/dist/asset-cache.js
|
|
94
99
|
```
|
|
95
100
|
|
|
96
101
|
## クイックスタート
|
package/README.md
CHANGED
|
@@ -66,13 +66,13 @@ The built JavaScript file is committed to this repository so users do not need t
|
|
|
66
66
|
The versioned npm package contains the same reviewed build:
|
|
67
67
|
|
|
68
68
|
```bash
|
|
69
|
-
pnpm add --save-exact @kubohiroya/turbowarp-asset-cache@0.
|
|
69
|
+
pnpm add --save-exact @kubohiroya/turbowarp-asset-cache@0.7.0
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
Load `node_modules/@kubohiroya/turbowarp-asset-cache/dist/asset-cache.js`, or use the version-pinned CDN URL:
|
|
73
73
|
|
|
74
74
|
```text
|
|
75
|
-
https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-asset-cache@0.
|
|
75
|
+
https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-asset-cache@0.7.0/dist/asset-cache.js
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
## Quick Start
|
package/dist/asset-cache.js
CHANGED
|
@@ -721,7 +721,7 @@ var block_definitions_default = {
|
|
|
721
721
|
]
|
|
722
722
|
};
|
|
723
723
|
//#endregion
|
|
724
|
-
//#region node_modules/.pnpm/@kubohiroya+turbowarp-extension-data-editor@0.
|
|
724
|
+
//#region node_modules/.pnpm/@kubohiroya+turbowarp-extension-data-editor@0.8.1_react@18.3.1/node_modules/@kubohiroya/turbowarp-extension-data-editor/dist/fixed-input-schema.js
|
|
725
725
|
var numberToken = /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$/u;
|
|
726
726
|
var invalidNumber = Object.freeze({
|
|
727
727
|
kind: "invalid",
|
|
@@ -1118,7 +1118,7 @@ function fixedInputRegistration(scratch) {
|
|
|
1118
1118
|
};
|
|
1119
1119
|
}
|
|
1120
1120
|
//#endregion
|
|
1121
|
-
//#region node_modules/.pnpm/@kubohiroya+turbowarp-named-data@0.
|
|
1121
|
+
//#region node_modules/.pnpm/@kubohiroya+turbowarp-named-data@0.8.0-rc.1/node_modules/@kubohiroya/turbowarp-named-data/dist/composition.js
|
|
1122
1122
|
var NAMED_DATA_REGISTRY_SYMBOL_KEY = "@kubohiroya/turbowarp-named-data/registry";
|
|
1123
1123
|
var NAMED_DATA_REGISTRY_SYMBOL = Symbol.for(NAMED_DATA_REGISTRY_SYMBOL_KEY);
|
|
1124
1124
|
var NAMED_DATA_NAMESPACE_PATTERN = /^[a-z][a-z0-9.-]{0,63}$/u;
|
|
@@ -1158,6 +1158,18 @@ var NAMED_DATA_ERROR_CODES = [
|
|
|
1158
1158
|
"NAMED_DATA_ABORTED",
|
|
1159
1159
|
"NAMED_DATA_PROVIDER_RELEASED"
|
|
1160
1160
|
];
|
|
1161
|
+
/** Native byte forms retained by each provider kind; this does not enable conversion. */
|
|
1162
|
+
var NAMED_DATA_NATIVE_REPRESENTATIONS = Object.freeze({
|
|
1163
|
+
structured: Object.freeze(["json", "yaml"]),
|
|
1164
|
+
document: Object.freeze([
|
|
1165
|
+
"html",
|
|
1166
|
+
"markdown",
|
|
1167
|
+
"yaml",
|
|
1168
|
+
"json"
|
|
1169
|
+
]),
|
|
1170
|
+
binary: Object.freeze(["raw"]),
|
|
1171
|
+
asset: Object.freeze(["raw"])
|
|
1172
|
+
});
|
|
1161
1173
|
var NamedDataError = class extends Error {
|
|
1162
1174
|
constructor(code, message, options) {
|
|
1163
1175
|
super(`${code}: ${message}`, options);
|
|
@@ -1430,9 +1442,7 @@ function sameSchemaRef(left, right) {
|
|
|
1430
1442
|
return left === void 0 ? right === void 0 : right !== void 0 && left.id === right.id && left.version === right.version;
|
|
1431
1443
|
}
|
|
1432
1444
|
function isNativeRepresentation(kind, representation) {
|
|
1433
|
-
|
|
1434
|
-
if (kind === "document") return representation === "html" || representation === "markdown";
|
|
1435
|
-
return representation === "raw";
|
|
1445
|
+
return NAMED_DATA_NATIVE_REPRESENTATIONS[kind].includes(representation);
|
|
1436
1446
|
}
|
|
1437
1447
|
function requireNamespace(namespace) {
|
|
1438
1448
|
if (!isNamedDataNamespace(namespace)) throw invalidReference$1("Invalid namespace.");
|
|
@@ -2341,9 +2351,9 @@ function validateProjectAssetAddress(runtime, assetName, resourceIdentifier) {
|
|
|
2341
2351
|
}
|
|
2342
2352
|
}
|
|
2343
2353
|
var AssetManagerExtension = class {
|
|
2344
|
-
constructor(featureFlags = FEATURE_FLAGS) {
|
|
2345
|
-
_defineProperty(this, "runtime",
|
|
2346
|
-
_defineProperty(this, "renderer",
|
|
2354
|
+
constructor(featureFlags = FEATURE_FLAGS, runtime = Scratch.vm.runtime) {
|
|
2355
|
+
_defineProperty(this, "runtime", void 0);
|
|
2356
|
+
_defineProperty(this, "renderer", void 0);
|
|
2347
2357
|
_defineProperty(this, "externalAssets", /* @__PURE__ */ new Map());
|
|
2348
2358
|
_defineProperty(this, "costumeAssets", /* @__PURE__ */ new Map());
|
|
2349
2359
|
_defineProperty(this, "soundAssets", /* @__PURE__ */ new Map());
|
|
@@ -2393,6 +2403,12 @@ var AssetManagerExtension = class {
|
|
|
2393
2403
|
this.unbindNamedDataRegistryLifecycle = void 0;
|
|
2394
2404
|
});
|
|
2395
2405
|
_defineProperty(this, "fixedEditors", fixedInputRegistration(Scratch));
|
|
2406
|
+
_defineProperty(this, "listeningForTargetStops", false);
|
|
2407
|
+
_defineProperty(this, "releaseStoppedTarget", (target) => {
|
|
2408
|
+
if (target && !this.runtime.targets.includes(target)) this.displayedAssets.delete(target.id);
|
|
2409
|
+
});
|
|
2410
|
+
this.runtime = runtime;
|
|
2411
|
+
this.renderer = runtime.renderer;
|
|
2396
2412
|
this.featureFlags = Object.freeze({ ...featureFlags });
|
|
2397
2413
|
if (this.featureFlags.NAMED_ASSET_BODY_PROVIDER) {
|
|
2398
2414
|
this.namedBodyProviderValue = this.createNamedBodyProvider();
|
|
@@ -2401,9 +2417,19 @@ var AssetManagerExtension = class {
|
|
|
2401
2417
|
this.unbindNamedDataRegistryLifecycle = bindNamedDataRegistryLifecycle(this.runtime, registry);
|
|
2402
2418
|
this.startListeningForNamedBodyLifecycle();
|
|
2403
2419
|
}
|
|
2404
|
-
this.
|
|
2405
|
-
|
|
2406
|
-
|
|
2420
|
+
this.ensureRuntimeListeners();
|
|
2421
|
+
}
|
|
2422
|
+
/** A reusable composition reattaches its own listener when registering new assets. */
|
|
2423
|
+
ensureRuntimeListeners() {
|
|
2424
|
+
if (this.listeningForTargetStops || !this.runtime.on) return;
|
|
2425
|
+
this.runtime.on("STOP_FOR_TARGET", this.releaseStoppedTarget);
|
|
2426
|
+
this.listeningForTargetStops = true;
|
|
2427
|
+
}
|
|
2428
|
+
/** Release only this instance's subscription, leaving other runtime owners untouched. */
|
|
2429
|
+
releaseRuntimeListeners() {
|
|
2430
|
+
if (!this.listeningForTargetStops || !this.runtime.off) return;
|
|
2431
|
+
this.runtime.off("STOP_FOR_TARGET", this.releaseStoppedTarget);
|
|
2432
|
+
this.listeningForTargetStops = false;
|
|
2407
2433
|
}
|
|
2408
2434
|
setLoadingBackdrop(args) {
|
|
2409
2435
|
this.loadingBackdropName = normalizeName(args.NAME);
|
package/dist/composition.js
CHANGED
|
@@ -710,7 +710,7 @@ var block_definitions_default = {
|
|
|
710
710
|
]
|
|
711
711
|
};
|
|
712
712
|
//#endregion
|
|
713
|
-
//#region node_modules/.pnpm/@kubohiroya+turbowarp-extension-data-editor@0.
|
|
713
|
+
//#region node_modules/.pnpm/@kubohiroya+turbowarp-extension-data-editor@0.8.1_react@18.3.1/node_modules/@kubohiroya/turbowarp-extension-data-editor/dist/fixed-input-schema.js
|
|
714
714
|
var numberToken = /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$/u;
|
|
715
715
|
var invalidNumber = Object.freeze({
|
|
716
716
|
kind: "invalid",
|
|
@@ -1107,7 +1107,7 @@ function fixedInputRegistration(scratch) {
|
|
|
1107
1107
|
};
|
|
1108
1108
|
}
|
|
1109
1109
|
//#endregion
|
|
1110
|
-
//#region node_modules/.pnpm/@kubohiroya+turbowarp-named-data@0.
|
|
1110
|
+
//#region node_modules/.pnpm/@kubohiroya+turbowarp-named-data@0.8.0-rc.1/node_modules/@kubohiroya/turbowarp-named-data/dist/composition.js
|
|
1111
1111
|
var NAMED_DATA_REGISTRY_SYMBOL_KEY = "@kubohiroya/turbowarp-named-data/registry";
|
|
1112
1112
|
var NAMED_DATA_REGISTRY_SYMBOL = Symbol.for(NAMED_DATA_REGISTRY_SYMBOL_KEY);
|
|
1113
1113
|
var NAMED_DATA_NAMESPACE_PATTERN = /^[a-z][a-z0-9.-]{0,63}$/u;
|
|
@@ -1147,6 +1147,18 @@ var NAMED_DATA_ERROR_CODES = [
|
|
|
1147
1147
|
"NAMED_DATA_ABORTED",
|
|
1148
1148
|
"NAMED_DATA_PROVIDER_RELEASED"
|
|
1149
1149
|
];
|
|
1150
|
+
/** Native byte forms retained by each provider kind; this does not enable conversion. */
|
|
1151
|
+
var NAMED_DATA_NATIVE_REPRESENTATIONS = Object.freeze({
|
|
1152
|
+
structured: Object.freeze(["json", "yaml"]),
|
|
1153
|
+
document: Object.freeze([
|
|
1154
|
+
"html",
|
|
1155
|
+
"markdown",
|
|
1156
|
+
"yaml",
|
|
1157
|
+
"json"
|
|
1158
|
+
]),
|
|
1159
|
+
binary: Object.freeze(["raw"]),
|
|
1160
|
+
asset: Object.freeze(["raw"])
|
|
1161
|
+
});
|
|
1150
1162
|
var NamedDataError = class extends Error {
|
|
1151
1163
|
constructor(code, message, options) {
|
|
1152
1164
|
super(`${code}: ${message}`, options);
|
|
@@ -1419,9 +1431,7 @@ function sameSchemaRef(left, right) {
|
|
|
1419
1431
|
return left === void 0 ? right === void 0 : right !== void 0 && left.id === right.id && left.version === right.version;
|
|
1420
1432
|
}
|
|
1421
1433
|
function isNativeRepresentation(kind, representation) {
|
|
1422
|
-
|
|
1423
|
-
if (kind === "document") return representation === "html" || representation === "markdown";
|
|
1424
|
-
return representation === "raw";
|
|
1434
|
+
return NAMED_DATA_NATIVE_REPRESENTATIONS[kind].includes(representation);
|
|
1425
1435
|
}
|
|
1426
1436
|
function requireNamespace(namespace) {
|
|
1427
1437
|
if (!isNamedDataNamespace(namespace)) throw invalidReference$1("Invalid namespace.");
|
|
@@ -2293,8 +2303,8 @@ function validateProjectAssetAddress(runtime, assetName, resourceIdentifier) {
|
|
|
2293
2303
|
}
|
|
2294
2304
|
}
|
|
2295
2305
|
var AssetManagerExtension = class {
|
|
2296
|
-
runtime
|
|
2297
|
-
renderer
|
|
2306
|
+
runtime;
|
|
2307
|
+
renderer;
|
|
2298
2308
|
externalAssets = /* @__PURE__ */ new Map();
|
|
2299
2309
|
costumeAssets = /* @__PURE__ */ new Map();
|
|
2300
2310
|
soundAssets = /* @__PURE__ */ new Map();
|
|
@@ -2344,7 +2354,13 @@ var AssetManagerExtension = class {
|
|
|
2344
2354
|
this.unbindNamedDataRegistryLifecycle = void 0;
|
|
2345
2355
|
};
|
|
2346
2356
|
fixedEditors = fixedInputRegistration(Scratch);
|
|
2347
|
-
|
|
2357
|
+
listeningForTargetStops = false;
|
|
2358
|
+
releaseStoppedTarget = (target) => {
|
|
2359
|
+
if (target && !this.runtime.targets.includes(target)) this.displayedAssets.delete(target.id);
|
|
2360
|
+
};
|
|
2361
|
+
constructor(featureFlags = FEATURE_FLAGS, runtime = Scratch.vm.runtime) {
|
|
2362
|
+
this.runtime = runtime;
|
|
2363
|
+
this.renderer = runtime.renderer;
|
|
2348
2364
|
this.featureFlags = Object.freeze({ ...featureFlags });
|
|
2349
2365
|
if (this.featureFlags.NAMED_ASSET_BODY_PROVIDER) {
|
|
2350
2366
|
this.namedBodyProviderValue = this.createNamedBodyProvider();
|
|
@@ -2353,9 +2369,19 @@ var AssetManagerExtension = class {
|
|
|
2353
2369
|
this.unbindNamedDataRegistryLifecycle = bindNamedDataRegistryLifecycle(this.runtime, registry);
|
|
2354
2370
|
this.startListeningForNamedBodyLifecycle();
|
|
2355
2371
|
}
|
|
2356
|
-
this.
|
|
2357
|
-
|
|
2358
|
-
|
|
2372
|
+
this.ensureRuntimeListeners();
|
|
2373
|
+
}
|
|
2374
|
+
/** A reusable composition reattaches its own listener when registering new assets. */
|
|
2375
|
+
ensureRuntimeListeners() {
|
|
2376
|
+
if (this.listeningForTargetStops || !this.runtime.on) return;
|
|
2377
|
+
this.runtime.on("STOP_FOR_TARGET", this.releaseStoppedTarget);
|
|
2378
|
+
this.listeningForTargetStops = true;
|
|
2379
|
+
}
|
|
2380
|
+
/** Release only this instance's subscription, leaving other runtime owners untouched. */
|
|
2381
|
+
releaseRuntimeListeners() {
|
|
2382
|
+
if (!this.listeningForTargetStops || !this.runtime.off) return;
|
|
2383
|
+
this.runtime.off("STOP_FOR_TARGET", this.releaseStoppedTarget);
|
|
2384
|
+
this.listeningForTargetStops = false;
|
|
2359
2385
|
}
|
|
2360
2386
|
setLoadingBackdrop(args) {
|
|
2361
2387
|
this.loadingBackdropName = normalizeName(args.NAME);
|
|
@@ -8732,7 +8758,10 @@ async function createSessionBinaryBacking(inputValue, optionValue = {}, operatio
|
|
|
8732
8758
|
//#region src/composition.ts
|
|
8733
8759
|
function createAssetManagerComposition(featureFlags, options = {}) {
|
|
8734
8760
|
if (!options || typeof options !== "object" || Array.isArray(options)) throw new TypeError("Asset Cache composition options must be an object.");
|
|
8735
|
-
const
|
|
8761
|
+
const runtimeInput = options.runtime === void 0 ? Scratch.vm.runtime : options.runtime;
|
|
8762
|
+
if (options.runtime !== void 0 && (!runtimeInput || typeof runtimeInput !== "object" || !Array.isArray(runtimeInput.targets) || !runtimeInput.renderer || typeof runtimeInput.renderer !== "object")) throw new TypeError("Asset Cache composition runtime must provide targets and renderer.");
|
|
8763
|
+
const runtime = runtimeInput;
|
|
8764
|
+
const extension = new AssetManagerExtension(featureFlags, runtime);
|
|
8736
8765
|
const ownedNames = /* @__PURE__ */ new Map();
|
|
8737
8766
|
let literalNameSequence = 0;
|
|
8738
8767
|
let verifiedRemoteCache = null;
|
|
@@ -9012,7 +9041,6 @@ function createAssetManagerComposition(featureFlags, options = {}) {
|
|
|
9012
9041
|
previous?.resource.release();
|
|
9013
9042
|
return resource;
|
|
9014
9043
|
}
|
|
9015
|
-
const runtime = Scratch.vm.runtime;
|
|
9016
9044
|
let listeningForDOMImageLifecycle = false;
|
|
9017
9045
|
const releaseStoppedTargetDOMImageResources = (target) => {
|
|
9018
9046
|
if (target && !runtime.targets.includes(target)) releaseDOMImageResourcesForOwner(target.id);
|
|
@@ -9036,6 +9064,7 @@ function createAssetManagerComposition(featureFlags, options = {}) {
|
|
|
9036
9064
|
return Object.freeze({
|
|
9037
9065
|
async registerProjectAsset(input) {
|
|
9038
9066
|
if (!input || typeof input !== "object" || Array.isArray(input)) throw new TypeError("Project asset registration input must be an object.");
|
|
9067
|
+
extension.ensureRuntimeListeners();
|
|
9039
9068
|
const hasLocator = Object.hasOwn(input, "locator");
|
|
9040
9069
|
if (hasLocator === Object.hasOwn(input, "resourceId")) throw new TypeError("Provide exactly one project asset locator or resourceId.");
|
|
9041
9070
|
const claimed = claimName(input.name, input.nameMode ?? (hasLocator ? "literal" : "trimmed"));
|
|
@@ -9045,6 +9074,7 @@ function createAssetManagerComposition(featureFlags, options = {}) {
|
|
|
9045
9074
|
}));
|
|
9046
9075
|
},
|
|
9047
9076
|
async registerEmbeddedAsset(input) {
|
|
9077
|
+
extension.ensureRuntimeListeners();
|
|
9048
9078
|
if (!input || typeof input !== "object" || Array.isArray(input)) throw new TypeError("Embedded asset registration input must be an object.");
|
|
9049
9079
|
const claimed = claimName(input.name, input.nameMode ?? "trimmed");
|
|
9050
9080
|
return trackRegistration(claimed, extension.registerEmbeddedAsset({
|
|
@@ -9057,9 +9087,13 @@ function createAssetManagerComposition(featureFlags, options = {}) {
|
|
|
9057
9087
|
},
|
|
9058
9088
|
releaseAsset,
|
|
9059
9089
|
releaseAll() {
|
|
9060
|
-
releaseAllDOMImageResources();
|
|
9061
|
-
audioGeneration++;
|
|
9062
9090
|
const errors = [];
|
|
9091
|
+
try {
|
|
9092
|
+
releaseAllDOMImageResources();
|
|
9093
|
+
} catch (error) {
|
|
9094
|
+
errors.push(error);
|
|
9095
|
+
}
|
|
9096
|
+
audioGeneration++;
|
|
9063
9097
|
for (const playback of audioPlaybacks) try {
|
|
9064
9098
|
playback.dispose();
|
|
9065
9099
|
} catch (error) {
|
|
@@ -9070,6 +9104,11 @@ function createAssetManagerComposition(featureFlags, options = {}) {
|
|
|
9070
9104
|
} catch (error) {
|
|
9071
9105
|
errors.push(error);
|
|
9072
9106
|
}
|
|
9107
|
+
try {
|
|
9108
|
+
extension.releaseRuntimeListeners();
|
|
9109
|
+
} catch (error) {
|
|
9110
|
+
errors.push(error);
|
|
9111
|
+
}
|
|
9073
9112
|
if (errors.length > 0) throw new AggregateError(errors, "Failed to release assets");
|
|
9074
9113
|
},
|
|
9075
9114
|
isRegistered(name) {
|
|
@@ -9101,7 +9140,7 @@ function createAssetManagerComposition(featureFlags, options = {}) {
|
|
|
9101
9140
|
applyToTarget(name, target) {
|
|
9102
9141
|
return extension.setThisSpriteSkin({ NAME: ownedName(name)?.internal ?? name }, {
|
|
9103
9142
|
target,
|
|
9104
|
-
runtime
|
|
9143
|
+
runtime
|
|
9105
9144
|
});
|
|
9106
9145
|
},
|
|
9107
9146
|
playSound(name, options = {}) {
|
|
@@ -9187,5 +9226,7 @@ function createAssetManagerComposition(featureFlags, options = {}) {
|
|
|
9187
9226
|
}
|
|
9188
9227
|
});
|
|
9189
9228
|
}
|
|
9229
|
+
createAssetManagerComposition.supportsRuntimeIsolation = true;
|
|
9230
|
+
Object.defineProperty(createAssetManagerComposition, "supportsRuntimeIsolation", { writable: false });
|
|
9190
9231
|
//#endregion
|
|
9191
9232
|
export { NAMED_ASSET_BODY_NAMESPACE, NamedAssetBodyError, createAssetManagerComposition, createBinaryBundleStore, createIndexedDBBinaryObjectStore, createOpfsBinaryObjectStore, createSessionBinaryBacking, createVerifiedRemoteBinaryCache, createVerifiedRemoteCacheDatabaseName };
|
|
@@ -65,7 +65,20 @@ export interface DOMImageResourceBindingOptions {
|
|
|
65
65
|
readonly attribute?: 'href' | 'src';
|
|
66
66
|
readonly owner?: AssetManagerCompositionTarget;
|
|
67
67
|
}
|
|
68
|
+
/** Public runtime boundary; rendering and asset capabilities are checked when used. */
|
|
69
|
+
export interface AssetManagerCompositionRuntime {
|
|
70
|
+
readonly renderer: object;
|
|
71
|
+
readonly targets: readonly object[];
|
|
72
|
+
readonly storage?: unknown;
|
|
73
|
+
readonly stageWidth?: number;
|
|
74
|
+
on?(eventName: string, listener: (target?: AssetManagerCompositionTarget) => void): unknown;
|
|
75
|
+
off?(eventName: string, listener: (target?: AssetManagerCompositionTarget) => void): unknown;
|
|
76
|
+
requestRedraw?(): unknown;
|
|
77
|
+
getOpcodeFunction?(opcode: string): unknown;
|
|
78
|
+
}
|
|
68
79
|
export interface AssetManagerCompositionOptions {
|
|
80
|
+
/** Explicit owner for independent preview/player runtimes; defaults to the extension host. */
|
|
81
|
+
readonly runtime?: AssetManagerCompositionRuntime;
|
|
69
82
|
readonly verifiedRemoteCache?: VerifiedRemoteBinaryCacheOptions;
|
|
70
83
|
readonly binaryBundleStore?: BinaryBundleStoreOptions;
|
|
71
84
|
readonly sessionBinaryBacking?: SessionBinaryBackingOptions;
|
|
@@ -112,3 +125,6 @@ export interface AssetManagerComposition {
|
|
|
112
125
|
createSessionBinaryBacking(input: SessionBinaryBackingInput, options?: BinaryBundleOperationOptions): Promise<SessionBinaryBacking>;
|
|
113
126
|
}
|
|
114
127
|
export declare function createAssetManagerComposition(featureFlags?: AssetManagerFeatureFlags, options?: AssetManagerCompositionOptions): AssetManagerComposition;
|
|
128
|
+
export declare namespace createAssetManagerComposition {
|
|
129
|
+
var supportsRuntimeIsolation: true;
|
|
130
|
+
}
|
|
@@ -124,7 +124,13 @@ export declare class AssetManagerExtension {
|
|
|
124
124
|
private readonly releaseNamedBodySnapshotsForLifecycle;
|
|
125
125
|
private readonly unregisterNamedBodyProviderForRuntimeDispose;
|
|
126
126
|
private readonly fixedEditors;
|
|
127
|
-
|
|
127
|
+
private listeningForTargetStops;
|
|
128
|
+
private readonly releaseStoppedTarget;
|
|
129
|
+
constructor(featureFlags?: AssetManagerFeatureFlags, runtime?: TurboWarpRuntime);
|
|
130
|
+
/** A reusable composition reattaches its own listener when registering new assets. */
|
|
131
|
+
ensureRuntimeListeners(): void;
|
|
132
|
+
/** Release only this instance's subscription, leaving other runtime owners untouched. */
|
|
133
|
+
releaseRuntimeListeners(): void;
|
|
128
134
|
setLoadingBackdrop(args: BlockArgs): void;
|
|
129
135
|
setLoadingCostumes(args: BlockArgs): void;
|
|
130
136
|
prepareLoadingAssets(args: BlockArgs, util: ScratchBlockUtility): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubohiroya/turbowarp-asset-cache",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "A browser-local image, audio, and runtime-text asset cache for TurboWarp projects.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Hiroya Kubo",
|
|
@@ -72,10 +72,10 @@
|
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@eslint/js": "^9.39.5",
|
|
75
|
-
"@kubohiroya/turbowarp-extension-data-editor": "^0.
|
|
75
|
+
"@kubohiroya/turbowarp-extension-data-editor": "^0.8.1",
|
|
76
76
|
"@kubohiroya/turbowarp-extension-manifest": "^0.5.0",
|
|
77
|
-
"@kubohiroya/turbowarp-named-data": "^0.
|
|
78
|
-
"@kubohiroya/vite-plugin-turbowarp-extension": "^0.
|
|
77
|
+
"@kubohiroya/turbowarp-named-data": "^0.8.0-rc.1",
|
|
78
|
+
"@kubohiroya/vite-plugin-turbowarp-extension": "^0.11.0",
|
|
79
79
|
"@types/node": "^22.20.1",
|
|
80
80
|
"@xmldom/xmldom": "0.9.11",
|
|
81
81
|
"eslint": "^9.39.5",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"vitest": "^4.1.10"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
|
-
"@kubohiroya/turbowarp-named-data": "^0.
|
|
89
|
+
"@kubohiroya/turbowarp-named-data": "^0.8.0-rc.1"
|
|
90
90
|
},
|
|
91
91
|
"keywords": [
|
|
92
92
|
"turbowarp",
|