node-module-concat
Advanced tools
Comparing version 1.2.0 to 1.3.0
/********** Start module ${id}: ${path} **********/ | ||
__modules[${id}] = function() { | ||
var exports = {}, module = {"exports": exports}; | ||
__modules[${id}] = function(module, exports) { |
@@ -17,15 +17,15 @@ /* This header is placed at the beginning of the output file and defines the | ||
if(!__moduleIsCached[uid]) { | ||
// Populate the cache initially with an empty Object | ||
__modulesCache[uid] = {}; | ||
// Populate the cache initially with an empty `exports` Object | ||
__modulesCache[uid] = {"exports": {}, "loaded": false}; | ||
__moduleIsCached[uid] = true; | ||
if(uid === 0) { | ||
require.main = __modulesCache[uid]; | ||
} | ||
/* Note: if this module requires itself, or if its depenedencies | ||
require it, they will only see an empty Object for now */ | ||
// Now load the module | ||
var module = __modules[uid](); | ||
// Now copy the properties of the `module` into the module cache Object | ||
for(var key in module) { | ||
__modulesCache[uid][key] = module[key]; | ||
} | ||
__modules[uid](__modulesCache[uid], __modulesCache[uid].exports); | ||
__modulesCache[uid].loaded = true; | ||
} | ||
return __modulesCache[uid]; | ||
return __modulesCache[uid].exports; | ||
} | ||
@@ -32,0 +32,0 @@ /* This function is the replacement for all `__filename` references within a |
{ | ||
"name": "node-module-concat", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Node.js module concatenation library", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
var fs = require("fs") | ||
, hello = require("./lib/hello") | ||
, world = require("./lib/world"); | ||
, world = require("./lib/world") | ||
, func = require("./lib/func"); | ||
console.log(hello.hello + ", " + world.world); | ||
console.log(fs.readFileSync(__filename).toString() ); | ||
console.log(func() ); | ||
exports.hello = hello; | ||
exports.world = world; | ||
exports.func = func; | ||
console.log("index printing world.func:", world.func); | ||
if(require.main === module) { | ||
console.log("index is main!"); | ||
} else { | ||
console.log("index is **NOT** main!"); | ||
} |
exports.hello = "Hello"; | ||
console.log(require("./world")) | ||
exports.doneLoading = true; | ||
if(require.main === module) { | ||
console.log("hello module is main!!!!"); | ||
} | ||
console.log("hello's filename is", __filename); |
exports.world = "World"; | ||
exports.file = require("fs").readFileSync(__dirname + "/file.txt"); | ||
console.log("world printing hello", require("./hello")); | ||
exports.func = require("./func"); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15689
14
308