@pandacss/parser 0.0.0-dev-20230418111125 → 0.0.0-dev-20230418123438
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 +12 -15
- package/dist/index.mjs +12 -15
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ declare const createProject: ({ getFiles, readFile, parserOptions, ...projectOpt
|
|
|
37
37
|
getSourceFile: (filePath: string) => ts_morph.SourceFile | undefined;
|
|
38
38
|
removeSourceFile: (filePath: string) => void;
|
|
39
39
|
createSourceFile: (filePath: string) => ts_morph.SourceFile;
|
|
40
|
-
parseSourceFile: (filePath: string
|
|
40
|
+
parseSourceFile: (filePath: string) => _pandacss_types.ParserResult | undefined;
|
|
41
41
|
reloadSourceFile: (filePath: string) => ts_morph.FileSystemRefreshResult | undefined;
|
|
42
42
|
reloadSourceFiles: () => void;
|
|
43
43
|
};
|
package/dist/index.js
CHANGED
|
@@ -132,7 +132,7 @@ var combineResult = (unboxed) => {
|
|
|
132
132
|
};
|
|
133
133
|
var defaultEnv = { preset: "NONE" };
|
|
134
134
|
function createParser(options) {
|
|
135
|
-
return function parse(sourceFile
|
|
135
|
+
return function parse(sourceFile) {
|
|
136
136
|
if (!sourceFile)
|
|
137
137
|
return;
|
|
138
138
|
const filePath = sourceFile.getFilePath();
|
|
@@ -175,7 +175,7 @@ function createParser(options) {
|
|
|
175
175
|
});
|
|
176
176
|
const functions = /* @__PURE__ */ new Map();
|
|
177
177
|
const components = /* @__PURE__ */ new Map();
|
|
178
|
-
const propertiesMap = new Map(
|
|
178
|
+
const propertiesMap = /* @__PURE__ */ new Map();
|
|
179
179
|
const recipePropertiesByName = /* @__PURE__ */ new Map();
|
|
180
180
|
const recipeJsxLists = (jsx?.nodes ?? []).filter(isNodeRecipe).reduce(
|
|
181
181
|
(acc, recipe) => {
|
|
@@ -195,12 +195,11 @@ function createParser(options) {
|
|
|
195
195
|
const cssAlias = imports.getAlias("css");
|
|
196
196
|
if (options.jsx) {
|
|
197
197
|
options.jsx.nodes.forEach((node) => {
|
|
198
|
-
const properties = node.props ? new Map(propertiesMap) : propertiesMap;
|
|
199
198
|
const alias = imports.getAlias(node.name);
|
|
200
|
-
node.props?.forEach((prop) =>
|
|
201
|
-
functions.set(node.baseName,
|
|
202
|
-
functions.set(alias,
|
|
203
|
-
components.set(alias,
|
|
199
|
+
node.props?.forEach((prop) => propertiesMap.set(prop, true));
|
|
200
|
+
functions.set(node.baseName, propertiesMap);
|
|
201
|
+
functions.set(alias, propertiesMap);
|
|
202
|
+
components.set(alias, propertiesMap);
|
|
204
203
|
});
|
|
205
204
|
}
|
|
206
205
|
const getRecipeName = (0, import_shared2.memo)(options.getRecipeName);
|
|
@@ -215,13 +214,11 @@ function createParser(options) {
|
|
|
215
214
|
const matchTagProp = (0, import_shared2.memo)((tagName, propName) => {
|
|
216
215
|
if (propertiesMap.size === 0)
|
|
217
216
|
return true;
|
|
218
|
-
if (Boolean(components.get(tagName)?.
|
|
217
|
+
if (Boolean(components.get(tagName)?.has(propName)) || options.jsx?.isStyleProp(propName) || propertiesMap.has(propName))
|
|
219
218
|
return true;
|
|
220
219
|
if (isJsxTagRecipe(tagName)) {
|
|
221
220
|
const recipe = getRecipeByName(getRecipeName(tagName));
|
|
222
|
-
|
|
223
|
-
return recipePropertiesByName.get(recipe.name)?.has(propName) ?? false;
|
|
224
|
-
}
|
|
221
|
+
return recipe != null && !!recipePropertiesByName.get(recipe.name)?.has(propName);
|
|
225
222
|
}
|
|
226
223
|
return false;
|
|
227
224
|
});
|
|
@@ -230,7 +227,7 @@ function createParser(options) {
|
|
|
230
227
|
return true;
|
|
231
228
|
if (fnName === cvaAlias || fnName === cssAlias || fnName.startsWith(jsxFactoryAlias))
|
|
232
229
|
return true;
|
|
233
|
-
return
|
|
230
|
+
return functions.has(fnName);
|
|
234
231
|
});
|
|
235
232
|
const measure = import_logger.logger.time.debug(`Tokens extracted from ${filePath}`);
|
|
236
233
|
const extractResultByName = (0, import_extractor.extract)({
|
|
@@ -318,7 +315,7 @@ function createParser(options) {
|
|
|
318
315
|
return collector;
|
|
319
316
|
};
|
|
320
317
|
}
|
|
321
|
-
var isUpperCase = (value) => value[0] === value[0]
|
|
318
|
+
var isUpperCase = (value) => value[0] === value[0]?.toUpperCase();
|
|
322
319
|
|
|
323
320
|
// src/project.ts
|
|
324
321
|
var createTsProject = (options) => new import_ts_morph2.Project({
|
|
@@ -349,8 +346,8 @@ var createProject = ({ getFiles, readFile, parserOptions, ...projectOptions }) =
|
|
|
349
346
|
overwrite: true,
|
|
350
347
|
scriptKind: import_ts_morph2.ScriptKind.TSX
|
|
351
348
|
}),
|
|
352
|
-
parseSourceFile: (filePath
|
|
353
|
-
return parser(project.getSourceFile(filePath)
|
|
349
|
+
parseSourceFile: (filePath) => {
|
|
350
|
+
return parser(project.getSourceFile(filePath));
|
|
354
351
|
}
|
|
355
352
|
})),
|
|
356
353
|
(0, import_lil_fp.tap)(({ createSourceFile }) => {
|
package/dist/index.mjs
CHANGED
|
@@ -106,7 +106,7 @@ var combineResult = (unboxed) => {
|
|
|
106
106
|
};
|
|
107
107
|
var defaultEnv = { preset: "NONE" };
|
|
108
108
|
function createParser(options) {
|
|
109
|
-
return function parse(sourceFile
|
|
109
|
+
return function parse(sourceFile) {
|
|
110
110
|
if (!sourceFile)
|
|
111
111
|
return;
|
|
112
112
|
const filePath = sourceFile.getFilePath();
|
|
@@ -149,7 +149,7 @@ function createParser(options) {
|
|
|
149
149
|
});
|
|
150
150
|
const functions = /* @__PURE__ */ new Map();
|
|
151
151
|
const components = /* @__PURE__ */ new Map();
|
|
152
|
-
const propertiesMap = new Map(
|
|
152
|
+
const propertiesMap = /* @__PURE__ */ new Map();
|
|
153
153
|
const recipePropertiesByName = /* @__PURE__ */ new Map();
|
|
154
154
|
const recipeJsxLists = (jsx?.nodes ?? []).filter(isNodeRecipe).reduce(
|
|
155
155
|
(acc, recipe) => {
|
|
@@ -169,12 +169,11 @@ function createParser(options) {
|
|
|
169
169
|
const cssAlias = imports.getAlias("css");
|
|
170
170
|
if (options.jsx) {
|
|
171
171
|
options.jsx.nodes.forEach((node) => {
|
|
172
|
-
const properties = node.props ? new Map(propertiesMap) : propertiesMap;
|
|
173
172
|
const alias = imports.getAlias(node.name);
|
|
174
|
-
node.props?.forEach((prop) =>
|
|
175
|
-
functions.set(node.baseName,
|
|
176
|
-
functions.set(alias,
|
|
177
|
-
components.set(alias,
|
|
173
|
+
node.props?.forEach((prop) => propertiesMap.set(prop, true));
|
|
174
|
+
functions.set(node.baseName, propertiesMap);
|
|
175
|
+
functions.set(alias, propertiesMap);
|
|
176
|
+
components.set(alias, propertiesMap);
|
|
178
177
|
});
|
|
179
178
|
}
|
|
180
179
|
const getRecipeName = memo2(options.getRecipeName);
|
|
@@ -189,13 +188,11 @@ function createParser(options) {
|
|
|
189
188
|
const matchTagProp = memo2((tagName, propName) => {
|
|
190
189
|
if (propertiesMap.size === 0)
|
|
191
190
|
return true;
|
|
192
|
-
if (Boolean(components.get(tagName)?.
|
|
191
|
+
if (Boolean(components.get(tagName)?.has(propName)) || options.jsx?.isStyleProp(propName) || propertiesMap.has(propName))
|
|
193
192
|
return true;
|
|
194
193
|
if (isJsxTagRecipe(tagName)) {
|
|
195
194
|
const recipe = getRecipeByName(getRecipeName(tagName));
|
|
196
|
-
|
|
197
|
-
return recipePropertiesByName.get(recipe.name)?.has(propName) ?? false;
|
|
198
|
-
}
|
|
195
|
+
return recipe != null && !!recipePropertiesByName.get(recipe.name)?.has(propName);
|
|
199
196
|
}
|
|
200
197
|
return false;
|
|
201
198
|
});
|
|
@@ -204,7 +201,7 @@ function createParser(options) {
|
|
|
204
201
|
return true;
|
|
205
202
|
if (fnName === cvaAlias || fnName === cssAlias || fnName.startsWith(jsxFactoryAlias))
|
|
206
203
|
return true;
|
|
207
|
-
return
|
|
204
|
+
return functions.has(fnName);
|
|
208
205
|
});
|
|
209
206
|
const measure = logger.time.debug(`Tokens extracted from ${filePath}`);
|
|
210
207
|
const extractResultByName = extract({
|
|
@@ -292,7 +289,7 @@ function createParser(options) {
|
|
|
292
289
|
return collector;
|
|
293
290
|
};
|
|
294
291
|
}
|
|
295
|
-
var isUpperCase = (value) => value[0] === value[0]
|
|
292
|
+
var isUpperCase = (value) => value[0] === value[0]?.toUpperCase();
|
|
296
293
|
|
|
297
294
|
// src/project.ts
|
|
298
295
|
var createTsProject = (options) => new TsProject({
|
|
@@ -323,8 +320,8 @@ var createProject = ({ getFiles, readFile, parserOptions, ...projectOptions }) =
|
|
|
323
320
|
overwrite: true,
|
|
324
321
|
scriptKind: ScriptKind.TSX
|
|
325
322
|
}),
|
|
326
|
-
parseSourceFile: (filePath
|
|
327
|
-
return parser(project.getSourceFile(filePath)
|
|
323
|
+
parseSourceFile: (filePath) => {
|
|
324
|
+
return parser(project.getSourceFile(filePath));
|
|
328
325
|
}
|
|
329
326
|
})),
|
|
330
327
|
tap(({ createSourceFile }) => {
|
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-20230418123438",
|
|
4
4
|
"description": "The static parser for panda css",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
"lil-fp": "1.4.5",
|
|
15
15
|
"ts-morph": "18.0.0",
|
|
16
16
|
"ts-pattern": "4.2.2",
|
|
17
|
-
"@pandacss/extractor": "0.0.0-dev-
|
|
18
|
-
"@pandacss/is-valid-prop": "0.0.0-dev-
|
|
19
|
-
"@pandacss/logger": "0.0.0-dev-
|
|
20
|
-
"@pandacss/shared": "0.0.0-dev-
|
|
21
|
-
"@pandacss/types": "0.0.0-dev-
|
|
17
|
+
"@pandacss/extractor": "0.0.0-dev-20230418123438",
|
|
18
|
+
"@pandacss/is-valid-prop": "0.0.0-dev-20230418123438",
|
|
19
|
+
"@pandacss/logger": "0.0.0-dev-20230418123438",
|
|
20
|
+
"@pandacss/shared": "0.0.0-dev-20230418123438",
|
|
21
|
+
"@pandacss/types": "0.0.0-dev-20230418123438"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@pandacss/fixture": "0.0.0-dev-
|
|
25
|
-
"@pandacss/generator": "0.0.0-dev-
|
|
24
|
+
"@pandacss/fixture": "0.0.0-dev-20230418123438",
|
|
25
|
+
"@pandacss/generator": "0.0.0-dev-20230418123438"
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
28
|
"dist"
|