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

fix(ngcc): consistently delegate to TypeScript host for typing files #36089

Closed
wants to merge 3 commits into from

Commits on Mar 17, 2020

  1. test(ngcc): use "module" format property for ES5 bundles

    The format property for ES5 bundles should be "module" or "es5"/"esm5",
    but was "main" instead. The "main" property is appropriate for CommonJS
    and UMD bundles, not for ES5 bundles.
    JoostK committed Mar 17, 2020
    Configuration menu
    Copy the full SHA
    f023ad2 View commit details
    Browse the repository at this point in the history
  2. fix(ngcc): consistently delegate to TypeScript host for typing files

    When ngcc is compiling an entry-point, it uses a `ReflectionHost` that
    is specific to its format, e.g. ES2015, ES5, UMD or CommonJS. During the
    compilation of that entry-point however, the reflector may be used to
    reflect into external libraries using their declaration files.
    
    Up until now this was achieved by letting all `ReflectionHost` classes
    consider their parent class for reflector queries, thereby ending up in
    the `TypeScriptReflectionHost` that is a common base class for all
    reflector hosts. This approach has proven to be prone to bugs, as
    failing to call into the base class would cause incompatibilities with
    reading from declaration files.
    
    The observation can be made that there's only two distinct kinds of
    reflection host queries:
    1. the reflector query is about code that is part of the entry-point
       that is being compiled, or
    2. the reflector query is for an external library that the entry-point
       depends on, in which case the information is reflected
       from the declaration files.
    
    The `ReflectionHost` that was chosen for the entry-point should serve
    only reflector queries for the first case, whereas a regular
    `TypeScriptReflectionHost` should be used for the second case. This
    avoids the problem where a format-specific `ReflectionHost` fails to
    handle the second case correctly, as it isn't even considered for such
    reflector queries.
    
    This commit introduces a `ReflectionHost` that delegates to the
    `TypeScriptReflectionHost` for AST nodes within declaration files,
    otherwise delegating to the format-specific `ReflectionHost`.
    
    Fixes angular#35078
    Resolves FW-1859
    JoostK committed Mar 17, 2020
    Configuration menu
    Copy the full SHA
    8a0ffb4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    778e160 View commit details
    Browse the repository at this point in the history