@quenty/ducktype 3.0.0-canary.c90a5c7.0 → 3.0.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 +53 -1
- package/package.json +3 -3
- package/src/Shared/DuckTypeUtils.lua +22 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,59 @@
|
|
|
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
|
-
# [3.0.0
|
|
6
|
+
# [3.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/ducktype@2.2.0...@quenty/ducktype@3.0.0) (2024-02-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* New loader (breaking changes), fixing loader issues ([#439](https://github.com/Quenty/NevermoreEngine/issues/439)) ([3534345](https://github.com/Quenty/NevermoreEngine/commit/353434522918812953bd9f13fece73e27a4d034d))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* Standard loader
|
|
17
|
+
|
|
18
|
+
Adds new loader version which replicates full structure instead of some partial structure. This allows us to have hot-reloading (in the future), as well as generally do less computation, handle dependencies more carefully, and other changes.
|
|
19
|
+
|
|
20
|
+
This means you'll need to change you how require client-side modules, as we export a simple `loader` module instead of all modules available.
|
|
21
|
+
|
|
22
|
+
Signed-off-by: James Onnen <jonnen0@gmail.com>
|
|
23
|
+
|
|
24
|
+
* fix: Fix missing dependency in ResetService
|
|
25
|
+
|
|
26
|
+
* feat: Add RxPhysicsUtils.observePartMass
|
|
27
|
+
|
|
28
|
+
* fix: Fix package discovery for games
|
|
29
|
+
|
|
30
|
+
* feat: Add UIAlignmentUtils.verticalToHorizontalAlignment(verticalAlignment) and UIAlignmentUtils.horizontalToVerticalAlignment(horizontalAlignment)
|
|
31
|
+
|
|
32
|
+
* feat: AdorneeData:InitAttributes() does not require data as a secondparameter
|
|
33
|
+
|
|
34
|
+
* ci: Upgrade to new rojo 7.4.0
|
|
35
|
+
|
|
36
|
+
* fix: Update loader to handle hoarcekat properly
|
|
37
|
+
|
|
38
|
+
* docs: Fix spacing in Maid
|
|
39
|
+
|
|
40
|
+
* fix: Add new ragdoll constants
|
|
41
|
+
|
|
42
|
+
* fix: Compress influxDB sends
|
|
43
|
+
|
|
44
|
+
* style: Errors use string.format
|
|
45
|
+
|
|
46
|
+
* fix: Handle motor animations
|
|
47
|
+
|
|
48
|
+
* ci: Upgrade rojo version
|
|
49
|
+
|
|
50
|
+
* feat!: Maid no longer is includd in ValueObject.Changed event
|
|
51
|
+
|
|
52
|
+
* docs: Fix docs
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
# [2.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/ducktype@2.1.0...@quenty/ducktype@2.2.0) (2024-01-08)
|
|
7
59
|
|
|
8
60
|
**Note:** Version bump only for package @quenty/ducktype
|
|
9
61
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/ducktype",
|
|
3
|
-
"version": "3.0.0
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Utility functions to duck type a value",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/loader": "8.0.0
|
|
28
|
+
"@quenty/loader": "^8.0.0"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "5736b108e4d23cd4c9e761bbe4cc9fed6fb32dfa"
|
|
34
34
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
--[=[
|
|
2
|
+
Utility method to check interface is equivalent for two implementations
|
|
3
|
+
|
|
2
4
|
@class DuckTypeUtils
|
|
3
5
|
]=]
|
|
4
6
|
|
|
@@ -6,6 +8,13 @@ local require = require(script.Parent.loader).load(script)
|
|
|
6
8
|
|
|
7
9
|
local DuckTypeUtils = {}
|
|
8
10
|
|
|
11
|
+
--[=[
|
|
12
|
+
Returns true if a template is similar to a target
|
|
13
|
+
|
|
14
|
+
@param template table
|
|
15
|
+
@param target any
|
|
16
|
+
@return boolean
|
|
17
|
+
]=]
|
|
9
18
|
function DuckTypeUtils.isImplementation(template, target)
|
|
10
19
|
assert(type(template) == "table", "Bad template")
|
|
11
20
|
|
|
@@ -14,6 +23,17 @@ function DuckTypeUtils.isImplementation(template, target)
|
|
|
14
23
|
end
|
|
15
24
|
|
|
16
25
|
function DuckTypeUtils._checkInterface(template, target)
|
|
26
|
+
local targetMetatable = getmetatable(target)
|
|
27
|
+
local templateMetatable = getmetatable(template)
|
|
28
|
+
if targetMetatable and type(targetMetatable.__index) == "function" then
|
|
29
|
+
-- Indexing into this target could cause an error. Treat it differently and fast-fail
|
|
30
|
+
if templateMetatable then
|
|
31
|
+
return targetMetatable.__index == templateMetatable.__index
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
return false
|
|
35
|
+
end
|
|
36
|
+
|
|
17
37
|
for key, value in pairs(template) do
|
|
18
38
|
if type(value) == "function" and type(target[key]) ~= "function" then
|
|
19
39
|
return false
|
|
@@ -21,9 +41,8 @@ function DuckTypeUtils._checkInterface(template, target)
|
|
|
21
41
|
end
|
|
22
42
|
|
|
23
43
|
-- TODO: Prevent infinite recursion potential
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return DuckTypeUtils._checkInterface(metatable.__index, target)
|
|
44
|
+
if templateMetatable and type(templateMetatable.__index) == "table" then
|
|
45
|
+
return DuckTypeUtils._checkInterface(templateMetatable.__index, target)
|
|
27
46
|
end
|
|
28
47
|
|
|
29
48
|
return true
|