@dotenvx/dotenvx 1.24.2 → 1.24.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,21 @@
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.2...main)
5
+ ## [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.24.3...main)
6
6
 
7
- ## 1.24.2
7
+ ## [1.24.3](https://github.com/dotenvx/dotenvx/compare/v1.24.2...1.24.3)
8
+
9
+ ### Changed
10
+
11
+ * 🐞 fix command substitution for more complex commands ([#455](https://github.com/dotenvx/dotenvx/pull/455))
12
+
13
+ ## [1.24.2](https://github.com/dotenvx/dotenvx/compare/v1.24.1...1.24.2)
8
14
 
9
15
  ### Changed
10
16
 
11
17
  * treat pre-existing expandable values as literal in `process.env` ([#450](https://github.com/dotenvx/dotenvx/pull/450))
12
18
 
13
- ## 1.24.1
19
+ ## [1.24.1](https://github.com/dotenvx/dotenvx/compare/v1.24.0...1.24.1)
14
20
 
15
21
  ### Changed
16
22
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.24.2",
2
+ "version": "1.24.3",
3
3
  "name": "@dotenvx/dotenvx",
4
4
  "description": "a better dotenv–from the creator of `dotenv`",
5
5
  "author": "@motdotla",
@@ -122,12 +122,13 @@ class Parse {
122
122
  }
123
123
 
124
124
  eval (value) {
125
- const matches = value.match(/\$\([^()]+\)/) || []
125
+ // Match everything between the outermost $() using a regex with non-capturing groups
126
+ const matches = value.match(/\$\(([^)]+(?:\)[^(]*)*)\)/g) || []
126
127
 
127
128
  return matches.reduce(function (newValue, match) {
128
- const command = match.substring(2, match.length - 1) // get command
129
- const value = chomp(execSync(command).toString()) // execute command
130
- return newValue.replace(match, value) // replace with command value
129
+ const command = match.slice(2, -1) // Extract command by removing $() wrapper
130
+ const result = chomp(execSync(command).toString()) // execute command
131
+ return newValue.replace(match, result) // Replace match with result
131
132
  }, value)
132
133
  }
133
134