mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Rename AtomPackage.packageMain to .mainModule
This commit is contained in:
@@ -6,7 +6,7 @@ $ = require 'jquery'
|
||||
module.exports =
|
||||
class AtomPackage extends Package
|
||||
metadata: null
|
||||
packageMain: null
|
||||
mainModule: null
|
||||
deferActivation: false
|
||||
|
||||
load: ->
|
||||
@@ -48,17 +48,17 @@ class AtomPackage extends Package
|
||||
else
|
||||
try
|
||||
if @requirePackageMain()
|
||||
config.setDefaults(@name, @packageMain.configDefaults)
|
||||
config.setDefaults(@name, @mainModule.configDefaults)
|
||||
atom.activateAtomPackage(this)
|
||||
catch e
|
||||
console.warn "Failed to activate package named '#{@name}'", e.stack
|
||||
|
||||
requirePackageMain: ->
|
||||
return @packageMain if @packageMain
|
||||
return @mainModule if @mainModule
|
||||
mainPath = @path
|
||||
mainPath = fs.join(mainPath, @metadata.main) if @metadata.main
|
||||
mainPath = require.resolve(mainPath)
|
||||
@packageMain = require(mainPath) if fs.isFile(mainPath)
|
||||
@mainModule = require(mainPath) if fs.isFile(mainPath)
|
||||
|
||||
registerDeferredDeserializers: ->
|
||||
for deserializerName in @metadata.deferredDeserializers ? []
|
||||
|
||||
@@ -24,10 +24,10 @@ _.extend atom,
|
||||
|
||||
activateAtomPackage: (pack) ->
|
||||
@activatedAtomPackages.push(pack)
|
||||
pack.packageMain.activate(@atomPackageStates[pack.name] ? {})
|
||||
pack.mainModule.activate(@atomPackageStates[pack.name] ? {})
|
||||
|
||||
deactivateAtomPackages: ->
|
||||
pack.packageMain.deactivate?() for pack in @activatedAtomPackages
|
||||
pack.mainModule.deactivate?() for pack in @activatedAtomPackages
|
||||
@activatedAtomPackages = []
|
||||
|
||||
serializeAtomPackages: ->
|
||||
@@ -35,7 +35,7 @@ _.extend atom,
|
||||
for pack in @loadedPackages
|
||||
if pack in @activatedAtomPackages
|
||||
try
|
||||
packageStates[pack.name] = pack.packageMain.serialize?()
|
||||
packageStates[pack.name] = pack.mainModule.serialize?()
|
||||
catch e
|
||||
console?.error("Exception serializing '#{pack.name}' package's module\n", e.stack)
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user