angular-cn/tools
Alex Rickabaugh 4055150910 feat(compiler): allow selector-less directives as base classes (#31379)
In Angular today, the following pattern works:

```typescript
export class BaseDir {
  constructor(@Inject(ViewContainerRef) protected vcr: ViewContainerRef) {}
}

@Directive({
  selector: '[child]',
})
export class ChildDir extends BaseDir {
  // constructor inherited from BaseDir
}
```

A decorated child class can inherit a constructor from an undecorated base
class, so long as the base class has metadata of its own (for JIT mode).
This pattern works regardless of metadata in AOT.

In Angular Ivy, this pattern does not work: without the @Directive
annotation identifying the base class as a directive, information about its
constructor parameters will not be captured by the Ivy compiler. This is a
result of Ivy's locality principle, which is the basis behind a number of
compilation optimizations.

As a solution, @Directive() without a selector will be interpreted as a
"directive base class" annotation. Such a directive cannot be declared in an
NgModule, but can be inherited from. To implement this, a few changes are
made to the ngc compiler:

* the error for a selector-less directive is now generated when an NgModule
  declaring it is processed, not when the directive itself is processed.
* selector-less directives are not tracked along with other directives in
  the compiler, preventing other errors (like their absence in an NgModule)
  from being generated from them.

PR Close #31379
2019-08-14 12:03:05 -07:00
..
brotli-cli build: convert entry_point to label (#30627) 2019-06-11 00:03:11 +00:00
build build: remove obsolete files (#26471) 2018-10-23 08:57:41 -07:00
cjs-jasmine refactor(ivy): run the compiler compliance tests against ngtsc (#24862) 2018-07-20 11:48:36 -07:00
gulp-tasks docs(zone.js): update release docs instructions (#32128) 2019-08-13 16:55:03 -07:00
ngcontainer build: use bazel version from node modules (#26691) 2018-10-30 16:19:13 -04:00
npm style: add file header (#28871) 2019-02-28 12:06:36 -08:00
public_api_guard feat(compiler): allow selector-less directives as base classes (#31379) 2019-08-14 12:03:05 -07:00
rxjs build: update to rules_nodejs 0.32.2 (#31325) 2019-07-01 14:16:42 -07:00
size-tracking build: fix size-tracking tests not running (#31779) 2019-07-23 15:48:06 -07:00
source-map-test build: update npm dependencies (#19328) 2017-09-22 13:20:52 -07:00
symbol-extractor build: convert entry_point to label (#30627) 2019-06-11 00:03:11 +00:00
testing build(bazel): update to nodejs rules 0.27.9 (#29647) 2019-04-02 10:27:14 -07:00
ts-api-guardian build: TypeScript 3.5 upgrade (#31615) 2019-07-25 17:05:23 -07:00
tslint build: remove unused rollup.config.js files (#28646) 2019-02-14 19:28:08 +00:00
validate-commit-message build: ensure fixup commits match an earlier, unmerged commit (#32023) 2019-08-09 15:12:38 -07:00
yarn build: upgrade yarn to 1.3.2 (#21406) 2018-01-10 12:32:26 -08:00
BUILD.bazel build: add tsconfig-test to dependency for tsconfig in core/test/strict_types (#31471) 2019-07-12 11:38:16 -04:00
bazel_stamp_vars.js build: add pre-release check that validates the version name (#29551) 2019-03-27 12:26:13 -07:00
check-environment.js build: update to Node 10 (#25822) 2018-09-06 14:58:30 -07:00
defaults.bzl build: fix build failures with worker mode cache and @types/events (#31325) 2019-07-01 14:16:43 -07:00
jasmine-seed-generator.js test: run unit tests in random order (#19904) 2018-07-06 13:48:02 -07:00
jsconfig.json chore(vscode): add jsconfig.json and remove .settings dir 2015-10-29 13:53:21 +00:00
postinstall-patches.js build(bazel): update to latest stable chromium 74 on osx and linux for karma under bazel (#30502) 2019-05-16 14:38:14 -07:00
rebase-pr.js ci: rebase PRs on target branch (#29215) 2019-03-12 11:34:58 -07:00
rollup_bundle_commonjs_ignoreGlobal.patch fix(zone.js): restore definition of global (#31453) 2019-07-09 09:34:50 -07:00
tsconfig-test.json build(bazel): use fine-grained npm deps (#26111) (#26488) 2018-10-19 20:59:29 -07:00
tsconfig.json build: ts-api-guardian tsconfig warning with bazel (#27583) 2018-12-13 11:01:48 -08:00
types.d.ts build(bazel): use bazel managed node_modules for downstream angular from source build support (#24663) 2018-07-26 17:02:21 -07:00
utils.inc feat(bundle): add script to push bundles to code.angularjs.org 2015-04-14 14:50:53 -07:00