From 809c25fd076070f3e142bf814bcf43d7b8107253 Mon Sep 17 00:00:00 2001 From: Steffen Deusch Date: Tue, 27 May 2025 11:31:07 +0200 Subject: [PATCH 1/3] support passing NODE_PATH as list --- lib/esbuild.ex | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/esbuild.ex b/lib/esbuild.ex index 701407b..308735a 100644 --- a/lib/esbuild.ex +++ b/lib/esbuild.ex @@ -175,7 +175,7 @@ defmodule Esbuild do opts = [ cd: config[:cd] || File.cwd!(), - env: config[:env] || %{}, + env: normalize_env(config[:env] || %{}), into: IO.stream(:stdio, :line), stderr_to_stdout: true ] @@ -324,4 +324,17 @@ defmodule Esbuild do end end end + + defp normalize_env(%{"NODE_PATH" => paths} = env) when is_list(paths) do + Map.put(env, "NODE_PATH", Enum.join(paths, path_sep())) + end + + defp normalize_env(env), do: env + + defp path_sep do + case :os.type() do + {:win32, _} -> ";" + {:unix, _} -> ":" + end + end end From e818a2785820bd91a64b686aa6011216117de052 Mon Sep 17 00:00:00 2001 From: Steffen Deusch Date: Tue, 27 May 2025 11:32:05 +0200 Subject: [PATCH 2/3] update CI --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 16729fd..f8a6f57 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,7 +6,7 @@ on: - main jobs: test: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 env: MIX_ENV: test strategy: From 6f8b4dffe66600bf02b0a319a58a3920a7bf7f52 Mon Sep 17 00:00:00 2001 From: Steffen Deusch Date: Tue, 27 May 2025 12:39:13 +0200 Subject: [PATCH 3/3] join all lists --- lib/esbuild.ex | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/esbuild.ex b/lib/esbuild.ex index 308735a..ee59812 100644 --- a/lib/esbuild.ex +++ b/lib/esbuild.ex @@ -325,12 +325,13 @@ defmodule Esbuild do end end - defp normalize_env(%{"NODE_PATH" => paths} = env) when is_list(paths) do - Map.put(env, "NODE_PATH", Enum.join(paths, path_sep())) + defp normalize_env(env) do + Map.new(env, fn + {key, value} when is_list(value) -> {key, Enum.join(value, path_sep())} + other -> other + end) end - defp normalize_env(env), do: env - defp path_sep do case :os.type() do {:win32, _} -> ";"