In [glob patterns][1], the `*` wildcard is supposed to match 0 or more
characters.
For reference:
- This is also how `*` works in other implementations, such as
`.gitignore` files or Firebase hosting config.
- Some popular JS implementations (e.g. [minimatch][2], [micromatch][3])
work differently, matching 1 or more character (but not 0).
This commit "fixes" the minimal glob support in
`@angular/service-worker` to allow `*` to also match 0 characters.
[1]: https://en.wikipedia.org/wiki/Glob_%28programming%29
[2]: https://www.npmjs.com/package/minimatch
[3]: https://www.npmjs.com/package/micromatch
PR Close#23339
The ServiceWorker will redirect navigation requests that don't match any
`asset` or `data` group to the specified index file. The rules for a
request to be classified as a navigation request are as follows:
1. Its `mode` must be `navigation`.
2. It must accept a `text/html` response.
3. Its URL must match certain criteria (see below).
By default, a navigation request can have any URL except for:
1. URLs containing `__`.
2. URLs to files (i.e. containing a file extension in the last path
segment).
While these rules are fine in many cases, sometimes it is desirable to
configure different rules for the URLs of navigation requests (e.g.
ignore specific URLs and pass them through to the server).
This commit adds support for specifying an optional `navigationUrls`
list in `ngsw-config.json`, which contains URLs or simple globs
(currently only recognizing `!`, `*` and `**`).
Only requests whose URLs match any of the positive URLs/patterns and
none of the negative ones (i.e. URLs/patterns starting with `!`) will be
considered navigation requests (and handled accordingly by the SW).
(This is an alternative implementation to #23025.)
Fixes#20404
PR Close#23339
These files are in the UMD format for greater portablity, and as such
can't be marked as side-effect-free by webpack/build-optimizer/uglify.
PR Close#23366
Detect server environment by checking `typeof window` and schedule render immediately instead of waiting for RAF.
This does not make Angular Elements work on platform-server. This is just the first step.
PR Close#23324
All our package labels are `npm_package` so the bazel build reports a bunch of identical actions running, like
```
Angular Packaging: rolling up npm_package; 31s darwin-sandbox
Angular Packaging: rolling up npm_package; 30s darwin-sandbox
Angular Packaging: rolling up npm_package; 29s darwin-sandbox
Angular Packaging: rolling up npm_package; 27s darwin-sandbox
Angular Packaging: rolling up npm_package; 26s darwin-sandbox
Angular Packaging: rolling up npm_package; 23s darwin-sandbox
Angular Packaging: rolling up npm_package; 19s darwin-sandbox
Angular Packaging: rolling up npm_package; 11s darwin-sandbox
```
PR Close#23318
The 'stringify' function prints an object as [Object object] which
is not very helpful in many cases, especially in a diagnostics
message. This commit changes the behavior to pretty print an object.
PR Close#22689
When compiling templates the compiler would often bind to
closest context rather than the component context.
The only time one should be binding to the cont component is
in explicit cases where the inner template declares local variable.
PR Close#23168
Given
```
<div *ngFor=”…” (click)=“doSomething()”>
```
Before `doSomething` would execute on the inner template context, which
is incorrect. The correct behavior is to execute on the top level context
of the component.
PR Close#23168
rxjs 6.0.0 breaks strictMetadataEmit as they now publish a .d.ts file with a
structure like:
declare export class Subscription {
static EMPTY: Subscription;
}
This generates metadata which contains an error, and fails the strictMetadataEmit
validation. There is nothing a library author can do in this situation except to
set strictMetadataEmit to false.
The spirit of strictMetadataEmit is to validate that the author's library doesn't
do anything that will break downstream users. This failure is a corner case which
causes more harm than good, so this commit disables validation for metadata
collected from .d.ts files.
Fixes#22210
PR Close#23275
Lowering expressions in flat module metadata is desirable, but it won't
work without some rearchitecting. Currently the flat module index source
is added to the Program and therefore must be determined before the rest
of the transforms run. Since the lowering transform changes the set of
exports needed in the index, this creates a catch-22 in the index
generation.
This commit causes the flat module index metadata to be generated using
only those transforms which are "safe" (don't modify the index).
PR Close#23226