@codingame/monaco-vscode-extension-gallery-service-override 9.0.2 → 10.0.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.
Files changed (55) hide show
  1. package/_virtual/semver.js +5 -0
  2. package/package.json +2 -2
  3. package/tools.js +4 -2
  4. package/vscode/src/vs/platform/extensionManagement/common/abstractExtensionManagementService.js +107 -85
  5. package/vscode/src/vs/platform/extensionManagement/common/extensionGalleryService.js +23 -18
  6. package/vscode/src/vs/platform/extensionManagement/common/extensionManagementIpc.js +19 -7
  7. package/vscode/src/vs/platform/extensionManagement/common/extensionTipsService.js +0 -6
  8. package/vscode/src/vs/platform/extensionManagement/common/unsupportedExtensionsMigration.js +2 -4
  9. package/vscode/src/vs/platform/extensionRecommendations/common/extensionRecommendations.js +4 -20
  10. package/vscode/src/vs/platform/externalServices/common/marketplace.js +1 -2
  11. package/vscode/src/vs/platform/userDataProfile/common/userDataProfileIpc.js +0 -2
  12. package/vscode/src/vs/platform/userDataSync/common/ignoredExtensions.js +2 -3
  13. package/vscode/src/vs/workbench/contrib/extensions/browser/abstractRuntimeExtensionsEditor.js +32 -40
  14. package/vscode/src/vs/workbench/contrib/extensions/browser/browserRuntimeExtensionsEditor.js +0 -6
  15. package/vscode/src/vs/workbench/contrib/extensions/browser/configBasedRecommendations.js +2 -3
  16. package/vscode/src/vs/workbench/contrib/extensions/browser/exeBasedRecommendations.js +2 -3
  17. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionEditor.js +76 -94
  18. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionEnablementWorkspaceTrustTransitionParticipant.js +1 -1
  19. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionFeaturesTab.js +18 -19
  20. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendationNotificationService.js +48 -65
  21. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendationsService.js +2 -4
  22. package/vscode/src/vs/workbench/contrib/extensions/browser/extensions.contribution.js +241 -213
  23. package/vscode/src/vs/workbench/contrib/extensions/browser/extensions.web.contribution.js +1 -1
  24. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActivationProgress.js +2 -3
  25. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsCompletionItemsProvider.js +2 -3
  26. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsDependencyChecker.js +5 -5
  27. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsList.js +3 -3
  28. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsQuickAccess.js +14 -25
  29. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewer.js +5 -7
  30. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.js +135 -63
  31. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViews.js +62 -53
  32. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWidgets.js +34 -42
  33. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.js +270 -153
  34. package/vscode/src/vs/workbench/contrib/extensions/browser/fileBasedRecommendations.js +10 -14
  35. package/vscode/src/vs/workbench/contrib/extensions/browser/keymapRecommendations.js +1 -2
  36. package/vscode/src/vs/workbench/contrib/extensions/browser/languageRecommendations.js +1 -2
  37. package/vscode/src/vs/workbench/contrib/extensions/browser/media/extensionsViewlet.css.js +1 -1
  38. package/vscode/src/vs/workbench/contrib/extensions/browser/remoteRecommendations.js +1 -2
  39. package/vscode/src/vs/workbench/contrib/extensions/browser/webRecommendations.js +2 -3
  40. package/vscode/src/vs/workbench/contrib/extensions/browser/workspaceRecommendations.js +5 -7
  41. package/vscode/src/vs/workbench/contrib/extensions/common/reportExtensionIssueAction.js +1 -1
  42. package/vscode/src/vs/workbench/contrib/extensions/common/runtimeExtensionsInput.js +3 -4
  43. package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.js +96 -75
  44. package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionsProfileScannerService.js +0 -1
  45. package/vscode/src/vs/workbench/services/extensionManagement/browser/webExtensionsScannerService.js +15 -19
  46. package/vscode/src/vs/workbench/services/extensionManagement/common/extensionFeaturesManagemetService.js +7 -9
  47. package/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagementChannelClient.js +43 -22
  48. package/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagementServerService.js +3 -5
  49. package/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagementService.js +57 -41
  50. package/vscode/src/vs/workbench/services/extensionManagement/common/webExtensionManagementService.js +9 -9
  51. package/vscode/src/vs/workbench/services/extensionRecommendations/common/extensionIgnoredRecommendationsService.js +3 -5
  52. package/vscode/src/vs/workbench/services/extensions/browser/extensionUrlHandler.js +18 -21
  53. package/vscode/src/vs/workbench/services/extensions/browser/extensionsScannerService.js +0 -1
  54. package/vscode/src/vs/workbench/services/userDataProfile/common/remoteUserDataProfiles.js +3 -5
  55. package/vscode/src/vs/workbench/contrib/extensions/browser/deprecatedExtensionsChecker.js +0 -84
@@ -0,0 +1,5 @@
1
+ import { __require } from 'vscode/external/vscode-semver/semver.js';
2
+
3
+ var semverExports = __require();
4
+
5
+ export { semverExports };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-extension-gallery-service-override",
3
- "version": "9.0.2",
3
+ "version": "10.0.0",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -26,6 +26,6 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "vscode": "npm:@codingame/monaco-vscode-api@9.0.2"
29
+ "vscode": "npm:@codingame/monaco-vscode-api@10.0.0"
30
30
  }
31
31
  }
package/tools.js CHANGED
@@ -18,7 +18,7 @@ function memoizedConstructor(ctor) {
18
18
  });
19
19
  }
20
20
  async function sleep(duration) {
21
- await new Promise(resolve => setTimeout(resolve, duration));
21
+ await new Promise((resolve) => setTimeout(resolve, duration));
22
22
  }
23
23
  function throttle(fct, merge, delay) {
24
24
  let lastPromise = Promise.resolve();
@@ -26,7 +26,9 @@ function throttle(fct, merge, delay) {
26
26
  return async (param) => {
27
27
  if (toConsume == null) {
28
28
  toConsume = param;
29
- lastPromise = lastPromise.then(async () => await sleep(delay)).then(async () => {
29
+ lastPromise = lastPromise
30
+ .then(async () => await sleep(delay))
31
+ .then(async () => {
30
32
  const _toConsume = toConsume;
31
33
  toConsume = null;
32
34
  await fct(_toConsume);
@@ -7,13 +7,12 @@ import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
7
7
  import { Disposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
8
8
  import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
9
9
  import { isWeb } from 'vscode/vscode/vs/base/common/platform';
10
- import { isDefined } from 'vscode/vscode/vs/base/common/types';
11
10
  import { URI } from 'vscode/vscode/vs/base/common/uri';
12
11
  import { localize } from 'vscode/vscode/vs/nls';
13
- import { isTargetPlatformCompatible, ExtensionManagementError, ExtensionManagementErrorCode, InstallOperation, EXTENSION_INSTALL_DEP_PACK_CONTEXT, EXTENSION_INSTALL_SOURCE_CONTEXT, StatisticType, TargetPlatformToString, ExtensionGalleryError, ExtensionGalleryErrorCode } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
12
+ import { isTargetPlatformCompatible, ExtensionManagementError, EXTENSION_INSTALL_DEP_PACK_CONTEXT, EXTENSION_INSTALL_SOURCE_CONTEXT, TargetPlatformToString, ExtensionGalleryError, ExtensionSignatureVerificationCode } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
14
13
  import { IExtensionGalleryService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement.service';
15
14
  import { areSameExtensions, ExtensionKey, getGalleryExtensionId, getGalleryExtensionTelemetryData, getLocalExtensionTelemetryData } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
16
- import { isApplicationScopedExtension, ExtensionType } from 'vscode/vscode/vs/platform/extensions/common/extensions';
15
+ import { isApplicationScopedExtension } from 'vscode/vscode/vs/platform/extensions/common/extensions';
17
16
  import { areApiProposalsCompatible } from 'vscode/vscode/vs/platform/extensions/common/extensionValidator';
18
17
  import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
19
18
  import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
@@ -71,7 +70,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
71
70
  }
72
71
  throw ( (new ExtensionManagementError(
73
72
  `Unknown error while installing extension ${extension.identifier.id}`,
74
- ExtensionManagementErrorCode.Unknown
73
+ "Unknown"
75
74
  )));
76
75
  }
77
76
  catch (error) {
@@ -81,8 +80,8 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
81
80
  async installGalleryExtensions(extensions) {
82
81
  if (!this.galleryService.isEnabled()) {
83
82
  throw ( (new ExtensionManagementError(
84
- localize(11162, "Marketplace is not enabled"),
85
- ExtensionManagementErrorCode.NotAllowed
83
+ localize(11275, "Marketplace is not enabled"),
84
+ "NotAllowed"
86
85
  )));
87
86
  }
88
87
  const results = [];
@@ -93,7 +92,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
93
92
  installableExtensions.push({ ...compatible, options });
94
93
  }
95
94
  catch (error) {
96
- results.push({ identifier: extension.identifier, operation: InstallOperation.Install, source: extension, error, profileLocation: options.profileLocation ?? this.getCurrentExtensionsManifestLocation() });
95
+ results.push({ identifier: extension.identifier, operation: 2 , source: extension, error, profileLocation: options.profileLocation ?? this.getCurrentExtensionsManifestLocation() });
97
96
  }
98
97
  }))));
99
98
  if (installableExtensions.length) {
@@ -115,7 +114,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
115
114
  local = await this.copyExtension(extension, this.userDataProfilesService.defaultProfile.extensionsResource, fromProfileLocation);
116
115
  }
117
116
  for (const profile of this.userDataProfilesService.profiles) {
118
- const existing = (await this.getInstalled(ExtensionType.User, profile.extensionsResource))
117
+ const existing = (await this.getInstalled(1 , profile.extensionsResource))
119
118
  .find(e => areSameExtensions(e.identifier, extension.identifier));
120
119
  if (existing) {
121
120
  this._onDidUpdateExtensionMetadata.fire({ local: existing, profileLocation: profile.extensionsResource });
@@ -130,7 +129,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
130
129
  const local = this.uriIdentityService.extUri.isEqual(fromProfileLocation, this.userDataProfilesService.defaultProfile.extensionsResource)
131
130
  ? await this.updateMetadata(extension, { isApplicationScoped: true }, this.userDataProfilesService.defaultProfile.extensionsResource)
132
131
  : await this.copyExtension(extension, fromProfileLocation, this.userDataProfilesService.defaultProfile.extensionsResource, { isApplicationScoped: true });
133
- this._onDidInstallExtensions.fire([{ identifier: local.identifier, operation: InstallOperation.Install, local, profileLocation: this.userDataProfilesService.defaultProfile.extensionsResource, applicationScoped: true }]);
132
+ this._onDidInstallExtensions.fire([{ identifier: local.identifier, operation: 2 , local, profileLocation: this.userDataProfilesService.defaultProfile.extensionsResource, applicationScoped: true }]);
134
133
  return local;
135
134
  }
136
135
  }
@@ -148,7 +147,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
148
147
  async resetPinnedStateForAllUserExtensions(pinned) {
149
148
  try {
150
149
  await this.joinAllSettled(( (this.userDataProfilesService.profiles.map(async (profile) => {
151
- const extensions = await this.getInstalled(ExtensionType.User, profile.extensionsResource);
150
+ const extensions = await this.getInstalled(1 , profile.extensionsResource);
152
151
  await this.joinAllSettled(( (extensions.map(async (extension) => {
153
152
  if (extension.pinned !== pinned) {
154
153
  await this.updateMetadata(extension, { pinned }, profile.extensionsResource);
@@ -167,6 +166,29 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
167
166
  const alreadyRequestedInstallations = [];
168
167
  const getInstallExtensionTaskKey = (extension, profileLocation) => `${( (ExtensionKey.create(extension).toString()))}-${( (profileLocation.toString()))}`;
169
168
  const createInstallExtensionTask = (manifest, extension, options, root) => {
169
+ if (!URI.isUri(extension)) {
170
+ if (( (installingExtensionsMap.has(
171
+ `${extension.identifier.id.toLowerCase()}-${( (options.profileLocation.toString()))}`
172
+ )))) {
173
+ return;
174
+ }
175
+ const existingInstallingExtension = this.installingExtensions.get(getInstallExtensionTaskKey(extension, options.profileLocation));
176
+ if (existingInstallingExtension) {
177
+ if (root && this.canWaitForTask(root, existingInstallingExtension.task)) {
178
+ const identifier = existingInstallingExtension.task.identifier;
179
+ this.logService.info('Waiting for already requested installing extension', identifier.id, root.identifier.id, ( (options.profileLocation.toString())));
180
+ existingInstallingExtension.waitingTasks.push(root);
181
+ alreadyRequestedInstallations.push(Event.toPromise(Event.filter(this.onDidInstallExtensions, results => ( (results.some(result => areSameExtensions(result.identifier, identifier)))))).then(results => {
182
+ this.logService.info('Finished waiting for already requested installing extension', identifier.id, root.identifier.id, ( (options.profileLocation.toString())));
183
+ const result = results.find(result => areSameExtensions(result.identifier, identifier));
184
+ if (!result?.local) {
185
+ throw ( (new Error(`Extension ${identifier.id} is not installed`)));
186
+ }
187
+ }));
188
+ }
189
+ return;
190
+ }
191
+ }
170
192
  const installExtensionTask = this.createInstallExtensionTask(manifest, extension, options);
171
193
  const key = `${getGalleryExtensionId(manifest.publisher, manifest.name)}-${( (options.profileLocation.toString()))}`;
172
194
  installingExtensionsMap.set(key, { task: installExtensionTask, root });
@@ -205,29 +227,10 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
205
227
  const installed = await this.getInstalled(undefined, task.options.profileLocation, task.options.productVersion);
206
228
  const options = { ...task.options, context: { ...task.options.context, [EXTENSION_INSTALL_DEP_PACK_CONTEXT]: true } };
207
229
  for (const { gallery, manifest } of distinct(allDepsAndPackExtensionsToInstall, ({ gallery }) => gallery.identifier.id)) {
208
- if (( (installingExtensionsMap.has(
209
- `${gallery.identifier.id.toLowerCase()}-${( (options.profileLocation.toString()))}`
210
- )))) {
230
+ if (( (installed.some(({ identifier }) => areSameExtensions(identifier, gallery.identifier))))) {
211
231
  continue;
212
232
  }
213
- const existingInstallingExtension = this.installingExtensions.get(getInstallExtensionTaskKey(gallery, options.profileLocation));
214
- if (existingInstallingExtension) {
215
- if (this.canWaitForTask(task, existingInstallingExtension.task)) {
216
- const identifier = existingInstallingExtension.task.identifier;
217
- this.logService.info('Waiting for already requested installing extension', identifier.id, task.identifier.id, ( (options.profileLocation.toString())));
218
- existingInstallingExtension.waitingTasks.push(task);
219
- alreadyRequestedInstallations.push(Event.toPromise(Event.filter(this.onDidInstallExtensions, results => ( (results.some(result => areSameExtensions(result.identifier, identifier)))))).then(results => {
220
- this.logService.info('Finished waiting for already requested installing extension', identifier.id, task.identifier.id, ( (options.profileLocation.toString())));
221
- const result = results.find(result => areSameExtensions(result.identifier, identifier));
222
- if (!result?.local) {
223
- throw ( (new Error(`Extension ${identifier.id} is not installed`)));
224
- }
225
- }));
226
- }
227
- }
228
- else if (!( (installed.some(({ identifier }) => areSameExtensions(identifier, gallery.identifier))))) {
229
- createInstallExtensionTask(manifest, gallery, options, task);
230
- }
233
+ createInstallExtensionTask(manifest, gallery, options, task);
231
234
  }
232
235
  }
233
236
  catch (error) {
@@ -246,6 +249,10 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
246
249
  }
247
250
  }
248
251
  }))));
252
+ const otherProfilesToUpdate = await this.getOtherProfilesToUpdateExtension(( ([...( (installingExtensionsMap.values()))].map(({ task }) => task))));
253
+ for (const [profileLocation, task] of otherProfilesToUpdate) {
254
+ createInstallExtensionTask(task.manifest, task.source, { ...task.options, profileLocation }, undefined);
255
+ }
249
256
  await this.joinAllSettled(( ([...installingExtensionsMap.entries()].map(async ([key, { task }]) => {
250
257
  const startTime = ( (new Date())).getTime();
251
258
  let local;
@@ -253,12 +260,12 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
253
260
  local = await task.run();
254
261
  await this.joinAllSettled(( (this.participants.map(
255
262
  participant => participant.postInstall(local, task.source, task.options, CancellationToken.None)
256
- ))), ExtensionManagementErrorCode.PostInstall);
263
+ ))), "PostInstall" );
257
264
  }
258
265
  catch (e) {
259
266
  const error = toExtensionManagementError(e);
260
267
  if (!URI.isUri(task.source)) {
261
- reportTelemetry(this.telemetryService, task.operation === InstallOperation.Update ? 'extensionGallery:update' : 'extensionGallery:install', {
268
+ reportTelemetry(this.telemetryService, task.operation === 3 ? 'extensionGallery:update' : 'extensionGallery:install', {
262
269
  extensionData: getGalleryExtensionTelemetryData(task.source),
263
270
  error,
264
271
  source: task.options.context?.[EXTENSION_INSTALL_SOURCE_CONTEXT]
@@ -269,7 +276,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
269
276
  throw error;
270
277
  }
271
278
  if (!URI.isUri(task.source)) {
272
- const isUpdate = task.operation === InstallOperation.Update;
279
+ const isUpdate = task.operation === 3 ;
273
280
  const durationSinceUpdate = isUpdate ? undefined : (( (new Date())).getTime() - task.source.lastUpdated) / 1000;
274
281
  reportTelemetry(this.telemetryService, isUpdate ? 'extensionGallery:update' : 'extensionGallery:install', {
275
282
  extensionData: getGalleryExtensionTelemetryData(task.source),
@@ -278,9 +285,9 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
278
285
  durationSinceUpdate,
279
286
  source: task.options.context?.[EXTENSION_INSTALL_SOURCE_CONTEXT]
280
287
  });
281
- if (isWeb && task.operation !== InstallOperation.Update) {
288
+ if (isWeb && task.operation !== 3 ) {
282
289
  try {
283
- await this.galleryService.reportStatistic(local.manifest.publisher, local.manifest.name, local.manifest.version, StatisticType.Install);
290
+ await this.galleryService.reportStatistic(local.manifest.publisher, local.manifest.name, local.manifest.version, "install" );
284
291
  }
285
292
  catch (error) { }
286
293
  }
@@ -313,7 +320,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
313
320
  }
314
321
  return allDepsOrPacks;
315
322
  };
316
- const getErrorResult = (task) => ({ identifier: task.identifier, operation: InstallOperation.Install, source: task.source, context: task.options.context, profileLocation: task.options.profileLocation, error });
323
+ const getErrorResult = (task) => ({ identifier: task.identifier, operation: 2 , source: task.source, context: task.options.context, profileLocation: task.options.profileLocation, error });
317
324
  const rollbackTasks = [];
318
325
  for (const [key, { task, root }] of installingExtensionsMap) {
319
326
  const result = installExtensionResultsMap.get(key);
@@ -372,6 +379,34 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
372
379
  }
373
380
  }
374
381
  }
382
+ async getOtherProfilesToUpdateExtension(tasks) {
383
+ const otherProfilesToUpdate = [];
384
+ const profileExtensionsCache = ( (new ResourceMap()));
385
+ for (const task of tasks) {
386
+ if (task.operation !== 3
387
+ || task.options.isApplicationScoped
388
+ || task.options.pinned
389
+ || task.options.installGivenVersion
390
+ || URI.isUri(task.source)) {
391
+ continue;
392
+ }
393
+ for (const profile of this.userDataProfilesService.profiles) {
394
+ if (this.uriIdentityService.extUri.isEqual(profile.extensionsResource, task.options.profileLocation)) {
395
+ continue;
396
+ }
397
+ let installedExtensions = profileExtensionsCache.get(profile.extensionsResource);
398
+ if (!installedExtensions) {
399
+ installedExtensions = await this.getInstalled(1 , profile.extensionsResource);
400
+ profileExtensionsCache.set(profile.extensionsResource, installedExtensions);
401
+ }
402
+ const installedExtension = installedExtensions.find(e => areSameExtensions(e.identifier, task.identifier));
403
+ if (installedExtension && !installedExtension.pinned) {
404
+ otherProfilesToUpdate.push([profile.extensionsResource, task]);
405
+ }
406
+ }
407
+ }
408
+ return otherProfilesToUpdate;
409
+ }
375
410
  canWaitForTask(taskToWait, taskToWaitFor) {
376
411
  for (const [, { task, waitingTasks }] of this.installingExtensions.entries()) {
377
412
  if (task === taskToWait) {
@@ -406,11 +441,11 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
406
441
  if (errors.length === 1) {
407
442
  throw errors[0];
408
443
  }
409
- let error = ( (new ExtensionManagementError('', ExtensionManagementErrorCode.Unknown)));
444
+ let error = ( (new ExtensionManagementError('', "Unknown" )));
410
445
  for (const current of errors) {
411
446
  error = ( (new ExtensionManagementError(
412
447
  error.message ? `${error.message}, ${current.message}` : current.message,
413
- current.code !== ExtensionManagementErrorCode.Unknown && current.code !== ExtensionManagementErrorCode.Internal ? current.code : error.code
448
+ current.code !== "Unknown" && current.code !== "Internal" ? current.code : error.code
414
449
  )));
415
450
  }
416
451
  throw error;
@@ -472,10 +507,10 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
472
507
  const extensionsControlManifest = await this.getExtensionsControlManifest();
473
508
  if (( (extensionsControlManifest.malicious.some(identifier => areSameExtensions(extension.identifier, identifier))))) {
474
509
  throw ( (new ExtensionManagementError(localize(
475
- 11163,
510
+ 11276,
476
511
  "Can't install '{0}' extension since it was reported to be problematic.",
477
512
  extension.identifier.id
478
- ), ExtensionManagementErrorCode.Malicious)));
513
+ ), "Malicious" )));
479
514
  }
480
515
  const deprecationInfo = extensionsControlManifest.deprecated[extension.identifier.id.toLowerCase()];
481
516
  if (deprecationInfo?.extension?.autoMigrate) {
@@ -483,49 +518,49 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
483
518
  compatibleExtension = (await this.galleryService.getExtensions([{ id: deprecationInfo.extension.id, preRelease: deprecationInfo.extension.preRelease }], { targetPlatform: await this.getTargetPlatform(), compatible: true, productVersion }, CancellationToken.None))[0];
484
519
  if (!compatibleExtension) {
485
520
  throw ( (new ExtensionManagementError(localize(
486
- 11164,
521
+ 11277,
487
522
  "Can't install '{0}' extension since it was deprecated and the replacement extension '{1}' can't be found.",
488
523
  extension.identifier.id,
489
524
  deprecationInfo.extension.id
490
- ), ExtensionManagementErrorCode.Deprecated)));
525
+ ), "Deprecated" )));
491
526
  }
492
527
  }
493
528
  else {
494
529
  if (!(await this.canInstall(extension))) {
495
530
  const targetPlatform = await this.getTargetPlatform();
496
531
  throw ( (new ExtensionManagementError(localize(
497
- 11165,
532
+ 11278,
498
533
  "The '{0}' extension is not available in {1} for {2}.",
499
534
  extension.identifier.id,
500
535
  this.productService.nameLong,
501
536
  TargetPlatformToString(targetPlatform)
502
- ), ExtensionManagementErrorCode.IncompatibleTargetPlatform)));
537
+ ), "IncompatibleTargetPlatform" )));
503
538
  }
504
539
  compatibleExtension = await this.getCompatibleVersion(extension, sameVersion, installPreRelease, productVersion);
505
540
  if (!compatibleExtension) {
506
541
  const incompatibleApiProposalsMessages = [];
507
542
  if (!areApiProposalsCompatible(extension.properties.enabledApiProposals ?? [], incompatibleApiProposalsMessages)) {
508
543
  throw ( (new ExtensionManagementError(localize(
509
- 11166,
544
+ 11279,
510
545
  "Can't install '{0}' extension. {1}",
511
546
  extension.displayName ?? extension.identifier.id,
512
547
  incompatibleApiProposalsMessages[0]
513
- ), ExtensionManagementErrorCode.IncompatibleApi)));
548
+ ), "IncompatibleApi" )));
514
549
  }
515
550
  if (!installPreRelease && extension.properties.isPreReleaseVersion && (await this.galleryService.getExtensions([extension.identifier], CancellationToken.None))[0]) {
516
551
  throw ( (new ExtensionManagementError(localize(
517
- 11167,
552
+ 11280,
518
553
  "Can't install release version of '{0}' extension because it has no release version.",
519
554
  extension.displayName ?? extension.identifier.id
520
- ), ExtensionManagementErrorCode.ReleaseVersionNotFound)));
555
+ ), "ReleaseVersionNotFound" )));
521
556
  }
522
557
  throw ( (new ExtensionManagementError(localize(
523
- 11168,
558
+ 11281,
524
559
  "Can't install '{0}' extension because it is not compatible with the current version of {1} (version {2}).",
525
560
  extension.identifier.id,
526
561
  this.productService.nameLong,
527
562
  this.productService.version
528
- ), ExtensionManagementErrorCode.Incompatible)));
563
+ ), "Incompatible" )));
529
564
  }
530
565
  }
531
566
  this.logService.info('Getting Manifest...', compatibleExtension.identifier.id);
@@ -533,13 +568,13 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
533
568
  if (manifest === null) {
534
569
  throw ( (new ExtensionManagementError(
535
570
  `Missing manifest for extension ${compatibleExtension.identifier.id}`,
536
- ExtensionManagementErrorCode.Invalid
571
+ "Invalid"
537
572
  )));
538
573
  }
539
574
  if (manifest.version !== compatibleExtension.version) {
540
575
  throw ( (new ExtensionManagementError(
541
576
  `Cannot install '${compatibleExtension.identifier.id}' extension because of version mismatch in Marketplace`,
542
- ExtensionManagementErrorCode.Invalid
577
+ "Invalid"
543
578
  )));
544
579
  }
545
580
  return { extension: compatibleExtension, manifest };
@@ -604,7 +639,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
604
639
  for (const task of allTasks.slice(0)) {
605
640
  let installed = installedExtensionsMap.get(task.options.profileLocation);
606
641
  if (!installed) {
607
- installedExtensionsMap.set(task.options.profileLocation, installed = await this.getInstalled(ExtensionType.User, task.options.profileLocation));
642
+ installedExtensionsMap.set(task.options.profileLocation, installed = await this.getInstalled(1 , task.options.profileLocation));
608
643
  }
609
644
  if (task.options.donotIncludePack) {
610
645
  this.logService.info('Uninstalling the extension without including packed extension', `${task.extension.identifier.id}@${task.extension.manifest.version}`);
@@ -635,7 +670,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
635
670
  ))));
636
671
  if (task.extension.identifier.uuid) {
637
672
  try {
638
- await this.galleryService.reportStatistic(task.extension.manifest.publisher, task.extension.manifest.name, task.extension.manifest.version, StatisticType.Uninstall);
673
+ await this.galleryService.reportStatistic(task.extension.manifest.publisher, task.extension.manifest.name, task.extension.manifest.version, "uninstall" );
639
674
  }
640
675
  catch (error) { }
641
676
  }
@@ -694,7 +729,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
694
729
  if (extensionToUninstall === dependingExtension) {
695
730
  if (dependents.length === 1) {
696
731
  return ( localize(
697
- 11169,
732
+ 11282,
698
733
  "Cannot uninstall '{0}' extension. '{1}' extension depends on this.",
699
734
  extensionToUninstall.manifest.displayName || extensionToUninstall.manifest.name,
700
735
  dependents[0].manifest.displayName || dependents[0].manifest.name
@@ -702,7 +737,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
702
737
  }
703
738
  if (dependents.length === 2) {
704
739
  return ( localize(
705
- 11170,
740
+ 11283,
706
741
  "Cannot uninstall '{0}' extension. '{1}' and '{2}' extensions depend on this.",
707
742
  extensionToUninstall.manifest.displayName || extensionToUninstall.manifest.name,
708
743
  dependents[0].manifest.displayName || dependents[0].manifest.name,
@@ -710,7 +745,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
710
745
  ));
711
746
  }
712
747
  return ( localize(
713
- 11171,
748
+ 11284,
714
749
  "Cannot uninstall '{0}' extension. '{1}', '{2}' and other extension depend on this.",
715
750
  extensionToUninstall.manifest.displayName || extensionToUninstall.manifest.name,
716
751
  dependents[0].manifest.displayName || dependents[0].manifest.name,
@@ -719,7 +754,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
719
754
  }
720
755
  if (dependents.length === 1) {
721
756
  return ( localize(
722
- 11172,
757
+ 11285,
723
758
  "Cannot uninstall '{0}' extension . It includes uninstalling '{1}' extension and '{2}' extension depends on this.",
724
759
  extensionToUninstall.manifest.displayName || extensionToUninstall.manifest.name,
725
760
  dependingExtension.manifest.displayName
@@ -729,7 +764,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
729
764
  }
730
765
  if (dependents.length === 2) {
731
766
  return ( localize(
732
- 11173,
767
+ 11286,
733
768
  "Cannot uninstall '{0}' extension. It includes uninstalling '{1}' extension and '{2}' and '{3}' extensions depend on this.",
734
769
  extensionToUninstall.manifest.displayName || extensionToUninstall.manifest.name,
735
770
  dependingExtension.manifest.displayName
@@ -739,7 +774,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
739
774
  ));
740
775
  }
741
776
  return ( localize(
742
- 11174,
777
+ 11287,
743
778
  "Cannot uninstall '{0}' extension. It includes uninstalling '{1}' extension and '{2}', '{3}' and other extensions depend on this.",
744
779
  extensionToUninstall.manifest.displayName || extensionToUninstall.manifest.name,
745
780
  dependingExtension.manifest.displayName
@@ -794,41 +829,28 @@ function toExtensionManagementError(error, code) {
794
829
  if (error instanceof ExtensionGalleryError) {
795
830
  extensionManagementError = ( (new ExtensionManagementError(
796
831
  error.message,
797
- error.code === ExtensionGalleryErrorCode.DownloadFailedWriting ? ExtensionManagementErrorCode.DownloadFailedWriting : ExtensionManagementErrorCode.Gallery
832
+ error.code === "DownloadFailedWriting" ? "DownloadFailedWriting" : "Gallery"
798
833
  )));
799
834
  }
800
835
  else {
801
836
  extensionManagementError = ( (new ExtensionManagementError(
802
837
  error.message,
803
- isCancellationError(error) ? ExtensionManagementErrorCode.Cancelled : (code ?? ExtensionManagementErrorCode.Internal)
838
+ isCancellationError(error) ? "Cancelled" : ((code ?? "Internal") )
804
839
  )));
805
840
  }
806
841
  extensionManagementError.stack = error.stack;
807
842
  return extensionManagementError;
808
843
  }
809
844
  function reportTelemetry(telemetryService, eventName, { extensionData, verificationStatus, duration, error, source, durationSinceUpdate }) {
810
- let errorcode;
811
- let errorcodeDetail;
812
- if (isDefined(verificationStatus)) {
813
- if (verificationStatus === true) {
814
- verificationStatus = 'Verified';
815
- }
816
- else if (verificationStatus === false) {
817
- verificationStatus = 'Unverified';
818
- }
819
- else {
820
- errorcode = ExtensionManagementErrorCode.Signature;
821
- errorcodeDetail = verificationStatus;
822
- verificationStatus = 'Unverified';
823
- }
824
- }
825
- if (error) {
826
- errorcode = error.code;
827
- if (error.code === ExtensionManagementErrorCode.Signature) {
828
- errorcodeDetail = error.message;
829
- }
830
- }
831
- telemetryService.publicLog(eventName, { ...extensionData, verificationStatus, success: !error, duration, errorcode, errorcodeDetail, durationSinceUpdate, source });
845
+ telemetryService.publicLog(eventName, {
846
+ ...extensionData,
847
+ source,
848
+ duration,
849
+ durationSinceUpdate,
850
+ success: !error,
851
+ errorcode: error?.code,
852
+ verificationStatus: verificationStatus === ExtensionSignatureVerificationCode.Success ? 'Verified' : (verificationStatus ?? 'Unverified')
853
+ });
832
854
  }
833
855
  class AbstractExtensionTask {
834
856
  constructor() {
@@ -9,9 +9,8 @@ import { URI } from 'vscode/vscode/vs/base/common/uri';
9
9
  import { isOfflineError } from 'vscode/vscode/vs/base/parts/request/common/request';
10
10
  import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
11
11
  import { IEnvironmentService } from 'vscode/vscode/vs/platform/environment/common/environment.service';
12
- import { getTargetPlatform, SortBy, SortOrder, toTargetPlatform, WEB_EXTENSION_TAG, isNotWebExtensionInWebTargetPlatform, isTargetPlatformCompatible, ExtensionGalleryErrorCode, ExtensionGalleryError, StatisticType, InstallOperation } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
12
+ import { getTargetPlatform, toTargetPlatform, WEB_EXTENSION_TAG, isNotWebExtensionInWebTargetPlatform, isTargetPlatformCompatible, ExtensionGalleryError } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
13
13
  import { adoptToGalleryExtensionId, getGalleryExtensionId, areSameExtensions, getGalleryExtensionTelemetryData } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
14
- import { TargetPlatform } from 'vscode/vscode/vs/platform/extensions/common/extensions';
15
14
  import { isEngineValid, areApiProposalsCompatible } from 'vscode/vscode/vs/platform/extensions/common/extensionValidator';
16
15
  import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
17
16
  import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
@@ -23,7 +22,7 @@ import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storag
23
22
  import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
24
23
  import { StopWatch } from 'vscode/vscode/vs/base/common/stopwatch';
25
24
 
26
- const CURRENT_TARGET_PLATFORM = isWeb ? TargetPlatform.WEB : getTargetPlatform(platform, arch);
25
+ const CURRENT_TARGET_PLATFORM = isWeb ? "web" : getTargetPlatform(platform, arch);
27
26
  const ACTIVITY_HEADER_NAME = 'X-Market-Search-Activity-Id';
28
27
  var Flags;
29
28
  ( (function(Flags) {
@@ -81,8 +80,8 @@ const DefaultPageSize = 10;
81
80
  const DefaultQueryState = {
82
81
  pageNumber: 1,
83
82
  pageSize: DefaultPageSize,
84
- sortBy: SortBy.NoneOrRelevance,
85
- sortOrder: SortOrder.Default,
83
+ sortBy: 0 ,
84
+ sortOrder: 0 ,
86
85
  flags: Flags.None,
87
86
  criteria: [],
88
87
  assetTypes: []
@@ -217,15 +216,15 @@ function getIsPreview(flags) {
217
216
  return flags.indexOf('preview') !== -1;
218
217
  }
219
218
  function getTargetPlatformForExtensionVersion(version) {
220
- return version.targetPlatform ? toTargetPlatform(version.targetPlatform) : TargetPlatform.UNDEFINED;
219
+ return version.targetPlatform ? toTargetPlatform(version.targetPlatform) : "undefined" ;
221
220
  }
222
221
  function getAllTargetPlatforms(rawGalleryExtension) {
223
222
  const allTargetPlatforms = distinct(( rawGalleryExtension.versions.map(getTargetPlatformForExtensionVersion)));
224
223
  const isWebExtension = !!rawGalleryExtension.tags?.includes(WEB_EXTENSION_TAG);
225
- const webTargetPlatformIndex = allTargetPlatforms.indexOf(TargetPlatform.WEB);
224
+ const webTargetPlatformIndex = allTargetPlatforms.indexOf("web" );
226
225
  if (isWebExtension) {
227
226
  if (webTargetPlatformIndex === -1) {
228
- allTargetPlatforms.push(TargetPlatform.WEB);
227
+ allTargetPlatforms.push("web" );
229
228
  }
230
229
  }
231
230
  else {
@@ -485,7 +484,7 @@ let AbstractExtensionGalleryService = class AbstractExtensionGalleryService {
485
484
  text = text.length < 200 ? text : text.substring(0, 200);
486
485
  query = query.withFilter(FilterType.SearchText, text);
487
486
  }
488
- query = query.withSortBy(SortBy.NoneOrRelevance);
487
+ query = query.withSortBy(0 );
489
488
  }
490
489
  else if (options.ids) {
491
490
  query = query.withFilter(FilterType.ExtensionId, ...options.ids);
@@ -494,7 +493,7 @@ let AbstractExtensionGalleryService = class AbstractExtensionGalleryService {
494
493
  query = query.withFilter(FilterType.ExtensionName, ...options.names);
495
494
  }
496
495
  else {
497
- query = query.withSortBy(SortBy.InstallCount);
496
+ query = query.withSortBy(4 );
498
497
  }
499
498
  if (typeof options.sortBy === 'number') {
500
499
  query = query.withSortBy(options.sortBy);
@@ -657,16 +656,16 @@ let AbstractExtensionGalleryService = class AbstractExtensionGalleryService {
657
656
  }
658
657
  catch (e) {
659
658
  if (isCancellationError(e)) {
660
- errorCode = ExtensionGalleryErrorCode.Cancelled;
659
+ errorCode = "Cancelled" ;
661
660
  throw e;
662
661
  }
663
662
  else {
664
663
  const errorMessage = getErrorMessage(e);
665
664
  errorCode = isOfflineError(e)
666
- ? ExtensionGalleryErrorCode.Offline
665
+ ? "Offline"
667
666
  : errorMessage.startsWith('XHR timeout')
668
- ? ExtensionGalleryErrorCode.Timeout
669
- : ExtensionGalleryErrorCode.Failed;
667
+ ? "Timeout"
668
+ : "Failed" ;
670
669
  throw ( new ExtensionGalleryError(errorMessage, errorCode));
671
670
  }
672
671
  }
@@ -687,7 +686,7 @@ let AbstractExtensionGalleryService = class AbstractExtensionGalleryService {
687
686
  if (!this.isEnabled()) {
688
687
  return undefined;
689
688
  }
690
- const url = isWeb ? this.api(`/itemName/${publisher}.${name}/version/${version}/statType/${type === StatisticType.Install ? '1' : '3'}/vscodewebextension`) : this.api(`/publishers/${publisher}/extensions/${name}/${version}/stats?statType=${type}`);
689
+ const url = isWeb ? this.api(`/itemName/${publisher}.${name}/version/${version}/statType/${type === "install" ? '1' : '3'}/vscodewebextension`) : this.api(`/publishers/${publisher}/extensions/${name}/${version}/stats?statType=${type}`);
691
690
  const Accept = isWeb ? 'api-version=6.1-preview.1' : '*/*;api-version=4.0-preview.1';
692
691
  const commonHeaders = await this.commonHeadersPromise;
693
692
  const headers = { ...commonHeaders, Accept };
@@ -704,7 +703,7 @@ let AbstractExtensionGalleryService = class AbstractExtensionGalleryService {
704
703
  this.logService.trace('ExtensionGalleryService#download', extension.identifier.id);
705
704
  const data = getGalleryExtensionTelemetryData(extension);
706
705
  const startTime = ( new Date()).getTime();
707
- const operationParam = operation === InstallOperation.Install ? 'install' : operation === InstallOperation.Update ? 'update' : '';
706
+ const operationParam = operation === 2 ? 'install' : operation === 3 ? 'update' : '';
708
707
  const downloadAsset = operationParam ? {
709
708
  uri: `${extension.assets.download.uri}${( URI.parse(extension.assets.download.uri)).query ? '&' : '?'}${operationParam}=true`,
710
709
  fallbackUri: `${extension.assets.download.fallbackUri}${( URI.parse(extension.assets.download.fallbackUri)).query ? '&' : '?'}${operationParam}=true`
@@ -721,7 +720,10 @@ let AbstractExtensionGalleryService = class AbstractExtensionGalleryService {
721
720
  catch (e) {
722
721
  this.logService.warn(`Error while deleting the file ${( location.toString())}`, getErrorMessage(e));
723
722
  }
724
- throw ( new ExtensionGalleryError(getErrorMessage(error), ExtensionGalleryErrorCode.DownloadFailedWriting));
723
+ throw ( new ExtensionGalleryError(
724
+ getErrorMessage(error),
725
+ "DownloadFailedWriting"
726
+ ));
725
727
  }
726
728
  this.telemetryService.publicLog('galleryService:downloadVSIX', { ...data, duration: ( new Date()).getTime() - startTime });
727
729
  }
@@ -741,7 +743,10 @@ let AbstractExtensionGalleryService = class AbstractExtensionGalleryService {
741
743
  catch (e) {
742
744
  this.logService.warn(`Error while deleting the file ${( location.toString())}`, getErrorMessage(e));
743
745
  }
744
- throw ( new ExtensionGalleryError(getErrorMessage(error), ExtensionGalleryErrorCode.DownloadFailedWriting));
746
+ throw ( new ExtensionGalleryError(
747
+ getErrorMessage(error),
748
+ "DownloadFailedWriting"
749
+ ));
745
750
  }
746
751
  }
747
752
  async getReadme(extension, token) {