angular/packages/core/schematics/test
cexbrayat 11f86a0a08 refactor(migrations): use import manager in provide-initializer (#58456)
The manual replacement logic had a flaw and was inserting the imports several times.

For example:

```ts
import { APP_INITIALIZER, ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
import { InitService } from './init.service';

export const appConfig: ApplicationConfig = {
  providers: [provideZoneChangeDetection({ eventCoalescing: true }),
    {
      provide: APP_INITIALIZER,
      useFactory: (initService: InitService) => initService.init(),
      deps: [InitService],
      multi: true
    },
    {
      provide: APP_INITIALIZER,
      useFactory: (initService: InitService) => initService.init(),
      deps: [InitService],
      multi: true
    }
  ]
};
```

produced:

```ts
import { ApplicationConfig, provideZoneChangeDetection, inject, provideAppInitializer }{ ApplicationConfig, provideZoneChangeDetection, inject, provideAppInitializer } from '@angular/core';
import { InitService } from './init.service';

export const appConfig: ApplicationConfig = {
  providers: [provideZoneChangeDetection({ eventCoalescing: true }),
    provideAppInitializer(() => { return ((initService: InitService) => initService.init())(inject(InitService)); }),
    provideAppInitializer(() => { return ((initService: InitService) => initService.init())(inject(InitService)); })
  ]
};
```

It now produces proper imports:

```ts
import { ApplicationConfig, provideZoneChangeDetection, inject, provideAppInitializer } from '@angular/core';
```

PR Close #58456
2024-11-04 18:15:00 +01:00
..
google3 refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
all-migrations.spec.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
BUILD.bazel feat(migrations): expose output as function migration (#58299) 2024-10-22 07:41:41 -07:00
control_flow_migration_spec.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
explicit_standalone_flag_spec.ts refactor(migrations): Make the explicit standalone migration idempotent (#58418) 2024-10-30 11:55:11 -07:00
helpers.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
inject_migration_spec.ts refactor(migrations): attempt to correct initialization order in internal inject migration (#58427) 2024-10-31 09:17:51 +01:00
output_migration_spec.ts feat(migrations): expose output as function migration (#58299) 2024-10-22 07:41:41 -07:00
pending_tasks_spec.ts feat(core): migrate ExperimentalPendingTasks to PendingTasks (#57533) 2024-09-20 18:26:48 +02:00
project_tsconfig_paths_spec.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
provide_initializer_spec.ts refactor(migrations): use import manager in provide-initializer (#58456) 2024-11-04 18:15:00 +01:00
queries_migration_spec.ts feat(migrations): add schematic to migrate to signal queries (#58032) 2024-10-02 11:25:39 +00:00
signals_migration_spec.ts fix(migrations): add outputs migration to combined shorthand (#58318) 2024-10-23 08:02:50 -07:00
standalone_migration_spec.ts refactor(migrations): Port standalone migration to standalone by default (#58169) 2024-10-15 16:05:14 +00:00
standalone_routes_spec.ts fix(migrations): flip the default standalone flag in route-lazy-loading migration (#58474) 2024-11-03 19:07:09 +01:00