MCPcopy Create free account
hub / github.com/thetarnav/solid-devtools / addLocationToBody

Function addLocationToBody

packages/main/src/babel/babel.ts:280–300  ·  view source on GitHub ↗
(
        body: babel.types.BlockStatement,
        node: t.Node,
    )

Source from the content-addressed store, hash-verified

278 ) as (...args: Parameters<ReturnType<typeof babel.template>>) => t.Statement
279
280 function addLocationToBody(
281 body: babel.types.BlockStatement,
282 node: t.Node,
283 ) {
284 let location = getNodeLocationAttribute(node, file_filename)
285 if (location) {
286
287 if (!file_imported) {
288 file_imported = true
289
290 file_program!.unshiftContainer('body', [
291 t.importDeclaration(
292 [t.importSpecifier(sdt_get_owner_ident, get_owner_ident)],
293 solid_js_str,
294 ),
295 ])
296 }
297
298 body.body.unshift(buildSetComponentLocationAst({loc: t.stringLiteral(location)}))
299 }
300 }
301
302 return {
303 name: '@solid-devtools/location',

Callers 2

FunctionDeclarationFunction · 0.85
VariableDeclaratorFunction · 0.85

Calls 1

getNodeLocationAttributeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…