summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/libnpx/node_modules/dotenv
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/libnpx/node_modules/dotenv')
-rw-r--r--deps/npm/node_modules/libnpx/node_modules/dotenv/CHANGELOG.md22
-rw-r--r--deps/npm/node_modules/libnpx/node_modules/dotenv/README.md69
-rw-r--r--deps/npm/node_modules/libnpx/node_modules/dotenv/appveyor.yml13
-rw-r--r--deps/npm/node_modules/libnpx/node_modules/dotenv/lib/main.js39
-rw-r--r--deps/npm/node_modules/libnpx/node_modules/dotenv/package.json39
5 files changed, 49 insertions, 133 deletions
diff --git a/deps/npm/node_modules/libnpx/node_modules/dotenv/CHANGELOG.md b/deps/npm/node_modules/libnpx/node_modules/dotenv/CHANGELOG.md
index 1cfa04fa4f..2fcf56b902 100644
--- a/deps/npm/node_modules/libnpx/node_modules/dotenv/CHANGELOG.md
+++ b/deps/npm/node_modules/libnpx/node_modules/dotenv/CHANGELOG.md
@@ -4,25 +4,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
-## [5.0.0] - 2018-01-29
-
-### Added
-
-- Testing against Node v8 and v9
-- Documentation on trim behavior of values
-- Documentation on how to use with `import`
-
-### Changed
-
-- *Breaking*: default `path` is now `path.resolve(process.cwd(), '.env')`
-- *Breaking*: does not write over keys already in `process.env` if the key has a falsy value
-- using `const` and `let` instead of `var`
-
-### Removed
-
-- Testing aginst Node v7
-
-
## [4.0.0] - 2016-12-23
### Changed
@@ -86,8 +67,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Removed
- support for multiple `.env` files. should always use one `.env` file for the current environment
-[Unreleased]: https://github.com/motdotla/dotenv/compare/v5.0.0...HEAD
-[5.0.0]: https://github.com/motdotla/dotenv/compare/v4.0.0...v5.0.0
+[Unreleased]: https://github.com/motdotla/dotenv/compare/v4.0.0...HEAD
[4.0.0]: https://github.com/motdotla/dotenv/compare/v3.0.0...v4.0.0
[3.0.0]: https://github.com/motdotla/dotenv/compare/v2.0.0...v3.0.0
[2.0.0]: https://github.com/motdotla/dotenv/compare/v1.2.0...v2.0.0
diff --git a/deps/npm/node_modules/libnpx/node_modules/dotenv/README.md b/deps/npm/node_modules/libnpx/node_modules/dotenv/README.md
index 4665fd3962..90836a34b7 100644
--- a/deps/npm/node_modules/libnpx/node_modules/dotenv/README.md
+++ b/deps/npm/node_modules/libnpx/node_modules/dotenv/README.md
@@ -5,7 +5,6 @@
Dotenv is a zero-dependency module that loads environment variables from a `.env` file into [`process.env`](https://nodejs.org/docs/latest/api/process.html#process_process_env). Storing configuration in the environment separate from code is based on [The Twelve-Factor App](http://12factor.net/config) methodology.
[![BuildStatus](https://img.shields.io/travis/motdotla/dotenv/master.svg?style=flat-square)](https://travis-ci.org/motdotla/dotenv)
-[![Build status](https://ci.appveyor.com/api/projects/status/rnba2pyi87hgc8xw/branch/master?svg=true)](https://ci.appveyor.com/project/maxbeatty/dotenv/branch/master)
[![NPM version](https://img.shields.io/npm/v/dotenv.svg?style=flat-square)](https://www.npmjs.com/package/dotenv)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
[![Coverage Status](https://img.shields.io/coveralls/motdotla/dotenv/master.svg?style=flat-square)](https://coveralls.io/github/motdotla/dotenv?branch=coverall-intergration)
@@ -28,7 +27,7 @@ Create a `.env` file in the root directory of your project. Add
environment-specific variables on new lines in the form of `NAME=VALUE`.
For example:
-```dosini
+```
DB_HOST=localhost
DB_USER=root
DB_PASS=s1mpl3
@@ -39,7 +38,7 @@ That's it.
`process.env` now has the keys and values you defined in your `.env` file.
```javascript
-const db = require('db')
+var db = require('db')
db.connect({
host: process.env.DB_HOST,
username: process.env.DB_USER,
@@ -49,7 +48,8 @@ db.connect({
### Preload
-You can use the `--require` (`-r`) command line option to preload dotenv. By doing this, you do not need to require and load dotenv in your application code. This is the preferred approach when using `import` instead of `require`.
+If you are using iojs-v1.6.0 or later, you can use the `--require` (`-r`) command line option to preload dotenv. By doing this, you do not need to require and load dotenv in your application code.
+
```bash
$ node -r dotenv/config your_script.js
@@ -67,31 +67,20 @@ _Alias: `load`_
`config` will read your .env file, parse the contents, assign it to
[`process.env`](https://nodejs.org/docs/latest/api/process.html#process_process_env),
-and return an Object with a `parsed` key containing the loaded content or an `error` key if it failed.
-
-```js
-const result = dotenv.config()
-
-if (result.error) {
- throw result.error
-}
-
-console.log(result.parsed)
-```
-
+and return an Object with a _parsed_ key containing the loaded content or an _error_ key if it failed.
You can additionally, pass options to `config`.
### Options
#### Path
-Default: `path.resolve(process.cwd(), '.env')`
+Default: `.env`
You can specify a custom path if your file containing environment variables is
named or located differently.
```js
-require('dotenv').config({path: '/full/custom/path/to/your/env/vars'})
+require('dotenv').config({path: '/custom/path/to/your/env/vars'})
```
#### Encoding
@@ -112,9 +101,9 @@ variables is available to use. It accepts a String or Buffer and will return
an Object with the parsed keys and values.
```js
-const dotenv = require('dotenv')
-const buf = new Buffer('BASIC=basic')
-const config = dotenv.parse(buf) // will return an object
+var dotenv = require('dotenv')
+var buf = new Buffer('BASIC=basic')
+var config = dotenv.parse(buf) // will return an object
console.log(typeof config, config) // object { BASIC : 'basic' }
```
@@ -134,7 +123,6 @@ The parsing engine currently supports the following rules:
line'}
```
- inner quotes are maintained (think JSON) (`JSON={"foo": "bar"}` becomes `{JSON:"{\"foo\": \"bar\"}"`)
-- whitespace is removed from both ends of the value (see more on [`trim`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim)) (`FOO=" some value "` becomes `{FOO: 'some value'}`)
## FAQ
@@ -187,40 +175,6 @@ For `dotenv@2.x.x`: Use [dotenv-expand](https://github.com/motdotla/dotenv-expan
For `dotenv@1.x.x`: We haven't been presented with a compelling use case for expanding variables and believe it leads to env vars that are not "fully orthogonal" as [The Twelve-Factor App](http://12factor.net/config) outlines.<sup>[[1](https://github.com/motdotla/dotenv/issues/39)][[2](https://github.com/motdotla/dotenv/pull/97)]</sup> Please open an issue if you have a compelling use case.
-### How do I use dotenv with `import`?
-
-ES2015 and beyond offers modules that allow you to `export` any top-level `function`, `class`, `var`, `let`, or `const`.
-
-> When you run a module containing an `import` declaration, the modules it imports are loaded first, then each module body is executed in a depth-first traversal of the dependency graph, avoiding cycles by skipping anything already executed.
->
-> – [ES6 In Depth: Modules](https://hacks.mozilla.org/2015/08/es6-in-depth-modules/)
-
-You must run `dotenv.config()` before referencing any environment variables. Here's an example of problematic code:
-
-`errorReporter.js`:
-
-```js
-import { Client } from 'best-error-reporting-service'
-
-export const client = new Client(process.env.BEST_API_KEY)
-```
-
-`index.js`:
-
-```js
-import dotenv from 'dotenv'
-dotenv.config()
-
-import errorReporter from './errorReporter'
-errorReporter.client.report(new Error('faq example'))
-```
-
-`client` will not be configured correctly because it was constructed before `dotenv.config()` was executed. There are (at least) 3 ways to make this work.
-
-1. Preload dotenv: `node --require dotenv/config index.js` (_Note: you do not need to `import` dotenv with this approach_)
-2. Import `dotenv/config` instead of `dotenv` (_Note: you do not need to call `dotenv.config()` and must pass options via the command line with this approach_)
-3. Create a separate file that will execute `config` first as outlined in [this comment on #133](https://github.com/motdotla/dotenv/issues/133#issuecomment-255298822)
-
## Contributing Guide
See [CONTRIBUTING.md](CONTRIBUTING.md)
@@ -252,6 +206,3 @@ Here's some projects that expand on dotenv. Check them out.
* [require-environment-variables](https://github.com/bjoshuanoah/require-environment-variables)
* [dotenv-safe](https://github.com/rolodato/dotenv-safe)
* [envalid](https://github.com/af/envalid)
-* [lookenv](https://github.com/RodrigoEspinosa/lookenv)
-* [run.env](https://www.npmjs.com/package/run.env)
-* [dotenv-webpack](https://github.com/mrsteele/dotenv-webpack)
diff --git a/deps/npm/node_modules/libnpx/node_modules/dotenv/appveyor.yml b/deps/npm/node_modules/libnpx/node_modules/dotenv/appveyor.yml
deleted file mode 100644
index f55b8a4b6e..0000000000
--- a/deps/npm/node_modules/libnpx/node_modules/dotenv/appveyor.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-version: "{build}"
-build: off
-environment:
- matrix:
- - nodejs_version: "4"
- - nodejs_version: "6"
- - nodejs_version: "8"
- - nodejs_version: "9"
-install:
- - ps: Install-Product node $env:nodejs_version
- - npm install
-test_script:
- - npm test
diff --git a/deps/npm/node_modules/libnpx/node_modules/dotenv/lib/main.js b/deps/npm/node_modules/libnpx/node_modules/dotenv/lib/main.js
index 1f0df92719..eb96e7fd56 100644
--- a/deps/npm/node_modules/libnpx/node_modules/dotenv/lib/main.js
+++ b/deps/npm/node_modules/libnpx/node_modules/dotenv/lib/main.js
@@ -1,29 +1,28 @@
'use strict'
-const fs = require('fs')
-const path = require('path')
+var fs = require('fs')
/*
* Parses a string or buffer into an object
- * @param {(string|Buffer)} src - source to be parsed
- * @returns {Object} keys and values from src
+ * @param {String|Buffer} src - source to be parsed
+ * @returns {Object}
*/
function parse (src) {
- const obj = {}
+ var obj = {}
// convert Buffers before splitting into lines and processing
src.toString().split('\n').forEach(function (line) {
// matching "KEY' and 'VAL' in 'KEY=VAL'
- const keyValueArr = line.match(/^\s*([\w\.\-]+)\s*=\s*(.*)?\s*$/)
+ var keyValueArr = line.match(/^\s*([\w\.\-]+)\s*=\s*(.*)?\s*$/)
// matched?
if (keyValueArr != null) {
- const key = keyValueArr[1]
+ var key = keyValueArr[1]
// default undefined or missing values to empty string
- let value = keyValueArr[2] || ''
+ var value = keyValueArr[2] ? keyValueArr[2] : ''
// expand newlines in quoted values
- const len = value ? value.length : 0
+ var len = value ? value.length : 0
if (len > 0 && value.charAt(0) === '"' && value.charAt(len - 1) === '"') {
value = value.replace(/\\n/gm, '\n')
}
@@ -40,18 +39,16 @@ function parse (src) {
/*
* Main entry point into dotenv. Allows configuration before loading .env
- * @param {Object} options - options for parsing .env file
- * @param {string} [options.path=.env] - path to .env file
- * @param {string} [options.encoding=utf8] - encoding of .env file
- * @returns {Object} parsed object or error
+ * @param {Object} options - valid options: path ('.env'), encoding ('utf8')
+ * @returns {Boolean}
*/
function config (options) {
- let dotenvPath = path.resolve(process.cwd(), '.env')
- let encoding = 'utf8'
+ var path = '.env'
+ var encoding = 'utf8'
if (options) {
if (options.path) {
- dotenvPath = options.path
+ path = options.path
}
if (options.encoding) {
encoding = options.encoding
@@ -60,15 +57,13 @@ function config (options) {
try {
// specifying an encoding returns a string instead of a buffer
- const parsed = parse(fs.readFileSync(dotenvPath, { encoding }))
+ var parsedObj = parse(fs.readFileSync(path, { encoding: encoding }))
- Object.keys(parsed).forEach(function (key) {
- if (!process.env.hasOwnProperty(key)) {
- process.env[key] = parsed[key]
- }
+ Object.keys(parsedObj).forEach(function (key) {
+ process.env[key] = process.env[key] || parsedObj[key]
})
- return { parsed }
+ return { parsed: parsedObj }
} catch (e) {
return { error: e }
}
diff --git a/deps/npm/node_modules/libnpx/node_modules/dotenv/package.json b/deps/npm/node_modules/libnpx/node_modules/dotenv/package.json
index f1d99fc5fc..19c25a8886 100644
--- a/deps/npm/node_modules/libnpx/node_modules/dotenv/package.json
+++ b/deps/npm/node_modules/libnpx/node_modules/dotenv/package.json
@@ -1,41 +1,45 @@
{
- "_from": "dotenv@^5.0.1",
- "_id": "dotenv@5.0.1",
- "_inBundle": false,
- "_integrity": "sha512-4As8uPrjfwb7VXC+WnLCbXK7y+Ueb2B3zgNCePYfhxS1PYeaO1YTeplffTEcbfLhvFNGLAz90VvJs9yomG7bow==",
+ "_args": [
+ [
+ "dotenv@4.0.0",
+ "/Users/zkat/Documents/code/npx"
+ ]
+ ],
+ "_from": "dotenv@4.0.0",
+ "_id": "dotenv@4.0.0",
+ "_inBundle": true,
+ "_integrity": "sha1-hk7xN5rO1Vzm+V3r7NzhefegzR0=",
"_location": "/libnpx/dotenv",
"_phantomChildren": {},
"_requested": {
- "type": "range",
+ "type": "version",
"registry": true,
- "raw": "dotenv@^5.0.1",
+ "raw": "dotenv@4.0.0",
"name": "dotenv",
"escapedName": "dotenv",
- "rawSpec": "^5.0.1",
+ "rawSpec": "4.0.0",
"saveSpec": null,
- "fetchSpec": "^5.0.1"
+ "fetchSpec": "4.0.0"
},
"_requiredBy": [
"/libnpx"
],
- "_resolved": "https://registry.npmjs.org/dotenv/-/dotenv-5.0.1.tgz",
- "_shasum": "a5317459bd3d79ab88cff6e44057a6a3fbb1fcef",
- "_spec": "dotenv@^5.0.1",
- "_where": "/Users/zkat/Documents/code/npm/node_modules/libnpx",
+ "_resolved": "https://registry.npmjs.org/dotenv/-/dotenv-4.0.0.tgz",
+ "_spec": "4.0.0",
+ "_where": "/Users/zkat/Documents/code/npx",
"author": {
"name": "scottmotte"
},
"bugs": {
"url": "https://github.com/motdotla/dotenv/issues"
},
- "bundleDependencies": false,
"dependencies": {},
- "deprecated": false,
"description": "Loads environment variables from .env file",
"devDependencies": {
"babel": "5.8.23",
"coveralls": "^2.11.9",
- "lab": "^14.3.2",
+ "lab": "11.1.0",
+ "semver": "5.3.0",
"should": "11.1.1",
"sinon": "1.17.6",
"standard": "8.4.0",
@@ -62,12 +66,11 @@
"url": "git://github.com/motdotla/dotenv.git"
},
"scripts": {
- "ci:coverage": "lab test/* -r lcov | coveralls",
"lint": "standard",
"lint-md": "standard-markdown",
"postlint": "npm run lint-md",
"pretest": "npm run lint",
- "test": "lab"
+ "test": "lab test/* -r lcov | coveralls"
},
- "version": "5.0.1"
+ "version": "4.0.0"
}