Skip to content

Instantly share code, notes, and snippets.

@souporserious
Created April 27, 2022 18:18
Show Gist options
  • Save souporserious/51dfb3e92de6dd9f817d23a25f128b02 to your computer and use it in GitHub Desktop.
Save souporserious/51dfb3e92de6dd9f817d23a25f128b02 to your computer and use it in GitHub Desktop.
Documenting Steps
/** step:01 Start with the initial plugin. */
import jsx from '@babel/plugin-syntax-jsx'
export default () => {
return {
inherits: jsx,
visitor: {
/** step:02 Add visitor */
Program() {
this.tree = []
},
JSXElement(path) {
this.tree.push({
name: path.node.openingElement.name.name,
start: path.node.start,
end: path.node.end,
})
},
/** step:02 */
},
}
}
/** step:01 */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment