Commit graph

749 commits

Author SHA1 Message Date
Alan Agius
26fed34e0e
build: format md files
This commit configures prettier to format markdown files.
2025-11-06 10:03:05 -08:00
Lukas Matta
5b210e97af fix(migrations): Prevent removal of templates referenced with preceding whitespace characters
In https://github.com/angular/angular/pull/64745, a fix was introduced for templates referenced with a trailing semicolon. However, templates are still incorrectly removed when there are whitespace characters before the template name.

This commit updates the control flow migration logic to ensure templates referenced with preceding whitespace are not removed.

Fixes #64854
2025-11-04 23:25:59 +00:00
Lukas Matta
64cb08529d fix(migrations): Do not remove a template if it is referenced even with a trailing semilocon
This commit fixes a behavior where under certain conditions, the migration script ignored
a template reference with a trailing semicolon and incorrectly removed the definition
of a referenced template.

Fixes #64741
2025-10-29 10:50:56 +01:00
Alan Agius
b4e798ed87 refactor(migrations): exclude all @angular/* packages from schematics bundle
This change updates the rollup configuration for the core schematics to exclude all `@angular/*` packages from the bundle. This is possible following https://github.com/angular/angular/pull/64703

This significantly reduces the size of the `@angular/core` schematics bundle, resulting in a size reduction to 5.8mb.
2025-10-28 20:51:50 +01:00
Matthieu Riegler
8e50cdb930 refactor(compiler-cli): Remove deep imports of compiler-cli in angular/core
migration schematics will pull from `compiler-cli/private/migrations`
core tests will pull from `compiler-cli/private/testing`
2025-10-28 15:58:56 +01:00
Matthieu Riegler
eec6669733 refactor(migrations): use the applicationProviders for the zoneless migration
PR #64354 introduced the `applicationProviders` for `bootstrapModule`, this allows a simpler migration output.
2025-10-27 19:41:29 +01:00
Alan Agius
9d00c6892f build: reduce package size of @angular/core
The schematics bundle size is reduced by externalizing @angular/compiler. This reduces the package size from 11mb to 9.1mb.
2025-10-27 17:12:48 +01:00
aparziale
338ac3b2ef refactor(migrations): unit test signal migration adjustment (#64393)
Move unit test from spec file to golden test

PR Close #64393
2025-10-15 10:38:57 -07:00
SkyZeroZx
75fc16b261 feat(migrations): Adds support for CommonModule to standalone migration (#64138)
Introduces a migration that replaces CommonModule usage with individual imports from @angular/common, aligning with Angular's standalone component approach and improving module import clarity

PR Close #64138
2025-10-15 10:37:37 -07:00
SkyZeroZx
861cee34e0 feat(migrations): Adds migration for deprecated router testing module (#64217)
Introduces a schematic to replace deprecated router testing imports

PR Close #64217
2025-10-13 11:09:29 -07:00
SkyZeroZx
1ffcfb625a feat(migrations): Adds migration for deprecated router testing module (#64217)
Introduces a schematic to replace deprecated router testing imports

PR Close #64217
2025-10-13 11:09:29 -07:00
aparziale
e99bbd3d2a fix(migrations): migrating input with more than 1 usage in a method (#64367)
When the migration command was run for inputs, if the input had more than one reference in a method the migration would generate incorrect code

Fixes #63018

PR Close #64367
2025-10-13 08:37:10 -07:00
Kristiyan Kostadinov
62bbce63b7 fix(migrations): remove error for no matching files in control flow migration (#64253)
Now that the control flow migration is running as a part of `ng update`, we need to be a bit forgiving about there not being any matching files since it can break the entire update process.

These changes switch the error to a warning and it counts the files for the entire workspace, not the individual projects.

PR Close #64253
2025-10-06 15:29:25 -04:00
SkyZeroZx
d3e76b1956 fix(migrations): preserve component imports when pruning NgModules in standalone migration (#64186)
This fix preserves component imports by adding missing  statements and replacing module references with the correct component

PR Close #64186
2025-10-02 13:54:14 -07:00
Matthieu Riegler
d16d624b90 refactor(core): run control-flow migration by default (#64136)
After adding the control flow migration as optional in v20, we enable it by default in v21.

PR Close #64136
2025-10-01 11:51:33 -04:00
SkyZeroZx
51a0b59389 fix(migrations): handle shorthand property declarations in NgModule (#64160)
The migration now correctly detects shorthand declarations in NgModule metadata

PR Close #64160
2025-10-01 10:41:15 -04:00
aparziale
31bc9e4111 fix(migrations): skip migration for inputs with 'this' references (#64142)
Prevents migration of @input() properties that contain references to 'this' in their initializer functions. This ensures that functions accessing class members via 'this' remain unchanged, preventing potential build errors.

PR Close #64142
2025-09-30 15:32:44 -04:00
Matthieu Riegler
04462ed67f refactor(compiler): Remove the interpolation config (#64071)
After #63474, we don't need that anymore.

PR Close #64071
2025-09-29 15:29:46 -04:00
Jessica Janiuk
221d5687ae Revert "refactor(compiler): Remove the interpolation config (#64071)" (#64110)
This reverts commit 768a09d3c3.

PR Close #64110
2025-09-26 15:16:53 -04:00
Joey Perrott
758f0883f5 test(core): remove shelljs from core schematics tests (#64042)
Remove shelljs usage from core schematic tests and use builtins instead

PR Close #64042
2025-09-26 13:14:09 -04:00
Matthieu Riegler
768a09d3c3 refactor(compiler): Remove the interpolation config (#64071)
After #63474, we don't need that anymore.

PR Close #64071
2025-09-26 12:36:50 -04:00
Matthieu Riegler
fffc7cf1c4 refactor(migrations): migrate usages of getTestBed.initTestEnvironment (#63997)
This commit also removes code paths that were only useful for G3.

PR Close #63997
2025-09-24 16:03:40 +00:00
aparziale
b96afb4bfc fix(migrations): handle reused templates in control flow migration (#63996)
The control flow migration was incorrectly removing `ng-template` elements in scenarios where they were referenced by multiple `*ngIf` directives' `else` clauses and also used independently via `ngTemplateOutlet`.

PR Close #63996
2025-09-24 16:01:58 +00:00
Matt Lewis
aeb3e6c6a5 fix(migrations): handle import aliases to the same module name (#63934)
Fixes a bug in the standalone migration where 2 imported modules have the same class name but 1 is imported with an alias and would not be added to the component imports array when migrating

Fixes #63913

PR Close #63934
2025-09-19 14:48:32 +00:00
aparziale
307e4eafef refactor(migrations): remove common module if there are no references (#63892)
ngclass-to-class migration removes commonModule if there are no references that use it

PR Close #63892
2025-09-18 20:18:43 +00:00
Matthieu Riegler
809a4ed8c1 feat(core): Add migration for zoneless by default. (#63042)
This commit adds a migration that updates applications enable Zone change detection when Angular is zoneless by default.

PR Close #63042
2025-09-16 20:48:29 +00:00
Matthieu Riegler
07b4c12984 refactor(core): prevent input migration from introducing a breaking change (#63547)
Non-typed `transform` functions were stripped by the migration prior to this commit (while still logging an error).
This behavior will now only happen with `--best-effort`.

#63541

PR Close #63547
2025-09-16 18:53:50 +00:00
aparziale
4133b08d93 fix(migrations): fix route-lazy-loading migration (#63818)
route-lazy-loading migration now supports routes when exported by default

PR Close #63818
2025-09-16 15:53:47 +00:00
aparziale
8dc8914c8a feat(migrations): add migration to convert ngStyle to use style (#63517)
Add migration to convert ngStyle to use style

PR Close #63517
2025-09-15 20:16:16 +00:00
Alan Agius
28926ba92c feat(core): introduce BootstrapContext for improved server bootstrapping (#63562)
This commit introduces a number of changes to the server bootstrapping process to make it more robust and less error-prone, especially for concurrent requests.

Previously, the server rendering process relied on a module-level global platform injector. This could lead to issues in server-side rendering environments where multiple requests are processed concurrently, as they could inadvertently share or overwrite the global injector state.

The new approach introduces a `BootstrapContext` that is passed to the `bootstrapApplication` function. This context provides a platform reference that is scoped to the individual request, ensuring that each server-side render has an isolated platform injector. This prevents state leakage between concurrent requests and makes the overall process more reliable.

BREAKING CHANGE:
The server-side bootstrapping process has been changed to eliminate the reliance on a global platform injector.

Before:
```ts
const bootstrap = () => bootstrapApplication(AppComponent, config);
```

After:
```ts
const bootstrap = (context: BootstrapContext) =>
  bootstrapApplication(AppComponent, config, context);
```

A schematic is provided to automatically update `main.server.ts` files to pass the `BootstrapContext` to the `bootstrapApplication` call.

In addition, `getPlatform()` and `destroyPlatform()` will now return `null` and be a no-op respectively when running in a server environment.

PR Close #63562
2025-09-09 10:57:09 -07:00
aparziale
655a99d0c6 fix(migrations): fix bug in ngclass-to-class migration (#63617)
Fix bug in ngclass-to-class migration. The migrateSpaceSeparatedKey option was configured incorrectly and I added a test case

PR Close #63617
2025-09-08 12:30:00 -07:00
cexbrayat
b717f6dce6 docs: typos in ngClass migration (#63564)
PR Close #63564
2025-09-03 16:31:31 +00:00
Alan Agius
ce8db665f9 refactor(platform-browser): remove deprecated ApplicationConfig export (#63529)
Removes the deprecated `ApplicationConfig` export from `@angular/platform-browser`.
This export was deprecated in a prior version and developers should import `ApplicationConfig` from `@angular/core` instead.

BREAKING CHANGE:

The deprecated `ApplicationConfig` export from `@angular/platform-browser` has been removed.
Please import `ApplicationConfig` from `@angular/core` instead.

PR Close #63529
2025-09-02 11:48:19 -07:00
aparziale
06f4fd4456 fix(core): Fixed inject migration schematics for migrate destructured properties (#62832)
Fixes #62626 - Properties used with the destructor are also managed during migration.

PR Close #62832
2025-09-02 10:59:46 -07:00
Hongxu Xu
1f4c5f72aa refactor(bazel): reduce build deps (#63348)
clean up deps in bazel build scripts

PR Close #63348
2025-08-28 09:16:10 -07:00
Joey Perrott
2fcafb65c5 build: rename defaults2.bzl to defaults.bzl (#63383)
Use defaults.bzl for the common macros

PR Close #63383
2025-08-25 15:45:01 -07:00
Joey Perrott
3df1dccebe refactor: various build and import specificer fixes for strict deps (#63323)
Change direct deps in bazel targets and import specifiers within files to maintain strict deps requirements ahead of enabling strict deps tests in the repo

PR Close #63323
2025-08-22 14:45:00 -07:00
aparziale
7a336c159d refactor(migrations): centralize parseTemplate method (#62983)
refactor - Moved parseTemplate logic to a shared utility function to improve code reuse and maintainability

PR Close #62983
2025-08-21 11:41:32 -07:00
aparziale
6ddb250391 feat(migrations): add migration to convert ngClass to use class (#62983)
feat #61661 - add migration to convert ngClass to use class

PR Close #62983
2025-08-21 11:41:32 -07:00
Alan Agius
d0d6079f54 refactor: remove version 20 migrations (#63207)
This commit remove the non optional migrations for version 20 as these have already been executed.

PR Close #63207
2025-08-18 09:06:51 +02:00
Matthieu Riegler
4e0fc81491 feat(router): convert lastSuccessfulNavigation to signal (#63057)
This commit also include an `ng update` migration to ensure `lastSuccessfulNavigation` is invoked.

BREAKING CHANGE: `lastSuccessfulNavigation` is now a signal and needs to be invoked

PR Close #63057
2025-08-13 11:29:01 -07:00
Joey Perrott
c4dcfdf644 build: update to the latest version of devinfra and rename npm2 workspace (#63093)
Rename the npm2 workspace to npm and use the latest version of devinfra which drops rules_nodejs

PR Close #63093
2025-08-11 10:35:32 -07:00
Matthieu Riegler
687c374826 feat(router): add a currentNavigation signal to the Router service. (#63011)
This new signal property is convenient to derive a `isNavigating` state.

`isNavigating = computed(() => !!this.router.currentNavigation())`

DEPRECATED: The Router.getCurrentNavigation method is deprecated. Use the Router.currentNavigation signal instead.

fixes #62958

PR Close #63011
2025-08-06 09:54:53 -07:00
Joey Perrott
fa8d8b8396 build: migrate all npm packages to use new rules_js based npm_package rule (#62954)
Use a common rule for all npm_packages

PR Close #62954
2025-08-05 19:08:45 +00:00
Kristiyan Kostadinov
ddf779e18f Revert "feat(router): add a currentNavigation signal to the Router service. (#62971)" (#63010)
This reverts commit d00b3fed58.

PR Close #63010
2025-08-05 18:02:56 +02:00
Matthieu Riegler
d00b3fed58 feat(router): add a currentNavigation signal to the Router service. (#62971)
This new signal property is convenient to derive a `isNavigating` state.

`isNavigating = computed(() => !!this.router.currentNavigation())`

DEPRECATED: The Router.getCurrentNavigation method is deprecated. Use the Router.currentNavigation signal instead.

fixes #62958

PR Close #62971
2025-08-05 10:05:49 +02:00
Kristiyan Kostadinov
b1514d512e fix(migrations): incorrect filtering in inject migration (#62913)
The inject migration wasn't implementing file filtering properly which resulted in it passing an invalid tsconfig path to TypeScript.

Fixes #62866.

PR Close #62913
2025-07-31 09:15:42 +00:00
Joey Perrott
cbc258eec8 build: remove ts_project_interop infrastructure (#62908)
Remove the interop macros and final usages

PR Close #62908
2025-07-31 09:12:58 +00:00
Joey Perrott
49b7729e88 build: remove usages of rules_nodejs (#62885)
Remove rules_nodejs usages with direct migrations to rule_js alternatives

PR Close #62885
2025-07-30 08:51:27 +00:00
Joey Perrott
32c00ab416 build: standardize usage of js_binary (#62860)
Remove usages of nodejs_binary and use a commonly defined js_binary macro

PR Close #62860
2025-07-29 06:43:44 +02:00