mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-05-06 07:26:43 -04:00
c83f55f65e
# Description of Changes This PR moves most of the contents of `@clockworklabs/spacetimedb-sdk` into the `spacetimedb` module. The `spacetimedb` module now exports `sdk` and `server` as separate subpaths where `sdk` contains the code which was previously in `@clockworklabs/spacetimedb-sdk`. In particular it makes the following moves: - `/sdks/typescript/packages/sdk` -> `/sdks/typescript` - most of the contents of `/sdks/typescript/packages/sdk` -> `crates/bindings-typescript` - `/sdks/typescript/packages/test-app` -> `crates/bindings-typescript/test-app` The following packags was NOT moved: `/sdks/typescript/examples/quickstart-chat` ## Motivation In accordance with https://github.com/clockworklabs/SpacetimeDB/issues/3250, we would like to consolidate `@clockworklabs/spacetimedb-sdk` into a single `spacetimedb` package so that users can import the different things they need from a single package. ### Pros: - allow users to install a single package with subpaths `spacetimedb`, `spacetimedb/react`, `spacetimedb/sdk`, `spacetimedb/server`, etc. - Is much simpler for bundling, etc. - Is backwards compatible with `@clockworklabs/spacetimedb-sdk` which now becomes a thin wrapper - eventually allow us to break up the `spacetimedb` package into other packages if we want to split them up (e.g. `@spacetimedb/lib`, `@spacetimedb/sdk`, etc.) and we can solve the build complexity that introduces when we get to it - eventually allow us to move `bindings-csharp` out of the crates directory where it probably doesn't belong anyway - organizes all TypeScript packages into the packages directory where you'd normally expect them, with the possible exception of `/sdks/typescript` if we wanted to leave that separate ### Cons: - The `sdk` directory is now a bit of a ruse as to where the code actually lives since it's just a thin wrapper. If it eventually becomes its own independent package, we'll also have to break up spacetimedb into `@spacetimedb/lib` and `@spacetimedb/server` so that `@clockworklabs/spacetimedb-sdk` can depend on `@spacetimedb/lib` while being a dependency of `spacetimedb`. Ideally this change would have been made later, however, it became necessary for the following **heinously disastrous chain of forcing moves**: 1. Adding `react` support necessitated shipping react as an optional peer dependency under `@clockworklabs/spacetimedb-sdk/react` 2. This required adding a new build target/export/bundle 3. Previously `@clockworklabs/spacetimedb-sdk` was configured to have `noExternal` for `spacetimedb` meaning it would collect the library into the sdk bundle. I attempted to continue this for react support but... 4. Creating a new `react` bundle which also pulled in `spacetimedb` caused their to be nominal type conflicts between classes in the duplicate `spacetimedb` bundles. 5. Changing `spacetimedb` to be included as `external` caused compile errors because `@clockworklabs/spacetimedb-sdk` is configured in `tsconfig.json` to fail on unused variables and it was now including the source of `spacetimedb` which is not configured to error on unused variables and has "unused" private variables which are actually used by us secretly, but not exposed to the clients. > SIDE NOTE: The unused variables settings cannot be turned off on a line by line basis, so it has to be turned off entirely, but in order to maintain the linting checks we had I used `eslint` to enforce the rule so that we could disable it line by line. (This caused me to discover quite a lot of things that were broken that were caught by `eslint` being applied to the entire project. `eslint` was previously only applied to the `quickstart-chat` and the `crates/bindings-typescript` library) 6. Changing the build to be external, now requires `spacetimedb` to also be published to npm as its own module which `@clockworklabs/spacetimedb-sdk` now imports, which requires that we add `tsup` config to `spacetimedb` to publish a built version of the library. 7. The only way to avoid that is to move the `sdk` and `react` code from `@clockworklabs/spacetimedb-sdk` into the existing `spacetimedb` package to avoid the duplicate import problem on step 4 and change `@clockworklabs/spacetimedb-sdk` back to again use `noExternal` for its `spacetimedb` dependency. And here we are. I chose not to move `/crates/bindings-typescript` even though that's probably not a great place long term. It would be better to have it in `/packages/spacetimedb` or `/npm-packages/spacetimedb` or `/ts-packages/spacetimedb` or something, and move all our TypeScript packages in there. But that is a different matter. The net result however is that we have a new `spacetimedb` package which exports the different parts of the API under: - `spacetimedb` - `spacetimedb/server` - `spacetimedb/sdk` - `spacetimedb/react` while still not breaking the existing deploy process, nor any users/developers who are currently using `@clockworklabs/spacetimedb-sdk`. I think long term should we ever decide to split `spacetimedb` up into multiple packages or if we have additional unrelated packages, we should publish them to the `@spacetimedb` org which I reserved for us here: https://www.npmjs.com/org/spacetimedb > NOTE: `spacetimedb` is a package and `@spacetimedb` is an org. `spacetimedb/sdk` is not a separate package, it's a subpath export of the `spacetimedb` package, whereas `@spacetimedb/sdk` would be (and would need to be) it's own separate package. You can certainly have both `spacetimedb/sdk` and `@spacetimedb/sdk`. We could for example host the code for the sdk at `@spacetimedb/sdk` and just reexport it from `spacetimedb` under the `spacetimedb/sdk` subpath. # API and ABI breaking changes This should not change or modify the API or ABI in any way. If it does so accidentally it is a bug, although I carefully went through the exports. # Expected complexity level and risk 3 because it changes how the SDK is built a bit and rearranges a lot of paths. # Testing - [x] All of the CI passes - [x] I also ran quickstart-chat to confirm that it is not broken - [x] I also ran test-app
343 lines
11 KiB
TOML
343 lines
11 KiB
TOML
[workspace]
|
|
members = [
|
|
"crates/auth",
|
|
"crates/bench",
|
|
"crates/bindings-sys",
|
|
"crates/bindings",
|
|
"crates/bindings-macro",
|
|
"crates/cli",
|
|
"crates/client-api",
|
|
"crates/client-api-messages",
|
|
"crates/commitlog",
|
|
"crates/core",
|
|
"crates/data-structures",
|
|
"crates/datastore",
|
|
"crates/durability",
|
|
"crates/execution",
|
|
"crates/expr",
|
|
"crates/fs-utils",
|
|
"crates/lib",
|
|
"crates/metrics",
|
|
"crates/paths",
|
|
"crates/pg",
|
|
"crates/physical-plan",
|
|
"crates/primitives",
|
|
"crates/query",
|
|
"crates/sats",
|
|
"crates/schema",
|
|
"sdks/rust",
|
|
"crates/snapshot",
|
|
"crates/sqltest",
|
|
"crates/sql-parser",
|
|
"crates/standalone",
|
|
"crates/subscription",
|
|
"crates/table",
|
|
"crates/testing",
|
|
"crates/update",
|
|
"crates/vm",
|
|
"modules/benchmarks",
|
|
"modules/keynote-benchmarks",
|
|
"modules/perf-test",
|
|
"modules/module-test",
|
|
"modules/quickstart-chat",
|
|
"modules/sdk-test",
|
|
"modules/sdk-test-connect-disconnect",
|
|
"sdks/rust/tests/test-client",
|
|
"sdks/rust/tests/test-counter",
|
|
"sdks/rust/tests/connect_disconnect_client",
|
|
"tools/upgrade-version",
|
|
"tools/license-check",
|
|
"crates/bindings-typescript/test-app/server",
|
|
]
|
|
default-members = ["crates/cli", "crates/standalone", "crates/update"]
|
|
# cargo feature graph resolver. v3 is default in edition2024 but workspace
|
|
# manifests don't have editions.
|
|
resolver = "3"
|
|
|
|
[profile.release]
|
|
opt-level = 3
|
|
debug-assertions = false
|
|
overflow-checks = false
|
|
lto = "thin"
|
|
panic = 'unwind'
|
|
incremental = false
|
|
codegen-units = 16
|
|
rpath = false
|
|
|
|
[profile.release-fast]
|
|
inherits = "release"
|
|
lto = "thin"
|
|
|
|
[profile.dev]
|
|
opt-level = 0
|
|
debug = true
|
|
debug-assertions = true
|
|
overflow-checks = true
|
|
lto = false
|
|
panic = 'unwind'
|
|
incremental = true
|
|
codegen-units = 256
|
|
rpath = false
|
|
|
|
[profile.bench]
|
|
debug = true
|
|
|
|
[profile.test]
|
|
opt-level = 1
|
|
debug = true
|
|
|
|
[profile.profiling]
|
|
inherits = "release"
|
|
debug = true
|
|
|
|
[workspace.package]
|
|
version = "1.4.0"
|
|
edition = "2021"
|
|
# update rust-toolchain.toml too!
|
|
rust-version = "1.88.0"
|
|
|
|
[workspace.dependencies]
|
|
spacetimedb = { path = "crates/bindings", version = "1.4.0" }
|
|
spacetimedb-auth = { path = "crates/auth", version = "1.4.0" }
|
|
spacetimedb-bindings-macro = { path = "crates/bindings-macro", version = "1.4.0" }
|
|
spacetimedb-bindings-sys = { path = "crates/bindings-sys", version = "1.4.0" }
|
|
spacetimedb-cli = { path = "crates/cli", version = "1.4.0" }
|
|
spacetimedb-client-api = { path = "crates/client-api", version = "1.4.0" }
|
|
spacetimedb-client-api-messages = { path = "crates/client-api-messages", version = "1.4.0" }
|
|
spacetimedb-codegen = { path = "crates/codegen", version = "1.4.0" }
|
|
spacetimedb-commitlog = { path = "crates/commitlog", version = "1.4.0" }
|
|
spacetimedb-core = { path = "crates/core", version = "1.4.0" }
|
|
spacetimedb-data-structures = { path = "crates/data-structures", version = "1.4.0" }
|
|
spacetimedb-datastore = { path = "crates/datastore", version = "1.4.0" }
|
|
spacetimedb-durability = { path = "crates/durability", version = "1.4.0" }
|
|
spacetimedb-execution = { path = "crates/execution", version = "1.4.0" }
|
|
spacetimedb-expr = { path = "crates/expr", version = "1.4.0" }
|
|
spacetimedb-lib = { path = "crates/lib", default-features = false, version = "1.4.0" }
|
|
spacetimedb-memory-usage = { path = "crates/memory-usage", version = "1.4.0", default-features = false }
|
|
spacetimedb-metrics = { path = "crates/metrics", version = "1.4.0" }
|
|
spacetimedb-paths = { path = "crates/paths", version = "1.4.0" }
|
|
spacetimedb-pg = { path = "crates/pg", version = "1.4.0" }
|
|
spacetimedb-physical-plan = { path = "crates/physical-plan", version = "1.4.0" }
|
|
spacetimedb-primitives = { path = "crates/primitives", version = "1.4.0" }
|
|
spacetimedb-query = { path = "crates/query", version = "1.4.0" }
|
|
spacetimedb-sats = { path = "crates/sats", version = "1.4.0" }
|
|
spacetimedb-schema = { path = "crates/schema", version = "1.4.0" }
|
|
spacetimedb-standalone = { path = "crates/standalone", version = "1.4.0" }
|
|
spacetimedb-sql-parser = { path = "crates/sql-parser", version = "1.4.0" }
|
|
spacetimedb-table = { path = "crates/table", version = "1.4.0" }
|
|
spacetimedb-vm = { path = "crates/vm", version = "1.4.0" }
|
|
spacetimedb-fs-utils = { path = "crates/fs-utils", version = "1.4.0" }
|
|
spacetimedb-snapshot = { path = "crates/snapshot", version = "1.4.0" }
|
|
spacetimedb-subscription = { path = "crates/subscription", version = "1.4.0" }
|
|
|
|
# Prevent `ahash` from pulling in `getrandom` by disabling default features.
|
|
# Modules use `getrandom02` and we need to prevent an incompatible version
|
|
# from appearing in module dependency graphs.
|
|
ahash = { version = "0.8", default-features = false, features = ["std"] }
|
|
anyhow = "1.0.68"
|
|
anymap = "0.12"
|
|
arrayvec = "0.7.2"
|
|
async-stream = "0.3.6"
|
|
async-trait = "0.1.68"
|
|
axum = { version = "0.7", features = ["tracing"] }
|
|
axum-extra = { version = "0.9", features = ["typed-header"] }
|
|
backtrace = "0.3.66"
|
|
base64 = "0.21.2"
|
|
bigdecimal = "0.4.7"
|
|
bitflags = "2.3.3"
|
|
blake3 = "1.5.1"
|
|
brotli = "3.5"
|
|
byte-unit = "4.0.18"
|
|
bytemuck = { version = "1.16.2", features = ["must_cast"] }
|
|
bytes = "1.10.1"
|
|
bytestring = { version = "1.2.0", features = ["serde"] }
|
|
cargo_metadata = "0.17.0"
|
|
chrono = { version = "0.4.24", default-features = false }
|
|
clap = { version = "4.2.4", features = ["derive", "wrap_help"] }
|
|
clap-markdown = "0.1.4"
|
|
colored = "2.0.0"
|
|
console = { version = "0.15.6" }
|
|
convert_case = "0.6.0"
|
|
crc32c = "0.6.4"
|
|
criterion = { version = "0.5.1", features = ["async", "async_tokio", "html_reports"] }
|
|
crossbeam-channel = "0.5"
|
|
crossbeam-queue = "0.3.12"
|
|
cursive = { version = "0.20", default-features = false, features = ["crossterm-backend"] }
|
|
decorum = { version = "0.3.1", default-features = false, features = ["std"] }
|
|
derive_more = "0.99"
|
|
dialoguer = { version = "0.11", default-features = false }
|
|
dirs = "5.0.1"
|
|
duct = "0.13.5"
|
|
either = "1.9"
|
|
email_address = "0.2.4"
|
|
enum-as-inner = "0.6"
|
|
enum-map = "2.6.3"
|
|
env_logger = "0.10"
|
|
ethnum = { version = "1.5.0", features = ["serde"] }
|
|
flate2 = "1.0.24"
|
|
foldhash = "0.1.4"
|
|
fs-err = "2.9.0"
|
|
fs_extra = "1.3.0"
|
|
fs2 = "0.4.3"
|
|
futures = "0.3"
|
|
futures-channel = "0.3"
|
|
getrandom02 = { package = "getrandom", version = "0.2" }
|
|
glob = "0.3.1"
|
|
hashbrown = { version = "0.15", default-features = false, features = ["equivalent", "inline-more"] }
|
|
headers = "0.4"
|
|
heck = "0.4"
|
|
hex = "0.4.3"
|
|
home = "0.5"
|
|
hostname = "^0.3"
|
|
http = "1.0"
|
|
humantime = "2.1.0"
|
|
hyper = "1.0"
|
|
hyper-util = { version = "0.1", features = ["tokio"] }
|
|
imara-diff = "0.1.3"
|
|
indexmap = "2.0.0"
|
|
indicatif = "0.17"
|
|
insta = { version = "1.21.0", features = ["toml", "filters"] }
|
|
is-terminal = "0.4"
|
|
itertools = "0.12"
|
|
itoa = "1"
|
|
jsonwebtoken = { package = "spacetimedb-jsonwebtoken", version = "9.3.0" }
|
|
junction = "1"
|
|
jwks = { package = "spacetimedb-jwks", version = "0.1.3" }
|
|
lazy_static = "1.4.0"
|
|
log = "0.4.17"
|
|
memchr = "2"
|
|
mimalloc = "0.1.39"
|
|
nohash-hasher = "0.2"
|
|
nix = "0.30"
|
|
once_cell = "1.16"
|
|
parking_lot = { version = "0.12.1", features = ["send_guard", "arc_lock"] }
|
|
parse-size = "1.1.0"
|
|
paste = "1.0"
|
|
percent-encoding = "2.3"
|
|
petgraph = { version = "0.6.5", default-features = false }
|
|
pin-project-lite = "0.2.9"
|
|
pgwire = { version = "0.32", features = ["server-api"] }
|
|
postgres-types = "0.2.5"
|
|
pretty_assertions = { version = "1.4", features = ["unstable"] }
|
|
proc-macro2 = "1.0"
|
|
prometheus = "0.13.0"
|
|
proptest = "1.4"
|
|
proptest-derive = "0.5"
|
|
quick-junit = { version = "0.3.2" }
|
|
quote = "1.0.8"
|
|
rand08 = { package = "rand", version = "0.8" }
|
|
rand = "0.9"
|
|
rayon = "1.8"
|
|
rayon-core = "1.11.0"
|
|
regex = "1"
|
|
reqwest = { version = "0.12", features = ["stream", "json"] }
|
|
ron = "0.8"
|
|
rusqlite = { version = "0.29.0", features = ["bundled", "column_decltype"] }
|
|
rust_decimal = { version = "1.29.1", features = ["db-tokio-postgres"] }
|
|
rustc-demangle = "0.1.21"
|
|
rustc-hash = "2"
|
|
rustyline = { version = "12.0.0", features = [] }
|
|
scoped-tls = "1.0.1"
|
|
scopeguard = "1.1.0"
|
|
second-stack = "0.3"
|
|
self-replace = "1.5"
|
|
semver = "1"
|
|
serde = { version = "1.0.136", features = ["derive"] }
|
|
serde_json = { version = "1.0.128", features = ["raw_value", "arbitrary_precision"] }
|
|
serde_path_to_error = "0.1.9"
|
|
serde_with = { version = "3.3.0", features = ["base64", "hex"] }
|
|
serial_test = "2.0.0"
|
|
sha1 = "0.10.1"
|
|
sha3 = "0.10.0"
|
|
similar = "2.3"
|
|
slab = "0.4.7"
|
|
sled = "0.34.7"
|
|
smallvec = { version = "1.11", features = ["union", "const_generics"] }
|
|
socket2 = "0.5"
|
|
sqllogictest = "0.17"
|
|
sqllogictest-engines = "0.17"
|
|
sqlparser = "0.38.0"
|
|
strum = { version = "0.25.0", features = ["derive"] }
|
|
syn = { version = "2", features = ["full", "extra-traits"] }
|
|
syntect = { version = "5.0.0", default-features = false, features = ["default-fancy"] }
|
|
tabled = "0.14.0"
|
|
tar = "0.4"
|
|
tempdir = "0.3.7"
|
|
tempfile = "3.20"
|
|
termcolor = "1.2.0"
|
|
thin-vec = "0.2.13"
|
|
thiserror = "1.0.37"
|
|
tokio = { version = "1.37", features = ["full"] }
|
|
tokio_metrics = { version = "0.4.0" }
|
|
tokio-postgres = { version = "0.7.8", features = ["with-chrono-0_4"] }
|
|
tokio-stream = "0.1.17"
|
|
tokio-tungstenite = { version = "0.27.0", features = ["native-tls", "url"] }
|
|
tokio-util = { version = "0.7.4", features = ["time"] }
|
|
toml = "0.8"
|
|
toml_edit = "0.22.22"
|
|
tower-http = { version = "0.5", features = ["cors"] }
|
|
tower-layer = "0.3"
|
|
tower-service = "0.3"
|
|
tracing = "0.1.37"
|
|
tracing-appender = "0.2.2"
|
|
tracing-core = "0.1.31"
|
|
tracing-flame = "0.2.0"
|
|
tracing-log = "0.1.3"
|
|
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
|
|
trybuild = "1"
|
|
typed-arena = "2.0"
|
|
unicode-ident = "1.0.12"
|
|
unicode-normalization = "0.1.23"
|
|
url = "2.3.1"
|
|
urlencoding = "2.1.2"
|
|
uuid = { version = "1.2.1", features = ["v4"] }
|
|
v8 = "137.2"
|
|
walkdir = "2.2.5"
|
|
wasmbin = "0.6"
|
|
webbrowser = "1.0.2"
|
|
windows-sys = "0.59"
|
|
xdg = "2.5"
|
|
tikv-jemallocator = { version = "0.6.0", features = ["profiling", "stats"] }
|
|
tikv-jemalloc-ctl = { version = "0.6.0", features = ["stats"] }
|
|
jemalloc_pprof = { version = "0.8", features = ["symbolize", "flamegraph"] }
|
|
zstd-framed = { version = "0.1.1", features = ["tokio"] }
|
|
|
|
# Vendor the openssl we rely on, rather than depend on a
|
|
# potentially very old system version.
|
|
openssl = { version = "0.10", features = ["vendored"] }
|
|
|
|
[workspace.dependencies.wasmtime]
|
|
version = "25"
|
|
default-features = false
|
|
features = [
|
|
"addr2line",
|
|
"cache",
|
|
"cranelift",
|
|
"demangle",
|
|
"parallel-compilation",
|
|
"runtime",
|
|
"std",
|
|
]
|
|
|
|
[workspace.dependencies.tracing-tracy]
|
|
version = "0.10.4"
|
|
# We use the "ondemand" feature to allow connecting after the start,
|
|
# and reconnecting, from the tracy client to the database.
|
|
# TODO(George): Need to be able to remove "broadcast" in some build configurations.
|
|
features = [
|
|
"enable",
|
|
"system-tracing",
|
|
"context-switch-tracing",
|
|
"sampling",
|
|
"code-transfer",
|
|
"broadcast",
|
|
"ondemand",
|
|
]
|
|
|
|
[workspace.lints.rust]
|
|
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tokio_unstable)'] }
|
|
|
|
[workspace.lints.clippy]
|
|
# FIXME: we should work on this lint incrementally
|
|
result_large_err = "allow"
|