fdsfd
This commit is contained in:
parent
628618df89
commit
e031240dff
3749 changed files with 1120848 additions and 1 deletions
22
node_modules/cosmiconfig/LICENSE
generated
vendored
Normal file
22
node_modules/cosmiconfig/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 David Clark
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
572
node_modules/cosmiconfig/README.md
generated
vendored
Normal file
572
node_modules/cosmiconfig/README.md
generated
vendored
Normal file
|
@ -0,0 +1,572 @@
|
|||
# cosmiconfig
|
||||
|
||||
[](https://travis-ci.org/davidtheclark/cosmiconfig) [](https://ci.appveyor.com/project/davidtheclark/cosmiconfig/branch/main)
|
||||
[](https://codecov.io/gh/davidtheclark/cosmiconfig)
|
||||
|
||||
Cosmiconfig searches for and loads configuration for your program.
|
||||
|
||||
It features smart defaults based on conventional expectations in the JavaScript ecosystem.
|
||||
But it's also flexible enough to search wherever you'd like to search, and load whatever you'd like to load.
|
||||
|
||||
By default, Cosmiconfig will start where you tell it to start and search up the directory tree for the following:
|
||||
|
||||
- a `package.json` property
|
||||
- a JSON or YAML, extensionless "rc file"
|
||||
- an "rc file" with the extensions `.json`, `.yaml`, `.yml`, `.js`, or `.cjs`
|
||||
- a `.config.js` or `.config.cjs` CommonJS module
|
||||
|
||||
For example, if your module's name is "myapp", cosmiconfig will search up the directory tree for configuration in the following places:
|
||||
|
||||
- a `myapp` property in `package.json`
|
||||
- a `.myapprc` file in JSON or YAML format
|
||||
- a `.myapprc.json`, `.myapprc.yaml`, `.myapprc.yml`, `.myapprc.js`, or `.myapprc.cjs` file
|
||||
- a `myapp.config.js` or `myapp.config.cjs` CommonJS module exporting an object
|
||||
|
||||
Cosmiconfig continues to search up the directory tree, checking each of these places in each directory, until it finds some acceptable configuration (or hits the home directory).
|
||||
|
||||
## Table of contents
|
||||
|
||||
- [Installation](#installation)
|
||||
- [Usage](#usage)
|
||||
- [Result](#result)
|
||||
- [Asynchronous API](#asynchronous-api)
|
||||
- [cosmiconfig()](#cosmiconfig-1)
|
||||
- [explorer.search()](#explorersearch)
|
||||
- [explorer.load()](#explorerload)
|
||||
- [explorer.clearLoadCache()](#explorerclearloadcache)
|
||||
- [explorer.clearSearchCache()](#explorerclearsearchcache)
|
||||
- [explorer.clearCaches()](#explorerclearcaches)
|
||||
- [Synchronous API](#synchronous-api)
|
||||
- [cosmiconfigSync()](#cosmiconfigsync)
|
||||
- [explorerSync.search()](#explorersyncsearch)
|
||||
- [explorerSync.load()](#explorersyncload)
|
||||
- [explorerSync.clearLoadCache()](#explorersyncclearloadcache)
|
||||
- [explorerSync.clearSearchCache()](#explorersyncclearsearchcache)
|
||||
- [explorerSync.clearCaches()](#explorersyncclearcaches)
|
||||
- [cosmiconfigOptions](#cosmiconfigoptions)
|
||||
- [searchPlaces](#searchplaces)
|
||||
- [loaders](#loaders)
|
||||
- [packageProp](#packageprop)
|
||||
- [stopDir](#stopdir)
|
||||
- [cache](#cache)
|
||||
- [transform](#transform)
|
||||
- [ignoreEmptySearchPlaces](#ignoreemptysearchplaces)
|
||||
- [Caching](#caching)
|
||||
- [Differences from rc](#differences-from-rc)
|
||||
- [Contributing & Development](#contributing--development)
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
npm install cosmiconfig
|
||||
```
|
||||
|
||||
Tested in Node 10+.
|
||||
|
||||
## Usage
|
||||
|
||||
Create a Cosmiconfig explorer, then either `search` for or directly `load` a configuration file.
|
||||
|
||||
```js
|
||||
const { cosmiconfig, cosmiconfigSync } = require('cosmiconfig');
|
||||
// ...
|
||||
const explorer = cosmiconfig(moduleName);
|
||||
|
||||
// Search for a configuration by walking up directories.
|
||||
// See documentation for search, below.
|
||||
explorer.search()
|
||||
.then((result) => {
|
||||
// result.config is the parsed configuration object.
|
||||
// result.filepath is the path to the config file that was found.
|
||||
// result.isEmpty is true if there was nothing to parse in the config file.
|
||||
})
|
||||
.catch((error) => {
|
||||
// Do something constructive.
|
||||
});
|
||||
|
||||
// Load a configuration directly when you know where it should be.
|
||||
// The result object is the same as for search.
|
||||
// See documentation for load, below.
|
||||
explorer.load(pathToConfig).then(..);
|
||||
|
||||
// You can also search and load synchronously.
|
||||
const explorerSync = cosmiconfigSync(moduleName);
|
||||
|
||||
const searchedFor = explorerSync.search();
|
||||
const loaded = explorerSync.load(pathToConfig);
|
||||
```
|
||||
|
||||
## Result
|
||||
|
||||
The result object you get from `search` or `load` has the following properties:
|
||||
|
||||
- **config:** The parsed configuration object. `undefined` if the file is empty.
|
||||
- **filepath:** The path to the configuration file that was found.
|
||||
- **isEmpty:** `true` if the configuration file is empty. This property will not be present if the configuration file is not empty.
|
||||
|
||||
## Asynchronous API
|
||||
|
||||
### cosmiconfig()
|
||||
|
||||
```js
|
||||
const { cosmiconfig } = require('cosmiconfig');
|
||||
const explorer = cosmiconfig(moduleName[, cosmiconfigOptions])
|
||||
```
|
||||
|
||||
Creates a cosmiconfig instance ("explorer") configured according to the arguments, and initializes its caches.
|
||||
|
||||
#### moduleName
|
||||
|
||||
Type: `string`. **Required.**
|
||||
|
||||
Your module name. This is used to create the default [`searchPlaces`] and [`packageProp`].
|
||||
|
||||
If your [`searchPlaces`] value will include files, as it does by default (e.g. `${moduleName}rc`), your `moduleName` must consist of characters allowed in filenames. That means you should not copy scoped package names, such as `@my-org/my-package`, directly into `moduleName`.
|
||||
|
||||
**[`cosmiconfigOptions`] are documented below.**
|
||||
You may not need them, and should first read about the functions you'll use.
|
||||
|
||||
### explorer.search()
|
||||
|
||||
```js
|
||||
explorer.search([searchFrom]).then(result => {..})
|
||||
```
|
||||
|
||||
Searches for a configuration file. Returns a Promise that resolves with a [result] or with `null`, if no configuration file is found.
|
||||
|
||||
You can do the same thing synchronously with [`explorerSync.search()`].
|
||||
|
||||
Let's say your module name is `goldengrahams` so you initialized with `const explorer = cosmiconfig('goldengrahams');`.
|
||||
Here's how your default [`search()`] will work:
|
||||
|
||||
- Starting from `process.cwd()` (or some other directory defined by the `searchFrom` argument to [`search()`]), look for configuration objects in the following places:
|
||||
1. A `goldengrahams` property in a `package.json` file.
|
||||
2. A `.goldengrahamsrc` file with JSON or YAML syntax.
|
||||
3. A `.goldengrahamsrc.json`, `.goldengrahamsrc.yaml`, `.goldengrahamsrc.yml`, `.goldengrahamsrc.js`, or `.goldengrahamsrc.cjs` file.
|
||||
4. A `goldengrahams.config.js` or `goldengrahams.config.cjs` CommonJS module exporting the object.
|
||||
- If none of those searches reveal a configuration object, move up one directory level and try again.
|
||||
So the search continues in `./`, `../`, `../../`, `../../../`, etc., checking the same places in each directory.
|
||||
- Continue searching until arriving at your home directory (or some other directory defined by the cosmiconfig option [`stopDir`]).
|
||||
- If at any point a parsable configuration is found, the [`search()`] Promise resolves with its [result] \(or, with [`explorerSync.search()`], the [result] is returned).
|
||||
- If no configuration object is found, the [`search()`] Promise resolves with `null` (or, with [`explorerSync.search()`], `null` is returned).
|
||||
- If a configuration object is found *but is malformed* (causing a parsing error), the [`search()`] Promise rejects with that error (so you should `.catch()` it). (Or, with [`explorerSync.search()`], the error is thrown.)
|
||||
|
||||
**If you know exactly where your configuration file should be, you can use [`load()`], instead.**
|
||||
|
||||
**The search process is highly customizable.**
|
||||
Use the cosmiconfig options [`searchPlaces`] and [`loaders`] to precisely define where you want to look for configurations and how you want to load them.
|
||||
|
||||
#### searchFrom
|
||||
|
||||
Type: `string`.
|
||||
Default: `process.cwd()`.
|
||||
|
||||
A filename.
|
||||
[`search()`] will start its search here.
|
||||
|
||||
If the value is a directory, that's where the search starts.
|
||||
If it's a file, the search starts in that file's directory.
|
||||
|
||||
### explorer.load()
|
||||
|
||||
```js
|
||||
explorer.load(loadPath).then(result => {..})
|
||||
```
|
||||
|
||||
Loads a configuration file. Returns a Promise that resolves with a [result] or rejects with an error (if the file does not exist or cannot be loaded).
|
||||
|
||||
Use `load` if you already know where the configuration file is and you just need to load it.
|
||||
|
||||
```js
|
||||
explorer.load('load/this/file.json'); // Tries to load load/this/file.json.
|
||||
```
|
||||
|
||||
If you load a `package.json` file, the result will be derived from whatever property is specified as your [`packageProp`].
|
||||
|
||||
You can do the same thing synchronously with [`explorerSync.load()`].
|
||||
|
||||
### explorer.clearLoadCache()
|
||||
|
||||
Clears the cache used in [`load()`].
|
||||
|
||||
### explorer.clearSearchCache()
|
||||
|
||||
Clears the cache used in [`search()`].
|
||||
|
||||
### explorer.clearCaches()
|
||||
|
||||
Performs both [`clearLoadCache()`] and [`clearSearchCache()`].
|
||||
|
||||
## Synchronous API
|
||||
|
||||
### cosmiconfigSync()
|
||||
|
||||
```js
|
||||
const { cosmiconfigSync } = require('cosmiconfig');
|
||||
const explorerSync = cosmiconfigSync(moduleName[, cosmiconfigOptions])
|
||||
```
|
||||
|
||||
Creates a *synchronous* cosmiconfig instance ("explorerSync") configured according to the arguments, and initializes its caches.
|
||||
|
||||
See [`cosmiconfig()`].
|
||||
|
||||
### explorerSync.search()
|
||||
|
||||
```js
|
||||
const result = explorerSync.search([searchFrom]);
|
||||
```
|
||||
|
||||
Synchronous version of [`explorer.search()`].
|
||||
|
||||
Returns a [result] or `null`.
|
||||
|
||||
### explorerSync.load()
|
||||
|
||||
```js
|
||||
const result = explorerSync.load(loadPath);
|
||||
```
|
||||
|
||||
Synchronous version of [`explorer.load()`].
|
||||
|
||||
Returns a [result].
|
||||
|
||||
### explorerSync.clearLoadCache()
|
||||
|
||||
Clears the cache used in [`load()`].
|
||||
|
||||
### explorerSync.clearSearchCache()
|
||||
|
||||
Clears the cache used in [`search()`].
|
||||
|
||||
### explorerSync.clearCaches()
|
||||
|
||||
Performs both [`clearLoadCache()`] and [`clearSearchCache()`].
|
||||
|
||||
## cosmiconfigOptions
|
||||
|
||||
Type: `Object`.
|
||||
|
||||
Possible options are documented below.
|
||||
|
||||
### searchPlaces
|
||||
|
||||
Type: `Array<string>`.
|
||||
Default: See below.
|
||||
|
||||
An array of places that [`search()`] will check in each directory as it moves up the directory tree.
|
||||
Each place is relative to the directory being searched, and the places are checked in the specified order.
|
||||
|
||||
**Default `searchPlaces`:**
|
||||
|
||||
```js
|
||||
[
|
||||
'package.json',
|
||||
`.${moduleName}rc`,
|
||||
`.${moduleName}rc.json`,
|
||||
`.${moduleName}rc.yaml`,
|
||||
`.${moduleName}rc.yml`,
|
||||
`.${moduleName}rc.js`,
|
||||
`.${moduleName}rc.cjs`,
|
||||
`${moduleName}.config.js`,
|
||||
`${moduleName}.config.cjs`,
|
||||
]
|
||||
```
|
||||
|
||||
Create your own array to search more, fewer, or altogether different places.
|
||||
|
||||
Every item in `searchPlaces` needs to have a loader in [`loaders`] that corresponds to its extension.
|
||||
(Common extensions are covered by default loaders.)
|
||||
Read more about [`loaders`] below.
|
||||
|
||||
`package.json` is a special value: When it is included in `searchPlaces`, Cosmiconfig will always parse it as JSON and load a property within it, not the whole file.
|
||||
That property is defined with the [`packageProp`] option, and defaults to your module name.
|
||||
|
||||
Examples, with a module named `porgy`:
|
||||
|
||||
```js
|
||||
// Disallow extensions on rc files:
|
||||
[
|
||||
'package.json',
|
||||
'.porgyrc',
|
||||
'porgy.config.js'
|
||||
]
|
||||
|
||||
// ESLint searches for configuration in these places:
|
||||
[
|
||||
'.eslintrc.js',
|
||||
'.eslintrc.yaml',
|
||||
'.eslintrc.yml',
|
||||
'.eslintrc.json',
|
||||
'.eslintrc',
|
||||
'package.json'
|
||||
]
|
||||
|
||||
// Babel looks in fewer places:
|
||||
[
|
||||
'package.json',
|
||||
'.babelrc'
|
||||
]
|
||||
|
||||
// Maybe you want to look for a wide variety of JS flavors:
|
||||
[
|
||||
'porgy.config.js',
|
||||
'porgy.config.mjs',
|
||||
'porgy.config.ts',
|
||||
'porgy.config.coffee'
|
||||
]
|
||||
// ^^ You will need to designate custom loaders to tell
|
||||
// Cosmiconfig how to handle these special JS flavors.
|
||||
|
||||
// Look within a .config/ subdirectory of every searched directory:
|
||||
[
|
||||
'package.json',
|
||||
'.porgyrc',
|
||||
'.config/.porgyrc',
|
||||
'.porgyrc.json',
|
||||
'.config/.porgyrc.json'
|
||||
]
|
||||
```
|
||||
|
||||
### loaders
|
||||
|
||||
Type: `Object`.
|
||||
Default: See below.
|
||||
|
||||
An object that maps extensions to the loader functions responsible for loading and parsing files with those extensions.
|
||||
|
||||
Cosmiconfig exposes its default loaders on a named export `defaultLoaders`.
|
||||
|
||||
**Default `loaders`:**
|
||||
|
||||
```js
|
||||
const { defaultLoaders } = require('cosmiconfig');
|
||||
|
||||
console.log(Object.entries(defaultLoaders))
|
||||
// [
|
||||
// [ '.cjs', [Function: loadJs] ],
|
||||
// [ '.js', [Function: loadJs] ],
|
||||
// [ '.json', [Function: loadJson] ],
|
||||
// [ '.yaml', [Function: loadYaml] ],
|
||||
// [ '.yml', [Function: loadYaml] ],
|
||||
// [ 'noExt', [Function: loadYaml] ]
|
||||
// ]
|
||||
```
|
||||
|
||||
(YAML is a superset of JSON; which means YAML parsers can parse JSON; which is how extensionless files can be either YAML *or* JSON with only one parser.)
|
||||
|
||||
**If you provide a `loaders` object, your object will be *merged* with the defaults.**
|
||||
So you can override one or two without having to override them all.
|
||||
|
||||
**Keys in `loaders`** are extensions (starting with a period), or `noExt` to specify the loader for files *without* extensions, like `.myapprc`.
|
||||
|
||||
**Values in `loaders`** are a loader function (described below) whose values are loader functions.
|
||||
|
||||
**The most common use case for custom loaders value is to load extensionless `rc` files as strict JSON**, instead of JSON *or* YAML (the default).
|
||||
To accomplish that, provide the following `loaders` value:
|
||||
|
||||
```js
|
||||
{
|
||||
noExt: defaultLoaders['.json']
|
||||
}
|
||||
```
|
||||
|
||||
If you want to load files that are not handled by the loader functions Cosmiconfig exposes, you can write a custom loader function or use one from NPM if it exists.
|
||||
|
||||
**Third-party loaders:**
|
||||
|
||||
- [@endemolshinegroup/cosmiconfig-typescript-loader](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader)
|
||||
|
||||
**Use cases for custom loader function:**
|
||||
|
||||
- Allow configuration syntaxes that aren't handled by Cosmiconfig's defaults, like JSON5, INI, or XML.
|
||||
- Allow ES2015 modules from `.mjs` configuration files.
|
||||
- Parse JS files with Babel before deriving the configuration.
|
||||
|
||||
**Custom loader functions** have the following signature:
|
||||
|
||||
```js
|
||||
// Sync
|
||||
(filepath: string, content: string) => Object | null
|
||||
|
||||
// Async
|
||||
(filepath: string, content: string) => Object | null | Promise<Object | null>
|
||||
```
|
||||
|
||||
Cosmiconfig reads the file when it checks whether the file exists, so it will provide you with both the file's path and its content.
|
||||
Do whatever you need to, and return either a configuration object or `null` (or, for async-only loaders, a Promise that resolves with one of those).
|
||||
`null` indicates that no real configuration was found and the search should continue.
|
||||
|
||||
A few things to note:
|
||||
|
||||
- If you use a custom loader, be aware of whether it's sync or async: you cannot use async customer loaders with the sync API ([`cosmiconfigSync()`]).
|
||||
- **Special JS syntax can also be handled by using a `require` hook**, because `defaultLoaders['.js']` just uses `require`.
|
||||
Whether you use custom loaders or a `require` hook is up to you.
|
||||
|
||||
Examples:
|
||||
|
||||
```js
|
||||
// Allow JSON5 syntax:
|
||||
{
|
||||
'.json': json5Loader
|
||||
}
|
||||
|
||||
// Allow a special configuration syntax of your own creation:
|
||||
{
|
||||
'.special': specialLoader
|
||||
}
|
||||
|
||||
// Allow many flavors of JS, using custom loaders:
|
||||
{
|
||||
'.mjs': esmLoader,
|
||||
'.ts': typeScriptLoader,
|
||||
'.coffee': coffeeScriptLoader
|
||||
}
|
||||
|
||||
// Allow many flavors of JS but rely on require hooks:
|
||||
{
|
||||
'.mjs': defaultLoaders['.js'],
|
||||
'.ts': defaultLoaders['.js'],
|
||||
'.coffee': defaultLoaders['.js']
|
||||
}
|
||||
```
|
||||
|
||||
### packageProp
|
||||
|
||||
Type: `string | Array<string>`.
|
||||
Default: `` `${moduleName}` ``.
|
||||
|
||||
Name of the property in `package.json` to look for.
|
||||
|
||||
Use a period-delimited string or an array of strings to describe a path to nested properties.
|
||||
|
||||
For example, the value `'configs.myPackage'` or `['configs', 'myPackage']` will get you the `"myPackage"` value in a `package.json` like this:
|
||||
|
||||
```json
|
||||
{
|
||||
"configs": {
|
||||
"myPackage": {..}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If nested property names within the path include periods, you need to use an array of strings. For example, the value `['configs', 'foo.bar', 'baz']` will get you the `"baz"` value in a `package.json` like this:
|
||||
|
||||
```json
|
||||
{
|
||||
"configs": {
|
||||
"foo.bar": {
|
||||
"baz": {..}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If a string includes period but corresponds to a top-level property name, it will not be interpreted as a period-delimited path. For example, the value `'one.two'` will get you the `"three"` value in a `package.json` like this:
|
||||
|
||||
```json
|
||||
{
|
||||
"one.two": "three",
|
||||
"one": {
|
||||
"two": "four"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### stopDir
|
||||
|
||||
Type: `string`.
|
||||
Default: Absolute path to your home directory.
|
||||
|
||||
Directory where the search will stop.
|
||||
|
||||
### cache
|
||||
|
||||
Type: `boolean`.
|
||||
Default: `true`.
|
||||
|
||||
If `false`, no caches will be used.
|
||||
Read more about ["Caching"](#caching) below.
|
||||
|
||||
### transform
|
||||
|
||||
Type: `(Result) => Promise<Result> | Result`.
|
||||
|
||||
A function that transforms the parsed configuration. Receives the [result].
|
||||
|
||||
If using [`search()`] or [`load()`] \(which are async), the transform function can return the transformed result or return a Promise that resolves with the transformed result.
|
||||
If using `cosmiconfigSync`, [`search()`] or [`load()`], the function must be synchronous and return the transformed result.
|
||||
|
||||
The reason you might use this option — instead of simply applying your transform function some other way — is that *the transformed result will be cached*. If your transformation involves additional filesystem I/O or other potentially slow processing, you can use this option to avoid repeating those steps every time a given configuration is searched or loaded.
|
||||
|
||||
### ignoreEmptySearchPlaces
|
||||
|
||||
Type: `boolean`.
|
||||
Default: `true`.
|
||||
|
||||
By default, if [`search()`] encounters an empty file (containing nothing but whitespace) in one of the [`searchPlaces`], it will ignore the empty file and move on.
|
||||
If you'd like to load empty configuration files, instead, set this option to `false`.
|
||||
|
||||
Why might you want to load empty configuration files?
|
||||
If you want to throw an error, or if an empty configuration file means something to your program.
|
||||
|
||||
## Caching
|
||||
|
||||
As of v2, cosmiconfig uses caching to reduce the need for repetitious reading of the filesystem or expensive transforms. Every new cosmiconfig instance (created with `cosmiconfig()`) has its own caches.
|
||||
|
||||
To avoid or work around caching, you can do the following:
|
||||
|
||||
- Set the `cosmiconfig` option [`cache`] to `false`.
|
||||
- Use the cache-clearing methods [`clearLoadCache()`], [`clearSearchCache()`], and [`clearCaches()`].
|
||||
- Create separate instances of cosmiconfig (separate "explorers").
|
||||
|
||||
## Differences from [rc](https://github.com/dominictarr/rc)
|
||||
|
||||
[rc](https://github.com/dominictarr/rc) serves its focused purpose well. cosmiconfig differs in a few key ways — making it more useful for some projects, less useful for others:
|
||||
|
||||
- Looks for configuration in some different places: in a `package.json` property, an rc file, a `.config.js` file, and rc files with extensions.
|
||||
- Built-in support for JSON, YAML, and CommonJS formats.
|
||||
- Stops at the first configuration found, instead of finding all that can be found up the directory tree and merging them automatically.
|
||||
- Options.
|
||||
- Asynchronous by default (though can be run synchronously).
|
||||
|
||||
## Contributing & Development
|
||||
|
||||
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
|
||||
|
||||
And please do participate!
|
||||
|
||||
[result]: #result
|
||||
|
||||
[`load()`]: #explorerload
|
||||
|
||||
[`search()`]: #explorersearch
|
||||
|
||||
[`clearloadcache()`]: #explorerclearloadcache
|
||||
|
||||
[`clearsearchcache()`]: #explorerclearsearchcache
|
||||
|
||||
[`cosmiconfig()`]: #cosmiconfig
|
||||
|
||||
[`cosmiconfigSync()`]: #cosmiconfigsync
|
||||
|
||||
[`clearcaches()`]: #explorerclearcaches
|
||||
|
||||
[`packageprop`]: #packageprop
|
||||
|
||||
[`cache`]: #cache
|
||||
|
||||
[`stopdir`]: #stopdir
|
||||
|
||||
[`searchplaces`]: #searchplaces
|
||||
|
||||
[`loaders`]: #loaders
|
||||
|
||||
[`cosmiconfigoptions`]: #cosmiconfigoptions
|
||||
|
||||
[`explorerSync.search()`]: #explorersyncsearch
|
||||
|
||||
[`explorerSync.load()`]: #explorersyncload
|
||||
|
||||
[`explorer.search()`]: #explorersearch
|
||||
|
||||
[`explorer.load()`]: #explorerload
|
14
node_modules/cosmiconfig/dist/Explorer.d.ts
generated
vendored
Normal file
14
node_modules/cosmiconfig/dist/Explorer.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { ExplorerBase } from './ExplorerBase';
|
||||
import { CosmiconfigResult, ExplorerOptions } from './types';
|
||||
declare class Explorer extends ExplorerBase<ExplorerOptions> {
|
||||
constructor(options: ExplorerOptions);
|
||||
search(searchFrom?: string): Promise<CosmiconfigResult>;
|
||||
private searchFromDirectory;
|
||||
private searchDirectory;
|
||||
private loadSearchPlace;
|
||||
private loadFileContent;
|
||||
private createCosmiconfigResult;
|
||||
load(filepath: string): Promise<CosmiconfigResult>;
|
||||
}
|
||||
export { Explorer };
|
||||
//# sourceMappingURL=Explorer.d.ts.map
|
1
node_modules/cosmiconfig/dist/Explorer.d.ts.map
generated
vendored
Normal file
1
node_modules/cosmiconfig/dist/Explorer.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"Explorer.d.ts","sourceRoot":"","sources":["../src/Explorer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAqB,MAAM,SAAS,CAAC;AAEhF,cAAM,QAAS,SAAQ,YAAY,CAAC,eAAe,CAAC;gBAC/B,OAAO,EAAE,eAAe;IAI9B,MAAM,CACjB,UAAU,GAAE,MAAsB,GACjC,OAAO,CAAC,iBAAiB,CAAC;YAOf,mBAAmB;YAuBnB,eAAe;YAaf,eAAe;YAYf,eAAe;YAef,uBAAuB;IAUxB,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAyBhE;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
118
node_modules/cosmiconfig/dist/Explorer.js
generated
vendored
Normal file
118
node_modules/cosmiconfig/dist/Explorer.js
generated
vendored
Normal file
|
@ -0,0 +1,118 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Explorer = void 0;
|
||||
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
|
||||
var _ExplorerBase = require("./ExplorerBase");
|
||||
|
||||
var _readFile = require("./readFile");
|
||||
|
||||
var _cacheWrapper = require("./cacheWrapper");
|
||||
|
||||
var _getDirectory = require("./getDirectory");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
class Explorer extends _ExplorerBase.ExplorerBase {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
}
|
||||
|
||||
async search(searchFrom = process.cwd()) {
|
||||
const startDirectory = await (0, _getDirectory.getDirectory)(searchFrom);
|
||||
const result = await this.searchFromDirectory(startDirectory);
|
||||
return result;
|
||||
}
|
||||
|
||||
async searchFromDirectory(dir) {
|
||||
const absoluteDir = _path.default.resolve(process.cwd(), dir);
|
||||
|
||||
const run = async () => {
|
||||
const result = await this.searchDirectory(absoluteDir);
|
||||
const nextDir = this.nextDirectoryToSearch(absoluteDir, result);
|
||||
|
||||
if (nextDir) {
|
||||
return this.searchFromDirectory(nextDir);
|
||||
}
|
||||
|
||||
const transformResult = await this.config.transform(result);
|
||||
return transformResult;
|
||||
};
|
||||
|
||||
if (this.searchCache) {
|
||||
return (0, _cacheWrapper.cacheWrapper)(this.searchCache, absoluteDir, run);
|
||||
}
|
||||
|
||||
return run();
|
||||
}
|
||||
|
||||
async searchDirectory(dir) {
|
||||
for await (const place of this.config.searchPlaces) {
|
||||
const placeResult = await this.loadSearchPlace(dir, place);
|
||||
|
||||
if (this.shouldSearchStopWithResult(placeResult) === true) {
|
||||
return placeResult;
|
||||
}
|
||||
} // config not found
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
async loadSearchPlace(dir, place) {
|
||||
const filepath = _path.default.join(dir, place);
|
||||
|
||||
const fileContents = await (0, _readFile.readFile)(filepath);
|
||||
const result = await this.createCosmiconfigResult(filepath, fileContents);
|
||||
return result;
|
||||
}
|
||||
|
||||
async loadFileContent(filepath, content) {
|
||||
if (content === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (content.trim() === '') {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const loader = this.getLoaderEntryForFile(filepath);
|
||||
const loaderResult = await loader(filepath, content);
|
||||
return loaderResult;
|
||||
}
|
||||
|
||||
async createCosmiconfigResult(filepath, content) {
|
||||
const fileContent = await this.loadFileContent(filepath, content);
|
||||
const result = this.loadedContentToCosmiconfigResult(filepath, fileContent);
|
||||
return result;
|
||||
}
|
||||
|
||||
async load(filepath) {
|
||||
this.validateFilePath(filepath);
|
||||
|
||||
const absoluteFilePath = _path.default.resolve(process.cwd(), filepath);
|
||||
|
||||
const runLoad = async () => {
|
||||
const fileContents = await (0, _readFile.readFile)(absoluteFilePath, {
|
||||
throwNotFound: true
|
||||
});
|
||||
const result = await this.createCosmiconfigResult(absoluteFilePath, fileContents);
|
||||
const transformResult = await this.config.transform(result);
|
||||
return transformResult;
|
||||
};
|
||||
|
||||
if (this.loadCache) {
|
||||
return (0, _cacheWrapper.cacheWrapper)(this.loadCache, absoluteFilePath, runLoad);
|
||||
}
|
||||
|
||||
return runLoad();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.Explorer = Explorer;
|
||||
//# sourceMappingURL=Explorer.js.map
|
1
node_modules/cosmiconfig/dist/Explorer.js.map
generated
vendored
Normal file
1
node_modules/cosmiconfig/dist/Explorer.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
21
node_modules/cosmiconfig/dist/ExplorerBase.d.ts
generated
vendored
Normal file
21
node_modules/cosmiconfig/dist/ExplorerBase.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
import { CosmiconfigResult, ExplorerOptions, ExplorerOptionsSync, Cache, LoadedFileContent } from './types';
|
||||
import { Loader } from './index';
|
||||
declare class ExplorerBase<T extends ExplorerOptions | ExplorerOptionsSync> {
|
||||
protected readonly loadCache?: Cache;
|
||||
protected readonly searchCache?: Cache;
|
||||
protected readonly config: T;
|
||||
constructor(options: T);
|
||||
clearLoadCache(): void;
|
||||
clearSearchCache(): void;
|
||||
clearCaches(): void;
|
||||
private validateConfig;
|
||||
protected shouldSearchStopWithResult(result: CosmiconfigResult): boolean;
|
||||
protected nextDirectoryToSearch(currentDir: string, currentResult: CosmiconfigResult): string | null;
|
||||
private loadPackageProp;
|
||||
protected getLoaderEntryForFile(filepath: string): Loader;
|
||||
protected loadedContentToCosmiconfigResult(filepath: string, loadedContent: LoadedFileContent): CosmiconfigResult;
|
||||
protected validateFilePath(filepath: string): void;
|
||||
}
|
||||
declare function getExtensionDescription(filepath: string): string;
|
||||
export { ExplorerBase, getExtensionDescription };
|
||||
//# sourceMappingURL=ExplorerBase.d.ts.map
|
1
node_modules/cosmiconfig/dist/ExplorerBase.d.ts.map
generated
vendored
Normal file
1
node_modules/cosmiconfig/dist/ExplorerBase.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"ExplorerBase.d.ts","sourceRoot":"","sources":["../src/ExplorerBase.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,KAAK,EACL,iBAAiB,EAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,cAAM,YAAY,CAAC,CAAC,SAAS,eAAe,GAAG,mBAAmB;IAChE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC;IACrC,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC;IACvC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;gBAEV,OAAO,EAAE,CAAC;IAUtB,cAAc,IAAI,IAAI;IAMtB,gBAAgB,IAAI,IAAI;IAMxB,WAAW,IAAI,IAAI;IAK1B,OAAO,CAAC,cAAc;IAwBtB,SAAS,CAAC,0BAA0B,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO;IAMxE,SAAS,CAAC,qBAAqB,CAC7B,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,iBAAiB,GAC/B,MAAM,GAAG,IAAI;IAWhB,OAAO,CAAC,eAAe;IASvB,SAAS,CAAC,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAmBzD,SAAS,CAAC,gCAAgC,CACxC,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,iBAAiB,GAC/B,iBAAiB;IAUpB,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;CAKnD;AAMD,iBAAS,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGzD;AAED,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,CAAC"}
|
142
node_modules/cosmiconfig/dist/ExplorerBase.js
generated
vendored
Normal file
142
node_modules/cosmiconfig/dist/ExplorerBase.js
generated
vendored
Normal file
|
@ -0,0 +1,142 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getExtensionDescription = getExtensionDescription;
|
||||
exports.ExplorerBase = void 0;
|
||||
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
|
||||
var _loaders = require("./loaders");
|
||||
|
||||
var _getPropertyByPath = require("./getPropertyByPath");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
class ExplorerBase {
|
||||
constructor(options) {
|
||||
if (options.cache === true) {
|
||||
this.loadCache = new Map();
|
||||
this.searchCache = new Map();
|
||||
}
|
||||
|
||||
this.config = options;
|
||||
this.validateConfig();
|
||||
}
|
||||
|
||||
clearLoadCache() {
|
||||
if (this.loadCache) {
|
||||
this.loadCache.clear();
|
||||
}
|
||||
}
|
||||
|
||||
clearSearchCache() {
|
||||
if (this.searchCache) {
|
||||
this.searchCache.clear();
|
||||
}
|
||||
}
|
||||
|
||||
clearCaches() {
|
||||
this.clearLoadCache();
|
||||
this.clearSearchCache();
|
||||
}
|
||||
|
||||
validateConfig() {
|
||||
const config = this.config;
|
||||
config.searchPlaces.forEach(place => {
|
||||
const loaderKey = _path.default.extname(place) || 'noExt';
|
||||
const loader = config.loaders[loaderKey];
|
||||
|
||||
if (!loader) {
|
||||
throw new Error(`No loader specified for ${getExtensionDescription(place)}, so searchPlaces item "${place}" is invalid`);
|
||||
}
|
||||
|
||||
if (typeof loader !== 'function') {
|
||||
throw new Error(`loader for ${getExtensionDescription(place)} is not a function (type provided: "${typeof loader}"), so searchPlaces item "${place}" is invalid`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
shouldSearchStopWithResult(result) {
|
||||
if (result === null) return false;
|
||||
if (result.isEmpty && this.config.ignoreEmptySearchPlaces) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
nextDirectoryToSearch(currentDir, currentResult) {
|
||||
if (this.shouldSearchStopWithResult(currentResult)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const nextDir = nextDirUp(currentDir);
|
||||
|
||||
if (nextDir === currentDir || currentDir === this.config.stopDir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return nextDir;
|
||||
}
|
||||
|
||||
loadPackageProp(filepath, content) {
|
||||
const parsedContent = _loaders.loaders.loadJson(filepath, content);
|
||||
|
||||
const packagePropValue = (0, _getPropertyByPath.getPropertyByPath)(parsedContent, this.config.packageProp);
|
||||
return packagePropValue || null;
|
||||
}
|
||||
|
||||
getLoaderEntryForFile(filepath) {
|
||||
if (_path.default.basename(filepath) === 'package.json') {
|
||||
const loader = this.loadPackageProp.bind(this);
|
||||
return loader;
|
||||
}
|
||||
|
||||
const loaderKey = _path.default.extname(filepath) || 'noExt';
|
||||
const loader = this.config.loaders[loaderKey];
|
||||
|
||||
if (!loader) {
|
||||
throw new Error(`No loader specified for ${getExtensionDescription(filepath)}`);
|
||||
}
|
||||
|
||||
return loader;
|
||||
}
|
||||
|
||||
loadedContentToCosmiconfigResult(filepath, loadedContent) {
|
||||
if (loadedContent === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (loadedContent === undefined) {
|
||||
return {
|
||||
filepath,
|
||||
config: undefined,
|
||||
isEmpty: true
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
config: loadedContent,
|
||||
filepath
|
||||
};
|
||||
}
|
||||
|
||||
validateFilePath(filepath) {
|
||||
if (!filepath) {
|
||||
throw new Error('load must pass a non-empty string');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.ExplorerBase = ExplorerBase;
|
||||
|
||||
function nextDirUp(dir) {
|
||||
return _path.default.dirname(dir);
|
||||
}
|
||||
|
||||
function getExtensionDescription(filepath) {
|
||||
const ext = _path.default.extname(filepath);
|
||||
|
||||
return ext ? `extension "${ext}"` : 'files without extensions';
|
||||
}
|
||||
//# sourceMappingURL=ExplorerBase.js.map
|
1
node_modules/cosmiconfig/dist/ExplorerBase.js.map
generated
vendored
Normal file
1
node_modules/cosmiconfig/dist/ExplorerBase.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
14
node_modules/cosmiconfig/dist/ExplorerSync.d.ts
generated
vendored
Normal file
14
node_modules/cosmiconfig/dist/ExplorerSync.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { ExplorerBase } from './ExplorerBase';
|
||||
import { CosmiconfigResult, ExplorerOptionsSync } from './types';
|
||||
declare class ExplorerSync extends ExplorerBase<ExplorerOptionsSync> {
|
||||
constructor(options: ExplorerOptionsSync);
|
||||
searchSync(searchFrom?: string): CosmiconfigResult;
|
||||
private searchFromDirectorySync;
|
||||
private searchDirectorySync;
|
||||
private loadSearchPlaceSync;
|
||||
private loadFileContentSync;
|
||||
private createCosmiconfigResultSync;
|
||||
loadSync(filepath: string): CosmiconfigResult;
|
||||
}
|
||||
export { ExplorerSync };
|
||||
//# sourceMappingURL=ExplorerSync.d.ts.map
|
1
node_modules/cosmiconfig/dist/ExplorerSync.d.ts.map
generated
vendored
Normal file
1
node_modules/cosmiconfig/dist/ExplorerSync.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"ExplorerSync.d.ts","sourceRoot":"","sources":["../src/ExplorerSync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EAEpB,MAAM,SAAS,CAAC;AAEjB,cAAM,YAAa,SAAQ,YAAY,CAAC,mBAAmB,CAAC;gBACvC,OAAO,EAAE,mBAAmB;IAIxC,UAAU,CAAC,UAAU,GAAE,MAAsB,GAAG,iBAAiB;IAOxE,OAAO,CAAC,uBAAuB;IAuB/B,OAAO,CAAC,mBAAmB;IAa3B,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,2BAA2B;IAU5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB;CAsBrD;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
118
node_modules/cosmiconfig/dist/ExplorerSync.js
generated
vendored
Normal file
118
node_modules/cosmiconfig/dist/ExplorerSync.js
generated
vendored
Normal file
|
@ -0,0 +1,118 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ExplorerSync = void 0;
|
||||
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
|
||||
var _ExplorerBase = require("./ExplorerBase");
|
||||
|
||||
var _readFile = require("./readFile");
|
||||
|
||||
var _cacheWrapper = require("./cacheWrapper");
|
||||
|
||||
var _getDirectory = require("./getDirectory");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
class ExplorerSync extends _ExplorerBase.ExplorerBase {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
}
|
||||
|
||||
searchSync(searchFrom = process.cwd()) {
|
||||
const startDirectory = (0, _getDirectory.getDirectorySync)(searchFrom);
|
||||
const result = this.searchFromDirectorySync(startDirectory);
|
||||
return result;
|
||||
}
|
||||
|
||||
searchFromDirectorySync(dir) {
|
||||
const absoluteDir = _path.default.resolve(process.cwd(), dir);
|
||||
|
||||
const run = () => {
|
||||
const result = this.searchDirectorySync(absoluteDir);
|
||||
const nextDir = this.nextDirectoryToSearch(absoluteDir, result);
|
||||
|
||||
if (nextDir) {
|
||||
return this.searchFromDirectorySync(nextDir);
|
||||
}
|
||||
|
||||
const transformResult = this.config.transform(result);
|
||||
return transformResult;
|
||||
};
|
||||
|
||||
if (this.searchCache) {
|
||||
return (0, _cacheWrapper.cacheWrapperSync)(this.searchCache, absoluteDir, run);
|
||||
}
|
||||
|
||||
return run();
|
||||
}
|
||||
|
||||
searchDirectorySync(dir) {
|
||||
for (const place of this.config.searchPlaces) {
|
||||
const placeResult = this.loadSearchPlaceSync(dir, place);
|
||||
|
||||
if (this.shouldSearchStopWithResult(placeResult) === true) {
|
||||
return placeResult;
|
||||
}
|
||||
} // config not found
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
loadSearchPlaceSync(dir, place) {
|
||||
const filepath = _path.default.join(dir, place);
|
||||
|
||||
const content = (0, _readFile.readFileSync)(filepath);
|
||||
const result = this.createCosmiconfigResultSync(filepath, content);
|
||||
return result;
|
||||
}
|
||||
|
||||
loadFileContentSync(filepath, content) {
|
||||
if (content === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (content.trim() === '') {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const loader = this.getLoaderEntryForFile(filepath);
|
||||
const loaderResult = loader(filepath, content);
|
||||
return loaderResult;
|
||||
}
|
||||
|
||||
createCosmiconfigResultSync(filepath, content) {
|
||||
const fileContent = this.loadFileContentSync(filepath, content);
|
||||
const result = this.loadedContentToCosmiconfigResult(filepath, fileContent);
|
||||
return result;
|
||||
}
|
||||
|
||||
loadSync(filepath) {
|
||||
this.validateFilePath(filepath);
|
||||
|
||||
const absoluteFilePath = _path.default.resolve(process.cwd(), filepath);
|
||||
|
||||
const runLoadSync = () => {
|
||||
const content = (0, _readFile.readFileSync)(absoluteFilePath, {
|
||||
throwNotFound: true
|
||||
});
|
||||
const cosmiconfigResult = this.createCosmiconfigResultSync(absoluteFilePath, content);
|
||||
const transformResult = this.config.transform(cosmiconfigResult);
|
||||
return transformResult;
|
||||
};
|
||||
|
||||
if (this.loadCache) {
|
||||
return (0, _cacheWrapper.cacheWrapperSync)(this.loadCache, absoluteFilePath, runLoadSync);
|
||||
}
|
||||
|
||||
return runLoadSync();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.ExplorerSync = ExplorerSync;
|
||||
//# sourceMappingURL=ExplorerSync.js.map
|
1
node_modules/cosmiconfig/dist/ExplorerSync.js.map
generated
vendored
Normal file
1
node_modules/cosmiconfig/dist/ExplorerSync.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
5
node_modules/cosmiconfig/dist/cacheWrapper.d.ts
generated
vendored
Normal file
5
node_modules/cosmiconfig/dist/cacheWrapper.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
import { Cache, CosmiconfigResult } from './types';
|
||||
declare function cacheWrapper(cache: Cache, key: string, fn: () => Promise<CosmiconfigResult>): Promise<CosmiconfigResult>;
|
||||
declare function cacheWrapperSync(cache: Cache, key: string, fn: () => CosmiconfigResult): CosmiconfigResult;
|
||||
export { cacheWrapper, cacheWrapperSync };
|
||||
//# sourceMappingURL=cacheWrapper.d.ts.map
|
1
node_modules/cosmiconfig/dist/cacheWrapper.d.ts.map
generated
vendored
Normal file
1
node_modules/cosmiconfig/dist/cacheWrapper.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"cacheWrapper.d.ts","sourceRoot":"","sources":["../src/cacheWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEnD,iBAAe,YAAY,CACzB,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,MAAM,EACX,EAAE,EAAE,MAAM,OAAO,CAAC,iBAAiB,CAAC,GACnC,OAAO,CAAC,iBAAiB,CAAC,CAS5B;AAED,iBAAS,gBAAgB,CACvB,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,MAAM,EACX,EAAE,EAAE,MAAM,iBAAiB,GAC1B,iBAAiB,CASnB;AAED,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
|
32
node_modules/cosmiconfig/dist/cacheWrapper.js
generated
vendored
Normal file
32
node_modules/cosmiconfig/dist/cacheWrapper.js
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.cacheWrapper = cacheWrapper;
|
||||
exports.cacheWrapperSync = cacheWrapperSync;
|
||||
|
||||
async function cacheWrapper(cache, key, fn) {
|
||||
const cached = cache.get(key);
|
||||
|
||||
if (cached !== undefined) {
|
||||
return cached;
|
||||
}
|
||||
|
||||
const result = await fn();
|
||||
cache.set(key, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
function cacheWrapperSync(cache, key, fn) {
|
||||
const cached = cache.get(key);
|
||||
|
||||
if (cached !== undefined) {
|
||||
return cached;
|
||||
}
|
||||
|
||||
const result = fn();
|
||||
cache.set(key, result);
|
||||
return result;
|
||||
}
|
||||
//# sourceMappingURL=cacheWrapper.js.map
|
1
node_modules/cosmiconfig/dist/cacheWrapper.js.map
generated
vendored
Normal file
1
node_modules/cosmiconfig/dist/cacheWrapper.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../src/cacheWrapper.ts"],"names":["cacheWrapper","cache","key","fn","cached","get","undefined","result","set","cacheWrapperSync"],"mappings":";;;;;;;;AAEA,eAAeA,YAAf,CACEC,KADF,EAEEC,GAFF,EAGEC,EAHF,EAI8B;AAC5B,QAAMC,MAAM,GAAGH,KAAK,CAACI,GAAN,CAAUH,GAAV,CAAf;;AACA,MAAIE,MAAM,KAAKE,SAAf,EAA0B;AACxB,WAAOF,MAAP;AACD;;AAED,QAAMG,MAAM,GAAG,MAAMJ,EAAE,EAAvB;AACAF,EAAAA,KAAK,CAACO,GAAN,CAAUN,GAAV,EAAeK,MAAf;AACA,SAAOA,MAAP;AACD;;AAED,SAASE,gBAAT,CACER,KADF,EAEEC,GAFF,EAGEC,EAHF,EAIqB;AACnB,QAAMC,MAAM,GAAGH,KAAK,CAACI,GAAN,CAAUH,GAAV,CAAf;;AACA,MAAIE,MAAM,KAAKE,SAAf,EAA0B;AACxB,WAAOF,MAAP;AACD;;AAED,QAAMG,MAAM,GAAGJ,EAAE,EAAjB;AACAF,EAAAA,KAAK,CAACO,GAAN,CAAUN,GAAV,EAAeK,MAAf;AACA,SAAOA,MAAP;AACD","sourcesContent":["import { Cache, CosmiconfigResult } from './types';\n\nasync function cacheWrapper(\n cache: Cache,\n key: string,\n fn: () => Promise<CosmiconfigResult>,\n): Promise<CosmiconfigResult> {\n const cached = cache.get(key);\n if (cached !== undefined) {\n return cached;\n }\n\n const result = await fn();\n cache.set(key, result);\n return result;\n}\n\nfunction cacheWrapperSync(\n cache: Cache,\n key: string,\n fn: () => CosmiconfigResult,\n): CosmiconfigResult {\n const cached = cache.get(key);\n if (cached !== undefined) {\n return cached;\n }\n\n const result = fn();\n cache.set(key, result);\n return result;\n}\n\nexport { cacheWrapper, cacheWrapperSync };\n"],"file":"cacheWrapper.js"}
|
4
node_modules/cosmiconfig/dist/getDirectory.d.ts
generated
vendored
Normal file
4
node_modules/cosmiconfig/dist/getDirectory.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
declare function getDirectory(filepath: string): Promise<string>;
|
||||
declare function getDirectorySync(filepath: string): string;
|
||||
export { getDirectory, getDirectorySync };
|
||||
//# sourceMappingURL=getDirectory.d.ts.map
|
1
node_modules/cosmiconfig/dist/getDirectory.d.ts.map
generated
vendored
Normal file
1
node_modules/cosmiconfig/dist/getDirectory.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"getDirectory.d.ts","sourceRoot":"","sources":["../src/getDirectory.ts"],"names":[],"mappings":"AAGA,iBAAe,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAU7D;AAED,iBAAS,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAUlD;AAED,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
|
38
node_modules/cosmiconfig/dist/getDirectory.js
generated
vendored
Normal file
38
node_modules/cosmiconfig/dist/getDirectory.js
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getDirectory = getDirectory;
|
||||
exports.getDirectorySync = getDirectorySync;
|
||||
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
|
||||
var _pathType = require("path-type");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
async function getDirectory(filepath) {
|
||||
const filePathIsDirectory = await (0, _pathType.isDirectory)(filepath);
|
||||
|
||||
if (filePathIsDirectory === true) {
|
||||
return filepath;
|
||||
}
|
||||
|
||||
const directory = _path.default.dirname(filepath);
|
||||
|
||||
return directory;
|
||||
}
|
||||
|
||||
function getDirectorySync(filepath) {
|
||||
const filePathIsDirectory = (0, _pathType.isDirectorySync)(filepath);
|
||||
|
||||
if (filePathIsDirectory === true) {
|
||||
return filepath;
|
||||
}
|
||||
|
||||
const directory = _path.default.dirname(filepath);
|
||||
|
||||
return directory;
|
||||
}
|
||||
//# sourceMappingURL=getDirectory.js.map
|
1
node_modules/cosmiconfig/dist/getDirectory.js.map
generated
vendored
Normal file
1
node_modules/cosmiconfig/dist/getDirectory.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../src/getDirectory.ts"],"names":["getDirectory","filepath","filePathIsDirectory","directory","path","dirname","getDirectorySync"],"mappings":";;;;;;;;AAAA;;AACA;;;;AAEA,eAAeA,YAAf,CAA4BC,QAA5B,EAA+D;AAC7D,QAAMC,mBAAmB,GAAG,MAAM,2BAAYD,QAAZ,CAAlC;;AAEA,MAAIC,mBAAmB,KAAK,IAA5B,EAAkC;AAChC,WAAOD,QAAP;AACD;;AAED,QAAME,SAAS,GAAGC,cAAKC,OAAL,CAAaJ,QAAb,CAAlB;;AAEA,SAAOE,SAAP;AACD;;AAED,SAASG,gBAAT,CAA0BL,QAA1B,EAAoD;AAClD,QAAMC,mBAAmB,GAAG,+BAAgBD,QAAhB,CAA5B;;AAEA,MAAIC,mBAAmB,KAAK,IAA5B,EAAkC;AAChC,WAAOD,QAAP;AACD;;AAED,QAAME,SAAS,GAAGC,cAAKC,OAAL,CAAaJ,QAAb,CAAlB;;AAEA,SAAOE,SAAP;AACD","sourcesContent":["import path from 'path';\nimport { isDirectory, isDirectorySync } from 'path-type';\n\nasync function getDirectory(filepath: string): Promise<string> {\n const filePathIsDirectory = await isDirectory(filepath);\n\n if (filePathIsDirectory === true) {\n return filepath;\n }\n\n const directory = path.dirname(filepath);\n\n return directory;\n}\n\nfunction getDirectorySync(filepath: string): string {\n const filePathIsDirectory = isDirectorySync(filepath);\n\n if (filePathIsDirectory === true) {\n return filepath;\n }\n\n const directory = path.dirname(filepath);\n\n return directory;\n}\n\nexport { getDirectory, getDirectorySync };\n"],"file":"getDirectory.js"}
|
5
node_modules/cosmiconfig/dist/getPropertyByPath.d.ts
generated
vendored
Normal file
5
node_modules/cosmiconfig/dist/getPropertyByPath.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
declare function getPropertyByPath(source: {
|
||||
[key: string]: unknown;
|
||||
}, path: string | Array<string>): unknown;
|
||||
export { getPropertyByPath };
|
||||
//# sourceMappingURL=getPropertyByPath.d.ts.map
|
1
node_modules/cosmiconfig/dist/getPropertyByPath.d.ts.map
generated
vendored
Normal file
1
node_modules/cosmiconfig/dist/getPropertyByPath.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"getPropertyByPath.d.ts","sourceRoot":"","sources":["../src/getPropertyByPath.ts"],"names":[],"mappings":"AAKA,iBAAS,iBAAiB,CACxB,MAAM,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,EAClC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAC3B,OAAO,CAgBT;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
28
node_modules/cosmiconfig/dist/getPropertyByPath.js
generated
vendored
Normal file
28
node_modules/cosmiconfig/dist/getPropertyByPath.js
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getPropertyByPath = getPropertyByPath;
|
||||
|
||||
// Resolves property names or property paths defined with period-delimited
|
||||
// strings or arrays of strings. Property names that are found on the source
|
||||
// object are used directly (even if they include a period).
|
||||
// Nested property names that include periods, within a path, are only
|
||||
// understood in array paths.
|
||||
function getPropertyByPath(source, path) {
|
||||
if (typeof path === 'string' && Object.prototype.hasOwnProperty.call(source, path)) {
|
||||
return source[path];
|
||||
}
|
||||
|
||||
const parsedPath = typeof path === 'string' ? path.split('.') : path; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
|
||||
return parsedPath.reduce((previous, key) => {
|
||||
if (previous === undefined) {
|
||||
return previous;
|
||||
}
|
||||
|
||||
return previous[key];
|
||||
}, source);
|
||||
}
|
||||
//# sourceMappingURL=getPropertyByPath.js.map
|
1
node_modules/cosmiconfig/dist/getPropertyByPath.js.map
generated
vendored
Normal file
1
node_modules/cosmiconfig/dist/getPropertyByPath.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../src/getPropertyByPath.ts"],"names":["getPropertyByPath","source","path","Object","prototype","hasOwnProperty","call","parsedPath","split","reduce","previous","key","undefined"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA,SAASA,iBAAT,CACEC,MADF,EAEEC,IAFF,EAGW;AACT,MACE,OAAOA,IAAP,KAAgB,QAAhB,IACAC,MAAM,CAACC,SAAP,CAAiBC,cAAjB,CAAgCC,IAAhC,CAAqCL,MAArC,EAA6CC,IAA7C,CAFF,EAGE;AACA,WAAOD,MAAM,CAACC,IAAD,CAAb;AACD;;AAED,QAAMK,UAAU,GAAG,OAAOL,IAAP,KAAgB,QAAhB,GAA2BA,IAAI,CAACM,KAAL,CAAW,GAAX,CAA3B,GAA6CN,IAAhE,CARS,CAST;;AACA,SAAOK,UAAU,CAACE,MAAX,CAAkB,CAACC,QAAD,EAAgBC,GAAhB,KAAiC;AACxD,QAAID,QAAQ,KAAKE,SAAjB,EAA4B;AAC1B,aAAOF,QAAP;AACD;;AACD,WAAOA,QAAQ,CAACC,GAAD,CAAf;AACD,GALM,EAKJV,MALI,CAAP;AAMD","sourcesContent":["// Resolves property names or property paths defined with period-delimited\n// strings or arrays of strings. Property names that are found on the source\n// object are used directly (even if they include a period).\n// Nested property names that include periods, within a path, are only\n// understood in array paths.\nfunction getPropertyByPath(\n source: { [key: string]: unknown },\n path: string | Array<string>,\n): unknown {\n if (\n typeof path === 'string' &&\n Object.prototype.hasOwnProperty.call(source, path)\n ) {\n return source[path];\n }\n\n const parsedPath = typeof path === 'string' ? path.split('.') : path;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return parsedPath.reduce((previous: any, key): unknown => {\n if (previous === undefined) {\n return previous;\n }\n return previous[key];\n }, source);\n}\n\nexport { getPropertyByPath };\n"],"file":"getPropertyByPath.js"}
|
45
node_modules/cosmiconfig/dist/index.d.ts
generated
vendored
Normal file
45
node_modules/cosmiconfig/dist/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
import { Config, CosmiconfigResult, Loaders, LoadersSync } from './types';
|
||||
declare type LoaderResult = Config | null;
|
||||
export declare type Loader = ((filepath: string, content: string) => Promise<LoaderResult>) | LoaderSync;
|
||||
export declare type LoaderSync = (filepath: string, content: string) => LoaderResult;
|
||||
export declare type Transform = ((CosmiconfigResult: CosmiconfigResult) => Promise<CosmiconfigResult>) | TransformSync;
|
||||
export declare type TransformSync = (CosmiconfigResult: CosmiconfigResult) => CosmiconfigResult;
|
||||
interface OptionsBase {
|
||||
packageProp?: string | Array<string>;
|
||||
searchPlaces?: Array<string>;
|
||||
ignoreEmptySearchPlaces?: boolean;
|
||||
stopDir?: string;
|
||||
cache?: boolean;
|
||||
}
|
||||
export interface Options extends OptionsBase {
|
||||
loaders?: Loaders;
|
||||
transform?: Transform;
|
||||
}
|
||||
export interface OptionsSync extends OptionsBase {
|
||||
loaders?: LoadersSync;
|
||||
transform?: TransformSync;
|
||||
}
|
||||
declare function cosmiconfig(moduleName: string, options?: Options): {
|
||||
readonly search: (searchFrom?: string) => Promise<CosmiconfigResult>;
|
||||
readonly load: (filepath: string) => Promise<CosmiconfigResult>;
|
||||
readonly clearLoadCache: () => void;
|
||||
readonly clearSearchCache: () => void;
|
||||
readonly clearCaches: () => void;
|
||||
};
|
||||
declare function cosmiconfigSync(moduleName: string, options?: OptionsSync): {
|
||||
readonly search: (searchFrom?: string) => CosmiconfigResult;
|
||||
readonly load: (filepath: string) => CosmiconfigResult;
|
||||
readonly clearLoadCache: () => void;
|
||||
readonly clearSearchCache: () => void;
|
||||
readonly clearCaches: () => void;
|
||||
};
|
||||
declare const defaultLoaders: Readonly<{
|
||||
readonly '.cjs': LoaderSync;
|
||||
readonly '.js': LoaderSync;
|
||||
readonly '.json': LoaderSync;
|
||||
readonly '.yaml': LoaderSync;
|
||||
readonly '.yml': LoaderSync;
|
||||
readonly noExt: LoaderSync;
|
||||
}>;
|
||||
export { cosmiconfig, cosmiconfigSync, defaultLoaders };
|
||||
//# sourceMappingURL=index.d.ts.map
|
1
node_modules/cosmiconfig/dist/index.d.ts.map
generated
vendored
Normal file
1
node_modules/cosmiconfig/dist/index.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,MAAM,EACN,iBAAiB,EAGjB,OAAO,EACP,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB,aAAK,YAAY,GAAG,MAAM,GAAG,IAAI,CAAC;AAClC,oBAAY,MAAM,GACd,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC,GAC9D,UAAU,CAAC;AACf,oBAAY,UAAU,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,YAAY,CAAC;AAE7E,oBAAY,SAAS,GACjB,CAAC,CAAC,iBAAiB,EAAE,iBAAiB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC,GACtE,aAAa,CAAC;AAElB,oBAAY,aAAa,GAAG,CAC1B,iBAAiB,EAAE,iBAAiB,KACjC,iBAAiB,CAAC;AAEvB,UAAU,WAAW;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IACrC,YAAY,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,OAAQ,SAAQ,WAAW;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED,MAAM,WAAW,WAAY,SAAQ,WAAW;IAC9C,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,SAAS,CAAC,EAAE,aAAa,CAAC;CAC3B;AAGD,iBAAS,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE,OAAY;;;;;;EAe7D;AAGD,iBAAS,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB;;;;;;EAerE;AAGD,QAAA,MAAM,cAAc;;;;;;;EAOT,CAAC;AAkDZ,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC"}
|
82
node_modules/cosmiconfig/dist/index.js
generated
vendored
Normal file
82
node_modules/cosmiconfig/dist/index.js
generated
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.cosmiconfig = cosmiconfig;
|
||||
exports.cosmiconfigSync = cosmiconfigSync;
|
||||
exports.defaultLoaders = void 0;
|
||||
|
||||
var _os = _interopRequireDefault(require("os"));
|
||||
|
||||
var _Explorer = require("./Explorer");
|
||||
|
||||
var _ExplorerSync = require("./ExplorerSync");
|
||||
|
||||
var _loaders = require("./loaders");
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
||||
function cosmiconfig(moduleName, options = {}) {
|
||||
const normalizedOptions = normalizeOptions(moduleName, options);
|
||||
const explorer = new _Explorer.Explorer(normalizedOptions);
|
||||
return {
|
||||
search: explorer.search.bind(explorer),
|
||||
load: explorer.load.bind(explorer),
|
||||
clearLoadCache: explorer.clearLoadCache.bind(explorer),
|
||||
clearSearchCache: explorer.clearSearchCache.bind(explorer),
|
||||
clearCaches: explorer.clearCaches.bind(explorer)
|
||||
};
|
||||
} // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
||||
|
||||
|
||||
function cosmiconfigSync(moduleName, options = {}) {
|
||||
const normalizedOptions = normalizeOptions(moduleName, options);
|
||||
const explorerSync = new _ExplorerSync.ExplorerSync(normalizedOptions);
|
||||
return {
|
||||
search: explorerSync.searchSync.bind(explorerSync),
|
||||
load: explorerSync.loadSync.bind(explorerSync),
|
||||
clearLoadCache: explorerSync.clearLoadCache.bind(explorerSync),
|
||||
clearSearchCache: explorerSync.clearSearchCache.bind(explorerSync),
|
||||
clearCaches: explorerSync.clearCaches.bind(explorerSync)
|
||||
};
|
||||
} // do not allow mutation of default loaders. Make sure it is set inside options
|
||||
|
||||
|
||||
const defaultLoaders = Object.freeze({
|
||||
'.cjs': _loaders.loaders.loadJs,
|
||||
'.js': _loaders.loaders.loadJs,
|
||||
'.json': _loaders.loaders.loadJson,
|
||||
'.yaml': _loaders.loaders.loadYaml,
|
||||
'.yml': _loaders.loaders.loadYaml,
|
||||
noExt: _loaders.loaders.loadYaml
|
||||
});
|
||||
exports.defaultLoaders = defaultLoaders;
|
||||
|
||||
const identity = function identity(x) {
|
||||
return x;
|
||||
};
|
||||
|
||||
function normalizeOptions(moduleName, options) {
|
||||
const defaults = {
|
||||
packageProp: moduleName,
|
||||
searchPlaces: ['package.json', `.${moduleName}rc`, `.${moduleName}rc.json`, `.${moduleName}rc.yaml`, `.${moduleName}rc.yml`, `.${moduleName}rc.js`, `.${moduleName}rc.cjs`, `${moduleName}.config.js`, `${moduleName}.config.cjs`],
|
||||
ignoreEmptySearchPlaces: true,
|
||||
stopDir: _os.default.homedir(),
|
||||
cache: true,
|
||||
transform: identity,
|
||||
loaders: defaultLoaders
|
||||
};
|
||||
const normalizedOptions = { ...defaults,
|
||||
...options,
|
||||
loaders: { ...defaults.loaders,
|
||||
...options.loaders
|
||||
}
|
||||
};
|
||||
return normalizedOptions;
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/cosmiconfig/dist/index.js.map
generated
vendored
Normal file
1
node_modules/cosmiconfig/dist/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4
node_modules/cosmiconfig/dist/loaders.d.ts
generated
vendored
Normal file
4
node_modules/cosmiconfig/dist/loaders.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
import { LoadersSync } from './types';
|
||||
declare const loaders: LoadersSync;
|
||||
export { loaders };
|
||||
//# sourceMappingURL=loaders.d.ts.map
|
1
node_modules/cosmiconfig/dist/loaders.d.ts.map
generated
vendored
Normal file
1
node_modules/cosmiconfig/dist/loaders.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"loaders.d.ts","sourceRoot":"","sources":["../src/loaders.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AA0CtC,QAAA,MAAM,OAAO,EAAE,WAA4C,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
60
node_modules/cosmiconfig/dist/loaders.js
generated
vendored
Normal file
60
node_modules/cosmiconfig/dist/loaders.js
generated
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.loaders = void 0;
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||
let importFresh;
|
||||
|
||||
const loadJs = function loadJs(filepath) {
|
||||
if (importFresh === undefined) {
|
||||
importFresh = require('import-fresh');
|
||||
}
|
||||
|
||||
const result = importFresh(filepath);
|
||||
return result;
|
||||
};
|
||||
|
||||
let parseJson;
|
||||
|
||||
const loadJson = function loadJson(filepath, content) {
|
||||
if (parseJson === undefined) {
|
||||
parseJson = require('parse-json');
|
||||
}
|
||||
|
||||
try {
|
||||
const result = parseJson(content);
|
||||
return result;
|
||||
} catch (error) {
|
||||
error.message = `JSON Error in ${filepath}:\n${error.message}`;
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
let yaml;
|
||||
|
||||
const loadYaml = function loadYaml(filepath, content) {
|
||||
if (yaml === undefined) {
|
||||
yaml = require('yaml');
|
||||
}
|
||||
|
||||
try {
|
||||
const result = yaml.parse(content, {
|
||||
prettyErrors: true
|
||||
});
|
||||
return result;
|
||||
} catch (error) {
|
||||
error.message = `YAML Error in ${filepath}:\n${error.message}`;
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
const loaders = {
|
||||
loadJs,
|
||||
loadJson,
|
||||
loadYaml
|
||||
};
|
||||
exports.loaders = loaders;
|
||||
//# sourceMappingURL=loaders.js.map
|
1
node_modules/cosmiconfig/dist/loaders.js.map
generated
vendored
Normal file
1
node_modules/cosmiconfig/dist/loaders.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../src/loaders.ts"],"names":["importFresh","loadJs","filepath","undefined","require","result","parseJson","loadJson","content","error","message","yaml","loadYaml","parse","prettyErrors","loaders"],"mappings":";;;;;;;AAAA;AAQA,IAAIA,WAAJ;;AACA,MAAMC,MAAkB,GAAG,SAASA,MAAT,CAAgBC,QAAhB,EAA0B;AACnD,MAAIF,WAAW,KAAKG,SAApB,EAA+B;AAC7BH,IAAAA,WAAW,GAAGI,OAAO,CAAC,cAAD,CAArB;AACD;;AAED,QAAMC,MAAM,GAAGL,WAAW,CAACE,QAAD,CAA1B;AACA,SAAOG,MAAP;AACD,CAPD;;AASA,IAAIC,SAAJ;;AACA,MAAMC,QAAoB,GAAG,SAASA,QAAT,CAAkBL,QAAlB,EAA4BM,OAA5B,EAAqC;AAChE,MAAIF,SAAS,KAAKH,SAAlB,EAA6B;AAC3BG,IAAAA,SAAS,GAAGF,OAAO,CAAC,YAAD,CAAnB;AACD;;AAED,MAAI;AACF,UAAMC,MAAM,GAAGC,SAAS,CAACE,OAAD,CAAxB;AACA,WAAOH,MAAP;AACD,GAHD,CAGE,OAAOI,KAAP,EAAc;AACdA,IAAAA,KAAK,CAACC,OAAN,GAAiB,iBAAgBR,QAAS,MAAKO,KAAK,CAACC,OAAQ,EAA7D;AACA,UAAMD,KAAN;AACD;AACF,CAZD;;AAcA,IAAIE,IAAJ;;AACA,MAAMC,QAAoB,GAAG,SAASA,QAAT,CAAkBV,QAAlB,EAA4BM,OAA5B,EAAqC;AAChE,MAAIG,IAAI,KAAKR,SAAb,EAAwB;AACtBQ,IAAAA,IAAI,GAAGP,OAAO,CAAC,MAAD,CAAd;AACD;;AAED,MAAI;AACF,UAAMC,MAAM,GAAGM,IAAI,CAACE,KAAL,CAAWL,OAAX,EAAoB;AAAEM,MAAAA,YAAY,EAAE;AAAhB,KAApB,CAAf;AACA,WAAOT,MAAP;AACD,GAHD,CAGE,OAAOI,KAAP,EAAc;AACdA,IAAAA,KAAK,CAACC,OAAN,GAAiB,iBAAgBR,QAAS,MAAKO,KAAK,CAACC,OAAQ,EAA7D;AACA,UAAMD,KAAN;AACD;AACF,CAZD;;AAcA,MAAMM,OAAoB,GAAG;AAAEd,EAAAA,MAAF;AAAUM,EAAAA,QAAV;AAAoBK,EAAAA;AAApB,CAA7B","sourcesContent":["/* eslint-disable @typescript-eslint/no-require-imports */\n\nimport parseJsonType from 'parse-json';\nimport yamlType from 'yaml';\nimport importFreshType from 'import-fresh';\nimport { LoaderSync } from './index';\nimport { LoadersSync } from './types';\n\nlet importFresh: typeof importFreshType;\nconst loadJs: LoaderSync = function loadJs(filepath) {\n if (importFresh === undefined) {\n importFresh = require('import-fresh');\n }\n\n const result = importFresh(filepath);\n return result;\n};\n\nlet parseJson: typeof parseJsonType;\nconst loadJson: LoaderSync = function loadJson(filepath, content) {\n if (parseJson === undefined) {\n parseJson = require('parse-json');\n }\n\n try {\n const result = parseJson(content);\n return result;\n } catch (error) {\n error.message = `JSON Error in ${filepath}:\\n${error.message}`;\n throw error;\n }\n};\n\nlet yaml: typeof yamlType;\nconst loadYaml: LoaderSync = function loadYaml(filepath, content) {\n if (yaml === undefined) {\n yaml = require('yaml');\n }\n\n try {\n const result = yaml.parse(content, { prettyErrors: true });\n return result;\n } catch (error) {\n error.message = `YAML Error in ${filepath}:\\n${error.message}`;\n throw error;\n }\n};\n\nconst loaders: LoadersSync = { loadJs, loadJson, loadYaml };\n\nexport { loaders };\n"],"file":"loaders.js"}
|
7
node_modules/cosmiconfig/dist/readFile.d.ts
generated
vendored
Normal file
7
node_modules/cosmiconfig/dist/readFile.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
interface Options {
|
||||
throwNotFound?: boolean;
|
||||
}
|
||||
declare function readFile(filepath: string, options?: Options): Promise<string | null>;
|
||||
declare function readFileSync(filepath: string, options?: Options): string | null;
|
||||
export { readFile, readFileSync };
|
||||
//# sourceMappingURL=readFile.d.ts.map
|
1
node_modules/cosmiconfig/dist/readFile.d.ts.map
generated
vendored
Normal file
1
node_modules/cosmiconfig/dist/readFile.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"readFile.d.ts","sourceRoot":"","sources":["../src/readFile.ts"],"names":[],"mappings":"AAkBA,UAAU,OAAO;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,iBAAe,QAAQ,CACrB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,OAAY,GACpB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAiBxB;AAED,iBAAS,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,OAAY,GAAG,MAAM,GAAG,IAAI,CAiB5E;AAED,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC"}
|
56
node_modules/cosmiconfig/dist/readFile.js
generated
vendored
Normal file
56
node_modules/cosmiconfig/dist/readFile.js
generated
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.readFile = readFile;
|
||||
exports.readFileSync = readFileSync;
|
||||
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
async function fsReadFileAsync(pathname, encoding) {
|
||||
return new Promise((resolve, reject) => {
|
||||
_fs.default.readFile(pathname, encoding, (error, contents) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
|
||||
resolve(contents);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function readFile(filepath, options = {}) {
|
||||
const throwNotFound = options.throwNotFound === true;
|
||||
|
||||
try {
|
||||
const content = await fsReadFileAsync(filepath, 'utf8');
|
||||
return content;
|
||||
} catch (error) {
|
||||
if (throwNotFound === false && (error.code === 'ENOENT' || error.code === 'EISDIR')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
function readFileSync(filepath, options = {}) {
|
||||
const throwNotFound = options.throwNotFound === true;
|
||||
|
||||
try {
|
||||
const content = _fs.default.readFileSync(filepath, 'utf8');
|
||||
|
||||
return content;
|
||||
} catch (error) {
|
||||
if (throwNotFound === false && (error.code === 'ENOENT' || error.code === 'EISDIR')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=readFile.js.map
|
1
node_modules/cosmiconfig/dist/readFile.js.map
generated
vendored
Normal file
1
node_modules/cosmiconfig/dist/readFile.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../src/readFile.ts"],"names":["fsReadFileAsync","pathname","encoding","Promise","resolve","reject","fs","readFile","error","contents","filepath","options","throwNotFound","content","code","readFileSync"],"mappings":";;;;;;;;AAAA;;;;AAEA,eAAeA,eAAf,CACEC,QADF,EAEEC,QAFF,EAGmB;AACjB,SAAO,IAAIC,OAAJ,CAAY,CAACC,OAAD,EAAUC,MAAV,KAA2B;AAC5CC,gBAAGC,QAAH,CAAYN,QAAZ,EAAsBC,QAAtB,EAAgC,CAACM,KAAD,EAAQC,QAAR,KAA2B;AACzD,UAAID,KAAJ,EAAW;AACTH,QAAAA,MAAM,CAACG,KAAD,CAAN;AACA;AACD;;AAEDJ,MAAAA,OAAO,CAACK,QAAD,CAAP;AACD,KAPD;AAQD,GATM,CAAP;AAUD;;AAMD,eAAeF,QAAf,CACEG,QADF,EAEEC,OAAgB,GAAG,EAFrB,EAG0B;AACxB,QAAMC,aAAa,GAAGD,OAAO,CAACC,aAAR,KAA0B,IAAhD;;AAEA,MAAI;AACF,UAAMC,OAAO,GAAG,MAAMb,eAAe,CAACU,QAAD,EAAW,MAAX,CAArC;AAEA,WAAOG,OAAP;AACD,GAJD,CAIE,OAAOL,KAAP,EAAc;AACd,QACEI,aAAa,KAAK,KAAlB,KACCJ,KAAK,CAACM,IAAN,KAAe,QAAf,IAA2BN,KAAK,CAACM,IAAN,KAAe,QAD3C,CADF,EAGE;AACA,aAAO,IAAP;AACD;;AAED,UAAMN,KAAN;AACD;AACF;;AAED,SAASO,YAAT,CAAsBL,QAAtB,EAAwCC,OAAgB,GAAG,EAA3D,EAA8E;AAC5E,QAAMC,aAAa,GAAGD,OAAO,CAACC,aAAR,KAA0B,IAAhD;;AAEA,MAAI;AACF,UAAMC,OAAO,GAAGP,YAAGS,YAAH,CAAgBL,QAAhB,EAA0B,MAA1B,CAAhB;;AAEA,WAAOG,OAAP;AACD,GAJD,CAIE,OAAOL,KAAP,EAAc;AACd,QACEI,aAAa,KAAK,KAAlB,KACCJ,KAAK,CAACM,IAAN,KAAe,QAAf,IAA2BN,KAAK,CAACM,IAAN,KAAe,QAD3C,CADF,EAGE;AACA,aAAO,IAAP;AACD;;AAED,UAAMN,KAAN;AACD;AACF","sourcesContent":["import fs from 'fs';\n\nasync function fsReadFileAsync(\n pathname: string,\n encoding: BufferEncoding,\n): Promise<string> {\n return new Promise((resolve, reject): void => {\n fs.readFile(pathname, encoding, (error, contents): void => {\n if (error) {\n reject(error);\n return;\n }\n\n resolve(contents);\n });\n });\n}\n\ninterface Options {\n throwNotFound?: boolean;\n}\n\nasync function readFile(\n filepath: string,\n options: Options = {},\n): Promise<string | null> {\n const throwNotFound = options.throwNotFound === true;\n\n try {\n const content = await fsReadFileAsync(filepath, 'utf8');\n\n return content;\n } catch (error) {\n if (\n throwNotFound === false &&\n (error.code === 'ENOENT' || error.code === 'EISDIR')\n ) {\n return null;\n }\n\n throw error;\n }\n}\n\nfunction readFileSync(filepath: string, options: Options = {}): string | null {\n const throwNotFound = options.throwNotFound === true;\n\n try {\n const content = fs.readFileSync(filepath, 'utf8');\n\n return content;\n } catch (error) {\n if (\n throwNotFound === false &&\n (error.code === 'ENOENT' || error.code === 'EISDIR')\n ) {\n return null;\n }\n\n throw error;\n }\n}\n\nexport { readFile, readFileSync };\n"],"file":"readFile.js"}
|
20
node_modules/cosmiconfig/dist/types.d.ts
generated
vendored
Normal file
20
node_modules/cosmiconfig/dist/types.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
import { Loader, LoaderSync, Options, OptionsSync } from './index';
|
||||
export declare type Config = any;
|
||||
export declare type CosmiconfigResult = {
|
||||
config: Config;
|
||||
filepath: string;
|
||||
isEmpty?: boolean;
|
||||
} | null;
|
||||
export interface ExplorerOptions extends Required<Options> {
|
||||
}
|
||||
export interface ExplorerOptionsSync extends Required<OptionsSync> {
|
||||
}
|
||||
export declare type Cache = Map<string, CosmiconfigResult>;
|
||||
export declare type LoadedFileContent = Config | null | undefined;
|
||||
export interface Loaders {
|
||||
[key: string]: Loader;
|
||||
}
|
||||
export interface LoadersSync {
|
||||
[key: string]: LoaderSync;
|
||||
}
|
||||
//# sourceMappingURL=types.d.ts.map
|
1
node_modules/cosmiconfig/dist/types.d.ts.map
generated
vendored
Normal file
1
node_modules/cosmiconfig/dist/types.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGnE,oBAAY,MAAM,GAAG,GAAG,CAAC;AAEzB,oBAAY,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,IAAI,CAAC;AAIT,MAAM,WAAW,eAAgB,SAAQ,QAAQ,CAAC,OAAO,CAAC;CAAG;AAC7D,MAAM,WAAW,mBAAoB,SAAQ,QAAQ,CAAC,WAAW,CAAC;CAAG;AAGrE,oBAAY,KAAK,GAAG,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAMnD,oBAAY,iBAAiB,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAE1D,MAAM,WAAW,OAAO;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAC;CAC3B"}
|
6
node_modules/cosmiconfig/dist/types.js
generated
vendored
Normal file
6
node_modules/cosmiconfig/dist/types.js
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
//# sourceMappingURL=types.js.map
|
1
node_modules/cosmiconfig/dist/types.js.map
generated
vendored
Normal file
1
node_modules/cosmiconfig/dist/types.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"types.js"}
|
182
node_modules/cosmiconfig/package.json
generated
vendored
Normal file
182
node_modules/cosmiconfig/package.json
generated
vendored
Normal file
|
@ -0,0 +1,182 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"cosmiconfig@7.0.1",
|
||||
"/d"
|
||||
]
|
||||
],
|
||||
"_from": "cosmiconfig@7.0.1",
|
||||
"_id": "cosmiconfig@7.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==",
|
||||
"_location": "/cosmiconfig",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "cosmiconfig@7.0.1",
|
||||
"name": "cosmiconfig",
|
||||
"escapedName": "cosmiconfig",
|
||||
"rawSpec": "7.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "7.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/tailwindcss"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz",
|
||||
"_spec": "7.0.1",
|
||||
"_where": "/d",
|
||||
"author": {
|
||||
"name": "David Clark",
|
||||
"email": "david.dave.clark@gmail.com"
|
||||
},
|
||||
"babel": {
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"targets": {
|
||||
"node": "10"
|
||||
}
|
||||
}
|
||||
],
|
||||
"@babel/preset-typescript"
|
||||
]
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/davidtheclark/cosmiconfig/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Bogdan Chadkin",
|
||||
"email": "trysound@yandex.ru"
|
||||
},
|
||||
{
|
||||
"name": "Suhas Karanth",
|
||||
"email": "sudo.suhas@gmail.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@types/parse-json": "^4.0.0",
|
||||
"import-fresh": "^3.2.1",
|
||||
"parse-json": "^5.0.0",
|
||||
"path-type": "^4.0.0",
|
||||
"yaml": "^1.10.0"
|
||||
},
|
||||
"description": "Find and load configuration from a package.json property, rc file, or CommonJS module",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.10.4",
|
||||
"@babel/core": "^7.10.4",
|
||||
"@babel/preset-env": "^7.10.4",
|
||||
"@babel/preset-typescript": "^7.10.4",
|
||||
"@types/jest": "^26.0.4",
|
||||
"@types/node": "^14.0.22",
|
||||
"@typescript-eslint/eslint-plugin": "^3.6.0",
|
||||
"@typescript-eslint/parser": "^3.6.0",
|
||||
"cross-env": "^7.0.2",
|
||||
"del": "^5.1.0",
|
||||
"del-cli": "^3.0.1",
|
||||
"eslint": "^7.4.0",
|
||||
"eslint-config-davidtheclark-node": "^0.2.2",
|
||||
"eslint-config-prettier": "^6.11.0",
|
||||
"eslint-plugin-import": "^2.22.0",
|
||||
"eslint-plugin-jest": "^23.18.0",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"husky": "^4.2.5",
|
||||
"jest": "^26.1.0",
|
||||
"lint-staged": "^10.2.11",
|
||||
"make-dir": "^3.1.0",
|
||||
"parent-module": "^2.0.0",
|
||||
"prettier": "^2.0.5",
|
||||
"remark-preset-davidtheclark": "^0.12.0",
|
||||
"typescript": "^3.9.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"homepage": "https://github.com/davidtheclark/cosmiconfig#readme",
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged && npm run typescript && npm run test",
|
||||
"pre-push": "npm run check:all"
|
||||
}
|
||||
},
|
||||
"jest": {
|
||||
"testEnvironment": "node",
|
||||
"collectCoverageFrom": [
|
||||
"src/**/*.{js,ts}"
|
||||
],
|
||||
"coverageReporters": [
|
||||
"text",
|
||||
"html",
|
||||
"lcov"
|
||||
],
|
||||
"coverageThreshold": {
|
||||
"global": {
|
||||
"branches": 100,
|
||||
"functions": 100,
|
||||
"lines": 100,
|
||||
"statements": 100
|
||||
}
|
||||
},
|
||||
"resetModules": true,
|
||||
"resetMocks": true,
|
||||
"restoreMocks": true
|
||||
},
|
||||
"keywords": [
|
||||
"load",
|
||||
"configuration",
|
||||
"config"
|
||||
],
|
||||
"license": "MIT",
|
||||
"lint-staged": {
|
||||
"*.{js,ts}": [
|
||||
"eslint --fix",
|
||||
"prettier --write"
|
||||
],
|
||||
"*.{json,yml,yaml}": [
|
||||
"prettier --write"
|
||||
],
|
||||
"*.md": [
|
||||
"remark-preset-davidtheclark",
|
||||
"remark-preset-davidtheclark --format"
|
||||
]
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"name": "cosmiconfig",
|
||||
"prettier": {
|
||||
"trailingComma": "all",
|
||||
"arrowParens": "always",
|
||||
"singleQuote": true,
|
||||
"printWidth": 80,
|
||||
"tabWidth": 2
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/davidtheclark/cosmiconfig.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm run clean && npm run build:compile && npm run build:types",
|
||||
"build:compile": "cross-env NODE_ENV=production babel src -d dist --verbose --extensions .js,.ts --ignore \"**/**/*.test.js\",\"**/**/*.test.ts\" --source-maps",
|
||||
"build:types": "cross-env NODE_ENV=production tsc --project tsconfig.types.json",
|
||||
"check:all": "npm run test && npm run typescript && npm run lint && npm run format:check",
|
||||
"clean": "del-cli --dot=true \"./dist/**/*\"",
|
||||
"dev": "npm run clean && npm run build:compile -- --watch",
|
||||
"format": "prettier \"**/*.{js,ts,json,yml,yaml}\" --write",
|
||||
"format:check": "prettier \"**/*.{js,ts,json,yml,yaml}\" --check",
|
||||
"format:md": "remark-preset-davidtheclark --format",
|
||||
"lint": "eslint --ext .js,.ts . && npm run lint:md",
|
||||
"lint:fix": "eslint --ext .js,.ts . --fix",
|
||||
"lint:md": "remark-preset-davidtheclark",
|
||||
"prepublishOnly": "npm run check:all && npm run build",
|
||||
"test": "jest --coverage",
|
||||
"test:watch": "jest --watch",
|
||||
"typescript": "tsc"
|
||||
},
|
||||
"types": "dist/index.d.ts",
|
||||
"version": "7.0.1"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue