Combine process now wraps using module rather than only exports
- This will allow us to overwrite the 'exports' objectclosure/master
parent
27e3eb9370
commit
4987856a46
|
@ -84,13 +84,14 @@ for module in $CAT_MODULES; do
|
|||
|
||||
# each module must be enclosed in a closure to emulate a module
|
||||
echo "/** $module **/"
|
||||
echo "( function( exports )"
|
||||
echo "( function( module )"
|
||||
echo "{"
|
||||
echo " var exports = module.exports = {};"
|
||||
|
||||
# add the module, removing trailing commas
|
||||
cat $filename | $RMTRAIL
|
||||
|
||||
echo "} )( exports['$module'] = {} );"
|
||||
echo "} )( module['$module'] = {} );"
|
||||
done
|
||||
|
||||
# include tests?
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# #
|
||||
|
||||
exports.common = {
|
||||
module.common = { exports: {
|
||||
require: function ( id )
|
||||
{
|
||||
return require( id );
|
||||
}
|
||||
};
|
||||
} };
|
||||
|
||||
|
||||
function failAssertion( err )
|
||||
|
@ -37,7 +37,7 @@ function failAssertion( err )
|
|||
*
|
||||
* This contains only the used assertions
|
||||
*/
|
||||
exports.assert = {
|
||||
module.assert = { exports: {
|
||||
equal: function ( val, cmp, err )
|
||||
{
|
||||
if ( val !== cmp )
|
||||
|
@ -101,5 +101,5 @@ exports.assert = {
|
|||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
} };
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ var easejs = {};
|
|||
*
|
||||
* @type {Object.<string,Object>}
|
||||
*/
|
||||
var exports = {};
|
||||
var module = {};
|
||||
|
||||
/**
|
||||
* Returns the requested module
|
||||
|
@ -71,19 +71,19 @@ var easejs = {};
|
|||
var id_clean = module_id.replace( /^.\//, '' );
|
||||
|
||||
// attempt to retrieve the module
|
||||
var module = exports[ id_clean ];
|
||||
if ( module === undefined )
|
||||
var mod = module[ id_clean ];
|
||||
if ( mod === undefined )
|
||||
{
|
||||
throw "[ease.js] Undefined module: " + module_id;
|
||||
}
|
||||
|
||||
return module;
|
||||
return mod.exports;
|
||||
};
|
||||
|
||||
/**{CONTENT}**/
|
||||
|
||||
// the following should match the exports of /index.js
|
||||
ns_exports.Class = exports['class'];
|
||||
ns_exports.Interface = exports['interface'];
|
||||
ns_exports.Class = module['class'].exports;
|
||||
ns_exports.Interface = module['interface'].exports;
|
||||
} )( easejs );
|
||||
|
||||
|
|
Loading…
Reference in New Issue