2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { isWeb } from '../../../base/common/platform.js';
7
>
import { format2 } from '../../../base/common/strings.js';
8
>
import { URI } from '../../../base/common/uri.js';
9
>
import { IConfigurationService } from '../../configuration/common/configuration.js';
10
>
import { IEnvironmentService } from '../../environment/common/environment.js';
11
>
import { IFileService } from '../../files/common/files.js';
12
>
import { createDecorator } from '../../instantiation/common/instantiation.js';
13
>
import { IProductService } from '../../product/common/productService.js';
14
>
import { getServiceMachineId } from '../../externalServices/common/serviceMachineId.js';
15
>
import { IStorageService } from '../../storage/common/storage.js';
16
>
import { TelemetryLevel } from '../../telemetry/common/telemetry.js';
17
>
import { getTelemetryLevel, supportsTelemetry } from '../../telemetry/common/telemetryUtils.js';
18
>
import { RemoteAuthorities } from '../../../base/common/network.js';
19
>
import { TargetPlatform } from '../../extensions/common/extensions.js';
20
>
import { ExtensionGalleryResourceType, getExtensionGalleryManifestResourceUri, IExtensionGalleryManifest, IExtensionGalleryManifestService } from '../../extensionManagement/common/extensionGalleryManifest.js';
21
>
import { ILogService } from '../../log/common/log.js';
22
>
import { Disposable } from '../../../base/common/lifecycle.js';
23
>
24
>
const WEB_EXTENSION_RESOURCE_END_POINT_SEGMENT = '/web-extension-resource/';
25
>
26
>
export const IExtensionResourceLoaderService = createDecorator<IExtensionResourceLoaderService>('extensionResourceLoaderService');
27
>
28
>
/**
29
>
* A service useful for reading resources from within extensions.
30
>
*/
31
>
export interface IExtensionResourceLoaderService {
32
>
readonly _serviceBrand: undefined;
33
>
34
>
/**
35
>
* Read a certain resource within an extension.
36
>
*/
37
>
readExtensionResource(uri: URI): Promise<string>;
38
>
39
>
/**
40
>
* Returns whether the gallery provides extension resources.
41
>
*/
42
>
supportsExtensionGalleryResources(): Promise<boolean>;
43
>
44
>
/**
45
>
* Return true if the given URI is a extension gallery resource.
46
>
*/
47
>
isExtensionGalleryResource(uri: URI): Promise<boolean>;
48
>
49
>
/**
50
>
* Computes the URL of a extension gallery resource. Returns `undefined` if gallery does not provide extension resources.
51
>
*/
52
>
getExtensionGalleryResourceURL(galleryExtension: { publisher: string; name: string; version: string; targetPlatform?: TargetPlatform }, path?: string): Promise<URI | undefined>;
53
>
}
54
>
55
>
export function migratePlatformSpecificExtensionGalleryResourceURL(resource: URI, targetPlatform: TargetPlatform): URI | undefined {
56
if (resource.query !== `target=${targetPlatform}`) {
57
return undefined;