Commit Graph

7403 Commits

Author SHA1 Message Date
Pete Bacon Darwin e16d234709 ci: enable compliance tests on Windows (#41556)
Now that we have updated the Bazel node.js rules we can run all the
compliance tests in Windows on CI.

PR Close #41556
2021-04-12 10:08:41 -07:00
Keen Yee Liau 61bfa3d9df test(language-service): Add test to expose bug caused by source file change (#41500)
This commit adds a test to expose the bug caused by source file change in
between typecheck programs.

PR Close #41500
2021-04-09 12:22:31 -07:00
Keen Yee Liau 25e46c1fe4 refactor(language-service): stop tracking lastKwownProgram in CompilerFactory (#41517)
With the work done in #41291, the compiler always tracks the last known
program, so there's no need to track the program in the compiler factory
anymore.

PR Close #41517
2021-04-09 07:46:12 -07:00
Andrew Kushnir 51bb922a08 refactor(forms): add base class for all built-in ControlValueAccessors (#41225)
This commit adds a base class that contains common logic for all ControlValueAccessors defined in Forms package. This allows to remove duplicated logic from all built-in ControlValueAccessor classes.

PR Close #41225
2021-04-08 10:24:10 -07:00
Andrew Scott 44a7fae00f fix(router): handle new navigations from a NavigationEnd event (#41262)
This commit removes the line to set `currentNavigation` to `null` in the
navigation transitions subscription of the router. This logic is
already handled in the `finalize` stage of the transition pipe and has
been found to cause issues if a new navigation is triggered from a
subscription to the `NavigationEnd` event.

fixes #37460

PR Close #41262
2021-04-08 10:23:04 -07:00
Alex Rickabaugh deacc741e0 fix(compiler-cli): ensure the compiler tracks `ts.Program`s correctly (#41291)
`NgCompiler` previously had a notion of the "next" `ts.Program`, which
served two purposes:

* it allowed a client using the `ts.createProgram` API to query for the
  latest program produced by the previous `NgCompiler`, as a starting
  point for building the _next_ program that incorporated any new user
  changes.

* it allowed the old `NgCompiler` to be queried for the `ts.Program` on
  which all prior state is based, which is needed to compute the delta
  from the new program to ultimately determine how much of the prior
  state can be reused.

This system contained a flaw: it relied on the `NgCompiler` knowing when
the `ts.Program` would be changed. This works fine for changes that
originate in `NgCompiler` APIs, but a client of the `TemplateTypeChecker`
may use that API in ways that create new `ts.Program`s without the
`NgCompiler`'s knowledge. This caused the `NgCompiler`'s concept of the
"next" program to get out of sync, causing incorrectness in future
incremental analysis.

This refactoring cleans up the compiler's `ts.Program` management in
several ways:

* `TypeCheckingProgramStrategy`, the API which controls `ts.Program`
  updating, is renamed to the `ProgramDriver` and extracted to a separate
  ngtsc package.

* It loses its responsibility of determining component shim filenames. That
  functionality now lives exclusively in the template type-checking package.

* The "next" `ts.Program` concept is renamed to the "current" program, as
  the "next" name was misleading in several ways.

* `NgCompiler` now wraps the `ProgramDriver` used in the
  `TemplateTypeChecker` to know when a new `ts.Program` is created,
  regardless of which API drove the creation, which actually fixes the bug.

PR Close #41291
2021-04-08 10:20:38 -07:00
Pete Bacon Darwin 10a7c87692 refactor(compiler): implement `ngDeclareInjectable()` (#41316)
This commit changes the partial compilation so that it outputs declarations
rather than definitions for injectables.

The JIT compiler and the linker are updated to be able to handle these
new declarations.

PR Close #41316
2021-04-07 13:57:13 -07:00
Pete Bacon Darwin c83fe1698b refactor(core): rename `ɵɵInjectableDef` interface to `ɵɵInjectableDeclaration` (#41316)
The other similar interfaces were renamed in https://github.com/angular/angular/pull/41119,
but this one was left since it had existed before Ivy. It looks like the interface was
never actually exposed on npm so it is safe to rename this one too.

PR Close #41316
2021-04-07 13:57:12 -07:00
Pete Bacon Darwin 71d3b24da3 refactor(compiler): fix typo (#41316)
There was  spelling mistake in a comment.

PR Close #41316
2021-04-07 13:57:12 -07:00
Andrew Scott d28a391385 fix(router): Remove information about attached component when deactivating route (#41381)
When we deactivate a child route, we deactivate its outlet as well as
its children. We also need to clear the stored information about the
route and the associated component.
If we do not, the context will keep these references and can result in
reactivating an outlet that was deactivated by the previous navigation.

Fixes #41379

PR Close #41381
2021-04-07 13:55:31 -07:00
Kristiyan Kostadinov ec27bd4ed1 feat(compiler): support nullish coalescing in templates (#41437)
Adds support for nullish coalescing expressions inside of Angular templates (e.g. `{{ a ?? b ?? c}}`).

Fixes #36528.

PR Close #41437
2021-04-07 12:04:28 -07:00
Kristiyan Kostadinov d641542587 refactor(core): remove deprecated rxjs signature usage in event emitter and make more minifier-friendly (#41450)
* We had a usage of `Observable.subscribe` that uses the deprecated signature with 3 arguments. These changes switch to the non-deprecated version that passes in an `Observer`.
* Avoids always creating a `complete` callback since it isn't required.
* We were repeating all of the internal callbacks twice: once for sync and once for async. These changes move them out into variables so that they're more minifier-friendly. The savings aren't huge (~100 bytes minified), but it doesn't add any maintenance effort on our end so I decided to add it.

PR Close #41450
2021-04-07 11:53:09 -07:00
Andrew Scott 8f12f47492 fix(compiler-cli): Allow analysis to continue with invalid style url (#41403)
Currently, we throw a FatalDiagnosticError when we fail to load a resource
(`templateUrl` or `styleUrl`) at various stages in the compiler. This prevents
analysis of the component from completing. This will result in in users not being
able to get any information in the component template when there is a missing
`styleUrl`, for example.

This commit simply tracks the diagnostic, marks the component as poisoned, and
continues merrily along. Environments configured to use poisoned data
(like the language service) will then be able to use other information from the analysis.

Fixes https://github.com/angular/vscode-ng-language-service/issues/1241

PR Close #41403
2021-04-07 09:42:21 -07:00
Alan Agius c550bad49d fix(bazel): add missing dependency on `tslib` (#41480)
`@angular/bazel` depends on `tslib` https://unpkg.com/browse/@angular/bazel@11.2.8/src/api-extractor/index.js#L20

Related failure https://github.com/angular/universal/pull/2040

PR Close #41480
2021-04-07 09:39:49 -07:00
JounQin f60fb7d92b fix(compiler-cli): fix extending angularCompilerOptions from non relative extension less TypeScript configuration files (#41349)
support non rooted file of node package and relative path without json extension

close #41343

PR Close #41349
2021-04-07 09:37:44 -07:00
Joey Perrott dd66da1864 release: bump angular-in-web-memory-api package to 0.12.0 (#41487)
PR Close #41487
2021-04-07 09:35:17 -07:00
josemontespg 575f537473 docs(router): make getCurrentNavigation() jsdoc more explicit (#41417)
Add additional clarification to the documentation for
`getCurrentNavigation`.

PR Close #41417
2021-04-06 10:05:17 -07:00
Kristiyan Kostadinov f7c294ee0f feat(core): support `forwardRef` in `providedIn` of `Injectable` declaration (#41426)
Adds support for using a `forwardRef` inside of the `providedIn` of an `Injectable` declaration.

Fixes #41205.

PR Close #41426
2021-04-06 10:03:38 -07:00
Ahmed Ayed e05a6f3bb3 feat(common): add `historyGo` method to `Location` service (#38890)
Add new method `historyGo`, that will let
the user navigate to a specific page from session history identified by its
relative position to the current page.

We add some tests to `location_spec.ts` to validate the behavior of the
`historyGo` and `forward` methods.

Add more tests for `location_spec` to test `location.historyGo(0)`, `location.historyGo()`,
`location.historyGo(100)` and `location.historyGo(-100)`. We also add new tests for
`Integration` spec to validate the navigation when we using
`location#historyGo`.

Update the `historyGo` function docs

Note that this was made an optional function in the abstract classes to
avoid a breaking change. Because our location classes use `implements PlatformLocation`
rather than `extends PlatformLocation`, simply adding a default
implementation was not sufficient to make this a non-breaking change.
While we could fix the classes internal to Angular, this would still have been
a breaking change for any external developers who may have followed our
implementations as an example.

PR Close #38890
2021-04-06 09:25:58 -07:00
Alan Agius 3a823abcc5 refactor(compiler): remove dependency on fs-extra (#41445)
Currently, fs-extra is used to delete a directory recursively, but this is already available in native Node.JS. Hence, making this dependency redundant.

See: https://nodejs.org/docs/latest-v12.x/api/fs.html

PR Close #41445
2021-04-05 15:04:50 -07:00
Charles Lyding 1de04b124e feat(compiler-cli): support transforming component style resources (#41307)
This change introduces a new hook on the `ResourceHost` interface named `transformResource`.
Resource transformation allows both external and inline resources to be transformed prior to
compilation by the AOT compiler. This provides support for tooling integrations to enable
features such as preprocessor support for inline styles.
Only style resources are currently supported. However, the infrastructure is in place to add
template support in the future.

PR Close #41307
2021-04-02 15:48:45 -07:00
Alan Agius dc655262be refactor(compiler): remove TypeScript 4.0 program reuse check (#41406)
We no longer support TS 4.0, hence this check is redundant.

PR Close #41406
2021-04-02 15:47:54 -07:00
Alan Agius 64b979e12b fix(dev-infra): exclude node_modules from circular dependency checks (#41407)
With this change we exclude node_modules from circular dependency checks.

PR Close #41407
2021-04-02 15:47:33 -07:00
Alan Agius cd2961a3d8 ci: add renovate (#41407)
With this change we add renovate to update dependencies in the following locations
- WORKSPACE
- integration/bazel/WORKSPACE
- package.json
- packages/**/package.json
- tools/ts-api-guardian/package.json
- aio/package.json

We also enable yarn workspaces so that dependencies in these packages are hoisting to the root and renovate doesn't created nested lock files.

Enabling auto updates is important, because quite often dependencies get out of date especially in the compiler-cli which depends on a number of external dependencies.

PR Close #41407
2021-04-02 15:47:33 -07:00
mgechev 520ff69854 perf(core): add private hooks around user code executed by the runtime (#41255)
Introduces an **internal**, **experimental** `profiler` function, which
the runtime invokes around user code, including before and after:
- Running the template function of a component
- Executing a lifecycle hook
- Evaluating an output handler

The `profiler` function invokes a callback set with the global
`ng.ɵsetProfiler`. This API is **private** and **experimental** and
could be removed or changed at any time.

This implementation is cheap and available in production. It's cheap
because the `profiler` function is simple, which allows the JiT compiler
to inline it in the callsites. It also doesn't add up much to the
production bundle.

To listen for profiler events:

```ts
ng.ɵsetProfiler((event, ...args) => {
  // monitor user code execution
});
```

PR Close #41255
2021-04-02 10:34:23 -07:00
Pete Bacon Darwin ed77bfea26 test(core): fix JIT factory declaration test for IE11 (#41416)
This commit removes a check for the name of the generated factory
function, which is unimportant to test the behaviour of the code.

The name of these functions is generated from the name of the class
being instantiated. In IE11, there is no `function.name` property available
and so there is a shim for it in `third_party/shims_for_IE.js`, which patches
the `Function.property.name` property.

For performance reasons this shim writes the result of the computation
to the prototype of the function. Unfortunately, this means that any class
that extends the patched class will have the same value for `name`.

PR Close #41416
2021-04-01 12:21:00 -07:00
Pete Bacon Darwin c4af49335c docs(forms): fix the short description for `DefaultValueAccessor` (#41409)
The position of the `{@searchKeywords}` inline tag was causing the short-description to be empty.

PR Close #41409
2021-04-01 12:07:03 -07:00
JoostK ff9470b0a0 fix(compiler): include used components during JIT compilation of partial component declaration (#41353)
In #41104 the list of used directives was split into two arrays of used
directives and components, but the JIT side was not updated. This commit
fixes the JIT integration by including the list of used components.

Fixes #41318

PR Close #41353
2021-04-01 11:39:41 -07:00
Andrew Scott 0226a11c18 fix(language-service): Only provide Angular property completions in templates (#41278)
When possible, the @angular/language-service should only provide
information related to Angular. When there is an embedded language, like
inline templates, editor extensions should have the ability to create
virtual documents and forward the requests to the relevant providers for
that language type (see https://github.com/angular/vscode-ng-language-service/pull/1212).

This commit removes all dom schema completions in both inline and
external templates and provides only the Angular syntax for property completions
on elements.

PR Close #41278
2021-04-01 11:37:30 -07:00
Pete Bacon Darwin 7dfa446c4a fix(common): temporarily re-export and deprecate `XhrFactory` (#41393)
The moved `XhrFactory` still needs to be available from `@angular/common/http`
for some libraries that were built prior to 12.0.0, otherwise they cannot be
used in applications built post-12.0.0.

This commit adds back the re-export of `XhrFactory` and deprecates it.

PR Close #41393
2021-04-01 11:26:11 -07:00
Zach Arend 90f85da2de feat(language-service): add perf tracing to LanguageService (#41319)
Adds perf tracing for the public methods in LanguageService. If the log level is verbose or higher,
trace performance results to the tsServer logger. This logger is implemented on the extension side
in angular/vscode-ng-language-service.

PR Close #41319
2021-03-31 10:03:53 -07:00
Pete Bacon Darwin a371646a37 build: update yargs dependency to 16.2.0. (#41351)
This avoids a vulnerability in the transitive y18n dependency.

Fixes #41215

PR Close #41351
2021-03-30 16:59:38 -07:00
Kristiyan Kostadinov e112e320bf fix(compiler): handle case-sensitive CSS custom properties (#41380)
Currently we normalize all CSS property names in the `StylingBuilder` which breaks custom properties, because they're case-sensitive. These changes add a check so that custom properties aren't normalized.

Fixes #41364.

PR Close #41380
2021-03-30 16:57:44 -07:00
Alan Agius c4628f29be refactor(common): remove `XhrFactory` re-export from `@angular/common/http` (#41370)
This was only done temporary to allow migration in Google3. The removal breaking change message has already been included in #41313

PR Close #41370
2021-03-30 16:57:18 -07:00
Paul Gschwendtner 31370f4103 feat(bazel): allow setting `compilationMode` in `ng_module` rule (#41366)
Adds a new attribute to the `ng_module` rule that allows users to
set the Angular compiler `compilationMode` flag. An alternative
would have been to just enable the option in the user-specified
tsconfig. Though that is more inconvenient if a Bazel workspace
wants to change the compilation mode conditionally at anaylsis
phase through build settings.

Related to: https://github.com/angular/components/pull/22351t

PR Close #41366
2021-03-30 16:55:38 -07:00
Pete Bacon Darwin 2d3cd2b969 refactor(compiler): rename `R3FactoryTarget` to `FactoryTarget` (#41231)
This enumeration will now start to appear in publicly facing code,
as part of declarations, so we remove the R3 to make it less specific
to the internal name for the Ivy renderer/compiler.

PR Close #41231
2021-03-30 16:46:37 -07:00
Pete Bacon Darwin 0c1259505b refactor(compiler-cli): use a shared function for gathering factory metadata. (#41231)
Each of the annotations had its own function for doing this, and those
methods were generally employing spread operators that could allow
unwanted properties to leak into the factory metadata object.

This commit supplies a shared function `toFactoryMetadata()` that
avoids this spread of properties into the returned function.

PR Close #41231
2021-03-30 16:46:37 -07:00
Pete Bacon Darwin 72b65f995d refactor(compiler): remove `R3ResolvedDependencyType` altogether (#41231)
Now that other values were removed from `R3ResolvedDependencyType`,
its meaning can now be inferred from the other properties in the
`R3DeclareDependencyMetadata` type. This commit removes this enum
and updates the code to work without it.

PR Close #41231
2021-03-30 16:46:37 -07:00
Pete Bacon Darwin 463111f6f9 refactor(compiler): remove unused `dependenciesFromGlobalMetadata()` function (#41231)
This function is never called by any of the code in Angular and is not publicly exported.
So it can be safely removed.

PR Close #41231
2021-03-30 16:46:37 -07:00
Pete Bacon Darwin 94a9985b8b refactor(compiler-cli): having an `ɵinj` field no longer guarantees injectability (#41231)
When `ɵngDeclareInjector()` was implemented, the `factory` was moved
out to the `ɵfac` static property on the class. This check was not updated.

PR Close #41231
2021-03-30 16:46:37 -07:00
Pete Bacon Darwin 857dfaa1e7 refactor(core): remove the need for `ɵɵinjectPipeChangeDetectorRef()` (#41231)
This instruction was created to work around a problem with injecting a
`ChangeDetectorRef` into a pipe. See #31438. This fix required special
metadata for when the thing being injected was a `ChangeDetectorRef`.

Now this is handled by adding a flag `InjectorFlags.ForPipe` to the
`ɵɵdirectiveInject()` call, which avoids the need to special test_cases
`ChangeDetectorRef` in the generated code.

PR Close #41231
2021-03-30 16:46:37 -07:00
Pete Bacon Darwin cf4f74aad0 refactor(compiler-cli): implement `ɵɵngDeclareFactory` (#41231)
This commit changes the partial compilation so that it outputs declaration
calls rather than compiled factory functions.

The JIT compiler and the linker are updated to be able to handle these
new declarations.

PR Close #41231
2021-03-30 16:46:37 -07:00
Pete Bacon Darwin 9c9fd2d074 refactor(compiler): remove `injectFn` option from factory metadata (#41231)
The `injectFn` reference can be inferred unamiguously from the `target`
property so it is not needed.

PR Close #41231
2021-03-30 16:46:37 -07:00
James Henry 5e46901ffc refactor(compiler): option to include html comments in `ParsedTemplate` (#41251)
Adds a `collectCommentNodes` option on `ParseTemplateOptions` which will cause the returned `ParsedTemplate` to include an array of all html comments found in the template.

PR Close #41251
2021-03-29 15:16:26 -07:00
Alan Agius 95ff5ecb23 feat(core): add migration for `XhrFactory` import (#41313)
Automatically migrates `XhrFactory` from `@angular/common/http` to `@angular/common`.

PR Close #41313
2021-03-29 15:14:16 -07:00
Alan Agius 300d6d1e38 build(docs-infra): support building the local `angular-in-memory-web-api` package in `NgPackagesInstaller` (#41313)
In some cases, we want to test the AIO app or docs examples against the locally built `angular-in-memory-web-api` for example to ensure that the changes in a commit do not introduce a breaking changes.

PR Close #41313
2021-03-29 15:14:16 -07:00
Alan Agius e0028e5741 fix(platform-browser): configure `XhrFactory` to use `BrowserXhr` (#41313)
With this change we move `XhrFactory` to the root entrypoint of `@angular/commmon`, this is needed so that we can configure `XhrFactory` DI token at a platform level, and not add a dependency  between `@angular/platform-browser` and `@angular/common/http`.

Currently, when using `HttpClientModule` in a child module on the server, `ReferenceError: XMLHttpRequest is not defined` is being thrown because the child module has its own Injector and causes `XhrFactory` provider to be configured to use `BrowserXhr`.
Therefore, we should configure the `XhrFactory` at a platform level similar to other Browser specific providers.

BREAKING CHANGE:

`XhrFactory` has been moved from `@angular/common/http` to `@angular/common`.

**Before**
```ts
import {XhrFactory} from '@angular/common/http';
```

**After**
```ts
import {XhrFactory} from '@angular/common';
```

Closes #41311

PR Close #41313
2021-03-29 15:14:16 -07:00
Alex Rickabaugh b61c009c54 build: emit performance JSON file for each ng_module() (#41125)
A previous commit implemented a streamlined performance metric reporting
system for the compiler-cli, controlled via the compiler option
`tracePerformance`.

This commit adds a custom Bazel flag rule //packages/compiler-cli:ng_perf
to the repository, and wires it through to the `ng_module` implementation
such that if the flag is set, `ng_module` will produce perf results as part
of the build. The underlying mechanism of `//:ng_perf` is not exported from
`@angular/bazel` as a public rule that consumers can use, so there is little
risk of accidental dependency on the contents of these perf traces.

An alias is added so that `--ng_perf` is a Bazel flag which works in our
repository.

PR Close #41125
2021-03-24 13:42:25 -07:00
Alex Rickabaugh 48fec08c95 perf(compiler-cli): refactor the performance tracing infrastructure (#41125)
ngtsc has an internal performance tracing package, which previously has not
really seen much use. It used to track performance statistics on a very
granular basis (microseconds per actual class analysis, for example). This
had two problems:

* it produced voluminous amounts of data, complicating the analysis of such
  results and providing dubious value.
* it added nontrivial overhead to compilation when used (which also affected
  the very performance of the operations being measured).

This commit replaces the old system with a streamlined performance tracing
setup which is lightweight and designed to be always-on. The new system
tracks 3 metrics:

* time taken by various phases and operations within the compiler
* events (counters) which measure the shape and size of the compilation
* memory usage measured at various points of the compilation process

If the compiler option `tracePerformance` is set, the compiler will
serialize these metrics to a JSON file at that location after compilation is
complete.

PR Close #41125
2021-03-24 13:42:24 -07:00
George Kalpakas 81a0e7145b ci: fix `elements` test on older browsers (#41324)
Some `elements` tests rely on `window.customElements` being available.
On browsers where this was not present, the tests were skipped.

This commit includes the `@webcomponents/custom-elements` polyfill in
order to be able to run all `elements` tests on older browsers, which do
not natively support Custom Elements.

This, also, fixes the [saucelabs_ivy][1] and [saucelabs_view_engine][2]
CI jobs (part of the `monitoring` workflow), which have been failing
recently on IE 11 (probably due to the update to TS 4.2.3).

[1]: https://circleci.com/gh/angular/angular/944291
[2]: https://circleci.com/gh/angular/angular/944289

PR Close #41324
2021-03-24 08:28:46 -07:00
JoostK 274dc15452 fix(core): detect synthesized constructors that have been downleveled using TS 4.2 (#41305)
TypeScript 4.2 has changed its emitted syntax for synthetic constructors
when using `downlevelIteration`, which affects ES5 bundles that have
been downleveled from ES2015 bundles. This is typically the case for UMD
bundles in the APF spec, as they are generated by downleveling the
ESM2015 bundle into ES5. The reflection capabilities in the runtime need
to recognize this new form to correctly deal with synthesized
constructors, as otherwise JIT compilation could generate invalid
factory functions.

Fixes #41298

PR Close #41305
2021-03-23 11:23:04 -07:00
JoostK 8d3da56eda fix(ngcc): detect synthesized constructors that have been downleveled using TS 4.2 (#41305)
TypeScript 4.2 has changed its emitted syntax for synthetic constructors
when using `downlevelIteration`, which affects ES5 bundles that have
been downleveled from ES2015 bundles. This is typically the case for UMD
bundles in the APF spec, as they are generated by downleveling the
ESM2015 bundle into ES5. ngcc needs to detect the new syntax in order to
correctly identify synthesized constructor functions in ES5 bundles.

Fixes #41298

PR Close #41305
2021-03-23 11:23:04 -07:00
Kristiyan Kostadinov 190fa07b9a feat(router): add migration for ActivatedRouteSnapshot.fragment (#41092)
Adds a migration that casts the value of `ActivatedRouteSnapshot.fragment` to be non-nullable.

Also moves some code from the `AbstractControl.parent` migration so that it can be reused.

Relates to #37336.

PR Close #41092
2021-03-23 11:18:00 -07:00
Alex Rickabaugh 1eba57eb00 fix(language-service): show suggestion when type inference is suboptimal (#41072)
The Ivy Language Service uses the compiler's template type-checking engine,
which honors the configuration in the user's tsconfig.json. We recommend
that users upgrade to `strictTemplates` mode in their projects to take
advantage of the best possible type inference, and thus to have the best
experience in Language Service.

If a project is not using `strictTemplates`, then the compiler will not
leverage certain type inference options it has. One case where this is very
noticeable is the inference of let- variables for structural directives that
provide a template context guard (such as NgFor). Without `strictTemplates`,
these guards will not be applied and such variables will be inferred as
'any', degrading the user experience within Language Service.

This is working as designed, since the Language Service _should_ reflect
types exactly as the compiler sees them. However, the View Engine Language
Service used its own type system that _would_ infer these types even when
the compiler did not. As a result, it's confusing to some users why the
Ivy Language Service has "worse" type inference.

To address this confusion, this commit implements a suggestion diagnostic
which is shown in the Language Service for variables which could have been
narrowed via a context guard, but the type checking configuration didn't
allow it. This should make the reason why variables receive the 'any' type
as well as the action needed to improve the typings much more obvious,
improving the Language Service experience.

Fixes angular/vscode-ng-language-service#1155
Closes #41042

PR Close #41072
2021-03-23 09:39:19 -07:00
arturovt c49b28013a fix(animations): cleanup DOM elements when the root view is removed (#41059)
Currently, when importing `BrowserAnimationsModule`, Angular uses `AnimationRenderer`
as the renderer. When the root view is removed, the `AnimationRenderer` defers the actual
work to the `TransitionAnimationEngine` to do this, and the `TransitionAnimationEngine`
doesn't actually remove the DOM node, but just calls `markElementAsRemoved()`.

The actual DOM node is not removed until `TransitionAnimationEngine` "flushes".

Unfortunately, though, that "flush" will never happen, since the root view is being
destroyed and there will be no more flushes.

This commit adds `flush()` call when the root view is being destroyed.

BREAKING CHANGE:
DOM elements are now correctly removed when the root view is removed.
If you are using SSR and use the app's HTML for rendering, you will need
to ensure that you save the HTML to a variable before destorying the
app.
It is also possible that tests could be accidentally relying on the old behavior by
trying to find an element that was not removed in a previous test. If
this is the case, the failing tests should be updated to ensure they
have proper setup code which initializes elements they rely on.

PR Close #41059
2021-03-22 12:58:11 -07:00
Matthias Kunnen b5551609fe fix(router): fragment can be null (#37336)
ActivatedRoute.fragment was typed as Observable<string> but could emit
both null and undefined due to incorrect non-null assertion. These
non-null assertions have been removed and fragment has been retyped to
string | null.

BREAKING CHANGE:
Strict null checks will report on fragment potentially being null.
Migration path: add null check.

Fixes #23894, fixes #34197.

PR Close #37336
2021-03-22 10:02:39 -07:00
Pete Bacon Darwin e7b1d434c8 refactor(compiler): use `ɵɵInjectorDeclaration` rather than `ɵɵInjectorDef` in compiled output (#41119)
The `ɵɵInjectorDef` interface is internal and should not be published publicly
as part of libraries. This commit updates the compiler to render an opaque
type, `ɵɵInjectorDeclaration`, for this instead, which appears in the typings
for compiled libraries.

PR Close #41119
2021-03-22 08:57:18 -07:00
Pete Bacon Darwin 4dc27a7eaa refactor(core): rename `ɵɵFactoryDef` to `ɵɵFactoryDeclaration` (#41119)
Th `ɵɵFactoryDef` type will appear in published libraries, via their typings
files, to describe what type dependencies a DI factory has. The parameters
on this type are used by tooling such as the Language Service to understand
the DI dependencies of the class being created by the factory.

This commit moves the type to the `public_definitions.ts` file alongside
the other types that have a similar role, and it renames it to `ɵɵFactoryDeclaration`
to align it with the other declaration types such as `ɵɵDirectiveDeclaration`
and so on.

PR Close #41119
2021-03-22 08:57:18 -07:00
Pete Bacon Darwin 88683702e5 refactor(core): rename `...WithMeta` types to `...Declaration` and alias to `unknown` (#41119)
These types are only used in the generated typings files to provide
information to the Angular compiler in order that it can compile code
in downstream libraries and applications.

This commit aliases these types to `unknown` to avoid exposing the
previous alias types such as `ɵɵDirectiveDef`, which are internal to
the compiler.

PR Close #41119
2021-03-22 08:57:18 -07:00
Pete Bacon Darwin f2f0eaf37c docs(core): fix typos in interface docs (#41119)
The terminology use in the comments did not match the actual
types being referred to.

PR Close #41119
2021-03-22 08:57:18 -07:00
Pete Bacon Darwin aa039a13f0 fix(compiler): correctly process multiple rules containing `:host` selectors (#41261)
When there was more than one rule in a single style string, only the first
rule was having its `:host` selector processed correctly. Now subsequent
rules will also be processed accurately.

Fixes #41237

PR Close #41261
2021-03-19 12:38:15 -07:00
Andrew Kushnir 3a55698402 fix(core): remove obsolete check for [class] and [className] presence (#41254)
Previously presence of both [class] and [className] bindings on an element was treated as compiler error (implemented in 6f203c9575). Later, the situation was improved to actually allow both bindings to co-exist (see a153b61098), however the compiler check was not removed completely. The only situation where the error is thrown at this moment is when static (but with interpolation) and bound `class` attributes are present on an element, for ex.:

```
<div class="{{ one }}" [class]="'two'"></div>
```

In the current situation the error is acually misleading (as it refers to `[className]`).

This commit removes the mentioned compiler check as obsolete and makes the `class` and `style` attribute processing logically the same (the last occurrence is used to compute the value).

PR Close #41254
2021-03-19 12:37:45 -07:00
Pete Bacon Darwin fbdb19c263 docs(localize): expose documentation for the `@angular/localize` package (#40317)
PR Close #40317
2021-03-19 12:36:10 -07:00
Zach Arend 09aefd2904 fix(compiler-cli): add `useInlining` option to type check config (#41043)
This commit fixes the behavior when creating a type constructor for a directive when the following
conditions are met.
1. The directive has bound generic parameters.
2. Inlining is not available. (This happens for language service compiles).

Previously, we would throw an error saying 'Inlining is not supported in this environment.' The
compiler would stop type checking, and the developer could lose out on getting errors after the
compiler gives up.

This commit adds a useInlineTypeConstructors to the type check config. When set to false, we use
`any` type for bound generic parameters to avoid crashing. When set to true, we inline the type
constructor when inlining is required.

Addresses #40963

PR Close #41043
2021-03-18 09:52:47 -07:00
Zach Arend c267c680d8 refactor(compiler-cli): don't use FakeEnvironment for tcb tests (#41043)
For the tests in //packages/compiler-cli/src/ngtsc/typecheck, this
commits uses a `TypeCheckFile` for the environment, rather than a
`FakeEnvironment`. Using a real environment gives us more flexibility
with testing.

PR Close #41043
2021-03-18 09:52:47 -07:00
Kristiyan Kostadinov fa048948be feat(core): drop support for TypeScript 4.0 and 4.1 (#41158)
Drops support for TypeScript 4.0 and 4.1 across the repo.
The typings check for 4.1 was kept in order to ensure that we don't break g3.

PR Close #41158
2021-03-17 09:10:25 -07:00
Kristiyan Kostadinov 59ef40988e feat(core): support TypeScript 4.2 (#41158)
Updates the repo to TypeScript 4.2 and tslib 2.1.0.

PR Close #41158
2021-03-17 09:10:25 -07:00
JoostK eb74a96935 refactor(compiler-cli): separate used components from used directives in partial declaration (#41104)
The partial declaration of a component includes the list of directives
that are used in its template, including some metadata of the directive
which can be used during actual compilation of the component. Used
components are currently part of this list, as components are also
directives. This commit splits the used components into a dedicate
property in the partial declaration, which allows for template
compilation to optimize the generated code for components.

PR Close #41104
2021-03-17 09:09:29 -07:00
JoostK 66e9970691 feat(ngcc): support `__read` helper as used by TypeScript 4.2 (#41201)
This commit complements the support for the `__spreadArray` helper that
was added in microsoft/TypeScript#41523. The prior helpers `__spread`
and `__spreadArrays` used the `__read` helper internally, but the helper
is now emitted as an argument to `__spreadArray` so ngcc now needs to
support evaluating it statically. The real implementation of `__read`
reads an iterable into an array, but for ngcc's static evaluation
support it is sufficient to only deal with arrays as is. Additionally,
the optional `n` parameter is not supported as that is only emitted for
array destructuring syntax, which ngcc does not have to support.

PR Close #41201
2021-03-16 11:06:31 -07:00
JoostK 7b1214eca2 feat(ngcc): support `__spreadArray` helper as used by TypeScript 4.2 (#41201)
In TypeScript 4.2 the `__spread` and `__spreadArrays` helpers were both
replaced by the new helper function `__spreadArray` in
microsoft/TypeScript#41523. These helpers may be used in downleveled
JavaScript bundles that ngcc has to process, so ngcc has the ability to
statically detect these helpers and provide evaluation logic for them.
Because Angular is adopting support for TypeScript 4.2 it becomes
possible for libraries to be compiled by TypeScript 4.2 and thus ngcc
has to add support for the `__spreadArray` helper. The deprecated
`__spread` and `__spreadArrays` helpers are not affected by this change.

Closes #40394

PR Close #41201
2021-03-16 11:06:31 -07:00
Andrew Kushnir e88a9c6350 perf(forms): make `RadioControlRegistry` class tree-shakable (#41126)
This commit makes the `RadioControlRegistry` class tree-shakable by adding the `providedIn` property to its
`@Injectable` decorator. Now if the radio buttons are not used in the app (thus no `RadioControlValueAccessor`
directive is initialized), the `RadioControlRegistry` should not be included into application's prod bundle.

PR Close #41126
2021-03-16 09:35:14 -07:00
Andrew Kushnir b93fb79839 perf(forms): make `FormBuilder` class tree-shakable (#41126)
This commit makes the `FormBuilder` class tree-shakable by adding the `providedIn` property to its `@Injectable`
decorator. Now if the `FormBuilder` class is not referenced in application's code, it should not be included into
its production bundle.

PR Close #41126
2021-03-16 09:35:14 -07:00
JoostK 0093b3b19f fix(ngcc): do not compile JavaScript sources if typings-only processing is repeated (#41209)
The recently introduced typings-only mode in ngcc would incorrectly
write compiled JavaScript files if typings-only mode was requested, in
case the typings of the entry-point had already been processed in a
prior run of ngcc. The corresponding format property for which the
JavaScript files were written were not marked as processed, though, as
the typings-only mode excluded the format property itself from being
marked as processed. Consequently, subsequent runs of ngcc would not
consider the entry-point to have been processed and recompile the
JavaScript bundle once more, resulting in duplicate ngcc imports.

Fixes #41198

PR Close #41209
2021-03-16 09:33:53 -07:00
Pete Bacon Darwin 1a9f526315 docs(core): fix typo in developer docs (#41080)
PR Close #41080
2021-03-15 13:26:51 -07:00
Pete Bacon Darwin ef09922c61 docs(compiler): fix typos in partial compilation comments (#41080)
PR Close #41080
2021-03-15 13:26:51 -07:00
Pete Bacon Darwin 5565810bd6 refactor(compiler-cli): implement `ɵɵngDeclareNgModule` and `ɵɵngDeclareInjector` (#41080)
This commit changes the partial compilation so that it outputs declaration
calls rather than definition calls for NgModules and Injectors.

The JIT compiler and the linker are updated to be able to handle these
new declarations.

PR Close #41080
2021-03-15 13:26:51 -07:00
Pete Bacon Darwin 8a33842cca refactor(compiler): consolidate `R3CompiledExpression` (#41080)
There were a number of almost identical interfaces used in
the same way throughout the Render3 compiler code.
This commit changes the compiler to use the same interface
throughout.

PR Close #41080
2021-03-15 13:26:51 -07:00
Pete Bacon Darwin 90301f42a9 refactor(compiler): remove unused code (#41080)
These functions are not used so can be removed.

PR Close #41080
2021-03-15 13:26:51 -07:00
Pete Bacon Darwin be9d059efc refactor(compiler): move `type` in shared `R3PartialDeclaration` interface (#41080)
All interfaces that extend `R3PartialDeclaration` require a `type`
property so it makes sense to put it in the base interface.

PR Close #41080
2021-03-15 13:26:51 -07:00
Pete Bacon Darwin 12c925a000 refactor(compiler): consolidate `wrapReference()` (#41080)
This function is declared in multiple places. The instances inside
`compiler` are slightly different to those in `compiler-cli`. So this
commit consolidates them into two reusable functions.

PR Close #41080
2021-03-15 13:26:51 -07:00
Pete Bacon Darwin 28a7fba29a refactor(compiler): use `DefinitionMap` and remove `mapToMapExpression()` (#41080)
By consistently using the `DefinitionMap` class there is no longer
any need for the `mapToMapExpression()` function.

PR Close #41080
2021-03-15 13:26:51 -07:00
Andrew Kushnir 3bd1992218 perf(forms): avoid direct references to the `Validators` class (#41189)
Currently the `Validators` class contains a number of static methods that represent different validators as well as some helper methods. Since class methods are not tree-shakable, any reference to the `Validator` class retains all of its methods (even if you've used just one).

This commit refactors the code to extract the logic into standalone functions and use these functions in the code instead of referencing them via `Validators` class. That should make the code more tree-shakable. The `Validators` class still retains its structure and calls these standalone methods internally to keep this change backwards-compatible.

PR Close #41189
2021-03-15 11:12:55 -07:00
FDIM 1644d64398 feat(compiler-cli): introduce HttpContext request context (#25751)
A long-requested feature for HttpClient is the ability to store and retrieve
custom metadata for requests, especially in interceptors. This commit
implements this functionality via a new context object for requests.

Each outgoing HttpRequest now has an associated "context", an instance of
the HttpContext class. An HttpContext can be provided when making a request,
or if not then an empty context is created for the new request. This context
shares its lifecycle with the entire request, even across operations that
change the identity of the HttpRequest instance such as RxJS retries.

The HttpContext functions as an expando. Users can create typed tokens as instances of HttpContextToken, and
read/write a value for the key from any HttpContext object.

This commit implements the HttpContext functionality. A followup commit will
add angular.io documentation.

PR Close #25751
2021-03-15 10:33:48 -07:00
Andrew Kushnir 937e90cd16 perf(forms): make built-in ControlValueAccessors more tree-shakable (#41146)
This commit updates Forms code to avoid direct references to all built-in ControlValueAccessor classes, which
prevents their tree-shaking from production builds. Instead, a new static property is added to all built-in
ControlValueAccessors, which is checked when we need to identify whether a given ControlValueAccessors is a
built-in one.

PR Close #41146
2021-03-12 15:54:59 -08:00
Andrew Kushnir 8a9fe49a2a fix(forms): properly handle the change to the FormGroup shape (#40829)
Currently the code in the `FormGroupDirective` assumes that the shape of the underlying `FormGroup` never
changes and `FormControl`s are not replaced with other types. In practice this is possible and Forms code
should be able to process such changes in FormGroup shape.

This commit adds extra check to the `FormGroupDirective` class to avoid applying FormControl-specific to
other types.

Fixes #13788.

PR Close #40829
2021-03-12 14:23:01 -08:00
Misko Hevery 70962465b5 fix(core): Switch `emitDistinctChangesOnlyDefaultValue` to true (#41121)
BREAKING CHANGE:

Switching default of `emitDistinctChangesOnlyDefaultValue`
which changes the default behavior and may cause some applications which
rely on the incorrect behavior to fail.

`emitDistinctChangesOnly` flag has also been deprecated and will be
removed in a future major release.

The previous implementation would fire changes `QueryList.changes.subscribe`
whenever the `QueryList` was recomputed. This resulted in an artificially
high number of change notifications, as it is possible that recomputing
`QueryList` results in the same list. When the `QueryList` gets recomputed
is an implementation detail, and it should not be the thing that determines
how often change event should fire.

Unfortunately, fixing the behavior outright caused too many existing
applications to fail. For this reason, Angular considers this fix a
breaking fix and has introduced a flag in `@ContentChildren` and
`@ViewChildren`, that controls the behavior.

```
export class QueryCompWithStrictChangeEmitParent {
  @ContentChildren('foo', {
    // This option is the new default with this change.
    emitDistinctChangesOnly: true,
  })
  foos!: QueryList<any>;
}
```
For backward compatibility before v12
`emitDistinctChangesOnlyDefaultValue` was set to `false. This change
changes the default to `true`.

PR Close #41121
2021-03-12 10:47:56 -08:00
Keen Yee Liau 012a2b55e1 build(language-service): use 'export =' syntax for default export (#41165)
Tsserver expects `@angular/language-service` to provide a factory function
as the default export (commonjs-style) of the package.

The current implementation side steps TypeScript's import syntax by using
`module.exports = factory`.
This allows the code to incorrectly re-export other symbols:

```ts
export * from './api';
```

which transpiles to:

```js
var tslib_1 = require("tslib");
tslib_1.__exportStar(require("@angular/language-service/api"), exports);
```

Doing this meant that the package now has a runtime dependency on `tslib`,
which is totally unnecessary.

With the proper `export =` syntax, `tslib` is removed, and no other exports
are allowed.

Output:
```js
(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define("@angular/language-service", ["require", "exports"], factory);
    }
})(function (require, exports) {
    "use strict";
    return function factory(tsModule) {
        var plugin;
        return {
            create: function (info) {
                var config = info.config;
                var bundleName = config.ivy ? 'ivy.js' : 'language-service.js';
                plugin = require("./bundles/" + bundleName)(tsModule);
                return plugin.create(info);
            },
            getExternalFiles: function (project) {
                var _a, _b;
                return (_b = (_a = plugin === null || plugin === void 0 ? void 0 : plugin.getExternalFiles) === null || _a === void 0 ? void 0 : _a.call(plugin, project)) !== null && _b !== void 0 ? _b : [];
            },
            onConfigurationChanged: function (config) {
                var _a;
                (_a = plugin === null || plugin === void 0 ? void 0 : plugin.onConfigurationChanged) === null || _a === void 0 ? void 0 : _a.call(plugin, config);
            },
        };
    };
});
```

PR Close #41165
2021-03-11 14:48:33 -08:00
Pete Bacon Darwin 69afeb3808 fix(localize): trim extracted `equiv-text` values (#41180)
The ViewEngine message extraction would trim the values
of the `equiv-text` attributes. This commit aligns the Ivy
extraction of these attributes.

Fixes #41176

PR Close #41180
2021-03-11 10:31:37 -08:00
Kristiyan Kostadinov 3c66b100dd perf(common): remove unused methods from DomAdapter (#41102)
The `DomAdapter` is present in all Angular apps and its methods aren't tree shakeable.
These changes remove the methods that either aren't being used anymore or were only
used by our own tests. Note that these changes aren't breaking, because the adapter
is an internal API.

The following methods were removed:
* `getProperty` - only used within our own tests.
* `log` - Guaranteed to be defined on `console`.
* `logGroup` and `logGroupEnd` - Only used in one place. It was in the DomAdapter for built-in null checking.
* `logGroupEnd` - Only used in one place. It was placed in the DomAdapter for built in null checking.
* `performanceNow` - Only used in one place that has to be invoked through the browser console.
* `supportsCookies` - Unused.
* `getCookie` - Unused.
* `getLocation` and `getHistory` - Only used in one place which appears to have access to the DOM
already, because it had direct accesses to `window`. Furthermore, even if this was being used
in a non-browser context already, the `DominoAdapter` was set up to throw an error.

The following APIs were changed to be more compact:
* `supportsDOMEvents` - Changed to a readonly property.
* `remove` - No longer returns the removed node.

PR Close #41102
2021-03-10 11:48:24 -08:00
Pete Bacon Darwin b5e8c28640 fix(localize): render correct closing tag placeholder names in XLIFF 2 (#41152)
When there are elements in a translated message, the start and end tags
are encoded as placeholders. The names of these placeholders are computed
from the name of the element. For example `<a> will be `START_LINK` and
`</a>` will be `CLOSE_LINK`.

If there are more than one element with the same name, but different attributes,
then the starting placeholder name is made unique.
For example `<a href="a">` would be `START_LINK`, while `<a href="b">` in
the same message would then be called `START_LINK_1`.
But the closing tags will not be made unique since there are no attrbutes;
the always have the same text `</a>`, which will produce, for example,
`CLOSE_LINK`.

Previously, when extracting XLIFF 2 formatted translation files, the closing
tag placeholder names were computed incorrectly from the opening tag
placeholder names. For example `CLOSE_LINK_1`.

This commit strips these `_1` type endings from the start tag placeholder
name when computing the closing tag placeholder name. It also ensures
that the `type` of the placeholder is computed accurately in these cases
too.

Fixes #41142

PR Close #41152
2021-03-10 10:59:59 -08:00
JoostK b50d88073e perf(compiler-cli): ensure module resolution cache is reused for type-check program (#39693)
The Angular compiler creates two `ts.Program`s; one for emit and one for
template type-checking. The creation of the type-check program could
benefit from reusing the `ts.ModuleResolutionCache` that was primed
during the creation of the emit program. This requires that the compiler
host implements `resolveModuleNames`, as otherwise TypeScript will setup
a `ts.ModuleResolutionHost` of its own for both programs.

This commit ensures that `resolveModuleNames` is always implemented,
even if the originally provided compiler host does not. This is
beneficial for the `ngc` binary.

PR Close #39693
2021-03-09 10:41:08 -08:00
Theoklitos Bampouris e29a29ce9f docs(common): change misspelled constant (#41136)
Change misspelled constant from LOCAL_ID to LOCALE_ID
PR Close #41136
2021-03-09 08:57:38 -08:00
Andrew Kushnir fa3689f432 test(forms): split Forms example app into Reactive and Template-driven ones (#41108)
One of the main goals of the bundling tests is to verify that unused symbols are tree-shaken away in prod bundles.
Currently both Reactive and Template-driven test apps are merged into one. In order to make these tree-shaking
tests even more useful, this commit splits exiting test app into two, so that we can further optimize sets of
symbols that should be retained in both scenarios.

PR Close #41108
2021-03-08 16:05:11 -08:00
Pete Bacon Darwin 2ebe2bcb2f refactor(compiler): move factory out of injector definition (#41022)
Previously, injector definitions contained a `factory` property that
was used to create a new instance of the associated NgModule class.

Now this factory has been moved to its own `ɵfac` static property on the
NgModule class itself. This is inline with how directives, components and
pipes are created.

There is a small size increase to bundle sizes for each NgModule class,
because the `ɵfac` takes up a bit more space:

Before:

```js
let a = (() => {
  class n {}
  return n.\u0275mod = c.Cb({type: n}),
  n.\u0275inj = c.Bb({factory: function(t) { return new (t || n) }, imports: [[e.a.forChild(s)], e.a]}),
  n
})(),
```

After:

```js
let a = (() => {
  class n {}
  return n.\u0275fac = function(t) { return new (t || n) },
  n.\u0275mod = c.Cb({type: n}),
  n.\u0275inj = c.Bb({imports: [[r.a.forChild(s)], r.a]}),
  n
})(),
```

In other words `n.\u0275fac = ` is longer than `factory: ` (by 5 characters)
and only because the tooling insists on encoding `ɵ` as `\u0275`.

This can be mitigated in a future PR by only generating the `ɵfac` property
if it is actually needed.

PR Close #41022
2021-03-08 15:31:30 -08:00
Pete Bacon Darwin d04515cf53 refactor(compiler): separate `compileFactoryFunction()` from `compileInjector()` (#41022)
This commit moves the creation of the injector's factory function
out so that it can be more easily refactored further.

PR Close #41022
2021-03-08 15:31:30 -08:00
Alex Rickabaugh bdf13fe376 docs(compiler-cli): add README.md for template type checking system (#41004)
This commit adds a semi-comprehensive README file which describes the
design goals and implementation of the template type checking engine,
which powers the Angular Language Service as well as the main compiler's
understanding of types in templates.

PR Close #41004
2021-03-08 12:07:04 -08:00
JoostK 87bca2a5c6 perf(compiler-cli): avoid module resolution in cycle analysis (#40948)
The compiler performs cycle analysis for the used directives and pipes
of a component's template to avoid introducing a cyclic import into the
generated output. The used directives and pipes are represented by their
output expression which would typically be an `ExternalExpr`; those are
responsible for the generation of an `import` statement. Cycle analysis
needs to determine the `ts.SourceFile` that would end up being imported
by these `ExternalExpr`s, as the `ts.SourceFile` is then checked against
the program's `ImportGraph` to determine if the import is allowed, i.e.
does not introduce a cycle. To accomplish this, the `ExternalExpr` was
dissected and ran through module resolution to obtain the imported
`ts.SourceFile`.

This module resolution step is relatively expensive, as it typically
needs to hit the filesystem. Even in the presence of a module resolution
cache would these module resolution requests generally see cache misses,
as the generated import originates from a file for which the cache has
not previously seen the imported module specifier.

This commit removes the need for the module resolution by wrapping the
generated `Expression` in an `EmittedReference` struct. This allows the
reference emitter mechanism that is responsible for generating the
`Expression` to also communicate from which `ts.SourceFile` the
generated `Expression` would be imported, precluding the need for module
resolution down the road.

PR Close #40948
2021-03-08 12:05:49 -08:00
JoostK 9cec94a008 perf(compiler-cli): use bound symbol in import graph in favor of module resolution (#40948)
The import graph scans source files for its import and export statements
to extract the source files that it imports/exports. Such statements
contain a module specifier string and this module specifier used to be
resolved to the actual source file using an explicit module resolution
step. This is especially expensive in incremental rebuilds, as the
module resolution cache has not been primed during program creation
(assuming that the incremental program was able to reuse the module
resolution results from a prior compilation). This meant that all module
resolution requests would have to hit the filesystem, which is
relatively slow.

This commit is able to replace the module resolution with TypeScript's
bound symbol of the module specifier. This symbol corresponds with the
`ts.SourceFile` that is being imported/exported, which is exactly what
the import graph was interested in. As a result, no filesystem accesses
are done anymore.

PR Close #40948
2021-03-08 12:05:48 -08:00
Igor Minar 03d47d5701 feat(core): manually annotate de-sugarred core tree-shakable providers with @pureOrBreakMyCode (#41096)
This is necessary for closure compiler in order to support cross chunk code motion.

I'm intentionally not annotating these call sites with @__PURE__ at the moment because
build-optimizer does it within the Angular CLI build. In the future we might want to consider
having both annotations here in case we change how build-optimizer works.

PR Close #41096
2021-03-08 10:30:08 -08:00
Igor Minar 9c210281d4 feat(compiler): emit @__PURE__ or @pureOrBreakMyCode annotations in the generated code (#41096)
This change marks all relevant define* callsites as pure, causing the compiler to
emmit either @__PURE__ or @pureOrBreakMyCode annotation based on whether we are
compiling code annotated for closure or terser.

This change is needed in g3 where we don't run build optimizer but we
need the code to be annotated for the closure compiler.

Additionally this change allows for simplification of CLI and build optimizer as they
will no longer need to rewrite the generated code (there are still other places where
a build optimizer rewrite will be necessary so we can't remove it, we can only simplify it).

PR Close #41096
2021-03-08 10:30:08 -08:00
Jason Bedard 5c4914deff fix(bazel): fix incorrect rollup plugin method signature (#41101)
Update the resolveBazel method signature to align with the rollup plugin
resolveId API: https://rollupjs.org/guide/en/#resolveid

PR Close #41101
2021-03-08 10:06:46 -08:00
Kristiyan Kostadinov 1735430476 feat(localize): add scripts to migrate away from legacy message IDs (#41026)
Adds a new flag to `localize-extract` called `--migrateMapFile` which will generate a JSON file
that can be used to map legacy message IDs to cannonical ones.

Also includes a new script called `localize-migrate` that can take the mapping file which was
generated by `localize-extract` and migrate all of the IDs in the files that were passed in.

PR Close #41026
2021-03-08 10:05:42 -08:00
abarghoud cf5f86386f docs(core): add usage examples for APP_INITIALIZER token (#41095)
Add multiple usage examples for APP_INITIALIZER using Promise, Observable and multi providers

Closes #40730

PR Close #41095
2021-03-08 09:58:18 -08:00
JoostK fed6a7ce7d perf(compiler-cli): detect semantic changes and their effect on an incremental rebuild (#40947)
In Angular programs, changing a file may require other files to be
emitted as well due to implicit NgModule dependencies. For example, if
the selector of a directive is changed then all components that have
that directive in their compilation scope need to be recompiled, as the
change of selector may affect the directive matching results.

Until now, the compiler solved this problem using a single dependency
graph. The implicit NgModule dependencies were represented in this
graph, such that a changed file would correctly also cause other files
to be re-emitted. This approach is limited in a few ways:

1. The file dependency graph is used to determine whether it is safe to
   reuse the analysis data of an Angular decorated class. This analysis
   data is invariant to unrelated changes to the NgModule scope, but
   because the single dependency graph also tracked the implicit
   NgModule dependencies the compiler had to consider analysis data as
   stale far more often than necessary.
2. It is typical for a change to e.g. a directive to not affect its
   public API—its selector, inputs, outputs, or exportAs clause—in which
   case there is no need to re-emit all declarations in scope, as their
   compilation output wouldn't have changed.

This commit implements a mechanism by which the compiler is able to
determine the impact of a change by comparing it to the prior
compilation. To achieve this, a new graph is maintained that tracks all
public API information of all Angular decorated symbols. During an
incremental compilation this information is compared to the information
that was captured in the most recently succeeded compilation. This
determines the exact impact of the changes to the public API, which
is then used to determine which files need to be re-emitted.

Note that the file dependency graph remains, as it is still used to
track the dependencies of analysis data. This graph does no longer track
the implicit NgModule dependencies, which allows for better reuse of
analysis data.

These changes also fix a bug where template type-checking would fail to
incorporate changes made to a transitive base class of a
directive/component. This used to be a problem because transitive base
classes were not recorded as a transitive dependency in the file
dependency graph, such that prior type-check blocks would erroneously
be reused.

This commit also fixes an incorrectness where a change to a declaration
in NgModule `A` would not cause the declarations in NgModules that
import from NgModule `A` to be re-emitted. This was intentionally
incorrect as otherwise the performance of incremental rebuilds would
have been far worse. This is no longer a concern, as the compiler is now
able to only re-emit when actually necessary.

Fixes #34867
Fixes #40635
Closes #40728

PR Close #40947
2021-03-08 08:41:19 -08:00
Igor Minar 8c062493a0 refactor(core): don't use innerHTML in DOMTestComponentRenderer (#41099)
The use of innerHTML is unnecessary and causes TrustedType violations.

PR Close #41099
2021-03-08 08:39:09 -08:00
Andrew Kushnir 32dd3c5dd1 refactor(core): co-locate read/write patched data functions (#41097)
This commit refactors Ivy runtime code to move `readPatchedData` and `attachPatchedData` functions to a single
location for better maintainability and to make it easier to do further changes if needed.  The `readPatchedLView`
function was also moved to the same location (since it's a layer on top of the `readPatchedData` function).

PR Close #41097
2021-03-08 08:38:00 -08:00
Quentin Monmert c676ec1ce5 docs: fix some typos in angular.io examples (#41093)
This commit updates example code to make the spacing more consistent.

PR Close #41093
2021-03-05 15:08:11 -08:00
Alex Rickabaugh fbc9df181e feat(compiler-cli): support producing Closure-specific PURE annotations (#41021)
For certain generated function calls, the compiler emits a 'PURE' annotation
which informs Terser (the optimizer) about the purity of a specific function
call. This commit expands that system to produce a new Closure-specific
'pureOrBreakMyCode' annotation when targeting the Closure optimizer instead
of Terser.

PR Close #41021
2021-03-04 16:04:38 -08:00
Andrew Scott 45216ccc0d fix(language-service): Only provide dom completions for inline templates (#41078)
We currently provide completions for DOM elements in the schema as well
as attributes when we are in the context of an external template.
However, these completions are already provided by other extensions for
HTML contexts (like Emmet). To avoid duplication of results, this commit
updates the language service to exclude DOM completions for external
templates. They are still provided for inline templates because those
are not handled by the HTML language extensions.

PR Close #41078
2021-03-04 14:51:06 -08:00
arturovt 38524c4d29 fix(common): cleanup location change listeners when the root view is removed (#40867)
In the new behavior Angular cleanups `popstate` and `hashchange` event listeners
when the root view gets destroyed, thus event handlers are not added twice
when the application is bootstrapped again.

BREAKING CHANGE:

Methods of the `PlatformLocation` class, namely `onPopState` and `onHashChange`,
used to return `void`. Now those methods return functions that can be called
to remove event handlers.

PR Close #31546

PR Close #40867
2021-03-04 13:09:04 -08:00
abarghoud ca721c2972 feat(core): more precise type for `APP_INITIALIZER` token (#40986)
This commit updates the type of the `APP_INITIALIZER` injection token to
better document the expected types of values that Angular handles. Only
Promises and Observables are awaited and other types of values are ignored,
so the type of `APP_INITIALIZER` has been updated to
`Promise<unknown> | Observable<unknown> | void` to reflect this behavior.

BREAKING CHANGE:

The type of the `APP_INITIALIZER` token has been changed to more accurately
reflect the types of return values that are handled by Angular. Previously,
each initializer callback was typed to return `any`, this is now
`Promise<unknown> | Observable<unknown> | void`. In the unlikely event that
your application uses the `Injector.get` or `TestBed.inject` API to inject
the `APP_INITIALIZER` token, you may need to update the code to account for
the stricter type.

Additionally, TypeScript may report the TS2742 error if the `APP_INITIALIZER`
token is used in an expression of which its inferred type has to be emitted
into a .d.ts file. To workaround this, an explicit type annotation is needed,
which would typically be `Provider` or `Provider[]`.

Closes #40729

PR Close #40986
2021-03-04 12:01:07 -08:00
cexbrayat bf158e7ff0 fix(core): remove duplicated EMPTY_OBJ constant (#41066)
The codebase currently contains several `EMPTY_OBJ` constants,
and they can end up in the bundle of an application.
A recent commit 6fbe219 tipped us off
as it introduced several `noop` occurrences in the golden symbol files.
After investigating, we decided to remove the duplicated symbols.

This probably shaves only a few bytes,
but this commit removes the duplicated functions,
by always using the one in `core/src/utils/empty`.

PR Close #41066
2021-03-04 11:08:49 -08:00
Pete Bacon Darwin d44c7c209d refactor(compiler): remove unused `__BUILD_OPTIMIZER_*` constants (#41040)
These constants were created in a very early phase of Ivy development.
They have never been used in the framework, no the build-optimizer tool.

PR Close #41040
2021-03-04 11:04:27 -08:00
Pete Bacon Darwin 11e16c7b41 refactor(core): do not publish `ɵɵgetFactoryOf()` (#41040)
Previously, `ɵɵgetFactoryOf()` was "privately" published from
`@angular/core` since in the past it was assumed that this
might be an instruction generated by the compiler.

This is not currently the case, so this commit removes it from
the private exports and renames it to indicate that it is a local
helper function.

PR Close #41040
2021-03-04 11:04:27 -08:00
Pete Bacon Darwin 326f167075 refactor(core): remove `getFactoryOf` from `angularCoreDiEnv` (#41040)
This function is never actually generated directly so it can be removed
from the context passed to the JIT compiler.

PR Close #41040
2021-03-04 11:04:27 -08:00
Pete Bacon Darwin 89563442b8 refactor(compiler): remove unused `emitAllPartialModules()` and associated code (#41040)
This method does not appear to be used in the project.
This commit removes it and code that it exclusively
depended upon, or depended upon it.

PR Close #41040
2021-03-04 11:04:26 -08:00
Pete Bacon Darwin 7f24937f1c refactor(compiler): remove unused function (#41040)
The `accessExportScope()` function is not used anymore.

PR Close #41040
2021-03-04 11:04:26 -08:00
Pete Bacon Darwin 0f818f36d7 refactor(core): use `unknown` rather than `never` for private properties (#41040)
Before `unknown` was available, the `never` type was used to discourage
application developers from using "private" properties. The `unknown` type
is much better suited for this.

PR Close #41040
2021-03-04 11:04:26 -08:00
Chris ad40fcae7a docs: improve documentation on how to pass a stringified parameter list to HttpClient (#41010)
Fixes #40618

PR Close #41010
2021-03-04 11:00:23 -08:00
pavlenko 9ae0faa00a docs(router): fix typo for the equivalent `exactMatchOptions` value (#41075)
When `Router.isActive` is called with `true` the `exactMatchOptions` value is set for this case.

PR Close #41075
2021-03-04 10:58:30 -08:00
Alex Rickabaugh bb6e5e2dd0 fix(language-service): don't show external template diagnostics in ts files (#41070)
The compiler considers template diagnostics to "belong" to the source file
of the component using the template. This means that when diagnostics for
a source file are reported, it returns diagnostics of TS structures in the
actual source file, diagnostics for any inline templates, and diagnostics of
any external templates.

The Language Service uses a different model, and wants to show template
diagnostics in the actual .html file. Thus, it's not necessary (and in fact
incorrect) to include such diagnostics for the actual .ts file as well.
Doing this currently causes a bug where external diagnostics appear in the
TS file with "random" source spans.

This commit changes the Language Service to filter the set of diagnostics
returned by the compiler and only include those diagnostics with spans
actually within the .ts file itself.

Fixes #41032

PR Close #41070
2021-03-03 21:40:50 +00:00
Andrew Scott 0847a0353b fix(language-service): Always attempt HTML AST to template AST conversion for LS (#41068)
The current logic in the compiler is to bail when there are errors when
parsing a template into an HTML AST or when there are errors in the i18n
metadata. As a result, a template with these types of parse errors
_will not have any information for the language service_. This is because we
never attempt to conver the HTML AST to a template AST in these
scenarios, so there are no template AST nodes for the language service
to look at for information. In addition, this also means that the errors
are never displayed in the template to the user because there are no
nodes to map the error to.

This commit adds an option to the template parser to temporarily ignore
the html parse and i18n meta errors and always perform the template AST
conversion. At the end, the i18n and HTML parse errors are appended to
the returned errors list. While this seems risky, it at least provides
us with more information than we had before (which was 0) and it's only
done in the context of the language service, when the compiler is
configured to use poisoned data (HTML parse and i18n meta errors can be
interpreted as a "poisoned" template).

fixes angular/vscode-ng-language-service#1140

PR Close #41068
2021-03-03 21:13:58 +00:00
Andrew Scott 1e3c870ee6 fix(language-service): provide element completions after open tag < (#41068)
An opening tag `<` without any characters after it is interperted as a
text node (just a "less than" character) rather than the start of an
element in the template AST. This commit adjusts the autocomplete engine
to provide element autocompletions when the nearest character to the
left of the cursor is `<`.

Part of the fix for angular/vscode-ng-language-service#1140

PR Close #41068
2021-03-03 21:13:58 +00:00
Kristiyan Kostadinov 97b88f3631 fix(compiler): allow binding to autocomplete property on select and textarea elements (#40928)
Updates the schema to allow binding to the `autocomplete` property of a `textarea` or `select`.

Fixes #39490.

PR Close #40928
2021-03-03 10:00:27 -08:00
Andrew Scott 736b1f9fd4 fix(compiler): recover from an incomplete open tag at the end of a file (#41054)
The compiler's parsing code has logic to recover from incomplete open
tags (i.e. `<div`) but the recovery logic does not handle when the
incomplete tag is terminated by an EOF. This commit updates the logic to
allow for the EOF character to be interpreted as the end of the tag open
so that the parser can continue processing. It will then fail to find
the end tag and recover by marking the open tag as incomplete.

Part of https://github.com/angular/vscode-ng-language-service/issues/1140

PR Close #41054
2021-03-03 09:58:56 -08:00
Keen Yee Liau e9e7c33f3c fix(language-service): Add plugin option to force strictTemplates (#41062)
This commit adds a new configuration option, `forceStrictTemplates` to the
language service plugin to allow users to force enable `strictTemplates`.

This is needed so that the Angular extension can be used inside Google without
changing the underlying compiler options in the `ng_module` build rule.

PR Close #41062
2021-03-03 09:48:06 -08:00
Andrew Scott 10aa5641dd fix(language-service): only provide template results on reference requests (#41041)
VSCode only de-duplicates references results for "go to references" requests
but does not de-duplicate them for "find all references" requests. The
result is that users see duplicate references for results in TypeScript
files - one from the built-in TS extension and one from us.
While this is an issue in VSCode (see https://github.com/microsoft/vscode/issues/117095)
this commit provides a quick workaround on our end until it can be addressed there.

This commit should be reverted when microsoft/vscode/issues/117095 is resolved.

fixes https://github.com/angular/vscode-ng-language-service/issues/1124

PR Close #41041
2021-03-03 09:39:11 -08:00
Zach Arend 96f15f0de9 Revert "fix(animations): cleanup DOM elements when the root view is removed (#41001)" (#41056)
This reverts commit a31da48507.

PR Close #41056
2021-03-02 13:31:25 -08:00
Zach Arend 3370ade9a4 refactor(platform-browser): cast response of JSON.parse (#41020)
Casts the response of JSON.parse to `{}`, so that is not an `any` type.
This is because google3 does not allow the use of `any` type.

PR Close #41020
2021-03-01 15:48:24 -08:00
Kapunahele Wong 6c783c7fcb docs: rewrite structural-directives.md (#40015)
PR Close #40015
2021-03-01 15:32:26 -08:00
Andrew Scott 54b088967a refactor(compiler): remove unreachable code (#40984)
1. The error function throws, so no code after it is reachable.
2. Some switch statements are exhaustive, so no code after them are reachable.

PR Close #40984
2021-03-01 15:29:20 -08:00
arturovt a31da48507 fix(animations): cleanup DOM elements when the root view is removed (#41001)
Currently, when importing `BrowserAnimationsModule`, Angular uses `AnimationRenderer`
as the renderer. When the root view is removed, the `AnimationRenderer` defers the actual
work to the `TransitionAnimationEngine` to do this, and the `TransitionAnimationEngine`
doesn't actually remove the DOM node, but just calls `markElementAsRemoved()`.

The actual DOM node is not removed until `TransitionAnimationEngine` "flushes".

Unfortunately, though, that "flush" will never happen, since the root view is being
destroyed and there will be no more flushes.

This commit adds `flush()` call when the root view is being destroyed.

BREAKING CHANGE:
DOM elements are now correctly removed when the root view is removed. It
is possible that tests could be accidentally relying on the old behavior by
trying to find an element that was not removed in a previous test. If
this is the case, the failing tests should be updated to ensure they
have proper setup code which initializes elements they rely on.

PR Close #41001
2021-03-01 15:28:04 -08:00
ivanwonder 8110cf0ed2 fix(language-service): can't provide the Input and Output custom binding property name (#41005)
Now the language service always uses the name of the JavaScript property on the
component or directive instance for this input or output. This PR will use the right
binding property name.

PR Close #41005
2021-03-01 15:26:42 -08:00
Pete Bacon Darwin 0b69fabcf5 fix(compiler-cli): ensure ngcc can handle wildcard base-paths (#41033)
Ngcc uses the `paths` property to compute the potential base-paths
for packages that are being processed. If the `paths` contain a wildcard
`*` within a path segment, ngcc was not finding the base-path correctly.

Now when a wildcard is found, there is an additional search to look for
paths that might match the wildcard.

Fixes #41014

PR Close #41033
2021-03-01 15:25:44 -08:00
cexbrayat e12d9dec64 fix(core): remove duplicated EMPTY_ARRAY constant (#40991)
The codebase currently contains several `EMPTY_ARRAY` constants,
and they can end up in the bundle of an application.
A recent commit 6fbe219 tipped us off
as it introduced several `noop` occurrences in the golden symbol files.
After investigating with @petebacondarwin,
we decided to remove the duplicated symbols.

This probably shaves only a few bytes,
but this commit removes the duplicated functions,
by always using the one in `core/src/utils/empty`.

PR Close #40991
2021-03-01 09:00:43 -08:00
Chris bebdeba5fd docs: improve description, examples of DecimalPipe's digitsInfo parameter (#40714)
Fixes #40671

PR Close #40714
2021-02-26 15:42:29 -08:00
cexbrayat 91cdc11aa0 fix(common): allow number or boolean as http params (#40663)
This change fixes an incompatibility between the old `@angular/http` package
and its successor (`@angular/common/http`) by re-introducing the types that were supported before.

It now allows to use number and boolean directly as HTTP params, instead of having to convert it to string first.

Before:

    this.http.get('/api/config', { params: { page: `${page}` } });

After:

    this.http.get('/api/config', { params: { page }});

`HttpParams` has also been updated to have most of its methods accept number or boolean values.

Fixes #23856

BREAKING CHANGE:

The methods of the `HttpParams` class now accept `string | number | boolean`
instead of `string` for the value of a parameter.
If you extended this class in your application,
you'll have to update the signatures of your methods to reflect these changes.

PR Close #40663
2021-02-26 12:03:50 -08:00
George Kalpakas 284af7308b fix(ngcc): do not fail hard when a format-path points to a non-existing or empty file (#40985)
Previously, when `ngcc` encountered an entry-point with a format-path
that pointed to a non-existing or empty file it would throw an error and
stop processing the remaining tasks.

In the past, we used to ignore such format-paths and continue processing
the rest of the tasks ([see code][1]). This was changed to a hard
failure in 2954d1b5ca. Looking at the code
history, the reason for changing the behavior was an (incorrect)
assumption that the condition could not fail. This assumption failed to
take into account the case where a 3rd-party library has an invalid
format-path in its `package.json`. This is an issue with the library,
but it should not prevent `ngcc` from processing other
packages/entry-points/formats.

This commit fixes this by reporting the task as failed but not throwing
an error, thus allowing `ngcc` to continue processing other tasks.

[1]: https://github.com/angular/angular/blob/3077c9a1f89c5bd75fb96c16e/packages/compiler-cli/ngcc/src/main.ts#L124

Fixes #40965

PR Close #40985
2021-02-26 08:26:33 -08:00
Benjamin Blackwood 6206d99b86 docs(forms): add array example to get method (#41008)
PR Close #41008
2021-02-26 08:24:22 -08:00
Andrew Scott 6c05c80f19 feat(router): Add more find-tuned control in `routerLinkActiveOptions` (#40303)
This commit adds more configurability to the `Router#isActive` method
and `RouterLinkActive#routerLinkActiveOptions`.
It allows tuning individual match options for query params and the url
tree, which were either both partial or both exact matches in the past.
Additionally, it also allows matching against the fragment and matrix
parameters.

fixes #13205

BREAKING CHANGE:
The type of the `RouterLinkActive.routerLinkActiveOptions` input was
expanded to allow more fine-tuned control. Code that previously read
this property may need to be updated to account for the new type.

PR Close #40303
2021-02-24 15:32:05 -08:00
Kristiyan Kostadinov 29d8a0ab09 feat(animations): add support for disabling animations through BrowserAnimationsModule.withConfig (#40731)
Currently the only way to disable animations is by providing the `NoopAnimationsModule`
which doesn't allow for it to be disabled based on runtime information. These changes
add support for disabling animations based on runtime information by using
`BrowserAnimationsModule.withConfig({disableAnimations: true})`.

PR Close #40731
2021-02-24 15:08:27 -08:00
Pete Bacon Darwin 3c24136b98 fix(compiler): ensure JIT compilation of ɵɵngDeclarePipe() works (#40929)
Previously the compiler was not evaluating the JIT compilation
of `ɵɵngDeclarePipe()` but there was no test to check it.

PR Close #40929
2021-02-24 15:07:08 -08:00
Keen Yee Liau e986a9787b fix(language-service): use single entry point for Ivy and View Engine (#40967)
Currently there are two entry points for the `@angular/language-service`
package:

- `@angular/language-service`
  This default entry point is for View Engine LS. Through the redirection
  of `main` field in `package.json`, it resolves to
  `./bundles/language-service.js`.
- `@angular/language-service/bundles/ivy.js`
  This secondary entry point is for Ivy LS.

TypeScript recently changed the behavior of tsserver to allow only package
names as plugin names [1] for security reasons. This means the secondary
entry point for Ivy LS can no longer be used.
We implemented a quick hack in the module resolver (in the extension repo)
to fix this, but the long term fix should be in `@angular/language-service`.

Here, the `main` field in `package.json` is changed to `index.js`, and in the
index file we conditionally load View Engine or Ivy based on the input config.
This eliminates the need for multiple entry points.

As part of this PR, I also removed all source code for View Engine and Ivy
included in the NPM package. Consumers of this package should run the bundled
output and nothing else. This would help us prevent an accidental import that
results in execution of unbundled code.

[1]: https://github.com/microsoft/TypeScript/pull/42713

PR Close #40967
2021-02-24 15:05:44 -08:00
Pete Bacon Darwin 51a79772b2 test(localize): ensure tests pass on Windows (#40952)
These tests were relying upon unix-like paths, which
caused them to fail on Windows.

Note that the `filegroup` Bazel rule tends not to work well
on Windows, so this has been replaced with `copy_to_bin`
instead.

PR Close #40952
2021-02-24 14:27:07 -08:00
Pete Bacon Darwin 8d13f631d9 refactor(ngcc): support processing only the typings files of packages (#40976)
Some tools (such as Language Server and ng-packagr) only care about
the processed typings generated by ngcc. Forcing these tools to process
the JavaScript files as well has two disadvantages:

First, unnecessary work is being done, which is time consuming.

But more importantly, it is not always possible to know how the final bundling
tools will want the processed JavaScript to be configured. For example,
the CLI would prefer the `--create-ivy-entry-points` option but this would
break non-CLI build tooling.

This commit adds a new option (`--typings-only` on the command line, and
`typingsOnly` via programmatic API) that instructs ngcc to only render changes
to the typings files for the entry-points that it finds, and not to write any
JavaScript files.

In order to process the typings, a JavaScript format will need to be analysed, but
it will not be rendered to disk. When using this option, it is best to offer ngcc a
wide range of possible JavaScript formats to choose from, and it will use the
first format that it finds. Ideally you would configure it to try the `ES2015` FESM
format first, since this will be the most performant.

Fixes #40969

PR Close #40976
2021-02-24 14:23:14 -08:00
Andrew Scott d1535a1a77 test(language-service): remove circular dependency (#40966)
This commit removes the circular dependency from buffer->util->project->buffer.

PR Close #40966
2021-02-24 08:54:35 -08:00
Andrew Scott cf687fe8ab refactor(language-service): Remove old testing helpers (#40966)
All specs have been switched to the new testing package. The old test
helpers are no longer needed.

PR Close #40966
2021-02-24 08:54:35 -08:00
Andrew Scott dcee784b4f refactor(language-service): convert references_spec to new testing package (#40966)
refactor(language-service): convert references_spec to new testing package

PR Close #40966
2021-02-24 08:54:35 -08:00
Andrew Scott 000ec6be3c refactor(language-service): migrate type_definitions_spec to the new testing package (#40966)
refactor(language-service): migrate type_definitions_spec to the new testing package

PR Close #40966
2021-02-24 08:54:35 -08:00
Andrew Scott d1b7774753 refactor(language-service): migrate quick_info_spec to new testing package (#40966)
refactor(language-service): migrate quick_info_spec to new testing package

PR Close #40966
2021-02-24 08:54:34 -08:00