This repository has been archived by the owner on Jun 20, 2018. It is now read-only.
forked from eclipse-theia/theia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
this PR implements - retrieving metadata from plugins and using the metadata for plugin activation and deactivation; - pluggability, which allows extending the plugin system to run different types of plugins.
- Loading branch information
Showing
16 changed files
with
496 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (C) 2015-2018 Red Hat, Inc. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
|
||
import { BackendInitializationFn } from '../../common/plugin-protocol'; | ||
import { createAPI } from '../../plugin/plugin-context'; | ||
|
||
export const doInitialization: BackendInitializationFn = (rpc: any) => { | ||
const theia = createAPI(rpc); | ||
|
||
// add theia into global goal | ||
const g = global as any; | ||
g['theia'] = theia; | ||
|
||
const NODE_MODULE_NAMES = ['@theia/plugin', '@wiptheia/plugin']; | ||
const module = require('module'); | ||
|
||
// add theia object as module into npm cache | ||
NODE_MODULE_NAMES.forEach(moduleName => { | ||
require.cache[moduleName] = { | ||
id: moduleName, | ||
filename: moduleName, | ||
loaded: true, | ||
exports: theia | ||
}; | ||
}); | ||
|
||
// save original resolve method | ||
const internalResolve = module._resolveFilename; | ||
|
||
// if we try to resolve theia module, return the filename entry to use cache. | ||
module._resolveFilename = (request: string, parent: {}) => { | ||
if (NODE_MODULE_NAMES.indexOf(request) !== -1) { | ||
return request; | ||
} | ||
const retVal = internalResolve(request, parent); | ||
return retVal; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (C) 2018 Red Hat, Inc. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
|
||
import { BackendInitializationFn } from '../../common/plugin-protocol'; | ||
import { createAPI } from '../../plugin/plugin-context'; | ||
|
||
export const doInitialization: BackendInitializationFn = (rpc: any) => { | ||
const module = require('module'); | ||
const vscodeModuleName = 'vscode'; | ||
const theia = createAPI(rpc); | ||
|
||
// add theia into global goal as 'vscode' | ||
const g = global as any; | ||
g[vscodeModuleName] = theia; | ||
|
||
// add vscode object as module into npm cache | ||
require.cache[vscodeModuleName] = { | ||
id: vscodeModuleName, | ||
filename: vscodeModuleName, | ||
loaded: true, | ||
exports: g[vscodeModuleName] | ||
}; | ||
|
||
// save original resolve method | ||
const internalResolve = module._resolveFilename; | ||
|
||
// if we try to resolve vscode module, return the filename entry to use cache. | ||
module._resolveFilename = (request: string, parent: {}) => { | ||
if (vscodeModuleName === request) { | ||
return request; | ||
} | ||
const retVal = internalResolve(request, parent); | ||
return retVal; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.