@pandacss/parser 0.0.0-dev-20230801082734 → 0.0.0-dev-20230801084843
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 +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +17 -8
- package/dist/index.mjs +17 -8
- package/package.json +9 -9
package/dist/index.d.mts
CHANGED
|
@@ -7,11 +7,13 @@ declare class ParserResult {
|
|
|
7
7
|
jsx: Set<ResultItem>;
|
|
8
8
|
css: Set<ResultItem>;
|
|
9
9
|
cva: Set<ResultItem>;
|
|
10
|
+
sva: Set<ResultItem>;
|
|
10
11
|
recipe: Map<string, Set<ResultItem>>;
|
|
11
12
|
pattern: Map<string, Set<ResultItem>>;
|
|
12
13
|
filePath: string | undefined;
|
|
13
|
-
set(name: 'cva' | 'css', result: ResultItem): void;
|
|
14
|
+
set(name: 'cva' | 'css' | 'sva', result: ResultItem): void;
|
|
14
15
|
setCva(result: ResultItem): void;
|
|
16
|
+
setSva(result: ResultItem): void;
|
|
15
17
|
setJsx(result: ResultItem): void;
|
|
16
18
|
setPattern(name: string, result: ResultItem): void;
|
|
17
19
|
setRecipe(name: string, result: ResultItem): void;
|
|
@@ -21,13 +23,14 @@ declare class ParserResult {
|
|
|
21
23
|
toJSON(): {
|
|
22
24
|
css: ResultItem[];
|
|
23
25
|
cva: ResultItem[];
|
|
26
|
+
sva: ResultItem[];
|
|
27
|
+
jsx: ResultItem[];
|
|
24
28
|
recipe: {
|
|
25
29
|
[k: string]: ResultItem[];
|
|
26
30
|
};
|
|
27
31
|
pattern: {
|
|
28
32
|
[k: string]: ResultItem[];
|
|
29
33
|
};
|
|
30
|
-
jsx: ResultItem[];
|
|
31
34
|
};
|
|
32
35
|
merge(result: ParserResult): this;
|
|
33
36
|
static fromJSON(json: string): ParserResult;
|
package/dist/index.d.ts
CHANGED
|
@@ -7,11 +7,13 @@ declare class ParserResult {
|
|
|
7
7
|
jsx: Set<ResultItem>;
|
|
8
8
|
css: Set<ResultItem>;
|
|
9
9
|
cva: Set<ResultItem>;
|
|
10
|
+
sva: Set<ResultItem>;
|
|
10
11
|
recipe: Map<string, Set<ResultItem>>;
|
|
11
12
|
pattern: Map<string, Set<ResultItem>>;
|
|
12
13
|
filePath: string | undefined;
|
|
13
|
-
set(name: 'cva' | 'css', result: ResultItem): void;
|
|
14
|
+
set(name: 'cva' | 'css' | 'sva', result: ResultItem): void;
|
|
14
15
|
setCva(result: ResultItem): void;
|
|
16
|
+
setSva(result: ResultItem): void;
|
|
15
17
|
setJsx(result: ResultItem): void;
|
|
16
18
|
setPattern(name: string, result: ResultItem): void;
|
|
17
19
|
setRecipe(name: string, result: ResultItem): void;
|
|
@@ -21,13 +23,14 @@ declare class ParserResult {
|
|
|
21
23
|
toJSON(): {
|
|
22
24
|
css: ResultItem[];
|
|
23
25
|
cva: ResultItem[];
|
|
26
|
+
sva: ResultItem[];
|
|
27
|
+
jsx: ResultItem[];
|
|
24
28
|
recipe: {
|
|
25
29
|
[k: string]: ResultItem[];
|
|
26
30
|
};
|
|
27
31
|
pattern: {
|
|
28
32
|
[k: string]: ResultItem[];
|
|
29
33
|
};
|
|
30
|
-
jsx: ResultItem[];
|
|
31
34
|
};
|
|
32
35
|
merge(result: ParserResult): this;
|
|
33
36
|
static fromJSON(json: string): ParserResult;
|
package/dist/index.js
CHANGED
|
@@ -102,6 +102,7 @@ var ParserResult = class _ParserResult {
|
|
|
102
102
|
jsx = /* @__PURE__ */ new Set();
|
|
103
103
|
css = /* @__PURE__ */ new Set();
|
|
104
104
|
cva = /* @__PURE__ */ new Set();
|
|
105
|
+
sva = /* @__PURE__ */ new Set();
|
|
105
106
|
recipe = /* @__PURE__ */ new Map();
|
|
106
107
|
pattern = /* @__PURE__ */ new Map();
|
|
107
108
|
filePath;
|
|
@@ -111,6 +112,9 @@ var ParserResult = class _ParserResult {
|
|
|
111
112
|
setCva(result) {
|
|
112
113
|
this.cva.add({ type: "cva", ...result });
|
|
113
114
|
}
|
|
115
|
+
setSva(result) {
|
|
116
|
+
this.sva.add({ type: "sva", ...result });
|
|
117
|
+
}
|
|
114
118
|
setJsx(result) {
|
|
115
119
|
this.jsx.add({ type: "jsx", ...result });
|
|
116
120
|
}
|
|
@@ -123,7 +127,7 @@ var ParserResult = class _ParserResult {
|
|
|
123
127
|
this.recipe.get(name)?.add({ type: "recipe", ...result });
|
|
124
128
|
}
|
|
125
129
|
isEmpty() {
|
|
126
|
-
return this.css.size === 0 && this.cva.size === 0 && this.recipe.size === 0 && this.pattern.size === 0 && this.jsx.size === 0;
|
|
130
|
+
return this.css.size === 0 && this.cva.size === 0 && this.sva.size === 0 && this.recipe.size === 0 && this.pattern.size === 0 && this.jsx.size === 0;
|
|
127
131
|
}
|
|
128
132
|
setFilePath(filePath) {
|
|
129
133
|
this.filePath = filePath;
|
|
@@ -133,23 +137,27 @@ var ParserResult = class _ParserResult {
|
|
|
133
137
|
const result = [];
|
|
134
138
|
this.css.forEach((item) => result.push(item));
|
|
135
139
|
this.cva.forEach((item) => result.push(item));
|
|
140
|
+
this.sva.forEach((item) => result.push(item));
|
|
141
|
+
this.jsx.forEach((item) => result.push(item));
|
|
136
142
|
this.recipe.forEach((items) => items.forEach((item) => result.push(item)));
|
|
137
143
|
this.pattern.forEach((items) => items.forEach((item) => result.push(item)));
|
|
138
|
-
this.jsx.forEach((item) => result.push(item));
|
|
139
144
|
return result;
|
|
140
145
|
}
|
|
141
146
|
toJSON() {
|
|
142
147
|
return {
|
|
143
148
|
css: Array.from(this.css),
|
|
144
149
|
cva: Array.from(this.cva),
|
|
150
|
+
sva: Array.from(this.sva),
|
|
151
|
+
jsx: Array.from(this.jsx),
|
|
145
152
|
recipe: Object.fromEntries(Array.from(this.recipe.entries()).map(([key, value]) => [key, Array.from(value)])),
|
|
146
|
-
pattern: Object.fromEntries(Array.from(this.pattern.entries()).map(([key, value]) => [key, Array.from(value)]))
|
|
147
|
-
jsx: Array.from(this.jsx)
|
|
153
|
+
pattern: Object.fromEntries(Array.from(this.pattern.entries()).map(([key, value]) => [key, Array.from(value)]))
|
|
148
154
|
};
|
|
149
155
|
}
|
|
150
156
|
merge(result) {
|
|
151
157
|
result.css.forEach((item) => this.css.add(item));
|
|
152
158
|
result.cva.forEach((item) => this.cva.add(item));
|
|
159
|
+
result.sva.forEach((item) => this.sva.add(item));
|
|
160
|
+
result.jsx.forEach((item) => this.jsx.add(item));
|
|
153
161
|
result.recipe.forEach((items, name) => {
|
|
154
162
|
this.recipe.get(name) ?? this.recipe.set(name, /* @__PURE__ */ new Set());
|
|
155
163
|
items.forEach((item) => this.recipe.get(name)?.add(item));
|
|
@@ -158,7 +166,6 @@ var ParserResult = class _ParserResult {
|
|
|
158
166
|
this.pattern.get(name) ?? this.pattern.set(name, /* @__PURE__ */ new Set());
|
|
159
167
|
items.forEach((item) => this.pattern.get(name)?.add(item));
|
|
160
168
|
});
|
|
161
|
-
result.jsx.forEach((item) => this.jsx.add(item));
|
|
162
169
|
return this;
|
|
163
170
|
}
|
|
164
171
|
static fromJSON(json) {
|
|
@@ -166,9 +173,10 @@ var ParserResult = class _ParserResult {
|
|
|
166
173
|
const result = new _ParserResult();
|
|
167
174
|
result.css = new Set(data.css);
|
|
168
175
|
result.cva = new Set(data.cva);
|
|
176
|
+
result.sva = new Set(data.sva);
|
|
177
|
+
result.jsx = new Set(data.jsx);
|
|
169
178
|
result.recipe = new Map(Object.entries(data.recipe));
|
|
170
179
|
result.pattern = new Map(Object.entries(data.pattern));
|
|
171
|
-
result.jsx = new Set(data.jsx);
|
|
172
180
|
return result;
|
|
173
181
|
}
|
|
174
182
|
};
|
|
@@ -203,7 +211,7 @@ function createParser(options) {
|
|
|
203
211
|
const { jsx, getRecipesByJsxName, getPatternsByJsxName, tsOptions, join } = options;
|
|
204
212
|
const importMap = Object.fromEntries(Object.entries(options.importMap).map(([key, value]) => [key, join(...value)]));
|
|
205
213
|
const importRegex = [
|
|
206
|
-
createImportMatcher(importMap.css, ["css", "cva"]),
|
|
214
|
+
createImportMatcher(importMap.css, ["css", "cva", "sva"]),
|
|
207
215
|
createImportMatcher(importMap.recipe),
|
|
208
216
|
createImportMatcher(importMap.pattern)
|
|
209
217
|
];
|
|
@@ -296,6 +304,7 @@ function createParser(options) {
|
|
|
296
304
|
);
|
|
297
305
|
const cvaAlias = imports.getAlias("cva");
|
|
298
306
|
const cssAlias = imports.getAlias("css");
|
|
307
|
+
const svaAlias = imports.getAlias("sva");
|
|
299
308
|
if (options.jsx) {
|
|
300
309
|
options.jsx.nodes.forEach((node) => {
|
|
301
310
|
const alias = imports.getAlias(node.jsxName);
|
|
@@ -332,7 +341,7 @@ function createParser(options) {
|
|
|
332
341
|
const matchFn = (0, import_shared2.memo)((fnName) => {
|
|
333
342
|
if (recipes.has(fnName) || patterns.has(fnName))
|
|
334
343
|
return true;
|
|
335
|
-
if (fnName === cvaAlias || fnName === cssAlias || isRawFn(fnName) || isFactory(fnName))
|
|
344
|
+
if (fnName === cvaAlias || fnName === cssAlias || fnName === svaAlias || isRawFn(fnName) || isFactory(fnName))
|
|
336
345
|
return true;
|
|
337
346
|
return functions.has(fnName);
|
|
338
347
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -64,6 +64,7 @@ var ParserResult = class _ParserResult {
|
|
|
64
64
|
jsx = /* @__PURE__ */ new Set();
|
|
65
65
|
css = /* @__PURE__ */ new Set();
|
|
66
66
|
cva = /* @__PURE__ */ new Set();
|
|
67
|
+
sva = /* @__PURE__ */ new Set();
|
|
67
68
|
recipe = /* @__PURE__ */ new Map();
|
|
68
69
|
pattern = /* @__PURE__ */ new Map();
|
|
69
70
|
filePath;
|
|
@@ -73,6 +74,9 @@ var ParserResult = class _ParserResult {
|
|
|
73
74
|
setCva(result) {
|
|
74
75
|
this.cva.add({ type: "cva", ...result });
|
|
75
76
|
}
|
|
77
|
+
setSva(result) {
|
|
78
|
+
this.sva.add({ type: "sva", ...result });
|
|
79
|
+
}
|
|
76
80
|
setJsx(result) {
|
|
77
81
|
this.jsx.add({ type: "jsx", ...result });
|
|
78
82
|
}
|
|
@@ -85,7 +89,7 @@ var ParserResult = class _ParserResult {
|
|
|
85
89
|
this.recipe.get(name)?.add({ type: "recipe", ...result });
|
|
86
90
|
}
|
|
87
91
|
isEmpty() {
|
|
88
|
-
return this.css.size === 0 && this.cva.size === 0 && this.recipe.size === 0 && this.pattern.size === 0 && this.jsx.size === 0;
|
|
92
|
+
return this.css.size === 0 && this.cva.size === 0 && this.sva.size === 0 && this.recipe.size === 0 && this.pattern.size === 0 && this.jsx.size === 0;
|
|
89
93
|
}
|
|
90
94
|
setFilePath(filePath) {
|
|
91
95
|
this.filePath = filePath;
|
|
@@ -95,23 +99,27 @@ var ParserResult = class _ParserResult {
|
|
|
95
99
|
const result = [];
|
|
96
100
|
this.css.forEach((item) => result.push(item));
|
|
97
101
|
this.cva.forEach((item) => result.push(item));
|
|
102
|
+
this.sva.forEach((item) => result.push(item));
|
|
103
|
+
this.jsx.forEach((item) => result.push(item));
|
|
98
104
|
this.recipe.forEach((items) => items.forEach((item) => result.push(item)));
|
|
99
105
|
this.pattern.forEach((items) => items.forEach((item) => result.push(item)));
|
|
100
|
-
this.jsx.forEach((item) => result.push(item));
|
|
101
106
|
return result;
|
|
102
107
|
}
|
|
103
108
|
toJSON() {
|
|
104
109
|
return {
|
|
105
110
|
css: Array.from(this.css),
|
|
106
111
|
cva: Array.from(this.cva),
|
|
112
|
+
sva: Array.from(this.sva),
|
|
113
|
+
jsx: Array.from(this.jsx),
|
|
107
114
|
recipe: Object.fromEntries(Array.from(this.recipe.entries()).map(([key, value]) => [key, Array.from(value)])),
|
|
108
|
-
pattern: Object.fromEntries(Array.from(this.pattern.entries()).map(([key, value]) => [key, Array.from(value)]))
|
|
109
|
-
jsx: Array.from(this.jsx)
|
|
115
|
+
pattern: Object.fromEntries(Array.from(this.pattern.entries()).map(([key, value]) => [key, Array.from(value)]))
|
|
110
116
|
};
|
|
111
117
|
}
|
|
112
118
|
merge(result) {
|
|
113
119
|
result.css.forEach((item) => this.css.add(item));
|
|
114
120
|
result.cva.forEach((item) => this.cva.add(item));
|
|
121
|
+
result.sva.forEach((item) => this.sva.add(item));
|
|
122
|
+
result.jsx.forEach((item) => this.jsx.add(item));
|
|
115
123
|
result.recipe.forEach((items, name) => {
|
|
116
124
|
this.recipe.get(name) ?? this.recipe.set(name, /* @__PURE__ */ new Set());
|
|
117
125
|
items.forEach((item) => this.recipe.get(name)?.add(item));
|
|
@@ -120,7 +128,6 @@ var ParserResult = class _ParserResult {
|
|
|
120
128
|
this.pattern.get(name) ?? this.pattern.set(name, /* @__PURE__ */ new Set());
|
|
121
129
|
items.forEach((item) => this.pattern.get(name)?.add(item));
|
|
122
130
|
});
|
|
123
|
-
result.jsx.forEach((item) => this.jsx.add(item));
|
|
124
131
|
return this;
|
|
125
132
|
}
|
|
126
133
|
static fromJSON(json) {
|
|
@@ -128,9 +135,10 @@ var ParserResult = class _ParserResult {
|
|
|
128
135
|
const result = new _ParserResult();
|
|
129
136
|
result.css = new Set(data.css);
|
|
130
137
|
result.cva = new Set(data.cva);
|
|
138
|
+
result.sva = new Set(data.sva);
|
|
139
|
+
result.jsx = new Set(data.jsx);
|
|
131
140
|
result.recipe = new Map(Object.entries(data.recipe));
|
|
132
141
|
result.pattern = new Map(Object.entries(data.pattern));
|
|
133
|
-
result.jsx = new Set(data.jsx);
|
|
134
142
|
return result;
|
|
135
143
|
}
|
|
136
144
|
};
|
|
@@ -165,7 +173,7 @@ function createParser(options) {
|
|
|
165
173
|
const { jsx, getRecipesByJsxName, getPatternsByJsxName, tsOptions, join } = options;
|
|
166
174
|
const importMap = Object.fromEntries(Object.entries(options.importMap).map(([key, value]) => [key, join(...value)]));
|
|
167
175
|
const importRegex = [
|
|
168
|
-
createImportMatcher(importMap.css, ["css", "cva"]),
|
|
176
|
+
createImportMatcher(importMap.css, ["css", "cva", "sva"]),
|
|
169
177
|
createImportMatcher(importMap.recipe),
|
|
170
178
|
createImportMatcher(importMap.pattern)
|
|
171
179
|
];
|
|
@@ -258,6 +266,7 @@ function createParser(options) {
|
|
|
258
266
|
);
|
|
259
267
|
const cvaAlias = imports.getAlias("cva");
|
|
260
268
|
const cssAlias = imports.getAlias("css");
|
|
269
|
+
const svaAlias = imports.getAlias("sva");
|
|
261
270
|
if (options.jsx) {
|
|
262
271
|
options.jsx.nodes.forEach((node) => {
|
|
263
272
|
const alias = imports.getAlias(node.jsxName);
|
|
@@ -294,7 +303,7 @@ function createParser(options) {
|
|
|
294
303
|
const matchFn = memo2((fnName) => {
|
|
295
304
|
if (recipes.has(fnName) || patterns.has(fnName))
|
|
296
305
|
return true;
|
|
297
|
-
if (fnName === cvaAlias || fnName === cssAlias || isRawFn(fnName) || isFactory(fnName))
|
|
306
|
+
if (fnName === cvaAlias || fnName === cssAlias || fnName === svaAlias || isRawFn(fnName) || isFactory(fnName))
|
|
298
307
|
return true;
|
|
299
308
|
return functions.has(fnName);
|
|
300
309
|
});
|
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-20230801084843",
|
|
4
4
|
"description": "The static parser for panda css",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
"magic-string": "^0.30.1",
|
|
17
17
|
"ts-morph": "19.0.0",
|
|
18
18
|
"ts-pattern": "5.0.4",
|
|
19
|
-
"@pandacss/config": "^0.0.0-dev-
|
|
20
|
-
"@pandacss/extractor": "0.0.0-dev-
|
|
21
|
-
"@pandacss/is-valid-prop": "0.0.0-dev-
|
|
22
|
-
"@pandacss/logger": "0.0.0-dev-
|
|
23
|
-
"@pandacss/shared": "0.0.0-dev-
|
|
24
|
-
"@pandacss/types": "0.0.0-dev-
|
|
19
|
+
"@pandacss/config": "^0.0.0-dev-20230801084843",
|
|
20
|
+
"@pandacss/extractor": "0.0.0-dev-20230801084843",
|
|
21
|
+
"@pandacss/is-valid-prop": "0.0.0-dev-20230801084843",
|
|
22
|
+
"@pandacss/logger": "0.0.0-dev-20230801084843",
|
|
23
|
+
"@pandacss/shared": "0.0.0-dev-20230801084843",
|
|
24
|
+
"@pandacss/types": "0.0.0-dev-20230801084843"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"hookable": "5.5.3",
|
|
28
|
-
"@pandacss/fixture": "0.0.0-dev-
|
|
29
|
-
"@pandacss/generator": "0.0.0-dev-
|
|
28
|
+
"@pandacss/fixture": "0.0.0-dev-20230801084843",
|
|
29
|
+
"@pandacss/generator": "0.0.0-dev-20230801084843"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
32
|
"dist"
|