--env-file was meant to replace a node --env-file or dotenv-cli wrapper,
but it parsed with dotenvy, which expands $VAR and rejects values
Node.js accepts. The expansion was never a design decision: it came with
the parser. It was also wrong for names containing `_`.
Port Node.js's Dotenv::ParseContent (src/node_dotenv.cc, unchanged from
Node.js 22 through 26) instead. Values are no longer expanded, no content
is rejected, invalid UTF-8 becomes U+FFFD, and a value ends at a NUL
byte, as Node.js does. ERR_PNPM_ENV_FILE_PARSE goes away. The loader
still drops a leading UTF-8 byte-order mark, which Node.js keeps as part
of the first key.
The parser tests compare against util.parseEnv, which runs the same
Node.js parser, on hand-written and generated input.
---------
Co-authored-by: Zoltan Kochan <z@kochan.io>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>