@pandacss/parser 0.0.0-dev-20230116230229 → 0.0.0-dev-20230118102146
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.ts +1 -1
- package/dist/index.js +9 -6
- package/dist/index.mjs +9 -6
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -62,9 +62,12 @@ function isPrimitiveLiteral(node) {
|
|
|
62
62
|
return import_ts_morph.Node.isStringLiteral(node) || import_ts_morph.Node.isNumericLiteral(node) || import_ts_morph.Node.isTrueLiteral(node) || import_ts_morph.Node.isFalseLiteral(node);
|
|
63
63
|
}
|
|
64
64
|
function extractValue(value) {
|
|
65
|
-
return (0, import_ts_pattern.match)(value).when(
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
return (0, import_ts_pattern.match)(value).when(
|
|
66
|
+
(node) => import_ts_morph.Node.isStringLiteral(node) || import_ts_morph.Node.isNoSubstitutionTemplateLiteral(node),
|
|
67
|
+
(value2) => {
|
|
68
|
+
return value2.getLiteralValue().replaceAll(/[\n\s]+/g, " ");
|
|
69
|
+
}
|
|
70
|
+
).when(isPrimitiveLiteral, (value2) => {
|
|
68
71
|
return value2.getLiteralValue();
|
|
69
72
|
}).when(import_ts_morph.Node.isNullLiteral, () => {
|
|
70
73
|
return null;
|
|
@@ -137,7 +140,7 @@ function visitCallExpressions(file, options) {
|
|
|
137
140
|
var Collector = class {
|
|
138
141
|
jsx = /* @__PURE__ */ new Set();
|
|
139
142
|
css = /* @__PURE__ */ new Set();
|
|
140
|
-
|
|
143
|
+
cva = /* @__PURE__ */ new Set();
|
|
141
144
|
recipe = /* @__PURE__ */ new Map();
|
|
142
145
|
pattern = /* @__PURE__ */ new Map();
|
|
143
146
|
set(name, result) {
|
|
@@ -152,7 +155,7 @@ var Collector = class {
|
|
|
152
155
|
this.recipe.get(name)?.add({ type: "recipe", ...result });
|
|
153
156
|
}
|
|
154
157
|
get isEmpty() {
|
|
155
|
-
return this.css.size === 0 && this.
|
|
158
|
+
return this.css.size === 0 && this.cva.size === 0 && this.recipe.size === 0 && this.pattern.size === 0 && this.jsx.size === 0;
|
|
156
159
|
}
|
|
157
160
|
};
|
|
158
161
|
|
|
@@ -273,7 +276,7 @@ function createParser(options) {
|
|
|
273
276
|
const collector = new Collector();
|
|
274
277
|
const { jsx, importMap } = options;
|
|
275
278
|
const importRegex = [
|
|
276
|
-
createImportMatcher(importMap.css, ["css", "
|
|
279
|
+
createImportMatcher(importMap.css, ["css", "cva"]),
|
|
277
280
|
createImportMatcher(importMap.recipe),
|
|
278
281
|
createImportMatcher(importMap.pattern)
|
|
279
282
|
];
|
package/dist/index.mjs
CHANGED
|
@@ -37,9 +37,12 @@ function isPrimitiveLiteral(node) {
|
|
|
37
37
|
return Node.isStringLiteral(node) || Node.isNumericLiteral(node) || Node.isTrueLiteral(node) || Node.isFalseLiteral(node);
|
|
38
38
|
}
|
|
39
39
|
function extractValue(value) {
|
|
40
|
-
return match(value).when(
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
return match(value).when(
|
|
41
|
+
(node) => Node.isStringLiteral(node) || Node.isNoSubstitutionTemplateLiteral(node),
|
|
42
|
+
(value2) => {
|
|
43
|
+
return value2.getLiteralValue().replaceAll(/[\n\s]+/g, " ");
|
|
44
|
+
}
|
|
45
|
+
).when(isPrimitiveLiteral, (value2) => {
|
|
43
46
|
return value2.getLiteralValue();
|
|
44
47
|
}).when(Node.isNullLiteral, () => {
|
|
45
48
|
return null;
|
|
@@ -112,7 +115,7 @@ function visitCallExpressions(file, options) {
|
|
|
112
115
|
var Collector = class {
|
|
113
116
|
jsx = /* @__PURE__ */ new Set();
|
|
114
117
|
css = /* @__PURE__ */ new Set();
|
|
115
|
-
|
|
118
|
+
cva = /* @__PURE__ */ new Set();
|
|
116
119
|
recipe = /* @__PURE__ */ new Map();
|
|
117
120
|
pattern = /* @__PURE__ */ new Map();
|
|
118
121
|
set(name, result) {
|
|
@@ -127,7 +130,7 @@ var Collector = class {
|
|
|
127
130
|
this.recipe.get(name)?.add({ type: "recipe", ...result });
|
|
128
131
|
}
|
|
129
132
|
get isEmpty() {
|
|
130
|
-
return this.css.size === 0 && this.
|
|
133
|
+
return this.css.size === 0 && this.cva.size === 0 && this.recipe.size === 0 && this.pattern.size === 0 && this.jsx.size === 0;
|
|
131
134
|
}
|
|
132
135
|
};
|
|
133
136
|
|
|
@@ -248,7 +251,7 @@ function createParser(options) {
|
|
|
248
251
|
const collector = new Collector();
|
|
249
252
|
const { jsx, importMap } = options;
|
|
250
253
|
const importRegex = [
|
|
251
|
-
createImportMatcher(importMap.css, ["css", "
|
|
254
|
+
createImportMatcher(importMap.css, ["css", "cva"]),
|
|
252
255
|
createImportMatcher(importMap.recipe),
|
|
253
256
|
createImportMatcher(importMap.pattern)
|
|
254
257
|
];
|
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-20230118102146",
|
|
4
4
|
"description": "The static parser for panda css",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"ts-pattern": "4.1.3",
|
|
15
15
|
"ts-morph": "17.0.1",
|
|
16
|
-
"@pandacss/logger": "0.0.0-dev-
|
|
17
|
-
"@pandacss/shared": "0.0.0-dev-
|
|
18
|
-
"@pandacss/is-valid-prop": "0.0.0-dev-
|
|
19
|
-
"@pandacss/types": "0.0.0-dev-
|
|
16
|
+
"@pandacss/logger": "0.0.0-dev-20230118102146",
|
|
17
|
+
"@pandacss/shared": "0.0.0-dev-20230118102146",
|
|
18
|
+
"@pandacss/is-valid-prop": "0.0.0-dev-20230118102146",
|
|
19
|
+
"@pandacss/types": "0.0.0-dev-20230118102146"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@pandacss/fixture": "0.0.0-dev-
|
|
22
|
+
"@pandacss/fixture": "0.0.0-dev-20230118102146"
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
25
|
"dist"
|