-
-
Notifications
You must be signed in to change notification settings - Fork 309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Add dependency map #2476
base: dev/1.4
Are you sure you want to change the base?
Feat: Add dependency map #2476
Changes from 24 commits
c3b2aef
e82a3fc
ba86d40
880cb70
de6f83c
97a13a7
5d0f426
5e7d7ab
d10530b
8ca3c9c
98042c1
1130b13
94b7be4
f5a51b0
5bf17b3
f739fcf
8a9a2e2
8de27d3
a6eb435
ff7ca78
d79fd47
c534e51
5174b59
b54f336
6b1c196
9a413e6
4155cc1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -556,6 +556,8 @@ export class ResourceManager { | |||||||||||||||||
_editorResourceConfig: EditorResourceConfig = Object.create(null); | ||||||||||||||||||
/** @internal */ | ||||||||||||||||||
_virtualPathMap: Record<string, string> = Object.create(null); | ||||||||||||||||||
/** @internal */ | ||||||||||||||||||
_dependencyMap: Record<string, { [key: string]: string }> = Object.create(null); | ||||||||||||||||||
|
||||||||||||||||||
/** | ||||||||||||||||||
* @internal | ||||||||||||||||||
|
@@ -593,6 +595,7 @@ export class ResourceManager { | |||||||||||||||||
initVirtualResources(config: EditorResourceItem[]): void { | ||||||||||||||||||
config.forEach((element) => { | ||||||||||||||||||
this._virtualPathMap[element.virtualPath] = element.path; | ||||||||||||||||||
element.depndentAssets && this._dependencyMap[element.virtualPath] = element.depndentAssets; | ||||||||||||||||||
this._editorResourceConfig[element.id] = element; | ||||||||||||||||||
}); | ||||||||||||||||||
} | ||||||||||||||||||
|
@@ -631,8 +634,8 @@ const rePropName = RegExp( | |||||||||||||||||
"g" | ||||||||||||||||||
); | ||||||||||||||||||
|
||||||||||||||||||
type EditorResourceItem = { virtualPath: string; path: string; type: string; id: string }; | ||||||||||||||||||
type EditorResourceConfig = Record<string, EditorResourceItem>; | ||||||||||||||||||
type EditorResourceItem = { virtualPath: string; path: string; type: string; id: string, depndentAssets: { [key: string]: string } }; | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Address ESLint’s formatting recommendations and fix the property name. Use multiline for readability, and correct the property name to Below is a suggested diff: - type EditorResourceItem = { virtualPath: string; path: string; type: string; id: string, depndentAssets: { [key: string]: string } };
+ type EditorResourceItem = {
+ virtualPath: string;
+ path: string;
+ type: string;
+ id: string;
+ dependentAssets: { [key: string]: string };
+ }; 📝 Committable suggestion
Suggested change
🧰 Tools🪛 eslint[error] 637-637: Replace (prettier/prettier) 🪛 GitHub Check: lint[failure] 637-637: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||||||||||
type EditorResourceConfig = Record< string, EditorResourceItem >; | ||||||||||||||||||
type SubAssetPromiseCallbacks<T> = Record< | ||||||||||||||||||
// main asset url, ie. "https://***.glb" | ||||||||||||||||||
string, | ||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix assignment syntax and add null check.
The current implementation has several issues:
depndentAssets
Apply this diff to fix the issues:
📝 Committable suggestion
🧰 Tools
🪛 Biome (1.9.4)
[error] 598-598: Invalid assignment to
element.depndentAssets && this._dependencyMap[element.virtualPath]
This expression cannot be assigned to
(parse)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johanzhu, thanks for confirming the fix has been applied! Nice work.
If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!