src/com/google/javascript/jscomp/AbstractCommandLineRunner.java
/**
   * Parses module wrapper specifications.
   *
   * @param specs A list of module wrapper specifications, not null. The spec format is: <code>
   *     name:wrapper</code>. Wrappers.
   * @param chunks The JS chunks whose wrappers are specified
   * @return A map from module name to module wrapper. Modules with no wrapper will have the empty
   *     string as their value in this map.
   */
Parses module wrapper specifications.
@param specs A list of module wrapper specifications, not null. The spec format is:
name:wrapper. Wrappers.
@param chunks The JS chunks whose wrappers are specified
@return A map from module name to module wrapper. Modules with no wrapper will have the empty
string as their value in this map.
Parses module wrapper specifications . @param specs A list of module wrapper specifications not null . The spec format is : name : wrapper . Wrappers . @param chunks The JS chunks whose wrappers are specified @return A map from module name to module wrapper . Modules with no wrapper will have the empty string as their value in this map .
public static Map<String, String> parseModuleWrappers(
      List<String> specs, Iterable<JSModule> chunks) {
    checkState(specs != null);
    Map<String, String> wrappers = new HashMap<>();
    for (JSModule c : chunks) {
      wrappers.put(c.getName(), "");
    }
    for (String spec : specs) {
      int pos = spec.indexOf(':');
      if (pos == -1) {
        throw new FlagUsageException(
            "Expected module wrapper to have " + "<name>:<wrapper> format: " + spec);
      }
      String name = spec.substring(0, pos);
      if (!wrappers.containsKey(name)) {
        throw new FlagUsageException("Unknown module: '" + name + "'");
      }
      String wrapper = spec.substring(pos + 1);
      wrapper = wrapper.replace("%output%", "%s").replace("%n%", "\n");
      if (!wrapper.contains("%s")) {
        throw new FlagUsageException("No %s placeholder in module wrapper: '" + wrapper + "'");
      }
      wrappers.put(name, wrapper);
    }
    return wrappers;
  }
public static Map < String , String > parseModuleWrappers ( List < String > specs , Iterable < JSModule > chunks ) { checkState ( specs != null ) ; Map < String , String > wrappers = new HashMap < > ( ) ; for ( JSModule c : chunks ) { wrappers . put ( c . getName ( ) , "" ) ; } for ( String spec : specs ) { int pos = spec . indexOf ( ':' ) ; if ( pos == - 1 ) { throw new FlagUsageException ( "Expected module wrapper to have " + "<name>:<wrapper> format: " + spec ) ; } String name = spec . substring ( 0 , pos ) ; if ( ! wrappers . containsKey ( name ) ) { throw new FlagUsageException ( "Unknown module: '" + name + "'" ) ; } String wrapper = spec . substring ( pos + 1 ) ; wrapper = wrapper . replace ( "%output%" , "%s" ) . replace ( "%n%" , "\n" ) ; if ( ! wrapper . contains ( "%s" ) ) { throw new FlagUsageException ( "No %s placeholder in module wrapper: '" + wrapper + "'" ) ; } wrappers . put ( name , wrapper ) ; } return wrappers ; }
Parses module wrapper specifications.
Parses module wrapper specifications .
// Prepopulate the map with module names. // Format is "<name>:<wrapper>". // Parse module name. // Support for %n% and %output%