slava-sh / rust-bundler Goto Github PK
View Code? Open in Web Editor NEWCreates a single-source-file version of a Cargo package
Home Page: https://crates.io/crates/bundler
License: MIT License
Creates a single-source-file version of a Cargo package
Home Page: https://crates.io/crates/bundler
License: MIT License
Along with the existing pretty print, it may be useful to support minified code output.
I assume this won't be especially difficult since you're already using syntax trees?
attempting to bundle the following file
fn f() {
let a = 0;
for x in 1..=a {}
}
causes a rustfmt failure:
error: expected `{`, found `=`
--> stdin:1:45
|
1 | fn spread_at ( ) { let a = 0 ; for x in 1 ..= a { } }
| ^
thread 'main' panicked at 'rustfmt returned no code', src/libcore/option.rs:1188:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
Notice, however, that manually running rustfmt on that snippet works.
I'm not sure if it's actually possible, but I think it'd be conveniant to specify the destination file via cargo.toml (with the src being implicitly lib.rs or main.rs already, although it could also be configured). Additionally (if possible), it'd be nice to have some kind of implicit build.rs ship with the bundler crate. (That is, rather than having to manually write or copy one into your project).
It was always one of the key motivations for me of porting my project to rust.
Do you know if it's possible? If you haven't already looked into it, I might fork your project and give it a go over the weekend.
When using lib-files withing same project the new syntax is
use crate::example
instead of
use {{crate_name}}::example
In my codingame template
if trying to create a new lib and use inside math.rs with the crate_name::example it will fail when trying to bundle.
Source code could be read from ~/.cargo/registry/src/github.com-xxx/{crate_name}-{version}
.
This would enable easily using libraries such as competitive-programming-rs
or easy_io
, and benefit from their updates.
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.