Archived
1
0

fix(lib/vscode): remove native-keymap and keytar (#2961)

native-keymap and keytar are only used in the electron process,
so we don't need them. This allows us to drop our dependencies on
libx11-dev, libxkbfile-dev, and libsecret-dev.
This commit is contained in:
Akash Satheesan
2021-03-25 22:20:58 +05:30
committed by GitHub
parent 24a474ce20
commit 8332a6abc9
9 changed files with 155 additions and 220 deletions

58
lib/vscode/src/typings/keytar.d.ts vendored Normal file
View File

@ -0,0 +1,58 @@
// Definitions by: Milan Burda <https://github.com/miniak>, Brendan Forster <https://github.com/shiftkey>, Hari Juturu <https://github.com/juturu>
// Adapted from DefinitelyTyped: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/keytar/index.d.ts
// NOTE@coder: copy in from keytar upstream and modify
// keytar pulls in libsecret-dev, which we want to avoid,
// and vscode has a 'fallback' for web use that redirects keytar calls to use localStorage.
// Keep types in here for it to compile correctly.
declare module 'keytar' {
/**
* Get the stored password for the service and account.
*
* @param service The string service name.
* @param account The string account name.
*
* @returns A promise for the password string.
*/
export function getPassword(service: string, account: string): Promise<string | null>;
/**
* Add the password for the service and account to the keychain.
*
* @param service The string service name.
* @param account The string account name.
* @param password The string password.
*
* @returns A promise for the set password completion.
*/
export function setPassword(service: string, account: string, password: string): Promise<void>;
/**
* Delete the stored password for the service and account.
*
* @param service The string service name.
* @param account The string account name.
*
* @returns A promise for the deletion status. True on success.
*/
export function deletePassword(service: string, account: string): Promise<boolean>;
/**
* Find a password for the service in the keychain.
*
* @param service The string service name.
*
* @returns A promise for the password string.
*/
export function findPassword(service: string): Promise<string | null>;
/**
* Find all accounts and passwords for `service` in the keychain.
*
* @param service The string service name.
*
* @returns A promise for the array of found credentials.
*/
export function findCredentials(service: string): Promise<Array<{ account: string, password: string}>>;
}

View File

@ -0,0 +1,75 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// NOTE@coder: copy from native-keymap
// only used in electron-main, so we remove it to avoid pulling X11 in at build time.
// these types are required during compile, but functions are never used
declare module 'native-keymap' {
export interface IWindowsKeyMapping {
vkey: string;
value: string;
withShift: string;
withAltGr: string;
withShiftAltGr: string;
}
export interface IWindowsKeyboardMapping {
[code: string]: IWindowsKeyMapping;
}
export interface ILinuxKeyMapping {
value: string;
withShift: string;
withAltGr: string;
withShiftAltGr: string;
}
export interface ILinuxKeyboardMapping {
[code: string]: ILinuxKeyMapping;
}
export interface IMacKeyMapping {
value: string;
valueIsDeadKey: boolean;
withShift: string;
withShiftIsDeadKey: boolean;
withAltGr: string;
withAltGrIsDeadKey: boolean;
withShiftAltGr: string;
withShiftAltGrIsDeadKey: boolean;
}
export interface IMacKeyboardMapping {
[code: string]: IMacKeyMapping;
}
export type IKeyboardMapping = IWindowsKeyboardMapping | ILinuxKeyboardMapping | IMacKeyboardMapping;
export function getKeyMap(): IKeyboardMapping;
export interface IWindowsKeyboardLayoutInfo {
name: string;
id: string;
text: string;
}
export interface ILinuxKeyboardLayoutInfo {
model: string;
layout: string;
variant: string;
options: string;
rules: string;
}
export interface IMacKeyboardLayoutInfo {
id: string;
localizedName: string;
lang: string;
}
export type IKeyboardLayoutInfo = IWindowsKeyboardLayoutInfo | ILinuxKeyboardLayoutInfo | IMacKeyboardLayoutInfo;
export function getCurrentKeyboardLayout(): IKeyboardLayoutInfo;
export function onDidChangeKeyboardLayout(callback: () => void): void;
export function isISOKeyboard(): boolean | undefined;
}