Code Monkey home page Code Monkey logo

babel's Introduction

Small JSX compiler

This repo is my attempt at creating a reasonably small JSX compiler.

The upstream version of babel-standalone's "minified" build clocks in at

curl https://unpkg.com/@babel/[email protected]/babel.min.js | wc -c
# 1965073 bytes

nearly 2MB, and also does some DOM walking to process <script> tags.

I don't want any of that, I just want a pure function that converts a string of javascript with JSX to a string of javascript with React.createElement calls. (For use in the Sketch.systems playground; see forum thread for context.)

So, I removed all the babel plugins except @babel/plugin-transform-react-jsx and got rid of the DOM walking bits.

Run compile.sh to build /packages/babel-standalone/babel.min.js. Best I've gotten it down to is 969kB.

Please open an issue or pull request if this can be improved. (Or point me to another project that already does this!)

Thanks

--Kevin

babel's People

Contributors

aluisioasg avatar amasad avatar andarist avatar benjamn avatar danez avatar eventualbuddha avatar existentialism avatar gaearon avatar greenkeeper[bot] avatar guybedford avatar hzoo avatar jamiebuilds avatar jmm avatar jridgewell avatar kaicataldo avatar loganfsmyth avatar marijnh avatar mathiasbynens avatar motiz88 avatar neverberlerfellerer avatar nicolo-ribaudo avatar peey avatar rreverser avatar samwgoldman avatar sebmck avatar sindresorhus avatar webpro avatar xtuc avatar yavorsky avatar zertosh avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.