@theia/plugin-ext-vscode 1.28.0-next.39 → 1.28.0-next.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,15 @@
1
+ import { PluginDeployerResolverContext } from '@theia/plugin-ext';
2
+ import { LocalPluginDeployerResolver } from '@theia/plugin-ext/lib/main/node/resolvers/local-plugin-deployer-resolver';
3
+ import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment';
4
+ export declare class LocalVSIXFilePluginDeployerResolver extends LocalPluginDeployerResolver {
5
+ static LOCAL_FILE: string;
6
+ protected readonly environment: PluginVSCodeEnvironment;
7
+ protected get supportedScheme(): string;
8
+ accept(pluginId: string): boolean;
9
+ resolveFromLocalPath(pluginResolverContext: PluginDeployerResolverContext, localPath: string): Promise<void>;
10
+ /**
11
+ * Ensures that a user-installed plugin file is transferred to the user extension folder.
12
+ */
13
+ protected ensureDiscoverability(localPath: string): Promise<string>;
14
+ }
15
+ //# sourceMappingURL=local-vsix-file-plugin-deployer-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-vsix-file-plugin-deployer-resolver.d.ts","sourceRoot":"","sources":["../../src/node/local-vsix-file-plugin-deployer-resolver.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,0EAA0E,CAAC;AACvH,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAG9E,qBACa,mCAAoC,SAAQ,2BAA2B;IAChF,MAAM,CAAC,UAAU,SAAgB;IAEA,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,uBAAuB,CAAC;IAEzF,SAAS,KAAK,eAAe,IAAI,MAAM,CAEtC;IAEQ,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIpC,oBAAoB,CAAC,qBAAqB,EAAE,6BAA6B,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMlH;;OAEG;cACa,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAgB5E"}
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2018 Red Hat, Inc. and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ var LocalVSIXFilePluginDeployerResolver_1;
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.LocalVSIXFilePluginDeployerResolver = void 0;
29
+ const fs = require("@theia/core/shared/fs-extra");
30
+ const path = require("path");
31
+ const inversify_1 = require("@theia/core/shared/inversify");
32
+ const node_1 = require("@theia/core/lib/node");
33
+ const local_plugin_deployer_resolver_1 = require("@theia/plugin-ext/lib/main/node/resolvers/local-plugin-deployer-resolver");
34
+ const plugin_vscode_environment_1 = require("../common/plugin-vscode-environment");
35
+ const plugin_vscode_file_handler_1 = require("./plugin-vscode-file-handler");
36
+ let LocalVSIXFilePluginDeployerResolver = LocalVSIXFilePluginDeployerResolver_1 = class LocalVSIXFilePluginDeployerResolver extends local_plugin_deployer_resolver_1.LocalPluginDeployerResolver {
37
+ get supportedScheme() {
38
+ return LocalVSIXFilePluginDeployerResolver_1.LOCAL_FILE;
39
+ }
40
+ accept(pluginId) {
41
+ return super.accept(pluginId) && (0, plugin_vscode_file_handler_1.isVSCodePluginFile)(pluginId);
42
+ }
43
+ async resolveFromLocalPath(pluginResolverContext, localPath) {
44
+ const fileName = path.basename(localPath);
45
+ const pathInUserExtensionsDirectory = await this.ensureDiscoverability(localPath);
46
+ pluginResolverContext.addPlugin(fileName, pathInUserExtensionsDirectory);
47
+ }
48
+ /**
49
+ * Ensures that a user-installed plugin file is transferred to the user extension folder.
50
+ */
51
+ async ensureDiscoverability(localPath) {
52
+ const userExtensionsDir = await this.environment.getExtensionsDirUri();
53
+ if (!userExtensionsDir.isEqualOrParent(node_1.FileUri.create(localPath))) {
54
+ try {
55
+ const newPath = node_1.FileUri.fsPath(userExtensionsDir.resolve(path.basename(localPath)));
56
+ await fs.mkdirp(node_1.FileUri.fsPath(userExtensionsDir));
57
+ await new Promise((resolve, reject) => {
58
+ fs.copyFile(localPath, newPath, error => error ? reject(error) : resolve());
59
+ });
60
+ return newPath;
61
+ }
62
+ catch (e) {
63
+ console.warn(`Problem copying plugin at ${localPath}:`, e);
64
+ }
65
+ }
66
+ return localPath;
67
+ }
68
+ };
69
+ LocalVSIXFilePluginDeployerResolver.LOCAL_FILE = 'local-file';
70
+ __decorate([
71
+ (0, inversify_1.inject)(plugin_vscode_environment_1.PluginVSCodeEnvironment),
72
+ __metadata("design:type", plugin_vscode_environment_1.PluginVSCodeEnvironment)
73
+ ], LocalVSIXFilePluginDeployerResolver.prototype, "environment", void 0);
74
+ LocalVSIXFilePluginDeployerResolver = LocalVSIXFilePluginDeployerResolver_1 = __decorate([
75
+ (0, inversify_1.injectable)()
76
+ ], LocalVSIXFilePluginDeployerResolver);
77
+ exports.LocalVSIXFilePluginDeployerResolver = LocalVSIXFilePluginDeployerResolver;
78
+ //# sourceMappingURL=local-vsix-file-plugin-deployer-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-vsix-file-plugin-deployer-resolver.js","sourceRoot":"","sources":["../../src/node/local-vsix-file-plugin-deployer-resolver.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,2EAA2E;AAC3E,gFAAgF;;;;;;;;;;;;;AAEhF,kDAAkD;AAClD,6BAA6B;AAC7B,4DAAkE;AAClE,+CAA+C;AAE/C,6HAAuH;AACvH,mFAA8E;AAC9E,6EAAkE;AAGlE,IAAa,mCAAmC,2CAAhD,MAAa,mCAAoC,SAAQ,4DAA2B;IAKhF,IAAc,eAAe;QACzB,OAAO,qCAAmC,CAAC,UAAU,CAAC;IAC1D,CAAC;IAEQ,MAAM,CAAC,QAAgB;QAC5B,OAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,IAAA,+CAAkB,EAAC,QAAQ,CAAC,CAAC;IAClE,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,qBAAoD,EAAE,SAAiB;QAC9F,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC1C,MAAM,6BAA6B,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC;QAClF,qBAAqB,CAAC,SAAS,CAAC,QAAQ,EAAE,6BAA6B,CAAC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AE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAc/D,wBAgBG"}
1
+ {"version":3,"file":"plugin-vscode-backend-module.d.ts","sourceRoot":"","sources":["../../src/node/plugin-vscode-backend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAe/D,wBAkBG"}
@@ -26,6 +26,7 @@ const common_1 = require("@theia/plugin-ext/lib/common");
26
26
  const plugin_vscode_environment_1 = require("../common/plugin-vscode-environment");
27
27
  const plugin_vscode_deployer_participant_1 = require("./plugin-vscode-deployer-participant");
28
28
  const plugin_reader_1 = require("./plugin-reader");
29
+ const local_vsix_file_plugin_deployer_resolver_1 = require("./local-vsix-file-plugin-deployer-resolver");
29
30
  exports.default = new inversify_1.ContainerModule(bind => {
30
31
  bind(plugin_vscode_environment_1.PluginVSCodeEnvironment).toSelf().inSingletonScope();
31
32
  bind(plugin_vscode_deployer_participant_1.PluginVSCodeDeployerParticipant).toSelf().inSingletonScope();
@@ -38,5 +39,6 @@ exports.default = new inversify_1.ContainerModule(bind => {
38
39
  bind(common_1.PluginHostEnvironmentVariable).toService(plugin_vscode_cli_contribution_1.PluginVsCodeCliContribution);
39
40
  bind(plugin_reader_1.HostedPluginReader).toSelf().inSingletonScope();
40
41
  bind(node_1.BackendApplicationContribution).toService(plugin_reader_1.HostedPluginReader);
42
+ bind(plugin_ext_1.PluginDeployerResolver).to(local_vsix_file_plugin_deployer_resolver_1.LocalVSIXFilePluginDeployerResolver).inSingletonScope();
41
43
  });
42
44
  //# sourceMappingURL=plugin-vscode-backend-module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-vscode-backend-module.js","sourceRoot":"","sources":["../../src/node/plugin-vscode-backend-module.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6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AAI,CAAC,kCAAkB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACrD,IAAI,CAAC,qCAA8B,CAAC,CAAC,SAAS,CAAC,kCAAkB,CAAC,CAAC;IAEnE,IAAI,CAAC,mCAAsB,CAAC,CAAC,EAAE,CAAC,8EAAmC,CAAC,CAAC,gBAAgB,EAAE,CAAC;AAC5F,CAAC,CAAC,CAAC"}
@@ -1,15 +1,12 @@
1
1
  import { PluginDeployerFileHandler, PluginDeployerEntry, PluginDeployerFileHandlerContext } from '@theia/plugin-ext';
2
2
  import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment';
3
+ export declare const isVSCodePluginFile: (pluginPath?: string | undefined) => boolean;
3
4
  export declare class PluginVsCodeFileHandler implements PluginDeployerFileHandler {
4
5
  protected readonly environment: PluginVSCodeEnvironment;
5
6
  private readonly systemExtensionsDirUri;
6
7
  accept(resolvedPlugin: PluginDeployerEntry): boolean;
7
8
  handle(context: PluginDeployerFileHandlerContext): Promise<void>;
8
9
  protected getExtensionDir(context: PluginDeployerFileHandlerContext): Promise<string>;
9
- /**
10
- * Ensures that a user-installed plugin file is transferred to the user extension folder.
11
- */
12
- protected ensureDiscoverability(context: PluginDeployerFileHandlerContext): Promise<void>;
13
10
  protected decompress(extensionDir: string, context: PluginDeployerFileHandlerContext): Promise<void>;
14
11
  }
15
12
  //# sourceMappingURL=plugin-vscode-file-handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-vscode-file-handler.d.ts","sourceRoot":"","sources":["../../src/node/plugin-vscode-file-handler.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,gCAAgC,EAAc,MAAM,mBAAmB,CAAC;AAMjI,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAI9E,qBACa,uBAAwB,YAAW,yBAAyB;IAGrE,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,uBAAuB,CAAC;IAExD,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAiD;IAExF,MAAM,CAAC,cAAc,EAAE,mBAAmB,GAAG,OAAO;IAQ9C,MAAM,CAAC,OAAO,EAAE,gCAAgC,GAAG,OAAO,CAAC,IAAI,CAAC;cAetD,eAAe,CAAC,OAAO,EAAE,gCAAgC,GAAG,OAAO,CAAC,MAAM,CAAC;IAI3F;;OAEG;cACa,qBAAqB,CAAC,OAAO,EAAE,gCAAgC,GAAG,OAAO,CAAC,IAAI,CAAC;cAoB/E,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,gCAAgC,GAAG,OAAO,CAAC,IAAI,CAAC;CAW7G"}
1
+ {"version":3,"file":"plugin-vscode-file-handler.d.ts","sourceRoot":"","sources":["../../src/node/plugin-vscode-file-handler.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,gCAAgC,EAAc,MAAM,mBAAmB,CAAC;AAMjI,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAG9E,eAAO,MAAM,kBAAkB,8CAAgH,CAAC;AAEhJ,qBACa,uBAAwB,YAAW,yBAAyB;IAGrE,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,uBAAuB,CAAC;IAExD,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAiD;IAExF,MAAM,CAAC,cAAc,EAAE,mBAAmB,GAAG,OAAO;IAO9C,MAAM,CAAC,OAAO,EAAE,gCAAgC,GAAG,OAAO,CAAC,IAAI,CAAC;cActD,eAAe,CAAC,OAAO,EAAE,gCAAgC,GAAG,OAAO,CAAC,MAAM,CAAC;cAI3E,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,gCAAgC,GAAG,OAAO,CAAC,IAAI,CAAC;CAW7G"}
@@ -24,7 +24,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
24
24
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
25
  };
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.PluginVsCodeFileHandler = void 0;
27
+ exports.PluginVsCodeFileHandler = exports.isVSCodePluginFile = void 0;
28
28
  const plugin_ext_1 = require("@theia/plugin-ext");
29
29
  const fs = require("@theia/core/shared/fs-extra");
30
30
  const path = require("path");
@@ -33,7 +33,8 @@ const inversify_1 = require("@theia/core/shared/inversify");
33
33
  const temp_dir_util_1 = require("@theia/plugin-ext/lib/main/node/temp-dir-util");
34
34
  const plugin_vscode_environment_1 = require("../common/plugin-vscode-environment");
35
35
  const file_uri_1 = require("@theia/core/lib/node/file-uri");
36
- const uri_1 = require("@theia/core/lib/common/uri");
36
+ const isVSCodePluginFile = (pluginPath) => Boolean(pluginPath && (pluginPath.endsWith('.vsix') || pluginPath.endsWith('.tgz')));
37
+ exports.isVSCodePluginFile = isVSCodePluginFile;
37
38
  let PluginVsCodeFileHandler = class PluginVsCodeFileHandler {
38
39
  constructor() {
39
40
  this.systemExtensionsDirUri = file_uri_1.FileUri.create((0, temp_dir_util_1.getTempDir)('vscode-unpacked'));
@@ -42,11 +43,9 @@ let PluginVsCodeFileHandler = class PluginVsCodeFileHandler {
42
43
  if (!resolvedPlugin.isFile()) {
43
44
  return false;
44
45
  }
45
- const pluginPath = resolvedPlugin.path();
46
- return !!pluginPath && pluginPath.endsWith('.vsix') || pluginPath.endsWith('.tgz');
46
+ return (0, exports.isVSCodePluginFile)(resolvedPlugin.path());
47
47
  }
48
48
  async handle(context) {
49
- await this.ensureDiscoverability(context);
50
49
  const id = context.pluginEntry().id();
51
50
  const extensionDir = await this.getExtensionDir(context);
52
51
  console.log(`[${id}]: trying to decompress into "${extensionDir}"...`);
@@ -62,29 +61,6 @@ let PluginVsCodeFileHandler = class PluginVsCodeFileHandler {
62
61
  async getExtensionDir(context) {
63
62
  return file_uri_1.FileUri.fsPath(this.systemExtensionsDirUri.resolve(filenamify(context.pluginEntry().id(), { replacement: '_' })));
64
63
  }
65
- /**
66
- * Ensures that a user-installed plugin file is transferred to the user extension folder.
67
- */
68
- async ensureDiscoverability(context) {
69
- if (context.pluginEntry().type === plugin_ext_1.PluginType.User) {
70
- const userExtensionsDir = await this.environment.getExtensionsDirUri();
71
- const currentPath = context.pluginEntry().path();
72
- if (!userExtensionsDir.isEqualOrParent(new uri_1.default(currentPath)) && !userExtensionsDir.isEqualOrParent(new uri_1.default(context.pluginEntry().originalPath()))) {
73
- try {
74
- const newPath = file_uri_1.FileUri.fsPath(userExtensionsDir.resolve(path.basename(currentPath)));
75
- await fs.mkdirp(file_uri_1.FileUri.fsPath(userExtensionsDir));
76
- await new Promise((resolve, reject) => {
77
- fs.copyFile(currentPath, newPath, error => error ? reject(error) : resolve());
78
- });
79
- context.pluginEntry().updatePath(newPath);
80
- context.pluginEntry().storeValue('sourceLocations', [newPath]);
81
- }
82
- catch (e) {
83
- console.error(`[${context.pluginEntry().id}]: Failed to copy to user directory. Future sessions may not have access to this plugin.`);
84
- }
85
- }
86
- }
87
- }
88
64
  async decompress(extensionDir, context) {
89
65
  await context.unzip(context.pluginEntry().path(), extensionDir);
90
66
  if (context.pluginEntry().path().endsWith('.tgz')) {
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-vscode-file-handler.js","sourceRoot":"","sources":["../../src/node/plugin-vscode-file-handler.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,2EAA2E;AAC3E,gFAAgF;;;;;;;;;;;;AAEhF,kDAAiI;AACjI,kDAAkD;AAClD,6BAA6B;AAC7B,yCAAyC;AACzC,4DAAkE;AAClE,iFAA2E;AAC3E,mFAA8E;AAC9E,4DAAwD;AACxD,oDAA6C;AAG7C,IAAa,uBAAuB,GAApC,MAAa,uB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AH/C,uBAAuB;IADnC,IAAA,sBAAU,GAAE;GACA,uBAAuB,CA2CnC;AA3CY,0DAAuB"}
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@theia/plugin-ext-vscode",
3
- "version": "1.28.0-next.39+92084ae000f",
3
+ "version": "1.28.0-next.45+cf1b71e1aa3",
4
4
  "description": "Theia - Plugin Extension for VsCode",
5
5
  "dependencies": {
6
- "@theia/callhierarchy": "1.28.0-next.39+92084ae000f",
7
- "@theia/core": "1.28.0-next.39+92084ae000f",
8
- "@theia/editor": "1.28.0-next.39+92084ae000f",
9
- "@theia/filesystem": "1.28.0-next.39+92084ae000f",
10
- "@theia/monaco": "1.28.0-next.39+92084ae000f",
6
+ "@theia/callhierarchy": "1.28.0-next.45+cf1b71e1aa3",
7
+ "@theia/core": "1.28.0-next.45+cf1b71e1aa3",
8
+ "@theia/editor": "1.28.0-next.45+cf1b71e1aa3",
9
+ "@theia/filesystem": "1.28.0-next.45+cf1b71e1aa3",
10
+ "@theia/monaco": "1.28.0-next.45+cf1b71e1aa3",
11
11
  "@theia/monaco-editor-core": "1.67.2",
12
- "@theia/navigator": "1.28.0-next.39+92084ae000f",
13
- "@theia/plugin": "1.28.0-next.39+92084ae000f",
14
- "@theia/plugin-ext": "1.28.0-next.39+92084ae000f",
15
- "@theia/terminal": "1.28.0-next.39+92084ae000f",
16
- "@theia/userstorage": "1.28.0-next.39+92084ae000f",
17
- "@theia/workspace": "1.28.0-next.39+92084ae000f",
12
+ "@theia/navigator": "1.28.0-next.45+cf1b71e1aa3",
13
+ "@theia/plugin": "1.28.0-next.45+cf1b71e1aa3",
14
+ "@theia/plugin-ext": "1.28.0-next.45+cf1b71e1aa3",
15
+ "@theia/terminal": "1.28.0-next.45+cf1b71e1aa3",
16
+ "@theia/userstorage": "1.28.0-next.45+cf1b71e1aa3",
17
+ "@theia/workspace": "1.28.0-next.45+cf1b71e1aa3",
18
18
  "@types/request": "^2.0.3",
19
19
  "filenamify": "^4.1.0",
20
20
  "request": "^2.82.0"
@@ -58,5 +58,5 @@
58
58
  "nyc": {
59
59
  "extends": "../../configs/nyc.json"
60
60
  },
61
- "gitHead": "92084ae000fa31f4002f130716fce43fa134f2e1"
61
+ "gitHead": "cf1b71e1aa3d01577f3da851fcdee3cb60c57a06"
62
62
  }
@@ -0,0 +1,65 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2018 Red Hat, Inc. and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import * as fs from '@theia/core/shared/fs-extra';
18
+ import * as path from 'path';
19
+ import { inject, injectable } from '@theia/core/shared/inversify';
20
+ import { FileUri } from '@theia/core/lib/node';
21
+ import { PluginDeployerResolverContext } from '@theia/plugin-ext';
22
+ import { LocalPluginDeployerResolver } from '@theia/plugin-ext/lib/main/node/resolvers/local-plugin-deployer-resolver';
23
+ import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment';
24
+ import { isVSCodePluginFile } from './plugin-vscode-file-handler';
25
+
26
+ @injectable()
27
+ export class LocalVSIXFilePluginDeployerResolver extends LocalPluginDeployerResolver {
28
+ static LOCAL_FILE = 'local-file';
29
+
30
+ @inject(PluginVSCodeEnvironment) protected readonly environment: PluginVSCodeEnvironment;
31
+
32
+ protected get supportedScheme(): string {
33
+ return LocalVSIXFilePluginDeployerResolver.LOCAL_FILE;
34
+ }
35
+
36
+ override accept(pluginId: string): boolean {
37
+ return super.accept(pluginId) && isVSCodePluginFile(pluginId);
38
+ }
39
+
40
+ async resolveFromLocalPath(pluginResolverContext: PluginDeployerResolverContext, localPath: string): Promise<void> {
41
+ const fileName = path.basename(localPath);
42
+ const pathInUserExtensionsDirectory = await this.ensureDiscoverability(localPath);
43
+ pluginResolverContext.addPlugin(fileName, pathInUserExtensionsDirectory);
44
+ }
45
+
46
+ /**
47
+ * Ensures that a user-installed plugin file is transferred to the user extension folder.
48
+ */
49
+ protected async ensureDiscoverability(localPath: string): Promise<string> {
50
+ const userExtensionsDir = await this.environment.getExtensionsDirUri();
51
+ if (!userExtensionsDir.isEqualOrParent(FileUri.create(localPath))) {
52
+ try {
53
+ const newPath = FileUri.fsPath(userExtensionsDir.resolve(path.basename(localPath)));
54
+ await fs.mkdirp(FileUri.fsPath(userExtensionsDir));
55
+ await new Promise<void>((resolve, reject) => {
56
+ fs.copyFile(localPath, newPath, error => error ? reject(error) : resolve());
57
+ });
58
+ return newPath;
59
+ } catch (e) {
60
+ console.warn(`Problem copying plugin at ${localPath}:`, e);
61
+ }
62
+ }
63
+ return localPath;
64
+ }
65
+ }
@@ -16,7 +16,7 @@
16
16
 
17
17
  import { ContainerModule } from '@theia/core/shared/inversify';
18
18
  import {
19
- PluginDeployerFileHandler, PluginDeployerDirectoryHandler, PluginScanner, PluginDeployerParticipant
19
+ PluginDeployerFileHandler, PluginDeployerDirectoryHandler, PluginScanner, PluginDeployerParticipant, PluginDeployerResolver
20
20
  } from '@theia/plugin-ext';
21
21
  import { PluginVsCodeFileHandler } from './plugin-vscode-file-handler';
22
22
  import { PluginVsCodeDirectoryHandler } from './plugin-vscode-directory-handler';
@@ -27,6 +27,7 @@ import { PluginHostEnvironmentVariable } from '@theia/plugin-ext/lib/common';
27
27
  import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment';
28
28
  import { PluginVSCodeDeployerParticipant } from './plugin-vscode-deployer-participant';
29
29
  import { HostedPluginReader } from './plugin-reader';
30
+ import { LocalVSIXFilePluginDeployerResolver } from './local-vsix-file-plugin-deployer-resolver';
30
31
 
31
32
  export default new ContainerModule(bind => {
32
33
  bind(PluginVSCodeEnvironment).toSelf().inSingletonScope();
@@ -44,4 +45,6 @@ export default new ContainerModule(bind => {
44
45
 
45
46
  bind(HostedPluginReader).toSelf().inSingletonScope();
46
47
  bind(BackendApplicationContribution).toService(HostedPluginReader);
48
+
49
+ bind(PluginDeployerResolver).to(LocalVSIXFilePluginDeployerResolver).inSingletonScope();
47
50
  });
@@ -22,7 +22,8 @@ import { injectable, inject } from '@theia/core/shared/inversify';
22
22
  import { getTempDir } from '@theia/plugin-ext/lib/main/node/temp-dir-util';
23
23
  import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment';
24
24
  import { FileUri } from '@theia/core/lib/node/file-uri';
25
- import URI from '@theia/core/lib/common/uri';
25
+
26
+ export const isVSCodePluginFile = (pluginPath?: string) => Boolean(pluginPath && (pluginPath.endsWith('.vsix') || pluginPath.endsWith('.tgz')));
26
27
 
27
28
  @injectable()
28
29
  export class PluginVsCodeFileHandler implements PluginDeployerFileHandler {
@@ -36,12 +37,10 @@ export class PluginVsCodeFileHandler implements PluginDeployerFileHandler {
36
37
  if (!resolvedPlugin.isFile()) {
37
38
  return false;
38
39
  }
39
- const pluginPath = resolvedPlugin.path();
40
- return !!pluginPath && pluginPath.endsWith('.vsix') || pluginPath.endsWith('.tgz');
40
+ return isVSCodePluginFile(resolvedPlugin.path());
41
41
  }
42
42
 
43
43
  async handle(context: PluginDeployerFileHandlerContext): Promise<void> {
44
- await this.ensureDiscoverability(context);
45
44
  const id = context.pluginEntry().id();
46
45
  const extensionDir = await this.getExtensionDir(context);
47
46
  console.log(`[${id}]: trying to decompress into "${extensionDir}"...`);
@@ -59,29 +58,6 @@ export class PluginVsCodeFileHandler implements PluginDeployerFileHandler {
59
58
  return FileUri.fsPath(this.systemExtensionsDirUri.resolve(filenamify(context.pluginEntry().id(), { replacement: '_' })));
60
59
  }
61
60
 
62
- /**
63
- * Ensures that a user-installed plugin file is transferred to the user extension folder.
64
- */
65
- protected async ensureDiscoverability(context: PluginDeployerFileHandlerContext): Promise<void> {
66
- if (context.pluginEntry().type === PluginType.User) {
67
- const userExtensionsDir = await this.environment.getExtensionsDirUri();
68
- const currentPath = context.pluginEntry().path();
69
- if (!userExtensionsDir.isEqualOrParent(new URI(currentPath)) && !userExtensionsDir.isEqualOrParent(new URI(context.pluginEntry().originalPath()))) {
70
- try {
71
- const newPath = FileUri.fsPath(userExtensionsDir.resolve(path.basename(currentPath)));
72
- await fs.mkdirp(FileUri.fsPath(userExtensionsDir));
73
- await new Promise<void>((resolve, reject) => {
74
- fs.copyFile(currentPath, newPath, error => error ? reject(error) : resolve());
75
- });
76
- context.pluginEntry().updatePath(newPath);
77
- context.pluginEntry().storeValue('sourceLocations', [newPath]);
78
- } catch (e) {
79
- console.error(`[${context.pluginEntry().id}]: Failed to copy to user directory. Future sessions may not have access to this plugin.`);
80
- }
81
- }
82
- }
83
- }
84
-
85
61
  protected async decompress(extensionDir: string, context: PluginDeployerFileHandlerContext): Promise<void> {
86
62
  await context.unzip(context.pluginEntry().path(), extensionDir);
87
63
  if (context.pluginEntry().path().endsWith('.tgz')) {