Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

Commit 4f23167

Browse files
committed
dynamicDeps trace
1 parent 88298e3 commit 4f23167

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

core/register-loader.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,15 @@ function traceLoad (loader, load, link) {
306306
loader.loads[load.key] = {
307307
key: load.key,
308308
deps: link.dependencies,
309+
dynamicDeps: [],
309310
depMap: link.depMap || {}
310311
};
311312
}
312313

314+
function traceDynamicLoad (loader, parentKey, key) {
315+
loader.loads[parentKey].dynamicDeps.push(key);
316+
}
317+
313318
/*
314319
* Convert a CJS module.exports into a valid object for new Module:
315320
*
@@ -344,7 +349,7 @@ function registerDeclarative (loader, load, link, declare) {
344349
locked = false;
345350

346351
return value;
347-
}, new ContextualLoader(loader, load.key));
352+
}, new ContextualLoader(loader, load));
348353

349354
link.setters = declared.setters;
350355
link.execute = declared.execute;
@@ -502,18 +507,17 @@ function ContextualLoader (loader, key) {
502507
this.loader = loader;
503508
this.key = this.id = key;
504509
}
505-
ContextualLoader.prototype.constructor = function () {
510+
/*ContextualLoader.prototype.constructor = function () {
506511
throw new TypeError('Cannot subclass the contextual loader only Reflect.Loader.');
507-
};
512+
};*/
508513
ContextualLoader.prototype.import = function (key) {
514+
if (loader.trace)
515+
traceDynamicLoad(loader, this.key, key);
509516
return this.loader.import(key, this.key);
510517
};
511-
ContextualLoader.prototype.resolve = function (key) {
518+
/*ContextualLoader.prototype.resolve = function (key) {
512519
return this.loader.resolve(key, this.key);
513-
};
514-
ContextualLoader.prototype.load = function (key) {
515-
return this.loader.load(key, this.key);
516-
};
520+
};*/
517521

518522
// this is the execution function bound to the Module namespace record
519523
function ensureEvaluate (loader, load, link, registry, state, seen) {

0 commit comments

Comments
 (0)