@quenty/loader 10.3.0 → 10.3.1-canary.478.013677d.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
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.3.1-canary.478.013677d.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/loader@10.3.0...@quenty/loader@10.3.1-canary.478.013677d.0) (2024-08-24)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Unedited all changes ([60e64e3](https://github.com/Quenty/NevermoreEngine/commit/60e64e3efce17c10c4b8965871187d231b338dd4))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [10.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/loader@10.2.0...@quenty/loader@10.3.0) (2024-05-09)
|
|
7
18
|
|
|
8
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/loader",
|
|
3
|
-
"version": "10.3.0",
|
|
3
|
+
"version": "10.3.1-canary.478.013677d.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": "013677ddf1f34b223c027d332d00450722b8fd41"
|
|
30
30
|
}
|
|
@@ -68,7 +68,7 @@ function DependencyUtils.iterPackages(requester)
|
|
|
68
68
|
assert(typeof(requester) == "Instance", "Bad requester")
|
|
69
69
|
|
|
70
70
|
return coroutine.wrap(function()
|
|
71
|
-
for nodeModules in DependencyUtils.
|
|
71
|
+
for nodeModules in DependencyUtils.iterNodeModulesUp(requester) do
|
|
72
72
|
coroutine.yield(nodeModules.Parent)
|
|
73
73
|
|
|
74
74
|
for packageInst in DependencyUtils.iterPackagesInModuleModules(nodeModules) do
|
|
@@ -78,7 +78,7 @@ function DependencyUtils.iterPackages(requester)
|
|
|
78
78
|
end)
|
|
79
79
|
end
|
|
80
80
|
|
|
81
|
-
function DependencyUtils.
|
|
81
|
+
function DependencyUtils.iterNodeModulesUp(module)
|
|
82
82
|
assert(typeof(module) == "Instance", "Bad module")
|
|
83
83
|
|
|
84
84
|
return coroutine.wrap(function()
|
|
@@ -16,6 +16,7 @@ function PackageTrackerProvider.new()
|
|
|
16
16
|
|
|
17
17
|
self._maid = Maid.new()
|
|
18
18
|
self._packageTrackersRoots = {}
|
|
19
|
+
self._trackCount = 0
|
|
19
20
|
|
|
20
21
|
return self
|
|
21
22
|
end
|
|
@@ -27,6 +28,8 @@ function PackageTrackerProvider:AddPackageRoot(instance)
|
|
|
27
28
|
return self._packageTrackersRoots[instance]
|
|
28
29
|
end
|
|
29
30
|
|
|
31
|
+
self._trackCount = self._trackCount + 1
|
|
32
|
+
|
|
30
33
|
local maid = Maid.new()
|
|
31
34
|
|
|
32
35
|
self._packageTrackersRoots[instance] = maid:Add(PackageTracker.new(self, instance))
|
|
@@ -42,12 +45,7 @@ end
|
|
|
42
45
|
function PackageTrackerProvider:FindPackageTracker(instance)
|
|
43
46
|
assert(typeof(instance) == "Instance", "Bad instance")
|
|
44
47
|
|
|
45
|
-
local
|
|
46
|
-
if found then
|
|
47
|
-
return found
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
local current = instance.Parent
|
|
48
|
+
local current = instance
|
|
51
49
|
while current do
|
|
52
50
|
if self._packageTrackersRoots[current] then
|
|
53
51
|
return self._packageTrackersRoots[current]
|
package/src/init.lua
CHANGED
|
@@ -18,6 +18,9 @@ local Replicator = require(script.Replication.Replicator)
|
|
|
18
18
|
local ReplicatorReferences = require(script.Replication.ReplicatorReferences)
|
|
19
19
|
|
|
20
20
|
local GLOBAL_PACKAGE_TRACKER = PackageTrackerProvider.new()
|
|
21
|
+
script.Destroying:Connect(function()
|
|
22
|
+
GLOBAL_PACKAGE_TRACKER:Destroy()
|
|
23
|
+
end)
|
|
21
24
|
|
|
22
25
|
local Loader = {}
|
|
23
26
|
Loader.__index = Loader
|
|
@@ -43,7 +46,7 @@ function Loader.bootstrapGame(packages)
|
|
|
43
46
|
local self = Loader.new(packages, ReplicationTypeUtils.inferReplicationType())
|
|
44
47
|
|
|
45
48
|
if self._replicationType == ReplicationType.SERVER then
|
|
46
|
-
self:_setupLoaderPopulation()
|
|
49
|
+
self:_setupLoaderPopulation(self._packages)
|
|
47
50
|
|
|
48
51
|
-- Trade off security for performance
|
|
49
52
|
if RunService:IsStudio() then
|
|
@@ -63,7 +66,7 @@ function Loader.bootstrapPlugin(packages)
|
|
|
63
66
|
|
|
64
67
|
local self = Loader.new(packages, ReplicationType.PLUGIN)
|
|
65
68
|
|
|
66
|
-
self:_setupLoaderPopulation()
|
|
69
|
+
self:_setupLoaderPopulation(self._packages)
|
|
67
70
|
|
|
68
71
|
GLOBAL_PACKAGE_TRACKER:AddPackageRoot(packages)
|
|
69
72
|
|
|
@@ -74,18 +77,19 @@ function Loader.bootstrapStory(storyScript)
|
|
|
74
77
|
assert(typeof(storyScript) == "Instance", "Bad storyScript")
|
|
75
78
|
|
|
76
79
|
-- Prepopulate global package roots
|
|
77
|
-
local
|
|
78
|
-
for node_modules in DependencyUtils.
|
|
79
|
-
|
|
80
|
-
topNodeModule = node_modules
|
|
81
|
-
end
|
|
80
|
+
local topNodeModules = storyScript
|
|
81
|
+
for node_modules in DependencyUtils.iterNodeModulesUp(storyScript) do
|
|
82
|
+
topNodeModules = node_modules
|
|
82
83
|
end
|
|
83
84
|
|
|
84
|
-
local self = Loader.new(
|
|
85
|
+
local self = Loader.new(storyScript, ReplicationType.PLUGIN)
|
|
86
|
+
|
|
87
|
+
local root = topNodeModules.Parent
|
|
85
88
|
|
|
86
|
-
self:_setupLoaderPopulation()
|
|
89
|
+
self:_setupLoaderPopulation(root)
|
|
87
90
|
|
|
88
|
-
|
|
91
|
+
-- Track the package root
|
|
92
|
+
GLOBAL_PACKAGE_TRACKER:AddPackageRoot(root)
|
|
89
93
|
|
|
90
94
|
return self
|
|
91
95
|
end
|
|
@@ -144,7 +148,7 @@ function Loader:_findDependency(request)
|
|
|
144
148
|
-- Just standard dependency search
|
|
145
149
|
local foundBackup = DependencyUtils.findDependency(self._packages, request, self._replicationType)
|
|
146
150
|
if foundBackup then
|
|
147
|
-
warn(string.format("[Loader] - Failed to find package %q in package tracker\n%s", request, debug.traceback()))
|
|
151
|
+
warn(string.format("[Loader] - Failed to find package %q in package tracker of root %s\n%s", request, self._packages:GetFullName(), debug.traceback()))
|
|
148
152
|
|
|
149
153
|
-- Ensure hoarcekat story has a link to use
|
|
150
154
|
-- TODO: Maybe add to global package cache instead...
|
|
@@ -177,8 +181,8 @@ function Loader:_setupClientReplication()
|
|
|
177
181
|
copy.Parent = ReplicatedStorage
|
|
178
182
|
end
|
|
179
183
|
|
|
180
|
-
function Loader:_setupLoaderPopulation()
|
|
181
|
-
self._maid:Add(LoaderLinkCreator.new(
|
|
184
|
+
function Loader:_setupLoaderPopulation(root)
|
|
185
|
+
self._maid:Add(LoaderLinkCreator.new(root, nil, true))
|
|
182
186
|
end
|
|
183
187
|
|
|
184
188
|
function Loader:Destroy()
|