 
   constructor: (@path, @metadata) ->
     @emitter = new Emitter
+    @stylesheetDisposables = new CompositeDisposable
     @metadata ?= Package.loadMetadata(@path)
     @bundledPackage = Package.isBundledPackagePath(@path)
     @name = @metadata?.name ? path.basename(@path)

  reloadStylesheets: ->
    oldSheets = _.clone(@stylesheets)
    @loadStylesheets()
    atom.themes.removeStylesheet(stylesheetPath) for [stylesheetPath] in oldSheets
    @reloadStylesheet(stylesheetPath, content) for [stylesheetPath, content] in @stylesheets

  reloadStylesheet: (stylesheetPath, content) ->
    atom.themes.applyStylesheet(stylesheetPath, content, @getStylesheetType())

  requireMainModule: ->
    return @mainModule if @mainModule?

  activateStylesheets: ->
    return if @stylesheetsActivated

    group = @getStylesheetType()
    for [sourcePath, source] in @stylesheets
      @stylesheetDisposables.add(atom.styles.addStyleSheet(source, {sourcePath, sourcePath}))
    @stylesheetsActivated = true

  activateResources: ->
