| 
									
										
										
										
											2017-11-01 04:53:36 +03:00
										 |  |  | /********************************************************************** | 
					
						
							|  |  |  | *  | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | * | 
					
						
							| 
									
										
										
										
											2020-12-12 22:41:49 +03:00
										 |  |  | * This can be loaded from two contexts: | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | * 	- <script src=../> | 
					
						
							|  |  |  | * 		Needs the requirejs module already loaded... | 
					
						
							|  |  |  | * 		Example: | 
					
						
							|  |  |  | * 			<script src="js/require.min.js"/> | 
					
						
							|  |  |  | * 			<script src="cfg/requirejs.js"/> | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | * 	- require(..) | 
					
						
							|  |  |  | * 		This needs the root require(..) function... | 
					
						
							|  |  |  | * 		Example: | 
					
						
							|  |  |  | * 			// in the root module...
 | 
					
						
							|  |  |  | * 			require('./cfg/requirejs.js')(require) | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | * | 
					
						
							| 
									
										
										
										
											2020-12-14 20:06:58 +03:00
										 |  |  | **********************************************************/(function(){ | 
					
						
							| 
									
										
										
										
											2020-08-31 00:02:33 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-12 22:41:49 +03:00
										 |  |  | var _requirejs = typeof(requirejs) != 'undefined' && requirejs | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-23 20:02:37 +03:00
										 |  |  | var setup = function(require, root){ | 
					
						
							| 
									
										
										
										
											2020-12-12 22:41:49 +03:00
										 |  |  | 	var res = {} | 
					
						
							|  |  |  | 	var requirejs = _requirejs | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	var requirejs_cfg = { | 
					
						
							| 
									
										
										
										
											2022-01-28 21:41:06 +03:00
										 |  |  | 		// XXX under electron the path seems to be one level above the 
 | 
					
						
							|  |  |  | 		// 		actual base URL, i.e. one level above the $0, hence the 
 | 
					
						
							|  |  |  | 		// 		need to correct this...
 | 
					
						
							| 
									
										
										
										
											2020-12-23 20:02:37 +03:00
										 |  |  | 		baseUrl: root ? | 
					
						
							|  |  |  | 				root | 
					
						
							|  |  |  | 			: typeof(process) != 'undefined'  | 
					
						
							| 
									
										
										
										
											2020-12-12 22:41:49 +03:00
										 |  |  | 					&& process.versions.electron ? | 
					
						
							|  |  |  | 				(require.main ? | 
					
						
							|  |  |  | 					require.main.filename.split(/[\\\/]/g).slice(0, -1).join('/') | 
					
						
							|  |  |  | 					: document.baseURI | 
					
						
							| 
									
										
										
										
											2022-01-27 17:24:08 +03:00
										 |  |  | 						// remove URL protocol...
 | 
					
						
							|  |  |  | 						.replace(/^[a-zA-Z]+:\/\/\/?/, '/') | 
					
						
							|  |  |  | 						// remove leading '/' on windows drives...
 | 
					
						
							|  |  |  | 						.replace(/^\/[a-zA-Z]:/, '') | 
					
						
							| 
									
										
										
										
											2020-12-12 22:41:49 +03:00
										 |  |  | 						.split(/[#&]/)[0].split(/[\\\/]/g).slice(0, -1).join('/')) | 
					
						
							|  |  |  | 			:  '.', | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// XXX this does not work on direct filesystem access...
 | 
					
						
							|  |  |  | 		//urlArgs: 'bust='+Date.now(),
 | 
					
						
							| 
									
										
										
										
											2019-05-03 19:43:22 +03:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2020-12-12 22:41:49 +03:00
										 |  |  | 		paths: { | 
					
						
							|  |  |  | 			text: 'node_modules/requirejs-plugins/lib/text', | 
					
						
							|  |  |  | 			json: 'node_modules/requirejs-plugins/src/json', | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 			//react: 'node_modules/react/dist/react-with-addons.min.js',
 | 
					
						
							|  |  |  | 			//'react-dom': 'node_modules/react-dom/dist/react-dom.min.js',
 | 
					
						
							|  |  |  | 			//'ext-lib/preact': './node_modules/preact/dist/preact.dev',
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-02 18:04:06 +03:00
										 |  |  | 			'lib/doc': 'node_modules/ig-doc/doc', | 
					
						
							| 
									
										
										
										
											2022-08-12 21:06:07 +03:00
										 |  |  | 			'lib/stoppable': 'node_modules/ig-stoppable/stoppable', | 
					
						
							| 
									
										
										
										
											2020-12-12 22:41:49 +03:00
										 |  |  | 			'lib/object': 'node_modules/ig-object/object', | 
					
						
							|  |  |  | 			'lib/types': 'node_modules/ig-types/', | 
					
						
							|  |  |  | 			'lib/actions': 'node_modules/ig-actions/actions', | 
					
						
							|  |  |  | 			'lib/features': 'node_modules/ig-features/features', | 
					
						
							|  |  |  | 			//'lib/keyboard': './node_modules/ig-keyboard/keyboard',
 | 
					
						
							|  |  |  | 			'object-run': 'node_modules/object-run/run', | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 			'lib/argv': 'node_modules/ig-argv/argv', | 
					
						
							|  |  |  | 			'lib/walk': 'node_modules/generic-walk/walk', | 
					
						
							|  |  |  | 		},	 | 
					
						
							|  |  |  | 		map: { | 
					
						
							|  |  |  | 			'*': { | 
					
						
							|  |  |  | 				// back-refs
 | 
					
						
							|  |  |  | 				// ...these enable the npm modules reference each other in 
 | 
					
						
							|  |  |  | 				// a cross-platform manner....
 | 
					
						
							| 
									
										
										
										
											2022-08-02 18:04:06 +03:00
										 |  |  | 				'ig-doc': 'lib/doc', | 
					
						
							| 
									
										
										
										
											2020-12-12 22:41:49 +03:00
										 |  |  | 				'ig-object': 'lib/object', | 
					
						
							|  |  |  | 				'ig-types': 'lib/types', | 
					
						
							|  |  |  | 				'ig-actions': 'lib/actions', | 
					
						
							|  |  |  | 				'ig-features': 'lib/features', | 
					
						
							| 
									
										
										
										
											2022-07-07 22:22:36 +03:00
										 |  |  | 				'ig-stoppable': 'lib/stoppable', | 
					
						
							| 
									
										
										
										
											2020-12-12 22:41:49 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 				//'ig-keyboard': 'lib/keyboard',
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				'ig-argv': 'lib/argv', | 
					
						
							|  |  |  | 				'generic-walk': 'lib/walk', | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2017-11-01 04:53:36 +03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2020-12-12 22:41:49 +03:00
										 |  |  | 		packages: [ | 
					
						
							|  |  |  | 			'lib/types', | 
					
						
							|  |  |  | 		], | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// node contexts...
 | 
					
						
							|  |  |  | 	if(typeof(process) != 'undefined'){ | 
					
						
							|  |  |  | 		var nodeRequire =  | 
					
						
							|  |  |  | 		requirejs_cfg.nodeRequire =  | 
					
						
							|  |  |  | 			global.nodeRequire  | 
					
						
							|  |  |  | 				|| global.require | 
					
						
							|  |  |  | 				|| require | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		require('app-module-path') | 
					
						
							|  |  |  | 			.addPath('.') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		requirejs =  | 
					
						
							|  |  |  | 		global.requirejs =  | 
					
						
							|  |  |  | 		res.requirejs = | 
					
						
							|  |  |  | 			global.requirejs  | 
					
						
							| 
									
										
										
										
											2021-10-14 19:13:52 +03:00
										 |  |  | 				// XXX this breaks for electron version 15...
 | 
					
						
							|  |  |  | 				// 		the problem seems to be the "#!/..." at the start of r.js...
 | 
					
						
							| 
									
										
										
										
											2020-12-12 22:41:49 +03:00
										 |  |  | 				|| require('requirejs')  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		global.nodeRequire =  | 
					
						
							|  |  |  | 		res.nodeRequire = | 
					
						
							|  |  |  | 			nodeRequire } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-01 05:46:39 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-12 22:41:49 +03:00
										 |  |  | 	// browser contexts...
 | 
					
						
							|  |  |  | 	if(typeof(window) != 'undefined'){ | 
					
						
							|  |  |  | 		window.nodeRequire =  | 
					
						
							|  |  |  | 			window.nodeRequire  | 
					
						
							|  |  |  | 				|| (typeof(require) != 'undefined'  | 
					
						
							|  |  |  | 					&& require !== requirejs | 
					
						
							|  |  |  | 					&& require)  | 
					
						
							|  |  |  | 		window.requirejs = requirejs } | 
					
						
							| 
									
										
										
										
											2017-11-01 05:46:39 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-12 22:41:49 +03:00
										 |  |  | 	requirejs.config(requirejs_cfg) | 
					
						
							| 
									
										
										
										
											2017-11-01 05:46:39 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-12 22:41:49 +03:00
										 |  |  | 	return res } | 
					
						
							| 
									
										
										
										
											2017-11-01 05:46:39 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-12 22:41:49 +03:00
										 |  |  | //---------------------------------------------------------------------
 | 
					
						
							|  |  |  | // Run/export the setup...
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // we can get here from two contexts...
 | 
					
						
							|  |  |  | typeof(process) == 'undefined' ? | 
					
						
							|  |  |  | 	// browser's <script src="..">...
 | 
					
						
							|  |  |  | 	setup(require) | 
					
						
							|  |  |  | 	// node's require(..)
 | 
					
						
							|  |  |  | 	: (module.exports = setup) | 
					
						
							| 
									
										
										
										
											2017-11-01 04:53:36 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /********************************************************************** | 
					
						
							| 
									
										
										
										
											2020-12-14 20:06:58 +03:00
										 |  |  | * vim:set ts=4 sw=4 :                                           */ })() |