|
1 | 1 | <?php |
2 | 2 | /** |
3 | | - * Copyright 2014 Adobe |
4 | | - * All Rights Reserved. |
| 3 | + * Copyright © Magento, Inc. All rights reserved. |
| 4 | + * See COPYING.txt for license details. |
5 | 5 | */ |
6 | 6 |
|
7 | 7 | namespace Magento\Framework\RequireJs\Config\File\Collector; |
8 | 8 |
|
9 | 9 | use Magento\Framework\App\Filesystem\DirectoryList; |
10 | | -use Magento\Framework\Filesystem; |
11 | | -use Magento\Framework\RequireJs\Config as RequireJsConfig; |
12 | | -use Magento\Framework\View\Asset\Minification; |
13 | 10 | use Magento\Framework\View\Design\ThemeInterface; |
14 | 11 | use Magento\Framework\View\File\CollectorInterface; |
15 | | -use Magento\Framework\View\File\Factory; |
16 | 12 |
|
17 | 13 | /** |
18 | 14 | * Source of RequireJs config files basing on list of directories they may be located in |
@@ -46,37 +42,29 @@ class Aggregated implements CollectorInterface |
46 | 42 | protected $libDirectory; |
47 | 43 |
|
48 | 44 | /** |
49 | | - * @var Factory |
| 45 | + * @var \Magento\Framework\View\File\Factory |
50 | 46 | */ |
51 | 47 | protected $fileFactory; |
52 | 48 |
|
53 | 49 | /** |
54 | | - * @var Minification |
55 | | - */ |
56 | | - private Minification $minification; |
57 | | - |
58 | | - /** |
59 | | - * @param Filesystem $filesystem |
60 | | - * @param Factory $fileFactory |
| 50 | + * @param \Magento\Framework\Filesystem $filesystem |
| 51 | + * @param \Magento\Framework\View\File\Factory $fileFactory |
61 | 52 | * @param CollectorInterface $baseFiles |
62 | 53 | * @param CollectorInterface $themeFiles |
63 | 54 | * @param CollectorInterface $themeModularFiles |
64 | | - * @param Minification $minification |
65 | 55 | */ |
66 | 56 | public function __construct( |
67 | | - Filesystem $filesystem, |
68 | | - Factory $fileFactory, |
| 57 | + \Magento\Framework\Filesystem $filesystem, |
| 58 | + \Magento\Framework\View\File\Factory $fileFactory, |
69 | 59 | CollectorInterface $baseFiles, |
70 | 60 | CollectorInterface $themeFiles, |
71 | | - CollectorInterface $themeModularFiles, |
72 | | - Minification $minification |
| 61 | + CollectorInterface $themeModularFiles |
73 | 62 | ) { |
74 | 63 | $this->libDirectory = $filesystem->getDirectoryRead(DirectoryList::LIB_WEB); |
75 | 64 | $this->fileFactory = $fileFactory; |
76 | 65 | $this->baseFiles = $baseFiles; |
77 | 66 | $this->themeFiles = $themeFiles; |
78 | 67 | $this->themeModularFiles = $themeModularFiles; |
79 | | - $this->minification = $minification; |
80 | 68 | } |
81 | 69 |
|
82 | 70 | /** |
@@ -104,47 +92,6 @@ public function getFiles(ThemeInterface $theme, $filePath) |
104 | 92 | $files = array_merge($files, $this->themeModularFiles->getFiles($currentTheme, $filePath)); |
105 | 93 | $files = array_merge($files, $this->themeFiles->getFiles($currentTheme, $filePath)); |
106 | 94 | } |
107 | | - //return $files; |
108 | | - return $this->adjustMinification($theme, $files, $filePath); |
109 | | - } |
110 | | - |
111 | | - /** |
112 | | - * @param ThemeInterface $theme |
113 | | - * @param array $files |
114 | | - * @param string $filePath |
115 | | - * @return array |
116 | | - */ |
117 | | - private function adjustMinification(ThemeInterface $theme, array $files, string $filePath): array |
118 | | - { |
119 | | - if ($this->minification->isEnabled('js') && $filePath === RequireJsConfig::CONFIG_FILE_NAME) { |
120 | | - $minifiedConfigurations = $this->baseFiles->getFiles($theme, RequireJsConfig::CONFIG_FILE_NAME_MIN); |
121 | | - foreach ($theme->getInheritedThemes() as $currentTheme) { |
122 | | - $minifiedConfigurations = array_merge( |
123 | | - $minifiedConfigurations, |
124 | | - $this->themeModularFiles->getFiles($currentTheme, RequireJsConfig::CONFIG_FILE_NAME_MIN) |
125 | | - ); |
126 | | - $minifiedConfigurations = array_merge( |
127 | | - $minifiedConfigurations, |
128 | | - $this->themeFiles->getFiles($currentTheme, RequireJsConfig::CONFIG_FILE_NAME_MIN) |
129 | | - ); |
130 | | - } |
131 | | - if (!empty($minifiedConfigurations)) { |
132 | | - /* @var \Magento\Framework\View\File $file */ |
133 | | - foreach ($files as $key => $file) { |
134 | | - foreach ($minifiedConfigurations as $minifiedConfiguration) { |
135 | | - $replacedFilename = str_replace( |
136 | | - RequireJsConfig::CONFIG_FILE_NAME_MIN, |
137 | | - RequireJsConfig::CONFIG_FILE_NAME, |
138 | | - $minifiedConfiguration->getFilename() |
139 | | - ); |
140 | | - if ($file->getFilename() === $replacedFilename) { |
141 | | - $files[$key] = $minifiedConfiguration; |
142 | | - } |
143 | | - } |
144 | | - } |
145 | | - } |
146 | | - } |
147 | | - |
148 | 95 | return $files; |
149 | 96 | } |
150 | 97 | } |
0 commit comments