I did this, i have no idea yet if this works when it is compiled though:
/**
* Get File Contents Sync Mode
*
* @param {string} path
* @return {string}
*/
exports.getContents = function (path) {
var fs = require("fs"),
file = fs.readFileSync(path, "utf8");
return file;
};
/**
* Get Package Content Info
*
* @param {string} path "core.language" = "en"
* @param {string} defaultValue
* @return {mixed}
*/
exports.getPackageInfo = function(path, defaultValue) {
var ioFile = require('system/io/File.js');
var d = JSON.parse(ioFile.getContents(process.cwd() + "/package.json"));
if (path != null) {
var segments = path.split('.'),
o = d;
for (var prop in segments) {
if (o[segments[prop]]) {
o = o[segments[prop]];
} else {
o = null;
}
}
if (o === Object(o)) {
return o;
}
o = $.trim(o)
return o != "" ? o : defaultValue;
} else {
return d;
}
};