@pandacss/parser 0.0.0-dev-20230415084325 → 0.0.0-dev-20230415104814
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 +19 -10
- package/dist/index.mjs +19 -10
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -119,7 +119,7 @@ var combineResult = (unboxed) => {
|
|
|
119
119
|
return [...unboxed.conditions, unboxed.raw, ...unboxed.spreadConditions];
|
|
120
120
|
};
|
|
121
121
|
function createParser(options) {
|
|
122
|
-
return function parse(sourceFile,
|
|
122
|
+
return function parse(sourceFile, styleProperties) {
|
|
123
123
|
if (!sourceFile)
|
|
124
124
|
return;
|
|
125
125
|
const filePath = sourceFile.getFilePath();
|
|
@@ -162,7 +162,7 @@ function createParser(options) {
|
|
|
162
162
|
});
|
|
163
163
|
const functions = /* @__PURE__ */ new Map();
|
|
164
164
|
const components = /* @__PURE__ */ new Map();
|
|
165
|
-
const propertiesMap = new Map(
|
|
165
|
+
const propertiesMap = new Map(styleProperties.map((prop) => [prop, true]));
|
|
166
166
|
const recipePropertiesByName = /* @__PURE__ */ new Map();
|
|
167
167
|
const recipeJsxLists = (jsx?.nodes ?? []).filter(isNodeRecipe).reduce(
|
|
168
168
|
(acc, recipe) => {
|
|
@@ -291,15 +291,24 @@ function createParser(options) {
|
|
|
291
291
|
result.queryList.forEach((query) => {
|
|
292
292
|
const data = combineResult((0, import_extractor.unbox)(query.box));
|
|
293
293
|
import_logger.logger.debug(`ast:jsx:${name}`, { filePath, result: data });
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
294
|
+
(0, import_ts_pattern.match)(name).when(
|
|
295
|
+
(name2) => jsx && name2.startsWith(jsxFactoryAlias),
|
|
296
|
+
(name2) => {
|
|
297
|
+
collector.jsx.add({ name: name2, box: query.box, type: "jsx-factory", data });
|
|
298
|
+
}
|
|
299
|
+
).when(
|
|
300
|
+
(name2) => jsxPatternNodes.test(name2),
|
|
301
|
+
(name2) => {
|
|
302
|
+
collector.setPattern(name2, { type: "jsx-pattern", name: name2, box: query.box, data });
|
|
303
|
+
}
|
|
304
|
+
).when(
|
|
305
|
+
(name2) => recipeJsxLists.string.has(name2) || recipeJsxLists.regex.some((regex) => regex.test(name2)),
|
|
306
|
+
(name2) => {
|
|
307
|
+
collector.setRecipe(getRecipeName(name2), { type: "jsx-recipe", name: name2, box: query.box, data });
|
|
308
|
+
}
|
|
309
|
+
).otherwise(() => {
|
|
301
310
|
collector.jsx.add({ name, box: query.box, type: "jsx", data });
|
|
302
|
-
}
|
|
311
|
+
});
|
|
303
312
|
});
|
|
304
313
|
}
|
|
305
314
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -93,7 +93,7 @@ var combineResult = (unboxed) => {
|
|
|
93
93
|
return [...unboxed.conditions, unboxed.raw, ...unboxed.spreadConditions];
|
|
94
94
|
};
|
|
95
95
|
function createParser(options) {
|
|
96
|
-
return function parse(sourceFile,
|
|
96
|
+
return function parse(sourceFile, styleProperties) {
|
|
97
97
|
if (!sourceFile)
|
|
98
98
|
return;
|
|
99
99
|
const filePath = sourceFile.getFilePath();
|
|
@@ -136,7 +136,7 @@ function createParser(options) {
|
|
|
136
136
|
});
|
|
137
137
|
const functions = /* @__PURE__ */ new Map();
|
|
138
138
|
const components = /* @__PURE__ */ new Map();
|
|
139
|
-
const propertiesMap = new Map(
|
|
139
|
+
const propertiesMap = new Map(styleProperties.map((prop) => [prop, true]));
|
|
140
140
|
const recipePropertiesByName = /* @__PURE__ */ new Map();
|
|
141
141
|
const recipeJsxLists = (jsx?.nodes ?? []).filter(isNodeRecipe).reduce(
|
|
142
142
|
(acc, recipe) => {
|
|
@@ -265,15 +265,24 @@ function createParser(options) {
|
|
|
265
265
|
result.queryList.forEach((query) => {
|
|
266
266
|
const data = combineResult(unbox(query.box));
|
|
267
267
|
logger.debug(`ast:jsx:${name}`, { filePath, result: data });
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
268
|
+
match(name).when(
|
|
269
|
+
(name2) => jsx && name2.startsWith(jsxFactoryAlias),
|
|
270
|
+
(name2) => {
|
|
271
|
+
collector.jsx.add({ name: name2, box: query.box, type: "jsx-factory", data });
|
|
272
|
+
}
|
|
273
|
+
).when(
|
|
274
|
+
(name2) => jsxPatternNodes.test(name2),
|
|
275
|
+
(name2) => {
|
|
276
|
+
collector.setPattern(name2, { type: "jsx-pattern", name: name2, box: query.box, data });
|
|
277
|
+
}
|
|
278
|
+
).when(
|
|
279
|
+
(name2) => recipeJsxLists.string.has(name2) || recipeJsxLists.regex.some((regex) => regex.test(name2)),
|
|
280
|
+
(name2) => {
|
|
281
|
+
collector.setRecipe(getRecipeName(name2), { type: "jsx-recipe", name: name2, box: query.box, data });
|
|
282
|
+
}
|
|
283
|
+
).otherwise(() => {
|
|
275
284
|
collector.jsx.add({ name, box: query.box, type: "jsx", data });
|
|
276
|
-
}
|
|
285
|
+
});
|
|
277
286
|
});
|
|
278
287
|
}
|
|
279
288
|
});
|
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-20230415104814",
|
|
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-20230415104814",
|
|
18
|
+
"@pandacss/is-valid-prop": "0.0.0-dev-20230415104814",
|
|
19
|
+
"@pandacss/logger": "0.0.0-dev-20230415104814",
|
|
20
|
+
"@pandacss/shared": "0.0.0-dev-20230415104814",
|
|
21
|
+
"@pandacss/types": "0.0.0-dev-20230415104814"
|
|
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-20230415104814",
|
|
25
|
+
"@pandacss/generator": "0.0.0-dev-20230415104814"
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
28
|
"dist"
|