Skip to content

Replace with PackageExtensionCompat #10

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Aug 24, 2023
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
26 changes: 13 additions & 13 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,21 @@ version = "0.2.0"

[deps]
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
PackageExtensionCompat = "65ce6f38-6b18-4e1d-a461-8949797d7930"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"

[weakdeps]
PlotlyBase = "a03496cd-edff-5a9b-9e67-9cda94a718b5"
PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
[compat]
JSON3 = "1"
PlotlyBase = "0.8"
PlotlyJS = "0.18"
Plots = "1"
Requires = "1.3"
julia = "1.6"

[extensions]
DashBasePlotlyBaseExt = "PlotlyBase"
DashBasePlotlyJSExt = "PlotlyJS"
DashBasePlotsExt = "Plots"

[compat]
JSON3 = "1"
Plots = "1"
julia = "1.6"
PlotlyBase = "0.8"
PlotlyJS = "0.18"
PackageExtensionCompat = "1"

[extras]
PlotlyBase = "a03496cd-edff-5a9b-9e67-9cda94a718b5"
PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a"
Expand All @@ -34,3 +29,8 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "Plots", "PlotlyBase", "PlotlyJS", "PlotlyKaleido"]

[weakdeps]
PlotlyBase = "a03496cd-edff-5a9b-9e67-9cda94a718b5"
PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
8 changes: 5 additions & 3 deletions ext/DashBasePlotlyBaseExt.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
module DashBasePlotlyBaseExt

import DashBase
import PlotlyBase
import PlotlyBase.JSON
using DashBase

isdefined(Base, :get_extension) ? (using PlotlyBase) : (using ..PlotlyBase)

const JSON = PlotlyBase.JSON

function DashBase.to_dash(p::PlotlyBase.Plot)
data = JSON.lower(p)
Expand Down
5 changes: 3 additions & 2 deletions ext/DashBasePlotlyJSExt.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module DashBasePlotlyJSExt

import PlotlyJS
import DashBase
using DashBase

isdefined(Base, :get_extension) ? (using PlotlyJS) : (using ..PlotlyJS)

function DashBase.to_dash(p::PlotlyJS.SyncPlot)
DashBase.to_dash(p.plot)
Expand Down
4 changes: 2 additions & 2 deletions ext/DashBasePlotsExt.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module DashBasePlotsExt

import Plots
import DashBase
using DashBase

isdefined(Base, :get_extension) ? (using Plots) : (using ..Plots)

function DashBase.to_dash(p::Plots.Plot{Plots.PlotlyBackend})
return if haskey(Base.loaded_modules, Base.PkgId(Base.UUID("a03496cd-edff-5a9b-9e67-9cda94a718b5"), "PlotlyBase")) &&
Expand Down
11 changes: 9 additions & 2 deletions src/DashBase.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module DashBase
import JSON3
import PackageExtensionCompat
include("components.jl")
include("registry.jl")
export Component, push_prop!, get_name, get_type, get_namespace,
Expand All @@ -9,8 +8,16 @@ get_dash_dependencies, get_dash_renderer_pkg, get_componens_pkgs,
has_relative_path, has_dev_path, has_external_url, get_type,
get_external_url, get_dev_path, get_relative_path

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

function __init__()
PackageExtensionCompat.@require_extensions
@static if !isdefined(Base, :get_extension)
@require PlotlyBase = "a03496cd-edff-5a9b-9e67-9cda94a718b5" include("../ext/DashBasePlotlyBaseExt.jl")
@require PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a" include("../ext/DashBasePlotlyJSExt.jl")
@require Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" include("../ext/DashBasePlotsExt.jl")
end
end

end # module