angular-cn/packages
Alex Rickabaugh c4733c15c0 feat(ivy): enable re-export of the compilation scope of NgModules privately (#33177)
This commit refactors the aliasing system to support multiple different
AliasingHost implementations, which control specific aliasing behavior
in ngtsc (see the README.md).

A new host is introduced, the `PrivateExportAliasingHost`. This solves a
longstanding problem in ngtsc regarding support for "monorepo" style private
libraries. These are libraries which are compiled separately from the main
application, and depended upon through TypeScript path mappings. Such
libraries are frequently not in the Angular Package Format and do not have
entrypoints, but rather make use of deep import style module specifiers.
This can cause issues with ngtsc's ability to import a directive given the
module specifier of its NgModule.

For example, if the application uses a directive `Foo` from such a library
`foo`, the user might write:

```typescript
import {FooModule} from 'foo/module';
```

In this case, foo/module.d.ts is path-mapped into the program. Ordinarily
the compiler would see this as an absolute module specifier, and assume that
the `Foo` directive can be imported from the same specifier. For such non-
APF libraries, this assumption fails. Really `Foo` should be imported from
the file which declares it, but there are two problems with this:

1. The compiler would have to reverse the path mapping in order to determine
   a path-mapped path to the file (maybe foo/dir.d.ts).
2. There is no guarantee that the file containing the directive is path-
   mapped in the program at all.

The compiler would effectively have to "guess" 'foo/dir' as a module
specifier, which may or may not be accurate depending on how the library and
path mapping are set up.

It's strongly desirable that the compiler not break its current invariant
that the module specifier given by the user for the NgModule is always the
module specifier from which directives/pipes are imported. Thus, for any
given NgModule from a particular module specifier, it must always be
possible to import any directives/pipes from the same specifier, no matter
how it's packaged.

To make this possible, when compiling a file containing an NgModule, ngtsc
will automatically add re-exports for any directives/pipes not yet exported
by the user, with a name of the form: ɵngExportɵModuleNameɵDirectiveName

This has several effects:

1. It guarantees anyone depending on the NgModule will be able to import its
   directives/pipes from the same specifier.
2. It maintains a stable name for the exported symbol that is safe to depend
   on from code on NPM. Effectively, this private exported name will be a
   part of the package's .d.ts API, and cannot be changed in a non-breaking
   fashion.

Fixes #29361
FW-1610 #resolve

PR Close #33177
2019-10-22 13:14:31 -04:00
..
animations feat: typescript 3.6 support (#32946) 2019-10-18 13:15:16 -04:00
bazel feat(ivy): give shim generation its own compiler options (#33256) 2019-10-21 11:24:26 -04:00
benchpress feat: update rxjs peerDependencies minimum requirment to 6.5.3 (#32812) 2019-10-01 14:56:45 -07:00
common feat: typescript 3.6 support (#32946) 2019-10-18 13:15:16 -04:00
compiler feat: typescript 3.6 support (#32946) 2019-10-18 13:15:16 -04:00
compiler-cli feat(ivy): enable re-export of the compilation scope of NgModules privately (#33177) 2019-10-22 13:14:31 -04:00
core feat(core): add ModuleWithProviders generic type migration (#33217) 2019-10-21 15:53:28 -04:00
docs refactor(core): remove deprecated Renderer (#33019) 2019-10-08 09:23:00 -07:00
elements feat: typescript 3.6 support (#32946) 2019-10-18 13:15:16 -04:00
examples test: clean up explicit dynamic query usages (#33015) 2019-10-17 16:10:10 -04:00
forms docs(forms): fix grammar and add clarification to setValue docs (#33126) 2019-10-21 15:58:38 -04:00
http feat: typescript 3.6 support (#32946) 2019-10-18 13:15:16 -04:00
language-service refactor: format files (#31248) 2019-10-18 14:49:12 -04:00
localize build: remove vendored Babel typings (#33226) 2019-10-17 18:45:52 -04:00
platform-browser feat: typescript 3.6 support (#32946) 2019-10-18 13:15:16 -04:00
platform-browser-dynamic feat: typescript 3.6 support (#32946) 2019-10-18 13:15:16 -04:00
platform-server feat: typescript 3.6 support (#32946) 2019-10-18 13:15:16 -04:00
platform-webworker feat: typescript 3.6 support (#32946) 2019-10-18 13:15:16 -04:00
platform-webworker-dynamic feat: typescript 3.6 support (#32946) 2019-10-18 13:15:16 -04:00
private/testing test(ivy): add onlyInIvy perf counter expectations (#30339) 2019-05-09 11:22:00 -07:00
router fix(router): adjust UrlTree redirect to replace URL if in eager update (#32988) 2019-10-18 14:42:21 -04:00
service-worker feat: typescript 3.6 support (#32946) 2019-10-18 13:15:16 -04:00
upgrade feat: typescript 3.6 support (#32946) 2019-10-18 13:15:16 -04:00
zone.js build: remove vendored Babel typings (#33226) 2019-10-17 18:45:52 -04:00
BUILD.bazel refactor(core): ensure compatibility with typescript strict flag (#30993) 2019-07-18 14:21:25 -07:00
README.md Revert "docs: Remove unneeded file (#18106)" 2017-07-20 16:46:47 -05:00
empty.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
goog.d.ts fix(ivy): use goog.LOCALE for Closure Compiler to define default LOCALE_ID (#31519) 2019-07-16 13:02:10 -04:00
license-banner.txt build: bump year (#27880) 2019-01-11 11:15:59 -08:00
system.d.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
tsconfig-build-no-strict.json refactor(core): ensure compatibility with typescript strict flag (#30993) 2019-07-18 14:21:25 -07:00
tsconfig-build.json refactor(core): ensure compatibility with typescript strict flag (#30993) 2019-07-18 14:21:25 -07:00
tsconfig-test.json refactor: fix typescript strict flag failures in all tests (#30993) 2019-07-18 14:21:26 -07:00
tsconfig.json test(language-service): Create proper test project (#32653) 2019-09-18 13:07:01 -07:00
types.d.ts build: switch to typescript's es2015 typings (#28570) 2019-02-06 14:17:55 -05:00

README.md

Angular

The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.

License: MIT