@eslint-react/core 1.46.1-next.0 → 1.47.0-beta.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/dist/index.d.mts +181 -82
- package/dist/index.d.ts +181 -82
- package/dist/index.js +358 -94
- package/dist/index.mjs +341 -93
- package/package.json +6 -7
package/dist/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var AST8 = require('@eslint-react/ast');
|
|
4
4
|
var eff = require('@eslint-react/eff');
|
|
5
|
-
var JSX3 = require('@eslint-react/jsx');
|
|
6
5
|
var kit = require('@eslint-react/kit');
|
|
7
6
|
var shared = require('@eslint-react/shared');
|
|
8
7
|
var types = require('@typescript-eslint/types');
|
|
9
|
-
var
|
|
8
|
+
var VAR3 = require('@eslint-react/var');
|
|
10
9
|
var tsPattern = require('ts-pattern');
|
|
11
10
|
var birecord = require('birecord');
|
|
12
11
|
|
|
@@ -30,9 +29,8 @@ function _interopNamespace(e) {
|
|
|
30
29
|
return Object.freeze(n);
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
var VAR__namespace = /*#__PURE__*/_interopNamespace(VAR);
|
|
32
|
+
var AST8__namespace = /*#__PURE__*/_interopNamespace(AST8);
|
|
33
|
+
var VAR3__namespace = /*#__PURE__*/_interopNamespace(VAR3);
|
|
36
34
|
var birecord__default = /*#__PURE__*/_interopDefault(birecord);
|
|
37
35
|
|
|
38
36
|
var __defProp = Object.defineProperty;
|
|
@@ -1429,7 +1427,7 @@ function getRequireExpressionArguments(node) {
|
|
|
1429
1427
|
}
|
|
1430
1428
|
function isInitializedFromReact(name, importSource, initialScope) {
|
|
1431
1429
|
if (name.toLowerCase() === "react") return true;
|
|
1432
|
-
const latestDef =
|
|
1430
|
+
const latestDef = VAR3__namespace.findVariable(name, initialScope)?.defs.at(-1);
|
|
1433
1431
|
if (latestDef == null) return false;
|
|
1434
1432
|
const { node, parent } = latestDef;
|
|
1435
1433
|
if (node.type === types.AST_NODE_TYPES.VariableDeclarator && node.init != null) {
|
|
@@ -1442,7 +1440,7 @@ function isInitializedFromReact(name, importSource, initialScope) {
|
|
|
1442
1440
|
}
|
|
1443
1441
|
const args = getRequireExpressionArguments(init);
|
|
1444
1442
|
const arg0 = args?.[0];
|
|
1445
|
-
if (arg0 == null || !
|
|
1443
|
+
if (arg0 == null || !AST8__namespace.isLiteral(arg0, "string")) {
|
|
1446
1444
|
return false;
|
|
1447
1445
|
}
|
|
1448
1446
|
return arg0.value === importSource || arg0.value.startsWith(`${importSource}/`);
|
|
@@ -1507,7 +1505,7 @@ function isCallFromReactObject(objectName, propertyName) {
|
|
|
1507
1505
|
});
|
|
1508
1506
|
}
|
|
1509
1507
|
function isInstanceIdEqual(context, a, b) {
|
|
1510
|
-
return
|
|
1508
|
+
return AST8__namespace.isNodeEqual(a, b) || VAR3__namespace.isNodeValueEqual(a, b, [
|
|
1511
1509
|
context.sourceCode.getScope(a),
|
|
1512
1510
|
context.sourceCode.getScope(b)
|
|
1513
1511
|
]);
|
|
@@ -1552,10 +1550,10 @@ function isReactHookName(name) {
|
|
|
1552
1550
|
return name === "use" || /^use[A-Z0-9]/.test(name);
|
|
1553
1551
|
}
|
|
1554
1552
|
|
|
1555
|
-
// src/hook/is.ts
|
|
1553
|
+
// src/hook/hook-is.ts
|
|
1556
1554
|
function isReactHook(node) {
|
|
1557
1555
|
if (node == null) return false;
|
|
1558
|
-
const id =
|
|
1556
|
+
const id = AST8__namespace.getFunctionIdentifier(node);
|
|
1559
1557
|
return id?.name != null && isReactHookName(id.name);
|
|
1560
1558
|
}
|
|
1561
1559
|
function isReactHookCall(node) {
|
|
@@ -1653,23 +1651,12 @@ var isUseStateCall = eff.flip(isReactHookCallWithName)("useState");
|
|
|
1653
1651
|
var isUseSyncExternalStoreCall = eff.flip(isReactHookCallWithName)("useSyncExternalStore");
|
|
1654
1652
|
var isUseTransitionCall = eff.flip(isReactHookCallWithName)("useTransition");
|
|
1655
1653
|
|
|
1656
|
-
// src/hook/
|
|
1657
|
-
function isFunctionOfUseEffectSetup(node) {
|
|
1658
|
-
if (node == null) return false;
|
|
1659
|
-
return node.parent?.type === types.AST_NODE_TYPES.CallExpression && node.parent.callee !== node && node.parent.callee.type === types.AST_NODE_TYPES.Identifier && node.parent.arguments.at(0) === node && isUseEffectCallLoose(node.parent);
|
|
1660
|
-
}
|
|
1661
|
-
function isFunctionOfUseEffectCleanup(node) {
|
|
1662
|
-
if (node == null) return false;
|
|
1663
|
-
const returnStatement = AST6__namespace.findParentNode(node, AST6__namespace.is(types.AST_NODE_TYPES.ReturnStatement));
|
|
1664
|
-
const enclosingFunction = AST6__namespace.findParentNode(node, AST6__namespace.isFunction);
|
|
1665
|
-
const functionOfReturnStatement = AST6__namespace.findParentNode(returnStatement, AST6__namespace.isFunction);
|
|
1666
|
-
return enclosingFunction === functionOfReturnStatement && isFunctionOfUseEffectSetup(enclosingFunction);
|
|
1667
|
-
}
|
|
1654
|
+
// src/hook/hook-collector.ts
|
|
1668
1655
|
function useHookCollector() {
|
|
1669
1656
|
const hooks = /* @__PURE__ */ new Map();
|
|
1670
1657
|
const functionEntries = [];
|
|
1671
1658
|
const onFunctionEnter = (node) => {
|
|
1672
|
-
const id =
|
|
1659
|
+
const id = AST8__namespace.getFunctionIdentifier(node);
|
|
1673
1660
|
const key = shared.getId();
|
|
1674
1661
|
const name = id?.name;
|
|
1675
1662
|
if (name != null && isReactHookName(name)) {
|
|
@@ -1717,11 +1704,273 @@ function useHookCollector() {
|
|
|
1717
1704
|
};
|
|
1718
1705
|
return { ctx, listeners };
|
|
1719
1706
|
}
|
|
1707
|
+
function isFunctionOfUseEffectSetup(node) {
|
|
1708
|
+
if (node == null) return false;
|
|
1709
|
+
return node.parent?.type === types.AST_NODE_TYPES.CallExpression && node.parent.callee !== node && node.parent.callee.type === types.AST_NODE_TYPES.Identifier && node.parent.arguments.at(0) === node && isUseEffectCallLoose(node.parent);
|
|
1710
|
+
}
|
|
1711
|
+
function isFunctionOfUseEffectCleanup(node) {
|
|
1712
|
+
if (node == null) return false;
|
|
1713
|
+
const returnStatement = AST8__namespace.findParentNode(node, AST8__namespace.is(types.AST_NODE_TYPES.ReturnStatement));
|
|
1714
|
+
const enclosingFunction = AST8__namespace.findParentNode(node, AST8__namespace.isFunction);
|
|
1715
|
+
const functionOfReturnStatement = AST8__namespace.findParentNode(returnStatement, AST8__namespace.isFunction);
|
|
1716
|
+
return enclosingFunction === functionOfReturnStatement && isFunctionOfUseEffectSetup(enclosingFunction);
|
|
1717
|
+
}
|
|
1718
|
+
function stringifyJsx(node) {
|
|
1719
|
+
switch (node.type) {
|
|
1720
|
+
case types.AST_NODE_TYPES.JSXIdentifier:
|
|
1721
|
+
return node.name;
|
|
1722
|
+
case types.AST_NODE_TYPES.JSXNamespacedName:
|
|
1723
|
+
return `${node.namespace.name}:${node.name.name}`;
|
|
1724
|
+
case types.AST_NODE_TYPES.JSXMemberExpression:
|
|
1725
|
+
return `${stringifyJsx(node.object)}.${stringifyJsx(node.property)}`;
|
|
1726
|
+
case types.AST_NODE_TYPES.JSXText:
|
|
1727
|
+
return node.value;
|
|
1728
|
+
case types.AST_NODE_TYPES.JSXOpeningElement:
|
|
1729
|
+
return `<${stringifyJsx(node.name)}>`;
|
|
1730
|
+
case types.AST_NODE_TYPES.JSXClosingElement:
|
|
1731
|
+
return `</${stringifyJsx(node.name)}>`;
|
|
1732
|
+
case types.AST_NODE_TYPES.JSXOpeningFragment:
|
|
1733
|
+
return "<>";
|
|
1734
|
+
case types.AST_NODE_TYPES.JSXClosingFragment:
|
|
1735
|
+
return "</>";
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
// src/jsx/jsx-attribute-name.ts
|
|
1740
|
+
function getAttributeName(context, node) {
|
|
1741
|
+
return stringifyJsx(node.name);
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
// src/jsx/jsx-attribute.ts
|
|
1745
|
+
function getAttribute(context, name, attributes, initialScope) {
|
|
1746
|
+
return attributes.findLast((attr) => {
|
|
1747
|
+
if (attr.type === types.AST_NODE_TYPES.JSXAttribute) {
|
|
1748
|
+
return getAttributeName(context, attr) === name;
|
|
1749
|
+
}
|
|
1750
|
+
if (initialScope == null) return false;
|
|
1751
|
+
switch (attr.argument.type) {
|
|
1752
|
+
case types.AST_NODE_TYPES.Identifier: {
|
|
1753
|
+
const variable = VAR3__namespace.findVariable(attr.argument.name, initialScope);
|
|
1754
|
+
const variableNode = VAR3__namespace.getVariableInitNode(variable, 0);
|
|
1755
|
+
if (variableNode?.type === types.AST_NODE_TYPES.ObjectExpression) {
|
|
1756
|
+
return VAR3__namespace.findPropertyInProperties(name, variableNode.properties, initialScope) != null;
|
|
1757
|
+
}
|
|
1758
|
+
return false;
|
|
1759
|
+
}
|
|
1760
|
+
case types.AST_NODE_TYPES.ObjectExpression:
|
|
1761
|
+
return VAR3__namespace.findPropertyInProperties(name, attr.argument.properties, initialScope) != null;
|
|
1762
|
+
}
|
|
1763
|
+
return false;
|
|
1764
|
+
});
|
|
1765
|
+
}
|
|
1766
|
+
function getAttributeValue(context, node, name) {
|
|
1767
|
+
const initialScope = context.sourceCode.getScope(node);
|
|
1768
|
+
switch (node.type) {
|
|
1769
|
+
case types.AST_NODE_TYPES.JSXAttribute:
|
|
1770
|
+
if (node.value?.type === types.AST_NODE_TYPES.Literal) {
|
|
1771
|
+
return {
|
|
1772
|
+
kind: "some",
|
|
1773
|
+
node: node.value,
|
|
1774
|
+
initialScope,
|
|
1775
|
+
value: node.value.value
|
|
1776
|
+
};
|
|
1777
|
+
}
|
|
1778
|
+
if (node.value?.type === types.AST_NODE_TYPES.JSXExpressionContainer) {
|
|
1779
|
+
return VAR3__namespace.toStaticValue({
|
|
1780
|
+
kind: "lazy",
|
|
1781
|
+
node: node.value.expression,
|
|
1782
|
+
initialScope
|
|
1783
|
+
});
|
|
1784
|
+
}
|
|
1785
|
+
return { kind: "none", node, initialScope };
|
|
1786
|
+
case types.AST_NODE_TYPES.JSXSpreadAttribute: {
|
|
1787
|
+
const staticValue = VAR3__namespace.toStaticValue({
|
|
1788
|
+
kind: "lazy",
|
|
1789
|
+
node: node.argument,
|
|
1790
|
+
initialScope
|
|
1791
|
+
});
|
|
1792
|
+
if (staticValue.kind === "none") {
|
|
1793
|
+
return staticValue;
|
|
1794
|
+
}
|
|
1795
|
+
return tsPattern.match(staticValue.value).with({ [name]: tsPattern.P.select(tsPattern.P.any) }, (value) => ({
|
|
1796
|
+
kind: "some",
|
|
1797
|
+
node: node.argument,
|
|
1798
|
+
initialScope,
|
|
1799
|
+
value
|
|
1800
|
+
})).otherwise(() => ({ kind: "none", node, initialScope }));
|
|
1801
|
+
}
|
|
1802
|
+
default:
|
|
1803
|
+
return { kind: "none", node, initialScope };
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
// src/jsx/jsx-detection-hint.ts
|
|
1808
|
+
var JSXDetectionHint = {
|
|
1809
|
+
None: 0n,
|
|
1810
|
+
SkipUndefined: 1n << 0n,
|
|
1811
|
+
SkipNullLiteral: 1n << 1n,
|
|
1812
|
+
SkipBooleanLiteral: 1n << 2n,
|
|
1813
|
+
SkipStringLiteral: 1n << 3n,
|
|
1814
|
+
SkipNumberLiteral: 1n << 4n,
|
|
1815
|
+
SkipBigIntLiteral: 1n << 5n,
|
|
1816
|
+
SkipEmptyArray: 1n << 6n,
|
|
1817
|
+
SkipCreateElement: 1n << 7n,
|
|
1818
|
+
StrictArray: 1n << 8n,
|
|
1819
|
+
StrictLogical: 1n << 9n,
|
|
1820
|
+
StrictConditional: 1n << 10n
|
|
1821
|
+
};
|
|
1822
|
+
var DEFAULT_JSX_DETECTION_HINT = 0n | JSXDetectionHint.SkipUndefined | JSXDetectionHint.SkipBooleanLiteral;
|
|
1823
|
+
|
|
1824
|
+
// src/jsx/jsx-detection.ts
|
|
1825
|
+
var isJSX = AST8__namespace.isOneOf([
|
|
1826
|
+
types.AST_NODE_TYPES.JSXAttribute,
|
|
1827
|
+
types.AST_NODE_TYPES.JSXClosingElement,
|
|
1828
|
+
types.AST_NODE_TYPES.JSXClosingFragment,
|
|
1829
|
+
types.AST_NODE_TYPES.JSXElement,
|
|
1830
|
+
types.AST_NODE_TYPES.JSXEmptyExpression,
|
|
1831
|
+
types.AST_NODE_TYPES.JSXExpressionContainer,
|
|
1832
|
+
types.AST_NODE_TYPES.JSXFragment,
|
|
1833
|
+
types.AST_NODE_TYPES.JSXIdentifier,
|
|
1834
|
+
types.AST_NODE_TYPES.JSXMemberExpression,
|
|
1835
|
+
types.AST_NODE_TYPES.JSXNamespacedName,
|
|
1836
|
+
types.AST_NODE_TYPES.JSXOpeningElement,
|
|
1837
|
+
types.AST_NODE_TYPES.JSXOpeningFragment,
|
|
1838
|
+
types.AST_NODE_TYPES.JSXSpreadAttribute,
|
|
1839
|
+
types.AST_NODE_TYPES.JSXSpreadChild,
|
|
1840
|
+
types.AST_NODE_TYPES.JSXText
|
|
1841
|
+
]);
|
|
1842
|
+
function isJsxText(node) {
|
|
1843
|
+
if (node == null) return false;
|
|
1844
|
+
return node.type === types.AST_NODE_TYPES.JSXText || node.type === types.AST_NODE_TYPES.Literal;
|
|
1845
|
+
}
|
|
1846
|
+
function isJsxLike(code, node, hint = DEFAULT_JSX_DETECTION_HINT) {
|
|
1847
|
+
if (node == null) return false;
|
|
1848
|
+
if (isJSX(node)) return true;
|
|
1849
|
+
switch (node.type) {
|
|
1850
|
+
case types.AST_NODE_TYPES.Literal: {
|
|
1851
|
+
switch (typeof node.value) {
|
|
1852
|
+
case "boolean":
|
|
1853
|
+
return !(hint & JSXDetectionHint.SkipBooleanLiteral);
|
|
1854
|
+
case "string":
|
|
1855
|
+
return !(hint & JSXDetectionHint.SkipStringLiteral);
|
|
1856
|
+
case "number":
|
|
1857
|
+
return !(hint & JSXDetectionHint.SkipNumberLiteral);
|
|
1858
|
+
case "bigint":
|
|
1859
|
+
return !(hint & JSXDetectionHint.SkipBigIntLiteral);
|
|
1860
|
+
}
|
|
1861
|
+
if (node.value == null) {
|
|
1862
|
+
return !(hint & JSXDetectionHint.SkipNullLiteral);
|
|
1863
|
+
}
|
|
1864
|
+
return false;
|
|
1865
|
+
}
|
|
1866
|
+
case types.AST_NODE_TYPES.TemplateLiteral: {
|
|
1867
|
+
return !(hint & JSXDetectionHint.SkipStringLiteral);
|
|
1868
|
+
}
|
|
1869
|
+
case types.AST_NODE_TYPES.ArrayExpression: {
|
|
1870
|
+
if (hint & JSXDetectionHint.StrictArray) {
|
|
1871
|
+
return node.elements.every((n) => isJsxLike(code, n, hint));
|
|
1872
|
+
}
|
|
1873
|
+
return node.elements.some((n) => isJsxLike(code, n, hint));
|
|
1874
|
+
}
|
|
1875
|
+
case types.AST_NODE_TYPES.LogicalExpression: {
|
|
1876
|
+
if (hint & JSXDetectionHint.StrictLogical) {
|
|
1877
|
+
return isJsxLike(code, node.left, hint) && isJsxLike(code, node.right, hint);
|
|
1878
|
+
}
|
|
1879
|
+
return isJsxLike(code, node.left, hint) || isJsxLike(code, node.right, hint);
|
|
1880
|
+
}
|
|
1881
|
+
case types.AST_NODE_TYPES.ConditionalExpression: {
|
|
1882
|
+
let leftHasJSX2 = function(node2) {
|
|
1883
|
+
if (Array.isArray(node2.consequent)) {
|
|
1884
|
+
if (node2.consequent.length === 0) {
|
|
1885
|
+
return !(hint & JSXDetectionHint.SkipEmptyArray);
|
|
1886
|
+
}
|
|
1887
|
+
if (hint & JSXDetectionHint.StrictArray) {
|
|
1888
|
+
return node2.consequent.every((n) => isJsxLike(code, n, hint));
|
|
1889
|
+
}
|
|
1890
|
+
return node2.consequent.some((n) => isJsxLike(code, n, hint));
|
|
1891
|
+
}
|
|
1892
|
+
return isJsxLike(code, node2.consequent, hint);
|
|
1893
|
+
}, rightHasJSX2 = function(node2) {
|
|
1894
|
+
return isJsxLike(code, node2.alternate, hint);
|
|
1895
|
+
};
|
|
1896
|
+
if (hint & JSXDetectionHint.StrictConditional) {
|
|
1897
|
+
return leftHasJSX2(node) && rightHasJSX2(node);
|
|
1898
|
+
}
|
|
1899
|
+
return leftHasJSX2(node) || rightHasJSX2(node);
|
|
1900
|
+
}
|
|
1901
|
+
case types.AST_NODE_TYPES.SequenceExpression: {
|
|
1902
|
+
const exp = node.expressions.at(-1);
|
|
1903
|
+
return isJsxLike(code, exp, hint);
|
|
1904
|
+
}
|
|
1905
|
+
case types.AST_NODE_TYPES.CallExpression: {
|
|
1906
|
+
if (hint & JSXDetectionHint.SkipCreateElement) {
|
|
1907
|
+
return false;
|
|
1908
|
+
}
|
|
1909
|
+
switch (node.callee.type) {
|
|
1910
|
+
case types.AST_NODE_TYPES.Identifier:
|
|
1911
|
+
return node.callee.name === "createElement";
|
|
1912
|
+
case types.AST_NODE_TYPES.MemberExpression:
|
|
1913
|
+
return node.callee.property.type === types.AST_NODE_TYPES.Identifier && node.callee.property.name === "createElement";
|
|
1914
|
+
}
|
|
1915
|
+
return false;
|
|
1916
|
+
}
|
|
1917
|
+
case types.AST_NODE_TYPES.Identifier: {
|
|
1918
|
+
const { name } = node;
|
|
1919
|
+
if (name === "undefined") {
|
|
1920
|
+
return !(hint & JSXDetectionHint.SkipUndefined);
|
|
1921
|
+
}
|
|
1922
|
+
if (AST8__namespace.isJSXTagNameExpression(node)) {
|
|
1923
|
+
return true;
|
|
1924
|
+
}
|
|
1925
|
+
const variable = VAR3__namespace.findVariable(name, code.getScope(node));
|
|
1926
|
+
const variableNode = variable && VAR3__namespace.getVariableInitNode(variable, 0);
|
|
1927
|
+
return !!variableNode && isJsxLike(code, variableNode, hint);
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
return false;
|
|
1931
|
+
}
|
|
1932
|
+
function getElementType(context, node) {
|
|
1933
|
+
if (node.type === types.AST_NODE_TYPES.JSXFragment) {
|
|
1934
|
+
return "";
|
|
1935
|
+
}
|
|
1936
|
+
return stringifyJsx(node.openingElement.name);
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1939
|
+
// src/jsx/jsx-has.ts
|
|
1940
|
+
function hasAttribute(context, name, attributes, initialScope) {
|
|
1941
|
+
return getAttribute(context, name, attributes, initialScope) != null;
|
|
1942
|
+
}
|
|
1943
|
+
function hasAnyAttribute(context, names, attributes, initialScope) {
|
|
1944
|
+
return names.some((n) => hasAttribute(context, n, attributes, initialScope));
|
|
1945
|
+
}
|
|
1946
|
+
function hasEveryAttribute(context, names, attributes, initialScope) {
|
|
1947
|
+
return names.every((n) => hasAttribute(context, n, attributes, initialScope));
|
|
1948
|
+
}
|
|
1949
|
+
function findParentAttribute(node, test = eff.constTrue) {
|
|
1950
|
+
const guard = (node2) => {
|
|
1951
|
+
return node2.type === types.AST_NODE_TYPES.JSXAttribute && test(node2);
|
|
1952
|
+
};
|
|
1953
|
+
return AST8__namespace.findParentNode(node, guard);
|
|
1954
|
+
}
|
|
1955
|
+
function isHostElement(context, node) {
|
|
1956
|
+
return node.type === types.AST_NODE_TYPES.JSXElement && node.openingElement.name.type === types.AST_NODE_TYPES.JSXIdentifier && /^[a-z]/u.test(node.openingElement.name.name);
|
|
1957
|
+
}
|
|
1958
|
+
function isKeyedElement(context, node, initialScope) {
|
|
1959
|
+
return node.type === types.AST_NODE_TYPES.JSXElement && hasAttribute(context, "key", node.openingElement.attributes, initialScope);
|
|
1960
|
+
}
|
|
1961
|
+
function isFragmentElement(context, node, allowJSXFragment = false) {
|
|
1962
|
+
if (node == null) return false;
|
|
1963
|
+
if (node.type !== types.AST_NODE_TYPES.JSXElement && node.type !== types.AST_NODE_TYPES.JSXFragment) return false;
|
|
1964
|
+
if (node.type === types.AST_NODE_TYPES.JSXFragment) return allowJSXFragment;
|
|
1965
|
+
return getElementType(context, node).split(".").at(-1) === "Fragment";
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
// src/component/component-detection-hint.ts
|
|
1720
1969
|
var ComponentDetectionHint = {
|
|
1721
1970
|
/**
|
|
1722
1971
|
* 1n << 0n - 1n << 63n are reserved for JSXDetectionHint
|
|
1723
1972
|
*/
|
|
1724
|
-
...
|
|
1973
|
+
...JSXDetectionHint,
|
|
1725
1974
|
/**
|
|
1726
1975
|
* Skip function component created by React.memo
|
|
1727
1976
|
*/
|
|
@@ -1748,85 +1997,83 @@ var ComponentDetectionHint = {
|
|
|
1748
1997
|
SkipClassProperty: 1n << 69n
|
|
1749
1998
|
};
|
|
1750
1999
|
var DEFAULT_COMPONENT_DETECTION_HINT = 0n | ComponentDetectionHint.SkipBooleanLiteral | ComponentDetectionHint.SkipEmptyArray | ComponentDetectionHint.SkipArrayMapArgument | ComponentDetectionHint.SkipNumberLiteral | ComponentDetectionHint.SkipStringLiteral | ComponentDetectionHint.SkipUndefined | ComponentDetectionHint.StrictArray | ComponentDetectionHint.StrictConditional | ComponentDetectionHint.StrictLogical;
|
|
2000
|
+
function isClassComponent(node) {
|
|
2001
|
+
if ("superClass" in node && node.superClass != null) {
|
|
2002
|
+
const re = /^(?:Pure)?Component$/u;
|
|
2003
|
+
switch (true) {
|
|
2004
|
+
case node.superClass.type === types.AST_NODE_TYPES.Identifier:
|
|
2005
|
+
return re.test(node.superClass.name);
|
|
2006
|
+
case (node.superClass.type === types.AST_NODE_TYPES.MemberExpression && node.superClass.property.type === types.AST_NODE_TYPES.Identifier):
|
|
2007
|
+
return re.test(node.superClass.property.name);
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
return false;
|
|
2011
|
+
}
|
|
2012
|
+
function isPureComponent(node) {
|
|
2013
|
+
if ("superClass" in node && node.superClass != null) {
|
|
2014
|
+
const re = /^PureComponent$/u;
|
|
2015
|
+
switch (true) {
|
|
2016
|
+
case node.superClass.type === types.AST_NODE_TYPES.Identifier:
|
|
2017
|
+
return re.test(node.superClass.name);
|
|
2018
|
+
case (node.superClass.type === types.AST_NODE_TYPES.MemberExpression && node.superClass.property.type === types.AST_NODE_TYPES.Identifier):
|
|
2019
|
+
return re.test(node.superClass.property.name);
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
return false;
|
|
2023
|
+
}
|
|
1751
2024
|
function isComponentDidCatch(node) {
|
|
1752
|
-
return
|
|
2025
|
+
return AST8__namespace.isMethodOrProperty(node) && !node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentDidCatch";
|
|
1753
2026
|
}
|
|
1754
2027
|
function isComponentDidMount(node) {
|
|
1755
|
-
return
|
|
2028
|
+
return AST8__namespace.isMethodOrProperty(node) && !node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentDidMount";
|
|
1756
2029
|
}
|
|
1757
2030
|
function isComponentDidUpdate(node) {
|
|
1758
|
-
return
|
|
2031
|
+
return AST8__namespace.isMethodOrProperty(node) && !node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentDidUpdate";
|
|
1759
2032
|
}
|
|
1760
2033
|
function isComponentWillMount(node) {
|
|
1761
|
-
return
|
|
2034
|
+
return AST8__namespace.isMethodOrProperty(node) && !node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentWillMount";
|
|
1762
2035
|
}
|
|
1763
2036
|
function isComponentWillReceiveProps(node) {
|
|
1764
|
-
return
|
|
2037
|
+
return AST8__namespace.isMethodOrProperty(node) && !node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentWillReceiveProps";
|
|
1765
2038
|
}
|
|
1766
2039
|
function isComponentWillUnmount(node) {
|
|
1767
|
-
return
|
|
2040
|
+
return AST8__namespace.isMethodOrProperty(node) && !node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentWillUnmount";
|
|
1768
2041
|
}
|
|
1769
2042
|
function isComponentWillUpdate(node) {
|
|
1770
|
-
return
|
|
2043
|
+
return AST8__namespace.isMethodOrProperty(node) && !node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentWillUpdate";
|
|
1771
2044
|
}
|
|
1772
2045
|
function isGetChildContext(node) {
|
|
1773
|
-
return
|
|
2046
|
+
return AST8__namespace.isMethodOrProperty(node) && !node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "getChildContext";
|
|
1774
2047
|
}
|
|
1775
2048
|
function isGetDefaultProps(node) {
|
|
1776
|
-
return
|
|
2049
|
+
return AST8__namespace.isMethodOrProperty(node) && node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "getDefaultProps";
|
|
1777
2050
|
}
|
|
1778
2051
|
function isGetInitialState(node) {
|
|
1779
|
-
return
|
|
2052
|
+
return AST8__namespace.isMethodOrProperty(node) && !node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "getInitialState";
|
|
1780
2053
|
}
|
|
1781
2054
|
function isGetSnapshotBeforeUpdate(node) {
|
|
1782
|
-
return
|
|
2055
|
+
return AST8__namespace.isMethodOrProperty(node) && !node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "getSnapshotBeforeUpdate";
|
|
1783
2056
|
}
|
|
1784
2057
|
function isShouldComponentUpdate(node) {
|
|
1785
|
-
return
|
|
2058
|
+
return AST8__namespace.isMethodOrProperty(node) && !node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "shouldComponentUpdate";
|
|
1786
2059
|
}
|
|
1787
2060
|
function isUnsafeComponentWillMount(node) {
|
|
1788
|
-
return
|
|
2061
|
+
return AST8__namespace.isMethodOrProperty(node) && !node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillMount";
|
|
1789
2062
|
}
|
|
1790
2063
|
function isUnsafeComponentWillReceiveProps(node) {
|
|
1791
|
-
return
|
|
2064
|
+
return AST8__namespace.isMethodOrProperty(node) && !node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillReceiveProps";
|
|
1792
2065
|
}
|
|
1793
2066
|
function isUnsafeComponentWillUpdate(node) {
|
|
1794
|
-
return
|
|
2067
|
+
return AST8__namespace.isMethodOrProperty(node) && !node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillUpdate";
|
|
1795
2068
|
}
|
|
1796
2069
|
function isGetDerivedStateFromProps(node) {
|
|
1797
|
-
return
|
|
2070
|
+
return AST8__namespace.isMethodOrProperty(node) && node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "getDerivedStateFromProps";
|
|
1798
2071
|
}
|
|
1799
2072
|
function isGetDerivedStateFromError(node) {
|
|
1800
|
-
return
|
|
2073
|
+
return AST8__namespace.isMethodOrProperty(node) && node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "getDerivedStateFromError";
|
|
1801
2074
|
}
|
|
1802
|
-
function isClassComponent(node) {
|
|
1803
|
-
if ("superClass" in node && node.superClass != null) {
|
|
1804
|
-
const re = /^(?:Pure)?Component$/u;
|
|
1805
|
-
switch (true) {
|
|
1806
|
-
case node.superClass.type === types.AST_NODE_TYPES.Identifier:
|
|
1807
|
-
return re.test(node.superClass.name);
|
|
1808
|
-
case (node.superClass.type === types.AST_NODE_TYPES.MemberExpression && node.superClass.property.type === types.AST_NODE_TYPES.Identifier):
|
|
1809
|
-
return re.test(node.superClass.property.name);
|
|
1810
|
-
}
|
|
1811
|
-
}
|
|
1812
|
-
return false;
|
|
1813
|
-
}
|
|
1814
|
-
function isPureComponent(node) {
|
|
1815
|
-
if ("superClass" in node && node.superClass != null) {
|
|
1816
|
-
const re = /^PureComponent$/u;
|
|
1817
|
-
switch (true) {
|
|
1818
|
-
case node.superClass.type === types.AST_NODE_TYPES.Identifier:
|
|
1819
|
-
return re.test(node.superClass.name);
|
|
1820
|
-
case (node.superClass.type === types.AST_NODE_TYPES.MemberExpression && node.superClass.property.type === types.AST_NODE_TYPES.Identifier):
|
|
1821
|
-
return re.test(node.superClass.property.name);
|
|
1822
|
-
}
|
|
1823
|
-
}
|
|
1824
|
-
return false;
|
|
1825
|
-
}
|
|
1826
|
-
|
|
1827
|
-
// src/component/component-render.ts
|
|
1828
2075
|
function isRenderLike(node) {
|
|
1829
|
-
return
|
|
2076
|
+
return AST8__namespace.isMethodOrProperty(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "render" && node.parent.parent.type === types.AST_NODE_TYPES.ClassDeclaration;
|
|
1830
2077
|
}
|
|
1831
2078
|
function isFunctionOfRender(node) {
|
|
1832
2079
|
if (!isRenderLike(node.parent)) {
|
|
@@ -1835,10 +2082,10 @@ function isFunctionOfRender(node) {
|
|
|
1835
2082
|
return isClassComponent(node.parent.parent.parent);
|
|
1836
2083
|
}
|
|
1837
2084
|
function isRenderMethodLike(node) {
|
|
1838
|
-
return
|
|
2085
|
+
return AST8__namespace.isMethodOrProperty(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name.startsWith("render") && node.parent.parent.type === types.AST_NODE_TYPES.ClassDeclaration;
|
|
1839
2086
|
}
|
|
1840
2087
|
|
|
1841
|
-
// src/component/hierarchy.ts
|
|
2088
|
+
// src/component/component-hierarchy.ts
|
|
1842
2089
|
function isChildrenOfCreateElement(context, node) {
|
|
1843
2090
|
const parent = node.parent;
|
|
1844
2091
|
if (parent == null || parent.type !== types.AST_NODE_TYPES.CallExpression) return false;
|
|
@@ -1846,13 +2093,13 @@ function isChildrenOfCreateElement(context, node) {
|
|
|
1846
2093
|
return parent.arguments.slice(2).some((arg) => arg === node);
|
|
1847
2094
|
}
|
|
1848
2095
|
function isInsideRenderMethod(node) {
|
|
1849
|
-
return
|
|
2096
|
+
return AST8__namespace.findParentNode(node, (n) => isRenderLike(n) && isClassComponent(n.parent.parent)) != null;
|
|
1850
2097
|
}
|
|
1851
2098
|
function isFunctionOfComponentDidMount(node) {
|
|
1852
|
-
return
|
|
2099
|
+
return AST8__namespace.isFunction(node) && isComponentDidMount(node.parent) && node.parent.value === node;
|
|
1853
2100
|
}
|
|
1854
2101
|
function isFunctionOfComponentWillUnmount(node) {
|
|
1855
|
-
return
|
|
2102
|
+
return AST8__namespace.isFunction(node) && isComponentWillUnmount(node.parent) && node.parent.value === node;
|
|
1856
2103
|
}
|
|
1857
2104
|
function isFunctionOfRenderMethod(node) {
|
|
1858
2105
|
if (!isRenderMethodLike(node.parent)) {
|
|
@@ -1892,12 +2139,12 @@ function isValidComponentDefinition(context, node, hint) {
|
|
|
1892
2139
|
if (hint & ComponentDetectionHint.SkipClassProperty && isFunctionOfClassProperty(node.parent)) {
|
|
1893
2140
|
return false;
|
|
1894
2141
|
}
|
|
1895
|
-
if (hint & ComponentDetectionHint.SkipArrayMapArgument &&
|
|
2142
|
+
if (hint & ComponentDetectionHint.SkipArrayMapArgument && AST8__namespace.isArrayMapCall(node.parent)) {
|
|
1896
2143
|
return false;
|
|
1897
2144
|
}
|
|
1898
|
-
const significantParent =
|
|
2145
|
+
const significantParent = AST8__namespace.findParentNode(
|
|
1899
2146
|
node,
|
|
1900
|
-
|
|
2147
|
+
AST8__namespace.isOneOf([
|
|
1901
2148
|
types.AST_NODE_TYPES.JSXExpressionContainer,
|
|
1902
2149
|
types.AST_NODE_TYPES.ArrowFunctionExpression,
|
|
1903
2150
|
types.AST_NODE_TYPES.FunctionExpression,
|
|
@@ -1918,7 +2165,7 @@ function isComponentWrapperCallLoose(context, node) {
|
|
|
1918
2165
|
|
|
1919
2166
|
// src/component/component-id.ts
|
|
1920
2167
|
function getFunctionComponentId(context, node) {
|
|
1921
|
-
const functionId =
|
|
2168
|
+
const functionId = AST8__namespace.getFunctionIdentifier(node);
|
|
1922
2169
|
if (functionId != null) {
|
|
1923
2170
|
return functionId;
|
|
1924
2171
|
}
|
|
@@ -1945,10 +2192,10 @@ var ComponentFlag = {
|
|
|
1945
2192
|
// src/component/component-init-path.ts
|
|
1946
2193
|
function getComponentFlagFromInitPath(initPath) {
|
|
1947
2194
|
let flag = ComponentFlag.None;
|
|
1948
|
-
if (initPath != null &&
|
|
2195
|
+
if (initPath != null && AST8__namespace.hasCallInFunctionInitPath("memo", initPath)) {
|
|
1949
2196
|
flag |= ComponentFlag.Memo;
|
|
1950
2197
|
}
|
|
1951
|
-
if (initPath != null &&
|
|
2198
|
+
if (initPath != null && AST8__namespace.hasCallInFunctionInitPath("forwardRef", initPath)) {
|
|
1952
2199
|
flag |= ComponentFlag.ForwardRef;
|
|
1953
2200
|
}
|
|
1954
2201
|
return flag;
|
|
@@ -1988,8 +2235,8 @@ function useComponentCollector(context, options = {}) {
|
|
|
1988
2235
|
const entry = functionEntries.at(-1);
|
|
1989
2236
|
if (entry == null) return;
|
|
1990
2237
|
if (!entry.isComponent) return functionEntries.pop();
|
|
1991
|
-
const shouldDrop =
|
|
1992
|
-
return context.sourceCode.getScope(r).block === entry.node && r.argument != null && !
|
|
2238
|
+
const shouldDrop = AST8__namespace.getNestedReturnStatements(entry.node.body).slice().reverse().some((r) => {
|
|
2239
|
+
return context.sourceCode.getScope(r).block === entry.node && r.argument != null && !isJsxLike(context.sourceCode, r.argument, hint);
|
|
1993
2240
|
});
|
|
1994
2241
|
if (shouldDrop) {
|
|
1995
2242
|
components.delete(entry.key);
|
|
@@ -2013,9 +2260,9 @@ function useComponentCollector(context, options = {}) {
|
|
|
2013
2260
|
const entry = getCurrentEntry();
|
|
2014
2261
|
if (entry == null) return;
|
|
2015
2262
|
const { body } = entry.node;
|
|
2016
|
-
const isComponent = hasNoneOrLooseComponentName(context, entry.node) &&
|
|
2263
|
+
const isComponent = hasNoneOrLooseComponentName(context, entry.node) && isJsxLike(context.sourceCode, body, hint) && isValidComponentDefinition(context, entry.node, hint);
|
|
2017
2264
|
if (!isComponent) return;
|
|
2018
|
-
const initPath =
|
|
2265
|
+
const initPath = AST8__namespace.getFunctionInitPath(entry.node);
|
|
2019
2266
|
const id = getFunctionComponentId(context, entry.node);
|
|
2020
2267
|
const name = getComponentNameFromId(id);
|
|
2021
2268
|
const key = shared.getId();
|
|
@@ -2053,10 +2300,10 @@ function useComponentCollector(context, options = {}) {
|
|
|
2053
2300
|
"ReturnStatement[type]"(node) {
|
|
2054
2301
|
const entry = getCurrentEntry();
|
|
2055
2302
|
if (entry == null) return;
|
|
2056
|
-
const isComponent = hasNoneOrLooseComponentName(context, entry.node) &&
|
|
2303
|
+
const isComponent = hasNoneOrLooseComponentName(context, entry.node) && isJsxLike(context.sourceCode, node.argument, hint) && isValidComponentDefinition(context, entry.node, hint);
|
|
2057
2304
|
if (!isComponent) return;
|
|
2058
2305
|
entry.isComponent = true;
|
|
2059
|
-
const initPath =
|
|
2306
|
+
const initPath = AST8__namespace.getFunctionInitPath(entry.node);
|
|
2060
2307
|
const id = getFunctionComponentId(context, entry.node);
|
|
2061
2308
|
const name = getComponentNameFromId(id);
|
|
2062
2309
|
components.set(entry.key, {
|
|
@@ -2087,7 +2334,7 @@ function useComponentCollectorLegacy() {
|
|
|
2087
2334
|
if (!isClassComponent(node)) {
|
|
2088
2335
|
return;
|
|
2089
2336
|
}
|
|
2090
|
-
const id =
|
|
2337
|
+
const id = AST8__namespace.getClassIdentifier(node);
|
|
2091
2338
|
const key = shared.getId();
|
|
2092
2339
|
const flag = isPureComponent(node) ? ComponentFlag.PureComponent : ComponentFlag.None;
|
|
2093
2340
|
components.set(
|
|
@@ -2120,20 +2367,20 @@ var ComponentPhaseRelevance = birecord__default.default({
|
|
|
2120
2367
|
var isInversePhase = eff.dual(2, (a, b) => ComponentPhaseRelevance.get(a) === b);
|
|
2121
2368
|
function isRenderFunctionLoose(context, node) {
|
|
2122
2369
|
const { body, parent } = node;
|
|
2123
|
-
if (
|
|
2370
|
+
if (AST8__namespace.getFunctionIdentifier(node)?.name.startsWith("render")) {
|
|
2124
2371
|
return parent.type === types.AST_NODE_TYPES.JSXExpressionContainer && parent.parent.type === types.AST_NODE_TYPES.JSXAttribute && parent.parent.name.type === types.AST_NODE_TYPES.JSXIdentifier && parent.parent.name.name.startsWith("render");
|
|
2125
2372
|
}
|
|
2126
|
-
return
|
|
2373
|
+
return isJsxLike(
|
|
2127
2374
|
context.sourceCode,
|
|
2128
2375
|
body,
|
|
2129
|
-
|
|
2376
|
+
JSXDetectionHint.SkipNullLiteral | JSXDetectionHint.SkipUndefined | JSXDetectionHint.StrictLogical | JSXDetectionHint.StrictConditional
|
|
2130
2377
|
);
|
|
2131
2378
|
}
|
|
2132
2379
|
function isRenderPropLoose(context, node) {
|
|
2133
2380
|
if (node.name.type !== types.AST_NODE_TYPES.JSXIdentifier) {
|
|
2134
2381
|
return false;
|
|
2135
2382
|
}
|
|
2136
|
-
return node.name.name.startsWith("render") && node.value?.type === types.AST_NODE_TYPES.JSXExpressionContainer &&
|
|
2383
|
+
return node.name.name.startsWith("render") && node.value?.type === types.AST_NODE_TYPES.JSXExpressionContainer && AST8__namespace.isFunction(node.value.expression) && isRenderFunctionLoose(context, node.value.expression);
|
|
2137
2384
|
}
|
|
2138
2385
|
function isDirectValueOfRenderPropertyLoose(node) {
|
|
2139
2386
|
const matching = (node2) => {
|
|
@@ -2145,7 +2392,7 @@ function isDeclaredInRenderPropLoose(node) {
|
|
|
2145
2392
|
if (isDirectValueOfRenderPropertyLoose(node)) {
|
|
2146
2393
|
return true;
|
|
2147
2394
|
}
|
|
2148
|
-
const parent =
|
|
2395
|
+
const parent = AST8__namespace.findParentNode(node, AST8__namespace.is(types.AST_NODE_TYPES.JSXExpressionContainer))?.parent;
|
|
2149
2396
|
if (parent?.type !== types.AST_NODE_TYPES.JSXAttribute) {
|
|
2150
2397
|
return false;
|
|
2151
2398
|
}
|
|
@@ -2153,21 +2400,31 @@ function isDeclaredInRenderPropLoose(node) {
|
|
|
2153
2400
|
}
|
|
2154
2401
|
function isThisSetState(node) {
|
|
2155
2402
|
const { callee } = node;
|
|
2156
|
-
return callee.type === types.AST_NODE_TYPES.MemberExpression &&
|
|
2403
|
+
return callee.type === types.AST_NODE_TYPES.MemberExpression && AST8__namespace.isThisExpression(callee.object) && callee.property.type === types.AST_NODE_TYPES.Identifier && callee.property.name === "setState";
|
|
2157
2404
|
}
|
|
2158
2405
|
function isAssignmentToThisState(node) {
|
|
2159
2406
|
const { left } = node;
|
|
2160
|
-
return left.type === types.AST_NODE_TYPES.MemberExpression &&
|
|
2407
|
+
return left.type === types.AST_NODE_TYPES.MemberExpression && AST8__namespace.isThisExpression(left.object) && AST8__namespace.getPropertyName(left.property) === "state";
|
|
2161
2408
|
}
|
|
2162
2409
|
|
|
2163
2410
|
exports.ComponentDetectionHint = ComponentDetectionHint;
|
|
2164
2411
|
exports.ComponentFlag = ComponentFlag;
|
|
2165
2412
|
exports.ComponentPhaseRelevance = ComponentPhaseRelevance;
|
|
2166
2413
|
exports.DEFAULT_COMPONENT_DETECTION_HINT = DEFAULT_COMPONENT_DETECTION_HINT;
|
|
2414
|
+
exports.DEFAULT_JSX_DETECTION_HINT = DEFAULT_JSX_DETECTION_HINT;
|
|
2415
|
+
exports.JSXDetectionHint = JSXDetectionHint;
|
|
2416
|
+
exports.findParentAttribute = findParentAttribute;
|
|
2417
|
+
exports.getAttribute = getAttribute;
|
|
2418
|
+
exports.getAttributeName = getAttributeName;
|
|
2419
|
+
exports.getAttributeValue = getAttributeValue;
|
|
2167
2420
|
exports.getComponentFlagFromInitPath = getComponentFlagFromInitPath;
|
|
2168
2421
|
exports.getComponentNameFromId = getComponentNameFromId;
|
|
2422
|
+
exports.getElementType = getElementType;
|
|
2169
2423
|
exports.getFunctionComponentId = getFunctionComponentId;
|
|
2170
2424
|
exports.getInstanceId = getInstanceId;
|
|
2425
|
+
exports.hasAnyAttribute = hasAnyAttribute;
|
|
2426
|
+
exports.hasAttribute = hasAttribute;
|
|
2427
|
+
exports.hasEveryAttribute = hasEveryAttribute;
|
|
2171
2428
|
exports.hasNoneOrLooseComponentName = hasNoneOrLooseComponentName;
|
|
2172
2429
|
exports.isAssignmentToThisState = isAssignmentToThisState;
|
|
2173
2430
|
exports.isCallFromReact = isCallFromReact;
|
|
@@ -2209,6 +2466,7 @@ exports.isDeclaredInRenderPropLoose = isDeclaredInRenderPropLoose;
|
|
|
2209
2466
|
exports.isDirectValueOfRenderPropertyLoose = isDirectValueOfRenderPropertyLoose;
|
|
2210
2467
|
exports.isForwardRef = isForwardRef;
|
|
2211
2468
|
exports.isForwardRefCall = isForwardRefCall;
|
|
2469
|
+
exports.isFragmentElement = isFragmentElement;
|
|
2212
2470
|
exports.isFromReact = isFromReact;
|
|
2213
2471
|
exports.isFromReactLoose = isFromReactLoose;
|
|
2214
2472
|
exports.isFromReactObject = isFromReactObject;
|
|
@@ -2225,10 +2483,15 @@ exports.isGetDerivedStateFromError = isGetDerivedStateFromError;
|
|
|
2225
2483
|
exports.isGetDerivedStateFromProps = isGetDerivedStateFromProps;
|
|
2226
2484
|
exports.isGetInitialState = isGetInitialState;
|
|
2227
2485
|
exports.isGetSnapshotBeforeUpdate = isGetSnapshotBeforeUpdate;
|
|
2486
|
+
exports.isHostElement = isHostElement;
|
|
2228
2487
|
exports.isInitializedFromReact = isInitializedFromReact;
|
|
2229
2488
|
exports.isInsideRenderMethod = isInsideRenderMethod;
|
|
2230
2489
|
exports.isInstanceIdEqual = isInstanceIdEqual;
|
|
2231
2490
|
exports.isInversePhase = isInversePhase;
|
|
2491
|
+
exports.isJSX = isJSX;
|
|
2492
|
+
exports.isJsxLike = isJsxLike;
|
|
2493
|
+
exports.isJsxText = isJsxText;
|
|
2494
|
+
exports.isKeyedElement = isKeyedElement;
|
|
2232
2495
|
exports.isLazy = isLazy;
|
|
2233
2496
|
exports.isLazyCall = isLazyCall;
|
|
2234
2497
|
exports.isMemo = isMemo;
|
|
@@ -2272,6 +2535,7 @@ exports.isUseStateCall = isUseStateCall;
|
|
|
2272
2535
|
exports.isUseSyncExternalStoreCall = isUseSyncExternalStoreCall;
|
|
2273
2536
|
exports.isUseTransitionCall = isUseTransitionCall;
|
|
2274
2537
|
exports.isValidComponentDefinition = isValidComponentDefinition;
|
|
2538
|
+
exports.stringifyJsx = stringifyJsx;
|
|
2275
2539
|
exports.useComponentCollector = useComponentCollector;
|
|
2276
2540
|
exports.useComponentCollectorLegacy = useComponentCollectorLegacy;
|
|
2277
2541
|
exports.useHookCollector = useHookCollector;
|