pacc 4.39.3 → 4.40.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/package.json +3 -3
- package/src/filter.mjs +3 -3
- package/src/types.mjs +18 -7
- package/types/types.d.mts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pacc",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.40.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"ava": "^6.4.1",
|
|
42
|
-
"browser-ava": "^2.3.
|
|
42
|
+
"browser-ava": "^2.3.41",
|
|
43
43
|
"c8": "^10.1.3",
|
|
44
44
|
"documentation": "^14.0.3",
|
|
45
|
-
"semantic-release": "^
|
|
45
|
+
"semantic-release": "^25.0.0",
|
|
46
46
|
"typescript": "^5.9.3"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
package/src/filter.mjs
CHANGED
|
@@ -36,12 +36,12 @@ function allOp(op, value, against) {
|
|
|
36
36
|
if (value instanceof Map) {
|
|
37
37
|
return collectionOp(op, value.keys(), against);
|
|
38
38
|
}
|
|
39
|
-
if (value instanceof RegExp) {
|
|
40
|
-
return value.test(against);
|
|
41
|
-
}
|
|
42
39
|
if (value[Symbol.iterator]) {
|
|
43
40
|
return collectionOp(op, value, against);
|
|
44
41
|
}
|
|
42
|
+
if (value instanceof RegExp) {
|
|
43
|
+
return value.test(against);
|
|
44
|
+
}
|
|
45
45
|
|
|
46
46
|
switch (typeof against) {
|
|
47
47
|
case "object":
|
package/src/types.mjs
CHANGED
|
@@ -30,15 +30,20 @@ export const types = {
|
|
|
30
30
|
object: { name: "object" }
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
function error(message) {
|
|
33
|
+
export function error(message) {
|
|
34
34
|
throw new Error(message);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export function addType(type) {
|
|
38
|
-
if (type
|
|
38
|
+
if (type.typeDefinition) {
|
|
39
39
|
const clazz = type;
|
|
40
40
|
type = type.typeDefinition;
|
|
41
41
|
type.clazz = clazz;
|
|
42
|
+
} else {
|
|
43
|
+
if (!!type?.constructor.name) {
|
|
44
|
+
const clazz = type;
|
|
45
|
+
type.clazz = clazz;
|
|
46
|
+
}
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
if (types[type.name]) {
|
|
@@ -51,12 +56,18 @@ export function addType(type) {
|
|
|
51
56
|
type.owners = [];
|
|
52
57
|
}
|
|
53
58
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
const ex = Object.getPrototypeOf(type.clazz);
|
|
60
|
+
|
|
61
|
+
if (ex?.name) {
|
|
62
|
+
type.extends = ex.typeDefinition || ex;
|
|
63
|
+
} else {
|
|
64
|
+
if (typeof type.extends === "string") {
|
|
65
|
+
const ex = types[type.extends];
|
|
66
|
+
if (!ex) {
|
|
67
|
+
error(`${type.name}: missing type '${type.extends}'`);
|
|
68
|
+
}
|
|
69
|
+
type.extends = ex;
|
|
58
70
|
}
|
|
59
|
-
type.extends = ex;
|
|
60
71
|
}
|
|
61
72
|
|
|
62
73
|
for (const [path, attribute] of attributeIterator(type.attributes)) {
|
package/types/types.d.mts
CHANGED