utils.cjs 672 B

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