From 82c83bac85c37cbf3ce42c5151e59bad0f008dfd Mon Sep 17 00:00:00 2001 From: Florian Keller Date: Tue, 12 Nov 2019 23:53:25 +0100 Subject: [PATCH] [cosmiconfig] Remove package (#40148) --- notNeededPackages.json | 6 +++ types/cosmiconfig/cosmiconfig-tests.ts | 35 ------------- types/cosmiconfig/index.d.ts | 64 ----------------------- types/cosmiconfig/tsconfig.json | 16 ------ types/cosmiconfig/tslint.json | 1 - types/cosmiconfig/v4/cosmiconfig-tests.ts | 41 --------------- types/cosmiconfig/v4/index.d.ts | 63 ---------------------- types/cosmiconfig/v4/tsconfig.json | 19 ------- types/cosmiconfig/v4/tslint.json | 1 - types/postcss-load-config/index.d.ts | 6 +-- types/postcss-load-config/package.json | 3 +- 11 files changed, 11 insertions(+), 244 deletions(-) delete mode 100644 types/cosmiconfig/cosmiconfig-tests.ts delete mode 100644 types/cosmiconfig/index.d.ts delete mode 100644 types/cosmiconfig/tsconfig.json delete mode 100644 types/cosmiconfig/tslint.json delete mode 100644 types/cosmiconfig/v4/cosmiconfig-tests.ts delete mode 100644 types/cosmiconfig/v4/index.d.ts delete mode 100644 types/cosmiconfig/v4/tsconfig.json delete mode 100644 types/cosmiconfig/v4/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 8946a2dc60..84171c5194 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -732,6 +732,12 @@ "sourceRepoURL": "https://github.com/jayphelps/core-decorators.js", "asOfVersion": "0.20.0" }, + { + "libraryName": "cosmiconfig", + "typingsPackageName": "cosmiconfig", + "sourceRepoURL": "https://github.com/davidtheclark/cosmiconfig", + "asOfVersion": "6.0.0" + }, { "libraryName": "countup.js", "typingsPackageName": "countup.js", diff --git a/types/cosmiconfig/cosmiconfig-tests.ts b/types/cosmiconfig/cosmiconfig-tests.ts deleted file mode 100644 index f25337f3d3..0000000000 --- a/types/cosmiconfig/cosmiconfig-tests.ts +++ /dev/null @@ -1,35 +0,0 @@ -import cosmiconfig = require("cosmiconfig"); -import { CosmiconfigResult } from "cosmiconfig"; -import * as path from "path"; - -const explorer = cosmiconfig("yourModuleName", { - searchPlaces: [], - loaders: {}, - packageProp: "yourModuleName", - stopDir: "someDir", - cache: true, - transform: (result: CosmiconfigResult) => result, - ignoreEmptySearchPlaces: false, -}); - -const explorer2 = cosmiconfig("yourModuleName"); - -Promise.all([ - explorer.search(), - explorer.search(path.join(__dirname)), - explorer.searchSync(), - explorer.searchSync(path.join(__dirname)), - explorer.load(path.join(__dirname, "sample-config.json")), - explorer.loadSync(path.join(__dirname, "sample-config.json")), -]).then(result => result); - -const result = explorer.searchSync(); -if (result) { - const config = result.config; - const filepath = result.filepath; - const isEmpty = result.isEmpty; -} - -explorer.clearLoadCache(); -explorer.clearSearchCache(); -explorer.clearCaches(); diff --git a/types/cosmiconfig/index.d.ts b/types/cosmiconfig/index.d.ts deleted file mode 100644 index 94e28e9dab..0000000000 --- a/types/cosmiconfig/index.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -// Type definitions for cosmiconfig 5.0 -// Project: https://github.com/davidtheclark/cosmiconfig -// Definitions by: ozum -// szeck87 -// saadq -// jinwoo -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - -/// - -declare function cosmiconfig(moduleName: string, options?: cosmiconfig.ExplorerOptions): cosmiconfig.Explorer; - -declare namespace cosmiconfig { - interface Config { - [key: string]: any; - } - - type CosmiconfigResult = { - config: Config; - filepath: string; - isEmpty?: boolean; - } | null; - - interface LoaderResult { - config: Config | null; - filepath: string; - } - - type SyncLoader = (filepath: string, content: string) => Config | null; - type AsyncLoader = (filepath: string, content: string) => Config | null | Promise; - - interface LoaderEntry { - sync?: SyncLoader; - async?: AsyncLoader; - } - - interface Loaders { - [key: string]: LoaderEntry; - } - - interface Explorer { - search(searchFrom?: string): Promise; - searchSync(searchFrom?: string): null | CosmiconfigResult; - load(loadPath: string): Promise; - loadSync(loadPath: string): CosmiconfigResult; - clearLoadCache(): void; - clearSearchCache(): void; - clearCaches(): void; - } - - // These are the user options with defaults applied. - interface ExplorerOptions { - stopDir?: string; - cache?: boolean; - transform?: (result: CosmiconfigResult) => Promise | CosmiconfigResult; - packageProp?: string; - loaders?: Loaders; - searchPlaces?: string[]; - ignoreEmptySearchPlaces?: boolean; - } -} - -export = cosmiconfig; diff --git a/types/cosmiconfig/tsconfig.json b/types/cosmiconfig/tsconfig.json deleted file mode 100644 index 6f0f0ac3a2..0000000000 --- a/types/cosmiconfig/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": ["es6"], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": ["../"], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": ["index.d.ts", "cosmiconfig-tests.ts"] -} diff --git a/types/cosmiconfig/tslint.json b/types/cosmiconfig/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/cosmiconfig/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/cosmiconfig/v4/cosmiconfig-tests.ts b/types/cosmiconfig/v4/cosmiconfig-tests.ts deleted file mode 100644 index 2676c58407..0000000000 --- a/types/cosmiconfig/v4/cosmiconfig-tests.ts +++ /dev/null @@ -1,41 +0,0 @@ -import cosmiconfig = require("cosmiconfig"); - -const asyncExplorer = cosmiconfig("yourModuleName", { - packageProp: "yourModuleName", - rc: ".yourModuleNamerc", - js: "yourModuleName.config.js", - rcStrictJson: false, - rcExtensions: false, - stopDir: "someDir", - cache: true, - sync: false, - transform: ({ config, filePath }) => ({ config, filePath }), - format: "js" -}); - -Promise.all([ - asyncExplorer.load(), - asyncExplorer.load("start/search/here"), - asyncExplorer.load(null, "load/this/file.json") -]).then(result => result); - -asyncExplorer.load().then(({ config, filePath }) => ({ config, filePath })); - -asyncExplorer.clearFileCache(); -asyncExplorer.clearDirectoryCache(); -asyncExplorer.clearCaches(); - -const syncExplorer = cosmiconfig("yourModuleName", { - packageProp: "yourModuleName", - rc: ".yourModuleNamerc", - js: "yourModuleName.config.js", - rcStrictJson: false, - rcExtensions: false, - stopDir: "someDir", - cache: true, - sync: true, - transform: ({ config, filePath }) => ({ config, filePath }), - format: "js" -}); - -const { config, filePath } = syncExplorer.load(); diff --git a/types/cosmiconfig/v4/index.d.ts b/types/cosmiconfig/v4/index.d.ts deleted file mode 100644 index 032f570d6f..0000000000 --- a/types/cosmiconfig/v4/index.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -// Type definitions for cosmiconfig 4.0 -// Project: https://github.com/davidtheclark/cosmiconfig -// Definitions by: ozum -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - -interface Result { - config: object; - filePath: string; -} - -interface Options { - packageProp?: string | false; - rc?: string | false; - js?: string | false; - rcStrictJson?: boolean; - rcExtensions?: boolean; - stopDir?: string; - cache?: boolean; - transform?: (result: Result) => Promise | Result; - configPath?: string; - format?: "json" | "yaml" | "js"; -} - -// Default is false and makes load() method async -interface AsyncOptions extends Options { - sync?: false; -} - -// Makes load() method sync -interface SyncOptions extends Options { - sync: true; -} - -interface Explorer { - clearFileCache(): void; - clearDirectoryCache(): void; - clearCaches(): void; -} - -interface AsyncExplorer extends Explorer { - // You should provide either searchPath or configPath for load method. To disallow both, overloaded definitions added. - load(searchPath?: string): Promise; - load(searchPath: null | undefined, configPath?: string): Promise; -} - -interface SyncExplorer extends Explorer { - // You should provide either searchPath or configPath for load method. To disallow both, overloaded definitions added. - load(searchPath?: string): Result; - load(searchPath: null | undefined, configPath?: string): Result; -} - -declare function cosmiconfig( - moduleName: string, - options: SyncOptions -): SyncExplorer; - -declare function cosmiconfig( - moduleName: string, - options?: AsyncOptions -): AsyncExplorer; - -export = cosmiconfig; diff --git a/types/cosmiconfig/v4/tsconfig.json b/types/cosmiconfig/v4/tsconfig.json deleted file mode 100644 index f0c8707c16..0000000000 --- a/types/cosmiconfig/v4/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": ["es6"], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": ["../../"], - "paths": { - "cosmiconfig": [ "cosmiconfig/v4" ] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": ["index.d.ts", "cosmiconfig-tests.ts"] -} diff --git a/types/cosmiconfig/v4/tslint.json b/types/cosmiconfig/v4/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/cosmiconfig/v4/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/postcss-load-config/index.d.ts b/types/postcss-load-config/index.d.ts index 4ece32da66..085635ecbc 100644 --- a/types/postcss-load-config/index.d.ts +++ b/types/postcss-load-config/index.d.ts @@ -5,7 +5,7 @@ // TypeScript Version: 2.8 import { Parser, Plugin, ProcessOptions, Processor, Stringifier, Syntax, Transformer } from "postcss"; -import cosmiconfig = require("cosmiconfig"); +import { Options as CosmiconfigOptions } from 'cosmiconfig'; // In the ConfigContext, these three options can be instances of the // appropriate class, or strings. If they are strings, postcss-load-config will @@ -38,10 +38,10 @@ interface Result { plugins: ResultPlugin[]; } -declare function postcssrc(ctx?: ConfigContext, path?: string, options?: cosmiconfig.ExplorerOptions): Promise; +declare function postcssrc(ctx?: ConfigContext, path?: string, options?: CosmiconfigOptions): Promise; declare namespace postcssrc { - function sync(ctx?: ConfigContext, path?: string, options?: cosmiconfig.ExplorerOptions): Result; + function sync(ctx?: ConfigContext, path?: string, options?: CosmiconfigOptions): Result; } export = postcssrc; diff --git a/types/postcss-load-config/package.json b/types/postcss-load-config/package.json index 57e9c40057..1a61d1cac5 100644 --- a/types/postcss-load-config/package.json +++ b/types/postcss-load-config/package.json @@ -1,6 +1,7 @@ { "private": true, "dependencies": { - "postcss": "^7.0.0" + "postcss": "^7.0.0", + "cosmiconfig": "^6.0.0" } }