aboutsummaryrefslogtreecommitdiff
path: root/thirdparty/systemjs/index.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-10-10 03:50:11 +0200
committerFlorian Dold <florian.dold@gmail.com>2016-10-10 03:50:11 +0200
commitde4628b3a7e7618681a76c01d00c1632a96688cf (patch)
tree49d4d97cf1c591b8567c83aa2469522f7fa57d27 /thirdparty/systemjs/index.js
parent7989859ed6520d4e8d18f48545e5998bf66e253c (diff)
parent9af485a584e47fd503ed5c62b9f6482574715f1e (diff)
Merge commit '9af485a584e47fd503ed5c62b9f6482574715f1e' as 'thirdparty/systemjs'
Diffstat (limited to 'thirdparty/systemjs/index.js')
-rw-r--r--thirdparty/systemjs/index.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/thirdparty/systemjs/index.js b/thirdparty/systemjs/index.js
new file mode 100644
index 000000000..6a958ecff
--- /dev/null
+++ b/thirdparty/systemjs/index.js
@@ -0,0 +1,48 @@
+if (typeof Promise === 'undefined')
+ require('when/es6-shim/Promise');
+
+var version = require('./package.json').version;
+
+var isWindows = typeof process.platform != 'undefined' && process.platform.match(/^win/);
+
+// set transpiler paths in Node
+var nodeResolver = typeof process != 'undefined' && typeof require != 'undefined' && require.resolve;
+function configNodePath(loader, module, nodeModule, wildcard) {
+ if (loader.paths[module])
+ return;
+
+ var ext = wildcard ? '/package.json' : '';
+ try {
+ var match = nodeResolver(nodeModule + ext).replace(/\\/g, '/');
+ }
+ catch(e) {}
+
+ if (match)
+ loader.paths[module] = 'file://' + (isWindows ? '/' : '') + match.substr(0, match.length - ext.length) + (wildcard ? '/*.js' : '');
+}
+
+var SystemJSLoader = require('./dist/system.src').constructor;
+
+// standard class extend SystemJSLoader to SystemJSNodeLoader
+function SystemJSNodeLoader() {
+ SystemJSLoader.call(this);
+
+ if (nodeResolver) {
+ configNodePath(this, 'traceur', 'traceur/bin/traceur.js');
+ configNodePath(this, 'traceur-runtime', 'traceur/bin/traceur-runtime.js');
+ configNodePath(this, 'babel', 'babel-core/browser.js');
+ configNodePath(this, 'babel/external-helpers', 'babel-core/external-helpers.js');
+ configNodePath(this, 'babel-runtime/*', 'babel-runtime', true);
+ }
+}
+SystemJSNodeLoader.prototype = Object.create(SystemJSLoader.prototype);
+SystemJSNodeLoader.prototype.constructor = SystemJSNodeLoader;
+
+var System = new SystemJSNodeLoader();
+
+System.version = version + ' Node';
+
+if (typeof global != 'undefined')
+ global.System = global.SystemJS = System;
+
+module.exports = System;