cosmiconfig
- Version 9.0.0
- Published
- 124 kB
- 4 dependencies
- MIT license
Install
npm i cosmiconfig
yarn add cosmiconfig
pnpm add cosmiconfig
Overview
Find and load configuration from a package.json property, rc file, TypeScript module, and more!
Index
Variables
Functions
Interfaces
Type Aliases
Variables
variable defaultLoaders
const defaultLoaders: Readonly<{ readonly '.mjs': import('./types').Loader; readonly '.cjs': import('./types').Loader; readonly '.js': import('./types').Loader; readonly '.ts': import('./types').Loader; readonly '.json': import('./types').LoaderSync; readonly '.yaml': import('./types').LoaderSync; readonly '.yml': import('./types').LoaderSync; readonly noExt: import('./types').LoaderSync;}>;
variable defaultLoadersSync
const defaultLoadersSync: Readonly<{ readonly '.cjs': import('./types').LoaderSync; readonly '.js': import('./types').LoaderSync; readonly '.ts': import('./types').LoaderSync; readonly '.json': import('./types').LoaderSync; readonly '.yaml': import('./types').LoaderSync; readonly '.yml': import('./types').LoaderSync; readonly noExt: import('./types').LoaderSync;}>;
variable globalConfigSearchPlaces
const globalConfigSearchPlaces: string[];
variable globalConfigSearchPlacesSync
const globalConfigSearchPlacesSync: string[];
Functions
function cosmiconfig
cosmiconfig: ( moduleName: string, options?: Readonly<Partial<Options>>) => PublicExplorer;
function cosmiconfigSync
cosmiconfigSync: ( moduleName: string, options?: Readonly<Partial<OptionsSync>>) => PublicExplorerSync;
function getDefaultSearchPlaces
getDefaultSearchPlaces: (moduleName: string) => Array<string>;
function getDefaultSearchPlacesSync
getDefaultSearchPlacesSync: (moduleName: string) => Array<string>;
Interfaces
interface CommonOptions
interface CommonOptions {}
Modifiers
@public
property cache
cache: boolean;
property ignoreEmptySearchPlaces
ignoreEmptySearchPlaces: boolean;
property mergeImportArrays
mergeImportArrays: boolean;
property mergeSearchPlaces
mergeSearchPlaces: boolean;
property packageProp
packageProp?: string | Array<string>;
property searchPlaces
searchPlaces: Array<string>;
property searchStrategy
searchStrategy: SearchStrategy;
property stopDir
stopDir?: string;
interface Loaders
interface Loaders {}
Modifiers
@public
index signature
[key: string]: Loader;
interface LoadersSync
interface LoadersSync {}
Modifiers
@public
index signature
[key: string]: LoaderSync;
interface Options
interface Options extends CommonOptions {}
Modifiers
@public
interface OptionsSync
interface OptionsSync extends CommonOptions {}
Modifiers
@public
interface PublicExplorer
interface PublicExplorer extends PublicExplorerBase {}
Modifiers
@public
interface PublicExplorerBase
interface PublicExplorerBase {}
Modifiers
@public
property clearCaches
clearCaches: () => void;
property clearLoadCache
clearLoadCache: () => void;
property clearSearchCache
clearSearchCache: () => void;
interface PublicExplorerSync
interface PublicExplorerSync extends PublicExplorerBase {}
Modifiers
@public
Type Aliases
type Config
type Config = any;
Modifiers
@public
type CosmiconfigResult
type CosmiconfigResult = { config: Config; filepath: string; isEmpty?: boolean;} | null;
Modifiers
@public
type Loader
type Loader = | ((filepath: string, content: string) => Promise<LoaderResult>) | LoaderSync;
Modifiers
@public
type LoaderResult
type LoaderResult = Config | null;
Modifiers
@public
type LoaderSync
type LoaderSync = (filepath: string, content: string) => LoaderResult;
Modifiers
@public
type SearchStrategy
type SearchStrategy = 'none' | 'project' | 'global';
Modifiers
@public
type Transform
type Transform = | ((CosmiconfigResult: CosmiconfigResult) => Promise<CosmiconfigResult>) | TransformSync;
Modifiers
@public
type TransformSync
type TransformSync = (CosmiconfigResult: CosmiconfigResult) => CosmiconfigResult;
Modifiers
@public
Package Files (3)
Dependencies (4)
Dev Dependencies (21)
- @types/js-yaml
- @types/node
- @types/parse-json
- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser
- @vitest/coverage-istanbul
- cross-env
- eslint
- eslint-config-davidtheclark-node
- eslint-config-prettier
- eslint-import-resolver-typescript
- eslint-plugin-import
- eslint-plugin-node
- eslint-plugin-vitest
- husky
- lint-staged
- parent-module
- prettier
- remark-preset-davidtheclark
- typescript
- vitest
Peer Dependencies (1)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/cosmiconfig
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/cosmiconfig)
- HTML<a href="https://www.jsdocs.io/package/cosmiconfig"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3799 ms. - Missing or incorrect documentation? Open an issue for this package.