-
Hi, we're rewriting a TypeScript compiler project in Rust and using SWC for the TypeScript AST. Using const program = tsc.createProgram(['index.ts'], {});
const sourceFiles = program.getSourceFiles(); How can I easily achieve the same thing using Here's the code I have so far: let filepath = Path::new(&ts_file_path_string_value).to_path_buf();
let cm: Lrc<SourceMap> = Default::default();
let fm = cm.load_file(&filepath).unwrap();
let lexer = Lexer::new(
Syntax::Typescript(TsConfig::default()),
Default::default(),
StringInput::from(&*fm),
None
);
let mut parser = Parser::new_from(lexer);
let program = parser.parse_program().unwrap(); The |
Beta Was this translation helpful? Give feedback.
Answered by
kdy1
Jul 24, 2023
Replies: 1 comment
-
You need to resolve dependencies by yourself. swc works file-by-file |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
kdy1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to resolve dependencies by yourself. swc works file-by-file