@pandacss/parser 0.0.0-dev-20231220140705 → 0.0.0-dev-20231222115330

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
@@ -191,7 +191,6 @@ var isNodeRecipe = (node) => node.type === "recipe";
191
191
  var isNodePattern = (node) => node.type === "pattern";
192
192
  var cvaProps = ["compoundVariants", "defaultVariants", "variants", "base"];
193
193
  var isCva = (map) => cvaProps.some((prop) => map.has(prop));
194
- var noop = (..._args) => void 0;
195
194
  function createImportMatcher(mod, values) {
196
195
  const regex = values ? new RegExp(`^(${values.join("|")})$`) : /.*/;
197
196
  return {
@@ -268,10 +267,10 @@ function createParser(options) {
268
267
  const name = fullName.split(".raw")[0] ?? "";
269
268
  return name === "css" || isValidPattern(name) || isValidRecipe(name);
270
269
  };
271
- const patternPropertiesByName = /* @__PURE__ */ new Map();
272
- const initialpatterns = { string: /* @__PURE__ */ new Set(), regex: [] };
270
+ const patternPropertiesByJsxName = /* @__PURE__ */ new Map();
271
+ const initialPatterns = { string: /* @__PURE__ */ new Set(), regex: [] };
273
272
  const patternJsxLists = isJsxEnabled ? (jsx?.nodes ?? []).filter(isNodePattern).reduce((acc, pattern) => {
274
- patternPropertiesByName.set(pattern.jsxName, new Set(pattern.props ?? []));
273
+ patternPropertiesByJsxName.set(pattern.jsxName, new Set(pattern.props ?? []));
275
274
  pattern.jsx?.forEach((jsx2) => {
276
275
  if (typeof jsx2 === "string") {
277
276
  acc.string.add(jsx2);
@@ -280,7 +279,7 @@ function createParser(options) {
280
279
  }
281
280
  });
282
281
  return acc;
283
- }, initialpatterns) : initialpatterns;
282
+ }, initialPatterns) : initialPatterns;
284
283
  const recipes = /* @__PURE__ */ new Set();
285
284
  const patterns = /* @__PURE__ */ new Set();
286
285
  imports.value.forEach((importDeclaration) => {
@@ -322,23 +321,23 @@ function createParser(options) {
322
321
  }
323
322
  const isJsxTagRecipe = isJsxEnabled ? (0, import_shared2.memo)(
324
323
  (tagName) => recipeJsxLists.string.has(tagName) || recipeJsxLists.regex.some((regex) => regex.test(tagName))
325
- ) : noop;
324
+ ) : void 0;
326
325
  const isJsxTagPattern = isJsxEnabled ? (0, import_shared2.memo)(
327
326
  (tagName) => patternJsxLists.string.has(tagName) || patternJsxLists.regex.some((regex) => regex.test(tagName))
328
- ) : noop;
327
+ ) : void 0;
329
328
  const matchTag = isJsxEnabled ? (0, import_shared2.memo)((tagName) => {
330
329
  if (!tagName)
331
330
  return false;
332
- return components.has(tagName) || isUpperCase(tagName) || isFactory(tagName) || isJsxTagRecipe(tagName) || isJsxTagPattern(tagName);
333
- }) : noop;
331
+ return components.has(tagName) || isUpperCase(tagName) || isFactory(tagName) || isJsxTagRecipe?.(tagName) || isJsxTagPattern?.(tagName);
332
+ }) : void 0;
334
333
  const isRecipeOrPatternProp = (0, import_shared2.memo)((tagName, propName) => {
335
- if (isJsxEnabled && isJsxTagRecipe(tagName)) {
334
+ if (isJsxEnabled && isJsxTagRecipe?.(tagName)) {
336
335
  const recipeList = getRecipesByJsxName(tagName);
337
336
  return recipeList.some((recipe) => recipePropertiesByJsxName.get(recipe.jsxName)?.has(propName));
338
337
  }
339
- if (isJsxEnabled && isJsxTagPattern(tagName)) {
338
+ if (isJsxEnabled && isJsxTagPattern?.(tagName)) {
340
339
  const patternList = getPatternsByJsxName(tagName);
341
- return patternList.some((pattern) => patternPropertiesByName.get(pattern.baseName)?.has(propName));
340
+ return patternList.some((pattern) => patternPropertiesByJsxName.get(pattern.jsxName)?.has(propName));
342
341
  }
343
342
  return false;
344
343
  });
@@ -347,9 +346,12 @@ function createParser(options) {
347
346
  () => (0, import_shared2.memo)((tagName, propName) => {
348
347
  return Boolean(components.get(tagName)?.has(propName)) || options.jsx?.isStyleProp(propName) || propertiesMap.has(propName) || isRecipeOrPatternProp(tagName, propName);
349
348
  })
350
- ).with("minimal", () => (tagName, propName) => {
351
- return propName === "css" || isRecipeOrPatternProp(tagName, propName);
352
- }).otherwise(() => (tagName, propName) => isRecipeOrPatternProp(tagName, propName)) : noop;
349
+ ).with(
350
+ "minimal",
351
+ () => (0, import_shared2.memo)((tagName, propName) => {
352
+ return propName === "css" || isRecipeOrPatternProp(tagName, propName);
353
+ })
354
+ ).with("none", () => (0, import_shared2.memo)((tagName, propName) => isRecipeOrPatternProp(tagName, propName))).exhaustive() : void 0;
353
355
  const matchFn = (0, import_shared2.memo)((fnName) => {
354
356
  if (recipes.has(fnName) || patterns.has(fnName))
355
357
  return true;
@@ -361,8 +363,8 @@ function createParser(options) {
361
363
  const extractResultByName = (0, import_extractor.extract)({
362
364
  ast: sourceFile,
363
365
  components: isJsxEnabled ? {
364
- matchTag: (prop) => matchTag(prop.tagName),
365
- matchProp: (prop) => matchTagProp(prop.tagName, prop.propName)
366
+ matchTag: (prop) => !!matchTag?.(prop.tagName),
367
+ matchProp: (prop) => !!matchTagProp?.(prop.tagName, prop.propName)
366
368
  } : void 0,
367
369
  functions: {
368
370
  matchFn: (prop) => matchFn(prop.fnName),
package/dist/index.mjs CHANGED
@@ -153,7 +153,6 @@ var isNodeRecipe = (node) => node.type === "recipe";
153
153
  var isNodePattern = (node) => node.type === "pattern";
154
154
  var cvaProps = ["compoundVariants", "defaultVariants", "variants", "base"];
155
155
  var isCva = (map) => cvaProps.some((prop) => map.has(prop));
156
- var noop = (..._args) => void 0;
157
156
  function createImportMatcher(mod, values) {
158
157
  const regex = values ? new RegExp(`^(${values.join("|")})$`) : /.*/;
159
158
  return {
@@ -230,10 +229,10 @@ function createParser(options) {
230
229
  const name = fullName.split(".raw")[0] ?? "";
231
230
  return name === "css" || isValidPattern(name) || isValidRecipe(name);
232
231
  };
233
- const patternPropertiesByName = /* @__PURE__ */ new Map();
234
- const initialpatterns = { string: /* @__PURE__ */ new Set(), regex: [] };
232
+ const patternPropertiesByJsxName = /* @__PURE__ */ new Map();
233
+ const initialPatterns = { string: /* @__PURE__ */ new Set(), regex: [] };
235
234
  const patternJsxLists = isJsxEnabled ? (jsx?.nodes ?? []).filter(isNodePattern).reduce((acc, pattern) => {
236
- patternPropertiesByName.set(pattern.jsxName, new Set(pattern.props ?? []));
235
+ patternPropertiesByJsxName.set(pattern.jsxName, new Set(pattern.props ?? []));
237
236
  pattern.jsx?.forEach((jsx2) => {
238
237
  if (typeof jsx2 === "string") {
239
238
  acc.string.add(jsx2);
@@ -242,7 +241,7 @@ function createParser(options) {
242
241
  }
243
242
  });
244
243
  return acc;
245
- }, initialpatterns) : initialpatterns;
244
+ }, initialPatterns) : initialPatterns;
246
245
  const recipes = /* @__PURE__ */ new Set();
247
246
  const patterns = /* @__PURE__ */ new Set();
248
247
  imports.value.forEach((importDeclaration) => {
@@ -284,23 +283,23 @@ function createParser(options) {
284
283
  }
285
284
  const isJsxTagRecipe = isJsxEnabled ? memo2(
286
285
  (tagName) => recipeJsxLists.string.has(tagName) || recipeJsxLists.regex.some((regex) => regex.test(tagName))
287
- ) : noop;
286
+ ) : void 0;
288
287
  const isJsxTagPattern = isJsxEnabled ? memo2(
289
288
  (tagName) => patternJsxLists.string.has(tagName) || patternJsxLists.regex.some((regex) => regex.test(tagName))
290
- ) : noop;
289
+ ) : void 0;
291
290
  const matchTag = isJsxEnabled ? memo2((tagName) => {
292
291
  if (!tagName)
293
292
  return false;
294
- return components.has(tagName) || isUpperCase(tagName) || isFactory(tagName) || isJsxTagRecipe(tagName) || isJsxTagPattern(tagName);
295
- }) : noop;
293
+ return components.has(tagName) || isUpperCase(tagName) || isFactory(tagName) || isJsxTagRecipe?.(tagName) || isJsxTagPattern?.(tagName);
294
+ }) : void 0;
296
295
  const isRecipeOrPatternProp = memo2((tagName, propName) => {
297
- if (isJsxEnabled && isJsxTagRecipe(tagName)) {
296
+ if (isJsxEnabled && isJsxTagRecipe?.(tagName)) {
298
297
  const recipeList = getRecipesByJsxName(tagName);
299
298
  return recipeList.some((recipe) => recipePropertiesByJsxName.get(recipe.jsxName)?.has(propName));
300
299
  }
301
- if (isJsxEnabled && isJsxTagPattern(tagName)) {
300
+ if (isJsxEnabled && isJsxTagPattern?.(tagName)) {
302
301
  const patternList = getPatternsByJsxName(tagName);
303
- return patternList.some((pattern) => patternPropertiesByName.get(pattern.baseName)?.has(propName));
302
+ return patternList.some((pattern) => patternPropertiesByJsxName.get(pattern.jsxName)?.has(propName));
304
303
  }
305
304
  return false;
306
305
  });
@@ -309,9 +308,12 @@ function createParser(options) {
309
308
  () => memo2((tagName, propName) => {
310
309
  return Boolean(components.get(tagName)?.has(propName)) || options.jsx?.isStyleProp(propName) || propertiesMap.has(propName) || isRecipeOrPatternProp(tagName, propName);
311
310
  })
312
- ).with("minimal", () => (tagName, propName) => {
313
- return propName === "css" || isRecipeOrPatternProp(tagName, propName);
314
- }).otherwise(() => (tagName, propName) => isRecipeOrPatternProp(tagName, propName)) : noop;
311
+ ).with(
312
+ "minimal",
313
+ () => memo2((tagName, propName) => {
314
+ return propName === "css" || isRecipeOrPatternProp(tagName, propName);
315
+ })
316
+ ).with("none", () => memo2((tagName, propName) => isRecipeOrPatternProp(tagName, propName))).exhaustive() : void 0;
315
317
  const matchFn = memo2((fnName) => {
316
318
  if (recipes.has(fnName) || patterns.has(fnName))
317
319
  return true;
@@ -323,8 +325,8 @@ function createParser(options) {
323
325
  const extractResultByName = extract({
324
326
  ast: sourceFile,
325
327
  components: isJsxEnabled ? {
326
- matchTag: (prop) => matchTag(prop.tagName),
327
- matchProp: (prop) => matchTagProp(prop.tagName, prop.propName)
328
+ matchTag: (prop) => !!matchTag?.(prop.tagName),
329
+ matchProp: (prop) => !!matchTagProp?.(prop.tagName, prop.propName)
328
330
  } : void 0,
329
331
  functions: {
330
332
  matchFn: (prop) => matchFn(prop.fnName),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/parser",
3
- "version": "0.0.0-dev-20231220140705",
3
+ "version": "0.0.0-dev-20231222115330",
4
4
  "description": "The static parser for panda css",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -27,17 +27,17 @@
27
27
  "magic-string": "^0.30.2",
28
28
  "ts-morph": "19.0.0",
29
29
  "ts-pattern": "5.0.5",
30
- "@pandacss/config": "^0.0.0-dev-20231220140705",
31
- "@pandacss/extractor": "0.0.0-dev-20231220140705",
32
- "@pandacss/is-valid-prop": "0.0.0-dev-20231220140705",
33
- "@pandacss/logger": "0.0.0-dev-20231220140705",
34
- "@pandacss/shared": "0.0.0-dev-20231220140705",
35
- "@pandacss/types": "0.0.0-dev-20231220140705"
30
+ "@pandacss/config": "^0.0.0-dev-20231222115330",
31
+ "@pandacss/extractor": "0.0.0-dev-20231222115330",
32
+ "@pandacss/is-valid-prop": "0.0.0-dev-20231222115330",
33
+ "@pandacss/logger": "0.0.0-dev-20231222115330",
34
+ "@pandacss/shared": "0.0.0-dev-20231222115330",
35
+ "@pandacss/types": "0.0.0-dev-20231222115330"
36
36
  },
37
37
  "devDependencies": {
38
38
  "hookable": "5.5.3",
39
- "@pandacss/fixture": "0.0.0-dev-20231220140705",
40
- "@pandacss/generator": "0.0.0-dev-20231220140705"
39
+ "@pandacss/fixture": "0.0.0-dev-20231222115330",
40
+ "@pandacss/generator": "0.0.0-dev-20231222115330"
41
41
  },
42
42
  "files": [
43
43
  "dist"