default main/gapp as a dependency for all files forcing it to the top
This commit is contained in:
parent
fa65c7c67f
commit
b5ad39ee08
7 changed files with 20 additions and 21 deletions
27
app.js
27
app.js
|
|
@ -47,12 +47,12 @@ function init(mod) {
|
|||
|
||||
let depcache = {};
|
||||
|
||||
function find_deps(path, seen = []) {
|
||||
function find_deps(path) {
|
||||
let cached = depcache[path];
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
let deps = [];
|
||||
let deps = [ "main/gapp" ];
|
||||
let lines = fs.readFileSync(`${dir}/src/${path}.js`)
|
||||
.toString()
|
||||
.split('\n');
|
||||
|
|
@ -60,21 +60,17 @@ function init(mod) {
|
|||
let dpos = line.indexOf('// dep:');
|
||||
if (dpos >= 0) {
|
||||
let dep = line.substring(dpos+7).trim().replace('.','/');
|
||||
if (seen.indexOf(dep) >= 0) {
|
||||
dbug.warn(`circular ${dep} from ${path}`);
|
||||
continue;
|
||||
}
|
||||
if (deps.indexOf(dep) < 0) {
|
||||
deps.push(dep);
|
||||
}
|
||||
let deep = find_deps(dep, seen);
|
||||
if (deep) {
|
||||
// deeper dependencies go first
|
||||
deps = [...deep, ...deps];
|
||||
}
|
||||
let deep = find_deps(dep);
|
||||
deps = deps.filter(p => deep.indexOf(p) < 0);
|
||||
// deeper dependencies go first
|
||||
deps = [...deep, ...deps];
|
||||
}
|
||||
}
|
||||
return deps.length ? deps : undefined;
|
||||
depcache[path] = deps;
|
||||
return deps;
|
||||
}
|
||||
|
||||
// process script dependencies, expand paths
|
||||
|
|
@ -94,7 +90,6 @@ function init(mod) {
|
|||
let deps = find_deps(path);
|
||||
if (deps) {
|
||||
// remove deps already in list
|
||||
// todo: promote filtered deps order in path array
|
||||
deps = deps.filter(p => nval.indexOf(p) < 0);
|
||||
let ppos = nval.indexOf(path);
|
||||
if (ppos < 0) {
|
||||
|
|
@ -479,18 +474,12 @@ const script = {
|
|||
"main/meta",
|
||||
],
|
||||
mesh : [
|
||||
"main/gapp",
|
||||
"moto/license",
|
||||
"&main/mesh"
|
||||
],
|
||||
mesh_work : [
|
||||
"main/gapp",
|
||||
"moto/license",
|
||||
"&mesh/work"
|
||||
],
|
||||
mesh_pool : [
|
||||
"main/gapp",
|
||||
"moto/license",
|
||||
"&mesh/pool"
|
||||
]
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
(function() {
|
||||
|
||||
// dep: ext.three
|
||||
gapp.register('add.three');
|
||||
|
||||
var MP = THREE.Mesh.prototype,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@ if (typeof(self) === 'undefined') {
|
|||
|
||||
(function () {
|
||||
|
||||
/** satisfy earcut, tween, etc **/
|
||||
|
||||
if (!self.module) self.module = { exports: {} };
|
||||
|
||||
/** debug and logging **/
|
||||
|
||||
let mark = Date.now();
|
||||
|
|
|
|||
|
|
@ -99,10 +99,11 @@ document.onreadystatechange = function() {
|
|||
|
||||
// finalize modules
|
||||
gapp.finalize("main.mesh", [
|
||||
"moto.license", // dep: moto.license
|
||||
"moto.webui", // dep: moto.webui
|
||||
"moto.client", // dep: moto.client
|
||||
"moto.broker", // dep: moto.broker
|
||||
"moto.space" // dep: moto.space
|
||||
"moto.space", // dep: moto.space
|
||||
]);
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
(function() {
|
||||
|
||||
gapp.finalize("mesh.pool", [
|
||||
"moto.license", // dep: moto.license
|
||||
"moto.worker" // dep: moto.worker
|
||||
]);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
// dep: ext.three
|
||||
// dep: ext.three-bgu
|
||||
gapp.finalize("mesh.work", [
|
||||
"moto.license", // dep: moto.license
|
||||
"moto.client" // dep: moto.client
|
||||
]);
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,10 @@
|
|||
app.license = terms.LICENSE;
|
||||
app.version = terms.VERSION;
|
||||
app.copyright = terms.COPYRIGHT;
|
||||
// satisfy resolver
|
||||
gapp.register('moto.license');
|
||||
// for earcut and other modules
|
||||
self.module = { exports: terms };
|
||||
(self.module = self.module || {}).exports = terms;
|
||||
}
|
||||
|
||||
})();
|
||||
|
|
|
|||
Loading…
Reference in a new issue