Skip to content

Commit

Permalink
Merge pull request #24 from svg-rust/linux
Browse files Browse the repository at this point in the history
Linux
  • Loading branch information
SyMind committed Jul 8, 2023
2 parents 65a5b84 + 2c72212 commit 5eb9743
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions crates/binding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ svgr-rs = { path = "../core", features = ["node"] }

[build-dependencies]
napi-build = "2.0.1"

[profile.release]
lto = true
8 changes: 4 additions & 4 deletions crates/binding/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
extern crate napi_derive;

use swc_core::node::get_deserialized;
use svgr_rs::{transform as transform_core, Config, State};
use svgr_rs::{transform, Config, State};

#[napi]
pub async fn transform(code: String, config: napi::bindgen_prelude::Buffer, state: Option<State>) -> napi::bindgen_prelude::Result<String> {
#[napi(js_name = "transform")]
pub async fn transform_node(code: String, config: napi::bindgen_prelude::Buffer, state: Option<State>) -> napi::bindgen_prelude::Result<String> {
let config: Config = get_deserialized(&config)?;
let state = match state {
Some(state) => state,
None => Default::default()
};
match transform_core(code, config, state) {
match transform(code, config, state) {
Ok(result) => napi::bindgen_prelude::Result::Ok(result),
Err(reason) => napi::bindgen_prelude::Result::Err(napi::bindgen_prelude::Error::from_reason(reason)),
}
Expand Down
2 changes: 1 addition & 1 deletion npm/linux-x64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@svgr-rs/linux-x64-gnu",
"name": "@svgr-rs/core-linux-x64-gnu",
"version": "0.0.0",
"os": [
"linux"
Expand Down

0 comments on commit 5eb9743

Please sign in to comment.