[cosmiconfig] Remove package (#40148)

This commit is contained in:
Florian Keller
2019-11-12 23:53:25 +01:00
committed by Pranav Senthilnathan
parent e84391aa5f
commit 82c83bac85
11 changed files with 11 additions and 244 deletions

View File

@@ -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",

View File

@@ -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();

View File

@@ -1,64 +0,0 @@
// Type definitions for cosmiconfig 5.0
// Project: https://github.com/davidtheclark/cosmiconfig
// Definitions by: ozum <https://github.com/ozum>
// szeck87 <https://github.com/szeck87>
// saadq <https://github.com/saadq>
// jinwoo <https://github.com/jinwoo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="node" />
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<object | null>;
interface LoaderEntry {
sync?: SyncLoader;
async?: AsyncLoader;
}
interface Loaders {
[key: string]: LoaderEntry;
}
interface Explorer {
search(searchFrom?: string): Promise<null | CosmiconfigResult>;
searchSync(searchFrom?: string): null | CosmiconfigResult;
load(loadPath: string): Promise<CosmiconfigResult>;
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> | CosmiconfigResult;
packageProp?: string;
loaders?: Loaders;
searchPlaces?: string[];
ignoreEmptySearchPlaces?: boolean;
}
}
export = cosmiconfig;

View File

@@ -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"]
}

View File

@@ -1 +0,0 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -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();

View File

@@ -1,63 +0,0 @@
// Type definitions for cosmiconfig 4.0
// Project: https://github.com/davidtheclark/cosmiconfig
// Definitions by: ozum <https://github.com/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> | 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<Result>;
load(searchPath: null | undefined, configPath?: string): Promise<Result>;
}
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;

View File

@@ -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"]
}

View File

@@ -1 +0,0 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -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<Result>;
declare function postcssrc(ctx?: ConfigContext, path?: string, options?: CosmiconfigOptions): Promise<Result>;
declare namespace postcssrc {
function sync(ctx?: ConfigContext, path?: string, options?: cosmiconfig.ExplorerOptions): Result;
function sync(ctx?: ConfigContext, path?: string, options?: CosmiconfigOptions): Result;
}
export = postcssrc;

View File

@@ -1,6 +1,7 @@
{
"private": true,
"dependencies": {
"postcss": "^7.0.0"
"postcss": "^7.0.0",
"cosmiconfig": "^6.0.0"
}
}