Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Embracing Black Magic: The Power of Code Transpilation

Embracing Black Magic: The Power of Code Transpilation

Given at the You Gotta Love Front-end conference in Tel Aviv, 2016

Jiri Tobisek

June 28, 2016
Tweet

More Decks by Jiri Tobisek

Other Decks in Programming

Transcript

  1. spatchEvent:function(e,t){if(v._enabled){var n=o.getPooled(e,t);try{d.batchedUpdates(i nally{o.release(n)}}}};t.exports=v},{122:122,139:139,140:140,151:151,165:165,25:25,40: rict";var r={logTopLevelRenders:!1};t.exports=r},{}],67:[function(e,t,n){"use strict"; e(10),o=e(17),i=e(19),a=e(33),u=e(30),s=e(62),l=e(27),c=e(75),p=e(90),d={Component:a.i r.injection,EmptyComponent:s.injection,EventPluginHub:o.injection,EventPluginUtils:i.i eComponent:c.injection,Updates:p.injection};t.exports=d},{10:10,17:17,19:19,27:27,30:3 unction(e,t,n){"use

    strict";function r(e){return i(document.documentElement,e)}var e(51),i=e(143),a=e(148),u=e(149),s={hasSelectionCapabilities:function(e){var e&&e.nodeName&&e.nodeName.toLowerCase();return_t&&(“input"===t&&"text"===e.type||"text ,getSelectionInformation:function(){var e=u();return{focusedElem:e,selectionRange:s.ha getSelection(e):null}},restoreSelection:function(e){var t=u(),n=e.focuse
  2. class Person constructor: (options) -> {@name, @age, @height = 'average'}

    = options tim = new Person name: 'Tim', age: 4 var Person, tim; Person = (function() { function Person(options) { var ref; this.name = options.name, this.age = ...
  3. class Person constructor: (options) -> {@name, @age, @height = 'average'}

    = options tim = new Person name: 'Tim', age: 4 var Person, tim; Person = (function() { function Person(options) { var ref; this.name = options.name, this.age = ...
  4. const myMenu = <div className=“menu”> <Button label=“OK”/> </div> const myMenu

    = React.createElement(“div”, { className: “menu” }, React.createElement(Button, { label: “OK” } ) );
  5. import * as types from “babel-types”; const visitor = {

    Expression: function (path) { path.replaceWith( types.CallExpression( types.Identifier('__validate__'), [path.node] ) ); } };
  6. import * as types from “babel-types”; const visitor = {

    Expression: function (path) { path.replaceWith( types.CallExpression( types.Identifier('__validate__'), [path.node] ) ); } };
  7. import * as types from “babel-types”; const visitor = {

    Expression: function (path) { path.replaceWith( types.CallExpression( types.Identifier('__validate__'), [path.node] ) ); } };
  8. import * as types from “babel-types”; const visitor = {

    Expression: function (path) { path.replaceWith( types.CallExpression( types.Identifier('__validate__'), [path.node] ) ); } };
  9. import * as types from “babel-types”; const visitor = {

    Expression: function (path) { path.replaceWith( types.CallExpression( types.Identifier('__validate__'), [path.node] ) ); } };