rollup-plugin-data-qa
Version:
[](https://www.npmjs.com/package/rollup-plugin-data-qa) [](https://github.com/semantic-releas
12 lines (11 loc) • 561 B
JavaScript
//#region src/utils/mightNeedTransform/index.ts
const JSX_PATTERN = /<|jsxDEV|jsx\(|_jsx\(|jsxs\(|_jsxs\(|React\.createElement|createElement\(/;
const STYLED_PATTERN = /styled\.|styled\(/;
function mightNeedTransform(code, params) {
if (params.disabledReactFunctionComponent && params.disabledStyledComponent) return false;
if (!params.disabledReactFunctionComponent && JSX_PATTERN.test(code)) return true;
if (!params.disabledStyledComponent && STYLED_PATTERN.test(code)) return true;
return false;
}
//#endregion
export { mightNeedTransform as default };