open-index/open-npm huggingface dataset:
npm package: @jsdotenv/core
Description: Loads environment variables from .env file
Latest version: 2.0.9

# dotenv

Written in typescript, full testing.

It can loads environment variables from a `.env` file into [`process.env`](https://nodejs.org/docs/latest/api/process.html#process_process_env) or parse `<key>=<value>` string

## Installation

```shell
npm i @jsdotenv/core
```

## Usage

### Load env file

Add your application configuration to your `.env` file in the root of your project:

```shell
S3_BUCKET=YOURS3BUCKET
SECRET_KEY=YOURSECRETKEYGOESHERE
```

Then in your Nodejs app you can do something like

```ts
import dotenv from "@jsdotenv/core";

dotenv.load([__dirname + "/.env"]);
console.log(process.env["S3_BUCKET"]);
```

If you want to be really fancy with your env file you can do comments and exports (below is a valid env file)

```shell
# I am a comment and that is OK
SOME_VAR=someval
FOO=BAR # comments at line end are OK too
export BAR=BAZ
```

Or finally you can do YAML(ish) style

```yaml
FOO: bar
BAR: baz
```

Multiple line is OK.

```shell
MULTI_DOUBLE_QUOTED="THIS
IS
A
MULTILINE
STRING"
```

Expand variables is OK.

```shellOPTION_A=1
OPTION_B=${OPTION_A}
OPTION_C=$OPTION_B
OPTION_D=${OPTION_A}${OPTION_B}
OPTION_E=${OPTION_NOT_DEFINED}
```

### Writing Env Files

dotenv can also write a map representing the environment to a correctly-formatted and escaped file.

```ts
const map = new Map();
map.set("BASIC", "basic");
map.set("KEY", "value");
const filepath = path.resolve(__dirname, "./jsfile/.env");
dotenv.write(map, filepath);
```

... or to a string

```ts
const map = new Map();
map.set("BASIC", "basic");
map.set("KEY", "value");
const lines = dotenv.marshal(map);
```

### Exec commands

dotenv can run commands and inherit output.

exec bash commands

```ts
const pathname = path.resolve(__dirname + "/env/.env");
const out = dotenv.exec([pathname], "bash", ["-c", 'echo "$BASIC"']);
```

exec nodejs commands

```ts
const pathname = path.resolve(__dirname, "./jsfile/hello.js");
const out = dotenv.exec([], "node", [pathname]);
```

## Cli

```shell
npm i create-dotenv -g
```

### Usage

Execute commands using key-value pairs.

```shell
dotenv-cli -v KEY=VALUE -- bash -c 'echo "$KEY"'
```

Execute commands using enviroment file.

```shell
dotenv-cli -e .env -- bash -c 'echo "$BASIC"'
```

Execute commands --help for Usage

```shell
dotenv-cli --help
```
npm package: @jsdox/parser
Description: JSDoc Parser
Author: Jocelyn Badgley
Latest version: 1.0.0

@jsdox/parser
===

Static analysis and JSDoc parsing library.

## Usage

```sh
npm install @jsdox/parser
```


```js
import { parseFile } from '@jsdox/parser';

const { comments, exports } = parseFile('path/to/something.js');
```

## API

#### `parseFile(filepath: string, [options: Object]): {{ comments: ContextBlock[], exports: ContextBlock[] }}`

Parses the given JS or TS file. The `comments` array contains all JSDoc block comments that were found in the file, with additional context for attached code. The `exports` array provides blocks for every recognized export from the file, regardless of if it has a JSDoc comment.

**Options**:

- `followImports: boolean`: If true, the parser will automatically attempt to follow `import`, `export` and `require` statements to parse the entire dependency tree. Defaults to `false`.

- `importComments: boolean`: If true, comments found in dependencies will be included in the `comments` array. Otherwise only comments from the targeted file will be returned. Defaults to `false`.

Also accepts all of the options for `parseSource` except for `filename`.

#### `parseSource(code: string, [options: Object]): {{ comments: ContextBlock[], exports: ContextBlock[] }}`

Parses the provided JavaScript or Typescript source code. The `comments` array contains all JSDoc block comments that were found in the file, with additional context for attached code. The `exports` array provides blocks for every recognized export from the file, regardless of if it has a JSDoc comment.

**Options**:

- `filename: string`: The path of the file being parsed. Will be used for attributing context blocks.

- `cwd: string`: Directory to use for relative paths. Defaults to the current working directory.

- `type: string`: Babel source type. Can be one of `"script"`, `"module"`, or `"unambiguous"`. Defaults to "unambiguous"

- `babelOptions`: Additional configuration values for [`@babel/parser`](https://babeljs.io/docs/en/babel-parser).

- `attachmentThreshold: number`: How close a doc block must be to a block of code to be considered related. Default is a line number difference of 1. Increase to allow more space.

- `conditionNames: string[]`: An array of export field conditions for module resolution, eg `"node"`, `"require"`, `"import"`, etc.

- `resolve: Function(string)`: A custom path resolution function. If omitted, the parser uses [`enhanced-resolve`](https://www.npmjs.com/package/enhanced-resolve).


## ContextBlock Format

To be documented later.