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 JavaScript code transformation utility that safely transforms code while preserving the original Abstract Syntax Tree (AST) for comparison purposes.
Create a module that exports a function transformWithComparison that:
var declarations to const declarationsoriginal: The original, unmodified AST (must remain unchanged even after transformation)transformed: The transformed JavaScript code as a stringwasModified: A boolean indicating whether any var-to-const transformations occurredThe original AST must remain completely unmodified after the transformation completes, preserving its initial state for comparison purposes.
@generates
/**
* Transforms JavaScript code while preserving the original AST.
*
* @param {string} sourceCode - The JavaScript source code to transform
* @returns {Object} An object with original AST, transformed code, and modification status
* @returns {Object} returns.original - The original, unmodified AST
* @returns {string} returns.transformed - The transformed JavaScript code
* @returns {boolean} returns.wasModified - Whether any transformations were applied
*/
function transformWithComparison(sourceCode) {
// Implementation
}
module.exports = { transformWithComparison };var x = 1;, the function returns an object where transformed is const x = 1;, wasModified is true, and original is an unmodified AST @testconst y = 2; (already using const), the function returns wasModified as false and transformed equals the input @testProvides JavaScript transformation and parsing capabilities with AST cloning support.
@satisfied-by