kopia lustrzana https://github.com/c9/core
include modules required via require.resolve in npm_build
rodzic
dbf4c64a9a
commit
68b133fa61
|
@ -50,6 +50,14 @@ var fs = require("fs");
|
|||
var convertPath = require("./copy").convertPath;
|
||||
var loaded, moduleMap, root;
|
||||
var ignore;
|
||||
// loader modules that have non static require
|
||||
var LOADERS = {
|
||||
"amd-loader": 1,
|
||||
"architect": 1,
|
||||
"server.js": 1,
|
||||
"vfs-local": 1,
|
||||
"architect-build/build": 1,
|
||||
};
|
||||
|
||||
function addModule(id, parent) {
|
||||
if (ignore && ignore(id)) return;
|
||||
|
@ -85,7 +93,7 @@ function addModule(id, parent) {
|
|||
moduleMap[key] = "";
|
||||
return;
|
||||
}
|
||||
var re = /require\s*\(([^\)]+)\)/g, m;
|
||||
var re = /require\s*(?:\.\s*resolve\s*)?\(([^\)]+)\)/g, m;
|
||||
var children = [];
|
||||
while ((m = re.exec(text))) {
|
||||
var name = m[1].trim();
|
||||
|
@ -104,11 +112,14 @@ function addModule(id, parent) {
|
|||
if (!m[3]) f = f.slice(0, -ext.length);
|
||||
children.push(dirname + f);
|
||||
});
|
||||
console.warn("adding drectory ", dirpath, "for", id);
|
||||
console.warn("adding drectory ", dirpath, "for", key);
|
||||
console.warn("----| " + m[0]);
|
||||
continue;
|
||||
} catch(e) {}
|
||||
}
|
||||
console.error("non static require ", name, "from", id);
|
||||
}
|
||||
var shortKey = key.replace(/\|[^|]+$/, "");
|
||||
if (!LOADERS[shortKey])
|
||||
console.error("non static require ", name, "from", shortKey);
|
||||
} else {
|
||||
children.push(name.slice(1, -1));
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue