@mondaydotcomorg/atp-compiler
Version:
Production-ready compiler for transforming async iteration patterns into resumable operations with checkpoint-based state management
36 lines • 1.04 kB
JavaScript
/**
* Default Loop Transformer Plugin
* Wraps the existing LoopTransformer
*/
import { LoopTransformer } from '../../transformer/loop-transformer.js';
export class DefaultLoopTransformerPlugin {
name = 'atp-loop-transformer';
version = '1.0.0';
priority = 100;
transformer;
constructor(batchSizeThreshold) {
this.transformer = new LoopTransformer(batchSizeThreshold);
}
getVisitor(config) {
return {
ForOfStatement: (path) => {
this.transformer.transformForOfLoop(path);
},
WhileStatement: (path) => {
this.transformer.transformWhileLoop(path);
},
ForStatement: (path) => {
this.transformer.transformForLoop(path);
},
};
}
getMetadata() {
return {
loopCount: this.transformer.getTransformCount(),
};
}
reset() {
this.transformer.resetTransformCount();
}
}
//# sourceMappingURL=loop-transformer-plugin.js.map