refactor(ngcc): expose a hash of the project configuration (#35931)
This will be used in the entry-point manifest since a change to configuration might change the entry-points that are found. PR Close #35931
This commit is contained in:

committed by
Andrew Kushnir

parent
5af0e7523c
commit
74e47c503a
@ -5,6 +5,7 @@
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import {createHash} from 'crypto';
|
||||
import {satisfies} from 'semver';
|
||||
import * as vm from 'vm';
|
||||
import {AbsoluteFsPath, FileSystem, dirname, join, resolve} from '../../../src/ngtsc/file_system';
|
||||
@ -159,10 +160,12 @@ export class NgccConfiguration {
|
||||
private defaultConfig: NgccProjectConfig<VersionedPackageConfig[]>;
|
||||
private projectConfig: NgccProjectConfig<VersionedPackageConfig[]>;
|
||||
private cache = new Map<string, VersionedPackageConfig>();
|
||||
readonly hash: string;
|
||||
|
||||
constructor(private fs: FileSystem, baseDir: AbsoluteFsPath) {
|
||||
this.defaultConfig = this.processProjectConfig(baseDir, DEFAULT_NGCC_CONFIG);
|
||||
this.projectConfig = this.processProjectConfig(baseDir, this.loadProjectConfig(baseDir));
|
||||
this.hash = this.computeHash();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -283,6 +286,10 @@ export class NgccConfiguration {
|
||||
] :
|
||||
[packagePathAndVersion, undefined];
|
||||
}
|
||||
|
||||
private computeHash(): string {
|
||||
return createHash('md5').update(JSON.stringify(this.projectConfig)).digest('hex');
|
||||
}
|
||||
}
|
||||
|
||||
function findSatisfactoryVersion(
|
||||
|
Reference in New Issue
Block a user