I can Babel Macros (and So Can You!)

Babel @ JSConfHI
Feb 07 2019 ( External link )

Description: Babel macros are a new way to solve DX and UX tradeoffs by metaprogramming to write code the way that is best for you while delivering code that is best for the user. Case in point, JSX - but why stop there? In this talk we explore how I wrote babel-blade to solve the double declaration problem in clientside GraphQL libraries, and how to get started writing your first babel macro!

Dan Questions:

  • How will you deliver the idea to the audience?
    • Moana
  • What is the one thing that you want people to take away from your talk?
    • Babel Macros allow you to write simple compile time libraries
  • Why are you giving the talk? What is the emotional core? What do you believe in?
    • Compilers are the new Frameworks

Key questions:

  • what is a macro
    • babel plugin plugins?
  • growing a language - add vocabulary or change rules
    • extra language carries weight
    • bake it in
  • cathedral (one design) vs bazaar (no plan)

Points I wanna cover:

  • Act 1: Maui stealing Map
    • A brief history of JS
    • Growing a Language:
      • add vocabulary: library, npm
      • change rules: babel, tc39, typescript
    • cathedral vs bazaar
    • There's a third way
  • Act 2: Food Problems?
    • Quick Intro to GraphQL
      • combinatorial explosion of APIs
      • colocating data needs
      • faster iteration
    • GraphQL DD problem
  • Act 3: Meet Maui
    • What if we had a babel plugin
    • Introducing ASTExplorer/Babel playground
      • Adding a field
      • braces? psh
      • aliases ezpz
    • yay! solved
  • Act 4: Maui breaks Hook
    • Problems with Babel
      • implicit global scope
      • unpredictable conflicts
      • implicit - spooky action at a distance
      • needs config
      • have to test extensively to limit scope
  • Act 5: Part the Sea
    • Babel Macros
      • GraphQL: Instead of small custom holes, Punch a big hole
      • Babel Plugin Plugins
      • Compile time Libraries
    • demo some other macros
    • reveal - some visual
    • Compilers are the next frontier
  • Act 6: New Voyage
    • how to get started
      • AST explorer
      • familiarize yourself with an AST
      • babel handbook
      • kent dodds' workshops
    • Go Forth and Explore!

Resources:

Moana:

{
  "title": "I can Babel Macros (and So Can You!)",
  "slug": "babel-macros",
  "topic": "Babel",
  "venues": "JSConfHI",
  "date": "2019-02-07T00:00:00.000Z",
  "url": "https://www.jsconfhi.com/schedule/",
  "video": "https://www.youtube.com/watch?v=1WNT5RCENfo",
  "desc": "An introduction to Babel Macros and how they can solve DX vs UX tradeoffs",
  "description": "Babel macros are a new way to solve DX and UX tradeoffs by metaprogramming to write code the way that is best for you while delivering code that is best for the user. Case in point, JSX - but why stop there? In this talk we explore how I wrote babel-blade to solve the double declaration problem in clientside GraphQL libraries, and how to get started writing your first babel macro!",
  "cfp": "Hi organizers! Babel is a core part of the JS ecosystem, and I think still very underexplored/underappreciated because of the perception that it is hard to get into and limited to transpiling JSX and TC39 proposals. With the increasing adoption of babel-plugin-macros (adopted by large ecosystems like React) the addressable space for babel has -exploded-. Essentially making it possible to move computation and metaprogramming from run time to build time making for faster apps -and- a better developer experience! I want to tell the world!!",
  "pubdate": "2019-02-07T00:00:00.000Z"
}