@dotenvx/dotenvx 1.24.1 → 1.24.2
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 +7 -1
- package/package.json +1 -1
- package/src/lib/helpers/parse.js +7 -16
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
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.
|
|
5
|
+
## [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.24.2...main)
|
|
6
|
+
|
|
7
|
+
## 1.24.2
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
* treat pre-existing expandable values as literal in `process.env` ([#450](https://github.com/dotenvx/dotenvx/pull/450))
|
|
6
12
|
|
|
7
13
|
## 1.24.1
|
|
8
14
|
|
package/package.json
CHANGED
package/src/lib/helpers/parse.js
CHANGED
|
@@ -49,7 +49,7 @@ class Parse {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
// expand empty, double, or backticks
|
|
52
|
-
if (quote !== "'") {
|
|
52
|
+
if (quote !== "'" && !this.processEnv[key]) {
|
|
53
53
|
this.parsed[key] = resolveEscapeSequences(this.expand(this.parsed[key]))
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -141,11 +141,8 @@ class Parse {
|
|
|
141
141
|
|
|
142
142
|
let result = value
|
|
143
143
|
let match
|
|
144
|
-
const seen = new Set() // self-referential checker
|
|
145
144
|
|
|
146
145
|
while ((match = regex.exec(result)) !== null) {
|
|
147
|
-
seen.add(result)
|
|
148
|
-
|
|
149
146
|
const [template, bracedExpression, unbracedExpression] = match
|
|
150
147
|
const expression = bracedExpression || unbracedExpression
|
|
151
148
|
|
|
@@ -162,12 +159,6 @@ class Parse {
|
|
|
162
159
|
|
|
163
160
|
const key = r.shift()
|
|
164
161
|
|
|
165
|
-
// short-circuit if exact value already in process.env already
|
|
166
|
-
// const inProcessEnv = Object.prototype.hasOwnProperty.call(this.processEnv, key)
|
|
167
|
-
// if (!this.overload && !!this.processEnv[key] && (env[key] === this.processEnv[key])) {
|
|
168
|
-
// return this.processEnv[key]
|
|
169
|
-
// }
|
|
170
|
-
|
|
171
162
|
if ([':+', '+'].includes(splitter)) {
|
|
172
163
|
defaultValue = env[key] ? r.join(splitter) : ''
|
|
173
164
|
value = null
|
|
@@ -177,16 +168,16 @@ class Parse {
|
|
|
177
168
|
}
|
|
178
169
|
|
|
179
170
|
if (value) {
|
|
180
|
-
|
|
181
|
-
if (seen.has(value)) {
|
|
182
|
-
result = result.replace(template, defaultValue)
|
|
183
|
-
} else {
|
|
184
|
-
result = result.replace(template, value)
|
|
185
|
-
}
|
|
171
|
+
result = result.replace(template, value)
|
|
186
172
|
} else {
|
|
187
173
|
result = result.replace(template, defaultValue)
|
|
188
174
|
}
|
|
189
175
|
|
|
176
|
+
// if the result equaled what was in env then stop expanding - handle self-referential check as well
|
|
177
|
+
if (result === env[key]) {
|
|
178
|
+
break
|
|
179
|
+
}
|
|
180
|
+
|
|
190
181
|
regex.lastIndex = 0 // reset regex search position to re-evaluate after each replacement
|
|
191
182
|
}
|
|
192
183
|
|