Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions crates/perry-hir/src/lower/expr_call/native_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,17 @@ pub(super) fn try_native_module_methods(
// is a no-op returning undefined.
return Ok(Ok(Expr::Undefined));
}
"loadEnvFile" => {
// #1399: process.loadEnvFile(path?) (Node 20.12+)
// reads a `.env` file from disk and adds its
// KEY=value entries to process.env. Perry today
// doesn't persist `process.env.X = v` writes
// (#1344) so eagerly loading would be moot;
// returning undefined is the closest no-op for
// call sites that probe-and-call. Real `.env`
// loading is tracked separately.
return Ok(Ok(Expr::Undefined));
}
"exit" => {
// process.exit() / process.exit(code) — never
// returns, terminates the process. Until now this
Expand Down
1 change: 1 addition & 0 deletions crates/perry-hir/src/lower/lower_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ pub(crate) fn lower_expr(ctx: &mut LoweringContext, expr: &ast::Expr) -> Result<
| "dlopen"
| "hasUncaughtExceptionCaptureCallback"
| "setUncaughtExceptionCaptureCallback"
| "loadEnvFile"
)
&& ctx.lookup_local("process").is_none()
{
Expand Down
Loading