-
Notifications
You must be signed in to change notification settings - Fork 5.9k
fix(lib/vscode): remove native-keymap and keytar #2961
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+155
−220
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}>>; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
jsjoeio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* 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; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for review:
@types/keytar
is deprecated sincekeytar
includes types - I removed both and added atypings
file.