mirror of
https://github.com/denoland/deno.git
synced 2025-01-12 00:54:02 -05:00
feat: dprint formatter (#3820)
* rewrite fmt_test in Rust, remove tools/fmt_test.py * remove //std/prettier
This commit is contained in:
parent
f0a6062012
commit
73a3cc21d0
58 changed files with 868 additions and 34336 deletions
|
@ -1,6 +1,5 @@
|
||||||
cli/compilers/wasm_wrap.js
|
cli/compilers/wasm_wrap.js
|
||||||
cli/tests/error_syntax.js
|
cli/tests/error_syntax.js
|
||||||
std/deno.d.ts
|
std/deno.d.ts
|
||||||
std/prettier/vendor
|
|
||||||
std/**/testdata/
|
std/**/testdata/
|
||||||
std/**/node_modules/
|
std/**/node_modules/
|
||||||
|
|
599
Cargo.lock
generated
599
Cargo.lock
generated
|
@ -5,6 +5,14 @@ name = "adler32"
|
||||||
version = "1.0.4"
|
version = "1.0.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ahash"
|
||||||
|
version = "0.2.18"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"const-random 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aho-corasick"
|
name = "aho-corasick"
|
||||||
version = "0.7.6"
|
version = "0.7.6"
|
||||||
|
@ -41,6 +49,19 @@ name = "arrayvec"
|
||||||
version = "0.5.1"
|
version = "0.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ast_node"
|
||||||
|
version = "0.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"darling 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"pmutil 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"swc_macros_common 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "async-compression"
|
name = "async-compression"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
@ -63,6 +84,11 @@ dependencies = [
|
||||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "autocfg"
|
||||||
|
version = "0.1.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
|
@ -181,6 +207,15 @@ name = "cfg-if"
|
||||||
version = "0.1.10"
|
version = "0.1.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "chashmap"
|
||||||
|
version = "2.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "2.33.0"
|
version = "2.33.0"
|
||||||
|
@ -203,6 +238,24 @@ dependencies = [
|
||||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "const-random"
|
||||||
|
version = "0.1.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"const-random-macro 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "const-random-macro"
|
||||||
|
version = "0.1.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "constant_time_eq"
|
name = "constant_time_eq"
|
||||||
version = "0.1.5"
|
version = "0.1.5"
|
||||||
|
@ -247,6 +300,38 @@ dependencies = [
|
||||||
"sct 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"sct 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "darling"
|
||||||
|
version = "0.10.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"darling_core 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"darling_macro 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "darling_core"
|
||||||
|
version = "0.10.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"ident_case 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"strsim 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "darling_macro"
|
||||||
|
version = "0.10.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"darling_core 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "deno"
|
name = "deno"
|
||||||
version = "0.31.0"
|
version = "0.31.0"
|
||||||
|
@ -262,8 +347,10 @@ dependencies = [
|
||||||
"deno_typescript 0.31.0",
|
"deno_typescript 0.31.0",
|
||||||
"dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"dlopen 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"dlopen 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"dprint-plugin-typescript 0.3.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"fwdansi 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fwdansi 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"indexmap 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"indexmap 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -364,11 +451,33 @@ name = "downcast-rs"
|
||||||
version = "1.1.1"
|
version = "1.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dprint-core"
|
||||||
|
version = "0.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dprint-plugin-typescript"
|
||||||
|
version = "0.3.0-alpha.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"dprint-core 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"swc_common 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"swc_ecma_ast 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"swc_ecma_parser 0.17.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dtoa"
|
name = "dtoa"
|
||||||
version = "0.4.4"
|
version = "0.4.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "either"
|
||||||
|
version = "1.5.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "encoding_rs"
|
name = "encoding_rs"
|
||||||
version = "0.8.22"
|
version = "0.8.22"
|
||||||
|
@ -377,6 +486,17 @@ dependencies = [
|
||||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "enum_kind"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"pmutil 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"swc_macros_common 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "failure"
|
name = "failure"
|
||||||
version = "0.1.6"
|
version = "0.1.6"
|
||||||
|
@ -413,6 +533,17 @@ name = "fnv"
|
||||||
version = "1.0.6"
|
version = "1.0.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "from_variant"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"pmutil 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"swc_macros_common 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fuchsia-cprng"
|
name = "fuchsia-cprng"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
|
@ -541,6 +672,11 @@ dependencies = [
|
||||||
"wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "glob"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "h2"
|
name = "h2"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
|
@ -559,6 +695,15 @@ dependencies = [
|
||||||
"tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hashbrown"
|
||||||
|
version = "0.6.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"ahash 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "heck"
|
name = "heck"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
|
@ -646,6 +791,11 @@ dependencies = [
|
||||||
"tokio 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tokio 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ident_case"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "idna"
|
name = "idna"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
@ -704,6 +854,15 @@ name = "libc"
|
||||||
version = "0.2.66"
|
version = "0.2.66"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lock_api"
|
||||||
|
version = "0.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.8"
|
version = "0.4.8"
|
||||||
|
@ -717,6 +876,11 @@ name = "matches"
|
||||||
version = "0.1.8"
|
version = "0.1.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "maybe-uninit"
|
||||||
|
version = "2.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.3.0"
|
version = "2.3.0"
|
||||||
|
@ -813,6 +977,11 @@ dependencies = [
|
||||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "new_debug_unreachable"
|
||||||
|
version = "1.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nix"
|
name = "nix"
|
||||||
version = "0.14.1"
|
version = "0.14.1"
|
||||||
|
@ -834,6 +1003,34 @@ dependencies = [
|
||||||
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-bigint"
|
||||||
|
version = "0.2.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-integer"
|
||||||
|
version = "0.1.42"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-traits"
|
||||||
|
version = "0.2.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num_cpus"
|
name = "num_cpus"
|
||||||
version = "1.12.0"
|
version = "1.12.0"
|
||||||
|
@ -857,11 +1054,85 @@ dependencies = [
|
||||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "owning_ref"
|
||||||
|
version = "0.3.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "owning_ref"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "parking_lot"
|
||||||
|
version = "0.4.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "parking_lot"
|
||||||
|
version = "0.7.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "parking_lot_core"
|
||||||
|
version = "0.2.14"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "parking_lot_core"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "percent-encoding"
|
name = "percent-encoding"
|
||||||
version = "2.1.0"
|
version = "2.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "phf_generator"
|
||||||
|
version = "0.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"phf_shared 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "phf_shared"
|
||||||
|
version = "0.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"siphasher 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pin-project"
|
name = "pin-project"
|
||||||
version = "0.4.6"
|
version = "0.4.6"
|
||||||
|
@ -890,11 +1161,26 @@ name = "pin-utils"
|
||||||
version = "0.1.0-alpha.4"
|
version = "0.1.0-alpha.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pmutil"
|
||||||
|
version = "0.5.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ppv-lite86"
|
name = "ppv-lite86"
|
||||||
version = "0.2.6"
|
version = "0.2.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "precomputed-hash"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro-hack"
|
name = "proc-macro-hack"
|
||||||
version = "0.5.11"
|
version = "0.5.11"
|
||||||
|
@ -954,6 +1240,24 @@ dependencies = [
|
||||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand"
|
||||||
|
version = "0.6.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand"
|
name = "rand"
|
||||||
version = "0.7.3"
|
version = "0.7.3"
|
||||||
|
@ -964,6 +1268,16 @@ dependencies = [
|
||||||
"rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_chacha"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -996,6 +1310,14 @@ dependencies = [
|
||||||
"getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_hc"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand_hc"
|
name = "rand_hc"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
@ -1004,6 +1326,24 @@ dependencies = [
|
||||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_isaac"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_jitter"
|
||||||
|
version = "0.1.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand_os"
|
name = "rand_os"
|
||||||
version = "0.1.3"
|
version = "0.1.3"
|
||||||
|
@ -1017,6 +1357,31 @@ dependencies = [
|
||||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_pcg"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_pcg"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_xorshift"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rdrand"
|
name = "rdrand"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
|
@ -1130,6 +1495,14 @@ name = "rustc-demangle"
|
||||||
version = "0.1.16"
|
version = "0.1.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustc_version"
|
||||||
|
version = "0.2.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustls"
|
name = "rustls"
|
||||||
version = "0.16.0"
|
version = "0.16.0"
|
||||||
|
@ -1196,6 +1569,16 @@ dependencies = [
|
||||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "scoped-tls"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "scopeguard"
|
||||||
|
version = "0.3.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sct"
|
name = "sct"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
|
@ -1224,6 +1607,19 @@ dependencies = [
|
||||||
"core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "semver"
|
||||||
|
version = "0.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "semver-parser"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.104"
|
version = "1.0.104"
|
||||||
|
@ -1273,11 +1669,24 @@ dependencies = [
|
||||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "siphasher"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "slab"
|
name = "slab"
|
||||||
version = "0.4.2"
|
version = "0.4.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "smallvec"
|
||||||
|
version = "0.6.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smallvec"
|
name = "smallvec"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
|
@ -1313,11 +1722,142 @@ name = "spin"
|
||||||
version = "0.5.2"
|
version = "0.5.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "stable_deref_trait"
|
||||||
|
version = "1.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "string_cache"
|
||||||
|
version = "0.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"new_debug_unreachable 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"phf_shared 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "string_cache_codegen"
|
||||||
|
version = "0.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"phf_generator 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"phf_shared 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "string_enum"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"pmutil 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"swc_macros_common 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strsim"
|
name = "strsim"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "strsim"
|
||||||
|
version = "0.9.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "swc_atoms"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"string_cache 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"string_cache_codegen 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "swc_common"
|
||||||
|
version = "0.4.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"ast_node 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"chashmap 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"from_variant 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"hashbrown 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"string_cache 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "swc_ecma_ast"
|
||||||
|
version = "0.15.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"enum_kind 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"num-bigint 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"string_enum 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"swc_atoms 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"swc_common 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "swc_ecma_parser"
|
||||||
|
version = "0.17.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"enum_kind 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"num-bigint 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"regex 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"smallvec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"swc_atoms 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"swc_common 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"swc_ecma_ast 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"swc_ecma_parser_macros 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "swc_ecma_parser_macros"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"pmutil 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"swc_macros_common 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "swc_macros_common"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"pmutil 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "0.15.44"
|
version = "0.15.44"
|
||||||
|
@ -1782,14 +2322,17 @@ dependencies = [
|
||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
"checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2"
|
"checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2"
|
||||||
|
"checksum ahash 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "6f33b5018f120946c1dcf279194f238a9f146725593ead1c08fa47ff22b0b5d3"
|
||||||
"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d"
|
"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d"
|
||||||
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
||||||
"checksum anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)" = "7825f6833612eb2414095684fcf6c635becf3ce97fe48cf6421321e93bfbd53c"
|
"checksum anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)" = "7825f6833612eb2414095684fcf6c635becf3ce97fe48cf6421321e93bfbd53c"
|
||||||
"checksum arc-swap 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d7b8a9123b8027467bce0099fe556c628a53c8d83df0507084c31e9ba2e39aff"
|
"checksum arc-swap 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d7b8a9123b8027467bce0099fe556c628a53c8d83df0507084c31e9ba2e39aff"
|
||||||
"checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee"
|
"checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee"
|
||||||
"checksum arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8"
|
"checksum arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8"
|
||||||
|
"checksum ast_node 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d96b5937e2a8b8dd9eac561c192f7fef2ab0cbc06c445e67b9e637ab158c52b"
|
||||||
"checksum async-compression 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2c5c52622726d68ec35fec88edfb4ccb862d4f3b3bfa4af2f45142e69ef9b220"
|
"checksum async-compression 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2c5c52622726d68ec35fec88edfb4ccb862d4f3b3bfa4af2f45142e69ef9b220"
|
||||||
"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
||||||
|
"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
|
||||||
"checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
|
"checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
|
||||||
"checksum backtrace 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)" = "b4b1549d804b6c73f4817df2ba073709e96e426f12987127c48e6745568c350b"
|
"checksum backtrace 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)" = "b4b1549d804b6c73f4817df2ba073709e96e426f12987127c48e6745568c350b"
|
||||||
"checksum backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6575f128516de27e3ce99689419835fce9643a9b215a14d2b5b685be018491"
|
"checksum backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6575f128516de27e3ce99689419835fce9643a9b215a14d2b5b685be018491"
|
||||||
|
@ -1807,25 +2350,36 @@ dependencies = [
|
||||||
"checksum cargo_gn 0.0.15 (registry+https://github.com/rust-lang/crates.io-index)" = "5ba7d7f7b201dfcbc314b14f2176c92f8ba521dab538b40e426ffed25ed7cd80"
|
"checksum cargo_gn 0.0.15 (registry+https://github.com/rust-lang/crates.io-index)" = "5ba7d7f7b201dfcbc314b14f2176c92f8ba521dab538b40e426ffed25ed7cd80"
|
||||||
"checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd"
|
"checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd"
|
||||||
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||||
|
"checksum chashmap 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ff41a3c2c1e39921b9003de14bf0439c7b63a9039637c291e1a64925d8ddfa45"
|
||||||
"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
|
"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
|
||||||
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
|
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
|
||||||
|
"checksum const-random 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "2f1af9ac737b2dd2d577701e59fd09ba34822f6f2ebdb30a7647405d9e55e16a"
|
||||||
|
"checksum const-random-macro 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "25e4c606eb459dd29f7c57b2e0879f2b6f14ee130918c2b78ccb58a9624e6c7a"
|
||||||
"checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
|
"checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
|
||||||
"checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d"
|
"checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d"
|
||||||
"checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b"
|
"checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b"
|
||||||
"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
|
"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
|
||||||
"checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6"
|
"checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6"
|
||||||
"checksum ct-logs 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4d3686f5fa27dbc1d76c751300376e167c5a43387f44bb451fd1c24776e49113"
|
"checksum ct-logs 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4d3686f5fa27dbc1d76c751300376e167c5a43387f44bb451fd1c24776e49113"
|
||||||
|
"checksum darling 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858"
|
||||||
|
"checksum darling_core 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b"
|
||||||
|
"checksum darling_macro 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72"
|
||||||
"checksum dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3"
|
"checksum dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3"
|
||||||
"checksum dirs-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b"
|
"checksum dirs-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b"
|
||||||
"checksum dlopen 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "71e80ad39f814a9abe68583cd50a2d45c8a67561c3361ab8da240587dda80937"
|
"checksum dlopen 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "71e80ad39f814a9abe68583cd50a2d45c8a67561c3361ab8da240587dda80937"
|
||||||
"checksum dlopen_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f236d9e1b1fbd81cea0f9cbdc8dcc7e8ebcd80e6659cd7cb2ad5f6c05946c581"
|
"checksum dlopen_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f236d9e1b1fbd81cea0f9cbdc8dcc7e8ebcd80e6659cd7cb2ad5f6c05946c581"
|
||||||
"checksum downcast-rs 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "52ba6eb47c2131e784a38b726eb54c1e1484904f013e576a25354d0124161af6"
|
"checksum downcast-rs 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "52ba6eb47c2131e784a38b726eb54c1e1484904f013e576a25354d0124161af6"
|
||||||
|
"checksum dprint-core 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5415007772b0b0b447be0f0e748d0c1e55b4eb038ab5a606d12ba9feac7caa30"
|
||||||
|
"checksum dprint-plugin-typescript 0.3.0-alpha.1 (registry+https://github.com/rust-lang/crates.io-index)" = "98421a795f88b5b6da8d3e64fd66aeb34d636a7a2dc33e3e603f228ccd9679af"
|
||||||
"checksum dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e"
|
"checksum dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e"
|
||||||
|
"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
|
||||||
"checksum encoding_rs 0.8.22 (registry+https://github.com/rust-lang/crates.io-index)" = "cd8d03faa7fe0c1431609dfad7bbe827af30f82e1e2ae6f7ee4fca6bd764bc28"
|
"checksum encoding_rs 0.8.22 (registry+https://github.com/rust-lang/crates.io-index)" = "cd8d03faa7fe0c1431609dfad7bbe827af30f82e1e2ae6f7ee4fca6bd764bc28"
|
||||||
|
"checksum enum_kind 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6e57153e35187d51f08471d5840459ff29093473e7bedd004a1414985aab92f3"
|
||||||
"checksum failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9"
|
"checksum failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9"
|
||||||
"checksum failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08"
|
"checksum failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08"
|
||||||
"checksum flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6bd6d6f4752952feb71363cffc9ebac9411b75b87c6ab6058c40c8900cf43c0f"
|
"checksum flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6bd6d6f4752952feb71363cffc9ebac9411b75b87c6ab6058c40c8900cf43c0f"
|
||||||
"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
|
"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
|
||||||
|
"checksum from_variant 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "039885ad6579a86b94ad8df696cce8c530da496bf7b07b12fec8d6c4cd654bb9"
|
||||||
"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
|
"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
|
||||||
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
|
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
|
||||||
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
|
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
|
||||||
|
@ -1841,7 +2395,9 @@ dependencies = [
|
||||||
"checksum futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0d66274fb76985d3c62c886d1da7ac4c0903a8c9f754e8fe0f35a6a6cc39e76"
|
"checksum futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0d66274fb76985d3c62c886d1da7ac4c0903a8c9f754e8fe0f35a6a6cc39e76"
|
||||||
"checksum fwdansi 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08c1f5787fe85505d1f7777268db5103d80a7a374d2316a7ce262e57baf8f208"
|
"checksum fwdansi 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08c1f5787fe85505d1f7777268db5103d80a7a374d2316a7ce262e57baf8f208"
|
||||||
"checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
|
"checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
|
||||||
|
"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
||||||
"checksum h2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b9433d71e471c1736fd5a61b671fc0b148d7a2992f666c958d03cd8feb3b88d1"
|
"checksum h2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b9433d71e471c1736fd5a61b671fc0b148d7a2992f666c958d03cd8feb3b88d1"
|
||||||
|
"checksum hashbrown 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8e6073d0ca812575946eb5f35ff68dbe519907b25c42530389ff946dc84c6ead"
|
||||||
"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
|
"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
|
||||||
"checksum hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eff2656d88f158ce120947499e971d743c05dbcbed62e5bd2f38f1698bbc3772"
|
"checksum hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eff2656d88f158ce120947499e971d743c05dbcbed62e5bd2f38f1698bbc3772"
|
||||||
"checksum http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b708cc7f06493459026f53b9a61a7a121a5d1ec6238dee58ea4941132b30156b"
|
"checksum http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b708cc7f06493459026f53b9a61a7a121a5d1ec6238dee58ea4941132b30156b"
|
||||||
|
@ -1849,6 +2405,7 @@ dependencies = [
|
||||||
"checksum httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9"
|
"checksum httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9"
|
||||||
"checksum hyper 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8bf49cfb32edee45d890537d9057d1b02ed55f53b7b6a30bae83a38c9231749e"
|
"checksum hyper 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8bf49cfb32edee45d890537d9057d1b02ed55f53b7b6a30bae83a38c9231749e"
|
||||||
"checksum hyper-rustls 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b89109920197f2c90d75e82addbb96bf424570790d310cc2b18f0b33f4a9cc43"
|
"checksum hyper-rustls 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b89109920197f2c90d75e82addbb96bf424570790d310cc2b18f0b33f4a9cc43"
|
||||||
|
"checksum ident_case 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
||||||
"checksum idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9"
|
"checksum idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9"
|
||||||
"checksum indexmap 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b54058f0a6ff80b6803da8faf8997cde53872b38f4023728f6830b06cd3c0dc"
|
"checksum indexmap 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b54058f0a6ff80b6803da8faf8997cde53872b38f4023728f6830b06cd3c0dc"
|
||||||
"checksum iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e"
|
"checksum iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e"
|
||||||
|
@ -1857,8 +2414,10 @@ dependencies = [
|
||||||
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||||
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||||
"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
|
"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
|
||||||
|
"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c"
|
||||||
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
|
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
|
||||||
"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
||||||
|
"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
|
||||||
"checksum memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3197e20c7edb283f87c071ddfc7a2cca8f8e0b888c242959846a6fce03c72223"
|
"checksum memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3197e20c7edb283f87c071ddfc7a2cca8f8e0b888c242959846a6fce03c72223"
|
||||||
"checksum mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
|
"checksum mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
|
||||||
"checksum mime_guess 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1a0ed03949aef72dbdf3116a383d7b38b4768e6f960528cd6a6044aa9ed68599"
|
"checksum mime_guess 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1a0ed03949aef72dbdf3116a383d7b38b4768e6f960528cd6a6044aa9ed68599"
|
||||||
|
@ -1869,17 +2428,31 @@ dependencies = [
|
||||||
"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
|
"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
|
||||||
"checksum miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226"
|
"checksum miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226"
|
||||||
"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88"
|
"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88"
|
||||||
|
"checksum new_debug_unreachable 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54"
|
||||||
"checksum nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6c722bee1037d430d0f8e687bbdbf222f27cc6e4e68d5caf630857bb2b6dbdce"
|
"checksum nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6c722bee1037d430d0f8e687bbdbf222f27cc6e4e68d5caf630857bb2b6dbdce"
|
||||||
"checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6"
|
"checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6"
|
||||||
|
"checksum num-bigint 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304"
|
||||||
|
"checksum num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba"
|
||||||
|
"checksum num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096"
|
||||||
"checksum num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46203554f085ff89c235cd12f7075f3233af9b11ed7c9e16dfe2560d03313ce6"
|
"checksum num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46203554f085ff89c235cd12f7075f3233af9b11ed7c9e16dfe2560d03313ce6"
|
||||||
"checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
|
"checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
|
||||||
"checksum os_pipe 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "db4d06355a7090ce852965b2d08e11426c315438462638c6d721448d0b47aa22"
|
"checksum os_pipe 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "db4d06355a7090ce852965b2d08e11426c315438462638c6d721448d0b47aa22"
|
||||||
|
"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
|
||||||
|
"checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13"
|
||||||
|
"checksum parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "149d8f5b97f3c1133e3cfcd8886449959e856b557ff281e292b733d7c69e005e"
|
||||||
|
"checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337"
|
||||||
|
"checksum parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa"
|
||||||
|
"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9"
|
||||||
"checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
|
"checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
|
||||||
|
"checksum phf_generator 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526"
|
||||||
|
"checksum phf_shared 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7"
|
||||||
"checksum pin-project 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "94b90146c7216e4cb534069fb91366de4ea0ea353105ee45ed297e2d1619e469"
|
"checksum pin-project 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "94b90146c7216e4cb534069fb91366de4ea0ea353105ee45ed297e2d1619e469"
|
||||||
"checksum pin-project-internal 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "44ca92f893f0656d3cba8158dd0f2b99b94de256a4a54e870bd6922fcc6c8355"
|
"checksum pin-project-internal 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "44ca92f893f0656d3cba8158dd0f2b99b94de256a4a54e870bd6922fcc6c8355"
|
||||||
"checksum pin-project-lite 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e8822eb8bb72452f038ebf6048efa02c3fe22bf83f76519c9583e47fc194a422"
|
"checksum pin-project-lite 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e8822eb8bb72452f038ebf6048efa02c3fe22bf83f76519c9583e47fc194a422"
|
||||||
"checksum pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587"
|
"checksum pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587"
|
||||||
|
"checksum pmutil 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3894e5d549cccbe44afecf72922f277f603cd4bb0219c8342631ef18fffbe004"
|
||||||
"checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b"
|
"checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b"
|
||||||
|
"checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
|
||||||
"checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5"
|
"checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5"
|
||||||
"checksum proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e"
|
"checksum proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e"
|
||||||
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
||||||
|
@ -1887,13 +2460,21 @@ dependencies = [
|
||||||
"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
|
"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
|
||||||
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
|
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
|
||||||
"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
|
"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
|
||||||
|
"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
|
||||||
"checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
|
"checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
|
||||||
|
"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"
|
||||||
"checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853"
|
"checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853"
|
||||||
"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
|
"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
|
||||||
"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
|
"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
|
||||||
"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
|
"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
|
||||||
|
"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4"
|
||||||
"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
|
"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
|
||||||
|
"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08"
|
||||||
|
"checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b"
|
||||||
"checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071"
|
"checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071"
|
||||||
|
"checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44"
|
||||||
|
"checksum rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429"
|
||||||
|
"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c"
|
||||||
"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
|
"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
|
||||||
"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
|
"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
|
||||||
"checksum redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ecedbca3bf205f8d8f5c2b44d83cd0690e39ee84b951ed649e9f1841132b66d"
|
"checksum redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ecedbca3bf205f8d8f5c2b44d83cd0690e39ee84b951ed649e9f1841132b66d"
|
||||||
|
@ -1904,27 +2485,45 @@ dependencies = [
|
||||||
"checksum ring 0.16.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6747f8da1f2b1fabbee1aaa4eb8a11abf9adef0bf58a41cee45db5d59cecdfac"
|
"checksum ring 0.16.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6747f8da1f2b1fabbee1aaa4eb8a11abf9adef0bf58a41cee45db5d59cecdfac"
|
||||||
"checksum rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ca4eaef519b494d1f2848fc602d18816fed808a981aedf4f1f00ceb7c9d32cf"
|
"checksum rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ca4eaef519b494d1f2848fc602d18816fed808a981aedf4f1f00ceb7c9d32cf"
|
||||||
"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
|
"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
|
||||||
|
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
||||||
"checksum rustls 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b25a18b1bf7387f0145e7f8324e700805aade3842dd3db2e74e4cdeb4677c09e"
|
"checksum rustls 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b25a18b1bf7387f0145e7f8324e700805aade3842dd3db2e74e4cdeb4677c09e"
|
||||||
"checksum rustls-native-certs 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "51ffebdbb48c14f84eba0b715197d673aff1dd22cc1007ca647e28483bbcc307"
|
"checksum rustls-native-certs 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "51ffebdbb48c14f84eba0b715197d673aff1dd22cc1007ca647e28483bbcc307"
|
||||||
"checksum rusty_v8 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8ed9530934df58a5be648916e142858b473558a0df6356b59e083c1c3c2f7d32"
|
"checksum rusty_v8 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8ed9530934df58a5be648916e142858b473558a0df6356b59e083c1c3c2f7d32"
|
||||||
"checksum rustyline 5.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a23cb19702a8d6afb6edb3c842386e680d4883760e0df74e6848e23c2a87a635"
|
"checksum rustyline 5.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a23cb19702a8d6afb6edb3c842386e680d4883760e0df74e6848e23c2a87a635"
|
||||||
"checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8"
|
"checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8"
|
||||||
"checksum schannel 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "87f550b06b6cba9c8b8be3ee73f391990116bf527450d2556e9b9ce263b9a021"
|
"checksum schannel 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "87f550b06b6cba9c8b8be3ee73f391990116bf527450d2556e9b9ce263b9a021"
|
||||||
|
"checksum scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
|
||||||
|
"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
|
||||||
"checksum sct 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e3042af939fca8c3453b7af0f1c66e533a15a86169e39de2657310ade8f98d3c"
|
"checksum sct 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e3042af939fca8c3453b7af0f1c66e533a15a86169e39de2657310ade8f98d3c"
|
||||||
"checksum security-framework 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8ef2429d7cefe5fd28bd1d2ed41c944547d4ff84776f5935b456da44593a16df"
|
"checksum security-framework 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8ef2429d7cefe5fd28bd1d2ed41c944547d4ff84776f5935b456da44593a16df"
|
||||||
"checksum security-framework-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e31493fc37615debb8c5090a7aeb4a9730bc61e77ab10b9af59f1a202284f895"
|
"checksum security-framework-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e31493fc37615debb8c5090a7aeb4a9730bc61e77ab10b9af59f1a202284f895"
|
||||||
|
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
||||||
|
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||||
"checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449"
|
"checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449"
|
||||||
"checksum serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64"
|
"checksum serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64"
|
||||||
"checksum serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)" = "48c575e0cc52bdd09b47f330f646cf59afc586e9c4e3ccd6fc1f625b8ea1dad7"
|
"checksum serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)" = "48c575e0cc52bdd09b47f330f646cf59afc586e9c4e3ccd6fc1f625b8ea1dad7"
|
||||||
"checksum serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97"
|
"checksum serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97"
|
||||||
"checksum signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41"
|
"checksum signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41"
|
||||||
|
"checksum siphasher 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "83da420ee8d1a89e640d0948c646c1c088758d3a3c538f943bfa97bdac17929d"
|
||||||
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
||||||
|
"checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6"
|
||||||
"checksum smallvec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44e59e0c9fa00817912ae6e4e6e3c4fe04455e75699d06eedc7d85917ed8e8f4"
|
"checksum smallvec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44e59e0c9fa00817912ae6e4e6e3c4fe04455e75699d06eedc7d85917ed8e8f4"
|
||||||
"checksum socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85"
|
"checksum socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85"
|
||||||
"checksum source-map-mappings 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "89babfa6891f638e3e30c5dd248368937015b627a9704aaa8c9d3b9177bf8bfa"
|
"checksum source-map-mappings 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "89babfa6891f638e3e30c5dd248368937015b627a9704aaa8c9d3b9177bf8bfa"
|
||||||
"checksum sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf77cb82ba8453b42b6ae1d692e4cdc92f9a47beaf89a847c8be83f4e328ad3"
|
"checksum sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf77cb82ba8453b42b6ae1d692e4cdc92f9a47beaf89a847c8be83f4e328ad3"
|
||||||
"checksum spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
|
"checksum spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
|
||||||
|
"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
|
||||||
|
"checksum string_cache 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2940c75beb4e3bf3a494cef919a747a2cb81e52571e212bfbd185074add7208a"
|
||||||
|
"checksum string_cache_codegen 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f24c8e5e19d22a726626f1a5e16fe15b132dcf21d10177fa5a45ce7962996b97"
|
||||||
|
"checksum string_enum 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94fdb6536756cfd35ee18b9a9972ab2a699d405cc57e0ad0532022960f30d581"
|
||||||
"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
||||||
|
"checksum strsim 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c"
|
||||||
|
"checksum swc_atoms 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "46682d5a27e12d8b86168ea2fcb3aae2e0625f24bf109dee4bca24b2b51e03ce"
|
||||||
|
"checksum swc_common 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a743da2fa9a585671f985d532ee6c839e7dc69c8abe00740cf39b4156f3514f3"
|
||||||
|
"checksum swc_ecma_ast 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ae2303811d9d34475654698a0d569860ca6995f00f7329cff5e79492dbb6c"
|
||||||
|
"checksum swc_ecma_parser 0.17.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4ae57aeb4894875ae7b0aaba4d07d688eec24829cd3e8ff5feaf1d0b815f6fab"
|
||||||
|
"checksum swc_ecma_parser_macros 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b3ae6f346378d597ff91095bb1b926e3e1f3504babd30968b939c96d2529b2a"
|
||||||
|
"checksum swc_macros_common 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d1638e13581d32a5ef0ea74fadb9d2325b30f3fdb17ac8d38cb6da5f83f1b92b"
|
||||||
"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"
|
"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"
|
||||||
"checksum syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4ff033220a41d1a57d8125eab57bf5263783dfdcc18688b1dacc6ce9651ef8"
|
"checksum syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4ff033220a41d1a57d8125eab57bf5263783dfdcc18688b1dacc6ce9651ef8"
|
||||||
"checksum synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545"
|
"checksum synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545"
|
||||||
|
|
|
@ -35,7 +35,9 @@ brotli2 = "0.3.2"
|
||||||
clap = "2.33.0"
|
clap = "2.33.0"
|
||||||
dirs = "2.0.2"
|
dirs = "2.0.2"
|
||||||
dlopen = "0.1.8"
|
dlopen = "0.1.8"
|
||||||
|
dprint-plugin-typescript = "0.3.0-alpha.1"
|
||||||
futures = { version = "0.3.1", features = [ "compat", "io-compat" ] }
|
futures = { version = "0.3.1", features = [ "compat", "io-compat" ] }
|
||||||
|
glob = "0.3.0"
|
||||||
http = "0.2.0"
|
http = "0.2.0"
|
||||||
indexmap = "1.3.0"
|
indexmap = "1.3.0"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
|
|
360
cli/flags.rs
360
cli/flags.rs
|
@ -28,8 +28,6 @@ macro_rules! std_url {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used for `deno fmt <files>...` subcommand
|
|
||||||
const PRETTIER_URL: &str = std_url!("prettier/main.ts");
|
|
||||||
/// Used for `deno install...` subcommand
|
/// Used for `deno install...` subcommand
|
||||||
const INSTALLER_URL: &str = std_url!("installer/mod.ts");
|
const INSTALLER_URL: &str = std_url!("installer/mod.ts");
|
||||||
/// Used for `deno test...` subcommand
|
/// Used for `deno test...` subcommand
|
||||||
|
@ -41,6 +39,10 @@ pub enum DenoSubcommand {
|
||||||
Completions,
|
Completions,
|
||||||
Eval,
|
Eval,
|
||||||
Fetch,
|
Fetch,
|
||||||
|
Format {
|
||||||
|
check: bool,
|
||||||
|
files: Option<Vec<String>>,
|
||||||
|
},
|
||||||
Help,
|
Help,
|
||||||
Info,
|
Info,
|
||||||
Install,
|
Install,
|
||||||
|
@ -230,60 +232,19 @@ fn types_parse(flags: &mut DenoFlags, _matches: &clap::ArgMatches) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fmt_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) {
|
fn fmt_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) {
|
||||||
flags.subcommand = DenoSubcommand::Run;
|
let maybe_files = match matches.values_of("files") {
|
||||||
flags.allow_read = true;
|
Some(f) => {
|
||||||
flags.allow_write = true;
|
let files: Vec<String> = f.map(String::from).collect();
|
||||||
flags.argv.push(PRETTIER_URL.to_string());
|
Some(files)
|
||||||
|
|
||||||
let files: Vec<String> = matches
|
|
||||||
.values_of("files")
|
|
||||||
.unwrap()
|
|
||||||
.map(String::from)
|
|
||||||
.collect();
|
|
||||||
flags.argv.extend(files);
|
|
||||||
|
|
||||||
if !matches.is_present("stdout") {
|
|
||||||
// `deno fmt` writes to the files by default
|
|
||||||
flags.argv.push("--write".to_string());
|
|
||||||
}
|
|
||||||
|
|
||||||
let prettier_flags = [
|
|
||||||
["0", "check"],
|
|
||||||
["1", "prettierrc"],
|
|
||||||
["1", "ignore-path"],
|
|
||||||
["1", "print-width"],
|
|
||||||
["1", "tab-width"],
|
|
||||||
["0", "use-tabs"],
|
|
||||||
["0", "no-semi"],
|
|
||||||
["0", "single-quote"],
|
|
||||||
["1", "quote-props"],
|
|
||||||
["0", "jsx-single-quote"],
|
|
||||||
["0", "jsx-bracket-same-line"],
|
|
||||||
["0", "trailing-comma"],
|
|
||||||
["0", "no-bracket-spacing"],
|
|
||||||
["1", "arrow-parens"],
|
|
||||||
["1", "prose-wrap"],
|
|
||||||
["1", "end-of-line"],
|
|
||||||
];
|
|
||||||
|
|
||||||
for opt in &prettier_flags {
|
|
||||||
let t = opt[0];
|
|
||||||
let keyword = opt[1];
|
|
||||||
|
|
||||||
if matches.is_present(&keyword) {
|
|
||||||
if t == "0" {
|
|
||||||
flags.argv.push(format!("--{}", keyword));
|
|
||||||
} else {
|
|
||||||
if keyword == "prettierrc" {
|
|
||||||
flags.argv.push("--config".to_string());
|
|
||||||
} else {
|
|
||||||
flags.argv.push(format!("--{}", keyword));
|
|
||||||
}
|
|
||||||
flags
|
|
||||||
.argv
|
|
||||||
.push(matches.value_of(keyword).unwrap().to_string());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
None => None,
|
||||||
|
};
|
||||||
|
|
||||||
|
let check = matches.is_present("check");
|
||||||
|
|
||||||
|
flags.subcommand = DenoSubcommand::Format {
|
||||||
|
check,
|
||||||
|
files: maybe_files,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,155 +517,28 @@ The declaration file could be saved and used for typing information.",
|
||||||
|
|
||||||
fn fmt_subcommand<'a, 'b>() -> App<'a, 'b> {
|
fn fmt_subcommand<'a, 'b>() -> App<'a, 'b> {
|
||||||
SubCommand::with_name("fmt")
|
SubCommand::with_name("fmt")
|
||||||
.about("Format files")
|
.about("Format files")
|
||||||
.long_about(
|
.long_about(
|
||||||
"Auto-format JavaScript/TypeScript source code using Prettier
|
"Auto-format JavaScript/TypeScript source code
|
||||||
|
|
||||||
Automatically downloads Prettier dependencies on first run.
|
deno fmt
|
||||||
|
|
||||||
deno fmt myfile1.ts myfile2.ts",
|
deno fmt myfile1.ts myfile2.ts
|
||||||
)
|
|
||||||
.arg(
|
deno fmt --check",
|
||||||
Arg::with_name("check")
|
)
|
||||||
.long("check")
|
.arg(
|
||||||
.help("Check if the source files are formatted.")
|
Arg::with_name("check")
|
||||||
.takes_value(false),
|
.long("check")
|
||||||
)
|
.help("Check if the source files are formatted.")
|
||||||
.arg(
|
.takes_value(false),
|
||||||
Arg::with_name("prettierrc")
|
)
|
||||||
.long("prettierrc")
|
.arg(
|
||||||
.value_name("auto|disable|FILE")
|
Arg::with_name("files")
|
||||||
.help("Specify the configuration file of the prettier.
|
.takes_value(true)
|
||||||
auto: Auto detect prettier configuration file in current working dir.
|
.multiple(true)
|
||||||
disable: Disable load configuration file.
|
.required(false),
|
||||||
FILE: Load specified prettier configuration file. support .json/.toml/.js/.ts file
|
)
|
||||||
")
|
|
||||||
.takes_value(true)
|
|
||||||
.require_equals(true)
|
|
||||||
.default_value("auto")
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("ignore-path")
|
|
||||||
.long("ignore-path")
|
|
||||||
.value_name("auto|disable|FILE")
|
|
||||||
.help("Path to a file containing patterns that describe files to ignore.
|
|
||||||
auto: Auto detect .pretierignore file in current working dir.
|
|
||||||
disable: Disable load .prettierignore file.
|
|
||||||
FILE: Load specified prettier ignore file.
|
|
||||||
")
|
|
||||||
.takes_value(true)
|
|
||||||
.require_equals(true)
|
|
||||||
.default_value("auto")
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("stdout")
|
|
||||||
.long("stdout")
|
|
||||||
.help("Output formated code to stdout")
|
|
||||||
.takes_value(false),
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("print-width")
|
|
||||||
.long("print-width")
|
|
||||||
.value_name("int")
|
|
||||||
.help("Specify the line length that the printer will wrap on.")
|
|
||||||
.takes_value(true)
|
|
||||||
.require_equals(true)
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("tab-width")
|
|
||||||
.long("tab-width")
|
|
||||||
.value_name("int")
|
|
||||||
.help("Specify the number of spaces per indentation-level.")
|
|
||||||
.takes_value(true)
|
|
||||||
.require_equals(true)
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("use-tabs")
|
|
||||||
.long("use-tabs")
|
|
||||||
.help("Indent lines with tabs instead of spaces.")
|
|
||||||
.takes_value(false)
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("no-semi")
|
|
||||||
.long("no-semi")
|
|
||||||
.help("Print semicolons at the ends of statements.")
|
|
||||||
.takes_value(false)
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("single-quote")
|
|
||||||
.long("single-quote")
|
|
||||||
.help("Use single quotes instead of double quotes.")
|
|
||||||
.takes_value(false)
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("quote-props")
|
|
||||||
.long("quote-props")
|
|
||||||
.value_name("as-needed|consistent|preserve")
|
|
||||||
.help("Change when properties in objects are quoted.")
|
|
||||||
.takes_value(true)
|
|
||||||
.possible_values(&["as-needed", "consistent", "preserve"])
|
|
||||||
.require_equals(true)
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("jsx-single-quote")
|
|
||||||
.long("jsx-single-quote")
|
|
||||||
.help("Use single quotes instead of double quotes in JSX.")
|
|
||||||
.takes_value(false)
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("jsx-bracket-same-line")
|
|
||||||
.long("jsx-bracket-same-line")
|
|
||||||
.help(
|
|
||||||
"Put the > of a multi-line JSX element at the end of the last line
|
|
||||||
instead of being alone on the next line (does not apply to self closing elements)."
|
|
||||||
)
|
|
||||||
.takes_value(false)
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("trailing-comma")
|
|
||||||
.long("trailing-comma")
|
|
||||||
.help("Print trailing commas wherever possible when multi-line.")
|
|
||||||
.takes_value(false)
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("no-bracket-spacing")
|
|
||||||
.long("no-bracket-spacing")
|
|
||||||
.help("Print spaces between brackets in object literals.")
|
|
||||||
.takes_value(false)
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("arrow-parens")
|
|
||||||
.long("arrow-parens")
|
|
||||||
.value_name("avoid|always")
|
|
||||||
.help("Include parentheses around a sole arrow function parameter.")
|
|
||||||
.takes_value(true)
|
|
||||||
.possible_values(&["avoid", "always"])
|
|
||||||
.require_equals(true)
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("prose-wrap")
|
|
||||||
.long("prose-wrap")
|
|
||||||
.value_name("always|never|preserve")
|
|
||||||
.help("How to wrap prose.")
|
|
||||||
.takes_value(true)
|
|
||||||
.possible_values(&["always", "never", "preserve"])
|
|
||||||
.require_equals(true)
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("end-of-line")
|
|
||||||
.long("end-of-line")
|
|
||||||
.value_name("auto|lf|crlf|cr")
|
|
||||||
.help("Which end of line characters to apply.")
|
|
||||||
.takes_value(true)
|
|
||||||
.possible_values(&["auto", "lf", "crlf", "cr"])
|
|
||||||
.require_equals(true)
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("files")
|
|
||||||
.takes_value(true)
|
|
||||||
.multiple(true)
|
|
||||||
.required(true),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn repl_subcommand<'a, 'b>() -> App<'a, 'b> {
|
fn repl_subcommand<'a, 'b>() -> App<'a, 'b> {
|
||||||
|
@ -1439,20 +1273,24 @@ mod tests {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
r.unwrap(),
|
r.unwrap(),
|
||||||
DenoFlags {
|
DenoFlags {
|
||||||
subcommand: DenoSubcommand::Run,
|
subcommand: DenoSubcommand::Format {
|
||||||
allow_write: true,
|
check: false,
|
||||||
allow_read: true,
|
files: Some(svec!["script_1.ts", "script_2.ts"])
|
||||||
argv: svec![
|
},
|
||||||
"deno",
|
argv: svec!["deno"],
|
||||||
PRETTIER_URL,
|
..DenoFlags::default()
|
||||||
"script_1.ts",
|
}
|
||||||
"script_2.ts",
|
);
|
||||||
"--write",
|
|
||||||
"--config",
|
let r = flags_from_vec_safe(svec!["deno", "fmt", "--check"]);
|
||||||
"auto",
|
assert_eq!(
|
||||||
"--ignore-path",
|
r.unwrap(),
|
||||||
"auto"
|
DenoFlags {
|
||||||
],
|
subcommand: DenoSubcommand::Format {
|
||||||
|
check: true,
|
||||||
|
files: None
|
||||||
|
},
|
||||||
|
argv: svec!["deno"],
|
||||||
..DenoFlags::default()
|
..DenoFlags::default()
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -1667,36 +1505,6 @@ mod tests {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn fmt_stdout() {
|
|
||||||
let r = flags_from_vec_safe(svec![
|
|
||||||
"deno",
|
|
||||||
"fmt",
|
|
||||||
"--stdout",
|
|
||||||
"script_1.ts",
|
|
||||||
"script_2.ts"
|
|
||||||
]);
|
|
||||||
assert_eq!(
|
|
||||||
r.unwrap(),
|
|
||||||
DenoFlags {
|
|
||||||
subcommand: DenoSubcommand::Run,
|
|
||||||
argv: svec![
|
|
||||||
"deno",
|
|
||||||
PRETTIER_URL,
|
|
||||||
"script_1.ts",
|
|
||||||
"script_2.ts",
|
|
||||||
"--config",
|
|
||||||
"auto",
|
|
||||||
"--ignore-path",
|
|
||||||
"auto"
|
|
||||||
],
|
|
||||||
allow_write: true,
|
|
||||||
allow_read: true,
|
|
||||||
..DenoFlags::default()
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn default_to_run() {
|
fn default_to_run() {
|
||||||
let r = flags_from_vec_safe(svec!["deno", "script.ts"]);
|
let r = flags_from_vec_safe(svec!["deno", "script.ts"]);
|
||||||
|
@ -2125,66 +1933,6 @@ mod tests {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn fmt_args() {
|
|
||||||
let r = flags_from_vec_safe(svec![
|
|
||||||
"deno",
|
|
||||||
"fmt",
|
|
||||||
"--check",
|
|
||||||
"--prettierrc=auto",
|
|
||||||
"--print-width=100",
|
|
||||||
"--tab-width=4",
|
|
||||||
"--use-tabs",
|
|
||||||
"--no-semi",
|
|
||||||
"--single-quote",
|
|
||||||
"--arrow-parens=always",
|
|
||||||
"--prose-wrap=preserve",
|
|
||||||
"--end-of-line=crlf",
|
|
||||||
"--quote-props=preserve",
|
|
||||||
"--jsx-single-quote",
|
|
||||||
"--jsx-bracket-same-line",
|
|
||||||
"--ignore-path=.prettier-ignore",
|
|
||||||
"script.ts"
|
|
||||||
]);
|
|
||||||
assert_eq!(
|
|
||||||
r.unwrap(),
|
|
||||||
DenoFlags {
|
|
||||||
subcommand: DenoSubcommand::Run,
|
|
||||||
argv: svec![
|
|
||||||
"deno",
|
|
||||||
PRETTIER_URL,
|
|
||||||
"script.ts",
|
|
||||||
"--write",
|
|
||||||
"--check",
|
|
||||||
"--config",
|
|
||||||
"auto",
|
|
||||||
"--ignore-path",
|
|
||||||
".prettier-ignore",
|
|
||||||
"--print-width",
|
|
||||||
"100",
|
|
||||||
"--tab-width",
|
|
||||||
"4",
|
|
||||||
"--use-tabs",
|
|
||||||
"--no-semi",
|
|
||||||
"--single-quote",
|
|
||||||
"--quote-props",
|
|
||||||
"preserve",
|
|
||||||
"--jsx-single-quote",
|
|
||||||
"--jsx-bracket-same-line",
|
|
||||||
"--arrow-parens",
|
|
||||||
"always",
|
|
||||||
"--prose-wrap",
|
|
||||||
"preserve",
|
|
||||||
"--end-of-line",
|
|
||||||
"crlf"
|
|
||||||
],
|
|
||||||
allow_write: true,
|
|
||||||
allow_read: true,
|
|
||||||
..DenoFlags::default()
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_with_exclude() {
|
fn test_with_exclude() {
|
||||||
let r = flags_from_vec_safe(svec![
|
let r = flags_from_vec_safe(svec![
|
||||||
|
|
162
cli/fmt.rs
Normal file
162
cli/fmt.rs
Normal file
|
@ -0,0 +1,162 @@
|
||||||
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
|
//! This module provides file formating utilities using
|
||||||
|
//! [`dprint`](https://github.com/dsherret/dprint).
|
||||||
|
//!
|
||||||
|
//! At the moment it is only consumed using CLI but in
|
||||||
|
//! the future it can be easily extended to provide
|
||||||
|
//! the same functions as ops available in JS runtime.
|
||||||
|
|
||||||
|
use dprint_plugin_typescript::format_text;
|
||||||
|
use dprint_plugin_typescript::Configuration;
|
||||||
|
use dprint_plugin_typescript::ConfigurationBuilder;
|
||||||
|
use glob;
|
||||||
|
use regex::Regex;
|
||||||
|
use std::fs;
|
||||||
|
use std::path::Path;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
use std::time::Instant;
|
||||||
|
|
||||||
|
lazy_static! {
|
||||||
|
static ref TYPESCRIPT_LIB: Regex = Regex::new(".d.ts$").unwrap();
|
||||||
|
static ref TYPESCRIPT: Regex = Regex::new(".tsx?$").unwrap();
|
||||||
|
static ref JAVASCRIPT: Regex = Regex::new(".jsx?$").unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_supported(path: &Path) -> bool {
|
||||||
|
let path_str = path.to_string_lossy();
|
||||||
|
!TYPESCRIPT_LIB.is_match(&path_str)
|
||||||
|
&& (TYPESCRIPT.is_match(&path_str) || JAVASCRIPT.is_match(&path_str))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_config() -> Configuration {
|
||||||
|
ConfigurationBuilder::new()
|
||||||
|
.line_width(80)
|
||||||
|
.indent_width(2)
|
||||||
|
.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_supported_files(paths: Vec<PathBuf>) -> Vec<PathBuf> {
|
||||||
|
let mut files_to_check = vec![];
|
||||||
|
|
||||||
|
for path in paths {
|
||||||
|
if is_supported(&path) {
|
||||||
|
files_to_check.push(path.to_owned());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
files_to_check
|
||||||
|
}
|
||||||
|
|
||||||
|
fn check_source_files(config: Configuration, paths: Vec<PathBuf>) {
|
||||||
|
let start = Instant::now();
|
||||||
|
let mut not_formatted_files = vec![];
|
||||||
|
|
||||||
|
for file_path in paths {
|
||||||
|
let file_path_str = file_path.to_string_lossy();
|
||||||
|
let file_contents = fs::read_to_string(&file_path).unwrap();
|
||||||
|
match format_text(&file_path_str, &file_contents, &config) {
|
||||||
|
Ok(None) => {
|
||||||
|
// nothing to format, pass
|
||||||
|
}
|
||||||
|
Ok(Some(formatted_text)) => {
|
||||||
|
if formatted_text != file_contents {
|
||||||
|
println!("Not formatted {}", file_path_str);
|
||||||
|
not_formatted_files.push(file_path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
eprintln!("Error checking: {}", &file_path_str);
|
||||||
|
eprintln!(" {}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let duration = Instant::now() - start;
|
||||||
|
|
||||||
|
if !not_formatted_files.is_empty() {
|
||||||
|
let f = if not_formatted_files.len() == 1 {
|
||||||
|
"file"
|
||||||
|
} else {
|
||||||
|
"files"
|
||||||
|
};
|
||||||
|
|
||||||
|
eprintln!(
|
||||||
|
"Found {} not formatted {} in {:?}",
|
||||||
|
not_formatted_files.len(),
|
||||||
|
f,
|
||||||
|
duration
|
||||||
|
);
|
||||||
|
std::process::exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn format_source_files(config: Configuration, paths: Vec<PathBuf>) {
|
||||||
|
let start = Instant::now();
|
||||||
|
let mut not_formatted_files = vec![];
|
||||||
|
|
||||||
|
for file_path in paths {
|
||||||
|
let file_path_str = file_path.to_string_lossy();
|
||||||
|
let file_contents = fs::read_to_string(&file_path).unwrap();
|
||||||
|
match format_text(&file_path_str, &file_contents, &config) {
|
||||||
|
Ok(None) => {
|
||||||
|
// nothing to format, pass
|
||||||
|
}
|
||||||
|
Ok(Some(formatted_text)) => {
|
||||||
|
if formatted_text != file_contents {
|
||||||
|
println!("Formatting {}", file_path_str);
|
||||||
|
fs::write(&file_path, formatted_text).unwrap();
|
||||||
|
not_formatted_files.push(file_path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
eprintln!("Error formatting: {}", &file_path_str);
|
||||||
|
eprintln!(" {}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let duration = Instant::now() - start;
|
||||||
|
let f = if not_formatted_files.len() == 1 {
|
||||||
|
"file"
|
||||||
|
} else {
|
||||||
|
"files"
|
||||||
|
};
|
||||||
|
eprintln!(
|
||||||
|
"Formatted {} {} in {:?}",
|
||||||
|
not_formatted_files.len(),
|
||||||
|
f,
|
||||||
|
duration
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_matching_files(glob_paths: Vec<String>) -> Vec<PathBuf> {
|
||||||
|
let mut target_files = Vec::with_capacity(128);
|
||||||
|
|
||||||
|
for path in glob_paths {
|
||||||
|
let files = glob::glob(&path)
|
||||||
|
.expect("Failed to execute glob.")
|
||||||
|
.filter_map(Result::ok);
|
||||||
|
target_files.extend(files);
|
||||||
|
}
|
||||||
|
|
||||||
|
target_files
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Format JavaScript/TypeScript files.
|
||||||
|
///
|
||||||
|
/// First argument supports globs, and if it is `None`
|
||||||
|
/// then the current directory is recursively walked.
|
||||||
|
pub fn format_files(maybe_files: Option<Vec<String>>, check: bool) {
|
||||||
|
// TODO: improve glob to look for tsx?/jsx? files only
|
||||||
|
let glob_paths = maybe_files.unwrap_or_else(|| vec!["**/*".to_string()]);
|
||||||
|
let matching_files = get_matching_files(glob_paths);
|
||||||
|
let matching_files = get_supported_files(matching_files);
|
||||||
|
let config = get_config();
|
||||||
|
|
||||||
|
if check {
|
||||||
|
check_source_files(config, matching_files);
|
||||||
|
} else {
|
||||||
|
format_source_files(config, matching_files);
|
||||||
|
}
|
||||||
|
}
|
|
@ -28,6 +28,7 @@ pub mod diagnostics;
|
||||||
mod disk_cache;
|
mod disk_cache;
|
||||||
mod file_fetcher;
|
mod file_fetcher;
|
||||||
pub mod flags;
|
pub mod flags;
|
||||||
|
mod fmt;
|
||||||
pub mod fmt_errors;
|
pub mod fmt_errors;
|
||||||
mod fs;
|
mod fs;
|
||||||
mod global_state;
|
mod global_state;
|
||||||
|
@ -422,6 +423,10 @@ fn run_script(flags: DenoFlags) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn format_command(files: Option<Vec<String>>, check: bool) {
|
||||||
|
fmt::format_files(files, check);
|
||||||
|
}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
ansi_term::enable_ansi_support().ok(); // For Windows 10
|
ansi_term::enable_ansi_support().ok(); // For Windows 10
|
||||||
|
@ -442,11 +447,12 @@ pub fn main() {
|
||||||
};
|
};
|
||||||
log::set_max_level(log_level.to_level_filter());
|
log::set_max_level(log_level.to_level_filter());
|
||||||
|
|
||||||
match flags.subcommand {
|
match flags.clone().subcommand {
|
||||||
DenoSubcommand::Bundle => bundle_command(flags),
|
DenoSubcommand::Bundle => bundle_command(flags),
|
||||||
DenoSubcommand::Completions => {}
|
DenoSubcommand::Completions => {}
|
||||||
DenoSubcommand::Eval => eval_command(flags),
|
DenoSubcommand::Eval => eval_command(flags),
|
||||||
DenoSubcommand::Fetch => fetch_command(flags),
|
DenoSubcommand::Fetch => fetch_command(flags),
|
||||||
|
DenoSubcommand::Format { check, files } => format_command(files, check),
|
||||||
DenoSubcommand::Info => info_command(flags),
|
DenoSubcommand::Info => info_command(flags),
|
||||||
DenoSubcommand::Repl => run_repl(flags),
|
DenoSubcommand::Repl => run_repl(flags),
|
||||||
DenoSubcommand::Run => run_script(flags),
|
DenoSubcommand::Run => run_script(flags),
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
|
|
||||||
console.log(
|
console.log("Hello World"
|
||||||
"Hello World"
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -29,12 +29,44 @@ fn fetch_test() {
|
||||||
drop(g);
|
drop(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(#2933): Rewrite this test in rust.
|
|
||||||
#[test]
|
#[test]
|
||||||
fn fmt_test() {
|
fn fmt_test() {
|
||||||
let g = util::http_server();
|
use tempfile::TempDir;
|
||||||
util::run_python_script("tools/fmt_test.py");
|
|
||||||
drop(g);
|
let t = TempDir::new().expect("tempdir fail");
|
||||||
|
let fixed = util::root_path().join("cli/tests/badly_formatted_fixed.js");
|
||||||
|
let badly_formatted_original =
|
||||||
|
util::root_path().join("cli/tests/badly_formatted.js");
|
||||||
|
let badly_formatted = t.path().join("badly_formatted.js");
|
||||||
|
let badly_formatted_str = badly_formatted.to_str().unwrap();
|
||||||
|
std::fs::copy(&badly_formatted_original, &badly_formatted)
|
||||||
|
.expect("Failed to copy file");
|
||||||
|
|
||||||
|
let status = util::deno_cmd()
|
||||||
|
.current_dir(util::root_path())
|
||||||
|
.arg("fmt")
|
||||||
|
.arg("--check")
|
||||||
|
.arg(badly_formatted_str)
|
||||||
|
.spawn()
|
||||||
|
.expect("Failed to spawn script")
|
||||||
|
.wait()
|
||||||
|
.expect("Failed to wait for child process");
|
||||||
|
|
||||||
|
assert_eq!(Some(1), status.code());
|
||||||
|
|
||||||
|
let status = util::deno_cmd()
|
||||||
|
.current_dir(util::root_path())
|
||||||
|
.arg("fmt")
|
||||||
|
.arg(badly_formatted_str)
|
||||||
|
.spawn()
|
||||||
|
.expect("Failed to spawn script")
|
||||||
|
.wait()
|
||||||
|
.expect("Failed to wait for child process");
|
||||||
|
|
||||||
|
assert_eq!(Some(0), status.code());
|
||||||
|
let expected = std::fs::read_to_string(fixed).unwrap();
|
||||||
|
let actual = std::fs::read_to_string(badly_formatted).unwrap();
|
||||||
|
assert_eq!(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -29,7 +29,6 @@ Here are the dedicated documentations of modules:
|
||||||
- [http](http/README.md)
|
- [http](http/README.md)
|
||||||
- [log](log/README.md)
|
- [log](log/README.md)
|
||||||
- [media_types](media_types/README.md)
|
- [media_types](media_types/README.md)
|
||||||
- [prettier](prettier/README.md)
|
|
||||||
- [strings](strings/README.md)
|
- [strings](strings/README.md)
|
||||||
- [testing](testing/README.md)
|
- [testing](testing/README.md)
|
||||||
- [uuid](uuid/README.md)
|
- [uuid](uuid/README.md)
|
||||||
|
|
|
@ -847,7 +847,7 @@ $ echo 'export PATH="$HOME/.deno/bin:$PATH"' >> ~/.bashrc
|
||||||
Installation directory can be changed using `-d/--dir` flag:
|
Installation directory can be changed using `-d/--dir` flag:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ deno install --dir /usr/local/bin prettier https://deno.land/std/prettier/main.ts --allow-write --allow-read
|
$ deno install --dir /usr/local/bin file_server https://deno.land/std/http/file_server.ts --allow-net --allow-read
|
||||||
```
|
```
|
||||||
|
|
||||||
When installing a script you can specify permissions that will be used to run
|
When installing a script you can specify permissions that will be used to run
|
||||||
|
@ -857,13 +857,11 @@ additional CLI flags you want to pass to the script.
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ deno install format_check https://deno.land/std/prettier/main.ts --allow-write --allow-read --check --print-width 88 --tab-width 2
|
$ deno install file_server https://deno.land/std/http/file_server.ts --allow-net --allow-read 8080
|
||||||
```
|
```
|
||||||
|
|
||||||
Above command creates an executable called `format_check` that runs `prettier`
|
Above command creates an executable called `file_server` that runs with write
|
||||||
with write and read permissions. When you run `format_check` deno will run
|
and read permissions and binds to port 8080.
|
||||||
prettier in `check` mode and configured to use `88` column width with `2` column
|
|
||||||
tabs.
|
|
||||||
|
|
||||||
It is a good practice to use `import.meta.main` idiom for an entry point for
|
It is a good practice to use `import.meta.main` idiom for an entry point for
|
||||||
executable file. See
|
executable file. See
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
# prettier
|
|
||||||
|
|
||||||
Prettier APIs and tools for deno
|
|
||||||
|
|
||||||
## Use as a CLI
|
|
||||||
|
|
||||||
To formats the source files, run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
deno --allow-read --allow-write https://deno.land/std/prettier/main.ts
|
|
||||||
```
|
|
||||||
|
|
||||||
You can format only specific files by passing the arguments.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
deno --allow-read --allow-write https://deno.land/std/prettier/main.ts path/to/script.ts
|
|
||||||
```
|
|
||||||
|
|
||||||
You can format files on specific directory by passing the directory's path.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
deno --allow-read --allow-write https://deno.land/std/prettier/main.ts path/to/script.ts
|
|
||||||
```
|
|
||||||
|
|
||||||
You can format the input plain text stream. default parse it as typescript code.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cat path/to/script.ts | deno https://deno.land/std/prettier/main.ts
|
|
||||||
cat path/to/script.js | deno https://deno.land/std/prettier/main.ts --stdin-parser=babel
|
|
||||||
cat path/to/config.json | deno https://deno.land/std/prettier/main.ts --stdin-parser=json
|
|
||||||
cat path/to/README.md | deno https://deno.land/std/prettier/main.ts --stdin-parser=markdown
|
|
||||||
```
|
|
||||||
|
|
||||||
## Use API
|
|
||||||
|
|
||||||
You can use APIs of prettier as the following:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import {
|
|
||||||
prettier,
|
|
||||||
prettierPlugins
|
|
||||||
} from "https://deno.land/std/prettier/prettier.ts";
|
|
||||||
|
|
||||||
prettier.format("const x = 1", {
|
|
||||||
parser: "babel",
|
|
||||||
plugins: prettierPlugins
|
|
||||||
}); // => "const x = 1;"
|
|
||||||
```
|
|
|
@ -1,15 +0,0 @@
|
||||||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse the contents of the ignore file and return patterns.
|
|
||||||
* It can parse files like .gitignore/.npmignore/.prettierignore
|
|
||||||
* @param ignoreString
|
|
||||||
* @returns patterns
|
|
||||||
*/
|
|
||||||
export function parse(ignoreString: string): Set<string> {
|
|
||||||
const partterns = ignoreString
|
|
||||||
.split(/\r?\n/)
|
|
||||||
.filter(line => line.trim() !== "" && line.charAt(0) !== "#");
|
|
||||||
|
|
||||||
return new Set(partterns);
|
|
||||||
}
|
|
|
@ -1,81 +0,0 @@
|
||||||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
|
||||||
import { test, runIfMain } from "../testing/mod.ts";
|
|
||||||
import { assertEquals } from "../testing/asserts.ts";
|
|
||||||
import { parse } from "./ignore.ts";
|
|
||||||
|
|
||||||
const testCases = [
|
|
||||||
{
|
|
||||||
input: `# this is a comment
|
|
||||||
node_modules
|
|
||||||
`,
|
|
||||||
output: new Set(["node_modules"])
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: ` # invalid comment
|
|
||||||
`,
|
|
||||||
output: new Set([" # invalid comment"])
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: `
|
|
||||||
node_modules
|
|
||||||
package.json
|
|
||||||
`,
|
|
||||||
output: new Set(["node_modules", "package.json"])
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: `
|
|
||||||
node_modules
|
|
||||||
package.json
|
|
||||||
`,
|
|
||||||
output: new Set([" node_modules", " package.json"])
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: `*.orig
|
|
||||||
*.pyc
|
|
||||||
*.swp
|
|
||||||
|
|
||||||
/.idea/
|
|
||||||
/.vscode/
|
|
||||||
gclient_config.py_entries
|
|
||||||
/gh-pages/
|
|
||||||
/target/
|
|
||||||
|
|
||||||
# Files that help ensure VSCode can work but we don't want checked into the
|
|
||||||
# repo
|
|
||||||
/node_modules
|
|
||||||
/tsconfig.json
|
|
||||||
|
|
||||||
# We use something stronger than lockfiles, we have all NPM modules stored in a
|
|
||||||
# git. We do not download from NPM during build.
|
|
||||||
# https://github.com/denoland/deno_third_party
|
|
||||||
yarn.lock
|
|
||||||
# yarn creates this in error.
|
|
||||||
tools/node_modules/
|
|
||||||
`,
|
|
||||||
output: new Set([
|
|
||||||
"*.orig",
|
|
||||||
"*.pyc",
|
|
||||||
"*.swp",
|
|
||||||
"/.idea/",
|
|
||||||
"/.vscode/",
|
|
||||||
"gclient_config.py_entries",
|
|
||||||
"/gh-pages/",
|
|
||||||
"/target/",
|
|
||||||
"/node_modules",
|
|
||||||
"/tsconfig.json",
|
|
||||||
"yarn.lock",
|
|
||||||
"tools/node_modules/"
|
|
||||||
])
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
test({
|
|
||||||
name: "[encoding.ignore] basic",
|
|
||||||
fn(): void {
|
|
||||||
for (const { input, output } of testCases) {
|
|
||||||
assertEquals(parse(input), output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
runIfMain(import.meta);
|
|
|
@ -1,616 +0,0 @@
|
||||||
#!/usr/bin/env -S deno --allow-run --allow-write
|
|
||||||
/**
|
|
||||||
* Copyright © James Long and contributors
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
|
||||||
// This script formats the given source files. If the files are omitted, it
|
|
||||||
// formats the all files in the repository.
|
|
||||||
import { parse } from "../flags/mod.ts";
|
|
||||||
import * as path from "../path/mod.ts";
|
|
||||||
import * as toml from "../encoding/toml.ts";
|
|
||||||
import * as yaml from "../encoding/yaml.ts";
|
|
||||||
import * as ignore from "./ignore.ts";
|
|
||||||
import { ExpandGlobOptions, WalkInfo, expandGlob } from "../fs/mod.ts";
|
|
||||||
import { prettier, prettierPlugins } from "./prettier.ts";
|
|
||||||
const { args, cwd, exit, readAll, readFile, stdin, stdout, writeFile } = Deno;
|
|
||||||
|
|
||||||
const HELP_MESSAGE = `
|
|
||||||
Formats the given files. If no arg is passed, then formats the all files.
|
|
||||||
|
|
||||||
Usage: deno prettier/main.ts [options] [files...]
|
|
||||||
|
|
||||||
Options:
|
|
||||||
-H, --help Show this help message and exit.
|
|
||||||
--check Check if the source files are formatted.
|
|
||||||
--write Whether to write to the file, otherwise
|
|
||||||
it will output to stdout, Defaults to
|
|
||||||
false.
|
|
||||||
--ignore <path> Ignore the given path(s).
|
|
||||||
--ignore-path <auto|disable|path> Path to a file containing patterns that
|
|
||||||
describe files to ignore. Optional
|
|
||||||
value: auto/disable/filepath. Defaults
|
|
||||||
to null.
|
|
||||||
--stdin Specifies to read the code from stdin.
|
|
||||||
If run the command in a pipe, you do not
|
|
||||||
need to specify this flag.
|
|
||||||
Defaults to false.
|
|
||||||
--stdin-parser <typescript|babel|markdown|json>
|
|
||||||
If set --stdin flag, then need specify a
|
|
||||||
parser for stdin. available parser:
|
|
||||||
typescript/babel/markdown/json. Defaults
|
|
||||||
to typescript.
|
|
||||||
--config <auto|disable|path> Specify the configuration file of the
|
|
||||||
prettier.
|
|
||||||
Optional value: auto/disable/filepath.
|
|
||||||
Defaults to null.
|
|
||||||
|
|
||||||
JS/TS Styling Options:
|
|
||||||
--print-width <int> The line length where Prettier will try
|
|
||||||
wrap. Defaults to 80.
|
|
||||||
--tab-width <int> Number of spaces per indentation level.
|
|
||||||
Defaults to 2.
|
|
||||||
--use-tabs Indent with tabs instead of spaces.
|
|
||||||
Defaults to false.
|
|
||||||
--no-semi Do not print semicolons, except at the
|
|
||||||
beginning of lines which may need them.
|
|
||||||
--single-quote Use single quotes instead of double
|
|
||||||
quotes. Defaults to false.
|
|
||||||
--quote-props <as-needed|consistent|preserve>
|
|
||||||
Change when properties in objects are
|
|
||||||
quoted. Defaults to as-needed.
|
|
||||||
--jsx-single-quote Use single quotes instead of double
|
|
||||||
quotes in JSX.
|
|
||||||
--jsx-bracket-same-line Put the > of a multi-line JSX element at
|
|
||||||
the end of the last line instead of
|
|
||||||
being alone on the next line (does not
|
|
||||||
apply to self closing elements).
|
|
||||||
--trailing-comma <none|es5|all> Print trailing commas wherever possible
|
|
||||||
when multi-line. Defaults to none.
|
|
||||||
--no-bracket-spacing Do not print spaces between brackets.
|
|
||||||
--arrow-parens <avoid|always> Include parentheses around a sole arrow
|
|
||||||
function parameter. Defaults to avoid.
|
|
||||||
--end-of-line <auto|lf|crlf|cr> Which end of line characters to apply.
|
|
||||||
Defaults to auto.
|
|
||||||
|
|
||||||
Markdown Styling Options:
|
|
||||||
--prose-wrap <always|never|preserve> How to wrap prose. Defaults to preserve.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
deno run prettier/main.ts --write script1.ts script2.js
|
|
||||||
Formats the files
|
|
||||||
|
|
||||||
deno run prettier/main.ts --check script1.ts script2.js
|
|
||||||
Checks if the files are formatted
|
|
||||||
|
|
||||||
deno run prettier/main.ts --write
|
|
||||||
Formats the all files in the repository
|
|
||||||
|
|
||||||
deno run prettier/main.ts script1.ts
|
|
||||||
Print the formatted code to stdout
|
|
||||||
|
|
||||||
cat script1.ts | deno run prettier/main.ts
|
|
||||||
Read the typescript code from stdin and
|
|
||||||
output formatted code to stdout.
|
|
||||||
|
|
||||||
cat config.json | deno run prettier/main.ts --stdin-parser=json
|
|
||||||
Read the JSON string from stdin and
|
|
||||||
output formatted code to stdout.
|
|
||||||
`;
|
|
||||||
|
|
||||||
// Available parsers
|
|
||||||
type ParserLabel = "typescript" | "babel" | "markdown" | "json";
|
|
||||||
|
|
||||||
interface PrettierBuildInOptions {
|
|
||||||
printWidth: number;
|
|
||||||
tabWidth: number;
|
|
||||||
useTabs: boolean;
|
|
||||||
semi: boolean;
|
|
||||||
singleQuote: boolean;
|
|
||||||
quoteProps: string;
|
|
||||||
jsxSingleQuote: boolean;
|
|
||||||
jsxBracketSameLine: boolean;
|
|
||||||
trailingComma: string;
|
|
||||||
bracketSpacing: boolean;
|
|
||||||
arrowParens: string;
|
|
||||||
proseWrap: string;
|
|
||||||
endOfLine: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface PrettierOptions extends PrettierBuildInOptions {
|
|
||||||
write: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
const encoder = new TextEncoder();
|
|
||||||
const decoder = new TextDecoder();
|
|
||||||
|
|
||||||
async function readFileIfExists(filename: string): Promise<string | null> {
|
|
||||||
let data;
|
|
||||||
try {
|
|
||||||
data = await readFile(filename);
|
|
||||||
} catch (e) {
|
|
||||||
// The file is deleted. Returns null.
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return decoder.decode(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the file has been formatted with prettier.
|
|
||||||
*/
|
|
||||||
async function checkFile(
|
|
||||||
filename: string,
|
|
||||||
parser: ParserLabel,
|
|
||||||
prettierOpts: PrettierOptions
|
|
||||||
): Promise<boolean> {
|
|
||||||
const text = await readFileIfExists(filename);
|
|
||||||
|
|
||||||
if (!text) {
|
|
||||||
// The file is empty. Skip.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const formatted = prettier.check(text, {
|
|
||||||
...prettierOpts,
|
|
||||||
parser,
|
|
||||||
plugins: prettierPlugins
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!formatted) {
|
|
||||||
// TODO: print some diff info here to show why this failed
|
|
||||||
console.error(`${filename} ... Not formatted`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return formatted;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Formats the given file.
|
|
||||||
*/
|
|
||||||
async function formatFile(
|
|
||||||
filename: string,
|
|
||||||
parser: ParserLabel,
|
|
||||||
prettierOpts: PrettierOptions
|
|
||||||
): Promise<void> {
|
|
||||||
const text = await readFileIfExists(filename);
|
|
||||||
|
|
||||||
if (!text) {
|
|
||||||
// The file is deleted. Skip.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const formatted: string = prettier.format(text, {
|
|
||||||
...prettierOpts,
|
|
||||||
parser,
|
|
||||||
plugins: prettierPlugins
|
|
||||||
});
|
|
||||||
|
|
||||||
const fileUnit8 = encoder.encode(formatted);
|
|
||||||
if (prettierOpts.write) {
|
|
||||||
if (text !== formatted) {
|
|
||||||
console.log(`Formatting ${filename}`);
|
|
||||||
await writeFile(filename, fileUnit8);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
await stdout.write(fileUnit8);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Selects the right prettier parser for the given path.
|
|
||||||
*/
|
|
||||||
function selectParser(path: string): ParserLabel | null {
|
|
||||||
if (/\.tsx?$/.test(path)) {
|
|
||||||
return "typescript";
|
|
||||||
} else if (/\.jsx?$/.test(path)) {
|
|
||||||
return "babel";
|
|
||||||
} else if (/\.json$/.test(path)) {
|
|
||||||
return "json";
|
|
||||||
} else if (/\.md$/.test(path)) {
|
|
||||||
return "markdown";
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the files of the given paths have been formatted with prettier.
|
|
||||||
* If paths are empty, then checks all the files.
|
|
||||||
*/
|
|
||||||
async function checkSourceFiles(
|
|
||||||
files: AsyncIterableIterator<WalkInfo>,
|
|
||||||
prettierOpts: PrettierOptions
|
|
||||||
): Promise<void> {
|
|
||||||
const checks: Array<Promise<boolean>> = [];
|
|
||||||
|
|
||||||
for await (const { filename } of files) {
|
|
||||||
const parser = selectParser(filename);
|
|
||||||
if (parser) {
|
|
||||||
checks.push(checkFile(filename, parser, prettierOpts));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const results = await Promise.all(checks);
|
|
||||||
|
|
||||||
if (results.every((result): boolean => result)) {
|
|
||||||
console.log("Every file is formatted");
|
|
||||||
exit(0);
|
|
||||||
} else {
|
|
||||||
console.log("Some files are not formatted");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Formats the files of the given paths with prettier.
|
|
||||||
* If paths are empty, then formats all the files.
|
|
||||||
*/
|
|
||||||
async function formatSourceFiles(
|
|
||||||
files: AsyncIterableIterator<WalkInfo>,
|
|
||||||
prettierOpts: PrettierOptions
|
|
||||||
): Promise<void> {
|
|
||||||
const formats: Array<Promise<void>> = [];
|
|
||||||
|
|
||||||
for await (const { filename } of files) {
|
|
||||||
const parser = selectParser(filename);
|
|
||||||
if (parser) {
|
|
||||||
if (prettierOpts.write) {
|
|
||||||
formats.push(formatFile(filename, parser, prettierOpts));
|
|
||||||
} else {
|
|
||||||
await formatFile(filename, parser, prettierOpts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (prettierOpts.write) {
|
|
||||||
await Promise.all(formats);
|
|
||||||
}
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Format source code
|
|
||||||
*/
|
|
||||||
function format(
|
|
||||||
text: string,
|
|
||||||
parser: ParserLabel,
|
|
||||||
prettierOpts: PrettierOptions
|
|
||||||
): string {
|
|
||||||
const formatted: string = prettier.format(text, {
|
|
||||||
...prettierOpts,
|
|
||||||
parser: parser,
|
|
||||||
plugins: prettierPlugins
|
|
||||||
});
|
|
||||||
|
|
||||||
return formatted;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Format code from stdin and output to stdout
|
|
||||||
*/
|
|
||||||
async function formatFromStdin(
|
|
||||||
parser: ParserLabel,
|
|
||||||
prettierOpts: PrettierOptions
|
|
||||||
): Promise<void> {
|
|
||||||
const byte = await readAll(stdin);
|
|
||||||
const formattedCode = format(
|
|
||||||
new TextDecoder().decode(byte),
|
|
||||||
parser,
|
|
||||||
prettierOpts
|
|
||||||
);
|
|
||||||
await stdout.write(new TextEncoder().encode(formattedCode));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the files to format.
|
|
||||||
* @param include The glob patterns to select the files.
|
|
||||||
* eg `"cmd/*.ts"` to select all the typescript files in cmd
|
|
||||||
* directory.
|
|
||||||
* eg `"cmd/run.ts"` to select `cmd/run.ts` file as only.
|
|
||||||
* @param exclude The glob patterns to ignore files.
|
|
||||||
* eg `"*_test.ts"` to ignore all the test file.
|
|
||||||
* @param root The directory from which to apply default globs.
|
|
||||||
* @returns returns an async iterable object
|
|
||||||
*/
|
|
||||||
async function* getTargetFiles(
|
|
||||||
include: string[],
|
|
||||||
exclude: string[],
|
|
||||||
root: string = cwd()
|
|
||||||
): AsyncIterableIterator<WalkInfo> {
|
|
||||||
const expandGlobOpts: ExpandGlobOptions = {
|
|
||||||
root,
|
|
||||||
exclude,
|
|
||||||
includeDirs: true,
|
|
||||||
extended: true,
|
|
||||||
globstar: true
|
|
||||||
};
|
|
||||||
|
|
||||||
async function* expandDirectory(d: string): AsyncIterableIterator<WalkInfo> {
|
|
||||||
for await (const walkInfo of expandGlob("**/*", {
|
|
||||||
...expandGlobOpts,
|
|
||||||
root: d,
|
|
||||||
includeDirs: false
|
|
||||||
})) {
|
|
||||||
yield walkInfo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const globString of include) {
|
|
||||||
for await (const walkInfo of expandGlob(globString, expandGlobOpts)) {
|
|
||||||
if (walkInfo.info.isDirectory()) {
|
|
||||||
yield* expandDirectory(walkInfo.filename);
|
|
||||||
} else {
|
|
||||||
yield walkInfo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* auto detect prettier configuration file and return config if file exist.
|
|
||||||
*/
|
|
||||||
async function autoResolveConfig(): Promise<PrettierBuildInOptions> {
|
|
||||||
const configFileNamesMap = {
|
|
||||||
".prettierrc.json": 1,
|
|
||||||
".prettierrc.yaml": 1,
|
|
||||||
".prettierrc.yml": 1,
|
|
||||||
".prettierrc.js": 1,
|
|
||||||
".prettierrc.ts": 1,
|
|
||||||
"prettier.config.js": 1,
|
|
||||||
"prettier.config.ts": 1,
|
|
||||||
".prettierrc.toml": 1
|
|
||||||
};
|
|
||||||
|
|
||||||
const files = await Deno.readDir(".");
|
|
||||||
|
|
||||||
for (const f of files) {
|
|
||||||
if (f.isFile() && configFileNamesMap[f.name]) {
|
|
||||||
const c = await resolveConfig(f.name);
|
|
||||||
if (c) {
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* parse prettier configuration file.
|
|
||||||
* @param filepath the configuration file path.
|
|
||||||
* support extension name with .json/.toml/.js
|
|
||||||
*/
|
|
||||||
async function resolveConfig(
|
|
||||||
filepath: string
|
|
||||||
): Promise<PrettierBuildInOptions> {
|
|
||||||
let config: PrettierBuildInOptions = undefined;
|
|
||||||
|
|
||||||
function generateError(msg: string): Error {
|
|
||||||
return new Error(`Invalid prettier configuration file: ${msg}.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const raw = new TextDecoder().decode(await Deno.readFile(filepath));
|
|
||||||
|
|
||||||
switch (path.extname(filepath)) {
|
|
||||||
case ".json":
|
|
||||||
try {
|
|
||||||
config = JSON.parse(raw) as PrettierBuildInOptions;
|
|
||||||
} catch (err) {
|
|
||||||
throw generateError(err.message);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ".yml":
|
|
||||||
case ".yaml":
|
|
||||||
try {
|
|
||||||
config = yaml.parse(raw) as PrettierBuildInOptions;
|
|
||||||
} catch (err) {
|
|
||||||
throw generateError(err.message);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ".toml":
|
|
||||||
try {
|
|
||||||
config = toml.parse(raw) as PrettierBuildInOptions;
|
|
||||||
} catch (err) {
|
|
||||||
throw generateError(err.message);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ".js":
|
|
||||||
case ".ts":
|
|
||||||
const absPath = path.isAbsolute(filepath)
|
|
||||||
? filepath
|
|
||||||
: path.join(cwd(), filepath);
|
|
||||||
|
|
||||||
try {
|
|
||||||
const output = await import(
|
|
||||||
// TODO: Remove platform condition
|
|
||||||
// after https://github.com/denoland/deno/issues/3355 fixed
|
|
||||||
Deno.build.os === "win" ? "file://" + absPath : absPath
|
|
||||||
);
|
|
||||||
|
|
||||||
if (output && output.default) {
|
|
||||||
config = output.default as PrettierBuildInOptions;
|
|
||||||
} else {
|
|
||||||
throw new Error(
|
|
||||||
"Prettier of JS version should have default exports."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
throw generateError(err.message);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* auto detect .prettierignore and return pattern if file exist.
|
|
||||||
*/
|
|
||||||
async function autoResolveIgnoreFile(): Promise<Set<string>> {
|
|
||||||
const files = await Deno.readDir(".");
|
|
||||||
|
|
||||||
for (const f of files) {
|
|
||||||
if (f.isFile() && f.name === ".prettierignore") {
|
|
||||||
return await resolveIgnoreFile(f.name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Set([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* parse prettier ignore file.
|
|
||||||
* @param filepath the ignore file path.
|
|
||||||
*/
|
|
||||||
async function resolveIgnoreFile(filepath: string): Promise<Set<string>> {
|
|
||||||
const raw = new TextDecoder().decode(await Deno.readFile(filepath));
|
|
||||||
return ignore.parse(raw);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function main(opts): Promise<void> {
|
|
||||||
const { help, check, _: args } = opts;
|
|
||||||
|
|
||||||
let prettierOpts: PrettierOptions = {
|
|
||||||
printWidth: Number(opts["print-width"]),
|
|
||||||
tabWidth: Number(opts["tab-width"]),
|
|
||||||
useTabs: Boolean(opts["use-tabs"]),
|
|
||||||
semi: Boolean(opts["semi"]),
|
|
||||||
singleQuote: Boolean(opts["single-quote"]),
|
|
||||||
quoteProps: opts["quote-props"],
|
|
||||||
jsxSingleQuote: Boolean(opts["jsx-single-quote"]),
|
|
||||||
jsxBracketSameLine: Boolean(opts["jsx-bracket-same-line "]),
|
|
||||||
trailingComma: opts["trailing-comma"],
|
|
||||||
bracketSpacing: Boolean(opts["bracket-spacing"]),
|
|
||||||
arrowParens: opts["arrow-parens"],
|
|
||||||
proseWrap: opts["prose-wrap"],
|
|
||||||
endOfLine: opts["end-of-line"],
|
|
||||||
write: opts["write"]
|
|
||||||
};
|
|
||||||
|
|
||||||
if (help) {
|
|
||||||
console.log(HELP_MESSAGE);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
const configFilepath = opts["config"];
|
|
||||||
|
|
||||||
if (configFilepath && configFilepath !== "disable") {
|
|
||||||
const config =
|
|
||||||
configFilepath === "auto"
|
|
||||||
? await autoResolveConfig()
|
|
||||||
: await resolveConfig(configFilepath);
|
|
||||||
|
|
||||||
if (config) {
|
|
||||||
prettierOpts = { ...prettierOpts, ...config };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let ignore = opts.ignore as string[];
|
|
||||||
|
|
||||||
if (!Array.isArray(ignore)) {
|
|
||||||
ignore = [ignore];
|
|
||||||
}
|
|
||||||
|
|
||||||
const ignoreFilepath = opts["ignore-path"];
|
|
||||||
|
|
||||||
if (ignoreFilepath && ignoreFilepath !== "disable") {
|
|
||||||
const ignorePatterns =
|
|
||||||
ignoreFilepath === "auto"
|
|
||||||
? await autoResolveIgnoreFile()
|
|
||||||
: await resolveIgnoreFile(ignoreFilepath);
|
|
||||||
|
|
||||||
ignore = ignore.concat(Array.from(ignorePatterns));
|
|
||||||
}
|
|
||||||
|
|
||||||
const files = getTargetFiles(args.length ? args : ["."], ignore);
|
|
||||||
|
|
||||||
const tty = Deno.isTTY();
|
|
||||||
|
|
||||||
const shouldReadFromStdin =
|
|
||||||
(!tty.stdin && (tty.stdout || tty.stderr)) || !!opts["stdin"];
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (shouldReadFromStdin) {
|
|
||||||
await formatFromStdin(opts["stdin-parser"], prettierOpts);
|
|
||||||
} else if (check) {
|
|
||||||
await checkSourceFiles(files, prettierOpts);
|
|
||||||
} else {
|
|
||||||
await formatSourceFiles(files, prettierOpts);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
main(
|
|
||||||
parse(args, {
|
|
||||||
string: [
|
|
||||||
"ignore",
|
|
||||||
"ignore-path",
|
|
||||||
"printWidth",
|
|
||||||
"tab-width",
|
|
||||||
"trailing-comma",
|
|
||||||
"arrow-parens",
|
|
||||||
"prose-wrap",
|
|
||||||
"end-of-line",
|
|
||||||
"stdin-parser",
|
|
||||||
"quote-props"
|
|
||||||
],
|
|
||||||
boolean: [
|
|
||||||
"check",
|
|
||||||
"help",
|
|
||||||
"semi",
|
|
||||||
"use-tabs",
|
|
||||||
"single-quote",
|
|
||||||
"bracket-spacing",
|
|
||||||
"write",
|
|
||||||
"stdin",
|
|
||||||
"jsx-single-quote",
|
|
||||||
"jsx-bracket-same-line"
|
|
||||||
],
|
|
||||||
default: {
|
|
||||||
ignore: [],
|
|
||||||
"print-width": "80",
|
|
||||||
"tab-width": "2",
|
|
||||||
"use-tabs": false,
|
|
||||||
semi: true,
|
|
||||||
"single-quote": false,
|
|
||||||
"trailing-comma": "none",
|
|
||||||
"bracket-spacing": true,
|
|
||||||
"arrow-parens": "avoid",
|
|
||||||
"prose-wrap": "preserve",
|
|
||||||
"end-of-line": "auto",
|
|
||||||
write: false,
|
|
||||||
stdin: false,
|
|
||||||
"stdin-parser": "typescript",
|
|
||||||
"quote-props": "as-needed",
|
|
||||||
"jsx-single-quote": false,
|
|
||||||
"jsx-bracket-same-line": false
|
|
||||||
},
|
|
||||||
alias: {
|
|
||||||
H: "help"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
);
|
|
|
@ -1,551 +0,0 @@
|
||||||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
|
||||||
import { assertEquals } from "../testing/asserts.ts";
|
|
||||||
import { test, runIfMain } from "../testing/mod.ts";
|
|
||||||
import { copy, emptyDir } from "../fs/mod.ts";
|
|
||||||
import { EOL, join } from "../path/mod.ts";
|
|
||||||
import { xrun } from "./util.ts";
|
|
||||||
const { readAll, execPath } = Deno;
|
|
||||||
|
|
||||||
const decoder = new TextDecoder();
|
|
||||||
|
|
||||||
async function run(
|
|
||||||
args: string[]
|
|
||||||
): Promise<{ stdout: string; code: number | undefined }> {
|
|
||||||
const p = xrun({ args, stdout: "piped" });
|
|
||||||
|
|
||||||
const stdout = decoder.decode(await readAll(p.stdout!));
|
|
||||||
const { code } = await p.status();
|
|
||||||
|
|
||||||
return { stdout, code };
|
|
||||||
}
|
|
||||||
|
|
||||||
const cmd = [
|
|
||||||
execPath(),
|
|
||||||
"run",
|
|
||||||
"--allow-run",
|
|
||||||
"--allow-write",
|
|
||||||
"--allow-read",
|
|
||||||
"./prettier/main.ts"
|
|
||||||
];
|
|
||||||
|
|
||||||
const testdata = join("prettier", "testdata");
|
|
||||||
|
|
||||||
function normalizeOutput(output: string): string {
|
|
||||||
return output
|
|
||||||
.replace(/\r/g, "")
|
|
||||||
.replace(/\\/g, "/")
|
|
||||||
.trim()
|
|
||||||
.split("\n")
|
|
||||||
.sort()
|
|
||||||
.join("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
function normalizeSourceCode(source: string): string {
|
|
||||||
return source.replace(/\r/g, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
test(async function testPrettierCheckAndFormatFiles(): Promise<void> {
|
|
||||||
const tempDir = await Deno.makeTempDir();
|
|
||||||
await copy(testdata, tempDir, { overwrite: true });
|
|
||||||
|
|
||||||
const files = [
|
|
||||||
join(tempDir, "0.ts"),
|
|
||||||
join(tempDir, "1.js"),
|
|
||||||
join(tempDir, "2.ts"),
|
|
||||||
join(tempDir, "3.jsx"),
|
|
||||||
join(tempDir, "4.tsx")
|
|
||||||
];
|
|
||||||
|
|
||||||
let p = await run([...cmd, "--check", ...files]);
|
|
||||||
assertEquals(p.code, 1);
|
|
||||||
assertEquals(normalizeOutput(p.stdout), "Some files are not formatted");
|
|
||||||
|
|
||||||
p = await run([...cmd, "--write", ...files]);
|
|
||||||
assertEquals(p.code, 0);
|
|
||||||
assertEquals(
|
|
||||||
normalizeOutput(p.stdout),
|
|
||||||
normalizeOutput(`Formatting ${tempDir}/0.ts
|
|
||||||
Formatting ${tempDir}/1.js
|
|
||||||
Formatting ${tempDir}/3.jsx
|
|
||||||
Formatting ${tempDir}/4.tsx
|
|
||||||
`)
|
|
||||||
);
|
|
||||||
|
|
||||||
p = await run([...cmd, "--check", ...files]);
|
|
||||||
assertEquals(p.code, 0);
|
|
||||||
assertEquals(normalizeOutput(p.stdout), "Every file is formatted");
|
|
||||||
|
|
||||||
emptyDir(tempDir);
|
|
||||||
});
|
|
||||||
|
|
||||||
test(async function testPrettierCheckAndFormatDirs(): Promise<void> {
|
|
||||||
const tempDir = await Deno.makeTempDir();
|
|
||||||
await copy(testdata, tempDir, { overwrite: true });
|
|
||||||
|
|
||||||
const dirs = [join(tempDir, "foo"), join(tempDir, "bar")];
|
|
||||||
|
|
||||||
let p = await run([...cmd, "--check", ...dirs]);
|
|
||||||
assertEquals(p.code, 1);
|
|
||||||
assertEquals(normalizeOutput(p.stdout), "Some files are not formatted");
|
|
||||||
|
|
||||||
p = await run([...cmd, "--write", ...dirs]);
|
|
||||||
assertEquals(p.code, 0);
|
|
||||||
assertEquals(
|
|
||||||
normalizeOutput(p.stdout),
|
|
||||||
normalizeOutput(`Formatting ${tempDir}/bar/0.ts
|
|
||||||
Formatting ${tempDir}/bar/1.js
|
|
||||||
Formatting ${tempDir}/foo/0.ts
|
|
||||||
Formatting ${tempDir}/foo/1.js`)
|
|
||||||
);
|
|
||||||
|
|
||||||
p = await run([...cmd, "--check", ...dirs]);
|
|
||||||
assertEquals(p.code, 0);
|
|
||||||
assertEquals(normalizeOutput(p.stdout), "Every file is formatted");
|
|
||||||
|
|
||||||
emptyDir(tempDir);
|
|
||||||
});
|
|
||||||
|
|
||||||
test(async function testPrettierOptions(): Promise<void> {
|
|
||||||
const tempDir = await Deno.makeTempDir();
|
|
||||||
await copy(testdata, tempDir, { overwrite: true });
|
|
||||||
|
|
||||||
const file0 = join(tempDir, "opts", "0.ts");
|
|
||||||
const file1 = join(tempDir, "opts", "1.ts");
|
|
||||||
const file2 = join(tempDir, "opts", "2.ts");
|
|
||||||
const file3 = join(tempDir, "opts", "3.md");
|
|
||||||
|
|
||||||
const getSourceCode = async (f: string): Promise<string> =>
|
|
||||||
decoder.decode(await Deno.readFile(f));
|
|
||||||
|
|
||||||
await run([...cmd, "--no-semi", "--write", file0]);
|
|
||||||
assertEquals(
|
|
||||||
normalizeSourceCode(await getSourceCode(file0)),
|
|
||||||
`console.log(0)
|
|
||||||
console.log([function foo() {}, function baz() {}, a => {}])
|
|
||||||
`
|
|
||||||
);
|
|
||||||
|
|
||||||
await run([
|
|
||||||
...cmd,
|
|
||||||
"--print-width",
|
|
||||||
"30",
|
|
||||||
"--tab-width",
|
|
||||||
"4",
|
|
||||||
"--write",
|
|
||||||
file0
|
|
||||||
]);
|
|
||||||
assertEquals(
|
|
||||||
normalizeSourceCode(await getSourceCode(file0)),
|
|
||||||
`console.log(0);
|
|
||||||
console.log([
|
|
||||||
function foo() {},
|
|
||||||
function baz() {},
|
|
||||||
a => {}
|
|
||||||
]);
|
|
||||||
`
|
|
||||||
);
|
|
||||||
|
|
||||||
await run([...cmd, "--print-width", "30", "--use-tabs", "--write", file0]);
|
|
||||||
assertEquals(
|
|
||||||
normalizeSourceCode(await getSourceCode(file0)),
|
|
||||||
`console.log(0);
|
|
||||||
console.log([
|
|
||||||
function foo() {},
|
|
||||||
function baz() {},
|
|
||||||
a => {}
|
|
||||||
]);
|
|
||||||
`
|
|
||||||
);
|
|
||||||
|
|
||||||
await run([...cmd, "--single-quote", "--write", file1]);
|
|
||||||
assertEquals(
|
|
||||||
normalizeSourceCode(await getSourceCode(file1)),
|
|
||||||
`console.log('1');
|
|
||||||
`
|
|
||||||
);
|
|
||||||
|
|
||||||
await run([
|
|
||||||
...cmd,
|
|
||||||
"--print-width",
|
|
||||||
"30",
|
|
||||||
"--trailing-comma",
|
|
||||||
"all",
|
|
||||||
"--write",
|
|
||||||
file0
|
|
||||||
]);
|
|
||||||
assertEquals(
|
|
||||||
normalizeSourceCode(await getSourceCode(file0)),
|
|
||||||
`console.log(0);
|
|
||||||
console.log([
|
|
||||||
function foo() {},
|
|
||||||
function baz() {},
|
|
||||||
a => {},
|
|
||||||
]);
|
|
||||||
`
|
|
||||||
);
|
|
||||||
|
|
||||||
await run([...cmd, "--no-bracket-spacing", "--write", file2]);
|
|
||||||
assertEquals(
|
|
||||||
normalizeSourceCode(await getSourceCode(file2)),
|
|
||||||
`console.log({a: 1});
|
|
||||||
`
|
|
||||||
);
|
|
||||||
|
|
||||||
await run([...cmd, "--arrow-parens", "always", "--write", file0]);
|
|
||||||
assertEquals(
|
|
||||||
normalizeSourceCode(await getSourceCode(file0)),
|
|
||||||
`console.log(0);
|
|
||||||
console.log([function foo() {}, function baz() {}, (a) => {}]);
|
|
||||||
`
|
|
||||||
);
|
|
||||||
|
|
||||||
await run([...cmd, "--prose-wrap", "always", "--write", file3]);
|
|
||||||
assertEquals(
|
|
||||||
normalizeSourceCode(await getSourceCode(file3)),
|
|
||||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, " +
|
|
||||||
"sed do eiusmod tempor" +
|
|
||||||
"\nincididunt ut labore et dolore magna aliqua.\n"
|
|
||||||
);
|
|
||||||
|
|
||||||
await run([...cmd, "--end-of-line", "crlf", "--write", file2]);
|
|
||||||
assertEquals(await getSourceCode(file2), "console.log({ a: 1 });\r\n");
|
|
||||||
|
|
||||||
emptyDir(tempDir);
|
|
||||||
});
|
|
||||||
|
|
||||||
test(async function testPrettierPrintToStdout(): Promise<void> {
|
|
||||||
const tempDir = await Deno.makeTempDir();
|
|
||||||
await copy(testdata, tempDir, { overwrite: true });
|
|
||||||
|
|
||||||
const file0 = join(tempDir, "0.ts");
|
|
||||||
const file1 = join(tempDir, "formatted.ts");
|
|
||||||
|
|
||||||
const getSourceCode = async (f: string): Promise<string> =>
|
|
||||||
decoder.decode(await Deno.readFile(f));
|
|
||||||
|
|
||||||
const { stdout } = await run([...cmd, file0]);
|
|
||||||
// The source file will not change without `--write` flags.
|
|
||||||
assertEquals(
|
|
||||||
await getSourceCode(file0),
|
|
||||||
`console.log (0)
|
|
||||||
`
|
|
||||||
);
|
|
||||||
// The output should be formatted code.
|
|
||||||
assertEquals(
|
|
||||||
stdout,
|
|
||||||
`console.log(0);
|
|
||||||
`
|
|
||||||
);
|
|
||||||
|
|
||||||
const { stdout: formattedCode } = await run([...cmd, file1]);
|
|
||||||
// The source file will not change without `--write` flags.
|
|
||||||
assertEquals(
|
|
||||||
await getSourceCode(file1),
|
|
||||||
`console.log(0);
|
|
||||||
`
|
|
||||||
);
|
|
||||||
// The output will be formatted code even it is the same as the source file's
|
|
||||||
// content.
|
|
||||||
assertEquals(
|
|
||||||
formattedCode,
|
|
||||||
`console.log(0);
|
|
||||||
`
|
|
||||||
);
|
|
||||||
|
|
||||||
emptyDir(tempDir);
|
|
||||||
});
|
|
||||||
|
|
||||||
// TODO(bartlomieju): reenable after landing rusty_v8 branch
|
|
||||||
// crashing on Windows
|
|
||||||
/*
|
|
||||||
test(async function testPrettierReadFromStdin(): Promise<void> {
|
|
||||||
interface TestCase {
|
|
||||||
stdin: string;
|
|
||||||
stdout: string;
|
|
||||||
stderr: string;
|
|
||||||
code: number;
|
|
||||||
success: boolean;
|
|
||||||
parser?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function readFromStdinAssertion(
|
|
||||||
stdin: string,
|
|
||||||
expectedStdout: string,
|
|
||||||
expectedStderr: string,
|
|
||||||
expectedCode: number,
|
|
||||||
expectedSuccess: boolean,
|
|
||||||
parser?: string
|
|
||||||
): Promise<void> {
|
|
||||||
const inputCode = stdin;
|
|
||||||
const p1 = Deno.run({
|
|
||||||
args: [execPath(), "./prettier/testdata/echox.ts", `${inputCode}`],
|
|
||||||
stdout: "piped"
|
|
||||||
});
|
|
||||||
|
|
||||||
const p2 = Deno.run({
|
|
||||||
args: [
|
|
||||||
execPath(),
|
|
||||||
"run",
|
|
||||||
"./prettier/main.ts",
|
|
||||||
"--stdin",
|
|
||||||
...(parser ? ["--stdin-parser", parser] : [])
|
|
||||||
],
|
|
||||||
stdin: "piped",
|
|
||||||
stdout: "piped",
|
|
||||||
stderr: "piped"
|
|
||||||
});
|
|
||||||
|
|
||||||
const n = await Deno.copy(p2.stdin!, p1.stdout!);
|
|
||||||
assertEquals(n, new TextEncoder().encode(stdin).length);
|
|
||||||
|
|
||||||
const status1 = await p1.status();
|
|
||||||
assertEquals(status1.code, 0);
|
|
||||||
assertEquals(status1.success, true);
|
|
||||||
p2.stdin!.close();
|
|
||||||
const status2 = await p2.status();
|
|
||||||
assertEquals(status2.code, expectedCode);
|
|
||||||
assertEquals(status2.success, expectedSuccess);
|
|
||||||
const decoder = new TextDecoder("utf-8");
|
|
||||||
assertEquals(
|
|
||||||
decoder.decode(await Deno.readAll(p2.stdout!)),
|
|
||||||
expectedStdout
|
|
||||||
);
|
|
||||||
assertEquals(
|
|
||||||
decoder.decode(await Deno.readAll(p2.stderr!)).split(EOL)[0],
|
|
||||||
expectedStderr
|
|
||||||
);
|
|
||||||
p2.close();
|
|
||||||
p1.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
const testCases: TestCase[] = [
|
|
||||||
{
|
|
||||||
stdin: `console.log("abc" )`,
|
|
||||||
stdout: `console.log("abc");\n`,
|
|
||||||
stderr: ``,
|
|
||||||
code: 0,
|
|
||||||
success: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
stdin: `console.log("abc" )`,
|
|
||||||
stdout: `console.log("abc");\n`,
|
|
||||||
stderr: ``,
|
|
||||||
code: 0,
|
|
||||||
success: true,
|
|
||||||
parser: "babel"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
stdin: `{\"a\":\"b\"}`,
|
|
||||||
stdout: `{ "a": "b" }\n`,
|
|
||||||
stderr: ``,
|
|
||||||
code: 0,
|
|
||||||
success: true,
|
|
||||||
parser: "json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
stdin: `## test`,
|
|
||||||
stdout: `## test\n`,
|
|
||||||
stderr: ``,
|
|
||||||
code: 0,
|
|
||||||
success: true,
|
|
||||||
parser: "markdown"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
stdin: `invalid typescript code##!!@@`,
|
|
||||||
stdout: ``,
|
|
||||||
stderr: `SyntaxError: ';' expected. (1:9)`,
|
|
||||||
code: 1,
|
|
||||||
success: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
stdin: `console.log("foo");`,
|
|
||||||
stdout: ``,
|
|
||||||
stderr:
|
|
||||||
'Error: Couldn\'t resolve parser "invalid_parser". ' +
|
|
||||||
"Parsers must be explicitly added to the standalone bundle.",
|
|
||||||
code: 1,
|
|
||||||
success: false,
|
|
||||||
parser: "invalid_parser"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
for (const t of testCases) {
|
|
||||||
await readFromStdinAssertion(
|
|
||||||
t.stdin,
|
|
||||||
t.stdout,
|
|
||||||
t.stderr,
|
|
||||||
t.code,
|
|
||||||
t.success,
|
|
||||||
t.parser
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
|
|
||||||
test(async function testPrettierWithAutoConfig(): Promise<void> {
|
|
||||||
const configs = [
|
|
||||||
"config_file_json",
|
|
||||||
"config_file_toml",
|
|
||||||
"config_file_js",
|
|
||||||
"config_file_ts",
|
|
||||||
"config_file_yaml",
|
|
||||||
"config_file_yml"
|
|
||||||
];
|
|
||||||
|
|
||||||
for (const configName of configs) {
|
|
||||||
const cwd = join(testdata, configName);
|
|
||||||
const prettierFile = join(Deno.cwd(), "prettier", "main.ts");
|
|
||||||
const { stdout, stderr } = Deno.run({
|
|
||||||
args: [
|
|
||||||
execPath(),
|
|
||||||
"run",
|
|
||||||
"--allow-read",
|
|
||||||
"--allow-env",
|
|
||||||
prettierFile,
|
|
||||||
"../5.ts",
|
|
||||||
"--config",
|
|
||||||
"auto"
|
|
||||||
],
|
|
||||||
stdout: "piped",
|
|
||||||
stderr: "piped",
|
|
||||||
cwd
|
|
||||||
});
|
|
||||||
|
|
||||||
const output = decoder.decode(await Deno.readAll(stdout));
|
|
||||||
const errMsg = decoder.decode(await Deno.readAll(stderr));
|
|
||||||
|
|
||||||
assertEquals(
|
|
||||||
errMsg
|
|
||||||
.split(EOL)
|
|
||||||
.filter((line: string) => line.indexOf("Compile") !== 0)
|
|
||||||
.join(EOL),
|
|
||||||
""
|
|
||||||
);
|
|
||||||
|
|
||||||
assertEquals(output, `console.log('0');\n`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
test(async function testPrettierWithSpecifiedConfig(): Promise<void> {
|
|
||||||
interface Config {
|
|
||||||
dir: string;
|
|
||||||
name: string;
|
|
||||||
}
|
|
||||||
const configs: Config[] = [
|
|
||||||
{
|
|
||||||
dir: "config_file_json",
|
|
||||||
name: ".prettierrc.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
dir: "config_file_toml",
|
|
||||||
name: ".prettierrc.toml"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
dir: "config_file_js",
|
|
||||||
name: ".prettierrc.js"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
dir: "config_file_ts",
|
|
||||||
name: ".prettierrc.ts"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
dir: "config_file_yaml",
|
|
||||||
name: ".prettierrc.yaml"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
dir: "config_file_yml",
|
|
||||||
name: ".prettierrc.yml"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
for (const config of configs) {
|
|
||||||
const cwd = join(testdata, config.dir);
|
|
||||||
const prettierFile = join(Deno.cwd(), "prettier", "main.ts");
|
|
||||||
const { stdout, stderr } = Deno.run({
|
|
||||||
args: [
|
|
||||||
execPath(),
|
|
||||||
"run",
|
|
||||||
"--allow-read",
|
|
||||||
"--allow-env",
|
|
||||||
prettierFile,
|
|
||||||
"../5.ts",
|
|
||||||
"--config",
|
|
||||||
config.name
|
|
||||||
],
|
|
||||||
stdout: "piped",
|
|
||||||
stderr: "piped",
|
|
||||||
cwd
|
|
||||||
});
|
|
||||||
|
|
||||||
const output = decoder.decode(await Deno.readAll(stdout));
|
|
||||||
const errMsg = decoder.decode(await Deno.readAll(stderr));
|
|
||||||
|
|
||||||
assertEquals(
|
|
||||||
errMsg
|
|
||||||
.split(EOL)
|
|
||||||
.filter((line: string) => line.indexOf("Compile") !== 0)
|
|
||||||
.join(EOL),
|
|
||||||
""
|
|
||||||
);
|
|
||||||
|
|
||||||
assertEquals(output, `console.log('0');\n`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
test(async function testPrettierWithAutoIgnore(): Promise<void> {
|
|
||||||
// only format typescript file
|
|
||||||
const cwd = join(testdata, "ignore_file");
|
|
||||||
const prettierFile = join(Deno.cwd(), "prettier", "main.ts");
|
|
||||||
const { stdout, stderr } = Deno.run({
|
|
||||||
args: [
|
|
||||||
execPath(),
|
|
||||||
"run",
|
|
||||||
"--allow-read",
|
|
||||||
"--allow-env",
|
|
||||||
prettierFile,
|
|
||||||
"**/*",
|
|
||||||
"--ignore-path",
|
|
||||||
"auto"
|
|
||||||
],
|
|
||||||
stdout: "piped",
|
|
||||||
stderr: "piped",
|
|
||||||
cwd
|
|
||||||
});
|
|
||||||
|
|
||||||
assertEquals(decoder.decode(await Deno.readAll(stderr)), "");
|
|
||||||
|
|
||||||
assertEquals(
|
|
||||||
decoder.decode(await Deno.readAll(stdout)),
|
|
||||||
`console.log("typescript");\nconsole.log("typescript1");\n`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
test(async function testPrettierWithSpecifiedIgnore(): Promise<void> {
|
|
||||||
// only format javascript file
|
|
||||||
const cwd = join(testdata, "ignore_file");
|
|
||||||
const prettierFile = join(Deno.cwd(), "prettier", "main.ts");
|
|
||||||
const { stdout, stderr } = Deno.run({
|
|
||||||
args: [
|
|
||||||
execPath(),
|
|
||||||
"run",
|
|
||||||
"--allow-read",
|
|
||||||
"--allow-env",
|
|
||||||
prettierFile,
|
|
||||||
"**/*",
|
|
||||||
"--ignore-path",
|
|
||||||
"typescript.prettierignore"
|
|
||||||
],
|
|
||||||
stdout: "piped",
|
|
||||||
stderr: "piped",
|
|
||||||
cwd
|
|
||||||
});
|
|
||||||
|
|
||||||
assertEquals(decoder.decode(await Deno.readAll(stderr)), "");
|
|
||||||
|
|
||||||
assertEquals(
|
|
||||||
decoder.decode(await Deno.readAll(stdout)),
|
|
||||||
`console.log("javascript");\nconsole.log("javascript1");\n`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
runIfMain(import.meta);
|
|
|
@ -1,19 +0,0 @@
|
||||||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
|
||||||
/**
|
|
||||||
* Types are given here because parser files are big
|
|
||||||
* and it's much faster to give TS compiler just type declarations.
|
|
||||||
*/
|
|
||||||
// @deno-types="./vendor/standalone.d.ts"
|
|
||||||
import "./vendor/standalone.js";
|
|
||||||
// @deno-types="./vendor/parser_typescript.d.ts"
|
|
||||||
import "./vendor/parser_typescript.js";
|
|
||||||
// @deno-types="./vendor/parser_babylon.d.ts"
|
|
||||||
import "./vendor/parser_babylon.js";
|
|
||||||
// @deno-types="./vendor/parser_markdown.d.ts"
|
|
||||||
import "./vendor/parser_markdown.js";
|
|
||||||
|
|
||||||
// TODO: provide decent type declarions for these
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
const { prettier, prettierPlugins } = window as any;
|
|
||||||
|
|
||||||
export { prettier, prettierPlugins };
|
|
1
std/prettier/testdata/0.ts
vendored
1
std/prettier/testdata/0.ts
vendored
|
@ -1 +0,0 @@
|
||||||
console.log (0)
|
|
1
std/prettier/testdata/1.js
vendored
1
std/prettier/testdata/1.js
vendored
|
@ -1 +0,0 @@
|
||||||
console.log (1)
|
|
0
std/prettier/testdata/2.ts
vendored
0
std/prettier/testdata/2.ts
vendored
2
std/prettier/testdata/3.jsx
vendored
2
std/prettier/testdata/3.jsx
vendored
|
@ -1,2 +0,0 @@
|
||||||
<div>
|
|
||||||
</div>
|
|
3
std/prettier/testdata/4.tsx
vendored
3
std/prettier/testdata/4.tsx
vendored
|
@ -1,3 +0,0 @@
|
||||||
<div>
|
|
||||||
</div>
|
|
||||||
|
|
1
std/prettier/testdata/5.ts
vendored
1
std/prettier/testdata/5.ts
vendored
|
@ -1 +0,0 @@
|
||||||
console.log("0" )
|
|
1
std/prettier/testdata/bar/0.ts
vendored
1
std/prettier/testdata/bar/0.ts
vendored
|
@ -1 +0,0 @@
|
||||||
console.log (0)
|
|
1
std/prettier/testdata/bar/1.js
vendored
1
std/prettier/testdata/bar/1.js
vendored
|
@ -1 +0,0 @@
|
||||||
console.log (1)
|
|
|
@ -1,5 +0,0 @@
|
||||||
// prettier.config.js or .prettierrc.js
|
|
||||||
export default {
|
|
||||||
singleQuote: true,
|
|
||||||
trailingComma: "all"
|
|
||||||
};
|
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"singleQuote": true,
|
|
||||||
"trailingComma": "all"
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
singleQuote = true
|
|
||||||
trailingComma= "all"
|
|
|
@ -1,5 +0,0 @@
|
||||||
// prettier.config.js or .prettierrc.js
|
|
||||||
export default {
|
|
||||||
singleQuote: true,
|
|
||||||
trailingComma: "all"
|
|
||||||
};
|
|
|
@ -1,2 +0,0 @@
|
||||||
singleQuote: true
|
|
||||||
trailingComma: "all"
|
|
|
@ -1,2 +0,0 @@
|
||||||
singleQuote: true
|
|
||||||
trailingComma: "all"
|
|
8
std/prettier/testdata/echox.ts
vendored
8
std/prettier/testdata/echox.ts
vendored
|
@ -1,8 +0,0 @@
|
||||||
async function echox(args: string[]) {
|
|
||||||
for (const arg of args) {
|
|
||||||
await Deno.stdout.write(new TextEncoder().encode(arg));
|
|
||||||
}
|
|
||||||
Deno.exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
echox(Deno.args);
|
|
1
std/prettier/testdata/foo/0.ts
vendored
1
std/prettier/testdata/foo/0.ts
vendored
|
@ -1 +0,0 @@
|
||||||
console.log (0)
|
|
1
std/prettier/testdata/foo/1.js
vendored
1
std/prettier/testdata/foo/1.js
vendored
|
@ -1 +0,0 @@
|
||||||
console.log (1)
|
|
1
std/prettier/testdata/formatted.ts
vendored
1
std/prettier/testdata/formatted.ts
vendored
|
@ -1 +0,0 @@
|
||||||
console.log(0);
|
|
|
@ -1,3 +0,0 @@
|
||||||
# ignore javascript/markdown file
|
|
||||||
*.js
|
|
||||||
*.md
|
|
1
std/prettier/testdata/ignore_file/0.js
vendored
1
std/prettier/testdata/ignore_file/0.js
vendored
|
@ -1 +0,0 @@
|
||||||
console.log("javascript" )
|
|
1
std/prettier/testdata/ignore_file/0.ts
vendored
1
std/prettier/testdata/ignore_file/0.ts
vendored
|
@ -1 +0,0 @@
|
||||||
console.log("typescript" )
|
|
1
std/prettier/testdata/ignore_file/1.js
vendored
1
std/prettier/testdata/ignore_file/1.js
vendored
|
@ -1 +0,0 @@
|
||||||
console.log("javascript1" )
|
|
1
std/prettier/testdata/ignore_file/1.ts
vendored
1
std/prettier/testdata/ignore_file/1.ts
vendored
|
@ -1 +0,0 @@
|
||||||
console.log("typescript1" )
|
|
5
std/prettier/testdata/ignore_file/README.md
vendored
5
std/prettier/testdata/ignore_file/README.md
vendored
|
@ -1,5 +0,0 @@
|
||||||
test format
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
console.log('')
|
|
||||||
```
|
|
|
@ -1,3 +0,0 @@
|
||||||
# ignore typescript/markdown file
|
|
||||||
*.ts
|
|
||||||
*.md
|
|
6
std/prettier/testdata/opts/0.ts
vendored
6
std/prettier/testdata/opts/0.ts
vendored
|
@ -1,6 +0,0 @@
|
||||||
console.log(0);
|
|
||||||
console.log([
|
|
||||||
function foo() {},
|
|
||||||
function baz() {},
|
|
||||||
a => {}
|
|
||||||
]);
|
|
1
std/prettier/testdata/opts/1.ts
vendored
1
std/prettier/testdata/opts/1.ts
vendored
|
@ -1 +0,0 @@
|
||||||
console.log ("1")
|
|
1
std/prettier/testdata/opts/2.ts
vendored
1
std/prettier/testdata/opts/2.ts
vendored
|
@ -1 +0,0 @@
|
||||||
console.log({a:1})
|
|
1
std/prettier/testdata/opts/3.md
vendored
1
std/prettier/testdata/opts/3.md
vendored
|
@ -1 +0,0 @@
|
||||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
|
@ -1,10 +0,0 @@
|
||||||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
|
||||||
const { build, run } = Deno;
|
|
||||||
|
|
||||||
// Runs a command in cross-platform way
|
|
||||||
export function xrun(opts: Deno.RunOptions): Deno.Process {
|
|
||||||
return run({
|
|
||||||
...opts,
|
|
||||||
args: build.os === "win" ? ["cmd.exe", "/c", ...opts.args] : opts.args
|
|
||||||
});
|
|
||||||
}
|
|
507
std/prettier/vendor/index.d.ts
vendored
507
std/prettier/vendor/index.d.ts
vendored
|
@ -1,507 +0,0 @@
|
||||||
// Type definitions for prettier 1.18
|
|
||||||
// Project: https://github.com/prettier/prettier, https://prettier.io
|
|
||||||
// Definitions by: Ika <https://github.com/ikatyang>,
|
|
||||||
// Ifiok Jr. <https://github.com/ifiokjr>,
|
|
||||||
// Florian Keller <https://github.com/ffflorian>,
|
|
||||||
// Sosuke Suzuki <https://github.com/sosukesuzuki>
|
|
||||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
||||||
// TypeScript Version: 2.8
|
|
||||||
|
|
||||||
export type AST = any;
|
|
||||||
export type Doc = doc.builders.Doc;
|
|
||||||
|
|
||||||
// https://github.com/prettier/prettier/blob/master/src/common/fast-path.js
|
|
||||||
export interface FastPath<T = any> {
|
|
||||||
stack: any[];
|
|
||||||
getName(): null | PropertyKey;
|
|
||||||
getValue(): T;
|
|
||||||
getNode(count?: number): null | T;
|
|
||||||
getParentNode(count?: number): null | T;
|
|
||||||
call<U>(callback: (path: this) => U, ...names: PropertyKey[]): U;
|
|
||||||
each(callback: (path: this) => void, ...names: PropertyKey[]): void;
|
|
||||||
map<U>(callback: (path: this, index: number) => U, ...names: PropertyKey[]): U[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export type BuiltInParser = (text: string, options?: any) => AST;
|
|
||||||
export type BuiltInParserName =
|
|
||||||
| 'babylon' // deprecated
|
|
||||||
| 'babel'
|
|
||||||
| 'babel-flow'
|
|
||||||
| 'flow'
|
|
||||||
| 'typescript'
|
|
||||||
| 'postcss' // deprecated
|
|
||||||
| 'css'
|
|
||||||
| 'less'
|
|
||||||
| 'scss'
|
|
||||||
| 'json'
|
|
||||||
| 'json5'
|
|
||||||
| 'json-stringify'
|
|
||||||
| 'graphql'
|
|
||||||
| 'markdown'
|
|
||||||
| 'vue'
|
|
||||||
| 'html'
|
|
||||||
| 'angular'
|
|
||||||
| 'mdx'
|
|
||||||
| 'yaml'
|
|
||||||
| 'lwc';
|
|
||||||
|
|
||||||
export type CustomParser = (text: string, parsers: Record<BuiltInParserName, BuiltInParser>, options: Options) => AST;
|
|
||||||
|
|
||||||
export interface Options extends Partial<RequiredOptions> {}
|
|
||||||
export interface RequiredOptions extends doc.printer.Options {
|
|
||||||
/**
|
|
||||||
* Print semicolons at the ends of statements.
|
|
||||||
*/
|
|
||||||
semi: boolean;
|
|
||||||
/**
|
|
||||||
* Use single quotes instead of double quotes.
|
|
||||||
*/
|
|
||||||
singleQuote: boolean;
|
|
||||||
/**
|
|
||||||
* Use single quotes in JSX.
|
|
||||||
*/
|
|
||||||
jsxSingleQuote: boolean;
|
|
||||||
/**
|
|
||||||
* Print trailing commas wherever possible.
|
|
||||||
*/
|
|
||||||
trailingComma: 'none' | 'es5' | 'all';
|
|
||||||
/**
|
|
||||||
* Print spaces between brackets in object literals.
|
|
||||||
*/
|
|
||||||
bracketSpacing: boolean;
|
|
||||||
/**
|
|
||||||
* Put the `>` of a multi-line JSX element at the end of the last line instead of being alone on the next line.
|
|
||||||
*/
|
|
||||||
jsxBracketSameLine: boolean;
|
|
||||||
/**
|
|
||||||
* Format only a segment of a file.
|
|
||||||
*/
|
|
||||||
rangeStart: number;
|
|
||||||
/**
|
|
||||||
* Format only a segment of a file.
|
|
||||||
*/
|
|
||||||
rangeEnd: number;
|
|
||||||
/**
|
|
||||||
* Specify which parser to use.
|
|
||||||
*/
|
|
||||||
parser: BuiltInParserName | CustomParser;
|
|
||||||
/**
|
|
||||||
* Specify the input filepath. This will be used to do parser inference.
|
|
||||||
*/
|
|
||||||
filepath: string;
|
|
||||||
/**
|
|
||||||
* Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file.
|
|
||||||
* This is very useful when gradually transitioning large, unformatted codebases to prettier.
|
|
||||||
*/
|
|
||||||
requirePragma: boolean;
|
|
||||||
/**
|
|
||||||
* Prettier can insert a special @format marker at the top of files specifying that
|
|
||||||
* the file has been formatted with prettier. This works well when used in tandem with
|
|
||||||
* the --require-pragma option. If there is already a docblock at the top of
|
|
||||||
* the file then this option will add a newline to it with the @format marker.
|
|
||||||
*/
|
|
||||||
insertPragma: boolean;
|
|
||||||
/**
|
|
||||||
* By default, Prettier will wrap markdown text as-is since some services use a linebreak-sensitive renderer.
|
|
||||||
* In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out.
|
|
||||||
*/
|
|
||||||
proseWrap:
|
|
||||||
| boolean // deprecated
|
|
||||||
| 'always'
|
|
||||||
| 'never'
|
|
||||||
| 'preserve';
|
|
||||||
/**
|
|
||||||
* Include parentheses around a sole arrow function parameter.
|
|
||||||
*/
|
|
||||||
arrowParens: 'avoid' | 'always';
|
|
||||||
/**
|
|
||||||
* The plugin API is in a beta state.
|
|
||||||
*/
|
|
||||||
plugins: Array<string | Plugin>;
|
|
||||||
/**
|
|
||||||
* How to handle whitespaces in HTML.
|
|
||||||
*/
|
|
||||||
htmlWhitespaceSensitivity: 'css' | 'strict' | 'ignore';
|
|
||||||
/**
|
|
||||||
* Which end of line characters to apply.
|
|
||||||
*/
|
|
||||||
endOfLine: 'auto' | 'lf' | 'crlf' | 'cr';
|
|
||||||
/**
|
|
||||||
* Change when properties in objects are quoted.
|
|
||||||
*/
|
|
||||||
quoteProps: 'as-needed' | 'consistent' | 'preserve';
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ParserOptions extends RequiredOptions {
|
|
||||||
locStart: (node: any) => number;
|
|
||||||
locEnd: (node: any) => number;
|
|
||||||
originalText: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Plugin {
|
|
||||||
languages?: SupportLanguage[];
|
|
||||||
parsers?: { [parserName: string]: Parser };
|
|
||||||
printers?: { [astFormat: string]: Printer };
|
|
||||||
options?: SupportOption[];
|
|
||||||
defaultOptions?: Partial<RequiredOptions>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Parser {
|
|
||||||
parse: (text: string, parsers: { [parserName: string]: Parser }, options: ParserOptions) => AST;
|
|
||||||
astFormat: string;
|
|
||||||
hasPragma?: (text: string) => boolean;
|
|
||||||
locStart: (node: any) => number;
|
|
||||||
locEnd: (node: any) => number;
|
|
||||||
preprocess?: (text: string, options: ParserOptions) => string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Printer {
|
|
||||||
print(
|
|
||||||
path: FastPath,
|
|
||||||
options: ParserOptions,
|
|
||||||
print: (path: FastPath) => Doc,
|
|
||||||
): Doc;
|
|
||||||
embed?: (
|
|
||||||
path: FastPath,
|
|
||||||
print: (path: FastPath) => Doc,
|
|
||||||
textToDoc: (text: string, options: Options) => Doc,
|
|
||||||
options: ParserOptions,
|
|
||||||
) => Doc | null;
|
|
||||||
insertPragma?: (text: string) => string;
|
|
||||||
/**
|
|
||||||
* @returns `null` if you want to remove this node
|
|
||||||
* @returns `void` if you want to use modified newNode
|
|
||||||
* @returns anything if you want to replace the node with it
|
|
||||||
*/
|
|
||||||
massageAstNode?: (node: any, newNode: any, parent: any) => any;
|
|
||||||
hasPrettierIgnore?: (path: FastPath) => boolean;
|
|
||||||
canAttachComment?: (node: any) => boolean;
|
|
||||||
willPrintOwnComments?: (path: FastPath) => boolean;
|
|
||||||
printComments?: (path: FastPath, print: (path: FastPath) => Doc, options: ParserOptions, needsSemi: boolean) => Doc;
|
|
||||||
handleComments?: {
|
|
||||||
ownLine?: (commentNode: any, text: string, options: ParserOptions, ast: any, isLastComment: boolean) => boolean;
|
|
||||||
endOfLine?: (commentNode: any, text: string, options: ParserOptions, ast: any, isLastComment: boolean) => boolean;
|
|
||||||
remaining?: (commentNode: any, text: string, options: ParserOptions, ast: any, isLastComment: boolean) => boolean;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CursorOptions extends Options {
|
|
||||||
/**
|
|
||||||
* Specify where the cursor is.
|
|
||||||
*/
|
|
||||||
cursorOffset: number;
|
|
||||||
rangeStart?: never;
|
|
||||||
rangeEnd?: never;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CursorResult {
|
|
||||||
formatted: string;
|
|
||||||
cursorOffset: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* `format` is used to format text using Prettier. [Options](https://github.com/prettier/prettier#options) may be provided to override the defaults.
|
|
||||||
*/
|
|
||||||
export function format(source: string, options?: Options): string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* `check` checks to see if the file has been formatted with Prettier given those options and returns a `Boolean`.
|
|
||||||
* This is similar to the `--list-different` parameter in the CLI and is useful for running Prettier in CI scenarios.
|
|
||||||
*/
|
|
||||||
export function check(source: string, options?: Options): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* `formatWithCursor` both formats the code, and translates a cursor position from unformatted code to formatted code.
|
|
||||||
* This is useful for editor integrations, to prevent the cursor from moving when code is formatted.
|
|
||||||
*
|
|
||||||
* The `cursorOffset` option should be provided, to specify where the cursor is. This option cannot be used with `rangeStart` and `rangeEnd`.
|
|
||||||
*/
|
|
||||||
export function formatWithCursor(source: string, options: CursorOptions): CursorResult;
|
|
||||||
|
|
||||||
export interface ResolveConfigOptions {
|
|
||||||
/**
|
|
||||||
* If set to `false`, all caching will be bypassed.
|
|
||||||
*/
|
|
||||||
useCache?: boolean;
|
|
||||||
/**
|
|
||||||
* Pass directly the path of the config file if you don't wish to search for it.
|
|
||||||
*/
|
|
||||||
config?: string;
|
|
||||||
/**
|
|
||||||
* If set to `true` and an `.editorconfig` file is in your project,
|
|
||||||
* Prettier will parse it and convert its properties to the corresponding prettier configuration.
|
|
||||||
* This configuration will be overridden by `.prettierrc`, etc. Currently,
|
|
||||||
* the following EditorConfig properties are supported:
|
|
||||||
* - indent_style
|
|
||||||
* - indent_size/tab_width
|
|
||||||
* - max_line_length
|
|
||||||
*/
|
|
||||||
editorconfig?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* `resolveConfig` can be used to resolve configuration for a given source file,
|
|
||||||
* passing its path as the first argument. The config search will start at the
|
|
||||||
* file path and continue to search up the directory.
|
|
||||||
* (You can use `process.cwd()` to start searching from the current directory).
|
|
||||||
*
|
|
||||||
* A promise is returned which will resolve to:
|
|
||||||
*
|
|
||||||
* - An options object, providing a [config file](https://github.com/prettier/prettier#configuration-file) was found.
|
|
||||||
* - `null`, if no file was found.
|
|
||||||
*
|
|
||||||
* The promise will be rejected if there was an error parsing the configuration file.
|
|
||||||
*/
|
|
||||||
export function resolveConfig(filePath: string, options?: ResolveConfigOptions): Promise<null | Options>;
|
|
||||||
export namespace resolveConfig {
|
|
||||||
function sync(filePath: string, options?: ResolveConfigOptions): null | Options;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* `resolveConfigFile` can be used to find the path of the Prettier configuration file,
|
|
||||||
* that will be used when resolving the config (i.e. when calling `resolveConfig`).
|
|
||||||
*
|
|
||||||
* A promise is returned which will resolve to:
|
|
||||||
*
|
|
||||||
* - The path of the configuration file.
|
|
||||||
* - `null`, if no file was found.
|
|
||||||
*
|
|
||||||
* The promise will be rejected if there was an error parsing the configuration file.
|
|
||||||
*/
|
|
||||||
export function resolveConfigFile(filePath?: string): Promise<null | string>;
|
|
||||||
export namespace resolveConfigFile {
|
|
||||||
function sync(filePath?: string): null | string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* As you repeatedly call `resolveConfig`, the file system structure will be cached for performance. This function will clear the cache.
|
|
||||||
* Generally this is only needed for editor integrations that know that the file system has changed since the last format took place.
|
|
||||||
*/
|
|
||||||
export function clearConfigCache(): void;
|
|
||||||
|
|
||||||
export interface SupportLanguage {
|
|
||||||
name: string;
|
|
||||||
since?: string;
|
|
||||||
parsers: BuiltInParserName[] | string[];
|
|
||||||
group?: string;
|
|
||||||
tmScope?: string;
|
|
||||||
aceMode?: string;
|
|
||||||
codemirrorMode?: string;
|
|
||||||
codemirrorMimeType?: string;
|
|
||||||
aliases?: string[];
|
|
||||||
extensions?: string[];
|
|
||||||
filenames?: string[];
|
|
||||||
linguistLanguageId?: number;
|
|
||||||
vscodeLanguageIds?: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SupportOptionDefault {
|
|
||||||
since: string;
|
|
||||||
value: SupportOptionValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SupportOption {
|
|
||||||
since?: string;
|
|
||||||
type: 'int' | 'boolean' | 'choice' | 'path';
|
|
||||||
array?: boolean;
|
|
||||||
deprecated?: string;
|
|
||||||
redirect?: SupportOptionRedirect;
|
|
||||||
description: string;
|
|
||||||
oppositeDescription?: string;
|
|
||||||
default: SupportOptionValue | SupportOptionDefault[];
|
|
||||||
range?: SupportOptionRange;
|
|
||||||
choices?: SupportOptionChoice[];
|
|
||||||
category: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SupportOptionRedirect {
|
|
||||||
options: string;
|
|
||||||
value: SupportOptionValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SupportOptionRange {
|
|
||||||
start: number;
|
|
||||||
end: number;
|
|
||||||
step: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SupportOptionChoice {
|
|
||||||
value: boolean | string;
|
|
||||||
description?: string;
|
|
||||||
since?: string;
|
|
||||||
deprecated?: string;
|
|
||||||
redirect?: SupportOptionValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type SupportOptionValue = number | boolean | string;
|
|
||||||
|
|
||||||
export interface SupportInfo {
|
|
||||||
languages: SupportLanguage[];
|
|
||||||
options: SupportOption[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface FileInfoOptions {
|
|
||||||
ignorePath?: string;
|
|
||||||
withNodeModules?: boolean;
|
|
||||||
plugins?: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface FileInfoResult {
|
|
||||||
ignored: boolean;
|
|
||||||
inferredParser: string | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getFileInfo(filePath: string, options?: FileInfoOptions): Promise<FileInfoResult>;
|
|
||||||
|
|
||||||
export namespace getFileInfo {
|
|
||||||
function sync(filePath: string, options?: FileInfoOptions): FileInfoResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an object representing the parsers, languages and file types Prettier supports.
|
|
||||||
* If `version` is provided (e.g. `"1.5.0"`), information for that version will be returned,
|
|
||||||
* otherwise information for the current version will be returned.
|
|
||||||
*/
|
|
||||||
export function getSupportInfo(version?: string): SupportInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* `version` field in `package.json`
|
|
||||||
*/
|
|
||||||
export const version: string;
|
|
||||||
|
|
||||||
// https://github.com/prettier/prettier/blob/master/src/common/util-shared.js
|
|
||||||
export namespace util {
|
|
||||||
function isNextLineEmpty(text: string, node: any, options: ParserOptions): boolean;
|
|
||||||
function isNextLineEmptyAfterIndex(text: string, index: number): boolean;
|
|
||||||
function getNextNonSpaceNonCommentCharacterIndex(text: string, node: any, options: ParserOptions): number;
|
|
||||||
function makeString(rawContent: string, enclosingQuote: "'" | '"', unescapeUnnecessaryEscapes: boolean): string;
|
|
||||||
function addLeadingComment(node: any, commentNode: any): void;
|
|
||||||
function addDanglingComment(node: any, commentNode: any): void;
|
|
||||||
function addTrailingComment(node: any, commentNode: any): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://github.com/prettier/prettier/blob/master/src/doc/index.js
|
|
||||||
export namespace doc {
|
|
||||||
namespace builders {
|
|
||||||
type Doc =
|
|
||||||
| string
|
|
||||||
| Align
|
|
||||||
| BreakParent
|
|
||||||
| Concat
|
|
||||||
| Fill
|
|
||||||
| Group
|
|
||||||
| IfBreak
|
|
||||||
| Indent
|
|
||||||
| Line
|
|
||||||
| LineSuffix
|
|
||||||
| LineSuffixBoundary;
|
|
||||||
|
|
||||||
interface Align {
|
|
||||||
type: 'align';
|
|
||||||
contents: Doc;
|
|
||||||
n: number | string | { type: 'root' };
|
|
||||||
}
|
|
||||||
|
|
||||||
interface BreakParent {
|
|
||||||
type: 'break-parent';
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Concat {
|
|
||||||
type: 'concat';
|
|
||||||
parts: Doc[];
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Fill {
|
|
||||||
type: 'fill';
|
|
||||||
parts: Doc[];
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Group {
|
|
||||||
type: 'group';
|
|
||||||
contents: Doc;
|
|
||||||
break: boolean;
|
|
||||||
expandedStates: Doc[];
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IfBreak {
|
|
||||||
type: 'if-break';
|
|
||||||
breakContents: Doc;
|
|
||||||
flatContents: Doc;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Indent {
|
|
||||||
type: 'indent';
|
|
||||||
contents: Doc;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Line {
|
|
||||||
type: 'line';
|
|
||||||
soft?: boolean;
|
|
||||||
hard?: boolean;
|
|
||||||
literal?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface LineSuffix {
|
|
||||||
type: 'line-suffix';
|
|
||||||
contents: Doc;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface LineSuffixBoundary {
|
|
||||||
type: 'line-suffix-boundary';
|
|
||||||
}
|
|
||||||
|
|
||||||
function addAlignmentToDoc(doc: Doc, size: number, tabWidth: number): Doc;
|
|
||||||
function align(n: Align['n'], contents: Doc): Align;
|
|
||||||
const breakParent: BreakParent;
|
|
||||||
function concat(contents: Doc[]): Concat;
|
|
||||||
function conditionalGroup(states: Doc[], opts?: { shouldBreak: boolean }): Group;
|
|
||||||
function dedent(contents: Doc): Align;
|
|
||||||
function dedentToRoot(contents: Doc): Align;
|
|
||||||
function fill(parts: Doc[]): Fill;
|
|
||||||
function group(contents: Doc, opts?: { shouldBreak: boolean }): Group;
|
|
||||||
const hardline: Concat;
|
|
||||||
function ifBreak(breakContents: Doc, flatContents: Doc): IfBreak;
|
|
||||||
function indent(contents: Doc): Indent;
|
|
||||||
function join(separator: Doc, parts: Doc[]): Concat;
|
|
||||||
const line: Line;
|
|
||||||
function lineSuffix(contents: Doc): LineSuffix;
|
|
||||||
const lineSuffixBoundary: LineSuffixBoundary;
|
|
||||||
const literalline: Concat;
|
|
||||||
function markAsRoot(contents: Doc): Align;
|
|
||||||
const softline: Line;
|
|
||||||
}
|
|
||||||
namespace debug {
|
|
||||||
function printDocToDebug(doc: Doc): string;
|
|
||||||
}
|
|
||||||
namespace printer {
|
|
||||||
function printDocToString(doc: Doc, options: Options): {
|
|
||||||
formatted: string;
|
|
||||||
cursorNodeStart?: number;
|
|
||||||
cursorNodeText?: string;
|
|
||||||
};
|
|
||||||
interface Options {
|
|
||||||
/**
|
|
||||||
* Specify the line length that the printer will wrap on.
|
|
||||||
*/
|
|
||||||
printWidth: number;
|
|
||||||
/**
|
|
||||||
* Specify the number of spaces per indentation-level.
|
|
||||||
*/
|
|
||||||
tabWidth: number;
|
|
||||||
/**
|
|
||||||
* Indent lines with tabs instead of spaces
|
|
||||||
*/
|
|
||||||
useTabs: boolean;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
namespace utils {
|
|
||||||
function isEmpty(doc: Doc): boolean;
|
|
||||||
function isLineNext(doc: Doc): boolean;
|
|
||||||
function willBreak(doc: Doc): boolean;
|
|
||||||
function traverseDoc(doc: Doc, onEnter?: (doc: Doc) => void | boolean, onExit?: (doc: Doc) => void, shouldTraverseConditionalGroups?: boolean): void;
|
|
||||||
function mapDoc<T>(doc: Doc, callback: (doc: Doc) => T): T;
|
|
||||||
function propagateBreaks(doc: Doc): void;
|
|
||||||
function removeLines(doc: Doc): Doc;
|
|
||||||
function stripTrailingHardline(doc: Doc): Doc;
|
|
||||||
}
|
|
||||||
}
|
|
4
std/prettier/vendor/parser_babylon.d.ts
vendored
4
std/prettier/vendor/parser_babylon.d.ts
vendored
|
@ -1,4 +0,0 @@
|
||||||
import { Parser } from './index.d.ts';
|
|
||||||
|
|
||||||
declare const parser: { parsers: { [parserName: string]: Parser } };
|
|
||||||
export = parser;
|
|
11
std/prettier/vendor/parser_babylon.js
vendored
11
std/prettier/vendor/parser_babylon.js
vendored
File diff suppressed because one or more lines are too long
4
std/prettier/vendor/parser_markdown.d.ts
vendored
4
std/prettier/vendor/parser_markdown.d.ts
vendored
|
@ -1,4 +0,0 @@
|
||||||
import { Parser } from './index.d.ts';
|
|
||||||
|
|
||||||
declare const parser: { parsers: { [parserName: string]: Parser } };
|
|
||||||
export = parser;
|
|
142
std/prettier/vendor/parser_markdown.js
vendored
142
std/prettier/vendor/parser_markdown.js
vendored
File diff suppressed because one or more lines are too long
4
std/prettier/vendor/parser_typescript.d.ts
vendored
4
std/prettier/vendor/parser_typescript.d.ts
vendored
|
@ -1,4 +0,0 @@
|
||||||
import { Parser } from './index.d.ts';
|
|
||||||
|
|
||||||
declare const parser: { parsers: { [parserName: string]: Parser } };
|
|
||||||
export = parser;
|
|
24
std/prettier/vendor/parser_typescript.js
vendored
24
std/prettier/vendor/parser_typescript.js
vendored
File diff suppressed because one or more lines are too long
30
std/prettier/vendor/standalone.d.ts
vendored
30
std/prettier/vendor/standalone.d.ts
vendored
|
@ -1,30 +0,0 @@
|
||||||
import { CursorOptions, CursorResult, Options, Plugin } from './index.d.ts';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* formatWithCursor both formats the code, and translates a cursor position from unformatted code to formatted code.
|
|
||||||
* This is useful for editor integrations, to prevent the cursor from moving when code is formatted
|
|
||||||
*
|
|
||||||
* The cursorOffset option should be provided, to specify where the cursor is. This option cannot be used with rangeStart and rangeEnd.
|
|
||||||
*
|
|
||||||
* ```js
|
|
||||||
* prettier.formatWithCursor(" 1", { cursorOffset: 2, parser: "babel" });
|
|
||||||
* ```
|
|
||||||
* `-> { formatted: '1;\n', cursorOffset: 1 }`
|
|
||||||
*/
|
|
||||||
export function formatWithCursor(
|
|
||||||
source: string,
|
|
||||||
options: CursorOptions,
|
|
||||||
): CursorResult;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* `format` is used to format text using Prettier. [Options](https://github.com/prettier/prettier#options) may be provided to override the defaults.
|
|
||||||
*/
|
|
||||||
export function format(source: string, options?: Options): string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* `check` checks to see if the file has been formatted with Prettier given those options and returns a `Boolean`.
|
|
||||||
* This is similar to the `--list-different` parameter in the CLI and is useful for running Prettier in CI scenarios.
|
|
||||||
*/
|
|
||||||
export function check(source: string, options?: Options): boolean;
|
|
||||||
|
|
||||||
export as namespace prettier;
|
|
31835
std/prettier/vendor/standalone.js
vendored
31835
std/prettier/vendor/standalone.js
vendored
File diff suppressed because one or more lines are too long
|
@ -29,10 +29,6 @@ exec_time_benchmarks = [
|
||||||
("workers_round_robin", ["tests/workers_round_robin_bench.ts"]),
|
("workers_round_robin", ["tests/workers_round_robin_bench.ts"]),
|
||||||
("text_decoder", ["cli/tests/text_decoder_perf.js"]),
|
("text_decoder", ["cli/tests/text_decoder_perf.js"]),
|
||||||
("text_encoder", ["cli/tests/text_encoder_perf.js"]),
|
("text_encoder", ["cli/tests/text_encoder_perf.js"]),
|
||||||
("compile_local_prettier", ["fetch", "--reload", "std/prettier/main.ts"]),
|
|
||||||
("compile_remote_prettier",
|
|
||||||
["fetch", "--reload",
|
|
||||||
"https://deno.land/x/std@v0.29.0/prettier/main.ts"]),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
|
||||||
import os
|
|
||||||
import shutil
|
|
||||||
|
|
||||||
from test_util import DenoTestCase, run_tests
|
|
||||||
from util import mkdtemp, root_path, tests_path, run_output
|
|
||||||
|
|
||||||
|
|
||||||
class TestFmt(DenoTestCase):
|
|
||||||
def test_fmt(self):
|
|
||||||
d = mkdtemp()
|
|
||||||
try:
|
|
||||||
fixed_filename = os.path.join(tests_path,
|
|
||||||
"badly_formatted_fixed.js")
|
|
||||||
src = os.path.join(tests_path, "badly_formatted.js")
|
|
||||||
dst = os.path.join(d, "badly_formatted.js")
|
|
||||||
shutil.copyfile(src, dst)
|
|
||||||
|
|
||||||
# Set DENO_DIR to the temp dir to test an initial fetch of prettier.
|
|
||||||
# TODO(ry) This make the test depend on internet access which is not
|
|
||||||
# ideal. We should have prettier in the repo already, and we could
|
|
||||||
# fetch it instead through tools/http_server.py.
|
|
||||||
deno_dir = d
|
|
||||||
|
|
||||||
result = run_output(
|
|
||||||
[os.path.join(root_path, self.deno_exe), "fmt", dst],
|
|
||||||
cwd=d,
|
|
||||||
merge_env={"DENO_DIR": deno_dir},
|
|
||||||
exit_on_fail=True,
|
|
||||||
quiet=True)
|
|
||||||
self.assertEqual(result.code, 0)
|
|
||||||
with open(fixed_filename) as f:
|
|
||||||
expected = f.read()
|
|
||||||
with open(dst) as f:
|
|
||||||
actual = f.read()
|
|
||||||
self.assertEqual(expected, actual)
|
|
||||||
finally:
|
|
||||||
shutil.rmtree(d)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
run_tests()
|
|
|
@ -22,8 +22,8 @@ def eslint():
|
||||||
"eslint")
|
"eslint")
|
||||||
# Find all *directories* in the main repo that contain .ts/.js files.
|
# Find all *directories* in the main repo that contain .ts/.js files.
|
||||||
source_files = git_ls_files(root_path, [
|
source_files = git_ls_files(root_path, [
|
||||||
"*.js", "*.ts", ":!:std/prettier/vendor/*", ":!:std/**/testdata/*",
|
"*.js", "*.ts", ":!:std/**/testdata/*", ":!:std/**/node_modules/*",
|
||||||
":!:std/**/node_modules/*", ":!:cli/compilers/*"
|
":!:cli/compilers/*"
|
||||||
])
|
])
|
||||||
source_dirs = set([os.path.dirname(f) for f in source_files])
|
source_dirs = set([os.path.dirname(f) for f in source_files])
|
||||||
# Within the source dirs, eslint does its own globbing, taking into account
|
# Within the source dirs, eslint does its own globbing, taking into account
|
||||||
|
|
Loading…
Reference in a new issue