Skip to content

Commit 07de898

Browse files
chore(*): prepare release 0.4.0
1 parent 63d4c5f commit 07de898

File tree

6 files changed

+109
-29
lines changed

6 files changed

+109
-29
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aurelia-framework",
3-
"version": "0.3.2",
3+
"version": "0.4.0",
44
"description": "The aurelia framework brings together all the required core aurelia libraries into a ready-to-go application-building platform.",
55
"keywords": [
66
"aurelia",

dist/amd/aurelia.js

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,33 @@ define(["exports", "aurelia-logging", "aurelia-dependency-injection", "aurelia-l
1414

1515
var logger = LogManager.getLogger("aurelia");
1616

17+
function loadPlugins(loader, plugins) {
18+
var toLoad = [], i, ii, current;
19+
20+
for (i = 0, ii = plugins.length; i < ii; ++i) {
21+
current = plugins[i];
22+
logger.debug("Loading plugin " + current.moduleId + ".");
23+
toLoad.push(loader.loadModule(current.moduleId).then(function (exportedValue) {
24+
if ("install" in exportedValue) {
25+
return exportedValue.install(current.config || {}).then(function () {
26+
logger.debug("Installed plugin " + current.moduleId + ".");
27+
});
28+
} else {
29+
logger.debug("Loaded plugin " + current.moduleId + ".");
30+
}
31+
}));
32+
}
33+
34+
return Promise.all(toLoad);
35+
}
36+
1737
var Aurelia = (function () {
1838
var Aurelia = function Aurelia(loader, container, resources) {
1939
this.loader = loader || Loader.createDefaultLoader();
2040
this.container = container || new Container();
2141
this.resources = resources || new ResourceRegistry();
2242
this.resourcesToLoad = [];
43+
this.plugins = [];
2344

2445
this.withInstance(Aurelia, this);
2546
this.withInstance(Loader, this.loader);
@@ -42,8 +63,8 @@ define(["exports", "aurelia-logging", "aurelia-dependency-injection", "aurelia-l
4263
return this;
4364
};
4465

45-
Aurelia.prototype.withPlugins = function (config, baseUrl) {
46-
logger.error("withPlugins is not yet implemented");
66+
Aurelia.prototype.withPlugin = function (moduleId, config) {
67+
this.plugins.push({ moduleId: moduleId, config: config });
4768
return this;
4869
};
4970

@@ -70,16 +91,18 @@ define(["exports", "aurelia-logging", "aurelia-dependency-injection", "aurelia-l
7091
logger.error("You must configure Aurelia with a BindingLanguage implementation.");
7192
}
7293

73-
return this.container.get(ResourceCoordinator).importResources(this.resourcesToLoad).then(function (resources) {
74-
resources.forEach(function (x) {
75-
return x.register(_this.resources);
94+
return loadPlugins(this.loader, this.plugins).then(function () {
95+
return _this.container.get(ResourceCoordinator).importResources(_this.resourcesToLoad).then(function (resources) {
96+
resources.forEach(function (x) {
97+
return x.register(_this.resources);
98+
});
99+
logger.info("Aurelia Started");
100+
return _this;
76101
});
77-
logger.info("Aurelia Started");
78-
return _this;
79102
});
80103
};
81104

82-
Aurelia.prototype.setRoot = function (root, transition, applicationHost) {
105+
Aurelia.prototype.setRoot = function (root, applicationHost) {
83106
var _this2 = this;
84107
if (!applicationHost || typeof applicationHost == "string") {
85108
this.host = document.getElementById(applicationHost || "applicationHost") || document.body;

dist/commonjs/aurelia.js

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,33 @@ var includeEventsIn = require('aurelia-event-aggregator').includeEventsIn;
1414

1515
var logger = LogManager.getLogger("aurelia");
1616

17+
function loadPlugins(loader, plugins) {
18+
var toLoad = [], i, ii, current;
19+
20+
for (i = 0, ii = plugins.length; i < ii; ++i) {
21+
current = plugins[i];
22+
logger.debug("Loading plugin " + current.moduleId + ".");
23+
toLoad.push(loader.loadModule(current.moduleId).then(function (exportedValue) {
24+
if ("install" in exportedValue) {
25+
return exportedValue.install(current.config || {}).then(function () {
26+
logger.debug("Installed plugin " + current.moduleId + ".");
27+
});
28+
} else {
29+
logger.debug("Loaded plugin " + current.moduleId + ".");
30+
}
31+
}));
32+
}
33+
34+
return Promise.all(toLoad);
35+
}
36+
1737
var Aurelia = (function () {
1838
var Aurelia = function Aurelia(loader, container, resources) {
1939
this.loader = loader || Loader.createDefaultLoader();
2040
this.container = container || new Container();
2141
this.resources = resources || new ResourceRegistry();
2242
this.resourcesToLoad = [];
43+
this.plugins = [];
2344

2445
this.withInstance(Aurelia, this);
2546
this.withInstance(Loader, this.loader);
@@ -42,8 +63,8 @@ var Aurelia = (function () {
4263
return this;
4364
};
4465

45-
Aurelia.prototype.withPlugins = function (config, baseUrl) {
46-
logger.error("withPlugins is not yet implemented");
66+
Aurelia.prototype.withPlugin = function (moduleId, config) {
67+
this.plugins.push({ moduleId: moduleId, config: config });
4768
return this;
4869
};
4970

@@ -70,16 +91,18 @@ var Aurelia = (function () {
7091
logger.error("You must configure Aurelia with a BindingLanguage implementation.");
7192
}
7293

73-
return this.container.get(ResourceCoordinator).importResources(this.resourcesToLoad).then(function (resources) {
74-
resources.forEach(function (x) {
75-
return x.register(_this.resources);
94+
return loadPlugins(this.loader, this.plugins).then(function () {
95+
return _this.container.get(ResourceCoordinator).importResources(_this.resourcesToLoad).then(function (resources) {
96+
resources.forEach(function (x) {
97+
return x.register(_this.resources);
98+
});
99+
logger.info("Aurelia Started");
100+
return _this;
76101
});
77-
logger.info("Aurelia Started");
78-
return _this;
79102
});
80103
};
81104

82-
Aurelia.prototype.setRoot = function (root, transition, applicationHost) {
105+
Aurelia.prototype.setRoot = function (root, applicationHost) {
83106
var _this2 = this;
84107
if (!applicationHost || typeof applicationHost == "string") {
85108
this.host = document.getElementById(applicationHost || "applicationHost") || document.body;

dist/es6/aurelia.js

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,33 @@ import {EventAggregator, includeEventsIn} from 'aurelia-event-aggregator';
66

77
var logger = LogManager.getLogger('aurelia');
88

9+
function loadPlugins(loader, plugins){
10+
var toLoad = [], i, ii, current;
11+
12+
for(i = 0, ii = plugins.length; i < ii; ++i){
13+
current = plugins[i];
14+
logger.debug(`Loading plugin ${current.moduleId}.`);
15+
toLoad.push(loader.loadModule(current.moduleId).then(exportedValue => {
16+
if('install' in exportedValue){
17+
return exportedValue.install(current.config || {}).then(() =>{
18+
logger.debug(`Installed plugin ${current.moduleId}.`);
19+
});
20+
}else{
21+
logger.debug(`Loaded plugin ${current.moduleId}.`);
22+
}
23+
}));
24+
}
25+
26+
return Promise.all(toLoad);
27+
}
28+
929
export class Aurelia {
1030
constructor(loader, container, resources){
1131
this.loader = loader || Loader.createDefaultLoader();
1232
this.container = container || new Container();
1333
this.resources = resources || new ResourceRegistry();
1434
this.resourcesToLoad = [];
35+
this.plugins = [];
1536

1637
this.withInstance(Aurelia, this);
1738
this.withInstance(Loader, this.loader);
@@ -34,8 +55,8 @@ export class Aurelia {
3455
return this;
3556
}
3657

37-
withPlugins(config, baseUrl){
38-
logger.error('withPlugins is not yet implemented');
58+
withPlugin(moduleId, config){
59+
this.plugins.push({moduleId:moduleId, config:config});
3960
return this;
4061
}
4162

@@ -61,17 +82,17 @@ export class Aurelia {
6182
logger.error('You must configure Aurelia with a BindingLanguage implementation.');
6283
}
6384

64-
//TODO: configure plugins
65-
66-
return this.container.get(ResourceCoordinator)
67-
.importResources(this.resourcesToLoad).then(resources => {
68-
resources.forEach(x => x.register(this.resources));
69-
logger.info('Aurelia Started');
70-
return this;
71-
});
85+
return loadPlugins(this.loader, this.plugins).then(() => {
86+
return this.container.get(ResourceCoordinator)
87+
.importResources(this.resourcesToLoad).then(resources => {
88+
resources.forEach(x => x.register(this.resources));
89+
logger.info('Aurelia Started');
90+
return this;
91+
});
92+
});
7293
}
7394

74-
setRoot(root, transition, applicationHost){
95+
setRoot(root, applicationHost){
7596
if (!applicationHost || typeof applicationHost == 'string') {
7697
this.host = document.getElementById(applicationHost || 'applicationHost') || document.body;
7798
} else {

doc/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
## 0.4.0 (2014-12-22)
2+
3+
4+
#### Bug Fixes
5+
6+
* **package:** update templating to latest version ([63d4c5f6](http://github.com/aurelia/framework/commit/63d4c5f6db58a50f6e1776b2b4939ca81ce4edf5))
7+
8+
9+
#### Features
10+
11+
* **framework:** enable plugin loading and config ([f3b02ea9](http://github.com/aurelia/framework/commit/f3b02ea96c0a607b77bb7fbc7e0389748fb07c12))
12+
13+
114
### 0.3.2 (2014-12-18)
215

316

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aurelia-framework",
3-
"version": "0.3.2",
3+
"version": "0.4.0",
44
"description": "The aurelia framework brings together all the required core aurelia libraries into a ready-to-go application-building platform.",
55
"keywords": [
66
"aurelia",

0 commit comments

Comments
 (0)