refactor(resources): extract AssetDecoder from Loader (Loader split, Slice 2/4)#415
Merged
Conversation
added 4 commits
July 26, 2026 05:23
Standalone class owning Loader's URL resolution, cache-strategy dispatch, bindAsset handler invocation, and container byte-injection. Resolved resources are handed to a constructor-injected storeResource callback rather than stored directly, so this class stays "identity + bytes/handler in, resource out" per the Loader-split design doc. Not yet wired into Loader — this commit is additive only, proven correct in isolation against fakes. Loader.ts's own copy of this logic still exists unchanged.
…hFetch test
AssetTypeRegistry.bindAsset's toRequest closure nests non-source fields
under 'options'. Update test to expect { source: 'hero.png', options: { scale: 2 } }
instead of loosened assertions. Verifies exact option-merging behavior as specified.
Fixes: code-review feedback on test assertion rigor.
Verified: all tests pass, typecheck clean.
…ce 2b) Loader composes one AssetDecoder instance and delegates URL resolution, cache-strategy dispatch, bindAsset handler invocation, and container byte-injection to it. Resource storage stays on Loader._storeResource, reached from AssetDecoder through a constructor-injected callback — AssetDecoder itself never touches the resident-resource map, per the Loader-split design doc. No public API change — basePath/fetchOptions keep their exact getter/setter semantics as thin delegates. Loader.ts drops the fetch/dispatch plumbing; the extracted logic is unchanged, only relocated and proven independently in AssetDecoder's own test file (prior commit).
…r split
Fix simple-import-sort violations in AssetDecoder.ts and asset-decoder.test.ts,
apply Prettier's arrow-last-argument expansion to four register() call sites
in the test file, import AssetHandler so its JSDoc {@link} resolves, trim the
duplicated basePath doc comment to point back at Loader.basePath, and clarify
the destroy() teardown-order comment to name this._decoder.destroy() as the
store-destroy step.
Exoridus
enabled auto-merge (squash)
July 26, 2026 03:55
Bundle ReportChanges will increase total bundle size by 7.83kB (0.03%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: exo-iife-min-Exo-iifeAssets Changed:
Files in
view changes for bundle: exo-esm-esmAssets Changed:
Files in
view changes for bundle: exo-esm-modules-esmAssets Changed:
Files in
Files in
view changes for bundle: exo-full-iife-Exo-iifeAssets Changed:
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced Jul 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Loaderinto a standaloneAssetDecoderclass (src/resources/AssetDecoder.ts), continuing the internal Loader-split effort started in Slice 1 (refactor(resources): extract AssetTypeRegistry from Loader (Loader split, Slice 1/4) #414,AssetTypeRegistry).AssetDecoderdeliberately never touches the resident-resource map: every resolved value is handed to a constructor-injectedstoreResourcecallback (currently wired toLoader._storeResource), so Slice 3 (AssetResidency) can repoint that one callback without redesigning this class.Loader's public methods keep their exact signatures/JSDoc;basePath/fetchOptionsbecome thin delegates.docs:api:checkconfirms zero drift in the generated API docs.destroy()teardown order (factories → stores → handlers) is preserved, including the regression coverage added after the Slice 1 review found a real ordering bug.Test plan
pnpm typecheck— cleanpnpm test:core— 329/329 files, 5326 passed, 15 skipped, 0 failedpnpm verify:quick(typecheck + guides/examples/type-tests/packages typecheck + lint + format + docs:api:check) — clean, only pre-existing unrelated warningstest/resources/asset-decoder.test.ts(12 tests) exercisesAssetDecoderstandalone against a realAssetTypeRegistryand faked I/O boundary (CacheStrategy/CacheStore)