Commit Graph

808 Commits

Author SHA1 Message Date
Chuck Jazdzewski d0af45c31a Revert "fix(animations): ensure inner :leave animations do not remove node when skipped (#19532)"
This reverts commit ac50bd678e.
2017-10-11 10:37:12 -07:00
Tobias Bosch b0befd7376 fix(compiler): `TestBed.overrideProvider` should keep imported `NgModule`s eager (#19624)
Before, as soon as a user called `TestBed.overrideProvider` for a provider
of a `NgModule` that was imported via `TestBed.configureTestingModule`,
that `NgModule` became lazy.

This commit changes this behavior to keep the `NgModule` eager,
with or without a call to `TestBed.overrideProvider`.

PR Close #19624
2017-10-10 13:51:25 -07:00
Matias Niemelä ac50bd678e fix(animations): ensure inner :leave animations do not remove node when skipped (#19532)
PR Close #19532
2017-10-10 12:41:47 -07:00
Matias Niemelä 9130505b57 fix(animations): ensure animateChild() works with all inner leave animations (#19006) (#19532)
Closes #18305

PR Close #19532
2017-10-10 12:41:47 -07:00
Tobias Bosch 931cf78057 refactor(compiler): introduce `TestBed.deprecatedOverrideProvider` (#19558)
This allows use to fix `TestBed.overrideProvider` to keep imported `NgModule`s eager,
while allowing our users to still keep the old semantics until they have fixed their
tests.

PR Close #19558
2017-10-10 10:15:46 -07:00
Tobias Bosch 6ade68cff1 fix(compiler): correctly instantiate eager providers that are used via `Injector.get` (#19558)
Closes #15501

PR Close #19558
2017-10-10 10:15:46 -07:00
Tobias Bosch d30ce19231 fix(compiler): correctly calculate the out path on windows (#19601)
Fixes #19543
PR Close #19601
2017-10-10 10:15:06 -07:00
Chuck Jazdzewski d7eac7ee56 Revert "fix(router): navigating to the current location works (#19463)"
This reverts commit 43c5b638b9.
2017-10-09 16:38:12 -07:00
Chuck Jazdzewski d53b96f2a2 Revert "fix(router): do not call `location.go` when skipping a navigation (#19463)"
This reverts commit 6651541230.
2017-10-09 16:37:31 -07:00
Kapunahele Wong 79deeacbd7 docs(aio): add copy about ngNoForm to NgForm API doc (#19561)
PR Close #19561
2017-10-09 14:53:49 -07:00
vsavkin 6651541230 fix(router): do not call `location.go` when skipping a navigation (#19463)
Closes #18036

PR Close #19463
2017-10-09 11:45:13 -07:00
vsavkin 43c5b638b9 fix(router): navigating to the current location works (#19463)
Closes #13340

PR Close #19463
2017-10-09 11:45:13 -07:00
Matias Niemelä c3a52697f5 perf(animations): reduce size of bundle by removing AST classes (#19539)
This CL refactors the animation AST code to make use of interfaces instead of classes. Given that interfaces are not persisted during runtime the removal of classes should nicely cut down on size for the animations-browser bundle.

-- before --
animations-browser.umd.js = 222kb
animations-browser.umd.min.js = 107kb

-- after --
animations-browser.umd.js = 213kb
animations-browser.umd.min.js = 102kb

PR Close #19539
2017-10-09 10:00:48 -07:00
Matias Niemelä c4704c8abc fix(animations): properly support boolean-based transitions and state changes (#19279)
Closes #9396
Closes #12337

PR Close #19279
2017-10-09 10:00:32 -07:00
Chuck Jazdzewski b1ca5d4ddf Revert "perf(animations): reduce size of bundle by removing AST classes (#19539)"
This reverts commit d5c9c5f183.
2017-10-06 18:16:30 -07:00
Chuck Jazdzewski 9fecd72f44 Revert "test(animations): test to see if triggers get cancelled on removal (#19532)"
This reverts commit f12e15e682.
2017-10-06 18:15:26 -07:00
Chuck Jazdzewski f4480d46b4 Revert "fix(animations): ensure animateChild() works with all inner leave animations (#19532)"
This reverts commit 1c77cdadaf.
2017-10-06 18:15:22 -07:00
Chuck Jazdzewski 8e5b582b61 Revert "fix(router): navigating to the current location works (#19463)"
This reverts commit b67d574a95.
2017-10-06 18:15:19 -07:00
Chuck Jazdzewski 0cc87c5ba1 Revert "fix(router): do not call `location.go` when skipping a navigation (#19463)"
This reverts commit fdfa31798b.
2017-10-06 18:15:16 -07:00
Chuck Jazdzewski 6aa7cc1d96 Revert "fix(animations): properly support boolean-based transitions and state changes (#19279)"
This reverts commit a8920eb774.
2017-10-06 18:15:08 -07:00
Matias Niemelä a8920eb774 fix(animations): properly support boolean-based transitions and state changes (#19279)
Closes #9396
Closes #12337

PR Close #19279
2017-10-06 15:35:37 -07:00
vsavkin fdfa31798b fix(router): do not call `location.go` when skipping a navigation (#19463)
Closes #18036

PR Close #19463
2017-10-06 15:35:25 -07:00
vsavkin b67d574a95 fix(router): navigating to the current location works (#19463)
Closes #13340

PR Close #19463
2017-10-06 15:35:24 -07:00
Matias Niemelä 1c77cdadaf fix(animations): ensure animateChild() works with all inner leave animations (#19532)
Closes #18305

PR Close #19532
2017-10-06 15:35:13 -07:00
Matias Niemelä f12e15e682 test(animations): test to see if triggers get cancelled on removal (#19532)
PR Close #19532
2017-10-06 15:35:13 -07:00
Matias Niemelä d5c9c5f183 perf(animations): reduce size of bundle by removing AST classes (#19539)
This CL refactors the animation AST code to make use of interfaces instead of classes. Given that interfaces are not persisted during runtime the removal of classes should nicely cut down on size for the animations-browser bundle.

-- before --
animations-browser.umd.js = 222kb
animations-browser.umd.min.js = 107kb

-- after --
animations-browser.umd.js = 213kb
animations-browser.umd.min.js = 102kb

PR Close #19539
2017-10-06 15:34:57 -07:00
Chuck Jazdzewski f83989bb0d fix(compiler-cli): produce smaller source maps for templates (#19578)
Assocating each template node with a the generated TypeScript
generated overly verbose source maps. Changed to creating a
source map entry per unique source span instead of each
unique template ast node.

Fixes: #19537

PR Close #19578
2017-10-06 14:48:25 -07:00
Tobias Bosch 81167d9c4a perf(compiler): speed up loading of summaries for bazel. (#19581)
For hazel, we have a specific way of writing summaries,
which we can leverage to make the deserialization faster.

PR Close #19581
2017-10-06 14:48:02 -07:00
Tobias Bosch 0b06ea177a perf(compiler): only type check input files when using bazel (#19581)
This helps hazel as it does not check libraries (e.g. the default lib) which are
not input files, but still checks `.d.ts` files that are inputs.

PR Close #19581
2017-10-06 14:48:02 -07:00
Alex Rickabaugh f10f8db5fb fix(service-worker): several misc fixes for corner cases
This commit fixes several issues discovered through use in real apps.

* The sha1() function operated on text content, causing issues for binary-format files.
  A sha1Binary() function which operates on unparsed data now avoids any encoding issues.
* The characters '?' and '+' were not escaped in Glob-to-regex conversion previously, but
  are now.
* URLs from the browser contain the full origin, but were checked against the table of
  hashes from the manifest which only has the path for URLs from the same origin. Now the
  origin is checked and URLs are relativized to the domain root before comparison if
  appropriate.
* ngsw: prefix was missing from data groups, is now added.
* Occasionally servers will return a redirected response for an asset, and caching it could
  cause errors for navigation requests. The SW now handles this by detecting such responses
  and following the redirect manually, to avoid caching a redirected response.
* The request for known assets is now created from scratch from the URL before fetching from
  the network, in order to sanitize it and avoid carrying any special modes or headers that
  might result in opaque responses.
* Debugging log for troubleshooting.
* Avoid creating errors by returning 504 responses on error.
* Fix bug where idle queue doesn't run in some circumstances.
* Add tests for the above.
2017-10-05 13:27:31 -07:00
Alex Rickabaugh b804d4bde5 Revert "fix(platform-browser): support customEqualityTesters when overriding Jasmine toEqual"
This reverts commit f580ffab4f.

Reason: broke a few existing tests.
2017-10-05 13:20:00 -07:00
Tobias Bosch 01f711281c fix(compiler): don’t use `ng://` in AOT source maps, and never point to the original source file
This is important to not confuse users nor downstream tools that
consume our source maps. For generated content for which we don’t
have an original source file, we use the generated file now.

Fixes #19538
2017-10-04 16:20:55 -07:00
Tobias Bosch 5b5108363d refactor(compiler): remove stale metadata classes for animations
These are no longer needed as animations are a purely
runtime concept.
2017-10-04 16:20:55 -07:00
Vikram Subramanian fbc9537952 perf(compiler): fix perf issue in loading aot summaries in jit compiler
The current `flattenSummaries` function re-process the same NgModule
summary even if it has been processed before. Certain modules like
CommonModule are repeated multiple times in the module tree and it is
expanded out every time.

This was making unit tests using AOT summaries really slow. This will
also slow down JIT bootstrap applications that load AOT summaries for
component libraries.

The fix is to remember which summaries were seen before and not to
process them again.
2017-10-04 15:04:23 -07:00
Vikram Subramanian f580ffab4f fix(platform-browser): support customEqualityTesters when overriding Jasmine toEqual 2017-10-04 15:00:58 -07:00
Tobias Bosch 696af79dc7 fix(compiler): properly work on windows
Verified manually on a windows surface tablet.

Fixes #19492
2017-10-04 14:58:08 -07:00
Victor Berchet 0833b59aab refactor(core): add a checkIndex to the compiler view nodes
Each node now has two index: nodeIndex and checkIndex.

nodeIndex is the index in both the view definition and the view data.
checkIndex is the index in in the update function (update directives and update
renderer).

While nodeIndex and checkIndex have the same value for now, having both of them
will allow changing the structure of view definition after compilation (ie for
runtime translations).
2017-10-04 14:55:54 -07:00
Tobias Bosch caa51950e8 fix(compiler): only don’t emit already emitted files in incremental compilation 2017-10-04 14:55:21 -07:00
Chuck Jazdzewski f3f4c3d835 fix(compiler): disallow references for select and index evaluation
Also fixes an issue where enum values of 0 or '``' where not treated
correctly.

Fixes: #18170
2017-10-04 14:54:39 -07:00
Tobias Bosch 7c5ecb5b5c fix(compiler): also count generated files to determine whether to use single file emit 2017-10-03 09:57:12 -07:00
Tobias Bosch 1058b2a778 fix(compiler): always emit summaries for jit with ng_module bazel rule. 2017-10-03 09:57:12 -07:00
Tobias Bosch c4129137e7 fix(compiler): set `emitSkipped` to false for incremental compilation 2017-10-03 09:57:12 -07:00
George Kalpakas eef7d8aa11 fix(upgrade): call `ngOnInit()` after `ngOnChanges()` (on components with inputs)
Fixes #18913
2017-10-02 16:01:07 -07:00
George Kalpakas 617b3d2ba5 fix(upgrade): correctly run change detection when `propagateDigest` is false 2017-10-02 16:01:07 -07:00
George Kalpakas 546eb7d851 test(upgrade): ensure AngularJS is bootstraped inside the Angular zone in tests 2017-10-02 16:01:07 -07:00
George Kalpakas 29dbc3b67c refactor(upgrade): remove redundant call to `appRef.detach()`
Once  a `ViewRef` is attached to the `ApplicationRef`, destroying the corresponding `ComponentRef` will automatically detach the `ViewRef`.
2017-10-02 16:01:07 -07:00
George Kalpakas 4e6aa9c2db fix(upgrade): ensure downgraded components are destroyed in the Angular zone 2017-10-02 16:01:07 -07:00
Tobias Bosch 745b59f49c perf(compiler): only emit changed files for incremental compilation
For now, we always create all generated files, but diff them
before we pass them to TypeScript.

For the user files, we compare the programs and only emit changed
TypeScript files.

This also adds more diagnostic messages if the `—diagnostics` flag
is passed to the command line.
2017-10-02 08:24:50 -07:00
Tobias Bosch b0868915ae perf(compiler): don’t emit summaries for jit by default
This re-adds the flag `enableSummariesForJit` to the compiler options
that already existed in Angular 4.
2017-10-02 08:24:50 -07:00
Tobias Bosch 0038712474 fix(compiler): add typings for `COMPILED`.
Note: This commit has to be synced into G3 again.
2017-09-29 09:26:38 -07:00
Tobias Bosch db74f44a97 fix: don’t rely on `goog.DEBUG` but on `COMPILED` instead
`good.DEBUG` can also be true when using advanced compilation.

Attention: This change has be applied in G3 already as a local mod!
2017-09-29 09:26:38 -07:00
Alex Rickabaugh d442b6855f feat(service-worker): introduce the @angular/service-worker package (#19274)
This service worker is a conceptual derivative of the existing @angular/service-worker maintained at github.com/angular/mobile-toolkit, but has been rewritten to support use across a much wider variety of applications.

Entrypoints include:

@angular/service-worker: a library for use within Angular client apps to communicate with the service worker.
@angular/service-worker/gen: a library for generating ngsw.json files from glob-based SW config files.
@angular/service-worker/ngsw-worker.js: the bundled service worker script itself.
@angular/service-worker/ngsw-cli.js: a CLI tool for generating ngsw.json files from glob-based SW config files.
2017-09-28 16:18:12 -07:00
Tobias Bosch 7c1d3e0f5a fix(compiler): make watch mode work with `declaration: false`
closes #19464
2017-09-28 14:21:05 -07:00
Tobias Bosch 2f6ae527d1 fix(compiler): make sure our out path calculation is correct 2017-09-28 14:20:20 -07:00
Tobias Bosch ec2be5dccb fix(compiler): allow to use flat modules and summaries
The combination of flat modules, flat module redirects and summaries
lead to errors before.
2017-09-28 14:20:20 -07:00
Victor Berchet 14e8e88022 Revert "refactor(core): Change `abstract get` to `readonly` (#19226)"
This reverts commit 3aa3d5c548.
2017-09-28 13:36:56 -07:00
Victor Berchet 6a9ce67714 Revert "refactor(core): Removed readonly getters and changed to readonly (#19225)"
This reverts commit 2b84b86fc0.
2017-09-28 13:36:44 -07:00
Victor Savkin a9d32a3f89 fix(router): resolve and guards should be able to reject with null and undefined (#19418)
Closes #17148
2017-09-28 11:06:08 -07:00
Chuck Jazdzewski ff5b050a92 fix(compiler): correctly map error message locations (#19424) 2017-09-28 10:53:04 -07:00
Chuck Jazdzewski b3db3f80ba fix(compiler): do not consider a reference with members as a reference (#19454)
Fixes: #18170
2017-09-28 10:52:52 -07:00
tinayuangao 2b84b86fc0 refactor(core): Removed readonly getters and changed to readonly (#19225)
variables
2017-09-28 09:36:29 -07:00
tinayuangao 3aa3d5c548 refactor(core): Change `abstract get` to `readonly` (#19226) 2017-09-28 09:36:13 -07:00
Matias Niemelä 2d2300e118 docs(animations): document usage of negative limit values for query (#19451) 2017-09-28 09:34:36 -07:00
Chuck Jazdzewski f24ea59f74 fix(compiler-cli): don't rewrite imports when annotating for closure (#19444)
Closure no longer needs to have the imports rewritten avoid rewriting
as this can cause issues when the source directory structure differs
from what is deployed.

Fixes: #19026
2017-09-28 09:31:28 -07:00
Chuck Jazdzewski c1b029a413 fix(language-service): do not report errors for `OpaqueToken` (#19427)
`OpaqueToken` was removed from angular but the language-service
should not report errors when it is used for older versions of
angular.
2017-09-28 09:30:34 -07:00
Alex Eagle 82e49230ff build: Give names to the AMD modules nested in Angular UMD distro (#19425) 2017-09-28 09:29:22 -07:00
Tobias Bosch 627f04883a fix(compiler): implement i18n with new compiler
This commit is from vikerman@

closes #19429
2017-09-27 10:10:49 -07:00
Tobias Bosch a7798f2a93 fix: don’t use the global `ng` at all with closure enhanced optimizations
This is needed as:
- closure declares globals itself for minified names, which sometimes clobber our `ng` global
- we can't declare a closure extern as the namespace `ng` is already used within Google for typings for angularJS (via `goog.provide('ng....')`).
2017-09-27 10:09:56 -07:00
Tobias Bosch b21a1d1961 fix: create proper externs so that closure does not clobber e.g. `ng` for internal variables (#19423) 2017-09-26 15:02:33 -07:00
Jeremy Elbourn 8a0e45826a fix(http): introduce named type for HttpParams options (#19360)
This is necessary to enable type-based optimizations with Closure.
Without explicity making these options the same named type, Closure
thinks they are different types and cannot disambiguate the `fromObject`
property.
2017-09-26 15:02:08 -07:00
Chuck Jazdzewski dfb8d21ef4 feat(compiler): enabled strict checking of parameters to an `@Injectable` (#19412)
Added the compiler options `strictInjectionParameters` that defaults
to `false`. If enabled the compiler will report errors for parameters
of an `@Injectable` that cannot be determined instead of generating a
warning.

This is planned to be switched to default to `true` for Angular 6.0.
2017-09-26 13:40:47 -07:00
Chuck Jazdzewski a75040d0a1 refactor(compiler): bump metadata version to 4 (#19338)
Also adds auto upgrade from lower version based
on the .d.ts file (e.g. from version 3 to 4).

This is needed as we are now also capturing type aliases
in metadata files (and we rely on this),
see 6e3498ca8e.
2017-09-26 13:31:59 -07:00
Matias Niemelä 86ffacf7ce feat(animations): support negative query option values
closes #19259
2017-09-26 12:02:56 -07:00
Matias Niemelä b54368bf35 fix(animations): properly support the query limit option value
Closes #19232
2017-09-26 12:02:43 -07:00
Filipe Silva e889c68aff fix(compiler-cli): don't join errors with comma (#19331) 2017-09-26 11:25:57 -07:00
Olivier Combe f9b0863c8a fix(common): use correct pipe name in error messages (#19403)
Fixes #19373
2017-09-26 10:18:26 -07:00
Chuck Jazdzewski f57b7df4d7 fix(compiler): remove deprecated `Compiler.ngGetContentSelectors()` (#19347)
BREAKING CHANGE:

The method `ngGetConentSelectors()`, deprecated in Angular 4.0, has been
removed.

Use `ComponentFactory.ngContentSelectors` instead.
2017-09-26 10:18:10 -07:00
Chuck Jazdzewski 27c6638913 fix(compiler-cli): set source file ranges in node emitter (#19348)
Enables source mapping from the template to the generated files.
2017-09-26 09:26:18 -07:00
Tobias Bosch bb1665cbd8 fix(compiler): make sure to detect paths that start with `rootDir` correctly
closes #19362
2017-09-25 13:36:43 -07:00
Tobias Bosch 1dacae2c3c fix(compiler): work well with `forwardRef` with `useValue` / `useFactory`
The new expression lowering lowers everything after `useValue` / `useFactory`
into a separate exported variable. If the value was a `forwardRef`, this
was passed to the runtime and resulted in errors.

This change unwraps `forwardRef`s during runtime again.

Note: we can’t unwrap the `forwardRef` into an exported variable
during compile time, as this would defeat the purpose of the
`forwardRef` in referring to something that can’t be referred to
at this position.
2017-09-25 13:36:00 -07:00
Tobias Bosch e31a76ce24 fix(compiler): allow to use lowering with `export *`.
Previously, we generated incorrect code when a file
had lowerings and also exported another file via `export *`
that also had lowerings in it.
2017-09-25 13:36:00 -07:00
Tobias Bosch 3799f43c71 fix(compiler): add parens around binary / ternary expressions
This fixes cases where binary / ternary operators are nested
(e.g. a nested ternary operator).
2017-09-25 13:36:00 -07:00
Tobias Bosch a8a9660112 fix(compiler): various squashed fixes for the new ngc
introduce the option `allowEmptyCodegenFiles` to generate all generated files,
even if they are empty.
- also provides the original source files from which the file was generated
  in the write file callback
- needed e.g. for G3 when copying over pinto mod names from the original component
  to all generated files

use `importAs` from flat modules when writing summaries
- i.e. prevents incorrect entries like @angular/common/common in the .ngsummary.json files.

change interaction between ng and ts to prevent race conditions
- before Angular would rely on TS to first read the file for which we generate files,
  and then the generated files. However, this can break easily when we reuse an old program.

don’t generate files for sources that are outside of `rootDir`
(see #19337)
2017-09-25 13:36:00 -07:00
Pawel Kozlowski 13613d4acb fix(compiler): skip   when trimming / removing whitespaces (#19310)
Fixes #19304
2017-09-25 13:33:31 -07:00
Alex Eagle 9ad4b3bd31 build: update to latest @bazel/typescript (#19277)
Switches devmode output of an ng_module to UMD
2017-09-25 12:40:22 -07:00
Filipe Silva e224e3d62d fix(compiler-cli): update ngtools2 EmitFlags (#19375) 2017-09-25 12:37:00 -07:00
Chuck Jazdzewski 476790290e fix(compiler-cli): do not validate metadata from declaration files (#19324)
Upgrading metadata files causes spurious reports of metadata errors.

Fixes #18867
2017-09-25 12:36:08 -07:00
Olivier Combe 0f5c70d563 build: update npm dependencies (#19328)
PR Close #19328
2017-09-22 13:20:52 -07:00
Olivier Combe f48b343af1 build: switch from npm to yarn (#19328)
PR Close #19328
2017-09-22 13:20:52 -07:00
Marc Laval 516759b1ff test(platform-browser): fix mXSS attack test in Canary (#18809)
PR Close #18809
2017-09-22 13:10:00 -07:00
Miško Hevery 344a5ca545 feat(core): support for bootstrap with custom zone (#17672)
PR Close #17672
2017-09-21 16:51:48 -07:00
Vikram Subramanian cfd9ca0d6f feat(platform-server): add an API to transfer state from server (#19134)
TransferState provides a shared store that is transferred from the
server to client. To use it import BrowserTransferStateModule from the
client app module and ServerTransferStateModule from the server app
module and TransferState will be available as an Injectable object.

PR Close #19134
2017-09-21 13:56:13 -07:00
Chuck Jazdzewski f96142cd7c build: remove references to `tsc-wrapped` (#19298)
With this commit `ngc` is used instead of `tsc-wrapped` for
collecting metadata and tsickle rewriting and `tsc-wrapped`
is removed from the repository.

`@angular/tsc-wrapped@5` is now deprecated and is no longer
used, updated, or maintained as part as of Angular 5.x.x.

`@angular/tsc-wrapped@4` is still maintained and required by
Angular 4.x.x and will be maintained as long as 4.x.x is in
LTS.

PR Close #19298
2017-09-21 13:55:52 -07:00
Victor Berchet abceaa2f33 refactor(core): viewDef related refactoring (#19272)
- optimize the way node flags are propagated in `viewDef()`,
- fix `elementDef()` signature to make `namespaceAndName` nullable,
- move render parent computation with the parent computation

PR Close #19272
2017-09-21 09:59:52 -07:00
Tobias Bosch f2bad195bc fix(compiler): correctly derive `fileExists` for generated files (#19301)
PR Close #19301
2017-09-21 09:59:40 -07:00
Tobias Bosch 1a647c399b fix(compiler): also create `.ngfactory.js` files in non obvious cases (#19301)
E.g. when an exported class contains a ctor argument which is
from another compilation unit.

PR Close #19301
2017-09-21 09:59:40 -07:00
Tobias Bosch c76da27240 fix(compiler): support `noResolve` (#19301)
PR Close #19301
2017-09-21 09:59:40 -07:00
Tobias Bosch 04997c8418 fix(compiler): don’t type check property access of literal maps (#19301)
This was the behavior in Ng4, so we put the stricter
check behind the `fullTemplateTypeCheck` flag.
PR Close #19301
2017-09-21 09:59:40 -07:00
Tobias Bosch 45747ed531 fix(compiler): don’t lower property accesses of exported symbols (#19301)
E.g. this allows the following to work:
```
@Decorator({
  useValue: MyClass.someMethod
})
class MyClass {
  static someMethod() {}
}
```
PR Close #19301
2017-09-21 09:59:40 -07:00
Tobias Bosch 62602b9bd8 fix(compiler): collect non exported symbols in d.ts files (#19301)
TS treats all symbols in d.ts files as exported,
whether they have an `export` keyword or not.

PR Close #19301
2017-09-21 09:59:40 -07:00