MCPcopy Create free account
hub / github.com/babel/babel / makeSource

Function makeSource

packages/babel-plugin-transform-react-jsx/src/create-plugin.ts:260–277  ·  view source on GitHub ↗
(node: t.Node)

Source from the content-addressed store, hash-verified

258
259 let fileNameIdentifier: Identifier | undefined;
260 function makeSource(node: t.Node) {
261 const location = node.loc;
262 if (!location) {
263 // the element was generated and doesn't have location information
264 return t.buildUndefinedNode();
265 }
266
267 if (!fileNameIdentifier) {
268 fileNameIdentifier =
269 path.scope.generateUidIdentifier("_jsxFileName");
270 }
271
272 return makeTrace(
273 t.cloneNode(fileNameIdentifier),
274 location.start.line,
275 location.start.column,
276 );
277 }
278
279 function makeTrace(
280 fileNameIdentifier: Identifier,

Callers 1

enterFunction · 0.85

Calls 2

makeTraceFunction · 0.85
generateUidIdentifierMethod · 0.80

Tested by

no test coverage detected