mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
Load internal modules with an atom engines field as packages
This commit is contained in:
@@ -91,7 +91,15 @@ _.extend atom,
|
||||
resolvePackagePath: (name) ->
|
||||
return name if fsUtils.isDirectory(name)
|
||||
path = fsUtils.resolve(config.packageDirPaths..., name)
|
||||
path if fsUtils.isDirectory(path)
|
||||
if fsUtils.isDirectory(path)
|
||||
path
|
||||
else
|
||||
packagePath = fsUtils.join(window.resourcePath, 'node_modules', name)
|
||||
packagePath if @isInternalPackage(packagePath)
|
||||
|
||||
isInternalPackage: (packagePath) ->
|
||||
{engines} = Package.loadMetadata(packagePath, true)
|
||||
return packagePath if engines?.atom?
|
||||
|
||||
getLoadedPackage: (name) ->
|
||||
@loadedPackages[name]
|
||||
@@ -107,9 +115,14 @@ _.extend atom,
|
||||
|
||||
getAvailablePackagePaths: ->
|
||||
packagePaths = []
|
||||
|
||||
for packageDirPath in config.packageDirPaths
|
||||
for packagePath in fsUtils.list(packageDirPath)
|
||||
packagePaths.push(packagePath) if fsUtils.isDirectory(packagePath)
|
||||
|
||||
for packagePath in fsUtils.list(fsUtils.join(window.resourcePath, 'node_modules'))
|
||||
packagePaths.push(packagePath) if @isInternalPackage(packagePath)
|
||||
|
||||
_.uniq(packagePaths)
|
||||
|
||||
getAvailablePackageNames: ->
|
||||
|
||||
Reference in New Issue
Block a user