bin/instrument.js
function processFile(argv, inputPath, opt_outputPath) {
  // Setup output path.
  var outputPath = opt_outputPath;
  if (!opt_outputPath) {
    var ext = path.extname(inputPath);
    if (ext.length) {
      outputPath = inputPath.substr(0, inputPath.length - ext.length) +
          '.instrumented' + ext;
    } else {
      outputPath = inputPath + '.instrumented.js';
    }
  }

  var sourceCode = fs.readFileSync(inputPath).toString();

  // TODO(benvanik): support setting the module ID?
  var targetCode = transformCode(0, inputPath, sourceCode, argv);

  console.log('Writing ' + outputPath + '...');
  fs.writeFileSync(outputPath, targetCode);
  fs.chmodSync(outputPath, fs.statSync(inputPath).mode);
}
function processFile(argv, inputPath, opt_outputPath) {
  // Setup output path.
  var outputPath = opt_outputPath;
  if (!opt_outputPath) {
    var ext = path.extname(inputPath);
    if (ext.length) {
      outputPath = inputPath.substr(0, inputPath.length - ext.length) +
          '.instrumented' + ext;
    } else {
      outputPath = inputPath + '.instrumented.js';
    }
  }

  var sourceCode = fs.readFileSync(inputPath).toString();

  // TODO(benvanik): support setting the module ID?
  var targetCode = transformCode(0, inputPath, sourceCode, argv);

  console.log('Writing ' + outputPath + '...');
  fs.writeFileSync(outputPath, targetCode);
  fs.chmodSync(outputPath, fs.statSync(inputPath).mode);
}
function processFile ( argv , inputPath , opt_outputPath ) { // Setup output path. var outputPath = opt_outputPath ; if ( ! opt_outputPath ) { var ext = path . extname ( inputPath ) ; if ( ext . length ) { outputPath = inputPath . substr ( 0 , inputPath . length - ext . length ) + '.instrumented' + ext ; } else { outputPath = inputPath + '.instrumented.js' ; } } var sourceCode = fs . readFileSync ( inputPath ) . toString ( ) ; // TODO(benvanik): support setting the module ID? var targetCode = transformCode ( 0 , inputPath , sourceCode , argv ) ; console . log ( 'Writing ' + outputPath + '...' ) ; fs . writeFileSync ( outputPath , targetCode ) ; fs . chmodSync ( outputPath , fs . statSync ( inputPath ) . mode ) ; }
Processes a single input file.
@param {!Object} argv Parsed arguments.
@param {string} inputPath Input file path.
@param {string=} opt_outputPath Output file path.
Processes a single input file .