Skip to content

Commit

Permalink
Get data from locate call
Browse files Browse the repository at this point in the history
Instead of instantiate, which isn’t called when error is thrown from a
module.
  • Loading branch information
peteruithoven committed Aug 16, 2015
1 parent 47ef9f1 commit 4dbe06d
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,16 @@ System.normalize = function (path, importFrom) {
});
return promise;
};
var systemInstantiate = System.instantiate;
System.instantiate = function (load) {
return systemInstantiate.apply(this, arguments)
.then(function (result) {
var importData = imports[load.name];
importData.metadata = load.metadata;
var fromData = imports[importData.from];
if (fromData) {
fromData.deps.push(importData);
}
return result;
});

var systemLocate = System.locate;
System.locate = function (load) {
var importData = imports[load.name];
importData.metadata = load.metadata;
var fromData = imports[importData.from];
if (fromData) {
fromData.deps.push(importData);
}
return systemLocate.apply(this, arguments);
};

export function logImport (importData) {
Expand All @@ -34,7 +32,7 @@ export function logImport (importData) {
if (metaKey === 'deps') continue;
var metaValue = metadata[metaKey];
if (metaValue !== undefined) {
console.log(`${metaKey}:`,metaValue);
console.log(`${metaKey}:`, metaValue);
}
}
console.group(' deps: ', importData.deps.length);
Expand Down

0 comments on commit 4dbe06d

Please sign in to comment.