aboutsummaryrefslogtreecommitdiff
path: root/thirdparty/systemjs/lib/bundles.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-04-20 03:09:25 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-04-24 16:14:29 +0200
commit82f2b76e25a4a67e01ec67e5ebe39d14ad771ea8 (patch)
tree965f6eb89b84d65a62b49008fd972c004832ccd1 /thirdparty/systemjs/lib/bundles.js
parente6e0cbc387c2a77b48e4065c229daa65bf1aa0fa (diff)
Reorganize module loading.
We now use webpack instead of SystemJS, effectively bundling modules into one file (plus commons chunks) for every entry point. This results in a much smaller extension size (almost half). Furthermore we use yarn/npm even for extension run-time dependencies. This relieves us from manually vendoring and building dependencies. It's also easier to understand for new developers familiar with node.
Diffstat (limited to 'thirdparty/systemjs/lib/bundles.js')
-rw-r--r--thirdparty/systemjs/lib/bundles.js73
1 files changed, 0 insertions, 73 deletions
diff --git a/thirdparty/systemjs/lib/bundles.js b/thirdparty/systemjs/lib/bundles.js
deleted file mode 100644
index c22a44986..000000000
--- a/thirdparty/systemjs/lib/bundles.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- System bundles
-
- Allows a bundle module to be specified which will be dynamically
- loaded before trying to load a given module.
-
- For example:
- SystemJS.bundles['mybundle'] = ['jquery', 'bootstrap/js/bootstrap']
-
- Will result in a load to "mybundle" whenever a load to "jquery"
- or "bootstrap/js/bootstrap" is made.
-
- In this way, the bundle becomes the request that provides the module
-*/
-
-(function() {
- // bundles support (just like RequireJS)
- // bundle name is module name of bundle itself
- // bundle is array of modules defined by the bundle
- // when a module in the bundle is requested, the bundle is loaded instead
- // of the form SystemJS.bundles['mybundle'] = ['jquery', 'bootstrap/js/bootstrap']
- hookConstructor(function(constructor) {
- return function() {
- constructor.call(this);
- this.bundles = {};
- this._loader.loadedBundles = {};
- };
- });
-
- // assign bundle metadata for bundle loads
- hook('locate', function(locate) {
- return function(load) {
- var loader = this;
- var matched = false;
-
- if (!(load.name in loader.defined))
- for (var b in loader.bundles) {
- for (var i = 0; i < loader.bundles[b].length; i++) {
- var curModule = loader.bundles[b][i];
-
- if (curModule == load.name) {
- matched = true;
- break;
- }
-
- // wildcard in bundles does not include / boundaries
- if (curModule.indexOf('*') != -1) {
- var parts = curModule.split('*');
- if (parts.length != 2) {
- loader.bundles[b].splice(i--, 1);
- continue;
- }
-
- if (load.name.substring(0, parts[0].length) == parts[0] &&
- load.name.substr(load.name.length - parts[1].length, parts[1].length) == parts[1] &&
- load.name.substr(parts[0].length, load.name.length - parts[1].length - parts[0].length).indexOf('/') == -1) {
- matched = true;
- break;
- }
- }
- }
-
- if (matched)
- return loader['import'](b)
- .then(function() {
- return locate.call(loader, load);
- });
- }
-
- return locate.call(loader, load);
- };
- });
-})();