Transfiler is quite unfamiliar to me. As a big fan of Rust
, I never heard about the Transfiler (But it doesn't mean that I understand the compiler very wellㅠ). Let's look around the Transfiler.
Transfiler converts from programming language(or version) to similar level of language. Different with Compiler
, Transfiler converts high level language -> high level language
Newest ESNext JS
-> Old version of ES5 code
JSX
-> React.createElement
TypeScript
-> Vanilla JS
optional chaining(?.)
-> code with IF branches
AST(Abstract Syntax Tree)
CallExpression(React.createElement, ...)
nodePrettier
to insert spaces, line breaks, and semicolonsfunction Title() {
return <h1 className="title">Hello</h1>;
}
JSXElement
node foundJSXElement
-> React.createElement(
"h1",
{ className: "title" },
"Hello"
);
function Title() {
return React.createElement("h1", { className: "title" }, "Hello");
}