Skip to content

Commit

Permalink
Merge pull request #228 from GenieFramework/hh-extension2
Browse files Browse the repository at this point in the history
remove extra files for Requires
  • Loading branch information
hhaensel authored Oct 17, 2023
2 parents 252b37f + aa1a03c commit 7f53268
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 64 deletions.
22 changes: 11 additions & 11 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,14 @@ Requires = "ae029012-a4dd-5104-9daa-d747884805df"
StructTypes = "856f2bd8-1eba-4b0a-8007-ebc267875bd4"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"

[weakdeps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"

[extensions]
StippleDataFramesExt = "DataFrames"
StippleOffsetArraysExt = "OffsetArrays"
StippleJSONExt = "JSON"

[compat]
DataFrames = "1"
FilePathsBase = "0.9"
Genie = "5.18"
GenieSession = "1"
GenieSessionFileSession = "1"
JSON3 = "1.9"
JSON = "0.20, 0.21"
JSON3 = "1.9"
MacroTools = "0.5"
Mixers = "0.1.2"
Observables = "0.3, 0.4, 0.5"
Expand All @@ -53,6 +43,11 @@ StructTypes = "1.8"
Tables = "1"
julia = "1.6"

[extensions]
StippleDataFramesExt = "DataFrames"
StippleJSONExt = "JSON"
StippleOffsetArraysExt = "OffsetArrays"

[extras]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
Expand All @@ -61,3 +56,8 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "DataFrames", "JSON", "OffsetArrays"]

[weakdeps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
7 changes: 0 additions & 7 deletions ext/StippleDataFrames.jl

This file was deleted.

7 changes: 3 additions & 4 deletions ext/StippleDataFramesExt.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
module StippleDataFramesExt

@static if isdefined(Base, :get_extension)
using Stipple
using DataFrames
end
using Stipple

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

function Stipple.stipple_parse(::Type{DF} where DF <: DataFrames.AbstractDataFrame, d::Vector)
isempty(d) ? DF() : reduce(vcat, DataFrames.DataFrame.(d))
Expand Down
10 changes: 0 additions & 10 deletions ext/StippleJSON.jl

This file was deleted.

7 changes: 4 additions & 3 deletions ext/StippleJSONExt.jl
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
module StippleJSONExt

using Stipple
using JSON

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

# garantee interoperability of different JSONTText definitions in Stipple and JSON
# for both JSON3 and JSON
# Note that `lower` for Stipple.JSONText is not defined as parse(json.s), because that would require
# pure proper JSON. For transmissions of bindings, though, we need to allow to pass object names.

JSON.JSONText(json::Stipple.JSONText) = JSON.JSONText(json.s)
JSON.show_json(io::JSON.Writer.CompactContext, s::JSON.Writer.CS, json::Stipple.JSONText) = write(io, json.s)
JSON.show_json(io::JSON.Writer.CompactContext, ::JSON.Writer.CS, json::Stipple.JSONText) = write(io, json.s)
JSON.Writer.lower(json::Stipple.JSONText) = json.s

Stipple.JSONText(json::JSON.JSONText) = Stipple.JSONText(json.s)
@inline StructTypes.StructType(::Type{JSON.JSONText}) = JSON3.RawType()
@inline StructTypes.construct(::Type{JSON.JSONText}, json::JSON3.RawValue) = JSONText(string(json))
@inline StructTypes.construct(::Type{JSON.JSONText}, json::JSON3.RawValue) = JSON.JSONText(string(json))
@inline JSON3.rawbytes(json::JSON.JSONText) = codeunits(json.s)

end
12 changes: 0 additions & 12 deletions ext/StippleOffsetArrays.jl

This file was deleted.

3 changes: 2 additions & 1 deletion ext/StippleOffsetArraysExt.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module StippleOffsetArraysExt

using Stipple
using OffsetArrays

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

function Stipple.convertvalue(targetfield::Union{Ref{T}, Reactive{T}}, value) where T <: OffsetArrays.OffsetArray
a = Stipple.stipple_parse(eltype(targetfield), value)
Expand Down
7 changes: 0 additions & 7 deletions ext/StippleTablesExt.jl

This file was deleted.

12 changes: 3 additions & 9 deletions src/Stipple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,21 +208,15 @@ function __init__()

@static if !isdefined(Base, :get_extension)
@require OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" begin
# evaluate the code of the extension without the surrounding module
include(joinpath(@__DIR__, "..", "ext", "StippleOffsetArrays.jl"))
# Core.eval(@__MODULE__, Meta.parse(join(jl, ';')).args[3])
include(joinpath(@__DIR__, "..", "ext", "StippleOffsetArraysExt.jl"))
end

@require DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" begin
# evaluate the code of the extension without the surrounding module
include(joinpath(@__DIR__, "..", "ext", "StippleDataFrames.jl"))
# Core.eval(@__MODULE__, Meta.parse(join(jl, ';')).args[3])
include(joinpath(@__DIR__, "..", "ext", "StippleDataFramesExt.jl"))
end

@require JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" begin
# evaluate the code of the extension without the surrounding module
include(joinpath(@__DIR__, "..", "ext", "StippleJSON.jl"))
# Core.eval(@__MODULE__, Meta.parse(join(jl, ';')).args[3])
include(joinpath(@__DIR__, "..", "ext", "StippleJSONExt.jl"))
end
end
end
Expand Down

0 comments on commit 7f53268

Please sign in to comment.