Skip to content

Commit 8c0e3e4

Browse files
chore(all): prepare release 0.7.0
1 parent f9df6e5 commit 8c0e3e4

File tree

13 files changed

+561
-327
lines changed

13 files changed

+561
-327
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.6.0",
3+
"version": "0.7.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: 120 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
define(["exports", "aurelia-logging", "aurelia-dependency-injection", "aurelia-loader", "aurelia-templating", "./plugins"], function (exports, _aureliaLogging, _aureliaDependencyInjection, _aureliaLoader, _aureliaTemplating, _plugins) {
22
"use strict";
33

4+
var _prototypeProperties = function (child, staticProps, instanceProps) {
5+
if (staticProps) Object.defineProperties(child, staticProps);
6+
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
7+
};
8+
49
var LogManager = _aureliaLogging;
510
var Container = _aureliaDependencyInjection.Container;
611
var Loader = _aureliaLoader.Loader;
@@ -12,88 +17,132 @@ define(["exports", "aurelia-logging", "aurelia-dependency-injection", "aurelia-l
1217
var Plugins = _plugins.Plugins;
1318

1419

15-
var logger = LogManager.getLogger("aurelia");
16-
17-
var Aurelia = function Aurelia(loader, container, resources) {
18-
this.loader = loader || Loader.createDefaultLoader();
19-
this.container = container || new Container();
20-
this.resources = resources || new ResourceRegistry();
21-
this.resourcesToLoad = [];
22-
this.plugins = new Plugins(this);
20+
var logger = LogManager.getLogger("aurelia"),
21+
slice = Array.prototype.slice;
2322

24-
this.withInstance(Aurelia, this);
25-
this.withInstance(Loader, this.loader);
26-
this.withInstance(ResourceRegistry, this.resources);
27-
};
28-
29-
Aurelia.prototype.withInstance = function (type, instance) {
30-
this.container.registerInstance(type, instance);
31-
return this;
32-
};
23+
function loadResources(container, resourcesToLoad, appResources) {
24+
var resourceCoordinator = container.get(ResourceCoordinator), current;
3325

34-
Aurelia.prototype.withSingleton = function (type, implementation) {
35-
this.container.registerSingleton(type, implementation);
36-
return this;
37-
};
26+
function next() {
27+
if (current = resourcesToLoad.shift()) {
28+
return resourceCoordinator.importResources(current).then(function (resources) {
29+
resources.forEach(function (x) {
30+
return x.register(appResources);
31+
});
32+
return next();
33+
});
34+
}
3835

39-
Aurelia.prototype.withResources = function (resources) {
40-
if (Array.isArray(resources)) {
41-
this.resourcesToLoad = this.resourcesToLoad.concat(resources);
42-
} else {
43-
this.resourcesToLoad = this.resourcesToLoad.concat(Array.prototype.slice.call(arguments));
36+
return Promise.resolve();
4437
}
4538

46-
return this;
47-
};
39+
return next();
40+
}
4841

49-
Aurelia.prototype.start = function () {
50-
var _this = this;
51-
if (this.started) {
52-
return;
53-
}
42+
var Aurelia = (function () {
43+
function Aurelia(loader, container, resources) {
44+
this.loader = loader || Loader.createDefaultLoader();
45+
this.container = container || new Container();
46+
this.resources = resources || new ResourceRegistry();
47+
this.resourcesToLoad = [];
48+
this.plugins = new Plugins(this);
5449

55-
this.started = true;
56-
logger.info("Aurelia Starting");
50+
this.withInstance(Aurelia, this);
51+
this.withInstance(Loader, this.loader);
52+
this.withInstance(ResourceRegistry, this.resources);
53+
}
5754

58-
return this.plugins.process().then(function () {
59-
if (!_this.container.hasHandler(BindingLanguage)) {
60-
logger.error("You must configure Aurelia with a BindingLanguage implementation.");
55+
_prototypeProperties(Aurelia, null, {
56+
withInstance: {
57+
value: function (type, instance) {
58+
this.container.registerInstance(type, instance);
59+
return this;
60+
},
61+
writable: true,
62+
enumerable: true,
63+
configurable: true
64+
},
65+
withSingleton: {
66+
value: function (type, implementation) {
67+
this.container.registerSingleton(type, implementation);
68+
return this;
69+
},
70+
writable: true,
71+
enumerable: true,
72+
configurable: true
73+
},
74+
withResources: {
75+
value: function (resources) {
76+
if (Array.isArray(resources)) {
77+
this.resourcesToLoad.push(resources);
78+
} else {
79+
this.resourcesToLoad.push(slice.call(arguments));
80+
}
81+
82+
return this;
83+
},
84+
writable: true,
85+
enumerable: true,
86+
configurable: true
87+
},
88+
start: {
89+
value: function () {
90+
var _this = this;
91+
if (this.started) {
92+
return;
93+
}
94+
95+
this.started = true;
96+
logger.info("Aurelia Starting");
97+
98+
return this.plugins.process().then(function () {
99+
if (!_this.container.hasHandler(BindingLanguage)) {
100+
logger.error("You must configure Aurelia with a BindingLanguage implementation.");
101+
}
102+
103+
return loadResources(_this.container, _this.resourcesToLoad, _this.resources).then(function () {
104+
logger.info("Aurelia Started");
105+
return _this;
106+
});
107+
});
108+
},
109+
writable: true,
110+
enumerable: true,
111+
configurable: true
112+
},
113+
setRoot: {
114+
value: function (root, applicationHost) {
115+
var _this2 = this;
116+
var compositionEngine, instruction = {};
117+
118+
if (!applicationHost || typeof applicationHost == "string") {
119+
this.host = document.getElementById(applicationHost || "applicationHost") || document.body;
120+
} else {
121+
this.host = applicationHost;
122+
}
123+
124+
this.host.aurelia = this;
125+
this.container.registerInstance(Element, this.host);
126+
127+
compositionEngine = this.container.get(CompositionEngine);
128+
instruction.viewModel = root;
129+
instruction.viewSlot = new ViewSlot(this.host, true);
130+
instruction.container = instruction.childContainer = this.container;
131+
132+
return compositionEngine.compose(instruction).then(function (root) {
133+
_this2.root = root;
134+
instruction.viewSlot.attached();
135+
return _this2;
136+
});
137+
},
138+
writable: true,
139+
enumerable: true,
140+
configurable: true
61141
}
62-
63-
return _this.container.get(ResourceCoordinator).importResources(_this.resourcesToLoad).then(function (resources) {
64-
resources.forEach(function (x) {
65-
return x.register(_this.resources);
66-
});
67-
logger.info("Aurelia Started");
68-
return _this;
69-
});
70142
});
71-
};
72-
73-
Aurelia.prototype.setRoot = function (root, applicationHost) {
74-
var _this2 = this;
75-
var compositionEngine, instruction = {};
76143

77-
if (!applicationHost || typeof applicationHost == "string") {
78-
this.host = document.getElementById(applicationHost || "applicationHost") || document.body;
79-
} else {
80-
this.host = applicationHost;
81-
}
82-
83-
this.host.aurelia = this;
84-
this.container.registerInstance(Element, this.host);
85-
86-
compositionEngine = this.container.get(CompositionEngine);
87-
instruction.viewModel = root;
88-
instruction.viewSlot = new ViewSlot(this.host, true);
89-
instruction.container = instruction.childContainer = this.container;
90-
91-
return compositionEngine.compose(instruction).then(function (root) {
92-
_this2.root = root;
93-
instruction.viewSlot.attached();
94-
return _this2;
95-
});
96-
};
144+
return Aurelia;
145+
})();
97146

98147
exports.Aurelia = Aurelia;
99148
});

dist/amd/index.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,28 @@ define(["exports", "./aurelia", "aurelia-dependency-injection", "aurelia-binding
77
};
88
};
99

10-
var _exportsWildcard = function (obj) {
11-
for (var i in obj) {
12-
if (exports[i] !== undefined) {
13-
exports[i] = obj[i];
10+
var _defaults = function (obj, defaults) {
11+
for (var key in defaults) {
12+
if (obj[key] === undefined) {
13+
obj[key] = defaults[key];
1414
}
1515
}
16+
17+
return obj;
1618
};
1719

1820
exports.Aurelia = _aurelia.Aurelia;
19-
_exportsWildcard(_interopRequireWildcard(_aureliaDependencyInjection));
21+
_defaults(exports, _interopRequireWildcard(_aureliaDependencyInjection));
2022

21-
_exportsWildcard(_interopRequireWildcard(_aureliaBinding));
23+
_defaults(exports, _interopRequireWildcard(_aureliaBinding));
2224

23-
_exportsWildcard(_interopRequireWildcard(_aureliaMetadata));
25+
_defaults(exports, _interopRequireWildcard(_aureliaMetadata));
2426

25-
_exportsWildcard(_interopRequireWildcard(_aureliaTemplating));
27+
_defaults(exports, _interopRequireWildcard(_aureliaTemplating));
2628

27-
_exportsWildcard(_interopRequireWildcard(_aureliaLoader));
29+
_defaults(exports, _interopRequireWildcard(_aureliaLoader));
2830

29-
_exportsWildcard(_interopRequireWildcard(_aureliaTaskQueue));
31+
_defaults(exports, _interopRequireWildcard(_aureliaTaskQueue));
3032

3133
var TheLogManager = _aureliaLogging;
3234
var LogManager = exports.LogManager = TheLogManager;

dist/amd/plugins.js

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
define(["exports", "aurelia-logging"], function (exports, _aureliaLogging) {
22
"use strict";
33

4+
var _prototypeProperties = function (child, staticProps, instanceProps) {
5+
if (staticProps) Object.defineProperties(child, staticProps);
6+
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
7+
};
8+
49
var LogManager = _aureliaLogging;
510

611

@@ -26,32 +31,47 @@ define(["exports", "aurelia-logging"], function (exports, _aureliaLogging) {
2631
});
2732
}
2833

29-
var Plugins = function Plugins(aurelia) {
30-
this.aurelia = aurelia;
31-
this.info = [];
32-
this.hasProcessed = false;
33-
};
34+
var Plugins = (function () {
35+
function Plugins(aurelia) {
36+
this.aurelia = aurelia;
37+
this.info = [];
38+
}
3439

35-
Plugins.prototype.install = function (moduleId, config) {
36-
this.info.push({ moduleId: moduleId, config: config });
37-
return this;
38-
};
40+
_prototypeProperties(Plugins, null, {
41+
install: {
42+
value: function (moduleId, config) {
43+
this.info.push({ moduleId: moduleId, config: config });
44+
return this;
45+
},
46+
writable: true,
47+
enumerable: true,
48+
configurable: true
49+
},
50+
process: {
51+
value: function () {
52+
var aurelia = this.aurelia,
53+
loader = aurelia.loader,
54+
info = this.info,
55+
current;
3956

40-
Plugins.prototype.process = function () {
41-
var toLoad = [], aurelia = this.aurelia, loader = aurelia.loader, info = this.info, i, ii;
57+
var next = function () {
58+
if (current = info.shift()) {
59+
return loadPlugin(aurelia, loader, current).then(next);
60+
}
4261

43-
if (this.hasProcessed) {
44-
return Promise.resolve();
45-
}
62+
return Promise.resolve();
63+
};
4664

47-
this.hasProcessed = true;
48-
49-
for (i = 0, ii = info.length; i < ii; ++i) {
50-
toLoad.push(loadPlugin(aurelia, loader, info[i]));
51-
}
65+
return next();
66+
},
67+
writable: true,
68+
enumerable: true,
69+
configurable: true
70+
}
71+
});
5272

53-
return Promise.all(toLoad);
54-
};
73+
return Plugins;
74+
})();
5575

5676
exports.Plugins = Plugins;
5777
});

0 commit comments

Comments
 (0)