Create stubs for getTypeDefinitionAtPosition for both VE and Ivy Language Service implementations.
This will prevent failed requests when it is implemented on the vscode plugin side
PR Close#39050
* Add `templateNode` to `ElementSymbol` and `TemplateSymbol` so callers
can use the information about the attributes on the
`TmplAstElement`/`TmplAstTemplate` for directive matching
* Remove helper function `getSymbolOfVariableDeclaration` and favor
more specific handling for scenarios. The generic function did not
easily handle different scenarios for all types of variable declarations
in the TCB
PR Close#39047
Currently it is impossible to determine the source of a binding that
generates `BoundAttribute` because all bound attributes generated from a
microsyntax expression share the same source span.
For example, in
```html
<div *ngFor="let item of items; trackBy: trackByFn"></div>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
source span for all `BoundAttribute`s generated from microsyntax
```
the `BoundAttribute` for both `ngForOf` and `ngForTrackBy`
share the same source span.
A lot of hacks were necessary in View Engine language service to work
around this limitation. It was done by inspecting the whole source span
then figuring out the relative position of the cursor.
With this change, we introduce a flag to set the binding span as the
source span of the `ParsedProperty` in Ivy AST.
This flag is needed so that we don't have to change VE ASTs.
Note that in the binding parser, we already set `bindingSpan` as the
source span for a `ParsedVariable`, and `keySpan` as the source span for
a literal attribute. This change makes the Ivy AST more consistent by
propagating the binding span to `ParsedProperty` as well.
PR Close#39036
This commit updates ngbot config to avoid requesting google3 presubmit for the changes in
the `packages/compiler-cli/src/ngtsc/sourcemaps` folder (which is not synced into google3).
PR Close#39035
In preparation for the Ivy Language service, add the same properties to AppComponent that appear in
TemplateReference so the inline template can be tested thoroughly.
PR Close#39033
This commit adds an API to `NgCompiler`, a method called
`getComponentsWithTemplateFile`. Given a filesystem path to an external
template file, it retrieves a `Set` (actually a `ReadonlySet`) of component
declarations which are using this template. In most cases, this will only be
a single component.
This information is easily determined by the compiler during analysis, but
is hard for a lot of Angular tooling (e.g. the language service) to infer
independently. Therefore, it makes sense to expose this as a compiler API.
PR Close#39002
Previously, when updating the dependency versions in
`aio/tools/examples/shared/package.json` (which contains all
dependencies used in docs examples projects), one had to manually go
through all boilerplate directories and update the `package.json` files
with the same versions.
This commit simplifies this task by automating it via a Node.js script.
PR Close#38992
When updating the boilerplate for CLI-based docs examples, one needed to
install dependencies inside the
`aio/tools/examples/shared/boilerplate/cli/` directory, which resulted
in a `node_modules/` directory and a `yarn.lock` file. These were not
supposed to be part of the boilerplate, so they had to be manually
removed after the boilerplate was updated.
This commit simplifies the workflow by allowing boilerplate files to be
ignored (both by git and the `example-boilerplate.js` script) via a
`.gitignore` file. This way, it is no longer necessary to manually
remove the unneeded directories/files.
PR Close#38992
This commit updates the Markdown files inside the `aio/tools/` directory
to contain one sentence per line in order to be consistent with how
Markdown files are formatted in the rest of the repo.
PR Close#38992
Instead of doing all sorts of checks in the `visit()` method, move checks
that are specific to `BoundEvent` to the `visitBoundEvent()` method.
PR Close#38985
Remove @angular/platform-webworker and @angular/platform-webworker-dynamic
as they were deprecated in v8
BREAKING CHANGE: @angular/platform-webworker and @angular/platform-webworker-dynamic
have been removed as they were deprecated in v8
PR Close#38846
Notes Paul and Pawel as OOO through commenting out their usernames in users
entries throughout the pullapprove configs which could result in their review
being requested by pullapprove.
PR Close#39028
This commit updates TypeScript and other dependencies used in angular.io
to more closely align with new apps created with the latest Angular CLI.
It also updates `tsconfig.json`, re-ordering some properties around and
introducing some more checks (again to more closely match new CLI apps).
NOTE:
I skipped updating RxJS from 6.5.4 to 6.6.3, because it increased the
main bundle by ~500B.
NOTE:
`tslint.json` will be updated in a subsequent PR, because it requires
more extensive changes.
PR Close#39017
This commit updates the version of Angular Components used in angular.io
to version 10.2.2.
NOTE:
The actual size increase for the main bundle in ViewEngine mode is 1.3KB
(because the actual size before this commit was 430423B, not 430008B as
seen in `aio-payloads.json`).
PR Close#39017
This commit updates the version of Angular framework used in angular.io
to version 10.1.3.
NOTE:
The actual size decrease for the main bundle is 3KB (because the actual
size before this commit was 451226B, not 450952B as seen in
`aio-payloads.json`).
PR Close#39017
With the introduction of incremental type checking in #36211, an
intermediate `ts.Program` for type checking is only created if there are
any templates to check. This rendered some tests ineffective at avoiding
regressions, as the intermediate `ts.Program` was required for the tests
to fail if the scenario under test would not be accounted for. This
commit adds a single component to these tests, to ensure the
intermediate `ts.Program` is in fact created.
PR Close#39011
Prior to this fix, incremental rebuilds could fail to type check due to
missing ambient types from auto-discovered declaration files in @types
directories, or type roots in general. This was caused by the
intermediary `ts.Program` that is created for template type checking,
for which a `ts.CompilerHost` was used which did not implement the
optional `directoryExists` methods. As a result, auto-discovery of types
would not be working correctly, and this would retain into the
`ts.Program` that would be created for an incremental rebuild.
This commit fixes the issue by forcing the custom `ts.CompilerHost` used
for type checking to properly delegate into the original
`ts.CompilerHost`, even for optional methods. This is accomplished using
a base class `DelegatingCompilerHost` which is typed in such a way that
newly introduced `ts.CompilerHost` methods must be accounted for.
Fixes#38979
PR Close#39011
We weren't resolving a path correctly which resulted in an error on Windows.
For reference, here's the error. Note the extra slash before `C:`:
```
Error: ENOENT: no such file or directory, scandir '/C:/bazel_output_root/yxvwd24o/external/npm/node_modules/typescript'
at Object.readdirSync (fs.js:854:3)
```
PR Close#39005
In the past, the docs examples were configured to not use AOT
compilation in development mode (only in production mode). This was an
artifact of when JIT was the default in development mode.
Now that AOT is the default (even in development mode) for new CLI apps,
this commit configures all docs examples to always use AOT compilation.
(This has been made possible by fixing the `component-interaction` docs
example to correctly run in AOT mode in an earlier commit.)
PR Close#39001
Previously, some of the e2e tests of the `component-interaction` docs
example were disabled because they were failing.
This commit fixes and re-enables them.
PR Close#39001
This commit refactors the e2e tests of the `component-interaction` docs
example to improve readability and make them easier to maintain.
Changes include:
- Switch from `element.all().get(0)` to `element()` when there is only
one such element on the page.
- Switch from `Promise#then()` to `async/await`.
- Move `ElementFinder`s at the top of the test (instead of having them
interleaved with expectations).
- Load the page before every test (i.e. in a `beforeEach()` instead of
`beforeAll()`) to prevent state from each test leaking into the
subsequent tests.
- Order imports alphabetically.
PR Close#39001
Previously, the `component-interaction` docs example was configured to
run e2e tests on CI in development mode (in contrast to the default for
all docs examples, which is to run e2e tests in production mode). This
was necessary due to the following reasons:
- One of the components, `CountdownTimerComponent`, which is used by
`CountdownLocalVarParentComponent` and
`CountdownViewChildParentComponent`, was triggering a periodic
asynchronous task (via `setInterval()`), which prevented the app from
stabilizing and caused tests to fail.
- In order to prevent this from happening, the example's `AppModule` had
special provisioning to not include the problematic components in its
declarations when testing.
- Since this had to be determined dynamically at runtime (via inspecting
the URL query params), the `AppModule`'s config could not be
statically evaluated in AOT compilation.
This commit fixes the example to make it compatible with AOT compilation
and removes the custom test command from its `example-config.json`
(allowing it to be run with the default e2e test command, i.e. in
production mode).
PR Close#39001
This commit updates the docs examples to Angular v10.1.3. In addition to
updating the dependencies versions, it also updates the project's
structure and config to more closely match what a new v10 CLI app would
look like. See, also, the [diff][1] between a basic v9.1.4 CLI app and a
v10.1.3 one.
[1]: https://github.com/cexbrayat/angular-cli-diff/compare/9.1.4..10.1.3
PR Close#38993
BlacklistedStackFrames to InternalZoneJsStackFrames along with other related
symbols renamed with the same changes (with appropriate casing style).
PR Close#38978
Previously, the `retry` example did not work as intended. The `retry`
operator was called before the exception occured, thus not retrying the
`ajax` request.
This commit moves the `retry` operator into the correct order to ensure
that the failed request is retried.
PR Close#38905
This commit updates the symbols in the TemplateTypeCheck API and methods
for retrieving them:
* Include `isComponent` and `selector` for directives so callers can determine which
attributes on an element map to the matched directives.
* Add a new `TextAttributeSymbol` and return this when requesting a symbol for a `TextAttribute`.
* When requesting a symbol for `PropertyWrite` and `MethodCall`, use the
`nameSpan` to retrieve symbols.
* Add fix to retrieve generic directives attached to elements/templates.
PR Close#38844
`NodeInjector` is store in expando as a list of values in an array. The
offset constant into the array have been brought together into a single
`NodeInjectorOffset` enum with better documentation explaining their usage.
PR Close#38707
This change makes `getPreviousOrParentTNode` return `TNode|null` (rather
than just `TNode`) which is more reflective of the reality. The
`getPreviousOrParentTNode` can be `null` upon entering the `LView`.
PR Close#38707
`TNodeType.View` was created to support inline views. That feature did
not materialize and we have since removed the instructions for it, leave
an unneeded `TNodeType.View` which was still used in a very
inconsistent way. This change no longer created `TNodeType.View` (and
there will be a follow up chang to completely remove it.)
Also simplified the mental model so that `LView[HOST]`/`LView[T_HOST]`
always point to the insertion location of the `LView`.
PR Close#38707
Host `TNode` was passed into `getOrCreateTNode` just so that we can
compute weather or not we are a root node. This was needed because
`previousOrParentTNode` could have `TNode` from `TView` other then
current `TView`. This is confusing mental model. Previous change
ensured that `previousOrParentTNode` must always be part of `TView`,
which enabled this change to remove the unneeded argument.
PR Close#38707