Commit Graph

19595 Commits

Author SHA1 Message Date
George Kalpakas 6dc43a475b fix(upgrade): avoid memory leak when removing downgraded components (#39965)
Previously, due to the way the AngularJS and Angular clean-up processes
interfere with each other when removing an AngularJS element that
contains a downgraded Angular component, the data associated with the
host element of the downgraded component was not removed. This data was
kept in an internal AngularJS cache, which prevented the element and
component instance from being garbage-collected, leading to memory
leaks.

This commit fixes this by ensuring the element data is explicitly
removed when cleaning up a downgraded component.

NOTE:
This is essentially the equivalent of #26209 but for downgraded (instead
of upgraded) components.

Fixes #39911
Closes #39921

PR Close #39965
2020-12-08 12:02:48 -08:00
George Kalpakas 988b1e3506 refactor(upgrade): remove unused parameters/properties/variables (#39965)
This commit removes some unused parameters, properties and variables in
various `@angular/upgrade` functions.

PR Close #39965
2020-12-08 12:02:46 -08:00
JoostK e69288418c refactor(compiler-cli): reformat directive/pipe metadata extraction (#39961)
The prior usage of a ternary expression caused the code to be formatted
in a weird way, so this commit replaces the ternary with an `if` statement.

PR Close #39961
2020-12-08 12:02:00 -08:00
JoostK dd8a31838c refactor(compiler-cli): extract parsing of interpolation config (#39961)
Prior to this change the interpolation config value was cast to
`[string, string]` without checking whether there really were two
string values available. This commit extracts the logic of parsing the
interpolation config into a separate function and adds a check that
the array contains exactly two strings.

PR Close #39961
2020-12-08 12:01:59 -08:00
JoostK c0bccc39db refactor(compiler-cli): carry type information into AST value types (#39961)
This change allows the `AstObject` and `AstValue` types to provide
their represented type as a generic type argument, which is helpful
for documentation and discoverability purposes.

PR Close #39961
2020-12-08 12:01:57 -08:00
JoostK 5fa026fd81 refactor(compiler): add type information to `DefinitionMap` (#39961)
This allows the code generation to correspond with a type, which is
helpful for documentation and discoverability purposes. This does not
offer any type-safety with respect to the actually generated code.

PR Close #39961
2020-12-08 12:01:56 -08:00
Daniel Eisterhold 5848439a48 docs(platform-browser): fix spelling of deserialized (#36102)
PR Close #36102
2020-12-08 12:01:04 -08:00
Misko Hevery bc6e6691e9 Revert "build: update bazel rules_nodejs to version 2.3.1 (#39636)"
This reverts commit eee878c00e.
2020-12-08 11:06:22 -08:00
Misko Hevery 73e15bd78f Revert "build: update to use npm_package.pack rule (#39636)"
This reverts commit fbfc7dff48.
2020-12-08 11:06:17 -08:00
Kalle Järvenpää 5a2a907adf docs(animations): a small typo (#37164)
Removed two extra closing parentheses in docs.
PR Close #37164
2020-12-08 09:22:22 -08:00
JiaLiPassion fbfc7dff48 build: update to use npm_package.pack rule (#39636)
Remove the work around solution for the `npm pack`, we can now
use `npm_package.pack` rule of bazel, since the windows os issue
has been fixed here https://github.com/bazelbuild/rules_nodejs/commit/bc36519

PR Close #39636
2020-12-08 09:15:49 -08:00
JiaLiPassion eee878c00e build: update bazel rules_nodejs to version 2.3.1 (#39636)
Update the version `rules_nodejs` to 2.3.1, so the `npm_package.pack` rule
can now work on windows os.

PR Close #39636
2020-12-08 09:15:46 -08:00
Andrew Scott a694838c41 refactor(compiler-cli): TemplateTypeChecker with checkTypeOfAttributes=false should still work (#39537)
When the compiler option `checkTypeOfAttributes` is `false`, we should
still be able to produce type information from the
`TemplateTypeChecker`. The current behavior ignores all attributes that
map to directive inputs. This commit includes those attribute bindings
in the TCB but adds the "ignore for diagnostics" marker so they do not
produce errors. This way, consumers of the TTC (the Language Service)
can still get valid information about these attributes even when the
user has configured the compiler to not produce diagnostics/errors for them.

PR Close #39537
2020-12-08 09:14:27 -08:00
Pete Bacon Darwin 86fdc77ddf docs: replace image with one containing correct text (#40022)
The previous image referred to "Mr IQ". The example application
(and the content of the referring guide) actually uses "Dr IQ".

Closes #34823

PR Close #40022
2020-12-08 09:12:01 -08:00
m-ahmadi 2ffd739aed docs: rephrased two sentences (#37230)
This commit rephrases a confusing sentence, and also adds more info to
another sentence to be more understandable.

PR Close #37230
2020-12-08 09:02:51 -08:00
Pete Bacon Darwin f06a50fc0c docs: fix reference to `routes` array in TOH tutorial (#40023)
The previous tutorial content referred to a `Routes` member of
`AppRoutingModule`, which is not correct. Instead there is a
`routes` variable that is passed to the `forRoot()` method when
configuring the `AppRoutingModule`.

Replaces #36583

PR Close #40023
2020-12-08 08:56:40 -08:00
George Kalpakas 8d30551954 build(docs-infra): upgrade cli command docs sources to 099ce69de (#40020)
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](2eb97bf5b...099ce69de):

**Modified**
- help/build.json
- help/generate.json
- help/serve.json

PR Close #40020
2020-12-08 08:54:39 -08:00
Joey Perrott 25e3dc594d refactor(dev-infra): separate retrieving targeted branches from printing them (#39897)
Separate retrieving targeted branches from printing the branches to allow for
other tools to better integrate with the results.

PR Close #39897
2020-12-08 08:54:08 -08:00
Panagiotis Kyriazopoulos 2292554856 docs(core): fix typos in the "View Encapsulation" guide (#39246)
1. In line 25 changed the word "components" to "component's".
2. In line 66 changed the phrase "you never refer to them" to "you should never refer to them".
3. Appended the paragraph containing the above phrase in a `div` with the class `alert is-helpful`.

PR Close #39246
2020-12-08 08:53:36 -08:00
ankitkaushik24 f408af30bb docs: removes the outdated content (#39242)
Remove the statements where mentions the component in the `entryComponents`
array inside `NgModule` metadata.

This is not required since Angular version 9.

PR Close #39242
2020-12-08 08:53:00 -08:00
profanis e8d2348e21 docs: how to create a custom Attribute decorator in a child component and use it from a parent component (#38721)
Aside from using the @input() decorator, we can use the @Attrbitute decorator too.
Of course, those two are different and support different causes.
I expected to see a working example on the Attribute Bindings section, but I didn't find one.
This PR depicts the usage of the Attribute decorator between two components

PR Close #38721
2020-12-08 08:52:25 -08:00
Ajit Singh 6e7a57f97a docs: add note that sting based lazy loading is opt-in (#35956)
after angular version 8 string based lazy loading is not activated by default it is an opt in behaviour in which you have to add the lazy loaded routes in the tsconfig file for compilation. Aded a note too that it will be removed in version 11.

Fixes #35652

PR Close #35956
2020-12-08 08:47:39 -08:00
JoostK 3ec2807e38 refactor(compiler-cli): add script to update all golden partial files (#39989)
The golden files for the partial compliance tests need to be updated
with individual Bazel run invocations, which is not very ergonomic when
a large number of golden files need to updated. This commit adds a
script to query the Bazel targets that update the goldens and then runs
those targets sequentially.

PR Close #39989
2020-12-07 16:21:42 -08:00
Pete Bacon Darwin b8714c384f test(compiler-cli): add source-map compliance tests for inline-templates (#39939)
This test migrates source-mapping tests to the new compliance test framework.
The original tests are found in the file at:
`packages/compiler-cli/test/ngtsc/template_mapping_spec.ts`.

These new tests also check the mappings resulting from partial compilation
followed by linking, after flattening the pair of source-maps that each
process generates.

Note that there are some differences between the mappings for full compile
and linked compile modes, due to how TypeScript and Babel use source-span
information on AST nodes.  To accommodate this, there are two expectation
files for most of these source files.

PR Close #39939
2020-12-07 16:21:07 -08:00
Pete Bacon Darwin 9066ca9e92 test(compiler-cli): add support for source-map checks in compliance tests (#39939)
This commit allows compliance test-cases to be written that specify
source-map mappings between the source and generated code.

To check a mapping, add a `// SOURCE:` comment to the end of a line:

```
<generated code> // SOURCE: "<source-url>" <source code>
```

The generated code will still be checked, stripped of the `// SOURCE` comment,
as normal by the `expectEmit()` helper.

In addition, the source-map segments are checked to ensure that there is a
mapping from `<generated code>` to `<source code>` found in the file at
`<source-url>`.

Note:

* The source-url should be absolute, with the directory containing the
  TEST_CASES.json file assumed to be `/`.
* Whitespace is important and will be included when comparing the segments.
* There is a single space character between each part of the line.
* Newlines within a mapping must be escaped since the mapping and comment
  must all appear on a single line of this file.

PR Close #39939
2020-12-07 16:21:05 -08:00
Pete Bacon Darwin 09ba30ef29 test(compiler-cli): improve compliance test compile mode filtering (#39939)
Previously one could set a flag in a `TEST_CASES.json` file to exclude
the test-cases from being run if the input files were being compiled
partially and then linked.

There are also scenarios where one might want to exclude test-cases
from "full compile" mode test runs.

This commit changes the compliance test tooling to support a new
property `compilationModeFilter`, which is an array containing one or
more of `"full compile"` and `"linked compile"`. Only the tests
whose `compilationModeFilter` array contains the current compilation
mode will be run.

PR Close #39939
2020-12-07 16:21:04 -08:00
Pete Bacon Darwin c5ea3d5b0e test(compiler-cli): ensure that golden partial files are parsed accurately (#39939)
Previously files were serialized with an extra newline seperator that
was not removed when parsing. This caused the parsed file to start with
an extra newline that invalidated its source-map.

Also, the splitting was producing an empty entry at the start of the extracted
golden files which is now ignored.

PR Close #39939
2020-12-07 16:21:02 -08:00
Pete Bacon Darwin 2afa3801bc test(compiler-cli): fix TEST_CASES.json schema (#39939)
The schema accidentally included the `expectedErrors` and `extraCheck`
properties below the `files` property instead of below the `expectations`
property.

PR Close #39939
2020-12-07 16:21:01 -08:00
Bjarki ef892743ec feat(compiler): support tagged template literals in code generator (#39122)
Add a TaggedTemplateExpr to represent tagged template literals in
Angular's syntax tree (more specifically Expression in output_ast.ts).
Also update classes that implement ExpressionVisitor to add support for
tagged template literals in different contexts, such as JIT compilation
and conversion to JS.

Partial support for tagged template literals had already been
implemented to support the $localize tag used by Angular's i18n
framework. Where applicable, this code was refactored to support
arbitrary tags, although completely replacing the i18n-specific support
for the $localize tag with the new generic support for tagged template
literals may not be completely trivial, and is left as future work.

PR Close #39122
2020-12-07 16:20:04 -08:00
Andrew Scott e92d8a8e8f test(compiler-cli): Add test for checkTypeOfDomReferences = false (#39539)
Add test for when `checkTypeOfDomReferences = false` to ensure that we
do not regress in behavior at any point. The desired behavior for this
case is that the `TemplateTypeChecker` will honor the user's
configuration and not produce symbols for the dom reference.

PR Close #39539
2020-12-07 13:22:29 -08:00
George Kalpakas 7901ebafa0 build(docs-infra): upgrade cli command docs sources to 2eb97bf5b (#39943)
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](548c6ed3e...2eb97bf5b):

**Modified**
- help/analytics.json
- help/build.json
- help/config.json
- help/e2e.json
- help/extract-i18n.json
- help/generate.json
- help/lint.json
- help/new.json
- help/serve.json
- help/test.json
- help/update.json

PR Close #39943
2020-12-07 13:21:40 -08:00
Misko Hevery 5fc45082ca fix(core): Support extending differs from root `NgModule` (#39981)
Differs tries to inject parent differ in order to support extending.
This does not work in the 'root' injector as the provider overrides the
default injector. The fix is to just assume standard set of providers
and extend those instead.

PR close #25015
Issue close #11309 `Can't extend IterableDiffers`
Issue close #18554 `IterableDiffers.extend is not AOT compatible`
  (This is fixed because we no longer have an arrow function in the
  factory but a proper function which can be imported.)

PR Close #39981
2020-12-07 09:51:27 -08:00
Alexey Elin 775394c809 docs: use double colon for pseudo-elements (#40004)
The double colon helps to distinguish between pseudo-classes and pseudo-elements.
https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements

PR Close #40004
2020-12-07 09:49:46 -08:00
Joey Perrott 6d19c16d32 build: remove check-env script (#39980)
Remove the check-env script as it is not longer relied on and only surfaces
false positives/known mismatches at this point.

Since our tooling now acts using vendored code where needed, this is no
longer as necessary as it previously was.

PR Close #39980
2020-12-07 09:48:11 -08:00
Joey Perrott d9356f2842 feat(dev-infra): close pull requests on merge which do not target master branch (#39979)
Previously, when a PR which does not target the master branch in the Github UI was
merged it would not close automatically.  This change detects when this case occurs
and closes the PR via the Github API.

For example:

  A PR which targets the 11.0.x branch in the Github UI has the `target: patch` label

This PR is only pushed into the 11.0.x branch, which does not trigger Github's
reference based actions to close the PR.

PR Close #39979
2020-12-07 09:47:30 -08:00
George Kalpakas a8aeb74714 test(upgrade): run tests against AngularJS v1.8.x as well (#39972)
We intend to run the `@angular/upgrade` tests against all supported
versions of AngularJS (v1.5+). Previously, we only ran them against
v1.5, v1.6 and v1.7.

Since AngularJS v1.8 was released recently, this commit adds it to the
list of AngularJS versions we test against.

PR Close #39972
2020-12-07 09:40:49 -08:00
arturovt 7954c8dfa3 perf(forms): use `ngDevMode` to tree-shake `_ngModelWarning` (#39964)
This commit adds `ngDevMode` guard to call `_ngModelWarning` only
in dev mode (similar to how things work in other parts of Ivy runtime code).
The `ngDevMode` flag helps to tree-shake this function from production builds
(since it will act as no-op, in dev mode everything will work as it works right now)
to decrease production bundle size.

PR Close #39964
2020-12-04 16:08:02 -08:00
arturovt 9ebe42370a perf(animations): use `ngDevMode` to tree-shake warning (#39964)
This commit adds ngDevMode guard to show warning only
in dev mode (similar to how things work in other parts of Ivy runtime code).
The ngDevMode flag helps to tree-shake this warning from production builds
(in dev mode everything will work as it works right now) to decrease production bundle size.

PR Close #39964
2020-12-04 16:08:01 -08:00
arturovt f022efa06f perf(common): use `ngDevMode` to tree-shake warnings (#39964)
This commit adds ngDevMode guard to show warnings only
in dev mode (similar to how things work in other parts of Ivy runtime code).
The ngDevMode flag helps to tree-shake these warnings from production builds
(in dev mode everything will work as it works right now) to decrease production bundle size.

PR Close #39964
2020-12-04 16:08:00 -08:00
arturovt e1fe9ecffe perf(core): use `ngDevMode` to tree-shake `checkNoChanges` (#39964)
This commit adds `ngDevMode` guard to run `checkNoChanges` only
in dev mode (similar to how things work in other parts of Ivy runtime code).
The `ngDevMode` flag helps to tree-shake this code from production builds
(in dev mode everything will work as it works right now) to decrease production bundle size.

PR Close #39964
2020-12-04 16:07:59 -08:00
Pete Bacon Darwin d2042a0da2 refactor(compiler-cli): use semver range checking for partial versions (#39847)
The partial compiler will add a version number to the objects that are
generated so that the linker can select the appropriate partial linker
class to process the metadata.

Previously this version matching was a simple number check. Now
the partial compilation writes the current Angular compiler version
into the generated metadata, and semantic version ranges are used
to select the appropriate partial linker.

PR Close #39847
2020-12-04 10:26:17 -08:00
arturovt 8b0cccca45 perf(core): use `ngDevMode` to tree-shake warnings (#39959)
This commit adds `ngDevMode` guard to show sanitization warnings only
in dev mode (similar to how things work in other parts of Ivy runtime code).
The `ngDevMode` flag helps to tree-shake these warnings from production builds
(in dev mode everything will work as it works right now) to decrease production bundle size.

PR Close #39959
2020-12-04 10:21:36 -08:00
Alex Rickabaugh 28a0bcb424 feat(language-service): implement autocompletion for global properties (Ivy) (#39250)
This commit adds support in the Ivy Language Service for autocompletion in a
global context - e.g. a {{foo|}} completion.

Support is added both for the primary function `getCompletionsAtPosition` as
well as the detail functions `getCompletionEntryDetails` and
`getCompletionEntrySymbol`. These latter operations are not used yet as an
upstream change to the extension is required to advertise and support this
capability.

PR Close #39250
2020-12-04 10:19:45 -08:00
cexbrayat 67c5fe06e6 docs: improve FormBuilder.group deprecation message (#39946)
This expands the deprecation message that started to pop up in v11.0.3
after the landing of commit e148382bd0,
that deprecated the `{[key: string]: any}` type for the options property of the `FormBuilder.group` method.

It turns out that having a custom validator declared as
`{ validators: (group: FormGroup) => ValidationErrors|null }` works in practice,
but is now inferred by TS as the deprecated version of `group`
(because `FormGroup` is a subclass of `AbstractControl` that `ValidatorFn` expects).
We considered the possibility of tweaking the forms API to accept such validators,
but it turns out to generate too many changes in the framework or possible breaking changes for Angular users.

We settled for a more explicit deprecation message, elaborated with the help of @petebacondarwin.
This will hopefully help developers to understand why the deprecation warning is showing up
when they think they are already using the non-deprecated overload.

PR Close #39946
2020-12-04 10:18:48 -08:00
Joey Perrott 8683529e4a release: correct CHANGELOG.md to include changes from 11.0.3 release (#39951)
The changelog entry for the 11.0.3 release was not included in the
changelog on master as expected.

PR Close #39951
2020-12-04 10:18:00 -08:00
JoostK a7e4db3344 test(compiler-cli): improve compliance test performance (#39956)
The newly built compliance test runner was not using the shared source
file cache that was added in b627f7f02e,
which offers a significant performance boost to the compliance test
targets.

PR Close #39956
2020-12-04 10:17:21 -08:00
Zach Arend de8f0fe5ee test(language-service): convert ivy diagnostics tests from legacy (#39957)
This commit updates the tests for the diagnostics in the ivy language
service to use the new in-memory test environment.

PR Close #39957
2020-12-04 10:16:43 -08:00
Keen Yee Liau 65651b094d docs: remove support for v8 LTS (#39915)
Support window for v8 LTS ended on November 28, 2020.

PR Close #39915
2020-12-03 13:46:05 -08:00
ayazhafiz 3b700985f0 fix(language-service): do not treat file URIs as general URLs (#39917)
In the past, the legacy (VE-based) language service would use a
`UrlResolver` instance to resolve file paths, primarily for compiler
resources like external templates. The problem with this is that the
UrlResolver is designed to resolve URLs in general, and so for a path
like `/a/b/#c`, `#c` is treated as hash/fragment rather than as part
of the path, which can lead to unexpected path resolution (f.x.,
`resolve('a/b/#c/d.ts', './d.html')` would produce `'a/b/d.html'` rather
than the expected `'a/b/#c/d.html'`).

This commit resolves the issue by using Node's `path` module to resolve
file paths directly, which aligns more with how resources are resolved
in the Ivy compiler.

The testing story here is not great, and the API for validating a file
path could be a little bit prettier/robust. However, since the VE-based
language service is going into more of a "maintenance mode" now that
there is a clear path for the Ivy-based LS moving forward, I think it is
okay not to spend too much time here.

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

PR Close #39917
2020-12-03 13:45:30 -08:00
Andrew Scott dd18cfd983 refactor(language-service): create findRenameLocations stubs (#39919)
Create stubs for `findRenameLocations` for both VE and Ivy Language Service
implementations. This will prevent failed requests when it is implemented on the vscode plugin side.

PR Close #39919
2020-12-03 13:44:49 -08:00