mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-18 12:52:42 +01:00
I guess this can support JS too.
This commit is contained in:
parent
0c8b04d5a8
commit
3726a19113
1 changed files with 13 additions and 1 deletions
|
@ -111,12 +111,24 @@ foreach ($file_map as $path => $info) {
|
||||||
$package_map = array();
|
$package_map = array();
|
||||||
foreach ($package_spec as $name => $package) {
|
foreach ($package_spec as $name => $package) {
|
||||||
$hashes = array();
|
$hashes = array();
|
||||||
|
$type = null;
|
||||||
foreach ($package as $symbol) {
|
foreach ($package as $symbol) {
|
||||||
if (empty($hash_map[$symbol])) {
|
if (empty($hash_map[$symbol])) {
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
"Package specification for '{$name}' includes '{$symbol}', but that ".
|
"Package specification for '{$name}' includes '{$symbol}', but that ".
|
||||||
"symbol is not defined anywhere.");
|
"symbol is not defined anywhere.");
|
||||||
}
|
}
|
||||||
|
if ($type === null) {
|
||||||
|
$type = $runtime_map[$symbol]['type'];
|
||||||
|
} else {
|
||||||
|
$ntype = $runtime_map[$symbol]['type'];
|
||||||
|
if ($type !== $ntype) {
|
||||||
|
throw new Exception(
|
||||||
|
"Package specification for '{$name}' mixes resources of type ".
|
||||||
|
"'{$type}' with resources of type '{$ntype}'. Each package may only ".
|
||||||
|
"contain one type of resource.");
|
||||||
|
}
|
||||||
|
}
|
||||||
$hashes[] = $symbol.':'.$hash_map[$symbol];
|
$hashes[] = $symbol.':'.$hash_map[$symbol];
|
||||||
}
|
}
|
||||||
$key = substr(md5(implode("\n", $hashes)), 0, 8);
|
$key = substr(md5(implode("\n", $hashes)), 0, 8);
|
||||||
|
@ -124,7 +136,7 @@ foreach ($package_spec as $name => $package) {
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'symbols' => $package,
|
'symbols' => $package,
|
||||||
'uri' => '/res/pkg/'.$key.'/'.$name,
|
'uri' => '/res/pkg/'.$key.'/'.$name,
|
||||||
'type' => 'css', // TODO LOL
|
'type' => $type,
|
||||||
);
|
);
|
||||||
foreach ($package as $symbol) {
|
foreach ($package as $symbol) {
|
||||||
$package_map['reverse'][$symbol] = $key;
|
$package_map['reverse'][$symbol] = $key;
|
||||||
|
|
Loading…
Reference in a new issue