You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature #53251 [AssetMapper] Add integrity hash to the default es-module-shims script (smnandre)
This PR was squashed before being merged into the 7.1 branch.
Discussion
----------
[AssetMapper] Add integrity hash to the default es-module-shims script
| Q | A
| ------------- | ---
| Branch? | 7.1
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Issues | Fix#52939 (partially)
| License | MIT
We'll need some deeper changes to manage integrity hashes with custom polyfill URL's...
But this PR already handles the "standard" way of using es-module-shims.
Commits
-------
903259c [AssetMapper] Add integrity hash to the default es-module-shims script
@@ -47,7 +49,7 @@ public function render(string|array $entryPoint, array $attributes = []): string
47
49
$importMap = [];
48
50
$modulePreloads = [];
49
51
$cssLinks = [];
50
-
$polyFillPath = null;
52
+
$polyfillPath = null;
51
53
foreach ($importMapDataas$importName => $data) {
52
54
$path = $data['path'];
53
55
@@ -58,7 +60,7 @@ public function render(string|array $entryPoint, array $attributes = []): string
58
60
59
61
// if this represents the polyfill, hide it from the import map
60
62
if ($importName === $this->polyfillImportName) {
61
-
$polyFillPath = $path;
63
+
$polyfillPath = $path;
62
64
continue;
63
65
}
64
66
@@ -102,22 +104,31 @@ public function render(string|array $entryPoint, array $attributes = []): string
102
104
</script>
103
105
HTML;
104
106
105
-
if (false !== $this->polyfillImportName && null === $polyFillPath) {
107
+
if (false !== $this->polyfillImportName && null === $polyfillPath) {
106
108
if ('es-module-shims' !== $this->polyfillImportName) {
107
109
thrownew \InvalidArgumentException(sprintf('The JavaScript module polyfill was not found in your import map. Either disable the polyfill or run "php bin/console importmap:require "%s"" to install it.', $this->polyfillImportName));
108
110
}
109
111
110
112
// a fallback for the default polyfill in case it's not in the importmap
0 commit comments