1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | "use strict";
|
11 |
|
12 |
|
13 | ( function ( workspace ) {
|
14 | const
|
15 | NODE_PREFIX = "node://",
|
16 | NODE_PREFIX_SIZE = NODE_PREFIX.length,
|
17 | modules = {},
|
18 | definitions = {},
|
19 | nodejsRequire = typeof window.require === 'function' ? window.require : null;
|
20 | const f = function ( id, body ) {
|
21 | if ( id.substr( 0, NODE_PREFIX_SIZE ) === NODE_PREFIX ) {
|
22 |
|
23 | if ( !nodejsRequire ) {
|
24 | throw Error( "[require] NodeJS is not available to load module " + id.substr( NODE_PREFIX_SIZE ) );
|
25 | }
|
26 | return nodejsRequire( id.substr( NODE_PREFIX_SIZE ) );
|
27 | }
|
28 |
|
29 | if ( typeof body === 'function' ) {
|
30 | definitions[ id ] = body;
|
31 | return body;
|
32 | }
|
33 | const moduleInit = definitions[ id ];
|
34 | if ( typeof moduleInit === 'undefined' ) {
|
35 | const err = new Error( "Required module is missing: " + id );
|
36 | console.error( err.stack );
|
37 | throw err;
|
38 | }
|
39 | var mod = modules[ id ];
|
40 | if ( typeof mod === 'undefined' ) {
|
41 | mod = { exports: {} };
|
42 | const exports = mod.exports;
|
43 | moduleInit.call( workspace, f, mod, exports );
|
44 | modules[ id ] = mod.exports;
|
45 | mod = mod.exports;
|
46 | }
|
47 | return mod;
|
48 | };
|
49 |
|
50 | workspace.APP = {};
|
51 | workspace.require = f;
|
52 | return f;
|
53 | }( this ) ); |
\ | No newline at end of file |