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