@pandacss/parser 0.0.0-dev-20230414043636 → 0.0.0-dev-20230414155459
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.js +13 -10
- package/dist/index.mjs +13 -10
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -48,7 +48,7 @@ function getImportDeclarations(file, options) {
|
|
|
48
48
|
specifiers.forEach((specifier) => {
|
|
49
49
|
const name = specifier.getNameNode().getText();
|
|
50
50
|
const alias = specifier.getAliasNode()?.getText() || name;
|
|
51
|
-
if (!match2({
|
|
51
|
+
if (!match2({ name, alias, mod: source }))
|
|
52
52
|
return;
|
|
53
53
|
result.push({ name, alias, mod: source });
|
|
54
54
|
});
|
|
@@ -63,7 +63,7 @@ function getImportDeclarations(file, options) {
|
|
|
63
63
|
},
|
|
64
64
|
createMatch(mod) {
|
|
65
65
|
const mods = result.filter((o) => o.mod.includes(mod));
|
|
66
|
-
return (0, import_shared.memo)((id) => !!mods.find((mod2) => mod2.alias === id));
|
|
66
|
+
return (0, import_shared.memo)((id) => !!mods.find((mod2) => mod2.alias === id || mod2.name === id));
|
|
67
67
|
},
|
|
68
68
|
match(id) {
|
|
69
69
|
return !!this.find(id);
|
|
@@ -134,7 +134,7 @@ function createParser(options) {
|
|
|
134
134
|
}
|
|
135
135
|
const imports = getImportDeclarations(sourceFile, {
|
|
136
136
|
match(value) {
|
|
137
|
-
return importRegex.some(({ regex, mod }) => regex.test(value.
|
|
137
|
+
return importRegex.some(({ regex, mod }) => regex.test(value.name) && value.mod.includes(mod));
|
|
138
138
|
}
|
|
139
139
|
});
|
|
140
140
|
const collector = createParserResult();
|
|
@@ -149,12 +149,15 @@ function createParser(options) {
|
|
|
149
149
|
const isValidStyleFn = (name) => name === jsx?.factory;
|
|
150
150
|
const jsxFactoryAlias = jsx ? imports.getAlias(jsx.factory) : "panda";
|
|
151
151
|
const jsxPatternNodes = new RegExp(`(${jsx?.nodes.map((node) => node.type === "pattern" && node.name).join("|")})$`);
|
|
152
|
-
const recipes = /* @__PURE__ */ new
|
|
152
|
+
const recipes = /* @__PURE__ */ new Set();
|
|
153
|
+
const patterns = /* @__PURE__ */ new Set();
|
|
153
154
|
imports.value.forEach((importDeclaration) => {
|
|
154
|
-
const {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
const { alias } = importDeclaration;
|
|
156
|
+
if (isValidRecipe(alias)) {
|
|
157
|
+
recipes.add(alias);
|
|
158
|
+
}
|
|
159
|
+
if (isValidPattern(alias)) {
|
|
160
|
+
patterns.add(alias);
|
|
158
161
|
}
|
|
159
162
|
});
|
|
160
163
|
const functions = /* @__PURE__ */ new Map();
|
|
@@ -208,7 +211,7 @@ function createParser(options) {
|
|
|
208
211
|
return false;
|
|
209
212
|
});
|
|
210
213
|
const matchFn = (0, import_shared2.memo)((fnName) => {
|
|
211
|
-
if (recipes.has(fnName))
|
|
214
|
+
if (recipes.has(fnName) || patterns.has(fnName))
|
|
212
215
|
return true;
|
|
213
216
|
if (fnName === cvaAlias || fnName === cssAlias || fnName.startsWith(jsxFactoryAlias))
|
|
214
217
|
return true;
|
|
@@ -217,7 +220,7 @@ function createParser(options) {
|
|
|
217
220
|
const matchFnProp = (0, import_shared2.memo)((fnName, propName) => {
|
|
218
221
|
if (propertiesMap.size === 0)
|
|
219
222
|
return true;
|
|
220
|
-
if (recipes.has(fnName))
|
|
223
|
+
if (recipes.has(fnName) || patterns.has(fnName))
|
|
221
224
|
return true;
|
|
222
225
|
if (fnName === cvaAlias)
|
|
223
226
|
return true;
|
package/dist/index.mjs
CHANGED
|
@@ -22,7 +22,7 @@ function getImportDeclarations(file, options) {
|
|
|
22
22
|
specifiers.forEach((specifier) => {
|
|
23
23
|
const name = specifier.getNameNode().getText();
|
|
24
24
|
const alias = specifier.getAliasNode()?.getText() || name;
|
|
25
|
-
if (!match2({
|
|
25
|
+
if (!match2({ name, alias, mod: source }))
|
|
26
26
|
return;
|
|
27
27
|
result.push({ name, alias, mod: source });
|
|
28
28
|
});
|
|
@@ -37,7 +37,7 @@ function getImportDeclarations(file, options) {
|
|
|
37
37
|
},
|
|
38
38
|
createMatch(mod) {
|
|
39
39
|
const mods = result.filter((o) => o.mod.includes(mod));
|
|
40
|
-
return memo((id) => !!mods.find((mod2) => mod2.alias === id));
|
|
40
|
+
return memo((id) => !!mods.find((mod2) => mod2.alias === id || mod2.name === id));
|
|
41
41
|
},
|
|
42
42
|
match(id) {
|
|
43
43
|
return !!this.find(id);
|
|
@@ -108,7 +108,7 @@ function createParser(options) {
|
|
|
108
108
|
}
|
|
109
109
|
const imports = getImportDeclarations(sourceFile, {
|
|
110
110
|
match(value) {
|
|
111
|
-
return importRegex.some(({ regex, mod }) => regex.test(value.
|
|
111
|
+
return importRegex.some(({ regex, mod }) => regex.test(value.name) && value.mod.includes(mod));
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
114
|
const collector = createParserResult();
|
|
@@ -123,12 +123,15 @@ function createParser(options) {
|
|
|
123
123
|
const isValidStyleFn = (name) => name === jsx?.factory;
|
|
124
124
|
const jsxFactoryAlias = jsx ? imports.getAlias(jsx.factory) : "panda";
|
|
125
125
|
const jsxPatternNodes = new RegExp(`(${jsx?.nodes.map((node) => node.type === "pattern" && node.name).join("|")})$`);
|
|
126
|
-
const recipes = /* @__PURE__ */ new
|
|
126
|
+
const recipes = /* @__PURE__ */ new Set();
|
|
127
|
+
const patterns = /* @__PURE__ */ new Set();
|
|
127
128
|
imports.value.forEach((importDeclaration) => {
|
|
128
|
-
const {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
const { alias } = importDeclaration;
|
|
130
|
+
if (isValidRecipe(alias)) {
|
|
131
|
+
recipes.add(alias);
|
|
132
|
+
}
|
|
133
|
+
if (isValidPattern(alias)) {
|
|
134
|
+
patterns.add(alias);
|
|
132
135
|
}
|
|
133
136
|
});
|
|
134
137
|
const functions = /* @__PURE__ */ new Map();
|
|
@@ -182,7 +185,7 @@ function createParser(options) {
|
|
|
182
185
|
return false;
|
|
183
186
|
});
|
|
184
187
|
const matchFn = memo2((fnName) => {
|
|
185
|
-
if (recipes.has(fnName))
|
|
188
|
+
if (recipes.has(fnName) || patterns.has(fnName))
|
|
186
189
|
return true;
|
|
187
190
|
if (fnName === cvaAlias || fnName === cssAlias || fnName.startsWith(jsxFactoryAlias))
|
|
188
191
|
return true;
|
|
@@ -191,7 +194,7 @@ function createParser(options) {
|
|
|
191
194
|
const matchFnProp = memo2((fnName, propName) => {
|
|
192
195
|
if (propertiesMap.size === 0)
|
|
193
196
|
return true;
|
|
194
|
-
if (recipes.has(fnName))
|
|
197
|
+
if (recipes.has(fnName) || patterns.has(fnName))
|
|
195
198
|
return true;
|
|
196
199
|
if (fnName === cvaAlias)
|
|
197
200
|
return true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/parser",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20230414155459",
|
|
4
4
|
"description": "The static parser for panda css",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
"lil-fp": "1.4.5",
|
|
15
15
|
"ts-morph": "18.0.0",
|
|
16
16
|
"ts-pattern": "4.2.2",
|
|
17
|
-
"@pandacss/extractor": "0.0.0-dev-
|
|
18
|
-
"@pandacss/is-valid-prop": "0.0.0-dev-
|
|
19
|
-
"@pandacss/logger": "0.0.0-dev-
|
|
20
|
-
"@pandacss/shared": "0.0.0-dev-
|
|
21
|
-
"@pandacss/types": "0.0.0-dev-
|
|
17
|
+
"@pandacss/extractor": "0.0.0-dev-20230414155459",
|
|
18
|
+
"@pandacss/is-valid-prop": "0.0.0-dev-20230414155459",
|
|
19
|
+
"@pandacss/logger": "0.0.0-dev-20230414155459",
|
|
20
|
+
"@pandacss/shared": "0.0.0-dev-20230414155459",
|
|
21
|
+
"@pandacss/types": "0.0.0-dev-20230414155459"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@pandacss/fixture": "0.0.0-dev-
|
|
25
|
-
"@pandacss/generator": "0.0.0-dev-
|
|
24
|
+
"@pandacss/fixture": "0.0.0-dev-20230414155459",
|
|
25
|
+
"@pandacss/generator": "0.0.0-dev-20230414155459"
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
28
|
"dist"
|