@pandacss/parser 0.0.0-dev-20230417181739 → 0.0.0-dev-20230418111141

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
@@ -79,36 +79,39 @@ function getImportDeclarations(file, options) {
79
79
 
80
80
  // src/parser-result.ts
81
81
  var createParserResult = () => ({
82
- all: /* @__PURE__ */ new Set(),
83
82
  jsx: /* @__PURE__ */ new Set(),
84
83
  css: /* @__PURE__ */ new Set(),
85
84
  cva: /* @__PURE__ */ new Set(),
86
85
  recipe: /* @__PURE__ */ new Map(),
87
86
  pattern: /* @__PURE__ */ new Map(),
88
87
  set(name, result) {
89
- const obj = { type: "object", ...result };
90
- this[name].add(obj);
91
- this.all.add(obj);
88
+ this[name].add({ type: "object", ...result });
92
89
  },
93
90
  setCva(result) {
94
- const cva = { type: "cva", ...result };
95
- this.cva.add(cva);
96
- this.all.add(cva);
91
+ this.cva.add({ type: "cva", ...result });
92
+ },
93
+ setJsx(result) {
94
+ this.jsx.add({ type: "jsx", ...result });
97
95
  },
98
96
  setPattern(name, result) {
99
97
  this.pattern.get(name) ?? this.pattern.set(name, /* @__PURE__ */ new Set());
100
- const pattern = { type: "pattern", name, ...result };
101
- this.pattern.get(name)?.add(pattern);
102
- this.all.add(pattern);
98
+ this.pattern.get(name)?.add({ type: "pattern", name, ...result });
103
99
  },
104
100
  setRecipe(name, result) {
105
101
  this.recipe.get(name) ?? this.recipe.set(name, /* @__PURE__ */ new Set());
106
- const recipe = { type: "recipe", ...result };
107
- this.recipe.get(name)?.add(recipe);
108
- this.all.add(recipe);
102
+ this.recipe.get(name)?.add({ type: "recipe", ...result });
109
103
  },
110
104
  isEmpty() {
111
- return this.all.size === 0;
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;
112
115
  }
113
116
  });
114
117
 
@@ -205,6 +208,8 @@ function createParser(options) {
205
208
  (tagName) => recipeJsxLists.string.has(tagName) || recipeJsxLists.regex.some((regex) => regex.test(tagName))
206
209
  );
207
210
  const matchTag = (0, import_shared2.memo)((tagName) => {
211
+ if (!tagName)
212
+ return false;
208
213
  return components.has(tagName) || isUpperCase(tagName) || tagName.startsWith(jsxFactoryAlias) || isJsxTagRecipe(tagName);
209
214
  });
210
215
  const matchTagProp = (0, import_shared2.memo)((tagName, propName) => {
@@ -305,7 +310,7 @@ function createParser(options) {
305
310
  (0, import_ts_pattern.match)(name).when(
306
311
  (name2) => jsx && name2.startsWith(jsxFactoryAlias),
307
312
  (name2) => {
308
- collector.jsx.add({ name: name2, box: query.box, type: "jsx-factory", data });
313
+ collector.setJsx({ name: name2, box: query.box, type: "jsx-factory", data });
309
314
  }
310
315
  ).when(
311
316
  (name2) => jsxPatternNodes.test(name2),
@@ -318,7 +323,7 @@ function createParser(options) {
318
323
  collector.setRecipe(getRecipeName(name2), { type: "jsx-recipe", name: name2, box: query.box, data });
319
324
  }
320
325
  ).otherwise(() => {
321
- collector.jsx.add({ name, box: query.box, type: "jsx", data });
326
+ collector.setJsx({ name, box: query.box, type: "jsx", data });
322
327
  });
323
328
  });
324
329
  }
package/dist/index.mjs CHANGED
@@ -53,36 +53,39 @@ function getImportDeclarations(file, options) {
53
53
 
54
54
  // src/parser-result.ts
55
55
  var createParserResult = () => ({
56
- all: /* @__PURE__ */ new Set(),
57
56
  jsx: /* @__PURE__ */ new Set(),
58
57
  css: /* @__PURE__ */ new Set(),
59
58
  cva: /* @__PURE__ */ new Set(),
60
59
  recipe: /* @__PURE__ */ new Map(),
61
60
  pattern: /* @__PURE__ */ new Map(),
62
61
  set(name, result) {
63
- const obj = { type: "object", ...result };
64
- this[name].add(obj);
65
- this.all.add(obj);
62
+ this[name].add({ type: "object", ...result });
66
63
  },
67
64
  setCva(result) {
68
- const cva = { type: "cva", ...result };
69
- this.cva.add(cva);
70
- this.all.add(cva);
65
+ this.cva.add({ type: "cva", ...result });
66
+ },
67
+ setJsx(result) {
68
+ this.jsx.add({ type: "jsx", ...result });
71
69
  },
72
70
  setPattern(name, result) {
73
71
  this.pattern.get(name) ?? this.pattern.set(name, /* @__PURE__ */ new Set());
74
- const pattern = { type: "pattern", name, ...result };
75
- this.pattern.get(name)?.add(pattern);
76
- this.all.add(pattern);
72
+ this.pattern.get(name)?.add({ type: "pattern", name, ...result });
77
73
  },
78
74
  setRecipe(name, result) {
79
75
  this.recipe.get(name) ?? this.recipe.set(name, /* @__PURE__ */ new Set());
80
- const recipe = { type: "recipe", ...result };
81
- this.recipe.get(name)?.add(recipe);
82
- this.all.add(recipe);
76
+ this.recipe.get(name)?.add({ type: "recipe", ...result });
83
77
  },
84
78
  isEmpty() {
85
- return this.all.size === 0;
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;
86
89
  }
87
90
  });
88
91
 
@@ -179,6 +182,8 @@ function createParser(options) {
179
182
  (tagName) => recipeJsxLists.string.has(tagName) || recipeJsxLists.regex.some((regex) => regex.test(tagName))
180
183
  );
181
184
  const matchTag = memo2((tagName) => {
185
+ if (!tagName)
186
+ return false;
182
187
  return components.has(tagName) || isUpperCase(tagName) || tagName.startsWith(jsxFactoryAlias) || isJsxTagRecipe(tagName);
183
188
  });
184
189
  const matchTagProp = memo2((tagName, propName) => {
@@ -279,7 +284,7 @@ function createParser(options) {
279
284
  match(name).when(
280
285
  (name2) => jsx && name2.startsWith(jsxFactoryAlias),
281
286
  (name2) => {
282
- collector.jsx.add({ name: name2, box: query.box, type: "jsx-factory", data });
287
+ collector.setJsx({ name: name2, box: query.box, type: "jsx-factory", data });
283
288
  }
284
289
  ).when(
285
290
  (name2) => jsxPatternNodes.test(name2),
@@ -292,7 +297,7 @@ function createParser(options) {
292
297
  collector.setRecipe(getRecipeName(name2), { type: "jsx-recipe", name: name2, box: query.box, data });
293
298
  }
294
299
  ).otherwise(() => {
295
- collector.jsx.add({ name, box: query.box, type: "jsx", data });
300
+ collector.setJsx({ name, box: query.box, type: "jsx", data });
296
301
  });
297
302
  });
298
303
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/parser",
3
- "version": "0.0.0-dev-20230417181739",
3
+ "version": "0.0.0-dev-20230418111141",
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-20230417181739",
18
- "@pandacss/is-valid-prop": "0.0.0-dev-20230417181739",
19
- "@pandacss/logger": "0.0.0-dev-20230417181739",
20
- "@pandacss/shared": "0.0.0-dev-20230417181739",
21
- "@pandacss/types": "0.0.0-dev-20230417181739"
17
+ "@pandacss/extractor": "0.0.0-dev-20230418111141",
18
+ "@pandacss/is-valid-prop": "0.0.0-dev-20230418111141",
19
+ "@pandacss/logger": "0.0.0-dev-20230418111141",
20
+ "@pandacss/shared": "0.0.0-dev-20230418111141",
21
+ "@pandacss/types": "0.0.0-dev-20230418111141"
22
22
  },
23
23
  "devDependencies": {
24
- "@pandacss/fixture": "0.0.0-dev-20230417181739",
25
- "@pandacss/generator": "0.0.0-dev-20230417181739"
24
+ "@pandacss/fixture": "0.0.0-dev-20230418111141",
25
+ "@pandacss/generator": "0.0.0-dev-20230418111141"
26
26
  },
27
27
  "files": [
28
28
  "dist"