1414use Symfony \Component \AssetMapper \AssetMapper ;
1515use Symfony \Component \AssetMapper \AssetMapperInterface ;
1616use Symfony \Component \AssetMapper \Event \PreAssetsCompileEvent ;
17- use Symfony \Component \AssetMapper \ImportMap \ImportMapManager ;
17+ use Symfony \Component \AssetMapper \ImportMap \ImportMapGenerator ;
1818use Symfony \Component \AssetMapper \Path \PublicAssetsPathResolverInterface ;
1919use Symfony \Component \Console \Attribute \AsCommand ;
2020use Symfony \Component \Console \Command \Command ;
@@ -38,7 +38,7 @@ final class AssetMapperCompileCommand extends Command
3838 public function __construct (
3939 private readonly PublicAssetsPathResolverInterface $ publicAssetsPathResolver ,
4040 private readonly AssetMapperInterface $ assetMapper ,
41- private readonly ImportMapManager $ importMapManager ,
41+ private readonly ImportMapGenerator $ importMapGenerator ,
4242 private readonly Filesystem $ filesystem ,
4343 private readonly string $ projectDir ,
4444 private readonly string $ publicDirName ,
@@ -81,12 +81,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8181 $ manifestPath = $ outputDir .'/ ' .AssetMapper::MANIFEST_FILE_NAME ;
8282 $ files [] = $ manifestPath ;
8383
84- $ importMapPath = $ outputDir .'/ ' .ImportMapManager ::IMPORT_MAP_CACHE_FILENAME ;
84+ $ importMapPath = $ outputDir .'/ ' .ImportMapGenerator ::IMPORT_MAP_CACHE_FILENAME ;
8585 $ files [] = $ importMapPath ;
8686
8787 $ entrypointFilePaths = [];
88- foreach ($ this ->importMapManager ->getEntrypointNames () as $ entrypointName ) {
89- $ dumpedEntrypointPath = $ outputDir .'/ ' .sprintf (ImportMapManager ::ENTRYPOINT_CACHE_FILENAME_PATTERN , $ entrypointName );
88+ foreach ($ this ->importMapGenerator ->getEntrypointNames () as $ entrypointName ) {
89+ $ dumpedEntrypointPath = $ outputDir .'/ ' .sprintf (ImportMapGenerator ::ENTRYPOINT_CACHE_FILENAME_PATTERN , $ entrypointName );
9090 $ files [] = $ dumpedEntrypointPath ;
9191 $ entrypointFilePaths [$ entrypointName ] = $ dumpedEntrypointPath ;
9292 }
@@ -105,12 +105,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
105105 $ this ->filesystem ->dumpFile ($ manifestPath , json_encode ($ manifest , \JSON_PRETTY_PRINT ));
106106 $ io ->comment (sprintf ('Manifest written to <info>%s</info> ' , $ this ->shortenPath ($ manifestPath )));
107107
108- $ this ->filesystem ->dumpFile ($ importMapPath , json_encode ($ this ->importMapManager ->getRawImportMapData (), \JSON_THROW_ON_ERROR | \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES | \JSON_HEX_TAG ));
108+ $ this ->filesystem ->dumpFile ($ importMapPath , json_encode ($ this ->importMapGenerator ->getRawImportMapData (), \JSON_THROW_ON_ERROR | \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES | \JSON_HEX_TAG ));
109109 $ io ->comment (sprintf ('Import map data written to <info>%s</info>. ' , $ this ->shortenPath ($ importMapPath )));
110110
111- $ entrypointNames = $ this ->importMapManager ->getEntrypointNames ();
111+ $ entrypointNames = $ this ->importMapGenerator ->getEntrypointNames ();
112112 foreach ($ entrypointFilePaths as $ entrypointName => $ path ) {
113- $ this ->filesystem ->dumpFile ($ path , json_encode ($ this ->importMapManager -> getEntrypointMetadata ($ entrypointName ), \JSON_THROW_ON_ERROR | \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES | \JSON_HEX_TAG ));
113+ $ this ->filesystem ->dumpFile ($ path , json_encode ($ this ->importMapGenerator -> findEagerEntrypointImports ($ entrypointName ), \JSON_THROW_ON_ERROR | \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES | \JSON_HEX_TAG ));
114114 }
115115 $ styledEntrypointNames = array_map (fn (string $ entrypointName ) => sprintf ('<info>%s</> ' , $ entrypointName ), $ entrypointNames );
116116 $ io ->comment (sprintf ('Entrypoint metadata written for <comment>%d</> entrypoints (%s). ' , \count ($ entrypointNames ), implode (', ' , $ styledEntrypointNames )));
0 commit comments