From: Cheng Zhao Date: Thu, 12 Nov 2015 09:02:04 +0000 (+0800) Subject: Add ELECTRON_DISABLE_OLD_STYLE_MODULES env X-Git-Tag: v0.35.0~15^2~10 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=f9d7e7ce559d28307058cf196e280e8e2d2eed0e;p=electron.git Add ELECTRON_DISABLE_OLD_STYLE_MODULES env --- diff --git a/atom/browser/lib/init.coffee b/atom/browser/lib/init.coffee index fd6059bd..a9092e3f 100644 --- a/atom/browser/lib/init.coffee +++ b/atom/browser/lib/init.coffee @@ -13,12 +13,13 @@ require path.resolve(__dirname, '..', '..', 'common', 'lib', 'reset-search-paths # Import common settings. require path.resolve(__dirname, '..', '..', 'common', 'lib', 'init') -# Add browser/api/lib to module search paths, which contains javascript part of -# Electron's built-in libraries. +# Expose public APIs. globalPaths = Module.globalPaths -globalPaths.push path.resolve(__dirname, '..', 'api', 'lib') globalPaths.push path.resolve(__dirname, '..', 'api', 'lib', 'exports') +unless process.env.ELECTRON_DISABLE_OLD_STYLE_MODULES + globalPaths.push path.resolve(__dirname, '..', 'api', 'lib') + if process.platform is 'win32' # Redirect node's console to use our own implementations, since node can not # handle console output when running as GUI program. diff --git a/atom/common/lib/init.coffee b/atom/common/lib/init.coffee index 1c80e617..a9287199 100644 --- a/atom/common/lib/init.coffee +++ b/atom/common/lib/init.coffee @@ -9,8 +9,9 @@ process.atomBinding = (name) -> catch e process.binding "atom_common_#{name}" if /No such module/.test e.message -# Add common/api/lib to module search paths. -Module.globalPaths.push path.resolve(__dirname, '..', 'api', 'lib') +unless process.env.ELECTRON_DISABLE_OLD_STYLE_MODULES + # Add common/api/lib to module search paths. + Module.globalPaths.push path.resolve(__dirname, '..', 'api', 'lib') # setImmediate and process.nextTick makes use of uv_check and uv_prepare to # run the callbacks, however since we only run uv loop on requests, the diff --git a/atom/renderer/lib/init.coffee b/atom/renderer/lib/init.coffee index 47797942..4f0e6a32 100644 --- a/atom/renderer/lib/init.coffee +++ b/atom/renderer/lib/init.coffee @@ -13,12 +13,13 @@ require path.resolve(__dirname, '..', '..', 'common', 'lib', 'reset-search-paths # Import common settings. require path.resolve(__dirname, '..', '..', 'common', 'lib', 'init') -# Add renderer/api/lib to require's search paths, which contains javascript part -# of Atom's built-in libraries. +# Expose public APIs. globalPaths = Module.globalPaths -globalPaths.push path.resolve(__dirname, '..', 'api', 'lib') globalPaths.push path.resolve(__dirname, '..', 'api', 'lib', 'exports') +unless process.env.ELECTRON_DISABLE_OLD_STYLE_MODULES + globalPaths.push path.resolve(__dirname, '..', 'api', 'lib') + # The global variable will be used by ipc for event dispatching v8Util = process.atomBinding 'v8_util' v8Util.setHiddenValue global, 'ipc', new events.EventEmitter