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
$io->comment(sprintf('Import map written to <info>%s</info> and <info>%s</info> for quick importmap dumping onto the page.', $this->shortenPath($importMapPath), $this->shortenPath($importMapPreloadPath)));
Copy file name to clipboardExpand all lines: src/Symfony/Component/AssetMapper/Command/ImportMapRequireCommand.php
+1-5Lines changed: 1 addition & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -126,10 +126,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
126
126
);
127
127
}
128
128
129
-
if ($input->getOption('download')) {
130
-
$io->warning(sprintf('The --download option is experimental. It should work well with the default %s provider but check your browser console for 404 errors.', ImportMapManager::PROVIDER_JSDELIVR_ESM));
if ($invalidKeys = array_diff(array_keys($data), $validKeys)) {
347
+
thrownew \InvalidArgumentException(sprintf('The following keys are not valid for the importmap entry "%s": "%s". Valid keys are: "%s".', $importName, implode('", "', $invalidKeys), implode('", "', $validKeys)));
348
+
}
349
+
350
+
$type = $data['type'] ?? ImportMapEntry::TYPE_JS;
351
+
if (!in_array($type, ImportMapEntry::getValidTypes(), true)) {
352
+
thrownew \InvalidArgumentException(sprintf('The "type" for import "%s" must be one of %s, "%s" given.', $importName, implode(', ', ImportMapEntry::getValidTypes()), $type));
@@ -425,28 +459,55 @@ private function convertEntriesToImports(array $entries): array
425
459
thrownew \InvalidArgumentException(sprintf('The package "%s" mentioned in "%s" must have a "path" or "url" key.', $entryOptions->importName, basename($this->importMapConfigPath)));
426
460
}
427
461
428
-
$imports[$entryOptions->importName] = $path;
462
+
if (ImportMapEntry::TYPE_CSS === $entryOptions->type) {
463
+
if ($entryOptions->preload) {
464
+
// importmap is a noop because this will be rendered as a link tag
465
+
$this->linkTags[] = $path;
466
+
// As an optimization, CSS files that live directly in importmap.php
467
+
// and which are preload, do not need to be added to the importmap:
468
+
// these are only meant to be rendered as link tags.
0 commit comments