@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
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// *****************************************************************************
|
|
3
2
|
// Copyright (C) 2020 TypeFox and others.
|
|
4
3
|
//
|
|
@@ -14,25 +13,23 @@
|
|
|
14
13
|
//
|
|
15
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
15
|
// *****************************************************************************
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const local_vsix_file_plugin_deployer_resolver_1 = require("./local-vsix-file-plugin-deployer-resolver");
|
|
25
|
-
const core_1 = require("@theia/core");
|
|
16
|
+
import { __decorate } from "tslib";
|
|
17
|
+
import { injectable, inject, named } from '@theia/core/shared/inversify';
|
|
18
|
+
import * as fs from '@theia/core/shared/fs-extra';
|
|
19
|
+
import { FileUri } from '@theia/core/lib/node';
|
|
20
|
+
import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment.js';
|
|
21
|
+
import { LocalVSIXFilePluginDeployerResolver } from './local-vsix-file-plugin-deployer-resolver.js';
|
|
22
|
+
import { ILogger } from '@theia/core';
|
|
26
23
|
let PluginVSCodeDeployerParticipant = class PluginVSCodeDeployerParticipant {
|
|
27
24
|
async onWillStart(context) {
|
|
28
25
|
const extensionDeploymentDirUri = await this.environments.getDeploymentDirUri();
|
|
29
26
|
context.userEntries.push(extensionDeploymentDirUri.withScheme('local-dir').toString());
|
|
30
27
|
const userExtensionDirUri = await this.environments.getUserExtensionsDirUri();
|
|
31
|
-
const userExtensionDirPath =
|
|
28
|
+
const userExtensionDirPath = FileUri.fsPath(userExtensionDirUri);
|
|
32
29
|
if (await fs.pathExists(userExtensionDirPath)) {
|
|
33
30
|
const files = await fs.readdir(userExtensionDirPath);
|
|
34
31
|
for (const file of files) {
|
|
35
|
-
if (file.endsWith(
|
|
32
|
+
if (file.endsWith(LocalVSIXFilePluginDeployerResolver.FILE_EXTENSION)) {
|
|
36
33
|
const extensionUri = userExtensionDirUri.resolve(file).withScheme('local-file').toString();
|
|
37
34
|
this.logger.info(`found drop-in extension "${extensionUri}"`);
|
|
38
35
|
context.userEntries.push(extensionUri);
|
|
@@ -41,17 +38,15 @@ let PluginVSCodeDeployerParticipant = class PluginVSCodeDeployerParticipant {
|
|
|
41
38
|
}
|
|
42
39
|
}
|
|
43
40
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
(0, inversify_1.inject)(plugin_vscode_environment_1.PluginVSCodeEnvironment),
|
|
47
|
-
tslib_1.__metadata("design:type", plugin_vscode_environment_1.PluginVSCodeEnvironment)
|
|
41
|
+
__decorate([
|
|
42
|
+
inject(PluginVSCodeEnvironment)
|
|
48
43
|
], PluginVSCodeDeployerParticipant.prototype, "environments", void 0);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
tslib_1.__metadata("design:type", Object)
|
|
44
|
+
__decorate([
|
|
45
|
+
inject(ILogger),
|
|
46
|
+
named('plugin-ext-vscode:PluginVSCodeDeployerParticipant')
|
|
53
47
|
], PluginVSCodeDeployerParticipant.prototype, "logger", void 0);
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
PluginVSCodeDeployerParticipant = __decorate([
|
|
49
|
+
injectable()
|
|
56
50
|
], PluginVSCodeDeployerParticipant);
|
|
51
|
+
export { PluginVSCodeDeployerParticipant };
|
|
57
52
|
//# sourceMappingURL=plugin-vscode-deployer-participant.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-vscode-deployer-participant.js","sourceRoot":"","sources":["../../src/node/plugin-vscode-deployer-participant.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-vscode-deployer-participant.js","sourceRoot":"","sources":["../../src/node/plugin-vscode-deployer-participant.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF,OAAO,EAAE,mCAAmC,EAAE,MAAM,+CAA+C,CAAC;AACpG,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAG/B,IAAM,+BAA+B,GAArC,MAAM,+BAA+B;IAQxC,KAAK,CAAC,WAAW,CAAC,OAAmC;QACjD,MAAM,yBAAyB,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,CAAC;QAChF,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,yBAAyB,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEvF,MAAM,mBAAmB,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,uBAAuB,EAAE,CAAC;QAC9E,MAAM,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;QAEjE,IAAI,MAAM,EAAE,CAAC,UAAU,CAAC,oBAAoB,CAAC,EAAE,CAAC;YAC5C,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;YACrD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACvB,IAAI,IAAI,CAAC,QAAQ,CAAC,mCAAmC,CAAC,cAAc,CAAC,EAAE,CAAC;oBACpE,MAAM,YAAY,GAAG,mBAAmB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC;oBAC3F,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,4BAA4B,YAAY,GAAG,CAAC,CAAC;oBAC9D,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBAC3C,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;CACJ,CAAA;AAvBsB;IADlB,MAAM,CAAC,uBAAuB,CAAC;qEACyB;AAGtC;IADlB,MAAM,CAAC,OAAO,CAAC;IAAE,KAAK,CAAC,mDAAmD,CAAC;+DACzC;AAN1B,+BAA+B;IAD3C,UAAU,EAAE;GACA,+BAA+B,CA0B3C"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// *****************************************************************************
|
|
3
2
|
// Copyright (C) 2018 Red Hat, Inc. and others.
|
|
4
3
|
//
|
|
@@ -14,21 +13,19 @@
|
|
|
14
13
|
//
|
|
15
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
15
|
// *****************************************************************************
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const plugin_cli_contribution_1 = require("@theia/plugin-ext/lib/main/node/plugin-cli-contribution");
|
|
27
|
-
const plugin_vscode_utils_1 = require("./plugin-vscode-utils");
|
|
16
|
+
import { __decorate } from "tslib";
|
|
17
|
+
import * as path from 'path';
|
|
18
|
+
import * as fs from '@theia/core/shared/fs-extra';
|
|
19
|
+
import { inject, injectable, named } from '@theia/core/shared/inversify';
|
|
20
|
+
import { ILogger } from '@theia/core';
|
|
21
|
+
import { firstTrue } from '@theia/core/lib/common/promise-util';
|
|
22
|
+
import { PluginDeployerEntryType, PluginIdentifiers } from '@theia/plugin-ext';
|
|
23
|
+
import { PluginCliContribution } from '@theia/plugin-ext/lib/main/node/plugin-cli-contribution';
|
|
24
|
+
import { TMP_DIR_PREFIX } from './plugin-vscode-utils.js';
|
|
28
25
|
let PluginVsCodeDirectoryHandler = class PluginVsCodeDirectoryHandler {
|
|
29
26
|
async accept(plugin) {
|
|
30
27
|
this.logger.debug(`Resolving "${plugin.id()}" as a VS Code extension...`);
|
|
31
|
-
if (plugin.path().startsWith(
|
|
28
|
+
if (plugin.path().startsWith(TMP_DIR_PREFIX)) {
|
|
32
29
|
// avoid adding corrupted plugins from temporary directories
|
|
33
30
|
return false;
|
|
34
31
|
}
|
|
@@ -41,16 +38,16 @@ let PluginVsCodeDirectoryHandler = class PluginVsCodeDirectoryHandler {
|
|
|
41
38
|
return this.deriveMetadata(plugin);
|
|
42
39
|
}
|
|
43
40
|
async deriveMetadata(plugin) {
|
|
44
|
-
return
|
|
41
|
+
return firstTrue(this.resolveFromSources(plugin), this.resolveFromVSIX(plugin), this.resolveFromNpmTarball(plugin));
|
|
45
42
|
}
|
|
46
43
|
async handle(context) {
|
|
47
44
|
const types = [];
|
|
48
45
|
const packageJson = context.pluginEntry().getValue('package.json');
|
|
49
46
|
if (packageJson.browser) {
|
|
50
|
-
types.push(
|
|
47
|
+
types.push(PluginDeployerEntryType.FRONTEND);
|
|
51
48
|
}
|
|
52
49
|
if (packageJson.main || !packageJson.browser) {
|
|
53
|
-
types.push(
|
|
50
|
+
types.push(PluginDeployerEntryType.BACKEND);
|
|
54
51
|
}
|
|
55
52
|
context.pluginEntry().accept(...types);
|
|
56
53
|
}
|
|
@@ -80,7 +77,7 @@ let PluginVsCodeDirectoryHandler = class PluginVsCodeDirectoryHandler {
|
|
|
80
77
|
if (!pck || !pck.name || !pck.version || !pck.engines || !pck.engines.vscode) {
|
|
81
78
|
return false;
|
|
82
79
|
}
|
|
83
|
-
pck.publisher ??=
|
|
80
|
+
pck.publisher ??= PluginIdentifiers.UNPUBLISHED;
|
|
84
81
|
if (options) {
|
|
85
82
|
plugin.storeValue('package.json', pck);
|
|
86
83
|
plugin.rootPath = plugin.path();
|
|
@@ -92,7 +89,7 @@ let PluginVsCodeDirectoryHandler = class PluginVsCodeDirectoryHandler {
|
|
|
92
89
|
async requirePackage(pluginPath) {
|
|
93
90
|
try {
|
|
94
91
|
const plugin = await fs.readJSON(path.join(pluginPath, 'package.json'));
|
|
95
|
-
plugin.publisher ??=
|
|
92
|
+
plugin.publisher ??= PluginIdentifiers.UNPUBLISHED;
|
|
96
93
|
return plugin;
|
|
97
94
|
}
|
|
98
95
|
catch {
|
|
@@ -100,17 +97,15 @@ let PluginVsCodeDirectoryHandler = class PluginVsCodeDirectoryHandler {
|
|
|
100
97
|
}
|
|
101
98
|
}
|
|
102
99
|
};
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
(0, inversify_1.inject)(plugin_cli_contribution_1.PluginCliContribution),
|
|
106
|
-
tslib_1.__metadata("design:type", plugin_cli_contribution_1.PluginCliContribution)
|
|
100
|
+
__decorate([
|
|
101
|
+
inject(PluginCliContribution)
|
|
107
102
|
], PluginVsCodeDirectoryHandler.prototype, "pluginCli", void 0);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
tslib_1.__metadata("design:type", Object)
|
|
103
|
+
__decorate([
|
|
104
|
+
inject(ILogger),
|
|
105
|
+
named('plugin-ext-vscode:PluginVsCodeDirectoryHandler')
|
|
112
106
|
], PluginVsCodeDirectoryHandler.prototype, "logger", void 0);
|
|
113
|
-
|
|
114
|
-
|
|
107
|
+
PluginVsCodeDirectoryHandler = __decorate([
|
|
108
|
+
injectable()
|
|
115
109
|
], PluginVsCodeDirectoryHandler);
|
|
110
|
+
export { PluginVsCodeDirectoryHandler };
|
|
116
111
|
//# sourceMappingURL=plugin-vscode-directory-handler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-vscode-directory-handler.js","sourceRoot":"","sources":["../../src/node/plugin-vscode-directory-handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-vscode-directory-handler.js","sourceRoot":"","sources":["../../src/node/plugin-vscode-directory-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,gFAAgF;AAChF,gFAAgF;;AAEhF,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,OAAO,EAAY,MAAM,aAAa,CAAC;AAChD,OAAO,EAAY,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAEH,uBAAuB,EAAiB,iBAAiB,EAC5D,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAMnD,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IASrC,KAAK,CAAC,MAAM,CAAC,MAA2B;QACpC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,MAAM,CAAC,EAAE,EAAE,6BAA6B,CAAC,CAAC;QAC1E,IAAI,MAAM,CAAC,IAA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CodeEnvironment } from '../common/plugin-vscode-environment';
|
|
2
|
+
import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment.js';
|
|
3
3
|
import { ILogger } from '@theia/core';
|
|
4
|
+
import { ArchiveExtractor } from '@theia/filesystem/lib/node/archive/archive-extractor';
|
|
4
5
|
export declare const isVSCodePluginFile: (pluginPath?: string) => boolean;
|
|
5
6
|
export declare class PluginVsCodeFileHandler implements PluginDeployerFileHandler {
|
|
6
7
|
protected readonly environment: PluginVSCodeEnvironment;
|
|
7
8
|
protected readonly logger: ILogger;
|
|
9
|
+
protected readonly archiveExtractor: ArchiveExtractor;
|
|
8
10
|
accept(resolvedPlugin: PluginDeployerEntry): Promise<boolean>;
|
|
9
11
|
handle(context: PluginDeployerFileHandlerContext): Promise<void>;
|
|
10
12
|
protected getNormalizedExtensionId(pluginId: string): string;
|
|
@@ -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,EAAE,MAAM,mBAAmB,CAAC;AAIrH,OAAO,EAAE,uBAAuB,EAAE,MAAM,
|
|
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,EAAE,MAAM,mBAAmB,CAAC;AAIrH,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAGjF,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sDAAsD,CAAC;AAExF,eAAO,MAAM,kBAAkB,GAAI,aAAa,MAAM,YAAyF,CAAC;AAEhJ,qBACa,uBAAwB,YAAW,yBAAyB;IAErE,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,uBAAuB,CAAC;IAGxD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAGnC,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAEhD,MAAM,CAAC,cAAc,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;IAS7D,MAAM,CAAC,OAAO,EAAE,gCAAgC,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBtE,SAAS,CAAC,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;CAG/D"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// *****************************************************************************
|
|
3
2
|
// Copyright (C) 2018 Red Hat, Inc. and others.
|
|
4
3
|
//
|
|
@@ -14,38 +13,36 @@
|
|
|
14
13
|
//
|
|
15
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
15
|
// *****************************************************************************
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
const isVSCodePluginFile = (pluginPath) => Boolean(pluginPath && (pluginPath.endsWith('.vsix') || pluginPath.endsWith('.tgz')));
|
|
28
|
-
exports.isVSCodePluginFile = isVSCodePluginFile;
|
|
16
|
+
import { __decorate } from "tslib";
|
|
17
|
+
import filenamify from 'filenamify';
|
|
18
|
+
import { inject, injectable, named } from '@theia/core/shared/inversify';
|
|
19
|
+
import * as fs from '@theia/core/shared/fs-extra';
|
|
20
|
+
import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment.js';
|
|
21
|
+
import { FileUri } from '@theia/core/lib/common/file-uri';
|
|
22
|
+
import { unpackToDeploymentDir } from './plugin-vscode-utils.js';
|
|
23
|
+
import { ILogger } from '@theia/core';
|
|
24
|
+
import { ArchiveExtractor } from '@theia/filesystem/lib/node/archive/archive-extractor';
|
|
25
|
+
export const isVSCodePluginFile = (pluginPath) => Boolean(pluginPath && (pluginPath.endsWith('.vsix') || pluginPath.endsWith('.tgz')));
|
|
29
26
|
let PluginVsCodeFileHandler = class PluginVsCodeFileHandler {
|
|
30
27
|
async accept(resolvedPlugin) {
|
|
31
28
|
return resolvedPlugin.isFile().then(file => {
|
|
32
29
|
if (!file) {
|
|
33
30
|
return false;
|
|
34
31
|
}
|
|
35
|
-
return
|
|
32
|
+
return isVSCodePluginFile(resolvedPlugin.path());
|
|
36
33
|
});
|
|
37
34
|
}
|
|
38
35
|
async handle(context) {
|
|
39
36
|
const id = this.getNormalizedExtensionId(context.pluginEntry().id());
|
|
40
|
-
const extensionDeploymentDir = await
|
|
37
|
+
const extensionDeploymentDir = await unpackToDeploymentDir(this.environment, context.pluginEntry().path(), id, this.archiveExtractor);
|
|
41
38
|
context.pluginEntry().updatePath(extensionDeploymentDir);
|
|
42
39
|
this.logger.info(`root path: ${context.pluginEntry().rootPath}`);
|
|
43
40
|
const originalPath = context.pluginEntry().originalPath();
|
|
44
41
|
if (originalPath && originalPath !== extensionDeploymentDir) {
|
|
45
42
|
const tempDirUri = await this.environment.getTempDirUri();
|
|
46
|
-
if (originalPath.startsWith(
|
|
43
|
+
if (originalPath.startsWith(FileUri.fsPath(tempDirUri))) {
|
|
47
44
|
try {
|
|
48
|
-
await fs.remove(
|
|
45
|
+
await fs.remove(FileUri.fsPath(originalPath));
|
|
49
46
|
}
|
|
50
47
|
catch (e) {
|
|
51
48
|
this.logger.error(`[${id}]: failed to remove temporary files: "${originalPath}"`, e);
|
|
@@ -54,20 +51,21 @@ let PluginVsCodeFileHandler = class PluginVsCodeFileHandler {
|
|
|
54
51
|
}
|
|
55
52
|
}
|
|
56
53
|
getNormalizedExtensionId(pluginId) {
|
|
57
|
-
return (
|
|
54
|
+
return filenamify(pluginId, { replacement: '_' }).replace(/\.vsix$/, '');
|
|
58
55
|
}
|
|
59
56
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
(0, inversify_1.inject)(plugin_vscode_environment_1.PluginVSCodeEnvironment),
|
|
63
|
-
tslib_1.__metadata("design:type", plugin_vscode_environment_1.PluginVSCodeEnvironment)
|
|
57
|
+
__decorate([
|
|
58
|
+
inject(PluginVSCodeEnvironment)
|
|
64
59
|
], PluginVsCodeFileHandler.prototype, "environment", void 0);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
tslib_1.__metadata("design:type", Object)
|
|
60
|
+
__decorate([
|
|
61
|
+
inject(ILogger),
|
|
62
|
+
named('plugin-ext-vscode:PluginVsCodeFileHandler')
|
|
69
63
|
], PluginVsCodeFileHandler.prototype, "logger", void 0);
|
|
70
|
-
|
|
71
|
-
(
|
|
64
|
+
__decorate([
|
|
65
|
+
inject(ArchiveExtractor)
|
|
66
|
+
], PluginVsCodeFileHandler.prototype, "archiveExtractor", void 0);
|
|
67
|
+
PluginVsCodeFileHandler = __decorate([
|
|
68
|
+
injectable()
|
|
72
69
|
], PluginVsCodeFileHandler);
|
|
70
|
+
export { PluginVsCodeFileHandler };
|
|
73
71
|
//# sourceMappingURL=plugin-vscode-file-handler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-vscode-file-handler.js","sourceRoot":"","sources":["../../src/node/plugin-vscode-file-handler.ts"],"names":[],"mappings":"
|
|
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,gFAAgF;AAChF,gFAAgF;;AAGhF,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAA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names":[],"mappings":"AAqBA,OAAO,EAAE,uBAAuB,EAAoB,MAAM,EAAe,MAAM,mBAAmB,CAAC;AAWnG,eAAO,MAAM,gBAAgB,EAAE,uBAS9B,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin-vscode-init.d.ts","sourceRoot":"","sources":["../../src/node/plugin-vscode-init.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,uBAAuB,EAAoB,MAAM,EAAe,MAAM,mBAAmB,CAAC;AAWnG,eAAO,MAAM,gBAAgB,EAAE,uBAS9B,CAAC;AAyCF;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAElG"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// *****************************************************************************
|
|
3
2
|
// Copyright (C) 2018-2019 Red Hat, Inc.
|
|
4
3
|
//
|
|
@@ -14,21 +13,18 @@
|
|
|
14
13
|
//
|
|
15
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
15
|
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.doInitialization = void 0;
|
|
19
|
-
exports.findPlugin = findPlugin;
|
|
20
16
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
import Module, { register } from 'node:module';
|
|
18
|
+
import { isEqualOrParent } from '@theia/core/lib/common/paths';
|
|
19
|
+
import { emptyPlugin } from '@theia/plugin-ext';
|
|
20
|
+
import { VSCODE_DEFAULT_API_VERSION } from '../common/plugin-vscode-types.js';
|
|
25
21
|
process.env['VSCODE_PID'] = process.env['THEIA_PARENT_PID'];
|
|
26
22
|
const pluginsApiImpl = new Map();
|
|
27
23
|
const plugins = new Array();
|
|
28
24
|
let defaultApi;
|
|
29
25
|
let isLoadOverride = false;
|
|
30
26
|
let pluginApiFactory;
|
|
31
|
-
const doInitialization = (apiFactory, plugin) => {
|
|
27
|
+
export const doInitialization = (apiFactory, plugin) => {
|
|
32
28
|
pluginsApiImpl.set(plugin.model.id, createVSCodeAPI(apiFactory, plugin));
|
|
33
29
|
plugins.push(plugin);
|
|
34
30
|
pluginApiFactory = apiFactory;
|
|
@@ -37,15 +33,15 @@ const doInitialization = (apiFactory, plugin) => {
|
|
|
37
33
|
isLoadOverride = true;
|
|
38
34
|
}
|
|
39
35
|
};
|
|
40
|
-
exports.doInitialization = doInitialization;
|
|
41
36
|
function createVSCodeAPI(apiFactory, plugin) {
|
|
42
37
|
const vscode = apiFactory(plugin);
|
|
43
38
|
// override the version for vscode to be a VSCode version
|
|
44
|
-
vscode.version = process.env['VSCODE_API_VERSION'] ||
|
|
39
|
+
vscode.version = process.env['VSCODE_API_VERSION'] || VSCODE_DEFAULT_API_VERSION;
|
|
45
40
|
return vscode;
|
|
46
41
|
}
|
|
47
42
|
function overrideInternalLoad() {
|
|
48
|
-
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
|
+
const module = Module;
|
|
49
45
|
const vscodeModuleName = 'vscode';
|
|
50
46
|
// save original load method
|
|
51
47
|
const internalLoad = module._load;
|
|
@@ -62,7 +58,7 @@ function overrideInternalLoad() {
|
|
|
62
58
|
}
|
|
63
59
|
if (!defaultApi) {
|
|
64
60
|
console.warn(`Could not identify plugin for 'Theia' require call from ${parent.filename}`);
|
|
65
|
-
defaultApi = createVSCodeAPI(pluginApiFactory,
|
|
61
|
+
defaultApi = createVSCodeAPI(pluginApiFactory, emptyPlugin);
|
|
66
62
|
}
|
|
67
63
|
return defaultApi;
|
|
68
64
|
};
|
|
@@ -74,8 +70,8 @@ function overrideInternalLoad() {
|
|
|
74
70
|
* Matches on folder boundaries, so sibling plugins whose folder names share
|
|
75
71
|
* a prefix (e.g. `acme.foo` vs. `acme.foo-extras`) are not mismatched.
|
|
76
72
|
*/
|
|
77
|
-
function findPlugin(pluginList, filePath) {
|
|
78
|
-
return pluginList.find(plugin =>
|
|
73
|
+
export function findPlugin(pluginList, filePath) {
|
|
74
|
+
return pluginList.find(plugin => isEqualOrParent(filePath, plugin.pluginFolder));
|
|
79
75
|
}
|
|
80
76
|
/**
|
|
81
77
|
* Register an ESM loader hook so that `import 'vscode'` from an ESM plugin
|
|
@@ -133,7 +129,7 @@ export async function load(url, context, nextLoad) {
|
|
|
133
129
|
`;
|
|
134
130
|
try {
|
|
135
131
|
const dataUrl = 'data:text/javascript;base64,' + Buffer.from(loaderSource, 'utf8').toString('base64');
|
|
136
|
-
|
|
132
|
+
register(dataUrl);
|
|
137
133
|
}
|
|
138
134
|
catch (e) {
|
|
139
135
|
console.error('Failed to register VS Code ESM loader hook; ESM plugins will not load:', e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-vscode-init.js","sourceRoot":"","sources":["../../src/node/plugin-vscode-init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-vscode-init.js","sourceRoot":"","sources":["../../src/node/plugin-vscode-init.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,wCAAwC;AACxC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAEhF,uDAAuD;AAEvD,OAAO,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAqD,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACnG,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAE9E,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,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,OAAO,GAAG,8BAA8B,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACtG,QAAQ,CAAC,OAAO,CAAC,CAAC;IACtB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,OAAO,CAAC,KAAK,CAAC,wEAAwE,EAAE,CAAC,CAAC,CAAC;IAC/F,CAAC;AACL,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// *****************************************************************************
|
|
3
2
|
// Copyright (C) 2026 EclipseSource and others.
|
|
4
3
|
//
|
|
@@ -14,12 +13,10 @@
|
|
|
14
13
|
//
|
|
15
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
15
|
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const tslib_1 = require("tslib");
|
|
19
16
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
import { expect } from 'chai';
|
|
18
|
+
import * as path from 'path';
|
|
19
|
+
import { findPlugin } from './plugin-vscode-init.js';
|
|
23
20
|
const PLUGIN_A_FOLDER = path.join(path.sep, 'p', 'sample-namespace.plugin-esm');
|
|
24
21
|
const PLUGIN_B_FOLDER = path.join(path.sep, 'p', 'sample-namespace.plugin-esm-mjs');
|
|
25
22
|
const pluginA = { pluginFolder: PLUGIN_A_FOLDER };
|
|
@@ -28,21 +25,21 @@ const plugins = [pluginA, pluginB];
|
|
|
28
25
|
describe('findPlugin', () => {
|
|
29
26
|
it('matches the plugin whose folder directly contains the file', () => {
|
|
30
27
|
const file = path.join(PLUGIN_A_FOLDER, 'extension.js');
|
|
31
|
-
|
|
28
|
+
expect(findPlugin(plugins, file)).to.equal(pluginA);
|
|
32
29
|
});
|
|
33
30
|
it('matches a nested file inside the plugin folder', () => {
|
|
34
31
|
const file = path.join(PLUGIN_B_FOLDER, 'node_modules', 'dep', 'index.js');
|
|
35
|
-
|
|
32
|
+
expect(findPlugin(plugins, file)).to.equal(pluginB);
|
|
36
33
|
});
|
|
37
34
|
it('does not mismatch when one plugin folder name is a prefix of another', () => {
|
|
38
35
|
const file = path.join(PLUGIN_B_FOLDER, 'extension.mjs');
|
|
39
|
-
|
|
36
|
+
expect(findPlugin(plugins, file)).to.equal(pluginB);
|
|
40
37
|
});
|
|
41
38
|
it('returns undefined for a path outside any plugin folder', () => {
|
|
42
|
-
|
|
39
|
+
expect(findPlugin(plugins, path.join(path.sep, 'p', 'some-other', 'file.js'))).to.be.undefined;
|
|
43
40
|
});
|
|
44
41
|
it('returns undefined for an empty plugin list', () => {
|
|
45
|
-
|
|
42
|
+
expect(findPlugin([], path.join(PLUGIN_A_FOLDER, 'extension.js'))).to.be.undefined;
|
|
46
43
|
});
|
|
47
44
|
});
|
|
48
45
|
//# sourceMappingURL=plugin-vscode-init.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-vscode-init.spec.js","sourceRoot":"","sources":["../../src/node/plugin-vscode-init.spec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-vscode-init.spec.js","sourceRoot":"","sources":["../../src/node/plugin-vscode-init.spec.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,gFAAgF;AAChF,gFAAgF;AAEhF,uDAAuD;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,M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E,CAAC,wDAAwD,EAAE,GAAG,EAAE;QAC9D,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC;IACnG,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QAClD,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC;IACvF,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment';
|
|
1
|
+
import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment.js';
|
|
2
2
|
import { PluginIdentifiers } from '@theia/plugin-ext/lib/common/plugin-protocol';
|
|
3
|
+
import { ArchiveExtractor } from '@theia/filesystem/lib/node/archive/archive-extractor';
|
|
3
4
|
/**
|
|
4
5
|
* Extracts extension identity from a VSIX file by reading its package.json.
|
|
5
6
|
*
|
|
@@ -7,13 +8,14 @@ import { PluginIdentifiers } from '@theia/plugin-ext/lib/common/plugin-protocol'
|
|
|
7
8
|
* This function extracts only the `extension/package.json` file to read the extension metadata.
|
|
8
9
|
*
|
|
9
10
|
* @param vsixPath Path to the VSIX file
|
|
11
|
+
* @param archiveExtractor the extractor used to read the VSIX file
|
|
10
12
|
* @returns PluginIdentifiers.Components (publisher?, name, version), or undefined if the package.json cannot be read or is invalid
|
|
11
13
|
*/
|
|
12
|
-
export declare function extractExtensionIdentityFromVsix(vsixPath: string): Promise<PluginIdentifiers.Components | undefined>;
|
|
13
|
-
export declare function decompressExtension(sourcePath: string, destPath: string): Promise<boolean>;
|
|
14
|
+
export declare function extractExtensionIdentityFromVsix(vsixPath: string, archiveExtractor?: ArchiveExtractor): Promise<PluginIdentifiers.Components | undefined>;
|
|
15
|
+
export declare function decompressExtension(sourcePath: string, destPath: string, archiveExtractor?: ArchiveExtractor): Promise<boolean>;
|
|
14
16
|
export declare function existsInDeploymentDir(env: PluginVSCodeEnvironment, extensionId: string): Promise<boolean>;
|
|
15
17
|
export declare const TMP_DIR_PREFIX = "tmp-vscode-unpacked-";
|
|
16
|
-
export declare function unpackToDeploymentDir(env: PluginVSCodeEnvironment, sourcePath: string, extensionId: string): Promise<string>;
|
|
18
|
+
export declare function unpackToDeploymentDir(env: PluginVSCodeEnvironment, sourcePath: string, extensionId: string, archiveExtractor?: ArchiveExtractor): Promise<string>;
|
|
17
19
|
export declare function getExtensionDeploymentDir(env: PluginVSCodeEnvironment, extensionId: string): Promise<string>;
|
|
18
20
|
export declare function getTempDir(env: PluginVSCodeEnvironment, prefix: string): Promise<string>;
|
|
19
21
|
//# sourceMappingURL=plugin-vscode-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-vscode-utils.d.ts","sourceRoot":"","sources":["../../src/node/plugin-vscode-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-vscode-utils.d.ts","sourceRoot":"","sources":["../../src/node/plugin-vscode-utils.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAiB,MAAM,8CAA8C,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAAwB,MAAM,sDAAsD,CAAC;AAI9G;;;;;;;;;GASG;AACH,wBAAsB,gCAAgC,CAClD,QAAQ,EAAE,MAAM,EAChB,gBAAgB,GAAE,gBAA0C,GAC7D,OAAO,CAAC,iBAAiB,CAAC,UAAU,GAAG,SAAS,CAAC,CAgCnD;AAED,wBAAsB,mBAAmB,CACrC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,gBAAgB,GAAE,gBAA0C,GAC7D,OAAO,CAAC,OAAO,CAAC,CAgBlB;AAED,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAE/G;AAED,eAAO,MAAM,cAAc,yBAAyB,CAAC;AACrD,wBAAsB,qBAAqB,CACvC,GAAG,EAAE,uBAAuB,EAC5B,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,gBAAgB,GAAE,gBAA0C,GAC7D,OAAO,CAAC,MAAM,CAAC,CAiCjB;AAED,wBAAsB,yBAAyB,CAAC,GAAG,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAKlH;AAED,wBAAsB,UAAU,CAAC,GAAG,EAAE,uBAAuB,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAY9F"}
|