BREAKING CHANGE:
In v5, we deprecated support for the intl API in order to improve the browser support. We are now removing these deprecated APIs for v9. See the original change here for more info on why: #18284.
PR Close#29250
This commit fixes ngtsc's import generator to use the ReflectionHost when
looking through the exports of an ES module to find the export of a
particular declaration that's being imported. This is necessary because
some module formats like CommonJS have unusual export mechanics, and the
normal TypeScript ts.TypeChecker does not understand them.
This fixes an issue with ngcc + CommonJS where exports were not being
enumerated correctly.
FW-1630 #resolve
PR Close#33192
Normally, when ngcc encounters a package with missing dependencies while
attempting to determine a compilation ordering, it will ignore that package.
This commit adds a configuration for a flag to tell ngcc to compile the
package anyway, regardless of any missing dependencies.
FW-1931 #resolve
PR Close#33192
In the ReflectionHost API, a 'viaModule' indicates that a particular value
originated in another absolute module. It should always be 'null' for values
originating in relatively-imported modules.
This commit fixes a bug in the CommonJsReflectionHost where viaModule would
be reported even for relatively-imported values, which causes invalid import
statements to be generated during compilation.
A test is added to verify the correct behavior.
FW-1628 #resolve
PR Close#33192
This allows disabling parallelism in ngcc if desired, which is mainly useful
for debugging. The implementation creates the flag and passes its value to
mainNgcc.
No tests are added since the feature mainly exists already - ngcc supports
both parallel and serial execution. This commit only allows switching the
flag via the commandline.
PR Close#33192
Prior to this commit, the absolute spans (relative to template source
file rather than the start of an expression) of expressions in a
template attribute like `*ngIf` were generated incorrectly, equating to
the relative spans.
This fixes the bug by passing an `absoluteOffset` parameter when parsing
template bindings.
Through some levels of indirection, this is required for the Language
Service to support text replacement in
https://github.com/angular/angular/pull/33091.
PR Close#33189
These were getting included in the @angular/localize package.
Instead, patch the upstream files to work with TS typeRoots option
See bazelbuild/rules_nodejs#1033
PR Close#33226
Prior to this fix if a map-based class or style binding wrote
its values onto an elemenent, the internal styling context would
not register the binding if the initial value as a `NO_CHANGE`
value. This situation occurs if a directive takes control of the
`class` or `style` input values and then returns a `NO_CHANGE` value
if the initial value is empty.
This patch ensures that all bindings are always registered with the
`TStylingContext` data-structure even if their initial value is
an instance of `NO_CHANGE`.
PR Close#33236
The `dev-infra-framework` codeowners section is located after
all the codeowner sections for the individual framework packages.
This means that for certain wildcards, like `*.bzl` take precedence
over the individual package sections (like of `/packages/bazel/**`).
This can be observed in the following PR where `dev-infra` got requested
for file changes to `@angular/bazel`. #32955.
To fix this, we move the `dev-infra-framework` section before all
individual framework package sections. This means that we only match
files which are not matched by other patterns.
Additionally a pattern for `*.BAZEL` has been added to the dev-infra
section. This helps getting changes to `BUILD.bazel` files through
easier as dev-infra can review those (Note: only for bazel files which
are not matched by other patterns).
PR Close#32956
Prior to this fix, all style/class bindings (e.g. `[style]` and
`[class.foo]`) would quietly update a binding value if and when the
current binding value changes during checkNoChanges.
With this patch, all styling instructions will properly check to see
if the value has changed during the second pass of detectChanges()
if checkNoChanges is active.
PR Close#33103
Prior to this commit, metadata defined on ICU container element was not inherited by the ICU if the whole message is a single ICU (for example: `<ng-container i18n="meaning|description@@id">{count, select, ...}</ng-container>). This commit updates the logic to use parent container i18n meta information for the cases when a message consists of a single ICU.
Fixes#33171
PR Close#33191
LocaleID defs are not considered public API, so the property
that contains them should be prefixed with Angular's marker
for "private" ('ɵ') to discourage apps from relying on def
APIs directly.
This commit adds the prefix and shortens the name from
ngLocaleIdDef to loc. This is because property names
cannot be minified by Uglify without turning on property
mangling (which most apps have turned off) and are thus
size-sensitive.
PR Close#33212
Previously, when `ngcc` was reflecting on class members it did not
account for the fact that a member could be of the kind
`IndexSignature`. This can happen, for example, on abstract classes (as
is the case for [JsonCallbackContext][1]).
Trying to reflect on such members (and failing to recognize their kind),
resulted in warnings, such as:
```
Warning: Unknown member type: "[key: string]: (data: any) => void;
```
While these warnings are harmless, they can be confusing and worrisome
for users.
This commit avoids such warnings by detecting class members of the
`IndexSignature` kind and ignoring them.
[1]: https://github.com/angular/angular/blob/4659cc26e/packages/common/http/src/jsonp.ts#L39
PR Close#33198
Turns out that writing to global state is more expensive than writing to
a property on an object.
Slower:
````
let count = 0;
function increment() {
count++;
}
```
Faster:
````
const state = {
count: 0
};
function increment() {
state.count++;
}
```
This change moves all of the instruction state into a single state object.
`noop_change_detection` benchmark
Pre refactoring: 16.7 us
Post refactoring: 14.523 us (-13.3%)
PR Close#33093
Prior to this commit, all `className` inputs were not set because the runtime code assumed that the `classMap` instruction is only generated for `[class]` bindings. However the `[className]` binding also produces the same `classMap`, thus the code needs to distinguish between `class` and `className`. This commit adds extra logic to select the right input name and also throws an error in case `[class]` and `[className]` bindings are used on the same element simultaneously.
PR Close#33188
Prior to this change, the template type checker would incorrectly bind
non-property bindings such as `[class.strong]`, `[style.color]` and
`[attr.enabled]` to directive inputs of the same name. This is
undesirable, as those bindings are never actually bound to the inputs at
runtime.
Fixes#32099Fixes#32496
Resolves FW-1596
PR Close#33130
We can re-enable all tests which have been disabled in the
`material-unit-tests` job. This is because Angular components
removed the dependency on `hammerjs`. Meaning that the previously
failing tests no longer break due to the v9 `HammerModule` breaking
change.
PR Close#33221
Updates the commit of the Angular components repository for
which the `material-unit-tests` job runs tests against. We need to
update to the latest commit at the time of writing, in order to be able
to remove the gesture tests from the material-ci/blocklist.
This is now possible because the Angular components repository
removes the dependency on `hammerjs` completely.
PR Close#33221
Improves the `missing-injectable` migration test case in the
`ng_update_migrations` integration test by adding scenarios
for the recent changes that have been made to the migration.
e.g. 5557dec120
PR Close#33223
Updates the Angular CLI version in the `ng_update_migrations`
integration test. Since refactorings are made to the `ng update`
command implementation, we want to make sure that everything
works as expected for the migrations in version 9.
PR Close#33223
Ensure that the latest version of `webdriver-manager` (v12.1.7) is
installed for `protractor`, which correctly installs a ChromeDriver
version that is compatible with the latest version of Chrome.
With the previous version of `webdriver-manager`, ChromeDriver v75 would
be installed by default, which was not compatible with the latest
version of Chrome (v77).
PR Close#33206
Update `protractor` and ensure that the latest version of
`webdriver-manager` (v12.1.7) is installed, which correctly installs a
ChromeDriver version that is compatible with the latest version of
Chrome.
With the previous version of `webdriver-manager`, ChromeDriver v75 would
be installed by default, which was not compatible with the latest
version of Chrome (v77).
PR Close#33206
The `setup-local` scripts (and others that are based on it, such as
`setup-local-viewengine`), mainly does two things: Replace the Angular
packages with the locally built ones for `aio/` and the docs examples
(`aio/tools/examples/shared/`). It does this by calling two other npm
scripts: `aio-use-local` and `example-use-local` respectively.
For these scripts to work, the local Angular packages must be already
built (via `scripts/build-packages-dist.sh`). In order to make it easier
for people to test against local packages, the scripts support a
`--build-packages` option, that (if passed) will result in building the
local packages as well.
Given that the same local packages are used for both `aio/` and the
examples, we only need to build the packages once. Also, to speed up
execution on CI, we do not need to build the packages there, because the
packages would have been built already in a previous CI job.
However, the various setup npm scripts were not implemented correctly to
meet these requirements. Specifically, when running locally,
`aio-use-local` would build the packages, while `example-use-local`
would not (it was supposed to use the already built packages from
`aio-use-local`). The `example-use-local` script, though, was configured
to run before `aio-use-local`. As a result, the packages were not built,
by the time `example-use-local` needed them, which would cause an error.
This commit fixes it by ensuring that `aio-use-local` (which builds the
local Angular packages) runs before `example-use-local`, so that the
latter can use the same packages already built by the former.
PR Close#33206
Previously, when compiling the docs examples with `ngcc` (to run them in
Ivy mode), we would only consider the `es2015` property. However, some
packages (such as `angular-in-memory-web-api`) may not have that
property in their `package.json`. They might still be compilable by
`ngcc`, if they define other format properties (such as `module` or
`main`), but `ngcc` would still fail if it could not find any of the
_specified_ properties (here only `es2015`):
```
Error: Unable to process any formats for the following entry-points (tried es2015):
- /.../node_modules/angular-in-memory-web-api
```
This commit fixes potential issues by considering all properties that
would be considered if `ngcc` was run implicitly by `@angular/cli` and
aligns the command with the one that will be generated for new apps:
https://github.com/angular/angular/blob/3e14c2d02/packages/core/schematics/migrations/postinstall-ngcc/index.ts#L22
PR Close#33206
This patch introduces the `printTable()` and `printSources()`
methods to `DebugStylingContext` which can be used via the
`window.ng.getDebugNode` helpers when debugging an application.
PR Close#33179
Ensure that the latest version of `webdriver-manager` (v12.1.7) is
installed for `protractor`, which correctly installs a ChromeDriver
version that is compatible with the latest version of Chrome.
With the previous version of `webdriver-manager`, ChromeDriver v75 would
be installed by default, which was not compatible with the latest
version of Chrome (v77).
PR Close#33206
Update `protractor` and ensure that the latest version of
`webdriver-manager` (v12.1.7) is installed, which correctly installs a
ChromeDriver version that is compatible with the latest version of
Chrome.
With the previous version of `webdriver-manager`, ChromeDriver v75 would
be installed by default, which was not compatible with the latest
version of Chrome (v77).
PR Close#33206
The `setup-local` scripts (and others that are based on it, such as
`setup-local-viewengine`), mainly does two things: Replace the Angular
packages with the locally built ones for `aio/` and the docs examples
(`aio/tools/examples/shared/`). It does this by calling two other npm
scripts: `aio-use-local` and `example-use-local` respectively.
For these scripts to work, the local Angular packages must be already
built (via `scripts/build-packages-dist.sh`). In order to make it easier
for people to test against local packages, the scripts support a
`--build-packages` option, that (if passed) will result in building the
local packages as well.
Given that the same local packages are used for both `aio/` and the
examples, we only need to build the packages once. Also, to speed up
execution on CI, we do not need to build the packages there, because the
packages would have been built already in a previous CI job.
However, the various setup npm scripts were not implemented correctly to
meet these requirements. Specifically, when running locally,
`aio-use-local` would build the packages, while `example-use-local`
would not (it was supposed to use the already built packages from
`aio-use-local`). The `example-use-local` script, though, was configured
to run before `aio-use-local`. As a result, the packages were not built,
by the time `example-use-local` needed them, which would cause an error.
This commit fixes it by ensuring that `aio-use-local` (which builds the
local Angular packages) runs before `example-use-local`, so that the
latter can use the same packages already built by the former.
PR Close#33206
Previously, we would only consider the `es2015` property, but some
packages (such as `angular-in-memory-web-api`) may not have that. They
might still be compilable by `ngcc`, is they have other format
properties (e.g. `module` or `main`).
This commit fixes potential issues by considering all properties that
would be considered via the cli integration and aligns the command to
turn on ivy for docs examples with the one used in new cli apps:
https://github.com/angular/angular/blob/3e14c2d02/packages/core/schematics/migrations/postinstall-ngcc/index.ts#L22
PR Close#33206
This commit speeds up the tests by calling `MockHost.reset()` in
`beforeEach()` instead of destroying the entire language service and
creating a new one. The creation of a new language service instance is
expensive due to the need to initialize many core Symbols when creating
a new program.
This speeds ups the test (on my local machine) from 35 secs to 15 secs.
PR Close#33200
Injectable defs are not considered public API, so the property
that contains them should be prefixed with Angular's marker
for "private" ('ɵ') to discourage apps from relying on def
APIs directly.
This commit adds the prefix and shortens the name from
ngInjectableDef to "prov" (for "provider", since injector defs
are known as "inj"). This is because property names cannot
be minified by Uglify without turning on property mangling
(which most apps have turned off) and are thus size-sensitive.
PR Close#33151
Injector defs are not considered public API, so the property
that contains them should be prefixed with Angular's marker
for "private" ('ɵ') to discourage apps from relying on def
APIs directly.
This commit adds the prefix and shortens the name from
ngInjectorDef to inj. This is because property names
cannot be minified by Uglify without turning on property
mangling (which most apps have turned off) and are thus
size-sensitive.
PR Close#33151
This change assures that data structures related to initial inputs
(ones set from static attributes) are created only once (during the
first template pass) and no additional runtime checks are done for
subsequent passes.
Additionally this commit changes the data structure used by initial inputs
on TNode - previously initial inputs for a directive were stored at the
directive index in LView. This meant that an array holding initial inputs
was relativelly big and had many null elements (as placeholders for elements,
directives, injector etc.). After the change we only create an array of a size
equal to a number of directives matched on a given TNode.
For the `directive_instantiate` benchmark it boils to allocating a 1-element
array vs. 100-element array previously.
PR Close#33195