@react-analyzer/core 0.0.5 → 0.0.6

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 CHANGED
@@ -1,4 +1,3 @@
1
- import { isFalseLiteralType, isTrueLiteralType } from "ts-api-utils";
2
1
  import ts from "typescript";
3
2
  import { unit } from "@let/eff";
4
3
  import { AST, Context } from "tsl";
@@ -20,6 +19,11 @@ interface SemanticNode {
20
19
  }
21
20
  //#endregion
22
21
  //#region src/type/type-is.d.ts
22
+ declare function isBooleanLiteralType<TType extends ts.Type>(type: TType): type is TType & {
23
+ intrinsicName: "false" | "true";
24
+ };
25
+ declare const isFalseLiteralType: (type: ts.Type) => boolean;
26
+ declare const isTrueLiteralType: (type: ts.Type) => boolean;
23
27
  declare const isAnyType: (type: ts.Type) => boolean;
24
28
  declare const isBigIntType: (type: ts.Type) => boolean;
25
29
  declare const isBooleanType: (type: ts.Type) => boolean;
@@ -156,4 +160,4 @@ declare const isForwardRefCall: isReactAPICall.ReturnType;
156
160
  declare const isMemoCall: isReactAPICall.ReturnType;
157
161
  declare const isLazyCall: isReactAPICall.ReturnType;
158
162
  //#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 };
163
+ export { SemanticEntry, SemanticNode, TypeVariant, getVariantsOfTypes, isAnyType, isBigIntType, isBooleanLiteralType, 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,10 +1,21 @@
1
- import { isFalseLiteralType, isTrueLiteralType, isTypeFlagSet } from "ts-api-utils";
2
1
  import { P, isMatching, match } from "ts-pattern";
3
2
  import ts, { SyntaxKind } from "typescript";
4
3
  import { dual, unit } from "@let/eff";
5
4
  import { toStringFormat } from "@react-analyzer/ast";
6
5
 
7
6
  //#region src/type/type-is.ts
7
+ function isFlagSet(allFlags, flag) {
8
+ return (allFlags & flag) !== 0;
9
+ }
10
+ function isFlagSetOnObject(obj, flag) {
11
+ return isFlagSet(obj.flags, flag);
12
+ }
13
+ const isTypeFlagSet = isFlagSetOnObject;
14
+ function isBooleanLiteralType(type) {
15
+ return isTypeFlagSet(type, ts.TypeFlags.BooleanLiteral);
16
+ }
17
+ const isFalseLiteralType = (type) => isBooleanLiteralType(type) && type.intrinsicName === "false";
18
+ const isTrueLiteralType = (type) => isBooleanLiteralType(type) && type.intrinsicName === "true";
8
19
  const isAnyType = (type) => isTypeFlagSet(type, ts.TypeFlags.TypeParameter | ts.TypeFlags.Any);
9
20
  const isBigIntType = (type) => isTypeFlagSet(type, ts.TypeFlags.BigIntLike);
10
21
  const isBooleanType = (type) => isTypeFlagSet(type, ts.TypeFlags.BooleanLike);
@@ -113,4 +124,4 @@ const isMemoCall = isReactAPICall("memo");
113
124
  const isLazyCall = isReactAPICall("lazy");
114
125
 
115
126
  //#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 };
127
+ export { getVariantsOfTypes, isAnyType, isBigIntType, isBooleanLiteralType, 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.5",
3
+ "version": "0.0.6",
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": {
@@ -29,7 +29,7 @@
29
29
  "dependencies": {
30
30
  "@let/eff": "npm:@jsr/let__eff@^0.1.2",
31
31
  "ts-pattern": "^5.9.0",
32
- "@react-analyzer/ast": "0.0.5"
32
+ "@react-analyzer/ast": "0.0.6"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@tsconfig/node24": "^24.0.3",
@@ -39,7 +39,6 @@
39
39
  "@local/configs": "0.0.0"
40
40
  },
41
41
  "peerDependencies": {
42
- "ts-api-utils": "^2.1.0",
43
42
  "tsl": "^1.0.27",
44
43
  "typescript": "^5.9.3"
45
44
  },