tessl install tessl/npm-babel--runtime@7.28.0Babel's modular runtime helpers that provide transpilation support for modern JavaScript features
Agent Success
Agent success rate when using this tile
94%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.19x
Baseline
Agent success rate without this tile
79%
Build a Babel plugin that counts the number of function calls in each file and stores this information during the transformation process.
Your plugin should:
Count function calls: Track every function call expression (both regular calls and member expression calls like obj.method()) encountered in each file.
Store per-file state: Use plugin-specific storage to maintain a count for each file being transformed. The count should be accessible within the plugin throughout the transformation.
Access plugin context: Utilize the plugin pass context to access file information and store the count appropriately.
Add metadata: After transformation, the plugin should add the count to the file's metadata under the key functionCallCount.
When transforming a file with 3 function calls (foo(), bar(), baz()), the metadata should contain functionCallCount: 3 @test
When transforming a file with method calls (obj.method(), arr.push(1)), these should be counted as function calls @test
When transforming a file with nested function calls (foo(bar())), all calls should be counted separately (count should be 2) @test
When transforming a file with no function calls, the metadata should contain functionCallCount: 0 @test
@generates
/**
* Babel plugin that counts function calls in a file
* @returns {object} Babel plugin object
*/
module.exports = function functionCallCounterPlugin() {
return {
name: "function-call-counter",
visitor: {
// Plugin visitor implementation
}
};
};Provides the plugin API and transformation infrastructure.
@satisfied-by