@pandacss/parser 0.0.0-dev-20230625194802 → 0.0.0-dev-20230626085107
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 +78 -0
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +9 -9
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import * as ts_morph from 'ts-morph';
|
|
2
|
+
import { ProjectOptions as ProjectOptions$1 } from 'ts-morph';
|
|
3
|
+
import { ResultItem, RecipeConfig, PandaHookable } from '@pandacss/types';
|
|
4
|
+
|
|
5
|
+
declare class ParserResult {
|
|
6
|
+
jsx: Set<ResultItem>;
|
|
7
|
+
css: Set<ResultItem>;
|
|
8
|
+
cva: Set<ResultItem>;
|
|
9
|
+
recipe: Map<string, Set<ResultItem>>;
|
|
10
|
+
pattern: Map<string, Set<ResultItem>>;
|
|
11
|
+
filePath: string | undefined;
|
|
12
|
+
set(name: 'cva' | 'css', result: ResultItem): void;
|
|
13
|
+
setCva(result: ResultItem): void;
|
|
14
|
+
setJsx(result: ResultItem): void;
|
|
15
|
+
setPattern(name: string, result: ResultItem): void;
|
|
16
|
+
setRecipe(name: string, result: ResultItem): void;
|
|
17
|
+
isEmpty(): boolean;
|
|
18
|
+
setFilePath(filePath: string): this;
|
|
19
|
+
toArray(): ResultItem[];
|
|
20
|
+
toJSON(): {
|
|
21
|
+
css: ResultItem[];
|
|
22
|
+
cva: ResultItem[];
|
|
23
|
+
recipe: {
|
|
24
|
+
[k: string]: ResultItem[];
|
|
25
|
+
};
|
|
26
|
+
pattern: {
|
|
27
|
+
[k: string]: ResultItem[];
|
|
28
|
+
};
|
|
29
|
+
jsx: ResultItem[];
|
|
30
|
+
};
|
|
31
|
+
merge(result: ParserResult): this;
|
|
32
|
+
static fromJSON(json: string): ParserResult;
|
|
33
|
+
}
|
|
34
|
+
declare const createParserResult: () => ParserResult;
|
|
35
|
+
|
|
36
|
+
type ParserPatternNode = {
|
|
37
|
+
name: string;
|
|
38
|
+
type: 'pattern';
|
|
39
|
+
props?: string[];
|
|
40
|
+
baseName: string;
|
|
41
|
+
};
|
|
42
|
+
type ParserRecipeNode = {
|
|
43
|
+
name: string;
|
|
44
|
+
type: 'recipe';
|
|
45
|
+
props: string[];
|
|
46
|
+
baseName: string;
|
|
47
|
+
jsx: RecipeConfig['jsx'];
|
|
48
|
+
};
|
|
49
|
+
type ParserNodeOptions = ParserPatternNode | ParserRecipeNode;
|
|
50
|
+
type ParserOptions = {
|
|
51
|
+
importMap: Record<'css' | 'recipe' | 'pattern' | 'jsx', string>;
|
|
52
|
+
jsx?: {
|
|
53
|
+
factory: string;
|
|
54
|
+
nodes: ParserNodeOptions[];
|
|
55
|
+
isStyleProp: (prop: string) => boolean;
|
|
56
|
+
};
|
|
57
|
+
getRecipeName: (tagName: string) => string;
|
|
58
|
+
getRecipeByName: (name: string) => RecipeConfig | undefined;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
type ProjectOptions = Partial<ProjectOptions$1> & {
|
|
62
|
+
readFile: (filePath: string) => string;
|
|
63
|
+
getFiles: () => string[];
|
|
64
|
+
hooks: PandaHookable;
|
|
65
|
+
parserOptions: ParserOptions;
|
|
66
|
+
};
|
|
67
|
+
declare const createProject: ({ getFiles, readFile, parserOptions, hooks, ...projectOptions }: ProjectOptions) => {
|
|
68
|
+
getSourceFile: (filePath: string) => ts_morph.SourceFile | undefined;
|
|
69
|
+
removeSourceFile: (filePath: string) => void;
|
|
70
|
+
createSourceFile: (filePath: string) => ts_morph.SourceFile;
|
|
71
|
+
addSourceFile: (filePath: string, content: string) => ts_morph.SourceFile;
|
|
72
|
+
parseSourceFile: (filePath: string) => ParserResult | undefined;
|
|
73
|
+
reloadSourceFile: (filePath: string) => ts_morph.FileSystemRefreshResult | undefined;
|
|
74
|
+
reloadSourceFiles: () => void;
|
|
75
|
+
};
|
|
76
|
+
type Project = ReturnType<typeof createProject>;
|
|
77
|
+
|
|
78
|
+
export { ParserResult, Project, ProjectOptions, createParserResult, createProject };
|
package/dist/index.js
CHANGED
|
@@ -97,7 +97,7 @@ function getImportDeclarations(file, options) {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
// src/parser-result.ts
|
|
100
|
-
var ParserResult = class {
|
|
100
|
+
var ParserResult = class _ParserResult {
|
|
101
101
|
jsx = /* @__PURE__ */ new Set();
|
|
102
102
|
css = /* @__PURE__ */ new Set();
|
|
103
103
|
cva = /* @__PURE__ */ new Set();
|
|
@@ -162,7 +162,7 @@ var ParserResult = class {
|
|
|
162
162
|
}
|
|
163
163
|
static fromJSON(json) {
|
|
164
164
|
const data = JSON.parse(json);
|
|
165
|
-
const result = new
|
|
165
|
+
const result = new _ParserResult();
|
|
166
166
|
result.css = new Set(data.css);
|
|
167
167
|
result.cva = new Set(data.cva);
|
|
168
168
|
result.recipe = new Map(Object.entries(data.recipe));
|
package/dist/index.mjs
CHANGED
|
@@ -59,7 +59,7 @@ function getImportDeclarations(file, options) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
// src/parser-result.ts
|
|
62
|
-
var ParserResult = class {
|
|
62
|
+
var ParserResult = class _ParserResult {
|
|
63
63
|
jsx = /* @__PURE__ */ new Set();
|
|
64
64
|
css = /* @__PURE__ */ new Set();
|
|
65
65
|
cva = /* @__PURE__ */ new Set();
|
|
@@ -124,7 +124,7 @@ var ParserResult = class {
|
|
|
124
124
|
}
|
|
125
125
|
static fromJSON(json) {
|
|
126
126
|
const data = JSON.parse(json);
|
|
127
|
-
const result = new
|
|
127
|
+
const result = new _ParserResult();
|
|
128
128
|
result.css = new Set(data.css);
|
|
129
129
|
result.cva = new Set(data.cva);
|
|
130
130
|
result.recipe = new Map(Object.entries(data.recipe));
|
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-20230626085107",
|
|
4
4
|
"description": "The static parser for panda css",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -14,19 +14,19 @@
|
|
|
14
14
|
"@vue/compiler-sfc": "^3.3.4",
|
|
15
15
|
"lil-fp": "1.4.5",
|
|
16
16
|
"magic-string": "^0.30.0",
|
|
17
|
-
"svelte": "^
|
|
17
|
+
"svelte": "^4.0.0",
|
|
18
18
|
"ts-morph": "18.0.0",
|
|
19
19
|
"ts-pattern": "4.3.0",
|
|
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-
|
|
20
|
+
"@pandacss/extractor": "0.0.0-dev-20230626085107",
|
|
21
|
+
"@pandacss/is-valid-prop": "0.0.0-dev-20230626085107",
|
|
22
|
+
"@pandacss/logger": "0.0.0-dev-20230626085107",
|
|
23
|
+
"@pandacss/shared": "0.0.0-dev-20230626085107",
|
|
24
|
+
"@pandacss/types": "0.0.0-dev-20230626085107"
|
|
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-20230626085107",
|
|
29
|
+
"@pandacss/generator": "0.0.0-dev-20230626085107"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
32
|
"dist"
|