Skip to content

Commit 243b8fd

Browse files
weaverryantgalopin
authored andcommitted
Upgrading all packages to Stimulus 3
1 parent 9a5f76b commit 243b8fd

File tree

10 files changed

+21
-13
lines changed

10 files changed

+21
-13
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# CHANGELOG
22

3-
## 1.4
3+
## 2.0
44

5+
- Support for `stimulus` version 2 was removed and support for `@hotwired/stimulus`
6+
version 3 was added. See the [@symfony/stimulus-bridge CHANGELOG](https://github.com/symfony/stimulus-bridge/blob/main/CHANGELOG.md#300)
7+
for more details.
58
- Support added for Symfony 6
69

710
## 1.3

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ Symfony UX Cropper.js allows you to extend its default behavior using a custom S
126126
```js
127127
// mycropper_controller.js
128128

129-
import { Controller } from 'stimulus';
129+
import { Controller } from '@hotwired/stimulus';
130130

131131
export default class extends Controller {
132132
connect() {

Resources/assets/dist/controller.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", {
1515
});
1616
exports["default"] = void 0;
1717

18-
var _stimulus = require("stimulus");
18+
var _stimulus = require("@hotwired/stimulus");
1919

2020
var _cropperjs = _interopRequireDefault(require("cropperjs"));
2121

@@ -37,7 +37,7 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
3737

3838
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
3939

40-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
40+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
4141

4242
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
4343

Resources/assets/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"peerDependencies": {
2626
"cropperjs": "^1.5.9",
27-
"stimulus": "^2.0.0"
27+
"@hotwired/stimulus": "^3.0.0"
2828
},
2929
"devDependencies": {
3030
"@babel/cli": "^7.12.1",
@@ -33,7 +33,7 @@
3333
"@babel/preset-env": "^7.12.7",
3434
"@symfony/stimulus-testing": "^1.1.0",
3535
"cropperjs": "^1.5.9",
36-
"stimulus": "^2.0.0"
36+
"@hotwired/stimulus": "^3.0.0"
3737
},
3838
"jest": {
3939
"testRegex": "test/.*\\.test.js",

Resources/assets/src/controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
'use strict';
1111

12-
import { Controller } from 'stimulus';
12+
import { Controller } from '@hotwired/stimulus';
1313
import Cropper from 'cropperjs';
1414

1515
export default class extends Controller {

Resources/assets/test/controller.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
'use strict';
1111

12-
import { Application, Controller } from 'stimulus';
12+
import { Application, Controller } from '@hotwired/stimulus';
1313
import { getByTestId, waitFor } from '@testing-library/dom';
1414
import { clearDOM, mountDOM } from '@symfony/stimulus-testing';
1515
import CropperjsController from '../dist/controller';

Tests/Kernel/AppKernelTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
*/
1919
trait AppKernelTrait
2020
{
21-
public function getCacheDir()
21+
public function getCacheDir(): string
2222
{
2323
return $this->createTmpDir('cache');
2424
}
2525

26-
public function getLogDir()
26+
public function getLogDir(): string
2727
{
2828
return $this->createTmpDir('logs');
2929
}

Tests/Kernel/EmptyAppKernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class EmptyAppKernel extends Kernel
2424
{
2525
use AppKernelTrait;
2626

27-
public function registerBundles()
27+
public function registerBundles(): iterable
2828
{
2929
return [new CropperjsBundle()];
3030
}

Tests/Kernel/FrameworkAppKernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class FrameworkAppKernel extends Kernel
2626
{
2727
use AppKernelTrait;
2828

29-
public function registerBundles()
29+
public function registerBundles(): iterable
3030
{
3131
return [new FrameworkBundle(), new CropperjsBundle()];
3232
}

Tests/Kernel/TwigAppKernel.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
1515
use Symfony\Bundle\TwigBundle\TwigBundle;
1616
use Symfony\Component\Config\Loader\LoaderInterface;
17+
use Symfony\Component\DependencyInjection\Alias;
1718
use Symfony\Component\DependencyInjection\ContainerBuilder;
19+
use Symfony\Component\Form\FormFactoryInterface;
1820
use Symfony\Component\HttpKernel\Kernel;
1921
use Symfony\UX\Cropperjs\CropperjsBundle;
2022

@@ -27,7 +29,7 @@ class TwigAppKernel extends Kernel
2729
{
2830
use AppKernelTrait;
2931

30-
public function registerBundles()
32+
public function registerBundles(): iterable
3133
{
3234
return [new FrameworkBundle(), new TwigBundle(), new CropperjsBundle()];
3335
}
@@ -37,6 +39,9 @@ public function registerContainerConfiguration(LoaderInterface $loader)
3739
$loader->load(function (ContainerBuilder $container) {
3840
$container->loadFromExtension('framework', ['secret' => '$ecret', 'test' => true]);
3941
$container->loadFromExtension('twig', ['default_path' => __DIR__.'/templates', 'strict_variables' => true, 'exception_controller' => null]);
42+
43+
// create a public alias - FormFactoryInterface is removed otherwise
44+
$container->setAlias('public_form_factory', new Alias(FormFactoryInterface::class, true));
4045
});
4146
}
4247
}

0 commit comments

Comments
 (0)