@dotenvx/dotenvx 1.38.1 → 1.38.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,15 +2,27 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
- [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.38.1...main)
5
+ [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.38.3...main)
6
+
7
+ ## [1.38.3](https://github.com/dotenvx/dotenvx/compare/v1.38.2...v1.38.3)
8
+
9
+ ### Changed
10
+
11
+ * 🐞 Fix self-referencing expansion when key exists already in `process.env` ([#536](https://github.com/dotenvx/dotenvx/pull/536))
12
+
13
+ ## [1.38.2](https://github.com/dotenvx/dotenvx/compare/v1.38.1...v1.38.2)
14
+
15
+ ### Added
16
+
17
+ * Add typescript types for `main.get`.
6
18
 
7
19
  ## [1.38.1](https://github.com/dotenvx/dotenvx/compare/v1.38.0...v1.38.1)
8
20
 
9
21
  ### Changed
10
22
 
11
- * Support `encrypt` when mutliline contains windows `CRLF` (`\\r\\n`) ([#534](https://github.com/dotenvx/dotenvx/pull/534))
23
+ * Support `encrypt` when mutliline contains windows `CRLF` (`\r\n`) ([#534](https://github.com/dotenvx/dotenvx/pull/534))
12
24
 
13
- Note: dotenvx will convert these `\\r\\n` newlines to `\\n`. Our recommendation is to stop using CRLF - its origin is from typewriter days. Instead, set your editor or gitattributes to use LF.
25
+ Note: dotenvx will convert these `\r\n` newlines to `\n`. Our recommendation is to stop using `CRLF` - its origin is from typewriter days. Instead, set your editor or gitattributes to use `LF`.
14
26
 
15
27
  ## [1.38.0](https://github.com/dotenvx/dotenvx/compare/v1.37.0...v1.38.0)
16
28
 
package/README.md CHANGED
@@ -2212,33 +2212,68 @@ More examples
2212
2212
  dotenvx.set('HELLO', 'World', { path: '.env' })
2213
2213
  ```
2214
2214
 
2215
+ </details>
2216
+ * <details><summary>`get(KEY)` - <i>Decryption at Access</i></summary><br>
2217
+
2218
+ Programatically get an environment variable at access/runtime.
2219
+
2220
+ ```js
2221
+ // index.js
2222
+ const dotenvx = require('@dotenvx/dotenvx')
2223
+ const decryptedValue = dotenvx.get('HELLO')
2224
+ console.log(decryptedValue)
2225
+ ```
2226
+
2227
+ This is known as *Decryption at Access* and is written about in [the whitepaper](https://dotenvx.com/dotenvx.pdf).
2228
+
2215
2229
  </details>
2216
2230
 
2217
2231
  &nbsp;
2218
2232
 
2219
2233
  ## Guides
2220
2234
 
2221
- > Go deeper into using `dotenvx` with detailed framework and platform guides.
2235
+ > Go deeper with `dotenvx` detailed framework and platform guides.
2222
2236
  >
2223
2237
 
2224
- * <a href="https://dotenvx.com/docs/platforms/digital-ocean">Digital Ocean <img src="https://api.iconify.design/devicon/digitalocean.svg" alt="Digital Ocean" width="20" /></a>
2225
- * <a href="https://dotenvx.com/docs/platforms/docker">Docker <img src="https://api.iconify.design/skill-icons/docker.svg" alt="Docker" width="20" /></a>
2226
- * <a href="https://dotenvx.com/docs/platforms/fly">Fly.io <img src="https://api.iconify.design/logos/fly-icon.svg" alt="Fly.io" width="20" /></a>
2227
- * <a href="https://dotenvx.com/docs/cis/github-actions">GitHub Actions <img src="https://api.iconify.design/devicon/github.svg" alt="GitHub" width="20" /></a>
2228
- * <a href="https://dotenvx.com/docs/platforms/heroku">Heroku <img src="https://api.iconify.design/skill-icons/heroku.svg" alt="Heroku" width="20" /></a>
2229
- * <a href="https://dotenvx.com/docs/platforms/netlify">Netlify <img src="https://api.iconify.design/skill-icons/netlify-light.svg" alt="Netlify" width="20" /></a>
2230
- * <a href="https://dotenvx.com/docs/package-managers/npm">NPM <img src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/npm.svg" alt="NPM Logo" width="20" height="20" style="fill:#CB3837;"></a>
2231
- * <a href="https://dotenvx.com/docs/monorepos/nx">Nx <img src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/nx.svg" alt="Nx Logo" width="20" height="20" style="fill:#143055;"></a>
2232
- * <a href="https://dotenvx.com/docs/platforms/render">Render <img src="https://api.iconify.design/simple-icons/render.svg" alt="Render" width="20" /></a>
2233
- * <a href="https://dotenvx.com/docs/platforms/railway">Railway <img src="https://api.iconify.design/simple-icons/railway.svg" alt="Railway" width="20" /></a>
2234
- * <a href="https://dotenvx.com/docs/monorepos/turborepo">Turborepo <img src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/turborepo.svg" alt="Turborepo Logo" width="20" height="20" style="fill:#EF4444;"></a>
2235
- * <a href="https://dotenvx.com/docs/platforms/vercel">Vercel <img src="https://api.iconify.design/devicon/vercel.svg" alt="Vercel" width="20" /></a>
2236
- * [more](https://dotenvx.com/docs/guides)
2237
- * <a href="https://dotenvx.com/docs/guides#node-js">Node.js <img src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/nodejs.svg" alt="Node.js Logo" width="20" height="20" style="fill:#5FA04E;"></a>
2238
- * <a href="https://dotenvx.com/docs/guides#python">Python <img src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/python.svg" alt="Python Logo" width="20" height="20" style="fill:#3776AB;"></a>
2239
- * <a href="https://dotenvx.com/docs/guides#php">PHP <img src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/php.svg" alt="PHP Logo" width="20" height="20" style="fill:#777BB4;"></a>
2240
- * <a href="https://dotenvx.com/docs/guides#ruby">Ruby <img src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/ruby.svg" alt="Ruby Logo" width="20" height="20" style="fill:#CC342D;"></a>
2241
- * <a href="https://dotenvx.com/docs/guides#rust">Rust <img src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/rust.svg" alt="Rust Logo" width="20" height="20" style="fill:#000000;"></a>
2238
+ * [Languages](https://dotenvx.com/docs#languages)
2239
+ * [Node.js](https://dotenvx.com/docs/languages/nodejs)
2240
+ * [Python](https://dotenvx.com/docs/languages/python)
2241
+ * [Ruby](https://dotenvx.com/docs/languages/ruby)
2242
+ * [Go](https://dotenvx.com/docs/languages/go)
2243
+ * [PHP](https://dotenvx.com/docs/languages/php)
2244
+ * [Rust](https://dotenvx.com/docs/languages/rust)
2245
+ * [Frameworks](https://dotenvx.com/docs#frameworks)
2246
+ * [Astro](https://dotenvx.com/docs/frameworks/astro)
2247
+ * [Express](https://dotenvx.com/docs/frameworks/express)
2248
+ * [Next](https://dotenvx.com/docs/frameworks/next)
2249
+ * [Remix](https://dotenvx.com/docs/frameworks/remix)
2250
+ * [Flask](https://dotenvx.com/docs/frameworks/flask)
2251
+ * [Sinatra](https://dotenvx.com/docs/frameworks/sinatra)
2252
+ * [Rocket](https://dotenvx.com/docs/frameworks/rocket)
2253
+ * [Platforms](https://dotenvx.com/docs#platforms)
2254
+ * [Digital Ocean](https://dotenvx.com/docs/platforms/digital-ocean)
2255
+ * [Docker](https://dotenvx.com/docs/platforms/docker)
2256
+ * [Fly](https://dotenvx.com/docs/platforms/fly)
2257
+ * [Heroku](https://dotenvx.com/docs/platforms/heroku)
2258
+ * [Netlify](https://dotenvx.com/docs/platforms/netlify)
2259
+ * [Vercel](https://dotenvx.com/docs/platforms/vercel)
2260
+ * [Railway](https://dotenvx.com/docs/platforms/railway)
2261
+ * [Render](https://dotenvx.com/docs/platforms/render)
2262
+ * [CI/CDs](https://dotenvx.com/docs#cis)
2263
+ * [GitHub Actions](https://dotenvx.com/docs/cis/github-actions)
2264
+ * [Background Jobs](https://dotenvx.com/docs#background-jobs)
2265
+ * [Trigger.dev](https://dotenvx.com/docs/background-jobs/triggerdotdev)
2266
+ * [Package Managers](https://dotenvx.com/docs#package-managers)
2267
+ * [NPM](https://dotenvx.com/docs/package-managers/npm)
2268
+ * [PNPM](https://dotenvx.com/docs/package-managers/pnpm)
2269
+ * [Process Managers](https://dotenvx.com/docs#process-managers)
2270
+ * [PM2](https://dotenvx.com/docs/process-managers/pm2)
2271
+ * [Monorepos](https://dotenvx.com/docs#monorepos)
2272
+ * [Nx](https://dotenvx.com/docs/monorepos/nx)
2273
+ * [Turborepo](https://dotenvx.com/docs/monorepos/turborepo)
2274
+ * [Concepts](https://dotenvx.com/docs#concepts)
2275
+ * [.env](https://dotenvx.com/docs/env-file)
2276
+ * [.env.keys](https://dotenvx.com/docs/env-keys-file)
2242
2277
 
2243
2278
  &nbsp;
2244
2279
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.38.1",
2
+ "version": "1.38.3",
3
3
  "name": "@dotenvx/dotenvx",
4
4
  "description": "a better dotenv–from the creator of `dotenv`",
5
5
  "author": "@motdotla",
@@ -60,7 +60,7 @@ class Parse {
60
60
  }
61
61
 
62
62
  // expand empty, double, or backticks
63
- if (!evaled && quote !== "'" && !this.processEnv[key]) {
63
+ if (!evaled && quote !== "'" && (!this.processEnv[key] || this.overload)) {
64
64
  this.parsed[key] = resolveEscapeSequences(this.expand(this.parsed[key]))
65
65
  }
66
66
 
package/src/lib/main.d.ts CHANGED
@@ -232,6 +232,50 @@ export function set(
232
232
  options?: SetOptions
233
233
  ): SetOutput;
234
234
 
235
+ export interface GetOptions {
236
+ /**
237
+ * Suppress specific errors like MISSING_ENV_FILE. The error keys can be found
238
+ * in src/lib/helpers/errors.js
239
+ * @default []
240
+ * @example require('@dotenvx/dotenvx').get('KEY', { ignore: ['MISSING_ENV_FILE'] })
241
+ */
242
+ ignore?: string[];
243
+
244
+ /**
245
+ * Override any environment variables that have already been set on your machine with values from your .env file.
246
+ * @default false
247
+ * @example require('@dotenvx/dotenvx').get('KEY', { overload: true })
248
+ * @alias overload
249
+ */
250
+ overload?: boolean;
251
+
252
+ /**
253
+ * Customize the path to your .env.keys file. This is useful with monorepos.
254
+ * @default []
255
+ * @example require('@dotenvx/dotenvx').get('KEY', { envKeysFile: '../../.env.keys'} })
256
+ */
257
+ envKeysFile?: string;
258
+
259
+ /**
260
+ * Throw immediately if an error is encountered - like a missing .env file.
261
+ * @default false
262
+ * @example require('@dotenvx/dotenvx').get('KEY', { strict: true })
263
+ */
264
+ strict?: boolean;
265
+ }
266
+
267
+ /**
268
+ * Get a single environment variable.
269
+ *
270
+ * @see https://dotenvx.com/docs
271
+ * @param key - KEY
272
+ * @param options - additional options. example: `{ overload: true }`
273
+ */
274
+ export function get(
275
+ key: string,
276
+ options?: GetOptions
277
+ ): string;
278
+
235
279
  /**
236
280
  * List all env files in the current working directory
237
281
  *