@tamagui/language-service 0.0.0-bootstrap.0 → 3.0.0-beta.643.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/README.md +140 -1
- package/dist/cjs/check.cjs +173 -0
- package/dist/cjs/check.native.cjs +369 -0
- package/dist/cjs/check.native.js +371 -0
- package/dist/cjs/check.native.js.map +1 -0
- package/dist/cjs/core.cjs +221 -0
- package/dist/cjs/core.native.cjs +305 -0
- package/dist/cjs/core.native.js +307 -0
- package/dist/cjs/core.native.js.map +1 -0
- package/dist/cjs/document.cjs +82 -0
- package/dist/cjs/document.native.cjs +158 -0
- package/dist/cjs/document.native.js +160 -0
- package/dist/cjs/document.native.js.map +1 -0
- package/dist/cjs/extract-estree.cjs +193 -0
- package/dist/cjs/extract-estree.native.cjs +296 -0
- package/dist/cjs/extract-estree.native.js +298 -0
- package/dist/cjs/extract-estree.native.js.map +1 -0
- package/dist/cjs/extract-sucrase.cjs +222 -0
- package/dist/cjs/extract-sucrase.native.cjs +256 -0
- package/dist/cjs/extract-sucrase.native.js +258 -0
- package/dist/cjs/extract-sucrase.native.js.map +1 -0
- package/dist/cjs/host.cjs +38 -0
- package/dist/cjs/host.native.cjs +61 -0
- package/dist/cjs/host.native.js +63 -0
- package/dist/cjs/host.native.js.map +1 -0
- package/dist/cjs/index.cjs +301 -0
- package/dist/cjs/index.native.cjs +414 -0
- package/dist/cjs/index.native.js +416 -0
- package/dist/cjs/index.native.js.map +1 -0
- package/dist/esm/check.mjs +148 -0
- package/dist/esm/check.mjs.map +1 -0
- package/dist/esm/check.native.js +342 -0
- package/dist/esm/check.native.js.map +1 -0
- package/dist/esm/core.mjs +198 -0
- package/dist/esm/core.mjs.map +1 -0
- package/dist/esm/core.native.js +280 -0
- package/dist/esm/core.native.js.map +1 -0
- package/dist/esm/document.mjs +61 -0
- package/dist/esm/document.mjs.map +1 -0
- package/dist/esm/document.native.js +135 -0
- package/dist/esm/document.native.js.map +1 -0
- package/dist/esm/extract-estree.mjs +172 -0
- package/dist/esm/extract-estree.mjs.map +1 -0
- package/dist/esm/extract-estree.native.js +273 -0
- package/dist/esm/extract-estree.native.js.map +1 -0
- package/dist/esm/extract-sucrase.mjs +201 -0
- package/dist/esm/extract-sucrase.mjs.map +1 -0
- package/dist/esm/extract-sucrase.native.js +233 -0
- package/dist/esm/extract-sucrase.native.js.map +1 -0
- package/dist/esm/host.mjs +17 -0
- package/dist/esm/host.mjs.map +1 -0
- package/dist/esm/host.native.js +38 -0
- package/dist/esm/host.native.js.map +1 -0
- package/dist/esm/index.mjs +281 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/index.native.js +392 -0
- package/dist/esm/index.native.js.map +1 -0
- package/index.cjs +1 -0
- package/package.json +79 -7
- package/src/check.ts +204 -0
- package/src/core.ts +355 -0
- package/src/document.ts +140 -0
- package/src/extract-estree.ts +251 -0
- package/src/extract-sucrase.ts +308 -0
- package/src/host.ts +32 -0
- package/src/index.ts +452 -0
- package/types/check.d.ts +31 -0
- package/types/check.d.ts.map +11 -0
- package/types/core.d.ts +68 -0
- package/types/core.d.ts.map +11 -0
- package/types/document.d.ts +42 -0
- package/types/document.d.ts.map +11 -0
- package/types/extract-estree.d.ts +19 -0
- package/types/extract-estree.d.ts.map +11 -0
- package/types/extract-sucrase.d.ts +26 -0
- package/types/extract-sucrase.d.ts.map +11 -0
- package/types/host.d.ts +10 -0
- package/types/host.d.ts.map +11 -0
- package/types/index.d.ts +9 -0
- package/types/index.d.ts.map +11 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
function defaultIsTamaguiModule(source) {
|
|
2
|
+
return source === "tamagui" || source.startsWith("tamagui/") || source.startsWith("@tamagui/");
|
|
3
|
+
}
|
|
4
|
+
function span(node) {
|
|
5
|
+
if (node.range) return node.range;
|
|
6
|
+
if (typeof node.start === "number" && typeof node.end === "number") {
|
|
7
|
+
return [node.start, node.end];
|
|
8
|
+
}
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
function staticString(node) {
|
|
12
|
+
if (!node) return null;
|
|
13
|
+
const at = span(node);
|
|
14
|
+
if (!at) return null;
|
|
15
|
+
if (node.type === "Literal") {
|
|
16
|
+
const value = node.value;
|
|
17
|
+
if (typeof value !== "string") return null;
|
|
18
|
+
const raw = node.raw;
|
|
19
|
+
if (typeof raw === "string" && raw.slice(1, -1) !== value) return null;
|
|
20
|
+
return {
|
|
21
|
+
value,
|
|
22
|
+
start: at[0] + 1,
|
|
23
|
+
end: at[1] - 1
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
if (node.type === "TemplateLiteral") {
|
|
27
|
+
const expressions = node.expressions;
|
|
28
|
+
const quasis = node.quasis;
|
|
29
|
+
if (expressions?.length !== 0 || quasis?.length !== 1) return null;
|
|
30
|
+
const cooked = quasis[0]?.value?.cooked;
|
|
31
|
+
if (typeof cooked !== "string") return null;
|
|
32
|
+
if (quasis[0]?.value?.raw !== cooked) return null;
|
|
33
|
+
return {
|
|
34
|
+
value: cooked,
|
|
35
|
+
start: at[0] + 1,
|
|
36
|
+
end: at[1] - 1
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
function identifierName(node) {
|
|
42
|
+
if (!node) return null;
|
|
43
|
+
if (node.type === "Identifier" || node.type === "JSXIdentifier") {
|
|
44
|
+
return typeof node.name === "string" ? node.name : null;
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
function jsxRootName(name) {
|
|
49
|
+
let current = name;
|
|
50
|
+
while (current?.type === "JSXMemberExpression") {
|
|
51
|
+
current = current.object;
|
|
52
|
+
}
|
|
53
|
+
return identifierName(current);
|
|
54
|
+
}
|
|
55
|
+
const skipKeys = /* @__PURE__ */ new Set([
|
|
56
|
+
"parent",
|
|
57
|
+
"loc",
|
|
58
|
+
"range",
|
|
59
|
+
"leadingComments",
|
|
60
|
+
"trailingComments"
|
|
61
|
+
]);
|
|
62
|
+
function walk(node, visit) {
|
|
63
|
+
visit(node);
|
|
64
|
+
for (const key in node) {
|
|
65
|
+
if (skipKeys.has(key)) continue;
|
|
66
|
+
const value = node[key];
|
|
67
|
+
if (Array.isArray(value)) {
|
|
68
|
+
for (const item of value) {
|
|
69
|
+
if (item && typeof item === "object" && typeof item.type === "string") {
|
|
70
|
+
walk(item, visit);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
} else if (value && typeof value === "object" && typeof value.type === "string") {
|
|
74
|
+
walk(value, visit);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function extractStyleSitesFromEstree(program, options = {}) {
|
|
79
|
+
const isStyleProp = options.isStyleProp ?? (() => true);
|
|
80
|
+
const isTamaguiModule = options.isTamaguiModule ?? defaultIsTamaguiModule;
|
|
81
|
+
const root = program;
|
|
82
|
+
const styledBindings = /* @__PURE__ */ new Set();
|
|
83
|
+
const componentNames = /* @__PURE__ */ new Set();
|
|
84
|
+
walk(root, (node) => {
|
|
85
|
+
if (node.type === "ImportDeclaration") {
|
|
86
|
+
const source = node.source?.value;
|
|
87
|
+
if (typeof source !== "string" || !isTamaguiModule(source)) return;
|
|
88
|
+
for (const specifier of node.specifiers || []) {
|
|
89
|
+
const local = identifierName(specifier.local);
|
|
90
|
+
if (!local) continue;
|
|
91
|
+
if (specifier.type === "ImportNamespaceSpecifier") {
|
|
92
|
+
componentNames.add(local);
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (specifier.type !== "ImportSpecifier") continue;
|
|
96
|
+
const importedNode = specifier.imported;
|
|
97
|
+
const imported = identifierName(importedNode) ?? (typeof importedNode?.value === "string" ? importedNode.value : null);
|
|
98
|
+
if (imported === "styled") styledBindings.add(local);
|
|
99
|
+
else if (imported && /^[A-Z]/.test(imported)) componentNames.add(local);
|
|
100
|
+
}
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (node.type === "VariableDeclarator") {
|
|
104
|
+
const name = identifierName(node.id);
|
|
105
|
+
const init = node.init;
|
|
106
|
+
if (name && init?.type === "CallExpression" && identifierName(init.callee) !== null && styledBindings.has(identifierName(init.callee))) {
|
|
107
|
+
componentNames.add(name);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
const sites = [];
|
|
112
|
+
const pushSite = (property, valueNode, kind) => {
|
|
113
|
+
if (!isStyleProp(property)) return;
|
|
114
|
+
const content = staticString(valueNode);
|
|
115
|
+
if (!content) return;
|
|
116
|
+
sites.push({
|
|
117
|
+
property,
|
|
118
|
+
value: content.value,
|
|
119
|
+
start: content.start,
|
|
120
|
+
end: content.end,
|
|
121
|
+
kind,
|
|
122
|
+
node: valueNode
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
const visitStyleObject = (object) => {
|
|
126
|
+
for (const member of object.properties || []) {
|
|
127
|
+
if (member.type !== "Property") continue;
|
|
128
|
+
if (member.computed) continue;
|
|
129
|
+
const key = member.key;
|
|
130
|
+
const property = identifierName(key) ?? (typeof key?.value === "string" ? key.value : null);
|
|
131
|
+
const value = member.value;
|
|
132
|
+
if (property && isStyleProp(property)) {
|
|
133
|
+
pushSite(property, value, "styled-property");
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if (value?.type === "ObjectExpression") {
|
|
137
|
+
visitStyleObject(value);
|
|
138
|
+
} else if (value?.type === "ArrayExpression") {
|
|
139
|
+
for (const element of value.elements || []) {
|
|
140
|
+
if (element?.type === "ObjectExpression") visitStyleObject(element);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
walk(root, (node) => {
|
|
146
|
+
if (node.type === "CallExpression") {
|
|
147
|
+
const callee = identifierName(node.callee);
|
|
148
|
+
if (!callee || !styledBindings.has(callee)) return;
|
|
149
|
+
const definition = node.arguments?.[1];
|
|
150
|
+
if (definition?.type === "ObjectExpression") visitStyleObject(definition);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (node.type === "JSXOpeningElement") {
|
|
154
|
+
const componentRoot = jsxRootName(node.name);
|
|
155
|
+
const accepted = options.allComponents ? componentRoot !== null && /^[A-Z]/.test(componentRoot) : componentRoot !== null && componentNames.has(componentRoot);
|
|
156
|
+
if (!accepted) return;
|
|
157
|
+
for (const attribute of node.attributes || []) {
|
|
158
|
+
if (attribute.type !== "JSXAttribute") continue;
|
|
159
|
+
const property = identifierName(attribute.name);
|
|
160
|
+
if (!property) continue;
|
|
161
|
+
const rawValue = attribute.value;
|
|
162
|
+
const valueNode = rawValue?.type === "JSXExpressionContainer" ? rawValue.expression : rawValue;
|
|
163
|
+
if (valueNode) pushSite(property, valueNode, "jsx-attribute");
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
sites.sort((a, b) => a.start - b.start);
|
|
168
|
+
return sites;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export { extractStyleSitesFromEstree };
|
|
172
|
+
//# sourceMappingURL=extract-estree.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract-estree.js","names":[],"sources":["esm/extract-estree.js"],"sourcesContent":["function defaultIsTamaguiModule(source) {\n return source === \"tamagui\" || source.startsWith(\"tamagui/\") || source.startsWith(\"@tamagui/\");\n}\nfunction span(node) {\n if (node.range) return node.range;\n if (typeof node.start === \"number\" && typeof node.end === \"number\") {\n return [node.start, node.end];\n }\n return null;\n}\nfunction staticString(node) {\n if (!node) return null;\n const at = span(node);\n if (!at) return null;\n if (node.type === \"Literal\") {\n const value = node.value;\n if (typeof value !== \"string\") return null;\n const raw = node.raw;\n if (typeof raw === \"string\" && raw.slice(1, -1) !== value) return null;\n return { value, start: at[0] + 1, end: at[1] - 1 };\n }\n if (node.type === \"TemplateLiteral\") {\n const expressions = node.expressions;\n const quasis = node.quasis;\n if (expressions?.length !== 0 || quasis?.length !== 1) return null;\n const cooked = quasis[0]?.value?.cooked;\n if (typeof cooked !== \"string\") return null;\n if (quasis[0]?.value?.raw !== cooked) return null;\n return { value: cooked, start: at[0] + 1, end: at[1] - 1 };\n }\n return null;\n}\nfunction identifierName(node) {\n if (!node) return null;\n if (node.type === \"Identifier\" || node.type === \"JSXIdentifier\") {\n return typeof node.name === \"string\" ? node.name : null;\n }\n return null;\n}\nfunction jsxRootName(name) {\n let current = name;\n while (current?.type === \"JSXMemberExpression\") {\n current = current.object;\n }\n return identifierName(current);\n}\nconst skipKeys = /* @__PURE__ */ new Set([\n \"parent\",\n \"loc\",\n \"range\",\n \"leadingComments\",\n \"trailingComments\"\n]);\nfunction walk(node, visit) {\n visit(node);\n for (const key in node) {\n if (skipKeys.has(key)) continue;\n const value = node[key];\n if (Array.isArray(value)) {\n for (const item of value) {\n if (item && typeof item === \"object\" && typeof item.type === \"string\") {\n walk(item, visit);\n }\n }\n } else if (value && typeof value === \"object\" && typeof value.type === \"string\") {\n walk(value, visit);\n }\n }\n}\nfunction extractStyleSitesFromEstree(program, options = {}) {\n const isStyleProp = options.isStyleProp ?? (() => true);\n const isTamaguiModule = options.isTamaguiModule ?? defaultIsTamaguiModule;\n const root = program;\n const styledBindings = /* @__PURE__ */ new Set();\n const componentNames = /* @__PURE__ */ new Set();\n walk(root, (node) => {\n if (node.type === \"ImportDeclaration\") {\n const source = node.source?.value;\n if (typeof source !== \"string\" || !isTamaguiModule(source)) return;\n for (const specifier of node.specifiers || []) {\n const local = identifierName(specifier.local);\n if (!local) continue;\n if (specifier.type === \"ImportNamespaceSpecifier\") {\n componentNames.add(local);\n continue;\n }\n if (specifier.type !== \"ImportSpecifier\") continue;\n const importedNode = specifier.imported;\n const imported = identifierName(importedNode) ?? (typeof importedNode?.value === \"string\" ? importedNode.value : null);\n if (imported === \"styled\") styledBindings.add(local);\n else if (imported && /^[A-Z]/.test(imported)) componentNames.add(local);\n }\n return;\n }\n if (node.type === \"VariableDeclarator\") {\n const name = identifierName(node.id);\n const init = node.init;\n if (name && init?.type === \"CallExpression\" && identifierName(init.callee) !== null && styledBindings.has(identifierName(init.callee))) {\n componentNames.add(name);\n }\n }\n });\n const sites = [];\n const pushSite = (property, valueNode, kind) => {\n if (!isStyleProp(property)) return;\n const content = staticString(valueNode);\n if (!content) return;\n sites.push({\n property,\n value: content.value,\n start: content.start,\n end: content.end,\n kind,\n node: valueNode\n });\n };\n const visitStyleObject = (object) => {\n for (const member of object.properties || []) {\n if (member.type !== \"Property\") continue;\n if (member.computed) continue;\n const key = member.key;\n const property = identifierName(key) ?? (typeof key?.value === \"string\" ? key.value : null);\n const value = member.value;\n if (property && isStyleProp(property)) {\n pushSite(property, value, \"styled-property\");\n continue;\n }\n if (value?.type === \"ObjectExpression\") {\n visitStyleObject(value);\n } else if (value?.type === \"ArrayExpression\") {\n for (const element of value.elements || []) {\n if (element?.type === \"ObjectExpression\") visitStyleObject(element);\n }\n }\n }\n };\n walk(root, (node) => {\n if (node.type === \"CallExpression\") {\n const callee = identifierName(node.callee);\n if (!callee || !styledBindings.has(callee)) return;\n const definition = node.arguments?.[1];\n if (definition?.type === \"ObjectExpression\") visitStyleObject(definition);\n return;\n }\n if (node.type === \"JSXOpeningElement\") {\n const componentRoot = jsxRootName(node.name);\n const accepted = options.allComponents ? componentRoot !== null && /^[A-Z]/.test(componentRoot) : componentRoot !== null && componentNames.has(componentRoot);\n if (!accepted) return;\n for (const attribute of node.attributes || []) {\n if (attribute.type !== \"JSXAttribute\") continue;\n const property = identifierName(attribute.name);\n if (!property) continue;\n const rawValue = attribute.value;\n const valueNode = rawValue?.type === \"JSXExpressionContainer\" ? rawValue.expression : rawValue;\n if (valueNode) pushSite(property, valueNode, \"jsx-attribute\");\n }\n }\n });\n sites.sort((a, b) => a.start - b.start);\n return sites;\n}\nexport {\n extractStyleSitesFromEstree\n};\n//# sourceMappingURL=extract-estree.js.map\n"],"mappings":";AAAA,SAAS,uBAAuB,QAAQ;CACtC,OAAO,WAAW,aAAa,OAAO,WAAW,UAAU,KAAK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AAe,IAAI,MAAM,GAAG;GAC5C,MAAM,aAAa,KAAK,YAAY;GACpC,IAAI,YAAY,SAAS,oBAAoB,iBAAiB,UAAU;GACxE;EACF;EACA,IAAI,KAAK,SAAS,qBAAqB;GACrC,MAAM,gBAAgB,YAAY,KAAK,IAAI;GAC3C,MAAM,WAAW,QAAQ,gBAAgB,kBAAkB,QAAQ,SAAS,KAAK,aAAa,IAAI,kBAAkB,QAAQ,eAAe,IAAI,aAAa;GAC5J,IAAI,CAAC,UAAU;GACf,KAAK,MAAM,aAAa,KAAK,cAAc,CAAC,GAAG;IAC7C,IAAI,UAAU,SAAS,gBAAgB;IACvC,MAAM,WAAW,eAAe,UAAU,IAAI;IAC9C,IAAI,CAAC,UAAU;IACf,MAAM,WAAW,UAAU;IAC3B,MAAM,YAAY,UAAU,SAAS,2BAA2B,SAAS,aAAa;IACtF,IAAI,WAAW,SAAS,UAAU,WAAW,eAAe;GAC9D;EACF;CACF,CAAC;CACD,MAAM,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK;CACtC,OAAO;AACT"}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
function _type_of(obj) {
|
|
2
|
+
"@swc/helpers - typeof";
|
|
3
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
4
|
+
}
|
|
5
|
+
function defaultIsTamaguiModule(source) {
|
|
6
|
+
return source === "tamagui" || source.startsWith("tamagui/") || source.startsWith("@tamagui/");
|
|
7
|
+
}
|
|
8
|
+
function span(node) {
|
|
9
|
+
if (node.range) return node.range;
|
|
10
|
+
if (typeof node.start === "number" && typeof node.end === "number") {
|
|
11
|
+
return [node.start, node.end];
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
function staticString(node) {
|
|
16
|
+
if (!node) return null;
|
|
17
|
+
var at = span(node);
|
|
18
|
+
if (!at) return null;
|
|
19
|
+
if (node.type === "Literal") {
|
|
20
|
+
var value = node.value;
|
|
21
|
+
if (typeof value !== "string") return null;
|
|
22
|
+
var raw = node.raw;
|
|
23
|
+
if (typeof raw === "string" && raw.slice(1, -1) !== value) return null;
|
|
24
|
+
return {
|
|
25
|
+
value,
|
|
26
|
+
start: at[0] + 1,
|
|
27
|
+
end: at[1] - 1
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
if (node.type === "TemplateLiteral") {
|
|
31
|
+
var _quasis__value, _quasis_, _quasis__value1, _quasis_1;
|
|
32
|
+
var expressions = node.expressions;
|
|
33
|
+
var quasis = node.quasis;
|
|
34
|
+
if ((expressions === null || expressions === void 0 ? void 0 : expressions.length) !== 0 || (quasis === null || quasis === void 0 ? void 0 : quasis.length) !== 1) return null;
|
|
35
|
+
var cooked = (_quasis_ = quasis[0]) === null || _quasis_ === void 0 ? void 0 : (_quasis__value = _quasis_.value) === null || _quasis__value === void 0 ? void 0 : _quasis__value.cooked;
|
|
36
|
+
if (typeof cooked !== "string") return null;
|
|
37
|
+
if (((_quasis_1 = quasis[0]) === null || _quasis_1 === void 0 ? void 0 : (_quasis__value1 = _quasis_1.value) === null || _quasis__value1 === void 0 ? void 0 : _quasis__value1.raw) !== cooked) return null;
|
|
38
|
+
return {
|
|
39
|
+
value: cooked,
|
|
40
|
+
start: at[0] + 1,
|
|
41
|
+
end: at[1] - 1
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
function identifierName(node) {
|
|
47
|
+
if (!node) return null;
|
|
48
|
+
if (node.type === "Identifier" || node.type === "JSXIdentifier") {
|
|
49
|
+
return typeof node.name === "string" ? node.name : null;
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
function jsxRootName(name) {
|
|
54
|
+
var current = name;
|
|
55
|
+
while ((current === null || current === void 0 ? void 0 : current.type) === "JSXMemberExpression") {
|
|
56
|
+
current = current.object;
|
|
57
|
+
}
|
|
58
|
+
return identifierName(current);
|
|
59
|
+
}
|
|
60
|
+
var skipKeys = /* @__PURE__ */ new Set([
|
|
61
|
+
"parent",
|
|
62
|
+
"loc",
|
|
63
|
+
"range",
|
|
64
|
+
"leadingComments",
|
|
65
|
+
"trailingComments"
|
|
66
|
+
]);
|
|
67
|
+
function walk(node, visit) {
|
|
68
|
+
visit(node);
|
|
69
|
+
for (var key in node) {
|
|
70
|
+
if (skipKeys.has(key)) continue;
|
|
71
|
+
var value = node[key];
|
|
72
|
+
if (Array.isArray(value)) {
|
|
73
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
74
|
+
try {
|
|
75
|
+
for (var _iterator = value[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
76
|
+
var item = _step.value;
|
|
77
|
+
if (item && (typeof item === "undefined" ? "undefined" : _type_of(item)) === "object" && typeof item.type === "string") {
|
|
78
|
+
walk(item, visit);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
} catch (err) {
|
|
82
|
+
_didIteratorError = true;
|
|
83
|
+
_iteratorError = err;
|
|
84
|
+
} finally {
|
|
85
|
+
try {
|
|
86
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
87
|
+
_iterator.return();
|
|
88
|
+
}
|
|
89
|
+
} finally {
|
|
90
|
+
if (_didIteratorError) {
|
|
91
|
+
throw _iteratorError;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
} else if (value && (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && typeof value.type === "string") {
|
|
96
|
+
walk(value, visit);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function extractStyleSitesFromEstree(program) {
|
|
101
|
+
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
102
|
+
var _options_isStyleProp;
|
|
103
|
+
var isStyleProp = (_options_isStyleProp = options.isStyleProp) !== null && _options_isStyleProp !== void 0 ? _options_isStyleProp : function() {
|
|
104
|
+
return true;
|
|
105
|
+
};
|
|
106
|
+
var _options_isTamaguiModule;
|
|
107
|
+
var isTamaguiModule = (_options_isTamaguiModule = options.isTamaguiModule) !== null && _options_isTamaguiModule !== void 0 ? _options_isTamaguiModule : defaultIsTamaguiModule;
|
|
108
|
+
var root = program;
|
|
109
|
+
var styledBindings = /* @__PURE__ */ new Set();
|
|
110
|
+
var componentNames = /* @__PURE__ */ new Set();
|
|
111
|
+
walk(root, function(node) {
|
|
112
|
+
if (node.type === "ImportDeclaration") {
|
|
113
|
+
var _node_source;
|
|
114
|
+
var source = (_node_source = node.source) === null || _node_source === void 0 ? void 0 : _node_source.value;
|
|
115
|
+
if (typeof source !== "string" || !isTamaguiModule(source)) return;
|
|
116
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
117
|
+
try {
|
|
118
|
+
for (var _iterator = (node.specifiers || [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
119
|
+
var specifier = _step.value;
|
|
120
|
+
var local = identifierName(specifier.local);
|
|
121
|
+
if (!local) continue;
|
|
122
|
+
if (specifier.type === "ImportNamespaceSpecifier") {
|
|
123
|
+
componentNames.add(local);
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
if (specifier.type !== "ImportSpecifier") continue;
|
|
127
|
+
var importedNode = specifier.imported;
|
|
128
|
+
var _identifierName;
|
|
129
|
+
var imported = (_identifierName = identifierName(importedNode)) !== null && _identifierName !== void 0 ? _identifierName : typeof (importedNode === null || importedNode === void 0 ? void 0 : importedNode.value) === "string" ? importedNode.value : null;
|
|
130
|
+
if (imported === "styled") styledBindings.add(local);
|
|
131
|
+
else if (imported && /^[A-Z]/.test(imported)) componentNames.add(local);
|
|
132
|
+
}
|
|
133
|
+
} catch (err) {
|
|
134
|
+
_didIteratorError = true;
|
|
135
|
+
_iteratorError = err;
|
|
136
|
+
} finally {
|
|
137
|
+
try {
|
|
138
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
139
|
+
_iterator.return();
|
|
140
|
+
}
|
|
141
|
+
} finally {
|
|
142
|
+
if (_didIteratorError) {
|
|
143
|
+
throw _iteratorError;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (node.type === "VariableDeclarator") {
|
|
150
|
+
var name = identifierName(node.id);
|
|
151
|
+
var init = node.init;
|
|
152
|
+
if (name && (init === null || init === void 0 ? void 0 : init.type) === "CallExpression" && identifierName(init.callee) !== null && styledBindings.has(identifierName(init.callee))) {
|
|
153
|
+
componentNames.add(name);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
var sites = [];
|
|
158
|
+
var pushSite = function(property, valueNode, kind) {
|
|
159
|
+
if (!isStyleProp(property)) return;
|
|
160
|
+
var content = staticString(valueNode);
|
|
161
|
+
if (!content) return;
|
|
162
|
+
sites.push({
|
|
163
|
+
property,
|
|
164
|
+
value: content.value,
|
|
165
|
+
start: content.start,
|
|
166
|
+
end: content.end,
|
|
167
|
+
kind,
|
|
168
|
+
node: valueNode
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
var visitStyleObject = function(object) {
|
|
172
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
173
|
+
try {
|
|
174
|
+
for (var _iterator = (object.properties || [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
175
|
+
var member = _step.value;
|
|
176
|
+
if (member.type !== "Property") continue;
|
|
177
|
+
if (member.computed) continue;
|
|
178
|
+
var key = member.key;
|
|
179
|
+
var _identifierName;
|
|
180
|
+
var property = (_identifierName = identifierName(key)) !== null && _identifierName !== void 0 ? _identifierName : typeof (key === null || key === void 0 ? void 0 : key.value) === "string" ? key.value : null;
|
|
181
|
+
var value = member.value;
|
|
182
|
+
if (property && isStyleProp(property)) {
|
|
183
|
+
pushSite(property, value, "styled-property");
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
if ((value === null || value === void 0 ? void 0 : value.type) === "ObjectExpression") {
|
|
187
|
+
visitStyleObject(value);
|
|
188
|
+
} else if ((value === null || value === void 0 ? void 0 : value.type) === "ArrayExpression") {
|
|
189
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
190
|
+
try {
|
|
191
|
+
for (var _iterator1 = (value.elements || [])[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
|
|
192
|
+
var element = _step1.value;
|
|
193
|
+
if ((element === null || element === void 0 ? void 0 : element.type) === "ObjectExpression") visitStyleObject(element);
|
|
194
|
+
}
|
|
195
|
+
} catch (err) {
|
|
196
|
+
_didIteratorError1 = true;
|
|
197
|
+
_iteratorError1 = err;
|
|
198
|
+
} finally {
|
|
199
|
+
try {
|
|
200
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
201
|
+
_iterator1.return();
|
|
202
|
+
}
|
|
203
|
+
} finally {
|
|
204
|
+
if (_didIteratorError1) {
|
|
205
|
+
throw _iteratorError1;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
} catch (err) {
|
|
212
|
+
_didIteratorError = true;
|
|
213
|
+
_iteratorError = err;
|
|
214
|
+
} finally {
|
|
215
|
+
try {
|
|
216
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
217
|
+
_iterator.return();
|
|
218
|
+
}
|
|
219
|
+
} finally {
|
|
220
|
+
if (_didIteratorError) {
|
|
221
|
+
throw _iteratorError;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
walk(root, function(node) {
|
|
227
|
+
if (node.type === "CallExpression") {
|
|
228
|
+
var _node_arguments;
|
|
229
|
+
var callee = identifierName(node.callee);
|
|
230
|
+
if (!callee || !styledBindings.has(callee)) return;
|
|
231
|
+
var definition = (_node_arguments = node.arguments) === null || _node_arguments === void 0 ? void 0 : _node_arguments[1];
|
|
232
|
+
if ((definition === null || definition === void 0 ? void 0 : definition.type) === "ObjectExpression") visitStyleObject(definition);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
if (node.type === "JSXOpeningElement") {
|
|
236
|
+
var componentRoot = jsxRootName(node.name);
|
|
237
|
+
var accepted = options.allComponents ? componentRoot !== null && /^[A-Z]/.test(componentRoot) : componentRoot !== null && componentNames.has(componentRoot);
|
|
238
|
+
if (!accepted) return;
|
|
239
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
240
|
+
try {
|
|
241
|
+
for (var _iterator = (node.attributes || [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
242
|
+
var attribute = _step.value;
|
|
243
|
+
if (attribute.type !== "JSXAttribute") continue;
|
|
244
|
+
var property = identifierName(attribute.name);
|
|
245
|
+
if (!property) continue;
|
|
246
|
+
var rawValue = attribute.value;
|
|
247
|
+
var valueNode = (rawValue === null || rawValue === void 0 ? void 0 : rawValue.type) === "JSXExpressionContainer" ? rawValue.expression : rawValue;
|
|
248
|
+
if (valueNode) pushSite(property, valueNode, "jsx-attribute");
|
|
249
|
+
}
|
|
250
|
+
} catch (err) {
|
|
251
|
+
_didIteratorError = true;
|
|
252
|
+
_iteratorError = err;
|
|
253
|
+
} finally {
|
|
254
|
+
try {
|
|
255
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
256
|
+
_iterator.return();
|
|
257
|
+
}
|
|
258
|
+
} finally {
|
|
259
|
+
if (_didIteratorError) {
|
|
260
|
+
throw _iteratorError;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
sites.sort(function(a, b) {
|
|
267
|
+
return a.start - b.start;
|
|
268
|
+
});
|
|
269
|
+
return sites;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export { extractStyleSitesFromEstree };
|
|
273
|
+
//# sourceMappingURL=extract-estree.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract-estree.native.js","names":[],"sources":["esm/extract-estree.native.js"],"sourcesContent":["function _type_of(obj) {\n \"@swc/helpers - typeof\";\n return obj && typeof Symbol !== \"undefined\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n}\nfunction defaultIsTamaguiModule(source) {\n return source === \"tamagui\" || source.startsWith(\"tamagui/\") || source.startsWith(\"@tamagui/\");\n}\nfunction span(node) {\n if (node.range) return node.range;\n if (typeof node.start === \"number\" && typeof node.end === \"number\") {\n return [\n node.start,\n node.end\n ];\n }\n return null;\n}\nfunction staticString(node) {\n if (!node) return null;\n var at = span(node);\n if (!at) return null;\n if (node.type === \"Literal\") {\n var value = node.value;\n if (typeof value !== \"string\") return null;\n var raw = node.raw;\n if (typeof raw === \"string\" && raw.slice(1, -1) !== value) return null;\n return {\n value,\n start: at[0] + 1,\n end: at[1] - 1\n };\n }\n if (node.type === \"TemplateLiteral\") {\n var _quasis__value, _quasis_, _quasis__value1, _quasis_1;\n var expressions = node.expressions;\n var quasis = node.quasis;\n if ((expressions === null || expressions === void 0 ? void 0 : expressions.length) !== 0 || (quasis === null || quasis === void 0 ? void 0 : quasis.length) !== 1) return null;\n var cooked = (_quasis_ = quasis[0]) === null || _quasis_ === void 0 ? void 0 : (_quasis__value = _quasis_.value) === null || _quasis__value === void 0 ? void 0 : _quasis__value.cooked;\n if (typeof cooked !== \"string\") return null;\n if (((_quasis_1 = quasis[0]) === null || _quasis_1 === void 0 ? void 0 : (_quasis__value1 = _quasis_1.value) === null || _quasis__value1 === void 0 ? void 0 : _quasis__value1.raw) !== cooked) return null;\n return {\n value: cooked,\n start: at[0] + 1,\n end: at[1] - 1\n };\n }\n return null;\n}\nfunction identifierName(node) {\n if (!node) return null;\n if (node.type === \"Identifier\" || node.type === \"JSXIdentifier\") {\n return typeof node.name === \"string\" ? node.name : null;\n }\n return null;\n}\nfunction jsxRootName(name) {\n var current = name;\n while ((current === null || current === void 0 ? void 0 : current.type) === \"JSXMemberExpression\") {\n current = current.object;\n }\n return identifierName(current);\n}\nvar skipKeys = /* @__PURE__ */ new Set([\n \"parent\",\n \"loc\",\n \"range\",\n \"leadingComments\",\n \"trailingComments\"\n]);\nfunction walk(node, visit) {\n visit(node);\n for (var key in node) {\n if (skipKeys.has(key)) continue;\n var value = node[key];\n if (Array.isArray(value)) {\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = value[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var item = _step.value;\n if (item && (typeof item === \"undefined\" ? \"undefined\" : _type_of(item)) === \"object\" && typeof item.type === \"string\") {\n walk(item, visit);\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n } else if (value && (typeof value === \"undefined\" ? \"undefined\" : _type_of(value)) === \"object\" && typeof value.type === \"string\") {\n walk(value, visit);\n }\n }\n}\nfunction extractStyleSitesFromEstree(program) {\n var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n var _options_isStyleProp;\n var isStyleProp = (_options_isStyleProp = options.isStyleProp) !== null && _options_isStyleProp !== void 0 ? _options_isStyleProp : function() {\n return true;\n };\n var _options_isTamaguiModule;\n var isTamaguiModule = (_options_isTamaguiModule = options.isTamaguiModule) !== null && _options_isTamaguiModule !== void 0 ? _options_isTamaguiModule : defaultIsTamaguiModule;\n var root = program;\n var styledBindings = /* @__PURE__ */ new Set();\n var componentNames = /* @__PURE__ */ new Set();\n walk(root, function(node) {\n if (node.type === \"ImportDeclaration\") {\n var _node_source;\n var source = (_node_source = node.source) === null || _node_source === void 0 ? void 0 : _node_source.value;\n if (typeof source !== \"string\" || !isTamaguiModule(source)) return;\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = (node.specifiers || [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var specifier = _step.value;\n var local = identifierName(specifier.local);\n if (!local) continue;\n if (specifier.type === \"ImportNamespaceSpecifier\") {\n componentNames.add(local);\n continue;\n }\n if (specifier.type !== \"ImportSpecifier\") continue;\n var importedNode = specifier.imported;\n var _identifierName;\n var imported = (_identifierName = identifierName(importedNode)) !== null && _identifierName !== void 0 ? _identifierName : typeof (importedNode === null || importedNode === void 0 ? void 0 : importedNode.value) === \"string\" ? importedNode.value : null;\n if (imported === \"styled\") styledBindings.add(local);\n else if (imported && /^[A-Z]/.test(imported)) componentNames.add(local);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n return;\n }\n if (node.type === \"VariableDeclarator\") {\n var name = identifierName(node.id);\n var init = node.init;\n if (name && (init === null || init === void 0 ? void 0 : init.type) === \"CallExpression\" && identifierName(init.callee) !== null && styledBindings.has(identifierName(init.callee))) {\n componentNames.add(name);\n }\n }\n });\n var sites = [];\n var pushSite = function(property, valueNode, kind) {\n if (!isStyleProp(property)) return;\n var content = staticString(valueNode);\n if (!content) return;\n sites.push({\n property,\n value: content.value,\n start: content.start,\n end: content.end,\n kind,\n node: valueNode\n });\n };\n var visitStyleObject = function(object) {\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = (object.properties || [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var member = _step.value;\n if (member.type !== \"Property\") continue;\n if (member.computed) continue;\n var key = member.key;\n var _identifierName;\n var property = (_identifierName = identifierName(key)) !== null && _identifierName !== void 0 ? _identifierName : typeof (key === null || key === void 0 ? void 0 : key.value) === \"string\" ? key.value : null;\n var value = member.value;\n if (property && isStyleProp(property)) {\n pushSite(property, value, \"styled-property\");\n continue;\n }\n if ((value === null || value === void 0 ? void 0 : value.type) === \"ObjectExpression\") {\n visitStyleObject(value);\n } else if ((value === null || value === void 0 ? void 0 : value.type) === \"ArrayExpression\") {\n var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;\n try {\n for (var _iterator1 = (value.elements || [])[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {\n var element = _step1.value;\n if ((element === null || element === void 0 ? void 0 : element.type) === \"ObjectExpression\") visitStyleObject(element);\n }\n } catch (err) {\n _didIteratorError1 = true;\n _iteratorError1 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion1 && _iterator1.return != null) {\n _iterator1.return();\n }\n } finally {\n if (_didIteratorError1) {\n throw _iteratorError1;\n }\n }\n }\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n };\n walk(root, function(node) {\n if (node.type === \"CallExpression\") {\n var _node_arguments;\n var callee = identifierName(node.callee);\n if (!callee || !styledBindings.has(callee)) return;\n var definition = (_node_arguments = node.arguments) === null || _node_arguments === void 0 ? void 0 : _node_arguments[1];\n if ((definition === null || definition === void 0 ? void 0 : definition.type) === \"ObjectExpression\") visitStyleObject(definition);\n return;\n }\n if (node.type === \"JSXOpeningElement\") {\n var componentRoot = jsxRootName(node.name);\n var accepted = options.allComponents ? componentRoot !== null && /^[A-Z]/.test(componentRoot) : componentRoot !== null && componentNames.has(componentRoot);\n if (!accepted) return;\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = (node.attributes || [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var attribute = _step.value;\n if (attribute.type !== \"JSXAttribute\") continue;\n var property = identifierName(attribute.name);\n if (!property) continue;\n var rawValue = attribute.value;\n var valueNode = (rawValue === null || rawValue === void 0 ? void 0 : rawValue.type) === \"JSXExpressionContainer\" ? rawValue.expression : rawValue;\n if (valueNode) pushSite(property, valueNode, \"jsx-attribute\");\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n }\n });\n sites.sort(function(a, b) {\n return a.start - b.start;\n });\n return sites;\n}\nexport {\n extractStyleSitesFromEstree\n};\n//# sourceMappingURL=extract-estree.js.map\n"],"mappings":";AAAA,SAAS,SAAS,KAAK;CACrB;CACA,OAAO,OAAO,OAAO,WAAW,eAAe,IAAI,gBAAgB,SAAS,WAAW,OAAO;AAChG;AACA,SAAS,uBAAuB,QAAQ;CACtC,OAAO,WAAW,aAAa,OAAO,WAAW,UAAU,KAAK,OAAO,WAAW,WAAW;AAC/F;AACA,SAAS,KAAK,MAAM;CAClB,IAAI,KAAK,OAAO,OAAO,KAAK;CAC5B,IAAI,OAAO,KAAK,UAAU,YAAY,OAAO,KAAK,QAAQ,UAAU;EAClE,OAAO,CACL,KAAK,OACL,KAAK,GACP;CACF;CACA,OAAO;AACT;AACA,SAAS,aAAa,MAAM;CAC1B,IAAI,CAAC,MAAM,OAAO;CAClB,IAAI,KAAK,KAAK,IAAI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