@dotenvx/dotenvx 1.24.3 → 1.24.5

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,27 +2,39 @@
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.24.3...main)
5
+ [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.24.5...main)
6
6
 
7
- ## [1.24.3](https://github.com/dotenvx/dotenvx/compare/v1.24.2...1.24.3)
7
+ ## [1.24.5](https://github.com/dotenvx/dotenvx/compare/v1.24.4...v1.24.5)
8
+
9
+ ### Changed
10
+
11
+ * 🐞 do not expand prior literal values ([#458](https://github.com/dotenvx/dotenvx/pull/458))
12
+
13
+ ## [1.24.4](https://github.com/dotenvx/dotenvx/compare/v1.24.3...v1.24.4)
14
+
15
+ ### Changed
16
+
17
+ * do not expand command substitution ([#456](https://github.com/dotenvx/dotenvx/pull/456))
18
+
19
+ ## [1.24.3](https://github.com/dotenvx/dotenvx/compare/v1.24.2...v1.24.3)
8
20
 
9
21
  ### Changed
10
22
 
11
23
  * 🐞 fix command substitution for more complex commands ([#455](https://github.com/dotenvx/dotenvx/pull/455))
12
24
 
13
- ## [1.24.2](https://github.com/dotenvx/dotenvx/compare/v1.24.1...1.24.2)
25
+ ## [1.24.2](https://github.com/dotenvx/dotenvx/compare/v1.24.1...v1.24.2)
14
26
 
15
27
  ### Changed
16
28
 
17
29
  * treat pre-existing expandable values as literal in `process.env` ([#450](https://github.com/dotenvx/dotenvx/pull/450))
18
30
 
19
- ## [1.24.1](https://github.com/dotenvx/dotenvx/compare/v1.24.0...1.24.1)
31
+ ## [1.24.1](https://github.com/dotenvx/dotenvx/compare/v1.24.0...v1.24.1)
20
32
 
21
33
  ### Changed
22
34
 
23
35
  * bump `cross-spawn` to prevent potential ReDoS [CVE-2024-21538](https://github.com/advisories/ghsa-3xgq-45jj-v275) ([#449](https://github.com/dotenvx/dotenvx/pull/449))
24
36
 
25
- ## 1.24.0
37
+ ## [1.24.0](https://github.com/dotenvx/dotenvx/compare/v1.23.0...v1.24.0)
26
38
 
27
39
  ### Added
28
40
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.24.3",
2
+ "version": "1.24.5",
3
3
  "name": "@dotenvx/dotenvx",
4
4
  "description": "a better dotenv–from the creator of `dotenv`",
5
5
  "author": "@motdotla",
@@ -20,6 +20,8 @@ class Parse {
20
20
 
21
21
  // for use with progressive expansion
22
22
  this.runningParsed = {}
23
+ // for use with stopping expansion for literals
24
+ this.literals = {}
23
25
  }
24
26
 
25
27
  run () {
@@ -44,15 +46,24 @@ class Parse {
44
46
  }
45
47
 
46
48
  // eval empty, double, or backticks
49
+ let evaled = false
47
50
  if (quote !== "'" && (!this.inProcessEnv(key) || this.processEnv[key] === this.parsed[key])) {
48
- this.parsed[key] = this.eval(this.parsed[key])
51
+ const priorEvaled = this.parsed[key]
52
+ this.parsed[key] = this.eval(priorEvaled)
53
+ if (priorEvaled !== this.parsed[key]) {
54
+ evaled = true
55
+ }
49
56
  }
50
57
 
51
58
  // expand empty, double, or backticks
52
- if (quote !== "'" && !this.processEnv[key]) {
59
+ if (!evaled && quote !== "'" && !this.processEnv[key]) {
53
60
  this.parsed[key] = resolveEscapeSequences(this.expand(this.parsed[key]))
54
61
  }
55
62
 
63
+ if (quote === "'") {
64
+ this.literals[key] = this.parsed[key]
65
+ }
66
+
56
67
  // for use with progressive expansion
57
68
  this.runningParsed[key] = this.parsed[key]
58
69
 
@@ -157,7 +168,6 @@ class Parse {
157
168
 
158
169
  let defaultValue
159
170
  let value
160
-
161
171
  const key = r.shift()
162
172
 
163
173
  if ([':+', '+'].includes(splitter)) {
@@ -179,6 +189,11 @@ class Parse {
179
189
  break
180
190
  }
181
191
 
192
+ // if the result came from what was a literal value then stop expanding
193
+ if (this.literals[key]) {
194
+ break
195
+ }
196
+
182
197
  regex.lastIndex = 0 // reset regex search position to re-evaluate after each replacement
183
198
  }
184
199