1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 04:42:40 +01:00

I guess this can support JS too.

This commit is contained in:
epriestley 2011-01-29 16:16:09 -08:00
parent 0c8b04d5a8
commit 3726a19113

View file

@ -111,12 +111,24 @@ foreach ($file_map as $path => $info) {
$package_map = array();
foreach ($package_spec as $name => $package) {
$hashes = array();
$type = null;
foreach ($package as $symbol) {
if (empty($hash_map[$symbol])) {
throw new Exception(
"Package specification for '{$name}' includes '{$symbol}', but that ".
"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];
}
$key = substr(md5(implode("\n", $hashes)), 0, 8);
@ -124,7 +136,7 @@ foreach ($package_spec as $name => $package) {
'name' => $name,
'symbols' => $package,
'uri' => '/res/pkg/'.$key.'/'.$name,
'type' => 'css', // TODO LOL
'type' => $type,
);
foreach ($package as $symbol) {
$package_map['reverse'][$symbol] = $key;