ng-packagr 22.0.1 → 22.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-packagr",
3
- "version": "22.0.1",
3
+ "version": "22.0.2",
4
4
  "description": "Compile and package Angular libraries in Angular Package Format (APF)",
5
5
  "keywords": [
6
6
  "apf",
@@ -166,7 +166,7 @@ async function compileSourceFiles(graph, tsConfig, moduleResolutionCache, option
166
166
  }
167
167
  }
168
168
  if (otherDiagnostics.length) {
169
- log.msg(formatDiagnostics(errorDiagnostics));
169
+ log.msg(formatDiagnostics(otherDiagnostics));
170
170
  }
171
171
  if (errorDiagnostics.length) {
172
172
  throw new Error(formatDiagnostics(errorDiagnostics));
@@ -1 +1 @@
1
- {"version":3,"file":"compile-source-files.js","sourceRoot":"","sources":["../../../../src/lib/ngc/compile-source-files.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,gDA+MC;AAxND,yCAAiC;AACjC,4DAA4B;AAE5B,+CAAgF;AAGhF,mEAA4F;AAC5F,kDAAoC;AAE7B,KAAK,UAAU,kBAAkB,CACtC,KAAiB,EACjB,QAA6B,EAC7B,qBAA+C,EAC/C,OAAyB,EACzB,YAAuC,EACvC,mBAAyC;IAEzC,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAE,GAAG,wDAAa,uBAAuB,GAAC,CAAC;IAClF,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IACxD,MAAM,eAAe,GAAoB,EAAE,GAAG,QAAQ,CAAC,OAAO,EAAE,GAAG,YAAY,EAAE,CAAC;IAClF,MAAM,UAAU,GAAG,IAAA,gCAAwB,EAAC,KAAK,CAAC,CAAC;IACnD,MAAM,aAAa,GAAG,IAAA,uBAAe,EAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,mBAAm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;IACvD,CAAC;IAED,MAAM,YAAY,GAAG,eAAe,CAAC,WAAW,EAAE,CAAC,YAAY,CAAC;IAEhE,IAAI,0CAA0C,IAAI,OAAO,EAAE,CAAC;QAC1D,OACE,OAAO,CAAC,oBAAoB,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE;YACxF,IAAI,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;gBACtC,cAAc,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;YACrF,CAAC;QACH,CAAC,CAAC,EACF,CAAC;YACD,QAAQ;QACV,CAAC;IACH,CAAC;IAED,KAAK,MAAM,UAAU,IAAI,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;QAClD,IAAI,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YAClC,SAAS;QACX,CAAC;QAED,IAAI,eAAe,CAAC,sBAAsB,CAAC,cAAc,CAAC,UAAU,CAAC,EAAE,CAAC;YACtE,SAAS;QACX,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;QACxE,eAAe,CAAC,sBAAsB,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC","sourcesContent":["import { CompilerOptions, ParsedConfiguration } from '@angular/compiler-cli';\nimport { join } from 'node:path';\nimport ts from 'typescript';\nimport { BuildGraph } from '../graph/build-graph';\nimport { findEntryPointInProgress, findPackageNode } from '../ng-package/nodes';\nimport { NgPackagrOptions } from '../ng-package/options.di';\nimport { StylesheetProcessor } from '../styles/stylesheet-processor';\nimport { augmentProgramWithVersioning, cacheCompilerHost } from '../ts/cache-compiler-host';\nimport * as log from '../utils/log';\n\nexport async function compileSourceFiles(\n graph: BuildGraph,\n tsConfig: ParsedConfiguration,\n moduleResolutionCache: ts.ModuleResolutionCache,\n options: NgPackagrOptions,\n extraOptions?: Partial<CompilerOptions>,\n stylesheetProcessor?: StylesheetProcessor,\n) {\n const { NgtscProgram, formatDiagnostics } = await import('@angular/compiler-cli');\n const { cacheDirectory, watch, cacheEnabled } = options;\n const tsConfigOptions: CompilerOptions = { ...tsConfig.options, ...extraOptions };\n const entryPoint = findEntryPointInProgress(graph);\n const ngPackageNode = findPackageNode(graph);\n const inlineStyleLanguage = ngPackageNode.data.inlineStyleLanguage;\n\n const cacheDir = cacheEnabled && cacheDirectory;\n if (cacheDir) {\n tsConfigOptions.incremental ??= true;\n tsConfigOptions.tsBuildInfoFile ??= join(\n cacheDir,\n `tsbuildinfo/${entryPoint.data.entryPoint.flatModuleFile}.tsbuildinfo`,\n );\n }\n\n const tsCompilerHost = cacheCompilerHost(\n graph,\n entryPoint,\n tsConfigOptions,\n moduleResolutionCache,\n stylesheetProcessor,\n inlineStyleLanguage,\n );\n\n const cache = entryPoint.cache;\n let usingBuildInfo = false;\n\n let oldBuilder = cache.oldBuilder;\n if (!oldBuilder && cacheDir) {\n oldBuilder = ts.readBuilderProgram(tsConfigOptions, tsCompilerHost);\n usingBuildInfo = true;\n }\n\n // Create the Angular specific program that contains the Angular compiler\n const angularProgram = new NgtscProgram(tsConfig.rootNames, tsConfigOptions, tsCompilerHost, cache.oldNgtscProgram);\n\n const angularCompiler = angularProgram.compiler;\n const { ignoreForDiagnostics, ignoreForEmit } = angularCompiler;\n\n // SourceFile versions are required for builder programs.\n // The wrapped host inside NgtscProgram adds additional files that will not have versions.\n const typeScriptProgram = angularProgram.getTsProgram();\n augmentProgramWithVersioning(typeScriptProgram);\n\n let builder: ts.BuilderProgram | ts.EmitAndSemanticDiagnosticsBuilderProgram;\n if (watch || cacheDir) {\n builder = cache.oldBuilder = ts.createEmitAndSemanticDiagnosticsBuilderProgram(\n typeScriptProgram,\n tsCompilerHost,\n oldBuilder,\n );\n cache.oldNgtscProgram = angularProgram;\n } else {\n builder = ts.createEmitAndSemanticDiagnosticsBuilderProgram(typeScriptProgram, tsCompilerHost);\n }\n\n // Update semantic diagnostics cache\n const affectedFiles = new Set<ts.SourceFile>();\n\n // Analyze affected files when in watch mode for incremental type checking\n if ('getSemanticDiagnosticsOfNextAffectedFile' in builder) {\n while (true) {\n const result = builder.getSemanticDiagnosticsOfNextAffectedFile(undefined, sourceFile => {\n // If the affected file is a TTC shim, add the shim's original source file.\n // This ensures that changes that affect TTC are typechecked even when the changes\n // are otherwise unrelated from a TS perspective and do not result in Ivy codegen changes.\n // For example, changing @Input property types of a directive used in another component's\n // template.\n if (ignoreForDiagnostics.has(sourceFile) && sourceFile.fileName.endsWith('.ngtypecheck.ts')) {\n // This file name conversion relies on internal compiler logic and should be converted\n // to an official method when available. 15 is length of `.ngtypecheck.ts`\n const originalFilename = sourceFile.fileName.slice(0, -15) + '.ts';\n const originalSourceFile = builder.getSourceFile(originalFilename);\n if (originalSourceFile) {\n affectedFiles.add(originalSourceFile);\n }\n\n return true;\n }\n\n return false;\n });\n\n if (!result) {\n break;\n }\n\n affectedFiles.add(result.affected as ts.SourceFile);\n }\n\n // Add all files with associated template type checking files.\n // Stored TS build info does not have knowledge of the AOT compiler or the typechecking state of the templates.\n // To ensure that errors are reported correctly, all AOT component diagnostics need to be analyzed even if build\n // info is present.\n if (usingBuildInfo) {\n for (const sourceFile of builder.getSourceFiles()) {\n if (ignoreForDiagnostics.has(sourceFile) && sourceFile.fileName.endsWith('.ngtypecheck.ts')) {\n // This file name conversion relies on internal compiler logic and should be converted\n // to an official method when available. 15 is length of `.ngtypecheck.ts`\n const originalFilename = sourceFile.fileName.slice(0, -15) + '.ts';\n const originalSourceFile = builder.getSourceFile(originalFilename);\n if (originalSourceFile) {\n affectedFiles.add(originalSourceFile);\n }\n }\n }\n }\n }\n\n // Collect program level diagnostics\n const allDiagnostics: ts.Diagnostic[] = [\n ...angularCompiler.getOptionDiagnostics(),\n ...builder.getOptionsDiagnostics(),\n ...builder.getGlobalDiagnostics(),\n ];\n\n // Required to support asynchronous resource loading\n // Must be done before creating transformers or getting template diagnostics\n await angularCompiler.analyzeAsync();\n\n // Collect source file specific diagnostics\n const angularDiagnosticCache = cache.angularDiagnosticCache;\n for (const sourceFile of builder.getSourceFiles()) {\n if (ignoreForDiagnostics.has(sourceFile)) {\n continue;\n }\n\n allDiagnostics.push(\n ...builder.getSyntacticDiagnostics(sourceFile),\n ...builder.getSemanticDiagnostics(sourceFile),\n // We use the `typeScriptProgram` instead of `builder` here as a\n // performance workaround for: https://github.com/microsoft/TypeScript/issues/60970\n ...typeScriptProgram.getDeclarationDiagnostics(sourceFile),\n );\n\n // Declaration files cannot have template diagnostics\n if (sourceFile.isDeclarationFile) {\n continue;\n }\n\n // Only request Angular template diagnostics for affected files to avoid\n // overhead of template diagnostics for unchanged files.\n if (affectedFiles.has(sourceFile) || !angularDiagnosticCache.has(sourceFile)) {\n const angularDiagnostics = angularCompiler.getDiagnosticsForFile(\n sourceFile,\n affectedFiles.size === 1 ? /** OptimizeFor.SingleFile **/ 0 : /** OptimizeFor.WholeProgram */ 1,\n );\n\n angularDiagnosticCache.update(sourceFile, angularDiagnostics);\n }\n\n allDiagnostics.push(...angularDiagnosticCache.get(sourceFile));\n }\n\n const otherDiagnostics = [];\n const errorDiagnostics = [];\n for (const diagnostic of allDiagnostics) {\n if (diagnostic.category === ts.DiagnosticCategory.Error) {\n errorDiagnostics.push(diagnostic);\n } else {\n otherDiagnostics.push(diagnostic);\n }\n }\n\n if (otherDiagnostics.length) {\n log.msg(formatDiagnostics(errorDiagnostics));\n }\n\n if (errorDiagnostics.length) {\n throw new Error(formatDiagnostics(errorDiagnostics));\n }\n\n const transformers = angularCompiler.prepareEmit().transformers;\n\n if ('getSemanticDiagnosticsOfNextAffectedFile' in builder) {\n while (\n builder.emitNextAffectedFile((fileName, data, writeByteOrderMark, onError, sourceFiles) => {\n if (fileName.endsWith('.tsbuildinfo')) {\n tsCompilerHost.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles);\n }\n })\n ) {\n // empty\n }\n }\n\n for (const sourceFile of builder.getSourceFiles()) {\n if (ignoreForEmit.has(sourceFile)) {\n continue;\n }\n\n if (angularCompiler.incrementalCompilation.safeToSkipEmit(sourceFile)) {\n continue;\n }\n\n builder.emit(sourceFile, undefined, undefined, undefined, transformers);\n angularCompiler.incrementalCompilation.recordSuccessfulEmit(sourceFile);\n }\n}\n"]}
1
+ {"version":3,"file":"compile-source-files.js","sourceRoot":"","sources":["../../../../src/lib/ngc/compile-source-files.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,gDA+MC;AAxND,yCAAiC;AACjC,4DAA4B;AAE5B,+CAAgF;AAGhF,mEAA4F;AAC5F,kDAAoC;AAE7B,KAAK,UAAU,kBAAkB,CACtC,KAAiB,EACjB,QAA6B,EAC7B,qBAA+C,EAC/C,OAAyB,EACzB,YAAuC,EACvC,mBAAyC;IAEzC,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAE,GAAG,wDAAa,uBAAuB,GAAC,CAAC;IAClF,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IACxD,MAAM,eAAe,GAAoB,EAAE,GAAG,QAAQ,CAAC,OAAO,EAAE,GAAG,YAAY,EAAE,CAAC;IAClF,MAAM,UAAU,GAAG,IAAA,gCAAwB,EAAC,KAAK,CAAC,CAAC;IACnD,MAAM,aAAa,GAAG,IAAA,uBAAe,EAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,mBAAmB,GAAG,aAAa,CAAC,IAAI,CAAC,mBAAmB,CAAC;IAEnE,MAAM,QAAQ,GAAG,YAAY,IAAI,cAAc,CAAC;IAChD,IAAI,QAAQ,EAAE,CAAC;QACb,eAAe,CAAC,WAAW,KAAK,IAAI,CAAC;QACrC,eAAe,CAAC,eAAe,KAAK,IAAA,gBAAI,EACtC,QAAQ,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EAAE,EAAE;YACxF,IAAI,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;gBACtC,cAAc,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;YACrF,CAAC;QACH,CAAC,CAAC,EACF,CAAC;YACD,QAAQ;QACV,CAAC;IACH,CAAC;IAED,KAAK,MAAM,UAAU,IAAI,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;QAClD,IAAI,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YAClC,SAAS;QACX,CAAC;QAED,IAAI,eAAe,CAAC,sBAAsB,CAAC,cAAc,CAAC,UAAU,CAAC,EAAE,CAAC;YACtE,SAAS;QACX,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;QACxE,eAAe,CAAC,sBAAsB,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC","sourcesContent":["import { CompilerOptions, ParsedConfiguration } from '@angular/compiler-cli';\nimport { join } from 'node:path';\nimport ts from 'typescript';\nimport { BuildGraph } from '../graph/build-graph';\nimport { findEntryPointInProgress, findPackageNode } from '../ng-package/nodes';\nimport { NgPackagrOptions } from '../ng-package/options.di';\nimport { StylesheetProcessor } from '../styles/stylesheet-processor';\nimport { augmentProgramWithVersioning, cacheCompilerHost } from '../ts/cache-compiler-host';\nimport * as log from '../utils/log';\n\nexport async function compileSourceFiles(\n graph: BuildGraph,\n tsConfig: ParsedConfiguration,\n moduleResolutionCache: ts.ModuleResolutionCache,\n options: NgPackagrOptions,\n extraOptions?: Partial<CompilerOptions>,\n stylesheetProcessor?: StylesheetProcessor,\n) {\n const { NgtscProgram, formatDiagnostics } = await import('@angular/compiler-cli');\n const { cacheDirectory, watch, cacheEnabled } = options;\n const tsConfigOptions: CompilerOptions = { ...tsConfig.options, ...extraOptions };\n const entryPoint = findEntryPointInProgress(graph);\n const ngPackageNode = findPackageNode(graph);\n const inlineStyleLanguage = ngPackageNode.data.inlineStyleLanguage;\n\n const cacheDir = cacheEnabled && cacheDirectory;\n if (cacheDir) {\n tsConfigOptions.incremental ??= true;\n tsConfigOptions.tsBuildInfoFile ??= join(\n cacheDir,\n `tsbuildinfo/${entryPoint.data.entryPoint.flatModuleFile}.tsbuildinfo`,\n );\n }\n\n const tsCompilerHost = cacheCompilerHost(\n graph,\n entryPoint,\n tsConfigOptions,\n moduleResolutionCache,\n stylesheetProcessor,\n inlineStyleLanguage,\n );\n\n const cache = entryPoint.cache;\n let usingBuildInfo = false;\n\n let oldBuilder = cache.oldBuilder;\n if (!oldBuilder && cacheDir) {\n oldBuilder = ts.readBuilderProgram(tsConfigOptions, tsCompilerHost);\n usingBuildInfo = true;\n }\n\n // Create the Angular specific program that contains the Angular compiler\n const angularProgram = new NgtscProgram(tsConfig.rootNames, tsConfigOptions, tsCompilerHost, cache.oldNgtscProgram);\n\n const angularCompiler = angularProgram.compiler;\n const { ignoreForDiagnostics, ignoreForEmit } = angularCompiler;\n\n // SourceFile versions are required for builder programs.\n // The wrapped host inside NgtscProgram adds additional files that will not have versions.\n const typeScriptProgram = angularProgram.getTsProgram();\n augmentProgramWithVersioning(typeScriptProgram);\n\n let builder: ts.BuilderProgram | ts.EmitAndSemanticDiagnosticsBuilderProgram;\n if (watch || cacheDir) {\n builder = cache.oldBuilder = ts.createEmitAndSemanticDiagnosticsBuilderProgram(\n typeScriptProgram,\n tsCompilerHost,\n oldBuilder,\n );\n cache.oldNgtscProgram = angularProgram;\n } else {\n builder = ts.createEmitAndSemanticDiagnosticsBuilderProgram(typeScriptProgram, tsCompilerHost);\n }\n\n // Update semantic diagnostics cache\n const affectedFiles = new Set<ts.SourceFile>();\n\n // Analyze affected files when in watch mode for incremental type checking\n if ('getSemanticDiagnosticsOfNextAffectedFile' in builder) {\n while (true) {\n const result = builder.getSemanticDiagnosticsOfNextAffectedFile(undefined, sourceFile => {\n // If the affected file is a TTC shim, add the shim's original source file.\n // This ensures that changes that affect TTC are typechecked even when the changes\n // are otherwise unrelated from a TS perspective and do not result in Ivy codegen changes.\n // For example, changing @Input property types of a directive used in another component's\n // template.\n if (ignoreForDiagnostics.has(sourceFile) && sourceFile.fileName.endsWith('.ngtypecheck.ts')) {\n // This file name conversion relies on internal compiler logic and should be converted\n // to an official method when available. 15 is length of `.ngtypecheck.ts`\n const originalFilename = sourceFile.fileName.slice(0, -15) + '.ts';\n const originalSourceFile = builder.getSourceFile(originalFilename);\n if (originalSourceFile) {\n affectedFiles.add(originalSourceFile);\n }\n\n return true;\n }\n\n return false;\n });\n\n if (!result) {\n break;\n }\n\n affectedFiles.add(result.affected as ts.SourceFile);\n }\n\n // Add all files with associated template type checking files.\n // Stored TS build info does not have knowledge of the AOT compiler or the typechecking state of the templates.\n // To ensure that errors are reported correctly, all AOT component diagnostics need to be analyzed even if build\n // info is present.\n if (usingBuildInfo) {\n for (const sourceFile of builder.getSourceFiles()) {\n if (ignoreForDiagnostics.has(sourceFile) && sourceFile.fileName.endsWith('.ngtypecheck.ts')) {\n // This file name conversion relies on internal compiler logic and should be converted\n // to an official method when available. 15 is length of `.ngtypecheck.ts`\n const originalFilename = sourceFile.fileName.slice(0, -15) + '.ts';\n const originalSourceFile = builder.getSourceFile(originalFilename);\n if (originalSourceFile) {\n affectedFiles.add(originalSourceFile);\n }\n }\n }\n }\n }\n\n // Collect program level diagnostics\n const allDiagnostics: ts.Diagnostic[] = [\n ...angularCompiler.getOptionDiagnostics(),\n ...builder.getOptionsDiagnostics(),\n ...builder.getGlobalDiagnostics(),\n ];\n\n // Required to support asynchronous resource loading\n // Must be done before creating transformers or getting template diagnostics\n await angularCompiler.analyzeAsync();\n\n // Collect source file specific diagnostics\n const angularDiagnosticCache = cache.angularDiagnosticCache;\n for (const sourceFile of builder.getSourceFiles()) {\n if (ignoreForDiagnostics.has(sourceFile)) {\n continue;\n }\n\n allDiagnostics.push(\n ...builder.getSyntacticDiagnostics(sourceFile),\n ...builder.getSemanticDiagnostics(sourceFile),\n // We use the `typeScriptProgram` instead of `builder` here as a\n // performance workaround for: https://github.com/microsoft/TypeScript/issues/60970\n ...typeScriptProgram.getDeclarationDiagnostics(sourceFile),\n );\n\n // Declaration files cannot have template diagnostics\n if (sourceFile.isDeclarationFile) {\n continue;\n }\n\n // Only request Angular template diagnostics for affected files to avoid\n // overhead of template diagnostics for unchanged files.\n if (affectedFiles.has(sourceFile) || !angularDiagnosticCache.has(sourceFile)) {\n const angularDiagnostics = angularCompiler.getDiagnosticsForFile(\n sourceFile,\n affectedFiles.size === 1 ? /** OptimizeFor.SingleFile **/ 0 : /** OptimizeFor.WholeProgram */ 1,\n );\n\n angularDiagnosticCache.update(sourceFile, angularDiagnostics);\n }\n\n allDiagnostics.push(...angularDiagnosticCache.get(sourceFile));\n }\n\n const otherDiagnostics = [];\n const errorDiagnostics = [];\n for (const diagnostic of allDiagnostics) {\n if (diagnostic.category === ts.DiagnosticCategory.Error) {\n errorDiagnostics.push(diagnostic);\n } else {\n otherDiagnostics.push(diagnostic);\n }\n }\n\n if (otherDiagnostics.length) {\n log.msg(formatDiagnostics(otherDiagnostics));\n }\n\n if (errorDiagnostics.length) {\n throw new Error(formatDiagnostics(errorDiagnostics));\n }\n\n const transformers = angularCompiler.prepareEmit().transformers;\n\n if ('getSemanticDiagnosticsOfNextAffectedFile' in builder) {\n while (\n builder.emitNextAffectedFile((fileName, data, writeByteOrderMark, onError, sourceFiles) => {\n if (fileName.endsWith('.tsbuildinfo')) {\n tsCompilerHost.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles);\n }\n })\n ) {\n // empty\n }\n }\n\n for (const sourceFile of builder.getSourceFiles()) {\n if (ignoreForEmit.has(sourceFile)) {\n continue;\n }\n\n if (angularCompiler.incrementalCompilation.safeToSkipEmit(sourceFile)) {\n continue;\n }\n\n builder.emit(sourceFile, undefined, undefined, undefined, transformers);\n angularCompiler.incrementalCompilation.recordSuccessfulEmit(sourceFile);\n }\n}\n"]}