JSXElement()

in src/ast.ts [116:153]


      JSXElement(path) {
        if (
          path.node.openingElement.type === "JSXOpeningElement" &&
          //@ts-ignore
          path.node.openingElement.name.name === elementName
        ) {
          if (propsConfig["children"] && propsConfig["children"].propHook) {
            const propHook = propsConfig["children"].propHook;
            path.get("children").forEach((child) => {
              typeof propHook === "object"
                ? fnBodyAppend(
                    child,
                    getInstrumentOnChange(propHook.what, propHook.into),
                  )
                : child.traverse(
                    propHook({ getInstrumentOnChange, fnBodyAppend }),
                  );
            });
          }
          path
            .get("openingElement")
            .get("attributes")
            .forEach((attr) => {
              const name = (attr.get("name") as any).node.name;
              const propHook = propsConfig[name].propHook;
              if (typeof propHook !== "undefined") {
                typeof propHook === "object"
                  ? fnBodyAppend(
                      attr.get("value") as any,
                      getInstrumentOnChange(propHook.what, propHook.into),
                    )
                  : attr.traverse(
                      propHook({ getInstrumentOnChange, fnBodyAppend }),
                    );
              }
            });
        }
      },