Skip to content

Commit e9773fb

Browse files
authored
Support export in env parser (#6630)
* Support export in env parser * use a noncapture group
1 parent d4e4b2d commit e9773fb

3 files changed

Lines changed: 8 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fixed an issue where including `export` in .env files caused parsing errors. (#6629)

src/functions/env.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ const RESERVED_KEYS = [
4545
const LINE_RE = new RegExp(
4646
"^" + // begin line
4747
"\\s*" + // leading whitespaces
48+
"(?:export)?" + // Optional 'export' in a non-capture group
49+
"\\s*" + // more whitespaces
4850
"([\\w./]+)" + // key
4951
"\\s*=[\\f\\t\\v]*" + // separator (=)
5052
"(" + // begin optional value

src/test/functions/env.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ describe("functions/env", () => {
1515
input: "FOO=foo ",
1616
want: { FOO: "foo" },
1717
},
18+
{
19+
description: "should parse exported values",
20+
input: "export FOO=foo",
21+
want: { FOO: "foo" },
22+
},
1823
{
1924
description: "should parse values with trailing spaces (single quotes)",
2025
input: "FOO='foo' ",

0 commit comments

Comments
 (0)