diff --git a/CHANGELOG.md b/CHANGELOG.md index fe1ad73c7fb7d..c5e7f5c865206 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - [plugin] added support of debug activation events [#5645](https://github.com/theia-ide/theia/pull/5645) - [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) +- [vscode] unzip node_modules for built-in extensions [#5756](https://github.com/theia-ide/theia/pull/5756) Breaking changes: diff --git a/packages/plugin-ext-vscode/src/node/plugin-vscode-file-handler.ts b/packages/plugin-ext-vscode/src/node/plugin-vscode-file-handler.ts index f6fdc27df0411..7e3476c14546a 100644 --- a/packages/plugin-ext-vscode/src/node/plugin-vscode-file-handler.ts +++ b/packages/plugin-ext-vscode/src/node/plugin-vscode-file-handler.ts @@ -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'; @@ -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();