@pandacss/parser 0.0.0-dev-20230205182145 → 0.0.0-dev-20230206084557

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 CHANGED
@@ -1,28 +1,7 @@
1
+ import * as _pandacss_types from '@pandacss/types';
1
2
  import * as ts_morph from 'ts-morph';
2
3
  import { ProjectOptions as ProjectOptions$1 } from 'ts-morph';
3
4
 
4
- type Result = {
5
- name?: string;
6
- data: Record<string, any>;
7
- type?: string;
8
- };
9
- type PartialResult = {
10
- data: Record<string, any>;
11
- };
12
- declare const createParserResult: () => {
13
- jsx: Set<Result>;
14
- css: Set<Result>;
15
- cva: Set<Result>;
16
- recipe: Map<string, Set<Result>>;
17
- pattern: Map<string, Set<Result>>;
18
- set(name: 'cva' | 'css', result: PartialResult): void;
19
- setCva(result: PartialResult): void;
20
- setPattern(name: string, result: PartialResult): void;
21
- setRecipe(name: string, result: PartialResult): void;
22
- isEmpty(): boolean;
23
- };
24
- type ParserResult = ReturnType<typeof createParserResult>;
25
-
26
5
  type ParserNodeOptions = {
27
6
  name: string;
28
7
  type: 'pattern' | 'recipe';
@@ -46,49 +25,10 @@ declare const createProject: ({ getFiles, readFile, parserOptions, ...projectOpt
46
25
  getSourceFile: (filePath: string) => ts_morph.SourceFile | undefined;
47
26
  removeSourceFile: (filePath: string) => void;
48
27
  createSourceFile: (filePath: string) => ts_morph.SourceFile;
49
- parseSourceFile: (filePath: string) => {
50
- jsx: Set<{
51
- name?: string | undefined;
52
- data: Record<string, any>;
53
- type?: string | undefined;
54
- }>;
55
- css: Set<{
56
- name?: string | undefined;
57
- data: Record<string, any>;
58
- type?: string | undefined;
59
- }>;
60
- cva: Set<{
61
- name?: string | undefined;
62
- data: Record<string, any>;
63
- type?: string | undefined;
64
- }>;
65
- recipe: Map<string, Set<{
66
- name?: string | undefined;
67
- data: Record<string, any>;
68
- type?: string | undefined;
69
- }>>;
70
- pattern: Map<string, Set<{
71
- name?: string | undefined;
72
- data: Record<string, any>;
73
- type?: string | undefined;
74
- }>>;
75
- set(name: "cva" | "css", result: {
76
- data: Record<string, any>;
77
- }): void;
78
- setCva(result: {
79
- data: Record<string, any>;
80
- }): void;
81
- setPattern(name: string, result: {
82
- data: Record<string, any>;
83
- }): void;
84
- setRecipe(name: string, result: {
85
- data: Record<string, any>;
86
- }): void;
87
- isEmpty(): boolean;
88
- } | undefined;
28
+ parseSourceFile: (filePath: string) => _pandacss_types.ParserResult | undefined;
89
29
  reloadSourceFile: (filePath: string) => ts_morph.FileSystemRefreshResult | undefined;
90
30
  reloadSourceFiles: () => void;
91
31
  };
92
32
  type Project = ReturnType<typeof createProject>;
93
33
 
94
- export { ParserResult, Project, ProjectOptions, createProject };
34
+ export { Project, ProjectOptions, createProject };
package/dist/index.js CHANGED
@@ -264,7 +264,7 @@ function createParser(options) {
264
264
  return function parse(sourceFile) {
265
265
  if (!sourceFile)
266
266
  return;
267
- const fileName = sourceFile.getFilePath();
267
+ const filePath = sourceFile.getFilePath();
268
268
  const collector = createParserResult();
269
269
  const { jsx, importMap } = options;
270
270
  const importRegex = [
@@ -281,7 +281,7 @@ function createParser(options) {
281
281
  }
282
282
  });
283
283
  if (imports.value.length) {
284
- import_logger.logger.debug("ast:import", `Found import { ${imports} } in ${fileName}`);
284
+ import_logger.logger.debug("ast:import", `Found import { ${imports} } in ${filePath}`);
285
285
  }
286
286
  const isValidPattern = imports.createMatch(importMap.pattern);
287
287
  const isValidRecipe = imports.createMatch(importMap.recipe);
@@ -292,7 +292,7 @@ function createParser(options) {
292
292
  const name = imports.getName(_name);
293
293
  const [css] = importRegex;
294
294
  const result = { name, data };
295
- import_logger.logger.debug(`ast:${name}`, { fileName, result });
295
+ import_logger.logger.debug(`ast:${name}`, { filePath, result });
296
296
  (0, import_ts_pattern3.match)(name).when(css.match, (name2) => {
297
297
  collector.set(name2, result);
298
298
  }).when(isValidPattern, (name2) => {
@@ -320,7 +320,7 @@ function createParser(options) {
320
320
  },
321
321
  fn({ name, data }) {
322
322
  let type;
323
- import_logger.logger.debug(`ast:jsx:${name}`, { fileName, result: data });
323
+ import_logger.logger.debug(`ast:jsx:${name}`, { filePath, result: data });
324
324
  if (jsx && name.startsWith(jsxFactoryAlias)) {
325
325
  type = "jsx-factory";
326
326
  } else if (jsxPatternNodes.test(name)) {
package/dist/index.mjs CHANGED
@@ -240,7 +240,7 @@ function createParser(options) {
240
240
  return function parse(sourceFile) {
241
241
  if (!sourceFile)
242
242
  return;
243
- const fileName = sourceFile.getFilePath();
243
+ const filePath = sourceFile.getFilePath();
244
244
  const collector = createParserResult();
245
245
  const { jsx, importMap } = options;
246
246
  const importRegex = [
@@ -257,7 +257,7 @@ function createParser(options) {
257
257
  }
258
258
  });
259
259
  if (imports.value.length) {
260
- logger.debug("ast:import", `Found import { ${imports} } in ${fileName}`);
260
+ logger.debug("ast:import", `Found import { ${imports} } in ${filePath}`);
261
261
  }
262
262
  const isValidPattern = imports.createMatch(importMap.pattern);
263
263
  const isValidRecipe = imports.createMatch(importMap.recipe);
@@ -268,7 +268,7 @@ function createParser(options) {
268
268
  const name = imports.getName(_name);
269
269
  const [css] = importRegex;
270
270
  const result = { name, data };
271
- logger.debug(`ast:${name}`, { fileName, result });
271
+ logger.debug(`ast:${name}`, { filePath, result });
272
272
  match3(name).when(css.match, (name2) => {
273
273
  collector.set(name2, result);
274
274
  }).when(isValidPattern, (name2) => {
@@ -296,7 +296,7 @@ function createParser(options) {
296
296
  },
297
297
  fn({ name, data }) {
298
298
  let type;
299
- logger.debug(`ast:jsx:${name}`, { fileName, result: data });
299
+ logger.debug(`ast:jsx:${name}`, { filePath, result: data });
300
300
  if (jsx && name.startsWith(jsxFactoryAlias)) {
301
301
  type = "jsx-factory";
302
302
  } else if (jsxPatternNodes.test(name)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/parser",
3
- "version": "0.0.0-dev-20230205182145",
3
+ "version": "0.0.0-dev-20230206084557",
4
4
  "description": "The static parser for panda css",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -11,16 +11,16 @@
11
11
  "access": "public"
12
12
  },
13
13
  "dependencies": {
14
- "lil-fp": "1.2.1",
14
+ "lil-fp": "1.2.3",
15
15
  "ts-morph": "17.0.1",
16
16
  "ts-pattern": "4.1.3",
17
- "@pandacss/is-valid-prop": "0.0.0-dev-20230205182145",
18
- "@pandacss/logger": "0.0.0-dev-20230205182145",
19
- "@pandacss/shared": "0.0.0-dev-20230205182145",
20
- "@pandacss/types": "0.0.0-dev-20230205182145"
17
+ "@pandacss/is-valid-prop": "0.0.0-dev-20230206084557",
18
+ "@pandacss/logger": "0.0.0-dev-20230206084557",
19
+ "@pandacss/shared": "0.0.0-dev-20230206084557",
20
+ "@pandacss/types": "0.0.0-dev-20230206084557"
21
21
  },
22
22
  "devDependencies": {
23
- "@pandacss/fixture": "0.0.0-dev-20230205182145"
23
+ "@pandacss/fixture": "0.0.0-dev-20230206084557"
24
24
  },
25
25
  "files": [
26
26
  "dist"