AbstractManifestAssetManager
API reference › Foxy › Asset › AbstractManifestAssetManager
2 subclasses
Provides the asset manifest handling shared by every asset manager: dependency merging, root package paths, and lock file detection.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$config protected constructor | Foxy\ | Foxy configuration. | AbstractManifestAssetManager |
$fs protected constructor | Composer\ | Filesystem used to resolve and update manifest paths. | AbstractManifestAssetManager |
$io protected constructor | Composer\ | Composer output used for progress messages. | AbstractManifestAssetManager |
$updatable protected | bool | Whether an existing frontend installation may be updated. Default: true. | AbstractManifestAssetManager |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Creates a manager with the services shared by asset manifest operations. | AbstractManifestAssetManager |
addDependencies() | Merges Composer asset dependencies into the frontend package manifest. | AbstractManifestAssetManager |
audit() abstract | Runs the security audit of the locked dependencies. | AssetManagerInterface |
getAuditParser() abstract | Returns the parser of this manager’s audit report. | AssetManagerInterface |
getLockPackageName() abstract | Get the filename of the lock file. | AssetManagerInterface |
getName() abstract | Get the name of asset manager. | AssetManagerInterface |
getPackageJsonPath() | Returns the frontend package manifest path. | AbstractManifestAssetManager |
getPackageName() | Returns the frontend package manifest filename. | AbstractManifestAssetManager |
getVersionConstraint() abstract | Get the supported version constraint of the asset manager. | AssetManagerInterface |
hasLockFile() | Returns whether the manager lock file exists. | AbstractManifestAssetManager |
isAvailable() abstract | Check if the asset manager is available. | AssetManagerInterface |
isInstalled() | Returns whether both the dependency directory and package manifest exist. | AbstractManifestAssetManager |
isUpdatable() | Returns whether an existing frontend installation may be updated. | AbstractManifestAssetManager |
run() abstract | Run the asset manager to install/update the asset dependencies. | AssetManagerInterface |
setUpdatable() | Enables or disables updates of an existing frontend installation. | AbstractManifestAssetManager |
validate() abstract | Validate the version of asset manager. | AssetManagerInterface |
actionWhenComposerDependenciesAreAlreadyInstalled() protected | Handles dependencies already present in the frontend installation. | AbstractManifestAssetManager |
actionWhenComposerDependenciesAreMerged() protected | Runs after the Composer asset dependencies are merged and before the asset package is written. | AbstractManifestAssetManager |
getLockFilePath() protected | Returns the manager lock-file path under the root package directory. | AbstractManifestAssetManager |
getManagerConfig() protected | Returns the configuration scoped to this manager, so manager-* map entries resolve to its own value. | AbstractManifestAssetManager |
getManagerWorkingDirectory() protected | Returns the configured manager working directory, or null to use the process default. | AbstractManifestAssetManager |
getNodeModulesPath() protected | Returns the node_modules path under the root package directory. | AbstractManifestAssetManager |
getRootPackageDir() protected | Returns the resolved root package directory. | AbstractManifestAssetManager |
getRootPackagePath() protected | Resolves a path under the root package directory. | AbstractManifestAssetManager |
Constants
Section titled “Constants”| Constant | Value | Description | Defined by |
|---|---|---|---|
NODE_MODULES_PATH | './node_modules' | AbstractManifestAssetManager |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”public function __construct(Composer\IO\IOInterface $io, Foxy\Config\Config $config, Composer\Util\Filesystem $fs)Creates a manager with the services shared by asset manifest operations.
Parameters
| Parameter | Type | Description |
|---|---|---|
$io | Composer\ | Composer output used for progress messages. |
$config | Foxy\ | Foxy configuration. |
$fs | Composer\ | Filesystem used to resolve and update manifest paths. |
addDependencies()
Section titled “addDependencies() ”public function addDependencies(Composer\Package\RootPackageInterface $rootPackage, array $dependencies): Foxy\Asset\AssetPackageInterfaceMerges Composer asset dependencies into the frontend package manifest.
Parameters
| Parameter | Type | Description |
|---|---|---|
$rootPackage | Composer\ | |
$dependencies | array |
Returns
Throws
Exception|Seld\JsonLint\ParsingException
getPackageJsonPath()
Section titled “getPackageJsonPath() ”public function getPackageJsonPath(): stringReturns the frontend package manifest path.
Returns
string
getPackageName()
Section titled “getPackageName() ”public function getPackageName(): stringReturns the frontend package manifest filename.
Returns
string
hasLockFile()
Section titled “hasLockFile() ”public function hasLockFile(): boolReturns whether the manager lock file exists.
Returns
bool
isInstalled()
Section titled “isInstalled() ”public function isInstalled(): boolReturns whether both the dependency directory and package manifest exist.
Returns
bool
isUpdatable()
Section titled “isUpdatable() ”public function isUpdatable(): boolReturns whether an existing frontend installation may be updated.
Returns
bool
setUpdatable()
Section titled “setUpdatable() ”public function setUpdatable(bool $updatable): staticEnables or disables updates of an existing frontend installation.
Parameters
| Parameter | Type | Description |
|---|---|---|
$updatable | bool |
Returns
static
actionWhenComposerDependenciesAreAlreadyInstalled()
Section titled “actionWhenComposerDependenciesAreAlreadyInstalled() ”protected function actionWhenComposerDependenciesAreAlreadyInstalled(list<string> $names): voidHandles dependencies already present in the frontend installation.
Parameters
| Parameter | Type | Description |
|---|---|---|
$names | list<string> | The asset package name of composer dependencies. |
actionWhenComposerDependenciesAreMerged()
Section titled “actionWhenComposerDependenciesAreMerged() ”protected function actionWhenComposerDependenciesAreMerged(Foxy\Asset\AssetPackageInterface $assetPackage, array<string, mixed> $previousDependencies): voidRuns after the Composer asset dependencies are merged and before the asset package is written.
Parameters
| Parameter | Type | Description |
|---|---|---|
$assetPackage | AssetPackageInterface | The asset package with the merged Composer dependencies. |
$previousDependencies | array<string, | The Composer asset dependencies declared before the merge. |
getLockFilePath()
Section titled “getLockFilePath() ”protected function getLockFilePath(): stringReturns the manager lock-file path under the root package directory.
Returns
string
getManagerConfig()
Section titled “getManagerConfig() ”protected function getManagerConfig(): Foxy\Config\ConfigReturns the configuration scoped to this manager, so manager-* map entries resolve to its own value.
The view is built on each call because getName() must not run from a constructor.
Returns
getManagerWorkingDirectory()
Section titled “getManagerWorkingDirectory() ”protected function getManagerWorkingDirectory(): string|nullReturns the configured manager working directory, or null to use the process default.
Returns
string|null
getNodeModulesPath()
Section titled “getNodeModulesPath() ”protected function getNodeModulesPath(): stringReturns the node_modules path under the root package directory.
Returns
string
getRootPackageDir()
Section titled “getRootPackageDir() ”protected function getRootPackageDir(): stringReturns the resolved root package directory.
Returns
string
getRootPackagePath()
Section titled “getRootPackagePath() ”protected function getRootPackagePath(string $path): stringResolves a path under the root package directory.
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string |
Returns
string