utils.cjs 670 B

123456789101112131415161718192021
  1. exports.getImportSource = function ({
  2. node
  3. }) {
  4. if (node.specifiers.length === 0) return node.source.value;
  5. };
  6. exports.getRequireSource = function ({
  7. node
  8. }) {
  9. if (node.type !== "ExpressionStatement") return;
  10. const {
  11. expression
  12. } = node;
  13. if (expression.type === "CallExpression" && expression.callee.type === "Identifier" && expression.callee.name === "require" && expression.arguments.length === 1 && expression.arguments[0].type === "StringLiteral") {
  14. return expression.arguments[0].value;
  15. }
  16. };
  17. exports.isPolyfillSource = function (source) {
  18. return source === "@babel/polyfill" || source === "core-js";
  19. };
  20. //# sourceMappingURL=utils.cjs.map