@dotenvx/dotenvx 1.38.0 → 1.38.1

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,7 +2,15 @@
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.0...main)
5
+ [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.38.1...main)
6
+
7
+ ## [1.38.1](https://github.com/dotenvx/dotenvx/compare/v1.38.0...v1.38.1)
8
+
9
+ ### Changed
10
+
11
+ * Support `encrypt` when mutliline contains windows `CRLF` (`\\r\\n`) ([#534](https://github.com/dotenvx/dotenvx/pull/534))
12
+
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.
6
14
 
7
15
  ## [1.38.0](https://github.com/dotenvx/dotenvx/compare/v1.37.0...v1.38.0)
8
16
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.38.0",
2
+ "version": "1.38.1",
3
3
  "name": "@dotenvx/dotenvx",
4
4
  "description": "a better dotenv–from the creator of `dotenv`",
5
5
  "author": "@motdotla",
@@ -7,7 +7,7 @@ function append (src, key, appendValue) {
7
7
  let output
8
8
  let newPart = ''
9
9
 
10
- const parsed = dotenvParse(src, true) // skip expanding \n
10
+ const parsed = dotenvParse(src, true, true) // skip expanding \n and skip converting \r\n
11
11
  const _quotes = quotes(src)
12
12
  if (Object.prototype.hasOwnProperty.call(parsed, key)) {
13
13
  const quote = _quotes[key]
@@ -1,14 +1,16 @@
1
1
  // historical dotenv.parse - https://github.com/motdotla/dotenv)
2
2
  const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg
3
3
 
4
- function dotenvParse (src, skipExpandForDoubleQuotes = false) {
4
+ function dotenvParse (src, skipExpandForDoubleQuotes = false, skipConvertingWindowsNewlines = false) {
5
5
  const obj = {}
6
6
 
7
7
  // Convert buffer to string
8
8
  let lines = src.toString()
9
9
 
10
10
  // Convert line breaks to same format
11
- lines = lines.replace(/\r\n?/mg, '\n')
11
+ if (!skipConvertingWindowsNewlines) {
12
+ lines = lines.replace(/\r\n?/mg, '\n')
13
+ }
12
14
 
13
15
  let match
14
16
  while ((match = LINE.exec(lines)) != null) {
@@ -7,7 +7,7 @@ function replace (src, key, replaceValue) {
7
7
  let output
8
8
  let newPart = ''
9
9
 
10
- const parsed = dotenvParse(src, true) // skip expanding \n
10
+ const parsed = dotenvParse(src, true, true) // skip expanding \n and skip converting \r\n
11
11
  const _quotes = quotes(src)
12
12
  if (Object.prototype.hasOwnProperty.call(parsed, key)) {
13
13
  const quote = _quotes[key]