Commit graph

29561 commits

Author SHA1 Message Date
Yann-Thomas LE MOIGNE
3a686478ac docs(service-worker): Miss a comma in sample (#3) (#51336)
PR Close #51336
2023-08-21 08:24:31 -07:00
Matthieu Riegler
a9b3c006f8 fix(core): guard the jasmine hooks (#51394)
This commit fixes a regression introduced in #50063

Fixes #51382

PR Close #51394
2023-08-21 08:14:53 -07:00
Paul Gschwendtner
53434864cb ci: remove myself from pullapprove unavailability list (#51437)
Removes myself from the pullapprove unavailability list.

PR Close #51437
2023-08-21 08:14:01 -07:00
Naaajii
f724b8dd6b docs(docs-infra): fix margin on contribute page heading (#51393)
fix margin on h2 tag of contribute page being overwritten

closes #51391

PR Close #51393
2023-08-21 08:12:57 -07:00
Kristiyan Kostadinov
9152de1387 test(core): remove manually-written control flow instructions (#51380)
Updates the control flow tests to use the compiler instead of manually-written instructions. Also adds a couple of tests that I was using along the way to verify that things work as expected.

PR Close #51380
2023-08-18 10:01:02 -07:00
Kristiyan Kostadinov
9cc0cbed0c refactor(compiler): generate if block instructions (#51380)
Adds the logic to generate the instructions for `if` blocks. There are two primary use cases we need to account for:

A conditional that doesn't use the `as` parameter of the `if` block. To support it we generate a nested ternary expression that evaluates to the index of the template whose condition is truthy. If the block doesn't have an `else` branch, we pass in a special `-1` value which means that no view will be rendered.

Example with an `else`:
```ts
// {#if expr}
//   ...
//   {:else if otherExpr} ...
//   {:else} ...
// {/if}

if (rf & 1) {
  ɵɵtemplate(0, App_Conditional_0_Template, 0, 0);
  ɵɵtemplate(1, App_Conditional_1_Template, 0, 0);
  ɵɵtemplate(2, App_Conditional_2_Template, 0, 0);
}
if (rf & 2) {
  ɵɵconditional(0, ctx.expr ? 0 : ctx.otherExpr ? 1 : 2);
}
```

Example without an `else`:
```ts
// {#if expr}
//   ...
//   {:else if otherExpr} ...
// {/if}

if (rf & 1) {
  ɵɵtemplate(0, App_Conditional_0_Template, 0, 0);
  ɵɵtemplate(1, App_Conditional_1_Template, 0, 0);
}
if (rf & 2) {
  ɵɵconditional(0, ctx.expr ? 0 : ctx.otherExpr ? 1 : -1);
}
```

If a conditional captures it's value in an alias (e.g. `{#if expr; as foo}`) we need to assign the value to a temporary variable before passing it along to `conditional`.

```ts
// {#if expr; as alias}...{/if}
if (rf & 1) {
  ɵɵtemplate(0, App_Conditional_0_Template, 1, 0);
}
if (rf & 2) {
  let App_contFlowTmp;
  ɵɵconditional(0, (App_contFlowTmp = ctx.expr) ? 0 : -1, App_contFlowTmp);
}
```

PR Close #51380
2023-08-18 10:01:02 -07:00
Kristiyan Kostadinov
0c4c773fca refactor(compiler): generate switch block instructions (#51380)
Adds the logic to generate the instructions for `switch` instructions. For the following block:

```html
{#switch value()}
  {:case 0} case 0
  {:case 1} case 1
  {:case 2} case 2
  {:default} default
{/switch}
```

The compiler will produce the following output:

```ts
function App_Template(rf, ctx) {
  if (rf & 1) {
    ɵɵtemplate(0, App_Case_0_Template, 1, 0);
    ɵɵtemplate(1, App_Case_1_Template, 1, 0);
    ɵɵtemplate(2, App_Case_2_Template, 1, 0);
    ɵɵtemplate(3, App_Case_3_Template, 1, 0);
  }
  if (rf & 2) {
    let App_contFlowTmp;
    ɵɵconditional(0, (App_contFlowTmp = ctx.value()) === 0 ? 0 : App_contFlowTmp === 1 ? 1 : App_contFlowTmp === 2 ? 2 : 3);
  }
}
```

PR Close #51380
2023-08-18 10:01:02 -07:00
JoostK
5bd9fbd2c3 fix(compiler-cli): enforce a minimum version to be used when a library uses input transform (#51413)
Angular 16.1 introduced the input transform feature, requiring the partial compilation output to be extended
with a reference to the input transform function. This has resulted in a subtle breaking change, where older
versions of the Angular linker can no longer consume libraries that have started to use this feature.

We do try to support using a 16.1 library from an Angular 16.0 application, but if a library actually
adopts a new feature then this is no longer possible. In such cases, it is desirable to report a message
telling the user that their version of the Angular compiler is too old, as determined by the `"minVersion"`
property that is present in each partial declaration. This version would still indicate that the declaration
required at least Angular 14.0 to be compiled, but this is not accurate once input transforms are being
used. Consequently, this error would not be reported, causing a less informative error once the input transform
was being observed.

Fixes #51411

PR Close #51413
2023-08-18 07:58:53 -07:00
Matthieu Riegler
4663a33a0d refactor(platform-browser-dynamic): remove reexport of MetadataOverrider (#51412)
this commit removes an unnecessary re-export

PR Close #51412
2023-08-18 07:57:34 -07:00
Matthieu Riegler
de3be98417 docs: fix links in UpgradeAdapter (#51395)
PR Close #51395
2023-08-18 07:56:41 -07:00
Kristiyan Kostadinov
9cc52b9b85 feat(core): support TypeScript 5.2 (#51334)
Updates the project to support TypeScript 5.2.

PR Close #51334
2023-08-18 07:55:16 -07:00
Payam Valadkhan
0b901a814b refactor(compiler-cli): better error messages when external strings used for template and styles in local compilation mode (#51338)
In local compilation mode it is not possible to use an imported string for component's template or styles as it cannot be resolved statically in compile time. There are some such use cases in g3 and potentially devs might incorporate such pattern. At the moment such pattern will cause the local compilation fail with generic error messages (e.g., so and so at position 1 is not a reference, etc). This change makes specific error messages with helpful hints for such cases. These new error messages can help devs to quickly resolve the issue as well as make it possible to identify existing issues in g3.

PR Close #51338
2023-08-17 14:02:52 -07:00
Payam Valadkhan
8798abb744 refactor(core): implement runtime logic to compute component dependencies in local compilation mode (#51377)
The runtime `ɵɵsetNgModuleScope` is modified to accept raw scope info as passed to it in local compilation mode. The runtime further registers the ng-module in the deps tracker. Then the runtime `ɵɵgetComponentDepsFactory` is implemented to use the deps tracker to get the component dependencies which leads to a valid and working Angular code.

PR Close #51377
2023-08-17 14:01:51 -07:00
Payam Valadkhan
e69e41ecf8 refactor(core): more accurate types for standalone component imports in deps tracker (#51377)
The standalone components import as passed to the deps tracker will be the raw import, i.e., it is either a Type or a module with providers or a factory of these. So we use the existing type `RawScopeInfoFromDecorator` for these imports instead of the current one to be more realistic.

PR Close #51377
2023-08-17 14:01:51 -07:00
Payam Valadkhan
56e0b8526a refactor(core): allow empty raw import info for standalone components in the runtime deps tracker (#51377)
The current logic requires that standalone component always provide an array of raw imports. But such array could be dropped from the downstream tools if the component has no imports. So it is more natural to allow undefined raw imports for standalone components and treat it as empty array.

PR Close #51377
2023-08-17 14:01:51 -07:00
Payam Valadkhan
8b431a0164 refactor(core): kill circular deps by moving scope runtime functions to a new scope.ts file (#51377)
This refactoring is needed for next commit not to produce circular deps as we start using the `depsTracker` inside `ɵɵsetNgModuleScope`. The runtime `ɵɵsetComponentScope` is not needed to move but it moved to the new file just for consistency sake.

PR Close #51377
2023-08-17 14:01:51 -07:00
Payam Valadkhan
273d8e93ad docs: add instruction how to run aio locally (#51402)
This test is part of CI and is needed in addition to tests in packages.

PR Close #51402
2023-08-17 14:00:14 -07:00
Paul Gschwendtner
552ea77854 refactor(compiler-cli): drop tsickle code paths (#50602)
`tsickle` is not used in any code paths in 3P and we can remove
this complexity. The `tsickle` npm package has not been released
in a while and we are risking breakages with e.g. future TypeScript
versions.

Note that the `ng_module` rule was updated to not emit through
tsickle at all. The tsickle in 1P is done directly by `tsc_wrapped`
and our code path in `compiler-cli` is not needed at all.

PR Close #50602
2023-08-17 10:23:49 -07:00
Alex Castle
d910bf8a84 fix(common): Allow safeUrl for ngSrc in NgOptimizedImage (#51351)
Allow safeUrl and add transformer to immediately convert ngSrc to string

PR Close #51351
2023-08-17 10:20:35 -07:00
Matthieu Riegler
e6503930f1 docs: fix see also links. (#51379)
These were all the @see with no links.

PR Close #51379
2023-08-17 10:18:33 -07:00
Matthieu Riegler
5fb5f087e3 docs(docs-infra): fix docs-watch script (#51316)
With this commit we can use `yarn docs-watch` again
Fixes #51308

PR Close #51316
2023-08-17 10:17:33 -07:00
Pawel Kozlowski
77504f18af release: cut the v17.0.0-next.0 release 2023-08-16 10:33:53 -07:00
Pawel Kozlowski
72beab0f67 docs: release notes for the v16.2.1 release 2023-08-16 10:24:47 -07:00
Gerald Monaco
6145cc1c0a refactor(core): Ensure hydration cleanup runs in the Angular zone (#51321)
Hydration cleanup needs to run in the Angular zone so that change detection will run.

PR Close #51321
2023-08-15 16:02:06 -07:00
Andrew Scott
6791f41308 docs(router): Clarify how to clear secondary routes (#51376)
The example for clearing secondary outlets currently only works because
the named outlet appears at the root of the application's route config.
If developers follow this example with an outlet that is not at the
root level, they will not be able to close the outlet.
This commit updates the example to provide a more robust way
of clearing the outlet from the activated outlet component
as well as providing a warning about how the commands are applied.

Lastly, there is a small bit of guidance provided for developers who
might want to explore the ability to close an outlet from any location
in the app, without needing to be aware of the activated route.
An example of this can be found here:
https://stackblitz.com/edit/close-outlet-from-anywhere

resolves #51373
resolves #13523

PR Close #51376
2023-08-15 15:43:17 -07:00
Andrew Kushnir
bcc3c43fca refactor(core): update TestBed to handle async component metadata (#51182)
This commit updates TestBed to wait for async component metadata resolution before compiling components.
Async metadata is added by the compiler in case a component uses defer blocks, which contain deferrable
symbols.

PR Close #51182
2023-08-15 11:32:09 -07:00
Andrew Kushnir
c41a1950fd refactor(compiler): apply component metadata asynchronously when defer blocks are present (#51182)
This commit updates compiler logic to generate the `setClassMetadataAsync` calls for components that used defer blocks. The `setClassMetadataAsync` function loads deferrable dependencies and invokes the `setClassMetadata` synchronously once everything is loaded. This change is needed to avoid eager references to deferrable symbols in component metadata in generated code.

PR Close #51182
2023-08-15 11:32:09 -07:00
Zoltán Szőgyényi
75561c96d0 docs: add new UI library resource from the Tailwind CSS ecosystem (#50976)
PR Close #50976
2023-08-15 11:29:39 -07:00
Luis Castro
328b3613b8 docs(common): revert format date_pipe (#51359)
PR Close #51359
2023-08-15 10:06:47 -07:00
Luis Castro
200a264fab docs(common): add new date format example to documentation (#51359)
PR Close #51359
2023-08-15 10:06:47 -07:00
Kristiyan Kostadinov
422d0d5ca3 refactor(compiler): handle deferred when trigger with a pipe (#51368)
Fixes that we weren't processing `when` conditions correctly which led to a compilation error when a pipe is used inside the expression.

PR Close #51368
2023-08-15 10:03:59 -07:00
Matthieu Riegler
17c6ad7775 docs: Add usage information to HttpInterceptorFn (#51236)
Simple doc addendum

PR Close #51236
2023-08-15 10:02:43 -07:00
Matthieu Riegler
83b708203e docs: Improve host binding docs (#51326)
This commit adds the mention of the support of styles/classes/attributes in host bindings.

fixes # 44296

PR Close #51326
2023-08-15 09:54:14 -07:00
aanchal
2174351385 docs: add the doc type attribute (#51332)
PR Close #51332
2023-08-15 09:53:05 -07:00
Matthieu Riegler
3348f8820b docs: Add precisions about static/dynamic queries. (#51146)
The table is mostly copied from guide/migration-dynamic-flag.

Fixes #51142

PR Close #51146
2023-08-15 09:52:04 -07:00
codestart
d4ca651602 docs(docs-infra): fix minor typo in standalone-migration.md (#51370)
PR Close #51370
2023-08-15 09:37:46 -07:00
Jeremy Mowery
be3edad60e refactor: add readonly to public InjectionToken types (#51125)
We enabled a lint rule internally to require that multi-provided
`InjectionToken`s have a `readonly` array type, the tokens in this
PR do not follow this rule and are causing lint violations.

Fixes #51124

PR Close #51125
2023-08-14 17:17:35 -07:00
Pawel Kozlowski
93675dc797 feat(core): conditional built-in control flow (#51346)
Initial PoC of the built-in control flow support. The goal is to
unblock compiler work.

PR Close #51346
2023-08-14 17:16:39 -07:00
Quentin Dunand
6a60a29ff2 docs: Fix Promise.then wrong parameter (#51322)
Removed the second wrong parameter from the `Promise.then()` method in the doc.
PR Close #51322
2023-08-14 15:27:37 -07:00
Andrew Scott
ccf32f62d9 build: update pullapprove (#51360)
update pullapprove to remove self from unavailable list

PR Close #51360
2023-08-14 15:12:27 -07:00
Matthieu Riegler
3b1c1b91a2 docs: Add Missing SSR integrity marker error doc page (#51340)
This commit adds an error doc page for error 507 : Missing SSR content integrity marker.

PR Close #51340
2023-08-14 14:39:25 -07:00
Jessica Janiuk
5a2b7683bc docs: Add CDN Optimization section to hydration guide (#51355)
This adds a section to cover the case of CDNs that have optimizations that will break both Angular and Hydration by stripping comment nodes.

PR Close #51355
2023-08-14 14:31:09 -07:00
Pawel Kozlowski
ebd217d393 Revert "refactor(core): remove class type check when clearing cache in deps tracker (#51293)" (#51358)
This reverts commit a9f609e75c.

PR Close #51358
2023-08-14 13:48:47 -07:00
Pawel Kozlowski
b1f0fc9129 Revert "refactor(core): enabled using deps tracker in JIT compilation (#51293)" (#51358)
This reverts commit bc55d82eb9.

PR Close #51358
2023-08-14 13:48:47 -07:00
Pawel Kozlowski
b0ea81d562 Revert "refactor(core): kill circular deps by moving scope runtime functions to a new scope.ts file (#51309)" (#51358)
This reverts commit 45105555da.

PR Close #51358
2023-08-14 13:48:47 -07:00
Pawel Kozlowski
b297ea7966 Revert "refactor(core): allow empty raw import info for standalone components in the runtime deps tracker (#51309)" (#51358)
This reverts commit 8156128863.

PR Close #51358
2023-08-14 13:48:47 -07:00
Pawel Kozlowski
32d30f26a7 Revert "refactor(core): more accurate types for standalone component imports in deps tracker (#51309)" (#51358)
This reverts commit e7ea016e00.

PR Close #51358
2023-08-14 13:48:47 -07:00
Pawel Kozlowski
ee73d180fd Revert "refactor(core): implement runtime logic to compute component dependencies in local compilation mode (#51309)" (#51358)
This reverts commit f7cfc3b8fa.

PR Close #51358
2023-08-14 13:48:47 -07:00
Payam Valadkhan
f7cfc3b8fa refactor(core): implement runtime logic to compute component dependencies in local compilation mode (#51309)
The runtime `ɵɵsetNgModuleScope` is modified to accept raw scope info as passed to it in local compilation mode. The runtime further registers the ng-module in the deps tracker. Then the runtime `ɵɵgetComponentDepsFactory` is implemented to use the deps tracker to get the component dependencies which leads to a valid and working Angular code.

PR Close #51309
2023-08-14 08:58:47 -07:00
Payam Valadkhan
e7ea016e00 refactor(core): more accurate types for standalone component imports in deps tracker (#51309)
The standalone components import as passed to the deps tracker will be the raw import, i.e., it is either a Type or a module with providers or a factory of these. So we use the existing type `RawScopeInfoFromDecorator` for these imports instead of the current one to be more realistic.

PR Close #51309
2023-08-14 08:58:47 -07:00