@@ -69,78 +69,56 @@ define(['exports', 'core-js', 'aurelia-logging', 'aurelia-metadata', 'aurelia-de
69
69
return this ;
70
70
} ;
71
71
72
- Plugins . prototype . defaultBindingLanguage = function defaultBindingLanguage ( ) {
72
+ Plugins . prototype . _addNormalizedPlugin = function _addNormalizedPlugin ( name , config ) {
73
73
var _this2 = this ;
74
74
75
- this . aurelia . addPreStartTask ( function ( ) {
76
- return System . normalize ( 'aurelia-templating-binding' , _this2 . bootstrapperName ) . then ( function ( name ) {
77
- _this2 . aurelia . use . plugin ( name ) ;
78
- } ) ;
79
- } ) ;
75
+ var plugin = { moduleId : name , resourcesRelativeTo : name , config : config || { } } ;
80
76
81
- return this ;
82
- } ;
83
-
84
- Plugins . prototype . router = function router ( ) {
85
- var _this3 = this ;
77
+ this . plugin ( plugin ) ;
86
78
87
79
this . aurelia . addPreStartTask ( function ( ) {
88
- return System . normalize ( 'aurelia-templating-router' , _this3 . bootstrapperName ) . then ( function ( name ) {
89
- _this3 . aurelia . use . plugin ( name ) ;
80
+ return System . normalize ( name , _this2 . bootstrapperName ) . then ( function ( normalizedName ) {
81
+ normalizedName = normalizedName . endsWith ( '.js' ) || normalizedName . endsWith ( '.ts' ) ? normalizedName . substring ( 0 , normalizedName . length - 3 ) : normalizedName ;
82
+
83
+ plugin . moduleId = normalizedName ;
84
+ plugin . resourcesRelativeTo = normalizedName ;
85
+ System . map [ name ] = normalizedName ;
90
86
} ) ;
91
87
} ) ;
92
88
93
89
return this ;
94
90
} ;
95
91
96
- Plugins . prototype . history = function history ( ) {
97
- var _this4 = this ;
92
+ Plugins . prototype . defaultBindingLanguage = function defaultBindingLanguage ( ) {
93
+ return this . _addNormalizedPlugin ( 'aurelia-templating-binding' ) ;
94
+ } ;
98
95
99
- this . aurelia . addPreStartTask ( function ( ) {
100
- return System . normalize ( 'aurelia-history-browser' , _this4 . bootstrapperName ) . then ( function ( name ) {
101
- _this4 . aurelia . use . plugin ( name ) ;
102
- } ) ;
103
- } ) ;
96
+ Plugins . prototype . router = function router ( ) {
97
+ return this . _addNormalizedPlugin ( 'aurelia-templating-router' ) ;
98
+ } ;
104
99
105
- return this ;
100
+ Plugins . prototype . history = function history ( ) {
101
+ return this . _addNormalizedPlugin ( 'aurelia-history-browser' ) ;
106
102
} ;
107
103
108
104
Plugins . prototype . defaultResources = function defaultResources ( ) {
109
- var _this5 = this ;
110
-
111
- this . aurelia . addPreStartTask ( function ( ) {
112
- return System . normalize ( 'aurelia-templating-resources' , _this5 . bootstrapperName ) . then ( function ( name ) {
113
- System . map [ 'aurelia-templating-resources' ] = name ;
114
- _this5 . aurelia . use . plugin ( name ) ;
115
- } ) ;
116
- } ) ;
117
-
118
- return this ;
105
+ return this . _addNormalizedPlugin ( 'aurelia-templating-resources' ) ;
119
106
} ;
120
107
121
108
Plugins . prototype . eventAggregator = function eventAggregator ( ) {
122
- var _this6 = this ;
123
-
124
- this . aurelia . addPreStartTask ( function ( ) {
125
- return System . normalize ( 'aurelia-event-aggregator' , _this6 . bootstrapperName ) . then ( function ( name ) {
126
- System . map [ 'aurelia-event-aggregator' ] = name ;
127
- _this6 . aurelia . use . plugin ( name ) ;
128
- } ) ;
129
- } ) ;
130
-
131
- return this ;
109
+ return this . _addNormalizedPlugin ( 'aurelia-event-aggregator' ) ;
132
110
} ;
133
111
134
112
Plugins . prototype . standardConfiguration = function standardConfiguration ( ) {
135
113
return this . aurelia . use . defaultBindingLanguage ( ) . defaultResources ( ) . history ( ) . router ( ) . eventAggregator ( ) ;
136
114
} ;
137
115
138
116
Plugins . prototype . developmentLogging = function developmentLogging ( ) {
139
- var _this7 = this ;
117
+ var _this3 = this ;
140
118
141
119
this . aurelia . addPreStartTask ( function ( ) {
142
- return System . normalize ( 'aurelia-logging-console' , _this7 . bootstrapperName ) . then ( function ( name ) {
143
- return _this7 . aurelia . loader . loadModule ( name ) . then ( function ( m ) {
120
+ return System . normalize ( 'aurelia-logging-console' , _this3 . bootstrapperName ) . then ( function ( name ) {
121
+ return _this3 . aurelia . loader . loadModule ( name ) . then ( function ( m ) {
144
122
_aureliaLogging . addAppender ( new m . ConsoleAppender ( ) ) ;
145
123
_aureliaLogging . setLevel ( _aureliaLogging . logLevel . debug ) ;
146
124
} ) ;
@@ -151,7 +129,7 @@ define(['exports', 'core-js', 'aurelia-logging', 'aurelia-metadata', 'aurelia-de
151
129
} ;
152
130
153
131
Plugins . prototype . _process = function _process ( ) {
154
- var _this8 = this ;
132
+ var _this4 = this ;
155
133
156
134
var aurelia = this . aurelia ,
157
135
loader = aurelia . loader ,
@@ -167,7 +145,7 @@ define(['exports', 'core-js', 'aurelia-logging', 'aurelia-metadata', 'aurelia-de
167
145
return loadPlugin ( aurelia , loader , current ) . then ( next ) ;
168
146
}
169
147
170
- _this8 . processed = true ;
148
+ _this4 . processed = true ;
171
149
return Promise . resolve ( ) ;
172
150
} ;
173
151
@@ -308,7 +286,7 @@ define(['exports', 'core-js', 'aurelia-logging', 'aurelia-metadata', 'aurelia-de
308
286
} ;
309
287
310
288
Aurelia . prototype . start = function start ( ) {
311
- var _this9 = this ;
289
+ var _this5 = this ;
312
290
313
291
if ( this . started ) {
314
292
return Promise . resolve ( this ) ;
@@ -320,48 +298,48 @@ define(['exports', 'core-js', 'aurelia-logging', 'aurelia-metadata', 'aurelia-de
320
298
preventActionlessFormSubmit ( ) ;
321
299
322
300
return runTasks ( this , this . preStartTasks ) . then ( function ( ) {
323
- return _this9 . use . _process ( ) . then ( function ( ) {
324
- if ( ! _this9 . container . hasHandler ( _aureliaTemplating . BindingLanguage ) ) {
301
+ return _this5 . use . _process ( ) . then ( function ( ) {
302
+ if ( ! _this5 . container . hasHandler ( _aureliaTemplating . BindingLanguage ) ) {
325
303
var message = 'You must configure Aurelia with a BindingLanguage implementation.' ;
326
304
logger . error ( message ) ;
327
305
throw new Error ( message ) ;
328
306
}
329
307
330
- if ( ! _this9 . container . hasHandler ( _aureliaTemplating . Animator ) ) {
331
- _aureliaTemplating . Animator . configureDefault ( _this9 . container ) ;
308
+ if ( ! _this5 . container . hasHandler ( _aureliaTemplating . Animator ) ) {
309
+ _aureliaTemplating . Animator . configureDefault ( _this5 . container ) ;
332
310
}
333
311
334
- return loadResources ( _this9 . container , _this9 . resourcesToLoad , _this9 . resources ) ;
312
+ return loadResources ( _this5 . container , _this5 . resourcesToLoad , _this5 . resources ) ;
335
313
} ) . then ( function ( ) {
336
- return runTasks ( _this9 , _this9 . postStartTasks ) . then ( function ( ) {
314
+ return runTasks ( _this5 , _this5 . postStartTasks ) . then ( function ( ) {
337
315
logger . info ( 'Aurelia Started' ) ;
338
316
var evt = new window . CustomEvent ( 'aurelia-started' , { bubbles : true , cancelable : true } ) ;
339
317
document . dispatchEvent ( evt ) ;
340
- return _this9 ;
318
+ return _this5 ;
341
319
} ) ;
342
320
} ) ;
343
321
} ) ;
344
322
} ;
345
323
346
324
Aurelia . prototype . enhance = function enhance ( ) {
347
- var _this10 = this ;
325
+ var _this6 = this ;
348
326
349
327
var bindingContext = arguments [ 0 ] === undefined ? { } : arguments [ 0 ] ;
350
328
var applicationHost = arguments [ 1 ] === undefined ? null : arguments [ 1 ] ;
351
329
352
330
this . _configureHost ( applicationHost ) ;
353
331
354
332
return new Promise ( function ( resolve ) {
355
- var viewEngine = _this10 . container . get ( _aureliaTemplating . ViewEngine ) ;
356
- _this10 . root = viewEngine . enhance ( _this10 . container , _this10 . host , _this10 . resources , bindingContext ) ;
357
- _this10 . root . attached ( ) ;
358
- _this10 . _onAureliaComposed ( ) ;
359
- return _this10 ;
333
+ var viewEngine = _this6 . container . get ( _aureliaTemplating . ViewEngine ) ;
334
+ _this6 . root = viewEngine . enhance ( _this6 . container , _this6 . host , _this6 . resources , bindingContext ) ;
335
+ _this6 . root . attached ( ) ;
336
+ _this6 . _onAureliaComposed ( ) ;
337
+ return _this6 ;
360
338
} ) ;
361
339
} ;
362
340
363
341
Aurelia . prototype . setRoot = function setRoot ( ) {
364
- var _this11 = this ;
342
+ var _this7 = this ;
365
343
366
344
var root = arguments [ 0 ] === undefined ? 'app' : arguments [ 0 ] ;
367
345
var applicationHost = arguments [ 1 ] === undefined ? null : arguments [ 1 ] ;
@@ -379,10 +357,10 @@ define(['exports', 'core-js', 'aurelia-logging', 'aurelia-metadata', 'aurelia-de
379
357
instruction . host = this . host ;
380
358
381
359
return compositionEngine . compose ( instruction ) . then ( function ( root ) {
382
- _this11 . root = root ;
360
+ _this7 . root = root ;
383
361
instruction . viewSlot . attached ( ) ;
384
- _this11 . _onAureliaComposed ( ) ;
385
- return _this11 ;
362
+ _this7 . _onAureliaComposed ( ) ;
363
+ return _this7 ;
386
364
} ) ;
387
365
} ;
388
366
0 commit comments