Skip to content

Commit

Permalink
[vscode] fix #5756: unzip node_modules for built-in extensions
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
  • Loading branch information
akosyakov committed Jul 23, 2019
1 parent 45cfbfc commit ccaa5d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- [security] Bump lodash.mergewith from 4.6.1 to 4.6.2
- [plugin] Fixed `Converting circular structure to JSON` Error [#5661](https://github.com/theia-ide/theia/pull/5661)
- [plugin] fixed auto detection of new languages [#5753](https://github.com/theia-ide/theia/issues/5753)
- [vscode] unzip node_modules for built-in extensions [#5756](https://github.com/theia-ide/theia/pull/5756)

Breaking changes:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import { PluginDeployerFileHandler, PluginDeployerEntry, PluginDeployerFileHandlerContext } from '@theia/plugin-ext';
import { injectable } from 'inversify';
import * as fs from 'fs-extra';
import * as path from 'path';
import { getTempDir } from '@theia/plugin-ext';

Expand All @@ -41,6 +42,13 @@ export class PluginVsCodeFileHandler implements PluginDeployerFileHandler {

const unpackedPath = path.resolve(this.unpackedFolder, path.basename(context.pluginEntry().path()));
await context.unzip(context.pluginEntry().path(), unpackedPath);
if (context.pluginEntry().path().endsWith('.tgz')) {
const extensionPath = path.join(unpackedPath, 'package');
const vscodeNodeModulesPath = path.join(extensionPath, 'vscode_node_modules.zip');
if (await fs.pathExists(vscodeNodeModulesPath)) {
await context.unzip(vscodeNodeModulesPath, path.join(extensionPath, 'node_modules'));
}
}

context.pluginEntry().updatePath(unpackedPath);
return Promise.resolve();
Expand Down

0 comments on commit ccaa5d8

Please sign in to comment.