Commit Graph

4465 Commits

Author SHA1 Message Date
ayazhafiz 1ed3531049 fix(language-service): re-add regressed templateUrl tests (#32438)
Commit 18ce58 (per #32378) regressed tests for templateUrl definitions.
This PR re-adds those tests.

PR Close #32438
2019-09-03 11:59:13 -07:00
Miško Hevery e8f9ba4b6c fix(ivy): add missing closure extern for \$localize (#32460)
PR Close #32460
2019-09-03 11:55:16 -07:00
Mansour Fall f5bec3ff50 feat(common): HttpParams fromObject accepts ReadonlyArray<string> (#31072)
Fixes #28452

PR Close #31072
2019-08-30 12:55:02 -07:00
Pete Bacon Darwin fe5caca884 docs(core): update the i18n design doc (#31609)
PR Close #31609
2019-08-30 12:53:26 -07:00
Pete Bacon Darwin a7f61e63fa refactor(ivy): remove `i18nConfigureLocalize` instruction (#31609)
This has been replaced by the `loadTranslations()` function in
`@angular/localize/run_time`.

PR Close #31609
2019-08-30 12:53:26 -07:00
Pete Bacon Darwin c024d89448 refactor(ivy): remove `i18nLocalize` instruction (#31609)
This has been replaced by the `$localize` tag.

PR Close #31609
2019-08-30 12:53:26 -07:00
Pete Bacon Darwin fa79f51645 refactor(ivy): update the compiler to emit `$localize` tags (#31609)
This commit changes the Angular compiler (ivy-only) to generate `$localize`
tagged strings for component templates that use `i18n` attributes.

BREAKING CHANGE

Since `$localize` is a global function, it must be included in any applications
that use i18n. This is achieved by importing the `@angular/localize` package
into an appropriate bundle, where it will be executed before the renderer
needs to call `$localize`. For CLI based projects, this is best done in
the `polyfills.ts` file.

```ts
import '@angular/localize';
```

For non-CLI applications this could be added as a script to the index.html
file or another suitable script file.

PR Close #31609
2019-08-30 12:53:26 -07:00
Pete Bacon Darwin b21397bde9 feat(ivy): implement `$localize()` global function (#31609)
PR Close #31609
2019-08-30 12:53:25 -07:00
Andrew Scott 260217a800 fix(ivy): Prevent errors when querying for elements outside Angular context (#32361)
DebugElement.query also searches elements that may have been created
outside of Angular (ex: with `document.appendChild`). The current
behavior attempts to get the LContext of these nodes but throws an error
because the LContext does not exist.

PR Close #32361
2019-08-30 12:51:34 -07:00
cexbrayat c8b065524e refactor(ivy): cleanup di tests from render3 (#32165)
The tests were already migrated to acceptance with `ngFor`/`ngIf`, but were leftover in case JS blocks ended up supported in Ivy.

PR Close #32165
2019-08-30 12:49:04 -07:00
Paul Gschwendtner c56c2416a9 refactor(core): undecorated-classes-with-decorated-fields migration commits empty updates (#32391)
Commit 904a2018e0 introduced a new migration for
undecorated classes with decorated Angular class members. Currently the migration
always calls `tree.beginUpdate` and `tree.commitUpdate` (even if there are no changes).

This causes unnecessary updates to be reported to developers running `ng update`. Once
an update is commited, the CLI will report the update regardless of whether any changes were
made or not.

This behavior can be observed in the `ng_update_migrations` integration test. See:
https://circleci.com/gh/angular/angular/438470#tests/containers/3. Notice how all
source files are denoted as `UPDATED` (even though there are no changes).

PR Close #32391
2019-08-30 12:46:01 -07:00
Martin Probst d498314850 fix(zone.js): a path traversal attack in test (#32392)
`simple-server.js` is vulnerable to a trivial path traversal attack, i.e. an
attacker can supply a path like `../../etc/passwd` to read arbitrary files on
the server. This change fixes the issue by properly resolving the path, and then
only serving files under the current directory (as intended).

This is not really a security issue, given the code is not part of Angular, but
rather just testing infrastructure for Angular itself, and the CI servers are
not expected to contain confidential information, but still worth fixing for
code hygiene.

PR Close #32392
2019-08-30 12:44:46 -07:00
Pawel Kozlowski 8dc3f3647c perf(ivy): properly initialise global state in the element_text_create benchmark (#32397)
PR Close #32397
2019-08-30 12:42:28 -07:00
Alan Agius 350ea47def feat(bazel): update to the latest `@microsoft/api-extractor` (#32185)
PR Close #32185
2019-08-30 13:55:32 -04:00
Matias Niemelä ba5e07efc7 perf(ivy): add a micro benchmark for map-based style and class bindings (#32401)
This patch introduces a new micro benchmark that performance tests
against map-based style and class bindings in Ivy running together
on the same element.

PR Close #32401
2019-08-30 13:52:35 -04:00
Matias Niemelä df8e6750a1 perf(ivy): add a micro benchmark for style and class bindings (#32401)
This patch introduces a new micro benchmark that performance tests
against style and class bindings in Ivy running together on the same
element.

PR Close #32401
2019-08-30 13:52:35 -04:00
Misko Hevery 1537791f06 perf(core): Make `PlatformLocation` tree-shakable (#32154)
Convert `PlatformLocation` into a tree-shakable provider.

PR Close #32154
2019-08-29 21:51:56 -07:00
Misko Hevery 77c382ccba feat(core): Adds DI support for `providedIn: 'platform'|'any'` (#32154)
Extend the vocabulary of the `providedIn` to also include  `'platform'` and `'any'`` scope.
```
@Injectable({
  providedId: 'platform', // tree shakable injector for platform injector
})
class MyService {...}
```

PR Close #32154
2019-08-29 21:51:56 -07:00
Misko Hevery 8a47b48912 refactor: Move `dom_adapter.ts` to `@angular/common` (#32154)
This work is needed in preparation for turning tokens into tree-shakable injectables.

PR Close #32154
2019-08-29 21:51:56 -07:00
JoostK f7471eea3c fix(ngcc): handle compilation diagnostics (#31996)
Previously, any diagnostics reported during the compilation of an
entry-point would not be shown to the user, but either be ignored or
cause a hard crash in case of a `FatalDiagnosticError`. This is
unfortunate, as such error instances contain information on which code
was responsible for producing the error, whereas only its error message
would not. Therefore, it was quite hard to determine where the error
originates from.

This commit introduces behavior to deal with error diagnostics in a more
graceful way. Such diagnostics will still cause the compilation to fail,
however the error message now contains formatted diagnostics.

Closes #31977
Resolves FW-1374

PR Close #31996
2019-08-29 12:38:02 -07:00
JoostK 4161d19374 test(ivy): normalize rooted paths to include a drive letter in Windows (#31996)
The Angular compiler has an emulation system for various kinds of
filesystems and runs its testcases for all those filesystems. This
allows to verify that the compiler behaves correctly in all of the
supported platforms, without needing to run the tests on the actual
platforms.

Previously, the emulated Windows mode would normalize rooted paths to
always include a drive letter, whereas the native mode did not perform
this normalization. The consequence of this discrepancy was that running
the tests in native Windows was behaving differently compared to how
emulated Windows mode behaves, potentially resulting in test failures
in native Windows that would succeed for emulated Windows.

This commit adds logic to ensure that paths are normalized equally for
emulated Windows and native Windows mode, therefore resolving the
discrepancy.

PR Close #31996
2019-08-29 12:38:02 -07:00
Paul Gschwendtner 3af99a7b4a refactor(core): wire up missing-injectable migration for ng-update (#32349)
Initially the `missing-injectable` migration was only being used
in google3. Wiring the migration up in the CLI migrations was
planned to be done in a follow-up.

PR Close #32349
2019-08-29 12:34:43 -07:00
Pete Bacon Darwin d5101dff3b fix(ivy): ngcc - improve the "ngcc version changed" error message (#32396)
If a project has nested projects that contain node_modules folders
that get processed by ngcc, it can be confusing when the ngcc
version changes since the error message is very generic:

```
The ngcc compiler has changed since the last ngcc build.
Please completely remove `node_modules` and try again.
```

This commit augments the error message with the path of
the entry-point that failed so that it is more obvious which
node_modules folder to remove.

BREAKING CHANGE:

This commit removes the public export of `hasBeenProcessed()`.

This was exported to be availble to the CLI integration but was never
used. The change to the function signature is a breaking change in itself
so we remove the function altogether to simplify and lower the public
API surface going forward.

PR Close #32396
2019-08-29 12:32:54 -07:00
Kara Erickson 7742a99cee ci: update size benchmarks for core with 9.0.0-next.4 (#32255)
PR Close #32255
2019-08-28 21:39:24 -07:00
Pawel Kozlowski 5635505f2e refactor(ivy): remove unused ɵɵtextBinding instruction (#32345)
PR Close #32345
2019-08-28 21:37:15 -07:00
George Kalpakas cc288aec3d docs(platform-browser): remove redundant JSDoc tag from `BROWSER_SANITIZATION_PROVIDERS__POST_R3__` (#32314)
The JSDoc tag was introduced in #31934 and was not intentional according
to [this discussion on Slack][1].

[1]: https://angular-team.slack.com/archives/CHB51S90D/p1566322373094100?thread_ts=1566292123.093500&cid=CHB51S90D

PR Close #32314
2019-08-28 21:34:42 -07:00
ayazhafiz 47a4edb817 refactor(language-service): rename `host` to `tsLsHost` (#32346)
Disambiguate the name of the Language Service Host used in constructing
a TypeScript Language Service Host by renaming the `host` property to
`tsLsHost`.

PR Close #32346
2019-08-28 21:27:15 -07:00
Carlos Ortiz García 3aba7ebe6a feat(core): Introduce TestBed.inject to replace TestBed.get (#32200)
TestBed.get is not type safe, fixing it would be a massive breaking
change. The Angular team has proposed replacing it with TestBed.inject
and deprecate TestBed.get.

Deprecation from TestBed.get will come as a separate commit.

Issue #26491
Fixes #29905

BREAKING CHANGE: Injector.get now accepts abstract classes to return
type-safe values. Previous implementation returned `any` through the
deprecated implementation.

PR Close #32200
2019-08-28 21:26:46 -07:00
Keen Yee Liau 18ce58c2bc refactor(language-service): cleanup tests for Hover (#32378)
Move generic test methods to `MockTypescriptHost` so they could be
shared across all tests.

This is in preparation for adding more tests to Hover when new features
get added.

PR Close #32378
2019-08-28 17:25:07 -07:00
Keen Yee Liau 852afb312a fix(language-service): Create DirectiveKind enum (#32376)
Hovering over a selector, the QuickInfo display string is something
like:
```
(component) AppComponent
```
where `component` is the symbol kind.
Prior to this, there was no types to indicate the possible values of a
symbol. This PR creates an enum to represent that.

PR Close #32376
2019-08-28 17:23:53 -07:00
Pawel Kozlowski d4703d9316 refactor(ivy): remove global state access from inputs-related functions (#32370)
PR Close #32370
2019-08-28 17:23:23 -07:00
Pawel Kozlowski 1bb9ce5d8c refactor(ivy): remove superflous argument to the createTNodeAtIndex function (#32370)
PR Close #32370
2019-08-28 17:23:23 -07:00
Keen Yee Liau 97fc45f32a fix(language-service): Invalidate Reflector caches when program changes (#32357)
This commit fixes a bug introduced in the recent refactoring whereby
caches become stale when the program changes.
This is because StaticReflector keeps its own caches that are not
clearable. The previous refactoring tried to reuse the same instance,
leading to out-of-sync program state.

Clearing out the *entire* cache is very inefficient. Instead, we could
just invalidate the symbols in the files that have changed. This
requires changes to the API of StaticReflector, but put this on hold
until the refactoring of language service for Ivy commences.

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

PR Close #32357
2019-08-28 17:22:50 -07:00
Pawel Kozlowski a1e91b00d2 perf(ivy): remove renderStringify calls for text nodes creation (#32342)
Values passed to the `ɵɵtext` instruction are strings (or undefined)
in the generated code so no need to stringify those again.

PR Close #32342
2019-08-28 17:12:38 -07:00
Pawel Kozlowski fac066ea9f perf(ivy): run registerPostOrderHooks in the first template pass only (#32342)
PR Close #32342
2019-08-28 17:12:38 -07:00
Pawel Kozlowski 85864ed9f7 perf(ivy): add element and text creation benchmark (#32342)
PR Close #32342
2019-08-28 17:12:38 -07:00
Pawel Kozlowski 581b837e88 perf(ivy): remove repeated memory read / write in addComponentLogic (#32339)
PR Close #32339
2019-08-28 17:12:02 -07:00
Paul Gschwendtner 60a056d5dc refactor(core): undecorated classes migration should not decorate classes if not needed (#32319)
Currently the undecorated classes migration decorates base classes if no
explicit constructor is defined on all classes in the inheritance chain.

We only want to decorate base classes which define a constructor that is
inherited. Additionally for best practice, all classes in between the class
that inherits the constructor and the one that defines it are also decorated.

PR Close #32319
2019-08-28 17:11:36 -07:00
Paul Gschwendtner 543631f2b3 refactor(core): undecorated-classes migration should properly construct object literal from metadata (#32319)
The `undecorated-classes-with-di` migration currently creates invalid object literals from parsed
NGC metadata files if there are object literal properties with keys that contain special characters.

e.g. consider a decorated base class with a host binding using `[class.X]`. Currently the migration
parses and converts the metadata to TypeScript code but incorrectly uses `[class.X]` unquoted as
identifier.

PR Close #32319
2019-08-28 17:11:36 -07:00
Paul Gschwendtner d0f3539e6e test(core): cleanup bazel target names for schematic tests (#32318)
Apparently the names of the bazel test targets in the schematics are
incorrect. This commit updates the target names to match their bazel
package name.

PR Close #32318
2019-08-28 17:11:04 -07:00
Paul Gschwendtner e5636a322c refactor(core): undecorated-classes-with-di migration should never use ngtsc (#32318)
ec4381dd40 enabled Ivy by default. This is
problematic as migrations like `undecorated-classes-with-di` depend on the
`AngularCompilerProgram` (NGC) in order to perform the migration from
version 8 to version 9. In order to ensure that the migration always runs
with NGC (and doesn't get the `NgtscProgram`), we need to explicitly disable
ivy when creating the `@angular/compiler-cli` program for the migration.

PR Close #32318
2019-08-28 17:11:04 -07:00
Kara Erickson b094936d72 refactor(core): remove more misc unused utilities from DomAdapters (#32291)
PR Close #32291
2019-08-28 17:10:30 -07:00
Kara Erickson f3e4cb491e refactor(core): remove testing-only event utilities from DomAdapters (#32291)
PR Close #32291
2019-08-28 17:10:30 -07:00
Kara Erickson cb5701f8d9 refactor(core): remove testing-only node getters and invoke() from DomAdapters (#32291)
PR Close #32291
2019-08-28 17:10:30 -07:00
Kara Erickson c0680602f9 refactor(core): remove testing-only childNodes() and firstChild() fns from DomAdapters (#32291)
PR Close #32291
2019-08-28 17:10:30 -07:00
Kara Erickson 30dabdf8fc refactor(core): remove testing-only DOM manipulation utils from DomAdapters (#32291)
PR Close #32291
2019-08-28 17:10:30 -07:00
Kara Erickson ede5786d1e refactor(core): remove testing-only style utils from DomAdapters (#32291)
PR Close #32291
2019-08-28 17:10:29 -07:00
ayazhafiz 46caf88b2c feat(language-service): add definitions for templateUrl (#32238)
Adds support for `getDefinitionAt` when called on a templateUrl
property assignment.

The currrent architecture for getting definitions is designed to be
called on templates, so we have to introduce a new
`getTsDefinitionAndBoundSpan` method to get Angular-specific definitions
in TypeScript files and pass a `readTemplate` closure that will read the
contents of a template using `TypeScriptServiceHost#getTemplates`. We
can probably go in and make this nicer in a future PR, though I'm not
sure what the best architecture should be yet.

Part of angular/vscode-ng-language-service#111

PR Close #32238
2019-08-28 17:09:46 -07:00
George Kalpakas 65aaffcfe4 docs(service-worker): add example app for `SwPush` API docs (#32139)
Previously, the `SwPush` API docs were using hard-coded code snippets.

This commit switches to using code snippets from an actual example app,
which ensures that the code shown in the docs will at least continue to
compile successfully.

PR Close #32139
2019-08-27 16:18:53 -07:00
Judy Bogart ac11a0be15 docs: add push notification usage to api doc (#32139)
PR Close #32139
2019-08-27 16:18:53 -07:00