Skip to content

Commit

Permalink
Require Elixir v1.13
Browse files Browse the repository at this point in the history
Closes #3167.
  • Loading branch information
josevalim committed Mar 12, 2024
1 parent 7f6a9c8 commit dec1017
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 19 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

## 0.20.12 (2024-03-04)

### Enhancements
* Phoenix LiveView requires Elixir v1.13+

### Bug fixes
* Do not send Telemetry metadata as Logger event, this avoids the metadata from being accidentally copied to other processes
* Ensure LiveViewTest does not crash on IDs with foreign characters, such as question marks
Expand Down
3 changes: 0 additions & 3 deletions lib/phoenix_live_view/html_algebra.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ defmodule Phoenix.LiveView.HTMLAlgebra do

import Inspect.Algebra, except: [format: 2]

# TODO: Remove it after versions before Elixir 1.13 are no longer supported.
@compile {:no_warn_undefined, Code}

@languages ~w(style script)

# The formatter has two modes:
Expand Down
8 changes: 2 additions & 6 deletions lib/phoenix_live_view/html_formatter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -220,16 +220,12 @@ defmodule Phoenix.LiveView.HTMLFormatter do
@behaviour Mix.Tasks.Format
end

# TODO: Add it back after versions before Elixir 1.13 are no longer supported.
# @impl Mix.Tasks.Format
@doc false
@impl Mix.Tasks.Format
def features(_opts) do
[sigils: [:H], extensions: [".heex"]]
end

# TODO: Add it back after versions before Elixir 1.13 are no longer supported.
# @impl Mix.Tasks.Format
@doc false
@impl Mix.Tasks.Format
def format(source, opts) do
line_length = opts[:heex_line_length] || opts[:line_length] || @default_line_length
newlines = :binary.matches(source, ["\r\n", "\n"])
Expand Down
10 changes: 1 addition & 9 deletions lib/phoenix_live_view/tag_engine.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1209,20 +1209,12 @@ defmodule Phoenix.LiveView.TagEngine do
defp to_location(%{line: line, column: column}), do: [line: line, column: column]

defp actual_component_module(env, fun) do
case lookup_import(env, {fun, 1}) do
case Macro.Env.lookup_import(env, {fun, 1}) do
[{_, module} | _] -> module
_ -> env.module
end
end

# TODO: Use Macro.Env.lookup_import/2 when we require Elixir v1.13+
defp lookup_import(%Macro.Env{functions: functions, macros: macros}, {name, arity} = pair)
when is_atom(name) and is_integer(arity) do
f = for {mod, pairs} <- functions, :ordsets.is_element(pair, pairs), do: {:function, mod}
m = for {mod, pairs} <- macros, :ordsets.is_element(pair, pairs), do: {:macro, mod}
f ++ m
end

defp remove_phx_no_break(attrs) do
List.keydelete(attrs, "phx-no-format", 0)
end
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule Phoenix.LiveView.MixProject do
[
app: :phoenix_live_view,
version: @version,
elixir: "~> 1.12",
elixir: "~> 1.13",
start_permanent: Mix.env() == :prod,
elixirc_paths: elixirc_paths(Mix.env()),
test_options: [docs: true],
Expand Down

0 comments on commit dec1017

Please sign in to comment.