@ngtools/webpack 14.0.4 → 14.0.7

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": "14.0.4",
3
+ "version": "14.0.7",
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",
@@ -24,7 +24,7 @@ export declare class NgccProcessor {
24
24
  constructor(compilerNgcc: typeof import('@angular/compiler-cli/ngcc'), propertiesToConsider: string[], compilationWarnings: (Error | string)[], compilationErrors: (Error | string)[], basePath: string, tsConfigPath: string, inputFileSystem: InputFileSystem, resolver: ResolverWithOptions);
25
25
  /** Process the entire node modules tree. */
26
26
  process(): void;
27
- /** Process a module and it's depedencies. */
27
+ /** Process a module and its dependencies. */
28
28
  processModule(moduleName: string, resolvedModule: ts.ResolvedModule | ts.ResolvedTypeReferenceDirective): void;
29
29
  invalidate(fileName: string): void;
30
30
  /**
@@ -59,8 +59,10 @@ class NgccProcessor {
59
59
  }
60
60
  /** Process the entire node modules tree. */
61
61
  process() {
62
- // Under Bazel when running in sandbox mode parts of the filesystem is read-only.
63
- if (process.env.BAZEL_TARGET) {
62
+ // Under Bazel when running in sandbox mode parts of the filesystem is read-only, or when using
63
+ // Yarn PnP there may not be a node_modules directory. ngcc can't run in those cases, so the
64
+ // processing is skipped.
65
+ if (process.env.BAZEL_TARGET || !this._nodeModulesDirectory) {
64
66
  return;
65
67
  }
66
68
  // Skip if node_modules are read-only
@@ -154,14 +156,16 @@ class NgccProcessor {
154
156
  }
155
157
  }
156
158
  }
157
- /** Process a module and it's depedencies. */
159
+ /** Process a module and its dependencies. */
158
160
  processModule(moduleName, resolvedModule) {
159
161
  var _a, _b;
160
162
  const resolvedFileName = resolvedModule.resolvedFileName;
161
- if (!resolvedFileName ||
163
+ if (!this._nodeModulesDirectory ||
164
+ !resolvedFileName ||
162
165
  moduleName.startsWith('.') ||
163
166
  this._processedModules.has(resolvedFileName)) {
164
- // Skip when module is unknown, relative or NGCC compiler is not found or already processed.
167
+ // Skip when module_modules directory is not present, module is unknown, relative or the
168
+ // NGCC compiler is not found or already processed.
165
169
  return;
166
170
  }
167
171
  const packageJsonPath = this.tryResolvePackage(moduleName, resolvedFileName);
@@ -216,7 +220,7 @@ class NgccProcessor {
216
220
  }
217
221
  current = path.dirname(current);
218
222
  }
219
- throw new Error(`Cannot locate the 'node_modules' directory.`);
223
+ return null;
220
224
  }
221
225
  findPackageManagerLockFile(projectBasePath) {
222
226
  for (const lockFile of ['yarn.lock', 'pnpm-lock.yaml', 'package-lock.json']) {