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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ In `router.ex` of your Phoenix app, make sure your locally running Phoenix app c
config :live_debugger,
ip: {127, 0, 0, 1}, # IP on which LiveDebugger will be hosted
port: 4007, # Port on which LiveDebugger will be hosted
secret_key_base: "YOUR_SECRET_KEY_BASE", # Secret key used for LiveDebugger.Endpoint
signing_salt: "your_signing_salt", # Signing salt used for LiveDebugger.Endpoint
adapter: Bandit.PhoenixAdapter, # Adapter used in LiveDebugger.Endpoint
secret_key_base: "YOUR_SECRET_KEY_BASE", # Secret key used for LiveDebuggerWeb.Endpoint
signing_salt: "your_signing_salt", # Signing salt used for LiveDebuggerWeb.Endpoint
adapter: Bandit.PhoenixAdapter, # Adapter used in LiveDebuggerWeb.Endpoint
tracing_setup_delay: 0 # Time in ms after tracing will be initialized. Useful in case multi-nodes envs
```

Expand Down
2 changes: 2 additions & 0 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ if config_env() == :dev do
]
]

config :live_debugger, LiveDebuggerWeb.Endpoint, debug_errors: true

config :live_debugger, experimental_features: :all
end

Expand Down
6 changes: 3 additions & 3 deletions lib/live_debugger.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ defmodule LiveDebugger do

children = [
{Phoenix.PubSub, name: LiveDebugger.PubSub},
{LiveDebugger.Endpoint,
{LiveDebuggerWeb.Endpoint,
[
check_origin: false,
pubsub_server: LiveDebugger.PubSub
Expand Down Expand Up @@ -61,7 +61,7 @@ defmodule LiveDebugger do
live_reload: Keyword.get(config, :live_reload, [])
]

Application.put_env(@app_name, LiveDebugger.Endpoint, endpoint_config)
Application.put_env(@app_name, LiveDebuggerWeb.Endpoint, endpoint_config)
end

defp put_live_debugger_tags(config) do
Expand All @@ -83,7 +83,7 @@ defmodule LiveDebugger do
highlighting?: highlighting?
}

tags = LiveDebugger.Components.Config.live_debugger_tags(assigns)
tags = LiveDebuggerWeb.Components.Config.live_debugger_tags(assigns)
Application.put_env(@app_name, :live_debugger_tags, tags)
end
end
23 changes: 0 additions & 23 deletions lib/live_debugger/router.ex

This file was deleted.

8 changes: 6 additions & 2 deletions lib/live_debugger/services/module_discovery_service.ex
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ defmodule LiveDebugger.Services.ModuleDiscoveryService do
defp debugger?(module) do
stringified_module = Atom.to_string(module)

String.starts_with?(stringified_module, "LiveDebugger.") or
String.starts_with?(stringified_module, "Elixir.LiveDebugger.")
String.starts_with?(stringified_module, [
"Elixir.LiveDebugger.",
"Elixir.LiveDebuggerWeb.",
"LiveDebugger.",
"LiveDebuggerWeb."
])
end
end
2 changes: 1 addition & 1 deletion lib/live_debugger/structs/lv_process.ex
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ defmodule LiveDebugger.Structs.LvProcess do
debugger? =
socket.view
|> Atom.to_string()
|> String.starts_with?("Elixir.LiveDebugger.")
|> String.starts_with?(["Elixir.LiveDebugger.", "Elixir.LiveDebuggerWeb."])

embedded? = socket.host_uri == :not_mounted_at_router

Expand Down
14 changes: 7 additions & 7 deletions lib/live_debugger_web.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ defmodule LiveDebuggerWeb do
def live_view do
quote do
use Phoenix.LiveView,
layout: {LiveDebugger.Layout, :app}
layout: {LiveDebuggerWeb.Layout, :app}

on_mount({LiveDebugger.Flash, :add_hook})
on_mount({LiveDebuggerWeb.Hooks.Flash, :add_hook})

import Phoenix.HTML
import LiveDebuggerWeb.Helpers
import LiveDebugger.Components
import LiveDebugger.Flash, only: [push_flash: 2, push_flash: 3]
import LiveDebuggerWeb.Components
import LiveDebuggerWeb.Hooks.Flash, only: [push_flash: 2, push_flash: 3]
end
end

Expand All @@ -21,8 +21,8 @@ defmodule LiveDebuggerWeb do

import Phoenix.HTML
import LiveDebuggerWeb.Helpers
import LiveDebugger.Components
import LiveDebugger.Flash, only: [push_flash: 2, push_flash: 3]
import LiveDebuggerWeb.Components
import LiveDebuggerWeb.Hooks.Flash, only: [push_flash: 2, push_flash: 3]
end
end

Expand All @@ -32,7 +32,7 @@ defmodule LiveDebuggerWeb do

import Phoenix.HTML
import LiveDebuggerWeb.Helpers
import LiveDebugger.Components
import LiveDebuggerWeb.Components
end
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
defmodule LiveDebugger.Components do
defmodule LiveDebuggerWeb.Components do
@moduledoc """
This module provides reusable components for LiveDebugger.
"""

use Phoenix.Component

alias Phoenix.LiveView.JS
alias LiveDebugger.LiveHelpers.Routes
alias LiveDebuggerWeb.Helpers.RoutesHelper

@report_issue_url "https://github.com/software-mansion/live-debugger/issues/new/choose"

Expand Down Expand Up @@ -553,7 +553,7 @@ defmodule LiveDebugger.Components do
def navbar(assigns) do
~H"""
<navbar class="w-full h-12 shrink-0 py-auto px-4 flex items-center gap-2 bg-navbar-bg text-navbar-logo border-b border-navbar-border">
<.link :if={@return_link?} patch={Routes.live_views_dashboard()}>
<.link :if={@return_link?} patch={RoutesHelper.live_views_dashboard()}>
<.nav_icon icon="icon-arrow-left" />
</.link>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LiveDebugger.Components.Config do
defmodule LiveDebuggerWeb.Components.Config do
@moduledoc """
Renders the LiveDebugger config meta tag and the browser features script.
It is meant to be injected to the debugged application layout.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LiveDebugger.Components.ElixirDisplay do
defmodule LiveDebuggerWeb.Components.ElixirDisplay do
@moduledoc """
This module provides a component to display a tree of terms.
Check LiveDebugger.Utils.TermParser.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LiveDebugger.Components.Error do
defmodule LiveDebuggerWeb.Components.Error do
@moduledoc false

use LiveDebuggerWeb, :component
Expand All @@ -14,7 +14,7 @@ defmodule LiveDebugger.Components.Error do
<%= render_slot(@heading) %>
</div>
<p class="mb-4"><%= render_slot(@description) %></p>
<.link navigate={LiveDebugger.LiveHelpers.Routes.live_views_dashboard()}>
<.link navigate={LiveDebuggerWeb.Helpers.RoutesHelper.live_views_dashboard()}>
<.button>
See active LiveViews
</.button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
defmodule LiveDebugger.Components.Links do
defmodule LiveDebuggerWeb.Components.Links do
@moduledoc """
Adds styling for links.
"""
use LiveDebuggerWeb, :component

alias LiveDebugger.Structs.LvProcess
alias LiveDebugger.Utils.Parsers
alias LiveDebugger.LiveHelpers.Routes
alias LiveDebuggerWeb.Helpers.RoutesHelper

attr(:lv_process, LvProcess, required: true)
attr(:id, :string, required: true)
Expand All @@ -17,7 +17,7 @@ defmodule LiveDebugger.Components.Links do

~H"""
<.link
href={Routes.channel_dashboard(@lv_process.socket_id, @lv_process.transport_pid)}
href={RoutesHelper.channel_dashboard(@lv_process.socket_id, @lv_process.transport_pid)}
class="w-full flex gap-1 text-primary-text"
>
<.icon :if={@icon} name={@icon} class="w-4 h-4 shrink-0 text-link-primary" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
defmodule LiveDebugger.Components.Traces do
defmodule LiveDebuggerWeb.Components.Traces do
@moduledoc """
UI components for the TracesLive module.
"""

use LiveDebuggerWeb, :live_component

alias LiveDebugger.Structs.Trace
alias LiveDebugger.Components.ElixirDisplay
alias LiveDebuggerWeb.Components.ElixirDisplay
alias LiveDebugger.Utils.TermParser
alias LiveDebugger.Utils.Parsers

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LiveDebugger.Components.Tree do
defmodule LiveDebuggerWeb.Components.Tree do
@moduledoc """
Tree component which show nested tree of live view and live components.
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LiveDebugger.Endpoint do
defmodule LiveDebuggerWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :live_debugger

@session_options [
Expand Down Expand Up @@ -39,5 +39,5 @@ defmodule LiveDebugger.Endpoint do
plug(Plug.Session, @session_options)

plug(Plug.RequestId)
plug(LiveDebugger.Router)
plug(LiveDebuggerWeb.Router)
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LiveDebugger.ErrorView do
defmodule LiveDebuggerWeb.ErrorView do
@moduledoc false

def render(template, _), do: Phoenix.Controller.status_message_from_template(template)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
defmodule LiveDebugger.LiveHelpers.Routes do
defmodule LiveDebuggerWeb.Helpers.RoutesHelper do
@moduledoc """
Helper module to generate url routes for the LiveDebugger application.
"""

use Phoenix.VerifiedRoutes, endpoint: LiveDebugger.Endpoint, router: LiveDebugger.Router
use Phoenix.VerifiedRoutes, endpoint: LiveDebuggerWeb.Endpoint, router: LiveDebuggerWeb.Router

alias LiveDebugger.Utils.Parsers

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LiveDebugger.Flash do
defmodule LiveDebuggerWeb.Hooks.Flash do
@moduledoc """
Functionalities to make flash messages work inside LiveComponents
See: https://sevenseacat.net/posts/2023/flash-messages-in-phoenix-liveview-components/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LiveDebugger.Layout do
defmodule LiveDebuggerWeb.Layout do
@moduledoc """
Inspiration was taken from Phoenix LiveDashboard
https://github.com/phoenixframework/phoenix_live_dashboard/blob/main/lib/phoenix/live_dashboard/layout_view.ex
Expand All @@ -7,7 +7,7 @@ defmodule LiveDebugger.Layout do

use Phoenix.Component

import LiveDebugger.Components
import LiveDebuggerWeb.Components

@doc false
def render(template, assigns)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LiveDebugger.LiveViews.ChannelDashboardLive do
defmodule LiveDebuggerWeb.ChannelDashboardLive do
@moduledoc false

use LiveDebuggerWeb, :live_view
Expand All @@ -10,15 +10,15 @@ defmodule LiveDebugger.LiveViews.ChannelDashboardLive do
alias LiveDebugger.Utils.URL
alias Phoenix.LiveView.AsyncResult

alias LiveDebugger.Components.Error
alias LiveDebuggerWeb.Components.Error
alias LiveDebugger.Structs.TreeNode
alias LiveDebugger.Services.LiveViewDiscoveryService
alias LiveDebugger.Utils.Parsers
alias LiveDebugger.LiveHelpers.Routes
alias LiveDebuggerWeb.Helpers.RoutesHelper

alias LiveDebugger.LiveViews.StateLive
alias LiveDebugger.LiveViews.TracesLive
alias LiveDebugger.LiveViews.SidebarLive
alias LiveDebuggerWeb.StateLive
alias LiveDebuggerWeb.TracesLive
alias LiveDebuggerWeb.SidebarLive
alias LiveDebugger.Utils.PubSub, as: PubSubUtils

@impl true
Expand Down Expand Up @@ -102,7 +102,7 @@ defmodule LiveDebugger.LiveViews.ChannelDashboardLive do
%LvProcess{socket_id: socket_id, transport_pid: transport_pid} <-
LiveViewDiscoveryService.successor_lv_process(module) do
socket
|> push_navigate(to: Routes.channel_dashboard(socket_id, transport_pid))
|> push_navigate(to: RoutesHelper.channel_dashboard(socket_id, transport_pid))
|> noreply()
else
_ ->
Expand Down Expand Up @@ -210,7 +210,7 @@ defmodule LiveDebugger.LiveViews.ChannelDashboardLive do
end

defp patch_transport_pid(socket, lv_process) do
path = Routes.channel_dashboard(lv_process.socket_id, lv_process.transport_pid)
path = RoutesHelper.channel_dashboard(lv_process.socket_id, lv_process.transport_pid)
url = URL.update_path(socket.assigns.url, path)

push_patch(socket, to: url)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LiveDebugger.LiveViews.LiveViewsDashboardLive do
defmodule LiveDebuggerWeb.LiveViewsDashboardLive do
@moduledoc """
It displays all active LiveView sessions in the debugged application.
"""
Expand All @@ -8,7 +8,7 @@ defmodule LiveDebugger.LiveViews.LiveViewsDashboardLive do
alias Phoenix.LiveView.AsyncResult
alias LiveDebugger.Services.LiveViewDiscoveryService
alias LiveDebugger.Utils.Parsers
alias LiveDebugger.LiveHelpers.Routes
alias LiveDebuggerWeb.Helpers.RoutesHelper

@impl true
def handle_params(_unsigned_params, _uri, socket) do
Expand Down Expand Up @@ -121,7 +121,7 @@ defmodule LiveDebugger.LiveViews.LiveViewsDashboardLive do
defp list_element(assigns) do
~H"""
<.link
navigate={Routes.channel_dashboard(@lv_process.socket_id, @lv_process.transport_pid)}
navigate={RoutesHelper.channel_dashboard(@lv_process.socket_id, @lv_process.transport_pid)}
class="flex justify-between items-center h-full w-full text-xs p-1.5 hover:bg-surface-0-bg-hover rounded-sm"
>
<div class="flex flex-col gap-1">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LiveDebugger.LiveViews.SidebarLive do
defmodule LiveDebuggerWeb.SidebarLive do
@moduledoc """
This live view is responsible for displaying the sidebar of the LiveDebugger.
It receives events from the `ChannelDashboardLive` live to open the mobile sidebar.
Expand All @@ -11,12 +11,12 @@ defmodule LiveDebugger.LiveViews.SidebarLive do
alias LiveDebugger.Structs.LvProcess
alias LiveDebugger.Structs.Trace
alias LiveDebugger.Utils.Parsers
alias LiveDebugger.Components.Tree
alias LiveDebugger.Components.Links
alias LiveDebuggerWeb.Components.Tree
alias LiveDebuggerWeb.Components.Links
alias LiveDebugger.Services.ChannelService
alias Phoenix.Socket.Message
alias LiveDebugger.Utils.URL
alias LiveDebugger.LiveComponents.NestedLiveViewsLinks
alias LiveDebuggerWeb.LiveComponents.NestedLiveViewsLinks
alias LiveDebugger.Utils.PubSub, as: PubSubUtils

attr(:socket, :map, required: true)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LiveDebugger.LiveViews.StateLive do
defmodule LiveDebuggerWeb.StateLive do
@moduledoc """
This nested live view displays the state of a LiveView.
"""
Expand All @@ -7,7 +7,7 @@ defmodule LiveDebugger.LiveViews.StateLive do

alias Phoenix.LiveView.AsyncResult

alias LiveDebugger.Components.ElixirDisplay
alias LiveDebuggerWeb.Components.ElixirDisplay
alias LiveDebugger.Utils.Parsers
alias LiveDebugger.Structs.TreeNode
alias LiveDebugger.Services.ChannelService
Expand Down
Loading