enyojs/enyo — pull request #324 by kevinpschaaf (2013-06-27 10:05:59+00:00)
Title: GF-6936: On-device source packaging support

Overview of source mapping scheme:
* Adds -f (map from) and -t (mapto) parameters to minify.js, which are passed to walker
* Walker now passes a "chunks" array back to the minifier
* A chunk is either an object containing a `sheets` and `scripts` array, or a string path to a mapped package
* Scripts/sheets are added to the current chunk until a package matching a "mapfrom" key is reached
* When walker encounters a package matching a "mapfrom" key, it pushes the associated "mapto" string onto the chunks array, and then starts a new chunk
* When there is more than one chunk returned from the minifier, it minifies chunks of app code into numbered app[n].js/css files (otherwise all of the minified app code goes into app.js like normal)
* A top-level depends call is generated into "app.js", which interleaves local (app[n].js/css) files and mapped remote packages, preserving the order that the walker originally encountered them, as well as enyo.path mappings to the remote packages

Additional changes:
* Support for automatically generated "package aliases" has been removed from enyo.path and the minifier; it never worked so there's little risk of anyone relying on it
* Instead, enyo.path.rewrite was modified to allow matching not just tokens (i.e. $lib, $enyo), but also "token-paths", such as "$lib/enyo-ilib"; this requires sorting the array longest-to-shortest so that "$lib/enyo-ilib" matches before "$lib".
* The minifier was modified to accept a new -l (lib) property, to allow forcing the location the walker uses for $lib tokens to a specific location, rather than being relative to the -e enyo path. This allows us to minify apps that don't have an enyo folder at all (the case if you haven't initialized submodules, which the OE build still can't)