Commit Graph

13155 Commits

Author SHA1 Message Date
Vani 8accc98d28 docs: incorporate review feedback (#26827)
PR Close #26827
2019-02-14 19:33:14 +00:00
Vani aa8d0809d3 docs: update HttpInterceptor API docs (#26827)
PR Close #26827
2019-02-14 19:33:14 +00:00
Kristiyan Kostadinov 80a5934af6 fix(ivy): support schemas at runtime (#28637)
Accounts for schemas in when validating properties in Ivy.

This PR resolves FW-819.

A couple of notes:
* I had to rework the test slightly, in order to have it fail when we expect it to. The one in master is passing since Ivy's validation runs during the update phase, rather than creation.
* I had to deviate from the design in FW-819 and not add an `enableSchema` instruction, because the schema is part of the `NgModule` scope, however the scope is only assigned to a component once all of the module's declarations have been resolved and some of them can be async. Instead, I opted to have the `schemas` on the component definition.

PR Close #28637
2019-02-14 19:31:51 +00:00
Paul Gschwendtner 7cbc36fdac build: remove unused rollup.config.js files (#28646)
Since we build and publish the individual packages
using Bazel and `build.sh` has been removed, we can
safely remove the `rollup.config.js` files which are no
longer needed because the `ng_package` bazel rule
automatically handles the rollup settings and globals.

PR Close #28646
2019-02-14 19:28:08 +00:00
Kristiyan Kostadinov 63e5d2787b fix(ivy): rethrow event handler errors in tests (#28707)
Currently errors thrown inside event handler in Ivy are caught and forwarded to the `ErrorHandler`, however this means that if they happen during a unit test, the test won't fail. These changes add a test-specific `ErrorHandler` that throws the error rather than logging it out.

PR Close #28707
2019-02-14 19:26:56 +00:00
Jeremy Elbourn 83fd66d1d0 fix(ivy): DebugNode should read styles from StylingContext (#28709)
Previously `DebugNode.classes` and `DebugNode.styles` mistakenly used an
object that is only *sometimes* a `StylingContext`. Also fixes a mistake
in `debug_node_spec.ts` where a test component was not declared in the
testing module.

There is still a bug here where `DebugNode` is not exposing *static*
values. This will need to be fixed in a follow up.

PR Close #28709
2019-02-14 19:24:17 +00:00
Matias Niemelä 627cecdfe2 fix(ivy): ensure host bindings and host styling works on a root component (#28664)
Prior to this fix if a root component was instantiated it create host
bindings, but never render them once update mode ran unless one or more
slot-allocated bindings were issued. Since styling in Ivy does not make
use of LView slots, the host bindings function never ran on the root
component.

This fix ensures that the `hostBindings` function does run for a root
component and also renders the schedlued styling instructions when
executed.

Jira Issue: FW-1062

PR Close #28664
2019-02-14 19:23:25 +00:00
George Kalpakas b41da03f00 build(docs-infra): upgrade cli command docs sources to 1631f7d62 (#28727)
Updating [angular#master](https://github.com/angular/angular/tree/master) from [cli-builds#master](https://github.com/angular/cli-builds/tree/master).
Relevant changes in [commit range](ba5120d18...1631f7d62):

**Modified**
- help/build.json

PR Close #28727
2019-02-14 19:22:53 +00:00
Keen Yee Liau 65c2deacbb refactor(bazel): Fix warning about overridden tsconfig options (#28674)
Under Bazel, some compilerOptions in tsconfig.json are controlled by
downstream rules. The default tsconfig.json causes Bazel to print out
warnings about overriden settings.

This commit makes a backup of the original tsconfig.json and removes
tsconfig settings that are controlled by Bazel.

As part of this fix, JsonAst utils are refactored into separate package
and unit tests are added.

PR closes https://github.com/angular/angular/issues/28034

PR Close #28674
2019-02-13 21:24:19 -08:00
Greg Magolan 841a1d32e1 build(bazel): rollback to chromium 69 (latest version that still works on OSX) (#28698)
PR Close #28698
2019-02-13 19:18:27 -08:00
Greg Magolan 362c41de89 build(bazel): pin chromium to 72.0.3636 and chrome-driver to 2.46 on all platforms (#28698)
PR Close #28698
2019-02-13 19:18:27 -08:00
Greg Magolan cf848c6ea0 build(bazel): pin chrome driver to 2.45 and use newer chrome in linux to fix test in CI (#28698)
PR Close #28698
2019-02-13 19:18:27 -08:00
Greg Magolan 47574fef11 build(bazel): temporarily pin browser versions while upstream is fixed as work-around for #28681 (#28698)
PR Close #28698
2019-02-13 19:18:27 -08:00
Pawel Kozlowski b0afc4c638 refactor(ivy): remove unused constructor argument (#28677)
PR Close #28677
2019-02-13 19:18:02 -08:00
Artem Lanovyy 1df3aefb81 fix(forms): mark form as pristine before emitting value and status change events (#28395)
BREAKING CHANGE

Previous to this change, when a control was reset, value and status change
events would be emitted before the control was reset to pristine. As a
result, if one were to check a control's pristine state in a valueChange
listener, it would appear that the control was still dirty after reset.

This change delays emission of value and status change events until after
controls have been marked pristine. This means the pristine state will be
reset as expected if one checks in a listener.

Theoretically, there could be applications depending on checking whether a
control *used to be dirty*, so this is marked as breaking. In these cases,
apps should cache the state on the app side before calling reset.

Fixes #28130

PR Close #28395
2019-02-13 19:17:35 -08:00
Alex Eagle 8cec4b3ff7 build: make api-extractor work in google3 (#28588)
PR Close #28588
2019-02-13 19:16:29 -08:00
Alan Agius 9e5d1357fe build: update `@microsoft/api-extractor` to `7.0.17` (#28588)
This fixes one of the problems that we reported https://github.com/Microsoft/web-build-tools/issues/1048

PR Close #28588
2019-02-13 19:16:29 -08:00
Alan Agius 3bb3d6d3e6 test: update ng_package tests to use bundle_dts (#28588)
PR Close #28588
2019-02-13 19:16:29 -08:00
Alan Agius 3d39100c85 feat(bazel): add dts bundler as action to ng_module (#28588)
This enabled dts flattening in the final distrubutable package.

Notes:
 - For the time being this is an opt-in feature via the `ng_module` attribute  `bundle_dts`, however in the near future this will be turned on by default.
 - This only supports the legacy compiler `ngc`, as `ngtsc` emits namespaced imports `import * as __` from local modules which is not supported for the time being by API Extractor. See: https://github.com/Microsoft/web-build-tools/issues/1029

Ref: TOOL-611

PR Close #28588
2019-02-13 19:16:29 -08:00
Marc Laval 3842dd6a6d fix(ivy): OnChanges should support updating one Input among many (#28693)
PR Close #28693
2019-02-13 19:15:44 -08:00
Alberto Garza 36df9056af docs(animations): fixed some grammar (#28708)
PR Close #28708
2019-02-13 19:14:57 -08:00
Alex Eagle 2c6a6f18c2 build: update jquery to latest (#28719)
Versions less than 3.0.0 have security vulnerabilities

PR Close #28719
2019-02-13 19:14:10 -08:00
Alex Rickabaugh 423b39e216 feat(ivy): use fileNameToModuleName to emit imports when it's available (#28523)
The ultimate goal of this commit is to make use of fileNameToModuleName to
get the module specifier to use when generating an import, when that API is
available in the CompilerHost that ngtsc is created with.

As part of getting there, the way in which ngtsc tracks references and
generates import module specifiers is refactored considerably. References
are tracked with the Reference class, and previously ngtsc had several
different kinds of Reference. An AbsoluteReference represented a declaration
which needed to be imported via an absolute module specifier tracked in the
AbsoluteReference, and a RelativeReference represented a declaration from
the local program, imported via relative path or referred to directly by
identifier if possible. Thus, how to refer to a particular declaration was
encoded into the Reference type _at the time of creation of the Reference_.

This commit refactors that logic and reduces Reference to a single class
with no subclasses. A Reference represents a node being referenced, plus
context about how the node was located. This context includes a
"bestGuessOwningModule", the compiler's best guess at which absolute
module specifier has defined this reference. For example, if the compiler
arrives at the declaration of CommonModule via an import to @angular/common,
then any references obtained from CommonModule (e.g. NgIf) will also be
considered to be owned by @angular/common.

A ReferenceEmitter class and accompanying ReferenceEmitStrategy interface
are introduced. To produce an Expression referring to a given Reference'd
node, the ReferenceEmitter consults a sequence of ReferenceEmitStrategy
implementations.

Several different strategies are defined:

- LocalIdentifierStrategy: use local ts.Identifiers if available.
- AbsoluteModuleStrategy: if the Reference has a bestGuessOwningModule,
  import the node via an absolute import from that module specifier.
- LogicalProjectStrategy: if the Reference is in the logical project
  (is under the project rootDirs), import the node via a relative import.
- FileToModuleStrategy: use a FileToModuleHost to generate the module
  specifier by which to import the node.

Depending on the availability of fileNameToModuleName in the CompilerHost,
then, a different collection of these strategies is used for compilation.

PR Close #28523
2019-02-13 19:13:11 -08:00
Alex Rickabaugh a529f53031 feat(ivy): introduce concrete types for paths in ngtsc (#28523)
This commit introduces a new ngtsc sub-library, 'path', which contains
branded string types for the different kind of paths that ngtsc manipulates.
Having static types for these paths will reduce the number of path-related
bugs (especially on Windows) and will eliminate unnecessary defensive
normalizing.

See the README.md file for more detail.

PR Close #28523
2019-02-13 19:13:11 -08:00
Alex Rickabaugh 99d8582882 feat(ivy): support @Injectable on already decorated classes (#28523)
Previously, ngtsc would throw an error if two decorators were matched on
the same class simultaneously. However, @Injectable is a special case, and
it appears frequently on component, directive, and pipe classes. For pipes
in particular, it's a common pattern to treat the pipe class also as an
injectable service.

ngtsc actually lacked the capability to compile multiple matching
decorators on a class, so this commit adds support for that. Decorator
handlers (and thus the decorators they match) are classified into three
categories: PRIMARY, SHARED, and WEAK.

PRIMARY handlers compile decorators that cannot coexist with other primary
decorators. The handlers for Component, Directive, Pipe, and NgModule are
marked as PRIMARY. A class may only have one decorator from this group.

SHARED handlers compile decorators that can coexist with others. Injectable
is the only decorator in this category, meaning it's valid to put an
@Injectable decorator on a previously decorated class.

WEAK handlers behave like SHARED, but are dropped if any non-WEAK handler
matches a class. The handler which compiles ngBaseDef is WEAK, since
ngBaseDef is only needed if a class doesn't otherwise have a decorator.

Tests are added to validate that @Injectable can coexist with the other
decorators and that an error is generated when mixing the primaries.

PR Close #28523
2019-02-13 19:13:10 -08:00
Alex Rickabaugh d2742cf473 feat(ivy): compile @Injectable on classes not meant for DI (#28523)
In the past, @Injectable had no side effects and existing Angular code is
therefore littered with @Injectable usage on classes which are not intended
to be injected.

A common example is:

@Injectable()
class Foo {
  constructor(private notInjectable: string) {}
}

and somewhere else:

providers: [{provide: Foo, useFactory: ...})

Here, there is no need for Foo to be injectable - indeed, it's impossible
for the DI system to create an instance of it, as it has a non-injectable
constructor. The provider configures a factory for the DI system to be
able to create instances of Foo.

Adding @Injectable in Ivy signifies that the class's own constructor, and
not a provider, determines how the class will be created.

This commit adds logic to compile classes which are marked with @Injectable
but are otherwise not injectable, and create an ngInjectableDef field with
a factory function that throws an error. This way, existing code in the wild
continues to compile, but if someone attempts to use the injectable it will
fail with a useful error message.

In the case where strictInjectionParameters is set to true, a compile-time
error is thrown instead of the runtime error, as ngtsc has enough
information to determine when injection couldn't possibly be valid.

PR Close #28523
2019-02-13 19:13:10 -08:00
Alex Rickabaugh f8b67712bc fix(ivy): translate WriteKeyExpr expressions properly (#28523)
Translation of WriteKeyExpr expressions was not implemented in the ngtsc
expression translator. This resulted in binding expressions like
"target[key] = $event" not compiling.

This commit fixes the bug by implementing WriteKeyExpr translation.

PR Close #28523
2019-02-13 19:13:10 -08:00
Alex Rickabaugh 3477610f6d fix(ivy): resolve enum values in host bindings (#28523)
Some applications use enum values in their host bindings:

@Component({
  host: {
    '[prop]': EnumType.Key,
  }, ...
})

This commit changes the resolution of host properties to follow the enum
declaration and extract the correct value for the binding.

PR Close #28523
2019-02-13 19:13:10 -08:00
Alex Rickabaugh 09af7ea4f5 fix(compiler): fix two existing expression transformer issues (#28523)
Testing of Ivy revealed two bugs in the AstMemoryEfficientTransformer
class, a part of existing View Engine compiler infrastructure that's
reused in Ivy. These bugs cause AST expressions not to be transformed
under certain circumstances.

The fix is simple, and tests are added to ensure the specific expression
forms that trigger the issue compile properly under Ivy.

PR Close #28523
2019-02-13 19:13:10 -08:00
Paul Gschwendtner dba2a406fd build: remove legacy e2e tests job (#28645)
Now that all e2e integration tests within `modules/` have been
migrated to Bazel, we can remove the legacy e2e tests job.

PR Close #28645
2019-02-13 12:15:02 -08:00
Paul Gschwendtner fb194d5146 build: update instructions to run benchmark tests (#28645)
* Updates the instructions on how to run the benchmark tests.
* Removes the unused `favicon.ico` file and the corresponding Bazel filegroup

PR Close #28645
2019-02-13 12:15:01 -08:00
Paul Gschwendtner 0a4811c4ad build: convert largeform benchmarks to bazel (#28645)
Switches the `largeform` benchmarks to Bazel.
This is the last remaining e2e test within `modules/`.

PR Close #28645
2019-02-13 12:15:01 -08:00
Paul Gschwendtner 13685131bc build: run largetable benchmark tests with bazel (#28645)
PR Close #28645
2019-02-13 12:15:01 -08:00
Paul Gschwendtner 1a326d5690 build: serve largetable benchmark tests with bazel (#28645)
PR Close #28645
2019-02-13 12:15:01 -08:00
Greg Magolan 28bdeeef3e build(bazel): update to rules_nodejs 0.18.6 (#28699)
PR Close #28699
2019-02-13 12:13:08 -08:00
Pawel Kozlowski 6fa4235543 test(ivy): enable passing Material tests (#28687)
PR Close #28687
2019-02-13 12:12:45 -08:00
Pawel Kozlowski 6d057cc05d fix(ivy): should mark OnPush ancestor of dynamically created views as dirty (#28687)
While marking a given views tree as dirty we should go all the way to the
root of the views tree and cross boundaries of dynamically inserted views.
In other words the markForCheck functionality should consider parents of
dynamically inserted views.

PR Close #28687
2019-02-13 12:12:45 -08:00
Pawel Kozlowski 2f27a8051b test(ivy): ivy change detection doesn't descend into CD-detached view trees (#28680)
PR Close #28680
2019-02-13 12:12:26 -08:00
Trotyl Yu 77eee42963 fix(core): improve global variable detection (#28679)
Closes #16545

PR Close #28679
2019-02-13 12:05:41 -08:00
Andrew Kushnir 553f80ff46 fix(ivy): set proper implementation for module injector (#28667)
Prior to this change we used current injector implementation for module injector, which was causing problems and produces circular dependencies in case the same token is referenced (with @SkipSelf flag) in the `deps` array. The origin of the problem was that once `directiveInject` implementation becomes active, it was used for module injector as well, thus searching deps in Component/Directive DI scope. This fix sets `injectInjectorOnly` implementation for module injector to resolve the problem.

PR Close #28667
2019-02-13 12:05:13 -08:00
Kapunahele Wong 5cafd44654 fix(docs-infra): fix filtering in run-example-e2e.js (#28663)
PR Close #28663
2019-02-13 12:04:51 -08:00
SebastienBtr cb0a8b566f docs(router): change slideInDownAnimation into slideInAnimation (#28640)
In the Routing & Navigation there is a typo - slideInDownAnimation, but it should be slideInAnimation

PR Close #28572

PR Close #28640
2019-02-13 12:03:45 -08:00
Paul Gschwendtner cf6d63ca63 build: fix web_worker images example not working (#28562)
The web_worker images example is currently not really usable
because the rendered button that can be used to upload
an "image" to the demo is currently not working. This is because
the HTML markup for the `file-field` is not matching what `materialize-css`
expects. See: https://materializecss.com/text-inputs.html

PR Close #28562
2019-02-13 12:01:54 -08:00
Paul Gschwendtner 1d20088291 build: playground examples do not explicitly specify "ng_module" assets (#28562)
Currently all playground examples are built with NGC, and most
of the HTML resources are automatically inlined. Surprisingly NGC
is able to resolve the relative component assets even though these
aren't specified in the `assets`. This seems to work because NGC
resolves the files in the execroot where the files are present
(if Bazel doesn't use sandboxing).

Issue is tracked with TOOL-667

PR Close #28562
2019-02-13 12:01:54 -08:00
Paul Gschwendtner 7e895b9179 build: fix web_worker playground examples using external resources (#28562)
The `web_workers/images` example is not being tested by any e2e
spec and therefore it's technically not necessary to fix that it uses
external resources, though in order to ensure that the Bazel builds
are hermetic and that we can eventually add e2e specs for the
web_worker/image example, we should avoid any use of external
resources.

We remove the `web-animations` polyfill in the `web_workers/animations`
example because we should try to vendor as few as possible deps. Also
the animations API is already supported by browsers we run the e2e tests
against (note here: `web_workers/animations` is currently also disabled)

PR Close #28562
2019-02-13 12:01:54 -08:00
Andrew Kushnir 39d0311e4e refactor(ivy): combine contentQueries and contentQueriesRefresh functions (#28503)
Prior to this update we had separate contentQueries and contentQueriesRefresh functions to handle creation and update phases. This approach was inconsistent with View Queries, Host Bindings and Template functions that we generate for Component/Directive defs. Now the mentioned 2 functions are combines into one (contentQueries), creation and update logic is separated with RenderFlags (similar to what we have in other generated functions).

PR Close #28503
2019-02-13 12:01:32 -08:00
Judy Bogart 644e7a28d8 docs: add di-related api doc (#27731)
PR Close #27731
2019-02-13 11:57:37 -08:00
Marc Laval f8b9e61469 test(ivy): enable more docs examples e2e tests (#28688)
PR Close #28688
2019-02-13 09:53:13 -08:00
Keen Yee Liau 2ea030c2c5 fix(bazel): Turn on strict action env (#28675)
This commit fixes a bug whereby recompilation occurs every time `yarn ng build`
or `yarn bazel build ...` is invoked.

This is a temporary solution until # https://github.com/bazelbuild/bazel/issues/7026
is fixed.

PR Close #28675
2019-02-13 09:52:51 -08:00
Keen Yee Liau 49fb8c3cb0 fix(bazel): Install angular repo before yarn_install (#28670)
PR closes https://github.com/angular/angular/issues/28636

PR Close #28670
2019-02-13 09:52:30 -08:00