MCPcopy Create free account
hub / github.com/callstack/linaria / MemberExpression

Function MemberExpression

babel-plugins/transform-import-meta.cjs:4–23  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

2 name: 'transform-import-meta-url',
3 visitor: {
4 MemberExpression(path) {
5 const { object, property, computed } = path.node;
6 if (computed) return;
7 if (!t.isMetaProperty(object)) return;
8 if (!t.isIdentifier(object.meta, { name: 'import' })) return;
9 if (!t.isIdentifier(object.property, { name: 'meta' })) return;
10 if (!t.isIdentifier(property, { name: 'url' })) return;
11 const requireUrl = t.callExpression(
12 t.memberExpression(t.identifier('module'), t.identifier('require')),
13 [t.stringLiteral('url')]
14 );
15 const pathToFileURL = t.memberExpression(
16 requireUrl,
17 t.identifier('pathToFileURL')
18 );
19 const fileUrl = t.callExpression(pathToFileURL, [
20 t.identifier('__filename'),
21 ]);
22 path.replaceWith(t.memberExpression(fileUrl, t.identifier('href')));
23 },
24 },
25});

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…