Open MrKou47 opened 3 weeks ago
The changes in this pull request introduce a new enumeration value, Script
, to the AssetType
enum in the AssetType.ts
file. Additionally, a new class named ScriptLoader
is added in the ScriptLoader.ts
file, which extends the Loader
class. This class is designed to handle the loading of script assets, specifically for files with the extensions "js" and "mjs". The ScriptLoader
class includes a load
method that manages the asynchronous loading of script modules. Furthermore, the index.ts
file is updated to import and export the new ScriptLoader
class, and unit tests for the ScriptLoader
functionality are introduced in ScriptLoader.test.ts
.
File | Change Summary |
---|---|
packages/core/src/asset/AssetType.ts | Added new enum value: Script = "Script" to AssetType . |
packages/loader/src/ScriptLoader.ts | Introduced ScriptLoader class extending Loader , with an interface ESModule and a load(item: LoadItem): AssetPromise<ESModule> method. |
packages/loader/src/index.ts | Added import and export for ScriptLoader . |
tests/src/loader/ScriptLoader.test.ts | Created unit tests for ScriptLoader , verifying loading from URL and Blob, including an interface ESModule . |
packages/core/src/animation/Keyframe.ts | Reformatted conditional type expressions for readability in Keyframe class without changing logic. |
packages/core/src/animation/internal/animationCurveOwner/AnimationCurveOwner.ts | Reformatted conditional expressions for readability in methods of AnimationCurveOwner class without changing logic. |
rollup.config.js | Added a newline at the end of the file. |
In the meadow where scripts play,
A new type hops in, hip-hip-hooray!
WithScriptLoader
to fetch and find,
Our code now dances, oh so refined.
ThroughAssetType
, we grow and gleam,
A rabbit's joy, a coder's dream! 🐇✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Consider whether or not to use dynamic-import-polyfill
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 69.47%. Comparing base (
f3400c8
) to head (2a1e40d
). Report is 58 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Feature:
ScriptLoader
AssetType.Script
What is the current behavior? (You can also link to an open issue here)
What is the new behavior (if this is a feature change)?
Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
Other information:
Summary by CodeRabbit
New Features
Script
asset type for better asset management.ScriptLoader
class for loading script assets efficiently, supporting both "js" and "mjs" file types.ScriptLoader
andESModule
for broader use.Bug Fixes
Tests
ScriptLoader
functionality, verifying script loading from both URL and Blob sources.