@pandacss/parser 0.22.0 → 0.23.0
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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +58 -56
- package/dist/index.mjs +58 -56
- package/package.json +8 -9
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -213,14 +213,15 @@ var defaultEnv = { preset: "ECMA" };
|
|
|
213
213
|
var identityFn = (styles) => styles;
|
|
214
214
|
var evaluateOptions = { environment: defaultEnv };
|
|
215
215
|
function createParser(options) {
|
|
216
|
-
const { jsx, getRecipesByJsxName, getPatternsByJsxName, tsOptions, join } = options;
|
|
216
|
+
const { jsx, getRecipesByJsxName, getPatternsByJsxName, tsOptions, join, isTemplateLiteralSyntax } = options;
|
|
217
217
|
const importMap = Object.fromEntries(Object.entries(options.importMap).map(([key, value]) => [key, join(...value)]));
|
|
218
|
+
const isJsxEnabled = jsx.framework;
|
|
218
219
|
const importRegex = [
|
|
219
220
|
createImportMatcher(importMap.css, ["css", "cva", "sva"]),
|
|
220
221
|
createImportMatcher(importMap.recipe),
|
|
221
222
|
createImportMatcher(importMap.pattern)
|
|
222
223
|
];
|
|
223
|
-
if (
|
|
224
|
+
if (isJsxEnabled) {
|
|
224
225
|
importRegex.push(createImportMatcher(importMap.jsx, [jsx.factory, ...jsx.nodes.map((node) => node.jsxName)]));
|
|
225
226
|
}
|
|
226
227
|
return function parse2(sourceFile) {
|
|
@@ -253,31 +254,32 @@ function createParser(options) {
|
|
|
253
254
|
"ast:import",
|
|
254
255
|
imports.value.length ? `Found import { ${imports} } in ${filePath}` : `No import found in ${filePath}`
|
|
255
256
|
);
|
|
257
|
+
if (!imports.value.length && !isJsxEnabled) {
|
|
258
|
+
return collector;
|
|
259
|
+
}
|
|
256
260
|
const [css] = importRegex;
|
|
257
|
-
const jsxFactoryAlias =
|
|
261
|
+
const jsxFactoryAlias = isJsxEnabled ? imports.getAlias(jsx.factory) : "styled";
|
|
258
262
|
const isValidPattern = imports.createMatch(importMap.pattern, options.patternKeys);
|
|
259
263
|
const isValidRecipe = imports.createMatch(importMap.recipe, options.recipeKeys);
|
|
260
264
|
const isValidStyleFn = (name) => name === jsx?.factory;
|
|
261
|
-
const isFactory = (name) => Boolean(
|
|
265
|
+
const isFactory = (name) => Boolean(isJsxEnabled && name.startsWith(jsxFactoryAlias));
|
|
262
266
|
const isRawFn = (fullName) => {
|
|
263
267
|
const name = fullName.split(".raw")[0] ?? "";
|
|
264
268
|
return name === "css" || isValidPattern(name) || isValidRecipe(name);
|
|
265
269
|
};
|
|
266
|
-
const
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
{ string: /* @__PURE__ */ new Set(), regex: [] }
|
|
280
|
-
);
|
|
270
|
+
const patternPropertiesByJsxName = /* @__PURE__ */ new Map();
|
|
271
|
+
const initialPatterns = { string: /* @__PURE__ */ new Set(), regex: [] };
|
|
272
|
+
const patternJsxLists = isJsxEnabled ? (jsx?.nodes ?? []).filter(isNodePattern).reduce((acc, pattern) => {
|
|
273
|
+
patternPropertiesByJsxName.set(pattern.jsxName, new Set(pattern.props ?? []));
|
|
274
|
+
pattern.jsx?.forEach((jsx2) => {
|
|
275
|
+
if (typeof jsx2 === "string") {
|
|
276
|
+
acc.string.add(jsx2);
|
|
277
|
+
} else if (jsx2) {
|
|
278
|
+
acc.regex.push(jsx2);
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
return acc;
|
|
282
|
+
}, initialPatterns) : initialPatterns;
|
|
281
283
|
const recipes = /* @__PURE__ */ new Set();
|
|
282
284
|
const patterns = /* @__PURE__ */ new Set();
|
|
283
285
|
imports.value.forEach((importDeclaration) => {
|
|
@@ -293,20 +295,18 @@ function createParser(options) {
|
|
|
293
295
|
const components = /* @__PURE__ */ new Map();
|
|
294
296
|
const propertiesMap = /* @__PURE__ */ new Map();
|
|
295
297
|
const recipePropertiesByJsxName = /* @__PURE__ */ new Map();
|
|
296
|
-
const
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
{ string: /* @__PURE__ */ new Set(), regex: [] }
|
|
309
|
-
);
|
|
298
|
+
const initialRecipes = { string: /* @__PURE__ */ new Set(), regex: [] };
|
|
299
|
+
const recipeJsxLists = isJsxEnabled ? (jsx?.nodes ?? []).filter(isNodeRecipe).reduce((acc, recipe) => {
|
|
300
|
+
recipePropertiesByJsxName.set(recipe.jsxName, new Set(recipe.props ?? []));
|
|
301
|
+
recipe.jsx?.forEach((jsx2) => {
|
|
302
|
+
if (typeof jsx2 === "string") {
|
|
303
|
+
acc.string.add(jsx2);
|
|
304
|
+
} else {
|
|
305
|
+
acc.regex.push(jsx2);
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
return acc;
|
|
309
|
+
}, initialRecipes) : initialRecipes;
|
|
310
310
|
const cvaAlias = imports.getAlias("cva");
|
|
311
311
|
const cssAlias = imports.getAlias("css");
|
|
312
312
|
const svaAlias = imports.getAlias("sva");
|
|
@@ -319,36 +319,39 @@ function createParser(options) {
|
|
|
319
319
|
components.set(alias, propertiesMap);
|
|
320
320
|
});
|
|
321
321
|
}
|
|
322
|
-
const isJsxTagRecipe = (0, import_shared2.memo)(
|
|
322
|
+
const isJsxTagRecipe = isJsxEnabled ? (0, import_shared2.memo)(
|
|
323
323
|
(tagName) => recipeJsxLists.string.has(tagName) || recipeJsxLists.regex.some((regex) => regex.test(tagName))
|
|
324
|
-
);
|
|
325
|
-
const isJsxTagPattern = (0, import_shared2.memo)(
|
|
324
|
+
) : void 0;
|
|
325
|
+
const isJsxTagPattern = isJsxEnabled ? (0, import_shared2.memo)(
|
|
326
326
|
(tagName) => patternJsxLists.string.has(tagName) || patternJsxLists.regex.some((regex) => regex.test(tagName))
|
|
327
|
-
);
|
|
328
|
-
const matchTag = (0, import_shared2.memo)((tagName) => {
|
|
327
|
+
) : void 0;
|
|
328
|
+
const matchTag = isJsxEnabled ? (0, import_shared2.memo)((tagName) => {
|
|
329
329
|
if (!tagName)
|
|
330
330
|
return false;
|
|
331
|
-
return components.has(tagName) || isUpperCase(tagName) || isFactory(tagName) || isJsxTagRecipe(tagName) || isJsxTagPattern(tagName);
|
|
332
|
-
});
|
|
331
|
+
return components.has(tagName) || isUpperCase(tagName) || isFactory(tagName) || isJsxTagRecipe?.(tagName) || isJsxTagPattern?.(tagName);
|
|
332
|
+
}) : void 0;
|
|
333
333
|
const isRecipeOrPatternProp = (0, import_shared2.memo)((tagName, propName) => {
|
|
334
|
-
if (isJsxTagRecipe(tagName)) {
|
|
334
|
+
if (isJsxEnabled && isJsxTagRecipe?.(tagName)) {
|
|
335
335
|
const recipeList = getRecipesByJsxName(tagName);
|
|
336
336
|
return recipeList.some((recipe) => recipePropertiesByJsxName.get(recipe.jsxName)?.has(propName));
|
|
337
337
|
}
|
|
338
|
-
if (isJsxTagPattern(tagName)) {
|
|
338
|
+
if (isJsxEnabled && isJsxTagPattern?.(tagName)) {
|
|
339
339
|
const patternList = getPatternsByJsxName(tagName);
|
|
340
|
-
return patternList.some((pattern) =>
|
|
340
|
+
return patternList.some((pattern) => patternPropertiesByJsxName.get(pattern.jsxName)?.has(propName));
|
|
341
341
|
}
|
|
342
342
|
return false;
|
|
343
343
|
});
|
|
344
|
-
const matchTagProp = (0, import_ts_pattern.match)(jsx?.styleProps).with(
|
|
344
|
+
const matchTagProp = isJsxEnabled ? (0, import_ts_pattern.match)(jsx?.styleProps).with(
|
|
345
345
|
"all",
|
|
346
346
|
() => (0, import_shared2.memo)((tagName, propName) => {
|
|
347
347
|
return Boolean(components.get(tagName)?.has(propName)) || options.jsx?.isStyleProp(propName) || propertiesMap.has(propName) || isRecipeOrPatternProp(tagName, propName);
|
|
348
348
|
})
|
|
349
|
-
).with(
|
|
350
|
-
|
|
351
|
-
|
|
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;
|
|
352
355
|
const matchFn = (0, import_shared2.memo)((fnName) => {
|
|
353
356
|
if (recipes.has(fnName) || patterns.has(fnName))
|
|
354
357
|
return true;
|
|
@@ -359,10 +362,10 @@ function createParser(options) {
|
|
|
359
362
|
const measure = import_logger.logger.time.debug(`Tokens extracted from ${filePath}`);
|
|
360
363
|
const extractResultByName = (0, import_extractor.extract)({
|
|
361
364
|
ast: sourceFile,
|
|
362
|
-
components: {
|
|
363
|
-
matchTag: (prop) => matchTag(prop.tagName),
|
|
364
|
-
matchProp: (prop) => matchTagProp(prop.tagName, prop.propName)
|
|
365
|
-
},
|
|
365
|
+
components: isJsxEnabled ? {
|
|
366
|
+
matchTag: (prop) => !!matchTag?.(prop.tagName),
|
|
367
|
+
matchProp: (prop) => !!matchTagProp?.(prop.tagName, prop.propName)
|
|
368
|
+
} : void 0,
|
|
366
369
|
functions: {
|
|
367
370
|
matchFn: (prop) => matchFn(prop.fnName),
|
|
368
371
|
matchProp: () => true,
|
|
@@ -372,9 +375,7 @@ function createParser(options) {
|
|
|
372
375
|
return true;
|
|
373
376
|
}
|
|
374
377
|
},
|
|
375
|
-
taggedTemplates: {
|
|
376
|
-
matchTaggedTemplate: (tag) => matchFn(tag.fnName)
|
|
377
|
-
},
|
|
378
|
+
taggedTemplates: isTemplateLiteralSyntax ? { matchTaggedTemplate: (tag) => matchFn(tag.fnName) } : void 0,
|
|
378
379
|
getEvaluateOptions: (node) => {
|
|
379
380
|
if (!import_ts_morph.Node.isCallExpression(node))
|
|
380
381
|
return evaluateOptions;
|
|
@@ -394,9 +395,10 @@ function createParser(options) {
|
|
|
394
395
|
});
|
|
395
396
|
measure();
|
|
396
397
|
extractResultByName.forEach((result, alias) => {
|
|
397
|
-
let name =
|
|
398
|
+
let name = alias;
|
|
398
399
|
if (isRawFn(name))
|
|
399
400
|
name = name.replace(".raw", "");
|
|
401
|
+
name = imports.getName(name);
|
|
400
402
|
import_logger.logger.debug(`ast:${name}`, name !== alias ? { kind: result.kind, alias } : { kind: result.kind });
|
|
401
403
|
if (result.kind === "function") {
|
|
402
404
|
(0, import_ts_pattern.match)(name).when(css.match, (name2) => {
|
|
@@ -503,7 +505,7 @@ function createParser(options) {
|
|
|
503
505
|
});
|
|
504
506
|
}).otherwise(() => {
|
|
505
507
|
});
|
|
506
|
-
} else if (result.kind === "component") {
|
|
508
|
+
} else if (isJsxEnabled && result.kind === "component") {
|
|
507
509
|
result.queryList.forEach((query) => {
|
|
508
510
|
const data = combineResult((0, import_extractor.unbox)(query.box));
|
|
509
511
|
(0, import_ts_pattern.match)(name).when(isFactory, (jsxName) => {
|
package/dist/index.mjs
CHANGED
|
@@ -175,14 +175,15 @@ var defaultEnv = { preset: "ECMA" };
|
|
|
175
175
|
var identityFn = (styles) => styles;
|
|
176
176
|
var evaluateOptions = { environment: defaultEnv };
|
|
177
177
|
function createParser(options) {
|
|
178
|
-
const { jsx, getRecipesByJsxName, getPatternsByJsxName, tsOptions, join } = options;
|
|
178
|
+
const { jsx, getRecipesByJsxName, getPatternsByJsxName, tsOptions, join, isTemplateLiteralSyntax } = options;
|
|
179
179
|
const importMap = Object.fromEntries(Object.entries(options.importMap).map(([key, value]) => [key, join(...value)]));
|
|
180
|
+
const isJsxEnabled = jsx.framework;
|
|
180
181
|
const importRegex = [
|
|
181
182
|
createImportMatcher(importMap.css, ["css", "cva", "sva"]),
|
|
182
183
|
createImportMatcher(importMap.recipe),
|
|
183
184
|
createImportMatcher(importMap.pattern)
|
|
184
185
|
];
|
|
185
|
-
if (
|
|
186
|
+
if (isJsxEnabled) {
|
|
186
187
|
importRegex.push(createImportMatcher(importMap.jsx, [jsx.factory, ...jsx.nodes.map((node) => node.jsxName)]));
|
|
187
188
|
}
|
|
188
189
|
return function parse2(sourceFile) {
|
|
@@ -215,31 +216,32 @@ function createParser(options) {
|
|
|
215
216
|
"ast:import",
|
|
216
217
|
imports.value.length ? `Found import { ${imports} } in ${filePath}` : `No import found in ${filePath}`
|
|
217
218
|
);
|
|
219
|
+
if (!imports.value.length && !isJsxEnabled) {
|
|
220
|
+
return collector;
|
|
221
|
+
}
|
|
218
222
|
const [css] = importRegex;
|
|
219
|
-
const jsxFactoryAlias =
|
|
223
|
+
const jsxFactoryAlias = isJsxEnabled ? imports.getAlias(jsx.factory) : "styled";
|
|
220
224
|
const isValidPattern = imports.createMatch(importMap.pattern, options.patternKeys);
|
|
221
225
|
const isValidRecipe = imports.createMatch(importMap.recipe, options.recipeKeys);
|
|
222
226
|
const isValidStyleFn = (name) => name === jsx?.factory;
|
|
223
|
-
const isFactory = (name) => Boolean(
|
|
227
|
+
const isFactory = (name) => Boolean(isJsxEnabled && name.startsWith(jsxFactoryAlias));
|
|
224
228
|
const isRawFn = (fullName) => {
|
|
225
229
|
const name = fullName.split(".raw")[0] ?? "";
|
|
226
230
|
return name === "css" || isValidPattern(name) || isValidRecipe(name);
|
|
227
231
|
};
|
|
228
|
-
const
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
{ string: /* @__PURE__ */ new Set(), regex: [] }
|
|
242
|
-
);
|
|
232
|
+
const patternPropertiesByJsxName = /* @__PURE__ */ new Map();
|
|
233
|
+
const initialPatterns = { string: /* @__PURE__ */ new Set(), regex: [] };
|
|
234
|
+
const patternJsxLists = isJsxEnabled ? (jsx?.nodes ?? []).filter(isNodePattern).reduce((acc, pattern) => {
|
|
235
|
+
patternPropertiesByJsxName.set(pattern.jsxName, new Set(pattern.props ?? []));
|
|
236
|
+
pattern.jsx?.forEach((jsx2) => {
|
|
237
|
+
if (typeof jsx2 === "string") {
|
|
238
|
+
acc.string.add(jsx2);
|
|
239
|
+
} else if (jsx2) {
|
|
240
|
+
acc.regex.push(jsx2);
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
return acc;
|
|
244
|
+
}, initialPatterns) : initialPatterns;
|
|
243
245
|
const recipes = /* @__PURE__ */ new Set();
|
|
244
246
|
const patterns = /* @__PURE__ */ new Set();
|
|
245
247
|
imports.value.forEach((importDeclaration) => {
|
|
@@ -255,20 +257,18 @@ function createParser(options) {
|
|
|
255
257
|
const components = /* @__PURE__ */ new Map();
|
|
256
258
|
const propertiesMap = /* @__PURE__ */ new Map();
|
|
257
259
|
const recipePropertiesByJsxName = /* @__PURE__ */ new Map();
|
|
258
|
-
const
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
{ string: /* @__PURE__ */ new Set(), regex: [] }
|
|
271
|
-
);
|
|
260
|
+
const initialRecipes = { string: /* @__PURE__ */ new Set(), regex: [] };
|
|
261
|
+
const recipeJsxLists = isJsxEnabled ? (jsx?.nodes ?? []).filter(isNodeRecipe).reduce((acc, recipe) => {
|
|
262
|
+
recipePropertiesByJsxName.set(recipe.jsxName, new Set(recipe.props ?? []));
|
|
263
|
+
recipe.jsx?.forEach((jsx2) => {
|
|
264
|
+
if (typeof jsx2 === "string") {
|
|
265
|
+
acc.string.add(jsx2);
|
|
266
|
+
} else {
|
|
267
|
+
acc.regex.push(jsx2);
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
return acc;
|
|
271
|
+
}, initialRecipes) : initialRecipes;
|
|
272
272
|
const cvaAlias = imports.getAlias("cva");
|
|
273
273
|
const cssAlias = imports.getAlias("css");
|
|
274
274
|
const svaAlias = imports.getAlias("sva");
|
|
@@ -281,36 +281,39 @@ function createParser(options) {
|
|
|
281
281
|
components.set(alias, propertiesMap);
|
|
282
282
|
});
|
|
283
283
|
}
|
|
284
|
-
const isJsxTagRecipe = memo2(
|
|
284
|
+
const isJsxTagRecipe = isJsxEnabled ? memo2(
|
|
285
285
|
(tagName) => recipeJsxLists.string.has(tagName) || recipeJsxLists.regex.some((regex) => regex.test(tagName))
|
|
286
|
-
);
|
|
287
|
-
const isJsxTagPattern = memo2(
|
|
286
|
+
) : void 0;
|
|
287
|
+
const isJsxTagPattern = isJsxEnabled ? memo2(
|
|
288
288
|
(tagName) => patternJsxLists.string.has(tagName) || patternJsxLists.regex.some((regex) => regex.test(tagName))
|
|
289
|
-
);
|
|
290
|
-
const matchTag = memo2((tagName) => {
|
|
289
|
+
) : void 0;
|
|
290
|
+
const matchTag = isJsxEnabled ? memo2((tagName) => {
|
|
291
291
|
if (!tagName)
|
|
292
292
|
return false;
|
|
293
|
-
return components.has(tagName) || isUpperCase(tagName) || isFactory(tagName) || isJsxTagRecipe(tagName) || isJsxTagPattern(tagName);
|
|
294
|
-
});
|
|
293
|
+
return components.has(tagName) || isUpperCase(tagName) || isFactory(tagName) || isJsxTagRecipe?.(tagName) || isJsxTagPattern?.(tagName);
|
|
294
|
+
}) : void 0;
|
|
295
295
|
const isRecipeOrPatternProp = memo2((tagName, propName) => {
|
|
296
|
-
if (isJsxTagRecipe(tagName)) {
|
|
296
|
+
if (isJsxEnabled && isJsxTagRecipe?.(tagName)) {
|
|
297
297
|
const recipeList = getRecipesByJsxName(tagName);
|
|
298
298
|
return recipeList.some((recipe) => recipePropertiesByJsxName.get(recipe.jsxName)?.has(propName));
|
|
299
299
|
}
|
|
300
|
-
if (isJsxTagPattern(tagName)) {
|
|
300
|
+
if (isJsxEnabled && isJsxTagPattern?.(tagName)) {
|
|
301
301
|
const patternList = getPatternsByJsxName(tagName);
|
|
302
|
-
return patternList.some((pattern) =>
|
|
302
|
+
return patternList.some((pattern) => patternPropertiesByJsxName.get(pattern.jsxName)?.has(propName));
|
|
303
303
|
}
|
|
304
304
|
return false;
|
|
305
305
|
});
|
|
306
|
-
const matchTagProp = match(jsx?.styleProps).with(
|
|
306
|
+
const matchTagProp = isJsxEnabled ? match(jsx?.styleProps).with(
|
|
307
307
|
"all",
|
|
308
308
|
() => memo2((tagName, propName) => {
|
|
309
309
|
return Boolean(components.get(tagName)?.has(propName)) || options.jsx?.isStyleProp(propName) || propertiesMap.has(propName) || isRecipeOrPatternProp(tagName, propName);
|
|
310
310
|
})
|
|
311
|
-
).with(
|
|
312
|
-
|
|
313
|
-
|
|
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;
|
|
314
317
|
const matchFn = memo2((fnName) => {
|
|
315
318
|
if (recipes.has(fnName) || patterns.has(fnName))
|
|
316
319
|
return true;
|
|
@@ -321,10 +324,10 @@ function createParser(options) {
|
|
|
321
324
|
const measure = logger.time.debug(`Tokens extracted from ${filePath}`);
|
|
322
325
|
const extractResultByName = extract({
|
|
323
326
|
ast: sourceFile,
|
|
324
|
-
components: {
|
|
325
|
-
matchTag: (prop) => matchTag(prop.tagName),
|
|
326
|
-
matchProp: (prop) => matchTagProp(prop.tagName, prop.propName)
|
|
327
|
-
},
|
|
327
|
+
components: isJsxEnabled ? {
|
|
328
|
+
matchTag: (prop) => !!matchTag?.(prop.tagName),
|
|
329
|
+
matchProp: (prop) => !!matchTagProp?.(prop.tagName, prop.propName)
|
|
330
|
+
} : void 0,
|
|
328
331
|
functions: {
|
|
329
332
|
matchFn: (prop) => matchFn(prop.fnName),
|
|
330
333
|
matchProp: () => true,
|
|
@@ -334,9 +337,7 @@ function createParser(options) {
|
|
|
334
337
|
return true;
|
|
335
338
|
}
|
|
336
339
|
},
|
|
337
|
-
taggedTemplates: {
|
|
338
|
-
matchTaggedTemplate: (tag) => matchFn(tag.fnName)
|
|
339
|
-
},
|
|
340
|
+
taggedTemplates: isTemplateLiteralSyntax ? { matchTaggedTemplate: (tag) => matchFn(tag.fnName) } : void 0,
|
|
340
341
|
getEvaluateOptions: (node) => {
|
|
341
342
|
if (!Node.isCallExpression(node))
|
|
342
343
|
return evaluateOptions;
|
|
@@ -356,9 +357,10 @@ function createParser(options) {
|
|
|
356
357
|
});
|
|
357
358
|
measure();
|
|
358
359
|
extractResultByName.forEach((result, alias) => {
|
|
359
|
-
let name =
|
|
360
|
+
let name = alias;
|
|
360
361
|
if (isRawFn(name))
|
|
361
362
|
name = name.replace(".raw", "");
|
|
363
|
+
name = imports.getName(name);
|
|
362
364
|
logger.debug(`ast:${name}`, name !== alias ? { kind: result.kind, alias } : { kind: result.kind });
|
|
363
365
|
if (result.kind === "function") {
|
|
364
366
|
match(name).when(css.match, (name2) => {
|
|
@@ -465,7 +467,7 @@ function createParser(options) {
|
|
|
465
467
|
});
|
|
466
468
|
}).otherwise(() => {
|
|
467
469
|
});
|
|
468
|
-
} else if (result.kind === "component") {
|
|
470
|
+
} else if (isJsxEnabled && result.kind === "component") {
|
|
469
471
|
result.queryList.forEach((query) => {
|
|
470
472
|
const data = combineResult(unbox(query.box));
|
|
471
473
|
match(name).when(isFactory, (jsxName) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/parser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "The static parser for panda css",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -27,17 +27,16 @@
|
|
|
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.
|
|
31
|
-
"@pandacss/extractor": "0.
|
|
32
|
-
"@pandacss/is-valid-prop": "0.
|
|
33
|
-
"@pandacss/logger": "0.
|
|
34
|
-
"@pandacss/shared": "0.
|
|
35
|
-
"@pandacss/types": "0.
|
|
30
|
+
"@pandacss/config": "^0.23.0",
|
|
31
|
+
"@pandacss/extractor": "0.23.0",
|
|
32
|
+
"@pandacss/is-valid-prop": "0.23.0",
|
|
33
|
+
"@pandacss/logger": "0.23.0",
|
|
34
|
+
"@pandacss/shared": "0.23.0",
|
|
35
|
+
"@pandacss/types": "0.23.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"hookable": "5.5.3",
|
|
39
|
-
"@pandacss/
|
|
40
|
-
"@pandacss/generator": "0.22.0"
|
|
39
|
+
"@pandacss/generator": "0.23.0"
|
|
41
40
|
},
|
|
42
41
|
"files": [
|
|
43
42
|
"dist"
|