Skip to content
Open
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
13 changes: 13 additions & 0 deletions lib/esbuild.ex
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,19 @@ defmodule Esbuild do
|> elem(1)
end

def json_library() do
case Application.get_env(:esbuild, :json_library) do
nil ->
case Code.ensure_loaded(JSON) do
{:module, _} -> JSON
{:error, _} -> Jason
end

lib ->
lib
end
end

defp start_unique_install_worker() do
ref =
__MODULE__.Supervisor
Expand Down
2 changes: 1 addition & 1 deletion lib/esbuild/npm_registry.ex
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ defmodule Esbuild.NpmRegistry do
}
} =
fetch_file!(url)
|> Jason.decode!()
|> Esbuild.json_library().decode!()

%{"sig" => signature} =
signatures
Expand Down