Compare commits

...

24 Commits

Author SHA1 Message Date
Hugo Alliaume 2236755f4f Update minimum required Symfony version to 7.4
After internal discussions, related to #3452
2026-04-10 00:56:44 +02:00
Hugo Alliaume e9b46c5698 Upgrade minimum required PHP version to 8.4
As discussed internally
2026-04-09 22:56:19 +02:00
Hugo Alliaume 985ac22ccb Merge branch '2.x' into 3.x
* 2.x:
  Update versions to 2.34.0
  [Native] Fix invalid priority for DevServerListener
  [Apps] Add Native demo
  [Autocomplete][Chartjs][Cropperjs][Dropzone][LazyImage][LiveComponent][Map][Notify][React][StimulusBundle][Svelte][Swup][TogglePassword][Translator][Turbo][Typed][Vue] Update package.json to `2.33.0`
  [Cropperjs] Add image rotation in php side
  [CI] Update permissions to allow pushing changes to the repository during NPM release
  [E2E] Test over Symfony 8.0
2026-03-23 08:25:36 +01:00
Hugo Alliaume 3bb89a8f10 Merge branch '2.x' into 3.x
* 2.x:
  Update tsdown & use @tsdown/css
  [CI] Rename JS code-quality-related jobs
  Update oxfmt and oxlint
2026-03-21 09:19:15 +01:00
Hugo Alliaume a6ecf51bda Merge branch '2.x' into 3.x
* 2.x:
  [Toolkit][Shadcn] Fix initial "open" state for AlertDialog and Dialog
  Remove unused @vitest/browser
  Update Vitest to ^4.1.0
  [TwigComponent] Fix profiler loaded in production due to unresolved %kernel.debug% default
  [LiveComponent] Add `debug:live-component` command
  Fix email input class binding for validation errors
  (Shadcn] Fix Tooltip's wrapper when re-rendered by LiveComponent
  Allow components use dynamically templates
  fix properly apply inline styles with important priority
  Migrate from tsup (deprecated) to tsdown
  Remove tsx dependency and rely on Node.js 22.18.0 native TypeScript runner
  Fix unit testing script
  Update JavaScript dependencies
2026-03-15 19:41:51 +01:00
Hugo Alliaume c7983dd3d6 Merge branch '2.x' into 3.x
* 2.x:
  [TwigComponent] Add support for anonymous component name resolution in external bundle
  [Toolkit][Avatar] Update templates
  Add version constraint for symfony/config and zenstruck/foundry
  zenstruck/foundry bundle requires symfony/http-kernel 6.1
  [Toolkit][Shadcn] Update Avatar component
  -
  Drop Biome.js for oxfmt and oxlint
  Run PHP-CS-Fixer (no_useless_else & static_lambda)
  [TwigComponent] Document high-order components
  [TwigComponent] Document about Readonly  components
  Update GitHub link in documentation
2026-02-09 08:09:48 +01:00
Hugo Alliaume 45e90b499c Merge branch '2.x' into 3.x
* 2.x:
  Fix minimum requested 6.x version of FrameworkBundle for LiveComponent
  [Autocomplete][Chartjs][Cropperjs][Dropzone][LazyImage][React][StimulusBundle][Svelte][Swup][TogglePassword][Translator][Turbo][Typed][Vue] Use `Extension` from `DependencyInjection` instead of `HttpKernel`
  [Toolkit][Shadcn] Update Alert CSS class, add Alert:Action component
  [Toolkit][Shadcn] Add Tooltip component
  [Toolkit][Shadcn] Add Accordion recipe
  [Toolkit] Fix `Field` demo code
2026-02-01 14:44:07 +01:00
Hugo Alliaume 7258efcd1f Merge branch '2.x' into 3.x
* 2.x:
  [React] Add support for React 19
  [Toolkit][Shadcn] Fix `InputGroup` example
  [Toolkit][Shadcn] Update snapshots
  [Toolkit][Shadcn] Rework templates of `textarea` recipe
  [Toolkit][Shadcn] Rework templates of `table` recipe
  [Toolkit][Shadcn] Rework templates of `input-group` recipe
  [Toolkit][Shadcn] Rework templates of `checkbox` recipe
  [Toolkit][Shadcn] Rework templates of `card` recipe
  [Toolkit][Shadcn] Rework templates of `badge` recipe
  [Toolkit][Shadcn] Rework templates of `avatar` recipe
  [Toolkit][Shadcn] Rework many components examples
  Fix npm releases due to `repository` issue
  Update versions to 2.32.0
  [Toolkit][Shadcn] Fix text color in dark mode for AlertDialog/Dialog components
  remove installation note about assetmapper
  [Site] Move website to dedicated repository
  Fix text-color for destructive badge
2026-01-24 17:36:08 +01:00
Hugo Alliaume 98b1d60e93 Merge branch '2.x' into 3.x
# By Hugo Alliaume (7) and others
* 2.x:
  [Toolkit] Prepare base for recipe type "Block"
  Update root JS dependencies
  Fix button syntax for file upload actions
  [Site] Update to Symfony 8
  [Site] Update to PHP 8.5
  [Site] Update to Symfony 7.4
  Add changelog entry for #3285
  [StimulusBundle][Performance] Change AssetMapper `excluded_patterns` from `**/controllers.json` to `*/controllers.json`
  [CI] Fix compatibility issues with Symfony 8 and spatie/phpunit-snapshot-assertions

# Conflicts:
#	pnpm-lock.yaml
#	src/Map/src/Bridge/Google/assets/dist/map_controller.js
#	src/Map/src/Bridge/Google/assets/src/map_controller.ts
#	src/StimulusBundle/CHANGELOG.md
#	ux.symfony.com/composer.lock
2026-01-11 14:24:52 +01:00
Hugo Alliaume fb5a529051 Merge branch '2.x' into 3.x
* 2.x:
  [Translator] Reword `dump_typescript` option description
  [Toolkit][Shadcn] add ButtonGroup component
  [Toolkit][Shadcn] add Field component
  [Translator] Add option `ux_translator.dump_typescript` to enable/disable TypeScript types generation
  [Translator] Early exit parameters extraction from Intl messages, if no `{` is found
  [Toolkit][Shadcn] add Empty component
  Update Encore app
  Update ux.symfony.com app
  Update E2E app
  [Translator] Refactor API to use string-based translation keys instead of generated constants
  docs: fix missing space in JSON snippet for UX Autocomplete
  Git-ignore config/reference.php
  [Icons] Fix `aliases` and `icon_attributes` config types for `config/reference.php`
  [Autocomplete] Add documentation about plugins management
2025-12-07 05:46:59 +09:00
Hugo Alliaume bbdd4cbe17 Add phpunit.dist.xml in .gitattributes 2025-11-22 18:57:33 +01:00
Hugo Alliaume 540e76af4f [StimulusBundle] Drop Symfony PHPUnit Bridge in favor of PHPUnit >= 11.0 2025-11-19 09:28:32 +01:00
Hugo Alliaume 0c019e021c [StimulusBundle] Remove deprecations for 3.0 2025-11-18 00:13:43 +01:00
Hugo Alliaume 54febb74a2 Replace 2.x occurrences by 3.x 2025-11-16 20:12:36 +01:00
Hugo Alliaume 4348949274 Merge branch '2.x' into 3.x
# By Hugo Alliaume (8) and others
* 2.x:
  [CI] Tests over Symfony 7.4.0-beta1 and 8.0.0-beta1
  fix: add missing closing quote to attribute
  [Toolkit][Shadcn] Add missing as props, update CONTRIBUTING.md
  [Toolkit][Shadcn] Add missing as props, update CONTRIBUTING.md
  [TwigComponent] Merge `profiler` and `profiler_collect_components` config options
  Add clarification about difference between component re-rendering and initial loading
  [Toolkit] Add CONTRIBUTING.md
  [TwigComponent][Perf] Add option to disable the dump of components
  [Toolkit][Shadcn][Button] Re-introduce `as` prop, adjust some examples
  [Toolkit][Shadcn] Update Button CSS class, remove as props
  [Toolkit][Shadcn][Item] Minor fixes (html_cva, missing dependencies, more examples)
  [Toolkit][Shadcn] docs for Item component
  [Toolkit][Shadcn] Add Item component
  [Site] Document Toolkit recipes props and blocks
  [CI] Fix sudo issues when installing npm before installing node
  Update versions to 2.31.0
  fix(render): [autocomplete] missing common config properties during merge (such as `no_results`) for `options_as_html` inputs
  [Turbo] Fix mercure auth the wrong hub with turbo_steam_listen
  [LiveComponent] Add dispatch browser event test

# Conflicts:
#	.github/workflows/unit-tests.yaml
#	CONTRIBUTING.md
#	src/Autocomplete/composer.json
#	src/Autocomplete/tests/Fixtures/Kernel.php
#	src/Icons/composer.json
#	src/LazyImage/assets/package.json
#	src/LiveComponent/CHANGELOG.md
#	src/LiveComponent/composer.json
#	src/LiveComponent/tests/Fixtures/Kernel.php
#	src/Swup/assets/package.json
#	src/TogglePassword/assets/package.json
#	src/Turbo/composer.json
#	src/TwigComponent/CHANGELOG.md
#	src/TwigComponent/src/DependencyInjection/TwigComponentExtension.php
#	src/TwigComponent/tests/Unit/DependencyInjection/TwigComponentExtensionTest.php
#	src/Typed/assets/package.json
#	ux.symfony.com/composer.lock
2025-11-16 20:05:08 +01:00
Hugo Alliaume 36fae71dad Merge branch '2.x' into 3.x
# By Romain Monteil (2) and others
* 2.x:
  [Map] Display warning when trying to define a custom icon for a `Marker` that already has an `Icon`
  [Map] Add fitBoundsToMarkers option to Twig extension and component
  [LiveComponent] Replace the browser's URL before triggering `render:finished` hook
  [Icons] Add documentation on icons colors
  Fix typo in documentation

# Conflicts:
#	src/Map/CHANGELOG.md
#	src/Map/src/Bridge/Google/CHANGELOG.md
#	src/Map/src/Bridge/Leaflet/CHANGELOG.md
2025-10-05 08:23:40 +02:00
Hugo Alliaume c25e53cda7 Merge branch '2.x' into 3.x
* 2.x:
  [Toolkit] Delay/hide the "Community Kits" feature, minor fixes
  [Site] Fix port to 9044 and upgrade UX dependencies
  [Docs] Fix `composer config` to avoid modifying `package.json` automatically
  Refactor "test_package.sh" to its original purpose, add multiples checks for packages definition
  Enhance PR template with deprecation and documentation fields
  [Icons] explain svg colors and improve example configuration
  [Docs] Add doc for E2E steps + minor modifications
  [Site] Lock icons
2025-09-25 08:28:32 +02:00
Hugo Alliaume 129a4eb576 Merge branch '2.x' into 3.x
* 2.x:
  [App/E2E] Add examples listing on homepage, improve example page
  Improve performance for LiveUrlSubscriber
  [Toolkit] Rework the "dependencies" Recipe JSON schema
  [Toolkit][Shadcn] Add AlertDialog recipe
  [Toolkit] Add npm & importmap package dependencies
  Update index.rst
  Fix Route PHP attribute in Vue Router Web History mode
  PHP CS Fixer - apply const->var annotation conversion
  [Doc] Updates for UX Icons docs
  Configure .gitattributes to ignore Vitest and Playwright config files from export
2025-09-12 22:52:52 +02:00
Hugo Alliaume 4f97b82536 Merge branch '2.x' into 3.x
# By Hugo Alliaume (3) and others
# Via Hugo Alliaume (3) and others
* 2.x:
  Update versions to 2.30.0
  Fix changelogs
  [LiveComponent] Refactor and fix (again) the new URL (with path and query LiveProps) generation
  Remove some indirect deprecations
  [LiveComponent] Fix BC Break
  [Docs][LiveComponent] Clean oldies version added

# Conflicts:
#	src/LazyImage/CHANGELOG.md
#	src/LazyImage/assets/package.json
#	src/LazyImage/tests/Kernel/TwigAppKernel.php
#	src/Map/CHANGELOG.md
#	src/Swup/CHANGELOG.md
#	src/Swup/assets/package.json
#	src/TogglePassword/CHANGELOG.md
#	src/TogglePassword/assets/package.json
#	src/TogglePassword/tests/Kernel/TwigAppKernel.php
#	src/Typed/CHANGELOG.md
#	src/Typed/assets/package.json
2025-08-28 00:01:01 +02:00
Hugo Alliaume de4e102353 Upgrade minimum required PHP version to 8.2 2025-08-24 16:01:49 +02:00
Hugo Alliaume 2e0faad33f Merge branch '2.x' into 3.x
# By Hugo Alliaume (4) and others
* 2.x:
  [React][Vue][Svelte] Add E2E tests
  [LiveComponent] Return empty string for `data-value=""` instead of falling back to null
  [Icons] fix set default viewBox when not defined in Iconify icon set
  Re-configure LF eof in git
  [Map] Leaflet bridge doc
  Ensure PHP 8.5 compatibility
  Fix highest-deps job

# Conflicts:
#	src/Autocomplete/CHANGELOG.md
#	src/Chartjs/CHANGELOG.md
#	src/Cropperjs/CHANGELOG.md
#	src/Dropzone/CHANGELOG.md
#	src/Icons/CHANGELOG.md
#	src/LazyImage/CHANGELOG.md
#	src/LiveComponent/CHANGELOG.md
#	src/Map/src/Bridge/Google/CHANGELOG.md
#	src/Map/src/Bridge/Leaflet/CHANGELOG.md
#	src/Notify/CHANGELOG.md
#	src/React/CHANGELOG.md
#	src/StimulusBundle/CHANGELOG.md
#	src/Svelte/CHANGELOG.md
#	src/Swup/CHANGELOG.md
#	src/TogglePassword/CHANGELOG.md
#	src/Translator/CHANGELOG.md
#	src/Turbo/CHANGELOG.md
#	src/TwigComponent/CHANGELOG.md
#	src/Typed/CHANGELOG.md
#	src/Vue/CHANGELOG.md
2025-08-23 19:34:07 +02:00
Hugo Alliaume f4bec0f6ea Merge branch '2.x' into 3.x
# By Hugo Alliaume (5) and github-actions[bot] (1)
* 2.x:
  Create E2E app & run it in CI
  Update versions to 2.29.2
  Use Playwright to run E2E tests
  Rework test_package.sh to allow passing tail args to vitest
  Rename back vitest.config.unit.mjs to vitest.config.mjs
  Configure Vitest for unit and browser tests (use @puppeteer/browsers and webdriverio)

# Conflicts:
#	pnpm-lock.yaml
#	src/LazyImage/assets/package.json
#	src/LazyImage/assets/test/unit/controller.test.ts
#	src/Swup/assets/package.json
#	src/Swup/assets/test/unit/controller.test.ts
#	src/TogglePassword/assets/package.json
#	src/TogglePassword/assets/test/unit/controller.test.ts
#	src/Typed/assets/package.json
#	src/Typed/assets/test/unit/controller.test.ts
2025-08-19 20:41:14 +02:00
Hugo Alliaume 3afbe1ed99 Merge branch '2.x' into 3.x
* 2.x:
  [LiveComponent] Fix new URL calculation when having `#[LiveProp]` with custom `modifier` which returns a new `LiveProp`
  [LiveComponent] Fix new URL calculation when having `#[LiveProp]` with `useSerializerForHydration: true` and `#[SerializedName]`
  [CI] Fix highest dev jobs
  Run latest PHP-CS-Fixer with improved configuration
  [CI] Remove PHP-CS-Fixer job
  [Pkg] Ensure UX Map assets are built first
  [Toolkit] Fix comptability with Windows
  [LiveComponent] Exclude unstable tests on Windows with @transient-on-windows

# Conflicts:
#	src/LazyImage/tests/BlurHash/BlurHashTest.php
#	src/LazyImage/tests/Kernel/AppKernelTrait.php
#	src/TogglePassword/tests/Kernel/TwigAppKernel.php
2025-08-15 08:16:45 +02:00
Hugo Alliaume d7deaf0b77 Update minimum required Symfony version to ^6.4 2025-08-14 18:23:48 +02:00
20 changed files with 134 additions and 517 deletions
+1 -1
View File
@@ -4,5 +4,5 @@
/assets/test export-ignore
/assets/vitest.config.mjs export-ignore
/doc export-ignore
/phpunit.xml.dist export-ignore
/phpunit.dist.xml export-ignore
/tests export-ignore
+2 -1
View File
@@ -3,6 +3,7 @@
/vendor/
/composer.lock
/phpunit.xml
/.phpunit.result.cache
/.phpunit.cache
/tests/fixtures/var
/config/reference.php
+2 -2
View File
@@ -1,3 +1,3 @@
branches: ['2.x']
maintained_branches: ['2.x']
branches: ['2.x', '3.x']
maintained_branches: ['3.x']
doc_dir: 'doc'
+6
View File
@@ -1,5 +1,11 @@
# CHANGELOG
## 3.0.0
- Minimum required Symfony version is now 7.4
- Minimum required PHP version is now 8.4
- Remove Twig function `ux_controller_link_tags()`, which requires Symfony AssetMapper >=6.4
## 2.33
- Change AssetMapper `excluded_patterns` from `**/controllers.json` to `*/controllers.json`
+13 -10
View File
@@ -13,20 +13,23 @@
}
],
"require": {
"php": ">=8.1",
"symfony/config": "^5.4|^6.0|^7.0|^8.0",
"symfony/dependency-injection": "^5.4|^6.0|^7.0|^8.0",
"symfony/finder": "^5.4|^6.0|^7.0|^8.0",
"symfony/http-kernel": "^5.4|^6.0|^7.0|^8.0",
"php": ">=8.4",
"symfony/config": "^7.4|^8.0",
"symfony/dependency-injection": "^7.4|^8.0",
"symfony/finder": "^7.4|^8.0",
"symfony/http-kernel": "^7.4|^8.0",
"twig/twig": "^2.15.3|^3.8",
"symfony/deprecation-contracts": "^2.0|^3.0"
},
"conflict": {
"symfony/asset-mapper": "<6.4"
},
"require-dev": {
"symfony/asset-mapper": "^6.3|^7.0|^8.0",
"symfony/framework-bundle": "^5.4|^6.0|^7.0|^8.0",
"symfony/phpunit-bridge": "^5.4|^6.0|^7.0|^8.0",
"symfony/twig-bundle": "^5.4|^6.0|^7.0|^8.0",
"zenstruck/browser": "^1.4"
"phpunit/phpunit": "^11.1|^12.0",
"symfony/asset-mapper": "^7.4|^8.0",
"symfony/framework-bundle": "^7.4|^8.0",
"symfony/twig-bundle": "^7.4|^8.0",
"zenstruck/browser": "^1.9"
},
"minimum-stability": "dev",
"autoload": {
-13
View File
@@ -15,8 +15,6 @@ use Symfony\UX\StimulusBundle\AssetMapper\ControllersMapGenerator;
use Symfony\UX\StimulusBundle\AssetMapper\StimulusLoaderJavaScriptCompiler;
use Symfony\UX\StimulusBundle\Helper\StimulusHelper;
use Symfony\UX\StimulusBundle\Twig\StimulusTwigExtension;
use Symfony\UX\StimulusBundle\Twig\UxControllersTwigExtension;
use Symfony\UX\StimulusBundle\Twig\UxControllersTwigRuntime;
use Symfony\UX\StimulusBundle\Ux\UxPackageReader;
use Twig\Environment;
@@ -45,17 +43,6 @@ return static function (ContainerConfigurator $container): void {
])
// symfony/asset-mapper services
->set('stimulus.ux_controllers_twig_extension', UxControllersTwigExtension::class)
->tag('twig.extension')
->set('stimulus.ux_controllers_twig_runtime', UxControllersTwigRuntime::class)
->args([
service('stimulus.asset_mapper.controllers_map_generator'),
service('asset_mapper'),
service('stimulus.asset_mapper.ux_package_reader'),
param('kernel.project_dir'),
])
->tag('twig.runtime')
->set('stimulus.asset_mapper.controllers_map_generator', ControllersMapGenerator::class)
->args([
-4
View File
@@ -416,10 +416,6 @@ will import all your custom controllers as well as those from ``controllers.json
It will also dynamically enable "debug" mode in Stimulus when your application
is running in debug mode.
.. tip::
For AssetMapper 6.3 only, you also need a ``{{ ux_controller_link_tags() }}``
in ``base.html.twig``. This is not needed in AssetMapper 6.4+.
With WebpackEncoreBundle
~~~~~~~~~~~~~~~~~~~~~~~~
+15 -13
View File
@@ -2,16 +2,17 @@
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/bin/.phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
bootstrap="vendor/autoload.php"
bootstrap="tests/bootstrap.php"
failOnDeprecation="true"
failOnRisky="true"
failOnWarning="true"
cacheDirectory=".phpunit.cache"
>
<php>
<ini name="error_reporting" value="-1"/>
<env name="SHELL_VERBOSITY" value="-1"/>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0&amp;max[direct]=0"/>
<env name="KERNEL_CLASS" value="Symfony\UX\Autocomplete\Tests\Fixtures\Kernel"/>
<env name="DATABASE_URL" value="sqlite:///%kernel.project_dir%/var/data.db"/>
</php>
@@ -22,17 +23,18 @@
</testsuite>
</testsuites>
<coverage>
<source
ignoreSuppressionOfDeprecations="true"
ignoreIndirectDeprecations="true"
restrictNotices="true"
restrictWarnings="true"
>
<include>
<directory>./src</directory>
<directory>src</directory>
</include>
</coverage>
<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
</listeners>
<extensions>
<extension class="Zenstruck\Browser\Test\BrowserExtension"/>
</extensions>
<deprecationTrigger>
<function>trigger_deprecation</function>
</deprecationTrigger>
</source>
</phpunit>
@@ -24,7 +24,6 @@ class RemoveAssetMapperServicesCompiler implements CompilerPassInterface
public function process(ContainerBuilder $container): void
{
if (!$container->hasDefinition('asset_mapper')) {
$container->removeDefinition('stimulus.ux_controllers_twig_runtime');
$container->removeDefinition('stimulus.asset_mapper.controllers_map_generator');
$container->removeDefinition('stimulus.asset_mapper.loader_javascript_compiler');
}
-30
View File
@@ -1,30 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\UX\StimulusBundle\Twig;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
/**
* @internal
*
* @author Ryan Weaver <ryan@symfonycasts.com>
*/
final class UxControllersTwigExtension extends AbstractExtension
{
public function getFunctions(): array
{
return [
new TwigFunction('ux_controller_link_tags', [UxControllersTwigRuntime::class, 'renderLinkTags'], ['is_safe' => ['html']]),
];
}
}
-171
View File
@@ -1,171 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\UX\StimulusBundle\Twig;
use Symfony\Component\AssetMapper\AssetMapperInterface;
use Symfony\Component\AssetMapper\ImportMap\ImportMapGenerator;
use Symfony\UX\StimulusBundle\AssetMapper\ControllersMapGenerator;
use Symfony\UX\StimulusBundle\Ux\UxPackageReader;
use Twig\Extension\RuntimeExtensionInterface;
/**
* Returns the link tags for all autoimported CSS files in controllers.json.
*
* @internal
*
* @author Ryan Weaver <ryan@symfonycasts.com>
*/
final class UxControllersTwigRuntime implements RuntimeExtensionInterface
{
private array $importMap;
public function __construct(
private ControllersMapGenerator $controllersMapGenerator,
private AssetMapperInterface $assetMapper,
private UxPackageReader $uxPackageReader,
private string $projectDir,
) {
}
/**
* Returns the CSS <link> tags for all "autoimport" entries in controllers.json.
*/
public function renderLinkTags(): string
{
if (class_exists(ImportMapGenerator::class)) {
trigger_deprecation('symfony/ux-stimulus-bundle', '2.13.0', 'Calling ux_controller_link_tags() is deprecated and does nothing with symfony/asset-mapper 6.4. The link tags are rendered automatically via the importmap() function.');
return '';
}
$controllersFile = $this->controllersMapGenerator->getControllersJsonPath();
if (!is_file($controllersFile)) {
return '';
}
$data = json_decode(file_get_contents($controllersFile), true, 512, \JSON_THROW_ON_ERROR);
$packages = $data['controllers'] ?? [];
$links = [];
foreach ($packages as $uxPackageName => $controllers) {
foreach ($controllers as $controllerData) {
if (!$controllerData['enabled'] ?? false) {
continue;
}
foreach ($controllerData['autoimport'] ?? [] as $autoImport => $enabled) {
if ($enabled) {
$links[] = \sprintf('<link rel="stylesheet" href="%s">', $this->getLinkHref($autoImport, $uxPackageName));
}
}
}
}
return implode("\n", $links);
}
// duplicated & adapted in ControllersMapGenerator
private function getLinkHref(string $autoImport, string $uxPackageName): string
{
// see if this is a mapped asset path
$asset = $this->assetMapper->getAsset($autoImport);
if ($asset) {
return $asset->publicPath;
}
$slashPosition = strpos($autoImport, '/');
if (false === $slashPosition) {
throw new \LogicException(\sprintf('The autoimport "%s" is not valid.', $autoImport));
}
// if the first character is @, then the package name is @symfony/ux-cropperjs
$parts = explode('/', $autoImport);
if (str_starts_with($autoImport, '@')) {
$package = implode('/', \array_slice($parts, 0, 2));
$file = implode('/', \array_slice($parts, 2));
} else {
$package = $parts[0];
$file = implode('/', \array_slice($parts, 1));
}
if ($package === $uxPackageName) {
// this is a file local to the ux package
$uxPackageMetadata = $this->uxPackageReader->readPackageMetadata($uxPackageName);
$filePath = $uxPackageMetadata->packageDirectory.'/'.$file;
if (!is_file($filePath)) {
throw new \LogicException(\sprintf('An "autoimport" in "%s" refers to "%s". This path could not be found in the asset mapper and the file "%s" does not exist in the package path "%s". And so, the file cannot be loaded.', $this->shortControllersPath(), $autoImport, $file, $uxPackageMetadata->packageDirectory));
}
$asset = $this->assetMapper->getAssetFromSourcePath($filePath);
if (!$asset) {
throw new \LogicException(\sprintf('An "autoimport" in "%s" refers to "%s". This file was found, but the path is not in the asset mapper. And so, the file cannot be loaded.', $this->shortControllersPath(), $autoImport));
}
return $asset->publicPath;
}
$importMap = $this->readImportMap();
if (!isset($importMap[$package])) {
throw new \LogicException(\sprintf('An "autoimport" in "%s" refers to "%s". This path could not be found in the asset mapper and no "%s" entry was found in importmap.php. And so, the file cannot be loaded.', $this->shortControllersPath(), $autoImport, $package));
}
$importMapEntry = $importMap[$package];
if (!isset($importMapEntry['url'])) {
throw new \LogicException(\sprintf('An "autoimport" in "%s" refers to "%s". This path could not be found in the asset mapper and no "url" key was found in importmap.php for the package "%s". And so, the file cannot be loaded.', $this->shortControllersPath(), $autoImport, $package));
}
$version = $this->parseVersionFromUrl($importMapEntry['url']);
return $this->getJsDelivrUrl($package, $version, $file);
}
private function readImportMap(): array
{
if (!isset($this->importMap)) {
// this should be dynamic, but for now, we'll hardcode it
$path = $this->projectDir.'/importmap.php';
$this->importMap = is_file($path) ? (static fn () => include $path)() : [];
}
return $this->importMap;
}
private function parseVersionFromUrl(string $url): ?string
{
$versionPattern = '/(?<=@)\d+(?:\.\d+)+/';
if (!preg_match($versionPattern, $url, $matches)) {
return null;
}
return $matches[0];
}
private function getJsDelivrUrl(string $package, ?string $version, string $file): string
{
$version ??= 'latest';
$package = str_replace('@', '', $package);
return \sprintf('https://cdn.jsdelivr.net/npm/%s@%s/%s', $package, $version, $file);
}
private function shortControllersPath(): string
{
$path = $this->controllersMapGenerator->getControllersJsonPath();
$path = realpath($path);
$projectDir = realpath($this->projectDir);
if (!str_starts_with($path, $projectDir)) {
return $path;
}
return str_replace($projectDir, '', $path);
}
}
@@ -22,13 +22,6 @@ use Symfony\UX\StimulusBundle\Ux\UxPackageMetadata;
class AutoImportLocatorTest extends TestCase
{
protected function setUp(): void
{
if (!class_exists(ImportMapConfigReader::class)) {
$this->markTestSkipped('Test requires AssetMapper >= 6.4.');
}
}
public function testLocateAutoImportCanHandleAssetMapperPath()
{
$assetMapper = $this->createMock(AssetMapperInterface::class);
@@ -13,7 +13,6 @@ namespace Symfony\UX\StimulusBundle\Tests\AssetMapper;
use PHPUnit\Framework\TestCase;
use Symfony\Component\AssetMapper\AssetMapperInterface;
use Symfony\Component\AssetMapper\ImportMap\ImportMapConfigReader;
use Symfony\Component\AssetMapper\MappedAsset;
use Symfony\UX\StimulusBundle\AssetMapper\AutoImportLocator;
use Symfony\UX\StimulusBundle\AssetMapper\ControllersMapGenerator;
@@ -54,17 +53,11 @@ class ControllersMapGeneratorTest extends TestCase
$packageReader = new UxPackageReader(__DIR__.'/../fixtures');
$autoImportLocator = $this->createMock(AutoImportLocator::class);
if (class_exists(ImportMapConfigReader::class)) {
$autoImportLocator->expects($this->any())
->method('locateAutoImport')
->willReturnCallback(static function ($path) {
return new MappedControllerAutoImport('/path/to'.$path, false);
});
} else {
// @legacy for AssetMapper 6.3
$autoImportLocator->expects($this->never())
->method('locateAutoImport');
}
$autoImportLocator->expects($this->any())
->method('locateAutoImport')
->willReturnCallback(static function ($path) {
return new MappedControllerAutoImport('/path/to'.$path, false);
});
$generator = new ControllersMapGenerator(
$mapper,
@@ -106,11 +99,7 @@ class ControllersMapGeneratorTest extends TestCase
$this->assertSame('fake-vendor/ux-package1/package-controller-second.js', $controllerSecond->asset->logicalPath);
// lazy from user's controller.json
$this->assertTrue($controllerSecond->isLazy);
// @legacy: assert can be without the conditional for AssetMapper 6.4+
if (class_exists(ImportMapConfigReader::class)) {
// 4 auto imports from package.json
$this->assertCount(4, $controllerSecond->autoImports);
}
$this->assertCount(4, $controllerSecond->autoImports);
$helloControllerFromPackage = $map['fake-vendor--ux-package2--hello-controller'];
$this->assertSame('fake-vendor/ux-package2/package-hello-controller.js', $helloControllerFromPackage->asset->logicalPath);
@@ -13,7 +13,6 @@ namespace Symfony\UX\StimulusBundle\Tests\AssetMapper;
use Composer\InstalledVersions;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\AssetMapper\ImportMap\ImportMapConfigReader;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\UX\StimulusBundle\Tests\fixtures\StimulusTestKernel;
use Zenstruck\Browser\Test\HasBrowser;
@@ -33,123 +32,79 @@ class StimulusControllerLoaderFunctionalTest extends WebTestCase
$crawler = $this->browser()
->get('/')
->crawler()
;
->crawler();
$importMapJson = $crawler->filter('script[type="importmap"]')->html();
$importMap = json_decode($importMapJson, true);
$importMapKeys = array_keys($importMap['imports']);
if (class_exists(ImportMapConfigReader::class)) {
// filter out items ending in .css
$importMapJsKeys = array_filter($importMapKeys, static function ($key) {
return '.css' !== substr($key, -4);
});
$importMapCssKeys = array_filter($importMapKeys, static function ($key) {
return '.css' === substr($key, -4);
});
sort($importMapJsKeys);
$this->assertSame([
// 1x import from loader.js (which is aliased to @symfony/stimulus-bundle via importmap)
'/assets/@symfony/stimulus-bundle/controllers.js',
// 7x from "controllers" (hello is overridden)
'/assets/controllers/bye_controller.js',
'/assets/controllers/hello-with-dashes-controller.js',
'/assets/controllers/hello_with_underscores-controller.js',
'/assets/controllers/subdir/deeper-controller.js',
'/assets/controllers/subdir/deeper-with-dashes-controller.js',
'/assets/controllers/subdir/deeper_with_underscores-controller.js',
'/assets/controllers/typescript-controller.ts',
// 2x from UX packages, which are enabled in controllers.json
'/assets/fake-vendor/ux-package1/package-controller-second.js',
'/assets/fake-vendor/ux-package2/package-hello-controller.js',
// 4x from more-controllers
'/assets/more-controllers/excluded-controller.js',
'/assets/more-controllers/hello-controller.js',
'/assets/more-controllers/minified-controller.js',
'/assets/more-controllers/other-controller.js',
// 5x from importmap.php
'@hotwired/stimulus',
'@scoped/needed-vendor',
'@symfony/stimulus-bundle',
'app',
'needed-vendor',
], array_values($importMapJsKeys));
// filter out items ending in .css
$importMapJsKeys = array_filter($importMapKeys, static function ($key) {
return '.css' !== substr($key, -4);
});
$importMapCssKeys = array_filter($importMapKeys, static function ($key) {
return '.css' === substr($key, -4);
});
sort($importMapJsKeys);
$this->assertSame([
// 1x import from loader.js (which is aliased to @symfony/stimulus-bundle via importmap)
'/assets/@symfony/stimulus-bundle/controllers.js',
// 7x from "controllers" (hello is overridden)
'/assets/controllers/bye_controller.js',
'/assets/controllers/hello-with-dashes-controller.js',
'/assets/controllers/hello_with_underscores-controller.js',
'/assets/controllers/subdir/deeper-controller.js',
'/assets/controllers/subdir/deeper-with-dashes-controller.js',
'/assets/controllers/subdir/deeper_with_underscores-controller.js',
'/assets/controllers/typescript-controller.ts',
// 2x from UX packages, which are enabled in controllers.json
'/assets/fake-vendor/ux-package1/package-controller-second.js',
'/assets/fake-vendor/ux-package2/package-hello-controller.js',
// 4x from more-controllers
'/assets/more-controllers/excluded-controller.js',
'/assets/more-controllers/hello-controller.js',
'/assets/more-controllers/minified-controller.js',
'/assets/more-controllers/other-controller.js',
// 5x from importmap.php
'@hotwired/stimulus',
'@scoped/needed-vendor',
'@symfony/stimulus-bundle',
'app',
'needed-vendor',
], array_values($importMapJsKeys));
// the autoimport CSS
$this->assertSame([
'/assets/in/asset/mapper/controller_second1.css',
// enabled => false
// '/assets/in/asset/mapper/controller_second2.css',
'/assets/fake-vendor/ux-package1/styles.css',
// the autoimport CSS
$this->assertSame([
'/assets/in/asset/mapper/controller_second1.css',
// enabled => false
// '/assets/in/asset/mapper/controller_second2.css',
'/assets/fake-vendor/ux-package1/styles.css',
// 2x from importmap.php: so they should, of course, be here.
// But our compiler should not add "path-based" entries
// '/assets/vendor/needed-vendor/file.css',
// '/assets/vendor/@scoped/needed-vendor/the/file2.css',
'needed-vendor/file.css',
'@scoped/needed-vendor/the/file2.css',
], array_values($importMapCssKeys));
// 2x from importmap.php: so they should, of course, be here.
// But our compiler should not add "path-based" entries
// '/assets/vendor/needed-vendor/file.css',
// '/assets/vendor/@scoped/needed-vendor/the/file2.css',
'needed-vendor/file.css',
'@scoped/needed-vendor/the/file2.css',
], array_values($importMapCssKeys));
// "app" is the entry. So, all non-lazy controllers should be preloaded:
$preLoadHrefs = $crawler->filter('link[rel="modulepreload"]')->each(static function ($link) {
return $link->attr('href');
});
$this->assertCount(12, $preLoadHrefs);
sort($preLoadHrefs);
$this->assertStringStartsWith('/assets/@symfony/stimulus-bundle/controllers-', $preLoadHrefs[0]);
$this->assertStringStartsWith('/assets/@symfony/stimulus-bundle/loader-', $preLoadHrefs[1]);
$this->assertStringStartsWith('/assets/controllers/hello-with-dashes-controller-', $preLoadHrefs[3]);
$this->assertStringStartsWith('/assets/controllers/hello_with_underscores-controller-', $preLoadHrefs[4]);
$this->assertStringStartsWith('/assets/controllers/subdir/deeper-controller-', $preLoadHrefs[5]);
$this->assertStringStartsWith('/assets/controllers/subdir/deeper-with-dashes-controller-', $preLoadHrefs[6]);
$this->assertStringStartsWith('/assets/controllers/subdir/deeper_with_underscores-controller-', $preLoadHrefs[7]);
$this->assertStringStartsWith('/assets/controllers/typescript-controller-', $preLoadHrefs[8]);
$this->assertStringStartsWith('/assets/fake-vendor/ux-package2/package-hello-controller-', $preLoadHrefs[9]);
$this->assertStringStartsWith('/assets/more-controllers/hello-controller-', $preLoadHrefs[10]);
$this->assertStringStartsWith('/assets/vendor/@hotwired/stimulus/stimulus.index', $preLoadHrefs[11]);
} else {
// legacy
$this->assertSame([
// 1x import from loader.js (which is aliased to @symfony/stimulus-bundle via importmap)
'/assets/@symfony/stimulus-bundle/controllers.js',
// 6x from "controllers" (hello is overridden)
'/assets/controllers/bye_controller.js',
'/assets/controllers/hello-with-dashes-controller.js',
'/assets/controllers/hello_with_underscores-controller.js',
'/assets/controllers/subdir/deeper-controller.js',
'/assets/controllers/subdir/deeper-with-dashes-controller.js',
'/assets/controllers/subdir/deeper_with_underscores-controller.js',
// 2x from UX packages, which are enabled in controllers.json
'/assets/fake-vendor/ux-package1/package-controller-second.js',
'/assets/fake-vendor/ux-package2/package-hello-controller.js',
// 2x from more-controllers
'/assets/more-controllers/hello-controller.js',
'/assets/more-controllers/other-controller.js',
// 5x from importmap.php
'@hotwired/stimulus',
'@scoped/needed-vendor',
'@symfony/stimulus-bundle',
'app',
'needed-vendor',
], $importMapKeys);
// "app" & loader.js are pre-loaded. So, all non-lazy controllers should be preloaded:
$preLoadHrefs = $crawler->filter('link[rel="modulepreload"]')->each(static function ($link) {
return $link->attr('href');
});
$this->assertCount(10, $preLoadHrefs);
sort($preLoadHrefs);
$this->assertStringStartsWith('/assets/@symfony/stimulus-bundle/controllers-', $preLoadHrefs[0]);
$this->assertStringStartsWith('/assets/@symfony/stimulus-bundle/loader-', $preLoadHrefs[1]);
$this->assertStringStartsWith('/assets/controllers/hello-with-dashes-controller-', $preLoadHrefs[2]);
$this->assertStringStartsWith('/assets/controllers/hello_with_underscores-controller-', $preLoadHrefs[3]);
$this->assertStringStartsWith('/assets/controllers/subdir/deeper-controller-', $preLoadHrefs[4]);
$this->assertStringStartsWith('/assets/controllers/subdir/deeper-with-dashes-controller-', $preLoadHrefs[5]);
$this->assertStringStartsWith('/assets/controllers/subdir/deeper_with_underscores-controller-', $preLoadHrefs[6]);
$this->assertStringStartsWith('/assets/fake-vendor/ux-package2/package-hello-controller-', $preLoadHrefs[7]);
$this->assertStringStartsWith('/assets/more-controllers/hello-controller-', $preLoadHrefs[8]);
}
// "app" is the entry. So, all non-lazy controllers should be preloaded:
$preLoadHrefs = $crawler->filter('link[rel="modulepreload"]')->each(static function ($link) {
return $link->attr('href');
});
$this->assertCount(12, $preLoadHrefs);
sort($preLoadHrefs);
$this->assertStringStartsWith('/assets/@symfony/stimulus-bundle/controllers-', $preLoadHrefs[0]);
$this->assertStringStartsWith('/assets/@symfony/stimulus-bundle/loader-', $preLoadHrefs[1]);
$this->assertStringStartsWith('/assets/controllers/hello-with-dashes-controller-', $preLoadHrefs[3]);
$this->assertStringStartsWith('/assets/controllers/hello_with_underscores-controller-', $preLoadHrefs[4]);
$this->assertStringStartsWith('/assets/controllers/subdir/deeper-controller-', $preLoadHrefs[5]);
$this->assertStringStartsWith('/assets/controllers/subdir/deeper-with-dashes-controller-', $preLoadHrefs[6]);
$this->assertStringStartsWith('/assets/controllers/subdir/deeper_with_underscores-controller-', $preLoadHrefs[7]);
$this->assertStringStartsWith('/assets/controllers/typescript-controller-', $preLoadHrefs[8]);
$this->assertStringStartsWith('/assets/fake-vendor/ux-package2/package-hello-controller-', $preLoadHrefs[9]);
$this->assertStringStartsWith('/assets/more-controllers/hello-controller-', $preLoadHrefs[10]);
$this->assertStringStartsWith('/assets/vendor/@hotwired/stimulus/stimulus.index', $preLoadHrefs[11]);
}
protected static function getKernelClass(): string
+2 -3
View File
@@ -11,6 +11,7 @@
namespace Symfony\UX\StimulusBundle\Tests\Dto;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\UX\StimulusBundle\Dto\StimulusAttributes;
use Twig\Environment;
@@ -149,9 +150,7 @@ final class StimulusAttributesTest extends TestCase
$this->assertSame(['foo' => 'bar baz'], $this->stimulusAttributes->toArray());
}
/**
* @dataProvider provideAddComplexActionData
*/
#[DataProvider('provideAddComplexActionData')]
public function testAddComplexAction(string $controllerName, string $actionName, ?string $eventName, string $expectedAction)
{
$this->stimulusAttributes->addAction($controllerName, $actionName, $eventName);
+4 -9
View File
@@ -11,6 +11,7 @@
namespace Symfony\UX\StimulusBundle\Tests\Twig;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\UX\StimulusBundle\Helper\StimulusHelper;
use Symfony\UX\StimulusBundle\Tests\StimulusIntegrationTestKernel;
@@ -29,9 +30,7 @@ final class StimulusTwigExtensionTest extends TestCase
$this->twig = $container->get(Environment::class);
}
/**
* @dataProvider provideRenderStimulusController
*/
#[DataProvider('provideRenderStimulusController')]
public function testRenderStimulusController(string $controllerName, array $controllerValues, array $controllerClasses, array $controllerOutlets, string $expectedString, array $expectedArray)
{
$extension = new StimulusTwigExtension(new StimulusHelper($this->twig));
@@ -140,9 +139,7 @@ final class StimulusTwigExtensionTest extends TestCase
);
}
/**
* @dataProvider provideRenderStimulusAction
*/
#[DataProvider('provideRenderStimulusAction')]
public function testRenderStimulusAction(string $controllerName, ?string $actionName, ?string $eventName, array $parameters, string $expectedString, array $expectedArray)
{
$extension = new StimulusTwigExtension(new StimulusHelper($this->twig));
@@ -218,9 +215,7 @@ final class StimulusTwigExtensionTest extends TestCase
);
}
/**
* @dataProvider provideRenderStimulusTarget
*/
#[DataProvider('provideRenderStimulusTarget')]
public function testRenderStimulusTarget(string $controllerName, ?string $targetName, string $expectedString, array $expectedArray)
{
$extension = new StimulusTwigExtension(new StimulusHelper($this->twig));
@@ -1,93 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\UX\StimulusBundle\Tests\Twig;
use PHPUnit\Framework\TestCase;
use Symfony\Component\AssetMapper\AssetMapperInterface;
use Symfony\Component\AssetMapper\ImportMap\ImportMapConfigReader;
use Symfony\Component\AssetMapper\MappedAsset;
use Symfony\UX\StimulusBundle\AssetMapper\ControllersMapGenerator;
use Symfony\UX\StimulusBundle\Twig\UxControllersTwigRuntime;
use Symfony\UX\StimulusBundle\Ux\UxPackageReader;
class UxControllersTwigRuntimeTest extends TestCase
{
/**
* @group legacy
*/
public function testRenderLinkTags()
{
if (class_exists(ImportMapConfigReader::class)) {
$this->markTestSkipped('Skip test for AssetMapper 6.4+');
}
$controllersMapGenerator = $this->createMock(ControllersMapGenerator::class);
$controllersMapGenerator->expects($this->any())
->method('getControllersJsonPath')
->willReturn(__DIR__.'/../fixtures/assets/controllers.json')
;
$assetMapper = $this->createMock(AssetMapperInterface::class);
$assetMapper->expects($this->any())
->method('getAsset')
->willReturnCallback(static function ($path) {
if (str_starts_with($path, 'in/asset/mapper')) {
return new MappedAsset(basename($path), publicPath: '/assets/mapper/'.basename($path));
}
if (str_starts_with($path, '@fake-vendor/ux-package1')) {
return new MappedAsset('fake-vendor/ux-package1/'.basename($path), publicPath: '/assets/@fake-vendor/ux-package1/'.basename($path));
}
return null;
});
$runtime = new UxControllersTwigRuntime(
$controllersMapGenerator,
$assetMapper,
new UxPackageReader(__DIR__.'/../fixtures'),
__DIR__.'/../fixtures/legacy'
);
$this->assertStringNotContainsString(
'controller_first.css',
$runtime->renderLinkTags()
);
$this->assertStringContainsString(
'href="/assets/mapper/controller_second1.css"',
$runtime->renderLinkTags()
);
$this->assertStringNotContainsString(
'controller_second2.css',
$runtime->renderLinkTags()
);
$this->assertStringContainsString(
'href="/assets/@fake-vendor/ux-package1/styles.css"',
$runtime->renderLinkTags()
);
$this->assertStringContainsString(
'href="https://cdn.jsdelivr.net/npm/needed-vendor@3.2.0/file.css"',
$runtime->renderLinkTags()
);
$this->assertStringContainsString(
'href="https://cdn.jsdelivr.net/npm/scoped/needed-vendor@1.2.3/the/file2.css"',
$runtime->renderLinkTags()
);
// loop through a controllers.json file with several autoimports
// cases for the assets:
// 1) asset path is in the pipeline
// 2) path starts with the "package name" (try with scoped and non-scoped)
// then look right inside the package
// 3) look inside importmap.php for a "url" package and map to jsdelivr
}
}
+17
View File
@@ -0,0 +1,17 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Component\ErrorHandler\ErrorHandler;
require __DIR__.'/../vendor/autoload.php';
// @see https://github.com/symfony/symfony/issues/53812
ErrorHandler::register(null, false);
+1 -2
View File
@@ -15,7 +15,6 @@ use Psr\Log\NullLogger;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Bundle\TwigBundle\TwigBundle;
use Symfony\Component\AssetMapper\ImportMap\ImportMapConfigReader;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\HttpFoundation\Response;
@@ -60,7 +59,7 @@ class StimulusTestKernel extends Kernel
__DIR__.'/vendor/fake-vendor/ux-package2/Resources/assets/dist' => 'fake-vendor/ux-package2',
],
// @legacy
'importmap_path' => '%kernel.project_dir%/'.(class_exists(ImportMapConfigReader::class) ? 'importmap.php' : 'legacy/importmap.php'),
'importmap_path' => '%kernel.project_dir%/importmap.php',
],
'test' => true,
...(self::VERSION_ID >= 60200 ? [
-30
View File
@@ -1,30 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
// @legacy for AssetMapper 6.3 support
return [
'app' => [
'path' => 'app.js',
'entrypoint' => true,
],
'@hotwired/stimulus' => [
'url' => 'https://ga.jspm.io/npm:@hotwired/stimulus@3.2.1/dist/stimulus.js',
],
'@symfony/stimulus-bundle' => [
'path' => '@symfony/stimulus-bundle/loader.js',
],
'needed-vendor' => [
'url' => 'https://cdn.jsdelivr.net/npm/needed-vendor@3.2.0/dist/needed-vendor+esm',
],
'@scoped/needed-vendor' => [
'url' => 'https://cdn.jsdelivr.net/npm/@scoped/needed-vendor@1.2.3',
],
];