From 7ffb75f476bacb50088f0151d983db838069d02b Mon Sep 17 00:00:00 2001 From: Tobias Bosch Date: Thu, 25 May 2017 18:02:35 -0700 Subject: [PATCH] refactor(compiler): change `bundle` to `flatModuleIndex` in the code (#17028) --- build.sh | 2 +- packages/compiler-cli/src/compiler_host.ts | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/build.sh b/build.sh index 36b982e95c..6e9827092c 100755 --- a/build.sh +++ b/build.sh @@ -266,7 +266,7 @@ compilePackage() { $NGC -p ${1}/tsconfig-build.json echo "====== Create ${1}/../${package_name}.d.ts re-export file for Closure" echo "$(cat ${LICENSE_BANNER}) ${N} export * from './${package_name}/index'" > ${2}/../${package_name}.d.ts - echo "{\"__symbolic\":\"module\",\"version\":3,\"metadata\":{},\"exports\":[{\"from\":\"./${package_name}/index\"}],\"bundleRedirect\":true}" > ${2}/../${package_name}.metadata.json + echo "{\"__symbolic\":\"module\",\"version\":3,\"metadata\":{},\"exports\":[{\"from\":\"./${package_name}/index\"}],\"flatModuleIndexRedirect\":true}" > ${2}/../${package_name}.metadata.json fi for DIR in ${1}/* ; do diff --git a/packages/compiler-cli/src/compiler_host.ts b/packages/compiler-cli/src/compiler_host.ts index e9bc4e2a90..afb1d6f4a8 100644 --- a/packages/compiler-cli/src/compiler_host.ts +++ b/packages/compiler-cli/src/compiler_host.ts @@ -31,9 +31,9 @@ export class CompilerHost implements AotCompilerHost { protected basePath: string; private genDir: string; private resolverCache = new Map(); - private bundleIndexCache = new Map(); - private bundleIndexNames = new Set(); - private bundleRedirectNames = new Set(); + private flatModuleIndexCache = new Map(); + private flatModuleIndexNames = new Set(); + private flatModuleIndexRedirectNames = new Set(); private moduleFileNames = new Map(); protected resolveModuleNameHost: CompilerHostContext; @@ -281,8 +281,8 @@ export class CompilerHost implements AotCompilerHost { // Check for a bundle index. if (this.hasBundleIndex(filePath)) { const normalFilePath = path.normalize(filePath); - return this.bundleIndexNames.has(normalFilePath) || - this.bundleRedirectNames.has(normalFilePath); + return this.flatModuleIndexNames.has(normalFilePath) || + this.flatModuleIndexRedirectNames.has(normalFilePath); } } return true; @@ -313,7 +313,7 @@ export class CompilerHost implements AotCompilerHost { private hasBundleIndex(filePath: string): boolean { const checkBundleIndex = (directory: string): boolean => { - let result = this.bundleIndexCache.get(directory); + let result = this.flatModuleIndexCache.get(directory); if (result == null) { if (path.basename(directory) == 'node_module') { // Don't look outside the node_modules this package is installed in. @@ -333,14 +333,14 @@ export class CompilerHost implements AotCompilerHost { const metadataFile = typings.replace(DTS, '.metadata.json'); if (this.context.fileExists(metadataFile)) { const metadata = JSON.parse(this.context.readFile(metadataFile)); - if (metadata.bundleRedirect) { - this.bundleRedirectNames.add(typings); + if (metadata.flatModuleIndexRedirect) { + this.flatModuleIndexRedirectNames.add(typings); // Note: don't set result = true, // as this would mark this folder // as having a bundleIndex too early without // filling the bundleIndexNames. } else if (metadata.importAs) { - this.bundleIndexNames.add(typings); + this.flatModuleIndexNames.add(typings); result = true; } } @@ -360,7 +360,7 @@ export class CompilerHost implements AotCompilerHost { result = false; } } - this.bundleIndexCache.set(directory, result); + this.flatModuleIndexCache.set(directory, result); } return result; };