@rbxts/covenant 3.6.0 → 3.7.1
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/package.json +48 -48
- package/src/covenant.luau +1 -15
- package/src/hooks.d.ts +2 -6
- package/src/hooks.luau +12 -4
package/package.json
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@rbxts/covenant",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"main": "src/init.luau",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"build": "rbxtsc",
|
|
7
|
-
"watch": "rbxtsc -w",
|
|
8
|
-
"prepublishOnly": "npm run build"
|
|
9
|
-
},
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/cuberootmctoasted/covenant.git"
|
|
13
|
-
},
|
|
14
|
-
"keywords": [],
|
|
15
|
-
"author": "",
|
|
16
|
-
"license": "ISC",
|
|
17
|
-
"bugs": {
|
|
18
|
-
"url": "https://github.com/cuberootmctoasted/covenant/issues"
|
|
19
|
-
},
|
|
20
|
-
"homepage": "https://github.com/cuberootmctoasted/covenant#readme",
|
|
21
|
-
"description": "",
|
|
22
|
-
"types": "src/covenant.d.ts",
|
|
23
|
-
"files": [
|
|
24
|
-
"src",
|
|
25
|
-
"!**/*.tsbuildinfo"
|
|
26
|
-
],
|
|
27
|
-
"publishConfig": {
|
|
28
|
-
"access": "public"
|
|
29
|
-
},
|
|
30
|
-
"devDependencies": {
|
|
31
|
-
"@rbxts/compiler-types": "^3.0.0-types.0",
|
|
32
|
-
"@rbxts/covenant": "^2.1.1",
|
|
33
|
-
"@rbxts/types": "^1.0.891",
|
|
34
|
-
"@typescript-eslint/eslint-plugin": "^8.47.0",
|
|
35
|
-
"@typescript-eslint/parser": "^8.47.0",
|
|
36
|
-
"eslint": "^9.39.1",
|
|
37
|
-
"eslint-config-prettier": "^10.1.8",
|
|
38
|
-
"eslint-plugin-prettier": "^5.5.4",
|
|
39
|
-
"eslint-plugin-roblox-ts": "^1.3.0",
|
|
40
|
-
"prettier": "^3.6.2",
|
|
41
|
-
"roblox-ts": "^3.0.0",
|
|
42
|
-
"typescript": "^5.9.3"
|
|
43
|
-
},
|
|
44
|
-
"dependencies": {
|
|
45
|
-
"@rbxts/jecs": "^0.9.0",
|
|
46
|
-
"@rbxts/services": "^1.6.0"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@rbxts/covenant",
|
|
3
|
+
"version": "3.7.1",
|
|
4
|
+
"main": "src/init.luau",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "rbxtsc",
|
|
7
|
+
"watch": "rbxtsc -w",
|
|
8
|
+
"prepublishOnly": "npm run build"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/cuberootmctoasted/covenant.git"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [],
|
|
15
|
+
"author": "",
|
|
16
|
+
"license": "ISC",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/cuberootmctoasted/covenant/issues"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://github.com/cuberootmctoasted/covenant#readme",
|
|
21
|
+
"description": "",
|
|
22
|
+
"types": "src/covenant.d.ts",
|
|
23
|
+
"files": [
|
|
24
|
+
"src",
|
|
25
|
+
"!**/*.tsbuildinfo"
|
|
26
|
+
],
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@rbxts/compiler-types": "^3.0.0-types.0",
|
|
32
|
+
"@rbxts/covenant": "^2.1.1",
|
|
33
|
+
"@rbxts/types": "^1.0.891",
|
|
34
|
+
"@typescript-eslint/eslint-plugin": "^8.47.0",
|
|
35
|
+
"@typescript-eslint/parser": "^8.47.0",
|
|
36
|
+
"eslint": "^9.39.1",
|
|
37
|
+
"eslint-config-prettier": "^10.1.8",
|
|
38
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
39
|
+
"eslint-plugin-roblox-ts": "^1.3.0",
|
|
40
|
+
"prettier": "^3.6.2",
|
|
41
|
+
"roblox-ts": "^3.0.0",
|
|
42
|
+
"typescript": "^5.9.3"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@rbxts/jecs": "^0.9.0",
|
|
46
|
+
"@rbxts/services": "^1.6.0"
|
|
47
|
+
}
|
|
48
|
+
}
|
package/src/covenant.luau
CHANGED
|
@@ -578,21 +578,7 @@ do
|
|
|
578
578
|
end
|
|
579
579
|
local hooks = createHooks({
|
|
580
580
|
indicateUpdate = indicateUpdate,
|
|
581
|
-
|
|
582
|
-
self:subscribeComponent(component, subscriber)
|
|
583
|
-
end,
|
|
584
|
-
getPayloadQueue = function(component)
|
|
585
|
-
local queue = {}
|
|
586
|
-
for entity, state in self:worldQuery(component) do
|
|
587
|
-
local _arg0 = {
|
|
588
|
-
entity = entity,
|
|
589
|
-
state = state,
|
|
590
|
-
previousState = nil,
|
|
591
|
-
}
|
|
592
|
-
table.insert(queue, _arg0)
|
|
593
|
-
end
|
|
594
|
-
return queue
|
|
595
|
-
end,
|
|
581
|
+
covenant = self,
|
|
596
582
|
})
|
|
597
583
|
-- ▼ ReadonlyArray.map ▼
|
|
598
584
|
local _newValue = table.create(#queriedComponents)
|
package/src/hooks.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Entity } from "@rbxts/jecs";
|
|
2
|
+
import { Covenant } from "./covenant";
|
|
2
3
|
type AsyncResult<T = unknown> = {
|
|
3
4
|
completed: boolean;
|
|
4
5
|
value: T | undefined;
|
|
@@ -23,12 +24,7 @@ export interface CovenantHooks {
|
|
|
23
24
|
}
|
|
24
25
|
interface CovenantHooksProps {
|
|
25
26
|
indicateUpdate: () => void;
|
|
26
|
-
|
|
27
|
-
getPayloadQueue: <T extends defined>(component: Entity<T>) => {
|
|
28
|
-
entity: Entity;
|
|
29
|
-
state: T | undefined;
|
|
30
|
-
previousState: T | undefined;
|
|
31
|
-
}[];
|
|
27
|
+
covenant: Covenant;
|
|
32
28
|
}
|
|
33
29
|
export declare function createHooks(props: CovenantHooksProps): CovenantHooks;
|
|
34
30
|
export {};
|
package/src/hooks.luau
CHANGED
|
@@ -77,9 +77,8 @@ local function createUseEventImmediately(_param)
|
|
|
77
77
|
end
|
|
78
78
|
end
|
|
79
79
|
local function createUseComponentChange(_param)
|
|
80
|
-
local
|
|
80
|
+
local covenant = _param.covenant
|
|
81
81
|
local indicateUpdate = _param.indicateUpdate
|
|
82
|
-
local getPayloadQueue = _param.getPayloadQueue
|
|
83
82
|
local queues = {}
|
|
84
83
|
local watchedStringifiedComponents = {}
|
|
85
84
|
local caches = {}
|
|
@@ -100,7 +99,7 @@ local function createUseComponentChange(_param)
|
|
|
100
99
|
if not (watchedStringifiedComponents[stringifiedComponent] ~= nil) then
|
|
101
100
|
watchedStringifiedComponents[stringifiedComponent] = true
|
|
102
101
|
queues[stringifiedComponent] = {}
|
|
103
|
-
subscribeComponent(component, function(entity, state, previousState)
|
|
102
|
+
covenant:subscribeComponent(component, function(entity, state, previousState)
|
|
104
103
|
local _exp = queues[stringifiedComponent]
|
|
105
104
|
local _arg0 = {
|
|
106
105
|
entity = entity,
|
|
@@ -114,7 +113,16 @@ local function createUseComponentChange(_param)
|
|
|
114
113
|
if not payload then
|
|
115
114
|
return {}
|
|
116
115
|
else
|
|
117
|
-
|
|
116
|
+
local payloadQueue = {}
|
|
117
|
+
for entity, state in covenant:worldQuery(component) do
|
|
118
|
+
local _arg0 = {
|
|
119
|
+
entity = entity,
|
|
120
|
+
state = state,
|
|
121
|
+
previousState = nil,
|
|
122
|
+
}
|
|
123
|
+
table.insert(payloadQueue, _arg0)
|
|
124
|
+
end
|
|
125
|
+
return payloadQueue
|
|
118
126
|
end
|
|
119
127
|
end
|
|
120
128
|
local queue = queues[stringifiedComponent]
|