@eslint-react/var 1.24.0-next.9 → 1.24.1-beta.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/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +8 -8
- package/dist/index.mjs +8 -8
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -43,7 +43,7 @@ declare function isNodeValueEqual(a: TSESTree.Node, b: TSESTree.Node, initialSco
|
|
|
43
43
|
bScope: Scope
|
|
44
44
|
]): boolean;
|
|
45
45
|
|
|
46
|
-
type
|
|
46
|
+
type LazyValue = {
|
|
47
47
|
kind: "lazy";
|
|
48
48
|
node: TSESTree.Node;
|
|
49
49
|
initialScope: Scope | _;
|
|
@@ -57,7 +57,7 @@ type StaticValue = {
|
|
|
57
57
|
value: unknown;
|
|
58
58
|
initialScope: Scope | _;
|
|
59
59
|
};
|
|
60
|
-
declare function
|
|
60
|
+
declare function toStaticValue(lazyValue: LazyValue): {
|
|
61
61
|
readonly kind: "none";
|
|
62
62
|
readonly node: TSESTree.Node;
|
|
63
63
|
readonly initialScope: Scope | undefined;
|
|
@@ -110,4 +110,4 @@ declare const ValueConstructionHint: {
|
|
|
110
110
|
*/
|
|
111
111
|
declare function getValueConstruction(node: TSESTree.Node | _, initialScope: Scope, hint?: bigint): ValueConstruction | _;
|
|
112
112
|
|
|
113
|
-
export { type
|
|
113
|
+
export { type LazyValue, type ValueConstruction, ValueConstructionHint, findPropertyInProperties, findVariable, getChidScopes, getValueConstruction, getVariableDeclaratorId, getVariableNode, getVariables, isInitializedFromSource, isNodeValueEqual, toStaticValue };
|
package/dist/index.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ declare function isNodeValueEqual(a: TSESTree.Node, b: TSESTree.Node, initialSco
|
|
|
43
43
|
bScope: Scope
|
|
44
44
|
]): boolean;
|
|
45
45
|
|
|
46
|
-
type
|
|
46
|
+
type LazyValue = {
|
|
47
47
|
kind: "lazy";
|
|
48
48
|
node: TSESTree.Node;
|
|
49
49
|
initialScope: Scope | _;
|
|
@@ -57,7 +57,7 @@ type StaticValue = {
|
|
|
57
57
|
value: unknown;
|
|
58
58
|
initialScope: Scope | _;
|
|
59
59
|
};
|
|
60
|
-
declare function
|
|
60
|
+
declare function toStaticValue(lazyValue: LazyValue): {
|
|
61
61
|
readonly kind: "none";
|
|
62
62
|
readonly node: TSESTree.Node;
|
|
63
63
|
readonly initialScope: Scope | undefined;
|
|
@@ -110,4 +110,4 @@ declare const ValueConstructionHint: {
|
|
|
110
110
|
*/
|
|
111
111
|
declare function getValueConstruction(node: TSESTree.Node | _, initialScope: Scope, hint?: bigint): ValueConstruction | _;
|
|
112
112
|
|
|
113
|
-
export { type
|
|
113
|
+
export { type LazyValue, type ValueConstruction, ValueConstructionHint, findPropertyInProperties, findVariable, getChidScopes, getValueConstruction, getVariableDeclaratorId, getVariableNode, getVariables, isInitializedFromSource, isNodeValueEqual, toStaticValue };
|
package/dist/index.js
CHANGED
|
@@ -153,13 +153,13 @@ function getRequireExpressionArguments(node) {
|
|
|
153
153
|
}
|
|
154
154
|
return eff._;
|
|
155
155
|
}
|
|
156
|
-
function
|
|
157
|
-
const { kind, node, initialScope } =
|
|
156
|
+
function toStaticValue(lazyValue) {
|
|
157
|
+
const { kind, node, initialScope } = lazyValue;
|
|
158
158
|
if (kind !== "lazy") {
|
|
159
|
-
return
|
|
159
|
+
return lazyValue;
|
|
160
160
|
}
|
|
161
|
-
const
|
|
162
|
-
return
|
|
161
|
+
const staticValue = initialScope == null ? ASTUtils.getStaticValue(node) : ASTUtils.getStaticValue(node, initialScope);
|
|
162
|
+
return staticValue == null ? { kind: "none", node, initialScope } : { kind: "some", node, initialScope, value: staticValue.value };
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
// src/is-node-value-equal.ts
|
|
@@ -230,8 +230,8 @@ function isNodeValueEqual(a, b, initialScopes) {
|
|
|
230
230
|
return aFunction === bFunction;
|
|
231
231
|
}
|
|
232
232
|
default: {
|
|
233
|
-
const aStatic =
|
|
234
|
-
const bStatic =
|
|
233
|
+
const aStatic = toStaticValue({ kind: "lazy", node: a, initialScope: aScope });
|
|
234
|
+
const bStatic = toStaticValue({ kind: "lazy", node: b, initialScope: bScope });
|
|
235
235
|
return aStatic.kind !== "none" && bStatic.kind !== "none" && aStatic.value === bStatic.value;
|
|
236
236
|
}
|
|
237
237
|
}
|
|
@@ -321,4 +321,4 @@ exports.getVariableNode = getVariableNode;
|
|
|
321
321
|
exports.getVariables = getVariables;
|
|
322
322
|
exports.isInitializedFromSource = isInitializedFromSource;
|
|
323
323
|
exports.isNodeValueEqual = isNodeValueEqual;
|
|
324
|
-
exports.
|
|
324
|
+
exports.toStaticValue = toStaticValue;
|
package/dist/index.mjs
CHANGED
|
@@ -131,13 +131,13 @@ function getRequireExpressionArguments(node) {
|
|
|
131
131
|
}
|
|
132
132
|
return _;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
const { kind, node, initialScope } =
|
|
134
|
+
function toStaticValue(lazyValue) {
|
|
135
|
+
const { kind, node, initialScope } = lazyValue;
|
|
136
136
|
if (kind !== "lazy") {
|
|
137
|
-
return
|
|
137
|
+
return lazyValue;
|
|
138
138
|
}
|
|
139
|
-
const
|
|
140
|
-
return
|
|
139
|
+
const staticValue = initialScope == null ? getStaticValue(node) : getStaticValue(node, initialScope);
|
|
140
|
+
return staticValue == null ? { kind: "none", node, initialScope } : { kind: "some", node, initialScope, value: staticValue.value };
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
// src/is-node-value-equal.ts
|
|
@@ -208,8 +208,8 @@ function isNodeValueEqual(a, b, initialScopes) {
|
|
|
208
208
|
return aFunction === bFunction;
|
|
209
209
|
}
|
|
210
210
|
default: {
|
|
211
|
-
const aStatic =
|
|
212
|
-
const bStatic =
|
|
211
|
+
const aStatic = toStaticValue({ kind: "lazy", node: a, initialScope: aScope });
|
|
212
|
+
const bStatic = toStaticValue({ kind: "lazy", node: b, initialScope: bScope });
|
|
213
213
|
return aStatic.kind !== "none" && bStatic.kind !== "none" && aStatic.value === bStatic.value;
|
|
214
214
|
}
|
|
215
215
|
}
|
|
@@ -289,4 +289,4 @@ function getValueConstruction(node, initialScope, hint = ValueConstructionHint.N
|
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
-
export { ValueConstructionHint, findPropertyInProperties, findVariable2 as findVariable, getChidScopes, getValueConstruction, getVariableDeclaratorId, getVariableNode, getVariables, isInitializedFromSource, isNodeValueEqual,
|
|
292
|
+
export { ValueConstructionHint, findPropertyInProperties, findVariable2 as findVariable, getChidScopes, getValueConstruction, getVariableDeclaratorId, getVariableNode, getVariables, isInitializedFromSource, isNodeValueEqual, toStaticValue };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/var",
|
|
3
|
-
"version": "1.24.
|
|
3
|
+
"version": "1.24.1-beta.1",
|
|
4
4
|
"description": "ESLint React's TSESTree AST utility module for static analysis of variables",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"./package.json"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@typescript-eslint/scope-manager": "^8.
|
|
37
|
-
"@typescript-eslint/types": "^8.
|
|
38
|
-
"@typescript-eslint/utils": "^8.
|
|
36
|
+
"@typescript-eslint/scope-manager": "^8.21.0",
|
|
37
|
+
"@typescript-eslint/types": "^8.21.0",
|
|
38
|
+
"@typescript-eslint/utils": "^8.21.0",
|
|
39
39
|
"string-ts": "^2.2.0",
|
|
40
|
-
"ts-pattern": "^5.6.
|
|
41
|
-
"@eslint-react/
|
|
42
|
-
"@eslint-react/
|
|
40
|
+
"ts-pattern": "^5.6.2",
|
|
41
|
+
"@eslint-react/eff": "1.24.1-beta.1",
|
|
42
|
+
"@eslint-react/ast": "1.24.1-beta.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"tsup": "^8.3.5",
|