Sha256: cf34bfeb536f83f643be728feeb5165f1a863d32c83a52b8bdc7678ae5ff3f02
Contents?: true
Size: 691 Bytes
Versions: 9
Compression:
Stored size: 691 Bytes
Contents
// babel-plugin adding `plugin-` prefix to each "id" JSX attribute module.exports = main function main({types: t}) { return { visitor: { // intentionally traversing from Program, // if it matches JSXAttribute here the issue won't be reproduced Program(progPath) { progPath.traverse({ JSXAttribute(path) { const name = path.get('name') if (t.isJSXIdentifier(name) && name.node.name === 'id') { const value = path.get('value') if (t.isStringLiteral(value)) value.replaceWith(t.stringLiteral(`plugin-${value.node.value}`)) } }, }) }, }, } }
Version data entries
9 entries across 9 versions & 3 rubygems