kuretchi / cargo-simple-bundler Goto Github PK
View Code? Open in Web Editor NEWPacks only necessary modules of the crate into a single file automatically.
License: Apache License 2.0
Packs only necessary modules of the crate into a single file automatically.
License: Apache License 2.0
"Inner macros" are commonly used, even in the original input!
by tanakh.
$ crate :: ident !
parts definitely mean the paths of macro_export
ed ones. they should be excluded.
#[macro_export]
macro_rules! foo {
() => {
$crate::foo_inner!()
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! foo_inner {
() => {
$crate::Foo
};
}
pub struct Foo;
❯ cargo simple-bundler --manifest-path ../lib/Cargo.toml -e ./src/main.rs
[WARN ] definition of `foo` not found in `crate`. treat as a dependency on the parent
mod lib {
#[macro_export]
macro_rules! foo {
() => {
$crate::lib::foo_inner!()
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! foo_inner {
() => {
$crate::lib::Foo
};
}
pub struct Foo;
}
...Or we may insert pub crate::{ re_export_macros }
in crate::lib
.
//use lib::foo;
fn main() {
let _ = foo!();
}
mod lib {
#![allow(unused_imports)]
pub(crate) use crate::{foo, foo_inner};
#[macro_export]
macro_rules! foo {
() => {
$crate::lib::foo_inner!()
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! foo_inner {
() => {
$crate::lib::Foo
};
}
pub struct Foo;
}
今までは「ライブラリクレートに対して実行し,必要なコードを抜粋する」コマンドだったのを,「(ライブラリに依存する) バイナリクレートに対して実行し,提出可能なコードを生成する」コマンドにしたい.
Before:
cargo simple-bundler --manifest-path /path/to/lib/one/Cargo.toml -e main.rs >one.rs
cargo simple-bundler --manifest-path /path/to/lib/two/Cargo.toml -e main.rs >two.rs
cat one.rs two.rs main.rs >bundled.rs
After:
cargo simple-bundler --crates one,two >bundled.rs
path
(や git
) のみ対応 / cargo-clone
などを使うA declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.