forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
/
react-compiler-healthcheck+19.0.0-beta-8a03594-20241020+001+initial.patch
90 lines (90 loc) · 2.85 KB
/
react-compiler-healthcheck+19.0.0-beta-8a03594-20241020+001+initial.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
diff --git a/node_modules/react-compiler-healthcheck/dist/index.js b/node_modules/react-compiler-healthcheck/dist/index.js
index 5a4060d..460339b 100755
--- a/node_modules/react-compiler-healthcheck/dist/index.js
+++ b/node_modules/react-compiler-healthcheck/dist/index.js
@@ -56969,7 +56969,7 @@ var reactCompilerCheck = {
compile(source, path);
}
},
- report() {
+ report(verbose) {
const totalComponents =
SucessfulCompilation.length +
countUniqueLocInEvents(OtherFailures) +
@@ -56979,6 +56979,50 @@ var reactCompilerCheck = {
`Successfully compiled ${SucessfulCompilation.length} out of ${totalComponents} components.`
)
);
+
+ if (verbose) {
+ for (const compilation of [...SucessfulCompilation, ...ActionableFailures, ...OtherFailures]) {
+ const filename = compilation.fnLoc?.filename;
+
+ if (compilation.kind === "CompileSuccess") {
+ const name = compilation.fnName;
+ const isHook = name?.startsWith('use');
+
+ if (name) {
+ console.log(
+ chalk.green(
+ `Successfully compiled ${isHook ? "hook" : "component" } [${name}](${filename})`
+ )
+ );
+ } else {
+ console.log(chalk.green(`Successfully compiled ${compilation.fnLoc?.filename}`));
+ }
+ }
+
+ if (compilation.kind === "CompileError") {
+ const { reason, severity, loc } = compilation.detail;
+
+ const lnNo = loc.start?.line;
+ const colNo = loc.start?.column;
+
+ const isTodo = severity === ErrorSeverity.Todo;
+
+ console.log(
+ chalk[isTodo ? 'yellow' : 'red'](
+ `Failed to compile ${
+ filename
+ }${
+ lnNo !== undefined ? `:${lnNo}${
+ colNo !== undefined ? `:${colNo}` : ""
+ }.` : ""
+ }`
+ ),
+ chalk[isTodo ? 'yellow' : 'red'](reason? `Reason: ${reason}` : "")
+ );
+ console.log("\n");
+ }
+ }
+ }
},
};
const JsFileExtensionRE = /(js|ts|jsx|tsx)$/;
@@ -57015,9 +57059,16 @@ function main() {
type: 'string',
default: '**/+(*.{js,mjs,jsx,ts,tsx}|package.json)',
})
+ .option('verbose', {
+ description: 'run with verbose logging',
+ type: 'boolean',
+ default: false,
+ alias: 'v',
+ })
.parseSync();
const spinner = ora('Checking').start();
let src = argv.src;
+ let verbose = argv.verbose;
const globOptions = {
onlyFiles: true,
ignore: [
@@ -57037,7 +57088,7 @@ function main() {
libraryCompatCheck.run(source, path);
}
spinner.stop();
- reactCompilerCheck.report();
+ reactCompilerCheck.report(verbose);
strictModeCheck.report();
libraryCompatCheck.report();
});