From c794db9e318cdeb5696ed3c0570581a72a5025d6 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 2 Oct 2018 14:23:28 -0700 Subject: [PATCH] Switch to use a few more @types packages instead of our custom versions --- package.json | 5 + src/typings/keytar.d.ts | 48 ---- src/typings/minimist.d.ts | 35 --- src/typings/semver.d.ts | 125 ----------- src/typings/sinon.d.ts | 448 -------------------------------------- src/typings/winreg.d.ts | 338 ---------------------------- yarn.lock | 42 +++- 7 files changed, 46 insertions(+), 995 deletions(-) delete mode 100644 src/typings/keytar.d.ts delete mode 100644 src/typings/minimist.d.ts delete mode 100644 src/typings/semver.d.ts delete mode 100644 src/typings/sinon.d.ts delete mode 100644 src/typings/winreg.d.ts diff --git a/package.json b/package.json index 358f00e8e95..7e10e99a15f 100644 --- a/package.json +++ b/package.json @@ -56,8 +56,13 @@ }, "devDependencies": { "7zip": "0.0.6", + "@types/keytar": "^4.0.1", + "@types/minimist": "^1.2.0", "@types/mocha": "2.2.39", + "@types/semver": "^5.5.0", + "@types/sinon": "^1.16.36", "@types/webpack": "^4.4.10", + "@types/winreg": "^1.2.30", "asar": "^0.14.0", "chromium-pickle-js": "^0.2.0", "clean-css": "3.4.6", diff --git a/src/typings/keytar.d.ts b/src/typings/keytar.d.ts deleted file mode 100644 index e881644eb8d..00000000000 --- a/src/typings/keytar.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -// Type definitions for keytar 4.0.2 -// Project: http://atom.github.io/node-keytar/ -// Definitions by: Milan Burda , Brendan Forster , Hari Juturu -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -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; - - /** - * 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; - - /** - * 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; - - /** - * 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; - -} \ No newline at end of file diff --git a/src/typings/minimist.d.ts b/src/typings/minimist.d.ts deleted file mode 100644 index d1e1a05252a..00000000000 --- a/src/typings/minimist.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Type definitions for minimist 1.1.3 -// Project: https://github.com/substack/minimist -// Definitions by: Bart van der Schoor , Necroskillz -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare module 'minimist' { - function minimist(args?: string[], opts?: minimist.Opts): minimist.ParsedArgs; - - namespace minimist { - export interface Opts { - // a string or array of strings argument names to always treat as strings - string?: string | string[]; - // a string or array of strings to always treat as booleans - boolean?: boolean | string | string[]; - // an object mapping string names to strings or arrays of string argument names to use - alias?: { [key: string]: string | string[] }; - // an object mapping string argument names to default values - default?: { [key: string]: any }; - // when true, populate argv._ with everything after the first non-option - stopEarly?: boolean; - // a function which is invoked with a command line parameter not defined in the opts configuration object. - // If the function returns false, the unknown option is not added to argv - unknown?: (arg: string) => boolean; - // when true, populate argv._ with everything before the -- and argv['--'] with everything after the -- - '--'?: boolean; - } - - export interface ParsedArgs { - [arg: string]: any; - _: string[]; - } - } - - export = minimist; -} diff --git a/src/typings/semver.d.ts b/src/typings/semver.d.ts deleted file mode 100644 index 129a83e21fa..00000000000 --- a/src/typings/semver.d.ts +++ /dev/null @@ -1,125 +0,0 @@ -// Type definitions for semver v2.2.1 -// Project: https://github.com/isaacs/node-semver -// Definitions by: Bart van der Schoor -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare module SemVerModule { - /** - * Return the parsed version, or null if it's not valid. - */ - function valid(v: string, loose?: boolean): string; - /** - * Return the version incremented by the release type (major, minor, patch, or prerelease), or null if it's not valid. - */ - function inc(v: string, release: string, loose?: boolean): string; - - // Comparison - /** - * v1 > v2 - */ - function gt(v1: string, v2: string, loose?: boolean): boolean; - /** - * v1 >= v2 - */ - function gte(v1: string, v2: string, loose?: boolean): boolean; - /** - * v1 < v2 - */ - function lt(v1: string, v2: string, loose?: boolean): boolean; - /** - * v1 <= v2 - */ - function lte(v1: string, v2: string, loose?: boolean): boolean; - /** - * v1 == v2 This is true if they're logically equivalent, even if they're not the exact same string. You already know how to compare strings. - */ - function eq(v1: string, v2: string, loose?: boolean): boolean; - /** - * v1 != v2 The opposite of eq. - */ - function neq(v1: string, v2: string, loose?: boolean): boolean; - /** - * Pass in a comparison string, and it'll call the corresponding semver comparison function. "===" and "!==" do simple string comparison, but are included for completeness. Throws if an invalid comparison string is provided. - */ - function cmp(v1: string, comparator: any, v2: string, loose?: boolean): boolean; - /** - * Return 0 if v1 == v2, or 1 if v1 is greater, or -1 if v2 is greater. Sorts in ascending order if passed to Array.sort(). - */ - function compare(v1: string, v2: string, loose?: boolean): number; - /** - * The reverse of compare. Sorts an array of versions in descending order when passed to Array.sort(). - */ - function rcompare(v1: string, v2: string, loose?: boolean): number; - - // Ranges - /** - * Return the valid range or null if it's not valid - */ - function validRange(range: string, loose?: boolean): string; - /** - * Return true if the version satisfies the range. - */ - function satisfies(version: string, range: string, loose?: boolean): boolean; - /** - * Return the highest version in the list that satisfies the range, or null if none of them do. - */ - function maxSatisfying(versions: string[], range: string, loose?: boolean): string; - /** - * Return true if version is greater than all the versions possible in the range. - */ - function gtr(version: string, range: string, loose?: boolean): boolean; - /** - * Return true if version is less than all the versions possible in the range. - */ - function ltr(version: string, range: string, loose?: boolean): boolean; - /** - * Return true if the version is outside the bounds of the range in either the high or low direction. The hilo argument must be either the string '>' or '<'. (This is the function called by gtr and ltr.) - */ - function outside(version: string, range: string, hilo: string, loose?: boolean): boolean; - - class SemVerBase { - raw: string; - loose: boolean; - format(): string; - inspect(): string; - toString(): string; - } - - class SemVer extends SemVerBase { - constructor(version: string, loose?: boolean); - - major: number; - minor: number; - patch: number; - version: string; - build: string[]; - prerelease: string[]; - - compare(other: SemVer): number; - compareMain(other: SemVer): number; - comparePre(other: SemVer): number; - inc(release: string): SemVer; - } - - class Comparator extends SemVerBase { - constructor(comp: string, loose?: boolean); - - semver: SemVer; - operator: string; - value: boolean; - parse(comp: string): void; - test(version: SemVer): boolean; - } - - class Range extends SemVerBase { - constructor(range: string, loose?: boolean); - - set: Comparator[][]; - parseRange(range: string): Comparator[]; - test(version: SemVer): boolean; - } -} - -declare module "semver" { - export = SemVerModule; -} diff --git a/src/typings/sinon.d.ts b/src/typings/sinon.d.ts deleted file mode 100644 index 0ca6c3840a0..00000000000 --- a/src/typings/sinon.d.ts +++ /dev/null @@ -1,448 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -// Type definitions for Sinon 1.16.0 -// Project: http://sinonjs.org/ -// Definitions by: William Sears -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare module '~sinon/lib/sinon' { - module Sinon { - export interface SinonSpyCallApi { - // Properties - thisValue: any; - args: any[]; - exception: any; - returnValue: any; - - // Methods - calledOn(obj: any): boolean; - calledWith(...args: any[]): boolean; - calledWithExactly(...args: any[]): boolean; - calledWithMatch(...args: any[]): boolean; - notCalledWith(...args: any[]): boolean; - notCalledWithMatch(...args: any[]): boolean; - returned(value: any): boolean; - threw(): boolean; - threw(type: string): boolean; - threw(obj: any): boolean; - callArg(pos: number): void; - callArgOn(pos: number, obj: any, ...args: any[]): void; - callArgWith(pos: number, ...args: any[]): void; - callArgOnWith(pos: number, obj: any, ...args: any[]): void; - yield(...args: any[]): void; - yieldOn(obj: any, ...args: any[]): void; - yieldTo(property: string, ...args: any[]): void; - yieldToOn(property: string, obj: any, ...args: any[]): void; - } - - export interface SinonSpyCall extends SinonSpyCallApi { - calledBefore(call: SinonSpyCall): boolean; - calledAfter(call: SinonSpyCall): boolean; - calledWithNew(call: SinonSpyCall): boolean; - } - - export interface SinonSpy extends SinonSpyCallApi { - // Properties - callCount: number; - called: boolean; - notCalled: boolean; - calledOnce: boolean; - calledTwice: boolean; - calledThrice: boolean; - firstCall: SinonSpyCall; - secondCall: SinonSpyCall; - thirdCall: SinonSpyCall; - lastCall: SinonSpyCall; - thisValues: any[]; - args: any[][]; - exceptions: any[]; - returnValues: any[]; - - // Methods - (...args: any[]): any; - calledBefore(anotherSpy: SinonSpy): boolean; - calledAfter(anotherSpy: SinonSpy): boolean; - calledWithNew(spy: SinonSpy): boolean; - withArgs(...args: any[]): SinonSpy; - alwaysCalledOn(obj: any): boolean; - alwaysCalledWith(...args: any[]): boolean; - alwaysCalledWithExactly(...args: any[]): boolean; - alwaysCalledWithMatch(...args: any[]): boolean; - neverCalledWith(...args: any[]): boolean; - neverCalledWithMatch(...args: any[]): boolean; - alwaysThrew(): boolean; - alwaysThrew(type: string): boolean; - alwaysThrew(obj: any): boolean; - alwaysReturned(): boolean; - invokeCallback(...args: any[]): void; - getCall(n: number): SinonSpyCall; - getCalls(): SinonSpyCall[]; - reset(): void; - printf(format: string, ...args: any[]): string; - restore(): void; - } - - export interface SinonSpyStatic { - (): SinonSpy; - (func: any): SinonSpy; - (obj: any, method: string): SinonSpy; - } - - export interface SinonStatic { - spy: SinonSpyStatic; - } - - export interface SinonStub extends SinonSpy { - resetBehavior(): void; - returns(obj: any): SinonStub; - returnsArg(index: number): SinonStub; - returnsThis(): SinonStub; - throws(type?: string): SinonStub; - throws(obj: any): SinonStub; - callsArg(index: number): SinonStub; - callsArgOn(index: number, context: any): SinonStub; - callsArgWith(index: number, ...args: any[]): SinonStub; - callsArgOnWith(index: number, context: any, ...args: any[]): SinonStub; - callsArgAsync(index: number): SinonStub; - callsArgOnAsync(index: number, context: any): SinonStub; - callsArgWithAsync(index: number, ...args: any[]): SinonStub; - callsArgOnWithAsync(index: number, context: any, ...args: any[]): SinonStub; - onCall(n: number): SinonStub; - onFirstCall(): SinonStub; - onSecondCall(): SinonStub; - onThirdCall(): SinonStub; - yields(...args: any[]): SinonStub; - yieldsOn(context: any, ...args: any[]): SinonStub; - yieldsTo(property: string, ...args: any[]): SinonStub; - yieldsToOn(property: string, context: any, ...args: any[]): SinonStub; - yieldsAsync(...args: any[]): SinonStub; - yieldsOnAsync(context: any, ...args: any[]): SinonStub; - yieldsToAsync(property: string, ...args: any[]): SinonStub; - yieldsToOnAsync(property: string, context: any, ...args: any[]): SinonStub; - withArgs(...args: any[]): SinonStub; - } - - export interface SinonStubStatic { - (): SinonStub; - (obj: any): SinonStub; - (obj: any, method: string): SinonStub; - (obj: any, method: string, func: any): SinonStub; - } - - export interface SinonStatic { - stub: SinonStubStatic; - } - - export interface SinonExpectation extends SinonStub { - atLeast(n: number): SinonExpectation; - atMost(n: number): SinonExpectation; - never(): SinonExpectation; - once(): SinonExpectation; - twice(): SinonExpectation; - thrice(): SinonExpectation; - exactly(n: number): SinonExpectation; - withArgs(...args: any[]): SinonExpectation; - withExactArgs(...args: any[]): SinonExpectation; - on(obj: any): SinonExpectation; - verify(): SinonExpectation; - restore(): void; - } - - export interface SinonExpectationStatic { - create(methodName?: string): SinonExpectation; - } - - export interface SinonMock { - expects(method: string): SinonExpectation; - restore(): void; - verify(): void; - } - - export interface SinonMockStatic { - (): SinonExpectation; - (obj: any): SinonMock; - } - - export interface SinonStatic { - expectation: SinonExpectationStatic; - mock: SinonMockStatic; - } - - export interface SinonFakeTimers { - now: number; - create(now: number): SinonFakeTimers; - setTimeout(callback: (...args: any[]) => void, timeout: number, ...args: any[]): number; - clearTimeout(id: number): void; - setInterval(callback: (...args: any[]) => void, timeout: number, ...args: any[]): number; - clearInterval(id: number): void; - tick(ms: number): number; - reset(): void; - Date(): Date; - Date(year: number): Date; - Date(year: number, month: number): Date; - Date(year: number, month: number, day: number): Date; - Date(year: number, month: number, day: number, hour: number): Date; - Date(year: number, month: number, day: number, hour: number, minute: number): Date; - Date(year: number, month: number, day: number, hour: number, minute: number, second: number): Date; - Date(year: number, month: number, day: number, hour: number, minute: number, second: number, ms: number): Date; - restore(): void; - - /** - * Simulate the user changing the system clock while your program is running. It changes the 'now' timestamp - * without affecting timers, intervals or immediates. - * @param now The new 'now' in unix milliseconds - */ - setSystemTime(now: number): void; - /** - * Simulate the user changing the system clock while your program is running. It changes the 'now' timestamp - * without affecting timers, intervals or immediates. - * @param now The new 'now' as a JavaScript Date - */ - setSystemTime(date: Date): void; - } - - export interface SinonFakeTimersStatic { - (): SinonFakeTimers; - (...timers: string[]): SinonFakeTimers; - (now: number, ...timers: string[]): SinonFakeTimers; - } - - export interface SinonStatic { - useFakeTimers: SinonFakeTimersStatic; - clock: SinonFakeTimers; - } - - export interface SinonFakeUploadProgress { - eventListeners: { - progress: any[]; - load: any[]; - abort: any[]; - error: any[]; - }; - - addEventListener(event: string, listener: (e: Event) => any): void; - removeEventListener(event: string, listener: (e: Event) => any): void; - dispatchEvent(event: Event): void; - } - - export interface SinonFakeXMLHttpRequest { - // Properties - onCreate: (xhr: SinonFakeXMLHttpRequest) => void; - url: string; - method: string; - requestHeaders: any; - requestBody: string; - status: number; - statusText: string; - async: boolean; - username: string; - password: string; - withCredentials: boolean; - upload: SinonFakeUploadProgress; - responseXML: Document; - getResponseHeader(header: string): string; - getAllResponseHeaders(): any; - - // Methods - restore(): void; - useFilters: boolean; - addFilter(filter: (method: string, url: string, async: boolean, username: string, password: string) => boolean): void; - setResponseHeaders(headers: any): void; - setResponseBody(body: string): void; - respond(status: number, headers: any, body: string): void; - autoRespond(ms: number): void; - } - - export interface SinonFakeXMLHttpRequestStatic { - (): SinonFakeXMLHttpRequest; - } - - export interface SinonStatic { - useFakeXMLHttpRequest: SinonFakeXMLHttpRequestStatic; - FakeXMLHttpRequest: SinonFakeXMLHttpRequest; - } - - export interface SinonFakeServer { - // Properties - autoRespond: boolean; - autoRespondAfter: number; - fakeHTTPMethods: boolean; - getHTTPMethod: (request: SinonFakeXMLHttpRequest) => string; - requests: SinonFakeXMLHttpRequest[]; - respondImmediately: boolean; - - // Methods - respondWith(body: string): void; - respondWith(response: any[]): void; - respondWith(fn: (xhr: SinonFakeXMLHttpRequest) => void): void; - respondWith(url: string, body: string): void; - respondWith(url: string, response: any[]): void; - respondWith(url: string, fn: (xhr: SinonFakeXMLHttpRequest) => void): void; - respondWith(method: string, url: string, body: string): void; - respondWith(method: string, url: string, response: any[]): void; - respondWith(method: string, url: string, fn: (xhr: SinonFakeXMLHttpRequest) => void): void; - respondWith(url: RegExp, body: string): void; - respondWith(url: RegExp, response: any[]): void; - respondWith(url: RegExp, fn: (xhr: SinonFakeXMLHttpRequest) => void): void; - respondWith(method: string, url: RegExp, body: string): void; - respondWith(method: string, url: RegExp, response: any[]): void; - respondWith(method: string, url: RegExp, fn: (xhr: SinonFakeXMLHttpRequest) => void): void; - respond(): void; - restore(): void; - } - - export interface SinonFakeServerStatic { - create(): SinonFakeServer; - } - - export interface SinonStatic { - fakeServer: SinonFakeServerStatic; - fakeServerWithClock: SinonFakeServerStatic; - } - - export interface SinonExposeOptions { - prefix?: string; - includeFail?: boolean; - } - - export interface SinonAssert { - // Properties - failException: string; - fail: (message?: string) => void; // Overridable - pass: (assertion: any) => void; // Overridable - - // Methods - notCalled(spy: SinonSpy): void; - called(spy: SinonSpy): void; - calledOnce(spy: SinonSpy): void; - calledTwice(spy: SinonSpy): void; - calledThrice(spy: SinonSpy): void; - callCount(spy: SinonSpy, count: number): void; - callOrder(...spies: SinonSpy[]): void; - calledOn(spy: SinonSpy, obj: any): void; - alwaysCalledOn(spy: SinonSpy, obj: any): void; - calledWith(spy: SinonSpy, ...args: any[]): void; - alwaysCalledWith(spy: SinonSpy, ...args: any[]): void; - neverCalledWith(spy: SinonSpy, ...args: any[]): void; - calledWithExactly(spy: SinonSpy, ...args: any[]): void; - alwaysCalledWithExactly(spy: SinonSpy, ...args: any[]): void; - calledWithMatch(spy: SinonSpy, ...args: any[]): void; - alwaysCalledWithMatch(spy: SinonSpy, ...args: any[]): void; - neverCalledWithMatch(spy: SinonSpy, ...args: any[]): void; - threw(spy: SinonSpy): void; - threw(spy: SinonSpy, exception: string): void; - threw(spy: SinonSpy, exception: any): void; - alwaysThrew(spy: SinonSpy): void; - alwaysThrew(spy: SinonSpy, exception: string): void; - alwaysThrew(spy: SinonSpy, exception: any): void; - expose(obj: any, options?: SinonExposeOptions): void; - } - - export interface SinonStatic { - assert: SinonAssert; - } - - export interface SinonMatcher { - and(expr: SinonMatcher): SinonMatcher; - or(expr: SinonMatcher): SinonMatcher; - } - - export interface SinonMatch { - (value: number): SinonMatcher; - (value: string): SinonMatcher; - (expr: RegExp): SinonMatcher; - (obj: any): SinonMatcher; - (callback: (value: any) => boolean): SinonMatcher; - any: SinonMatcher; - defined: SinonMatcher; - truthy: SinonMatcher; - falsy: SinonMatcher; - bool: SinonMatcher; - number: SinonMatcher; - string: SinonMatcher; - object: SinonMatcher; - func: SinonMatcher; - array: SinonMatcher; - regexp: SinonMatcher; - date: SinonMatcher; - same(obj: any): SinonMatcher; - typeOf(type: string): SinonMatcher; - instanceOf(type: any): SinonMatcher; - has(property: string, expect?: any): SinonMatcher; - hasOwn(property: string, expect?: any): SinonMatcher; - } - - export interface SinonStatic { - match: SinonMatch; - } - - export interface SinonSandboxConfig { - injectInto?: any; - properties?: string[]; - useFakeTimers?: any; - useFakeServer?: any; - } - - export interface SinonSandbox { - clock: SinonFakeTimers; - requests: SinonFakeXMLHttpRequest; - server: SinonFakeServer; - spy: SinonSpyStatic; - stub: SinonStubStatic; - mock: SinonMockStatic; - useFakeTimers: SinonFakeTimersStatic; - useFakeXMLHttpRequest: SinonFakeXMLHttpRequestStatic; - useFakeServer(): SinonFakeServer; - restore(): void; - } - - export interface SinonSandboxStatic { - create(): SinonSandbox; - create(config: SinonSandboxConfig): SinonSandbox; - } - - export interface SinonStatic { - sandbox: SinonSandboxStatic; - } - - export interface SinonTestConfig { - injectIntoThis?: boolean; - injectInto?: any; - properties?: string[]; - useFakeTimers?: boolean; - useFakeServer?: boolean; - } - - export interface SinonTestWrapper extends SinonSandbox { - (...args: any[]): any; - } - - export interface SinonStatic { - config: SinonTestConfig; - test(fn: (...args: any[]) => any): SinonTestWrapper; - testCase(tests: any): any; - } - - // Utility overridables - export interface SinonStatic { - createStubInstance(constructor: any): SinonStub; - format(obj: any): string; - log(message: string): void; - restore(object: any): void; - } - } - - var Sinon: Sinon.SinonStatic; - - export = Sinon; -} -declare module 'sinon/lib/sinon' { - import main = require('~sinon/lib/sinon'); - export = main; -} -declare module 'sinon' { - import main = require('~sinon/lib/sinon'); - export = main; -} \ No newline at end of file diff --git a/src/typings/winreg.d.ts b/src/typings/winreg.d.ts deleted file mode 100644 index 70047d8b50f..00000000000 --- a/src/typings/winreg.d.ts +++ /dev/null @@ -1,338 +0,0 @@ -// Type definitions for Winreg v1.2.0 -// Project: http://fresc81.github.io/node-winreg/ -// Definitions by: RX14 , BobBuehler -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare var Winreg: WinregStatic; - -interface WinregStatic { - /** - * Creates a registry object, which provides access to a single registry key. - * Note: This class is returned by a call to ```require('winreg')```. - * - * @public - * @class - * - * @param {@link Options} options - the options - * - * @example - * var Registry = require('winreg') - * , autoStartCurrentUser = new Registry({ - * hive: Registry.HKCU, - * key: '\\Software\\Microsoft\\Windows\\CurrentVersion\\Run' - * }); - */ - new (options: Winreg.Options): Winreg.Registry; - - /** - * Registry hive key HKEY_LOCAL_MACHINE. - * Note: For writing to this hive your program has to run with admin privileges. - */ - HKLM: string; - - /** - * Registry hive key HKEY_CURRENT_USER. - */ - HKCU: string; - - /** - * Registry hive key HKEY_CLASSES_ROOT. - * Note: For writing to this hive your program has to run with admin privileges. - */ - HKCR: string; - - /** - * Registry hive key HKEY_USERS. - * Note: For writing to this hive your program has to run with admin privileges. - */ - HKU: string; - - /** - * Registry hive key HKEY_CURRENT_CONFIG. - * Note: For writing to this hive your program has to run with admin privileges. - */ - HKCC: string; - - /** - * Collection of available registry hive keys. - */ - HIVES: Array; - - /** - * Registry value type STRING. - * - * Values of this type contain a string. - */ - REG_SZ: string; - - /** - * Registry value type MULTILINE_STRING. - * - * Values of this type contain a multiline string. - */ - REG_MULTI_SZ: string; - - /** - * Registry value type EXPANDABLE_STRING. - * - * Values of this type contain an expandable string. - */ - REG_EXPAND_SZ: string; - - /** - * Registry value type DOUBLE_WORD. - * - * Values of this type contain a double word (32 bit integer). - */ - REG_DWORD: string; - - /** - * Registry value type QUAD_WORD. - * - * Values of this type contain a quad word (64 bit integer). - */ - REG_QWORD: string; - - /** - * Registry value type BINARY. - * - * Values of this type contain a binary value. - */ - REG_BINARY: string; - - /** - * Registry value type UNKNOWN. - * - * Values of this type contain a value of an unknown type. - */ - REG_NONE: string; - - /** - * Collection of available registry value types. - */ - REG_TYPES: Array; - - /** - * The name of the default value. May be used instead of the empty string literal for better readability. - */ - DEFAULT_VALUE: string; -} - -declare namespace Winreg { - export interface Options { - /** - * Optional hostname, must start with '\\' sequence. - */ - host?: string; - - /** - * Optional hive ID, default is HKLM. - */ - hive?: string; - - /** - * Optional key, default is the root key. - */ - key?: string; - - /** - * Optional registry hive architecture ('x86' or 'x64'; only valid on Windows 64 Bit Operating Systems). - */ - arch?: string; - } - - /** - * A registry object, which provides access to a single registry key. - */ - export interface Registry { - /** - * The hostname. - * @readonly - */ - host: string; - - /** - * The hive id. - * @readonly - */ - hive: string; - - /** - * The registry key name. - * @readonly - */ - key: string; - - /** - * The full path to the registry key. - * @readonly - */ - path: string; - - /** - * The registry hive architecture ('x86' or 'x64'). - * @readonly - */ - arch: string; - - /** - * Creates a new {@link Registry} instance that points to the parent registry key. - * @readonly - */ - parent: Registry; - - /** - * Retrieve all values from this registry key. - * @param {valuesCallback} cb - callback function - * @param {error=} cb.err - error object or null if successful - * @param {array=} cb.items - an array of {@link RegistryItem} objects - * @returns {Registry} this registry key object - */ - values(cb: (err: Error, result: Array) => void): Registry; - - /** - * Retrieve all subkeys from this registry key. - * @param {function (err, items)} cb - callback function - * @param {error=} cb.err - error object or null if successful - * @param {array=} cb.items - an array of {@link Registry} objects - * @returns {Registry} this registry key object - */ - keys(cb: (err: Error, result: Array) => void): Registry; - - /** - * Gets a named value from this registry key. - * @param {string} name - the value name, use {@link Registry.DEFAULT_VALUE} or an empty string for the default value - * @param {function (err, item)} cb - callback function - * @param {error=} cb.err - error object or null if successful - * @param {RegistryItem=} cb.item - the retrieved registry item - * @returns {Registry} this registry key object - */ - get(name: string, cb: (err: Error, result: Winreg.RegistryItem) => void): Registry; - - /** - * Sets a named value in this registry key, overwriting an already existing value. - * @param {string} name - the value name, use {@link Registry.DEFAULT_VALUE} or an empty string for the default value - * @param {string} type - the value type - * @param {string} value - the value - * @param {function (err)} cb - callback function - * @param {error=} cb.err - error object or null if successful - * @returns {Registry} this registry key object - */ - set(name: string, type: string, value: string, cb: (err: Error) => void): Registry; - - /** - * Remove a named value from this registry key. If name is empty, sets the default value of this key. - * Note: This key must be already existing. - * @param {string} name - the value name, use {@link Registry.DEFAULT_VALUE} or an empty string for the default value - * @param {function (err)} cb - callback function - * @param {error=} cb.err - error object or null if successful - * @returns {Registry} this registry key object - */ - remove(name: string, cb: (err: Error) => void): Registry; - - /** - * Remove all subkeys and values (including the default value) from this registry key. - * @param {function (err)} cb - callback function - * @param {error=} cb.err - error object or null if successful - * @returns {Registry} this registry key object - */ - clear(cb: (err: Error) => void): Registry; - - /** - * Alias for the clear method to keep it backward compatible. - * @method - * @deprecated Use {@link Registry#clear} or {@link Registry#destroy} in favour of this method. - * @param {function (err)} cb - callback function - * @param {error=} cb.err - error object or null if successful - * @returns {Registry} this registry key object - */ - erase(cb: (err: Error) => void): Registry; - - /** - * Delete this key and all subkeys from the registry. - * @param {function (err)} cb - callback function - * @param {error=} cb.err - error object or null if successful - * @returns {Registry} this registry key object - */ - destroy(cb: (err: Error) => void): Registry; - - /** - * Create this registry key. Note that this is a no-op if the key already exists. - * @param {function (err)} cb - callback function - * @param {error=} cb.err - error object or null if successful - * @returns {Registry} this registry key object - */ - create(cb: (err: Error) => void): Registry; - - /** - * Checks if this key already exists. - * @param {function (err, exists)} cb - callback function - * @param {error=} cb.err - error object or null if successful - * @param {boolean=} cb.exists - true if a registry key with this name already exists - * @returns {Registry} this registry key object - */ - keyExists(cb: (err: Error, exists: boolean) => void): Registry; - - /** - * Checks if a value with the given name already exists within this key. - * @param {string} name - the value name, use {@link Registry.DEFAULT_VALUE} or an empty string for the default value - * @param {function (err, exists)} cb - callback function - * @param {error=} cb.err - error object or null if successful - * @param {boolean=} cb.exists - true if a value with the given name was found in this key - * @returns {Registry} this registry key object - */ - valueExists(name: string, cb: (err: Error, exists: boolean) => void): Registry; - } - - /** - * A single registry value record. - * Objects of this type are created internally and returned by methods of {@link Registry} objects. - */ - export interface RegistryItem { - /** - * The hostname. - * @readonly - */ - host: string; - - /** - * The hive id. - * @readonly - */ - hive: string; - - /** - * The registry key. - * @readonly - */ - key: string; - - /** - * The value name. - * @readonly - */ - name: string; - - /** - * The value type. - * @readonly - */ - type: string; - - /** - * The value. - * @readonly - */ - value: string; - - /** - * The hive architecture. - * @readonly - */ - arch: string; - } -} - -declare module "winreg" { - export = Winreg; -} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 3208c45e227..e36f11ecac2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -22,6 +22,21 @@ dependencies: commander "*" +"@types/events@*": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@types/events/-/events-1.2.0.tgz#81a6731ce4df43619e5c8c945383b3e62a89ea86" + integrity sha512-KEIlhXnIutzKwRbQkGWb/I4HFqBuUykAdHgDED6xqwXJfONCjF5VoE0cXEiurh3XauygxzeDzgtXUqvLkxFzzA== + +"@types/keytar@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@types/keytar/-/keytar-4.0.1.tgz#e2cf6405dc33861424e59b67516c66d2cf7bc21b" + integrity sha512-loKBID6UL4QjhD2scuvv6oAPlQ/WAY7aYTDyKlKo7fIgriLS8EZExqT567cHL5CY6si51MRoX1+r3mitD3eYrA== + +"@types/minimist@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.0.tgz#69a23a3ad29caf0097f06eda59b361ee2f0639f6" + integrity sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY= + "@types/mocha@2.2.39": version "2.2.39" resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.39.tgz#f68d63db8b69c38e9558b4073525cf96c4f7a829" @@ -32,11 +47,16 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-4.2.22.tgz#cf488a0f6b4a9c245d09927f4f757ca278b9c8ce" integrity sha512-LXRap3bb4AjtLZ5NOFc4ssVZrQPTgdPcNm++0SEJuJZaOA+xHkojJNYqy33A5q/94BmG5tA6yaMeD4VdCv5aSA== -"@types/semver@^5.4.0": +"@types/semver@^5.4.0", "@types/semver@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@types/semver/-/semver-5.5.0.tgz#146c2a29ee7d3bae4bf2fcb274636e264c813c45" integrity sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ== +"@types/sinon@^1.16.36": + version "1.16.36" + resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-1.16.36.tgz#74bb6ed7928597c1b3fb1b009005e94dc6eae357" + integrity sha1-dLtu15KFl8Gz+xsAkAXpTcbq41c= + "@types/tapable@*": version "1.0.4" resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.4.tgz#b4ffc7dc97b498c969b360a41eee247f82616370" @@ -59,6 +79,26 @@ "@types/uglify-js" "*" source-map "^0.6.0" +"@types/winreg@^1.2.30": + version "1.2.30" + resolved "https://registry.yarnpkg.com/@types/winreg/-/winreg-1.2.30.tgz#91d6710e536d345b9c9b017c574cf6a8da64c518" + integrity sha1-kdZxDlNtNFucmwF8V0z2qNpkxRg= + +"@types/yauzl@^2.9.0": + version "2.9.0" + resolved "https://registry.yarnpkg.com/@types/yauzl/-/yauzl-2.9.0.tgz#b8427df4659c77a9f5f1bf684a1f54a5159032f6" + integrity sha512-KVQbjKvieCq6d5LqZ8KIzzwygF88fWC+l7wvPbRPM3OI3f9ZAlhaKUlk3kjiyvOMqopSTM7enjduXXl5B+msXw== + dependencies: + "@types/events" "*" + "@types/node" "*" + +"@types/yazl@^2.4.0": + version "2.4.0" + resolved "https://registry.yarnpkg.com/@types/yazl/-/yazl-2.4.0.tgz#8460cecd6e1f00fc2252abe867cd6668d619d9fe" + integrity sha512-a71e3Equ/V/lXL3udQ4k9IBCQmPHx4fElSEO+Aao4L//RthbgqasLxeABgRvMVnEmqCGGIq0OLeWuImwFhWZJw== + dependencies: + "@types/node" "*" + "@webassemblyjs/ast@1.5.13": version "1.5.13" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.5.13.tgz#81155a570bd5803a30ec31436bc2c9c0ede38f25" -- GitLab