@pandacss/parser 0.23.0 → 0.24.1
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 +31 -41
- package/dist/index.d.ts +31 -41
- package/dist/index.js +250 -200
- package/dist/index.mjs +243 -189
- package/package.json +16 -11
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { ParserOptions, Generator } from '@pandacss/generator';
|
|
2
|
+
import { ParserResultInterface, ResultItem, Runtime, PandaHookable, ConfigTsOptions } from '@pandacss/types';
|
|
3
|
+
import { SourceFile, ProjectOptions as ProjectOptions$1, Project as Project$1, FileSystemRefreshResult } from 'ts-morph';
|
|
4
4
|
|
|
5
|
-
declare class ParserResult {
|
|
5
|
+
declare class ParserResult implements ParserResultInterface {
|
|
6
|
+
private context;
|
|
7
|
+
/** Ordered list of all ResultItem */
|
|
8
|
+
all: ResultItem[];
|
|
6
9
|
jsx: Set<ResultItem>;
|
|
7
10
|
css: Set<ResultItem>;
|
|
8
11
|
cva: Set<ResultItem>;
|
|
@@ -10,14 +13,18 @@ declare class ParserResult {
|
|
|
10
13
|
recipe: Map<string, Set<ResultItem>>;
|
|
11
14
|
pattern: Map<string, Set<ResultItem>>;
|
|
12
15
|
filePath: string | undefined;
|
|
16
|
+
encoder: ParserOptions['encoder'];
|
|
17
|
+
constructor(context: ParserOptions, encoder?: ParserOptions['encoder']);
|
|
18
|
+
append(result: ResultItem): ResultItem;
|
|
13
19
|
set(name: 'cva' | 'css' | 'sva', result: ResultItem): void;
|
|
14
20
|
setCva(result: ResultItem): void;
|
|
15
21
|
setSva(result: ResultItem): void;
|
|
16
22
|
setJsx(result: ResultItem): void;
|
|
17
23
|
setPattern(name: string, result: ResultItem): void;
|
|
18
|
-
setRecipe(
|
|
24
|
+
setRecipe(recipeName: string, result: ResultItem): void;
|
|
19
25
|
isEmpty(): boolean;
|
|
20
26
|
setFilePath(filePath: string): this;
|
|
27
|
+
merge(result: ParserResult): this;
|
|
21
28
|
toArray(): ResultItem[];
|
|
22
29
|
toJSON(): {
|
|
23
30
|
css: ResultItem[];
|
|
@@ -31,52 +38,35 @@ declare class ParserResult {
|
|
|
31
38
|
[k: string]: ResultItem[];
|
|
32
39
|
};
|
|
33
40
|
};
|
|
34
|
-
merge(result: ParserResult): this;
|
|
35
|
-
static fromJSON(json: string): ParserResult;
|
|
36
41
|
}
|
|
37
|
-
declare const createParserResult: () => ParserResult;
|
|
38
42
|
|
|
39
|
-
|
|
40
|
-
type ParserRecipeNode = Generator['recipes']['details'][number];
|
|
41
|
-
type ParserNodeOptions = ParserPatternNode | ParserRecipeNode;
|
|
42
|
-
interface ParserOptions {
|
|
43
|
-
importMap: Record<'css' | 'recipe' | 'pattern' | 'jsx', string[]>;
|
|
44
|
-
jsx: {
|
|
45
|
-
framework: string | undefined;
|
|
46
|
-
factory: string;
|
|
47
|
-
styleProps: Exclude<Config['jsxStyleProps'], undefined>;
|
|
48
|
-
nodes: ParserNodeOptions[];
|
|
49
|
-
isStyleProp: (prop: string) => boolean;
|
|
50
|
-
};
|
|
51
|
-
isTemplateLiteralSyntax: boolean;
|
|
52
|
-
patternKeys: string[];
|
|
53
|
-
recipeKeys: string[];
|
|
54
|
-
getRecipesByJsxName: (jsxName: string) => ParserRecipeNode[];
|
|
55
|
-
getPatternsByJsxName: (jsxName: string) => ParserPatternNode[];
|
|
56
|
-
tsOptions?: ConfigTsOptions;
|
|
57
|
-
join: Runtime['path']['join'];
|
|
58
|
-
}
|
|
43
|
+
declare function createParser(context: ParserOptions): (sourceFile: SourceFile | undefined, encoder?: Generator['encoder']) => ParserResult | undefined;
|
|
59
44
|
|
|
60
|
-
|
|
45
|
+
interface ProjectOptions extends ProjectOptions$1 {
|
|
61
46
|
readFile: Runtime['fs']['readFileSync'];
|
|
62
|
-
getFiles
|
|
47
|
+
getFiles(): string[];
|
|
63
48
|
hooks: PandaHookable;
|
|
64
49
|
parserOptions: ParserOptions;
|
|
65
50
|
tsOptions?: ConfigTsOptions;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
51
|
+
}
|
|
52
|
+
declare class Project {
|
|
53
|
+
private options;
|
|
54
|
+
project: Project$1;
|
|
55
|
+
parser: ReturnType<typeof createParser>;
|
|
56
|
+
constructor(options: ProjectOptions);
|
|
57
|
+
get files(): string[];
|
|
70
58
|
getSourceFile: (filePath: string) => SourceFile | undefined;
|
|
71
|
-
removeSourceFile: (filePath: string) => void;
|
|
72
59
|
createSourceFile: (filePath: string) => SourceFile;
|
|
60
|
+
createSourceFiles: () => void;
|
|
73
61
|
addSourceFile: (filePath: string, content: string) => SourceFile;
|
|
74
|
-
|
|
75
|
-
reloadSourceFile: (filePath: string) =>
|
|
62
|
+
removeSourceFile: (filePath: string) => boolean;
|
|
63
|
+
reloadSourceFile: (filePath: string) => FileSystemRefreshResult | undefined;
|
|
76
64
|
reloadSourceFiles: () => void;
|
|
77
|
-
|
|
78
|
-
getFiles: () => string[];
|
|
79
|
-
|
|
65
|
+
get readFile(): (filePath: string) => string;
|
|
66
|
+
get getFiles(): () => string[];
|
|
67
|
+
parseJson: (filePath: string) => ParserResult;
|
|
68
|
+
parseSourceFile: (filePath: string, encoder?: ParserOptions['encoder']) => ParserResult | undefined;
|
|
69
|
+
transformFile: (filePath: string, content: string) => string;
|
|
80
70
|
}
|
|
81
71
|
|
|
82
|
-
export {
|
|
72
|
+
export { ParserResult, Project, type ProjectOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { ParserOptions, Generator } from '@pandacss/generator';
|
|
2
|
+
import { ParserResultInterface, ResultItem, Runtime, PandaHookable, ConfigTsOptions } from '@pandacss/types';
|
|
3
|
+
import { SourceFile, ProjectOptions as ProjectOptions$1, Project as Project$1, FileSystemRefreshResult } from 'ts-morph';
|
|
4
4
|
|
|
5
|
-
declare class ParserResult {
|
|
5
|
+
declare class ParserResult implements ParserResultInterface {
|
|
6
|
+
private context;
|
|
7
|
+
/** Ordered list of all ResultItem */
|
|
8
|
+
all: ResultItem[];
|
|
6
9
|
jsx: Set<ResultItem>;
|
|
7
10
|
css: Set<ResultItem>;
|
|
8
11
|
cva: Set<ResultItem>;
|
|
@@ -10,14 +13,18 @@ declare class ParserResult {
|
|
|
10
13
|
recipe: Map<string, Set<ResultItem>>;
|
|
11
14
|
pattern: Map<string, Set<ResultItem>>;
|
|
12
15
|
filePath: string | undefined;
|
|
16
|
+
encoder: ParserOptions['encoder'];
|
|
17
|
+
constructor(context: ParserOptions, encoder?: ParserOptions['encoder']);
|
|
18
|
+
append(result: ResultItem): ResultItem;
|
|
13
19
|
set(name: 'cva' | 'css' | 'sva', result: ResultItem): void;
|
|
14
20
|
setCva(result: ResultItem): void;
|
|
15
21
|
setSva(result: ResultItem): void;
|
|
16
22
|
setJsx(result: ResultItem): void;
|
|
17
23
|
setPattern(name: string, result: ResultItem): void;
|
|
18
|
-
setRecipe(
|
|
24
|
+
setRecipe(recipeName: string, result: ResultItem): void;
|
|
19
25
|
isEmpty(): boolean;
|
|
20
26
|
setFilePath(filePath: string): this;
|
|
27
|
+
merge(result: ParserResult): this;
|
|
21
28
|
toArray(): ResultItem[];
|
|
22
29
|
toJSON(): {
|
|
23
30
|
css: ResultItem[];
|
|
@@ -31,52 +38,35 @@ declare class ParserResult {
|
|
|
31
38
|
[k: string]: ResultItem[];
|
|
32
39
|
};
|
|
33
40
|
};
|
|
34
|
-
merge(result: ParserResult): this;
|
|
35
|
-
static fromJSON(json: string): ParserResult;
|
|
36
41
|
}
|
|
37
|
-
declare const createParserResult: () => ParserResult;
|
|
38
42
|
|
|
39
|
-
|
|
40
|
-
type ParserRecipeNode = Generator['recipes']['details'][number];
|
|
41
|
-
type ParserNodeOptions = ParserPatternNode | ParserRecipeNode;
|
|
42
|
-
interface ParserOptions {
|
|
43
|
-
importMap: Record<'css' | 'recipe' | 'pattern' | 'jsx', string[]>;
|
|
44
|
-
jsx: {
|
|
45
|
-
framework: string | undefined;
|
|
46
|
-
factory: string;
|
|
47
|
-
styleProps: Exclude<Config['jsxStyleProps'], undefined>;
|
|
48
|
-
nodes: ParserNodeOptions[];
|
|
49
|
-
isStyleProp: (prop: string) => boolean;
|
|
50
|
-
};
|
|
51
|
-
isTemplateLiteralSyntax: boolean;
|
|
52
|
-
patternKeys: string[];
|
|
53
|
-
recipeKeys: string[];
|
|
54
|
-
getRecipesByJsxName: (jsxName: string) => ParserRecipeNode[];
|
|
55
|
-
getPatternsByJsxName: (jsxName: string) => ParserPatternNode[];
|
|
56
|
-
tsOptions?: ConfigTsOptions;
|
|
57
|
-
join: Runtime['path']['join'];
|
|
58
|
-
}
|
|
43
|
+
declare function createParser(context: ParserOptions): (sourceFile: SourceFile | undefined, encoder?: Generator['encoder']) => ParserResult | undefined;
|
|
59
44
|
|
|
60
|
-
|
|
45
|
+
interface ProjectOptions extends ProjectOptions$1 {
|
|
61
46
|
readFile: Runtime['fs']['readFileSync'];
|
|
62
|
-
getFiles
|
|
47
|
+
getFiles(): string[];
|
|
63
48
|
hooks: PandaHookable;
|
|
64
49
|
parserOptions: ParserOptions;
|
|
65
50
|
tsOptions?: ConfigTsOptions;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
51
|
+
}
|
|
52
|
+
declare class Project {
|
|
53
|
+
private options;
|
|
54
|
+
project: Project$1;
|
|
55
|
+
parser: ReturnType<typeof createParser>;
|
|
56
|
+
constructor(options: ProjectOptions);
|
|
57
|
+
get files(): string[];
|
|
70
58
|
getSourceFile: (filePath: string) => SourceFile | undefined;
|
|
71
|
-
removeSourceFile: (filePath: string) => void;
|
|
72
59
|
createSourceFile: (filePath: string) => SourceFile;
|
|
60
|
+
createSourceFiles: () => void;
|
|
73
61
|
addSourceFile: (filePath: string, content: string) => SourceFile;
|
|
74
|
-
|
|
75
|
-
reloadSourceFile: (filePath: string) =>
|
|
62
|
+
removeSourceFile: (filePath: string) => boolean;
|
|
63
|
+
reloadSourceFile: (filePath: string) => FileSystemRefreshResult | undefined;
|
|
76
64
|
reloadSourceFiles: () => void;
|
|
77
|
-
|
|
78
|
-
getFiles: () => string[];
|
|
79
|
-
|
|
65
|
+
get readFile(): (filePath: string) => string;
|
|
66
|
+
get getFiles(): () => string[];
|
|
67
|
+
parseJson: (filePath: string) => ParserResult;
|
|
68
|
+
parseSourceFile: (filePath: string, encoder?: ParserOptions['encoder']) => ParserResult | undefined;
|
|
69
|
+
transformFile: (filePath: string, content: string) => string;
|
|
80
70
|
}
|
|
81
71
|
|
|
82
|
-
export {
|
|
72
|
+
export { ParserResult, Project, type ProjectOptions };
|