Commit Graph

14037 Commits

Author SHA1 Message Date
Brandon 78146c1890 docs: update extra options available for RouterModule.forRoot() method (#29846)
PR Close #29846
2019-04-17 17:25:31 -07:00
Filipe Silva e1f51eaa55 feat(compiler-cli): export tooling definitions (#29929)
PR Close #29929
2019-04-17 17:23:01 -07:00
Filipe Silva e5905bb035 fix(core): use shakeable global definitions (#29929)
The `ngDevMode` and `ngI18nClosureMode` are special in that they should be set to `false` on production builds in order to shake out code associated with it.

Angular CLI does this in 5fc1f2499c/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts (L279-L282).

But in https://github.com/angular/angular/pull/28689 the toplevel usage was changed from `ngDevMode` to `global['ngDevMode']` (and the same for `ngI18nClosureMode`). This indirection prevents the static analysis in Terser from effecting the replacement.

PR Close #29929
2019-04-17 17:23:01 -07:00
Alex Eagle b9251fd707 build: Remove cc_binary dependency on brotli (#29912)
Just use the JavaScript port instead. We don't care about speed since we compress once as a build step.

PR Close #29912
2019-04-17 17:20:16 -07:00
Brad Green c0ec1d63ff docs: update product-alerts.component.1.ts (#29917)
Make the example match the generated output seen in StackBlitz as shown https://next.angular.io/getting-started#input step 2 "Open product-alerts.component.ts."

PR Close #29917
2019-04-17 16:49:21 -07:00
Alan Agius 4bde40f7c2 fix(core): don't include a local `EventListener` in typings (#29809)
With dts bundles, `core.d.ts` will include an `EventListener` class as it's used in 303eae918d/packages/core/src/debug/debug_node.ts (L32)

This will conflict with the DOM EventListener, as anything in `core.d.ts` which is using the DOM EventListener will fallback in using the one defined in the same module and hence build will fail because their implementation is different.

With this change, we rename the local `EventListener` to `DebugEventListener`, the later one is non exported.

Fixes #29806

PR Close #29809
2019-04-17 16:45:35 -07:00
Greg Magolan 4271d35dc4 build(bazel): fix missing deps in ts_devserver targets under /modules/playground/src/web_workers (#29799)
PR Close #29799
2019-04-17 13:02:03 -07:00
Greg Magolan 506f478f08 build(bazel): fix deps of test (#29799)
PR Close #29799
2019-04-17 13:02:03 -07:00
Greg Magolan 8a3a556c0c build(bazel): fix failure in http_server target due to transitive npm deps (#29799)
PR Close #29799
2019-04-17 13:02:03 -07:00
Greg Magolan ce2713f5b1 build(bazel): remove @ts-api-guardian_deps yarn_install (#29799)
PR Close #29799
2019-04-17 13:02:03 -07:00
Greg Magolan 7edfcf948f build(bazel): update to nodejs rules 0.27.12 and pin versions in @angular/bazel peer deps and for @bazel/schematics (#29799)
PR Close #29799
2019-04-17 13:02:03 -07:00
JoostK 83291f01b0 fix(ivy): let ngtsc unwrap expressions when resolving `forwardRef` (#29886)
Previously, ngtsc would fail to resolve `forwardRef` calls if they
contained additional parenthesis or casts. This commit changes the
behavior to first unwrap the AST nodes to see past such insignificant
nodes, resolving the issue.

Fixes #29639

PR Close #29886
2019-04-17 12:52:34 -07:00
JoostK 725148a44d feat(ivy): let ngtsc statically evaluate `Array.concat` calls (#29887)
Previously, only static evaluation of `Array.slice` was implemented in
ngtsc's static evaluator. This commit adds support for `Array.concat`.

Closes #29835

PR Close #29887
2019-04-17 12:49:13 -07:00
Andrew Kushnir 696e520842 fix(ivy): make metadata calls side-effect free in Closure (#29947)
When compiling Angular classes, the compiler may decide to append statements with specific metadata that's only required for JIT. This includes things like decorator metadata as well as NgModule scope data.

When the compiler generates such calls, the call sites are marked with Uglify's PURE annotation, so the optimizer will remove them in production builds. However, Closure does not have the PURE (or similar) annotation. We have a utility function `noSideEffects` in the runtime for this purpose. This commit wraps `setClassMetadata` and `setNgModuleScope` function bodies in `noSideEffect` closures to allow Closure remove them.

PR Close #29947
2019-04-17 12:20:51 -07:00
Pawel Kozlowski 5fee9daa5b fix(ivy): properly coalesce event handler in presence of queries (#29957)
The `TNode.cleanup` data structure can contain sequences of 4-element
sequence of entries (event handlers, directive outputs) mixed with
2-element sequence of entries (QueryList cleanup). Before this fix
we would always skip 4 elements in the `TNode.cleanup` while looking
up event handler cleanups. 4-element skips are not correct in case
of query cleanup presence and this commit corrects the algorithm to
jump 4 or 2 elements depending on a type of cleanup encountered.

PR Close #29957
2019-04-17 12:20:00 -07:00
Keen Yee Liau 1a56cd5c0b fix(language-service): Use proper types instead of any (#29942)
PR Close #29942
2019-04-17 12:17:13 -07:00
George Kalpakas 60e9d2da4f ci(docs-infra): increase wait for SW on localhost to avoid CI flakes (#29953)
The server used for testing on localhost has less optimizations (e.g.
serves uncompressed files), so we need to wait longer the ServiceWorker
to be loaded and registered to allow Lighthouse to reliably detect it,
especially on slower environments (e.g. CI).

Related: https://github.com/GoogleChrome/lighthouse/issues/5527#issuecomment-483710849

Fixes #29910

PR Close #29953
2019-04-17 12:14:39 -07:00
George Kalpakas ca9b3eed9e refactor(docs-infra): switch `test-pwa-score.js` to async/await (#29953)
PR Close #29953
2019-04-17 12:14:39 -07:00
Keen Yee Liau a48d288ff8 build(language-service): no need to bootstrap init_node_spec.js (#29937)
PR Close #29937
2019-04-17 12:13:39 -07:00
Kara Erickson d9c39dcab0 fix(ivy): directiveInject should fall back to inject (#29948)
If a component has its definition set by defineComponent (as opposed to
JIT getter), then it will generate a factory that uses directiveInject()
to retrieve its dependencies. This can be problematic in test code because
tests could use the injection utility before bootstrapping the component,
and directiveInject() relies on the view having been created.

This commit tweaks directiveInject() to fall back to inject() if the view
has not been created. This will allow injection to work in tests even if
it is called before the component is bootstrapped.

PR Close #29948
2019-04-16 19:31:46 -07:00
Kara Erickson ca2462cff7 fix(ivy): support providing components and dirs in tests (#29945)
Previous to this commit, providing a component or directive in a test
module without @Injectable() would throw because the injectable factory
would not be found. Providing components in tests in addition to declaring
or importing them is not necessary, but it should not throw an error.

This commit ensures factory data is saved when component defs and directive
defs are created, which allows them to be processed by the module injector.

Note that bootstrapping is still required for this setup to work because
directiveInject() does not support cases where the view has not been
created. This case will be handled in a future commit.

PR Close #29945
2019-04-16 19:14:17 -07:00
Alex Rickabaugh ab6036272c release: cut the v8.0.0-beta.13 release 2019-04-16 15:18:42 -07:00
Kara Erickson 1794a8e42a fix(ivy): coalesced listeners should preventDefault if any returns false (#29934)
We had a bug where event.preventDefault() was not always called if listeners
were coalesced. This is because we were overwriting the previous listener's
result every time we called the next listener, so listeners early in the chain
that returned false would be ignored and preventDefault would not be called.

This commit fixes that issue, so now preventDefault() is called if any listener
in a coalesced chain returns false. This brings us in line with View Engine
behavior.

PR Close #29934
2019-04-16 13:36:27 -07:00
Filipe Silva 86a3f90954 fix(compiler-cli): pass config path to ts.parseJsonConfigFileContent (#29872)
The config path is an optional argument to `ts.parseJsonConfigFileContent`. When passed, it is added to the returned object as `options.configFilePath`, and `tsc` itself passes it in.

The new TS 3.4 [incremental](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html) build functionality relies on this property being present: 025d826339/src/compiler/emitter.ts (L56-L57)

When using The compiler-cli `readConfiguration` the config path option isn't passed, preventing consumers (like @ngtools/webpack) from obtaining a complete config object.

This PR fixes this omission and should allow JIT users of @ngtools/webpack to set the `incremental` option in their tsconfig and have it be used by the TS program.

I tested this in JIT and saw a small decrease in build times in a small project. In AOT the incremental option didn't seem to be used at all, due to how `ngc` uses the TS APIs.

Related to https://github.com/angular/angular-cli/issues/13941.

PR Close #29872
2019-04-16 13:36:08 -07:00
Filipe Silva 2bfb6a02e2 fix(router): support non-NgFactory promise in loadChildren typings (#29832)
PR Close #29832
2019-04-16 10:46:12 -07:00
hpawe01 bd3164f88a docs: use correct values from `code-example` in i18n (#29920)
PR Close #29920
2019-04-16 10:31:16 -07:00
Jurgen Van de Moere b3edf494a4 docs(service-worker): fix small typo in devops guide (#29866)
PR Close #29866
2019-04-16 10:30:52 -07:00
Andrew Kushnir 5f1b6372c7 fix(ivy): multi provider override support in TestBed (#29919)
Overriding multi provider values (providers with `multi: true` flag) via TestBed require additional handling: all existing multi-provider values for the same token should be removed from the override list, so that they are not included into the final value of a given provider. This commit adds this logic to make sure we handle multi providers correctly.

PR Close #29919
2019-04-16 10:28:40 -07:00
Kristiyan Kostadinov 5d824c4153 fix(ivy): DebugNode.properties not preserving type of values (#29914)
Fixes the `DebugNode.properties` casting all of the values to a string.

This PR resolves FW-1253.

PR Close #29914
2019-04-16 09:50:44 -07:00
Yun Peng ca755a6b72 build: Fix label name (#29777)
Fix the following error with future Bazel version:
```
 Invalid label: invalid target name 'internal/npm_package:npm_package.bzl': target names may not contain ':'
```

PR Close #29777
2019-04-16 09:50:19 -07:00
Matias Niemelä 2deac0a412 perf(ivy): cache multiple reads to an element's stylingContext (#29818)
Because the styling context may be stored in a different location
and be apart of a sub array, reading the styling context each time
a host binding is evaluated is costly. This patch ensures that the
active styling context is cached so that multiple interactions with
styling bindings can easily retrieve the styling context efficiently.

PR Close #29818
2019-04-16 09:49:32 -07:00
Alex Rickabaugh 9147092a15 Revert "feat(ivy): use i18n locale data to determine the plural form of ICU expressions (#29249)" (#29918)
This reverts commit 6a8cca7975.

PR Close #29918
2019-04-15 16:55:51 -07:00
George Kalpakas 8027b3e19b ci(docs-infra): temporarily lower the min required PWA score for localhost tests (#29911)
The PWA score tests have been occasionally failing on CI recently
(possibly due to CI VM/network issues).

This commit temporarily disables them, until we investigate the
root-cause and/or put a work-around in place.

The PWA score tests are still run against the deployed versions (which
don't suffer as much) or PRs with public previews (as part of the
`test_aio_preview` job) and on upstream builds (as part of the
`deploy_aio` job).

Related to #29910.

[1]: https://github.com/angular/angular/blob/3a836c362/.circleci/config.yml#L390

PR Close #29911
2019-04-15 12:34:42 -07:00
Filipe Silva 3a836c362d build(docs-infra): convert `search-worker.js` to TypeScript (#29764)
PR Close #29764
2019-04-15 11:14:04 -07:00
Filipe Silva ee603a3b01 build(docs-infra): update to CLI 8 beta.13 (#29764)
PR Close #29764
2019-04-15 11:14:04 -07:00
Paul Gschwendtner b0c1282fbe refactor(core): migrations do not properly handle multiple templates in source file (#29841)
Currently if there are multiple source files within a given
TypeScript source file, only the last template in the source
file is checked as we store templates in a `Map` with the
source file paths as keys.

This is problematic as multiple templates can live within the
same source file and we therefore accidentally overwrite
existing entries in the resolved templates map.

PR Close #29841
2019-04-15 11:13:39 -07:00
Paul Gschwendtner 446e3573e3 refactor(core): add static-query template strategy (#29815)
Introduces a new strategy for the `static-query` schematic that
is enabled by default. In order to provide a migration that works
for the most Angular applications and makes the upgrade as easy
as possible, the template strategy leverages the view engine
Angular compiler logic in order to determine the query timing
that is currently used within applications using view engine.

PR Close #29815
2019-04-15 10:53:54 -07:00
Paul Gschwendtner 0d6c9d36a1 refactor(compiler): export static-query detection logic (#29815)
The `@angular/compiler` package currently contains the logic for determining whether
given queries are used statically or dynamically. This logic would be necessary in order
to build a schematic that leverages the Angular compiler API's in order to simulate the
query timing based on what ViewEngine computed at compilation-time/runtime.

Exporting the logic that is necessary to detect the timing should not affect the public
API as the `@angular/compiler` package is denoted as private in `PUBLIC_API.md`

PR Close #29815
2019-04-15 10:53:54 -07:00
Paul Gschwendtner 205a45e9a8 refactor(core): move usage detection into usage strategy (#29815)
In order to support multiple strategies for detecting the query timing, the
query usage logic has been moved into a query usage strategy.

PR Close #29815
2019-04-15 10:53:53 -07:00
Keen Yee Liau 7a7781e925 refactor(bazel): Remove NodeJsSyncHost (#29796)
`NodeJsSyncHost` is no longer provided by BuilderContext in
architect v2, and its usage caused subtle path resolution issues
in Windows.

This PR cleans up `@angular/bazel` builder to use all native path
and fs methods.

PR Close #29796
2019-04-15 10:52:03 -07:00
Ben Lesh b2962db4cb test: add additional test for codeGenApi (#29844)
Addresses comments made by @gkalpak in #29820

PR Close #29844
2019-04-15 10:51:24 -07:00
Keen Yee Liau bd2ce9cd56 fix(bazel): Install packages after `ng add` when invoked independently (#29852)
PR Closes https://github.com/angular/angular/issues/29573

PR Close #29852
2019-04-15 10:50:49 -07:00
Olivier Combe 6a8cca7975 feat(ivy): use i18n locale data to determine the plural form of ICU expressions (#29249)
Plural ICU expressions depend on the locale (different languages have different plural forms). Until now the locale was hard coded as `en-US`.
For compatibility reasons, if you use ivy with AOT and bootstrap your app with `bootstrapModule` then the `LOCALE_ID` token will be set automatically for ivy, which is then used to get the correct plural form.
If you use JIT, you need to define the `LOCALE_ID` provider on the module that you bootstrap.
For `TestBed` you can use either `configureTestingModule` or `overrideProvider` to define that provider.
If you don't use the compat mode and start your app with `renderComponent` you need to call `ɵsetLocaleId` manually to define the `LOCALE_ID` before bootstrap. We expect this to change once we start adding the new i18n APIs, so don't rely on this function (there's a reason why it's a private export).
PR Close #29249
2019-04-15 10:40:26 -07:00
Pawel Kozlowski 6a1441f727 perf(ivy): attempt to coalesce listeners only in presence of directives (#29859)
PR Close #29859
2019-04-15 09:13:37 -07:00
George Kalpakas d1d0f4a1ad fix(docs-infra): add missing ng-conf image (#29902)
As of b9fead7f8, the image is referenced in `announcements.json`, but it
was already removed (as it wasn't used at the time) in 7f905da33.

PR Close #29902
2019-04-15 09:12:58 -07:00
George Kalpakas 70177e544b build(docs-infra): add missing dependencies (chrome-launcher, lighthouse-logger) (#29904)
We are using `chrome-launcher` and `lighthouse-logger` in
[test-pwa-score][1], but we do not explicitly list them as
`devDependencies`, so we are relying on the fact that they happen to be
hoisted in `node_modules/` by yarn. This may unexpectedly break in the
future.

This commit fixes this, by explicitly listing them as `devDependencies`.

[1]: https://github.com/angular/angular/blob/ea70d41ac/aio/scripts/test-pwa-score.js#L14-L18

PR Close #29904
2019-04-15 09:12:37 -07:00
George Kalpakas 4f9c935473 build(docs-infra): upgrade lighthouse to 4.3.0 (#29904)
Also, log the Lighthouse version in `test-pwa-score` to aid in
debugging.

PR Close #29904
2019-04-15 09:12:37 -07:00
Filipe Silva ea70d41ac2 test: ensure correct TS version before running postinstall (#29885)
The bazel-schematics test could suffer from a version skew where new CLI projects were not yet using a new TS version, but Angular packages already were.

This caused the the `ngc` call in the added `postinstall` to run and fail: https://circleci.com/gh/angular/angular/283109

PR Close #29885
2019-04-13 09:31:21 -07:00
Alex Rickabaugh e2e637d70a release: cut the v8.0.0-beta.12 release 2019-04-12 17:48:21 -07:00
Alex Rickabaugh 911e0b8820 docs: release notes for the v7.2.13 release 2019-04-12 17:34:52 -07:00