chore(vscode): update to 1.54.2

This commit is contained in:
Joe Previte
2021-03-11 10:27:10 -07:00
1459 changed files with 53404 additions and 51004 deletions

View File

@@ -0,0 +1,74 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
import { Emitter, Event } from 'vs/base/common/event';
import { IUpdateService, State } from 'vs/platform/update/common/update';
export class UpdateChannel implements IServerChannel {
constructor(private service: IUpdateService) { }
listen(_: unknown, event: string): Event<any> {
switch (event) {
case 'onStateChange': return this.service.onStateChange;
}
throw new Error(`Event not found: ${event}`);
}
call(_: unknown, command: string, arg?: any): Promise<any> {
switch (command) {
case 'checkForUpdates': return this.service.checkForUpdates(arg);
case 'downloadUpdate': return this.service.downloadUpdate();
case 'applyUpdate': return this.service.applyUpdate();
case 'quitAndInstall': return this.service.quitAndInstall();
case '_getInitialState': return Promise.resolve(this.service.state);
case 'isLatestVersion': return this.service.isLatestVersion();
}
throw new Error(`Call not found: ${command}`);
}
}
export class UpdateChannelClient implements IUpdateService {
declare readonly _serviceBrand: undefined;
private readonly _onStateChange = new Emitter<State>();
readonly onStateChange: Event<State> = this._onStateChange.event;
private _state: State = State.Uninitialized;
get state(): State { return this._state; }
set state(state: State) {
this._state = state;
this._onStateChange.fire(state);
}
constructor(private readonly channel: IChannel) {
this.channel.listen<State>('onStateChange')(state => this.state = state);
this.channel.call<State>('_getInitialState').then(state => this.state = state);
}
checkForUpdates(context: any): Promise<void> {
return this.channel.call('checkForUpdates', context);
}
downloadUpdate(): Promise<void> {
return this.channel.call('downloadUpdate');
}
applyUpdate(): Promise<void> {
return this.channel.call('applyUpdate');
}
quitAndInstall(): Promise<void> {
return this.channel.call('quitAndInstall');
}
isLatestVersion(): Promise<boolean> {
return this.channel.call('isLatestVersion');
}
}

View File

@@ -46,7 +46,7 @@ export abstract class AbstractUpdateService implements IUpdateService {
constructor(
@ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService,
@IConfigurationService protected configurationService: IConfigurationService,
@IEnvironmentMainService private readonly environmentService: IEnvironmentMainService,
@IEnvironmentMainService private readonly environmentMainService: IEnvironmentMainService,
@IRequestService protected requestService: IRequestService,
@ILogService protected logService: ILogService,
) { }
@@ -57,11 +57,11 @@ export abstract class AbstractUpdateService implements IUpdateService {
* https://github.com/microsoft/vscode/issues/89784
*/
initialize(): void {
if (!this.environmentService.isBuilt) {
if (!this.environmentMainService.isBuilt) {
return; // updates are never enabled when running out of sources
}
if (this.environmentService.disableUpdates) {
if (this.environmentMainService.disableUpdates) {
this.logService.info('update#ctor - updates are disabled by the environment');
return;
}

View File

@@ -1,34 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IServerChannel } from 'vs/base/parts/ipc/common/ipc';
import { Event } from 'vs/base/common/event';
import { IUpdateService } from 'vs/platform/update/common/update';
export class UpdateChannel implements IServerChannel {
constructor(private service: IUpdateService) { }
listen(_: unknown, event: string): Event<any> {
switch (event) {
case 'onStateChange': return this.service.onStateChange;
}
throw new Error(`Event not found: ${event}`);
}
call(_: unknown, command: string, arg?: any): Promise<any> {
switch (command) {
case 'checkForUpdates': return this.service.checkForUpdates(arg);
case 'downloadUpdate': return this.service.downloadUpdate();
case 'applyUpdate': return this.service.applyUpdate();
case 'quitAndInstall': return this.service.quitAndInstall();
case '_getInitialState': return Promise.resolve(this.service.state);
case 'isLatestVersion': return this.service.isLatestVersion();
}
throw new Error(`Call not found: ${command}`);
}
}

View File

@@ -32,11 +32,11 @@ export class DarwinUpdateService extends AbstractUpdateService {
@ILifecycleMainService lifecycleMainService: ILifecycleMainService,
@IConfigurationService configurationService: IConfigurationService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
@IEnvironmentMainService environmentService: IEnvironmentMainService,
@IEnvironmentMainService environmentMainService: IEnvironmentMainService,
@IRequestService requestService: IRequestService,
@ILogService logService: ILogService
) {
super(lifecycleMainService, configurationService, environmentService, requestService, logService);
super(lifecycleMainService, configurationService, environmentMainService, requestService, logService);
}
initialize(): void {

View File

@@ -23,12 +23,12 @@ export class LinuxUpdateService extends AbstractUpdateService {
@ILifecycleMainService lifecycleMainService: ILifecycleMainService,
@IConfigurationService configurationService: IConfigurationService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
@IEnvironmentMainService environmentService: IEnvironmentMainService,
@IEnvironmentMainService environmentMainService: IEnvironmentMainService,
@IRequestService requestService: IRequestService,
@ILogService logService: ILogService,
@INativeHostMainService private readonly nativeHostMainService: INativeHostMainService
) {
super(lifecycleMainService, configurationService, environmentService, requestService, logService);
super(lifecycleMainService, configurationService, environmentMainService, requestService, logService);
}
protected buildUpdateFeedUrl(quality: string): string {

View File

@@ -36,10 +36,10 @@ abstract class AbstractUpdateService2 implements IUpdateService {
constructor(
@ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService,
@IEnvironmentMainService environmentService: IEnvironmentMainService,
@IEnvironmentMainService environmentMainService: IEnvironmentMainService,
@ILogService protected logService: ILogService,
) {
if (environmentService.disableUpdates) {
if (environmentMainService.disableUpdates) {
this.logService.info('update#ctor - updates are disabled');
return;
}
@@ -140,11 +140,11 @@ export class SnapUpdateService extends AbstractUpdateService2 {
private snap: string,
private snapRevision: string,
@ILifecycleMainService lifecycleMainService: ILifecycleMainService,
@IEnvironmentMainService environmentService: IEnvironmentMainService,
@IEnvironmentMainService environmentMainService: IEnvironmentMainService,
@ILogService logService: ILogService,
@ITelemetryService private readonly telemetryService: ITelemetryService
) {
super(lifecycleMainService, environmentService, logService);
super(lifecycleMainService, environmentMainService, logService);
const watcher = watch(path.dirname(this.snap));
const onChange = Event.fromNodeEventEmitter(watcher, 'change', (_, fileName: string) => fileName);

View File

@@ -56,20 +56,20 @@ export class Win32UpdateService extends AbstractUpdateService {
@memoize
get cachePath(): Promise<string> {
const result = path.join(tmpdir(), `vscode-update-${product.target}-${process.arch}`);
return pfs.mkdirp(result).then(() => result);
return fs.promises.mkdir(result, { recursive: true }).then(() => result);
}
constructor(
@ILifecycleMainService lifecycleMainService: ILifecycleMainService,
@IConfigurationService configurationService: IConfigurationService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
@IEnvironmentMainService environmentService: IEnvironmentMainService,
@IEnvironmentMainService environmentMainService: IEnvironmentMainService,
@IRequestService requestService: IRequestService,
@ILogService logService: ILogService,
@IFileService private readonly fileService: IFileService,
@INativeHostMainService private readonly nativeHostMainService: INativeHostMainService
) {
super(lifecycleMainService, configurationService, environmentService, requestService, logService);
super(lifecycleMainService, configurationService, environmentMainService, requestService, logService);
}
initialize(): void {
@@ -146,7 +146,7 @@ export class Win32UpdateService extends AbstractUpdateService {
return this.requestService.request({ url }, CancellationToken.None)
.then(context => this.fileService.writeFile(URI.file(downloadPath), context.stream))
.then(hash ? () => checksum(downloadPath, update.hash) : () => undefined)
.then(() => pfs.rename(downloadPath, updatePackagePath))
.then(() => fs.promises.rename(downloadPath, updatePackagePath))
.then(() => updatePackagePath);
});
}).then(packagePath => {
@@ -196,7 +196,7 @@ export class Win32UpdateService extends AbstractUpdateService {
const promises = versions.filter(filter).map(async one => {
try {
await pfs.unlink(path.join(cachePath, one));
await fs.promises.unlink(path.join(cachePath, one));
} catch (err) {
// ignore
}