Add support for JS transpilation mode to tsc_wrapped.

This mode makes it possible to process files that originated as JS sources, for instance in cases where tsc is used to transpile ES6+ into ES5.

Adds a flag to bazelOpts (isJsTranspilation), which is propagated to tsickle (see usage in https://github.com/angular/tsickle/pull/787). In the context of tsc_wrapped, this flag prevents some not entirely relevant checks from being run on non-TS sources.

PiperOrigin-RevId: 192745472
diff --git a/internal/tsc_wrapped/compiler_host.ts b/internal/tsc_wrapped/compiler_host.ts
index 0e262cd..99119d4 100644
--- a/internal/tsc_wrapped/compiler_host.ts
+++ b/internal/tsc_wrapped/compiler_host.ts
@@ -60,6 +60,7 @@
   transformDecorators: boolean;
   transformTypesToClosure: boolean;
   addDtsClutzAliases: boolean;
+  isJsTranspilation: boolean;
   options: BazelTsOptions;
   host: ts.ModuleResolutionHost = this;
 
@@ -101,6 +102,7 @@
     this.transformDecorators = bazelOpts.tsickle;
     this.transformTypesToClosure = bazelOpts.tsickle;
     this.addDtsClutzAliases = bazelOpts.addDtsClutzAliases;
+    this.isJsTranspilation = Boolean(bazelOpts.isJsTranspilation);
   }
 
   /**
@@ -135,7 +137,8 @@
 
   /** Avoid using tsickle on files that aren't in srcs[] */
   shouldSkipTsickleProcessing(fileName: string): boolean {
-    return this.bazelOpts.compilationTargetSrc.indexOf(fileName) === -1;
+    return this.bazelOpts.isJsTranspilation ||
+           this.bazelOpts.compilationTargetSrc.indexOf(fileName) === -1;
   }
 
   /** Whether the file is expected to be imported using a named module */
@@ -339,7 +342,11 @@
           `/// <amd-module name="${sourceFiles[0].moduleName}" />\n${content}`;
     }
     fileName = this.flattenOutDir(fileName);
-    if (!this.bazelOpts.es5Mode) {
+
+    if (this.bazelOpts.isJsTranspilation) {
+      // Write transpiled JS to *.dev_es5.js.
+      fileName = fileName.replace(/\.js$/, '.dev_es5.js');
+    } else if (!this.bazelOpts.es5Mode) {
       // Write ES6 transpiled files to *.closure.js.
       if (this.bazelOpts.locale) {
         // i18n paths are required to end with __locale.js so we put
diff --git a/internal/tsc_wrapped/tsconfig.ts b/internal/tsc_wrapped/tsconfig.ts
index 27c3bb5..2d7f197 100644
--- a/internal/tsc_wrapped/tsconfig.ts
+++ b/internal/tsc_wrapped/tsconfig.ts
@@ -137,6 +137,11 @@
    * on a ts_library.
    */
   moduleRoot?: string;
+
+  /**
+   * If true, indicates that this job is transpiling JS sources.
+   */
+  isJsTranspilation?: boolean;
 }
 
 export interface ParsedTsConfig {