You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Discussion: split the crate into a Node-API-free core and a thin #[napi] crate for embedding #807
This is a discussion issue: would you accept splitting oxc-node into a Node-API-free core crate and a thin #[napi] crate on top, as oxc already does with oxc_transformer + oxc_transform_napi and oxc_resolver + oxc_resolver_napi?
Motivation
Vite+ compiles oxc-node's crate into its own Node-API addon, next to rolldown_binding, so that vpx script.ts runs oxc-node's hooks from the binary it already ships (vite-plus PR voidzero-dev/vite-plus#2936). napi-rs registers every #[napi] item of every linked crate into one module. oxc-node's exports collide with those of oxc_transform_napi, which Rolldown's binding links: both export transform and have a TransformTask. The duplicate export silently overwrites the other.
To link it today, Vite+ carries a patch that:
adds namespace = "oxcNode" to every top-level #[napi] item and renames TransformTask to OxcNodeTransformTask (13 of the patch's 30 hunks);
switches the crate to rlib without a build script.
With a core crate, an embedder depends on the core and writes its own bindings, and the napi crate keeps today's @oxc-node/core API unchanged. The allocator and module_init would stay in the napi crate.
What the core would need
create_resolve and load take Node-API types directly: Function for nextResolve/nextLoad, PromiseRaw for asynchronous results, and Env. The core would need a small abstraction over "call the next hook, possibly asynchronously", with the napi crate adapting it. OxcTransformer, the tsconfig source, and the format detection look independent of napi already.
A lighter alternative is a feature that sets a namespace through cfg_attr on each item, but that adds two attributes per item and only fixes the name collision.
Happy to help with the split if the direction works for you.
Activity
feat(core): gate the #[napi] items and mimalloc behind a `napi` featu…
build(oxc-node): link v0.1.7 without its napi feature and drop the patch
build(oxc-node): link v0.1.7 without its napi feature and drop the patch
build(oxc-node): link v0.1.7 without its napi feature and drop the patch
build(oxc-node): link v0.1.7 without its napi feature and drop the patch
build(oxc-node): link v0.1.7 without its napi feature and drop the patch
build(oxc-node): link v0.1.7 without its napi feature and drop the patch
build(oxc-node): link v0.1.7 without its napi feature and drop the patch
build(oxc-node): link v0.1.7 without its napi feature and drop the patch
build(oxc-node): link v0.1.7 without its napi feature and drop the patch
build(oxc-node): link v0.1.7 without its napi feature and drop the patch
build(oxc-node): link v0.1.7 without its napi feature and drop the patch
build(oxc-node): link v0.1.7 without its napi feature and drop the patch
build(oxc-node): link v0.1.7 without its napi feature and drop the patch
build(oxc-node): link v0.1.7 without its napi feature and drop the patch
build(oxc-node): link v0.1.7 without its napi feature and drop the patch
build(oxc-node): link v0.1.7 without its napi feature and drop the patch
feat(vpx): run TypeScript scripts with the vendored oxc-node (#2936)