code: @GwtIncompatible("Unnecessary")
    @VisibleForTesting
    void writeOutput(
        Appendable out,
        Compiler compiler,
        String code,
        String wrapper,
        String codePlaceholder,
        @Nullable Function<String, String> escaper)
        throws IOException {
      int pos = wrapper.indexOf(codePlaceholder);
      if (pos != -1) {
        String prefix = "";
  
        if (pos > 0) {
          prefix = wrapper.substring(0, pos);
          out.append(prefix);
        }
  
        out.append(escaper == null ? code : escaper.apply(code));
  
        int suffixStart = pos + codePlaceholder.length();
        if (suffixStart != wrapper.length()) {
          // Something after placeholder?
          out.append(wrapper.substring(suffixStart));
        }
        // Make sure we always end output with a line feed.
        out.append('\n');
  
        // If we have a source map, adjust its offsets to match
        // the code WITHIN the wrapper.
        if (compiler != null && compiler.getSourceMap() != null) {
          compiler.getSourceMap().setWrapperPrefix(prefix);
        }
  
      } else {
        out.append(code);
        out.append('\n');
      }
    }
docs: Writes code to an output stream, optionally wrapping it in an arbitrary wrapper that contains a
  placeholder where the code should be inserted.