ts-simple-ast
Version:
TypeScript compiler wrapper for AST navigation and code generation.
12 lines (10 loc) • 610 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
function getNewReplacementSourceFile(opts) {
const { insertPos, newText, sourceFile, replacingLength = 0 } = opts;
const currentText = sourceFile.getFullText();
const newFileText = currentText.substring(0, insertPos) + newText + currentText.substring(insertPos + replacingLength);
return sourceFile.global.compilerFactory.createTempSourceFileFromText(newFileText, sourceFile.getFilePath());
}
exports.getNewReplacementSourceFile = getNewReplacementSourceFile;
//# sourceMappingURL=getNewReplacementSourceFile.js.map