First pass at per-package transpilation

This commit is contained in:
Michelle Tilley
2016-10-29 14:30:24 -07:00
parent 0860f354ca
commit ad448184b4
3 changed files with 152 additions and 3 deletions

View File

@@ -6,6 +6,7 @@ CSON = require 'season'
fs = require 'fs-plus'
{Emitter, CompositeDisposable} = require 'event-kit'
CompileCache = require './compile-cache'
ModuleCache = require './module-cache'
ScopedProperties = require './scoped-properties'
BufferedProcess = require './buffered-process'
@@ -86,6 +87,7 @@ class Package
@loadStylesheets()
@registerDeserializerMethods()
@activateCoreStartupServices()
@registerTranspilerConfig()
@configSchemaRegisteredOnLoad = @registerConfigSchemaFromMetadata()
@settingsPromise = @loadSettings()
if @shouldRequireMainModuleOnLoad() and not @mainModule?
@@ -94,6 +96,9 @@ class Package
@handleError("Failed to load the #{@name} package", error)
this
unload: ->
@unregisterTranspilerConfig()
shouldRequireMainModuleOnLoad: ->
not (
@metadata.deserializers? or
@@ -247,6 +252,16 @@ class Package
@activationDisposables.add @packageManager.serviceHub.consume(name, version, @mainModule[methodName].bind(@mainModule))
return
registerTranspilerConfig: ->
if @metadata.atomTranspilers
for transpiler in @metadata.atomTranspilers
CompileCache.addTranspilerConfigForPath(@path, transpiler)
unregisterTranspilerConfig: ->
if @metadata.atomTranspilers
for transpiler in @metadata.atomTranspilers
CompileCache.removeTranspilerConfigForPath(@path)
loadKeymaps: ->
if @bundledPackage and @packageManager.packagesCache[@name]?
@keymaps = (["#{@packageManager.resourcePath}#{path.sep}#{keymapPath}", keymapObject] for keymapPath, keymapObject of @packageManager.packagesCache[@name].keymaps)