text: "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  const ts = require("typescript");
  const compiler_helper_1 = require("./compiler-helper");
  const transformer_1 = require("./transformer");
  const typewiz_error_1 = require("./typewiz-error");
  function instrument(source, fileName, options) {
      const instrumentOptions = Object.assign({ instrumentCallExpressions: false, instrumentImplicitThis: false, skipTwizDeclarations: false }, options);
      const program = compiler_helper_1.getProgram(instrumentOptions);
      const sourceFile = program
          ? program.getSourceFile(fileName)
          : ts.createSourceFile(fileName, source, ts.ScriptTarget.Latest, true);
      if (!sourceFile) {
          throw new typewiz_error_1.TypewizError(`File not found: ${fileName}`);
      }
      const transformed = transformer_1.transformSourceFile(sourceFile, options, program);
      return ts.createPrinter().printFile(transformed);
  }
  exports.instrument = instrument;
  //# sourceMappingURL=instrument.js.map