Commit Graph

2123 Commits

Author SHA1 Message Date
Pawel Kozlowski 0386c44acc fix(ivy): inject attributes for directives on ng-template / ng-container (#25697)
PR Close #25697
2018-08-28 14:34:59 -04:00
Matias Niemelä 0024d68add feat(ivy): add support for resolving view data from a DOM node (#25627)
PR Close #25627
2018-08-27 21:15:29 -04:00
Igor Minar 317d40d879 test(compiler-cli): improve testing harness for incremental compilation (#25275)
In tsc 3.0 the check that enables program structure reuse in tryReuseStructureFromOldProgram has changed
and now uses identity comparison on arrays within CompilerOptions. Since we recreate the options
on each incremental compilation, we now fail this check.

After this change the default set of options is reused in between incremental compilations, but we still
allow options to be overriden if needed.

PR Close #25275
2018-08-27 21:07:53 -04:00
Alex Rickabaugh ab32ac6bb7 test(compiler-cli): fix the incremental ngc tests so that they run under bazel (#25275)
PR Close #25275
2018-08-27 21:07:53 -04:00
Alan Agius 5653fada32 feat: add TypeScript 3 support (#25275)
PR Close #25275
2018-08-27 21:07:53 -04:00
Greg Magolan 366195e182 build(bazel): esm5_outputs_aspect to work with targets such as ts_proto_library with no replay_params attribute (#25605)
PR Close #25605
2018-08-27 18:19:44 -04:00
Pawel Kozlowski 6a0f78fabf fix(ivy): match directives on bindings and element outputs (#25614)
Closes #23560

PR Close #25614
2018-08-27 18:17:25 -04:00
Pawel Kozlowski 3634575d89 test(common): fix double instantiation in NgSwitch test (#25632)
One of the tests was creating TestComponent instance _and_ using
global state making this test not predictable. Fixing the test
by making sure that TestComponent is instantiated only once.

PR Close #25632
2018-08-27 16:40:56 -04:00
Greg Magolan 9bcd8c2425 build(bazel): use value of /// <amd-module name=“”> directive to convert fileNameToModuleName in ngc-wrapped (#25650)
PR Close #25650
2018-08-27 12:21:18 -04:00
Pawel Kozlowski 8fa099158e fix(ivy): allow queries for ng-container without read option (#25617)
PR Close #25617
2018-08-24 11:52:50 -04:00
Pawel Kozlowski b00038c847 fix(ivy): inject ViewContainerRef for directives on ng-container (#25617)
PR Close #25617
2018-08-24 11:52:50 -04:00
George Kalpakas 18f129f536 build: upgrade Chromium and ChromeDriver to latest versions (#25602)
PR Close #25602
2018-08-24 11:48:40 -04:00
George Kalpakas 658f49f650 docs(elements): fix typo (tranformation --> transformation) (#25600)
PR Close #25600
2018-08-23 16:54:49 -04:00
Matias Niemelä a37bcc3bfe feat(ivy): bridge component styles into the component renderer (#25255)
PR Close #25255
2018-08-23 16:51:15 -04:00
Alex Eagle 22e7f7e99f build(bazel): update to rules_typescript 0.16.1 (#25490)
PR Close #25490
2018-08-23 15:26:21 -04:00
Matias Niemelä 668bfcec9d fix(docs-infra): fix closure warning issue for improper internal flag (#25628)
PR Close #25628
2018-08-22 21:59:22 -04:00
Alex Rickabaugh eb1fe19088 fix(ivy): ngtsc directive compilation should use shared ConstantPool (#25620)
This fixes a bug in ngtsc where each @Directive was compiled using a
separate ConstantPool. This resulted in two issues:

* Directive constants were not shared across the file
* Extra statements from directive compilation were dropped instead of
added to the file

This commit fixes both issues and adds a test to verify @Directive is
working properly.

PR Close #25620
2018-08-22 21:14:54 -04:00
Greg Magolan 22d58fc89b build(bazel): remove workaround no longer needed for module names for ngfactory & ngsummary files (#25604)
Workaround was added in https://github.com/angular/angular/pull/25335. It was necessary for .ngfactory & .ngsummary files to have proper AMD module names starting with @angular when building angular downstream from source using Bazel. The underlying issue has been resolved in the compiler and these files now get proper AMD module names without the need for this workaround. The workaround had an unexpected consequence https://github.com/angular/angular-cli/issues/11835 which is fixed by its removal.

PR Close #25604
2018-08-22 21:11:18 -04:00
Kara Erickson 27e2039630 fix(compiler): update compiler to generate new slot allocations (#25607)
PR Close #25607
2018-08-22 21:08:39 -04:00
Alex Rickabaugh 5c95b4b3a3 feat(ivy): support enum values in static resolution (#25619)
This commit adds support for enumeration values. An enumeration value
is now a first-class return value of the resolver, which provides both
a Reference to the enum type itself and the name of the value from that
enum. Resolving an enum itself returns a Map<string, EnumValue>.

PR Close #25619
2018-08-22 19:30:23 -04:00
Alex Rickabaugh 61218f5f0b fix(ivy): ensure factory statements are emitted correctly (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
Pete Bacon Darwin 7500f0eafb feat(ivy): find all packages to be compiled by ngcc (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
Pete Bacon Darwin 68acc5b355 feat(ivy): compile all package formats in ngcc (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
Pete Bacon Darwin 7d3b70c2af fix(ivy): ngcc is resilient to bad source-map comments (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
Pete Bacon Darwin 7ce291c72a feat(ivy): implement `Esm5ReflectionHost.getGenericArityOfClass()` (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
Pete Bacon Darwin 6ae1e63c89 refactor(ivy): rename `Esm2015ReflectionHost` to `Fesm2015ReflectionHost` (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
Alex Rickabaugh d33e0091df fix(ivy): emit generic types when needed in defs in .d.ts file (#25406)
Ivy definitions in .d.ts files often reference the type of a class.
Sometimes, those classes have generic type parameters. When this is
the case, ngtsc needs to emit generic type parameters in the .d.ts
files (usually by passing 'any').

PR Close #25406
2018-08-22 19:28:56 -04:00
George Kalpakas b97d770e60 feat(ivy): add support for typings in ngcc (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
George Kalpakas a3158bff27 refactor(ivy): minor re-organization of ngcc `PackageTransformer#transform` (#25406)
In preparation of adding support for transforming `.d.ts` files.

PR Close #25406
2018-08-22 19:28:56 -04:00
George Kalpakas d6e91ba545 feat(ivy): support getting the corresponding `.d.ts` file in ngcc (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
George Kalpakas cdb0215d0b test(ivy): clean up ngcc spec (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
George Kalpakas 396766104b refactor(ivy): rename spec files to match corresponding source files (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
George Kalpakas e77f0fd6e6 refactor(ivy): export ngcc import prefix into constant (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
George Kalpakas cdd4c9be63 feat(ivy): support custom prefix for imports in `DtsFileTransformer` (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
George Kalpakas 29705dd8f2 refactor(ivy): make `ReflectionHost` a parameter of `Renderer` (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
George Kalpakas ea68ba048a refactor(ivy): minor refactorings (#25406)
PR Close #25406
2018-08-22 19:28:55 -04:00
George Kalpakas 9081efa961 feat(ivy): enable processing of esm5 format in ngcc (#25406)
PR Close #25406
2018-08-22 19:28:55 -04:00
George Kalpakas 9e179cb311 fix(ivy): correctly detect classes in ngcc `Esm5ReflectionHost` (#25406)
PR Close #25406
2018-08-22 19:28:55 -04:00
George Kalpakas 3211432d2a feat(ivy): add support for esm2015 and esm5 in ngcc `PackageParser` (#25406)
Since non-flat module formats (esm2015, esm5) have different structure
than their flat counterparts (and since we are operating on JS files
inside `node_modules/`, we need to configure TS to include deeply nested
JS files (by specifying a sufficiently high `maxNodeModuleJsDepth`).

Remains to be determined if this has any (noticeable) performance
implications.

PR Close #25406
2018-08-22 19:28:55 -04:00
George Kalpakas a7134dbc37 refactor(ivy): remove unused arg from ngcc `Analyzer` (#25406)
PR Close #25406
2018-08-22 19:28:55 -04:00
Pete Bacon Darwin a528636f56 fix(ivy): allow `FunctionExpression` to indicate a method declaration (#25406)
In some code formats (e.g. ES5) methods can actually be function
expressions. For example:

```js
function MyClass() {}
// this static method is declared as a function expression
MyClass.staticMethod = function() { ... };
```

PR Close #25406
2018-08-22 19:28:55 -04:00
Pete Bacon Darwin f87b499dde feat(ivy): implement `getDefinitionOfFunction` on ES2015 and ES5 reflection hosts (#25406)
PR Close #25406
2018-08-22 19:28:55 -04:00
Alex Rickabaugh a45f2bfb8f feat(ivy): use the ReflectionHost to resolve parameters and initializers (#25406)
ngtsc's static resolver can evaluate function calls where parameters
have default values. In TypeScript code these default values live on the
function definition, but in ES5 code the default values are represented
by statements in the function body.

A new ReflectionHost method getDefinitionOfFunction() abstracts over
this difference, and allows the static reflector to more accurately
evaluate ES5 code.

PR Close #25406
2018-08-22 19:28:55 -04:00
Kara Erickson d5b70e0c66 fix(ivy): create LViewData from blueprint (#25587)
PR Close #25587
2018-08-22 15:58:42 -04:00
Marc Laval 6176974832 test(compiler-cli): fix failing test after bad merge (#25599)
PR Close #25599
2018-08-21 11:30:42 -07:00
Kara Erickson 831e71ea3c fix(ivy): host bindings should support array/object literals (#25583)
PR Close #25583
2018-08-21 10:48:42 -07:00
Jason Aden fc89479044 fix(router): default scroll position restoration to disabled (#25586)
Fixes #25145
FW-305 #resolve

PR Close #25586
2018-08-21 10:48:14 -07:00
Ben Lesh f54f3856cb feat(ivy): add query inheritance (#25556)
Adds inheritance handling for the following:

- viewQuery
- contentQueries
- contentQueriesRefresh

PR Close #25556
2018-08-20 16:36:22 -07:00
Vikram Subramanian 9ed3bd6b4f refactor(bazel): allow and ignore extra args for _ts_expected_outs (#25558)
This is needed to let ts_compile_actions take explicit list of srcs and deps to generate tsc actions from another rule. This is no-op for ngc for now.

PR Close #25558
2018-08-20 16:25:19 -07:00
Pawel Kozlowski 11e2d9da1a feat(ivy): add support to template local refs in the compiler (#25576)
Fixes #23316

PR Close #25576
2018-08-20 16:24:56 -07:00
Kara Erickson 21a14407f6 refactor(ivy): generate vars in component defs (#25562)
PR Close #25562
2018-08-20 11:08:10 -07:00
Kara Erickson f2aa9c6a7f refactor(ivy): use generated consts value to set binding index (#25533)
PR Close #25533
2018-08-17 14:32:55 -07:00
Kara Erickson 4708cb91ef refactor(ivy): remove reserveSlots instruction (#25533)
PR Close #25533
2018-08-17 14:32:55 -07:00
Wei Huang f053a3f274 test(bazel): Remove --no-sandbox for protractor tests (#25362)
Since we no longer need this flag to run web tests inside a docker
container, this reverts https://github.com/angular/angular/pull/24906

PR Close #25362
2018-08-17 09:58:30 -07:00
Pawel Kozlowski 31f0f5b3c3 feat(ivy): add support for local refs on ng-template (#25482)
PR Close #25482
2018-08-17 09:58:07 -07:00
Marcus Krahl 07d8d3994c feat(router): add UrlSegment[] to CanLoad interface (#13127)
CanLoad now defines UrlSegment[] as a second parameter of the function.
Users can store the initial url segments and refer to them later, e.g. to go
back to the original url after authentication via router.navigate(urlSegments).
Existing code still works as before because the second function parameter
does not have to be defined.

Closes #12411

PR Close #13127
2018-08-16 16:32:18 -07:00
Miško Hevery 116946fb11 style: tslint enforces no debugger statements left behind (#25532)
PR Close #25532
2018-08-16 16:00:22 -07:00
Misko Hevery 503905c807 feat(ivy): add `ngcc` ivy switch (#25238)
Provides a runtime and compile time switch for ivy including
`ApplicationRef.bootstrapModule`.

This is done by naming the symbols such that `ngcc` (angular
Compatibility compiler) can rename symbols in such a way that running
`ngcc` command will switch the `@angular/core` module from `legacy` to
`ivy` mode.

This is done as follows:

```
const someToken__PRE_NGCC__ = ‘legacy mode’;
const someToken__POST_NGCC__ = ‘ivy mode’;

export someSymbol = someToken__PRE_NGCC__;
```

The `ngcc` will search for any token which ends with `__PRE_NGCC__`
and replace it with `__POST_NGCC__`. This allows the `@angular/core`
package to be rewritten to ivy mode post `ngcc` execution.

PR Close #25238
2018-08-16 13:51:42 -07:00
Kara Erickson 6482f6f0fe refactor(ivy): separate container into 2 instructions (#25509)
PR Close #25509
2018-08-16 13:47:14 -07:00
Greg Magolan 9605456b66 build: refactor ambient node & jasmine types so they are only included where needed (#25491)
PR Close #25491
2018-08-16 13:46:43 -07:00
Miško Hevery 9ee6702fa9 refactor(ivy): remove short instruction names as they provide no value (#25493)
PR Close #25493
2018-08-16 11:04:34 -07:00
Victor Berchet 1f1103913a refactor(ivy): cleanup the public API for core/testing (#25492)
PR Close #25492
2018-08-15 09:53:17 -07:00
Alan Agius 01ec5fd6b0 fix(service-worker): `Cache-Control: no-cache` on assets breaks service worker (#25408)
At the moment `cacheAge` can we undefined when having `Cache-Control` set to `no-cache` due the mapping method in `needToRevalidate`

Closes #25442

PR Close #25408
2018-08-14 16:40:15 -07:00
Kieran Whiteman be2cf4dfd6 docs(core): Correct spelling error in directives docs (#25377)
Link to life-cycle hooks was spelt as "life-cycle hoooks".
PR Close #25377
2018-08-14 16:39:33 -07:00
Greg Magolan b5f354f2fb build(bazel): update to rules_typescript 0.16.0 & update to tagged rules_webtesting 0.2.1 (#25433)
PR Close #25433
2018-08-14 16:37:15 -07:00
Ben Lesh a0a29fdd27 feat(ivy): Add AOT handling for bare classes with Input and Output decorators (#25367)
PR Close #25367
2018-08-14 16:36:18 -07:00
Alex Rickabaugh 26066f282e fix(ivy): consider exported modules from other compilation scopes (#25425)
PR Close #25425
2018-08-14 14:23:24 -07:00
Alex Rickabaugh b40c437379 fix(ivy): ensure factory statements are emitted correctly (#25425)
A small bug caused base factory variable statements for @Component to
not be emitted properly. At the same time as this is fixed, those
statements are now emitted as const.

PR Close #25425
2018-08-14 14:23:24 -07:00
Alex Rickabaugh 82e2725154 fix(ivy): handle the case where no base factory is found (#25425)
When an Angular decorated class is inherited, it might be the case that
the entire inheritance chain actually has no constructor defined. In
that event, a factory which simply instantiates the type without any
arguments should be used.

PR Close #25425
2018-08-14 14:23:24 -07:00
Judy Bogart 98f336c0fb docs: add api doc for programmatic animation classes (#24668)
PR Close #24668
2018-08-14 13:15:27 -07:00
Pawel Kozlowski 9117fa199c test(ivy): activate local references canonical spec (#25462)
PR Close #25462
2018-08-14 12:01:55 -07:00
Pawel Kozlowski 0c4209f4b9 refactor(ivy): harmonize container and element / elementContainer signatures (#25458)
PR Close #25458
2018-08-14 12:01:23 -07:00
Victor Berchet 14ac7ad6b4 feat(ivy): implement TestBed (#25369)
PR Close #25369
2018-08-14 11:58:47 -07:00
Victor Berchet 85106375ac refactor(ivy): misc cleanup (#25369)
PR Close #25369
2018-08-14 11:58:47 -07:00
Ben Lesh bbb3f8fa60 docs(ivy): add better documentation around debugging ivy tests (#25432)
PR Close #25432
2018-08-13 21:44:55 -07:00
Martin Probst c869b143c6 build: drop unused re-export of json_marshal. (#25449)
This appears to be unused, and will be removed from rules_typescript now
that `struct.to_json` can take `dicts`.

PR Close #25449
2018-08-13 21:37:41 -07:00
Ben Lesh 1bb30147d3 fix(ivy): add typeof guard around ngDevMode for instances where we cannot set it in Node (#25475)
PR Close #25475
2018-08-13 20:50:53 -07:00
Ben Lesh fb2c5241fc fix(bazel): correct type concatenated to devmode_js (#25467)
PR Close #25467
2018-08-13 17:27:45 -07:00
Ben Lesh 97d8b5ed88 fix(ivy): reordering how root is acquired (#25470)
PR Close #25470
2018-08-13 17:25:47 -07:00
Kara Erickson 4a4d6fb0e6 test(ivy): compiler compliance tests should support ? (#25435)
PR Close #25435
2018-08-10 17:12:18 -07:00
Miško Hevery 2016afdbff fix(ivy): remove ivy dependency on ViewEngine's resolveRendererType2 (#25396)
PR Close #25396
2018-08-10 13:32:04 -07:00
Kara Erickson 409860a4da fix(ivy): queries should be restored when view changes (#25415)
PR Close #25415
2018-08-10 09:13:16 -07:00
Kara Erickson 2b128a47b9 refactor(ivy): queries should not rely on LNode (#25415)
PR Close #25415
2018-08-10 09:13:16 -07:00
Pawel Kozlowski 2d759927d4 feat(ivy): add support for ng-container in the compiler (#25383)
PR Close #25383
2018-08-09 13:13:04 -07:00
Alex Rickabaugh 7058072ff6 feat(ivy): enable .ngfactory.js generation in g3 only (#25392)
This turns on generation of ngfactory.js files when compiling in Ivy
mode in g3. They're not turned on for Bazel users as there appears to
be a strange interaction with the way our tests run in Bazel mode.

PR Close #25392
2018-08-09 09:58:13 -07:00
Alex Rickabaugh 33fd7e0784 fix(ivy): export NgModuleFactory via r3_symbols for core factories (#25392)
When @angular/core is compiled by ngtsc, a factory file is generated
for ApplicationModule, that is currently invalid because r3_symbols
does not export NgModuleFactory. This change fixes that issue and
ensures the generated ngfactory file for @angular/core is valid.

PR Close #25392
2018-08-09 09:58:13 -07:00
Alex Rickabaugh 2befc65777 fix(ivy): ngtsc should pay attention to declaration order (#25392)
When generating the 'directives:' property of ngComponentDef, ngtsc
needs to be conscious of declaration order. If a directive being
written into the array is declarated after the component currently
being compiled, then the entire directives array needs to be wrapped
in a closure.

This commit fixes ngtsc to pay attention to such ordering issues
within directives arrays.

PR Close #25392
2018-08-09 09:58:13 -07:00
Alex Rickabaugh 6f085f8610 fix(ivy): add missing exportAs field to ngDirectiveDef (#25392)
This commit includes the missing exportAs field from @Directive and
propagates it into the ngDirectiveDef.

PR Close #25392
2018-08-09 09:58:13 -07:00
Alex Rickabaugh 5be186035f feat(ivy): enable inheritance of factory functions in definitions (#25392)
This commit creates an API for factory functions which allows them
to be inherited from one another. To do so, it differentiates between
the factory function as a wrapper for a constructor and the factory
function in ngInjectableDefs which is determined by a default
provider.

The new form is:

factory: (t?) => new (t || SomeType)(inject(Dep1), inject(Dep2))

The 't' parameter allows for constructor inheritance. A subclass with
no declared constructor inherits its constructor from the superclass.
With the 't' parameter, a subclass can call the superclass' factory
function and use it to create an instance of the subclass.

For @Injectables with configured providers, the factory function is
of the form:

factory: (t?) => t ? constructorInject(t) : provider();

where constructorInject(t) creates an instance of 't' using the
naturally declared constructor of the type, and where provider()
creates an instance of the base type using the special declared
provider on @Injectable.

PR Close #25392
2018-08-09 09:58:13 -07:00
Alex Rickabaugh fba276d3d1 fix(ivy): use a single constant pool per source file (#25392)
Previously, ngtsc used a new ConstantPool for each decorator
compilation. This could result in collisions between constants in the
top-level scope.

Now, ngtsc uses a single ConstantPool for each source file being
compiled, and merges the constant statements into the file after the
import section.

PR Close #25392
2018-08-09 09:58:13 -07:00
Pawel Kozlowski 9c92a6fc7a test(ivy): add test for <ng-container> and shallow queries (#25379)
PR Close #25379
2018-08-09 07:35:01 -07:00
Alex Eagle 6c4da9dcd3 build: stop printing source-map-support warning (#25339)
PR Close #25339
2018-08-08 19:02:57 -07:00
Miško Hevery b64fed1ba3 fix(ivy): prevent ngDevMode from getting removed too early (#25371)
PR Close #25371
2018-08-08 13:13:16 -07:00
Alex Eagle a3f1e2cb42 style: format .bzl files with buildifier (#23544)
PR Close #23544
2018-08-08 13:12:07 -07:00
Alex Eagle bfdbdc2ee6 docs(bazel): add skydoc generation (#23544)
PR Close #23544
2018-08-08 13:12:07 -07:00
Igor Minar 74518c4b2e style: fix whitespace and indentation in the testing guide (#21669)
PR Close #21669
2018-08-08 13:11:15 -07:00
JiaLi.Passion ebf508fcd0 docs: add docs for fakeAsync test with custom macroTask in aio (#21669)
PR Close #21669
2018-08-08 13:11:15 -07:00
Roope Hakulinen 732026c3f5 feat(core): add DoBootstrap interface. (#24558)
Closes #24557.

PR Close #24558
2018-08-07 13:17:06 -07:00
Pawel Kozlowski af9ced9026 fix(ivy): project ng-container nodes (#25354)
PR Close #25354
2018-08-07 12:02:48 -07:00
Ádám Lippai c6e5b971d6 fix(compiler-cli): use the oldProgram option in watch mode (#21364)
The performCompilation() is always called with an undefined oldProgram option (even in watch mode).
This was regression introduced in: 957be960d2

Partial fix, discovered in: #21361

PR Close #21364
2018-08-07 11:58:38 -07:00