@quenty/loader 10.6.0 → 10.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/CHANGELOG.md +11 -0
- package/package.json +2 -2
- package/src/Maid.lua +11 -0
- package/src/Replication/Replicator.lua +40 -1
- package/src/init.lua +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [10.7.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/loader@10.6.0...@quenty/loader@10.7.0) (2024-10-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Replicator replicates attributes and tags properly ([3c7f020](https://github.com/Quenty/NevermoreEngine/commit/3c7f020c61a0c378ef84f8a49dcd7f070ec2c6c5))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [10.6.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/loader@10.5.0...@quenty/loader@10.6.0) (2024-10-04)
|
|
7
18
|
|
|
8
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/loader",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.7.0",
|
|
4
4
|
"description": "A simple module loader for Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "67c5dbf46f6f45213812f3f117419a5534936a0b"
|
|
30
30
|
}
|
package/src/Maid.lua
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
maid:DoCleaning()
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
+
@ignore
|
|
21
22
|
@class Maid
|
|
22
23
|
]]
|
|
23
24
|
-- luacheck: pop
|
|
@@ -32,6 +33,7 @@ Maid.ClassName = "Maid"
|
|
|
32
33
|
local maid = Maid.new()
|
|
33
34
|
```
|
|
34
35
|
|
|
36
|
+
@ignore
|
|
35
37
|
@return Maid
|
|
36
38
|
]=]
|
|
37
39
|
function Maid.new()
|
|
@@ -48,6 +50,7 @@ end
|
|
|
48
50
|
print(Maid.isMaid(nil)) --> false
|
|
49
51
|
```
|
|
50
52
|
|
|
53
|
+
@ignore
|
|
51
54
|
@param value any
|
|
52
55
|
@return boolean
|
|
53
56
|
]=]
|
|
@@ -67,6 +70,7 @@ end
|
|
|
67
70
|
print(maid._current) --> nil
|
|
68
71
|
```
|
|
69
72
|
|
|
73
|
+
@ignore
|
|
70
74
|
@param index any
|
|
71
75
|
@return MaidTask
|
|
72
76
|
]=]
|
|
@@ -94,6 +98,7 @@ end
|
|
|
94
98
|
Maid[key] = nil Removes a named task.
|
|
95
99
|
```
|
|
96
100
|
|
|
101
|
+
@ignore
|
|
97
102
|
@param index any
|
|
98
103
|
@param newTask MaidTask
|
|
99
104
|
]=]
|
|
@@ -143,6 +148,7 @@ end
|
|
|
143
148
|
--[=[
|
|
144
149
|
Gives a task to the maid for cleanup and returns the resulting value
|
|
145
150
|
|
|
151
|
+
@ignore
|
|
146
152
|
@param task MaidTask -- An item to clean
|
|
147
153
|
@return MaidTask
|
|
148
154
|
]=]
|
|
@@ -163,6 +169,7 @@ end
|
|
|
163
169
|
--[=[
|
|
164
170
|
Gives a task to the maid for cleanup, but uses an incremented number as a key.
|
|
165
171
|
|
|
172
|
+
@ignore
|
|
166
173
|
@param task MaidTask -- An item to clean
|
|
167
174
|
@return number -- taskId
|
|
168
175
|
]=]
|
|
@@ -184,6 +191,7 @@ end
|
|
|
184
191
|
--[=[
|
|
185
192
|
Gives a promise to the maid for clean.
|
|
186
193
|
|
|
194
|
+
@ignore
|
|
187
195
|
@param promise Promise<T>
|
|
188
196
|
@return Promise<T>
|
|
189
197
|
]=]
|
|
@@ -218,6 +226,8 @@ end
|
|
|
218
226
|
However, adding tasks while cleaning is not generally a good idea, as if you add a
|
|
219
227
|
function that adds itself, this will loop indefinitely.
|
|
220
228
|
:::
|
|
229
|
+
|
|
230
|
+
@ignore
|
|
221
231
|
]=]
|
|
222
232
|
function Maid:DoCleaning()
|
|
223
233
|
local tasks = self._tasks
|
|
@@ -265,6 +275,7 @@ end
|
|
|
265
275
|
--[=[
|
|
266
276
|
Alias for [Maid.DoCleaning()](/api/Maid#DoCleaning)
|
|
267
277
|
|
|
278
|
+
@ignore
|
|
268
279
|
@function Destroy
|
|
269
280
|
@within Maid
|
|
270
281
|
]=]
|
|
@@ -307,6 +307,7 @@ function Replicator:_doStandardReplication(maid, replicator, child, copy)
|
|
|
307
307
|
assert(typeof(child) == "Instance", "Bad child")
|
|
308
308
|
|
|
309
309
|
self:_setupAttributeReplication(maid, child, copy)
|
|
310
|
+
self:_setupTagReplication(maid, child, copy)
|
|
310
311
|
self:_setupNameReplication(maid, child, copy)
|
|
311
312
|
self:_setupParentReplication(maid, copy)
|
|
312
313
|
self:_setupReference(maid, child, copy)
|
|
@@ -467,6 +468,44 @@ function Replicator:_setupParentReplication(maid, copy)
|
|
|
467
468
|
copy.Parent = self._target.Value
|
|
468
469
|
end
|
|
469
470
|
|
|
471
|
+
--[[
|
|
472
|
+
Sets up tag replication explicitly.
|
|
473
|
+
|
|
474
|
+
@param maid Maid
|
|
475
|
+
@param child Instance
|
|
476
|
+
@param copy Instance
|
|
477
|
+
]]
|
|
478
|
+
function Replicator:_setupTagReplication(maid, child, copy)
|
|
479
|
+
assert(Maid.isMaid(maid), "Bad maid")
|
|
480
|
+
assert(typeof(child) == "Instance", "Bad child")
|
|
481
|
+
assert(typeof(copy) == "Instance", "Bad copy")
|
|
482
|
+
|
|
483
|
+
for _, tag in pairs(child:GetTags()) do
|
|
484
|
+
copy:AddTag(tag)
|
|
485
|
+
end
|
|
486
|
+
|
|
487
|
+
maid:GiveTask(child.Changed:Connect(function(property)
|
|
488
|
+
if property == "Tags" then
|
|
489
|
+
local ourTagSet = {}
|
|
490
|
+
for _, tag in pairs(copy:GetTags()) do
|
|
491
|
+
ourTagSet[tag] = true
|
|
492
|
+
end
|
|
493
|
+
|
|
494
|
+
for _, tag in pairs(child:GetTags()) do
|
|
495
|
+
if not ourTagSet[tag] then
|
|
496
|
+
copy:AddTag(tag)
|
|
497
|
+
end
|
|
498
|
+
|
|
499
|
+
ourTagSet[tag] = nil
|
|
500
|
+
end
|
|
501
|
+
|
|
502
|
+
for tag, _ in pairs(ourTagSet) do
|
|
503
|
+
copy:RemoveTag(tag)
|
|
504
|
+
end
|
|
505
|
+
end
|
|
506
|
+
end))
|
|
507
|
+
end
|
|
508
|
+
|
|
470
509
|
--[[
|
|
471
510
|
Sets up the object value replication to point towards new values.
|
|
472
511
|
|
|
@@ -528,7 +567,7 @@ end
|
|
|
528
567
|
|
|
529
568
|
function Replicator:_setupAttributeReplication(maid, child, copy)
|
|
530
569
|
for key, value in pairs(child:GetAttributes()) do
|
|
531
|
-
|
|
570
|
+
copy:SetAttribute(key, value)
|
|
532
571
|
end
|
|
533
572
|
|
|
534
573
|
maid:GiveTask(child.AttributeChanged:Connect(function(attribute)
|
package/src/init.lua
CHANGED
|
@@ -148,7 +148,11 @@ function Loader:_findDependency(request)
|
|
|
148
148
|
-- Just standard dependency search
|
|
149
149
|
local foundBackup = DependencyUtils.findDependency(self._packages, request, self._replicationType)
|
|
150
150
|
if foundBackup then
|
|
151
|
-
|
|
151
|
+
if packageTracker then
|
|
152
|
+
warn(string.format("[Loader] - No package tracker for root %s (while loading %s)\n%s", self._packages:GetFullName(), request, debug.traceback()))
|
|
153
|
+
else
|
|
154
|
+
warn(string.format("[Loader] - Failed to find package %q in package tracker of root %s\n%s", request, self._packages:GetFullName(), debug.traceback()))
|
|
155
|
+
end
|
|
152
156
|
|
|
153
157
|
-- Ensure hoarcekat story has a link to use
|
|
154
158
|
-- TODO: Maybe add to global package cache instead...
|