diff --git a/CHANGELOG.md b/CHANGELOG.md index 52281ad5..feb555d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Bundle an unpublished `rquickjs` compatibility facade for dependencies such as LLRT to share the quickjs-jit types and VM. + - Add pre-generated bindings for `riscv64gc-unknown-linux-gnu` and `riscv64a23-unknown-linux-gnu` - JIT M2: Tier 1 and Tier 2 now support the remaining comparison, bitwise, shift, `%`, unary numeric, constant, stack-shuffle, tail-call, `null`, and empty-string opcodes; the JIT ABI diff --git a/Cargo.toml b/Cargo.toml index 75d4be6f..8c112632 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,7 @@ members = [ "jit", "benchmarks", "macro", + "compat/rquickjs", "examples/native-module", "examples/module-loader", "examples/import-attributes", diff --git a/README.md b/README.md index 0f169577..77e35c25 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,10 @@ and use Cargo source patches from that revision for both `quickjs-jit-core` and `quickjs-jit-sys`. Do not combine the published 0.12.2 runtime with 0.12.3 core or sys crates. +Dependencies that still name the `rquickjs` package, including LLRT, can use +the bundled [compatibility facade](compat/rquickjs/README.md). The consuming +workspace must select it with a root-level `[patch.crates-io]` entry. + [![github](https://img.shields.io/badge/github-longbridge/rquickjs-8da0cb.svg?style=for-the-badge&logo=github)](https://github.com/longbridge/rquickjs) [![crates](https://img.shields.io/crates/v/quickjs-jit.svg?style=for-the-badge&color=fc8d62&logo=rust)](https://crates.io/crates/quickjs-jit) [![docs](https://img.shields.io/badge/docs.rs-quickjs--jit-66c2a5?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K)](https://docs.rs/quickjs-jit) diff --git a/compat/rquickjs/Cargo.toml b/compat/rquickjs/Cargo.toml new file mode 100644 index 00000000..956b349d --- /dev/null +++ b/compat/rquickjs/Cargo.toml @@ -0,0 +1,35 @@ +[package] +name = "rquickjs" +version = "0.12.7" +edition = "2021" +rust-version = "1.87" +license = "MIT" +description = "Compatibility facade routing rquickjs dependencies to quickjs-jit" +publish = false + +[lib] +path = "src/lib.rs" + +[dependencies] +upstream = { package = "quickjs-jit", version = "0.12.7", path = "../..", default-features = false } + +[features] +default = ["std"] +std = ["upstream/std"] +chrono = ["upstream/chrono"] +either = ["upstream/either"] +indexmap = ["upstream/indexmap"] +phf = ["upstream/phf"] +bindgen = ["upstream/bindgen"] +parallel = ["upstream/parallel"] +loader = ["upstream/loader"] +dyn-load = ["upstream/dyn-load"] +rust-alloc = ["upstream/rust-alloc"] +macro = ["upstream/macro"] +half = ["upstream/half"] +bytes = ["upstream/bytes"] +futures = ["upstream/futures"] +classes = ["upstream/classes"] +array-buffer = ["upstream/array-buffer"] +allocator = ["upstream/allocator"] +properties = ["upstream/properties"] diff --git a/compat/rquickjs/README.md b/compat/rquickjs/README.md new file mode 100644 index 00000000..0c4514f1 --- /dev/null +++ b/compat/rquickjs/README.md @@ -0,0 +1,30 @@ +# rquickjs compatibility facade + +This unpublished package reexports `quickjs-jit` under the package name +`rquickjs`. Dependencies such as LLRT can keep their existing `rquickjs` +dependency while sharing the application's QuickJS types and VM. The facade +forwards features and performs no runtime conversion. + +For an application next to a local quickjs-jit checkout, configure its workspace +root as follows: + +```toml +[dependencies] +rquickjs = { package = "quickjs-jit", path = "../quickjs-jit" } +rquickjs-jit = { package = "quickjs-jit-runtime", path = "../quickjs-jit/jit", features = ["compiler"] } + +[patch.crates-io] +rquickjs = { path = "../quickjs-jit/compat/rquickjs" } +``` + +Cargo only applies patches declared by the consuming workspace root; declaring +this patch inside a library dependency does not redirect that library's consumers. +The facade satisfies compatible `rquickjs` 0.12 requirements, not older binding +versions. + +For a Git dependency, point all three entries to the same repository URL and +full commit revision containing this package. Cargo locates the named packages +within the repository. Keep the bindings, runtime, and facade on that same +source so they resolve to one `quickjs-jit-core` and `quickjs-jit-sys` instance. +The `rquickjs` package name belongs to upstream on crates.io, so this facade has +`publish = false` and is consumed through Git or a local path. diff --git a/compat/rquickjs/src/lib.rs b/compat/rquickjs/src/lib.rs new file mode 100644 index 00000000..0261be28 --- /dev/null +++ b/compat/rquickjs/src/lib.rs @@ -0,0 +1,3 @@ +//! Compatibility facade for dependencies that still name the upstream package. + +pub use upstream::*;