browserify-async-define
Advanced tools
Comparing version 2.0.2 to 2.0.3
34
index.js
@@ -31,3 +31,3 @@ var path = require('path'); | ||
previous[current[0]] = current[1]; | ||
return previous; | ||
return previous; | ||
}, {}); | ||
@@ -40,3 +40,3 @@ } | ||
return items.length >= 2 ? items : [item, item]; | ||
}); | ||
}); | ||
} | ||
@@ -48,3 +48,3 @@ | ||
return previous; | ||
}, {}); | ||
}, {}); | ||
} | ||
@@ -79,3 +79,3 @@ | ||
.join('\n'); | ||
var defines = d.map(function (t){ | ||
@@ -87,3 +87,3 @@ var label = t[1]; | ||
.join('\n'); | ||
return ["var asyncDefine = require('async-define');", requires, defines].join('\n'); | ||
@@ -110,5 +110,5 @@ } | ||
callback(null, info.path, bundle[0]); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
@@ -140,3 +140,3 @@ } | ||
if (value[1]) { | ||
obj[value[0]] = value[1]; | ||
obj[value[0]] = value[1]; | ||
} | ||
@@ -148,3 +148,3 @@ return obj; | ||
var removedDependenciesOnCurrentFile = {}; | ||
b.transform(transformer.requireTransform, { | ||
@@ -154,3 +154,4 @@ verbose: !!opts.verbose, | ||
removedDependencies: removedDependencies, | ||
removedDependenciesOnCurrentFile: removedDependenciesOnCurrentFile | ||
removedDependenciesOnCurrentFile: removedDependenciesOnCurrentFile, | ||
global: true | ||
}); | ||
@@ -162,3 +163,4 @@ | ||
removedDependencies: removedDependencies, | ||
removedDependenciesOnCurrentFile: removedDependenciesOnCurrentFile | ||
removedDependenciesOnCurrentFile: removedDependenciesOnCurrentFile, | ||
global: true | ||
}); | ||
@@ -168,3 +170,3 @@ | ||
var additional = Object.keys(removedDependencies).map(function (key){ | ||
return [key, | ||
return [key, | ||
removedDependencies[key].label + key.slice(removedDependencies[key].name.length), | ||
@@ -188,5 +190,5 @@ fileLookupTable[removedDependencies[key].name]] | ||
} | ||
var streamNumber = Object.keys(fileMap).length; | ||
bundlesToVirtualFiles(files, function (err, f, bundlePath){ | ||
@@ -212,3 +214,3 @@ if (err) { | ||
next(null, row); | ||
}, | ||
}, | ||
function (cb){ | ||
@@ -222,2 +224,2 @@ if (Object.keys(fileLookupTable).length) { | ||
})); | ||
} | ||
} |
{ | ||
"name": "browserify-async-define", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "Browserify plugin for async-define", | ||
"main": "index.js", | ||
"scripts": { | ||
"build-main": "browserify demo/main/main.js -o demo/dist/main.js -p [./index.js -d jquery:jquery20:demo/dist/jquery.js -d react:react014:demo/dist/react.js -d react-dom:reactDom014:demo/dist/react.js]", | ||
"build-bundle": "browserify demo/bundle/jquery.js -o demo/dist/jquerytest.js -p [./index.js -e demo/bundle/jquery.js:jquery]", | ||
"build-main": "browserify demo/main/main.js -o demo/dist/main.js -p [./index.js -d jquery:jquery20:demo/dist/jquery.js -d react:react014:demo/dist/react.js -d react-dom:reactDom014:demo/dist/react.js --verbose]", | ||
"build-bundle": "browserify demo/bundle/jquery.js -o demo/dist/jquerytest.js -p [./index.js -e demo/bundle/jquery.js:jquery --verbose]", | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
@@ -10,0 +10,0 @@ "serve": "http-server -p 9090 demo" |
@@ -14,3 +14,3 @@ var path = require('path'); | ||
out.push(body); | ||
if (sym){ | ||
if (sym){ | ||
out.push("return module.exports;"); | ||
@@ -51,2 +51,6 @@ } | ||
if (file.indexOf('asyncDefine.js') !== -1) { | ||
done(null, content); | ||
} | ||
var output = (deps.deps.length > 0 || file in exports) ? wrap(exports, deps, exports[file], content) : content | ||
@@ -57,3 +61,3 @@ | ||
var requireTransform = transformTools.makeRequireTransform("browserify-async-define-2", | ||
var requireTransform = transformTools.makeRequireTransform("browserify-async-define-2", | ||
{evaluateArguments: true}, | ||
@@ -64,3 +68,2 @@ function(args, transformOptions, done) { | ||
var first_segment = args[0].split('/')[0]; | ||
if (first_segment in depsObj){ | ||
@@ -83,2 +86,2 @@ transformOptions.config.verbose && console.log('factored out: ', args[0]); | ||
requireTransform: requireTransform | ||
}; | ||
}; |
12807
279