How to use the metaProperty function from @babel/types

Find comprehensive JavaScript @babel/types.metaProperty code examples handpicked from public code repositorys.

180
181
182
183
184
185
186
187
188
189
    argumentsChild.replaceWith(argsRef);
  });
}

if (newTargetPaths.length > 0) {
  const newTargetBinding = getBinding(thisEnvFn, "newtarget", () => t.metaProperty(t.identifier("new"), t.identifier("target")));
  newTargetPaths.forEach(targetChild => {
    const targetRef = t.identifier(newTargetBinding);
    targetRef.loc = targetChild.node.loc;
    targetChild.replaceWith(targetRef);
fork icon0
star icon1
watch icon1

+ 40 other calls in file

39
40
41
42
43
44
45
46
47
48
  .map((token, i) =>
    babelTypes.templateElement({ raw: token }, i === path.node.elements.length - 1)
  ),
referenceIds.map(referenceId =>
  babelTypes.memberExpression(
    babelTypes.metaProperty(
      babelTypes.identifier('import'),
      babelTypes.identifier('meta')
    ),
    babelTypes.identifier(`ROLLUP_FILE_URL_${referenceId}`)
fork icon0
star icon0
watch icon2

+ 5 other calls in file

Other functions in @babel/types

Sorted by popularity

function icon

@babel/types.identifier is the most popular function in @babel/types (20936 examples)