How to use the babel-core.types.memberExpression function in babel-core

To help you get started, we’ve selected a few babel-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tmpfs / trucks / lib / compile.js View on Github external
function main(opts) {
  var t = require('babel-core').types;

  // main function declaration
  var expr = t.functionDeclaration(t.identifier(opts.main), [t.identifier(ELEM)], t.blockStatement([t.returnStatement(t.callExpression(t.memberExpression(t.memberExpression(t.identifier(opts.templates), t.callExpression(t.memberExpression(t.memberExpression(t.identifier(ELEM), t.identifier(TAG_NAME)), t.identifier(TO_LOWER_CASE)), []), true), t.identifier('call')), [t.identifier(ELEM), t.identifier(ELEM)]))]));

  return t.program([expr]);
}
github tmpfs / trucks / packages / transform-skate / lib / compiler.js View on Github external
function main(opts) {
  var t = require('babel-core').types;

  opts = opts || {};
  opts.main = opts.main || MAIN;
  opts.templates = opts.templates || TEMPLATES;

  // main function declaration
  var expr = t.functionDeclaration(t.identifier(opts.main), [t.identifier(ELEM)], t.blockStatement([t.returnStatement(t.callExpression(t.memberExpression(t.memberExpression(t.identifier(opts.templates), t.callExpression(t.memberExpression(t.memberExpression(t.identifier(ELEM), t.identifier(TAG_NAME)), t.identifier(TO_LOWER_CASE)), []), true), t.identifier('call')), [t.identifier(ELEM), t.identifier(ELEM)]))]));

  return t.program([expr]);
}
github tmpfs / trucks / packages / transform-skate / src / compiler.js View on Github external
const t = require('babel-core').types;
  opts = options(opts);

  // main function declaration
  let expr = t.functionDeclaration(
      t.identifier(opts.main),
      [t.identifier(ELEM)],
      t.blockStatement(
        [
          t.returnStatement(
            t.callExpression(
              t.memberExpression(
                t.memberExpression(
                  t.identifier(opts.templates),
                  t.callExpression(
                    t.memberExpression(
                      t.memberExpression(
                        t.identifier(ELEM),
                        t.identifier(TAG_NAME)
                      ),
                      t.identifier(TO_LOWER_CASE)
                    ),
                    []
                  ),
                  true
                ),
                t.identifier('call')
              ),
              [t.identifier(ELEM), t.identifier(ELEM)]
            )  
          )
        ]
github ooflorent / babel-plugin-graphql / src / compile.js View on Github external
export default function compile(quasi, node) {
  t.assertTemplateLiteral(node)

  const strings = node.quasis.map((child) => child.value.raw)
  const source = concat(strings)
  const ast = parse(source)

  const replacement = transformer.run(ast, {
    arguments: node.expressions,
  })

  return t.functionExpression(null, [t.identifier('params')], t.blockStatement([
    t.variableDeclaration('const', [
      t.variableDeclarator(t.identifier('GraphQL'), t.memberExpression(quasi, t.identifier('GraphQL'))),
    ]),
    t.returnStatement(replacement),
  ]))
}
github facebook / metro / packages / metro-bundler / src / ModuleGraph / worker / collect-dependencies.js View on Github external
function createMapLookup(dependencyMapIdentifier, propertyIdentifier) {
  return types.memberExpression(
    dependencyMapIdentifier,
    propertyIdentifier,
    true,
  );
}
github facebook / metro / packages / metro / src / ModuleGraph / worker / collect-dependencies.js View on Github external
function createMapLookup(dependencyMapIdentifier, propertyIdentifier) {
  return types.memberExpression(
    dependencyMapIdentifier,
    propertyIdentifier,
    true,
  );
}
github react-component / rn-packager / react-native / packager / src / ModuleGraph / worker / collect-dependencies.js View on Github external
function createMapLookup(dependencyMapIdentifier, propertyIdentifier) {
  return types.memberExpression(
    dependencyMapIdentifier,
    propertyIdentifier,
    true,
  );
}