tools/scan_deps.js
function genAddDependency(basePath, provideMap, requireMap) {
  var provide = provideMap.getAllProvides();
  var require = requireMap.getAllRequires();
  var set = new Set();

  provide.forEach(function(value, key) {
    set.add(key);
  });
  require.forEach(function(value, key) {
    set.add(key);
  });

  var results = [];
  set.forEach(function(key) {
    var relativeServePath = pathMod.join(
        '../../', pathMod.relative(basePath, key));

    if (osMod.platform().indexOf('win') != -1) {
      // For the case of Windows relativeServePath contains backslashes. Need to
      // escape the backward slash, otherwise it will not appear in the deps.js
      // file correctly. An alternative would be to convert backslashes to
      // forward slashes which works just as fine in the context of a browser.
      relativeServePath = relativeServePath.replace(/\\/g, '\\\\');
    }
    var line = 'goog.addDependency("' + relativeServePath + '", ';

    var isModule = false;
    if (provide.has(key)) {
      var value = /** @type {!Array<string>} */ (provide.get(key));
      line += JSON.stringify(value) + ', ';
      isModule = provideMap.isModule(key);
    } else {
      line += '[], ';
    }

    if (require.has(key)) {
      line += JSON.stringify(require.get(key));
    } else {
      line += '[]';
    }

    line += isModule ? ', true);' : ');';
    results.push(line);
  });

  return results;
}
function genAddDependency(basePath, provideMap, requireMap) {
  var provide = provideMap.getAllProvides();
  var require = requireMap.getAllRequires();
  var set = new Set();

  provide.forEach(function(value, key) {
    set.add(key);
  });
  require.forEach(function(value, key) {
    set.add(key);
  });

  var results = [];
  set.forEach(function(key) {
    var relativeServePath = pathMod.join(
        '../../', pathMod.relative(basePath, key));

    if (osMod.platform().indexOf('win') != -1) {
      // For the case of Windows relativeServePath contains backslashes. Need to
      // escape the backward slash, otherwise it will not appear in the deps.js
      // file correctly. An alternative would be to convert backslashes to
      // forward slashes which works just as fine in the context of a browser.
      relativeServePath = relativeServePath.replace(/\\/g, '\\\\');
    }
    var line = 'goog.addDependency("' + relativeServePath + '", ';

    var isModule = false;
    if (provide.has(key)) {
      var value = /** @type {!Array<string>} */ (provide.get(key));
      line += JSON.stringify(value) + ', ';
      isModule = provideMap.isModule(key);
    } else {
      line += '[], ';
    }

    if (require.has(key)) {
      line += JSON.stringify(require.get(key));
    } else {
      line += '[]';
    }

    line += isModule ? ', true);' : ');';
    results.push(line);
  });

  return results;
}
function genAddDependency ( basePath , provideMap , requireMap ) { var provide = provideMap . getAllProvides ( ) ; var require = requireMap . getAllRequires ( ) ; var set = new Set ( ) ; provide . forEach ( function ( value , key ) { set . add ( key ) ; } ) ; require . forEach ( function ( value , key ) { set . add ( key ) ; } ) ; var results = [ ] ; set . forEach ( function ( key ) { var relativeServePath = pathMod . join ( '../../' , pathMod . relative ( basePath , key ) ) ; if ( osMod . platform ( ) . indexOf ( 'win' ) != - 1 ) { // For the case of Windows relativeServePath contains backslashes. Need to // escape the backward slash, otherwise it will not appear in the deps.js // file correctly. An alternative would be to convert backslashes to // forward slashes which works just as fine in the context of a browser. relativeServePath = relativeServePath . replace ( / \\ / g , '\\\\' ) ; } var line = 'goog.addDependency("' + relativeServePath + '", ' ; var isModule = false ; if ( provide . has ( key ) ) { var value = /** @type {!Array<string>} */ ( provide . get ( key ) ) ; line += JSON . stringify ( value ) + ', ' ; isModule = provideMap . isModule ( key ) ; } else { line += '[], ' ; } if ( require . has ( key ) ) { line += JSON . stringify ( require . get ( key ) ) ; } else { line += '[]' ; } line += isModule ? ', true);' : ');' ; results . push ( line ) ; } ) ; return results ; }
Generates goog.addDependency.
@param {string} basePath
@param {!ProvideMap_} provideMap
@param {!RequireMap_} requireMap
@return {!Array<string>}
Generates goog . addDependency .