File tree 3 files changed +39
-1
lines changed 3 files changed +39
-1
lines changed Original file line number Diff line number Diff line change 76
76
'lib/renderer/extensions/i18n.js' ,
77
77
'lib/renderer/extensions/storage.js' ,
78
78
'lib/renderer/extensions/web-navigation.js' ,
79
+ 'lib/worker/init.js' ,
79
80
],
80
81
'js2c_sources' : [
81
82
'lib/common/asar.js' ,
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ const Module = require('module')
6
6
const resolvePromise = Promise . resolve . bind ( Promise )
7
7
8
8
// We modified the original process.argv to let node.js load the
9
- // atom-renderer .js, we need to restore it here.
9
+ // init .js, we need to restore it here.
10
10
process . argv . splice ( 1 , 1 )
11
11
12
12
// Clear search paths.
Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+
3
+ const path = require ( 'path' )
4
+ const Module = require ( 'module' )
5
+
6
+ // We modified the original process.argv to let node.js load the
7
+ // init.js, we need to restore it here.
8
+ process . argv . splice ( 1 , 1 )
9
+
10
+ // Clear search paths.
11
+ require ( '../common/reset-search-paths' )
12
+
13
+ // Import common settings.
14
+ require ( '../common/init' )
15
+
16
+ // Expose public APIs.
17
+ Module . globalPaths . push ( path . join ( __dirname , 'api' , 'exports' ) )
18
+
19
+ // Export node bindings to global.
20
+ global . require = require
21
+ global . module = module
22
+
23
+ // Set the __filename to the path of html file if it is file: protocol.
24
+ if ( self . location . protocol === 'file:' ) {
25
+ let pathname = process . platform === 'win32' && self . location . pathname [ 0 ] === '/' ? self . location . pathname . substr ( 1 ) : self . location . pathname
26
+ global . __filename = path . normalize ( decodeURIComponent ( pathname ) )
27
+ global . __dirname = path . dirname ( global . __filename )
28
+
29
+ // Set module's filename so relative require can work as expected.
30
+ module . filename = global . __filename
31
+
32
+ // Also search for module under the html file.
33
+ module . paths = module . paths . concat ( Module . _nodeModulePaths ( global . __dirname ) )
34
+ } else {
35
+ global . __filename = __filename
36
+ global . __dirname = __dirname
37
+ }
You can’t perform that action at this time.
0 commit comments