Revert "refactor(compiler): change `bundle` to `flatModuleIndex` in the code (#17028)"
This reverts commit 5aa53d70aa
.
This commit is contained in:
parent
694951096c
commit
80e506563c
2
build.sh
2
build.sh
|
@ -266,7 +266,7 @@ compilePackage() {
|
||||||
$NGC -p ${1}/tsconfig-build.json
|
$NGC -p ${1}/tsconfig-build.json
|
||||||
echo "====== Create ${1}/../${package_name}.d.ts re-export file for Closure"
|
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 "$(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\"}],\"flatModuleIndexRedirect\":true}" > ${2}/../${package_name}.metadata.json
|
echo "{\"__symbolic\":\"module\",\"version\":3,\"metadata\":{},\"exports\":[{\"from\":\"./${package_name}/index\"}],\"bundleRedirect\":true}" > ${2}/../${package_name}.metadata.json
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for DIR in ${1}/* ; do
|
for DIR in ${1}/* ; do
|
||||||
|
|
|
@ -31,9 +31,9 @@ export class CompilerHost implements AotCompilerHost {
|
||||||
protected basePath: string;
|
protected basePath: string;
|
||||||
private genDir: string;
|
private genDir: string;
|
||||||
private resolverCache = new Map<string, ModuleMetadata[]>();
|
private resolverCache = new Map<string, ModuleMetadata[]>();
|
||||||
private flatModuleIndexCache = new Map<string, boolean>();
|
private bundleIndexCache = new Map<string, boolean>();
|
||||||
private flatModuleIndexNames = new Set<string>();
|
private bundleIndexNames = new Set<string>();
|
||||||
private flatModuleIndexRedirectNames = new Set<string>();
|
private bundleRedirectNames = new Set<string>();
|
||||||
private moduleFileNames = new Map<string, string|null>();
|
private moduleFileNames = new Map<string, string|null>();
|
||||||
protected resolveModuleNameHost: CompilerHostContext;
|
protected resolveModuleNameHost: CompilerHostContext;
|
||||||
|
|
||||||
|
@ -281,8 +281,8 @@ export class CompilerHost implements AotCompilerHost {
|
||||||
// Check for a bundle index.
|
// Check for a bundle index.
|
||||||
if (this.hasBundleIndex(filePath)) {
|
if (this.hasBundleIndex(filePath)) {
|
||||||
const normalFilePath = path.normalize(filePath);
|
const normalFilePath = path.normalize(filePath);
|
||||||
return this.flatModuleIndexNames.has(normalFilePath) ||
|
return this.bundleIndexNames.has(normalFilePath) ||
|
||||||
this.flatModuleIndexRedirectNames.has(normalFilePath);
|
this.bundleRedirectNames.has(normalFilePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -313,7 +313,7 @@ export class CompilerHost implements AotCompilerHost {
|
||||||
|
|
||||||
private hasBundleIndex(filePath: string): boolean {
|
private hasBundleIndex(filePath: string): boolean {
|
||||||
const checkBundleIndex = (directory: string): boolean => {
|
const checkBundleIndex = (directory: string): boolean => {
|
||||||
let result = this.flatModuleIndexCache.get(directory);
|
let result = this.bundleIndexCache.get(directory);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
if (path.basename(directory) == 'node_module') {
|
if (path.basename(directory) == 'node_module') {
|
||||||
// Don't look outside the node_modules this package is installed in.
|
// 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');
|
const metadataFile = typings.replace(DTS, '.metadata.json');
|
||||||
if (this.context.fileExists(metadataFile)) {
|
if (this.context.fileExists(metadataFile)) {
|
||||||
const metadata = JSON.parse(this.context.readFile(metadataFile));
|
const metadata = JSON.parse(this.context.readFile(metadataFile));
|
||||||
if (metadata.flatModuleIndexRedirect) {
|
if (metadata.bundleRedirect) {
|
||||||
this.flatModuleIndexRedirectNames.add(typings);
|
this.bundleRedirectNames.add(typings);
|
||||||
// Note: don't set result = true,
|
// Note: don't set result = true,
|
||||||
// as this would mark this folder
|
// as this would mark this folder
|
||||||
// as having a bundleIndex too early without
|
// as having a bundleIndex too early without
|
||||||
// filling the bundleIndexNames.
|
// filling the bundleIndexNames.
|
||||||
} else if (metadata.importAs) {
|
} else if (metadata.importAs) {
|
||||||
this.flatModuleIndexNames.add(typings);
|
this.bundleIndexNames.add(typings);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -360,7 +360,7 @@ export class CompilerHost implements AotCompilerHost {
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.flatModuleIndexCache.set(directory, result);
|
this.bundleIndexCache.set(directory, result);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue