mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-26 07:14:35 +02:00
JavaScript: Fix dependency optimization
This commit is contained in:
parent
f18cb7d112
commit
7ea8ac7ccf
@ -243,14 +243,26 @@ class JavaScript
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('~^((?:\.\.?/)+)*(.*)~', $dependencyName, $natch)) {
|
$fileExtension = '.js';
|
||||||
|
$dirname = dirname($filePath);
|
||||||
|
if (preg_match('~^((?:\.\.?/)+)*.*?(\.\w+)?$~', $dependencyName, $natch)) {
|
||||||
|
if (! empty($natch[1])) {
|
||||||
|
$dependencyName = substr($dependencyName, strlen($natch[1]));
|
||||||
|
$dirname = realpath(join(DIRECTORY_SEPARATOR, [$dirname, $natch[1]]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($natch[2])) {
|
||||||
|
$dependencyName = substr($dependencyName, 0, -strlen($natch[2]));
|
||||||
|
$fileExtension = $natch[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$dependencyPath = join(DIRECTORY_SEPARATOR, [$dirname, $dependencyName . $fileExtension]);
|
||||||
|
if (file_exists($dependencyPath)) {
|
||||||
$dependencyName = join(DIRECTORY_SEPARATOR, array_filter([
|
$dependencyName = join(DIRECTORY_SEPARATOR, array_filter([
|
||||||
$packageName,
|
$packageName,
|
||||||
ltrim(substr(
|
trim(substr($dirname, strlen(realpath($basePath))), DIRECTORY_SEPARATOR . ' '),
|
||||||
realpath(join(DIRECTORY_SEPARATOR, [dirname($filePath), $natch[1]])),
|
$dependencyName
|
||||||
strlen(realpath($basePath))
|
|
||||||
), DIRECTORY_SEPARATOR),
|
|
||||||
$natch[2]
|
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user