1- /*
2- kefo: Copied from Ace editor repository. This file is needed
3- to hook up the requirejs defines so they work with a defined
4- javascript bfe namespace since we use dryice to build and not requirejs.
5- https://github.com/ajaxorg/ace/blob/master/build_support/mini_require.js
6-
7- Beyond the note above, it is not used in any other way. It is only
8- invoked when building/minifying the code.
9- */
10-
11- /* ***** BEGIN LICENSE BLOCK *****
12- * Distributed under the BSD license:
13- *
14- * Copyright (c) 2010, Ajax.org B.V.
15- * All rights reserved.
16- *
17- * Redistribution and use in source and binary forms, with or without
18- * modification, are permitted provided that the following conditions are met:
19- * * Redistributions of source code must retain the above copyright
20- * notice, this list of conditions and the following disclaimer.
21- * * Redistributions in binary form must reproduce the above copyright
22- * notice, this list of conditions and the following disclaimer in the
23- * documentation and/or other materials provided with the distribution.
24- * * Neither the name of Ajax.org B.V. nor the
25- * names of its contributors may be used to endorse or promote products
26- * derived from this software without specific prior written permission.
27- *
28- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
29- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
30- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31- * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
32- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
33- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
34- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
35- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38- *
39- * ***** END LICENSE BLOCK ***** */
40-
41- /**
42- * Define a module along with a payload
43- * @param module a name for the payload
44- * @param payload a function to call with (require, exports, module) params
45- */
46-
47- ( function ( ) {
48-
49- var ACE_NAMESPACE = "bfe" ;
50-
51- var global = ( function ( ) {
52- return this ;
53- } ) ( ) ;
54-
55-
56- if ( ! ACE_NAMESPACE && typeof requirejs !== "undefined" )
57- return ;
58-
59-
60- var _define = function ( module , deps , payload ) {
61- if ( typeof module !== 'string' ) {
62- if ( _define . original )
63- _define . original . apply ( window , arguments ) ;
64- else {
65- console . error ( 'dropping module because define wasn\'t a string.' ) ;
66- console . trace ( ) ;
67- }
68- return ;
69- }
70-
71- if ( arguments . length == 2 )
72- payload = deps ;
73-
74- if ( ! _define . modules ) {
75- _define . modules = { } ;
76- _define . payloads = { } ;
77- }
78-
79- _define . payloads [ module ] = payload ;
80- _define . modules [ module ] = null ;
81- } ;
82-
83- /**
84- * Get at functionality define()ed using the function above
85- */
86- var _require = function ( parentId , module , callback ) {
87- if ( Object . prototype . toString . call ( module ) === "[object Array]" ) {
88- var params = [ ] ;
89- for ( var i = 0 , l = module . length ; i < l ; ++ i ) {
90- var dep = lookup ( parentId , module [ i ] ) ;
91- if ( ! dep && _require . original )
92- return _require . original . apply ( window , arguments ) ;
93- params . push ( dep ) ;
94- }
95- if ( callback ) {
96- callback . apply ( null , params ) ;
97- }
98- }
99- else if ( typeof module === 'string' ) {
100- var payload = lookup ( parentId , module ) ;
101- if ( ! payload && _require . original )
102- return _require . original . apply ( window , arguments ) ;
103-
104- if ( callback ) {
105- callback ( ) ;
106- }
107-
108- return payload ;
109- }
110- else {
111- if ( _require . original )
112- return _require . original . apply ( window , arguments ) ;
113- }
114- } ;
115-
116- var normalizeModule = function ( parentId , moduleName ) {
117- // normalize plugin requires
118- if ( moduleName . indexOf ( "!" ) !== - 1 ) {
119- var chunks = moduleName . split ( "!" ) ;
120- return normalizeModule ( parentId , chunks [ 0 ] ) + "!" + normalizeModule ( parentId , chunks [ 1 ] ) ;
121- }
122- // normalize relative requires
123- if ( moduleName . charAt ( 0 ) == "." ) {
124- var base = parentId . split ( "/" ) . slice ( 0 , - 1 ) . join ( "/" ) ;
125- moduleName = base + "/" + moduleName ;
126-
127- while ( moduleName . indexOf ( "." ) !== - 1 && previous != moduleName ) {
128- var previous = moduleName ;
129- moduleName = moduleName . replace ( / \/ \. \/ / , "/" ) . replace ( / [ ^ \/ ] + \/ \. \. \/ / , "" ) ;
130- }
131- }
132-
133- return moduleName ;
134- } ;
135-
136- /**
137- * Internal function to lookup moduleNames and resolve them by calling the
138- * definition function if needed.
139- */
140- var lookup = function ( parentId , moduleName ) {
141-
142- moduleName = normalizeModule ( parentId , moduleName ) ;
143-
144- var module = _define . modules [ moduleName ] ;
145- if ( ! module ) {
146- module = _define . payloads [ moduleName ] ;
147- if ( typeof module === 'function' ) {
148- var exports = { } ;
149- var mod = {
150- id : moduleName ,
151- uri : '' ,
152- exports : exports ,
153- packaged : true
154- } ;
155-
156- var req = function ( module , callback ) {
157- return _require ( moduleName , module , callback ) ;
158- } ;
159-
160- var returnValue = module ( req , exports , mod ) ;
161- exports = returnValue || mod . exports ;
162- _define . modules [ moduleName ] = exports ;
163- delete _define . payloads [ moduleName ] ;
164- }
165- module = _define . modules [ moduleName ] = exports || module ;
166- }
167- return module ;
168- } ;
169-
170- function exportAce ( ns ) {
171- var require = function ( module , callback ) {
172- return _require ( "" , module , callback ) ;
173- } ;
174-
175- var root = global ;
176- if ( ns ) {
177- if ( ! global [ ns ] )
178- global [ ns ] = { } ;
179- root = global [ ns ] ;
180- }
181-
182- if ( ! root . define || ! root . define . packaged ) {
183- _define . original = root . define ;
184- root . define = _define ;
185- root . define . packaged = true ;
186- }
187-
188- if ( ! root . require || ! root . require . packaged ) {
189- _require . original = root . require ;
190- root . require = require ;
191- root . require . packaged = true ;
192- }
193- }
194-
195- exportAce ( ACE_NAMESPACE ) ;
196-
197- } ) ( ) ;
1+ /* ***** BEGIN LICENSE BLOCK *****
2+ * Distributed under the BSD license:
3+ *
4+ * Copyright (c) 2010, Ajax.org B.V.
5+ * All rights reserved.
6+ *
7+ * Redistribution and use in source and binary forms, with or without
8+ * modification, are permitted provided that the following conditions are met:
9+ * * Redistributions of source code must retain the above copyright
10+ * notice, this list of conditions and the following disclaimer.
11+ * * Redistributions in binary form must reproduce the above copyright
12+ * notice, this list of conditions and the following disclaimer in the
13+ * documentation and/or other materials provided with the distribution.
14+ * * Neither the name of Ajax.org B.V. nor the
15+ * names of its contributors may be used to endorse or promote products
16+ * derived from this software without specific prior written permission.
17+ *
18+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
22+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+ *
29+ * ***** END LICENSE BLOCK ***** */
30+ /**
31+ * Define a module along with a payload
32+ * @param module a name for the payload
33+ * @param payload a function to call with (require, exports, module) params
34+ */
35+ ( function ( ) {
36+ var ACE_NAMESPACE = 'bfe' ;
37+
38+ var global = ( function ( ) {
39+ return this ;
40+ } ) ( ) ;
41+
42+ if ( ! ACE_NAMESPACE && typeof requirejs !== 'undefined' ) { return ; }
43+
44+ var _define = function ( module , deps , payload ) {
45+ if ( typeof module !== 'string' ) {
46+ if ( _define . original ) { _define . original . apply ( window , arguments ) ; } else {
47+ console . error ( 'dropping module because define wasn\'t a string.' ) ;
48+ console . trace ( ) ;
49+ }
50+ return ;
51+ }
52+
53+ if ( arguments . length === 2 ) { payload = deps ; }
54+
55+ if ( ! _define . modules ) {
56+ _define . modules = { } ;
57+ _define . payloads = { } ;
58+ }
59+
60+ _define . payloads [ module ] = payload ;
61+ _define . modules [ module ] = null ;
62+ } ;
63+
64+ /**
65+ * Get at functionality define()ed using the function above
66+ */
67+ var _require = function ( parentId , module , callback ) {
68+ if ( Object . prototype . toString . call ( module ) === '[object Array]' ) {
69+ var params = [ ] ;
70+ for ( var i = 0 , l = module . length ; i < l ; ++ i ) {
71+ var dep = lookup ( parentId , module [ i ] ) ;
72+ if ( ! dep && _require . original ) { return _require . original . apply ( window , arguments ) ; }
73+ params . push ( dep ) ;
74+ }
75+ if ( callback ) {
76+ callback . apply ( null , params ) ;
77+ }
78+ } else if ( typeof module === 'string' ) {
79+ var payload = lookup ( parentId , module ) ;
80+ if ( ! payload && _require . original ) { return _require . original . apply ( window , arguments ) ; }
81+
82+ if ( callback ) {
83+ callback ( ) ;
84+ }
85+
86+ return payload ;
87+ } else {
88+ if ( _require . original ) { return _require . original . apply ( window , arguments ) ; }
89+ }
90+ } ;
91+
92+ var normalizeModule = function ( parentId , moduleName ) {
93+ // normalize plugin requires
94+ if ( moduleName . indexOf ( '!' ) !== - 1 ) {
95+ var chunks = moduleName . split ( '!' ) ;
96+ return normalizeModule ( parentId , chunks [ 0 ] ) + '!' + normalizeModule ( parentId , chunks [ 1 ] ) ;
97+ }
98+ // normalize relative requires
99+ if ( moduleName . charAt ( 0 ) === '.' ) {
100+ var base = parentId . split ( '/' ) . slice ( 0 , - 1 ) . join ( '/' ) ;
101+ moduleName = base + '/' + moduleName ;
102+
103+ while ( moduleName . indexOf ( '.' ) !== - 1 && previous !== moduleName ) {
104+ var previous = moduleName ;
105+ moduleName = moduleName . replace ( / \/ \. \/ / , '/' ) . replace ( / [ ^ \/ ] + \/ \. \. \/ / , '' ) ;
106+ }
107+ }
108+
109+ return moduleName ;
110+ } ;
111+
112+ /**
113+ * Internal function to lookup moduleNames and resolve them by calling the
114+ * definition function if needed.
115+ */
116+ var lookup = function ( parentId , moduleName ) {
117+ moduleName = normalizeModule ( parentId , moduleName ) ;
118+ var exports ;
119+ var module = _define . modules [ moduleName ] ;
120+ if ( ! module ) {
121+ module = _define . payloads [ moduleName ] ;
122+ if ( typeof module === 'function' ) {
123+ exports = { } ;
124+ var mod = {
125+ id : moduleName ,
126+ uri : '' ,
127+ exports : exports ,
128+ packaged : true
129+ } ;
130+
131+ var req = function ( module , callback ) {
132+ return _require ( moduleName , module , callback ) ;
133+ } ;
134+
135+ var returnValue = module ( req , exports , mod ) ;
136+ exports = returnValue || mod . exports ;
137+ _define . modules [ moduleName ] = exports ;
138+ delete _define . payloads [ moduleName ] ;
139+ }
140+ module = _define . modules [ moduleName ] = exports || module ;
141+ }
142+ return module ;
143+ } ;
144+
145+ function exportAce ( ns ) {
146+ var require = function ( module , callback ) {
147+ return _require ( '' , module , callback ) ;
148+ } ;
149+
150+ var root = global ;
151+ if ( ns ) {
152+ if ( ! global [ ns ] ) { global [ ns ] = { } ; }
153+ root = global [ ns ] ;
154+ }
155+
156+ if ( ! root . define || ! root . define . packaged ) {
157+ _define . original = root . define ;
158+ root . define = _define ;
159+ root . define . packaged = true ;
160+ }
161+
162+ if ( ! root . require || ! root . require . packaged ) {
163+ _require . original = root . require ;
164+ root . require = require ;
165+ root . require . packaged = true ;
166+ }
167+ }
168+
169+ exportAce ( ACE_NAMESPACE ) ;
170+ } ) ( ) ;
171+
0 commit comments