Skip to content

Commit

Permalink
feat: init project with cargo and pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
wumingliang.0113 committed Jun 26, 2022
1 parent b130501 commit 9f6842a
Show file tree
Hide file tree
Showing 37 changed files with 1,962 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[source.crates-io]
replace-with = 'rsproxy'

[source.rsproxy]
registry = "https://rsproxy.cn/crates.io-index"

[registries.rsproxy]
index = "https://rsproxy.cn/crates.io-index"

[net]
git-fetch-with-cli = true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ dist

# TernJS port file
.tern-port

# Rust
target
220 changes: 220 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[workspace]
members = ["crates/*"]
4 changes: 4 additions & 0 deletions crates/compiler/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[package]
name = "farmfe_compiler"
version = "0.0.1"
edition = "2021"
1 change: 1 addition & 0 deletions crates/compiler/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub struct Compiler {}
4 changes: 4 additions & 0 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[package]
name = "farmfe_core"
version = "0.0.1"
edition = "2021"
1 change: 1 addition & 0 deletions crates/core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub struct Core {}
18 changes: 18 additions & 0 deletions crates/node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
edition = "2021"
name = "farmfe_node"
version = "0.0.0"

[lib]
crate-type = ["cdylib"]

[dependencies]
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
napi = { version = "2.5.0", default-features = false, features = ["napi4"] }
napi-derive = "2.5.0"

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

[profile.release]
lto = true
5 changes: 5 additions & 0 deletions crates/node/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
extern crate napi_build;

fn main() {
napi_build::setup();
}
19 changes: 19 additions & 0 deletions crates/node/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#![deny(clippy::all)]

#[macro_use]
extern crate napi_derive;

fn sum(a: i32, b: i32) -> i32 {
a + b
}

#[napi]
pub struct JsCompiler {}

#[napi]
impl JsCompiler {
#[napi]
pub fn js_sum(&self, a: i32, b: i32) -> napi::Result<i32> {
Ok(sum(a, b))
}
}
4 changes: 4 additions & 0 deletions crates/plugin_script/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[package]
name = "farmfe_plugin_script"
version = "0.0.1"
edition = "2021"
2 changes: 2 additions & 0 deletions crates/plugin_script/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// ScriptPlugin is used to support compiling js/ts/jsx/tsx files to js chunks
pub struct ScriptPlugin {}
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "farm-fe",
"version": "0.0.0",
"description": "Farm is modern web building tool written in rust"
}
Loading

0 comments on commit 9f6842a

Please sign in to comment.