Mirror: The magical sticky regex-based parser generator 馃
at v1.0.1 479 B view raw
1import { makeHelpers } from './transform'; 2 3export default function reghexPlugin({ types }) { 4 let helpers; 5 6 return { 7 name: 'reghex', 8 visitor: { 9 Program() { 10 helpers = makeHelpers(types); 11 }, 12 ImportDeclaration(path) { 13 helpers.updateImport(path); 14 }, 15 TaggedTemplateExpression(path) { 16 if (helpers.isMatch(path) && helpers.getMatchImport(path)) { 17 helpers.transformMatch(path); 18 } 19 }, 20 }, 21 }; 22}