@pandacss/parser 0.0.0-dev-20230410155103 → 0.0.0-dev-20230411173946
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 +14 -7
- package/dist/index.mjs +13 -6
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var import_lil_fp = require("lil-fp");
|
|
|
29
29
|
var import_ts_morph5 = require("ts-morph");
|
|
30
30
|
|
|
31
31
|
// src/parser.ts
|
|
32
|
-
var
|
|
32
|
+
var import_extractor = require("@pandacss/extractor");
|
|
33
33
|
var import_logger = require("@pandacss/logger");
|
|
34
34
|
var import_shared2 = require("@pandacss/shared");
|
|
35
35
|
var import_ts_morph4 = require("ts-morph");
|
|
@@ -262,6 +262,9 @@ function createImportMatcher(mod, values) {
|
|
|
262
262
|
}
|
|
263
263
|
};
|
|
264
264
|
}
|
|
265
|
+
var combineResult = (unboxed) => {
|
|
266
|
+
return [...unboxed.conditions, unboxed.raw, ...unboxed.spreadConditions];
|
|
267
|
+
};
|
|
265
268
|
function createParser(options) {
|
|
266
269
|
return function parse(sourceFile, confProperties, mode = "internal") {
|
|
267
270
|
if (!sourceFile)
|
|
@@ -346,7 +349,7 @@ function createParser(options) {
|
|
|
346
349
|
return Boolean(functions.get(fnName)?.get(propName));
|
|
347
350
|
});
|
|
348
351
|
const measure2 = import_logger.logger.time.debug(`Tokens extracted from ${filePath}`);
|
|
349
|
-
const extractResultByName = (0,
|
|
352
|
+
const extractResultByName = (0, import_extractor.extract)({
|
|
350
353
|
ast: sourceFile,
|
|
351
354
|
components: {
|
|
352
355
|
matchTag: (prop) => matchTag(prop.tagName),
|
|
@@ -373,7 +376,7 @@ function createParser(options) {
|
|
|
373
376
|
collector.set(name2, {
|
|
374
377
|
name: name2,
|
|
375
378
|
box: query.box.value[0],
|
|
376
|
-
data: (0,
|
|
379
|
+
data: combineResult((0, import_extractor.unbox)(query.box.value[0]))
|
|
377
380
|
});
|
|
378
381
|
});
|
|
379
382
|
}).when(isValidPattern, (name2) => {
|
|
@@ -381,7 +384,7 @@ function createParser(options) {
|
|
|
381
384
|
collector.setPattern(name2, {
|
|
382
385
|
name: name2,
|
|
383
386
|
box: query.box.value[0],
|
|
384
|
-
data: (0,
|
|
387
|
+
data: combineResult((0, import_extractor.unbox)(query.box.value[0]))
|
|
385
388
|
});
|
|
386
389
|
});
|
|
387
390
|
}).when(isValidRecipe, (name2) => {
|
|
@@ -389,19 +392,23 @@ function createParser(options) {
|
|
|
389
392
|
collector.setRecipe(name2, {
|
|
390
393
|
name: name2,
|
|
391
394
|
box: query.box.value[0],
|
|
392
|
-
data: (0,
|
|
395
|
+
data: combineResult((0, import_extractor.unbox)(query.box.value[0]))
|
|
393
396
|
});
|
|
394
397
|
});
|
|
395
398
|
}).when(isValidStyleFn, () => {
|
|
396
399
|
result.queryList.forEach((query) => {
|
|
397
|
-
collector.setCva({
|
|
400
|
+
collector.setCva({
|
|
401
|
+
name,
|
|
402
|
+
box: query.box,
|
|
403
|
+
data: combineResult((0, import_extractor.unbox)(query.box))
|
|
404
|
+
});
|
|
398
405
|
});
|
|
399
406
|
}).otherwise(() => {
|
|
400
407
|
});
|
|
401
408
|
} else if (result.kind === "component") {
|
|
402
409
|
result.queryList.forEach((query) => {
|
|
403
410
|
let type;
|
|
404
|
-
const data = (0,
|
|
411
|
+
const data = combineResult((0, import_extractor.unbox)(query.box));
|
|
405
412
|
import_logger.logger.debug(`ast:jsx:${name}`, { filePath, result: data });
|
|
406
413
|
if (jsx && name.startsWith(jsxFactoryAlias)) {
|
|
407
414
|
type = "jsx-factory";
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { Obj, pipe, tap } from "lil-fp";
|
|
|
3
3
|
import { Project as TsProject, ScriptKind } from "ts-morph";
|
|
4
4
|
|
|
5
5
|
// src/parser.ts
|
|
6
|
-
import { extract, unbox } from "@
|
|
6
|
+
import { extract, unbox } from "@pandacss/extractor";
|
|
7
7
|
import { logger } from "@pandacss/logger";
|
|
8
8
|
import { memo as memo2 } from "@pandacss/shared";
|
|
9
9
|
import { Node as Node4 } from "ts-morph";
|
|
@@ -238,6 +238,9 @@ function createImportMatcher(mod, values) {
|
|
|
238
238
|
}
|
|
239
239
|
};
|
|
240
240
|
}
|
|
241
|
+
var combineResult = (unboxed) => {
|
|
242
|
+
return [...unboxed.conditions, unboxed.raw, ...unboxed.spreadConditions];
|
|
243
|
+
};
|
|
241
244
|
function createParser(options) {
|
|
242
245
|
return function parse(sourceFile, confProperties, mode = "internal") {
|
|
243
246
|
if (!sourceFile)
|
|
@@ -349,7 +352,7 @@ function createParser(options) {
|
|
|
349
352
|
collector.set(name2, {
|
|
350
353
|
name: name2,
|
|
351
354
|
box: query.box.value[0],
|
|
352
|
-
data: unbox(query.box.value[0])
|
|
355
|
+
data: combineResult(unbox(query.box.value[0]))
|
|
353
356
|
});
|
|
354
357
|
});
|
|
355
358
|
}).when(isValidPattern, (name2) => {
|
|
@@ -357,7 +360,7 @@ function createParser(options) {
|
|
|
357
360
|
collector.setPattern(name2, {
|
|
358
361
|
name: name2,
|
|
359
362
|
box: query.box.value[0],
|
|
360
|
-
data: unbox(query.box.value[0])
|
|
363
|
+
data: combineResult(unbox(query.box.value[0]))
|
|
361
364
|
});
|
|
362
365
|
});
|
|
363
366
|
}).when(isValidRecipe, (name2) => {
|
|
@@ -365,19 +368,23 @@ function createParser(options) {
|
|
|
365
368
|
collector.setRecipe(name2, {
|
|
366
369
|
name: name2,
|
|
367
370
|
box: query.box.value[0],
|
|
368
|
-
data: unbox(query.box.value[0])
|
|
371
|
+
data: combineResult(unbox(query.box.value[0]))
|
|
369
372
|
});
|
|
370
373
|
});
|
|
371
374
|
}).when(isValidStyleFn, () => {
|
|
372
375
|
result.queryList.forEach((query) => {
|
|
373
|
-
collector.setCva({
|
|
376
|
+
collector.setCva({
|
|
377
|
+
name,
|
|
378
|
+
box: query.box,
|
|
379
|
+
data: combineResult(unbox(query.box))
|
|
380
|
+
});
|
|
374
381
|
});
|
|
375
382
|
}).otherwise(() => {
|
|
376
383
|
});
|
|
377
384
|
} else if (result.kind === "component") {
|
|
378
385
|
result.queryList.forEach((query) => {
|
|
379
386
|
let type;
|
|
380
|
-
const data = unbox(query.box);
|
|
387
|
+
const data = combineResult(unbox(query.box));
|
|
381
388
|
logger.debug(`ast:jsx:${name}`, { filePath, result: data });
|
|
382
389
|
if (jsx && name.startsWith(jsxFactoryAlias)) {
|
|
383
390
|
type = "jsx-factory";
|
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-20230411173946",
|
|
4
4
|
"description": "The static parser for panda css",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -11,17 +11,17 @@
|
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"ts-morph": "17.0.1",
|
|
14
|
+
"lil-fp": "1.4.5",
|
|
15
|
+
"ts-morph": "18.0.0",
|
|
17
16
|
"ts-pattern": "4.2.2",
|
|
18
|
-
"@pandacss/
|
|
19
|
-
"@pandacss/
|
|
20
|
-
"@pandacss/
|
|
21
|
-
"@pandacss/
|
|
17
|
+
"@pandacss/extractor": "0.0.0-dev-20230411173946",
|
|
18
|
+
"@pandacss/is-valid-prop": "0.0.0-dev-20230411173946",
|
|
19
|
+
"@pandacss/logger": "0.0.0-dev-20230411173946",
|
|
20
|
+
"@pandacss/shared": "0.0.0-dev-20230411173946",
|
|
21
|
+
"@pandacss/types": "0.0.0-dev-20230411173946"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@pandacss/fixture": "0.0.0-dev-
|
|
24
|
+
"@pandacss/fixture": "0.0.0-dev-20230411173946"
|
|
25
25
|
},
|
|
26
26
|
"files": [
|
|
27
27
|
"dist"
|