8000 bug #52825 [AssetMapper] Upgrade asset mapper to 6.4 fails due to inv… · symfony/symfony@8cd61c5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8cd61c5

Browse files
bug #52825 [AssetMapper] Upgrade asset mapper to 6.4 fails due to invalid entries "downloaded_to" and "preload" (redflo)
This PR was merged into the 6.4 branch. Discussion ---------- [AssetMapper] Upgrade asset mapper to 6.4 fails due to invalid entries "downloaded_to" and "preload" …s "downloaded_to" and "preload" | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | yes and no, entries were deprecated, but upgrade did not handle these | Issues | Fix #52810 | License | MIT Fixes errors that arise from deprecated entries "downloaded_to" and "preload" after upgrade to Symfony 6.4. Deprecated parameters are ignored and removed whenever importmap.php is rewritten during importmap:update for example. Tested with my personal symfony project, and resolved the issue #52810 Commits ------- 122c0c6 [AssetMapper] Upgrade asset mapper to 6.4 fails due to invalid entries "downloaded_to" and "preload"
2 parents e3e3d5f + 122c0c6 commit 8cd61c5

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/Symfony/Component/AssetMapper/ImportMap/ImportMapConfigReader.php

+15-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function getEntries(): ImportMapEntries
4141

4242
$entries = new ImportMapEntries();
4343
foreach ($importMapConfig ?? [] as $importName => $data) {
44-
$validKeys = ['path', 'version', 'type', 'entrypoint', 'url', 'package_specifier'];
44+
$validKeys = ['path', 'version', 'type', 'entrypoint', 'url', 'package_specifier', 'downloaded_to', 'preload'];
4545
if ($invalidKeys = array_diff(array_keys($data), $validKeys)) {
4646
throw new \InvalidArgumentException(sprintf('The following keys are not valid for the importmap entry "%s": "%s". Valid keys are: "%s".', $importName, implode('", "', $invalidKeys), implode('", "', $validKeys)));
4747
}
@@ -51,6 +51,20 @@ public function getEntries(): ImportMapEntries
5151
trigger_deprecation('symfony/asset-mapper', '6.4', 'The "url" option is deprecated, use "version" instead.');
5252
}
5353

54+
// should solve itself when the config is written again
55+
if (isset($data['downloaded_to'])) {
56+
trigger_deprecation('symfony/asset-mapper', '6.4', 'The "downloaded_to" option is deprecated and will be removed.');
57+
// remove deprecated downloaded_to
58+
unset($data['downloaded_to']);
59+
}
60+
61+
// should solve itself when the config is written again
62+
if (isset($data['preload'])) {
63+
trigger_deprecation('symfony/asset-mapper', '6.4', 'The "preload" option is deprecated, preloading is automatically done.');
64+
// remove deprecated preload
65+
unset($data['preload']);
66+
}
67+
5468
$type = isset($data['type']) ? ImportMapType::tryFrom($data['type']) : ImportMapType::JS;
5569
$isEntrypoint = $data['entrypoint'] ?? false;
5670

0 commit comments

Comments
 (0)
0