{"version":3,"sources":["https://lively-kernel.org/lively4/lively4-stephelm/src/components/tools/lively-plugin-explorer-playground.js"],"names":["babel","types","t","template","transformFromAst","traverse","loggingFunc","loggingCall","name","visitor","FunctionDeclaration","path","isGenerated","skip","body","get","node","id","unshiftContainer","NAME","stringLiteral","ReturnStatement","arg","expression","identifier","newNode","EXPR","replaceWith"],"mappings":";;;;;;;;;yBAAe,UAAUA,KAAV,EAAiB;AAC9B,cAAM,EAAEC,OAAOC,CAAT,EAAYC,QAAZ,EAAsBC,gBAAtB,EAAwCC,QAAxC,KAAqDL,KAA3D;AACA,cAAMM,cAAcH,SAAU;;;EAAV,CAApB;AAIA,cAAMI,cAAcJ,SAAU,eAAV,CAApB;;AAEA,eAAO;AACLK,gBAAM,gBADD;AAELC,mBAAS;AACPC,gCAAoBC,IAApB,EAA0B;AACxB,kBAAIA,KAAKC,WAAL,EAAJ,EAAwB,OAAOD,KAAKE,IAAL,EAAP;AACxB,oBAAMC,OAAOH,KAAKI,GAAL,CAAS,MAAT,CAAb;AACA,oBAAMP,OAAOG,KAAKK,IAAL,CAAUC,EAAV,CAAaT,IAA1B;AACAM,mBAAKI,gBAAL,CAAsB,MAAtB,EAA8BZ,YAAY,EAACa,MAAMjB,EAAEkB,aAAF,CAAgBZ,IAAhB,CAAP,EAAZ,CAA9B;AACD,aANM;AAOPa,4BAAgBV,IAAhB,EAAsB;AACpB,oBAAMW,MAAMX,KAAKI,GAAL,CAAS,UAAT,CAAZ;AACA,oBAAMQ,aAAaD,IAAIN,IAAJ,IAAYd,EAAEsB,UAAF,CAAa,WAAb,CAA/B;AACA,oBAAMC,UAAUlB,YAAY,EAAEmB,MAAMH,UAAR,EAAZ,EAAkCA,UAAlD;AACAD,kBAAIK,WAAJ,CAAgBF,OAAhB;AACD;AAZM;AAFJ,SAAP;AAiBD,O","file":"lively-plugin-explorer-playground.js","sourcesContent":["export default function (babel) {\n  const { types: t, template, transformFromAst, traverse } = babel;\n  const loggingFunc = template(`function __log__(result) {\n  console.log(NAME, result);\n  return result;\n}`);\n  const loggingCall = template(`__log__(EXPR)`);\n\n  return {\n    name: \"return-logging\",\n    visitor: {\n      FunctionDeclaration(path) {\n        if (path.isGenerated()) return path.skip();\n        const body = path.get(\"body\");\n        const name = path.node.id.name;\n        body.unshiftContainer('body', loggingFunc({NAME: t.stringLiteral(name)}));\n      },\n      ReturnStatement(path) {\n        const arg = path.get('argument');\n        const expression = arg.node || t.identifier(\"undefined\");\n        const newNode = loggingCall({ EXPR: expression }).expression;\n        arg.replaceWith(newNode);\n      }\n    }\n  };\n}"]}