fix(ivy): ngcc - improve the "ngcc version changed" error message (#32396)

If a project has nested projects that contain node_modules folders
that get processed by ngcc, it can be confusing when the ngcc
version changes since the error message is very generic:

```
The ngcc compiler has changed since the last ngcc build.
Please completely remove `node_modules` and try again.
```

This commit augments the error message with the path of
the entry-point that failed so that it is more obvious which
node_modules folder to remove.

BREAKING CHANGE:

This commit removes the public export of `hasBeenProcessed()`.

This was exported to be availble to the CLI integration but was never
used. The change to the function signature is a breaking change in itself
so we remove the function altogether to simplify and lower the public
API surface going forward.

PR Close #32396
This commit is contained in:
Pete Bacon Darwin
2019-08-29 15:23:05 +01:00
committed by Miško Hevery
parent 63dff9c888
commit d5101dff3b
4 changed files with 24 additions and 26 deletions

View File

@ -111,7 +111,7 @@ export function mainNgcc(
for (const entryPoint of entryPoints) {
const packageJson = entryPoint.packageJson;
const hasProcessedTypings = hasBeenProcessed(packageJson, 'typings');
const hasProcessedTypings = hasBeenProcessed(packageJson, 'typings', entryPoint.path);
const {propertiesToProcess, propertyToPropertiesToMarkAsProcessed} =
getPropertiesToProcessAndMarkAsProcessed(packageJson, supportedPropertiesToConsider);
let processDts = !hasProcessedTypings;
@ -160,7 +160,7 @@ export function mainNgcc(
}
// The format-path which the property maps to is already processed - nothing to do.
if (hasBeenProcessed(packageJson, formatProperty)) {
if (hasBeenProcessed(packageJson, formatProperty, entryPoint.path)) {
logger.debug(`Skipping ${entryPoint.name} : ${formatProperty} (already compiled).`);
onTaskCompleted(task, TaskProcessingOutcome.AlreadyProcessed);
return;
@ -316,7 +316,7 @@ function hasProcessedTargetEntryPoint(
for (const property of propertiesToConsider) {
if (packageJson[property]) {
// Here is a property that should be processed
if (hasBeenProcessed(packageJson, property as EntryPointJsonProperty)) {
if (hasBeenProcessed(packageJson, property as EntryPointJsonProperty, targetPath)) {
if (!compileAllFormats) {
// It has been processed and we only need one, so we are done.
return true;