@pandacss/parser 0.0.0-dev-20230530140607 → 0.0.0-dev-20230530153916

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
@@ -65,6 +65,7 @@ declare const createProject: ({ getFiles, readFile, parserOptions, ...projectOpt
65
65
  getSourceFile: (filePath: string) => ts_morph.SourceFile | undefined;
66
66
  removeSourceFile: (filePath: string) => void;
67
67
  createSourceFile: (filePath: string) => ts_morph.SourceFile;
68
+ addSourceFile: (filePath: string, content: string) => ts_morph.SourceFile;
68
69
  parseSourceFile: (filePath: string) => ParserResult | undefined;
69
70
  reloadSourceFile: (filePath: string) => ts_morph.FileSystemRefreshResult | undefined;
70
71
  reloadSourceFiles: () => void;
package/dist/index.js CHANGED
@@ -173,19 +173,19 @@ var fallback = (box) => ({
173
173
  });
174
174
  var defaultEnv = { preset: "NONE" };
175
175
  function createParser(options) {
176
+ const { jsx, importMap, getRecipeByName } = options;
177
+ const importRegex = [
178
+ createImportMatcher(importMap.css, ["css", "cva"]),
179
+ createImportMatcher(importMap.recipe),
180
+ createImportMatcher(importMap.pattern)
181
+ ];
182
+ if (jsx) {
183
+ importRegex.push(createImportMatcher(importMap.jsx, [jsx.factory, ...jsx.nodes.map((node) => node.name)]));
184
+ }
176
185
  return function parse(sourceFile) {
177
186
  if (!sourceFile)
178
187
  return;
179
188
  const filePath = sourceFile.getFilePath();
180
- const { jsx, importMap, getRecipeByName } = options;
181
- const importRegex = [
182
- createImportMatcher(importMap.css, ["css", "cva"]),
183
- createImportMatcher(importMap.recipe),
184
- createImportMatcher(importMap.pattern)
185
- ];
186
- if (jsx) {
187
- importRegex.push(createImportMatcher(importMap.jsx, [jsx.factory, ...jsx.nodes.map((node) => node.name)]));
188
- }
189
189
  const imports = getImportDeclarations(sourceFile, {
190
190
  match(value) {
191
191
  return importRegex.some(({ regex, mod }) => regex.test(value.name) && value.mod.includes(mod));
@@ -388,6 +388,10 @@ var createProject = ({ getFiles, readFile, parserOptions, ...projectOptions }) =
388
388
  overwrite: true,
389
389
  scriptKind: import_ts_morph2.ScriptKind.TSX
390
390
  }),
391
+ addSourceFile: (filePath, content) => project.createSourceFile(filePath, content, {
392
+ overwrite: true,
393
+ scriptKind: import_ts_morph2.ScriptKind.TSX
394
+ }),
391
395
  parseSourceFile: (filePath) => {
392
396
  return parser(project.getSourceFile(filePath));
393
397
  }
package/dist/index.mjs CHANGED
@@ -145,19 +145,19 @@ var fallback = (box) => ({
145
145
  });
146
146
  var defaultEnv = { preset: "NONE" };
147
147
  function createParser(options) {
148
+ const { jsx, importMap, getRecipeByName } = options;
149
+ const importRegex = [
150
+ createImportMatcher(importMap.css, ["css", "cva"]),
151
+ createImportMatcher(importMap.recipe),
152
+ createImportMatcher(importMap.pattern)
153
+ ];
154
+ if (jsx) {
155
+ importRegex.push(createImportMatcher(importMap.jsx, [jsx.factory, ...jsx.nodes.map((node) => node.name)]));
156
+ }
148
157
  return function parse(sourceFile) {
149
158
  if (!sourceFile)
150
159
  return;
151
160
  const filePath = sourceFile.getFilePath();
152
- const { jsx, importMap, getRecipeByName } = options;
153
- const importRegex = [
154
- createImportMatcher(importMap.css, ["css", "cva"]),
155
- createImportMatcher(importMap.recipe),
156
- createImportMatcher(importMap.pattern)
157
- ];
158
- if (jsx) {
159
- importRegex.push(createImportMatcher(importMap.jsx, [jsx.factory, ...jsx.nodes.map((node) => node.name)]));
160
- }
161
161
  const imports = getImportDeclarations(sourceFile, {
162
162
  match(value) {
163
163
  return importRegex.some(({ regex, mod }) => regex.test(value.name) && value.mod.includes(mod));
@@ -360,6 +360,10 @@ var createProject = ({ getFiles, readFile, parserOptions, ...projectOptions }) =
360
360
  overwrite: true,
361
361
  scriptKind: ScriptKind.TSX
362
362
  }),
363
+ addSourceFile: (filePath, content) => project.createSourceFile(filePath, content, {
364
+ overwrite: true,
365
+ scriptKind: ScriptKind.TSX
366
+ }),
363
367
  parseSourceFile: (filePath) => {
364
368
  return parser(project.getSourceFile(filePath));
365
369
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/parser",
3
- "version": "0.0.0-dev-20230530140607",
3
+ "version": "0.0.0-dev-20230530153916",
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.3.0",
17
- "@pandacss/extractor": "0.0.0-dev-20230530140607",
18
- "@pandacss/is-valid-prop": "0.0.0-dev-20230530140607",
19
- "@pandacss/logger": "0.0.0-dev-20230530140607",
20
- "@pandacss/shared": "0.0.0-dev-20230530140607",
21
- "@pandacss/types": "0.0.0-dev-20230530140607"
17
+ "@pandacss/extractor": "0.0.0-dev-20230530153916",
18
+ "@pandacss/is-valid-prop": "0.0.0-dev-20230530153916",
19
+ "@pandacss/logger": "0.0.0-dev-20230530153916",
20
+ "@pandacss/types": "0.0.0-dev-20230530153916",
21
+ "@pandacss/shared": "0.0.0-dev-20230530153916"
22
22
  },
23
23
  "devDependencies": {
24
- "@pandacss/fixture": "0.0.0-dev-20230530140607",
25
- "@pandacss/generator": "0.0.0-dev-20230530140607"
24
+ "@pandacss/fixture": "0.0.0-dev-20230530153916",
25
+ "@pandacss/generator": "0.0.0-dev-20230530153916"
26
26
  },
27
27
  "files": [
28
28
  "dist"