Commit Graph

2501 Commits

Author SHA1 Message Date
Pete Bacon Darwin a64859b4bc fix(core): ensure that `ɵdefineNgModule` is available in flat-file formats (#26403)
When compiling the flat-file version of the `@angular/core` we need to be aware
that we cannot rely upon imported names to access the ivy definition functions.
The compiler is already clever enough to use local function calls rather than
trying to add a namespaced import, but there is a problem if the local name of the
function is different to the exported name. This is the case for functions that
are not part of the public API, and so are exported under a barred-O private alias.

In `@angular/core` the only decorations in use are `@NgModule` and `@Injectable`.
There are no directives, components, pipes, etc.

Since `defineInjectable` is part of the public API of `@angular/core`, the compiler
is able to generate code that references the original non-barred-O version of the
function.

But the `defineNgModule` is not part of the public API and so the compiler must
generate code that refers to it by the private barred-O version of the function.

This commit imports and then re-exports this barred-O version of `defineModule` to
ensure that the symbol is available in the local scope of the flat-file versions of
the `@angular/core` library.

PR Close #26403
2018-11-01 14:13:26 -07:00
Pete Bacon Darwin 2f30bbb495 perf(ivy): ngcc - only render .d.ts analysis when necessary (#26403)
For each package entry-point there is only one format that
is used to compile the typings files (.d.ts). This will be
either esm2015 or fesm2015 (preferred). So we would not run
any dts processing in the renderer if we are not compiling
the appropriate format.

PR Close #26403
2018-11-01 14:13:26 -07:00
Pete Bacon Darwin 030d43b9f3 fix(ivy): ngcc - fixes to support compiling Material library (#26403)
1) The `DecorationAnalyzer now analyzes all source files, rather than just
the entry-point files, which fixes #26183.
2) The `DecoratorAnalyzer` now runs all the `handler.analyze()`  calls
across the whole entry-point *before* running `handler.compile()`. This
ensures that dependencies between the decorated classes *within* an
entry-point are known to the handlers when running the compile process.
3) The `Renderer` now does the transformation of the typings (.d.ts) files
which allows us to support packages that only have flat format
entry-points better, and is faster, since we won't parse `.d.ts` files twice.

PR Close #26403
2018-11-01 14:13:26 -07:00
Pete Bacon Darwin dff10085e8 refactor(ivy): ngcc - move typings rendering to `Renderer` (#26403)
The rendering of typings is not specific to the package
format, so it doesn't make sense to put it in a specific
renderer.

As a result there is no real difference between esm5 and esm2015
renderers, so there is no point in having separate classes.

PR Close #26403
2018-11-01 14:13:26 -07:00
Pete Bacon Darwin e804143183 perf(ivy): ngcc - use flat file for dependency sorting if available (#26403)
Previously we always used the non-flat format because we thought
that this was the one that would always be available.

It turns out that this is not the case and that only one of the flat and
non-flat formats may be available.

Therefore we should use whichever is available, defaulting to the flat
format if that exists, since that will be faster to parse.

PR Close #26403
2018-11-01 14:13:26 -07:00
Pete Bacon Darwin bec4ca0c73 refactor(ivy): ngcc - recombine flat and non-flat `Esm2015ReflectionHost` (#26403)
Going forward we need to be able to do the same work on both
flat and non-flat module formats (such as computing arity and
transforming .d.ts files)

PR Close #26403
2018-11-01 14:13:26 -07:00
Pete Bacon Darwin 81acbad058 fix(ivy): ngcc - skip missing formats rather than erroring (#26403)
It is perfectly normal for some of the formats to be missing from
a package. We should not fail compilation for this.

PR Close #26403
2018-11-01 14:13:26 -07:00
Pete Bacon Darwin 360be02c0e fix(ivy): ngcc - support Angular Material package.json format (#26403)
The Material project uses slightly different properties to the
core Angular project for specifying the different format entry-point.

This commit ensures that we map these properties correctly for both
types of project.

PR Close #26403
2018-11-01 14:13:26 -07:00
Pete Bacon Darwin adce5064b0 fix(ivy): fix 'Module not found` error message (#26403)
The message was dumping a serialized object instead of a
human readable name into the exception being thrown.

PR Close #26403
2018-11-01 14:13:25 -07:00
Pete Bacon Darwin 1918f8d5b5 feat(ivy): support separate .js and .d.ts trees when generating imports (#26403)
The `NgModule` handler generates `R3References` for its declarations, imports,
exports, and bootstrap components, based on the relative import path
between the module and the classes it's referring to. This works fine for
compilation of a .ts Program inside ngtsc, but in ngcc the import needed
in the .d.ts file may be very different to the import needed between .js
files (for example, if the .js files are flattened and the .d.ts is not).

This commit introduces a new API in the `ReflectionHost` for extracting the
.d.ts version of a declaration, and makes use of it in the
`NgModuleDecorationHandler` to write a correct expression for the `NgModule`
definition type.

PR Close #26403
2018-11-01 14:13:25 -07:00
Pete Bacon Darwin eb5d3088a4 build: update `canonical-path` dependency (#26719)
This new version (1.0.0) provides a typings file!

PR Close #26719
2018-11-01 13:49:10 -07:00
Miško Hevery 683d53db4b docs: add `Function Inlining` rules to `PERF_NOTES.md` (#26876)
PR Close #26876
2018-11-01 13:47:34 -07:00
Kara Erickson a2929dfd57 fix(ivy): dynamically created components should run init hooks (#26864)
PR Close #26864
2018-11-01 13:44:10 -07:00
Kara Erickson 911bfef04c fix(ivy): bindings should be checked in components created dynamically by root component' (#26864)
PR Close #26864
2018-11-01 13:44:10 -07:00
Kara Erickson aadbc8a9d3 fix(ivy): sync exported r3 symbol with compiler generated symbol (#26877)
PR Close #26877
2018-11-01 13:32:35 -07:00
Igor Minar 2e7b5c5d64 test: fix broken golden file for packages/core/test/bundling/hello_world_r2 (#26893)
PR Close #26893
2018-11-01 06:03:12 -07:00
Pete Bacon Darwin 86580a8460 style(router): remove trailing whitespace (#26891)
PR Close #26891
2018-11-01 05:28:17 -07:00
Alex Rickabaugh 8634d0bcd8 feat(ivy): emit metadata along with all Angular types (#26860)
This commit causes a call to setClassMetadata() to be emitted for every
type being compiled by ngtsc (every Angular type). With this metadata,
the TestBed should be able to recompile these classes when overriding
decorator information.

Testing strategy: Tests in the previous commit for
generateSetClassMetadataCall() verify that the metadata as generated is
correct. This commit enables the generation for each DecoratorHandler,
and a test is added to ngtsc_spec to verify all decorated types have
metadata generated for them.

PR Close #26860
2018-10-31 19:52:36 -04:00
Alex Rickabaugh 492576114d feat(ivy): generator of setClassMetadata statements for Angular types (#26860)
This commit introduces generateSetClassMetadataCall(), an API in ngtsc
for generating calls to setClassMetadata() for a given declaration. The
reflection API is used to enumerate Angular decorators on the declaration,
which are converted to a format that ReflectionCapabilities can understand.
The reflection metadata is then patched onto the declared type via a call
to setClassMetadata().

This is simply a utility, a future commit invokes this utility for
each DecoratorHandler.

Testing strategy: tests are included which exercise generateSetClassMetadata
in isolation.

PR Close #26860
2018-10-31 19:52:36 -04:00
Alex Rickabaugh ca1e538752 feat(ivy): setClassMetadata() for assigning decorator metadata (#26860)
This commit introduces the setClassMetadata() private function, which
adds metadata to a type in a way that can be accessed via Angular's
ReflectionCapabilities. Currently, it writes to static fields as if
the metadata being added was downleveled from decorators by tsickle.

The plan is for ngtsc to emit code which calls this function, passing
metadata on to the runtime for testing purposes. Calls to this function
would then be tree-shaken away for production bundles.

Testing strategy: proper operation of this function will be an integral
part of TestBed metadata overriding. Angular core tests will fail if this
is broken.

PR Close #26860
2018-10-31 19:52:36 -04:00
Alex Rickabaugh afbee736ea refactor(ivy): use wrapped metadata in all DecoratorHandlers (#26860)
Previously, the Directive, Injectable, and Pipe DecoratorHandlers were
directly returning @angular/compiler metadata from their analyze() steps.
This precludes returning any additional information along with that
metadata. This commit introduces a wrapper interface for these handlers,
opening the door for additional information to be returned from analyze().

Testing strategy: this is a refactor commit, existing test coverage is
sufficient.

PR Close #26860
2018-10-31 19:52:36 -04:00
Alex Rickabaugh 84e311038d feat(ivy): capture the identifier of a decorator during reflection (#26860)
Previously the ReflectionHost API only returned the names of decorators
and not a reference to their TypeScript Identifier. This commit adds
the identifier itself, so that a consumer can write references to the
decorator.

Testing strategy: this commit is trivial, and the functionality will be
exercised by downstream tests.

PR Close #26860
2018-10-31 19:52:36 -04:00
Alex Rickabaugh 4dfa71f018 feat(compiler): ability to mark an InvokeFunctionExpr as pure (#26860)
Uglify and other tree-shakers attempt to determine if the invocation
of a function is side-effectful, and remove it if so (and the result
is unused). A /*@__PURE__*/ annotation on the call site can be used
to hint to the optimizer that the invocation has no side effects and
is safe to tree-shake away.

This commit adds a 'pure' flag to the output AST function call node,
which can be used to signal to downstream emitters that a pure
annotation should be added. It also modifies ngtsc's emitter to
emit an Uglify pure annotation when this flag is set.

Testing strategy: this will be tested via its consumers, by asserting
that pure functions are translated with the correct comment.

PR Close #26860
2018-10-31 19:52:36 -04:00
Jason Aden 4e9f2e5895 feat(router): guard returning UrlTree cancels current navigation and redirects (#26521)
Fixes #24618
FW-153 #resolve

PR Close #26521
2018-10-31 19:51:50 -04:00
Jason Aden 081f95c812 feat(router): allow guards to return UrlTree as well as boolean (#26521)
* Removed `andObservable` helper function in favor of inline implementation
* Flow `boolean | UrlTree` through guards check
* Add tests to verify behavior of `checkGuards` function flowing `UrlTree` properly

PR Close #26521
2018-10-31 19:51:50 -04:00
Jason Aden 152ca66eba feat(router): allow redirect from guards by returning UrlTree (#26521)
* Improve type checking within the CheckGuards function
* Change public API to allow returning of UrlTree instead of boolean

PR Close #26521
2018-10-31 19:51:50 -04:00
Jason Aden 17586f1e94 refactor(router): remove type casting from wrapIntoObservable private function (#26521)
PR Close #26521
2018-10-31 19:51:50 -04:00
Jason Aden 6712492dc2 refactor(router): add type definitions for guard functions (#26521)
PR Close #26521
2018-10-31 19:51:50 -04:00
Jason Aden 9f4299d47b refactor(router): add type guards for router guards (#26521)
PR Close #26521
2018-10-31 19:51:49 -04:00
Misko Hevery d042c4afe0 fix(core): Remove static dependency from @angular/core to @angular/compiler (#26734)
PR Close #26734
2018-10-31 14:15:06 -04:00
Matias Niemelä 5d740785a9 docs: fix aot typo 2018-10-30 17:37:20 -07:00
Matias Niemelä 68b2211e64 fix(ivy): ensure falsy styling is not applied during creation mode (#26793)
PR Close #26793
2018-10-30 19:41:56 -04:00
Greg Magolan 332394d87c build(bazel): generalize fix for AMD name for flat module out file (#26837)
PR Close #26837
2018-10-30 18:37:12 -04:00
Paul Gschwendtner 8fc4ae51fb build: use bazel version from node modules (#26691)
* No longer depends on a custom CircleCI docker image that comes with Bazel pre-installed. Since Bazel is now available through NPM, we should be able to use the version from `@bazel/bazel` in order to enforce a consistent environment on CI and locally.
* This also reduces the amount of packages that need to be published (ngcontainer is removed)

PR Close #26691
2018-10-30 16:19:13 -04:00
Alex Eagle 66be3c9f51 build: Move non-bazel deps to devDependencies (#26691)
This makes yarn_install of ngdeps under Bazel faster, since we don't need many of the large dependencies.
It's important because downstream angular/bazel users will observe the same install time.

PR Close #26691
2018-10-30 16:19:13 -04:00
Trotyl 95743e3a64 fix(core): support computed base class in metadata inheritance (#24014)
PR Close #24014
2018-10-30 13:48:22 -04:00
Pawel Kozlowski ede65dbede fix(ivy): allow root components to inject ViewContainerRef (#26682)
PR Close #26682
2018-10-29 18:47:14 -04:00
Pawel Kozlowski 578e4c7642 fix(ivy): compile queries in JIT mode (#26816)
PR Close #26816
2018-10-29 18:46:44 -04:00
Kara Erickson 96770e5c6b fix(ivy): optional dependencies should not throw with module injector (#26763)
PR Close #26763
2018-10-29 14:12:36 -04:00
Kara Erickson 1130e48541 fix(ivy): host injection flag should not throw for embedded views (#26795)
PR Close #26795
2018-10-29 14:12:11 -04:00
Andrew Kushnir 2a869271f6 fix(ivy): move HostListeners generation to factory function (#26480)
PR Close #26480
2018-10-29 14:02:22 -04:00
Matias Niemelä 95993e1dd5 fix(ivy): ensure pipes indices are referenced in styling bindings (#26755)
PR Close #26755
2018-10-26 18:40:23 -04:00
Kara Erickson d52d82d744 fix(ivy): injecting optional TemplateRef on element should not throw (#26664)
PR Close #26664
2018-10-26 18:11:27 -04:00
Alex Rickabaugh 56f44be0aa fix(compiler): generate relative paths only in summary file errors (#26759)
Previously errors in the summary file would include absolute file names.
This is undesirable as the output of a build should not depend on the
current working directory. Doing so causes nondeterminism issues in
builds.

PR Close #26759
2018-10-26 18:07:55 -04:00
Matias Niemelä d50d400231 build: fix formatting issue in host_binding_spec file 2018-10-26 14:33:04 -07:00
Kara Erickson 19fcfc3d00 fix(compiler): generate inputs with aliases properly (#26774)
PR Close #26774
2018-10-26 17:23:45 -04:00
Matias Niemelä c048358cf9 build: fix the golden files for hello_world_r2 2018-10-26 14:20:40 -07:00
Matias Niemelä 8171a2ab94 fix(ivy): ensure pipe declarations are populated lazily when a forward ref is detected (#26765)
PR Close #26765
2018-10-26 15:57:10 -04:00
Kara Erickson 2fd4c372d5 fix(ivy): resolve forward refs in providers (#26766)
PR Close #26766
2018-10-26 15:50:11 -04:00
Kara Erickson f76ce84ae1 fix(ivy): host bindings should work on nodes with providers (#26771)
PR Close #26771
2018-10-26 15:49:30 -04:00
Igor Minar 40bbfbf961 test(ivy): fix or disable failing ivy tests (#26735)
These tests were previously not running on CI so they have always been broken,
or got broken just recently :-(.

test(ivy): mark failing test targets with fixme-ivy-jit and fixme-ivy-local tags

PR Close #26735
2018-10-26 14:48:05 -04:00
Miško Hevery 95f852e856 build: fix comment formatting to make closure happy (#26769)
PR Close #26769
2018-10-25 19:40:36 -04:00
Kara Erickson 2c7386c961 feat(ivy): support injecting the injector (#26699)
PR Close #26699
2018-10-25 18:47:56 -04:00
Shino Kurian d5cbcef0ea fix(core): ignore comment nodes under unsafe elements (#25879)
Comment nodes that are child nodes of unsafe elements are identified as text nodes. This results in the comment node being returned as an encoded string.
Add a check to ignore such comment nodes.

PR Close #25879
2018-10-25 11:20:19 -07:00
Marc Laval b0476f308b feat(ivy): support providers and viewProviders (#25803)
PR Close #25803
2018-10-25 12:58:40 -04:00
Matias Niemelä 9dc52d9d04 feat(ivy): expose a series of debug console tools (#26705)
PR Close #26705
2018-10-24 20:30:51 -04:00
Matias Niemelä 297dc2bc02 fix(ivy): ensure `ngClass` works with [class] bindings (#26559)
PR Close #26559
2018-10-24 20:27:12 -04:00
Matias Niemelä f6c2db818e fix(ivy): ensure styling pipes are allocated before used in bindings (#26593)
PR Close #26593
2018-10-24 18:42:59 -04:00
Greg Magolan 4e91ead40b style: format (#26708)
PR Close #26708
2018-10-24 12:13:46 -07:00
Greg Magolan 7f39f37003 fix(bazel): support --nolegacy_external_runfiles in protractor rule (#26708)
PR Close #26708
2018-10-24 12:13:46 -07:00
Alex Rickabaugh bf9ab53f12 build(ivy): fix typo in build file 2018-10-24 10:07:49 -07:00
Alex Rickabaugh d99f661af7 build(ivy): properly tag the js_expected_symbol_test rules
Previously the rules were tagged ivy-only, but missing the ivy-aot tag
which would cause them to run under CI.
2018-10-24 10:04:06 -07:00
Alex Rickabaugh 5d58a31d86 fix(ivy): rename broken reflect_metadata switch file
This file was missed during the rename of the --define=compile
flag value from 'local' to 'aot. It's referenced as
reflect_metadata_${compile}.
2018-10-24 09:53:10 -07:00
Igor Minar ee0b857172 build: rename the ivy compile mode 'local' to 'aot' (#26686)
PR Close #26686
2018-10-23 14:14:49 -07:00
Greg Magolan 83dc3c0ee0 build: add config_env_vars = ["compile"] to ngc-wrapped (#26471)
PR Close #26471
2018-10-23 08:57:42 -07:00
Igor Minar 57531737e5 build: add source-map-support to various rules within our repo (#26471)
This removes an verbose warning and adds source-mapping support to our build/ci.

Related issue: https://github.com/bazelbuild/rules_nodejs/issues/389

PR Close #26471
2018-10-23 08:57:42 -07:00
Igor Minar 4237c34c78 test(ivy): mark failing test targets with fixme-ivy-jit and fixme-ivy-local tags (#26471)
We are close enough to blacklist a few test targets, rather than whitelist targets to run...

Because bazel rules can be composed of other rules that don't inherit tags automatically,
I had to explicitly mark all of our ts_library and ng_module targes with "ivy-local" and
"ivy-jit" tags so that we can create a query that excludes all fixme- tagged targets even
if those targets are composed of other targets that don't inherit this tag.

This is the updated overview of ivy related bazel tags:

- ivy-only: target that builds or runs only under ivy
- fixme-ivy-jit: target that doesn't yet build or run under ivy with --compile=jit
- fixme-ivy-local: target that doesn't yet build or run under ivy with --compile=local
- no-ivy-jit: target that is not intended to build or run under ivy with --compile=jit
- no-ivy-local: target that is not intended to build or run under ivy with --compile=local

PR Close #26471
2018-10-23 08:57:42 -07:00
Igor Minar 361eaf1888 build: remove obsolete files (#26471)
PR Close #26471
2018-10-23 08:57:41 -07:00
Pawel Kozlowski ff767dd153 fix(ivy): support ViewContainerRef ng-container children (#26646)
Issue found while running NgPlural tests with ivy

PR Close #26646
2018-10-23 08:52:30 -07:00
Anthony Ciccarello 6737e91974 docs(core): fix spelling in ComponentFactory (#26603)
PR Close #26603
2018-10-22 10:38:56 -07:00
Miško Hevery 213c25fb08 build: remove manual tags from platform jasmine tests (#26606)
PR Close #26606
2018-10-19 22:52:12 -07:00
Greg Magolan 838a3f204f style: ran buildifier (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Greg Magolan 15c2467dbd build: review comments addressed (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Alex Eagle 74ea4e9b5d style: run buildifier (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Alex Eagle 2132c8f461 refactor(bazel): allow google3 overrides for external deps (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Greg Magolan 8d5e3e6981 build: update to rules_typescript 0.20.3 and rules_nodejs 0.15.1 (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Greg Magolan 30f1dc002a build: add npm deps after rebase (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Greg Magolan 631998b2df build: idiomatic install of @angular/bazel npm package (#26258) (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Alex Eagle 30d6233e83 build: update ngcontainer to bazel 0.18.0 (#26465) (#26488)
* build: update ngcontainer to bazel 0.18.0

* build: update skylint to bazel 0.18

use .bazelignore file to ignore node_modules directory

PR Close #26488
2018-10-19 20:59:29 -07:00
Greg Magolan 6468711e16 build(bazel): update to rules_typescript 0.20.2 (#26279) (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Greg Magolan d698b0eadf build: update to rules_typescript 0.20.1 and rules_nodejs 0.15.0 (#26260) (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Greg Magolan 1f3331f5e6 build(bazel): use fine-grained npm deps (#26111) (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Alex Eagle b6c9678f21 build: introduce a package.bzl (#26488)
This lets Angular Bazel users install our transitive deps, rather than have to list them in their WORKSPACE file.
If they want a different version of one of these deps, they just need to install it before calling rules_angular_dependencies.

PR Close #26488
2018-10-19 20:59:29 -07:00
Pete Bacon Darwin 853faf4c71 docs: update upgrade to use `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:53 -07:00
Pete Bacon Darwin 13143b850e docs: update router to use `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:53 -07:00
Pete Bacon Darwin 7570f7222f docs: update platform-server to use `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:53 -07:00
Pete Bacon Darwin f1e3d5125d docs: update platform-browser-dynamic to use `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:53 -07:00
Pete Bacon Darwin 3511f08a81 docs: update http with `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:53 -07:00
Pete Bacon Darwin 982bc7f2aa docs: update forms with `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:53 -07:00
Pete Bacon Darwin 3903e5ebe7 docs: update core to use `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:53 -07:00
Pete Bacon Darwin 0918adf39d docs: common with `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:53 -07:00
Pete Bacon Darwin 42c331bbf2 docs: update animations with `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:53 -07:00
Pete Bacon Darwin 0bae97a726 docs: update platform-browser with `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:52 -07:00
Pete Bacon Darwin 24521f549c docs: convert all `@experimental` tags to `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:52 -07:00
Alex Rickabaugh 31022cbecf feat(ivy): generate .ngsummary.js shims (#26495)
This commit adds generation of .ngsummary.js shims alongside .ngfactory.js
shims when generated files are enabled.

Generated .ngsummary shims contain a single, null export for every exported
class with decorators that exists in the original source files. Ivy code
does not depend on summaries, so these exist only as a placeholder to allow
them to be imported and their values passed to old APIs. This preserves
backwards compatibility.

Testing strategy: this commit adds a compiler test to verify the correct
shape and contents of the generated .ngsummary.js files.

PR Close #26495
2018-10-19 13:30:02 -07:00
Alex Rickabaugh ce8053103e refactor(ivy): make shim generation generic in ngtsc (#26495)
This commit refactors the shim host to be agnostic to the shims being
generated, and provides an API for generating additional shims besides
the .ngfactory.js. This will be used in a following commit to generate
.ngsummary.js shims.

Testing strategy: this refactor introduces no new behavior, so it's
sufficient that the existing tests for factory shim generation continue
to pass.

PR Close #26495
2018-10-19 13:30:01 -07:00
Alex Rickabaugh 0b885ecaf7 refactor(ivy): rename ngtsc/factories to ngtsc/shims (#26495)
This simple refactor of the build rules renames the .ngfactory.js shim
generator to 'shims' instead of 'factories', in preparation for adding
.ngsummary.js shim generation.

Testing strategy: this commit does not introduce any new behavior and
merely moves files and symbols around. It's sufficient that the existing
ngtsc tests pass.

PR Close #26495
2018-10-19 13:30:01 -07:00
Alex Eagle 5b4cf38166 refactor(bazel): remove workaround for TS bug (#26516)
PR Close #26516
2018-10-19 11:14:24 -07:00
Olivier Combe 03bf0d6b41 docs(ivy): update status for i18n (#26502)
PR Close #26502
2018-10-19 11:06:25 -07:00
Alex Rickabaugh d4cee514f6 refactor(ivy): obviate the Bazel component of the ivy_switch (#26550)
Originally, the ivy_switch mechanism used Bazel genrules to conditionally
compile one TS file or another depending on whether ngc or ngtsc was the
selected compiler. This was done because we wanted to avoid importing
certain modules (and thus pulling them into the build) if Ivy was on or
off. This mechanism had a major drawback: ivy_switch became a bottleneck
in the import graph, as it both imports from many places in the codebase
and is imported by many modules in the codebase. This frequently resulted
in cyclic imports which caused issues both with TS and Closure compilation.

It turns out ngcc needs both code paths in the bundle to perform the switch
during its operation anyway, so import switching was later abandoned. This
means that there's no real reason why the ivy_switch mechanism needed to
operate at the Bazel level, and for the ivy_switch file to be a bottleneck.

This commit removes the Bazel-level ivy_switch mechanism, and introduces
an additional TypeScript transform in ngtsc (and the pass-through tsc
compiler used for testing JIT) to perform the same operation that ngcc
does, and flip the switch during ngtsc compilation. This allows the
ivy_switch file to be removed, and the individual switches to be located
directly next to their consumers in the codebase, greatly mitigating the
circular import issues and making the mechanism much easier to use.

As part of this commit, the tag for marking switched variables was changed
from __PRE_NGCC__ to __PRE_R3__, since it's no longer just ngcc which
flips these tags. Most variables were renamed from R3_* to SWITCH_* as well,
since they're referenced mostly in render2 code.

Test strategy: existing test coverage is more than sufficient - if this
didn't work correctly it would break the hello world and todo apps.

PR Close #26550
2018-10-19 09:23:05 -07:00
Pawel Kozlowski f8195e5e3d fix(ivy): stub TestBed.compileComponents implementation (#26506)
PR Close #26506
2018-10-17 13:08:14 -07:00
Andrew Kushnir 8a3fd58cad feat(ivy): i18n compiler support for i18nStart and i18nEnd instructions (#26442)
PR Close #26442
2018-10-17 11:03:52 -07:00
Andrew Kushnir 8024857d4c feat(ivy): i18n compiler support for element attributes (#26442)
PR Close #26442
2018-10-17 11:03:52 -07:00
Matias Niemelä fa8e633be5 feat(ivy): enhance [style] and [class] bindings to be animation aware (#26096)
PR Close #26096
2018-10-16 20:39:19 -07:00
Matias Niemelä be337a2e52 refactor(ivy): move styling files around (#26096)
PR Close #26096
2018-10-16 20:39:18 -07:00
Miško Hevery 4d164b6ca4 fix(ivy): make defineComponent tree shakable by Closure Compiler (#26425)
PR Close #26425
2018-10-16 20:37:35 -07:00
Igor Minar 371ffef4ce test(ivy): enable unit tests for @angular/animations (#26470)
PR Close #26470
2018-10-16 20:31:56 -07:00
Jason Aden fdfedceeec feat(router): add prioritizedGuardValue operator optimization and allowing UrlTree return from guard (#26478)
* If all guards return `true`, operator returns `true`
* `false` and `UrlTree` are now both valid returns from a guard
* Both these values wait for higher priority guards to resolve
* Highest priority `false` or `UrlTree` value will be returned

PR Close #26478
2018-10-16 20:31:32 -07:00
Matias Niemelä 9e5d440a0b refactor(ivy): handle animation metadata normalization in the compiler (#26481)
PR Close #26481
2018-10-16 20:31:04 -07:00
George Kalpakas 2326b9c294 fix(service-worker): clean up caches from old SW versions (#26319)
Since the SW immediately takes over all clients, it is safe to delete
caches used by older (e.g. beta) `@angular/service-worker` versions to
avoid running into browser storage quota limitations.

PR Close #26319
2018-10-16 14:12:07 -07:00
Miško Hevery 7d82053117 docs(ivy): i18n design (#26091)
PR Close #26091
2018-10-16 14:08:01 -07:00
Jason Aden 1c9b06504b fix(router): fix regression where navigateByUrl promise didn't resolve on CanLoad failure (#26455)
Fixes #26284

PR Close #26455
2018-10-15 16:53:25 -07:00
Kara Erickson e76a570908 refactor(ivy): remove LNode (#26426)
PR Close #26426
2018-10-15 11:20:32 -07:00
Kara Erickson 931e603f80 refactor(ivy): revert LNode.data into LViewData[HOST] (#26424)
PR Close #26424
2018-10-15 10:17:12 -07:00
Pawel Kozlowski 45732e5b91 fix(ivy): fix reference to pipeBind instruction with 2 args (#26451)
PR Close #26451
2018-10-15 10:14:25 -07:00
George Kalpakas 9e32dc7c95 build: upgrade `@types/jasminewd2` to 2.0.4 (#26139)
This commit also removes the extra jasminewd2 typings, since the changes
have been merged in the official typings with
DefinitelyTyped/DefinitelyTyped#28957.

PR Close #26139
2018-10-12 14:11:11 -07:00
Manduro ff15043e48 fix(core): allow null value for renderer setElement(…) (#17065)
Using Renderer’s setElementAttribute or setElementStyle with a null or undefined value removes the
corresponding attribute or style. The argument type should allow this when using strictNullChecks.

Closes #13686

PR Close #17065
2018-10-12 09:17:59 -07:00
Miško Hevery 9ebb4c02a2 docs(ivy): update status.md (#26382)
PR Close #26382
2018-10-12 09:01:41 -07:00
Jason Bedard 071934e92a fix(upgrade): properly destroy upgraded component elements and descendants (#26209)
Fixes #26208

PR Close #26209
2018-10-11 21:07:48 -07:00
Kara Erickson 735dfd3b1a refactor(ivy): replace LNode.dynamicLContainerNode with flat LContainers (#26407)
PR Close #26407
2018-10-11 21:07:21 -07:00
Kara Erickson 70cd112872 refactor(ivy): remove TNode.dynamicContainerNode (#26407)
PR Close #26407
2018-10-11 21:07:21 -07:00
krzysztof-grzybek 0a3f8173f0 refactor(platform-browser): remove type assertion on console.profileEnd (#26303)
Since typescript v3.1 type definition for console.profileEnd is fixed and type assertion 'any' is
not needed any more

PR Close #26303
2018-10-11 14:12:23 -07:00
Pawel Kozlowski 6a64ac4151 fix(ivy): Renderer2 should not use a special injection fn (#26369)
PR Close #26369
2018-10-11 14:12:03 -07:00
Pawel Kozlowski 4b494f23f5 fix(ivy): fix generated code for style bindings with units (#26397)
PR Close #26397
2018-10-11 14:11:15 -07:00
Pete Bacon Darwin 1e69d601fb fix(ivy): ensure that `ɵNgModuleDefWithMeta` is exported (#26082)
This is needed to build an app with `ngtsc` once `ngcc` has compiled
`@angular/core`.

PR Close #26082
2018-10-11 14:08:39 -07:00
Pete Bacon Darwin 34b6d5fff9 refactor(ivy): ngcc - `Transformer` delegates to `Analyzer`s and `Renderer` (#26082)
PR Close #26082
2018-10-11 14:08:39 -07:00
Pete Bacon Darwin 632f66a461 refactor(ivy): ngcc - `Renderer` now manages d.ts transformation (#26082)
PR Close #26082
2018-10-11 14:08:39 -07:00
Pete Bacon Darwin f7b17a4784 refactor(ivy): ngcc - `DecorationAnalyzer` acts on whole program (#26082)
PR Close #26082
2018-10-11 14:08:39 -07:00
Pete Bacon Darwin 9562324ea4 refactor(ivy): implement ngcc `SwitchMarkerAnalyzer` (#26082)
PR Close #26082
2018-10-11 14:08:39 -07:00
Pete Bacon Darwin 880c0add56 refactor(ivy): move and rename `Analyzer` to `DecorationAnalyzer` (#26082)
This is in preparation for adding in other kinds of Analyzer.

PR Close #26082
2018-10-11 14:08:39 -07:00
Pete Bacon Darwin 64c96186da refactor(ivy): move ngcc `rootDirs` computation into a function (#26082)
PR Close #26082
2018-10-11 14:08:39 -07:00
Pete Bacon Darwin 26209fca49 refactor(ivy): remove ngcc `Parser` and use `NgccReflectionHost` instead (#26082)
PR Close #26082
2018-10-11 14:08:39 -07:00
Pete Bacon Darwin 7f03528dbc refactor(ivy): implement `NgccReflectionHost.findDecoratedFiles` (#26082)
PR Close #26082
2018-10-11 14:08:39 -07:00
Pete Bacon Darwin d17602f31d refactor(ivy): rename and move ngcc `Parsed...` to `Decorated...` (#26082)
PR Close #26082
2018-10-11 14:08:39 -07:00
Pawel Kozlowski 053bf27fb3 refactor(ivy): use context discovery in TestBed implementation (#26211)
PR Close #26211
2018-10-11 13:01:28 -07:00
Andrew Kushnir 39f42bad1c feat(ivy): i18n compiler support for element attributes (#26280)
PR Close #26280
2018-10-11 13:00:19 -07:00
Pawel Kozlowski 3f8ac238f1 refactor(ivy): remove unused directives field from TView (#26364)
It was removed in #26316

PR Close #26364
2018-10-11 12:59:02 -07:00
Jason Aden 7466a99dda Revert "fix(upgrade): properly destroy upgraded component elements and descendants (#26209)"
This reverts commit 912f3d186f. Revert is needed due to compilation failures due to this PR inside Google.
2018-10-10 14:44:52 -07:00
Jason Bedard 912f3d186f fix(upgrade): properly destroy upgraded component elements and descendants (#26209)
Fixes #26208

PR Close #26209
2018-10-10 14:19:00 -07:00
Andrew Kushnir be4edf15ee fix(core): resolving merge conflicts in query.ts (#26324)
PR Close #26324
2018-10-09 17:34:08 -07:00
Andrew Kushnir d5e9405d4f fix(ivy): local refs in View and Content Queries should be pulled out into consts in generated code (#26240)
PR Close #26240
2018-10-09 17:20:36 -07:00
Andrew Kushnir e5644204dc fix(ivy): removing unnecessary assert in getOrCreateNodeInjector function (#26305)
PR Close #26305
2018-10-09 16:52:00 -07:00
Andrew Kushnir 69b9758ab8 fix(ivy): removing no longer needed QueryReadType (#26314) (#26314)
PR Close #26314

PR Close #26314
2018-10-09 16:50:34 -07:00
Kara Erickson 7ea5161d4d refactor(ivy): merge directives into LViewData (#26316)
PR Close #26316
2018-10-09 16:46:00 -07:00
Kara Erickson b0879046b7 test(ivy): add testing utility to replace loadDirective (#26316)
PR Close #26316
2018-10-09 16:46:00 -07:00
Alex Rickabaugh 456f23f76a fix(ivy): reflect animations field directly into the output definition (#26322)
The 'animations' field of @Component metadata should be copied directly
into the ngComponentDef for that component and should not pass through
static resolution.

Previously the animations array was statically resolved and then the
values were translated back when generating ngComponentDef.

PR Close #26322
2018-10-09 16:45:31 -07:00
Jason Aden 9623e7c639 Revert "fix(upgrade): properly destroy upgraded component elements and descendants (#26209)"
This reverts commit 5a31bde649.
2018-10-08 14:34:47 -07:00
Pete Bacon Darwin 83302d193e fix(ivy): ensure ngcc compiles `@angular/core` with correct internal imports (#26236)
PR Close #26236
2018-10-08 13:45:46 -07:00
Pete Bacon Darwin 807070fe83 refactor(ivy): ngcc - expose the package name from `EntryPoint` (#26236)
PR Close #26236
2018-10-08 13:45:46 -07:00
Pete Bacon Darwin 6a24db2bc6 fix(ivy): ngcc: only consider decorators from `@angular/core` (#26236)
PR Close #26236
2018-10-08 13:45:46 -07:00