@react-analyzer/core 0.0.3-next.3 → 0.0.3-next.5
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/dist/index.d.ts +96 -91
- package/dist/index.js +108 -114
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,61 +1,64 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { isFalseLiteralType, isTrueLiteralType } from "ts-api-utils";
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
import { unit } from "@react-analyzer/eff";
|
|
4
|
+
import { AST, Context } from "tsl";
|
|
5
5
|
|
|
6
|
+
//#region src/semantic/semantic-entry.d.ts
|
|
6
7
|
interface SemanticEntry {
|
|
7
|
-
|
|
8
|
+
node: AST.AnyNode;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/semantic/semantic-node.d.ts
|
|
10
12
|
interface SemanticNode {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
id: unit | AST.Identifier | AST.Identifier[];
|
|
14
|
+
key: string;
|
|
15
|
+
kind: string;
|
|
16
|
+
name: unit | string;
|
|
17
|
+
node: AST.AnyNode;
|
|
18
|
+
flag: bigint;
|
|
19
|
+
hint: bigint;
|
|
18
20
|
}
|
|
19
|
-
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/type/type-is.d.ts
|
|
20
23
|
declare const isAnyType: (type: ts.Type) => boolean;
|
|
21
24
|
declare const isBigIntType: (type: ts.Type) => boolean;
|
|
22
25
|
declare const isBooleanType: (type: ts.Type) => boolean;
|
|
23
26
|
declare const isEnumType: (type: ts.Type) => boolean;
|
|
24
27
|
declare const isFalsyBigIntType: (type: ts.Type) => type is ts.LiteralType & {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
28
|
+
freshType: ts.FreshableType;
|
|
29
|
+
regularType: ts.FreshableType;
|
|
30
|
+
flags: ts.TypeFlags;
|
|
31
|
+
symbol: ts.Symbol;
|
|
32
|
+
pattern?: ts.DestructuringPattern;
|
|
33
|
+
aliasSymbol?: ts.Symbol;
|
|
34
|
+
aliasTypeArguments?: readonly ts.Type[];
|
|
35
|
+
getFlags: () => ts.TypeFlags;
|
|
36
|
+
getSymbol: () => ts.Symbol | undefined;
|
|
37
|
+
getProperties: () => ts.Symbol[];
|
|
38
|
+
getProperty: (propertyName: string) => ts.Symbol | undefined;
|
|
39
|
+
getApparentProperties: () => ts.Symbol[];
|
|
40
|
+
getCallSignatures: () => readonly ts.Signature[];
|
|
41
|
+
getConstructSignatures: () => readonly ts.Signature[];
|
|
42
|
+
getStringIndexType: () => ts.Type | undefined;
|
|
43
|
+
getNumberIndexType: () => ts.Type | undefined;
|
|
44
|
+
getBaseTypes: () => ts.BaseType[] | undefined;
|
|
45
|
+
getNonNullableType: () => ts.Type;
|
|
46
|
+
getConstraint: () => ts.Type | undefined;
|
|
47
|
+
getDefault: () => ts.Type | undefined;
|
|
48
|
+
isUnion: () => this is ts.UnionType;
|
|
49
|
+
isIntersection: () => this is ts.IntersectionType;
|
|
50
|
+
isUnionOrIntersection: () => this is ts.UnionOrIntersectionType;
|
|
51
|
+
isLiteral: () => this is ts.LiteralType;
|
|
52
|
+
isStringLiteral: () => this is ts.StringLiteralType;
|
|
53
|
+
isNumberLiteral: () => this is ts.NumberLiteralType;
|
|
54
|
+
isTypeParameter: () => this is ts.TypeParameter;
|
|
55
|
+
isClassOrInterface: () => this is ts.InterfaceType;
|
|
56
|
+
isClass: () => this is ts.InterfaceType;
|
|
57
|
+
isIndexType: () => this is ts.IndexType;
|
|
58
|
+
value: {
|
|
59
|
+
negative: boolean;
|
|
60
|
+
base10Value: "0";
|
|
61
|
+
};
|
|
59
62
|
};
|
|
60
63
|
declare const isFalsyNumberType: (type: ts.Type) => boolean;
|
|
61
64
|
declare const isFalsyStringType: (type: ts.Type) => boolean;
|
|
@@ -65,42 +68,43 @@ declare const isNumberType: (type: ts.Type) => boolean;
|
|
|
65
68
|
declare const isObjectType: (type: ts.Type) => boolean;
|
|
66
69
|
declare const isStringType: (type: ts.Type) => boolean;
|
|
67
70
|
declare const isTruthyBigIntType: (type: ts.Type) => type is ts.LiteralType & {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
71
|
+
freshType: ts.FreshableType;
|
|
72
|
+
regularType: ts.FreshableType;
|
|
73
|
+
flags: ts.TypeFlags;
|
|
74
|
+
symbol: ts.Symbol;
|
|
75
|
+
pattern?: ts.DestructuringPattern;
|
|
76
|
+
aliasSymbol?: ts.Symbol;
|
|
77
|
+
aliasTypeArguments?: readonly ts.Type[];
|
|
78
|
+
getFlags: () => ts.TypeFlags;
|
|
79
|
+
getSymbol: () => ts.Symbol | undefined;
|
|
80
|
+
getProperties: () => ts.Symbol[];
|
|
81
|
+
getProperty: (propertyName: string) => ts.Symbol | undefined;
|
|
82
|
+
getApparentProperties: () => ts.Symbol[];
|
|
83
|
+
getCallSignatures: () => readonly ts.Signature[];
|
|
84
|
+
getConstructSignatures: () => readonly ts.Signature[];
|
|
85
|
+
getStringIndexType: () => ts.Type | undefined;
|
|
86
|
+
getNumberIndexType: () => ts.Type | undefined;
|
|
87
|
+
getBaseTypes: () => ts.BaseType[] | undefined;
|
|
88
|
+
getNonNullableType: () => ts.Type;
|
|
89
|
+
getConstraint: () => ts.Type | undefined;
|
|
90
|
+
getDefault: () => ts.Type | undefined;
|
|
91
|
+
isUnion: () => this is ts.UnionType;
|
|
92
|
+
isIntersection: () => this is ts.IntersectionType;
|
|
93
|
+
isUnionOrIntersection: () => this is ts.UnionOrIntersectionType;
|
|
94
|
+
isLiteral: () => this is ts.LiteralType;
|
|
95
|
+
isStringLiteral: () => this is ts.StringLiteralType;
|
|
96
|
+
isNumberLiteral: () => this is ts.NumberLiteralType;
|
|
97
|
+
isTypeParameter: () => this is ts.TypeParameter;
|
|
98
|
+
isClassOrInterface: () => this is ts.InterfaceType;
|
|
99
|
+
isClass: () => this is ts.InterfaceType;
|
|
100
|
+
isIndexType: () => this is ts.IndexType;
|
|
101
|
+
value: ts.PseudoBigInt;
|
|
99
102
|
};
|
|
100
103
|
declare const isTruthyNumberType: (type: ts.Type) => boolean;
|
|
101
104
|
declare const isTruthyStringType: (type: ts.Type) => boolean;
|
|
102
105
|
declare const isUnknownType: (type: ts.Type) => boolean;
|
|
103
|
-
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/type/type-variant.d.ts
|
|
104
108
|
type TypeVariant = "any" | "bigint" | "boolean" | "enum" | "never" | "nullish" | "number" | "object" | "string" | "unknown" | "falsy bigint" | "falsy boolean" | "falsy number" | "falsy string" | "truthy bigint" | "truthy boolean" | "truthy number" | "truthy string";
|
|
105
109
|
/**
|
|
106
110
|
* Ported from https://github.com/typescript-eslint/typescript-eslint/blob/eb736bbfc22554694400e6a4f97051d845d32e0b/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts#L826 with some enhancements
|
|
@@ -109,19 +113,20 @@ type TypeVariant = "any" | "bigint" | "boolean" | "enum" | "never" | "nullish" |
|
|
|
109
113
|
* @returns The variants of the types
|
|
110
114
|
*/
|
|
111
115
|
declare function getVariantsOfTypes(types: ts.Type[]): Set<TypeVariant>;
|
|
112
|
-
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/utils/is-react-api.d.ts
|
|
113
118
|
declare namespace isReactAPI {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
119
|
+
type ReturnType = {
|
|
120
|
+
(context: Context, node: unit | null | AST.AnyNode): node is AST.MemberExpression;
|
|
121
|
+
(context: Context): (node: unit | null | AST.AnyNode) => node is AST.MemberExpression;
|
|
122
|
+
};
|
|
118
123
|
}
|
|
119
124
|
declare function isReactAPI(api: string): isReactAPI.ReturnType;
|
|
120
125
|
declare namespace isReactAPICall {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
126
|
+
type ReturnType = {
|
|
127
|
+
(context: Context, node: unit | null | AST.AnyNode): node is AST.CallExpression;
|
|
128
|
+
(context: Context): (node: unit | null | AST.AnyNode) => node is AST.CallExpression;
|
|
129
|
+
};
|
|
125
130
|
}
|
|
126
131
|
declare function isReactAPICall(api: string): isReactAPICall.ReturnType;
|
|
127
132
|
declare const isCaptureOwnerStack: isReactAPI.ReturnType;
|
|
@@ -150,5 +155,5 @@ declare const isCreateRefCall: isReactAPICall.ReturnType;
|
|
|
150
155
|
declare const isForwardRefCall: isReactAPICall.ReturnType;
|
|
151
156
|
declare const isMemoCall: isReactAPICall.ReturnType;
|
|
152
157
|
declare const isLazyCall: isReactAPICall.ReturnType;
|
|
153
|
-
|
|
154
|
-
export {
|
|
158
|
+
//#endregion
|
|
159
|
+
export { SemanticEntry, SemanticNode, TypeVariant, getVariantsOfTypes, isAnyType, isBigIntType, isBooleanType, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isCloneElement, isCloneElementCall, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isEnumType, isFalseLiteralType, isFalsyBigIntType, isFalsyNumberType, isFalsyStringType, isForwardRef, isForwardRefCall, isLazy, isLazyCall, isMemo, isMemoCall, isNeverType, isNullishType, isNumberType, isObjectType, isReactAPI, isReactAPICall, isStringType, isTrueLiteralType, isTruthyBigIntType, isTruthyNumberType, isTruthyStringType, isUnknownType };
|
package/dist/index.js
CHANGED
|
@@ -1,122 +1,116 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { dual } from
|
|
6
|
-
import { toStringFormat } from '@react-analyzer/ast';
|
|
1
|
+
import { isFalseLiteralType, isTrueLiteralType, isTypeFlagSet } from "ts-api-utils";
|
|
2
|
+
import { P, isMatching, match } from "ts-pattern";
|
|
3
|
+
import ts, { SyntaxKind } from "typescript";
|
|
4
|
+
import { toStringFormat } from "@react-analyzer/ast";
|
|
5
|
+
import { dual, unit } from "@react-analyzer/eff";
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
7
|
+
//#region src/type/type-is.ts
|
|
8
|
+
const isAnyType = (type) => isTypeFlagSet(type, ts.TypeFlags.TypeParameter | ts.TypeFlags.Any);
|
|
9
|
+
const isBigIntType = (type) => isTypeFlagSet(type, ts.TypeFlags.BigIntLike);
|
|
10
|
+
const isBooleanType = (type) => isTypeFlagSet(type, ts.TypeFlags.BooleanLike);
|
|
11
|
+
const isEnumType = (type) => isTypeFlagSet(type, ts.TypeFlags.EnumLike);
|
|
12
|
+
const isFalsyBigIntType = (type) => type.isLiteral() && isMatching({ value: { base10Value: "0" } }, type);
|
|
13
|
+
const isFalsyNumberType = (type) => type.isNumberLiteral() && type.value === 0;
|
|
14
|
+
const isFalsyStringType = (type) => type.isStringLiteral() && type.value === "";
|
|
15
|
+
const isNeverType = (type) => isTypeFlagSet(type, ts.TypeFlags.Never);
|
|
16
|
+
const isNullishType = (type) => isTypeFlagSet(type, ts.TypeFlags.Null | ts.TypeFlags.Undefined | ts.TypeFlags.VoidLike);
|
|
17
|
+
const isNumberType = (type) => isTypeFlagSet(type, ts.TypeFlags.NumberLike);
|
|
18
|
+
const isObjectType = (type) => !isTypeFlagSet(type, ts.TypeFlags.Null | ts.TypeFlags.Undefined | ts.TypeFlags.VoidLike | ts.TypeFlags.BooleanLike | ts.TypeFlags.StringLike | ts.TypeFlags.NumberLike | ts.TypeFlags.BigIntLike | ts.TypeFlags.TypeParameter | ts.TypeFlags.Any | ts.TypeFlags.Unknown | ts.TypeFlags.Never);
|
|
19
|
+
const isStringType = (type) => isTypeFlagSet(type, ts.TypeFlags.StringLike);
|
|
20
|
+
const isTruthyBigIntType = (type) => type.isLiteral() && isMatching({ value: { base10Value: P.not("0") } }, type);
|
|
21
|
+
const isTruthyNumberType = (type) => type.isNumberLiteral() && type.value !== 0;
|
|
22
|
+
const isTruthyStringType = (type) => type.isStringLiteral() && type.value !== "";
|
|
23
|
+
const isUnknownType = (type) => isTypeFlagSet(type, ts.TypeFlags.Unknown);
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/type/type-variant.ts
|
|
27
|
+
/**
|
|
28
|
+
* Ported from https://github.com/typescript-eslint/typescript-eslint/blob/eb736bbfc22554694400e6a4f97051d845d32e0b/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts#L826 with some enhancements
|
|
29
|
+
* Get the variants of an array of types.
|
|
30
|
+
* @param types The types to get the variants of
|
|
31
|
+
* @returns The variants of the types
|
|
32
|
+
*/
|
|
28
33
|
function getVariantsOfTypes(types) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
variants.add(evaluated);
|
|
62
|
-
}
|
|
63
|
-
if (types.some(isEnumType)) {
|
|
64
|
-
variants.add("enum");
|
|
65
|
-
}
|
|
66
|
-
if (types.some(isObjectType)) {
|
|
67
|
-
variants.add("object");
|
|
68
|
-
}
|
|
69
|
-
if (types.some(isAnyType)) {
|
|
70
|
-
variants.add("any");
|
|
71
|
-
}
|
|
72
|
-
if (types.some(isNeverType)) {
|
|
73
|
-
variants.add("never");
|
|
74
|
-
}
|
|
75
|
-
return variants;
|
|
34
|
+
const variants = /* @__PURE__ */ new Set();
|
|
35
|
+
if (types.some(isUnknownType)) {
|
|
36
|
+
variants.add("unknown");
|
|
37
|
+
return variants;
|
|
38
|
+
}
|
|
39
|
+
if (types.some(isNullishType)) variants.add("nullish");
|
|
40
|
+
const booleans = types.filter(isBooleanType);
|
|
41
|
+
const boolean0 = booleans[0];
|
|
42
|
+
if (booleans.length === 1 && boolean0 != null) {
|
|
43
|
+
if (isFalseLiteralType(boolean0)) variants.add("falsy boolean");
|
|
44
|
+
else if (isTrueLiteralType(boolean0)) variants.add("truthy boolean");
|
|
45
|
+
} else if (booleans.length === 2) variants.add("boolean");
|
|
46
|
+
const strings = types.filter(isStringType);
|
|
47
|
+
if (strings.length > 0) {
|
|
48
|
+
const evaluated = match(strings).when((types$1) => types$1.every(isTruthyStringType), () => "truthy string").when((types$1) => types$1.every(isFalsyStringType), () => "falsy string").otherwise(() => "string");
|
|
49
|
+
variants.add(evaluated);
|
|
50
|
+
}
|
|
51
|
+
const bigints = types.filter(isBigIntType);
|
|
52
|
+
if (bigints.length > 0) {
|
|
53
|
+
const evaluated = match(bigints).when((types$1) => types$1.every(isTruthyBigIntType), () => "truthy bigint").when((types$1) => types$1.every(isFalsyBigIntType), () => "falsy bigint").otherwise(() => "bigint");
|
|
54
|
+
variants.add(evaluated);
|
|
55
|
+
}
|
|
56
|
+
const numbers = types.filter(isNumberType);
|
|
57
|
+
if (numbers.length > 0) {
|
|
58
|
+
const evaluated = match(numbers).when((types$1) => types$1.every(isTruthyNumberType), () => "truthy number").when((types$1) => types$1.every(isFalsyNumberType), () => "falsy number").otherwise(() => "number");
|
|
59
|
+
variants.add(evaluated);
|
|
60
|
+
}
|
|
61
|
+
if (types.some(isEnumType)) variants.add("enum");
|
|
62
|
+
if (types.some(isObjectType)) variants.add("object");
|
|
63
|
+
if (types.some(isAnyType)) variants.add("any");
|
|
64
|
+
if (types.some(isNeverType)) variants.add("never");
|
|
65
|
+
return variants;
|
|
76
66
|
}
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/utils/is-react-api.ts
|
|
77
70
|
function isReactAPI(api) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
71
|
+
const func = (context, node) => {
|
|
72
|
+
if (node == null) return false;
|
|
73
|
+
const name = toStringFormat(node);
|
|
74
|
+
if (name === api) return true;
|
|
75
|
+
if (name.substring(name.indexOf(".") + 1) === api) return true;
|
|
76
|
+
return false;
|
|
77
|
+
};
|
|
78
|
+
return dual(2, func);
|
|
86
79
|
}
|
|
87
80
|
function isReactAPICall(api) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
81
|
+
const func = (context, node) => {
|
|
82
|
+
if (node == null) return false;
|
|
83
|
+
if (node.kind !== SyntaxKind.CallExpression) return false;
|
|
84
|
+
return isReactAPI(api)(context, node.expression);
|
|
85
|
+
};
|
|
86
|
+
return dual(2, func);
|
|
94
87
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
88
|
+
const isCaptureOwnerStack = isReactAPI("captureOwnerStack");
|
|
89
|
+
const isChildrenCount = isReactAPI("Children.count");
|
|
90
|
+
const isChildrenForEach = isReactAPI("Children.forEach");
|
|
91
|
+
const isChildrenMap = isReactAPI("Children.map");
|
|
92
|
+
const isChildrenOnly = isReactAPI("Children.only");
|
|
93
|
+
const isChildrenToArray = isReactAPI("Children.toArray");
|
|
94
|
+
const isCloneElement = isReactAPI("cloneElement");
|
|
95
|
+
const isCreateContext = isReactAPI("createContext");
|
|
96
|
+
const isCreateElement = isReactAPI("createElement");
|
|
97
|
+
const isCreateRef = isReactAPI("createRef");
|
|
98
|
+
const isForwardRef = isReactAPI("forwardRef");
|
|
99
|
+
const isMemo = isReactAPI("memo");
|
|
100
|
+
const isLazy = isReactAPI("lazy");
|
|
101
|
+
const isCaptureOwnerStackCall = isReactAPICall("captureOwnerStack");
|
|
102
|
+
const isChildrenCountCall = isReactAPICall("Children.count");
|
|
103
|
+
const isChildrenForEachCall = isReactAPICall("Children.forEach");
|
|
104
|
+
const isChildrenMapCall = isReactAPICall("Children.map");
|
|
105
|
+
const isChildrenOnlyCall = isReactAPICall("Children.only");
|
|
106
|
+
const isChildrenToArrayCall = isReactAPICall("Children.toArray");
|
|
107
|
+
const isCloneElementCall = isReactAPICall("cloneElement");
|
|
108
|
+
const isCreateContextCall = isReactAPICall("createContext");
|
|
109
|
+
const isCreateElementCall = isReactAPICall("createElement");
|
|
110
|
+
const isCreateRefCall = isReactAPICall("createRef");
|
|
111
|
+
const isForwardRefCall = isReactAPICall("forwardRef");
|
|
112
|
+
const isMemoCall = isReactAPICall("memo");
|
|
113
|
+
const isLazyCall = isReactAPICall("lazy");
|
|
121
114
|
|
|
122
|
-
|
|
115
|
+
//#endregion
|
|
116
|
+
export { getVariantsOfTypes, isAnyType, isBigIntType, isBooleanType, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isCloneElement, isCloneElementCall, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isEnumType, isFalseLiteralType, isFalsyBigIntType, isFalsyNumberType, isFalsyStringType, isForwardRef, isForwardRefCall, isLazy, isLazyCall, isMemo, isMemoCall, isNeverType, isNullishType, isNumberType, isObjectType, isReactAPI, isReactAPICall, isStringType, isTrueLiteralType, isTruthyBigIntType, isTruthyNumberType, isTruthyStringType, isUnknownType };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-analyzer/core",
|
|
3
|
-
"version": "0.0.3-next.
|
|
3
|
+
"version": "0.0.3-next.5",
|
|
4
4
|
"description": "React Analyzer utility module for static analysis of React core APIs and patterns.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/react-analyzer",
|
|
6
6
|
"bugs": {
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"ts-pattern": "^5.8.0",
|
|
31
|
-
"@react-analyzer/ast": "0.0.3-next.
|
|
32
|
-
"@react-analyzer/
|
|
33
|
-
"@react-analyzer/
|
|
31
|
+
"@react-analyzer/ast": "0.0.3-next.5",
|
|
32
|
+
"@react-analyzer/kit": "0.0.3-next.5",
|
|
33
|
+
"@react-analyzer/eff": "0.0.3-next.5"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@tsconfig/node22": "^22.0.2",
|
|
37
37
|
"@types/node": "^24.3.0",
|
|
38
|
-
"
|
|
38
|
+
"tsdown": "^0.14.1",
|
|
39
39
|
"type-fest": "^4.41.0",
|
|
40
40
|
"@local/configs": "0.0.0"
|
|
41
41
|
},
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"node": ">=22.17.0"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
|
-
"build": "
|
|
52
|
+
"build": "tsdown --dts-resolve",
|
|
53
53
|
"build:docs": "typedoc",
|
|
54
54
|
"lint:publish": "publint",
|
|
55
55
|
"lint:ts": "tsl"
|