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 22, 2019
1 parent 3587c23 commit 7546eb9
Showing 1 changed file with 8 additions and 0 deletions.
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 7546eb9

Please sign in to comment.