diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist index 4fd55f8..e4a86a6 100644 --- a/.phpcs.xml.dist +++ b/.phpcs.xml.dist @@ -19,6 +19,7 @@ */docs/* */vendor/* */migrations/* + */tests/* diff --git a/README.md b/README.md index bf44e7b..aaa4852 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ This is all you need to start using Bundle! ## Basic usage -You may bundle any `node_module` or local script from your `resources/js` directory directly on the page. +You may import any `node_module` or local module from your `resources/js` directory directly on the page. ```html diff --git a/composer.json b/composer.json index 9830774..38eb72d 100644 --- a/composer.json +++ b/composer.json @@ -45,7 +45,8 @@ "spatie/laravel-ignition": "^2.3", "symfony/thanks": "^1.2", "orchestra/testbench": "^8.19", - "orchestra/testbench-dusk": "^8.19" + "orchestra/testbench-dusk": "^8.19", + "livewire/livewire": "^3.4" }, "config": { "allow-plugins": { diff --git a/composer.lock b/composer.lock index b0e21c0..53d9be5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4b0f3a83e9f9c38bc38faaa5c3c947ee", + "content-hash": "4e07ea978e97d44491daefd9be1f2fe1", "packages": [ { "name": "brick/math", @@ -2386,313 +2386,6 @@ ], "time": "2023-11-08T05:53:05+00:00" }, - { - "name": "spatie/backtrace", - "version": "1.5.3", - "source": { - "type": "git", - "url": "https://github.com/spatie/backtrace.git", - "reference": "483f76a82964a0431aa836b6ed0edde0c248e3ab" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/spatie/backtrace/zipball/483f76a82964a0431aa836b6ed0edde0c248e3ab", - "reference": "483f76a82964a0431aa836b6ed0edde0c248e3ab", - "shasum": "" - }, - "require": { - "php": "^7.3|^8.0" - }, - "require-dev": { - "ext-json": "*", - "phpunit/phpunit": "^9.3", - "spatie/phpunit-snapshot-assertions": "^4.2", - "symfony/var-dumper": "^5.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "Spatie\\Backtrace\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Freek Van de Herten", - "email": "freek@spatie.be", - "homepage": "https://spatie.be", - "role": "Developer" - } - ], - "description": "A better backtrace", - "homepage": "https://github.com/spatie/backtrace", - "keywords": [ - "Backtrace", - "spatie" - ], - "support": { - "source": "https://github.com/spatie/backtrace/tree/1.5.3" - }, - "funding": [ - { - "url": "https://github.com/sponsors/spatie", - "type": "github" - }, - { - "url": "https://spatie.be/open-source/support-us", - "type": "other" - } - ], - "time": "2023-06-28T12:59:17+00:00" - }, - { - "name": "spatie/flare-client-php", - "version": "1.4.3", - "source": { - "type": "git", - "url": "https://github.com/spatie/flare-client-php.git", - "reference": "5db2fdd743c3ede33f2a5367d89ec1a7c9c1d1ec" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/spatie/flare-client-php/zipball/5db2fdd743c3ede33f2a5367d89ec1a7c9c1d1ec", - "reference": "5db2fdd743c3ede33f2a5367d89ec1a7c9c1d1ec", - "shasum": "" - }, - "require": { - "illuminate/pipeline": "^8.0|^9.0|^10.0|^11.0", - "nesbot/carbon": "^2.62.1", - "php": "^8.0", - "spatie/backtrace": "^1.5.2", - "symfony/http-foundation": "^5.2|^6.0|^7.0", - "symfony/mime": "^5.2|^6.0|^7.0", - "symfony/process": "^5.2|^6.0|^7.0", - "symfony/var-dumper": "^5.2|^6.0|^7.0" - }, - "require-dev": { - "dms/phpunit-arraysubset-asserts": "^0.5.0", - "pestphp/pest": "^1.20|^2.0", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.0", - "spatie/phpunit-snapshot-assertions": "^4.0|^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.3.x-dev" - } - }, - "autoload": { - "files": [ - "src/helpers.php" - ], - "psr-4": { - "Spatie\\FlareClient\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Send PHP errors to Flare", - "homepage": "https://github.com/spatie/flare-client-php", - "keywords": [ - "exception", - "flare", - "reporting", - "spatie" - ], - "support": { - "issues": "https://github.com/spatie/flare-client-php/issues", - "source": "https://github.com/spatie/flare-client-php/tree/1.4.3" - }, - "funding": [ - { - "url": "https://github.com/spatie", - "type": "github" - } - ], - "time": "2023-10-17T15:54:07+00:00" - }, - { - "name": "spatie/ignition", - "version": "1.12.0", - "source": { - "type": "git", - "url": "https://github.com/spatie/ignition.git", - "reference": "5b6f801c605a593106b623e45ca41496a6e7d56d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/spatie/ignition/zipball/5b6f801c605a593106b623e45ca41496a6e7d56d", - "reference": "5b6f801c605a593106b623e45ca41496a6e7d56d", - "shasum": "" - }, - "require": { - "ext-json": "*", - "ext-mbstring": "*", - "php": "^8.0", - "spatie/backtrace": "^1.5.3", - "spatie/flare-client-php": "^1.4.0", - "symfony/console": "^5.4|^6.0|^7.0", - "symfony/var-dumper": "^5.4|^6.0|^7.0" - }, - "require-dev": { - "illuminate/cache": "^9.52|^10.0|^11.0", - "mockery/mockery": "^1.4", - "pestphp/pest": "^1.20|^2.0", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.0", - "psr/simple-cache-implementation": "*", - "symfony/cache": "^5.4|^6.0|^7.0", - "symfony/process": "^5.4|^6.0|^7.0", - "vlucas/phpdotenv": "^5.5" - }, - "suggest": { - "openai-php/client": "Require get solutions from OpenAI", - "simple-cache-implementation": "To cache solutions from OpenAI" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.5.x-dev" - } - }, - "autoload": { - "psr-4": { - "Spatie\\Ignition\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Spatie", - "email": "info@spatie.be", - "role": "Developer" - } - ], - "description": "A beautiful error page for PHP applications.", - "homepage": "https://flareapp.io/ignition", - "keywords": [ - "error", - "flare", - "laravel", - "page" - ], - "support": { - "docs": "https://flareapp.io/docs/ignition-for-laravel/introduction", - "forum": "https://twitter.com/flareappio", - "issues": "https://github.com/spatie/ignition/issues", - "source": "https://github.com/spatie/ignition" - }, - "funding": [ - { - "url": "https://github.com/spatie", - "type": "github" - } - ], - "time": "2024-01-03T15:49:39+00:00" - }, - { - "name": "spatie/laravel-ignition", - "version": "2.4.1", - "source": { - "type": "git", - "url": "https://github.com/spatie/laravel-ignition.git", - "reference": "005e1e7b1232f3b22d7e7be3f602693efc7dba67" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/005e1e7b1232f3b22d7e7be3f602693efc7dba67", - "reference": "005e1e7b1232f3b22d7e7be3f602693efc7dba67", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "ext-json": "*", - "ext-mbstring": "*", - "illuminate/support": "^10.0|^11.0", - "php": "^8.1", - "spatie/flare-client-php": "^1.3.5", - "spatie/ignition": "^1.9", - "symfony/console": "^6.2.3|^7.0", - "symfony/var-dumper": "^6.2.3|^7.0" - }, - "require-dev": { - "livewire/livewire": "^2.11|^3.3.5", - "mockery/mockery": "^1.5.1", - "openai-php/client": "^0.8.1", - "orchestra/testbench": "^8.0|^9.0", - "pestphp/pest": "^2.30", - "phpstan/extension-installer": "^1.2", - "phpstan/phpstan-deprecation-rules": "^1.1.1", - "phpstan/phpstan-phpunit": "^1.3.3", - "vlucas/phpdotenv": "^5.5" - }, - "suggest": { - "openai-php/client": "Require get solutions from OpenAI", - "psr/simple-cache-implementation": "Needed to cache solutions from OpenAI" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "Spatie\\LaravelIgnition\\IgnitionServiceProvider" - ], - "aliases": { - "Flare": "Spatie\\LaravelIgnition\\Facades\\Flare" - } - } - }, - "autoload": { - "files": [ - "src/helpers.php" - ], - "psr-4": { - "Spatie\\LaravelIgnition\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Spatie", - "email": "info@spatie.be", - "role": "Developer" - } - ], - "description": "A beautiful error page for Laravel applications.", - "homepage": "https://flareapp.io/ignition", - "keywords": [ - "error", - "flare", - "laravel", - "page" - ], - "support": { - "docs": "https://flareapp.io/docs/ignition-for-laravel/introduction", - "forum": "https://twitter.com/flareappio", - "issues": "https://github.com/spatie/laravel-ignition/issues", - "source": "https://github.com/spatie/laravel-ignition" - }, - "funding": [ - { - "url": "https://github.com/spatie", - "type": "github" - } - ], - "time": "2024-01-12T13:14:58+00:00" - }, { "name": "symfony/console", "version": "v6.4.2", @@ -6467,24 +6160,99 @@ "symfony/var-dumper": "^4.3.4|^5.0|^6.0|^7.0" }, "require-dev": { - "mockery/mockery": "~1.3.3|^1.4.2", - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^8.5.8|^9.3.3" - }, - "suggest": { - "illuminate/database": "The Illuminate Database package (^6.0|^7.0|^8.0|^9.0|^10.0|^11.0)." + "mockery/mockery": "~1.3.3|^1.4.2", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^8.5.8|^9.3.3" + }, + "suggest": { + "illuminate/database": "The Illuminate Database package (^6.0|^7.0|^8.0|^9.0|^10.0|^11.0)." + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Laravel\\Tinker\\TinkerServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Laravel\\Tinker\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "Powerful REPL for the Laravel framework.", + "keywords": [ + "REPL", + "Tinker", + "laravel", + "psysh" + ], + "support": { + "issues": "https://github.com/laravel/tinker/issues", + "source": "https://github.com/laravel/tinker/tree/v2.9.0" + }, + "time": "2024-01-04T16:10:04+00:00" + }, + { + "name": "livewire/livewire", + "version": "v3.4.1", + "source": { + "type": "git", + "url": "https://github.com/livewire/livewire.git", + "reference": "fd74e6b31c96c40bb36c99e79d5c62460b31ec6b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/livewire/livewire/zipball/fd74e6b31c96c40bb36c99e79d5c62460b31ec6b", + "reference": "fd74e6b31c96c40bb36c99e79d5c62460b31ec6b", + "shasum": "" + }, + "require": { + "illuminate/database": "^10.0|^11.0", + "illuminate/routing": "^10.0|^11.0", + "illuminate/support": "^10.0|^11.0", + "illuminate/validation": "^10.0|^11.0", + "league/mime-type-detection": "^1.9", + "php": "^8.1", + "symfony/http-kernel": "^6.2|^7.0" + }, + "require-dev": { + "calebporzio/sushi": "^2.1", + "laravel/framework": "^10.0|^11.0", + "laravel/prompts": "^0.1.6", + "mockery/mockery": "^1.3.1", + "orchestra/testbench": "8.20.0|^9.0", + "orchestra/testbench-dusk": "8.20.0|^9.0", + "phpunit/phpunit": "^10.4", + "psy/psysh": "^0.11.22|^0.12" }, "type": "library", "extra": { "laravel": { "providers": [ - "Laravel\\Tinker\\TinkerServiceProvider" - ] + "Livewire\\LivewireServiceProvider" + ], + "aliases": { + "Livewire": "Livewire\\Livewire" + } } }, "autoload": { + "files": [ + "src/helpers.php" + ], "psr-4": { - "Laravel\\Tinker\\": "src/" + "Livewire\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -6493,22 +6261,22 @@ ], "authors": [ { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" + "name": "Caleb Porzio", + "email": "calebporzio@gmail.com" } ], - "description": "Powerful REPL for the Laravel framework.", - "keywords": [ - "REPL", - "Tinker", - "laravel", - "psysh" - ], + "description": "A front-end framework for Laravel.", "support": { - "issues": "https://github.com/laravel/tinker/issues", - "source": "https://github.com/laravel/tinker/tree/v2.9.0" + "issues": "https://github.com/livewire/livewire/issues", + "source": "https://github.com/livewire/livewire/tree/v3.4.1" }, - "time": "2024-01-04T16:10:04+00:00" + "funding": [ + { + "url": "https://github.com/livewire", + "type": "github" + } + ], + "time": "2024-01-24T13:56:12+00:00" }, { "name": "mockery/mockery", @@ -9677,199 +9445,506 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/3.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T07:06:18+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "5.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "05909fb5bc7df4c52992396d0116aed689f93712" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/05909fb5bc7df4c52992396d0116aed689f93712", + "reference": "05909fb5bc7df4c52992396d0116aed689f93712", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "https://github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/5.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T07:05:40+00:00" + }, + { + "name": "sebastian/type", + "version": "4.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/462699a16464c3944eefc02ebdd77882bd3925bf", + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/4.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T07:10:45+00:00" + }, + { + "name": "sebastian/version", + "version": "4.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c51fa83a5d8f43f1402e3f32a005e6262244ef17", + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/4.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-07T11:34:05+00:00" + }, + { + "name": "spatie/backtrace", + "version": "1.5.3", + "source": { + "type": "git", + "url": "https://github.com/spatie/backtrace.git", + "reference": "483f76a82964a0431aa836b6ed0edde0c248e3ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/backtrace/zipball/483f76a82964a0431aa836b6ed0edde0c248e3ab", + "reference": "483f76a82964a0431aa836b6ed0edde0c248e3ab", + "shasum": "" + }, + "require": { + "php": "^7.3|^8.0" + }, + "require-dev": { + "ext-json": "*", + "phpunit/phpunit": "^9.3", + "spatie/phpunit-snapshot-assertions": "^4.2", + "symfony/var-dumper": "^5.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spatie\\Backtrace\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "name": "Freek Van de Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" } ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "description": "A better backtrace", + "homepage": "https://github.com/spatie/backtrace", + "keywords": [ + "Backtrace", + "spatie" + ], "support": { - "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/3.0.0" + "source": "https://github.com/spatie/backtrace/tree/1.5.3" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://github.com/sponsors/spatie", "type": "github" + }, + { + "url": "https://spatie.be/open-source/support-us", + "type": "other" } ], - "time": "2023-02-03T07:06:18+00:00" + "time": "2023-06-28T12:59:17+00:00" }, { - "name": "sebastian/recursion-context", - "version": "5.0.0", + "name": "spatie/flare-client-php", + "version": "1.4.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "05909fb5bc7df4c52992396d0116aed689f93712" + "url": "https://github.com/spatie/flare-client-php.git", + "reference": "5db2fdd743c3ede33f2a5367d89ec1a7c9c1d1ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/05909fb5bc7df4c52992396d0116aed689f93712", - "reference": "05909fb5bc7df4c52992396d0116aed689f93712", + "url": "https://api.github.com/repos/spatie/flare-client-php/zipball/5db2fdd743c3ede33f2a5367d89ec1a7c9c1d1ec", + "reference": "5db2fdd743c3ede33f2a5367d89ec1a7c9c1d1ec", "shasum": "" }, "require": { - "php": ">=8.1" + "illuminate/pipeline": "^8.0|^9.0|^10.0|^11.0", + "nesbot/carbon": "^2.62.1", + "php": "^8.0", + "spatie/backtrace": "^1.5.2", + "symfony/http-foundation": "^5.2|^6.0|^7.0", + "symfony/mime": "^5.2|^6.0|^7.0", + "symfony/process": "^5.2|^6.0|^7.0", + "symfony/var-dumper": "^5.2|^6.0|^7.0" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "dms/phpunit-arraysubset-asserts": "^0.5.0", + "pestphp/pest": "^1.20|^2.0", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1.0", + "spatie/phpunit-snapshot-assertions": "^4.0|^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "1.3.x-dev" } }, "autoload": { - "classmap": [ - "src/" - ] + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Spatie\\FlareClient\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } + "description": "Send PHP errors to Flare", + "homepage": "https://github.com/spatie/flare-client-php", + "keywords": [ + "exception", + "flare", + "reporting", + "spatie" ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { - "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/5.0.0" + "issues": "https://github.com/spatie/flare-client-php/issues", + "source": "https://github.com/spatie/flare-client-php/tree/1.4.3" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://github.com/spatie", "type": "github" } ], - "time": "2023-02-03T07:05:40+00:00" + "time": "2023-10-17T15:54:07+00:00" }, { - "name": "sebastian/type", - "version": "4.0.0", + "name": "spatie/ignition", + "version": "1.12.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/type.git", - "reference": "462699a16464c3944eefc02ebdd77882bd3925bf" + "url": "https://github.com/spatie/ignition.git", + "reference": "5b6f801c605a593106b623e45ca41496a6e7d56d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/462699a16464c3944eefc02ebdd77882bd3925bf", - "reference": "462699a16464c3944eefc02ebdd77882bd3925bf", + "url": "https://api.github.com/repos/spatie/ignition/zipball/5b6f801c605a593106b623e45ca41496a6e7d56d", + "reference": "5b6f801c605a593106b623e45ca41496a6e7d56d", "shasum": "" }, "require": { - "php": ">=8.1" + "ext-json": "*", + "ext-mbstring": "*", + "php": "^8.0", + "spatie/backtrace": "^1.5.3", + "spatie/flare-client-php": "^1.4.0", + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/var-dumper": "^5.4|^6.0|^7.0" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "illuminate/cache": "^9.52|^10.0|^11.0", + "mockery/mockery": "^1.4", + "pestphp/pest": "^1.20|^2.0", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1.0", + "psr/simple-cache-implementation": "*", + "symfony/cache": "^5.4|^6.0|^7.0", + "symfony/process": "^5.4|^6.0|^7.0", + "vlucas/phpdotenv": "^5.5" + }, + "suggest": { + "openai-php/client": "Require get solutions from OpenAI", + "simple-cache-implementation": "To cache solutions from OpenAI" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "4.0-dev" + "dev-main": "1.5.x-dev" } }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Spatie\\Ignition\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "Spatie", + "email": "info@spatie.be", + "role": "Developer" } ], - "description": "Collection of value objects that represent the types of the PHP type system", - "homepage": "https://github.com/sebastianbergmann/type", + "description": "A beautiful error page for PHP applications.", + "homepage": "https://flareapp.io/ignition", + "keywords": [ + "error", + "flare", + "laravel", + "page" + ], "support": { - "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/4.0.0" + "docs": "https://flareapp.io/docs/ignition-for-laravel/introduction", + "forum": "https://twitter.com/flareappio", + "issues": "https://github.com/spatie/ignition/issues", + "source": "https://github.com/spatie/ignition" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://github.com/spatie", "type": "github" } ], - "time": "2023-02-03T07:10:45+00:00" + "time": "2024-01-03T15:49:39+00:00" }, { - "name": "sebastian/version", - "version": "4.0.1", + "name": "spatie/laravel-ignition", + "version": "2.4.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17" + "url": "https://github.com/spatie/laravel-ignition.git", + "reference": "005e1e7b1232f3b22d7e7be3f602693efc7dba67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c51fa83a5d8f43f1402e3f32a005e6262244ef17", - "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17", + "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/005e1e7b1232f3b22d7e7be3f602693efc7dba67", + "reference": "005e1e7b1232f3b22d7e7be3f602693efc7dba67", "shasum": "" }, "require": { - "php": ">=8.1" + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "illuminate/support": "^10.0|^11.0", + "php": "^8.1", + "spatie/flare-client-php": "^1.3.5", + "spatie/ignition": "^1.9", + "symfony/console": "^6.2.3|^7.0", + "symfony/var-dumper": "^6.2.3|^7.0" + }, + "require-dev": { + "livewire/livewire": "^2.11|^3.3.5", + "mockery/mockery": "^1.5.1", + "openai-php/client": "^0.8.1", + "orchestra/testbench": "^8.0|^9.0", + "pestphp/pest": "^2.30", + "phpstan/extension-installer": "^1.2", + "phpstan/phpstan-deprecation-rules": "^1.1.1", + "phpstan/phpstan-phpunit": "^1.3.3", + "vlucas/phpdotenv": "^5.5" + }, + "suggest": { + "openai-php/client": "Require get solutions from OpenAI", + "psr/simple-cache-implementation": "Needed to cache solutions from OpenAI" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "4.0-dev" + "laravel": { + "providers": [ + "Spatie\\LaravelIgnition\\IgnitionServiceProvider" + ], + "aliases": { + "Flare": "Spatie\\LaravelIgnition\\Facades\\Flare" + } } }, "autoload": { - "classmap": [ - "src/" - ] + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Spatie\\LaravelIgnition\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "Spatie", + "email": "info@spatie.be", + "role": "Developer" } ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", + "description": "A beautiful error page for Laravel applications.", + "homepage": "https://flareapp.io/ignition", + "keywords": [ + "error", + "flare", + "laravel", + "page" + ], "support": { - "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/4.0.1" + "docs": "https://flareapp.io/docs/ignition-for-laravel/introduction", + "forum": "https://twitter.com/flareappio", + "issues": "https://github.com/spatie/laravel-ignition/issues", + "source": "https://github.com/spatie/laravel-ignition" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://github.com/spatie", "type": "github" } ], - "time": "2023-02-07T11:34:05+00:00" + "time": "2024-01-12T13:14:58+00:00" }, { "name": "spatie/laravel-ray", diff --git a/docs/index.md b/docs/index.md index 7b51bae..b17645e 100644 --- a/docs/index.md +++ b/docs/index.md @@ -33,7 +33,7 @@ This is all you need to start using Bundle! ## Basic usage -You may bundle any `node_module` or local script from your `resources/js` directory directly on the page. +You may import any `node_module` or local module from your `resources/js` directory directly on the page. ```html diff --git a/docs/integrations/alpinejs.md b/docs/integrations/alpinejs.md index c13a878..a9bce31 100644 --- a/docs/integrations/alpinejs.md +++ b/docs/integrations/alpinejs.md @@ -113,7 +113,7 @@ You can also import a module right inside a Alpine listener. For example: x-on:click=" let swal = await _import('swal') swal('Hello world!'); -" + " > Trigger Sweetalert dialog diff --git a/docs/introduction.md b/docs/introduction.md index 530efaa..3b9f7a7 100644 --- a/docs/introduction.md +++ b/docs/introduction.md @@ -35,14 +35,11 @@ A script tag with `type="module"` also makes it `defer` by default, so they are When you use the `` component Bundle constructs a small JS script that imports the desired module and exposes it on the page, along with the `_import` helper function. It then bundles it up and caches it in the `storage/app/bundle` directory. This is then either served over http or rendered inline. -
- -
+--> ## The `_import` helper function diff --git a/testbench.yaml b/testbench.yaml index 6fcf9e7..9f5e445 100644 --- a/testbench.yaml +++ b/testbench.yaml @@ -1,6 +1,7 @@ providers: - Workbench\App\Providers\WorkbenchServiceProvider - Leuverink\Bundle\ServiceProvider + - Livewire\LivewireServiceProvider workbench: start: "/" diff --git a/tests/Browser/AlpineIntegrationTest.php b/tests/Browser/AlpineInteropTest.php similarity index 91% rename from tests/Browser/AlpineIntegrationTest.php rename to tests/Browser/AlpineInteropTest.php index e1539cf..2ea414a 100644 --- a/tests/Browser/AlpineIntegrationTest.php +++ b/tests/Browser/AlpineInteropTest.php @@ -7,7 +7,7 @@ // Pest & Workbench Dusk don't play nicely together // We need to fall back to PHPUnit syntax. -class AlpineIntegrationTest extends DuskTestCase +class AlpineInteropTest extends DuskTestCase { /** @test */ public function it_can_bootstrap_alpine_via_iife_import() @@ -52,7 +52,7 @@ public function it_can_bootstrap_plugins_via_iife_import() } /** @test */ - public function it_can_use_other_imports_inside_x_init_directive() + public function it_can_use_imports_from_x_init() { $browser = $this->blade(<<< 'HTML' @@ -74,7 +74,7 @@ public function it_can_use_other_imports_inside_x_init_directive() $el.innerHTML = filtered[0].name " > - HTML)->pause(20); + HTML); // Doesn't raise console errors $this->assertEmpty($browser->driver->manage()->getLog('browser')); @@ -84,7 +84,7 @@ public function it_can_use_other_imports_inside_x_init_directive() } /** @test */ - public function it_can_use_other_imports_inside_x_data_directive() + public function it_can_use_imports_from_x_data() { $browser = $this->blade(<<< 'HTML' @@ -109,7 +109,7 @@ public function it_can_use_other_imports_inside_x_data_directive() } }" > - HTML)->pause(20); + HTML); // Doesn't raise console errors $this->assertEmpty($browser->driver->manage()->getLog('browser')); @@ -118,7 +118,7 @@ public function it_can_use_other_imports_inside_x_data_directive() } /** @test */ - public function it_can_use_other_imports_inside_x_click_directive() + public function it_can_use_imports_from_x_click_listener() { $browser = $this->blade(<<< 'HTML' @@ -141,7 +141,7 @@ public function it_can_use_other_imports_inside_x_click_directive() $el.innerHTML = filtered[0].name " >Click to change text - HTML)->pause(20); + HTML); $browser ->assertSeeIn('#component', 'Click to change text') @@ -154,7 +154,7 @@ public function it_can_use_other_imports_inside_x_click_directive() } /** @test */ - public function it_supports_backed_components_via_alpine_data() + public function it_supports_backed_components_with_alpine_data() { $this->markTestSkipped('not implemented'); @@ -168,7 +168,7 @@ public function it_supports_backed_components_via_alpine_data() x-text="message" id="component" > - HTML)->pause(20); + HTML); // Doesn't raise console errors $this->assertEmpty($browser->driver->manage()->getLog('browser')); diff --git a/tests/Browser/LivewireInteropTest.php b/tests/Browser/LivewireInteropTest.php new file mode 100644 index 0000000..3e41436 --- /dev/null +++ b/tests/Browser/LivewireInteropTest.php @@ -0,0 +1,197 @@ +serveLivewire(ImportsLodashFilter::class); + + $browser + ->assertScript('typeof window._import', 'function') + ->assertScript('typeof window.x_import_modules', 'object'); + } + + /** @test */ + public function it_imports_from_node_modules() + { + $browser = $this->serveLivewire(ImportsLodashFilter::class); + + $browser->assertScript('typeof window.x_import_modules.filter', 'object'); + } + + /** @test */ + public function it_imports_modules_inside_assets_directive() + { + $browser = $this->serveLivewire(ImportsLodashFilterInsideAssetsDirective::class); + + $browser + ->assertScript('typeof window._import', 'function') + ->assertScript('typeof window.x_import_modules', 'object') + ->assertScript('typeof window.x_import_modules.filter', 'object'); + } + + /** @test */ + public function it_can_use_imports_from_x_init() + { + $browser = $this->serveLivewire(CanUseImportsFromXInit::class); + + $browser->assertSeeIn('#component', 'Hello from x-init!'); + } + + /** @test */ + public function it_can_use_imports_from_x_data() + { + $browser = $this->serveLivewire(CanUseImportsFromXData::class); + + $browser->assertSeeIn('#component', 'Hello from x-data!'); + } + + /** @test */ + public function it_can_use_imports_from_x_click_listener() + { + $browser = $this->serveLivewire(CanUseImportsFromClickListener::class); + + $browser + ->assertSeeIn('#component', 'Click to change text') + ->press('#component') + ->assertSeeIn('#component', 'Hello from x-on:click!'); + } + + /** @test */ + public function it_can_use_imports_in_actions_using_one_time_js_expressions() + { + $browser = $this->serveLivewire(CanUseImportsFromAction::class); + + $browser + ->assertSeeIn('#component', 'Text changes when the Livewire action is invoked') + ->waitForLivewire()->click('@action') + ->assertSeeIn('#component', 'Hello from wire action!'); + } +} + +//-------------------------------------------------------------------------- +// Components +//-------------------------------------------------------------------------- +class ImportsLodashFilter extends Component +{ + public function render() + { + return <<< 'HTML' +
+ +
+ HTML; + } +} + +class ImportsLodashFilterInsideAssetsDirective extends Component +{ + public function render() + { + return <<< 'HTML' +
+ @assets + + @assets +
+ HTML; + } +} + +class CanUseImportsFromXInit extends Component +{ + public function render() + { + return <<< 'HTML' +
+ + +
+
+ HTML; + } +} + +class CanUseImportsFromXData extends Component +{ + public function render() + { + return <<< 'HTML' +
+ + +
+
+ HTML; + } +} + +class CanUseImportsFromClickListener extends Component +{ + public function render() + { + return <<< 'HTML' +
+ + + +
+ HTML; + } +} + +class CanUseImportsFromAction extends Component +{ + public function action() + { + $this->js(<<< 'JS' + const invoke = await _import('invoke') + + invoke(() => document.getElementById('component').innerHTML = 'Hello from wire action!') + JS); + } + + public function render() + { + return <<< 'HTML' +
+ + + + +
+ Text changes when the Livewire action is invoked +
+
+ HTML; + } +} diff --git a/tests/DuskTestCase.php b/tests/DuskTestCase.php index 61df0fa..4c8f0bb 100644 --- a/tests/DuskTestCase.php +++ b/tests/DuskTestCase.php @@ -2,12 +2,14 @@ namespace Leuverink\Bundle\Tests; +use Livewire\Livewire; use Laravel\Dusk\Browser; use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; use Orchestra\Testbench\Dusk\Options; use Orchestra\Testbench\Concerns\WithWorkbench; use Orchestra\Testbench\Dusk\TestCase as BaseTestCase; +use Orchestra\Testbench\Http\Middleware\VerifyCsrfToken; class DuskTestCase extends BaseTestCase { @@ -59,9 +61,10 @@ public function blade(string $blade) $page = Blade::render($blade); // Create a temporary route - $this->beforeServingApplication( - fn ($app) => $app->make(Route::class)::get('test-blade', fn () => $page) - ); + $this->beforeServingApplication(function ($app, $config) use ($page) { + $config->set('app.debug', true); + $app->make(Route::class)::get('test-blade', fn () => $page); + }); // Point Dusk to the temporary route & return the Browser for chaining $return = null; @@ -71,4 +74,38 @@ public function blade(string $blade) return $return; } + + /** + * Navigates the Dusk browser to a temporary route to a Livewire page component + * Then it returns the Browser object to continue chaining assertions. + */ + public function serveLivewire($component) + { + $this->artisan('livewire:layout'); + + // Create a temporary route + $this->beforeServingApplication(function ($app, $config) use (&$component) { + $config->set('app.debug', true); + $config->set('app.key', 'base64:q1fQla64BmAKJBOnRKuXvfddVoqEuSLv1eOEEO91uGI='); + + // Needs to register so component is findable in update calls + Livewire::component($component); + + // Disable CSRF check from update route + Livewire::setUpdateRoute(function ($handle) { + return Route::post('/livewire/update', $handle)->withoutMiddleware(VerifyCsrfToken::class); + }); + + // Register temporary Livewire route + $app->make(Route::class)::get('test-livewire', $component); + }); + + // Point Dusk to the temporary route & return the Browser for chaining + $return = null; + $this->browse(function (Browser $browser) use (&$return) { + $return = $browser->visit('test-livewire'); + }); + + return $return; + } } diff --git a/workbench/resources/js/invokes-callable.js b/workbench/resources/js/invokes-callable.js new file mode 100644 index 0000000..0e98cc3 --- /dev/null +++ b/workbench/resources/js/invokes-callable.js @@ -0,0 +1,3 @@ +export default function invoke(callable) { + callable(); +}