build-system/tasks/helpers.js
/**
 * Minifies a given JavaScript file entry point.
 * @param {string} srcDir
 * @param {string} srcFilename
 * @param {string} destDir
 * @param {?Object} options
 * @return {!Promise}
 */
Minifies a given JavaScript file entry point.
Minifies a given JavaScript file entry point .
async function compileMinifiedJs(srcDir, srcFilename, destDir, options) {
  const timeInfo = {};
  const entryPoint = path.join(srcDir, srcFilename);
  const minifiedName = maybeToEsmName(options.minifiedName);
  options.errored = false;
  await closureCompile(entryPoint, destDir, minifiedName, options, timeInfo);
  if (options.watch && options.errored) {
    return;
  }
  const destPath = path.join(destDir, minifiedName);
  combineWithCompiledFile(srcFilename, destPath, options);
  if (options.aliasName) {
    fs.copySync(
      destPath,
      path.join(destDir, maybeToEsmName(options.aliasName))
    );
  }
  let name = minifiedName;
  if (options.aliasName) {
    name += ` → ${maybeToEsmName(options.aliasName)}`;
  }
  endBuildStep('Minified', name, timeInfo.startTime);
}
async function compileMinifiedJs ( srcDir , srcFilename , destDir , options ) { const timeInfo = { } ; const entryPoint = path . join ( srcDir , srcFilename ) ; const minifiedName = maybeToEsmName ( options . minifiedName ) ; options . errored = false ; await closureCompile ( entryPoint , destDir , minifiedName , options , timeInfo ) ; if ( options . watch && options . errored ) { return ; } const destPath = path . join ( destDir , minifiedName ) ; combineWithCompiledFile ( srcFilename , destPath , options ) ; if ( options . aliasName ) { fs . copySync ( destPath , path . join ( destDir , maybeToEsmName ( options . aliasName ) ) ) ; } let name = minifiedName ; if ( options . aliasName ) { name += ` ma ybeToEsmName(o p tions.a l iasName)} ` ; } endBuildStep ( 'Minified' , name , timeInfo . startTime ) ; }
Minifies a given JavaScript file entry point.
Minifies a given JavaScript file entry point .
// If an incremental watch build fails, simply return.