@pandacss/parser 0.0.0-dev-20230417175154 → 0.0.0-dev-20230418111125

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 CHANGED
@@ -90,6 +90,9 @@ var createParserResult = () => ({
90
90
  setCva(result) {
91
91
  this.cva.add({ type: "cva", ...result });
92
92
  },
93
+ setJsx(result) {
94
+ this.jsx.add({ type: "jsx", ...result });
95
+ },
93
96
  setPattern(name, result) {
94
97
  this.pattern.get(name) ?? this.pattern.set(name, /* @__PURE__ */ new Set());
95
98
  this.pattern.get(name)?.add({ type: "pattern", name, ...result });
@@ -100,6 +103,15 @@ var createParserResult = () => ({
100
103
  },
101
104
  isEmpty() {
102
105
  return this.css.size === 0 && this.cva.size === 0 && this.recipe.size === 0 && this.pattern.size === 0 && this.jsx.size === 0;
106
+ },
107
+ getAll() {
108
+ const result = [];
109
+ this.css.forEach((item) => result.push(item));
110
+ this.cva.forEach((item) => result.push(item));
111
+ this.recipe.forEach((items) => items.forEach((item) => result.push(item)));
112
+ this.pattern.forEach((items) => items.forEach((item) => result.push(item)));
113
+ this.jsx.forEach((item) => result.push(item));
114
+ return result;
103
115
  }
104
116
  });
105
117
 
@@ -118,6 +130,7 @@ function createImportMatcher(mod, values) {
118
130
  var combineResult = (unboxed) => {
119
131
  return [...unboxed.conditions, unboxed.raw, ...unboxed.spreadConditions];
120
132
  };
133
+ var defaultEnv = { preset: "NONE" };
121
134
  function createParser(options) {
122
135
  return function parse(sourceFile, styleProperties) {
123
136
  if (!sourceFile)
@@ -195,6 +208,8 @@ function createParser(options) {
195
208
  (tagName) => recipeJsxLists.string.has(tagName) || recipeJsxLists.regex.some((regex) => regex.test(tagName))
196
209
  );
197
210
  const matchTag = (0, import_shared2.memo)((tagName) => {
211
+ if (!tagName)
212
+ return false;
198
213
  return components.has(tagName) || isUpperCase(tagName) || tagName.startsWith(jsxFactoryAlias) || isJsxTagRecipe(tagName);
199
214
  });
200
215
  const matchTagProp = (0, import_shared2.memo)((tagName, propName) => {
@@ -217,19 +232,6 @@ function createParser(options) {
217
232
  return true;
218
233
  return Boolean(functions.get(fnName));
219
234
  });
220
- const matchFnProp = (0, import_shared2.memo)((fnName, propName) => {
221
- if (propertiesMap.size === 0)
222
- return true;
223
- if (recipes.has(fnName) || patterns.has(fnName))
224
- return true;
225
- if (fnName === cvaAlias)
226
- return true;
227
- if (fnName.startsWith(jsxFactoryAlias))
228
- return true;
229
- if (fnName === cssAlias)
230
- return Boolean(propertiesMap.get(propName) || propName === "selectors");
231
- return Boolean(functions.get(fnName)?.get(propName));
232
- });
233
235
  const measure = import_logger.logger.time.debug(`Tokens extracted from ${filePath}`);
234
236
  const extractResultByName = (0, import_extractor.extract)({
235
237
  ast: sourceFile,
@@ -239,13 +241,14 @@ function createParser(options) {
239
241
  },
240
242
  functions: {
241
243
  matchFn: (prop) => matchFn(prop.fnName),
242
- matchProp: (prop) => matchFnProp(prop.fnName, prop.propName),
244
+ matchProp: () => true,
243
245
  matchArg: (prop) => {
244
246
  if (prop.fnName === jsxFactoryAlias && prop.index === 1 && import_ts_morph.Node.isIdentifier(prop.argNode))
245
247
  return false;
246
248
  return true;
247
249
  }
248
250
  },
251
+ getEvaluateOptions: (node) => ({ node, environment: defaultEnv }),
249
252
  flags: { skipTraverseFiles: true }
250
253
  });
251
254
  measure();
@@ -294,7 +297,7 @@ function createParser(options) {
294
297
  (0, import_ts_pattern.match)(name).when(
295
298
  (name2) => jsx && name2.startsWith(jsxFactoryAlias),
296
299
  (name2) => {
297
- collector.jsx.add({ name: name2, box: query.box, type: "jsx-factory", data });
300
+ collector.setJsx({ name: name2, box: query.box, type: "jsx-factory", data });
298
301
  }
299
302
  ).when(
300
303
  (name2) => jsxPatternNodes.test(name2),
@@ -307,7 +310,7 @@ function createParser(options) {
307
310
  collector.setRecipe(getRecipeName(name2), { type: "jsx-recipe", name: name2, box: query.box, data });
308
311
  }
309
312
  ).otherwise(() => {
310
- collector.jsx.add({ name, box: query.box, type: "jsx", data });
313
+ collector.setJsx({ name, box: query.box, type: "jsx", data });
311
314
  });
312
315
  });
313
316
  }
package/dist/index.mjs CHANGED
@@ -64,6 +64,9 @@ var createParserResult = () => ({
64
64
  setCva(result) {
65
65
  this.cva.add({ type: "cva", ...result });
66
66
  },
67
+ setJsx(result) {
68
+ this.jsx.add({ type: "jsx", ...result });
69
+ },
67
70
  setPattern(name, result) {
68
71
  this.pattern.get(name) ?? this.pattern.set(name, /* @__PURE__ */ new Set());
69
72
  this.pattern.get(name)?.add({ type: "pattern", name, ...result });
@@ -74,6 +77,15 @@ var createParserResult = () => ({
74
77
  },
75
78
  isEmpty() {
76
79
  return this.css.size === 0 && this.cva.size === 0 && this.recipe.size === 0 && this.pattern.size === 0 && this.jsx.size === 0;
80
+ },
81
+ getAll() {
82
+ const result = [];
83
+ this.css.forEach((item) => result.push(item));
84
+ this.cva.forEach((item) => result.push(item));
85
+ this.recipe.forEach((items) => items.forEach((item) => result.push(item)));
86
+ this.pattern.forEach((items) => items.forEach((item) => result.push(item)));
87
+ this.jsx.forEach((item) => result.push(item));
88
+ return result;
77
89
  }
78
90
  });
79
91
 
@@ -92,6 +104,7 @@ function createImportMatcher(mod, values) {
92
104
  var combineResult = (unboxed) => {
93
105
  return [...unboxed.conditions, unboxed.raw, ...unboxed.spreadConditions];
94
106
  };
107
+ var defaultEnv = { preset: "NONE" };
95
108
  function createParser(options) {
96
109
  return function parse(sourceFile, styleProperties) {
97
110
  if (!sourceFile)
@@ -169,6 +182,8 @@ function createParser(options) {
169
182
  (tagName) => recipeJsxLists.string.has(tagName) || recipeJsxLists.regex.some((regex) => regex.test(tagName))
170
183
  );
171
184
  const matchTag = memo2((tagName) => {
185
+ if (!tagName)
186
+ return false;
172
187
  return components.has(tagName) || isUpperCase(tagName) || tagName.startsWith(jsxFactoryAlias) || isJsxTagRecipe(tagName);
173
188
  });
174
189
  const matchTagProp = memo2((tagName, propName) => {
@@ -191,19 +206,6 @@ function createParser(options) {
191
206
  return true;
192
207
  return Boolean(functions.get(fnName));
193
208
  });
194
- const matchFnProp = memo2((fnName, propName) => {
195
- if (propertiesMap.size === 0)
196
- return true;
197
- if (recipes.has(fnName) || patterns.has(fnName))
198
- return true;
199
- if (fnName === cvaAlias)
200
- return true;
201
- if (fnName.startsWith(jsxFactoryAlias))
202
- return true;
203
- if (fnName === cssAlias)
204
- return Boolean(propertiesMap.get(propName) || propName === "selectors");
205
- return Boolean(functions.get(fnName)?.get(propName));
206
- });
207
209
  const measure = logger.time.debug(`Tokens extracted from ${filePath}`);
208
210
  const extractResultByName = extract({
209
211
  ast: sourceFile,
@@ -213,13 +215,14 @@ function createParser(options) {
213
215
  },
214
216
  functions: {
215
217
  matchFn: (prop) => matchFn(prop.fnName),
216
- matchProp: (prop) => matchFnProp(prop.fnName, prop.propName),
218
+ matchProp: () => true,
217
219
  matchArg: (prop) => {
218
220
  if (prop.fnName === jsxFactoryAlias && prop.index === 1 && Node.isIdentifier(prop.argNode))
219
221
  return false;
220
222
  return true;
221
223
  }
222
224
  },
225
+ getEvaluateOptions: (node) => ({ node, environment: defaultEnv }),
223
226
  flags: { skipTraverseFiles: true }
224
227
  });
225
228
  measure();
@@ -268,7 +271,7 @@ function createParser(options) {
268
271
  match(name).when(
269
272
  (name2) => jsx && name2.startsWith(jsxFactoryAlias),
270
273
  (name2) => {
271
- collector.jsx.add({ name: name2, box: query.box, type: "jsx-factory", data });
274
+ collector.setJsx({ name: name2, box: query.box, type: "jsx-factory", data });
272
275
  }
273
276
  ).when(
274
277
  (name2) => jsxPatternNodes.test(name2),
@@ -281,7 +284,7 @@ function createParser(options) {
281
284
  collector.setRecipe(getRecipeName(name2), { type: "jsx-recipe", name: name2, box: query.box, data });
282
285
  }
283
286
  ).otherwise(() => {
284
- collector.jsx.add({ name, box: query.box, type: "jsx", data });
287
+ collector.setJsx({ name, box: query.box, type: "jsx", data });
285
288
  });
286
289
  });
287
290
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/parser",
3
- "version": "0.0.0-dev-20230417175154",
3
+ "version": "0.0.0-dev-20230418111125",
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-20230417175154",
18
- "@pandacss/is-valid-prop": "0.0.0-dev-20230417175154",
19
- "@pandacss/logger": "0.0.0-dev-20230417175154",
20
- "@pandacss/shared": "0.0.0-dev-20230417175154",
21
- "@pandacss/types": "0.0.0-dev-20230417175154"
17
+ "@pandacss/extractor": "0.0.0-dev-20230418111125",
18
+ "@pandacss/is-valid-prop": "0.0.0-dev-20230418111125",
19
+ "@pandacss/logger": "0.0.0-dev-20230418111125",
20
+ "@pandacss/shared": "0.0.0-dev-20230418111125",
21
+ "@pandacss/types": "0.0.0-dev-20230418111125"
22
22
  },
23
23
  "devDependencies": {
24
- "@pandacss/fixture": "0.0.0-dev-20230417175154",
25
- "@pandacss/generator": "0.0.0-dev-20230417175154"
24
+ "@pandacss/fixture": "0.0.0-dev-20230418111125",
25
+ "@pandacss/generator": "0.0.0-dev-20230418111125"
26
26
  },
27
27
  "files": [
28
28
  "dist"