Skip to content

Commit

Permalink
merge core2 into core
Browse files Browse the repository at this point in the history
  • Loading branch information
oscartbeaumont committed Dec 27, 2023
1 parent 0b25409 commit bdb1820
Show file tree
Hide file tree
Showing 16 changed files with 72 additions and 73 deletions.
13 changes: 4 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ harness = false

[features]
default = ["typescript"]
typescript = ["rspc-core/typescript", "specta/typescript"] # TODO: Remove this
tracing = ["rspc-core/tracing", "dep:tracing"]
typescript = ["specta/typescript"] # TODO: Remove this
tracing = ["dep:tracing"]

unstable = ["rspc-core/unstable"] # APIs where one line of code can blow up your whole app # TODO: Drop this. No one cares about Spacedrive
unstable = [] # APIs where one line of code can blow up your whole app # TODO: Drop this. No one cares about Spacedrive

[dependencies]
# rspc-core = { path = "./crates/core" }
rspc-core2 = { path = "./crates/core2" }
rspc-core = { version = "0.0.1", path = "./crates/core" }
specta = { workspace = true }

serde = { workspace = true }
Expand All @@ -42,10 +41,6 @@ pin-project-lite = "0.2.13"
serde_json = { version = "1", default-features = false }
tracing = { version = "0.1.40", default-features = false, optional = true }

# Even though this `cfg` can never be enabled, it still forces cargo to keep `rspc-core` in lockstep with `rspc`.
[target.'cfg(any())'.dependencies]
rspc-core = { version = "=1.0.0-rc.5", path = "./crates/core" }

[dev-dependencies]
# Tests
async-stream = "0.3.5"
Expand Down
71 changes: 43 additions & 28 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,33 +1,48 @@
[package]
name = "rspc-core"
version = "1.0.0-rc.5"
version = "0.0.1"
edition = "2021"

# TODO: Remove all features from this crate cause they mean we can optimise build time
[features]
default = []
typescript = ["specta/typescript"]
tracing = ["dep:tracing"]
unstable = []
publish = false # TODO

[dependencies]
rspc-core2 = { path = "../core2" }

# TODO: Drop the `specta` dependency

specta = { workspace = true, features = ["typescript"] } # TODO: `typescript` should be required
serde = { workspace = true }
thiserror = { workspace = true }
futures = { version = "0.3.28", default-features = false, features = ["std", "async-await"] } # TODO: Drop for `futures_core` if possible
pin-project-lite = "0.2.13"
serde_json = { version = "1", default-features = false }
streamunordered = "0.5.3"

# TODO: Remove these from core
tracing = { version = "0.1.40", default-features = false, optional = true }

# TODO: Make something like this work
# # Even though this `cfg` can never be enabled, it still forces cargo to keep `rspc-core` in lockstep with `rspc-*`.
# [target.'cfg(any())'.dependencies]
# rspc-httpz = { version = "=1.0.0-rc.5", path = "../httpz" }
# rspc-tauri = { version = "=1.0.0-rc.5", path = "../tauri" }
# Public API
futures-core = "0.3"
serde = "1"

# Private API
erased-serde = "0.4.1"

[dev-dependencies]
tokio = { version = "1", features = ["full"] }
serde_json = "1" # TODO: Remove this
futures = "0.3"


# # TODO: Remove all features from this crate cause they mean we can optimise build time
# [features]
# default = []
# typescript = ["specta/typescript"]
# tracing = ["dep:tracing"]
# unstable = []

# [dependencies]
# rspc-core2 = { path = "../core2" }

# # TODO: Drop the `specta` dependency

# specta = { workspace = true, features = ["typescript"] } # TODO: `typescript` should be required
# serde = { workspace = true }
# thiserror = { workspace = true }
# futures = { version = "0.3.28", default-features = false, features = ["std", "async-await"] } # TODO: Drop for `futures_core` if possible
# pin-project-lite = "0.2.13"
# serde_json = { version = "1", default-features = false }
# streamunordered = "0.5.3"

# # TODO: Remove these from core
# tracing = { version = "0.1.40", default-features = false, optional = true }

# # TODO: Make something like this work
# # # Even though this `cfg` can never be enabled, it still forces cargo to keep `rspc-core` in lockstep with `rspc-*`.
# # [target.'cfg(any())'.dependencies]
# # rspc-httpz = { version = "=1.0.0-rc.5", path = "../httpz" }
# # rspc-tauri = { version = "=1.0.0-rc.5", path = "../tauri" }
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,17 @@
#![warn(unsafe_code)]
#![allow(clippy::module_inception)]
#![cfg_attr(docsrs, feature(doc_cfg))]

mod executor;
mod format;
#[doc(hidden)]
pub mod internal;
mod router;
mod serializer;
mod task;

pub use executor::{Executor, Procedure};
pub use format::{Format, TODOSerializer};
pub use router::Router;
pub use serializer::Serializer;
pub use task::Task;
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion crates/core2/tests/basic.rs → crates/core/tests/basic.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{pin::Pin, sync::Arc};

use futures::StreamExt;
use rspc_core2::{Executor, Format, Procedure, TODOSerializer};
use rspc_core::{Executor, Format, Procedure, TODOSerializer};
use serde_json::Value;

#[tokio::test]
Expand Down
13 changes: 0 additions & 13 deletions crates/core2/TODO

This file was deleted.

14 changes: 0 additions & 14 deletions crates/core2/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
//! rspc core

// TODO: Clippy lints

mod executor;
mod format;
#[doc(hidden)]
pub mod internal;
mod router;
mod serializer;
mod task;

pub use executor::{Executor, Procedure};
pub use format::{Format, TODOSerializer};
pub use router::Router;
pub use serializer::Serializer;
pub use task::Task;
2 changes: 1 addition & 1 deletion crates/httpz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ workers = ["httpz/workers", "httpz/ws"]
vercel = ["httpz/vercel", "httpz/ws", "axum"] # TODO: Shouldn't rely on Axum

[dependencies]
rspc-core = { version = "1.0.0-rc.5", path = "../core", default-features = false }
rspc-core = { version = "0.0.1", path = "../core", default-features = false }
httpz = { version = "0.0.6", default-features = false, features = ["cookies"] }
tokio = { version = "1", default-features = false, features = ["sync"] }
serde_json = "1.0.107"
Expand Down
6 changes: 4 additions & 2 deletions crates/tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ version = "1.0.0-rc.5"
edition = "2021"

[dependencies] # TODO: Typescript support should be optional
rspc-core = { version = "0.0.1", path = "../core", default-features = false, features = [] }
futures = "0.3.28"
rspc-core = { version = "1.0.0-rc.5", path = "../core", default-features = false, features = ["typescript"] } # TODO: Avoid typescript features
serde = { workspace = true, features = ["derive"] }
serde_json = "1.0.107"
tauri = { version = "1.5.2", default-features = false, features = ["wry"] } # TODO: Work without wry
tauri = { version = "1.5.2", default-features = false, features = ["wry"] } # TODO: Work without wry

# TODO: Remove these
tauri-specta = { version = "=2.0.0-rc.4", default-features = false, features = ["typescript"] }
specta = { workspace = true }
2 changes: 1 addition & 1 deletion src/internal2.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::pin::Pin;

use rspc_core2::{Format, TODOSerializer};
use rspc_core::{Format, TODOSerializer};
use serde_json::Value;

pub(crate) struct SerdeJsonFormat {}
Expand Down
8 changes: 4 additions & 4 deletions src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::{

use crate::{error::ExportError, export_config::ExportConfig};

use rspc_core2::Executor;
use rspc_core::Executor;
use specta::{
ts::{self, FormatterFn},
TypeMap,
Expand Down Expand Up @@ -145,11 +145,11 @@ where
}
}

impl<TCtx> rspc_core2::internal::SealedRouter for Router<TCtx> {}
impl<TCtx> rspc_core2::Router for Router<TCtx> {
impl<TCtx> rspc_core::internal::SealedRouter for Router<TCtx> {}
impl<TCtx> rspc_core::Router for Router<TCtx> {
type Ctx = TCtx;

fn build(self) -> rspc_core2::Executor {
fn build(self) -> rspc_core::Executor {
let mut executor = Executor::new();

for (name, procedure) in self.queries {
Expand Down

0 comments on commit bdb1820

Please sign in to comment.