Conversation
| if x <= 0 then failure("`max-num-def` must be an integer larger than 0") | ||
| else success | ||
| ) | ||
| arg[String]("input") |
There was a problem hiding this comment.
Improved command line parsing when both full form and aliases are used. For example, before this change you cannot run atom with full arguments at the end as shown below.
Won't work.
atom -o ... --language java
Would work.
atom --language java -o ...
| .withInputPath(config.inputPath.pathAsString) | ||
| .withOutputPath(outputAtomFile) | ||
| .withFlow(config.language.equalsIgnoreCase("FLOW")) | ||
| val finalConfig = sys.env.get("CHEN_ASTGEN_OUT") match |
There was a problem hiding this comment.
Support for new environment variable CHEN_ASTGEN_OUT to reuse an existing astgen output directory.
| projectType === "flow" ? babelFlowParserOptions : babelParserOptions; | ||
| const codeToJsAst = (file, code, projectType) => { | ||
| const isJs = /\.(js|jsx|cjs|mjs)$/.test(file); | ||
| if (isJs && projectType === "flow") { |
There was a problem hiding this comment.
Even when the user specifies flow, we can use hermes only for certain file types.
| try { | ||
| return parse(code, optionsToUse); | ||
| } catch { | ||
| return parse(code, primaryBabelOptions); |
There was a problem hiding this comment.
How many parsers do you need to support javascript? The true answer could be infinity, but currently we use three parsers.
| /** | ||
| * Convert a single EJS file to AST. | ||
| */ | ||
| const toEjsAst = (file) => { |
There was a problem hiding this comment.
This logic was ported from chen's EjsPreprocessor. Why? So that we can cache and reuse astgen output 💡
| const typeObj = typeChecker.getTypeAtLocation(node); | ||
| let typeObj = typeChecker.getTypeAtLocation(node); | ||
| if ( | ||
| typeObj.isLiteral() || |
There was a problem hiding this comment.
For string literals and booleans, we need to widen the type name.
| const projectFiles = srcFiles.filter( | ||
| (file) => !file.includes("node_modules") | ||
| ); | ||
| const projectFiles = !shouldIncludeNodeModulesBundles |
There was a problem hiding this comment.
We can create types for even dependencies inside node_modules. It will increase the time and memory quite a lot, but worth it.
Better flow support with hermes-parser.