@@ -5,11 +5,7 @@ define(['exports', 'core-js', 'aurelia-logging', 'aurelia-dependency-injection',
55
66 var _classCallCheck = function ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( 'Cannot call a class as a function' ) ; } } ;
77
8- var _createClass = ( function ( ) { function defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( 'value' in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } } return function ( Constructor , protoProps , staticProps ) { if ( protoProps ) defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) defineProperties ( Constructor , staticProps ) ; return Constructor ; } ; } ) ( ) ;
9-
10- Object . defineProperty ( exports , '__esModule' , {
11- value : true
12- } ) ;
8+ exports . __esModule = true ;
139
1410 var _core = _interopRequire ( _coreJs ) ;
1511
@@ -73,112 +69,112 @@ define(['exports', 'core-js', 'aurelia-logging', 'aurelia-dependency-injection',
7369 this . withInstance ( _aureliaTemplating . ResourceRegistry , this . resources ) ;
7470 }
7571
76- _createClass ( Aurelia , [ {
77- key : 'withInstance' ,
78- value : function withInstance ( type , instance ) {
79- this . container . registerInstance ( type , instance ) ;
80- return this ;
81- }
82- } , {
83- key : 'withSingleton' ,
84- value : function withSingleton ( type , implementation ) {
85- this . container . registerSingleton ( type , implementation ) ;
86- return this ;
87- }
88- } , {
89- key : 'globalizeResources' ,
90- value : function globalizeResources ( resources ) {
91- var toAdd = Array . isArray ( resources ) ? resources : arguments ,
92- i ,
93- ii ,
94- pluginPath = this . currentPluginId || '' ,
95- path ,
96- internalPlugin = pluginPath . startsWith ( './' ) ;
97-
98- for ( i = 0 , ii = toAdd . length ; i < ii ; ++ i ) {
99- path = internalPlugin ? _aureliaPath . relativeToFile ( toAdd [ i ] , pluginPath ) : _aureliaPath . join ( pluginPath , toAdd [ i ] ) ;
100-
101- this . resourcesToLoad [ path ] = this . resourcesToLoad [ path ] ;
102- }
72+ Aurelia . prototype . withInstance = function withInstance ( type , instance ) {
73+ this . container . registerInstance ( type , instance ) ;
74+ return this ;
75+ } ;
10376
104- return this ;
105- }
106- } , {
107- key : 'renameGlobalResource' ,
108- value : function renameGlobalResource ( resourcePath , newName ) {
109- this . resourcesToLoad [ resourcePath ] = newName ;
110- return this ;
111- }
112- } , {
113- key : 'start' ,
114- value : function start ( ) {
115- var _this = this ;
77+ Aurelia . prototype . withSingleton = function withSingleton ( type , implementation ) {
78+ this . container . registerSingleton ( type , implementation ) ;
79+ return this ;
80+ } ;
11681
117- if ( this . started ) {
118- return Promise . resolve ( this ) ;
82+ Aurelia . prototype . globalizeResources = function globalizeResources ( resources ) {
83+ var toAdd = Array . isArray ( resources ) ? resources : arguments ,
84+ i ,
85+ ii ,
86+ resource ,
87+ pluginPath = this . currentPluginId || '' ,
88+ path ,
89+ internalPlugin = pluginPath . startsWith ( './' ) ;
90+
91+ for ( i = 0 , ii = toAdd . length ; i < ii ; ++ i ) {
92+ resource = toAdd [ i ] ;
93+ if ( typeof resource != 'string' ) {
94+ throw new Error ( 'Invalid resource path [' + resource + ']. Resources must be specified as relative module IDs.' ) ;
11995 }
12096
121- this . started = true ;
122- logger . info ( 'Aurelia Starting' ) ;
97+ path = internalPlugin ? _aureliaPath . relativeToFile ( resource , pluginPath ) : _aureliaPath . join ( pluginPath , resource ) ;
12398
124- preventActionlessFormSubmit ( ) ;
99+ this . resourcesToLoad [ path ] = this . resourcesToLoad [ path ] ;
100+ }
125101
126- return this . use . _process ( ) . then ( function ( ) {
127- if ( ! _this . container . hasHandler ( _aureliaTemplating . BindingLanguage ) ) {
128- var message = 'You must configure Aurelia with a BindingLanguage implementation.' ;
129- logger . error ( message ) ;
130- throw new Error ( message ) ;
131- }
102+ return this ;
103+ } ;
132104
133- if ( ! _this . container . hasHandler ( _aureliaTemplating . Animator ) ) {
134- _aureliaTemplating . Animator . configureDefault ( _this . container ) ;
135- }
105+ Aurelia . prototype . renameGlobalResource = function renameGlobalResource ( resourcePath , newName ) {
106+ this . resourcesToLoad [ resourcePath ] = newName ;
107+ return this ;
108+ } ;
136109
137- return loadResources ( _this . container , _this . resourcesToLoad , _this . resources ) . then ( function ( ) {
138- logger . info ( 'Aurelia Started' ) ;
139- var evt = new window . CustomEvent ( 'aurelia-started' , { bubbles : true , cancelable : true } ) ;
140- document . dispatchEvent ( evt ) ;
141- return _this ;
142- } ) ;
143- } ) ;
110+ Aurelia . prototype . start = function start ( ) {
111+ var _this = this ;
112+
113+ if ( this . started ) {
114+ return Promise . resolve ( this ) ;
144115 }
145- } , {
146- key : 'setRoot' ,
147- value : function setRoot ( ) {
148- var _this2 = this ;
149116
150- var root = arguments [ 0 ] === undefined ? 'app' : arguments [ 0 ] ;
151- var applicationHost = arguments [ 1 ] === undefined ? null : arguments [ 1 ] ;
117+ this . started = true ;
118+ logger . info ( 'Aurelia Starting' ) ;
119+
120+ preventActionlessFormSubmit ( ) ;
152121
153- var compositionEngine ,
154- instruction = { } ;
122+ return this . use . _process ( ) . then ( function ( ) {
123+ if ( ! _this . container . hasHandler ( _aureliaTemplating . BindingLanguage ) ) {
124+ var message = 'You must configure Aurelia with a BindingLanguage implementation.' ;
125+ logger . error ( message ) ;
126+ throw new Error ( message ) ;
127+ }
155128
156- if ( ! applicationHost || typeof applicationHost == 'string' ) {
157- this . host = document . getElementById ( applicationHost || 'applicationHost' ) || document . body ;
158- } else {
159- this . host = applicationHost ;
129+ if ( ! _this . container . hasHandler ( _aureliaTemplating . Animator ) ) {
130+ _aureliaTemplating . Animator . configureDefault ( _this . container ) ;
160131 }
161132
162- this . host . aurelia = this ;
163- this . container . registerInstance ( Element , this . host ) ;
164-
165- compositionEngine = this . container . get ( _aureliaTemplating . CompositionEngine ) ;
166- instruction . viewModel = root ;
167- instruction . container = instruction . childContainer = this . container ;
168- instruction . viewSlot = new _aureliaTemplating . ViewSlot ( this . host , true ) ;
169- instruction . viewSlot . transformChildNodesIntoView ( ) ;
170-
171- return compositionEngine . compose ( instruction ) . then ( function ( root ) {
172- _this2 . root = root ;
173- instruction . viewSlot . attached ( ) ;
174- var evt = new window . CustomEvent ( 'aurelia-composed' , { bubbles : true , cancelable : true } ) ;
175- setTimeout ( function ( ) {
176- return document . dispatchEvent ( evt ) ;
177- } , 1 ) ;
178- return _this2 ;
133+ return loadResources ( _this . container , _this . resourcesToLoad , _this . resources ) . then ( function ( ) {
134+ logger . info ( 'Aurelia Started' ) ;
135+ var evt = new window . CustomEvent ( 'aurelia-started' , { bubbles : true , cancelable : true } ) ;
136+ document . dispatchEvent ( evt ) ;
137+ return _this ;
179138 } ) ;
139+ } ) ;
140+ } ;
141+
142+ Aurelia . prototype . setRoot = function setRoot ( ) {
143+ var _this2 = this ;
144+
145+ var root = arguments [ 0 ] === undefined ? 'app' : arguments [ 0 ] ;
146+ var applicationHost = arguments [ 1 ] === undefined ? null : arguments [ 1 ] ;
147+
148+ var compositionEngine ,
149+ instruction = { } ;
150+
151+ applicationHost = applicationHost || this . host ;
152+
153+ if ( ! applicationHost || typeof applicationHost == 'string' ) {
154+ this . host = document . getElementById ( applicationHost || 'applicationHost' ) || document . body ;
155+ } else {
156+ this . host = applicationHost ;
180157 }
181- } ] ) ;
158+
159+ this . host . aurelia = this ;
160+ this . container . registerInstance ( Element , this . host ) ;
161+
162+ compositionEngine = this . container . get ( _aureliaTemplating . CompositionEngine ) ;
163+ instruction . viewModel = root ;
164+ instruction . container = instruction . childContainer = this . container ;
165+ instruction . viewSlot = new _aureliaTemplating . ViewSlot ( this . host , true ) ;
166+ instruction . viewSlot . transformChildNodesIntoView ( ) ;
167+
168+ return compositionEngine . compose ( instruction ) . then ( function ( root ) {
169+ _this2 . root = root ;
170+ instruction . viewSlot . attached ( ) ;
171+ var evt = new window . CustomEvent ( 'aurelia-composed' , { bubbles : true , cancelable : true } ) ;
172+ setTimeout ( function ( ) {
173+ return document . dispatchEvent ( evt ) ;
174+ } , 1 ) ;
175+ return _this2 ;
176+ } ) ;
177+ } ;
182178
183179 return Aurelia ;
184180 } ) ( ) ;
0 commit comments