@ngtools/webpack 13.2.2 → 13.2.5

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": "@ngtools/webpack",
3
- "version": "13.2.2",
3
+ "version": "13.2.5",
4
4
  "description": "Webpack plugin that AoT compiles your Angular components and modules.",
5
5
  "main": "./src/index.js",
6
6
  "typings": "src/index.d.ts",
@@ -32,5 +32,6 @@ export declare class NgccProcessor {
32
32
  */
33
33
  private tryResolvePackage;
34
34
  private findNodeModulesDirectory;
35
+ private findPackageManagerLockFile;
35
36
  }
36
37
  export {};
@@ -72,15 +72,6 @@ class NgccProcessor {
72
72
  const runHashBasePath = path.join(this._nodeModulesDirectory, '.cli-ngcc');
73
73
  const projectBasePath = path.join(this._nodeModulesDirectory, '..');
74
74
  try {
75
- let lockData;
76
- let lockFile = 'yarn.lock';
77
- try {
78
- lockData = (0, fs_1.readFileSync)(path.join(projectBasePath, lockFile));
79
- }
80
- catch {
81
- lockFile = 'package-lock.json';
82
- lockData = (0, fs_1.readFileSync)(path.join(projectBasePath, lockFile));
83
- }
84
75
  let ngccConfigData;
85
76
  try {
86
77
  ngccConfigData = (0, fs_1.readFileSync)(path.join(projectBasePath, 'ngcc.config.js'));
@@ -90,10 +81,11 @@ class NgccProcessor {
90
81
  }
91
82
  const relativeTsconfigPath = path.relative(projectBasePath, this.tsConfigPath);
92
83
  const tsconfigData = (0, fs_1.readFileSync)(this.tsConfigPath);
84
+ const { lockFileData, lockFilePath } = this.findPackageManagerLockFile(projectBasePath);
93
85
  // Generate a hash that represents the state of the package lock file and used tsconfig
94
86
  const runHash = (0, crypto_1.createHash)('sha256')
95
- .update(lockData)
96
- .update(lockFile)
87
+ .update(lockFileData)
88
+ .update(lockFilePath)
97
89
  .update(ngccConfigData)
98
90
  .update(tsconfigData)
99
91
  .update(relativeTsconfigPath)
@@ -216,6 +208,19 @@ class NgccProcessor {
216
208
  }
217
209
  throw new Error(`Cannot locate the 'node_modules' directory.`);
218
210
  }
211
+ findPackageManagerLockFile(projectBasePath) {
212
+ for (const lockFile of ['yarn.lock', 'pnpm-lock.yaml', 'package-lock.json']) {
213
+ const lockFilePath = path.join(projectBasePath, lockFile);
214
+ try {
215
+ return {
216
+ lockFilePath,
217
+ lockFileData: (0, fs_1.readFileSync)(lockFilePath),
218
+ };
219
+ }
220
+ catch { }
221
+ }
222
+ throw new Error('Cannot locate a package manager lock file.');
223
+ }
219
224
  }
220
225
  exports.NgccProcessor = NgccProcessor;
221
226
  class NgccLogger {