Since IE11 does not support `Function#name`, we use a shim in tests that
parses the stringified function to extract the name. Previously, that
shim would cache the computed name on the function to speed up future
invocations. However, this resulted in incorrect values for functions
that "extended" other functions (such as the code generated by
TypeScript when downleveling ES2015 classes that extended other
classes).
To avoid issues such as #41416 (see also [internal discussion][1]), this
commit removes the caching of names. This is not expected to noticeably
affect performance, since (a) it is only used in tests, (b) it is only
used on browsers that do not natively support `Function#name` (i.e.
IE11) and (c) accessing function names is rare and inexpensive compared
to other operations that happen during testing.
[1]: https://angular-team.slack.com/archives/CB4UC1932/p1617285258058000
PR Close#41439
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
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
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
Due to an issue with wombat proxy returning the login state of the generated tokens,
we will need to require a login for all `ng-dev release publish` runs to ensure npm
login has occured.
PR Close#41422
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
The AIO search index is built in a WebWorker on the browser from a set
of page information that is downloaded as a JSON file (`search-data.json`).
We want to keep this file as small as possible while providing enough
data to generate a useful index to query against.
Previously, we only included one copy of each (non-ignored) term from each
doc but this prevents more subtle ranking of query results, since the number
of occurences of a term in a doc is lost.
This commit changes the generated file in the following ways:
- All non-ignored terms are now included in the order in which they appear
in the doc.
- The terms are indexed into a dictonary to avoid the text of the term being
repeated in every doc that contains the term.
- Each term is pre-"stemmed" using the same Porter Stemming algorith that the
Lunr search engine uses.
The web-worker has been updated to decode the new format of the file.
Now that all terms are included, it may enable some level of phrase based
matching in the future.
The size of the generated file is considerably larger than previously, but
on production HTTP servers the data is sent compressed, which reduces the
size dramatically.
PR Close#41368
This commit tries to improve the search results by processing
the query and attempting progressively less restrictive searches
until a non-zero set of pages is matched.
The new procesing includes:
* stripping off quote marks, which were causing searches to fail
* first attempting to match pages where ALL the query terms exist
* second attempting to match pages where ANY of the query terms exist
* third attempting to match pages where the title contains partial word matches
The first query attempt approximates, quite well, the idea of searching
for multi-word phrases. This is given the technical nature of the terms
and the fairly small size of the corpus.
PR Close#41368
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
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
Previously, the max width of the `file-not-found` page was limited to
50rem (800px by default). This allowed little space for showing
potentially helpful search results, which are shown in columns).
This commit increases the max width of the `file-not-found` page to
84rem (1344px by default) to allow search results to be visible without
requiring scrolling. This will not negatively affect UX, because the
page uses a multi-column layout and therefore there will rarely be long
lines of text to scan.
PR Close#41275
Check a range of commits by retrieving the log files to be parsed with the expected
format for the parser.
This change is in part of a larger set of changes making the process for obtaining
and parsing commits for release note creation and message validation consistent.
This consistency will make it easier to debug as well as ease the design of tooling
which is built on top of these processes.
PR Close#41341
We now include `misc/angular-in-memory-web-api` in the packages that
are build in the `dist/packages-dist` directory. But this package should
not be published as an artifact.
This commit prevents attempting to publishing the `misc` directory by
first checking whether the directory contains a `package.json` file.
PR Close#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
This commit updates the tooltip and footer description of the
"What is Angular" card in the `docs` guide to better match the card's
content. (It seems that the old content was copied/pasted from a
different card.)
It also updates the tooltip of the "Hello World" card to better describe
the card's purpose.
PR Close#41250
This commit replaces the unknown `is-warning` CSS class from an alert in
the `updating-content-github-ui` guide with the `is-important` CSS class
(that causes the alert to be given an orange-ish background).
PR Close#41250
This commit formats the `docs-card` elements used in
`contributors-guide-overview` and `docs` guides to have consistent
indentation and line-wrapping.
PR Close#41250
Previously, some links to specific sections of `CONTRIBUTING.md` were
using hashes automatically generated by GitHub based on the section
headings. This resulted in less readable hashes which were directly tied
to the heading text and thus less robust (i.e. more likely to break if
the heading was re-worded in the future).
This commit switches such links to use the dedicated anchors, which are
more succinct/readable and more stable.
PR Close#41250
It seems that the `updating-content-github-ui` guide was accidentally
omitted from the sidenav in #41061.
This commit adds the guide to the sidenav.
PR Close#41250
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
Historically all .bazel files were owned by dev-infra to assist in ensuring that
consistency was maintained in how rules were being used. As this now has reached
a point of maturity in the repository where the check is mostly a rubber stamping,
this requirement can be removed. Notably this is different than the requirement
of dev-infra approval for .bzl files as these contain the implementation of macros
rather than just the usage.
PR Close#41382
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
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
After being OOO for a while, I have been denoted as OOO in the pullapprove
configuration (by commenting out the username in the reviewer lists).
See 3ba97ab391.
This re-activates `devversion` in the pullapprove configuration.
PR Close#41352
The documentation has a very useful configuration for Travis and CircleCI but not for GitLab CI.
So, I thought that might be useful to have that as well.
PR Close#40411
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
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
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