pull/85/head
nightwing 2015-04-12 21:56:12 +04:00 zatwierdzone przez nightwing
rodzic cb01f0e76f
commit d33f396a17
1 zmienionych plików z 6 dodań i 4 usunięć

Wyświetl plik

@ -315,11 +315,11 @@ function resolveModulePath(id, pathMap) {
testPath = "/" + testPath;
while (testPath) {
if (pathMap[testPath]) {
return pathMap[testPath] + (tail && "/" + tail);
return pathMap[testPath] + tail;
}
var i = testPath.lastIndexOf("/");
if (i === -1) break;
tail = testPath.substr(i + 1) + (tail && "/" + tail);
tail = testPath.substr(i) + tail;
testPath = testPath.slice(0, i);
}
return id;
@ -360,7 +360,7 @@ function wrapUMD(module) {
return;
}
console.log("wrapping module " + module.id);
module.source = 'define(function(require, exports, module) {\n'
+ 'var _ = {require: require, exports: exports, module: module};\n'
@ -375,13 +375,15 @@ function wrapUMD(module) {
+ ' if (typeof deps == "function") {\n'
+ ' m = deps; deps = [];\n'
+ ' }\n'
+ ' if (typeof m != "function") {\n'
+ ' deps = m; m = null;\n'
+ ' }\n'
+ ' var ret = m ? m.apply(_.module, deps.map(function(n){return _[n] || require(n)})) : deps\n'
+ ' if (ret) _.module.exports = ret;\n'
+ '}\n'
+ 'define.amd = true;'
+ module.source
+ '});';
}
function debugSrc(module) {