@theia/plugin-ext-vscode 1.77.0-next.95 → 1.77.0
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.
- package/lib/browser/plugin-vscode-commands-contribution.d.ts.map +1 -1
- package/lib/browser/plugin-vscode-commands-contribution.js +213 -240
- package/lib/browser/plugin-vscode-commands-contribution.js.map +1 -1
- package/lib/browser/plugin-vscode-commands-contribution.spec.js +122 -59
- package/lib/browser/plugin-vscode-commands-contribution.spec.js.map +1 -1
- package/lib/browser/plugin-vscode-contribution.js +11 -14
- package/lib/browser/plugin-vscode-contribution.js.map +1 -1
- package/lib/browser/plugin-vscode-frontend-module.js +12 -14
- package/lib/browser/plugin-vscode-frontend-module.js.map +1 -1
- package/lib/common/plugin-vscode-environment.js +12 -16
- package/lib/common/plugin-vscode-environment.js.map +1 -1
- package/lib/common/plugin-vscode-types.d.ts +1 -1
- package/lib/common/plugin-vscode-types.js +3 -6
- package/lib/common/plugin-vscode-types.js.map +1 -1
- package/lib/common/plugin-vscode-uri.js +5 -9
- package/lib/common/plugin-vscode-uri.js.map +1 -1
- package/lib/node/context/plugin-vscode-init-fe.d.ts +1 -2
- package/lib/node/context/plugin-vscode-init-fe.d.ts.map +1 -1
- package/lib/node/context/plugin-vscode-init-fe.js +3 -2
- package/lib/node/context/plugin-vscode-init-fe.js.map +1 -1
- package/lib/node/local-vsix-file-plugin-deployer-resolver.d.ts +3 -1
- package/lib/node/local-vsix-file-plugin-deployer-resolver.d.ts.map +1 -1
- package/lib/node/local-vsix-file-plugin-deployer-resolver.js +31 -32
- package/lib/node/local-vsix-file-plugin-deployer-resolver.js.map +1 -1
- package/lib/node/package.spec.d.ts +1 -0
- package/lib/node/package.spec.js +1 -1
- package/lib/node/package.spec.js.map +1 -1
- package/lib/node/plugin-vscode-backend-module.js +22 -24
- package/lib/node/plugin-vscode-backend-module.js.map +1 -1
- package/lib/node/plugin-vscode-cli-contribution.js +10 -13
- package/lib/node/plugin-vscode-cli-contribution.js.map +1 -1
- package/lib/node/plugin-vscode-deployer-participant.d.ts +1 -1
- package/lib/node/plugin-vscode-deployer-participant.d.ts.map +1 -1
- package/lib/node/plugin-vscode-deployer-participant.js +17 -22
- package/lib/node/plugin-vscode-deployer-participant.js.map +1 -1
- package/lib/node/plugin-vscode-directory-handler.js +23 -28
- package/lib/node/plugin-vscode-directory-handler.js.map +1 -1
- package/lib/node/plugin-vscode-file-handler.d.ts +3 -1
- package/lib/node/plugin-vscode-file-handler.d.ts.map +1 -1
- package/lib/node/plugin-vscode-file-handler.js +26 -28
- package/lib/node/plugin-vscode-file-handler.js.map +1 -1
- package/lib/node/plugin-vscode-init.d.ts.map +1 -1
- package/lib/node/plugin-vscode-init.js +12 -16
- package/lib/node/plugin-vscode-init.js.map +1 -1
- package/lib/node/plugin-vscode-init.spec.js +8 -11
- package/lib/node/plugin-vscode-init.spec.js.map +1 -1
- package/lib/node/plugin-vscode-utils.d.ts +6 -4
- package/lib/node/plugin-vscode-utils.d.ts.map +1 -1
- package/lib/node/plugin-vscode-utils.js +24 -32
- package/lib/node/plugin-vscode-utils.js.map +1 -1
- package/lib/node/plugin-vscode-utils.spec.d.ts +2 -0
- package/lib/node/plugin-vscode-utils.spec.d.ts.map +1 -0
- package/lib/node/plugin-vscode-utils.spec.js +151 -0
- package/lib/node/plugin-vscode-utils.spec.js.map +1 -0
- package/lib/node/scanner-vscode.js +19 -22
- package/lib/node/scanner-vscode.js.map +1 -1
- package/lib/node/scanner-vscode.spec.js +12 -15
- package/lib/node/scanner-vscode.spec.js.map +1 -1
- package/package.json +26 -19
- package/src/browser/plugin-vscode-commands-contribution.spec.ts +84 -2
- package/src/browser/plugin-vscode-commands-contribution.ts +14 -11
- package/src/browser/plugin-vscode-frontend-module.ts +3 -3
- package/src/node/context/plugin-vscode-init-fe.ts +2 -1
- package/src/node/local-vsix-file-plugin-deployer-resolver.ts +10 -6
- package/src/node/plugin-vscode-backend-module.ts +7 -7
- package/src/node/plugin-vscode-cli-contribution.ts +1 -1
- package/src/node/plugin-vscode-deployer-participant.ts +2 -2
- package/src/node/plugin-vscode-directory-handler.ts +1 -1
- package/src/node/plugin-vscode-file-handler.ts +7 -3
- package/src/node/plugin-vscode-init.spec.ts +1 -1
- package/src/node/plugin-vscode-init.ts +4 -3
- package/src/node/plugin-vscode-utils.spec.ts +170 -0
- package/src/node/plugin-vscode-utils.ts +26 -11
- package/src/node/scanner-vscode.spec.ts +1 -1
- package/src/node/scanner-vscode.ts +2 -2
|
@@ -14,13 +14,15 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
-
import decompress from 'decompress';
|
|
18
17
|
import * as path from 'path';
|
|
19
18
|
import filenamify from 'filenamify';
|
|
20
19
|
import { FileUri } from '@theia/core/lib/node';
|
|
21
20
|
import * as fs from '@theia/core/shared/fs-extra';
|
|
22
|
-
import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment';
|
|
21
|
+
import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment.js';
|
|
23
22
|
import { PluginIdentifiers, PluginPackage } from '@theia/plugin-ext/lib/common/plugin-protocol';
|
|
23
|
+
import { ArchiveExtractor, ArchiveExtractorImpl } from '@theia/filesystem/lib/node/archive/archive-extractor';
|
|
24
|
+
|
|
25
|
+
const defaultArchiveExtractor = new ArchiveExtractorImpl();
|
|
24
26
|
|
|
25
27
|
/**
|
|
26
28
|
* Extracts extension identity from a VSIX file by reading its package.json.
|
|
@@ -29,13 +31,17 @@ import { PluginIdentifiers, PluginPackage } from '@theia/plugin-ext/lib/common/p
|
|
|
29
31
|
* This function extracts only the `extension/package.json` file to read the extension metadata.
|
|
30
32
|
*
|
|
31
33
|
* @param vsixPath Path to the VSIX file
|
|
34
|
+
* @param archiveExtractor the extractor used to read the VSIX file
|
|
32
35
|
* @returns PluginIdentifiers.Components (publisher?, name, version), or undefined if the package.json cannot be read or is invalid
|
|
33
36
|
*/
|
|
34
|
-
export async function extractExtensionIdentityFromVsix(
|
|
37
|
+
export async function extractExtensionIdentityFromVsix(
|
|
38
|
+
vsixPath: string,
|
|
39
|
+
archiveExtractor: ArchiveExtractor = defaultArchiveExtractor
|
|
40
|
+
): Promise<PluginIdentifiers.Components | undefined> {
|
|
35
41
|
try {
|
|
36
|
-
//
|
|
37
|
-
const files = await
|
|
38
|
-
filter:
|
|
42
|
+
// Read only the package.json file from the VSIX
|
|
43
|
+
const files = await archiveExtractor.readFiles(vsixPath, {
|
|
44
|
+
filter: entryPath => entryPath === 'extension/package.json'
|
|
39
45
|
});
|
|
40
46
|
|
|
41
47
|
if (files.length === 0) {
|
|
@@ -65,15 +71,19 @@ export async function extractExtensionIdentityFromVsix(vsixPath: string): Promis
|
|
|
65
71
|
}
|
|
66
72
|
}
|
|
67
73
|
|
|
68
|
-
export async function decompressExtension(
|
|
74
|
+
export async function decompressExtension(
|
|
75
|
+
sourcePath: string,
|
|
76
|
+
destPath: string,
|
|
77
|
+
archiveExtractor: ArchiveExtractor = defaultArchiveExtractor
|
|
78
|
+
): Promise<boolean> {
|
|
69
79
|
try {
|
|
70
|
-
await
|
|
80
|
+
await archiveExtractor.extract(sourcePath, destPath);
|
|
71
81
|
if (sourcePath.endsWith('.tgz')) {
|
|
72
82
|
// unzip node_modules from built-in extensions, see https://github.com/eclipse-theia/theia/issues/5756
|
|
73
83
|
const extensionPath = path.join(destPath, 'package');
|
|
74
84
|
const vscodeNodeModulesPath = path.join(extensionPath, 'vscode_node_modules.zip');
|
|
75
85
|
if (await fs.pathExists(vscodeNodeModulesPath)) {
|
|
76
|
-
await
|
|
86
|
+
await archiveExtractor.extract(vscodeNodeModulesPath, path.join(extensionPath, 'node_modules'));
|
|
77
87
|
}
|
|
78
88
|
}
|
|
79
89
|
return true;
|
|
@@ -88,7 +98,12 @@ export async function existsInDeploymentDir(env: PluginVSCodeEnvironment, extens
|
|
|
88
98
|
}
|
|
89
99
|
|
|
90
100
|
export const TMP_DIR_PREFIX = 'tmp-vscode-unpacked-';
|
|
91
|
-
export async function unpackToDeploymentDir(
|
|
101
|
+
export async function unpackToDeploymentDir(
|
|
102
|
+
env: PluginVSCodeEnvironment,
|
|
103
|
+
sourcePath: string,
|
|
104
|
+
extensionId: string,
|
|
105
|
+
archiveExtractor: ArchiveExtractor = defaultArchiveExtractor
|
|
106
|
+
): Promise<string> {
|
|
92
107
|
const extensionDeploymentDir = await getExtensionDeploymentDir(env, extensionId);
|
|
93
108
|
if (await fs.pathExists(extensionDeploymentDir)) {
|
|
94
109
|
console.log(`[${extensionId}]: deployment dir "${extensionDeploymentDir}" already exists`);
|
|
@@ -98,7 +113,7 @@ export async function unpackToDeploymentDir(env: PluginVSCodeEnvironment, source
|
|
|
98
113
|
const tempDir = await getTempDir(env, TMP_DIR_PREFIX);
|
|
99
114
|
try {
|
|
100
115
|
console.log(`[${extensionId}]: trying to decompress "${sourcePath}" into "${tempDir}"...`);
|
|
101
|
-
if (!await decompressExtension(sourcePath, tempDir)) {
|
|
116
|
+
if (!await decompressExtension(sourcePath, tempDir, archiveExtractor)) {
|
|
102
117
|
await fs.remove(tempDir);
|
|
103
118
|
const msg = `[${extensionId}]: decompressing "${sourcePath}" to "${tempDir}" failed`;
|
|
104
119
|
console.error(msg);
|
|
@@ -20,7 +20,7 @@ import { expect } from 'chai';
|
|
|
20
20
|
import * as os from 'os';
|
|
21
21
|
import * as path from 'path';
|
|
22
22
|
import * as fs from 'fs';
|
|
23
|
-
import { VsCodePluginScanner } from './scanner-vscode';
|
|
23
|
+
import { VsCodePluginScanner } from './scanner-vscode.js';
|
|
24
24
|
import { PluginPackage } from '@theia/plugin-ext';
|
|
25
25
|
import URI from '@theia/core/lib/common/uri';
|
|
26
26
|
|
|
@@ -19,7 +19,7 @@ import { injectable } from '@theia/core/shared/inversify';
|
|
|
19
19
|
import { PluginScanner, PluginEngine, PluginPackage, PluginModel, PluginLifecycle, PluginIdentifiers, UIKind } from '@theia/plugin-ext';
|
|
20
20
|
import { TheiaPluginScanner } from '@theia/plugin-ext/lib/hosted/node/scanners/scanner-theia';
|
|
21
21
|
import { environment } from '@theia/core/shared/@theia/application-package/lib/environment';
|
|
22
|
-
import { VSCodeExtensionUri } from '../common/plugin-vscode-uri';
|
|
22
|
+
import { VSCodeExtensionUri } from '../common/plugin-vscode-uri.js';
|
|
23
23
|
import { buildLifecycle, buildModelForVsCode } from '@theia/plugin-utils/lib/common/plugin-model';
|
|
24
24
|
|
|
25
25
|
const uiKind = environment.electron.is() ? UIKind.Desktop : UIKind.Web;
|
|
@@ -64,7 +64,7 @@ export class VsCodePluginScanner extends TheiaPluginScanner implements PluginSca
|
|
|
64
64
|
override getLifecycle(plugin: PluginPackage): PluginLifecycle {
|
|
65
65
|
return {
|
|
66
66
|
...buildLifecycle(plugin, 'vscode'),
|
|
67
|
-
backendInitPath: path.join(
|
|
67
|
+
backendInitPath: path.join(import.meta.dirname, 'plugin-vscode-init'),
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
|