MCPcopy Create free account
hub / github.com/FormidableLabs/babel-plugin-transform-define / Identifier

Function Identifier

lib/index.js:92–108  ·  view source on GitHub ↗
(nodePath, state)

Source from the content-addressed store, hash-verified

90
91 // const x = { version: VERSION };
92 Identifier(nodePath, state) {
93 const binding = nodePath.scope.getBinding(nodePath.node.name);
94
95 if (
96 binding
97 // Don't transform import identifiers. This is meant to mimic webpack's
98 // DefinePlugin behavior.
99 || isImportIdentifier(nodePath)
100 // Do not transform Object keys / properties unless they are computed like {[key]: value}
101 || nodePath.key === "key" && nodePath.parent.computed === false
102 || nodePath.key === "property" && nodePath.parent.computed === false
103 ) {
104 return;
105 }
106
107 processNode(state.opts, nodePath, t.valueToNode, identifierComparator);
108 },
109
110 // typeof window
111 UnaryExpression(nodePath, state) {

Callers

nothing calls this directly

Calls 2

isImportIdentifierFunction · 0.85
processNodeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…