src/language-js/embed.js
function isStyledComponents(path) {
  const parent = path.getParentNode();

  if (!parent || parent.type !== "TaggedTemplateExpression") {
    return false;
  }

  const tag = parent.tag;

  switch (tag.type) {
    case "MemberExpression":
      return (
        // styled.foo``
        isStyledIdentifier(tag.object) ||
        // Component.extend``
        isStyledExtend(tag)
      );

    case "CallExpression":
      return (
        // styled(Component)``
        isStyledIdentifier(tag.callee) ||
        (tag.callee.type === "MemberExpression" &&
          ((tag.callee.object.type === "MemberExpression" &&
            // styled.foo.attr({})``
            (isStyledIdentifier(tag.callee.object.object) ||
              // Component.extend.attr({)``
              isStyledExtend(tag.callee.object))) ||
            // styled(Component).attr({})``
            (tag.callee.object.type === "CallExpression" &&
              isStyledIdentifier(tag.callee.object.callee))))
      );

    case "Identifier":
      // css``
      return tag.name === "css";

    default:
      return false;
  }
}
function isStyledComponents(path) {
  const parent = path.getParentNode();

  if (!parent || parent.type !== "TaggedTemplateExpression") {
    return false;
  }

  const tag = parent.tag;

  switch (tag.type) {
    case "MemberExpression":
      return (
        // styled.foo``
        isStyledIdentifier(tag.object) ||
        // Component.extend``
        isStyledExtend(tag)
      );

    case "CallExpression":
      return (
        // styled(Component)``
        isStyledIdentifier(tag.callee) ||
        (tag.callee.type === "MemberExpression" &&
          ((tag.callee.object.type === "MemberExpression" &&
            // styled.foo.attr({})``
            (isStyledIdentifier(tag.callee.object.object) ||
              // Component.extend.attr({)``
              isStyledExtend(tag.callee.object))) ||
            // styled(Component).attr({})``
            (tag.callee.object.type === "CallExpression" &&
              isStyledIdentifier(tag.callee.object.callee))))
      );

    case "Identifier":
      // css``
      return tag.name === "css";

    default:
      return false;
  }
}
function isStyledComponents ( path ) { const parent = path . getParentNode ( ) ; if ( ! parent || parent . type !== "TaggedTemplateExpression" ) { return false ; } const tag = parent . tag ; switch ( tag . type ) { case "MemberExpression" : return ( // styled.foo`` isStyledIdentifier ( tag . object ) || // Component.extend`` isStyledExtend ( tag ) ) ; case "CallExpression" : return ( // styled(Component)`` isStyledIdentifier ( tag . callee ) || ( tag . callee . type === "MemberExpression" && ( ( tag . callee . object . type === "MemberExpression" && // styled.foo.attr({})`` ( isStyledIdentifier ( tag . callee . object . object ) || // Component.extend.attr({)`` isStyledExtend ( tag . callee . object ) ) ) || // styled(Component).attr({})`` ( tag . callee . object . type === "CallExpression" && isStyledIdentifier ( tag . callee . object . callee ) ) ) ) ) ; case "Identifier" : // css`` return tag . name === "css" ; default : return false ; } }
styled-components template literals
styled - components template literals