Repository URL to install this package:
|
Version:
1.2.11 ▾
|
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
}); // eslint-disable-next-line
exports.noParserRequireCallExpression = exports.noParserImportDeclaration = void 0;
const t = global._interopRequireWildcard(require('@babel/types'));
const _require = require("../utils/options"),
useCSSPreprocessor = _require.useCSSPreprocessor;
const noParserImportDeclaration = (path, state) => {
if (useCSSPreprocessor(state) && path.node.source.value === 'styled-components') {
path.node.source = t.stringLiteral('styled-components/no-parser');
}
};
const noParserRequireCallExpression = (path, state) => {
if (useCSSPreprocessor(state) && path.node.callee.name === 'require' && path.node.arguments && path.node.arguments.length === 1 && t.isStringLiteral(path.node.arguments[0]) && path.node.arguments[0].value === 'styled-components') {
path.node.arguments = [t.stringLiteral('styled-components/no-parser')];
}
};
exports.noParserImportDeclaration = noParserImportDeclaration;
exports.noParserRequireCallExpression = noParserRequireCallExpression;