@codingame/monaco-vscode-extension-gallery-service-override 4.4.1 → 4.5.0-improve-code-splitting.1
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/extensionGallery.js +21 -16
- package/package.json +10 -3
- package/vscode/src/vs/platform/extensionManagement/common/abstractExtensionManagementService.js +7 -6
- package/vscode/src/vs/platform/extensionManagement/common/extensionGalleryService.js +12 -11
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagementIpc.js +1 -1
- package/vscode/src/vs/platform/extensionManagement/common/extensionTipsService.js +2 -3
- package/vscode/src/vs/platform/extensionManagement/common/extensionsProfileScannerService.js +334 -0
- package/vscode/src/vs/platform/extensionManagement/common/extensionsScannerService.js +904 -0
- package/vscode/src/vs/platform/extensionRecommendations/common/extensionRecommendations.js +9 -0
- package/vscode/src/vs/platform/userDataProfile/common/userDataProfileIpc.js +67 -0
- package/vscode/src/vs/platform/userDataSync/common/ignoredExtensions.js +65 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/abstractRuntimeExtensionsEditor.js +18 -14
- package/vscode/src/vs/workbench/contrib/extensions/browser/configBasedRecommendations.js +2 -2
- package/vscode/src/vs/workbench/contrib/extensions/browser/deprecatedExtensionsChecker.js +8 -6
- package/vscode/src/vs/workbench/contrib/extensions/browser/exeBasedRecommendations.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionEditor.js +25 -21
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionEnablementWorkspaceTrustTransitionParticipant.js +5 -5
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionFeaturesTab.js +7 -6
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendationNotificationService.js +18 -16
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendationsService.js +9 -9
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensions.contribution.js +31 -24
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActivationProgress.js +3 -3
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsCompletionItemsProvider.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsDependencyChecker.js +7 -5
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsList.js +8 -6
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsQuickAccess.js +4 -4
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewer.js +6 -5
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.js +29 -24
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViews.js +34 -30
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWidgets.js +14 -13
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.js +33 -28
- package/vscode/src/vs/workbench/contrib/extensions/browser/fileBasedRecommendations.js +6 -6
- package/vscode/src/vs/workbench/contrib/extensions/browser/keymapRecommendations.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/browser/languageRecommendations.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/browser/remoteRecommendations.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/browser/unsupportedExtensionsMigrationContribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/extensions/browser/webRecommendations.js +2 -2
- package/vscode/src/vs/workbench/contrib/extensions/browser/workspaceRecommendations.js +6 -6
- package/vscode/src/vs/workbench/contrib/extensions/common/reportExtensionIssueAction.js +1 -1
- package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.js +19 -16
- package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionsProfileScannerService.js +8 -7
- package/vscode/src/vs/workbench/services/extensionManagement/browser/webExtensionsScannerService.js +17 -17
- package/vscode/src/vs/workbench/services/extensionManagement/common/extensionFeaturesManagemetService.js +4 -4
- package/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagementServerService.js +2 -3
- package/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagementService.js +21 -20
- package/vscode/src/vs/workbench/services/extensionManagement/common/remoteExtensionManagementService.js +4 -4
- package/vscode/src/vs/workbench/services/extensionManagement/common/webExtensionManagementService.js +9 -9
- package/vscode/src/vs/workbench/services/extensionRecommendations/common/extensionIgnoredRecommendationsService.js +2 -2
- package/vscode/src/vs/workbench/services/extensions/browser/extensionUrlHandler.js +339 -0
- package/vscode/src/vs/workbench/services/extensions/browser/extensionsScannerService.js +9 -9
- package/vscode/src/vs/workbench/services/userDataProfile/common/remoteUserDataProfiles.js +151 -0
- package/override/vs/platform/dialogs/common/dialogs.js +0 -10
package/extensionGallery.js
CHANGED
|
@@ -1,36 +1,41 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
3
|
-
import { IExtensionGalleryService, IGlobalExtensionEnablementService, IExtensionManagementService, IExtensionTipsService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
|
|
3
|
+
import { IExtensionGalleryService, IGlobalExtensionEnablementService, IExtensionManagementService, IExtensionTipsService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement.service';
|
|
4
4
|
import { ExtensionGalleryService } from './vscode/src/vs/platform/extensionManagement/common/extensionGalleryService.js';
|
|
5
5
|
import { GlobalExtensionEnablementService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionEnablementService';
|
|
6
|
-
import { IExtensionsWorkbenchService } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensions';
|
|
6
|
+
import { IExtensionsWorkbenchService } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensions.service';
|
|
7
7
|
import { getLocale } from 'vscode/vscode/vs/platform/languagePacks/common/languagePacks';
|
|
8
8
|
import { ExtensionsWorkbenchService } from './vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.js';
|
|
9
|
-
import { IExtensionManagementServerService, IWebExtensionsScannerService, IWorkbenchExtensionEnablementService } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionManagement';
|
|
9
|
+
import { IExtensionManagementServerService, IWebExtensionsScannerService, IWorkbenchExtensionEnablementService } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionManagement.service';
|
|
10
10
|
import { ExtensionManagementServerService } from './vscode/src/vs/workbench/services/extensionManagement/common/extensionManagementServerService.js';
|
|
11
|
-
import { IExtensionRecommendationsService, IExtensionIgnoredRecommendationsService } from 'vscode/vscode/vs/workbench/services/extensionRecommendations/common/extensionRecommendations';
|
|
11
|
+
import { IExtensionRecommendationsService, IExtensionIgnoredRecommendationsService } from 'vscode/vscode/vs/workbench/services/extensionRecommendations/common/extensionRecommendations.service';
|
|
12
12
|
import { ExtensionRecommendationsService } from './vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendationsService.js';
|
|
13
13
|
import { WebExtensionsScannerService } from './vscode/src/vs/workbench/services/extensionManagement/browser/webExtensionsScannerService.js';
|
|
14
|
-
import { IExtensionRecommendationNotificationService } from 'vscode/vscode/vs/platform/extensionRecommendations/common/extensionRecommendations';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
14
|
+
import { IExtensionRecommendationNotificationService } from 'vscode/vscode/vs/platform/extensionRecommendations/common/extensionRecommendations.service';
|
|
15
|
+
import { IgnoredExtensionsManagementService } from './vscode/src/vs/platform/userDataSync/common/ignoredExtensions.js';
|
|
16
|
+
import { IIgnoredExtensionsManagementService } from 'vscode/vscode/vs/platform/userDataSync/common/ignoredExtensions.service';
|
|
17
|
+
import { ExtensionManifestPropertiesService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionManifestPropertiesService';
|
|
18
|
+
import { IExtensionManifestPropertiesService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionManifestPropertiesService.service';
|
|
19
|
+
import { IBuiltinExtensionsScannerService } from 'vscode/vscode/vs/platform/extensions/common/extensions.service';
|
|
18
20
|
import { ExtensionIgnoredRecommendationsService } from './vscode/src/vs/workbench/services/extensionRecommendations/common/extensionIgnoredRecommendationsService.js';
|
|
19
|
-
import {
|
|
21
|
+
import { WorkspaceExtensionsConfigService } from 'vscode/vscode/vs/workbench/services/extensionRecommendations/common/workspaceExtensionsConfig';
|
|
22
|
+
import { IWorkspaceExtensionsConfigService } from 'vscode/vscode/vs/workbench/services/extensionRecommendations/common/workspaceExtensionsConfig.service';
|
|
20
23
|
import { ExtensionRecommendationNotificationService } from './vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendationNotificationService.js';
|
|
21
24
|
import { ExtensionTipsService } from './vscode/src/vs/platform/extensionManagement/common/extensionTipsService.js';
|
|
22
25
|
import { ExtensionManagementService } from './vscode/src/vs/workbench/services/extensionManagement/common/extensionManagementService.js';
|
|
23
|
-
import {
|
|
26
|
+
import { RemoteUserDataProfilesService } from './vscode/src/vs/workbench/services/userDataProfile/common/remoteUserDataProfiles.js';
|
|
27
|
+
import { IRemoteUserDataProfilesService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/remoteUserDataProfiles.service';
|
|
24
28
|
import { ExtensionEnablementService } from './vscode/src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.js';
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
29
|
+
import { ExtensionUrlHandler } from './vscode/src/vs/workbench/services/extensions/browser/extensionUrlHandler.js';
|
|
30
|
+
import { IExtensionUrlHandler } from 'vscode/vscode/vs/workbench/services/extensions/browser/extensionUrlHandler.service';
|
|
31
|
+
import { IRemoteAgentService } from 'vscode/vscode/vs/workbench/services/remote/common/remoteAgentService.service';
|
|
27
32
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
28
|
-
import { IExtensionsScannerService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionsScannerService';
|
|
33
|
+
import { IExtensionsScannerService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionsScannerService.service';
|
|
29
34
|
import { ExtensionsScannerService } from './vscode/src/vs/workbench/services/extensions/browser/extensionsScannerService.js';
|
|
30
35
|
import { ExtensionsProfileScannerService } from './vscode/src/vs/workbench/services/extensionManagement/browser/extensionsProfileScannerService.js';
|
|
31
|
-
import { IExtensionsProfileScannerService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionsProfileScannerService';
|
|
32
|
-
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
|
|
33
|
-
import { IExtensionFeaturesManagementService } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionFeatures';
|
|
36
|
+
import { IExtensionsProfileScannerService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionsProfileScannerService.service';
|
|
37
|
+
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label.service';
|
|
38
|
+
import { IExtensionFeaturesManagementService } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionFeatures.service';
|
|
34
39
|
import { ExtensionFeaturesManagementService } from './vscode/src/vs/workbench/services/extensionManagement/common/extensionFeaturesManagemetService.js';
|
|
35
40
|
import { registerAssets } from 'vscode/assets';
|
|
36
41
|
import { getExtensionManifests } from 'vscode/extensions';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-extension-gallery-service-override",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0-improve-code-splitting.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -17,8 +17,15 @@
|
|
|
17
17
|
"main": "index.js",
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"default": "./index.js"
|
|
23
|
+
},
|
|
24
|
+
"./vscode/*": {
|
|
25
|
+
"default": "./vscode/src/*.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
20
28
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@4.
|
|
22
|
-
"@codingame/monaco-vscode-files-service-override": "4.4.1"
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@4.5.0-improve-code-splitting.1"
|
|
23
30
|
}
|
|
24
31
|
}
|
package/vscode/src/vs/platform/extensionManagement/common/abstractExtensionManagementService.js
CHANGED
|
@@ -9,14 +9,15 @@ import { isWeb } from 'vscode/vscode/vs/base/common/platform';
|
|
|
9
9
|
import { isDefined } from 'vscode/vscode/vs/base/common/types';
|
|
10
10
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
11
11
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
12
|
-
import {
|
|
12
|
+
import { isTargetPlatformCompatible, ExtensionManagementError, ExtensionManagementErrorCode, EXTENSION_INSTALL_DEP_PACK_CONTEXT, TargetPlatformToString, ExtensionGalleryError } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
|
|
13
|
+
import { IExtensionGalleryService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement.service';
|
|
13
14
|
import { areSameExtensions, getGalleryExtensionTelemetryData, ExtensionKey, getLocalExtensionTelemetryData } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
|
|
14
15
|
import { isApplicationScopedExtension } from 'vscode/vscode/vs/platform/extensions/common/extensions';
|
|
15
|
-
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
16
|
-
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService';
|
|
17
|
-
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
18
|
-
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
|
|
19
|
-
import { IUserDataProfilesService } from 'vscode/vscode/vs/platform/userDataProfile/common/userDataProfile';
|
|
16
|
+
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
17
|
+
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
|
|
18
|
+
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
19
|
+
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
20
|
+
import { IUserDataProfilesService } from 'vscode/vscode/vs/platform/userDataProfile/common/userDataProfile.service';
|
|
20
21
|
|
|
21
22
|
let AbstractExtensionManagementService = class AbstractExtensionManagementService extends Disposable {
|
|
22
23
|
get onInstallExtension() { return this._onInstallExtension.event; }
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import { distinct } from 'vscode/vscode/vs/base/common/arrays';
|
|
3
3
|
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
|
|
4
|
-
import { getErrorMessage,
|
|
4
|
+
import { getErrorMessage, CancellationError, isCancellationError } from 'vscode/vscode/vs/base/common/errors';
|
|
5
5
|
import { isWeb, platform } from 'vscode/vscode/vs/base/common/platform';
|
|
6
6
|
import { arch } from 'vscode/vscode/vs/base/common/process';
|
|
7
7
|
import { isBoolean } from 'vscode/vscode/vs/base/common/types';
|
|
8
8
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
9
|
-
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
10
|
-
import { IEnvironmentService } from 'vscode/vscode/vs/platform/environment/common/environment';
|
|
11
|
-
import { getTargetPlatform, isNotWebExtensionInWebTargetPlatform, isTargetPlatformCompatible, ExtensionGalleryErrorCode, ExtensionGalleryError
|
|
12
|
-
import { getGalleryExtensionId, areSameExtensions, getGalleryExtensionTelemetryData
|
|
9
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
10
|
+
import { IEnvironmentService } from 'vscode/vscode/vs/platform/environment/common/environment.service';
|
|
11
|
+
import { getTargetPlatform, toTargetPlatform, WEB_EXTENSION_TAG, isNotWebExtensionInWebTargetPlatform, isTargetPlatformCompatible, ExtensionGalleryErrorCode, ExtensionGalleryError } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
|
|
12
|
+
import { adoptToGalleryExtensionId, getGalleryExtensionId, areSameExtensions, getGalleryExtensionTelemetryData } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
|
|
13
13
|
import { isEngineValid } from 'vscode/vscode/vs/platform/extensions/common/extensionValidator';
|
|
14
|
-
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
|
|
15
|
-
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
16
|
-
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService';
|
|
17
|
-
import {
|
|
14
|
+
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
15
|
+
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
16
|
+
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
|
|
17
|
+
import { asJson, isSuccess, asTextOrError } from 'vscode/vscode/vs/platform/request/common/request';
|
|
18
|
+
import { IRequestService } from 'vscode/vscode/vs/platform/request/common/request.service';
|
|
18
19
|
import { resolveMarketplaceHeaders } from '../../externalServices/common/marketplace.js';
|
|
19
|
-
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
20
|
-
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
20
|
+
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
21
|
+
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
21
22
|
import { StopWatch } from 'vscode/vscode/vs/base/common/stopwatch';
|
|
22
23
|
|
|
23
24
|
const CURRENT_TARGET_PLATFORM = isWeb ? "web" : getTargetPlatform(platform, arch);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
2
2
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
3
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
4
|
-
import {
|
|
4
|
+
import { DefaultURITransformer, transformAndReviveIncomingURIs } from 'vscode/vscode/vs/base/common/uriIpc';
|
|
5
5
|
import { isTargetPlatformCompatible } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
|
|
6
6
|
|
|
7
7
|
function transformIncomingExtension(extension, transformer) {
|
|
@@ -4,14 +4,13 @@ import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
|
4
4
|
import { joinPath } from 'vscode/vscode/vs/base/common/resources';
|
|
5
5
|
import 'vscode/vscode/vs/base/common/path';
|
|
6
6
|
import 'vscode/vscode/vs/base/common/platform';
|
|
7
|
-
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
|
|
8
|
-
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService';
|
|
7
|
+
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
8
|
+
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
|
|
9
9
|
import 'vscode/vscode/vs/base/common/async';
|
|
10
10
|
import 'vscode/vscode/vs/base/common/event';
|
|
11
11
|
import 'vscode/vscode/vs/base/common/process';
|
|
12
12
|
import 'vscode/vscode/vs/base/common/strings';
|
|
13
13
|
import 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
|
|
14
|
-
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
15
14
|
import 'vscode/vscode/vs/base/common/network';
|
|
16
15
|
|
|
17
16
|
let ExtensionTipsService = class ExtensionTipsService extends Disposable {
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { Queue } from 'vscode/vscode/vs/base/common/async';
|
|
3
|
+
import { VSBuffer } from 'vscode/vscode/vs/base/common/buffer';
|
|
4
|
+
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
|
+
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
6
|
+
import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
|
|
7
|
+
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
8
|
+
import { isIExtensionIdentifier } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
|
|
9
|
+
import { areSameExtensions } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
|
|
10
|
+
import { toFileOperationResult } from 'vscode/vscode/vs/platform/files/common/files';
|
|
11
|
+
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
12
|
+
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
13
|
+
import { IUserDataProfilesService } from 'vscode/vscode/vs/platform/userDataProfile/common/userDataProfile.service';
|
|
14
|
+
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
15
|
+
import { isString, isUndefined, isObject } from 'vscode/vscode/vs/base/common/types';
|
|
16
|
+
import { getErrorMessage } from 'vscode/vscode/vs/base/common/errors';
|
|
17
|
+
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
18
|
+
|
|
19
|
+
class ExtensionsProfileScanningError extends Error {
|
|
20
|
+
constructor(message, code) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.code = code;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
let AbstractExtensionsProfileScannerService = class AbstractExtensionsProfileScannerService extends Disposable {
|
|
26
|
+
constructor(extensionsLocation, fileService, userDataProfilesService, uriIdentityService, telemetryService, logService) {
|
|
27
|
+
super();
|
|
28
|
+
this.extensionsLocation = extensionsLocation;
|
|
29
|
+
this.fileService = fileService;
|
|
30
|
+
this.userDataProfilesService = userDataProfilesService;
|
|
31
|
+
this.uriIdentityService = uriIdentityService;
|
|
32
|
+
this.telemetryService = telemetryService;
|
|
33
|
+
this.logService = logService;
|
|
34
|
+
this._onAddExtensions = this._register(( new Emitter()));
|
|
35
|
+
this.onAddExtensions = this._onAddExtensions.event;
|
|
36
|
+
this._onDidAddExtensions = this._register(( new Emitter()));
|
|
37
|
+
this.onDidAddExtensions = this._onDidAddExtensions.event;
|
|
38
|
+
this._onRemoveExtensions = this._register(( new Emitter()));
|
|
39
|
+
this.onRemoveExtensions = this._onRemoveExtensions.event;
|
|
40
|
+
this._onDidRemoveExtensions = this._register(( new Emitter()));
|
|
41
|
+
this.onDidRemoveExtensions = this._onDidRemoveExtensions.event;
|
|
42
|
+
this.resourcesAccessQueueMap = ( new ResourceMap());
|
|
43
|
+
}
|
|
44
|
+
scanProfileExtensions(profileLocation, options) {
|
|
45
|
+
return this.withProfileExtensions(profileLocation, undefined, options);
|
|
46
|
+
}
|
|
47
|
+
async addExtensionsToProfile(extensions, profileLocation, keepExistingVersions) {
|
|
48
|
+
const extensionsToRemove = [];
|
|
49
|
+
const extensionsToAdd = [];
|
|
50
|
+
try {
|
|
51
|
+
await this.withProfileExtensions(profileLocation, existingExtensions => {
|
|
52
|
+
const result = [];
|
|
53
|
+
if (keepExistingVersions) {
|
|
54
|
+
result.push(...existingExtensions);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
for (const existing of existingExtensions) {
|
|
58
|
+
if (( extensions.some(
|
|
59
|
+
([e]) => areSameExtensions(e.identifier, existing.identifier) && e.manifest.version !== existing.version
|
|
60
|
+
))) {
|
|
61
|
+
extensionsToRemove.push(existing);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
result.push(existing);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
for (const [extension, metadata] of extensions) {
|
|
69
|
+
const index = result.findIndex(e => areSameExtensions(e.identifier, extension.identifier) && e.version === extension.manifest.version);
|
|
70
|
+
const extensionToAdd = { identifier: extension.identifier, version: extension.manifest.version, location: extension.location, metadata };
|
|
71
|
+
if (index === -1) {
|
|
72
|
+
extensionsToAdd.push(extensionToAdd);
|
|
73
|
+
result.push(extensionToAdd);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
result.splice(index, 1, extensionToAdd);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (extensionsToAdd.length) {
|
|
80
|
+
this._onAddExtensions.fire({ extensions: extensionsToAdd, profileLocation });
|
|
81
|
+
}
|
|
82
|
+
if (extensionsToRemove.length) {
|
|
83
|
+
this._onRemoveExtensions.fire({ extensions: extensionsToRemove, profileLocation });
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
});
|
|
87
|
+
if (extensionsToAdd.length) {
|
|
88
|
+
this._onDidAddExtensions.fire({ extensions: extensionsToAdd, profileLocation });
|
|
89
|
+
}
|
|
90
|
+
if (extensionsToRemove.length) {
|
|
91
|
+
this._onDidRemoveExtensions.fire({ extensions: extensionsToRemove, profileLocation });
|
|
92
|
+
}
|
|
93
|
+
return extensionsToAdd;
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
if (extensionsToAdd.length) {
|
|
97
|
+
this._onDidAddExtensions.fire({ extensions: extensionsToAdd, error, profileLocation });
|
|
98
|
+
}
|
|
99
|
+
if (extensionsToRemove.length) {
|
|
100
|
+
this._onDidRemoveExtensions.fire({ extensions: extensionsToRemove, error, profileLocation });
|
|
101
|
+
}
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
async updateMetadata(extensions, profileLocation) {
|
|
106
|
+
const updatedExtensions = [];
|
|
107
|
+
await this.withProfileExtensions(profileLocation, profileExtensions => {
|
|
108
|
+
const result = [];
|
|
109
|
+
for (const profileExtension of profileExtensions) {
|
|
110
|
+
const extension = extensions.find(([e]) => areSameExtensions(e.identifier, profileExtension.identifier) && e.manifest.version === profileExtension.version);
|
|
111
|
+
if (extension) {
|
|
112
|
+
profileExtension.metadata = { ...profileExtension.metadata, ...extension[1] };
|
|
113
|
+
updatedExtensions.push(profileExtension);
|
|
114
|
+
result.push(profileExtension);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
result.push(profileExtension);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return result;
|
|
121
|
+
});
|
|
122
|
+
return updatedExtensions;
|
|
123
|
+
}
|
|
124
|
+
async removeExtensionFromProfile(extension, profileLocation) {
|
|
125
|
+
const extensionsToRemove = [];
|
|
126
|
+
try {
|
|
127
|
+
await this.withProfileExtensions(profileLocation, profileExtensions => {
|
|
128
|
+
const result = [];
|
|
129
|
+
for (const e of profileExtensions) {
|
|
130
|
+
if (areSameExtensions(e.identifier, extension.identifier)) {
|
|
131
|
+
extensionsToRemove.push(e);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
result.push(e);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (extensionsToRemove.length) {
|
|
138
|
+
this._onRemoveExtensions.fire({ extensions: extensionsToRemove, profileLocation });
|
|
139
|
+
}
|
|
140
|
+
return result;
|
|
141
|
+
});
|
|
142
|
+
if (extensionsToRemove.length) {
|
|
143
|
+
this._onDidRemoveExtensions.fire({ extensions: extensionsToRemove, profileLocation });
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
if (extensionsToRemove.length) {
|
|
148
|
+
this._onDidRemoveExtensions.fire({ extensions: extensionsToRemove, error, profileLocation });
|
|
149
|
+
}
|
|
150
|
+
throw error;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
async withProfileExtensions(file, updateFn, options) {
|
|
154
|
+
return this.getResourceAccessQueue(file).queue(async () => {
|
|
155
|
+
let extensions = [];
|
|
156
|
+
let storedProfileExtensions;
|
|
157
|
+
try {
|
|
158
|
+
const content = await this.fileService.readFile(file);
|
|
159
|
+
storedProfileExtensions = JSON.parse(( content.value.toString()).trim() || '[]');
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
if (toFileOperationResult(error) !== 1 ) {
|
|
163
|
+
throw error;
|
|
164
|
+
}
|
|
165
|
+
if (this.uriIdentityService.extUri.isEqual(file, this.userDataProfilesService.defaultProfile.extensionsResource)) {
|
|
166
|
+
storedProfileExtensions = await this.migrateFromOldDefaultProfileExtensionsLocation();
|
|
167
|
+
}
|
|
168
|
+
if (!storedProfileExtensions && options?.bailOutWhenFileNotFound) {
|
|
169
|
+
throw new ExtensionsProfileScanningError(getErrorMessage(error), "ERROR_PROFILE_NOT_FOUND" );
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (storedProfileExtensions) {
|
|
173
|
+
if (!Array.isArray(storedProfileExtensions)) {
|
|
174
|
+
this.reportAndThrowInvalidConentError(file);
|
|
175
|
+
}
|
|
176
|
+
let migrate = false;
|
|
177
|
+
for (const e of storedProfileExtensions) {
|
|
178
|
+
if (!isStoredProfileExtension(e)) {
|
|
179
|
+
this.reportAndThrowInvalidConentError(file);
|
|
180
|
+
}
|
|
181
|
+
let location;
|
|
182
|
+
if (isString(e.relativeLocation) && e.relativeLocation) {
|
|
183
|
+
location = this.resolveExtensionLocation(e.relativeLocation);
|
|
184
|
+
}
|
|
185
|
+
else if (isString(e.location)) {
|
|
186
|
+
this.logService.warn(`Extensions profile: Ignoring extension with invalid location: ${e.location}`);
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
location = URI.revive(e.location);
|
|
191
|
+
const relativePath = this.toRelativePath(location);
|
|
192
|
+
if (relativePath) {
|
|
193
|
+
migrate = true;
|
|
194
|
+
e.relativeLocation = relativePath;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (isUndefined(e.metadata?.hasPreReleaseVersion) && e.metadata?.preRelease) {
|
|
198
|
+
migrate = true;
|
|
199
|
+
e.metadata.hasPreReleaseVersion = true;
|
|
200
|
+
}
|
|
201
|
+
extensions.push({
|
|
202
|
+
identifier: e.identifier,
|
|
203
|
+
location,
|
|
204
|
+
version: e.version,
|
|
205
|
+
metadata: e.metadata,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
if (migrate) {
|
|
209
|
+
await this.fileService.writeFile(file, VSBuffer.fromString(JSON.stringify(storedProfileExtensions)));
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (updateFn) {
|
|
213
|
+
extensions = updateFn(extensions);
|
|
214
|
+
const storedProfileExtensions = ( extensions.map(e => ({
|
|
215
|
+
identifier: e.identifier,
|
|
216
|
+
version: e.version,
|
|
217
|
+
location: e.location.toJSON(),
|
|
218
|
+
relativeLocation: this.toRelativePath(e.location),
|
|
219
|
+
metadata: e.metadata
|
|
220
|
+
})));
|
|
221
|
+
await this.fileService.writeFile(file, VSBuffer.fromString(JSON.stringify(storedProfileExtensions)));
|
|
222
|
+
}
|
|
223
|
+
return extensions;
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
reportAndThrowInvalidConentError(file) {
|
|
227
|
+
const error = ( new ExtensionsProfileScanningError(`Invalid extensions content in ${( file.toString())}`, "ERROR_INVALID_CONTENT" ));
|
|
228
|
+
this.telemetryService.publicLogError2('extensionsProfileScanningError', { code: error.code });
|
|
229
|
+
throw error;
|
|
230
|
+
}
|
|
231
|
+
toRelativePath(extensionLocation) {
|
|
232
|
+
return this.uriIdentityService.extUri.isEqual(this.uriIdentityService.extUri.dirname(extensionLocation), this.extensionsLocation)
|
|
233
|
+
? this.uriIdentityService.extUri.basename(extensionLocation)
|
|
234
|
+
: undefined;
|
|
235
|
+
}
|
|
236
|
+
resolveExtensionLocation(path) {
|
|
237
|
+
return this.uriIdentityService.extUri.joinPath(this.extensionsLocation, path);
|
|
238
|
+
}
|
|
239
|
+
async migrateFromOldDefaultProfileExtensionsLocation() {
|
|
240
|
+
if (!this._migrationPromise) {
|
|
241
|
+
this._migrationPromise = (async () => {
|
|
242
|
+
const oldDefaultProfileExtensionsLocation = this.uriIdentityService.extUri.joinPath(this.userDataProfilesService.defaultProfile.location, 'extensions.json');
|
|
243
|
+
const oldDefaultProfileExtensionsInitLocation = this.uriIdentityService.extUri.joinPath(this.extensionsLocation, '.init-default-profile-extensions');
|
|
244
|
+
let content;
|
|
245
|
+
try {
|
|
246
|
+
content = ( (await this.fileService.readFile(oldDefaultProfileExtensionsLocation)).value.toString());
|
|
247
|
+
}
|
|
248
|
+
catch (error) {
|
|
249
|
+
if (toFileOperationResult(error) === 1 ) {
|
|
250
|
+
return undefined;
|
|
251
|
+
}
|
|
252
|
+
throw error;
|
|
253
|
+
}
|
|
254
|
+
this.logService.info('Migrating extensions from old default profile location', ( oldDefaultProfileExtensionsLocation.toString()));
|
|
255
|
+
let storedProfileExtensions;
|
|
256
|
+
try {
|
|
257
|
+
const parsedData = JSON.parse(content);
|
|
258
|
+
if (Array.isArray(parsedData) && parsedData.every(candidate => isStoredProfileExtension(candidate))) {
|
|
259
|
+
storedProfileExtensions = parsedData;
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
this.logService.warn('Skipping migrating from old default profile locaiton: Found invalid data', parsedData);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
catch (error) {
|
|
266
|
+
this.logService.error(error);
|
|
267
|
+
}
|
|
268
|
+
if (storedProfileExtensions) {
|
|
269
|
+
try {
|
|
270
|
+
await this.fileService.createFile(this.userDataProfilesService.defaultProfile.extensionsResource, VSBuffer.fromString(JSON.stringify(storedProfileExtensions)), { overwrite: false });
|
|
271
|
+
this.logService.info('Migrated extensions from old default profile location to new location', ( oldDefaultProfileExtensionsLocation.toString()), ( this.userDataProfilesService.defaultProfile.extensionsResource.toString()));
|
|
272
|
+
}
|
|
273
|
+
catch (error) {
|
|
274
|
+
if (toFileOperationResult(error) === 3 ) {
|
|
275
|
+
this.logService.info('Migration from old default profile location to new location is done by another window', ( oldDefaultProfileExtensionsLocation.toString()), ( this.userDataProfilesService.defaultProfile.extensionsResource.toString()));
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
throw error;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
try {
|
|
283
|
+
await this.fileService.del(oldDefaultProfileExtensionsLocation);
|
|
284
|
+
}
|
|
285
|
+
catch (error) {
|
|
286
|
+
if (toFileOperationResult(error) !== 1 ) {
|
|
287
|
+
this.logService.error(error);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
try {
|
|
291
|
+
await this.fileService.del(oldDefaultProfileExtensionsInitLocation);
|
|
292
|
+
}
|
|
293
|
+
catch (error) {
|
|
294
|
+
if (toFileOperationResult(error) !== 1 ) {
|
|
295
|
+
this.logService.error(error);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return storedProfileExtensions;
|
|
299
|
+
})();
|
|
300
|
+
}
|
|
301
|
+
return this._migrationPromise;
|
|
302
|
+
}
|
|
303
|
+
getResourceAccessQueue(file) {
|
|
304
|
+
let resourceQueue = this.resourcesAccessQueueMap.get(file);
|
|
305
|
+
if (!resourceQueue) {
|
|
306
|
+
resourceQueue = ( new Queue());
|
|
307
|
+
this.resourcesAccessQueueMap.set(file, resourceQueue);
|
|
308
|
+
}
|
|
309
|
+
return resourceQueue;
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
AbstractExtensionsProfileScannerService = ( __decorate([
|
|
313
|
+
( __param(1, IFileService)),
|
|
314
|
+
( __param(2, IUserDataProfilesService)),
|
|
315
|
+
( __param(3, IUriIdentityService)),
|
|
316
|
+
( __param(4, ITelemetryService)),
|
|
317
|
+
( __param(5, ILogService))
|
|
318
|
+
], AbstractExtensionsProfileScannerService));
|
|
319
|
+
function isStoredProfileExtension(candidate) {
|
|
320
|
+
return isObject(candidate)
|
|
321
|
+
&& isIExtensionIdentifier(candidate.identifier)
|
|
322
|
+
&& (isUriComponents(candidate.location) || (isString(candidate.location) && candidate.location))
|
|
323
|
+
&& (isUndefined(candidate.relativeLocation) || isString(candidate.relativeLocation))
|
|
324
|
+
&& candidate.version && isString(candidate.version);
|
|
325
|
+
}
|
|
326
|
+
function isUriComponents(thing) {
|
|
327
|
+
if (!thing) {
|
|
328
|
+
return false;
|
|
329
|
+
}
|
|
330
|
+
return isString(thing.path) &&
|
|
331
|
+
isString(thing.scheme);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export { AbstractExtensionsProfileScannerService, ExtensionsProfileScanningError };
|