14
14
use Symfony \Component \AssetMapper \AssetMapper ;
15
15
use Symfony \Component \AssetMapper \AssetMapperInterface ;
16
16
use Symfony \Component \AssetMapper \Event \PreAssetsCompileEvent ;
17
- use Symfony \Component \AssetMapper \ImportMap \ImportMapManager ;
17
+ use Symfony \Component \AssetMapper \ImportMap \ImportMapGenerator ;
18
18
use Symfony \Component \AssetMapper \Path \PublicAssetsPathResolverInterface ;
19
19
use Symfony \Component \Console \Attribute \AsCommand ;
20
20
use Symfony \Component \Console \Command \Command ;
@@ -38,7 +38,7 @@ final class AssetMapperCompileCommand extends Command
38
38
public function __construct (
39
39
private readonly PublicAssetsPathResolverInterface $ publicAssetsPathResolver ,
40
40
private readonly AssetMapperInterface $ assetMapper ,
41
- private readonly ImportMapManager $ importMapManager ,
41
+ private readonly ImportMapGenerator $ importMapGenerator ,
42
42
private readonly Filesystem $ filesystem ,
43
43
private readonly string $ projectDir ,
44
44
private readonly string $ publicDirName ,
@@ -81,12 +81,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
81
81
$ manifestPath = $ outputDir .'/ ' .AssetMapper::MANIFEST_FILE_NAME ;
82
82
$ files [] = $ manifestPath ;
83
83
84
- $ importMapPath = $ outputDir .'/ ' .ImportMapManager ::IMPORT_MAP_CACHE_FILENAME ;
84
+ $ importMapPath = $ outputDir .'/ ' .ImportMapGenerator ::IMPORT_MAP_CACHE_FILENAME ;
85
85
$ files [] = $ importMapPath ;
86
86
87
87
$ 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 );
90
90
$ files [] = $ dumpedEntrypointPath ;
91
91
$ entrypointFilePaths [$ entrypointName ] = $ dumpedEntrypointPath ;
92
92
}
@@ -105,12 +105,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
105
105
$ this ->filesystem ->dumpFile ($ manifestPath , json_encode ($ manifest , \JSON_PRETTY_PRINT ));
106
106
$ io ->comment (sprintf ('Manifest written to <info>%s</info> ' , $ this ->shortenPath ($ manifestPath )));
107
107
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 ));
109
109
$ io ->comment (sprintf ('Import map data written to <info>%s</info>. ' , $ this ->shortenPath ($ importMapPath )));
110
110
111
- $ entrypointNames = $ this ->importMapManager ->getEntrypointNames ();
111
+ $ entrypointNames = $ this ->importMapGenerator ->getEntrypointNames ();
112
112
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 ));
114
114
}
115
115
$ styledEntrypointNames = array_map (fn (string $ entrypointName ) => sprintf ('<info>%s</> ' , $ entrypointName ), $ entrypointNames );
116
116
$ io ->comment (sprintf ('Entrypoint metadata written for <comment>%d</> entrypoints (%s). ' , \count ($ entrypointNames ), implode (', ' , $ styledEntrypointNames )));
0 commit comments