@forgeax/engine-assets-runtime 0.1.4 → 0.1.7
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.md +453 -175
- package/dist/.tsbuildinfo +1 -1
- package/dist/__tests__/aabb.unit.test.d.ts +2 -0
- package/dist/__tests__/aabb.unit.test.d.ts.map +1 -0
- package/dist/__tests__/artifact-integrity.unit.test.d.ts +2 -0
- package/dist/__tests__/artifact-integrity.unit.test.d.ts.map +1 -0
- package/dist/__tests__/artifact-io.unit.test.d.ts +2 -0
- package/dist/__tests__/artifact-io.unit.test.d.ts.map +1 -0
- package/dist/__tests__/asset-evidence-sdk.integration.test.d.ts +2 -0
- package/dist/__tests__/asset-evidence-sdk.integration.test.d.ts.map +1 -0
- package/dist/__tests__/asset-evidence.unit.test.d.ts +2 -0
- package/dist/__tests__/asset-evidence.unit.test.d.ts.map +1 -0
- package/dist/__tests__/asset-kind.unit.test.d.ts +2 -0
- package/dist/__tests__/asset-kind.unit.test.d.ts.map +1 -0
- package/dist/__tests__/asset-registry-catalog-reconcile.integration.test.d.ts +2 -0
- package/dist/__tests__/asset-registry-catalog-reconcile.integration.test.d.ts.map +1 -0
- package/dist/__tests__/asset-registry-catalog-reconcile.unit.test.d.ts +2 -0
- package/dist/__tests__/asset-registry-catalog-reconcile.unit.test.d.ts.map +1 -0
- package/dist/__tests__/asset-registry-catalog.unit.test.d.ts +2 -0
- package/dist/__tests__/asset-registry-catalog.unit.test.d.ts.map +1 -0
- package/dist/__tests__/asset-registry.pack-cache.test.d.ts +2 -0
- package/dist/__tests__/asset-registry.pack-cache.test.d.ts.map +1 -0
- package/dist/__tests__/asset-registry.unit.test.d.ts +2 -0
- package/dist/__tests__/asset-registry.unit.test.d.ts.map +1 -0
- package/dist/__tests__/asset-runtime-error-code-owner.test-d.d.ts +2 -0
- package/dist/__tests__/asset-runtime-error-code-owner.test-d.d.ts.map +1 -0
- package/dist/__tests__/catalog-replica.unit.test.d.ts +2 -0
- package/dist/__tests__/catalog-replica.unit.test.d.ts.map +1 -0
- package/dist/__tests__/catalog-source-v2.unit.test.d.ts +2 -0
- package/dist/__tests__/catalog-source-v2.unit.test.d.ts.map +1 -0
- package/dist/__tests__/catalog-source.unit.test.d.ts +2 -0
- package/dist/__tests__/catalog-source.unit.test.d.ts.map +1 -0
- package/dist/__tests__/catalog-subscription-order.unit.test.d.ts +2 -0
- package/dist/__tests__/catalog-subscription-order.unit.test.d.ts.map +1 -0
- package/dist/__tests__/catalog-subscription.unit.test.d.ts +2 -0
- package/dist/__tests__/catalog-subscription.unit.test.d.ts.map +1 -0
- package/dist/__tests__/decode-image-bytes-pass-through.test.d.ts +2 -0
- package/dist/__tests__/decode-image-bytes-pass-through.test.d.ts.map +1 -0
- package/dist/__tests__/decode-image-bytes.browser.test.d.ts +2 -0
- package/dist/__tests__/decode-image-bytes.browser.test.d.ts.map +1 -0
- package/dist/__tests__/decode-image-bytes.test-d.d.ts +2 -0
- package/dist/__tests__/decode-image-bytes.test-d.d.ts.map +1 -0
- package/dist/__tests__/decode-image-bytes.test.d.ts +2 -0
- package/dist/__tests__/decode-image-bytes.test.d.ts.map +1 -0
- package/dist/__tests__/dynamic-texture-store.unit.test.d.ts +2 -0
- package/dist/__tests__/dynamic-texture-store.unit.test.d.ts.map +1 -0
- package/dist/__tests__/errors-asset.unit.test.d.ts +2 -0
- package/dist/__tests__/errors-asset.unit.test.d.ts.map +1 -0
- package/dist/__tests__/inline-pack-loaders.unit.test.d.ts +2 -0
- package/dist/__tests__/inline-pack-loaders.unit.test.d.ts.map +1 -0
- package/dist/__tests__/instantiate-context.unit.test.d.ts +2 -0
- package/dist/__tests__/instantiate-context.unit.test.d.ts.map +1 -0
- package/dist/__tests__/instantiate-publication-fence.unit.test.d.ts +2 -0
- package/dist/__tests__/instantiate-publication-fence.unit.test.d.ts.map +1 -0
- package/dist/__tests__/instantiate.unit.test.d.ts +2 -0
- package/dist/__tests__/instantiate.unit.test.d.ts.map +1 -0
- package/dist/__tests__/loader-input-contract.unit.test.d.ts +2 -0
- package/dist/__tests__/loader-input-contract.unit.test.d.ts.map +1 -0
- package/dist/__tests__/loader-registry.unit.test.d.ts +2 -0
- package/dist/__tests__/loader-registry.unit.test.d.ts.map +1 -0
- package/dist/__tests__/material-dependency-invalidation.unit.test.d.ts +2 -0
- package/dist/__tests__/material-dependency-invalidation.unit.test.d.ts.map +1 -0
- package/dist/__tests__/material-generation-cache.unit.test.d.ts +2 -0
- package/dist/__tests__/material-generation-cache.unit.test.d.ts.map +1 -0
- package/dist/__tests__/material-load-consumer.test-d.d.ts +2 -0
- package/dist/__tests__/material-load-consumer.test-d.d.ts.map +1 -0
- package/dist/__tests__/material-ready.integration.test.d.ts +2 -0
- package/dist/__tests__/material-ready.integration.test.d.ts.map +1 -0
- package/dist/__tests__/material-stale-generation.unit.test.d.ts +2 -0
- package/dist/__tests__/material-stale-generation.unit.test.d.ts.map +1 -0
- package/dist/__tests__/mesh-bin-morph-v3.test.d.ts +2 -0
- package/dist/__tests__/mesh-bin-morph-v3.test.d.ts.map +1 -0
- package/dist/__tests__/mesh-bin.unit.test.d.ts +2 -0
- package/dist/__tests__/mesh-bin.unit.test.d.ts.map +1 -0
- package/dist/__tests__/mipmap-generator.unit.test.d.ts +2 -0
- package/dist/__tests__/mipmap-generator.unit.test.d.ts.map +1 -0
- package/dist/__tests__/pack-artifact-transcode-model-owner.test.d.ts +2 -0
- package/dist/__tests__/pack-artifact-transcode-model-owner.test.d.ts.map +1 -0
- package/dist/__tests__/pack-basis-load.integration.test.d.ts +2 -0
- package/dist/__tests__/pack-basis-load.integration.test.d.ts.map +1 -0
- package/dist/__tests__/payload-validate.unit.test.d.ts +2 -0
- package/dist/__tests__/payload-validate.unit.test.d.ts.map +1 -0
- package/dist/__tests__/plugin.test.d.ts +2 -0
- package/dist/__tests__/plugin.test.d.ts.map +1 -0
- package/dist/__tests__/registry-concurrency.bench.test.d.ts +2 -0
- package/dist/__tests__/registry-concurrency.bench.test.d.ts.map +1 -0
- package/dist/__tests__/registry-failure-retry.integration.test.d.ts +2 -0
- package/dist/__tests__/registry-failure-retry.integration.test.d.ts.map +1 -0
- package/dist/__tests__/registry-load-graph.integration.test.d.ts +2 -0
- package/dist/__tests__/registry-load-graph.integration.test.d.ts.map +1 -0
- package/dist/__tests__/registry-load-state.unit.test.d.ts +2 -0
- package/dist/__tests__/registry-load-state.unit.test.d.ts.map +1 -0
- package/dist/__tests__/registry-package-cache.unit.test.d.ts +2 -0
- package/dist/__tests__/registry-package-cache.unit.test.d.ts.map +1 -0
- package/dist/__tests__/registry-public-ready.unit.test.d.ts +2 -0
- package/dist/__tests__/registry-public-ready.unit.test.d.ts.map +1 -0
- package/dist/__tests__/resolve-asset-handle.unit.test.d.ts +2 -0
- package/dist/__tests__/resolve-asset-handle.unit.test.d.ts.map +1 -0
- package/dist/__tests__/scene-handle-fields.unit.test.d.ts +2 -0
- package/dist/__tests__/scene-handle-fields.unit.test.d.ts.map +1 -0
- package/dist/__tests__/scene-payload.unit.test.d.ts +2 -0
- package/dist/__tests__/scene-payload.unit.test.d.ts.map +1 -0
- package/dist/__tests__/scene-publication-fence.test.d.ts +2 -0
- package/dist/__tests__/scene-publication-fence.test.d.ts.map +1 -0
- package/dist/__tests__/scriptable-pack-public-surface.test-d.d.ts +2 -0
- package/dist/__tests__/scriptable-pack-public-surface.test-d.d.ts.map +1 -0
- package/dist/__tests__/static-rig.integration.test.d.ts +2 -0
- package/dist/__tests__/static-rig.integration.test.d.ts.map +1 -0
- package/dist/__tests__/validate-material.unit.test.d.ts +2 -0
- package/dist/__tests__/validate-material.unit.test.d.ts.map +1 -0
- package/dist/__tests__/video-pack-loader.integration.test.d.ts +2 -0
- package/dist/__tests__/video-pack-loader.integration.test.d.ts.map +1 -0
- package/dist/aabb.d.ts +3 -0
- package/dist/aabb.d.ts.map +1 -0
- package/dist/asset-registry.d.ts +554 -0
- package/dist/asset-registry.d.ts.map +1 -0
- package/dist/builtin-asset-registry.d.ts +22 -0
- package/dist/builtin-asset-registry.d.ts.map +1 -0
- package/dist/catalog-source.d.ts +2 -1
- package/dist/catalog-source.d.ts.map +1 -1
- package/dist/decode-image-bytes.d.ts +57 -0
- package/dist/decode-image-bytes.d.ts.map +1 -0
- package/dist/dynamic-texture-store.d.ts +89 -0
- package/dist/dynamic-texture-store.d.ts.map +1 -0
- package/dist/errors/asset.d.ts +201 -0
- package/dist/errors/asset.d.ts.map +1 -0
- package/dist/handles.d.ts +143 -0
- package/dist/handles.d.ts.map +1 -0
- package/dist/image-error.d.ts +6 -0
- package/dist/image-error.d.ts.map +1 -0
- package/dist/index.d.ts +32 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +7233 -114
- package/dist/index.mjs.map +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/loader-registry.d.ts +63 -0
- package/dist/loader-registry.d.ts.map +1 -0
- package/dist/loaders/inline-pack.d.ts +72 -0
- package/dist/loaders/inline-pack.d.ts.map +1 -0
- package/dist/loaders/mesh-bin.d.ts +21 -0
- package/dist/loaders/mesh-bin.d.ts.map +1 -0
- package/dist/loaders/pack-artifact.d.ts +20 -0
- package/dist/loaders/pack-artifact.d.ts.map +1 -0
- package/dist/material/dependency-graph.d.ts +9 -0
- package/dist/material/dependency-graph.d.ts.map +1 -0
- package/dist/material/generation-cache.d.ts +24 -0
- package/dist/material/generation-cache.d.ts.map +1 -0
- package/dist/material/inspection.d.ts +24 -0
- package/dist/material/inspection.d.ts.map +1 -0
- package/dist/material/loader.d.ts +59 -0
- package/dist/material/loader.d.ts.map +1 -0
- package/dist/material/runtime-shader.d.ts +14 -0
- package/dist/material/runtime-shader.d.ts.map +1 -0
- package/dist/mesh-bin.d.ts +3 -0
- package/dist/mesh-bin.d.ts.map +1 -0
- package/dist/mipmap-generator.d.ts +132 -0
- package/dist/mipmap-generator.d.ts.map +1 -0
- package/dist/payload-validate.d.ts +60 -0
- package/dist/payload-validate.d.ts.map +1 -0
- package/dist/plugin.d.ts +16 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/registry/artifact-io.d.ts +16 -0
- package/dist/registry/artifact-io.d.ts.map +1 -0
- package/dist/registry/asset-evidence.d.ts +13 -0
- package/dist/registry/asset-evidence.d.ts.map +1 -0
- package/dist/registry/catalog-state.d.ts +47 -0
- package/dist/registry/catalog-state.d.ts.map +1 -0
- package/dist/registry/catalog.d.ts +48 -0
- package/dist/registry/catalog.d.ts.map +1 -0
- package/dist/registry/instantiate.d.ts +153 -0
- package/dist/registry/instantiate.d.ts.map +1 -0
- package/dist/registry/load-by-guid.d.ts +247 -0
- package/dist/registry/load-by-guid.d.ts.map +1 -0
- package/dist/registry/load-state.d.ts +26 -0
- package/dist/registry/load-state.d.ts.map +1 -0
- package/dist/registry/runtime-projection.d.ts +16 -0
- package/dist/registry/runtime-projection.d.ts.map +1 -0
- package/dist/registry/scene-publication-fence.d.ts +38 -0
- package/dist/registry/scene-publication-fence.d.ts.map +1 -0
- package/dist/registry/validate-material.d.ts +77 -0
- package/dist/registry/validate-material.d.ts.map +1 -0
- package/dist/resolve-asset-handle.d.ts +43 -0
- package/dist/resolve-asset-handle.d.ts.map +1 -0
- package/dist/resolve-tileset-runtime.d.ts +23 -0
- package/dist/resolve-tileset-runtime.d.ts.map +1 -0
- package/dist/scene-handle-fields.d.ts +88 -0
- package/dist/scene-handle-fields.d.ts.map +1 -0
- package/dist/scene-payload.d.ts +15 -0
- package/dist/scene-payload.d.ts.map +1 -0
- package/dist/wire-default-loaders.d.ts +29 -0
- package/dist/wire-default-loaders.d.ts.map +1 -0
- package/package.json +22 -9
- package/src/__tests__/aabb.unit.test.ts +97 -0
- package/src/__tests__/artifact-integrity.unit.test.ts +99 -0
- package/src/__tests__/artifact-io.unit.test.ts +127 -0
- package/src/__tests__/asset-evidence-sdk.integration.test.ts +32 -0
- package/src/__tests__/asset-evidence.unit.test.ts +32 -0
- package/src/__tests__/{asset-kind.test.ts → asset-kind.unit.test.ts} +1 -1
- package/src/__tests__/asset-registry-catalog-reconcile.integration.test.ts +74 -0
- package/src/__tests__/asset-registry-catalog-reconcile.unit.test.ts +89 -0
- package/src/__tests__/asset-registry-catalog.unit.test.ts +170 -0
- package/src/__tests__/asset-registry.pack-cache.test.ts +96 -0
- package/src/__tests__/asset-registry.unit.test.ts +511 -0
- package/src/__tests__/asset-runtime-error-code-owner.test-d.ts +63 -0
- package/src/__tests__/catalog-replica.unit.test.ts +196 -0
- package/src/__tests__/catalog-source-v2.unit.test.ts +158 -0
- package/src/__tests__/catalog-source.unit.test.ts +126 -0
- package/src/__tests__/catalog-subscription-order.unit.test.ts +65 -0
- package/src/__tests__/catalog-subscription.unit.test.ts +28 -0
- package/src/__tests__/decode-image-bytes-pass-through.test.ts +34 -0
- package/src/__tests__/decode-image-bytes.browser.test.ts +102 -0
- package/src/__tests__/decode-image-bytes.test-d.ts +108 -0
- package/src/__tests__/decode-image-bytes.test.ts +90 -0
- package/src/__tests__/decode-image-mime-owner.test.ts +2 -5
- package/src/__tests__/dynamic-texture-store.unit.test.ts +115 -0
- package/src/__tests__/errors-asset.unit.test.ts +92 -0
- package/src/__tests__/inline-pack-loaders.unit.test.ts +548 -0
- package/src/__tests__/instantiate-context.unit.test.ts +65 -0
- package/src/__tests__/instantiate-publication-fence.unit.test.ts +158 -0
- package/src/__tests__/instantiate.unit.test.ts +684 -0
- package/src/__tests__/loader-input-contract.unit.test.ts +89 -0
- package/src/__tests__/loader-registry.unit.test.ts +101 -0
- package/src/__tests__/material-dependency-invalidation.unit.test.ts +14 -0
- package/src/__tests__/material-generation-cache.unit.test.ts +46 -0
- package/src/__tests__/material-load-consumer.test-d.ts +42 -0
- package/src/__tests__/material-ready.integration.test.ts +508 -0
- package/src/__tests__/material-stale-generation.unit.test.ts +147 -0
- package/src/__tests__/mesh-bin-morph-v3.test.ts +22 -0
- package/src/__tests__/mesh-bin.unit.test.ts +152 -0
- package/src/__tests__/mipmap-generator.unit.test.ts +202 -0
- package/src/__tests__/pack-artifact-transcode-model-owner.test.ts +32 -0
- package/src/__tests__/pack-basis-load.integration.test.ts +168 -0
- package/src/__tests__/payload-validate.unit.test.ts +285 -0
- package/src/__tests__/plugin.test.ts +55 -0
- package/src/__tests__/registry-concurrency.bench.test.ts +40 -0
- package/src/__tests__/registry-failure-retry.integration.test.ts +69 -0
- package/src/__tests__/registry-load-graph.integration.test.ts +246 -0
- package/src/__tests__/registry-load-state.unit.test.ts +35 -0
- package/src/__tests__/registry-package-cache.unit.test.ts +53 -0
- package/src/__tests__/registry-public-ready.unit.test.ts +38 -0
- package/src/__tests__/resolve-asset-handle.unit.test.ts +238 -0
- package/src/__tests__/scene-handle-fields.unit.test.ts +129 -0
- package/src/__tests__/scene-payload.unit.test.ts +151 -0
- package/src/__tests__/scene-publication-fence.test.ts +129 -0
- package/src/__tests__/scriptable-pack-public-surface.test-d.ts +27 -0
- package/src/__tests__/static-rig.integration.test.ts +8 -0
- package/src/__tests__/validate-material.unit.test.ts +359 -0
- package/src/__tests__/video-pack-loader.integration.test.ts +83 -0
- package/src/aabb.ts +107 -0
- package/src/asset-registry.ts +2045 -0
- package/src/builtin-asset-registry.ts +164 -0
- package/src/catalog-source.ts +14 -70
- package/src/decode-image-bytes.ts +126 -0
- package/src/dynamic-texture-store.ts +234 -0
- package/src/errors/asset.ts +347 -0
- package/src/handles.ts +186 -0
- package/src/image-error.ts +45 -0
- package/src/index.ts +183 -16
- package/src/internal.ts +1 -0
- package/src/loader-registry.ts +157 -0
- package/src/loaders/inline-pack.ts +837 -0
- package/src/loaders/mesh-bin.ts +304 -0
- package/src/loaders/pack-artifact.ts +665 -0
- package/src/material/dependency-graph.ts +46 -0
- package/src/material/generation-cache.ts +177 -0
- package/src/material/inspection.ts +46 -0
- package/src/material/loader.ts +326 -0
- package/src/material/runtime-shader.ts +133 -0
- package/src/mesh-bin.ts +5 -0
- package/src/mipmap-generator.ts +450 -0
- package/src/payload-validate.ts +573 -0
- package/src/plugin.ts +48 -0
- package/src/registry/artifact-io.ts +259 -0
- package/src/registry/asset-evidence.ts +51 -0
- package/src/registry/catalog-state.ts +409 -0
- package/src/registry/catalog.ts +369 -0
- package/src/registry/instantiate.ts +1056 -0
- package/src/registry/load-by-guid.ts +1657 -0
- package/src/registry/load-state.ts +115 -0
- package/src/registry/runtime-projection.ts +63 -0
- package/src/registry/scene-publication-fence.ts +256 -0
- package/src/registry/validate-material.ts +385 -0
- package/src/resolve-asset-handle.ts +147 -0
- package/src/resolve-tileset-runtime.ts +72 -0
- package/src/scene-handle-fields.ts +221 -0
- package/src/scene-payload.ts +207 -0
- package/src/wire-default-loaders.ts +79 -0
- package/dist/__tests__/asset-graph-red.integration.test.d.ts +0 -2
- package/dist/__tests__/asset-graph-red.integration.test.d.ts.map +0 -1
- package/dist/__tests__/asset-kind.test.d.ts +0 -2
- package/dist/__tests__/asset-kind.test.d.ts.map +0 -1
- package/dist/__tests__/asset-registry-core.integration.test.d.ts +0 -2
- package/dist/__tests__/asset-registry-core.integration.test.d.ts.map +0 -1
- package/dist/__tests__/asset-registry-public-api.test-d.d.ts +0 -2
- package/dist/__tests__/asset-registry-public-api.test-d.d.ts.map +0 -1
- package/dist/__tests__/asset-runtime-core-lifecycle.integration.test.d.ts +0 -2
- package/dist/__tests__/asset-runtime-core-lifecycle.integration.test.d.ts.map +0 -1
- package/dist/__tests__/asset-runtime-snapshot.unit.test.d.ts +0 -2
- package/dist/__tests__/asset-runtime-snapshot.unit.test.d.ts.map +0 -1
- package/dist/__tests__/catalog-session-red.unit.test.d.ts +0 -2
- package/dist/__tests__/catalog-session-red.unit.test.d.ts.map +0 -1
- package/dist/__tests__/registry-lifecycle-red.integration.test.d.ts +0 -2
- package/dist/__tests__/registry-lifecycle-red.integration.test.d.ts.map +0 -1
- package/src/__tests__/asset-graph-red.integration.test.ts +0 -113
- package/src/__tests__/asset-registry-core.integration.test.ts +0 -161
- package/src/__tests__/asset-registry-public-api.test-d.ts +0 -31
- package/src/__tests__/asset-runtime-core-lifecycle.integration.test.ts +0 -79
- package/src/__tests__/asset-runtime-snapshot.unit.test.ts +0 -23
- package/src/__tests__/catalog-session-red.unit.test.ts +0 -276
- package/src/__tests__/registry-lifecycle-red.integration.test.ts +0 -80
package/src/index.ts
CHANGED
|
@@ -1,22 +1,189 @@
|
|
|
1
|
+
// @forgeax/engine-assets-runtime -- public API barrel.
|
|
2
|
+
//
|
|
3
|
+
// Tier 2.1 package extracted from @forgeax/engine-runtime
|
|
4
|
+
// (feat-20260705-runtime-tier2-decomposition M1). The asset registry, loader
|
|
5
|
+
// registry, GUID resolution, default-loader wiring, builtin handles, and the
|
|
6
|
+
// dynamic-texture / mipmap helpers live here; the runtime package injects the
|
|
7
|
+
// post-spawn hook + extra loaders (audio / video) at the createRenderer
|
|
8
|
+
// assembly point.
|
|
9
|
+
//
|
|
10
|
+
// w14 public surface: exports exactly the asset-cluster symbols that the
|
|
11
|
+
// runtime package (src + __tests__) consumes plus what the pre-w14 runtime
|
|
12
|
+
// barrel re-exported to external consumers. Downstream apps repoint to this
|
|
13
|
+
// package in w15 (the runtime barrel no longer re-exports any asset symbol).
|
|
14
|
+
|
|
1
15
|
export type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
16
|
+
AnimationClip,
|
|
17
|
+
AnimationGraph,
|
|
18
|
+
AudioClipAsset,
|
|
19
|
+
EquirectAsset,
|
|
20
|
+
FontAsset,
|
|
21
|
+
MaterialAsset,
|
|
22
|
+
ParticleEffectAsset,
|
|
23
|
+
RenderPipelineAsset,
|
|
24
|
+
SamplerAsset,
|
|
25
|
+
SceneAsset,
|
|
26
|
+
SkeletonAsset,
|
|
27
|
+
SkinAsset,
|
|
28
|
+
TextureAsset,
|
|
29
|
+
TilesetAsset,
|
|
30
|
+
VideoAsset,
|
|
11
31
|
} from '@forgeax/engine-types';
|
|
12
|
-
|
|
13
32
|
export { defineAssetKind } from './asset-kind.js';
|
|
14
|
-
|
|
33
|
+
// ─── AssetRegistry + Asset / MeshAsset type aliases ─────────────────────────
|
|
34
|
+
export type {
|
|
35
|
+
Asset,
|
|
36
|
+
CatalogReconcileError,
|
|
37
|
+
CatalogReconcileResult,
|
|
38
|
+
MeshAsset,
|
|
39
|
+
} from './asset-registry';
|
|
40
|
+
export { AssetRegistry } from './asset-registry';
|
|
41
|
+
// ─── Process-static builtin payload registry + vertex-layout SSOT ───────────
|
|
15
42
|
export {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
43
|
+
BUILTIN_BASE,
|
|
44
|
+
BUILTIN_CUBE,
|
|
45
|
+
BUILTIN_CYLINDER,
|
|
46
|
+
BUILTIN_NINESLICE_QUAD,
|
|
47
|
+
BUILTIN_QUAD,
|
|
48
|
+
BUILTIN_SPHERE,
|
|
49
|
+
BUILTIN_TRIANGLE,
|
|
50
|
+
BuiltinAssetRegistry,
|
|
51
|
+
} from './builtin-asset-registry';
|
|
52
|
+
export { type CatalogListener, type CatalogSource, createCatalogSource } from './catalog-source';
|
|
53
|
+
// ─── Runtime image byte decoder (tweak-20260714 M1) ──────────────────────────
|
|
54
|
+
export { decodeImageBytes } from './decode-image-bytes';
|
|
55
|
+
// ─── Dynamic per-frame texture store ────────────────────────────────────────
|
|
56
|
+
export {
|
|
57
|
+
adaptDynamicTextureDevice,
|
|
58
|
+
type DynamicTextureDevice,
|
|
59
|
+
DynamicTextureStore,
|
|
60
|
+
} from './dynamic-texture-store';
|
|
61
|
+
// ─── Asset cluster error model (closed union + classes) ─────────────────────
|
|
62
|
+
export type {
|
|
63
|
+
AssetRuntimeError,
|
|
64
|
+
AssetRuntimeErrorCode,
|
|
65
|
+
MaterialResolvedEmptyPassesDetail,
|
|
66
|
+
SceneCollectAssetGuidUnresolvedDetail,
|
|
67
|
+
SceneCollectEntityRefOutOfClosureDetail,
|
|
68
|
+
} from './errors/asset';
|
|
69
|
+
export {
|
|
70
|
+
MaterialResolvedEmptyPassesError,
|
|
71
|
+
MeshBinAssetError,
|
|
72
|
+
MeshSsboCapacityExceededError,
|
|
73
|
+
MeshSsboCeilingReachedError,
|
|
74
|
+
SceneCollectAssetGuidUnresolvedError,
|
|
75
|
+
SceneCollectEntityRefOutOfClosureError,
|
|
76
|
+
} from './errors/asset';
|
|
77
|
+
// ─── Builtin mesh handles (re-exported by asset-registry from ./handles) ─────
|
|
78
|
+
export {
|
|
79
|
+
builtinMeshGuid,
|
|
80
|
+
HANDLE_CUBE,
|
|
81
|
+
HANDLE_CYLINDER,
|
|
82
|
+
HANDLE_NINESLICE_QUAD,
|
|
83
|
+
HANDLE_QUAD,
|
|
84
|
+
HANDLE_SPHERE,
|
|
85
|
+
HANDLE_TRIANGLE,
|
|
86
|
+
} from './handles';
|
|
87
|
+
// The five-action runtime registry is distinct from the legacy authoring
|
|
88
|
+
// AssetRegistry class above. Keep its resolver on the public package boundary
|
|
89
|
+
// so render/VFX hosts never reach through `/internal` to inspect loaded assets.
|
|
90
|
+
export {
|
|
91
|
+
type AssetRegistry as RuntimeAssetRegistry,
|
|
92
|
+
type AssetRegistryResolver,
|
|
21
93
|
createAssetRegistry,
|
|
94
|
+
getAssetRegistryResolver,
|
|
22
95
|
} from './internal/load-asset.js';
|
|
96
|
+
// ─── Loader-injection surface ───────────────────────────────────────────────
|
|
97
|
+
export { LoaderRegistry } from './loader-registry';
|
|
98
|
+
// ─── Default loader tables + individual loaders (pre-w14 consumer face) ──────
|
|
99
|
+
export {
|
|
100
|
+
animationClipLoader,
|
|
101
|
+
animationGraphLoader,
|
|
102
|
+
audioLoader,
|
|
103
|
+
INLINE_PACK_LOADERS,
|
|
104
|
+
materialLoader,
|
|
105
|
+
meshLoader,
|
|
106
|
+
particleEffectLoader,
|
|
107
|
+
renderPipelineLoader,
|
|
108
|
+
sceneLoader,
|
|
109
|
+
skeletonLoader,
|
|
110
|
+
skinLoader,
|
|
111
|
+
tilesetLoader,
|
|
112
|
+
} from './loaders/inline-pack';
|
|
113
|
+
// ─── Mesh binary container decode ───────────────────────────────────────────
|
|
114
|
+
export {
|
|
115
|
+
type UnpackedMeshBin,
|
|
116
|
+
unpackMeshBinV4,
|
|
117
|
+
} from './loaders/mesh-bin';
|
|
118
|
+
export {
|
|
119
|
+
equirectLoader,
|
|
120
|
+
fontLoader,
|
|
121
|
+
PACK_ARTIFACT_LOADERS,
|
|
122
|
+
renderPipelineLoader as renderPipelineArtifactLoader,
|
|
123
|
+
textureLoader,
|
|
124
|
+
tilesetLoader as tilesetArtifactLoader,
|
|
125
|
+
} from './loaders/pack-artifact';
|
|
126
|
+
export { MaterialGenerationCache } from './material/generation-cache';
|
|
127
|
+
export { inspectMaterialRuntime, type MaterialRuntimeInfo } from './material/inspection';
|
|
128
|
+
export {
|
|
129
|
+
createMaterialLoader,
|
|
130
|
+
type MaterialLoadError,
|
|
131
|
+
type MaterialLoadErrorCode,
|
|
132
|
+
type MaterialLoadErrorDetail,
|
|
133
|
+
type MaterialLoaderOptions,
|
|
134
|
+
type MaterialLoadRequest,
|
|
135
|
+
type MaterialPublication,
|
|
136
|
+
type MaterialReady,
|
|
137
|
+
} from './material/loader';
|
|
138
|
+
export {
|
|
139
|
+
installMaterialReadyShaders,
|
|
140
|
+
materialParametersToParamSchema,
|
|
141
|
+
runtimeMaterialShaderId,
|
|
142
|
+
} from './material/runtime-shader';
|
|
143
|
+
// ─── Mipmap generation helpers ──────────────────────────────────────────────
|
|
144
|
+
export {
|
|
145
|
+
blitMipmapsSync,
|
|
146
|
+
getOrCreateMipmapPipeline,
|
|
147
|
+
type MipmapBlitDevice,
|
|
148
|
+
type MipmapShaderModuleFactory,
|
|
149
|
+
mipmapCacheSize,
|
|
150
|
+
numMipLevels,
|
|
151
|
+
} from './mipmap-generator';
|
|
152
|
+
// ─── Register-time payload validation ───────────────────────────────────────
|
|
153
|
+
export { type TilesetValidateOptions, validateTilesetPayload } from './payload-validate';
|
|
154
|
+
export { assetLoaderPlugin, assetsPlugin, packLoaderPlugin } from './plugin';
|
|
155
|
+
export {
|
|
156
|
+
createRuntimeAssetEvidenceAdapter,
|
|
157
|
+
type RuntimeEvidenceSource,
|
|
158
|
+
} from './registry/asset-evidence';
|
|
159
|
+
export { CatalogReplica, type CatalogReplicaSnapshot } from './registry/catalog-state';
|
|
160
|
+
export type { PostSpawnHook, SkinJointResolver } from './registry/instantiate';
|
|
161
|
+
// ─── Scene instantiate collaboration contract types (D-1 injected hook) ─────
|
|
162
|
+
export { buildSceneChildContext } from './registry/instantiate';
|
|
163
|
+
export { loadMaterialReadyByGuid } from './registry/load-by-guid';
|
|
164
|
+
export {
|
|
165
|
+
compareScenePublicationFences,
|
|
166
|
+
createScenePublicationFence,
|
|
167
|
+
observeScenePublication,
|
|
168
|
+
parseScenePublicationFence,
|
|
169
|
+
SCENE_PUBLICATION_FENCE_SCHEMA,
|
|
170
|
+
SCENE_PUBLICATION_RECOVERY_ACTIONS,
|
|
171
|
+
type ScenePublicationFence,
|
|
172
|
+
type ScenePublicationFenceError,
|
|
173
|
+
type ScenePublicationFencePhase,
|
|
174
|
+
type ScenePublicationObservation,
|
|
175
|
+
scenePublicationFenceFromCatalog,
|
|
176
|
+
} from './registry/scene-publication-fence';
|
|
177
|
+
// ─── Handle-to-payload resolution ───────────────────────────────────────────
|
|
178
|
+
export { resolveAssetHandle, walkMaterialPassesOverSharedRefs } from './resolve-asset-handle';
|
|
179
|
+
export {
|
|
180
|
+
type ResolvedTilesetRuntime,
|
|
181
|
+
resolveTilesetRuntime,
|
|
182
|
+
type TilesetAtlasLookup,
|
|
183
|
+
type TilesetRuntimeError,
|
|
184
|
+
type TilesetRuntimeErrorCode,
|
|
185
|
+
} from './resolve-tileset-runtime';
|
|
186
|
+
// Public scene-pack boundary: editor/play hosts reuse the engine's canonical
|
|
187
|
+
// refs-index -> SceneAsset reconstruction when refreshing a saved SceneAsset.
|
|
188
|
+
export { parseScenePayload } from './scene-payload';
|
|
189
|
+
export { createDefaultLoaderRegistry, wireDefaultLoaders } from './wire-default-loaders';
|
package/src/internal.ts
CHANGED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// @forgeax/engine-assets-runtime - LoaderRegistry (feat-20260603-asset-import-loader-injection M1 / w2).
|
|
2
|
+
//
|
|
3
|
+
// The runtime half of the engine's third DIP instance (after RHI + Console):
|
|
4
|
+
// an injectable table that maps `asset.kind` -> a `Loader` (the contract SSOT
|
|
5
|
+
// lives in `@forgeax/engine-types`, plan-strategy D-2). `AssetRegistry` holds
|
|
6
|
+
// one of these (constructor-injected, D-7) and dispatches `loadByGuid` through
|
|
7
|
+
// `get(kind)` instead of a hardcoded `if (kind === ...)` chain (D-1).
|
|
8
|
+
//
|
|
9
|
+
// Shape mirrors the Console `Registry` (packages/console/src/registry.ts)
|
|
10
|
+
// register/lookup pattern (research Finding 8), with one deliberate
|
|
11
|
+
// difference: the injected unit here is an **object** `{ kind, load }`, not a
|
|
12
|
+
// bare function, because a "one kind -> one loader" dispatch table is the
|
|
13
|
+
// natural shape (plan-strategy D-1 alt-B rejection).
|
|
14
|
+
//
|
|
15
|
+
// Fail-fast semantics (charter P3): `register` throws on a malformed loader
|
|
16
|
+
// or duplicate kind at wire time, so one canonical owner cannot be silently
|
|
17
|
+
// replaced by a later seed table.
|
|
18
|
+
|
|
19
|
+
import type { ArtifactDescriptor, LoadContext, Loader } from '@forgeax/engine-types';
|
|
20
|
+
|
|
21
|
+
export interface PackArtifactInput {
|
|
22
|
+
readonly descriptor: ArtifactDescriptor;
|
|
23
|
+
readonly bytes: Uint8Array;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface PackLoaderInput {
|
|
27
|
+
readonly guid: string;
|
|
28
|
+
readonly kind: string;
|
|
29
|
+
readonly payload: Record<string, unknown>;
|
|
30
|
+
readonly refs: readonly string[];
|
|
31
|
+
readonly artifacts: Readonly<Record<string, PackArtifactInput>>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface PackLoader {
|
|
35
|
+
readonly kind: string;
|
|
36
|
+
load(input: PackLoaderInput, ctx: LoadContext): unknown;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type PackLoadResult =
|
|
40
|
+
| { readonly ok: true; readonly value: unknown }
|
|
41
|
+
| { readonly ok: false; readonly error: unknown };
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Injectable `asset.kind` -> {@link Loader} table held by `AssetRegistry`.
|
|
45
|
+
*
|
|
46
|
+
* @example Wire + dispatch (host side)
|
|
47
|
+
* ```ts
|
|
48
|
+
* import { LoaderRegistry, wireDefaultLoaders } from '@forgeax/engine-assets-runtime';
|
|
49
|
+
* const loaders = new LoaderRegistry();
|
|
50
|
+
* wireDefaultLoaders(loaders);
|
|
51
|
+
* const meshLoader = loaders.get('mesh'); // Loader | undefined
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export class LoaderRegistry {
|
|
55
|
+
// feat-20260623 M4 / w13: the Map stores Loader<unknown> so host custom kinds
|
|
56
|
+
// (Loader<MyPayload>) are accepted. The P in Loader<P> is covariant (output
|
|
57
|
+
// only: load() returns P), so Loader<Asset> is assignable to Loader<unknown>.
|
|
58
|
+
private readonly loaders = new Map<string, Loader<unknown>>();
|
|
59
|
+
private readonly packLoaders = new Map<string, PackLoader>();
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Register a loader for its `loader.kind`. Fail-fast on a malformed loader
|
|
63
|
+
* (charter P3); rejects a repeated kind so the canonical owner cannot be replaced.
|
|
64
|
+
*
|
|
65
|
+
* @param loader the `{ kind, load }` object to register.
|
|
66
|
+
* @throws TypeError when `loader.kind` is empty or `loader.load` is not a
|
|
67
|
+
* function — a wire-time misconfiguration the host must fix.
|
|
68
|
+
*/
|
|
69
|
+
register(loader: Loader<unknown>): () => void {
|
|
70
|
+
if (typeof loader.kind !== 'string' || loader.kind.length === 0) {
|
|
71
|
+
throw new TypeError(
|
|
72
|
+
`LoaderRegistry.register: loader.kind must be a non-empty string (got ${JSON.stringify(loader.kind)})`,
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
if (typeof loader.load !== 'function') {
|
|
76
|
+
throw new TypeError(
|
|
77
|
+
`LoaderRegistry.register: loader.load must be a function for kind "${loader.kind}"`,
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
if (this.loaders.has(loader.kind)) {
|
|
81
|
+
throw new TypeError(`LoaderRegistry.register: duplicate loader kind "${loader.kind}"`);
|
|
82
|
+
}
|
|
83
|
+
this.loaders.set(loader.kind, loader);
|
|
84
|
+
return () => {
|
|
85
|
+
if (this.loaders.get(loader.kind) === loader) this.loaders.delete(loader.kind);
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
registerPackLoader(loader: PackLoader): () => void {
|
|
90
|
+
if (typeof loader.kind !== 'string' || loader.kind.length === 0) {
|
|
91
|
+
throw new TypeError('LoaderRegistry.registerPackLoader: kind must be non-empty');
|
|
92
|
+
}
|
|
93
|
+
if (typeof loader.load !== 'function') {
|
|
94
|
+
throw new TypeError(
|
|
95
|
+
`LoaderRegistry.registerPackLoader: load must be a function for ${loader.kind}`,
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
if (this.packLoaders.has(loader.kind)) {
|
|
99
|
+
throw new TypeError(
|
|
100
|
+
`LoaderRegistry.registerPackLoader: duplicate loader kind "${loader.kind}"`,
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
this.packLoaders.set(loader.kind, loader);
|
|
104
|
+
return () => {
|
|
105
|
+
if (this.packLoaders.get(loader.kind) === loader) this.packLoaders.delete(loader.kind);
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async loadPack(input: PackLoaderInput, ctx: LoadContext): Promise<PackLoadResult> {
|
|
110
|
+
const packLoader = this.packLoaders.get(input.kind);
|
|
111
|
+
if (packLoader !== undefined) {
|
|
112
|
+
const output = await packLoader.load(input, ctx);
|
|
113
|
+
if (isPackLoadResult(output)) return output;
|
|
114
|
+
return { ok: true, value: output };
|
|
115
|
+
}
|
|
116
|
+
const loader = this.loaders.get(input.kind);
|
|
117
|
+
if (loader === undefined) {
|
|
118
|
+
return { ok: false, error: new Error(`no loader registered for ${input.kind}`) };
|
|
119
|
+
}
|
|
120
|
+
if (loader.loadPack !== undefined) {
|
|
121
|
+
const output = await loader.loadPack(input, ctx);
|
|
122
|
+
if (isPackLoadResult(output)) return output;
|
|
123
|
+
return { ok: true, value: output };
|
|
124
|
+
}
|
|
125
|
+
const output = await loader.load(input.payload, input.refs, ctx);
|
|
126
|
+
if (isPackLoadResult(output)) return output;
|
|
127
|
+
return { ok: true, value: output };
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Look up the loader registered for `kind`. Returns `undefined` when no
|
|
132
|
+
* loader is wired — the `AssetRegistry` consumer maps that to a structured
|
|
133
|
+
* `AssetError(code='loader-not-registered')` with the registered kinds in
|
|
134
|
+
* `.detail` (charter P3).
|
|
135
|
+
*/
|
|
136
|
+
get(kind: string): Loader<unknown> | undefined {
|
|
137
|
+
return this.loaders.get(kind);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The kinds currently wired, in insertion order. Fed into the
|
|
142
|
+
* `loader-not-registered` error `.detail.registeredKinds` so AI users see
|
|
143
|
+
* exactly what is injectable.
|
|
144
|
+
*/
|
|
145
|
+
registeredKinds(): readonly string[] {
|
|
146
|
+
return [...this.loaders.keys()];
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function isPackLoadResult(value: unknown): value is PackLoadResult {
|
|
151
|
+
return (
|
|
152
|
+
value !== null &&
|
|
153
|
+
typeof value === 'object' &&
|
|
154
|
+
'ok' in value &&
|
|
155
|
+
typeof (value as { ok?: unknown }).ok === 'boolean'
|
|
156
|
+
);
|
|
157
|
+
}
|