From 0b885ecaf79d85231e67122dc992e8e55c2d60d0 Mon Sep 17 00:00:00 2001 From: Alex Rickabaugh Date: Tue, 16 Oct 2018 11:33:47 -0700 Subject: [PATCH] refactor(ivy): rename ngtsc/factories to ngtsc/shims (#26495) This simple refactor of the build rules renames the .ngfactory.js shim generator to 'shims' instead of 'factories', in preparation for adding .ngsummary.js shim generation. Testing strategy: this commit does not introduce any new behavior and merely moves files and symbols around. It's sufficient that the existing ngtsc tests pass. PR Close #26495 --- packages/compiler-cli/BUILD.bazel | 2 +- packages/compiler-cli/src/ngtsc/program.ts | 4 ++-- .../compiler-cli/src/ngtsc/{factories => shims}/BUILD.bazel | 4 ++-- .../compiler-cli/src/ngtsc/{factories => shims}/README.md | 0 packages/compiler-cli/src/ngtsc/{factories => shims}/index.ts | 2 +- .../src/ngtsc/{factories => shims}/src/generator.ts | 0 .../compiler-cli/src/ngtsc/{factories => shims}/src/host.ts | 2 +- .../src/ngtsc/{factories => shims}/src/transform.ts | 0 8 files changed, 7 insertions(+), 7 deletions(-) rename packages/compiler-cli/src/ngtsc/{factories => shims}/BUILD.bazel (81%) rename packages/compiler-cli/src/ngtsc/{factories => shims}/README.md (100%) rename packages/compiler-cli/src/ngtsc/{factories => shims}/index.ts (86%) rename packages/compiler-cli/src/ngtsc/{factories => shims}/src/generator.ts (100%) rename packages/compiler-cli/src/ngtsc/{factories => shims}/src/host.ts (97%) rename packages/compiler-cli/src/ngtsc/{factories => shims}/src/transform.ts (100%) diff --git a/packages/compiler-cli/BUILD.bazel b/packages/compiler-cli/BUILD.bazel index 908473e806..0d44c69f53 100644 --- a/packages/compiler-cli/BUILD.bazel +++ b/packages/compiler-cli/BUILD.bazel @@ -27,8 +27,8 @@ ts_library( "//packages/compiler", "//packages/compiler-cli/src/ngtsc/annotations", "//packages/compiler-cli/src/ngtsc/diagnostics", - "//packages/compiler-cli/src/ngtsc/factories", "//packages/compiler-cli/src/ngtsc/metadata", + "//packages/compiler-cli/src/ngtsc/shims", "//packages/compiler-cli/src/ngtsc/switch", "//packages/compiler-cli/src/ngtsc/transform", "//packages/compiler-cli/src/ngtsc/typecheck", diff --git a/packages/compiler-cli/src/ngtsc/program.ts b/packages/compiler-cli/src/ngtsc/program.ts index 534853b531..2acd5e8eb4 100644 --- a/packages/compiler-cli/src/ngtsc/program.ts +++ b/packages/compiler-cli/src/ngtsc/program.ts @@ -15,9 +15,9 @@ import {nocollapseHack} from '../transformers/nocollapse_hack'; import {ComponentDecoratorHandler, DirectiveDecoratorHandler, InjectableDecoratorHandler, NgModuleDecoratorHandler, PipeDecoratorHandler, ResourceLoader, SelectorScopeRegistry} from './annotations'; import {BaseDefDecoratorHandler} from './annotations/src/base_def'; -import {FactoryGenerator, FactoryInfo, GeneratedFactoryHostWrapper, generatedFactoryTransform} from './factories'; import {TypeScriptReflectionHost} from './metadata'; import {FileResourceLoader, HostResourceLoader} from './resource_loader'; +import {FactoryGenerator, FactoryInfo, GeneratedShimsHostWrapper, generatedFactoryTransform} from './shims'; import {ivySwitchTransform} from './switch'; import {IvyCompilation, ivyTransformFactory} from './transform'; import {TypeCheckContext, TypeCheckProgramHost} from './typecheck'; @@ -65,7 +65,7 @@ export class NgtscProgram implements api.Program { this.sourceToFactorySymbols !.set(sourceFilePath, moduleSymbolNames); this.factoryToSourceInfo !.set(factoryPath, {sourceFilePath, moduleSymbolNames}); }); - this.host = new GeneratedFactoryHostWrapper(host, generator, factoryFileMap); + this.host = new GeneratedShimsHostWrapper(host, generator, factoryFileMap); } this.tsProgram = diff --git a/packages/compiler-cli/src/ngtsc/factories/BUILD.bazel b/packages/compiler-cli/src/ngtsc/shims/BUILD.bazel similarity index 81% rename from packages/compiler-cli/src/ngtsc/factories/BUILD.bazel rename to packages/compiler-cli/src/ngtsc/shims/BUILD.bazel index 1643e63d48..a586470276 100644 --- a/packages/compiler-cli/src/ngtsc/factories/BUILD.bazel +++ b/packages/compiler-cli/src/ngtsc/shims/BUILD.bazel @@ -3,12 +3,12 @@ package(default_visibility = ["//visibility:public"]) load("//tools:defaults.bzl", "ts_library") ts_library( - name = "factories", + name = "shims", srcs = glob([ "index.ts", "src/**/*.ts", ]), - module_name = "@angular/compiler-cli/src/ngtsc/factories", + module_name = "@angular/compiler-cli/src/ngtsc/shims", deps = [ "//packages/compiler", "//packages/compiler-cli/src/ngtsc/host", diff --git a/packages/compiler-cli/src/ngtsc/factories/README.md b/packages/compiler-cli/src/ngtsc/shims/README.md similarity index 100% rename from packages/compiler-cli/src/ngtsc/factories/README.md rename to packages/compiler-cli/src/ngtsc/shims/README.md diff --git a/packages/compiler-cli/src/ngtsc/factories/index.ts b/packages/compiler-cli/src/ngtsc/shims/index.ts similarity index 86% rename from packages/compiler-cli/src/ngtsc/factories/index.ts rename to packages/compiler-cli/src/ngtsc/shims/index.ts index 06052c6aa3..11875063a4 100644 --- a/packages/compiler-cli/src/ngtsc/factories/index.ts +++ b/packages/compiler-cli/src/ngtsc/shims/index.ts @@ -9,5 +9,5 @@ /// export {FactoryGenerator} from './src/generator'; -export {GeneratedFactoryHostWrapper} from './src/host'; +export {GeneratedShimsHostWrapper} from './src/host'; export {FactoryInfo, generatedFactoryTransform} from './src/transform'; diff --git a/packages/compiler-cli/src/ngtsc/factories/src/generator.ts b/packages/compiler-cli/src/ngtsc/shims/src/generator.ts similarity index 100% rename from packages/compiler-cli/src/ngtsc/factories/src/generator.ts rename to packages/compiler-cli/src/ngtsc/shims/src/generator.ts diff --git a/packages/compiler-cli/src/ngtsc/factories/src/host.ts b/packages/compiler-cli/src/ngtsc/shims/src/host.ts similarity index 97% rename from packages/compiler-cli/src/ngtsc/factories/src/host.ts rename to packages/compiler-cli/src/ngtsc/shims/src/host.ts index d2e0627c32..3a41022d2b 100644 --- a/packages/compiler-cli/src/ngtsc/factories/src/host.ts +++ b/packages/compiler-cli/src/ngtsc/shims/src/host.ts @@ -14,7 +14,7 @@ import {FactoryGenerator} from './generator'; /** * A wrapper around a `ts.CompilerHost` which supports generated files. */ -export class GeneratedFactoryHostWrapper implements ts.CompilerHost { +export class GeneratedShimsHostWrapper implements ts.CompilerHost { constructor( private delegate: ts.CompilerHost, private generator: FactoryGenerator, private factoryToSourceMap: Map) { diff --git a/packages/compiler-cli/src/ngtsc/factories/src/transform.ts b/packages/compiler-cli/src/ngtsc/shims/src/transform.ts similarity index 100% rename from packages/compiler-cli/src/ngtsc/factories/src/transform.ts rename to packages/compiler-cli/src/ngtsc/shims/src/transform.ts