- WIP on asset's system
This commit is contained in:
parent
0ededba2f6
commit
35b28c311e
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace Picea\Asset\Action;
|
||||
|
||||
use Picea\Asset\Extension;
|
||||
use Picea\Compiler;
|
||||
use Picea\Compiler\Context;
|
||||
use Picea\Event\Extension\UrlBuildAssetEvent;
|
||||
use Picea\EventTrait;
|
||||
|
||||
class Install {
|
||||
|
||||
use EventTrait;
|
||||
|
||||
public function __construct(
|
||||
public InstallActionInterface $action,
|
||||
) { }
|
||||
|
||||
public function launch() : bool
|
||||
{
|
||||
$this->action->run();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace Picea\Asset\Action;
|
||||
|
||||
interface InstallActionInterface
|
||||
{
|
||||
public function run() : mixed;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Picea\Asset\Action;
|
||||
|
||||
class Symlink implements InstallActionInterface
|
||||
{
|
||||
public function run() : mixed
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Picea\Asset;
|
||||
|
||||
enum ActionPrepareEnum
|
||||
{
|
||||
case Copy;
|
||||
case Symlink;
|
||||
}
|
|
@ -11,18 +11,20 @@ class Asset {
|
|||
|
||||
use EventTrait;
|
||||
|
||||
public function __construct(
|
||||
null|Action\Install $install = null,
|
||||
) {}
|
||||
|
||||
public function registerExtension(Compiler $compiler) : self
|
||||
{
|
||||
$compiler->registerExtension(new Extension\ImportmapExtension());
|
||||
|
||||
$compiler->getExtensionFromToken('asset')->eventRegister(new class() implements UrlBuildAssetEvent {
|
||||
|
||||
/* $compiler->getExtensionFromToken('asset')->eventRegister(new class() implements UrlBuildAssetEvent {
|
||||
public function execute(string $uri, array $parameters = [], bool $appendVersion) : void
|
||||
{
|
||||
dump($uri);
|
||||
}
|
||||
|
||||
});
|
||||
}); */
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Picea\Asset\Source;
|
||||
|
||||
class Directory
|
||||
{
|
||||
public function __construct(
|
||||
public string $path,
|
||||
public int $order,
|
||||
) {}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace Picea\Asset\Source;
|
||||
|
||||
class File
|
||||
{
|
||||
|
||||
}
|
Loading…
Reference in New Issue