open-index/open-npm huggingface dataset:
npm package: @qiwi/uniconfig-core
Description: Core uniconfig library
Author: Qiwi
Latest version: 3.5.5

# @qiwi/uniconfig-core

Core uniconfig layer: basic ifaces, utils, entry point, plugin API

## Install
```bash
  npm i @qiwi/uniconfig-core
  yarn add @qiwi/uniconfig-core
```

# Plugin API
`uniconfig` features may be significantly extended with plugins.
```javascript
import uniconfig, {rollupPlugin} from '@qiwi/uniconfig-core'
import uniconfigPluginFile from '@qiwi/uniconfig-plugin-api-file'    
import uniconfigPluginYaml from '@qiwi/uniconfig-plugin-yaml'    
import uniconfigPluginDatatree from '@qiwi/uniconfig-plugin-datatree'    

rollupPlugin(uniconfigPluginFile)
rollupPlugin(uniconfigPluginYaml)
rollupPlugin(uniconfigPluginDatatree)
const config = uniconfig('./foobar.yml', {mode: 'sync', pipeline: 'file>yaml>datatree'})    
```

Each plugin should expose at least two methods to be registered: `rollup` and `rollback`.
```javascript
export interface IContext {
  pipe: IRegistry
}

export interface IPlugin {
  rollback(context: IContext): void,
  rollup(context: IContext): void
}
``` 

`IPipe` with additional `name` field is also provided as plugin declaration:
```javascript
  const name = 'test'
  const pipe = {
    handle() {},
    handleSync() {}
  }
  const pipeAsPlugin = {...pipe, name}
  
  rollupPlugin(pipeAsPlugin)
  context.pipe.get(name)  // IPipe
```

### Example
```json
{
  "data": {
    "foo": "bar",
    "baz": 1,
    "host": "$remoteConfig.hostname",
    "port": "$jsonFile.defaultPort"
  },
  "sources": {
     "jsonFile": {"pipeline": "file>json", "data": "./foo.json"},
     "yamlFile": {"pipeline": "file>yaml", "data": "./bar.yaml"},
     "remoteConfig": {"pipeline": "http>json", "data": "https://reqres.in/api/users/2"}
  }
}
```
npm package: @qiwi/uniconfig-plugin-ajv
Description: Uniconfig AJV plugin
Author: Qiwi
Latest version: 3.5.7

# @qiwi/uniconfig-plugin-ajv

[Ajv](https://github.com/epoberezkin/ajv) validation plugin. 

## Install
```bash
  npm i @qiwi/uniconfig-plugin-ajv
  yarn add @qiwi/uniconfig-plugin-ajv
```

## Usage
```javascript

import uniconfig, {rollupPlugin} from '@qiwi/uniconfig-core'
import uniconfigPluginAjv from '@qiwi/uniconfig-plugin-ajv'
    
rollupPlugin(uniconfigPluginAjv)
const config = uniconfig({
  data: {
    data: {
      foo: 'bar'
    },
    schema: {
      type: 'object',
      required: ['foo'],
      properties: {
        foo: {
          type: 'string',
          minLength: 1
        }
      }
    }
  },
  pipeline: 'ajv',
  mode: 'sync'
}) 

config.get('foo') // 'bar'   
```
npm package: @qiwi/uniconfig-plugin-api-file
Description: Uniconfig file API (fs) plugin
Author: Qiwi
Latest version: 4.0.1

# @qiwi/uniconfig-plugin-api-file

Uniconfig File API plugin

## Install
```bash
  npm i @qiwi/uniconfig-plugin-api-file
  yarn add @qiwi/uniconfig-plugin-api-file
```

## Usage
```javascript
import uniconfig, {rollupPlugin} from '@qiwi/uniconfig-core'
import uniconfigFileApiPlugin from '@qiwi/uniconfig-plugin-api-file'
import uniconfigJsonParserPlugin from '@qiwi/uniconfig-plugin-parser-json'
    
rollupPlugin(uniconfigFileApiPlugin)
rollupPlugin(uniconfigJsonParserPlugin)

const target = './foo.json'
/** foo.json content:
{
  "foo": "bar"
}
*/

const config = uniconfig({
  data: {
    someParam: '$fromFile:foo'
  },
  source: {
    fromFile: {
      data: '<some path>',
      pipeline: 'file>json'
    }
  }
}, {
  mode: 'sync',
  pipeline: 'datatree'
})    

config.get('someParam') // "bar"

const missingTarget = './foo-missing.json' // this file does not exist
const target2 = './foo2.json'
/** foo2.json content:
 {
  "foo2": "bar2"
}
 */

const config = uniconfig({
  data: {
    someParam: '$fromFile:foo'
  },
  source: {
    fromFile: {
      data: [missingTarget, target2, target], // in this mode the content of the first existing file is returned
      pipeline: 'file>json'
    }
  }
}, {
  mode: 'sync',
  pipeline: 'datatree'
})

config.get('someParam') // "bar2"
```
npm package: @qiwi/uniconfig-plugin-api-http
Description: Uniconfig HTTP API plugin
Author: Qiwi
Latest version: 3.5.6

# @qiwi/uniconfig-plugin-api-http

Uniconfig HTTP API plugin

## Install
```bash
  npm i @qiwi/uniconfig-plugin-api-http
  yarn add @qiwi/uniconfig-plugin-api-http
```

## Usage
```javascript
import uniconfig, {rollupPlugin} from '@qiwi/uniconfig-core'
import uniconfigHttpApiPlugin from '@qiwi/uniconfig-plugin-api-http'
import uniconfigJsonParserPlugin from '@qiwi/uniconfig-plugin-parser-json'
    
rollupPlugin(uniconfigHttpApiPlugin)
rollupPlugin(uniconfigJsonParserPlugin)

const target = 'https://reqres.in/api/users/2'
/** Remote data:
{
    data: {
      id: 2,
      first_name: 'Janet',
      last_name: 'Weaver',
      avatar: 'https://s3.amazonaws.com/uifaces/faces/twitter/josephstein/128.jpg'
    }
  }
*/
const config = uniconfig({
  data: {
    someParam: '$fromWeb:data.first_name'
  },
  source: {
    fromWeb: {
      target,
      pipeline: 'http>json'
    }
  }
}, {
  mode: 'sync',
  pipeline: 'datatree'
})    

config.get('someParam') // "Janet"
```
npm package: @qiwi/uniconfig-plugin-argv
Description: Uniconfig argv reader plugin
Author: Qiwi
Latest version: 3.5.6

# @qiwi/uniconfig-plugin-argv

Script args reader plugin.

## Install
```bash
  npm i @qiwi/uniconfig-plugin-argv
  yarn add @qiwi/uniconfig-plugin-argv
```

## Usage
```javascript
// node yourapp/run.js --foo=bar

import uniconfig, {rollupPlugin} from '@qiwi/uniconfig-core'
import uniconfigPluginArgv from '@qiwi/uniconfig-plugin-argv'
    
rollupPlugin(uniconfigPluginArgv)
const config = uniconfig({pipeline: 'argv', mode: 'sync'}) 

config.get('foo') // 'bar'   
```
npm package: @qiwi/uniconfig-plugin-datatree
Description: uniconfig datatree plugin
Author: Qiwi
Latest version: 3.5.6

# @qiwi/uniconfig-plugin-datatree

Uniconfig "Datatree" plugin.

## Install
```bash
  npm i @qiwi/uniconfig-plugin-datatree
  yarn add @qiwi/uniconfig-plugin-datatree
```

# Usage

```javascript
import {Config, addPlugin} from '@qiwi/uniconfig-core'
import dataTreePlugin from '@qiwi/uniconfig-plugin-datatree'

addPlugin(dataTreePlugin)

const config = new Config({
  data: {
    someParam: '$foo:bar',
    otherParam: '$a:b',
    anotherParam: '$a:d.e.f.g',
    lastParam: '$a:i.j.k.l.m.n'
  },
  source: {
    foo: {
      data: {
        bar: 'baz'
      }
    },
    a: {
      data: {
        b: 'c',
        'd.e.f.g': 'h',
        'i.j': {
          k: {
            'l.m.n': 'o'
          }
        }
      }
    }
  }
}, {
  pipeline: 'datatree',
  mode: 'sync'
})

config.get('someParam')     // 'baz'
config.get('otherParam')    // 'c'
config.get('anotherParam')  // 'h'
config.get('lastParam')     // 'o'
```
npm package: @qiwi/uniconfig-plugin-dot
Description: Uniconfig doT template plugin
Author: Qiwi
Latest version: 3.5.6

# @qiwi/uniconfig-plugin-dot

Uniconfig [doT](http://olado.github.io/doT/) template plugin.

## Install
```bash
  npm i @qiwi/uniconfig-plugin-dot
  yarn add @qiwi/uniconfig-plugin-dot
```

## Usage
```javascript
import uniconfig, {rollupPlugin} from '@qiwi/uniconfig-core'
import uniconfigPluginDot from '@qiwi/uniconfig-plugin-dot'
    
rollupPlugin(uniconfigPluginDot)
const config = uniconfig({
   data: {
     template: '{{=it.foo}}-bar-{{=it.baz}}',
     data: {
       foo: 'FOO',
       baz: 'BAZ'
     }
   },
   mode: 'sync',
   pipeline: 'dot'
 }) 

config.get() // 'FOO-bar-BAZ'   
```
npm package: @qiwi/uniconfig-plugin-dotenv
Description: Uniconfig dotenv parser plugin
Author: Qiwi
Latest version: 3.5.12

# @qiwi/uniconfig-plugin-dotenv

Uniconfig dotenv parser plugin

## Install
```bash
  npm i @qiwi/uniconfig-plugin-dotenv
  yarn add @qiwi/uniconfig-plugin-dotenv
```


## Usage
Imagine `./some.env`
```env
FOO=BAR
BAZ=QUX
```

```javascript
import Config, {rollupPlugin} from '@qiwi/uniconfig-core'
import uniconfigPluginDotenv from '@qiwi/uniconfig-plugin-dotenv'
    
rollupPlugin(uniconfigPluginDotenv)
const config = new Config('./some.env', {mode: SYNC, pipeline: 'file>dotenv'})

config.get('FOO') // 'BAR'  
```
npm package: @qiwi/uniconfig-plugin-env
Description: Uniconfig environment variables API
Author: Qiwi
Latest version: 3.5.6

# @qiwi/uniconfig-plugin-env

Uniconfig Environment API plugin

## Install
```bash
  npm i @qiwi/uniconfig-plugin-env
  yarn add @qiwi/uniconfig-plugin-env
```

## Usage
```javascript
// FOO=bar node src/index.js

// index.js:
import uniconfig, {rollupPlugin} from '@qiwi/uniconfig-core'
import uniconfigPluginEnv from '@qiwi/uniconfig-plugin-env'
    
rollupPlugin(uniconfigPluginEnv)
const config = uniconfig({}, {pipeline: 'env'}) 

config.get('FOO') // 'bar'   
```
npm package: @qiwi/uniconfig-plugin-global
Description: Uniconfig global variables reading API
Author: Qiwi
Latest version: 3.5.6

# @qiwi/uniconfig-plugin-global

Uniconfig global variables reader plugin

## Install
```bash
  npm i @qiwi/uniconfig-plugin-global
  yarn add @qiwi/uniconfig-plugin-global
```

## Usage
```javascript
import uniconfig, {rollupPlugin} from '@qiwi/uniconfig-core'
import uniconfigPluginGlobal from '@qiwi/uniconfig-plugin-global'

global.DEBUG=true
    
rollupPlugin(uniconfigPluginGlobal)
const config = uniconfig({}, {pipeline: 'global'}) 

config.get('DEBUG') // 'true'   
```
npm package: @qiwi/uniconfig-plugin-ip
Description: Uniconfig IP/host resolver plugin
Author: Qiwi
Latest version: 3.5.6

# @qiwi/uniconfig-plugin-ip

Uniconfig IP/host resolver plugin

## Install
```bash
  npm i @qiwi/uniconfig-plugin-ip
  yarn add @qiwi/uniconfig-plugin-ip
```

## Usage
```javascript
import uniconfig, {rollupPlugin} from '@qiwi/uniconfig-core'
import uniconfigPluginIp from '@qiwi/uniconfig-plugin-ip'
    
rollupPlugin(uniconfigPluginIp)
const config = uniconfig({pipeline: 'ip', mode: 'sync'}) 

config.get() // '10.20.10.30'   
```
npm package: @qiwi/uniconfig-plugin-json
Description: Uniconfig json parser plugin
Author: Qiwi
Latest version: 3.5.8

# @qiwi/uniconfig-plugin-json

Uniconfig JSON parser plugin

## Install
```bash
  npm i @qiwi/uniconfig-plugin-yaml
  yarn add @qiwi/uniconfig-plugin-yaml
```


## Usage
```javascript
import uniconfig, {rollupPlugin} from '@qiwi/uniconfig-core'
import uniconfigPluginJson from '@qiwi/uniconfig-plugin-json'
    
rollupPlugin(uniconfigPluginJson)
const config = uniconfig('./foobar.json')    
```
npm package: @qiwi/uniconfig-plugin-path
Description: Uniconfig path resolver plugin
Author: Qiwi
Latest version: 3.6.1

# @qiwi/uniconfig-plugin-path

Uniconfig path resolver plugin

## Install
```bash
  npm i @qiwi/uniconfig-plugin-path
  yarn add @qiwi/uniconfig-plugin-path
```

## Usage
```javascript
import uniconfig, {rollupPlugin} from '@qiwi/uniconfig-core'
import uniconfigPluginPath from '@qiwi/uniconfig-plugin-path'
    
rollupPlugin(uniconfigPluginPath)
const config = uniconfig({data: ['<root>', 'config/default.json']}, {pipeline: 'path'}) 

config.get() // '/Users/antongolub/projects/uniconfig/config/default.json'  
```

## `root` reference
As practice shows, it's quite useful to build paths from the app root. So the `path` plugin works as preset, and adds [root plugin](../uniconfig-plugin-root/README.md) along with it.
Root aliases: `<root>`, `$root` and `APP_ROOT`.
npm package: @qiwi/uniconfig-plugin-pkg
Description: Uniconfig package.json reader plugin
Author: Qiwi
Latest version: 3.5.6

# @qiwi/uniconfig-plugin-pkg

Uniconfig package.json reader plugin

## Install
```bash
  npm i @qiwi/uniconfig-plugin-pkg
  yarn add @qiwi/uniconfig-plugin-pkg
```

## Usage
```javascript
import uniconfig, {rollupPlugin} from '@qiwi/uniconfig-core'
import uniconfigPluginPkg from '@qiwi/uniconfig-plugin-pkg'
    
rollupPlugin(uniconfigPluginPkg)
const config = uniconfig({pipeline: 'pkg', mode: 'sync'}) 

config.get('version') // '1.2.3'   
config.get('name')    // 'some-package-name'   
```
npm package: @qiwi/uniconfig-plugin-root
Description: Uniconfig root resolver plugin
Author: Qiwi
Latest version: 3.5.6

# @qiwi/uniconfig-plugin-root

Uniconfig app root resolver plugin

## Install
```bash
  npm i @qiwi/uniconfig-plugin-root
  yarn add @qiwi/uniconfig-plugin-root
```

## Usage
```javascript
import uniconfig, {rollupPlugin} from '@qiwi/uniconfig-core'
import uniconfigPluginRoot from '@qiwi/uniconfig-plugin-root'
    
rollupPlugin(uniconfigPluginRoot)
const config = uniconfig({pipeline: 'root', mode: 'sync'}) 

config.get()  //  '/Users/antongolub/projects/uniconfig'
```
npm package: @qiwi/uniconfig-plugin-yaml
Description: Uniconfig yaml parser plugin
Author: Qiwi
Latest version: 3.5.8

# @qiwi/uniconfig-plugin-yaml

Uniconfig YAML parser plugin

## Install
```bash
  npm i @qiwi/uniconfig-plugin-yaml
  yarn add @qiwi/uniconfig-plugin-yaml
```


## Usage
```javascript
import uniconfig, {rollupPlugin} from '@qiwi/uniconfig-core'
import uniconfigPluginYaml from '@qiwi/uniconfig-plugin-yaml'
    
rollupPlugin(uniconfigPluginYaml)
const config = uniconfig('./foobar.yml')    
```