Commit Graph

16544 Commits

Author SHA1 Message Date
Kara Erickson 67eac733d2 refactor(ivy): do not generate providedIn: null (#34116)
We should only generate the `providedIn` property in injectable
defs if it has a non-null value. `null` does not communicate
any information to the runtime that isn't communicated already
by the absence of the property.

This should give us some modest code size savings.

PR Close #34116
2019-12-03 10:14:52 -08:00
Charles Lyding 56f4e56094 docs: Ivy i18n guide updates for localize option (#34053)
PR Close #34053
2019-12-03 10:14:15 -08:00
Keen Yee Liau dd944ef73f fix(language-service): Insert parentheses for method completion (#33860)
This commit leverages the `insertText` field in `ts.CompletionEntry` to
return a completion text for class methods that includes parentheses.

PR closes https://github.com/angular/vscode-ng-language-service/issues/15

PR Close #33860
2019-12-03 10:13:36 -08:00
Danny Skoog c60d7563a8 style: enforce disallowance of object constructor (#33211)
Applying the `prefer-literal` tslint rule to object enforces the style guide rule https://google.github.io/styleguide/jsguide.html#features-objects-ctor

PR Close #33211
2019-12-03 10:08:25 -08:00
Andrew Scott d4b83681f1 build: disable buildifier print warning for compile=aot deprecation (#34199)
PR Close #34199
2019-12-03 10:07:21 -08:00
Alan Agius 0cd8431698 fix(bazel): don't rely on @angular/core being as a depedency to install @angular/bazel (#34181)
With this change we fix the logic to detect if a package is installed, removing a package and add a package by using the CLI schematic helpers.

Also we save `@angular/bazel` package directly as a `devDependency` when doing `ng-add`.

Closes #34164

PR Close #34181
2019-12-02 11:40:58 -08:00
Kara Erickson 755d2d572f refactor(ivy): remove unnecessary fac wrapper (#34076)
For injectables, we currently generate a factory function in the
injectable def (prov) that delegates to the factory function in
the factory def (fac). It looks something like this:

```
factory: function(t) { return Svc.fac(t); }
```

The extra wrapper function is unnecessary since the args for
the factory functions are the same. This commit changes the
compiler to generate this instead:

```
factory: Svc.fac
```

Because we are generating less code for each injectable, we
should see some modest code size savings. AIO's main bundle
is about 1 KB smaller.

PR Close #34076
2019-12-02 11:35:24 -08:00
crisbeto 02958c07f6 fix(common): reflect input type in NgIf context (#33997)
Fixes the content of `NgIf` being typed to any.

Fixes #31556.

PR Close #33997
2019-12-02 11:34:26 -08:00
crisbeto a6b6d74c00 fix(common): reflect input type in NgForOf context (#33997)
Fixes `NgForOf` not reflecting the type of its input in the `NgForOfContext`.

PR Close #33997
2019-12-02 11:34:26 -08:00
Alan Agius e6dbcd0f46 docs: remove redundant dashes (#34172)
PR Close #34172
2019-12-02 11:26:21 -08:00
Pete Bacon Darwin d529b55651 fix(ivy): i18n - correctly parse XLIFF placeholders (#34155)
The ViewEngine translation extractor does not convert `-` to `_` for
placeholders that represent custom elements. For example `<app-component>`
gets converted to placeholders like `START_TAG_APP-COMPONENT`.

In `$localize` placeholders are expected to be snake-case, not kebab-case.
So we must normalize them when parsing a translation file that might have
been created via the View Engine translation extractor.

The `$localize` extraction code will normalize these placeholders when
creating translation files in the first place.

Fixes #34151

PR Close #34155
2019-12-02 11:24:48 -08:00
Igor Minar 180a41af68 ci: replace fixme-ivy-aot with no-ivy-aot tag for //packages/language-service/test (#34144)
This target will need to be completely updated once the language service supports Ivy.

PR Close #34144
2019-12-02 11:24:18 -08:00
Igor Minar 1421eff382 build: re-enable template type-checking for various targets across the repo (#34144)
Various targets have their template type-checking disabled in the past.

There is no reason for this any more.

The only target that was tricky was packages/examples/core:core_examples
which was quite broken and I had to fix it up.

Template typechecking is still disabled under blaze, see FW-1753 for more
info.

PR Close #34144
2019-12-02 11:24:18 -08:00
Igor Minar d8792b3c36 fix(bazel): reenable template type checking in ng_module (#34144)
due to an unfortunate condition in 168abc6d6f/packages/compiler-cli/src/ngtsc/program.ts (L430-L434) the typechecking has been disabled when running under bazel + ivy.

As far as I can tell the ivyTemplateTypeCheck flag is now obsolete, so removing this
code from ng_module.bzl is desirable. I'll send a separate PR to remove the flag completely.

PR Close #34144
2019-12-02 11:24:18 -08:00
Igor Minar b8eb2f2f23 build: support yarn 1.19.x (#34143)
PR Close #34143
2019-12-02 11:23:48 -08:00
Igor Minar 5a7f33496b refactor(compiler-cli): remove bogus packages/compiler-cli/integrationtest/benchmarks/ (#34142)
nobody uses this folder for anything and the README.md is misleading.

PR Close #34142
2019-12-02 11:22:45 -08:00
Paul Gschwendtner e7cc1d606a refactor(core): update missing-injectable migration description to match guide (#34125)
Updates the description of the `missing-injectable` migration to mention the second pattern
that will be automatically handled.

PR Close #34125
2019-12-02 11:21:50 -08:00
Paul Gschwendtner 5b04abd5c0 docs: update title of v9 injectable migration guide (#34125)
The missing-injectable migration has been updated to handle a breaking change that is
unrelated to missing ´@Injectable` decorators. Though, the breaking change will be handled
as part of this migration since we did not want to create another migration (with all the boilerplate etc.)

The guide has been already updated to reflect the new pattern the migration handles, but we
should also rename the title of the guide to something that also mentions the other pattern.

Not renaming the guide URL since it is referenced in past releases and it's safer to keep the old
URL. The important thing is to change the actual rendered title.

PR Close #34125
2019-12-02 11:21:50 -08:00
Santosh Yadav 040673464c docs: small typo in DI docs (#34122)
PR Close #34122
2019-12-02 11:20:39 -08:00
Keen Yee Liau 7eccbcd30d fix(language-service): Make missing module suggestion instead of error (#34115)
If a Component or Directive is not part of any NgModule, the language
service currently produces an error message. This should not be an
error. Instead, it should be a suggestion.

This PR removes `ng.DiagnosticKind`, and instead reuses
`ts.DiagnosticCategory`.

PR closes https://github.com/angular/vscode-ng-language-service/issues/458

PR Close #34115
2019-12-02 11:19:40 -08:00
Keen Yee Liau 99320e1ffc fix(language-service): use host.error() instead of console.error() (#34114)
`host.error()` would log to file, and makes error messages much easier
to inspect because entries are time-stamped.

PR Close #34114
2019-12-02 11:14:08 -08:00
Keen Yee Liau 39722df41e fix(language-service): Do not produce diagnostics if metadata for NgModule not found (#34113)
The language service incorrectly reports an error if it fails to find
NgModule metadata for a particular Component / Directive. In many cases,
the use case is legit, particularly in test.

This commit removes such diagnostic message and cleans up the interface
for `TypeScriptHost.getTemplateAst()`.

PR closes https://github.com/angular/vscode-ng-language-service/issues/463

PR Close #34113
2019-12-02 11:13:41 -08:00
Joey Perrott c16a79df5c build: add failure message if compile build variable for angular/angular usage (#34109)
To quicken migration for our own developers away from using compile=aot
for setting ivy, we actually fail the build process if the compile
build variable is used with a message to use our config flags instead.

PR Close #34109
2019-12-02 11:13:13 -08:00
Joey Perrott 72d366fe21 build: Add deprecation warning when compile=aot is used for building with Ivy (#34109)
To inform downstream users to switch to using angular_ivy_enabled as the build
variable for setting Ivy, a deprecation message is printed instructing the user
to migrate away from building with compile=*

PR Close #34109
2019-12-02 11:13:13 -08:00
ayazhafiz 1425e63029 fix(language-service): determine correct type for ngFor exported values (#34089)
Currently, variables of an unknown type in an `*ngFor` expression are
refined to have the type of the iterable binding of the `*ngFor`
expression. Unfortunately, this is a bug for variables aliasing
[values exported by
`*ngFor`](https://angular.io/api/common/NgForOf#local-variables),
including `index` and `first`, because they are also given the type of
the binding expression, but they are not of the binding type. For
example, in

```typescript
@Component({
  selector: 'test',
  template: `
    <div *ngFor="let hero of heroes; let i = index; let isFirst = first">
      {{ hero }}
    </div>
  `
})
export class TestComponent {
  heroes: Hero[];
}
```

The local variables `i` and `isFirst` are determined to have a type of
`Hero`, when actually their types are `number` and `boolean`,
respectively.

This commit fixes this bug by checking if the value of a variable in an
`*ngFor` expression is known to be an export and assigning the variable
the type of that export value. Only if the variable does not alias an
export is it typed with the binding value of the `*ngFor` expression.

Closes https://github.com/angular/vscode-ng-language-service/issues/460

PR Close #34089
2019-12-02 11:03:34 -08:00
ajitsinghkaler 72abde603d docs: add deprecated-api-item class to deprecated items (#34088)
Fixes #31455

PR Close #34088
2019-12-02 11:03:05 -08:00
Greg Magolan bbce2ad7d4 build: update to nodejs rules 0.42.1 (#34073)
* This brings in a fix to the `@npm//foo:foo_files` targets for https://github.com/angular/angular/pull/33927 so the a rules_nodejs patch can be removed.
* It also brings a protractor_web_test fix that resolves the need for a work-around in /modules/playground/e2e_test/sourcemap/BUILD.bazel.

PR Close #34073
2019-12-02 11:02:38 -08:00
Sonu Kapoor 2cc954d5a5 test(docs-infra): ensure RxJS-related docs examples can compile without errors (#34063)
Previously, some RxJS-related examples (which are not proper Angular apps) were not
tested on CI as part of the `example-e2e` npm script. This meant that the examples
could get out-of-date or contain compile errors without as noticing.

This commit ensures that the `example-e2e` script picks up these examples and checks
that they compile successfully.

Partly addresses #28017.

PR Close #34063
2019-12-02 11:02:13 -08:00
Igor Minar 3408468121 build: remove fsevents from package.json (#34058)
we no longer need it.

PR Close #34058
2019-12-02 10:56:30 -08:00
Igor Minar b15f86e1ce build: remove gulp-connect and cors npm dependencies (#34058)
we no longer need them.

PR Close #34058
2019-12-02 10:55:55 -08:00
Igor Minar d251f22ebd build: remove obsolete build related tools and helper scripts (#34058)
none of these files are needed any more as they were replaced by Bazel.

PR Close #34058
2019-12-02 10:52:21 -08:00
Pawel Kozlowski df6d6e0b1d perf: add js-web-frameworks benchmark (#34034)
PR Close #34034
2019-12-02 10:51:44 -08:00
Igor Minar ea37e82e69 build: consolidate @angular-devkit/build-angular to the root package.json (#34002)
This allows us to update the version of the package in a single place for all tests.

Notable exemption of this is aio which currently doesn't depend on anything installed in the root.

PR Close #34002
2019-12-02 10:49:12 -08:00
Miško Hevery 168abc6d6f docs: release notes for the v9.0.0-rc.4 release 2019-11-27 15:16:35 -08:00
Santosh Yadav 6108962291 docs: add ngIndia to event page (#33656)
PR Close #33656
2019-11-27 13:04:08 -08:00
Miško Hevery 85b551a388 Revert "refactor: use isObservable provided by rxjs 6.1+ (#27668)"
This reverts commit 92c547830a.
2019-11-27 13:00:59 -08:00
ivanwonder c5006e025f fix(language-service): fix error of array-index out of bounds exception (#33928)
PR Close #33928
2019-11-27 12:48:41 -08:00
ivanwonder 5a227d8d7c feat(language-service): completions support for tuple array (#33928)
PR Close #33928
2019-11-27 12:48:41 -08:00
Igor Minar de7713d6ea ci: remove renovate.json because the config is incorrect (#34103)
.... and the bot is starting to spam us with lots of PRs.

PR Close #34103
2019-11-27 12:47:12 -08:00
Pete Bacon Darwin 2fb9b7ff1b fix(ngcc): do not output duplicate ɵprov properties (#34085)
Previously, the Angular AOT compiler would always add a
`ɵprov` to injectables. But in ngcc this resulted in duplicate `ɵprov`
properties since published libraries already have this property.

Now in ngtsc, trying to add a duplicate `ɵprov` property is an error,
while in ngcc the additional property is silently not added.

// FW-1750

PR Close #34085
2019-11-27 12:46:37 -08:00
Andrew Kushnir 658087be7e fix(ivy): prevent unknown element check for AOT-compiled components (#34024)
Prior to this commit, the unknown element can happen twice for AOT-compiled components: once during compilation and once again at runtime. Due to the fact that `schemas` information is not present on Component and NgModule defs after AOT compilation, the second check (at runtime) may fail, even though the same check was successful at compile time. This commit updates the code to avoid the second check for AOT-compiled components by checking whether `schemas` information is present in a logic that executes the unknown element check.

PR Close #34024
2019-11-27 12:45:32 -08:00
Miško Hevery 8c33f91529 docs: update run instructions (#34090)
PR Close #34090
2019-11-27 10:39:17 -08:00
George Kalpakas 0366743fc3 build(docs-infra): upgrade cli command docs sources to 6c6ad8661 (#34082)
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](8b71bccf9...6c6ad8661):

**Modified**
- help/test.json

##

PR Close #34082
2019-11-27 10:37:39 -08:00
Igor Minar 55b7fe9998 ci: disable renovate for integration tests (#34074)
the package.json in these tests points to file:dist/packages-dist which
is not materialized on renovate-bot, so the bot freaks out and fails to
update the lock files.

This means that the bot currently just opens up PRs that can't be merged.

Example: https://github.com/angular/angular/pull/34071

(In the past this worked nicely because we didn't keep the yarn.lock files
in the git repo for these projects, but that had a problem with unpined
depenedencies and undeterministic build/test runs).

For now it's better to disable the bot by removing all the package.jsons
from the config. We should revisit this in the future have the bot update
the root package.json instead.

PR Close #34074
2019-11-27 10:37:07 -08:00
Pete Bacon Darwin ee7857300b fix(ivy): i18n - ensure that escaped chars are handled in localized strings (#34065)
When creating synthesized tagged template literals, one must provide both
the "cooked" text and the "raw" (unparsed) text. Previously there were no
good APIs for creating the AST nodes with raw text for such literals.
Recently the APIs were improved to support this, and they do an extra
check to ensure that the raw text parses to be equal to the cooked text.

It turns out there is a bug in this check -
see https://github.com/microsoft/TypeScript/issues/35374.

This commit works around the bug by synthesizing a "head" node and morphing
it by changing its `kind` into the required node type.

// FW-1747

PR Close #34065
2019-11-27 10:36:36 -08:00
Alan Agius d5aedbe892 refactor(core): update undecorated-classes-with-di migration rerun command (#33958)
With Angular CLI version 9 RC 3 we can run a single migration for a package using the name of the migration schematic.

We need to pass the schematic name as a value to the `migrate-only` option.
Ex:
```
ng update @angular/core --migrate-only migration-v9-undecorated-classes-with-di
```

See: https://github.com/angular/angular-cli/pull/16174

PR Close #33958
2019-11-27 10:36:02 -08:00
Christopher Dahm 92c547830a refactor: use isObservable provided by rxjs 6.1+ (#27668)
Refactor common, core, forms, router to use the isObservable method from rxjs 6.1+. Remove the isObservable method from core.

PR Close #27668
2019-11-27 10:33:45 -08:00
Igor Minar c291c8e2cb ci: do not run ng_benchmarks on CI (#34057)
We don't collect/review the results from CI, so it's just a waste of CPU time.

It's sufficient if we are able to run these locally and manually.

PR Close #34057
2019-11-26 16:10:09 -08:00
Greg Magolan 005c4a1cc5 build: set default ts_devserver serving_path to /app_bundle.js to match g3 (#33996)
PR Close #33996
2019-11-26 16:09:32 -08:00
Greg Magolan c4335e2817 build: update to nodejs rules 0.41.0 (#33996)
This bring is changes to the @nodejs repository required for https://github.com/angular/angular/pull/33927. See release notes for more details: https://github.com/bazelbuild/rules_nodejs/releases/tag/0.41.0.

rules_nodejs is approaching 1.0 and breaking changes for that release are being made more frequently. In this release, the ts_devserver API changed and it no longer injects html script tags into a provided index.html file. The diff on this commit is large as this breaking change affects quite a few tests.

Also note that we don’t update @angular/bazel schematics and integration/bazel as 0.41.0 is not a recommended update for angular users yet due to the breaking changes in ts_devserver & web_package (now named pkg_web). When a suitable plain npm package that is in progress is finished then it will be possible to easily replace the html injection functionality removed from ts_devserver & pkg_web.

PR Close #33996
2019-11-26 16:09:32 -08:00