Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to Weakdeps #195

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 8 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
MD5 = "6ac74813-4b46-53a4-afec-0b5dc9d7885c"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
PlotlyBase = "a03496cd-edff-5a9b-9e67-9cda94a718b5"
PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
Sockets = "6462fe0b-24de-5631-8697-dd941f90decc"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand All @@ -36,13 +37,20 @@ JSON = "0.21"
JSON3 = "1.9"
MD5 = "0.2"
PlotlyBase = "0.8.5, 0.8.6"
PlotlyJS = "0.18"
Requires = "1.3"
YAML = "0.4.7"
julia = "1.6"

[extensions]
PlotlyJSExt = "PlotlyJS"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Aqua", "Test"]

[weakdeps]
PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a"
4 changes: 4 additions & 0 deletions src/plotly_js.jl → ext/PlotlyJSExt.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
module PlotlyJSExt

import JSON
import PlotlyJS

function DashBase.to_dash(p::PlotlyJS.SyncPlot)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strictly speaking, shouldn't this go in DashBase.jl?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good catch!

data = JSON.lower(p.plot)
pop!(data, :config, nothing)
return data
end

end
12 changes: 8 additions & 4 deletions src/Dash.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ using DashBase
import HTTP, JSON3, CodecZlib, MD5
using Sockets
using Pkg.Artifacts

if !isdefined(Base, :get_extension)
using Requires
end

const ROOT_PATH = realpath(joinpath(@__DIR__, ".."))
#const RESOURCE_PATH = realpath(joinpath(ROOT_PATH, "resources"))
Expand Down Expand Up @@ -106,12 +109,13 @@ end
@place_embedded_components
const _metadata = load_all_metadata()
function __init__()
setup_renderer_resources()
setup_dash_resources()
@require PlotlyJS="f0f68f2c-4968-5e81-91da-67840de0976a" include("plotly_js.jl")
setup_renderer_resources()
setup_dash_resources()
@static if !isdefined(Base, :get_extension)
@require PlotlyJS="f0f68f2c-4968-5e81-91da-67840de0976a" include("../ext/PlotlyJSExt.jl")
end
end


JSON3.StructTypes.StructType(::Type{DashBase.Component}) = JSON3.StructTypes.Struct()
JSON3.StructTypes.excludes(::Type{DashBase.Component}) = (:name, :available_props, :wildcard_regex)

Expand Down