transpiler(名词):一种源代码到源代码(source-to-source)的编译器/转换器,把一种编程语言(或同一语言的不同版本/方言)转换成另一种语言(或版本)的等价代码,常用于把“新语法”转换为“旧环境可运行的语法”(如把现代 JavaScript 转成兼容旧浏览器的 JavaScript)。也常被称为 source-to-source compiler。
/trænˈspaɪlər/
A transpiler converts modern JavaScript into older JavaScript that browsers understand.
转译器会把现代 JavaScript 转换成浏览器能理解的旧版 JavaScript。
To target multiple platforms, the team built a transpiler that rewrites the project’s syntax into a safer, more portable subset of the language.
为了适配多个平台,团队构建了一个转译器,把项目语法改写成更安全、更可移植的语言子集。
transpiler 是 trans-(“跨越、转换”)与 compiler(“编译器”)的合成词,用来强调它的核心特点:跨语言/跨版本地“编译”,但产物仍然是可读的源代码而不是机器码。该词在现代前端工程(如 Babel 等工具)兴起后更为常见。