Skip to content

Commit 55e7c55

Browse files
committed
First
0 parents  commit 55e7c55

File tree

4 files changed

+120
-0
lines changed

4 files changed

+120
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.DS_Store
2+
jspm_packages/*

config.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
System.config({
2+
baseURL: "/",
3+
defaultJSExtensions: true,
4+
transpiler: "babel",
5+
babelOptions: {
6+
"optional": [
7+
"runtime",
8+
"optimisation.modules.system"
9+
]
10+
},
11+
paths: {
12+
"github:*": "jspm_packages/github/*",
13+
"npm:*": "jspm_packages/npm/*"
14+
},
15+
16+
map: {
17+
"babel": "npm:[email protected]",
18+
"babel-runtime": "npm:[email protected]",
19+
"core-js": "npm:[email protected]",
20+
"github:jspm/[email protected]": {
21+
"process": "npm:[email protected]"
22+
},
23+
24+
"process": "github:jspm/[email protected]"
25+
},
26+
27+
"fs": "github:jspm/[email protected]",
28+
"process": "github:jspm/[email protected]"
29+
}
30+
}
31+
});

index.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
var imports = {};
2+
var systemNormalize = System.normalize;
3+
System.normalize = function (path, importFrom) {
4+
var promise = systemNormalize.apply(this, arguments);
5+
promise.then(function (normalizedPath) {
6+
imports[normalizedPath] = {
7+
importPath: path,
8+
path: normalizedPath,
9+
from: importFrom,
10+
deps: []
11+
};
12+
});
13+
return promise;
14+
};
15+
var systemInstantiate = System.instantiate;
16+
System.instantiate = function (load) {
17+
return systemInstantiate.apply(this, arguments)
18+
.then(function (result) {
19+
var importData = imports[load.name];
20+
importData.metadata = load.metadata;
21+
var fromData = imports[importData.from];
22+
if (fromData) {
23+
fromData.deps.push(importData);
24+
}
25+
return result;
26+
});
27+
};
28+
29+
export function logImport (importData) {
30+
console.groupCollapsed(importData.importPath);
31+
console.log('path: ', importData.path);
32+
var metadata = importData.metadata;
33+
for (let metaKey in metadata) {
34+
if (metaKey === 'deps') continue;
35+
var metaValue = metadata[metaKey];
36+
if (metaValue !== undefined) {
37+
console.log(`${metaKey}: ${metaValue}`);
38+
}
39+
}
40+
console.group(' deps: ', importData.deps.length);
41+
for (let depData of importData.deps) {
42+
logImport(depData);
43+
}
44+
console.groupEnd();
45+
console.groupEnd();
46+
}
47+
export function logImports () {
48+
console.group('Imports');
49+
for (let index in imports) {
50+
var importData = imports[index];
51+
// root imports?
52+
if (importData.from === undefined) {
53+
logImport(importData);
54+
}
55+
}
56+
console.groupEnd();
57+
}
58+
export function getImports () {
59+
return imports;
60+
}

package.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "systemjs-debugger",
3+
"version": "0.0.1",
4+
"description": "SystemJS debugger",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "https://github.com/peteruithoven/systemjs-debugger.git"
12+
},
13+
"keywords": [
14+
"systemjs",
15+
"jspm"
16+
],
17+
"author": "Peter Uithoven",
18+
"license": "MIT",
19+
"jspm": {
20+
"directories": {},
21+
"devDependencies": {
22+
"babel": "npm:babel-core@^5.8.21",
23+
"babel-runtime": "npm:babel-runtime@^5.8.20",
24+
"core-js": "npm:core-js@^1.0.0"
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)