@pandacss/parser 0.27.2 → 0.28.0
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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/index.mjs +5 -5
- package/package.json +8 -9
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ParserOptions } from '@pandacss/core';
|
|
2
|
-
import { ParserResultInterface, ResultItem, Runtime,
|
|
2
|
+
import { ParserResultInterface, ResultItem, Runtime, PandaHooks, ConfigTsOptions } from '@pandacss/types';
|
|
3
3
|
import { SourceFile, ProjectOptions as ProjectOptions$1, Project as Project$1, FileSystemRefreshResult } from 'ts-morph';
|
|
4
4
|
import { Generator } from '@pandacss/generator';
|
|
5
5
|
|
|
@@ -47,7 +47,7 @@ declare function createParser(context: ParserOptions): (sourceFile: SourceFile |
|
|
|
47
47
|
interface ProjectOptions extends ProjectOptions$1 {
|
|
48
48
|
readFile: Runtime['fs']['readFileSync'];
|
|
49
49
|
getFiles(): string[];
|
|
50
|
-
hooks:
|
|
50
|
+
hooks: Partial<PandaHooks>;
|
|
51
51
|
parserOptions: ParserOptions;
|
|
52
52
|
tsOptions?: ConfigTsOptions;
|
|
53
53
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ParserOptions } from '@pandacss/core';
|
|
2
|
-
import { ParserResultInterface, ResultItem, Runtime,
|
|
2
|
+
import { ParserResultInterface, ResultItem, Runtime, PandaHooks, ConfigTsOptions } from '@pandacss/types';
|
|
3
3
|
import { SourceFile, ProjectOptions as ProjectOptions$1, Project as Project$1, FileSystemRefreshResult } from 'ts-morph';
|
|
4
4
|
import { Generator } from '@pandacss/generator';
|
|
5
5
|
|
|
@@ -47,7 +47,7 @@ declare function createParser(context: ParserOptions): (sourceFile: SourceFile |
|
|
|
47
47
|
interface ProjectOptions extends ProjectOptions$1 {
|
|
48
48
|
readFile: Runtime['fs']['readFileSync'];
|
|
49
49
|
getFiles(): string[];
|
|
50
|
-
hooks:
|
|
50
|
+
hooks: Partial<PandaHooks>;
|
|
51
51
|
parserOptions: ParserOptions;
|
|
52
52
|
tsOptions?: ConfigTsOptions;
|
|
53
53
|
}
|
package/dist/index.js
CHANGED
|
@@ -578,14 +578,14 @@ var Project = class {
|
|
|
578
578
|
const sourceFile = this.project.getSourceFile(filePath);
|
|
579
579
|
if (!sourceFile)
|
|
580
580
|
return;
|
|
581
|
-
const
|
|
582
|
-
const
|
|
583
|
-
|
|
581
|
+
const original = sourceFile.getText();
|
|
582
|
+
const custom = hooks["parser:before"]?.({ filePath, content: original });
|
|
583
|
+
const transformed = custom ?? this.transformFile(filePath, original);
|
|
584
|
+
if (original !== transformed) {
|
|
584
585
|
sourceFile.replaceWithText(transformed);
|
|
585
586
|
}
|
|
586
|
-
hooks.callHook("parser:before", filePath, content);
|
|
587
587
|
const result = this.parser(sourceFile, encoder)?.setFilePath(filePath);
|
|
588
|
-
hooks
|
|
588
|
+
hooks["parser:after"]?.({ filePath, result });
|
|
589
589
|
return result;
|
|
590
590
|
};
|
|
591
591
|
transformFile = (filePath, content) => {
|
package/dist/index.mjs
CHANGED
|
@@ -544,14 +544,14 @@ var Project = class {
|
|
|
544
544
|
const sourceFile = this.project.getSourceFile(filePath);
|
|
545
545
|
if (!sourceFile)
|
|
546
546
|
return;
|
|
547
|
-
const
|
|
548
|
-
const
|
|
549
|
-
|
|
547
|
+
const original = sourceFile.getText();
|
|
548
|
+
const custom = hooks["parser:before"]?.({ filePath, content: original });
|
|
549
|
+
const transformed = custom ?? this.transformFile(filePath, original);
|
|
550
|
+
if (original !== transformed) {
|
|
550
551
|
sourceFile.replaceWithText(transformed);
|
|
551
552
|
}
|
|
552
|
-
hooks.callHook("parser:before", filePath, content);
|
|
553
553
|
const result = this.parser(sourceFile, encoder)?.setFilePath(filePath);
|
|
554
|
-
hooks
|
|
554
|
+
hooks["parser:after"]?.({ filePath, result });
|
|
555
555
|
return result;
|
|
556
556
|
};
|
|
557
557
|
transformFile = (filePath, content) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/parser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "The static parser for panda css",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -32,17 +32,16 @@
|
|
|
32
32
|
"magic-string": "0.30.5",
|
|
33
33
|
"ts-morph": "19.0.0",
|
|
34
34
|
"ts-pattern": "5.0.5",
|
|
35
|
-
"@pandacss/
|
|
36
|
-
"@pandacss/
|
|
37
|
-
"@pandacss/
|
|
38
|
-
"@pandacss/
|
|
39
|
-
"@pandacss/
|
|
40
|
-
"@pandacss/
|
|
35
|
+
"@pandacss/config": "^0.28.0",
|
|
36
|
+
"@pandacss/core": "^0.28.0",
|
|
37
|
+
"@pandacss/extractor": "0.28.0",
|
|
38
|
+
"@pandacss/logger": "0.28.0",
|
|
39
|
+
"@pandacss/shared": "0.28.0",
|
|
40
|
+
"@pandacss/types": "0.28.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@vue/compiler-core": "3.3.4",
|
|
44
|
-
"
|
|
45
|
-
"@pandacss/generator": "0.27.2"
|
|
44
|
+
"@pandacss/generator": "0.28.0"
|
|
46
45
|
},
|
|
47
46
|
"files": [
|
|
48
47
|
"dist"
|