Skip to content

Commit

Permalink
First
Browse files Browse the repository at this point in the history
  • Loading branch information
peteruithoven committed Aug 15, 2015
0 parents commit 55e7c55
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.DS_Store
jspm_packages/*
31 changes: 31 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
System.config({
baseURL: "/",
defaultJSExtensions: true,
transpiler: "babel",
babelOptions: {
"optional": [
"runtime",
"optimisation.modules.system"
]
},
paths: {
"github:*": "jspm_packages/github/*",
"npm:*": "jspm_packages/npm/*"
},

map: {
"babel": "npm:[email protected]",
"babel-runtime": "npm:[email protected]",
"core-js": "npm:[email protected]",
"github:jspm/[email protected]": {
"process": "npm:[email protected]"
},
"npm:[email protected]": {
"process": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"fs": "github:jspm/[email protected]",
"process": "github:jspm/[email protected]"
}
}
});
60 changes: 60 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
var imports = {};
var systemNormalize = System.normalize;
System.normalize = function (path, importFrom) {
var promise = systemNormalize.apply(this, arguments);
promise.then(function (normalizedPath) {
imports[normalizedPath] = {
importPath: path,
path: normalizedPath,
from: importFrom,
deps: []
};
});
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;
});
};

export function logImport (importData) {
console.groupCollapsed(importData.importPath);
console.log('path: ', importData.path);
var metadata = importData.metadata;
for (let metaKey in metadata) {
if (metaKey === 'deps') continue;
var metaValue = metadata[metaKey];
if (metaValue !== undefined) {
console.log(`${metaKey}: ${metaValue}`);
}
}
console.group(' deps: ', importData.deps.length);
for (let depData of importData.deps) {
logImport(depData);
}
console.groupEnd();
console.groupEnd();
}
export function logImports () {
console.group('Imports');
for (let index in imports) {
var importData = imports[index];
// root imports?
if (importData.from === undefined) {
logImport(importData);
}
}
console.groupEnd();
}
export function getImports () {
return imports;
}
27 changes: 27 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "systemjs-debugger",
"version": "0.0.1",
"description": "SystemJS debugger",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/peteruithoven/systemjs-debugger.git"
},
"keywords": [
"systemjs",
"jspm"
],
"author": "Peter Uithoven",
"license": "MIT",
"jspm": {
"directories": {},
"devDependencies": {
"babel": "npm:babel-core@^5.8.21",
"babel-runtime": "npm:babel-runtime@^5.8.20",
"core-js": "npm:core-js@^1.0.0"
}
}
}

0 comments on commit 55e7c55

Please sign in to comment.