Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(ngcc): fix rootDir issue and update ngcc integration test #34212

Closed
wants to merge 2 commits into from

Commits on Dec 4, 2019

  1. fix(ngcc): ensure that bundle rootDir is the package path

    Previously the `rootDir` was set to the entry-point path but
    this is incorrect if the source files are stored in a directory outside
    the entry-point path. This is the case in the latest versions of the
    Angular CDK.
    
    Instead the `rootDir` should be the containing package path, which is
    guaranteed to include all the source for the entry-point.
    
    ---
    
    A symptom of this is an error when ngcc is trying to process the source of
    an entry-point format after the entry-point's typings have already been
    processed by a previous processing run.
    
    During processing the `_toR3Reference()` function gets called which in turn
    makes a call to `ReflectionHost.getDtsDeclaration()`. If the typings files
    are also being processed this returns the node from the dts typings files.
    
    But if we have already processed the typings files and are now processing
    only an entry-point format without typings, the call to
    `ReflectionHost.getDtsDeclaration()` returns `null`.
    
    When this value is `null`, a JS `valueRef` is passed through as the DTS
    `typeRef` to the `ReferenceEmitter`. In this case, the `ReferenceEmitter`
    fails during `emit()` because no `ReferenceEmitStrategy` is able to provide
    an emission:
    
    1) The `LocalIdentifierStrategy` is not able help because in this case
    `ImportMode` is `ForceNewImport`.
    2) The `LogicalProjectStrategy` cannot find the JS file below the `rootDir`.
    
    The second strategy failure is fixed by this PR.
    
    Fixes angular/ngcc-validation#495
    petebacondarwin committed Dec 4, 2019
    Copy the full SHA
    29ceb92 View commit details
    Browse the repository at this point in the history
  2. test(ngcc): update ngcc integration test dependencies

    This commit updates `@angular/material` and `@angular/cdk` to the
    latest release candidate. Doing so exposed a bug in ngcc, which is fixed
    by the preceding commit. Also the layout of these libraries changed, so
    the checks in the integration test need a bit of tweaking.
    petebacondarwin committed Dec 4, 2019
    Copy the full SHA
    63cd7b3 View commit details
    Browse the repository at this point in the history