forked from swc-project/swc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(swc/cli): setup packages for binary
- relates with swc-project#1589
- Loading branch information
Showing
5 changed files
with
172 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[package] | ||
description = "Commandline for swc" | ||
name = "swc_cli" | ||
version = "0.1.0" | ||
edition = "2018" | ||
include = ["Cargo.toml", "src/**/*.rs"] | ||
license = "Apache-2.0" | ||
repository = "https://github.com/swc-project/swc.git" | ||
|
||
[[bin]] | ||
name = "swc" | ||
path = "./src/main.rs" | ||
|
||
[dependencies] | ||
structopt = { version = "0.3.25", features = [ "paw" ] } | ||
paw = "1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use std::path::PathBuf; | ||
|
||
use structopt::StructOpt; | ||
|
||
/// Transform, compile files. | ||
#[derive(Debug, StructOpt)] | ||
pub struct CompileCommand { | ||
///Filename to use when reading from stdin - this will be used in | ||
/// source-maps, errors etc | ||
#[structopt(short = "f", long = "filename")] | ||
file_name: String, | ||
/// Path to a .swcrc file to use | ||
#[structopt(parse(from_os_str), long = "config-file")] | ||
config_file: PathBuf, | ||
/// The name of the 'env' to use when loading configs and plugins. | ||
/// Defaults to the value of SWC_ENV, or else NODE_ENV, or else | ||
/// 'development'. | ||
/// | ||
/// DEPRECATED: use --env flag instead. | ||
#[structopt(long = "env-name")] | ||
env_name: String, | ||
} | ||
|
||
#[derive(StructOpt, Debug)] | ||
#[structopt(about = "Speedy Web Compiler")] | ||
pub enum SwcCommand { | ||
Compile(CompileCommand), | ||
} | ||
|
||
impl SwcCommand { | ||
pub fn execute(self) { | ||
match self { | ||
SwcCommand::Compile(..) => {} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
mod cli; | ||
use cli::SwcCommand; | ||
|
||
#[paw::main] | ||
fn main(_args: SwcCommand) { | ||
unimplemented!("Not yet implemented"); | ||
} |
3bd39cf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark
full_es2015
182299461
ns/iter (± 8454174
)212228240
ns/iter (± 13402065
)0.86
full_es2016
148956617
ns/iter (± 5268846
)171122089
ns/iter (± 8132561
)0.87
full_es2017
154073215
ns/iter (± 7646499
)176956616
ns/iter (± 10868566
)0.87
full_es2018
153649761
ns/iter (± 7578505
)182009461
ns/iter (± 14116946
)0.84
full_es2019
152282422
ns/iter (± 6306303
)178790557
ns/iter (± 13087427
)0.85
full_es2020
151772302
ns/iter (± 5921664
)176094444
ns/iter (± 12410554
)0.86
full_es3
209505400
ns/iter (± 10292911
)248924019
ns/iter (± 15435628
)0.84
full_es5
193253757
ns/iter (± 8006621
)228712871
ns/iter (± 17165264
)0.84
parser
693350
ns/iter (± 19589
)864849
ns/iter (± 99594
)0.80
This comment was automatically generated by workflow using github-action-benchmark.