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

chore: clean up deps and remove once_cell #105

Merged
merged 1 commit into from
Nov 3, 2024
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
1 change: 1 addition & 0 deletions serde_json_path/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#93]: https://github.com/hiltontj/serde_json_path/pull/93
[#98]: https://github.com/hiltontj/serde_json_path/pull/98
[i-json-range]: https://www.rfc-editor.org/rfc/rfc9535.html#section-2.1-4.1
[#105]: https://github.com/hiltontj/serde_json_path/pull/105

# 0.6.7 (3 March 2024)

Expand Down
18 changes: 10 additions & 8 deletions serde_json_path/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,19 @@ trace = ["dep:tracing", "serde_json_path_core/trace"]
functions = ["serde_json_path_core/functions"]

[dependencies]
inventory = { version = "0.3.4" }
# crates.io crates:
inventory = { version = "0.3.15" }
nom = "7.1.3"
once_cell = { version = "1.17.1" }
regex = { version="1.7.1", optional = true }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
regex = { version="1.11.1", optional = true }
serde = { version = "1.0.214", features = ["derive"] }
serde_json = "1.0.1"
thiserror = "1.0.67"
tracing = { version = "0.1.40", optional = true }

# local crates:
serde_json_path_core = { path = "../serde_json_path_core", version = "0.1.6" }
serde_json_path_macros = { path = "../serde_json_path_macros", version = "0.1.4" }
thiserror = "1.0"
tracing = { version = "0.1", optional = true }

[dev-dependencies]
test-log = { version = "0.2.11", default-features = false, features=["trace"] }
tracing-subscriber = { version = "0.3", default-features = false, features=["env-filter", "fmt"] }
tracing-subscriber = { version = "0.3.18", default-features = false, features=["env-filter", "fmt"] }
28 changes: 14 additions & 14 deletions serde_json_path/src/parser/selector/function/registry.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::collections::HashMap;
use std::{collections::HashMap, sync::LazyLock};

use once_cell::sync::Lazy;
use serde_json::Value;
use serde_json_path_core::spec::functions::{Function, LogicalType, NodesType, ValueType};

Expand All @@ -15,18 +14,19 @@ use serde_json_path_core::spec::functions::{Function, LogicalType, NodesType, Va
/// the return type for each function registered here. When adding new functions to
/// the register, i.e., when new functions are standardized, the function there needs
/// to be updated too.
pub(crate) static REGISTRY: Lazy<HashMap<&'static str, &'static Function>> = Lazy::new(|| {
let mut m = HashMap::new();
m.insert("length", &LENGTH_FUNC);
m.insert("count", &COUNT_FUNC);
#[cfg(feature = "regex")]
{
m.insert("match", &MATCH_FUNC);
m.insert("search", &SEARCH_FUNC);
}
m.insert("value", &VALUE_FUNC);
m
});
pub(crate) static REGISTRY: LazyLock<HashMap<&'static str, &'static Function>> =
LazyLock::new(|| {
let mut m = HashMap::new();
m.insert("length", &LENGTH_FUNC);
m.insert("count", &COUNT_FUNC);
#[cfg(feature = "regex")]
{
m.insert("match", &MATCH_FUNC);
m.insert("search", &SEARCH_FUNC);
}
m.insert("value", &VALUE_FUNC);
m
});

fn value_length(value: &Value) -> Option<usize> {
match value {
Expand Down
2 changes: 2 additions & 0 deletions serde_json_path_core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
# Unreleased

- **breaking**: ensure integers used as indices are within the [valid range for I-JSON][i-json-range] ([#98])
- **internal**: remove use of `once_cell` and use specific versions for crate dependencies ([#105])

[#98]: https://github.com/hiltontj/serde_json_path/pull/98
[i-json-range]: https://www.rfc-editor.org/rfc/rfc9535.html#section-2.1-4.1
[#105]: https://github.com/hiltontj/serde_json_path/pull/105

# 0.1.6 (3 March 2024)

Expand Down
11 changes: 5 additions & 6 deletions serde_json_path_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ trace = ["dep:tracing"]
functions = []

[dependencies]
inventory = { version = "0.3.4" }
once_cell = "1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
thiserror = "1.0"
tracing = { version = "0.1", optional = true }
inventory = { version = "0.3.15" }
serde = { version = "1.0.214", features = ["derive"] }
serde_json = "1.0.1"
thiserror = "1.0.67"
tracing = { version = "0.1.40", optional = true }

[dev-dependencies]
serde_json_path = { path = "../serde_json_path" }
Expand Down
6 changes: 3 additions & 3 deletions serde_json_path_core/src/spec/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@
use std::{
collections::VecDeque,
ops::{Deref, DerefMut},
sync::LazyLock,
};

use once_cell::sync::Lazy;
use serde_json::Value;

use crate::{node::NodeList, spec::query::Queryable};
Expand All @@ -151,11 +151,11 @@ use super::{

#[doc(hidden)]
pub type Validator =
Lazy<Box<dyn Fn(&[FunctionExprArg]) -> Result<(), FunctionValidationError> + Send + Sync>>;
LazyLock<Box<dyn Fn(&[FunctionExprArg]) -> Result<(), FunctionValidationError> + Send + Sync>>;

#[doc(hidden)]
pub type Evaluator =
Lazy<Box<dyn for<'a> Fn(VecDeque<JsonPathValue<'a>>) -> JsonPathValue<'a> + Sync + Send>>;
LazyLock<Box<dyn for<'a> Fn(VecDeque<JsonPathValue<'a>>) -> JsonPathValue<'a> + Sync + Send>>;

#[doc(hidden)]
#[allow(missing_debug_implementations)]
Expand Down
8 changes: 6 additions & 2 deletions serde_json_path_macros/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

# Unreleased

- **internal**: remove use of `once_cell` and use specific versions for crate dependencies ([#105])

[#105]: https://github.com/hiltontj/serde_json_path/pull/105

# 0.1.4 (3 March 2024)

- **testing**: support tests for non-determinism in compliance test suite ([#85])
- **fixed**: bug preventing registered functions from being used as arguments to other functions ([#84])
- **testing**: support tests for non-determinism in compliance test suite ([#85])

[#85]: https://github.com/hiltontj/serde_json_path/pull/85
[#84]: https://github.com/hiltontj/serde_json_path/pull/84
[#85]: https://github.com/hiltontj/serde_json_path/pull/85

# 0.1.3 (23 February 2024)

Expand Down
3 changes: 1 addition & 2 deletions serde_json_path_macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ keywords = ["json", "jsonpath", "json_path", "serde", "serde_json"]
[lib]

[dependencies]
inventory = "0.3.15"
serde_json_path_macros_internal = { path = "src/internal", version = "0.1.1" }
serde_json_path_core = { path = "../serde_json_path_core", version = "0.1.6" }
inventory = "0.3"
once_cell = "1"

[dev-dependencies]
serde_json = "1"
Expand Down
6 changes: 3 additions & 3 deletions serde_json_path_macros/src/internal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ proc-macro = true
path = "mod.rs"

[dependencies]
proc-macro2 = "1.0"
quote = "1.0"
syn = { version = "2.0", features = ["full"] }
proc-macro2 = "1.0.89"
quote = "1.0.37"
syn = { version = "2.0.87", features = ["full"] }
2 changes: 1 addition & 1 deletion serde_json_path_macros/src/internal/common/define.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub(crate) fn expand(input: ItemFn, name_str: Option<LitStr>) -> Result<Expanded
let args_len = args.len();
// Generate token streams for some needed types:
let lazy = quote! {
::serde_json_path_macros::once_cell::sync::Lazy
std::sync::LazyLock
};
let core = quote! {
::serde_json_path_macros::serde_json_path_core::spec::functions
Expand Down
3 changes: 0 additions & 3 deletions serde_json_path_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,5 @@ pub use serde_json_path_macros_internal::register;
#[doc(hidden)]
pub use ::inventory;

#[doc(hidden)]
pub use ::once_cell;

#[doc(hidden)]
pub use ::serde_json_path_core;