Transpilar is a mix of compile and translate. In other words it is a tool to generate a new version of a given code.
In the last years in Javascript the language has advanced a lot. As browsers move more slowly and cannot keep up with the pace, solutions began to emerge for developers to use the new technologies in the code they write, and then when it’s time to use that code, it’s transposed into a Javascript version that browsers accept. Babel is the best example of this, and a practical example would be:
var optionsA = {um: 1};
var optionsB = {...optionsA, dois: 2};
console.log(optionsB);
using future technologies, already approved or in the process of approval and transpilated:
"use strict";
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var optionsA = { um: 1 };
var optionsB = _extends({}, optionsA, { dois: 2 });
console.log(optionsB);
Thus compatible with Ecmascript 5.
If we add to this the concept of AST, that allows us to analyze the code and its components, so we can transpose not only for different versions of Javascript but for other languages, raw or not.
No, I’m not talking about anything pertaining to deodorants
– Wallace Maxters
Good thing you alerted Wallace!
– viana
And about deodorant?
– Math
recommend reading: https://blog.codecasts.com.br/ecossistema-javascript-parte-04-transpilers-734f77422316
– vinicius73