Skip to content

Commit bff634f

Browse files
crisbetoangular-robot[bot]
authored andcommitted
fix(@schematics/angular): update private Components utilities to work with standalone project structure
When the utilities for adding providers to the `bootstrapApplication` call were written, the structure for a standalone project handn't been finalized yet which meant that the code made some assumptions around how the app config is being passed in. This code breaks with the final project structure, because there the app config is in a separate file instead of an object literal. These changes update the utilities to account for the new structure. Note the updates are meant to cover the majority of apps and there are likely some edge cases that aren't covered. Covering all cases is tricky with the current setup, because to do so correctly would require knowledge of the entire app whereas the utilities operate on a file-by-file basis. For example, now the code is able to update a config in a separate file, but it wouldn't be able to handle a config that is re-exported. For such a case to be supported, we would need access to the type checker. These edge cases will be addressed later on with a larger refactor of the schematics utilities. I've added a couple of extra utilities for inserting function calls into the `providers` array and checking if a function is called in the `providers` array. We'll need them for the `ng generate` schematics on Components.
1 parent f76466f commit bff634f

File tree

3 files changed

+798
-123
lines changed

3 files changed

+798
-123
lines changed

packages/schematics/angular/private/components.ts

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
export {
1010
addModuleImportToStandaloneBootstrap,
11+
addFunctionalProvidersToStandaloneBootstrap,
12+
callsProvidersFunction,
1113
findBootstrapApplicationCall,
1214
importsProvidersFrom,
1315
} from './standalone';

0 commit comments

Comments
 (0)