Only really useful thing about an identifier is getting its name.
visitor: {
Identifier(node) {
// Usage | |
const container = div({ | |
id: 'foo', | |
style: { | |
background: 'black', | |
width: '100px', | |
height: '100px' | |
} | |
}); |
Main site: http://graphql.org/
Brief writeup on how to import modules in ES2015, what syntax they have, and how we can grab relevant properties from their AST's.
In ES2015, we can import modules into a file using an Import Declaration. An Import Declaration takes on the following interface:
interface ImportDeclaration <: ModuleDeclaration {
const box = document.querySelector('div'); | |
animate(box, { | |
translated: [250, 250], | |
rotated: 360, | |
scaled: [2, 2] | |
}, 1000, scaling); | |
function scaling(node) { | |
return animate(node, { |
Just personal notes that I'm collecting as I learn more about how to write plugins for babel.
t.property('init', t.identifier('foo'), t.literal('bar'))
init
, second parameter is key of the object, final one is the valuet.valueToNode()
{ | |
"retainLines": true, | |
"compact": true, | |
"comments": false, | |
"whitelist": [ | |
"es6.arrowFunctions", | |
"es6.blockScoping", | |
"es6.classes", | |
"es6.constants", | |
"es6.destructuring", |
{ | |
isJSXAttribute: [Function], | |
assertJSXAttribute: [Function], | |
isJSXClosingElement: [Function], | |
assertJSXClosingElement: [Function], | |
isJSXElement: [Function], | |
assertJSXElement: [Function], | |
isJSXEmptyExpression: [Function], | |
assertJSXEmptyExpression: [Function], | |
isJSXExpressionContainer: [Function], |